blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f07523adce31362aea33bf21bf6b7332f261911 | bdb880513a6d1333b3251e8986fbaa9411b049e8 | /.svn/pristine/4f/4f07523adce31362aea33bf21bf6b7332f261911.svn-base | e8882add0c2b7fe3909ea1b93f0a577f8cfa35d3 | [] | no_license | wang-shun/qmt | fe937cffe59781815fdefccdfa88362cef68b113 | c3c2e6a1bd9b4f3d852a698f64b6831b977093d1 | refs/heads/master | 2020-04-12T23:23:29.066091 | 2018-12-17T12:51:58 | 2018-12-17T12:51:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,892 | package com.lesports.qmt.sbc.service.support;
import com.google.common.collect.Lists;
import com.lesports.LeConstants;
import com.lesports.api.common.*;
import com.lesports.id.api.IdType;
import com.lesports.id.client.LeIdApis;
import com.lesports.qmt.config.api.dto.DictEntryTopType;
import com.lesports.qmt.config.client.QmtConfigApis;
import com.lesports.qmt.model.support.QmtModel;
import com.lesports.qmt.sbc.api.common.TvLicence;
import com.lesports.qmt.sbc.api.service.GetRelatedNewsParam;
import com.lesports.qmt.sbc.api.service.LiveShowStatusParam;
import com.lesports.qmt.sbc.api.service.LiveTypeParam;
import com.lesports.qmt.sbc.helper.CallerHelper;
import com.lesports.qmt.service.support.AbstractQmtService;
import com.lesports.utils.math.LeNumberUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.CriteriaDefinition;
import org.springframework.data.mongodb.core.query.Query;
import javax.annotation.Resource;
import java.io.Serializable;
import static org.springframework.data.mongodb.core.query.Criteria.where;
/**
* User: ellios
* Time: 16-3-20 : 上午11:03
*/
abstract public class AbstractSbcService<T extends QmtModel, ID extends Serializable> extends AbstractQmtService<T, ID> {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractSbcService.class);
public static final long STAR_LEVEL_THREE = 3645701000l;
public static final long STAR_LEVEL_TWO = 3645601000l;
@Resource
private CallerHelper callerHelper;
protected Criteria getCallerPayCriteria(long callerId) {
Criteria callerCriteria = null;
if (callerHelper.needFilterCaller(callerId)) {
Platform platform = callerHelper.getPlatformOfCaller(callerId);
if (platform == null) {
throw new IllegalArgumentException("illegal callerId : " + callerId);
}
callerCriteria = where("pay_platforms").is(platform);
}
return callerCriteria;
}
protected Criteria getCallerCriteria(long callerId) {
Criteria callerCriteria = null;
if (callerHelper.needFilterCaller(callerId)) {
Platform platform = callerHelper.getPlatformOfCaller(callerId);
if (platform == null) {
throw new IllegalArgumentException("illegal callerId : " + callerId);
}
callerCriteria = where("play_platforms").is(platform);
}
return callerCriteria;
}
protected Criteria getCallerCriteria4News(long callerId) {
Criteria callerCriteria = null;
if (callerHelper.needFilterCaller(callerId)) {
Platform platform = callerHelper.getPlatformOfCaller(callerId);
if (platform == null) {
throw new IllegalArgumentException("illegal callerId : " + callerId);
}
callerCriteria = where("platforms").is(platform);
}
return callerCriteria;
}
protected CriteriaDefinition getLiveShowStatusCriteria(LiveShowStatusParam liveShowStatusParam) {
if (liveShowStatusParam == null) {
return null;
}
switch (liveShowStatusParam) {
case LIVE_NOT_START:
return where("status").is(LiveShowStatus.LIVE_NOT_START);
case LIVING:
return where("status").is(LiveShowStatus.LIVING);
case LIVE_END:
return where("status").is(LiveShowStatus.LIVE_END);
case LIVE_NOT_END:
return where("status").in(Lists.newArrayList(LiveShowStatus.LIVING, LiveShowStatus.LIVE_NOT_START));
}
return null;
}
protected void addSupportLicenceCriteria(Query q, CallerParam caller) {
if (caller.getCallerId() == LeConstants.LESPORTS_TV_CIBN_CALLER_CODE) {
q.addCriteria(where("support_licences").is(TvLicence.CIBN));
} else if (caller.getCallerId() == LeConstants.LESPORTS_TV_ICNTV_CALLER_CODE) {
q.addCriteria(where("support_licences").is(TvLicence.ICNTV));
} else if (caller.getCallerId() == LeConstants.LESPORTS_TV_WASU_CALLER_CODE) {
q.addCriteria(where("support_licences").is(TvLicence.WASU));
} else if (caller.getCallerId() == LeConstants.LESPORTS_TCL_CIBN_CALLER_CODE) {
q.addCriteria(where("support_licences").is(TvLicence.CIBN));
}
if (caller.getPubChannel() == PubChannel.TCL) {//TCL过滤英超
q.addCriteria(where("related_ids").ne(100004008L));
}
}
protected void addRelatedNewsCriteriaToQuery(Query q, GetRelatedNewsParam p, CallerParam caller) {
if (p == null) {
return;
}
q.addCriteria(where("online").is(PublishStatus.ONLINE));
if (CollectionUtils.isNotEmpty(p.getRelatedIds())) {
q.addCriteria(where("related_ids").in(p.getRelatedIds()));
}
addSupportLicenceCriteria(q, caller);
if (CollectionUtils.isNotEmpty(p.getTypes())) {
q.addCriteria(where("type").in(p.getTypes()));
}
Criteria callerCriteria = getCallerCriteria4News(caller.getCallerId());
if (callerCriteria != null) {
q.addCriteria(callerCriteria);
}
//获取付费新闻
if (p.getMember() == 1) {
Criteria callerPayCriteria = getCallerPayCriteria(caller.getCallerId());
if (callerPayCriteria != null) {
q.addCriteria(callerPayCriteria);
}
}
if (p.getStar() == 1) {
q.addCriteria(where("star_level").is(STAR_LEVEL_THREE));
} else if (p.getStar() == 2) {
q.addCriteria(where("star_level").gte(STAR_LEVEL_TWO));
}
}
protected CriteriaDefinition getLiveCriteria5CallerFilter(LiveTypeParam liveTypeParam, long callerId) {
if (liveTypeParam == null) {
return null;
}
if (!callerHelper.needFilterCaller(callerId)) {
return getLiveCriteria(liveTypeParam);
}
Long splatId = callerHelper.getSplatIdOfCaller(callerId);
if (null == splatId) {
throw new IllegalArgumentException("illegal callerId : " + callerId);
}
return doGetLiveCriteria5CallerFilter(liveTypeParam, splatId);
}
protected CriteriaDefinition getLiveCriteria(LiveTypeParam liveTypeParam) {
if (liveTypeParam == null) {
return null;
}
switch (liveTypeParam) {
case ONLY_LIVE:
return where("has_live").is(true);
// case ONLY_KEY:
// return where("key").is(true);
case LIVE_OR_KEY:
return where("has_live").is(true);
case LIVE_OR_TLIVE:
return new Criteria().orOperator(where("has_live").is(true), where("has_text_live").is(true));
case LIVE_TLIVE_KEY:
return new Criteria().orOperator(where("has_live").is(true), where("has_text_live").is(true));
case NOT_ONLY_LIVE:
return null;
}
return null;
}
//和用户平台相关的过滤直播条件的查询
private CriteriaDefinition doGetLiveCriteria5CallerFilter(LiveTypeParam liveTypeParam, Long splatId) {
switch (liveTypeParam) {
case ONLY_LIVE:
return new Criteria().andOperator(where("has_live").is(true), where("live_streams.play_platforms").is(splatId));
case NOT_TLIVE:
return where("has_text_live").is(false);
// case ONLY_APP_HOMEPAGE_RECOMMEND:
// return new Criteria().andOperator(where("is_app_recommend").is(true), where("live_platforms").is(platform));
// case ONLY_KEY:
// return new Criteria().andOperator(where("key").is(true));
case LIVE_OR_KEY:
return new Criteria().andOperator(where("has_live").is(true), where("live_streams.play_platforms").is(splatId));
case LIVE_OR_TLIVE:
return new Criteria().orOperator(new Criteria().andOperator(where("has_live").is(true),
where("live_streams.play_platforms").is(splatId)),
where("has_text_live").is(true)
);
case LIVE_TLIVE_KEY://目前同LIVE_OR_TLIVE
return new Criteria().orOperator(new Criteria().andOperator(where("has_live").is(true),
where("live_streams.play_platforms").is(splatId)),
where("has_text_live").is(true)
);
case NOT_ONLY_LIVE:
return null;
}
return null;
}
protected boolean addGameTypeToQuery(Query q, long gameType) {
if (gameType <= 0) {
return false;
}
IdType idType = LeIdApis.checkIdTye(gameType);
if (idType == null) {
LOG.warn("illegal gameType : {}", gameType);
return false;
}
if (idType == IdType.COMPETITION) {
q.addCriteria(where("cid").is(gameType));
} else if (idType == IdType.DICT_ENTRY) {
DictEntryTopType entryType = QmtConfigApis.getDictEntryTopType(gameType);
if (entryType == DictEntryTopType.GAME_FIRST_TYPE) {
q.addCriteria(where("game_f_type").is(gameType));
}
if (entryType == DictEntryTopType.CHANNEL) {
q.addCriteria(where("channel_id").is(gameType));
} else {
LOG.warn("illegal gameType : {}", gameType);
return false;
}
//赛事、赛程、球队、球员、自制、话题
} else {
q.addCriteria(where("related_ids").is(gameType));
}
return true;
}
protected void addCountryAndLanguageCriteria(Query q, CallerParam caller) {
CriteriaDefinition countryCriteria = getRadioCountryCriteria(caller);
if (countryCriteria != null) {
q.addCriteria(countryCriteria);
}
CriteriaDefinition languageCriteria = getRadioLanguageCriteria(caller);
if (languageCriteria != null) {
q.addCriteria(languageCriteria);
}
}
protected CriteriaDefinition getRadioCountryCriteria(CallerParam caller) {
if (caller.getCountry() == null) {
return null;
}
return where("allow_country").is(caller.getCountry());
}
protected CriteriaDefinition getRadioLanguageCriteria(CallerParam caller) {
if (caller.getLanguage() == null) {
return null;
}
return where("language_code").is(caller.getLanguage());
}
}
| [
"ryan@192.168.3.101"
] | ryan@192.168.3.101 | |
21f8b7805bee933d37a00078be704d35943a5ce2 | e22b21109ed171e26af3ea78476dcf08b7f7f975 | /app/src/main/java/com/example/everydropcounts/DonorList.java | 8746239c5cf5cfe0423039578afc508ceb579438 | [] | no_license | NALIN25/EDC | eff43f602e86093d0b935dab37866a685df7b51b | 2153971387d07cff76ea85b16cdbf88cc11b1a41 | refs/heads/master | 2022-07-04T00:43:48.485866 | 2020-05-11T15:00:57 | 2020-05-11T15:00:57 | 263,074,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,569 | java | package com.example.everydropcounts;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import java.util.ArrayList;
import static com.example.everydropcounts.Splash.database;
public class DonorList extends AppCompatActivity {
String city;
String group;
ArrayList<String> donorList;
ListView listView;
ArrayAdapter<String> arrayAdapter;
public static ArrayList<Donor> donorInfo;
Button buttonMap;
@Override
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_donor_form);
Bundle extras = getIntent();
city = extras.getString("city");
group = extras.getString("group");
Log.i("NAME",city);
Log.i("NAME",group);
donorList = new ArrayList<>();
donorInfo = new ArrayList<>();
listView = (ListView) listView.findViewById(R.id.list_donor);
ArrayAdapter<String> adapter = new ArrayAdapter<String> (getActivity(),
android.R.layout.simple_spinner_item, donorList);
DatabaseReference myRef = database.getReference("EDCb");
myRef.child(city).child(group).addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Donor donor = dataSnapshot.getValue(Donor.class);
donorInfo.add(donor);
String donorInfo = donor.name + " \n" + donor.contactNumber;
donorList.add(donorInfo);
arrayAdapter.notifyDataSetChanged();
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private Context getActivity() {
return null;
}
private void setContentView(int activity_donor_list) {
}
private Bundle getIntent() {
return null;
}
}
| [
"nalin.uniyal1997@gmail.com"
] | nalin.uniyal1997@gmail.com |
208e812158fb8bc2fdea7f1db327e38ab67b34bf | 6958773575969a0f53603c37103c4653a28ebf93 | /app/src/main/java/inmethod/gitnotetaking/utility/MyGitUtility.java | c7f03e562db3b7ced963232ff121dd7ae38f23b2 | [] | no_license | WilliamFromTW/GitNoteTaking | 551737cd5de78b4e34df836b46327605198ec387 | 01b9c83cb15c4429e45fbac8f67e11f5eb3ef2a2 | refs/heads/master | 2023-06-10T15:27:13.377278 | 2023-05-29T02:25:45 | 2023-05-29T02:25:45 | 233,783,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,339 | java | package inmethod.gitnotetaking.utility;
import android.app.Activity;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import androidx.preference.PreferenceManager;
import org.eclipse.jgit.revwalk.RevCommit;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import inmethod.gitnotetaking.db.RemoteGit;
import inmethod.gitnotetaking.db.RemoteGitDAO;
import inmethod.jakarta.vcs.GitUtil;
public class MyGitUtility {
public static final String TAG = "GitNoteTaking";
public static final int GIT_STATUS_SUCCESS = 0;
public static final int GIT_STATUS_FAIL = -1;
public static final int GIT_STATUS_CLONING = -3;
public static final int GIT_STATUS_PULLING = -4;
public static boolean deleteLocalGitRepository(Context context, String sRemoteUrl) {
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
// Log.d(TAG, "check local repository, status = " + checkLocalGitRepository(sRemoteUrl));
if (checkLocalGitRepository(context, sRemoteUrl)) {
GitUtil aGitUtil;
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
aGitUtil.removeLocalGitRepository();
if (aGitUtil != null) aGitUtil.close();
return true;
} catch (Exception ee) {
ee.printStackTrace();
}
}
return false;
}
public static List<String> fetchGitBranches(Context context, String sRemoteUrl) {
GitUtil aGitUtil;
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
RemoteGit aRemoteGit = aRemoteGitDAO.getByURL(sRemoteUrl);
aRemoteGitDAO.close();
if (aRemoteGit == null) return null;
List<String> aReturn = null;
try {
aGitUtil = new GitUtil(sRemoteUrl, null);
aReturn = aGitUtil.fetchGitBranches(aRemoteGit.getUid(),aRemoteGit.getPwd());
if (aGitUtil != null) aGitUtil.close();
} catch (Exception ee) {
ee.printStackTrace();
}
return aReturn;
}
public static boolean push(Context context, String sRemoteUrl) {
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
RemoteGit aRemoteGit = aRemoteGitDAO.getByURL(sRemoteUrl);
if (aRemoteGit == null) return false;
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
boolean bIsRemoteRepositoryExist = false;
GitUtil aGitUtil=null;
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
bIsRemoteRepositoryExist = aGitUtil.checkRemoteRepository(aRemoteGit.getUid(), aRemoteGit.getPwd());
if (!bIsRemoteRepositoryExist) {
Log.e(TAG, "check remote url failed");
aRemoteGit.setStatus( MyGitUtility.GIT_STATUS_FAIL);
aRemoteGitDAO.update(aRemoteGit);
if (aGitUtil != null) aGitUtil.close();
return false;
}
Log.d(TAG, "Remote repository exists ? " + bIsRemoteRepositoryExist);
if (bIsRemoteRepositoryExist) {
Log.d(TAG, "try to push \n");
if (aGitUtil.push(sRemoteUrl, aRemoteGit.getUid(), aRemoteGit.getPwd())) {
Log.d(TAG, "push finished!");
aRemoteGit.setStatus(MyGitUtility.GIT_STATUS_SUCCESS);
aRemoteGitDAO.update(aRemoteGit);
aRemoteGitDAO.close();
if (aGitUtil != null) aGitUtil.close();
return true;
} else {
aRemoteGit.setStatus(MyGitUtility.GIT_STATUS_FAIL);
aRemoteGitDAO.update(aRemoteGit);
Log.d(TAG, "push failed!");
aRemoteGitDAO.close();
if (aGitUtil != null) aGitUtil.close();
return false;
}
}
if( aRemoteGitDAO!=null)
aRemoteGitDAO.close();
if (aGitUtil != null) aGitUtil.close();
return false;
} catch (Exception e) {
e.printStackTrace();
}
if (aGitUtil != null) aGitUtil.close();
return false;
}
public static boolean commit(Context context, String sRemoteUrl, String sCommitMessages) {
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
GitUtil aGitUtil=null;
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
RemoteGit aRemoteGit = aRemoteGitDAO.getByURL(sRemoteUrl);
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
String sAuthorName = aRemoteGit.getAuthor_name();
String sAuthorEmail = aRemoteGit.getAuthor_email();
aRemoteGitDAO.close();
if (aGitUtil.commit(sCommitMessages, sAuthorName, sAuthorEmail)) {
aRemoteGit.setStatus(MyGitUtility.GIT_STATUS_SUCCESS);
Log.d(TAG, "commit finished!");
if (aGitUtil != null) aGitUtil.close();
return true;
} else {
aRemoteGit.setStatus(MyGitUtility.GIT_STATUS_FAIL);
Log.d(TAG, "commit failed!");
if (aGitUtil != null) aGitUtil.close();
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
if (aGitUtil != null) aGitUtil.close();
return false;
}
public static boolean deleteByRemoteUrl(Context context, String sRemoteUrl) {
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
boolean sReturn = aRemoteGitDAO.delete(sRemoteUrl);
aRemoteGitDAO.close();
return sReturn;
}
public static ArrayList<RemoteGit> getRemoteGitList(Context context) {
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
ArrayList<RemoteGit> aList = aRemoteGitDAO.getAll();
aRemoteGitDAO.close();
return aList;
}
public static RemoteGit getRemoteGit(Context context,String sRemoteUrl) {
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
RemoteGit aReturn = aRemoteGitDAO.getByURL(sRemoteUrl);
aRemoteGitDAO.close();
return aReturn;
}
public static List<RevCommit> getLocalCommiLogtList(Context context, String sRemoteUrl) {
GitUtil aGitUtil;
List<RevCommit> aList = null;
try {
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
aList = aGitUtil.getLocalCommitIdList();
if (aGitUtil != null) aGitUtil.close();
} catch (Exception ee) {
ee.printStackTrace();
}
return aList;
}
public static boolean checkout(Context context,String sRemoteUrl){
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
RemoteGit aRemoteGit = aRemoteGitDAO.getByURL(sRemoteUrl);
if (aRemoteGit == null) return false;
String sUserName = aRemoteGit.getUid();
String sUserPassword = aRemoteGit.getPwd();
aRemoteGitDAO.close();
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
GitUtil aGitUtil;
boolean bReturn = false;
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
bReturn = aGitUtil.checkout(aRemoteGit.getBranch());
aGitUtil.close();
}catch (Exception ee){
Log.d(TAG,ee.getLocalizedMessage());
}
return bReturn;
}
public static String getLocalBranchName(Context context,String sRemoteUrl){
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
GitUtil aGitUtil;
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
String sReturn = aGitUtil.getLocalDefaultBranch();
aGitUtil.close();
return sReturn;
}catch(Exception ex){
ex.printStackTrace();
}
return null;
}
public static boolean pull(Context context, String sRemoteUrl) {
RemoteGitDAO aRemoteGitDAO = new RemoteGitDAO(context);
RemoteGit aRemoteGit = aRemoteGitDAO.getByURL(sRemoteUrl);
if (aRemoteGit == null) return false;
String sUserName = aRemoteGit.getUid();
aRemoteGit.setStatus(GIT_STATUS_PULLING);
aRemoteGitDAO.update(aRemoteGit);
String sUserPassword = aRemoteGit.getPwd();
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
boolean bIsRemoteRepositoryExist = false;
GitUtil aGitUtil;
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
bIsRemoteRepositoryExist = aGitUtil.checkRemoteRepository(sUserName, sUserPassword);
if (!bIsRemoteRepositoryExist) {
aRemoteGit.setStatus(GIT_STATUS_FAIL);
aRemoteGitDAO.update(aRemoteGit);
Log.e(TAG, "check remote url failed");
if (aGitUtil != null) aGitUtil.close();
return false;
}
Log.d(TAG, "Remote repository exists ? " + bIsRemoteRepositoryExist);
if (bIsRemoteRepositoryExist) {
Log.d(TAG, "try to update remote repository if local repository is not exists , branch="+aRemoteGit.getRemoteName());
if (aGitUtil.pull(aRemoteGit.getRemoteName(), sUserName, sUserPassword)) {
Log.d(TAG, "pull finished!");
aRemoteGit.setStatus(GIT_STATUS_SUCCESS);
aRemoteGitDAO.update(aRemoteGit);
if (aGitUtil != null) aGitUtil.close();
return true;
} else {
aRemoteGit.setStatus(GIT_STATUS_FAIL);
aRemoteGitDAO.update(aRemoteGit);
Log.d(TAG, "pull failed!");
if (aGitUtil != null) aGitUtil.close();
return false;
}
}
aRemoteGit.setStatus(GIT_STATUS_FAIL);
aRemoteGitDAO.update(aRemoteGit);
if (aGitUtil != null) aGitUtil.close();
if( aRemoteGit!=null )
aRemoteGitDAO.close();
return false;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public static boolean cloneGit(Context context, String sRemoteUrl, String sRemoteName, String sUserName, String sUserPassword) {
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
if (checkLocalGitRepository(context, sRemoteUrl)) {
return false;
}
boolean bIsRemoteRepositoryExist = false;
GitUtil aGitUtil;
try {
aGitUtil = new GitUtil(sRemoteUrl, sLocalDirectory);
bIsRemoteRepositoryExist = aGitUtil.checkRemoteRepository(sUserName, sUserPassword);
if (!bIsRemoteRepositoryExist) {
Log.e(TAG, "check remote url failed");
if (aGitUtil != null) aGitUtil.close();
return false;
}
Log.d(TAG, "Remote repository exists ? " + bIsRemoteRepositoryExist);
if (bIsRemoteRepositoryExist) {
Log.d(TAG, "try to clone remote repository if local repository is not exists \n");
if (aGitUtil.clone(sUserName, sUserPassword,1)) {
Log.d(TAG, "clone finished!");
if (aGitUtil != null) aGitUtil.close();
return true;
} else {
Log.d(TAG, "clone failed!");
if (aGitUtil != null) aGitUtil.close();
return false;
}
} else if (bIsRemoteRepositoryExist && aGitUtil.checkLocalRepository()) {
Log.d(TAG, "pull branch = " + aGitUtil.getRemoteDefaultBranch() + " , status : "
+ aGitUtil.pull(sRemoteName, sUserName, sUserPassword));
if (aGitUtil != null) aGitUtil.close();
return true;
}
return false;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public static boolean createLocalGitRepository(Activity activity, String sLocalGitName) {
try {
GitUtil aGitUtil = new GitUtil("localhost://local" + File.separator + sLocalGitName + ".git", getLocalGitDirectory(activity, "localhost://local" + File.separator + sLocalGitName + ".git"));
boolean bReturn = aGitUtil.createLocalRepository();
if (aGitUtil != null) aGitUtil.close();
return bReturn;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private static String getLocalGitDir(String sRemoteUrl) {
String sReturn = "";
if (sRemoteUrl.indexOf(".git") == -1) return sReturn;
int lastPath = sRemoteUrl.lastIndexOf("//");
if (lastPath != -1) {
sReturn = sRemoteUrl.substring(lastPath + 2);
}
if (sReturn.length() > 4)
sReturn = sReturn.substring(0, sReturn.length() - 4);
else return "";
return sReturn;
}
public static String getLocalGitDirectory(Context context, String sRemoteUrl) {
return context.getExternalFilesDir("")+
File.separator + PreferenceManager.getDefaultSharedPreferences(context).getString("GitLocalDirName", "gitnotetaking") + File.separator + getLocalGitDir(sRemoteUrl);
}
public static boolean checkLocalGitRepository(Context context, String sRemoteUrl) {
String sLocalDirectory = getLocalGitDirectory(context, sRemoteUrl);
Log.d(TAG, "default local directory = " + sLocalDirectory);
boolean bIsLocalRepositoryExist = false;
try {
bIsLocalRepositoryExist = GitUtil.checkLocalRepository(sLocalDirectory + "/.git");
Log.d(TAG, "bIsLocalRepositoryExist=" + bIsLocalRepositoryExist);
if (bIsLocalRepositoryExist) return true;
} catch (Exception ee) {
ee.printStackTrace();
}
return false;
}
}
| [
"william.fromtw@gmail.com"
] | william.fromtw@gmail.com |
3fd94b7407bad8e59643561d968e3419e26f3b4f | e460de77a46feb41963939ab77675ac3dc698975 | /app/src/main/java/com/ai/mycar/net/NetworkCommunicator.java | 19a89bbce3127c878db87604bf6618ea672ccf65 | [] | no_license | pyus13/ConnectCarClient | 30a0327662a838eb09072de4d8d6414994a73d3a | a0131a9cf7d2b541fc3c0f674bf31d376c0fd54e | refs/heads/master | 2021-06-11T21:55:19.841094 | 2017-01-11T04:17:38 | 2017-01-11T04:17:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,800 | java | package com.ai.mycar.net;
import com.ai.mycar.model.APIResponse;
import com.ai.mycar.model.DeviceInfo;
import com.ai.mycar.model.User;
import com.ai.mycar.rx.RegistrationManager;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by TCS Mumbai Mobility
* User : Piyush Agarwal 559339(dksc102950).
* Date : 1/10/17
* Time : 12:56 AM
*/
public class NetworkCommunicator {
private static NetworkCommunicator instance;
private RegisterationAPI mRegisterationAPI;
private RegistrationManager mRegistrationManager;
public static NetworkCommunicator getInstance() {
if (instance == null) {
synchronized (NetworkCommunicator.class) {
if (null == instance) {
instance = new NetworkCommunicator();
}
}
}
return instance;
}
private NetworkCommunicator() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://connect-car.herokuapp.com")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
mRegisterationAPI = retrofit.create(RegisterationAPI.class);
mRegistrationManager = RegistrationManager.getInstance();
}
public void registerUser(User user) {
Call<APIResponse> userRequest = mRegisterationAPI.createUser(user);
userRequest.enqueue(new Callback<APIResponse>() {
@Override
public void onResponse(Call<APIResponse> call, Response<APIResponse> response) {
mRegistrationManager.setUserResponse(response.body());
}
@Override
public void onFailure(Call<APIResponse> call, Throwable throwable) {
}
});
}
public void registerDevice(DeviceInfo device) {
Call<APIResponse> deviceRegisterRequest = mRegisterationAPI.registerDevice(device);
deviceRegisterRequest.enqueue(new Callback<APIResponse>() {
@Override
public void onResponse(Call<APIResponse> call, Response<APIResponse> response) {
mRegistrationManager.setDeviceRegisterResponse(response.body());
}
@Override
public void onFailure(Call<APIResponse> call, Throwable throwable) {
}
});
}
}
| [
"piyush.agarwal2@dcsg.com"
] | piyush.agarwal2@dcsg.com |
47b7fda4b5757cbc7238a17622436ac1c6e1a880 | e4e2cfe448703fd820150a6bf69fa66f90f3d916 | /src/main/java/br/com/utily/ecommerce/service/application/dashboard/IDashboardService.java | d6869965b189ed8e053ab3b8ef781114c75fa197 | [] | no_license | hanseld28/utily-ecommerce | 91b1f11837c3a2d1cdbf0e99a4015fb863d004bc | d8e0e9ac2c09234e923747840d4db4cfd98055d5 | refs/heads/master | 2023-02-04T16:52:42.496805 | 2020-12-12T21:59:24 | 2020-12-12T21:59:24 | 314,137,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package br.com.utily.ecommerce.service.application.dashboard;
import br.com.utily.ecommerce.entity.Entity;
import br.com.utily.ecommerce.service.IService;
import org.springframework.stereotype.Component;
@Component
public interface IDashboardService<T extends Entity> extends IService<T> {
}
| [
"hansel.donizete@gmail.com"
] | hansel.donizete@gmail.com |
8af6e07974710a1572df2d4c8006d20786e20413 | c105e86479efaf1a33149eca9af00d0ed188e030 | /src/main/java/com/kcsj/gwglxt/controller/DepartmentManage/DepartmentController.java | 697c71553793ce8d894b9b7e17e3dbb086cc5a14 | [] | no_license | sinobeloved/gwspxt_Backstage | 255dfd96c4390bbca63b2c7440cafff8b6d3100a | e01408a8da52b66b327c47827144290f6be46b2e | refs/heads/master | 2023-06-28T00:51:33.208234 | 2018-06-29T01:23:11 | 2018-06-29T01:23:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,815 | java | package com.kcsj.gwglxt.controller.DepartmentManage;
import com.kcsj.gwglxt.DTO.LoginCustom;
import com.kcsj.gwglxt.DTO.PositionPermission;
import com.kcsj.gwglxt.entity.Department;
import com.kcsj.gwglxt.entity.Permission;
import com.kcsj.gwglxt.entity.Position;
import com.kcsj.gwglxt.service.departmentManage.DepartmentService;
import com.kcsj.gwglxt.vo.QueryForPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.List;
@RestController
@CrossOrigin(origins = "*")
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
/****************************************8部门管理**************************/
//添加部门
@RequestMapping("/addDepartment")
public String addDepartment(@RequestBody Department department,HttpSession httpSession){
String result;
if(departmentService.getDptByName(department.getDepartmentName())){
int addResult = 0;
try {
LoginCustom loginCustom = (LoginCustom) httpSession.getAttribute("LoginInformation");
addResult = departmentService.insert(department,loginCustom);
} catch (Exception e) {
e.printStackTrace();
}
//判断执行文档添加操作返回的结果,返回结果为数据库中受影响行数
if (addResult == 0) {
result = "addFailed";
}else{
result = "addSuccess";
}
return "{\"msg\":\"" + result + "\"}";
}else {
result = "departmenntExist";
return "{\"msg\":\"" + result + "\"}";
}
}
//获得所有部门
@RequestMapping("/getAllDepartment")
public QueryForPage getAllDepartment(int currentPage, String fuzzySearch){
QueryForPage queryForPage = null;
try {
queryForPage = departmentService.getAllDepartment(currentPage,fuzzySearch);
} catch (Exception e) {
e.printStackTrace();
}
return queryForPage;
}
//获得所有部门(不分页)
@RequestMapping("/getAllDepartmentNoPage")
public List<Department> getAllDepartmentNoPage(){
List<Department> departments = null;
try {
departments = departmentService.getAllDepartmentNoPage();
} catch (Exception e) {
e.printStackTrace();
}
return departments;
}
//按部门查询职位权限
@RequestMapping("/getPoPeByDpt")
public List<PositionPermission> getPoPeByDpt(String department){
List<PositionPermission> positionPermissions = null;
try {
positionPermissions = departmentService.getPoPeByDpt(department);
} catch (Exception e) {
e.printStackTrace();
}
return positionPermissions;
}
//查询所有权限
@RequestMapping("/getAllPermission")
public List<Permission> getAllPermission(){
List<Permission> permissions = null;
try {
permissions = departmentService.getAllPermission();
} catch (Exception e) {
e.printStackTrace();
}
return permissions;
}
//添加职位
@RequestMapping("/addPosition")
public String addPosition(@RequestBody Position position,HttpSession httpSession){
String result;
if(departmentService.getPosotionName(position.getPositionName())){
int addResult = 0;
try {
LoginCustom loginCustom = (LoginCustom) httpSession.getAttribute("LoginInformation");
addResult = departmentService.insertPosition(position,loginCustom);
} catch (Exception e) {
e.printStackTrace();
}
//判断执行文档添加操作返回的结果,返回结果为数据库中受影响行数
if (addResult == 0) {
result = "addFailed";
}else{
result = "addSuccess";
}
return "{\"msg\":\"" + result + "\"}";
}else {
result = "positionExist";
return "{\"msg\":\"" + result + "\"}";
}
}
//修改职位权限
@RequestMapping("/updatePermission")
public String updatePermission(@RequestBody Position position,HttpSession httpSession){
String result;
int updateResult = 0;
try {
LoginCustom loginCustom = (LoginCustom) httpSession.getAttribute("LoginInformation");
updateResult = departmentService.updatePermission(position,loginCustom);
} catch (Exception e) {
e.printStackTrace();
}
//判断执行文档添加操作返回的结果,返回结果为数据库中受影响行数
if (updateResult == 0) {
result = "addFailed";
}else{
result = "addSuccess";
}
return "{\"msg\":\"" + result + "\"}";
}
//修改部门信息
@RequestMapping("/updateDptInfo")
public String updateDptInfo(@RequestBody Department department,HttpSession httpSession){
String result;
int updateResult = 0;
try {
LoginCustom loginCustom = (LoginCustom) httpSession.getAttribute("LoginInformation");
updateResult = departmentService.updateDptInfo(department,loginCustom);
} catch (Exception e) {
e.printStackTrace();
}
//判断执行文档添加操作返回的结果,返回结果为数据库中受影响行数
if (updateResult == 0) {
result = "addFailed";
}else{
result = "addSuccess";
}
return "{\"msg\":\"" + result + "\"}";
}
}
| [
"37685063+xiajichen@users.noreply.github.com"
] | 37685063+xiajichen@users.noreply.github.com |
ea4def6c90b143062c7ab0e4987b3946e3a17696 | d8496734848d8fb6b510fd53e5ec45f74c7cd035 | /org.jerkar.core/src/main/java/org/jerkar/api/depmanagement/JkDependencyExclusions.java | e1faeb108088ff131cdc92d51463294f3be30fc5 | [
"Apache-2.0"
] | permissive | dejan2609/jerkar | f2e969def0158ab357bf46d6ab7d993780ad7043 | 9cdd5df28d130d5559ad59efc7ded92a9c4bfbfb | refs/heads/master | 2021-01-02T22:53:45.557589 | 2017-08-04T15:06:08 | 2017-08-04T15:06:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,658 | java | package org.jerkar.api.depmanagement;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jerkar.api.utils.JkUtilsIterable;
/**
* Holds information about transitive dependencies to exclude.
*
* @author Jerome Angibaud
*/
public class JkDependencyExclusions {
private final Map<JkModuleId, List<JkDepExclude>> exclusions;
private JkDependencyExclusions(Map<JkModuleId, List<JkDepExclude>> exclusions) {
super();
this.exclusions = Collections.unmodifiableMap(exclusions);
}
/**
* Creates a builder for {@link JkDependencyExclusions}.
*/
public static Builder builder() {
return new Builder();
}
/**
* Returns the modules on which some transitive dependencies are excluded.
*/
public Set<JkModuleId> moduleIds() {
return this.exclusions.keySet();
}
/**
* Returns the transitive dependency module to exclude to the specified module.
*/
public List<JkDepExclude> get(JkModuleId moduleId) {
return exclusions.get(moduleId);
}
/**
* Returns <code>true</code> if this object contains no exclusion.
*/
public boolean isEmpty() {
return this.exclusions.isEmpty();
}
/**
* A builder for {@link JkDependencyExclusions}.
*/
public static class Builder {
Builder() {
}
private final Map<JkModuleId, List<JkDepExclude>> exclusions = new HashMap<JkModuleId, List<JkDepExclude>>();
/**
* Adds specified exclusions on the specified module.
*/
public Builder on(JkModuleId moduleId, JkDepExclude... depExcludes) {
return on(moduleId, Arrays.asList(depExcludes));
}
/**
* Adds specified exclusions on the specified module.
*/
public Builder on(JkModuleId moduleId, String... excludedModuleIds) {
final List<JkDepExclude> depExcludes = new LinkedList<JkDepExclude>();
for (final String excludeId : excludedModuleIds) {
depExcludes.add(JkDepExclude.of(excludeId));
}
return on(moduleId, depExcludes);
}
/**
* Adds specified exclusions on the specified module.
*/
public Builder on(String groupAndName, String... excludedModuleIds) {
return on(JkModuleId.of(groupAndName), excludedModuleIds);
}
/**
* Adds specified exclusions on the specified module.
*/
public Builder on(JkModuleId moduleId, Iterable<JkDepExclude> depExcludes) {
List<JkDepExclude> excludes = exclusions.get(moduleId);
if (excludes == null) {
excludes = new LinkedList<JkDepExclude>();
exclusions.put(moduleId, excludes);
}
excludes.addAll(JkUtilsIterable.listOf(depExcludes));
return this;
}
/**
* Creates a {@link JkDependencyExclusions} based on this builder content.
*/
public JkDependencyExclusions build() {
final Map<JkModuleId, List<JkDepExclude>> map = new HashMap<JkModuleId, List<JkDepExclude>>();
for (final JkModuleId moduleId : exclusions.keySet()) {
map.put(moduleId, Collections.unmodifiableList(exclusions.get(moduleId)));
}
return new JkDependencyExclusions(map);
}
}
}
| [
"djeangdev@yahoo.fr"
] | djeangdev@yahoo.fr |
651ec146da60ce78d4299e0bc1eb3df0b8709afc | d6b6de48d1c1893dd6e6d32c12236c83980fb4fa | /LibroBiblioteca/src/com/company/Libro.java | 92685a3d1250d8a9000926f00ee2fe171d29c550 | [] | no_license | rpf1980/EjerciciosTIPOexamen | ab518759e1a9eb4663959b045b563be1c87a8e67 | 3aa19624f7bf30c1cfcd8a007242b6b26af8c66a | refs/heads/master | 2020-05-18T14:46:14.030215 | 2019-05-28T12:50:03 | 2019-05-28T12:50:03 | 184,479,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,514 | java | package com.company;
import java.security.InvalidParameterException;
public class Libro
{
//Atributos
private String isbn;
private String titulo;
private String autor;
private int nPaginas;
private boolean leido = true;
//propiedades
public String getIsbn() {
return isbn;
}
public String getTitulo() {
return titulo;
}
public String getAutor() {
return autor;
}
public int getnPaginas() {
return nPaginas;
}
public boolean isLeido() {
return leido;
}
public void setLeido(boolean leido) {
this.leido = leido;
}
//Constructor
public Libro (String isbn, String titulo, String autor, int nPaginas)
{
if (isbn.equals("")||titulo.equals("")||autor.equals("")||nPaginas<0)
{
throw new InvalidParameterException("Los parámetros nombre, titulo, autor no puede estar vacío y el número de páginas debe ser superior a 0");
}
else
{
this.isbn = isbn;
this.titulo = titulo;
this.autor = autor;
this.nPaginas = nPaginas;
this.setLeido(false);
}
}
//Metodo
public String toString ()
{
String datos;
if (this.leido)
{
datos = this.titulo + " (" + this.autor + ") [LEÍDO]";
}
else
{
datos = this.titulo + " (" + this.autor + ")";
}
return datos;
}
}
| [
"united_ssh@outlook.com"
] | united_ssh@outlook.com |
241cab35037405ffd9910b633f2aa3059ec00080 | 8bc8038babd1e278c63d533fc7a351cac7ef4905 | /mybatis/src/main/java/org/apache/ibatis/reflection/SystemMetaObject.java | aa675c887cb13faa180d549d066a89c3d5028cb3 | [] | no_license | jinbaizhe/mybatis | a336709bca5f81b8b9b7931f2603348aa4f6a21e | 1726a7a63762e9200864564473ecb30570487842 | refs/heads/main | 2023-06-24T02:29:07.984538 | 2021-07-27T12:16:29 | 2021-07-27T12:16:29 | 361,598,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,716 | java | /*
* Copyright 2009-2015 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.apache.ibatis.reflection;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
/**
* @author Clinton Begin
*/
public final class SystemMetaObject {
public static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
public static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
public static final MetaObject NULL_META_OBJECT = MetaObject.forObject(NullObject.class, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
private SystemMetaObject() {
// Prevent Instantiation of Static Class
}
private static class NullObject {
}
public static MetaObject forObject(Object object) {
return MetaObject.forObject(object, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
}
}
| [
"jinbaizhe@leoao.com"
] | jinbaizhe@leoao.com |
a319080153500abcb169cbd74f49fb4756185ab1 | 12fb0b0ef5b84729bc0cab1415594b0c263d3d7f | /src/it524/misc/ex2/Tenor.java | 512aa0cdc92318c7c3389b671a779a88587468f9 | [] | no_license | yspolat/java-101 | fe487dd6336bfa223962ad7fb197298e05dabc63 | c1488611464daedf684ff29dc8a7b84a8dae63f1 | refs/heads/master | 2020-04-23T17:33:53.329494 | 2019-03-03T20:13:06 | 2019-03-03T20:13:06 | 171,336,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package it524.misc.ex2;
public class Tenor extends Singer{
public static String sing(){
return "fa";
}
public static void main(String[] args){
Tenor t = new Tenor();
Singer s = new Tenor();
System.out.println(t.sing() + "" + s.sing());
}
}
class Singer {
public static String sing() {
return "la";
}
}
| [
"yspolat@gmail.com"
] | yspolat@gmail.com |
efd635a7d237d9570ccd888c77d203e68b2e2495 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/21_geo-google-oasis.names.tc.ciq.xsdschema.xal._2.ThoroughfareNumberPrefix-0.5-8/oasis/names/tc/ciq/xsdschema/xal/_2/ThoroughfareNumberPrefix_ESTest.java | e56333b05d32bf6a2766c7cde8d9404ae4d2b04f | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | /*
* This file was automatically generated by EvoSuite
* Tue Oct 29 16:05:57 GMT 2019
*/
package oasis.names.tc.ciq.xsdschema.xal._2;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class ThoroughfareNumberPrefix_ESTest extends ThoroughfareNumberPrefix_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pderakhshanfar@bsr01.win.tue.nl"
] | pderakhshanfar@bsr01.win.tue.nl |
f58d80c5fa75020f2a969cb38184758a9f8b3e71 | 485960a10641e051f9ffeb45d4b7b66ac82e60ff | /src/main/java/com/ThreeFoolsStudios/SpectralMod/init/SpectralBlocks.java | bfb68049432c43c33b9cbf2321f708b4f1033502 | [] | no_license | Lhaldenby/Minecraft-Mod | 80e12ec4d52963bc8a1bd40fbf03bc78c2a263f2 | 7ce6f20995b4dd1f7244ae5344b4b1c642fe9c38 | refs/heads/master | 2022-12-15T01:29:35.364945 | 2020-09-14T22:52:10 | 2020-09-14T22:52:10 | 295,554,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,171 | java | package com.ThreeFoolsStudios.SpectralMod.init;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import com.ThreeFoolsStudios.SpectralMod.Reference;
import com.ThreeFoolsStudios.SpectralMod.SpectralMod;
import com.ThreeFoolsStudios.SpectralMod.blocks.BlockLight;
import com.ThreeFoolsStudios.SpectralMod.blocks.BlockSpectralAltar;
import com.ThreeFoolsStudios.SpectralMod.blocks.BlockTest;
import com.ThreeFoolsStudios.SpectralMod.blocks.ForgeBlockTileEntity;
import com.ThreeFoolsStudios.SpectralMod.blocks.OreTest;
public class SpectralBlocks {
//this creates an instance of the blocks that i want to add into my mod
public static Block Necromantic_Crystal;
public static Block Arcane_Ore;
public static Block Elemental_Stone;
public static Block Spectral_Altar;
public static Block Spectral_Stone;
public static Block Spectral_Gem_Block;
public static Block Spectral_Shard_Forge;
public static Block Spectral_Barrier;
public static Block Spectral_Light;
public static void init() { //this initialises each block and gives it properties
Necromantic_Crystal = new OreTest(Material.rock).setHardness(5) //this decides what material the block will sound liek when broken
.setUnlocalizedName("Necromantic_Crystal") //.setHardness sets how long the block takes to mine
.setCreativeTab(SpectralMod.tabSpectral); //.setUnlocalizedName sets the name of the block.
//.setCreativeTab sets what tab the block will be found in, in creative mod
Arcane_Ore = new OreTest(Material.rock).setHardness(5) //this is the same for the previous block
.setUnlocalizedName("Arcane_Ore")
.setCreativeTab(SpectralMod.tabSpectral);
;
Elemental_Stone = new OreTest(Material.rock).setHardness(5) //this is the same for the previous block
.setUnlocalizedName("Elemental_Stone")
.setCreativeTab(SpectralMod.tabSpectral);
;
Spectral_Altar = new BlockSpectralAltar(Material.rock).setHardness(5) //this is the same for the previous block
.setUnlocalizedName("Spectral_Altar")
.setCreativeTab(SpectralMod.tabSpectral);
;
Spectral_Stone = new BlockTest(Material.rock).setHardness(5) //this is the same for the previous block
.setUnlocalizedName("Spectral_Stone")
.setCreativeTab(SpectralMod.tabSpectral);
;
Spectral_Gem_Block = new BlockTest(Material.rock).setHardness(5) //this is the same for the previous block
.setUnlocalizedName("Spectral_Gem_Block")
.setCreativeTab(SpectralMod.tabSpectral);
;
Spectral_Shard_Forge = new ForgeBlockTileEntity(Material.rock).setHardness(2)
.setUnlocalizedName("Spectral_Shard_Forge") //this is the same for the previous block, but with a lower mine time
.setCreativeTab(SpectralMod.tabSpectral);
Spectral_Barrier = new BlockTest(Material.rock).setHardness(50)
.setUnlocalizedName("Spectral_Barrier") //this is the same for the previous block, but with a higher mine time
.setCreativeTab(SpectralMod.tabSpectral);
Spectral_Light = new BlockLight (Material.glass).setHardness(2)
.setUnlocalizedName("Spectral_Light")
.setCreativeTab(SpectralMod.tabSpectral);
}
public static void register() { //this registers the blocks to the game and sets their names
GameRegistry.registerBlock(Necromantic_Crystal, Necromantic_Crystal
.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Arcane_Ore, Arcane_Ore.getUnlocalizedName()
.substring(5));
GameRegistry.registerBlock(Elemental_Stone, Elemental_Stone
.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Spectral_Altar, Spectral_Altar
.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Spectral_Stone, Spectral_Stone
.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Spectral_Gem_Block, Spectral_Gem_Block
.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Spectral_Barrier, Spectral_Barrier
.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Spectral_Shard_Forge,
Spectral_Shard_Forge.getUnlocalizedName().substring(5));
GameRegistry.registerBlock(Spectral_Light,
Spectral_Light.getUnlocalizedName().substring(5));
}
public static void registerRenders() { //this sets the textures names for each block
registerRender(Necromantic_Crystal);
registerRender(Arcane_Ore);
registerRender(Elemental_Stone);
registerRender(Spectral_Altar);
registerRender(Spectral_Stone);
registerRender(Spectral_Gem_Block);
registerRender(Spectral_Barrier);
registerRender(Spectral_Shard_Forge);
registerRender(Spectral_Light);
}
public static void registerRender(Block block) { //this sets the item texture for the blocks in the inventory
Item item = Item.getItemFromBlock(block);
Minecraft
.getMinecraft()
.getRenderItem()
.getItemModelMesher()
.register(
item,
0,
new ModelResourceLocation(Reference.MOD_ID + ":"
+ item.getUnlocalizedName().substring(5),
"inventory"));
}
}
| [
"32489947+Lhaldenby@users.noreply.github.com"
] | 32489947+Lhaldenby@users.noreply.github.com |
20215a0bc779a37838669f0b4de9d5bee8cbdc7f | d0516470440eb0e881b768a95764d8156e6d91c1 | /app/src/main/java/mike/machine/retrofit/model/APIService.java | 6d98beb7b9d453c258a330b345303dd73ea26500 | [] | no_license | mike-one/RetrofitJava | ef936a3545ae961a35c6893fd230826e960d1ab5 | 4aac07696b7a5cee13736b334c8ec6cf7ce08f61 | refs/heads/master | 2023-02-01T11:24:23.384340 | 2020-12-22T05:05:55 | 2020-12-22T05:05:55 | 323,490,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package mike.machine.retrofit.model;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import rx.Observable;
public interface APIService {
@POST("/posts") //Esto se agregará a la URL
@FormUrlEncoded // Esto indicará que la petición tendrá su tipo MIME y UTF8
Call<Post> savePost(@Field("title") String title,
@Field("body") String body,
@Field("userId") long userId);
}
| [
"migue.un.av@gmail.com"
] | migue.un.av@gmail.com |
d70f9d62be932c8721ac82f942b09adadc326f28 | d675d52839819dd1260bd3c62d08b6d5f4fa29a2 | /deliverables/ANAC_Builder/cefespdbuilder/src/main/java/it/anticorruzione/cefespdbuilder/model/bean/ListElement.java | 34b889431878f0d3b14076c98f529fd7f4ff5b78 | [] | no_license | MarcoGiovannetti/eNEIDE | 3ca65a2e854eeeedacdd308d9cf534f55dce74cd | af6751162054aec60d033af909d1dfc935564aab | refs/heads/master | 2023-01-22T23:28:48.444907 | 2020-11-25T13:21:55 | 2020-11-25T13:21:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | /**
* CEF European single procurement document builder
*/
package it.anticorruzione.cefespdbuilder.model.bean;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
public class ListElement {
private String value;
private String listId;
private String listAgencyId;
private String listVersionId;
/**
* @return the listId
*/
public String getListId() {
return listId;
}
/**
* @return the value
*/
@XmlValue()
public String getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
/**
* @param listId the listId to set
*/
@XmlAttribute(name = "listID")
public void setListId(String listId) {
this.listId = listId;
}
/**
* @return the listAgencyId
*/
public String getListAgencyId() {
return listAgencyId;
}
/**
* @param listAgencyId the listAgencyId to set
*/
@XmlAttribute(name = "listAgencyID")
public void setListAgencyId(String listAgencyId) {
this.listAgencyId = listAgencyId;
}
/**
* @return the listVersionId
*/
public String getListVersionId() {
return listVersionId;
}
/**
* @param listVersionId the listVersionId to set
*/
@XmlAttribute(name = "listVersionID")
public void setListVersionId(String listVersionId) {
this.listVersionId = listVersionId;
}
} | [
"Paolo Filosa@192.168.163.60"
] | Paolo Filosa@192.168.163.60 |
8a9725e38b6637c09cdd96986cbdff7ade0c881f | 18548f77bbf824a6af4b8273d498319eb1fb9e38 | /WheelskartFront/src/main/java/com/niit/controller/CategoryController.java | cb54e2c7007b370eb42a9483427dd12248553823 | [] | no_license | mrahulbisht/Project | 13e412025476c938bca7b0e934b3fdc31c7c7706 | 1a5dd26f17a368e05454eebd9e6f9922eb2bb835 | refs/heads/master | 2020-04-05T14:02:04.381951 | 2017-07-24T09:18:27 | 2017-07-24T09:18:27 | 94,744,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,799 | java | package com.niit.controller;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.niit.dao.CategoryDAO;
import com.niit.domain.Category;
@Controller
public class CategoryController {
private static Logger log = LoggerFactory.getLogger(CategoryController.class);
//create category
//fetch all categories
//delete category
//update category
@Autowired CategoryDAO categorydAO;
@Autowired Category category;
@Autowired HttpSession session;
//@RequestMapping("/manage_category_add")
@GetMapping("/manage_category_add")
public ModelAndView createCategory(@RequestParam("id") String id,
@RequestParam("name") String name, @RequestParam("description") String desc)
{
log.debug("Starting of the method manageCategories");
category.setId(id);
category.setName(name);
category.setDescription(desc);
ModelAndView mv = new ModelAndView("Home");
mv.addObject("isAdminClickedCategories", "true");
mv.addObject("isAdmin", "true");
//Before calling save method, check whether the category id already exist in db or not
//if it is does not exist, then only call save method
if (categorydAO.getCategoryByID(id) !=null)
{
//category already exist
mv.addObject("message", "Category already exist with teh id " +id);
return mv;
}
else // actualy else is not required if return statement is there in if condition
{
categorydAO.save(category);
mv.addObject("message", "Category created successfuly ");
}
session.setAttribute("categoryList", categorydAO.list());
session.setAttribute("category", category);
log.debug("End of the method manageCategories");
return mv;
}
@RequestMapping("/manage_category_delete/{id}")
public ModelAndView deleteCategory(@PathVariable("id") String id)
{
log.debug("Starting of the method deleteCategory");
log.debug("You are going to delete " + id);
ModelAndView mv = new ModelAndView("Home");
if( categorydAO.delete(id))
{
mv.addObject("message", "successfully deleted the category");
}
else
{
mv.addObject("message", "Not able to delte the category");
}
session.setAttribute("categoryList", categorydAO.list());
session.setAttribute("category", category);
log.debug("Ending of the method deleteCategory");
return mv;
}
}
| [
"coolrahul.997@gmail.com"
] | coolrahul.997@gmail.com |
197a37cdd0ff12f357d70d8cde10ff3f5d1918ae | 20495c23dcec01d77546a1407331ccf84c5ed631 | /src/main/java/org/team639/lib/commands/DriveCommand.java | 393d883f33e1e0128ab2d605106f35ef97820ea2 | [] | no_license | CRRobotics/2019robot | ca73ed1c0f9ab14370305647f30737252b71f1db | c7a27c44ced55a89c6857238107c3578fc812cf4 | refs/heads/master | 2020-04-15T00:34:08.370968 | 2019-10-27T03:01:25 | 2019-10-27T03:01:25 | 164,245,070 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | package org.team639.lib.commands;
import edu.wpi.first.wpilibj.command.Command;
/**
* A command subclass for use with {@link DriveThread} via {@link ThreadedDriveCommand}.
* @see ThreadedDriveCommand
* @see DriveThread
*/
public abstract class DriveCommand extends Command {
public DriveCommand(String name) {
super(name);
}
@Override
protected abstract void initialize();
@Override
protected abstract void execute();
@Override
protected abstract void end();
@Override
protected abstract void interrupted();
@Override
protected abstract boolean isFinished();
@Override
public synchronized void start() throws IllegalCallerException {
throw new IllegalCallerException("This command should only be started through a ThreadedDriveCommand wrapper to run on a separate thread.");
}
}
| [
"theProgrammerJack@gmail.com"
] | theProgrammerJack@gmail.com |
8f81a1767a44f82239c2a4b32eedb0110246b8b8 | 0c9e783b4a5ddd212c965b854c7c3d56e32bd85b | /src/ocp11/ch10/review/Dog.java | 07d7e3fee841be4d8c7f97ec37bd7998759c98ba | [] | no_license | mhussainshah1/OCPStudyGuide | 831209f2e7b224f213e486c68d764fb4ce30963d | 4248454a0f217cd9494cf929ff64078e34c5444e | refs/heads/master | 2023-06-08T16:01:34.619559 | 2021-06-16T12:07:34 | 2021-06-16T12:07:34 | 319,525,558 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package ocp11.ch10.review;
public class Dog {
public String name;
public void parseName() {
System.out.print("1");
try {
System.out.print("2");
int x = Integer.parseInt(name);
System.out.print("3");
} catch (NumberFormatException e) {
System.out.print("4");
}
}
public static void main(String[] args) {
Dog leroy = new Dog();
leroy.name = "Leroy";
leroy.parseName();
System.out.print("5");
}
}
| [
"muhammadshah.14@sunymaritime.edu"
] | muhammadshah.14@sunymaritime.edu |
1755b506ef955ff7649fc631b63c7bbbff281c91 | 237b275a818a6ea4248f1a58a20f9915346bc0d9 | /src/test/java/io/bootique/tapestry/testapp2/bq/TestApp2BootiqueModule.java | b3e11fabce09505a61ed32e2e1c479c277ad10da | [
"Apache-2.0"
] | permissive | const1993/bootique-tapestry | b0a0a213c929b5ddb9bb03c5a8d4e17d485a2426 | 7aa6506e997b21041e6976ae8362ea501f89d6b2 | refs/heads/master | 2020-03-19T21:18:41.410962 | 2018-06-09T01:01:03 | 2018-06-09T01:01:03 | 136,935,754 | 0 | 0 | Apache-2.0 | 2018-06-11T14:12:01 | 2018-06-11T14:11:59 | Java | UTF-8 | Java | false | false | 274 | java | package io.bootique.tapestry.testapp2.bq;
import com.google.inject.Binder;
import com.google.inject.Module;
public class TestApp2BootiqueModule implements Module {
@Override
public void configure(Binder binder) {
binder.bind(BQEchoService.class);
}
}
| [
"andrus@objectstyle.com"
] | andrus@objectstyle.com |
73d3b2843e7c459dd9439231482bc858a318acbe | 8310384cefc2ede9b9c656bb936838462b8c5193 | /PostParser/src/postParser/Term.java | d22bacd0d8ca5a0803614dfa530f7c4b54dfb127 | [] | no_license | ErikHedberg/Calculator-Parsing-Algorithms | 0ff7c1c08b16ef8d106cdebb2dc6b51f3598fb59 | 40291b0e280d0e4f485b6b0df094f86559b72405 | refs/heads/master | 2020-04-19T19:19:38.770958 | 2019-01-30T17:34:08 | 2019-01-30T17:34:08 | 168,385,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package postParser;
public class Term {
String name = "Term"; //Name
String rep = ""; //String representation
String type = "Term"; //Type of term
Term(){}
Term(String n, String r, String t) {
name = n;
rep = r;
type = t;
}
}
| [
"snowbelowFTW@gmail.com"
] | snowbelowFTW@gmail.com |
8cd171f3d690b839a58ec6c3b49e6eef9439704f | e9d9d51d6f943c2f9664e189c5cf9faa84ea4a18 | /xc-model/src/main/java/com/zwb/demo/xc/domain/report/ReportCompany.java | cba83e03c58e058f25e5ee3b174c259aef849103 | [] | no_license | zhouwenbin00/xc-service | c24b23701e60024dbf43989c064d3693178a2a68 | 8ea4dc77a12ca16bce07271769125863763b71d6 | refs/heads/master | 2022-12-08T07:40:43.136198 | 2019-11-04T09:39:45 | 2019-11-04T09:39:45 | 211,318,855 | 0 | 0 | null | 2022-11-24T06:27:06 | 2019-09-27T12:52:31 | Java | UTF-8 | Java | false | false | 590 | java | package com.zwb.demo.xc.domain.report;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
/** Created by admin on 2018/2/27. */
@Data
@ToString
@Document(collection = "report_company")
public class ReportCompany {
@Id private String id;
private Float evaluation_score; // 评价分数(平均分)
private Float good_scale; // 好评率
private Long course_num; // 课程数
private Long student_num; // 学生人数
private Long play_num; // 播放次数
}
| [
"2825075112@qq.com"
] | 2825075112@qq.com |
1075854fa8b3d42c5f4a42edf9f9d7b262ed8a41 | 1ca6653d2b82b6ae27f34c123a79e0ebedf6d58b | /Ford mHealth Delivery Folder/Golden Hour/Crash Simulation with OpenXC/VehicleSimulationCrashApp/src/com/openxc/vehicle/crash/app/InfoAdapter.java | 63e7408113f3dd1676f188e8f1c3bb0bf1f50861 | [
"BSD-3-Clause"
] | permissive | emarsman/FordMobilityHealth | 77dc90033a9e2e480b65623d9f765c907de9ed4e | fb0031ee7cf99a21fd1185ac679511dbd9a06734 | refs/heads/master | 2020-05-25T11:27:27.887133 | 2016-03-17T20:12:20 | 2016-03-17T20:12:20 | 46,130,066 | 2 | 2 | null | 2015-11-13T15:30:25 | 2015-11-13T15:30:25 | null | UTF-8 | Java | false | false | 1,847 | java | package com.openxc.vehicle.crash.app;
import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class InfoAdapter extends BaseAdapter{
ArrayList<String> groupNamelist, groupValuelist;
Context context;
public LayoutInflater inflater;
public InfoAdapter(Context cnxt,
ArrayList<String> nodeNamelist, ArrayList<String> nodeValelist) {
// TODO Auto-generated constructor stub
super();
this.context=cnxt;
this.groupNamelist=nodeNamelist;
this.groupValuelist=nodeValelist;
this.inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return groupNamelist.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
public static class ViewHolder
{
TextView txtViewGrpName;
TextView txtViewGrptxt;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder;
if(convertView==null)
{
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.listitem_row, null);
holder.txtViewGrpName = (TextView) convertView.findViewById(R.id.txtViewTitle);
holder.txtViewGrptxt = (TextView) convertView.findViewById(R.id.txtViewDescription);
convertView.setTag(holder);
}
else
holder=(ViewHolder)convertView.getTag();
holder.txtViewGrpName.setText(groupNamelist.get(position));
holder.txtViewGrptxt.setText(groupValuelist.get(position));
return convertView;
}
}
| [
"akhileshkg@LP-E4115B4943CD.HCLT.CORP.HCL.IN"
] | akhileshkg@LP-E4115B4943CD.HCLT.CORP.HCL.IN |
935c2dbd6a1fe0071a5d25afde1c1e4c9354c47d | 6f8fd9d15fc23b3453fc9ad4dd9ae4923667d0c3 | /src/main/java/com/soinsoftware/petcity/bll/VaccineBll.java | f789cc82680cc3cf9646c99c3f2cddd7aa641980 | [] | no_license | SOINSOFTWARE/petcity-model | 3d64e686a6f8f744461f4ba2632bace2c86316dc | dff5f4509594e5eda35954c7619dee9f01eb41cf | refs/heads/master | 2020-03-26T07:06:43.455508 | 2018-12-11T04:03:38 | 2018-12-11T04:03:38 | 144,636,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | // Soin Software, 2018
package com.soinsoftware.petcity.bll;
import java.io.IOException;
import java.math.BigInteger;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import com.soinsoftware.petcity.dao.VaccineDao;
import com.soinsoftware.petcity.model.Company;
import com.soinsoftware.petcity.model.Vaccine;
/**
* @author Carlos Rodriguez
* @since 22/11/2018
*/
public class VaccineBll extends AbstractBll<Vaccine, BigInteger> {
private static VaccineBll instance;
private VaccineBll() throws IOException {
super(new VaccineDao());
}
public List<Vaccine> select(Company company) {
List<Vaccine> vaccines = ((VaccineDao) dao).select(company);
return vaccines.stream().sorted(Comparator.comparing(Vaccine::getName)).collect(Collectors.toList());
}
public static VaccineBll getInstance() throws IOException {
if (instance == null) {
instance = new VaccineBll();
}
return instance;
}
} | [
"crodriguez@signal.co"
] | crodriguez@signal.co |
5ea13019cab46b04694b035276bcfc8a62c17882 | d35a8a7eade926785878d27eb10a4331c430d198 | /lichkin-projects-cashier-desk-apis-generator/src/test/java/com/lichkin/application/LKApiGeneratorRunner.java | af83688cea465682f8f84884edc726c89f5c1fbe | [
"MIT"
] | permissive | LichKinContributor/lichkin-projects-cashier-desk | f918a5903b360e2e00fb9013869080b3747ea094 | bae790a9ea1e62e21295fb38fc0ac4fa66aa49ea | refs/heads/master | 2022-07-04T16:51:35.814189 | 2018-11-02T17:56:11 | 2018-11-02T17:56:11 | 155,856,036 | 0 | 0 | MIT | 2022-06-21T00:51:49 | 2018-11-02T11:20:56 | JavaScript | UTF-8 | Java | false | false | 1,431 | java | package com.lichkin.application;
import org.junit.Test;
import com.lichkin.springframework.generator.LKApiGenerator;
import com.lichkin.springframework.generator.LKApiGenerator.Type;
public class LKApiGeneratorRunner {
String projectDir = Thread.currentThread().getContextClassLoader().getResource(".").getPath().replace("/target/test-classes/", "");
String apiType = "WEB";
String userType = "ADMIN";
int index = 0;
int errorCode = 170000;
@Test
public void generateInsert() {
LKApiGenerator.generate(userType, apiType, projectDir, "", index, errorCode, Type.Insert, "新增数据接口");
}
@Test
public void generateUpdate() {
LKApiGenerator.generate(userType, apiType, projectDir, "", index, errorCode, Type.Update, "编辑数据接口");
}
@Test
public void generatePage() {
LKApiGenerator.generate(userType, apiType, projectDir, "", index, errorCode, Type.GetPage, "获取分页数据接口");
}
@Test
public void generateList() {
LKApiGenerator.generate(userType, apiType, projectDir, "", index, errorCode, Type.GetList, "获取列表数据接口");
}
@Test
public void generateOne() {
LKApiGenerator.generate(userType, apiType, projectDir, "", index, errorCode, Type.GetOne, "获取单个数据接口");
}
@Test
public void generateUS() {
LKApiGenerator.generate(userType, apiType, projectDir, "", index, errorCode, Type.UpdateUsingStatus, "修改状态接口");
}
}
| [
"zhuangxuxin@hotmail.com"
] | zhuangxuxin@hotmail.com |
d0143a68568a3a0c9d4bd785027204d10f232696 | cadd6c7807f21c53c5675d6312427bc44336cb24 | /common/tile/Decoration.java | 712b6c5288f60e9260b3a4d477319408b1dbb690 | [] | no_license | Hologuardian/LD29 | d5c13ad271e57489bb3ae10f5b336154fc4dc61e | d40fea06fadd7381c47bccbc56d0cb559434976a | refs/heads/master | 2021-03-12T19:41:23.129633 | 2014-05-13T23:40:31 | 2014-05-13T23:40:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,984 | java | package holo.common.tile;
import holo.common.world.World;
import org.newdawn.slick.Color;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.*;
public class Decoration
{
public Image[] tex;
public Shape bb;
public Vector2f loc;
public World world;
public int frameTime;
public float lightLevel;
public boolean collidable;
public LightSource light;
public float theta;
public long timer;
/**
*
* @param world
* @param coords
* @param texture
* @param size
* @param theta
* @param collidable
* @param lightLevel
* @param frameTime
*/
public Decoration(World world, Vector2f coords, String[] texture, float[] size, float theta, boolean collidable, float lightLevel, int frameTime)
{
tex = new Image[texture.length];
try
{
for(int i = 0; i < texture.length; ++i)
{
tex[i] = new Image(texture[i]);
}
}
catch(SlickException e)
{
e.printStackTrace();
}
loc = coords;
this.world = world;
this.theta = theta;
this.collidable = collidable;
this.lightLevel = lightLevel;
this.frameTime = frameTime;
bb = new Rectangle(coords.getX(), coords.getY(), size[0], size[1]);
this.light = new LightSource(this.getCenterCoords(), this.lightLevel, Color.blue);
}
public void update(int delta)
{
timer += delta;
if(this.isLight())
{
this.light.setCoords(this.getCenterCoords());
this.light.setStrength(lightLevel + timer % 8);
}
}
public boolean collidable()
{
return collidable;
}
public boolean isLight()
{
return lightLevel > 0;
}
public Vector2f getCoords()
{
return loc;
}
public Vector2f getCenterCoords()
{
return new Vector2f(getBB().getCenter());
}
public Image getFrame(int i)
{
return tex[i];
}
public int getNumFrames()
{
return tex.length;
}
public int getFrameTime()
{
return frameTime;
}
public Shape getBB()
{
return bb;
}
public float getRotation()
{
return theta;
}
}
| [
"namaeskram@gmail.com"
] | namaeskram@gmail.com |
954b07c0ad87fb3b8af51d7aaa175ca4826953e5 | 2949e292590d972c6d7f182f489f8f86a969cd69 | /Module4/02_spring_controller/practive/01_check_email/src/main/java/com/example/service/impl/ValidateServiceImpl.java | 74a9725633ce79a69a6146faa7e3e0d2a7ebf249 | [] | no_license | hoangphamdong/C0221G1-hoangphamdon | 13e519ae4c127909c3c1784ab6351f2ae23c0be0 | 7e238ca6ce80f5cce712544714d6fce5e3ffb848 | refs/heads/master | 2023-06-23T07:50:07.790174 | 2021-07-21T10:22:20 | 2021-07-21T10:22:20 | 342,122,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java | package com.example.service.impl;
import com.example.service.IValidateService;
import org.springframework.stereotype.Service;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service
public class ValidateServiceImpl implements IValidateService {
private static final String EMAIL_REGEX = "^[A-Za-z0-9]+[A-Za-z0-9]*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)$";
private static Pattern pattern;
private Matcher matcher;
@Override
public boolean validate(String email) {
pattern = Pattern.compile(EMAIL_REGEX);
matcher = pattern.matcher(email);
return matcher.matches();
}
}
| [
"hpdongbmt@gmail.com"
] | hpdongbmt@gmail.com |
2947b39144658a94e75197922e488ab3ab1b1c69 | 7893db1b9dbcb205dd6d035c19cea3f72244a98c | /src/cn/appsys/dao/backenduser/BackendUserMapper.java | 6f9c1cb64cb328faabd19f39b241c7d86e0897a2 | [] | no_license | desl0451/AppInfoSystem | edc8f80a7bd94ea40f8756ba0249bcae70e6ca85 | 755894c37d1d67f789aa908f0eea29f152e97de7 | refs/heads/master | 2021-01-23T09:36:03.213855 | 2017-12-20T07:54:59 | 2017-12-20T07:54:59 | 101,382,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package cn.appsys.dao.backenduser;
import org.apache.ibatis.annotations.Param;
import cn.appsys.pojo.BackendUser;
public interface BackendUserMapper {
/**
* 通过userCode获取User
* @param userCode
* @return
* @throws Exception
*/
public BackendUser getLoginUser(@Param("userCode")String userCode)throws Exception;
}
| [
"desl0451@126.com"
] | desl0451@126.com |
455f9b9dbe531722767a24a7b925562aadc62210 | f7be02486fdbcc518b9f71a79639d49e255eb917 | /src/main/java/com/jhipster/poc/config/WebConfigurer.java | e73e18cf727da496cf7f69c3790d0091e1ba4472 | [] | no_license | srinivasa-sameer/Jhipster | 4d762186fefb7523423ff5980e7cf534381380a4 | 8e06914ed6af5abb4a4fc8feb97d1847bd202dca | refs/heads/main | 2023-04-28T19:49:11.389550 | 2021-05-10T08:34:46 | 2021-05-10T08:34:46 | 365,973,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,389 | java | package com.jhipster.poc.config;
import static java.net.URLDecoder.decode;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.*;
import javax.servlet.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.server.*;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import org.springframework.util.CollectionUtils;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.config.JHipsterProperties;
/**
* Configuration of web application with Servlet 3.0 APIs.
*/
@Configuration
public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> {
private final Logger log = LoggerFactory.getLogger(WebConfigurer.class);
private final Environment env;
private final JHipsterProperties jHipsterProperties;
public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) {
this.env = env;
this.jHipsterProperties = jHipsterProperties;
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
if (env.getActiveProfiles().length != 0) {
log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles());
}
log.info("Web application fully configured");
}
/**
* Customize the Servlet engine: Mime types, the document root, the cache.
*/
@Override
public void customize(WebServerFactory server) {
// When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
setLocationForStaticAssets(server);
}
private void setLocationForStaticAssets(WebServerFactory server) {
if (server instanceof ConfigurableServletWebServerFactory) {
ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
File root;
String prefixPath = resolvePathPrefix();
root = new File(prefixPath + "target/classes/static/");
if (root.exists() && root.isDirectory()) {
servletWebServer.setDocumentRoot(root);
}
}
}
/**
* Resolve path prefix to static resources.
*/
private String resolvePathPrefix() {
String fullExecutablePath;
try {
fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
/* try without decoding if this ever happens */
fullExecutablePath = this.getClass().getResource("").getPath();
}
String rootPath = Paths.get(".").toUri().normalize().getPath();
String extractedPath = fullExecutablePath.replace(rootPath, "");
int extractionEndIndex = extractedPath.indexOf("target/");
if (extractionEndIndex <= 0) {
return "";
}
return extractedPath.substring(0, extractionEndIndex);
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = jHipsterProperties.getCors();
if (!CollectionUtils.isEmpty(config.getAllowedOrigins())) {
log.debug("Registering CORS filter");
source.registerCorsConfiguration("/api/**", config);
source.registerCorsConfiguration("/management/**", config);
source.registerCorsConfiguration("/v2/api-docs", config);
source.registerCorsConfiguration("/v3/api-docs", config);
source.registerCorsConfiguration("/swagger-resources", config);
source.registerCorsConfiguration("/swagger-ui/**", config);
}
return new CorsFilter(source);
}
}
| [
"srinivasaddepalli13@gmail.com"
] | srinivasaddepalli13@gmail.com |
32e06ec408af34caf6992aec0ccf0da875f36841 | 3524ff6fd067e95aa0b52180be380d965ded22e4 | /src/main/java/com/jiacy/app/设计模式/行为型/模板方法模式/RoomOwnerChuzhu.java | 29eaa4543ea7b208d07fa33a50d2cde8e9938554 | [] | no_license | jiacywork/study_notes | a1eb6a13611132c580b0ffc487f0258a9449e78c | 18e1e45dd9b888b4d954bee686545b1d20cc7615 | refs/heads/master | 2023-04-13T00:31:13.745522 | 2021-04-21T12:40:21 | 2021-04-21T12:40:21 | 290,371,957 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.jiacy.app.设计模式.行为型.模板方法模式;
public class RoomOwnerChuzhu implements AbstractRoomOwner {
@Override
public int operate(Room room) {
System.out.println("房屋已出租:" + room.getRoomId());
return room.getRoomId();
}
}
| [
"jiacywork@outlook.com"
] | jiacywork@outlook.com |
4cb388bbbee81bf7b08262190b5f15330523840a | acbcfd40ce14645f3327d6ba8c6a7f32c411f5b5 | /activos/src/main/java/com/prueba/activos/repository/ActivoRepo.java | c38e660da4e58a4ef6bf9da9d8f4d2c7b4ab8da4 | [] | no_license | carv85x/prueba-backend | f73006e79da0c6c47f628759d1f7e999f80f0617 | a42a9dfea7323e24b6b5de78972d43f5045aed6b | refs/heads/main | 2023-09-01T01:05:35.875464 | 2021-10-12T13:06:04 | 2021-10-12T13:06:04 | 413,799,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.prueba.activos.repository;
import java.util.Date;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.prueba.activos.model.ActivoModel;
@CrossOrigin(origins = "http://localhost:4200")
public interface ActivoRepo extends JpaRepository<ActivoModel, Long> {
public List<ActivoModel> findBySerial(String serial);
public List<ActivoModel> findByFechaCompra(Date fechaCompra);
public List<ActivoModel> findByTipo(String tipo);
}
| [
"carv85x@gmail.com"
] | carv85x@gmail.com |
ed03e456e2bceec95265f5e49d22dd0f34fd26fe | a36888e8137cf426c022aee467121c27f32a8bb5 | /AeonAudio/apisdk/src/main/java/com/home/apisdk/apiController/GetValidateUserAsynTask.java | 9a6f2b01212798a5e82ae27932a92d7f217fd6d6 | [] | no_license | pratikjoshi999/AeonAudio | 17227d443e56e0ce6b54e8831e5c35e41daf5ecc | d5bff2286c3bff04b1f39524af3e7012bff6669a | refs/heads/master | 2021-05-06T07:45:50.734500 | 2017-12-12T12:38:54 | 2017-12-12T12:38:54 | 113,966,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,021 | java | package com.home.apisdk.apiController;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import com.home.apisdk.APIUrlConstant;
import com.home.apisdk.apiModel.ValidateUserInput;
import com.home.apisdk.apiModel.ValidateUserOutput;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
/**
* Created by Muvi on 12/16/2016.
*/
public class GetValidateUserAsynTask extends AsyncTask<ValidateUserInput, Void, Void> {
ValidateUserInput validateUserInput;
String responseStr;
int status;
String message,PACKAGE_NAME;
String validuser_str;
public interface GetValidateUser{
void onGetValidateUserPreExecuteStarted();
void onGetValidateUserPostExecuteCompleted(ValidateUserOutput validateUserOutput, int status, String message);
}
/* public class GetContentListAsync extends AsyncTask<Void, Void, Void> {*/
private GetValidateUser listener;
private Context context;
ValidateUserOutput validateUserOutput=new ValidateUserOutput();
public GetValidateUserAsynTask(ValidateUserInput validateUserInput,GetValidateUser listener, Context context) {
this.listener = listener;
this.context=context;
this.validateUserInput = validateUserInput;
PACKAGE_NAME=context.getPackageName();
}
@Override
protected Void doInBackground(ValidateUserInput... params) {
try {
// Execute HTTP Post Request
try {
URL url = new URL(APIUrlConstant.getValidateUserForContentUrl());
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(20000);
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
conn.setDoInput(true);
conn.setDoOutput(true);
Log.v("SUBHA", "this.validateUserInput.getUserId()" + this.validateUserInput.getUserId());
Log.v("SUBHA","this.validateUserInput.getUserId()"+this.validateUserInput.getMuviUniqueId());
Log.v("SUBHA","this.validateUserInput.getUserId()"+this.validateUserInput.getAuthToken());
Log.v("SUBHA","this.validateUserInput.getUserId()"+this.validateUserInput.getEpisodeStreamUniqueId());
Log.v("SUBHA","this.validateUserInput.getUserId()"+this.validateUserInput.getSeasonId());
Log.v("SUBHA","this.validateUserInput.getUserId()"+this.validateUserInput.getLanguageCode());
Log.v("SUBHA","this.validateUserInput.getUserId()"+this.validateUserInput.getPurchaseType());
Uri.Builder builder = new Uri.Builder()
.appendQueryParameter("authToken", this.validateUserInput.getAuthToken())
.appendQueryParameter("user_id", this.validateUserInput.getUserId())
.appendQueryParameter("movie_id", this.validateUserInput.getMuviUniqueId())
.appendQueryParameter("episode_id", this.validateUserInput.getEpisodeStreamUniqueId())
.appendQueryParameter("season_id", this.validateUserInput.getSeasonId())
.appendQueryParameter("lang_code", this.validateUserInput.getLanguageCode())
.appendQueryParameter("purchase_type", this.validateUserInput.getPurchaseType());
String query = builder.build().getEncodedQuery();
Log.v("SUBHA", "authToken" +this.validateUserInput.getAuthToken());
Log.v("SUBHA", "user_id" +this.validateUserInput.getUserId());
Log.v("SUBHA", "movie_id" +this.validateUserInput.getMuviUniqueId());
OutputStream os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
writer.write(query);
writer.flush();
writer.close();
os.close();
int responseCode = conn.getResponseCode();
if (responseCode != HttpsURLConnection.HTTP_OK) {
final InputStream err = conn.getErrorStream();
try {
} finally {
InputStreamReader isr = new InputStreamReader(err);
BufferedReader in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
responseStr = inputLine;
Log.v("SUBHA", "responseStr" +responseStr);
}
in.close();
err.close();
}
}else{
InputStream ins = conn.getInputStream();
InputStreamReader isr = new InputStreamReader(ins);
BufferedReader in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
responseStr = inputLine;
Log.v("SUBHA", "responseStr" +responseStr);
}
in.close();
}
} catch (org.apache.http.conn.ConnectTimeoutException e){
status = 0;
message = "Error";
Log.v("SUBHA", "ConnectTimeoutException" +e);
}catch (IOException e) {
status = 0;
message = "Error";
Log.v("SUBHA", "IOException" +e);
}
JSONObject mainJson =null;
if(responseStr!=null) {
mainJson = new JSONObject(responseStr);
status = Integer.parseInt(mainJson.optString("code"));
if ((mainJson.has("msg")) && mainJson.getString("msg").trim() != null && !mainJson.getString("msg").trim().isEmpty() && !mainJson.getString("msg").trim().equals("null") && !mainJson.getString("msg").trim().matches("")) {
validateUserOutput.setMessage(mainJson.getString("msg"));
message = mainJson.getString("msg");
}
if ((mainJson.has("member_subscribed")) && mainJson.getString("member_subscribed").trim() != null && !mainJson.getString("member_subscribed").trim().isEmpty() && !mainJson.getString("member_subscribed").trim().equals("null") && !mainJson.getString("member_subscribed").trim().matches("")) {
validateUserOutput.setIsMemberSubscribed(mainJson.getString("member_subscribed"));
}
if ((mainJson.has("status")) && mainJson.getString("status").trim() != null && !mainJson.getString("status").trim().isEmpty() && !mainJson.getString("status").trim().equals("null") && !mainJson.getString("status").trim().matches("")) {
validateUserOutput.setValiduser_str(mainJson.getString("status"));
validuser_str = mainJson.getString("status");
}
}
else{
responseStr = "0";
status = 0;
message = "Error";
}
} catch (final JSONException e1) {
Log.v("SUBHA", "JSONException" +e1);
responseStr = "0";
status = 0;
message = "Error"; }
catch (Exception e)
{
Log.v("SUBHA", "Exception" +e);
responseStr = "0";
status = 0;
message = "Error";
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
listener.onGetValidateUserPreExecuteStarted();
status = 0;
/* if(!PACKAGE_NAME.equals(CommonConstants.user_Package_Name_At_Api))
{
this.cancel(true);
message = "Packge Name Not Matched";
listener.onGetVideoLogsPostExecuteCompleted(status, message,videoLogId);
return;
}
if(CommonConstants.hashKey.equals(""))
{
this.cancel(true);
message = "Hash Key Is Not Available. Please Initialize The SDK";
listener.onGetVideoLogsPostExecuteCompleted(status, message, videoLogId);
}*/
}
@Override
protected void onPostExecute(Void result) {
listener.onGetValidateUserPostExecuteCompleted(validateUserOutput, status, message);
}
}
| [
"pratikjoshi999@gmail.com"
] | pratikjoshi999@gmail.com |
edbd4d5e1e701aa5d03951e052e1e89a0a8134c8 | 2d9c82b18091cf57721aae048c9a59765a05e1fa | /src/main/java/com/vicent/demo/service/ProductService.java | 53f14018236039c239a1c85a1ebc98f98cd8ab56 | [] | no_license | Chao-Che-Wei/springboot_demo | 381b8974fed8bd87caaa1e79767ca2d20038da3c | 9827d530177b937164f39a9e7238ac8ed17c7885 | refs/heads/master | 2022-12-16T22:47:23.947091 | 2020-09-20T04:01:24 | 2020-09-20T04:01:24 | 295,327,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,173 | java | package com.vicent.demo.service;
import com.vicent.demo.converter.ProductConverter;
import com.vicent.demo.entity.Product;
import com.vicent.demo.entity.ProductRequest;
import com.vicent.demo.entity.ProductResponse;
import com.vicent.demo.exception.ConflictException;
import com.vicent.demo.exception.NotFoundException;
import com.vicent.demo.parameter.ProductQueryParameter;
import com.vicent.demo.repository.MockProductDAO;
import com.vicent.demo.repository.ProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
public class ProductService {
private ProductRepository repository;
private MailService mailService;
public ProductService(ProductRepository repository, MailService mailService){
this.repository = repository;
this.mailService = mailService;
}
public Product getProduct(String id) {
return repository.findById(id)
.orElseThrow(() -> new NotFoundException("Can't find product."));
}
public ProductResponse getProductResponse(String id) {
Product product = repository.findById(id)
.orElseThrow(() -> new NotFoundException("Can't find product."));
return ProductConverter.toProductResponse(product);
}
public ProductResponse createProduct(ProductRequest request) {
Product product = ProductConverter.toProduct(request);
repository.insert(product);
mailService.sendNewProductMail(product.getId());
return ProductConverter.toProductResponse(product);
}
public ProductResponse replaceProduct(String id, ProductRequest request) {
Product oldProduct = getProduct(id);
Product newProduct = ProductConverter.toProduct(request);
newProduct.setId(oldProduct.getId());
repository.save(newProduct);
return ProductConverter.toProductResponse(newProduct);
}
public void deleteProduct(String id) {
repository.deleteById(id);
mailService.sendDeleteProductMail(id);
}
public List<ProductResponse> getProducts(ProductQueryParameter param) {
String namekeyword = Optional.ofNullable(param.getKeyword()).orElse("");
int priceFrom = Optional.ofNullable(param.getPriceFrom()).orElse(0);
int priceTo = Optional.ofNullable(param.getPriceTo()).orElse(Integer.MAX_VALUE);
Sort sort = configureSort(param.getOrderBy(), param.getSortRule());
List<Product> products = repository.findByPriceBetweenAndNameLikeIgnoreCase(priceFrom, priceTo, namekeyword, sort);
return products.stream()
.map(ProductConverter::toProductResponse)
.collect(Collectors.toList());
}
private Sort configureSort(String orderBy, String sortRule) {
Sort sort = Sort.unsorted();
if(Objects.nonNull(orderBy) && Objects.nonNull(sort)){
Sort.Direction direction = Sort.Direction.fromString(sortRule);
sort = new Sort(direction, orderBy);
}
return sort;
}
}
| [
"s9920107.ee03g@g2.nctu.edu.tw"
] | s9920107.ee03g@g2.nctu.edu.tw |
1eb6f0cd867abe0ec3b85343377ad8a53e564e2f | f2397e97005309503cccd518f1f469124221480b | /src/test/java/com/spring/test/ConTest.java | 83f07708b2cdfb92855b8a0bc6e3f6fad4b1a750 | [] | no_license | zhinanzhen/allweb | b40a861e9f8072f1621ed611abf3344e8594a942 | d37d72311fe9fb7a9cb208bd214b70ecd2661f48 | refs/heads/master | 2022-06-01T06:37:43.805989 | 2022-05-17T14:04:16 | 2022-05-17T14:04:16 | 86,280,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.spring.test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application.xml")
public class ConTest {
}
| [
"1756912408@qq.com"
] | 1756912408@qq.com |
810da732cf333dc5f2f773fbdf2cac9cd386708b | fd35b42e61637be05c407cd3ceeb227ddb97d2e1 | /src/main/java/org/openflow/protocol/action/OFActionDecap.java | 08e5941e69485caeda420f4bd94d38c3816f3ea2 | [
"Apache-2.0"
] | permissive | byyu/ovx-merge2 | 629a5235223d8cfbc9dca849d5fa872b32c9534e | 3fd3d97e70176188488767e3a8dcb7d9d0f57cf2 | refs/heads/master | 2020-12-31T07:20:01.799001 | 2016-05-09T07:50:30 | 2016-05-09T07:50:30 | 58,352,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,084 | java | /*******************************************************************************
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/**
* Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
* University
*
* 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.
**/
/**
* @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
*/
package org.openflow.protocol.action;
import java.util.Arrays;
import net.onrc.openvirtex.packet.IPv4;
import net.onrc.openvirtex.util.MACAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.openflow.protocol.OFPhysicalPort;
/**
* Represents an ofp_action_dl_addr
*
* @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
*/
//kllaf
public class OFActionDecap extends OFAction {
public static int MINIMUM_LENGTH = 8;
public OFActionDecap() {
super();
super.setType(OFActionType.DECAP);
super.setLength((short) OFActionDecap.MINIMUM_LENGTH);
}
@Override
public void readFrom(final ChannelBuffer data) {
super.readFrom(data);
data.readInt();
}
@Override
public void writeTo(final ChannelBuffer data) {
super.writeTo(data);
data.writeInt((int)0);
}
@Override
public int hashCode() {
final int prime = 347;
int result = super.hashCode();
result = prime * result;
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof OFActionDecap)) {
return false;
}
return true;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append(this.type);
return builder.toString();
}
}
| [
"koreagood13@gmail.com"
] | koreagood13@gmail.com |
ac01a12818995d148d41d32e5584974766a6e66b | aadbbfff16e00d015caa99fea5f852bff5b9d786 | /KTP8/src/Crawler.java | 4fb3bf4d4b4088a5eb3634bd0a9e8cfcbed30e41 | [] | no_license | etherealeon/kjava | 646da479b8080ac098d190fb9056c2eff95b95e0 | e0517929fb3a27abc5ee26f6452241987d95eac3 | refs/heads/master | 2021-05-26T16:15:17.536617 | 2020-05-30T11:56:01 | 2020-05-30T11:56:01 | 254,132,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class Crawler implements Runnable {
final static int AnyDepth = 0;
private URLPool Pool;
@Override
public void run() {
try {
Scan();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
public Crawler(URLPool pool) {
Pool = pool;
}
private void Scan() throws IOException, InterruptedException {
while (true) {
Process(Pool.get());
}
}
private void Process(URLDepthPair pair) throws IOException{
URL url = new URL(pair.getURL());
URLConnection connection = url.openConnection();
String redirect = connection.getHeaderField("Location");
if (redirect != null) {
connection = new URL(redirect).openConnection();
}
Pool.addProcessed(pair);
if (pair.getDepth() == 0) return;
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String input;
while ((input = reader.readLine()) != null) {
String prefix = "http";
while (input.contains("a href=\"" + prefix)) {
input = input.substring(input.indexOf("a href=\"" + prefix) + 8);
String link = input.substring(0, input.indexOf('\"'));
if(link.contains(" "))
link = link.replace(" ", "%20");
if (Pool.getNotProcessed().contains(new URLDepthPair(link, AnyDepth)) ||
Pool.getProcessed().contains(new URLDepthPair(link, AnyDepth))) continue;
Pool.addNotProcessed(new URLDepthPair(link, pair.getDepth() - 1));
}
}
reader.close();
}
}
| [
"mrr696@yandex.ru"
] | mrr696@yandex.ru |
ed055281c32b6ee9789d91e4b88a2703ae147a2c | 63a9536edde213eb5771c294f5a657becbd382da | /src/org/dao/LoginDao_5_12.java | 8087c816683bc10473c02567d513ba3160f937d3 | [] | no_license | s1256ve/WebSSH | 61b4f603e254a71d76b73f0ed9b350897a0a40de | 78945f531c7b036adb968259249b5ec21127f37c | refs/heads/master | 2020-05-29T23:43:45.688807 | 2019-06-19T05:47:47 | 2019-06-19T05:47:47 | 189,442,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package org.dao;
import org.DBConn.DBConn;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.model.Login_5_12;
import org.model.Login_5_12;
public class LoginDao_5_12 {
public static void add(Login_5_12 l) {
Session sn=DBConn.conn();
Transaction tx=sn.beginTransaction();
sn.save(l);
tx.commit();
}
public static Login_5_12 load(int id) {
Session sn=DBConn.conn();
return (Login_5_12)sn.get(Login_5_12.class, new Integer(id));
}
public static void update(int id,Login_5_12 lf) {
Session sn=DBConn.conn();
Login_5_12 b=load(id);
b.setName(lf.getName());
Transaction tx=sn.beginTransaction();
sn.update(b);
tx.commit();
}
public static void delete(int id) {
Session sn=DBConn.conn();
Login_5_12 b=load(id);
Transaction tx=sn.beginTransaction();
sn.delete(b);
tx.commit();
}
public static void main(String[] args) {
//add(new Login_5_12("c", "c",true));
}
}
| [
"s1256ve@gmail.com"
] | s1256ve@gmail.com |
936720a399c1b84b289aa7c2ff615bd6dd71d9e7 | a54d534ffb53525ce9c2ca6bceed8899d23789b9 | /src/Prog26.java | 444bf9ca31ae25f96a927fec4e4fd3cc049ddb23 | [] | no_license | abhiMishka/codingPractice | 51c736d3455fec19f4a65d442de71e36df76900b | 88202acec076283e2a79e6052cc9a0beddd6e4e5 | refs/heads/master | 2020-12-06T00:46:34.704555 | 2020-05-10T14:15:43 | 2020-05-10T14:15:43 | 232,291,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | import java.util.HashMap;
/**
* https://www.educative.io/courses/grokking-the-coding-interview/YQQwQMWLx80
*/
public class Prog26 extends BaseTestClass {
public static void main(String[] args) {
print(findLength("cbbebi",3));
}
public static int findLength(String str, int k) {
int i=0;
int j=0;
int maxLength = -1;
int len = 0;
HashMap<Character,Boolean> map = new HashMap<>();
while(i<str.length() && j<str.length()){
char current = str.charAt(i);
if(!map.containsKey(current)){
map.put(current,true);
}
if(map.size()==k){
len = i-j;
if(len>maxLength){
maxLength = len;
}
i++;
}else if(map.size()>k){
map.remove(str.charAt(j));
j++;
}else{
i++;
}
}
return maxLength+1;
}
}
| [
"abhishek.k@loconav.com"
] | abhishek.k@loconav.com |
2e63b42f01c8a49f040cac0cc36eb33e419f3b9c | 880951a37ddcf51d4d8459fade973f1ef19a5865 | /src/main/java/finalproject/persistance/dao/impl/PriceDaoImpl.java | 3af2e76f6dbe88f869fbc372e1080d532babb2a2 | [] | no_license | tatochka1993/Price_Service | ae5c96a49fa00442ab0dd26981b723743c3a7ccf | 65a70d028a45d4c73558cc13d0181cafd441453c | refs/heads/master | 2021-01-23T07:15:57.117968 | 2017-01-31T09:36:28 | 2017-01-31T09:36:28 | 80,507,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,861 | java | package finalproject.persistance.dao.impl;
import finalproject.model.Price;
import finalproject.persistance.dao.PriceDao;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@SuppressWarnings("unchecked")
public class PriceDaoImpl implements PriceDao {
private static final String GET_ALL_PRICES = "FROM Price";
private static final String COUNT_ALL_PRICES = "SELECT COUNT(*) FROM Price";
@Autowired
private SessionFactory sessionFactory;
@Override
public double getCostById(int id) {
return (Double) sessionFactory.getCurrentSession()
.createQuery("SELECT cost FROM Price Where idProduct = " + id).uniqueResult();
}
@Override
public void update(int productId, double cost) {
Query query = sessionFactory.getCurrentSession()
.createQuery("update Price set cost = :cost" + " where idProduct = :idProduct");
query.setParameter("cost", cost);
query.setParameter("idProduct", productId);
query.executeUpdate();
}
@Override
public void delete(int productId) {
Query query = sessionFactory.getCurrentSession()
.createQuery("delete Price where idProduct = :idProduct");
query.setParameter("idProduct", productId);
query.executeUpdate();
}
@Override
public void create(int productId, double cost) {
Price price = new Price();
price.setIdProduct(productId);
price.setCost(cost);
sessionFactory.getCurrentSession()
.save(price);
}
public List<Price> getAll() {
return sessionFactory.getCurrentSession()
.createQuery(GET_ALL_PRICES).list();
}
}
| [
"Vasili.Shestyuk@billing.ru"
] | Vasili.Shestyuk@billing.ru |
91568d25fe6519a038de009bb62b353a6b715153 | 03e599c4be118adb7a39c16694409041c72b0016 | /jEdit/jars/MacOS/com/apple/cocoa/foundation/NSSelector.java | d0eef2a6b99d68e90a2c056d6828ec2f12d85817 | [] | no_license | VictorLoy/jEdit | 06f162c1da1a8a04d85cb3dc35bc2cd407f67d88 | 8ebeb6a78c5694466ea28b8d2fcd082c3aabdf48 | refs/heads/master | 2020-09-01T22:21:04.767030 | 2019-11-01T22:50:48 | 2019-11-01T22:50:48 | 219,073,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 115 | java | package com.apple.cocoa.foundation;
public class NSSelector {
public NSSelector(String s, Class[] ca) { }
}
| [
"victorloyinmi@uofs-10-230-81-70.usask.ca"
] | victorloyinmi@uofs-10-230-81-70.usask.ca |
377c06c60d02e9057547eaea3a176742a2938703 | 86ea9d89914b642c9866d1fa4b2e679e8dda6e7a | /src/main/java/com/zlj/forum/web/dataobject/ArticleLogsDO.java | ab4e62a86405d873913366523950ac514c583514 | [] | no_license | ZhangLujie4/creationForum | 70a25313ab299cb821df3cd0dcacc07006fb18e1 | 3937539e5af31b2fb99d967c9441e7a1e762e6e7 | refs/heads/master | 2022-07-03T19:29:11.454430 | 2019-06-10T23:29:25 | 2019-06-10T23:29:25 | 166,186,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package com.zlj.forum.web.dataobject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Date;
/**
* @author zhanglujie
* @description
* @date 2019-05-26 22:16
*/
@Data
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "article_logs")
public class ArticleLogsDO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Long uid;
private Long aid;
private Integer preferDegree;
private Date viewTime;
}
| [
"lujie.zhang@beibei.com"
] | lujie.zhang@beibei.com |
1041c055104b85978532cc7cb7d28f8b03a1e5d7 | 15aff3446c957fc934c98dc84a0668a2025f28c1 | /open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/converters/SchemaAttributeConverter.java | 6049a88acd7038bf98ef5c3e7516938106a14559 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | ilovechai/egeria | 0865773e6deaf35991ab23a649e91f4715dc749c | c7cd3dd4bb6c960f6b81ecd71394af48cc16a23b | refs/heads/main | 2023-03-15T18:15:16.154074 | 2023-03-03T13:10:41 | 2023-03-03T13:10:41 | 610,375,922 | 1 | 0 | Apache-2.0 | 2023-03-06T20:57:45 | 2023-03-06T16:42:28 | null | UTF-8 | Java | false | false | 8,711 | java | /* SPDX-License-Identifier: Apache 2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.assetowner.converters;
import org.odpi.openmetadata.accessservices.assetowner.metadataelements.SchemaAttributeElement;
import org.odpi.openmetadata.accessservices.assetowner.metadataelements.SchemaTypeElement;
import org.odpi.openmetadata.accessservices.assetowner.properties.DataItemSortOrder;
import org.odpi.openmetadata.accessservices.assetowner.properties.SchemaAttributeProperties;
import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper;
import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
/**
* SchemaAttributeConverter provides common methods for transferring relevant properties from an Open Metadata Repository Services (OMRS)
* EntityDetail object into a SchemaAttributeElement bean.
*/
public class SchemaAttributeConverter<B> extends AssetOwnerOMASConverter<B>
{
/**
* Constructor
*
* @param repositoryHelper helper object to parse entity
* @param serviceName name of this component
* @param serverName local server name
*/
public SchemaAttributeConverter(OMRSRepositoryHelper repositoryHelper,
String serviceName,
String serverName)
{
super(repositoryHelper, serviceName, serverName);
}
/**
* Extract the properties from the schema attribute entity. Each API creates a specialization of this method for its beans.
*
* @param beanClass name of the class to create
* @param schemaAttributeEntity entity containing the properties for the main schema attribute
* @param typeClass name of type used to describe the schema type
* @param schemaType bean containing the properties of the schema type - this is filled out by the schema type converter
* @param schemaAttributeRelationships relationships containing the links to other schema attributes
* @param methodName calling method
* @param <T> bean type used to create the schema type
* @return bean populated with properties from the instances supplied
* @throws PropertyServerException there is a problem instantiating the bean
*/
@Override
public <T> B getNewSchemaAttributeBean(Class<B> beanClass,
EntityDetail schemaAttributeEntity,
Class<T> typeClass,
T schemaType,
List<Relationship> schemaAttributeRelationships,
String methodName) throws PropertyServerException
{
try
{
/*
* This is initial confirmation that the generic converter has been initialized with an appropriate bean class.
*/
B returnBean = beanClass.getDeclaredConstructor().newInstance();
if (returnBean instanceof SchemaAttributeElement)
{
SchemaAttributeElement bean = (SchemaAttributeElement) returnBean;
SchemaAttributeProperties schemaAttributeProperties = new SchemaAttributeProperties();
if (schemaAttributeEntity != null)
{
/*
* Check that the entity is of the correct type.
*/
bean.setElementHeader(this.getMetadataElementHeader(beanClass, schemaAttributeEntity, methodName));
/*
* The initial set of values come from the entity properties. The super class properties are removed from a copy of the entities
* properties, leaving any subclass properties to be stored in extended properties.
*/
InstanceProperties instanceProperties = new InstanceProperties(schemaAttributeEntity.getProperties());
schemaAttributeProperties.setQualifiedName(this.removeQualifiedName(instanceProperties));
schemaAttributeProperties.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties));
schemaAttributeProperties.setDisplayName(this.removeDisplayName(instanceProperties));
schemaAttributeProperties.setDescription(this.removeDescription(instanceProperties));
schemaAttributeProperties.setIsDeprecated(this.removeIsDeprecated(instanceProperties));
schemaAttributeProperties.setElementPosition(this.removePosition(instanceProperties));
schemaAttributeProperties.setMinCardinality(this.removeMinCardinality(instanceProperties));
schemaAttributeProperties.setMaxCardinality(this.removeMaxCardinality(instanceProperties));
schemaAttributeProperties.setAllowsDuplicateValues(this.removeAllowsDuplicateValues(instanceProperties));
schemaAttributeProperties.setOrderedValues(this.removeOrderedValues(instanceProperties));
schemaAttributeProperties.setDefaultValueOverride(this.removeDefaultValueOverride(instanceProperties));
schemaAttributeProperties.setMinimumLength(this.removeMinimumLength(instanceProperties));
schemaAttributeProperties.setLength(this.removeLength(instanceProperties));
schemaAttributeProperties.setPrecision(this.removePrecision(instanceProperties));
schemaAttributeProperties.setIsNullable(this.removeIsNullable(instanceProperties));
schemaAttributeProperties.setNativeJavaClass(this.removeNativeClass(instanceProperties));
schemaAttributeProperties.setAliases(this.removeAliases(instanceProperties));
schemaAttributeProperties.setSortOrder(this.removeSortOrder(instanceProperties));
if (schemaType instanceof SchemaTypeElement)
{
schemaAttributeProperties.setAttributeType(((SchemaTypeElement) schemaType).getSchemaTypeProperties());
}
bean.setSchemaAttributeProperties(schemaAttributeProperties);
}
else
{
handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName);
}
}
return returnBean;
}
catch (IllegalAccessException | InstantiationException | ClassCastException | NoSuchMethodException | InvocationTargetException error)
{
super.handleInvalidBeanClass(beanClass.getName(), error, methodName);
}
return null;
}
/**
* Extract and delete the sortOrder property from the supplied instance properties.
*
* @param instanceProperties properties from entity
* @return DataItemSortOrder enum
*/
private DataItemSortOrder removeSortOrder(InstanceProperties instanceProperties)
{
final String methodName = "removeSortOrder";
if (instanceProperties != null)
{
int ordinal = repositoryHelper.removeEnumPropertyOrdinal(serviceName,
OpenMetadataAPIMapper.SORT_ORDER_PROPERTY_NAME,
instanceProperties,
methodName);
for (DataItemSortOrder dataItemSortOrder : DataItemSortOrder.values())
{
if (dataItemSortOrder.getOpenTypeOrdinal() == ordinal)
{
return dataItemSortOrder;
}
}
}
return DataItemSortOrder.UNKNOWN;
}
}
| [
"mandy_chessell@uk.ibm.com"
] | mandy_chessell@uk.ibm.com |
e6cf3105b300b2bf58859f7424e544272d19b575 | a2272f1002da68cc554cd57bf9470322a547c605 | /src/jdk/jdk.aot/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/SymbolTable.java | 6a004c5c773d755a68aba0ce730162f95feb4259 | [] | no_license | framework-projects/java | 50af8953ab46c509432c467c9ad69cc63818fa63 | 2d131cb46f232d3bf909face20502e4ba4b84db0 | refs/heads/master | 2023-06-28T05:08:00.482568 | 2021-08-04T08:42:32 | 2021-08-04T08:42:32 | 312,414,414 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | /*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.tools.jaotc.binformat;
public interface SymbolTable {
void addSymbol(Symbol symInfo);
Symbol getSymbol(String symName);
Symbol createSymbol(int offset, Symbol.Kind kind, Symbol.Binding binding, int size, String name);
}
| [
"chovavea@outlook.com"
] | chovavea@outlook.com |
758f1d13d6897fdfe2f140790606567a8109156d | 2dc102ee1343b86462f76e46f4be794014c44434 | /src/main/java/com/fatec/mogi/controller/StateController.java | 3dd462bc012e349549d0c35e85817b50d7ea7e28 | [] | no_license | Matheus-Wendel/Les2020 | c5eb0195fd1b956e706d16c70dcaabdae0af7279 | 05c09c6683aeaf748267f1bbec7938d3b2422344 | refs/heads/master | 2023-06-02T12:37:14.446123 | 2021-06-15T01:54:01 | 2021-06-15T01:54:01 | 287,143,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package com.fatec.mogi.controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fatec.mogi.model.domain.State;
@RestController
@RequestMapping("/state")
@CrossOrigin(origins = "*", maxAge = 3600L)
public class StateController extends AbstractController<State> {
public StateController() {
super(State.class);
}
}
| [
"matheus_wendel@outlook.com"
] | matheus_wendel@outlook.com |
47d7dd4903525c0aa3c8e66b48a0efc47b97c609 | ccf10279eb36b1deb97b031e000d8971a5c82502 | /app/src/main/java/com/zhuang/safe361/activity/ProcessSettingActivity.java | a964602b2711194b4496b0730a107b0bcdf08fe2 | [] | no_license | zhuangshaoBryant/361 | f1fe6de1498ebaa46cbcf4ca4f6ed0887198cc28 | f528c6c31e49a1358e10172f6b3cd97fdea3a2cf | refs/heads/master | 2021-01-01T04:44:58.861608 | 2017-07-14T08:01:09 | 2017-07-14T08:01:09 | 59,116,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,605 | java | package com.zhuang.safe361.activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import com.zhuang.safe361.R;
import com.zhuang.safe361.service.LockScreenService;
import com.zhuang.safe361.utils.ServiceStatusUtils;
public class ProcessSettingActivity extends Activity {
private CheckBox cb_show_system;
private SharedPreferences sp;
private CheckBox cb_lock_clear;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_process_setting);
sp = getSharedPreferences("config.xml", Context.MODE_PRIVATE);
initSystemShow();
initLockScreenClear();
}
private void initLockScreenClear() {
cb_lock_clear = (CheckBox) findViewById(R.id.cb_lock_clear);
//对之前存储过的状态进行回显
boolean isRunning = ServiceStatusUtils.isServiceRunning(this,"com.zhuang.safe361.service.LockScreenService");
cb_lock_clear.setChecked(isRunning);
if (isRunning) {
cb_lock_clear.setText("锁屏清理已开启");
}else{
cb_lock_clear.setText("锁屏清理已关闭");
}
cb_lock_clear.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cb_lock_clear.setText("锁屏清理已开启");
startService(new Intent(ProcessSettingActivity.this, LockScreenService.class));
}else{
cb_lock_clear.setText("锁屏清理已关闭");
stopService(new Intent(ProcessSettingActivity.this, LockScreenService.class));
}
}
});
}
private void initSystemShow() {
cb_show_system = (CheckBox) findViewById(R.id.cb_show_system);
//对之前存储过的状态进行回显
boolean showSystem = sp.getBoolean("showSystem",true);
cb_show_system.setChecked(showSystem);
if (showSystem) {
cb_show_system.setText("显示系统进程");
}else{
cb_show_system.setText("隐藏系统进程");
}
cb_show_system.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cb_show_system.setText("显示系统进程");
}else{
cb_show_system.setText("隐藏系统进程");
}
sp.edit().putBoolean("showSystem",isChecked).commit();
}
});
}
}
| [
"李壮"
] | 李壮 |
25cc98133ff7e7c6c42b8fec13ce0ef030312a0d | 2aa9dc7c35aa07ba0cd5057aaff9b054710f30b6 | /BankLoan/src/main/java/com/example/BankLoan/dao/StudentDAOInterface.java | 6065bc02db8d090981676a09ddc165a1c56b8bab | [] | no_license | Jyothirmai8/BankLoan | fbdc6450c9ff15513f5639b9b28ccad08ae3a484 | f1956dca26bd9a941b2b37c720a57b585b566397 | refs/heads/master | 2022-12-22T08:12:42.356732 | 2020-09-27T14:40:16 | 2020-09-27T14:40:16 | 299,051,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.example.BankLoan.dao;
import java.util.List;
import com.example.BankLoan.entity.Employee;
import com.example.BankLoan.entity.Student;
public interface StudentDAOInterface {
void addStudentInfo(Student student);
void updateStudentInfo(Student student);
void deleteStudentInfo(Student student);
List<Student> getStudentInfo();
Student getStudentData(int s);
}
| [
"jyothirmai.kosaraju@capgemini.com"
] | jyothirmai.kosaraju@capgemini.com |
e00622f3f5edb5f482c6ef01a5c7141d794137a4 | fb5bfb5b4cf7a118cb858490953e69517d8060a4 | /src/lib/utils/Holder.java | 7dda6199accec38a74b2b1593a37c4e51e24fdb1 | [] | no_license | v777779/jbook | 573dd1e4e3847ed51c9b6b66d2b098bf8eb58af5 | 09fc56a27e9aed797327f01ea955bdf1815d0d54 | refs/heads/master | 2021-09-19T08:14:16.299382 | 2018-07-25T14:03:12 | 2018-07-25T14:03:12 | 86,017,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package lib.utils;
/**
* Created by V1 on 20.03.2017.
*/
public class Holder<T> {
private T value;
public Holder() {
}
public Holder(T value) {
this.value = value;
}
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
return value.equals(o);
}
public String getName() {
return value.getClass().getSimpleName();
}
@Override
public String toString() {
return "Holder{" +
value +
'}';
}
}
| [
"vadim.v.voronov@gmail.com"
] | vadim.v.voronov@gmail.com |
898e735cdb4efa3f30c15731ba9f028786610018 | aaa102e363fc76066e0e9776738e49d81b3c69b5 | /app/src/main/java/com/sabaibrowser/TabControl.java | a4448ddf37d71ab085f0e05435afcb5b5b6db226 | [
"Apache-2.0"
] | permissive | zmuzik/browser | 54e39da6a15fdb81b26ba36e246aa11ff41d63c3 | 5894cdb4de32c661ca254bec2260d9f4fa67d0ee | refs/heads/master | 2021-01-25T07:07:06.480506 | 2017-03-10T07:54:40 | 2017-03-10T07:54:40 | 80,693,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,449 | java | /*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sabaibrowser;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
class TabControl {
// Log Tag
private static final String LOGTAG = "TabControl";
// next Tab ID, starting at 1
private static long sNextId = 1;
private static final String POSITIONS = "positions";
private static final String CURRENT = "current";
public static interface OnThumbnailUpdatedListener {
void onThumbnailUpdated(Tab t);
}
// Maximum number of tabs.
private int mMaxTabs;
// Private array of WebViews that are used as tabs.
private ArrayList<Tab> mTabs;
// Queue of most recently viewed tabs.
private ArrayList<Tab> mTabQueue;
// Current position in mTabs.
private int mCurrentTab = -1;
// the main browser controller
private final Controller mController;
private OnThumbnailUpdatedListener mOnThumbnailUpdatedListener;
/**
* Construct a new TabControl object
*/
TabControl(Controller controller) {
mController = controller;
mMaxTabs = mController.getMaxTabs();
mTabs = new ArrayList<Tab>(mMaxTabs);
mTabQueue = new ArrayList<Tab>(mMaxTabs);
}
synchronized static long getNextId() {
return sNextId++;
}
/**
* Return the current tab's main WebView. This will always return the main
* WebView for a given tab and not a subwindow.
* @return The current tab's WebView.
*/
WebView getCurrentWebView() {
Tab t = getTab(mCurrentTab);
if (t == null) {
return null;
}
return t.getWebView();
}
/**
* Return the current tab's top-level WebView. This can return a subwindow
* if one exists.
* @return The top-level WebView of the current tab.
*/
WebView getCurrentTopWebView() {
Tab t = getTab(mCurrentTab);
if (t == null) {
return null;
}
return t.getTopWindow();
}
/**
* return the list of tabs
*/
List<Tab> getTabs() {
return mTabs;
}
/**
* Return the tab at the specified position.
* @return The Tab for the specified position or null if the tab does not
* exist.
*/
Tab getTab(int position) {
if (position >= 0 && position < mTabs.size()) {
return mTabs.get(position);
}
return null;
}
/**
* Return the current tab.
* @return The current tab.
*/
Tab getCurrentTab() {
return getTab(mCurrentTab);
}
/**
* Return the current tab position.
* @return The current tab position
*/
int getCurrentPosition() {
return mCurrentTab;
}
/**
* Given a Tab, find it's position
* @param Tab to find
* @return position of Tab or -1 if not found
*/
int getTabPosition(Tab tab) {
if (tab == null) {
return -1;
}
return mTabs.indexOf(tab);
}
boolean canCreateNewTab() {
return mMaxTabs > mTabs.size();
}
/**
* Returns true if there are any incognito tabs open.
* @return True when any incognito tabs are open, false otherwise.
*/
boolean hasAnyOpenIncognitoTabs() {
for (Tab tab : mTabs) {
if (tab.getWebView() != null
&& tab.getWebView().isPrivateBrowsingEnabled()) {
return true;
}
}
return false;
}
void addPreloadedTab(Tab tab) {
for (Tab current : mTabs) {
if (current != null && current.getId() == tab.getId()) {
throw new IllegalStateException("Tab with id " + tab.getId() + " already exists: "
+ current.toString());
}
}
mTabs.add(tab);
tab.setController(mController);
mController.onSetWebView(tab, tab.getWebView());
tab.putInBackground();
}
/**
* Create a new tab.
* @return The newly createTab or null if we have reached the maximum
* number of open tabs.
*/
Tab createNewTab(boolean privateBrowsing) {
return createNewTab(null, privateBrowsing);
}
Tab createNewTab(Bundle state, boolean privateBrowsing) {
int size = mTabs.size();
// Return false if we have maxed out on tabs
if (!canCreateNewTab()) {
return null;
}
final WebView w = createNewWebView(privateBrowsing);
// Create a new tab and add it to the tab list
Tab t = new Tab(mController, w, state);
mTabs.add(t);
// Initially put the tab in the background.
t.putInBackground();
return t;
}
/**
* Create a new tab with default values for closeOnExit(false),
* appId(null), url(null), and privateBrowsing(false).
*/
Tab createNewTab() {
return createNewTab(false);
}
/**
* Remove the parent child relationships from all tabs.
*/
void removeParentChildRelationShips() {
for (Tab tab : mTabs) {
tab.removeFromTree();
}
}
/**
* Remove the tab from the list. If the tab is the current tab shown, the
* last created tab will be shown.
* @param t The tab to be removed.
*/
boolean removeTab(Tab t) {
if (t == null) {
return false;
}
// Grab the current tab before modifying the list.
Tab current = getCurrentTab();
// Remove t from our list of tabs.
mTabs.remove(t);
// Put the tab in the background only if it is the current one.
if (current == t) {
t.putInBackground();
mCurrentTab = -1;
} else {
// If a tab that is earlier in the list gets removed, the current
// index no longer points to the correct tab.
mCurrentTab = getTabPosition(current);
}
// destroy the tab
t.destroy();
// clear it's references to parent and children
t.removeFromTree();
// Remove it from the queue of viewed tabs.
mTabQueue.remove(t);
return true;
}
/**
* Destroy all the tabs and subwindows
*/
void destroy() {
for (Tab t : mTabs) {
t.destroy();
}
mTabs.clear();
mTabQueue.clear();
}
/**
* Returns the number of tabs created.
* @return The number of tabs created.
*/
int getTabCount() {
return mTabs.size();
}
/**
* save the tab state:
* current position
* position sorted array of tab ids
* for each tab id, save the tab state
* @param outState
* @param saveImages
*/
void saveState(Bundle outState) {
final int numTabs = getTabCount();
if (numTabs == 0) {
return;
}
long[] ids = new long[numTabs];
int i = 0;
for (Tab tab : mTabs) {
Bundle tabState = tab.saveState();
if (tabState != null) {
ids[i++] = tab.getId();
String key = Long.toString(tab.getId());
if (outState.containsKey(key)) {
// Dump the tab state for debugging purposes
for (Tab dt : mTabs) {
Log.e(LOGTAG, dt.toString());
}
throw new IllegalStateException(
"Error saving state, duplicate tab ids!");
}
outState.putBundle(key, tabState);
} else {
ids[i++] = -1;
// Since we won't be restoring the thumbnail, delete it
tab.deleteThumbnail();
}
}
if (!outState.isEmpty()) {
outState.putLongArray(POSITIONS, ids);
Tab current = getCurrentTab();
long cid = -1;
if (current != null) {
cid = current.getId();
}
outState.putLong(CURRENT, cid);
}
}
/**
* Check if the state can be restored. If the state can be restored, the
* current tab id is returned. This can be passed to restoreState below
* in order to restore the correct tab. Otherwise, -1 is returned and the
* state cannot be restored.
*/
long canRestoreState(Bundle inState, boolean restoreIncognitoTabs) {
final long[] ids = (inState == null) ? null : inState.getLongArray(POSITIONS);
if (ids == null) {
return -1;
}
final long oldcurrent = inState.getLong(CURRENT);
long current = -1;
if (restoreIncognitoTabs || (hasState(oldcurrent, inState) && !isIncognito(oldcurrent, inState))) {
current = oldcurrent;
} else {
// pick first non incognito tab
for (long id : ids) {
if (hasState(id, inState) && !isIncognito(id, inState)) {
current = id;
break;
}
}
}
return current;
}
private boolean hasState(long id, Bundle state) {
if (id == -1) return false;
Bundle tab = state.getBundle(Long.toString(id));
return ((tab != null) && !tab.isEmpty());
}
private boolean isIncognito(long id, Bundle state) {
Bundle tabstate = state.getBundle(Long.toString(id));
if ((tabstate != null) && !tabstate.isEmpty()) {
return tabstate.getBoolean(Tab.INCOGNITO);
}
return false;
}
/**
* Restore the state of all the tabs.
* @param currentId The tab id to restore.
* @param inState The saved state of all the tabs.
* @param restoreIncognitoTabs Restoring private browsing tabs
* @param restoreAll All webviews get restored, not just the current tab
* (this does not override handling of incognito tabs)
*/
void restoreState(Bundle inState, long currentId,
boolean restoreIncognitoTabs, boolean restoreAll) {
if (currentId == -1) {
return;
}
long[] ids = inState.getLongArray(POSITIONS);
long maxId = -Long.MAX_VALUE;
HashMap<Long, Tab> tabMap = new HashMap<Long, Tab>();
for (long id : ids) {
if (id > maxId) {
maxId = id;
}
final String idkey = Long.toString(id);
Bundle state = inState.getBundle(idkey);
if (state == null || state.isEmpty()) {
// Skip tab
continue;
} else if (!restoreIncognitoTabs
&& state.getBoolean(Tab.INCOGNITO)) {
// ignore tab
} else if (id == currentId || restoreAll) {
Tab t = createNewTab(state, false);
if (t == null) {
// We could "break" at this point, but we want
// sNextId to be set correctly.
continue;
}
tabMap.put(id, t);
// Me must set the current tab before restoring the state
// so that all the client classes are set.
if (id == currentId) {
setCurrentTab(t);
}
} else {
// Create a new tab and don't restore the state yet, add it
// to the tab list
Tab t = new Tab(mController, state);
tabMap.put(id, t);
mTabs.add(t);
// added the tab to the front as they are not current
mTabQueue.add(0, t);
}
}
// make sure that there is no id overlap between the restored
// and new tabs
sNextId = maxId + 1;
if (mCurrentTab == -1) {
if (getTabCount() > 0) {
setCurrentTab(getTab(0));
}
}
// restore parent/child relationships
for (long id : ids) {
final Tab tab = tabMap.get(id);
final Bundle b = inState.getBundle(Long.toString(id));
if ((b != null) && (tab != null)) {
final long parentId = b.getLong(Tab.PARENTTAB, -1);
if (parentId != -1) {
final Tab parent = tabMap.get(parentId);
if (parent != null) {
parent.addChildTab(tab);
}
}
}
}
}
/**
* Free the memory in this order, 1) free the background tabs; 2) free the
* WebView cache;
*/
void freeMemory() {
if (getTabCount() == 0) return;
// free the least frequently used background tabs
Vector<Tab> tabs = getHalfLeastUsedTabs(getCurrentTab());
if (tabs.size() > 0) {
Log.w(LOGTAG, "Free " + tabs.size() + " tabs in the browser");
for (Tab t : tabs) {
// store the WebView's state.
t.saveState();
// destroy the tab
t.destroy();
}
return;
}
// free the WebView's unused memory (this includes the cache)
Log.w(LOGTAG, "Free WebView's unused memory and cache");
WebView view = getCurrentWebView();
if (view != null) {
view.freeMemory();
}
}
private Vector<Tab> getHalfLeastUsedTabs(Tab current) {
Vector<Tab> tabsToGo = new Vector<Tab>();
// Don't do anything if we only have 1 tab or if the current tab is
// null.
if (getTabCount() == 1 || current == null) {
return tabsToGo;
}
if (mTabQueue.size() == 0) {
return tabsToGo;
}
// Rip through the queue starting at the beginning and tear down half of
// available tabs which are not the current tab or the parent of the
// current tab.
int openTabCount = 0;
for (Tab t : mTabQueue) {
if (t != null && t.getWebView() != null) {
openTabCount++;
if (t != current && t != current.getParent()) {
tabsToGo.add(t);
}
}
}
openTabCount /= 2;
if (tabsToGo.size() > openTabCount) {
tabsToGo.setSize(openTabCount);
}
return tabsToGo;
}
Tab getLeastUsedTab(Tab current) {
if (getTabCount() == 1 || current == null) {
return null;
}
if (mTabQueue.size() == 0) {
return null;
}
// find a tab which is not the current tab or the parent of the
// current tab
for (Tab t : mTabQueue) {
if (t != null && t.getWebView() != null) {
if (t != current && t != current.getParent()) {
return t;
}
}
}
return null;
}
/**
* Show the tab that contains the given WebView.
* @param view The WebView used to find the tab.
*/
Tab getTabFromView(WebView view) {
for (Tab t : mTabs) {
if (t.getWebView() == view) {
return t;
}
}
return null;
}
/**
* Return the tab with the matching application id.
* @param id The application identifier.
*/
Tab getTabFromAppId(String id) {
if (id == null) {
return null;
}
for (Tab t : mTabs) {
if (id.equals(t.getAppId())) {
return t;
}
}
return null;
}
/**
* Stop loading in all opened WebView including subWindows.
*/
void stopAllLoading() {
for (Tab t : mTabs) {
final WebView webview = t.getWebView();
if (webview != null) {
webview.stopLoading();
}
}
}
// This method checks if a tab matches the given url.
private boolean tabMatchesUrl(Tab t, String url) {
return url.equals(t.getUrl()) || url.equals(t.getOriginalUrl());
}
/**
* Return the tab that matches the given url.
* @param url The url to search for.
*/
Tab findTabWithUrl(String url) {
if (url == null) {
return null;
}
// Check the current tab first.
Tab currentTab = getCurrentTab();
if (currentTab != null && tabMatchesUrl(currentTab, url)) {
return currentTab;
}
// Now check all the rest.
for (Tab tab : mTabs) {
if (tabMatchesUrl(tab, url)) {
return tab;
}
}
return null;
}
/**
* Recreate the main WebView of the given tab.
*/
void recreateWebView(Tab t) {
final WebView w = t.getWebView();
if (w != null) {
t.destroy();
}
// Create a new WebView. If this tab is the current tab, we need to put
// back all the clients so force it to be the current tab.
t.setWebView(createNewWebView(), false);
if (getCurrentTab() == t) {
setCurrentTab(t, true);
}
}
/**
* Creates a new WebView and registers it with the global settings.
*/
private WebView createNewWebView() {
return createNewWebView(false);
}
/**
* Creates a new WebView and registers it with the global settings.
* @param privateBrowsing When true, enables private browsing in the new
* WebView.
*/
private WebView createNewWebView(boolean privateBrowsing) {
return mController.getWebViewFactory().createWebView(privateBrowsing);
}
/**
* Put the current tab in the background and set newTab as the current tab.
* @param newTab The new tab. If newTab is null, the current tab is not
* set.
*/
boolean setCurrentTab(Tab newTab) {
return setCurrentTab(newTab, false);
}
/**
* If force is true, this method skips the check for newTab == current.
*/
private boolean setCurrentTab(Tab newTab, boolean force) {
Tab current = getTab(mCurrentTab);
if (current == newTab && !force) {
return true;
}
if (current != null) {
current.putInBackground();
mCurrentTab = -1;
}
if (newTab == null) {
return false;
}
// Move the newTab to the end of the queue
int index = mTabQueue.indexOf(newTab);
if (index != -1) {
mTabQueue.remove(index);
}
mTabQueue.add(newTab);
// Display the new current tab
mCurrentTab = mTabs.indexOf(newTab);
WebView mainView = newTab.getWebView();
boolean needRestore = mainView == null;
if (needRestore) {
// Same work as in createNewTab() except don't do new Tab()
mainView = createNewWebView();
newTab.setWebView(mainView);
}
newTab.putInForeground();
return true;
}
// Used by Tab.onJsAlert() and friends
void setActiveTab(Tab tab) {
// Calls TabControl.setCurrentTab()
mController.setActiveTab(tab);
}
public void setOnThumbnailUpdatedListener(OnThumbnailUpdatedListener listener) {
mOnThumbnailUpdatedListener = listener;
for (Tab t : mTabs) {
WebView web = t.getWebView();
if (web != null) {
web.setPictureListener(listener != null ? t : null);
}
}
}
public OnThumbnailUpdatedListener getOnThumbnailUpdatedListener() {
return mOnThumbnailUpdatedListener;
}
}
| [
"zbynek.muzik@gmail.com"
] | zbynek.muzik@gmail.com |
214d6d6f64093e2a48bacaac30ef2df662750219 | afd225d1055689100d669fbbf0f574fccce2bbd3 | /FFmpegLibrary/src/com/appunite/ffmpeg/VideoControllerView.java | 3006358b0c0671eabc796250fe6a81403bce6e9d | [] | no_license | chenglun-lin/itri103-player | 74a5d77258b46a4a3a7a5f0251fae2538592b992 | 85683941659abbd104547153c7591473842729ed | refs/heads/master | 2021-01-18T23:31:59.742434 | 2016-07-11T08:02:35 | 2016-07-11T08:02:35 | 27,716,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,080 | java | /*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.appunite.ffmpeg;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import java.lang.ref.WeakReference;
import java.util.Formatter;
import java.util.Locale;
/**
* A view containing controls for a MediaPlayer. Typically contains the
* buttons like "Play/Pause", "Rewind", "Fast Forward" and a progress
* slider. It takes care of synchronizing the controls with the state
* of the MediaPlayer.
* <p>
* The way to use this class is to instantiate it programatically.
* The MediaController will create a default set of controls
* and put them in a window floating above your application. Specifically,
* the controls will float above the view specified with setAnchorView().
* The window will disappear if left idle for three seconds and reappear
* when the user touches the anchor view.
* <p>
* Functions like show() and hide() have no effect when MediaController
* is created in an xml layout.
*
* MediaController will hide and
* show the buttons according to these rules:
* <ul>
* <li> The "previous" and "next" buttons are hidden until setPrevNextListeners()
* has been called
* <li> The "previous" and "next" buttons are visible but disabled if
* setPrevNextListeners() was called with null listeners
* <li> The "rewind" and "fastforward" buttons are shown unless requested
* otherwise by using the MediaController(Context, boolean) constructor
* with the boolean set to false
* </ul>
*/
public class VideoControllerView extends FrameLayout {
private static final String TAG = "VideoControllerView";
private MediaPlayerControl mPlayer;
private Context mContext;
private ViewGroup mAnchor;
private View mRoot;
private ProgressBar mProgress;
private TextView mEndTime, mCurrentTime;
private boolean mShowing;
private boolean mDragging;
private static final int sDefaultTimeout = 3000;
private static final int FADE_OUT = 1;
private static final int SHOW_PROGRESS = 2;
private boolean mUseFastForward;
private boolean mFromXml;
private boolean mListenersSet;
private View.OnClickListener mNextListener, mPrevListener;
StringBuilder mFormatBuilder;
Formatter mFormatter;
private ImageButton mPauseButton;
private ImageButton mFfwdButton;
private ImageButton mRewButton;
private ImageButton mNextButton;
private ImageButton mPrevButton;
private ImageButton mFullscreenButton;
private Handler mHandler = new MessageHandler(this);
public VideoControllerView(Context context, AttributeSet attrs) {
super(context, attrs);
mRoot = null;
mContext = context;
mUseFastForward = true;
mFromXml = true;
Log.i(TAG, TAG);
}
public VideoControllerView(Context context, boolean useFastForward) {
super(context);
mContext = context;
mUseFastForward = useFastForward;
Log.i(TAG, TAG);
}
public VideoControllerView(Context context) {
this(context, true);
Log.i(TAG, TAG);
}
@Override
public void onFinishInflate() {
if (mRoot != null)
initControllerView(mRoot);
}
public void setMediaPlayer(MediaPlayerControl player) {
mPlayer = player;
updatePausePlay();
updateFullScreen();
}
/**
* Set the view that acts as the anchor for the control view.
* This can for example be a VideoView, or your Activity's main view.
* @param view The view to which to anchor the controller when it is visible.
*/
public void setAnchorView(ViewGroup view) {
mAnchor = view;
FrameLayout.LayoutParams frameParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
);
removeAllViews();
View v = makeControllerView();
addView(v, frameParams);
}
/**
* Create the view that holds the widgets that control playback.
* Derived classes can override this to create their own.
* @return The controller view.
* @hide This doesn't work as advertised
*/
protected View makeControllerView() {
LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRoot = inflate.inflate(R.layout.media_controller, null);
initControllerView(mRoot);
return mRoot;
}
private void initControllerView(View v) {
mPauseButton = (ImageButton) v.findViewById(R.id.pause);
if (mPauseButton != null) {
mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);
}
mFullscreenButton = (ImageButton) v.findViewById(R.id.fullscreen);
if (mFullscreenButton != null) {
mFullscreenButton.requestFocus();
mFullscreenButton.setOnClickListener(mFullscreenListener);
}
mFfwdButton = (ImageButton) v.findViewById(R.id.ffwd);
if (mFfwdButton != null) {
mFfwdButton.setOnClickListener(mFfwdListener);
if (!mFromXml) {
mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
}
}
mRewButton = (ImageButton) v.findViewById(R.id.rew);
if (mRewButton != null) {
mRewButton.setOnClickListener(mRewListener);
if (!mFromXml) {
mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
}
}
// By default these are hidden. They will be enabled when setPrevNextListeners() is called
mNextButton = (ImageButton) v.findViewById(R.id.next);
if (mNextButton != null && !mFromXml && !mListenersSet) {
mNextButton.setVisibility(View.GONE);
}
mPrevButton = (ImageButton) v.findViewById(R.id.prev);
if (mPrevButton != null && !mFromXml && !mListenersSet) {
mPrevButton.setVisibility(View.GONE);
}
mProgress = (ProgressBar) v.findViewById(R.id.mediacontroller_progress);
if (mProgress != null) {
if (mProgress instanceof SeekBar) {
SeekBar seeker = (SeekBar) mProgress;
seeker.setOnSeekBarChangeListener(mSeekListener);
}
mProgress.setMax(1000);
}
mEndTime = (TextView) v.findViewById(R.id.time);
mCurrentTime = (TextView) v.findViewById(R.id.time_current);
mFormatBuilder = new StringBuilder();
mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
videoSizeInfoText = (TextView) v.findViewById(R.id.screen_size_info);
installPrevNextListeners();
}
/**
* Show the controller on screen. It will go away
* automatically after 3 seconds of inactivity.
*/
public void show() {
show(sDefaultTimeout);
}
/**
* Disable pause or seek buttons if the stream cannot be paused or seeked.
* This requires the control interface to be a MediaPlayerControlExt
*/
private void disableUnsupportedButtons() {
if (mPlayer == null) {
return;
}
try {
if (mPauseButton != null && !mPlayer.canPause()) {
mPauseButton.setEnabled(false);
}
if (mRewButton != null && !mPlayer.canSeekBackward()) {
mRewButton.setEnabled(false);
}
if (mFfwdButton != null && !mPlayer.canSeekForward()) {
mFfwdButton.setEnabled(false);
}
} catch (IncompatibleClassChangeError ex) {
// We were given an old version of the interface, that doesn't have
// the canPause/canSeekXYZ methods. This is OK, it just means we
// assume the media can be paused and seeked, and so we don't disable
// the buttons.
}
}
/**
* Show the controller on screen. It will go away
* automatically after 'timeout' milliseconds of inactivity.
* @param timeout The timeout in milliseconds. Use 0 to show
* the controller until hide() is called.
*/
public void show(int timeout) {
if (!mShowing && mAnchor != null) {
setProgress();
if (mPauseButton != null) {
mPauseButton.requestFocus();
}
disableUnsupportedButtons();
FrameLayout.LayoutParams tlp = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.BOTTOM
);
mAnchor.addView(this, tlp);
mShowing = true;
}
updatePausePlay();
updateFullScreen();
// cause the progress bar to be updated even if mShowing
// was already true. This happens, for example, if we're
// paused with the progress bar showing the user hits play.
mHandler.sendEmptyMessage(SHOW_PROGRESS);
Message msg = mHandler.obtainMessage(FADE_OUT);
if (timeout != 0) {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(msg, timeout);
}
}
public boolean isShowing() {
return mShowing;
}
/**
* Remove the controller from the screen.
*/
public void hide() {
if (mAnchor == null) {
return;
}
try {
mAnchor.removeView(this);
mHandler.removeMessages(SHOW_PROGRESS);
} catch (IllegalArgumentException ex) {
Log.w("MediaController", "already removed");
}
mShowing = false;
}
private String stringForTime(int timeMs) {
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
mFormatBuilder.setLength(0);
if (hours > 0) {
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
} else {
return mFormatter.format("%02d:%02d", minutes, seconds).toString();
}
}
private int setProgress() {
if (mPlayer == null || mDragging) {
return 0;
}
int position = mPlayer.getCurrentPosition();
int duration = mPlayer.getDuration();
if (mProgress != null) {
if (duration > 0) {
// use long to avoid overflow
long pos = 1000L * position / duration;
mProgress.setProgress( (int) pos);
}
int percent = mPlayer.getBufferPercentage();
mProgress.setSecondaryProgress(percent * 10);
}
if (mEndTime != null)
mEndTime.setText(stringForTime(duration));
if (mCurrentTime != null)
mCurrentTime.setText(stringForTime(position));
return position;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
show(sDefaultTimeout);
return true;
}
@Override
public boolean onTrackballEvent(MotionEvent ev) {
show(sDefaultTimeout);
return false;
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (mPlayer == null) {
return true;
}
int keyCode = event.getKeyCode();
final boolean uniqueDown = event.getRepeatCount() == 0
&& event.getAction() == KeyEvent.ACTION_DOWN;
if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
|| keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
|| keyCode == KeyEvent.KEYCODE_SPACE) {
if (uniqueDown) {
doPauseResume();
show(sDefaultTimeout);
if (mPauseButton != null) {
mPauseButton.requestFocus();
}
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
if (uniqueDown && !mPlayer.isPlaying()) {
mPlayer.start();
updatePausePlay();
show(sDefaultTimeout);
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
|| keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
if (uniqueDown && mPlayer.isPlaying()) {
mPlayer.pause();
updatePausePlay();
show(sDefaultTimeout);
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|| keyCode == KeyEvent.KEYCODE_VOLUME_UP
|| keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) {
// don't show the controls for volume adjustment
return super.dispatchKeyEvent(event);
} else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
if (uniqueDown) {
hide();
}
return true;
}
show(sDefaultTimeout);
return super.dispatchKeyEvent(event);
}
private View.OnClickListener mPauseListener = new View.OnClickListener() {
public void onClick(View v) {
doPauseResume();
show(sDefaultTimeout);
}
};
private View.OnClickListener mFullscreenListener = new View.OnClickListener() {
public void onClick(View v) {
doToggleFullscreen();
show(sDefaultTimeout);
}
};
public void updatePausePlay() {
if (mRoot == null || mPauseButton == null || mPlayer == null) {
return;
}
if (mPlayer.isPlaying()) {
mPauseButton.setImageResource(R.drawable.ic_media_pause);
} else {
mPauseButton.setImageResource(R.drawable.ic_media_play);
}
}
public void updateFullScreen() {
if (mRoot == null || mFullscreenButton == null || mPlayer == null) {
return;
}
if (mPlayer.isFullScreen()) {
mFullscreenButton.setImageResource(R.drawable.ic_media_fullscreen_shrink);
}
else {
mFullscreenButton.setImageResource(R.drawable.ic_media_fullscreen_stretch);
}
}
private void doPauseResume() {
if (mPlayer == null) {
return;
}
if (mPlayer.isPlaying()) {
mPlayer.pause();
} else {
mPlayer.start();
}
updatePausePlay();
}
private void doToggleFullscreen() {
if (mPlayer == null) {
return;
}
int videoSizeInfo = mPlayer.toggleFullScreen();
showVideoSizeInfo(videoSizeInfo);
}
// There are two scenarios that can trigger the seekbar listener to trigger:
//
// The first is the user using the touchpad to adjust the posititon of the
// seekbar's thumb. In this case onStartTrackingTouch is called followed by
// a number of onProgressChanged notifications, concluded by onStopTrackingTouch.
// We're setting the field "mDragging" to true for the duration of the dragging
// session to avoid jumps in the position in case of ongoing playback.
//
// The second scenario involves the user operating the scroll ball, in this
// case there WON'T BE onStartTrackingTouch/onStopTrackingTouch notifications,
// we will simply apply the updated position without suspending regular updates.
private OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() {
public void onStartTrackingTouch(SeekBar bar) {
show(3600000);
mDragging = true;
// By removing these pending progress messages we make sure
// that a) we won't update the progress while the user adjusts
// the seekbar and b) once the user is done dragging the thumb
// we will post one of these messages to the queue again and
// this ensures that there will be exactly one message queued up.
mHandler.removeMessages(SHOW_PROGRESS);
}
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
if (mPlayer == null) {
return;
}
if (!fromuser) {
// We're not interested in programmatically generated changes to
// the progress bar's position.
return;
}
long duration = mPlayer.getDuration();
long newposition = (duration * progress) / 1000L;
mPlayer.seekTo( (int) newposition);
if (mCurrentTime != null)
mCurrentTime.setText(stringForTime( (int) newposition));
}
public void onStopTrackingTouch(SeekBar bar) {
mDragging = false;
setProgress();
updatePausePlay();
show(sDefaultTimeout);
// Ensure that progress is properly updated in the future,
// the call to show() does not guarantee this because it is a
// no-op if we are already showing.
mHandler.sendEmptyMessage(SHOW_PROGRESS);
}
};
@Override
public void setEnabled(boolean enabled) {
if (mPauseButton != null) {
mPauseButton.setEnabled(enabled);
}
if (mFfwdButton != null) {
mFfwdButton.setEnabled(enabled);
}
if (mRewButton != null) {
mRewButton.setEnabled(enabled);
}
if (mNextButton != null) {
mNextButton.setEnabled(enabled && mNextListener != null);
}
if (mPrevButton != null) {
mPrevButton.setEnabled(enabled && mPrevListener != null);
}
if (mProgress != null) {
mProgress.setEnabled(enabled);
}
disableUnsupportedButtons();
super.setEnabled(enabled);
}
private View.OnClickListener mRewListener = new View.OnClickListener() {
public void onClick(View v) {
if (mPlayer == null) {
return;
}
int pos = mPlayer.getCurrentPosition();
pos -= 5000; // milliseconds
mPlayer.seekTo(pos);
setProgress();
show(sDefaultTimeout);
}
};
private View.OnClickListener mFfwdListener = new View.OnClickListener() {
public void onClick(View v) {
if (mPlayer == null) {
return;
}
int pos = mPlayer.getCurrentPosition();
pos += 15000; // milliseconds
mPlayer.seekTo(pos);
setProgress();
show(sDefaultTimeout);
}
};
private void installPrevNextListeners() {
if (mNextButton != null) {
mNextButton.setOnClickListener(mNextListener);
mNextButton.setEnabled(mNextListener != null);
}
if (mPrevButton != null) {
mPrevButton.setOnClickListener(mPrevListener);
mPrevButton.setEnabled(mPrevListener != null);
}
}
public void setPrevNextListeners(View.OnClickListener next, View.OnClickListener prev) {
mNextListener = next;
mPrevListener = prev;
mListenersSet = true;
if (mRoot != null) {
installPrevNextListeners();
if (mNextButton != null && !mFromXml) {
mNextButton.setVisibility(View.VISIBLE);
}
if (mPrevButton != null && !mFromXml) {
mPrevButton.setVisibility(View.VISIBLE);
}
}
}
public interface MediaPlayerControl {
void start();
void pause();
int getDuration();
int getCurrentPosition();
void seekTo(int pos);
boolean isPlaying();
int getBufferPercentage();
boolean canPause();
boolean canSeekBackward();
boolean canSeekForward();
boolean isFullScreen();
int toggleFullScreen();
}
private static class MessageHandler extends Handler {
private final WeakReference<VideoControllerView> mView;
MessageHandler(VideoControllerView view) {
mView = new WeakReference<VideoControllerView>(view);
}
@Override
public void handleMessage(Message msg) {
VideoControllerView view = mView.get();
if (view == null || view.mPlayer == null) {
return;
}
int pos;
switch (msg.what) {
case FADE_OUT:
view.hide();
view.findViewById(R.id.screen_size_info).setVisibility(View.INVISIBLE);
break;
case SHOW_PROGRESS:
pos = view.setProgress();
if (!view.mDragging && view.mShowing && view.mPlayer.isPlaying()) {
msg = obtainMessage(SHOW_PROGRESS);
sendMessageDelayed(msg, 1000 - (pos % 1000));
}
break;
}
}
}
private static final int SURFACE_BEST_FIT = 0;
private static final int SURFACE_FIT_HORIZONTAL = 1;
private static final int SURFACE_FIT_VERTICAL = 2;
private static final int SURFACE_FILL = 3;
private static final int SURFACE_16_9 = 4;
private static final int SURFACE_4_3 = 5;
private static final int SURFACE_ORIGINAL = 6;
//private int mCurrentSize = SURFACE_BEST_FIT;
private TextView videoSizeInfoText;
private void showVideoSizeInfo(int currentSize) {
switch (currentSize) {
case SURFACE_BEST_FIT:
changeTextView(videoSizeInfoText, R.string.surface_best_fit);
break;
case SURFACE_FIT_HORIZONTAL:
changeTextView(videoSizeInfoText, R.string.surface_fit_horizontal);
break;
case SURFACE_FIT_VERTICAL:
changeTextView(videoSizeInfoText, R.string.surface_fit_vertical);
break;
case SURFACE_FILL:
changeTextView(videoSizeInfoText, R.string.surface_fill);
break;
case SURFACE_16_9:
videoSizeInfoText.setText("16:9");
break;
case SURFACE_4_3:
videoSizeInfoText.setText("4:3");
break;
case SURFACE_ORIGINAL:
changeTextView(videoSizeInfoText, R.string.surface_original);
break;
}
}
private void changeTextView(TextView view, int resId) {
view.setVisibility(View.VISIBLE);
view.setText(resId);
}
} | [
"clin602@gmail.com"
] | clin602@gmail.com |
af16a23b2b796c85e2e49250924c2417bc95b99b | 814a54cf26113f22977849744f6b8cb8f5c4b4c5 | /src/main/java/service/AgreeService.java | d1c4a4a853da6ab1864f2dfd9484ebcbe8d97133 | [] | no_license | Florence-y/UniversityMutualPlatform | 52f675cce2a6adbe600c2b93e00ccce8b90abd6f | e837dfa71d3c3acdb62b82e297a20079177703ea | refs/heads/master | 2023-04-10T15:13:37.601520 | 2021-04-16T14:18:30 | 2021-04-16T14:18:30 | 299,926,127 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package service;
import java.util.Map;
/**
* @author Florence
*/
public interface AgreeService {
/**
* 点赞
*
* @param agreeType 点赞的类型
* @param map 包含点赞需要的数据
* @return 返回状态码
*/
int agree(String agreeType, Map<String, Object> map);
/**
* 取消点赞
*
* @param agreeType 点赞
* @param map 包含点赞需要的数据
* @return 返回状态码
*/
int unAgree(String agreeType, Map<String, Object> map);
/**
* 获取某个问题或者回答的点赞
*
* @param type 类型 :question answer
* @param id 他们的id
* @return 计数
*/
int getAgreeCountQuestionOrAnswer(String type, Object id);
/**
* 某个人是否点赞过问题或者回答
*
* @param type 类型:question answer
* @param id 他们的id
* @param markNumber 用户的学号
* @return 是否点赞
*/
boolean isAgree(String type, Object id, String markNumber);
}
| [
"2213576511@qq.com"
] | 2213576511@qq.com |
87aa13e678a519792bb3065c227463628ff35dd0 | 94bdf752d8b34ee36348d89cd9bd20aa7a301049 | /app/src/main/java/com/fernando_carrillo/sunshine/ForcastFragment.java | e47285a7b905b7e6ed43163950f12d70b18600cc | [] | no_license | FernandoC/SunshineApp | 9d48f2281aabb59a44f0ac6584778cf23e069337 | 91dec6ee2a9ed9136ffc68b5da795750eca23252 | refs/heads/master | 2021-01-10T17:19:15.730834 | 2015-10-23T23:00:07 | 2015-10-23T23:00:07 | 44,841,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,246 | java | package com.fernando_carrillo.sunshine;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.text.format.Time;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
/**
* A fragment containing The forcast.
*/
public class ForcastFragment extends Fragment {
private ArrayAdapter<String> mForcastAdapter;
public ForcastFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
inflater.inflate(R.menu.forcast_fragment, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
// Handle item selection
switch (item.getItemId()) {
case R.id.action_refresh:
updateWeather();
return true;
case R.id.action_settings:
//Launches the Settings Activity
Intent intent = new Intent(getActivity(), SettingsActivity.class);
startActivity(intent);
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
ArrayList<String> fakeData = new ArrayList<String>();
fakeData.add("Today-Sunny-88/63");
fakeData.add("Tomorrow-Cloudy-88/63");
fakeData.add("Saturday-Hot-88/63");
fakeData.add("Sunday-Freezing-88/63");
fakeData.add("Monday-Sunny-88/63");
fakeData.add("Tuesday-Sunny-88/63");
fakeData.add("Saturday-Hot-88/63");
fakeData.add("Sunday-Freezing-88/63");
fakeData.add("Monday-Sunny-88/63");
fakeData.add("Tuesday-Sunny-88/63");
fakeData.add("Saturday-Hot-88/63");
fakeData.add("Sunday-Freezing-88/63");
fakeData.add("Monday-Sunny-88/63");
fakeData.add("Tuesday-Sunny-88/63");
mForcastAdapter = new ArrayAdapter<String>(
getActivity(),
R.layout.list_item_forcast,
R.id.list_item_forcast_textview,
fakeData
);
ListView listView = (ListView) rootView.findViewById(R.id.listview_forcast);
listView.setAdapter(mForcastAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String forcast = mForcastAdapter.getItem(position);
//Makes a Toast for debugging Purposes
int duration = Toast.LENGTH_SHORT;
Toast.makeText(getActivity(), forcast, duration).show();
//Launches the detail Activity
Intent intent = new Intent(getActivity(), DetailActivity.class)
.putExtra(Intent.EXTRA_TEXT, forcast);
startActivity(intent);
}
});
return rootView;
}
private void updateWeather(){
FetchWeatherTask weatherTask = new FetchWeatherTask();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
String location = prefs.getString(getString(R.string.pref_location_key),
getString(R.string.pref_location_default));
weatherTask.execute(location);
}
@Override
public void onStart(){
super.onStart();
updateWeather();
}
public class FetchWeatherTask extends AsyncTask<String, Void, String[]> {
private final String mLog = FetchWeatherTask.class.getSimpleName();
@Override
protected String[] doInBackground(String... params){
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
final String FORECAST_BASE_URL = "http://api.openweathermap.org/data/2.5/forecast/daily?";
final String QUERY_PARAM = "q";
final String FORMAT_PARAM = "mode";
final String UNIT_PARAM = "metric";
final String DAYS_PARAM = "cnt";
final String APPID_PARAM = "APPID";
Uri uri = Uri.parse(FORECAST_BASE_URL).buildUpon()
.appendQueryParameter(QUERY_PARAM, params[0])
.appendQueryParameter(FORMAT_PARAM, "json")
.appendQueryParameter(UNIT_PARAM, "metric")
.appendQueryParameter(DAYS_PARAM, "7")
.appendQueryParameter(APPID_PARAM, BuildConfig.OPEN_WEATHER_MAP_API_KEY)
.build();
Log.v(mLog, "URI = " + uri.toString());
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
// Possible parameters are avaiable at OWM's forecast API page, at
// http://openweathermap.org/API#forecast
URL url = new URL(uri.toString());
// Create the request to OpenWeatherMap, and open the connection
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
// Read the input stream into a String
InputStream inputStream = urlConnection.getInputStream();
StringBuffer buffer = new StringBuffer();
if (inputStream == null) {
// Nothing to do.
return null;
}
reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
// Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
// But it does make debugging a *lot* easier if you print out the completed
// buffer for debugging.
buffer.append(line + "\n");
}
if (buffer.length() == 0) {
// Stream was empty. No point in parsing.
return null;
}
forecastJsonStr = buffer.toString();
Log.v(mLog, "Forcast JSON String: " + forecastJsonStr);
return getWeatherDataFromJson(forecastJsonStr, 7);
} catch (IOException e) {
Log.e(mLog, "Error ", e);
// If the code didn't successfully get the weather data, there's no point in attemping
// to parse it.
return null;
} catch (JSONException e){
Log.e(mLog, "Error with json", e);
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
if (reader != null) {
try {
reader.close();
} catch (final IOException e) {
Log.e(mLog, "Error closing stream", e);
}
}
}
return null;
}
/* The date/time conversion code is going to be moved outside the asynctask later,
* so for convenience we're breaking it out into its own method now.
*/
private String getReadableDateString(long time){
// Because the API returns a unix timestamp (measured in seconds),
// it must be converted to milliseconds in order to be converted to valid date.
SimpleDateFormat shortenedDateFormat = new SimpleDateFormat("EEE MMM dd");
return shortenedDateFormat.format(time);
}
/**
* Prepare the weather high/lows for presentation.
*/
private String formatHighLows(double high, double low) {
// For presentation, assume the user doesn't care about tenths of a degree.
long roundedHigh = Math.round(high);
long roundedLow = Math.round(low);
String highLowStr = roundedHigh + "/" + roundedLow;
return highLowStr;
}
/**
* Take the String representing the complete forecast in JSON Format and
* pull out the data we need to construct the Strings needed for the wireframes.
*
* Fortunately parsing is easy: constructor takes the JSON string and converts it
* into an Object hierarchy for us.
*/
private String[] getWeatherDataFromJson(String forecastJsonStr, int numDays)
throws JSONException {
// These are the names of the JSON objects that need to be extracted.
final String OWM_LIST = "list";
final String OWM_WEATHER = "weather";
final String OWM_TEMPERATURE = "temp";
final String OWM_MAX = "max";
final String OWM_MIN = "min";
final String OWM_DESCRIPTION = "main";
JSONObject forecastJson = new JSONObject(forecastJsonStr);
JSONArray weatherArray = forecastJson.getJSONArray(OWM_LIST);
// OWM returns daily forecasts based upon the local time of the city that is being
// asked for, which means that we need to know the GMT offset to translate this data
// properly.
// Since this data is also sent in-order and the first day is always the
// current day, we're going to take advantage of that to get a nice
// normalized UTC date for all of our weather.
Time dayTime = new Time();
dayTime.setToNow();
// we start at the day returned by local time. Otherwise this is a mess.
int julianStartDay = Time.getJulianDay(System.currentTimeMillis(), dayTime.gmtoff);
// now we work exclusively in UTC
dayTime = new Time();
String[] resultStrs = new String[numDays];
for(int i = 0; i < weatherArray.length(); i++) {
// For now, using the format "Day, description, hi/low"
String day;
String description;
String highAndLow;
// Get the JSON object representing the day
JSONObject dayForecast = weatherArray.getJSONObject(i);
// The date/time is returned as a long. We need to convert that
// into something human-readable, since most people won't read "1400356800" as
// "this saturday".
long dateTime;
// Cheating to convert this to UTC time, which is what we want anyhow
dateTime = dayTime.setJulianDay(julianStartDay+i);
day = getReadableDateString(dateTime);
// description is in a child array called "weather", which is 1 element long.
JSONObject weatherObject = dayForecast.getJSONArray(OWM_WEATHER).getJSONObject(0);
description = weatherObject.getString(OWM_DESCRIPTION);
// Temperatures are in a child object called "temp". Try not to name variables
// "temp" when working with temperature. It confuses everybody.
JSONObject temperatureObject = dayForecast.getJSONObject(OWM_TEMPERATURE);
double high = temperatureObject.getDouble(OWM_MAX);
double low = temperatureObject.getDouble(OWM_MIN);
highAndLow = formatHighLows(high, low);
resultStrs[i] = day + " - " + description + " - " + highAndLow;
}
//for (String s : resultStrs) {
// Log.v(mLog, "Forecast entry: " + s);
//}
return resultStrs;
}
@Override
protected void onPostExecute(String[] weatherData){
if(weatherData != null) {
mForcastAdapter.clear();
for (String day : weatherData) {
mForcastAdapter.add(day);
}
}
}
}
}
| [
"carrilloFern@gmail.com"
] | carrilloFern@gmail.com |
bdd674c70491cda39aca6c31fd2fecb609a17683 | 06a77497c74f51d1316b0ec0b0c6878a81c724dc | /teams/SprintSubIThink/Missile.java | 994f0d7f54af28bfad1014928e2c3ce1f07398b5 | [
"MIT"
] | permissive | 3urningChrome/battlecode2015 | 871d2cf314d2e87358330362fe2efea67a07cbfd | 00ffbe53754d44d7dee79f950448543454a5dd5a | refs/heads/master | 2016-09-06T00:43:23.482834 | 2015-01-29T07:49:24 | 2015-01-29T07:49:24 | 28,828,062 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,199 | java | package SprintSubIThink;
import battlecode.common.Direction;
import battlecode.common.GameActionException;
import battlecode.common.GameConstants;
import battlecode.common.MapLocation;
import battlecode.common.RobotController;
public class Missile {
static final int HASH = Math.max(GameConstants.MAP_MAX_WIDTH,GameConstants.MAP_MAX_HEIGHT);
static final int orders_broadcast_offset = 200 + (HASH * HASH);
static RobotController rc;
Missile(RobotController the_rc) {
rc = the_rc;
//turn 1
//read direction from channel
int direction = read_broadcast(orders_broadcast_offset + location_channel(rc.getLocation()));
move(Direction.values()[direction]);
rc.yield();
//turn 2
//read direction otherwise, carry on
if(rc.isCoreReady()){
direction = read_broadcast(orders_broadcast_offset + location_channel(rc.getLocation()));
move(Direction.values()[direction]);
if(rc.senseNearbyRobots(2, rc.getTeam().opponent()).length > 0){
if(rc.senseNearbyRobots(2, rc.getTeam()).length < 1){
explode();
}
}
}
rc.yield();
//turn 3
//read direction otherwise, carry on
if(rc.isCoreReady()){
direction = read_broadcast(orders_broadcast_offset + location_channel(rc.getLocation()));
move(Direction.values()[direction]);
if(rc.senseNearbyRobots(2, rc.getTeam().opponent()).length > 0){
if(rc.senseNearbyRobots(2, rc.getTeam()).length < 1){
explode();
}
}
}
rc.yield();
//turn 4
//read direction otherwise, carry on
if(rc.isCoreReady()){
direction = read_broadcast(orders_broadcast_offset + location_channel(rc.getLocation()));
move(Direction.values()[direction]);
if(rc.senseNearbyRobots(2, rc.getTeam().opponent()).length > 0){
if(rc.senseNearbyRobots(2, rc.getTeam()).length < 1){
explode();
}
}
}
rc.yield();
//turn 5
//read direction otherwise, carry on
if(rc.isCoreReady()){
direction = read_broadcast(orders_broadcast_offset + location_channel(rc.getLocation()));
move(Direction.values()[direction]);
if(rc.senseNearbyRobots(2, rc.getTeam().opponent()).length > 0){
if(rc.senseNearbyRobots(2, rc.getTeam()).length < 1){
explode();
}
}
}
rc.yield();
//turn 6
//read direction otherwise, carry on
direction = read_broadcast(orders_broadcast_offset + location_channel(rc.getLocation()));
move(Direction.values()[direction]);
if(rc.senseNearbyRobots(2, rc.getTeam()).length > 0){
rc.disintegrate();;
}
explode();
rc.yield();
}
public int location_channel(MapLocation encode_this_location){
MapLocation return_location = new MapLocation(((encode_this_location.x % HASH) + HASH) % HASH,((encode_this_location.y % HASH) + HASH) % HASH);
return (return_location.x * HASH) + return_location.y;
}
public int read_broadcast(int channel){
try{
return rc.readBroadcast(channel);
} catch (Exception e){
System.out.println("Exception missile!");
}
return 0;
}
public void move(Direction direction){
if (rc.canMove(direction)){
try{
rc.move(direction);
}catch (Exception e){
e.printStackTrace();
}
}
}
public void explode(){
try{
rc.explode();
}catch (Exception e){
System.out.println("Exceptional missiles");
}
}
}
// int created_on = Clock.getRoundNum();
// RobotController robot_controller;
//
// public Missile(RobotController rc) {
// robot_controller = rc;
// MapLocation enemy_HQ_location = robot_controller.getLocation();
//
//
// //move toward closest enemy.
// //move in direction fired...
// int attack_distance = 6 - (Clock.getRoundNum() - created_on);
// attack_distance *= attack_distance;
// RobotInfo[] nearby_robots = robot_controller.senseNearbyRobots(attack_distance, robot_controller.getTeam().opponent());
//System.out.println("Missile Time1: " + Clock.getBytecodeNum() + " created_on:" + created_on);
// int closest_enemy = 9999;
// int pos_closest_enemy = -1;
// Direction enemyDirection = robot_controller.getLocation().directionTo(enemy_HQ_location);
// for(int i=0; i < nearby_robots.length;i++){
// if(robot_controller.getLocation().distanceSquaredTo(nearby_robots[i].location) < closest_enemy && !nearby_robots[i].type.equals(RobotType.MISSILE)){
// closest_enemy = robot_controller.getLocation().distanceSquaredTo(nearby_robots[i].location);
// pos_closest_enemy = i;
// }
// }
// System.out.println("Missile Time2: " + Clock.getBytecodeNum() + " created_on:" + created_on );
// if(pos_closest_enemy >= 0){
// enemyDirection = robot_controller.getLocation().directionTo(nearby_robots[pos_closest_enemy].location);
// }
//
//
// if (robot_controller.canMove(enemyDirection)){
// try{
// robot_controller.move(enemyDirection);
// }catch (Exception e){
// System.out.println("Exception e");
// }
// }
//
// robot_controller.yield();
//
// while(true){
// //move toward closest enemy.
// //move in direction fired...
// attack_distance = 6 - (Clock.getRoundNum() - created_on);
// attack_distance *= attack_distance;
// nearby_robots = robot_controller.senseNearbyRobots(attack_distance, robot_controller.getTeam().opponent());
//System.out.println("Missile Time1: " + Clock.getBytecodeNum() + " created_on:" + created_on);
// closest_enemy = 9999;
// pos_closest_enemy = -1;
// enemyDirection = robot_controller.getLocation().directionTo(enemy_HQ_location);
// for(int i=0; i < nearby_robots.length;i++){
// if(robot_controller.getLocation().distanceSquaredTo(nearby_robots[i].location) < closest_enemy && !nearby_robots[i].type.equals(RobotType.MISSILE)){
// closest_enemy = robot_controller.getLocation().distanceSquaredTo(nearby_robots[i].location);
// pos_closest_enemy = i;
// }
// }
// System.out.println("Missile Time2: " + Clock.getBytecodeNum() + " created_on:" + created_on );
// if(pos_closest_enemy >= 0){
// enemyDirection = robot_controller.getLocation().directionTo(nearby_robots[pos_closest_enemy].location);
// }
//
// RobotInfo[] friendly_fire = robot_controller.senseNearbyRobots(2, robot_controller.getTeam());
// int friend_count = 0;
// for(RobotInfo friend : friendly_fire){
// if(friend.type != RobotType.MISSILE){
// friend_count +=1;
// }
// }
// System.out.println("Missile Time3: " + Clock.getBytecodeNum() + " created_on:" + created_on );
//
// if(friend_count > 0){
// if ((Clock.getRoundNum() - created_on) == 5){
// robot_controller.disintegrate();
// }
// }else{
// if ((Clock.getRoundNum() - created_on)== 5){
// try{
// robot_controller.explode();
// }catch(Exception e){
// System.out.println("Boom");
// }
// } else{
// if(closest_enemy <= 2){
// try{
// robot_controller.explode();
// }catch(Exception e){
// System.out.println("Boom");
// }
// }
// }
// }
// System.out.println("Missile Time4: " + Clock.getBytecodeNum() + " created_on:" + created_on );
//
// if (robot_controller.canMove(enemyDirection)){
// try{
// robot_controller.move(enemyDirection);
// }catch (Exception e){
// System.out.println("Exception e");
// }
// }
//
// robot_controller.yield();
// }
// }
| [
"christop_phillips@hotmail.com"
] | christop_phillips@hotmail.com |
94e964f983c46820d944fb698da9c18f5ad77f36 | c0ab48edf55918507dde130bcb33dab3d863ca4c | /src/main/java/dev/astamur/concurrency/primitives/other/PingPongWithQueue.java | 53f6be50107f1652f2bb28380626ef4e964d7fb8 | [] | no_license | astamur/concurrency-examples | 7c616c9b4699edf5890d5db4f3cc82a0337db27a | fadc3f4370f1c17f38d068d0407d59697c5a9176 | refs/heads/master | 2021-01-11T07:24:28.490552 | 2020-07-01T16:37:01 | 2020-07-01T16:37:01 | 72,450,516 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,178 | java | package dev.astamur.concurrency.primitives.other;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.stream.IntStream;
public class PingPongWithQueue {
private final Queue<String> pings = new LinkedList<>();
private final Queue<String> pongs = new LinkedList<>();
private volatile boolean state = true;
public synchronized void ping() {
try {
pings.offer("Ping");
while (!state) {
wait();
}
System.out.println(pongs.poll() + " - " + Thread.currentThread().getName());
state = false;
notify();
} catch (InterruptedException e) {
System.out.println(Thread.currentThread().getName() + " was interrupted");
Thread.currentThread().interrupt();
}
}
public synchronized void pong() {
try {
pings.offer("Pong");
while (state) {
wait();
}
System.out.println(pings.poll() + " - " + Thread.currentThread().getName());
state = true;
notify();
} catch (InterruptedException e) {
System.out.println(Thread.currentThread().getName() + " was interrupted");
Thread.currentThread().interrupt();
}
}
public static void main(String[] args) throws InterruptedException {
PingPong pingPong = new PingPong();
Thread[] pingers = new Thread[10];
Thread[] pongers = new Thread[10];
IntStream.range(0, 10).forEach(i -> {
pingers[i] = new Thread(() -> {
while (!Thread.currentThread().isInterrupted()) {
pingPong.ping();
}
});
pongers[i] = new Thread(() -> {
while (!Thread.currentThread().isInterrupted()) {
pingPong.pong();
}
});
pingers[i].start();
pongers[i].start();
});
Thread.sleep(100);
Arrays.stream(pingers).forEach(Thread::interrupt);
Arrays.stream(pongers).forEach(Thread::interrupt);
}
} | [
"astamur.kirillin@gmail.com"
] | astamur.kirillin@gmail.com |
54d3233e0cc39ea03022d3394eac12d2cc2433be | 91f545ab18c7f5e714d64b3016ca15d2bcf4774e | /wsclient/src/pro/webws/client/IHelloWorld.java | 49c7a239cdd8664bc8588f16067dbb7e2f67f0cc | [] | no_license | bzrujie/test | a0c1f176d2135300cd698402beb957b494fcfb88 | 110829fd005db4abefc0de182ac47057a09287c3 | refs/heads/master | 2016-09-06T03:37:22.898057 | 2015-03-30T14:20:28 | 2015-03-30T14:20:28 | 32,199,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package pro.webws.client;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface IHelloWorld {
//@WebParam(name="arg0")可有可无,为了增强可读性
public String sayHello(@WebParam(name="arg0")String text);
}
| [
"bzrujie@163.com"
] | bzrujie@163.com |
f0e3a47663e2cb70cf0e3cf67ba684993f0aca60 | a290508b93a33d5c82e7efcf5cb489481aeeff64 | /homework6/src/homework6/GeometricObject.java | 0522671097244acedcb8277cb563e32605e97d0f | [] | no_license | wsj1122/homework6 | 3c69013be5b25bc6c47861deb65e987f87d5ddeb | 30167c7768075112d68a7c90d5185f3b2ba4397f | refs/heads/master | 2023-04-21T05:13:31.889920 | 2021-04-26T03:10:49 | 2021-04-26T03:10:49 | 361,600,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 835 | java | package homework6;
public class GeometricObject {
private String color = "white";
protected boolean filled;
private java.util.Date dateCreated;
public GeometricObject() {
dateCreated = new java.util.Date();
}
public GeometricObject(String color ,boolean filled) {
dateCreated = new java.util.Date();
this.color = color;
this.filled = filled;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public boolean isFilled() {
return filled;
}
public void setFilled(boolean filled) {
this.filled = filled;
}
public java.util.Date getDateCreated(){
return dateCreated;
}
public String toString() {
return "created on " + dateCreated + "\ncolor:" + color +
"and filled:" + filled;
}
}
| [
"3306852830@qq.com"
] | 3306852830@qq.com |
9e2a4c67b775e62cd283bbf8a9d842e437e94a21 | 99dfacbdb2dbe59e8822a8a422feebcf9b4f84e1 | /user-sdk/src/main/java/com/spaceship/user/client/StringUtil.java | 6d317e0b5464489e3e2d5d4602e8a738e93a9039 | [] | no_license | simon-atta/spaceship | e389f0c7e7dabee4f002f71ba541eb756bf6e31b | ddf729fc857bede8438f56ff302eb2e20e46a174 | refs/heads/master | 2021-09-26T21:29:06.214609 | 2021-09-15T16:48:08 | 2021-09-15T16:48:08 | 168,671,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,772 | java | /*
* User Protocal API
* User Protocal API help for commincate between users
* OpenAPI spec version: 1.0
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.spaceship.user.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-05-19T16:17:59.908Z")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive
* comparison).
*
* @param array
* The array
* @param value
* The value to search
* @return true if the array contains the value
*/
public static boolean containsIgnoreCase(String[] array, String value) {
for (String str : array) {
if (value == null && str == null) return true;
if (value != null && value.equalsIgnoreCase(str)) return true;
}
return false;
}
/**
* Join an array of strings with the given separator.
* <p>
* Note: This might be replaced by utility method from commons-lang or guava
* someday
* if one of those libraries is added as dependency.
* </p>
*
* @param array
* The array of strings
* @param separator
* The separator
* @return the resulting string
*/
public static String join(String[] array, String separator) {
int len = array.length;
if (len == 0) return "";
StringBuilder out = new StringBuilder();
out.append(array[0]);
for (int i = 1; i < len; i++) {
out.append(separator).append(array[i]);
}
return out.toString();
}
}
| [
"simon.ghobreil1@ikea.com"
] | simon.ghobreil1@ikea.com |
ba7f8ac51fd219e0b4545a823e33fff1fb381fff | 4dc69d8757daa29b7389c06f3ae0e3583c38d9dd | /app/src/test/java/song/of/god/ExampleUnitTest.java | ca065837044dd5616ed09129c36b1e4482ecf5fe | [] | no_license | samyakjain/Song-Of-God | 742b8f5fcb3e732db74ebd5e06c9d389b537cbb6 | e6b635599487b3088dc14fe27b7cf9b4fd755d3c | refs/heads/master | 2020-05-18T08:59:07.080735 | 2019-05-05T07:07:00 | 2019-05-05T07:07:00 | 184,311,045 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package song.of.god;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"me.samyakjain@gmail.com"
] | me.samyakjain@gmail.com |
2fa99c0d472dd1414c90b5e4ccc8f41daa809b22 | e54d1e3592494fc6c9bc8cfe3152d6aa9576e4d5 | /src/com/jiwei/result/JsonResult.java | 254e32939b147683035f4cc54155566575a91c6b | [] | no_license | fqeqiq168/cixi | b57f0d4621b6d9e1a4ab1c259caa1857594a91c5 | 6a447497c3623daeba7e3cc61a7d323d26394ee3 | refs/heads/master | 2020-04-14T20:04:28.543970 | 2019-01-04T09:26:38 | 2019-01-04T09:26:38 | 164,081,284 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 829 | java | package com.jiwei.result;
/**
* Author: D.Yang
* Email: koyangslash@gmail.com
* Date: 16/8/31
* Time: 下午5:50
* Describe: 封装Json返回信息
*/
public class JsonResult {
private boolean success;
private String status;
private String msg;
private Object obj;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
}
| [
"fqeqiq168@sina.com"
] | fqeqiq168@sina.com |
8dfa83ac734b34dbd66ba66d583f53ee962294b4 | 58d9997a806407a09c14aa0b567e57d486b282d4 | /com/planet_ink/coffee_mud/Locales/MetalRoom.java | dab5ff309ceb26627c2c5e12e3241575a90337a8 | [
"Apache-2.0"
] | permissive | kudos72/DBZCoffeeMud | 553bc8619a3542fce710ba43bac01144148fe2ed | 19a3a7439fcb0e06e25490e19e795394da1df490 | refs/heads/master | 2021-01-10T07:57:01.862867 | 2016-03-17T23:04:25 | 2016-03-17T23:04:25 | 39,215,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | package com.planet_ink.coffee_mud.Locales;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2004-2014 Bo Zimmerman
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.
*/
public class MetalRoom extends StdRoom
{
@Override public String ID(){return "MetalRoom";}
public MetalRoom()
{
super();
name="the room";
basePhyStats.setWeight(1);
recoverPhyStats();
climask=Places.CLIMASK_NORMAL;
}
@Override public int domainType(){return Room.DOMAIN_INDOORS_METAL;}
}
| [
"kirk.narey@gmail.com"
] | kirk.narey@gmail.com |
4f00c78e77552134440f2f4aca387e9fde2bfe24 | 2d344d3e6eb4374558a482836c2f6e03f38fa90d | /nearByShops-data/src/main/java/org/nearByShops/data/model/utils/DislikedUserShopKey.java | 83acf1230c4987b7327e8c80dd81efe29f6e841f | [] | no_license | mesbahiAouam/Near-shops | 2909181fc513ce9e8c71eafd375d84f4fdf97712 | 90fc8d66945d7d194356215a4db1f8639f37909a | refs/heads/master | 2020-07-10T20:00:17.886533 | 2019-08-27T18:45:42 | 2019-08-27T18:45:42 | 204,352,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package org.nearByShops.data.model.utils;
import java.io.Serializable;
import javax.persistence.Embeddable;
@Embeddable
public class DislikedUserShopKey implements Serializable {
private static final long serialVersionUID = 1L;
private int userId;
private int shopId;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getShopId() {
return shopId;
}
public void setShopId(int shopId) {
this.shopId = shopId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + shopId;
result = prime * result + userId;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DislikedUserShopKey other = (DislikedUserShopKey) obj;
if (shopId != other.shopId)
return false;
if (userId != other.userId)
return false;
return true;
}
}
| [
"mesbahi.aouam@gmail.com"
] | mesbahi.aouam@gmail.com |
11f922dbeb5291dcf4652a4c1bd613a261fc1e68 | aec9164a239ba6633bcb29253c10f13281c44847 | /src/main/java/com/sort/learn/CountSort.java | 55f344174b02b38529e7969a1f5908049bf71aa5 | [] | no_license | Gisliyong/algorithm | 4535f401789fed5207a55d378fc6a76ca872aa61 | 9180667405d51a445d6034cc3b4d133f1e98e50c | refs/heads/master | 2023-04-24T01:12:04.577075 | 2021-05-21T11:54:34 | 2021-05-21T11:54:34 | 356,491,367 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.sort.learn;
// 桶排序(计数排序)
/**
* 需要了解数据状况
* 算法时间复杂度为O(n)
*/
public class CountSort {
public static void main(String[] args) {
}
}
| [
"dixin_liyong@163.com"
] | dixin_liyong@163.com |
f96eb2b318404ad58be081245b6148445a67fd2f | 920eb2f94599e6f490dc076b5ecfc4b53763abc1 | /src/com/internousdev/template/action/UserCreateConfirmAction.java | ebdc901d1e5ca34c398a6628ecbb04f83bec568a | [] | no_license | Nagoshi06/copy-template | 06005f250236a89efcc0b05ed00619a6c2309e37 | 7b4d6c571ca6133459a83aab119fe6306a497613 | refs/heads/master | 2021-08-22T13:21:06.560673 | 2017-11-30T08:39:58 | 2017-11-30T08:39:58 | 112,586,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | package com.internousdev.template.action;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
public class UserCreateConfirmAction extends ActionSupport implements SessionAware{
private String loginUserId;
private String loginPassword;
private String userName;
public Map<String,Object> session;
private String result;
private String errorMassage;
/**
* 入力情報格納処理
*/
public String execute() {
result=SUCCESS;
if(!(loginUserId.equals(""))&&!(loginPassword.equals(""))&&!(userName.equals(""))){
session.put("loginUserId",loginUserId);
session.put("loginPassword",loginPassword);
session.put("userName",userName);
}else{
setErrorMassage("未入力の項目があります。");
result=ERROR;
}
return result;
}
public String getLoginUserId() {
return loginUserId;
}
public void setLoginUserId(String loginUserId) {
this.loginUserId = loginUserId;
}
public String getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(String loginPassword) {
this.loginPassword = loginPassword;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getErrorMassage() {
return errorMassage;
}
public void setErrorMassage(String errorMassage) {
this.errorMassage = errorMassage;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
}
| [
"t.nagoshi06@gmail.com"
] | t.nagoshi06@gmail.com |
ff26f9165e85d1355f5c4943dae23f034ab87b79 | b3f0b43d8e0e0187ea4d260b746f6b45ccf9e97d | /examples/robot/basic-robot/src/main/java/robot/RobotMap.java | 5da2a0b6937f2293bfcfdf44d3776720c26398dd | [
"BSD-3-Clause"
] | permissive | Flash3388/FlashLib | 55cfacd40ad39f4f12b48250e73992c6696f5bd8 | 482c626ff66d457525abda984933375d159a537e | refs/heads/master | 2023-07-20T02:50:46.912408 | 2023-07-06T19:26:45 | 2023-07-06T19:26:45 | 90,011,594 | 14 | 1 | BSD-3-Clause | 2023-05-06T13:55:15 | 2017-05-02T08:51:16 | Java | UTF-8 | Java | false | false | 749 | java | package robot;
import com.flash3388.flashlib.hid.HidChannel;
import com.flash3388.flashlib.io.IoChannel;
public class RobotMap {
private RobotMap() {}
public static final IoChannel DRIVE_MOTOR_FRONT = new IoChannel.Stub();
public static final IoChannel DRIVE_MOTOR_RIGHT = new IoChannel.Stub();
public static final IoChannel DRIVE_MOTOR_BACK = new IoChannel.Stub();
public static final IoChannel DRIVE_MOTOR_LEFT = new IoChannel.Stub();
public static final IoChannel SHOOTER_MOTOR = new IoChannel.Stub();
public static final IoChannel SHOOTER_MOTOR2 = new IoChannel.Stub();
public static final IoChannel SHOOTER_SOLENOID = new IoChannel.Stub();
public static final HidChannel XBOX = new HidChannel.Stub();
}
| [
"tomtzook@gmail.com"
] | tomtzook@gmail.com |
75fa4396e4cbfd6e3214dea6b8b2a4d359de47be | 988d4092687ad07dc5c419f2d349106c708e8b06 | /YummyOrderSystem/src/yummy/servlets/ClientGetResDisServlet.java | 260b634ec9be809c4dc8b818545d2aafe57bbc8a | [] | no_license | Oikwsan/Yummy | 6b081d9960cb01401298c7a9719beba9e572641d | 9b8c23294b6691a2910bbe5eadffb30a27b1a85d | refs/heads/master | 2020-06-07T13:37:35.942237 | 2019-06-21T03:46:18 | 2019-06-21T03:46:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,617 | java | package yummy.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.google.gson.Gson;
import yummy.model.Discount;
import yummy.service.ManagerService;
import yummy.service.RestaurantService;
/**
* Servlet implementation class ClientGetResDisServlet
*/
@WebServlet("/ClientGetResDisServlet")
public class ClientGetResDisServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static ApplicationContext appliationContext;
private static RestaurantService restaurantService;
/**
* @see HttpServlet#HttpServlet()
*/
public ClientGetResDisServlet() {
super();
// TODO Auto-generated constructor stub
}
public void init() throws ServletException {
super.init();
appliationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
restaurantService = (RestaurantService)appliationContext.getBean("RestaurantService");
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String rid = request.getParameter("rid");
System.out.println("rid: "+rid);
ArrayList<Discount> dis = restaurantService.getRestaurantDis(Integer.parseInt(rid));
Gson gson = new Gson();
String json = gson.toJson(dis);
System.out.println(json);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter writer = response.getWriter();
writer.append(json);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
doGet(request, response);
}
}
| [
"610137708@qq.com"
] | 610137708@qq.com |
2875c156498acce1b37711dbf932fa4be416ae26 | 3913e308aac77c57f34ff3a4aafd442005c987db | /NoteServices/src/main/java/com/microusers/noteservices/dto/LabelToNoteDto.java | 1d896d7790e1613c563096cac16836fd959fae97 | [] | no_license | ankita13-1997/Fundoo_Cloud_deploye | 44614c4b070542c8f029b4936c0cf1fe8a7ef591 | bda73123ade84ccea62a0405091bfa094bb28557 | refs/heads/master | 2023-06-27T04:52:30.419596 | 2021-07-16T17:36:16 | 2021-07-16T17:36:16 | 386,553,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.microusers.noteservices.dto;
import com.microusers.noteservices.model.LabelDetailsModel;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.UUID;
@Data
public class LabelToNoteDto {
@NotNull(message = "The noteId field should not be empty")
private UUID noteId;
private List<LabelDetailsModel> labels;
}
| [
"parhiankita@gmail.com"
] | parhiankita@gmail.com |
71ae9dc7f5423aea6185e10bba08c7e76351b11e | 10243859d826e7ea72d3f512db7e8970135379ee | /src/day16_String/checkWords.java | c5838fec137fb9ac6b707c8a513b64b95361cac0 | [] | no_license | Mosavi1988/summer_2020 | febaa544169805242c211ad28ceb43eb342dda15 | db6c92be8efc259896712b0d141491a06f9911bc | refs/heads/master | 2022-12-12T22:28:32.047929 | 2020-09-02T23:36:57 | 2020-09-02T23:36:57 | 282,464,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,268 | java | package day16_String;
public class checkWords {
public static void main(String[] args) {
String str = "book";
// last index = length-1
// second index = length -2
// third index = length -3
if (str.length() == 0) {
System.out.println("empty string");
} else if (str.length() >= 3) {
System.out.println(str.substring(str.length() - 3));
} else {
System.out.println(str);
}
String result = (str.length() == 0) ? "empty string" : (str.length() >= 3) ? str.substring(str.length() - 3) : str;
System.out.println(result);
System.out.println("=======================================================================================");
String str1 = "ab";
String str2 = "abc";
String str3 = "ab";
if (str1.length() == str2.length() && str1.length() == str3.length()) {
System.out.println("All words are same length");
} else if (str1.length() != str2.length() && str2.length() != str3.length() && str1.length() != str3.length()){
System.out.println("All different length");
}else {
System.out.println("Not same nor Different length");
}
}
}
| [
"zh_mosavi@hotmail.com"
] | zh_mosavi@hotmail.com |
7748175c86039c4df1eeb10365f0565736fb46f2 | d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f | /main/com/zfsoft/xgxt/xpjpy/xmsz/xmwh/XmwhService.java | 76f5ed8b8bc0011a4cb8ee5b0ddc299b2cce9ade | [] | no_license | gxlioper/xajd | 81bd19a7c4b9f2d1a41a23295497b6de0dae4169 | b7d4237acf7d6ffeca1c4a5a6717594ca55f1673 | refs/heads/master | 2022-03-06T15:49:34.004924 | 2019-11-19T07:43:25 | 2019-11-19T07:43:25 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 14,053 | java | /**
* @部门:学工产品事业部
* @日期:2013-7-30 下午02:39:49
*/
package com.zfsoft.xgxt.xpjpy.xmsz.xmwh;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import com.zfsoft.xgxt.xsxx.xsgl.XsxxDao;
import xgxt.action.Base;
import com.zfsoft.xgxt.base.service.impl.SuperServiceImpl;
import com.zfsoft.xgxt.base.util.UniqID;
import com.zfsoft.xgxt.xpjpy.cssz.CsszDao;
import com.zfsoft.xgxt.xpjpy.cssz.CsszModel;
import com.zfsoft.xgxt.xpjpy.cssz.CsszService;
import com.zfsoft.xgxt.xpjpy.wdpj.sqsh.SqshService;
import com.zfsoft.xgxt.xpjpy.xmsz.jdsz.JdszService;
import com.zfsoft.xgxt.xpjpy.xmsz.tjsz.TjszModel;
import com.zfsoft.xgxt.xpjpy.xmsz.tjsz.TjszService;
import com.zfsoft.xgxt.xpjpy.xmsz.tzsz.TzszService;
/**
* @系统名称: 学生工作管理系统
* @模块名称: 评奖评优管理模块
* @类功能描述: 项目维护
* @作者: Penghui.Qu [工号:445]
* @时间: 2013-7-30 下午02:39:49
* @版本: V1.0
* @修改记录: 类修改者-修改日期-修改说明
*/
public class XmwhService extends SuperServiceImpl<XmwhModel, XmwhDao> {
private XmwhDao dao = new XmwhDao();
public XmwhService() {
super.setDao(dao);
}
/**
*
* @描述: 开放申请或上报的评奖项目
* @作者:Penghui.Qu [工号:445]
* @日期:2013-7-30 下午02:59:48
* @修改记录: 修改者名字-修改日期-修改内容
* @return List<HashMap<String,String>> 返回类型
*/
public List<HashMap<String, String>> getKfsqPjxm() {
return dao.getKfsqPjxm();
}
public List<HashMap<String, String>> getKfsqPjxm(String xnxq,String bjdms) {
String newBjdms = "";
String[] bjdmss = bjdms.split(",");
for(int i=0;i<bjdmss.length;i++){
newBjdms += "'"+bjdmss[i]+"',";
}
if(newBjdms.length()>0){
newBjdms=newBjdms.substring(0, newBjdms.length()-1);
}
return dao.getKfsqPjxm(xnxq,newBjdms);
}
public List<HashMap<String, String>> getKfsqPjxm(String xnxq) {
return dao.getKfsqPjxm(xnxq);
}
/**
*
* @描述:获取所有项目,不包含当前项目
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录:
* @param xmdm
* @return
* @throws Exception
* List<HashMap<String,String>> 返回类型
* @throws
*/
public List<HashMap<String, String>> getOthers(String xmdm)
throws Exception {
String currXn = CsszService.getPjzq().get("xn");// 当前学年
String currXq = CsszService.getPjzq().get("xq");// 当年学期
return dao.getOthers(xmdm, currXn, currXq);
}
public List<HashMap<String, String>> getOthers(String xmdm,String xzdm)
throws Exception {
String currXn = CsszService.getPjzq().get("xn");// 当前学年
String currXq = CsszService.getPjzq().get("xq");// 当年学期
return dao.getOthers(xmdm, currXn, currXq,xzdm);
}
/**
*
* @描述:判断重复数据,以名称为准
* @作者:ligl
* @日期:2013-8-5 上午11:11:11
* @修改记录:
* @throws
*/
public boolean isRepeat(XmwhModel model) throws Exception {
return dao.isRepeat(model);
}
/**
*
* @描述:判断关联性,数据可否处理
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录:
* @throws
*/
public boolean isRalate(XmwhModel model) throws Exception {
XmwhModel modelOld = dao.getModel(model);
boolean flag = false;
if (!model.getXmmc().trim().equals(modelOld.getXmmc().trim())
|| !model.getLxdm().equals(modelOld.getLxdm())) {
// flag = dao.isRalate(model);
}
return flag;
}
/**
*
* @描述:判断关联性,数据可否处理
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录:
* @throws
*/
public boolean isRalate(String values) throws Exception {
boolean flag = false;
// 是否有学生申请项目
SqshService sqshService = new SqshService();
if (values != null) {
String[] xmdms = values.split(",");
for (int i = 0; i < xmdms.length; i++) {
flag = sqshService.isExistsFlowData(xmdms[i]);
if (flag) {
break;
}
}
}
return flag;
}
/**
*
* @删除关联表
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录: 修改者名字-修改日期-修改内容
* @param values
* @return
* @throws Exception boolean 返回类型
* @throws
*/
public boolean delRalate(String values) throws Exception {
return dao.delRalate(values);
}
/**
*
* @描述:根据项目代码查询记录
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录:
* @return List<HashMap<String,String>> 返回类型
* @throws
*/
public HashMap<String, String> getDataById(String xmdm) throws Exception {
return dao.getDataById(xmdm);
}
/**
*
* @描述:根据项目名称查询单条记录
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录:
* @return List<HashMap<String,String>> 返回类型
* @throws
*/
public HashMap<String, String> getDataByName(String xmmc, String xn, String xq) throws Exception {
return dao.getDataByName(xmmc, xn, xq);
}
/**
*
* @描述:根据项目代码查询项目名称
* @作者:ligl
* @日期:2013-4-19 下午02:19:00
* @修改记录:
* @return List<HashMap<String,String>> 返回类型
* @throws
*/
public String getNameById(String xmdm) throws Exception {
return dao.getNameById(xmdm);
}
/**
*
* @描述:通过项目代码获取已经设置的年级,年级以逗号分割
* @作者:ligl
* @日期:2013-8-5 上午11:07:42
* @修改记录:
* @param xmdm
* @return String 返回类型
* @throws
*/
public String getRsfpnj(String xmdm) throws Exception {
return dao.getRsfpnj(xmdm);
}
/**
*
* @描述:获取项目性质
* @作者:ligl
* @日期:2013-8-7 上午11:26:33
* @修改记录:
* @return
* @throws Exception
* List<HashMap<String,String>> 返回类型
* @throws
*/
public List<HashMap<String, String>> getXmxz() throws Exception {
return dao.getXmxz();
}
/**
*
* @描述:获取项目类型
* @作者:ligl
* @日期:2013-8-7 上午11:26:33
* @修改记录:
* @return
* @throws Exception
* List<HashMap<String,String>> 返回类型
* @throws
*/
public List<HashMap<String, String>> getXmlx(String xzdm) throws Exception {
return dao.getXmlx(xzdm);
}
/**
*
* @描述:得到当前学年学期,格式为:2012-2013 秋
* @作者:ligl
* @日期:2013-8-8 上午11:05:27
* @修改记录:
* @return String 返回类型
* @throws
*/
public String getCurrXnXqmc() throws Exception {
CsszModel csszModel = new CsszDao().getModel();
String currXn = csszModel.getXn();// 当前学年
String currXq = csszModel.getXq();// 当年学期
return xnXqGshMc(currXn, currXq);
}
/*
* 学年学期格式化,返回 2012-2013 春
*/
private String xnXqGshMc(String xn, String xq) throws Exception {
String xqmc = null;
List<HashMap<String, String>> xqList = Base.getXqList();
for (HashMap<String, String> map : xqList) {
if (xq != null && xq.equals(map.get("xqdm"))) {
xqmc = map.get("xqmc");
}
}
// 由于学年当中的学期存的是'on' 取消显示
if (xqmc == null) {
xqmc = "";
}
return xn + " " + xqmc;
}
/*
* 学年学期格式化,返回 2012-2013;01
*/
private String xnXqGshDm(String xn, String xq) throws Exception {
return xn + ";" + xq;
}
/**
*
* @描述:查询可以复制的奖项来源
* @作者:ligl
* @日期:2013-8-14 上午11:06:11
* @修改记录:
* @return
* @throws Exception
* List<HashMap<String,String>> 返回类型
* @throws
*/
public List<HashMap<String, String>> getJxfz() throws Exception {
List<HashMap<String, String>> jxfzList = new ArrayList<HashMap<String, String>>();
CsszDao csszDao = new CsszDao();
CsszModel csszModel = csszDao.getModel();
if (csszModel == null) {
}
String currXn = csszModel.getXn();// 当前学年
String currXq = csszModel.getXq();// 当年学期
String zczq = csszDao.getCsz("zczq");
List<HashMap<String, String>> xnxqList = dao.getJxfzXnXq(zczq);
String xn = null;
String xq = null;
HashMap<String, String> jxfzMap = null;
if (xnxqList != null) {
for (HashMap<String, String> map : xnxqList) {
xn = map.get("xn");
xq = map.get("xq");
if (!xn.equals(currXn) || !xq.equals(currXq)) {
jxfzMap = new HashMap<String, String>();
jxfzMap.put("dm", xnXqGshDm(xn, xq));
jxfzMap.put("mc", xnXqGshMc(xn, xq));
jxfzList.add(jxfzMap);
}
}
}
return jxfzList;
}
/**
* @描述:奖项复制
* @作者:ligl
* @日期:2013-8-14 下午01:48:30
* @修改记录:
* @param jxfznd
* @return boolean 返回类型
* @throws
*/
public boolean runJxfz(String jxfznd) throws Exception {
boolean flag = false;
CsszModel csszModel = new CsszDao().getModel();
String currXn = csszModel.getXn();// 当前学年
String currXq = csszModel.getXq();// 当年学期
TjszService tjszService = new TjszService();
JdszService jdszService = new JdszService();
TzszService tzszService = new TzszService();
String fzXn = jxfznd.split(";")[0];
String fzXq = jxfznd.split(";")[1];
List<HashMap<String, String>> jxfzList = dao.getJxfz(fzXn, fzXq,
currXn, currXq);
if (jxfzList != null && jxfzList.size() > 0) {
for (int i = 0; i < jxfzList.size(); i++) {
String guid = UniqID.getInstance().getUniqIDHash();
guid = guid.toUpperCase();
jxfzList.get(i).put("id", guid);
}
flag = dao.saveData(jxfzList, currXn, currXq);
//奖项复制:复制条件设置、兼得设置、奖项调整设置
List<TjszModel> list = null;
for (HashMap<String, String> jxfzMap : jxfzList) {
list=new ArrayList<TjszModel>();
List<HashMap<String, String>> tjList = tjszService.getTjsz(jxfzMap.get("xmdm"));
List<HashMap<String, String>> jdList = jdszService.getByXmdm(jxfzMap.get("xmdm"),currXn, currXq);
List<HashMap<String, String>> tzList = tzszService.getByXmdm(jxfzMap.get("xmdm"),currXn, currXq);
StringBuffer jdXmdms = new StringBuffer();
StringBuffer tzXmdms = new StringBuffer();
for (int i = 0; i < jdList.size(); i++) {
if(i<jdList.size()-1){
jdXmdms.append(jdList.get(i).get("fzbjdxmdm"));
jdXmdms.append(",");
}else{
jdXmdms.append(jdList.get(i).get("fzbjdxmdm"));
}
}
for (int i = 0; i < tzList.size(); i++) {
if(i<tzList.size()-1){
tzXmdms.append(tzList.get(i).get("fztzjxdm"));
tzXmdms.append(",");
}else{
tzXmdms.append(tzList.get(i).get("fztzjxdm"));
}
}
for (HashMap<String, String> tjMap : tjList) {
TjszModel tjModel = new TjszModel();
tjModel.setTjdm(tjMap.get("tjdm"));
tjModel.setYyfw(tjMap.get("yyfw"));
tjModel.setGxdm(tjMap.get("gxdm"));
tjModel.setTjz(tjMap.get("tjz"));
tjModel.setYlzq(tjMap.get("ylzq"));
list.add(tjModel);
}
flag = tjszService.saveOrUpdate(jxfzMap.get("id"), list);
flag = jdszService.jdsz(jxfzMap.get("id"), jdXmdms.toString());
flag = tzszService.shsz(jxfzMap.get("id"), tzXmdms.toString());
}
}
return flag;
}
/**
*
* @描述:
* @作者:ligl
* @日期:2013-8-15 上午10:03:15
* @修改记录:
* @param dateFormat
* @return
* String 返回类型
* @throws
*/
public String getCurrTime(String dateFormat){
DateFormat df = new SimpleDateFormat(dateFormat);
return df.format(new Date());
}
/**
*
* @描述:评奖项目序号重复验证
* @作者:沈晓波[工号:1123]
* @日期:2015-11-17 下午02:45:00
* @修改记录: 修改者名字-修改日期-修改内容
* @param model
* @return
* @throws Exception
* boolean 返回类型
* @throws
*/
public boolean isExistXssx(XmwhModel model) throws Exception {
String num = dao.checkExistXssx(model);
return Integer.valueOf(num) > 0;
}
/**
* @描述: 浙江传媒学院【项目性质】除了“国家奖学金”不选中,其余全部默认选中
* @作者: 孟威[工号:1186]
* @日期: 2015-12-31 下午01:03:59
* @修改记录: 修改者名字-修改日期-修改内容
* @return
* @throws Exception
* List<String> 返回类型
* @throws
*/
public List<String> getXmxzmw() throws Exception {
return dao.getXmxzmw();
}
/**
*
* @描述:根据项目代码查询项目名称(集体评奖)
* @作者:ligl
* @日期:2013-4-19 下午02:19:00
* @修改记录:
* @return List<HashMap<String,String>> 返回类型
* @throws
*/
public String getNameByIdJtpj(String xmdm) throws Exception {
return dao.getNameByIdJtpj(xmdm);
}
/**
* @description : 是否优秀干部
* @author : lj(1282)
* @date :2018-4-28 下午02:50:39
* @param xmdm
* @return
*/
public String getSfyxgb(String xmdm){
return dao.getSfyxgb(xmdm);
}
public List<HashMap<String,String>> getnewXmlx(String xmxz) {
return dao.getnewXmlx(xmxz);
}
/**
* @描述:获取培养层次列表
* @作者:lgx [工号:1553]
* @日期:2018/9/29 20:24
* @修改记录: 修改者名字-修改日期-修改内容
* @param: []
* @return: java.util.List<java.util.HashMap<java.lang.String,java.lang.String>>
*/
public List<HashMap<String,String>> getPyccList(){
XsxxDao xsxxDao = new XsxxDao();
return xsxxDao.getPyccList();
}
public String getXsxh(String xzdm) {
return dao.getXsxh(xzdm);
}
}
| [
"1398796456@qq.com"
] | 1398796456@qq.com |
c1bb84e31435914619737a2150a351d9729ea2cf | 0e0fd98498424a3c4aad28a8814c1f64e6e6e195 | /Week04/src/main/java/LemonadeChange.java | 43c6fcfdb60f00eb3e179a3ff2f1766126e025c9 | [] | no_license | chen-rui-2018/algorithm010 | 63ffd1eedf7d6aae2b99083cbd0c4ae12ab357c4 | c5911de99cd0b0ceaeb32d999befaf2eb9da1abc | refs/heads/master | 2022-12-08T07:13:30.444719 | 2020-08-21T14:11:56 | 2020-08-21T14:11:56 | 270,992,050 | 0 | 0 | null | 2020-06-09T12:07:00 | 2020-06-09T12:06:59 | null | UTF-8 | Java | false | false | 1,136 | java | import java.util.HashMap;
import java.util.Map;
/**
* @author: chenr
* @date: Created on 2020/7/5 15:06
* @version: v1.0
* @modified By:
* 柠檬水找零
*/
public class LemonadeChange {
public static void main(String[] args) {
int [] bulls = {20,5,5,10,20};
System.out.println(new LemonadeChange().lemonadeChange(bulls));
}
public boolean lemonadeChange(int[] bills) {
if (bills == null || bills.length == 0) {
return false;
}
int five = 0;
int ten = 0;
for (int i = 0; i < bills.length ; i++) {
if (bills[i] == 5){
five ++;
}else if (bills[i] == 10) {
if (five ==0) {
return false;
}
ten++;
five--;
}else {
if (five > 0 && ten >0 ) {
five--;
ten--;
}else if (five > 3){
five -= 3;
}else{
return false;
}
}
}
return true;
}
}
| [
"chenr@op-mobile.com.cn"
] | chenr@op-mobile.com.cn |
f959e8db2cdd78f5b913a064756cb913be90b80b | 271da533bd6def2204d30cb40f09e36e177b768e | /app/src/main/java/abhinay/firstapp/project/MainActivity.java | 71799f1d6a399afd651753672f4d3c8e4ec3f5e5 | [] | no_license | abhinaypotti/WhatToCook | ebf63b4deb47d4267428100ab6393f74f4398ff6 | 0627841360606fde00bc6bce376b88fef2886fb8 | refs/heads/master | 2023-01-23T18:49:55.640317 | 2020-11-11T06:26:44 | 2020-11-11T06:26:44 | 311,552,155 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package abhinay.firstapp.project;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = findViewById(R.id.main_register);
b2 = findViewById(R.id.main_login);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(MainActivity.this,RegisterActivity.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(MainActivity.this,LoginActivity.class);
startActivity(i);
}
});
}
} | [
"pottiabhinay2001@gmail.com"
] | pottiabhinay2001@gmail.com |
4e0c6e7031bb4c3905b6588f0f80f1410ab09672 | 0b38caeba973697bdbc6ea71f98017c769802952 | /app/src/main/java/com/kokme/cheapventilator/DeviceListActivity.java | 66b87699fe9a31ca317e4a63bd9863fe5c6ce456 | [] | no_license | yieoyo/CheapVentilator | c308b7b96cf539267f5184d47fc078aa0d1ba727 | c8ed40019d7758a7e7538db5c367ee387736e119 | refs/heads/master | 2022-10-17T07:22:49.122028 | 2020-06-11T17:18:53 | 2020-06-11T17:18:53 | 271,604,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,918 | java | package com.kokme.cheapventilator;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import java.util.Set;
public class DeviceListActivity extends AppCompatActivity {
public static String EXTRA_DEVICE_ADDRESS = "device_address";
private ArrayAdapter<String> nearbyDeviceAdapter;
private ArrayAdapter<String> pairedDeviceAdapter;
private BluetoothAdapter bluetoothAdapter;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.device_list);
setResult(Activity.RESULT_CANCELED);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bluetoothAdapter.isDiscovering()) {
bluetoothAdapter.cancelDiscovery();
button.setText("Search Device");
return;
}
nearbyDeviceAdapter.clear();
bluetoothAdapter.startDiscovery();
button.setText("CANCEL");
}
});
nearbyDeviceAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); // for newly discovered devices
pairedDeviceAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); // for already paired devices
ListView pairedDeviceView = (ListView) findViewById(R.id.paired_devices);
pairedDeviceView.setAdapter(pairedDeviceAdapter);
pairedDeviceView.setOnItemClickListener(deviceClickListener);
ListView nearbyDeviceView = (ListView) findViewById(R.id.nearby_devices);
nearbyDeviceView.setAdapter(nearbyDeviceAdapter);
nearbyDeviceView.setOnItemClickListener(deviceClickListener);
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); // Register for broadcasts when device is discovered
filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); // Register for broadcasts when discovery has finished
this.registerReceiver(receiver, filter);
// Get a set of currently paired devices
Set<BluetoothDevice> pairedDeviceSet = bluetoothAdapter.getBondedDevices();
if (pairedDeviceSet.size() > 0) {
for (BluetoothDevice device : pairedDeviceSet) {
pairedDeviceAdapter.add(device.getName() + "\n" + device.getAddress());
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (bluetoothAdapter.isDiscovering()) {
bluetoothAdapter.cancelDiscovery();
}
this.unregisterReceiver(receiver);
}
// The on-click listener for all devices in the ListViews
private AdapterView.OnItemClickListener deviceClickListener = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
if (bluetoothAdapter.isDiscovering()) {
bluetoothAdapter.cancelDiscovery();
}
// Get the device MAC address, which is the last 17 chars in the View
String info = ((TextView) v).getText().toString();
String addr = info.substring(info.length() - 17);
// Create the result Intent and include the MAC address
Intent intent = new Intent();
intent.putExtra(EXTRA_DEVICE_ADDRESS, addr);
setResult(Activity.RESULT_OK, intent);
finish();
}
};
// The BroadcastReceiver that listens for discovered devices
private final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
nearbyDeviceAdapter.add(device.getName() + "\n" + device.getAddress());
}
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
button.setText("Search Device");
}
}
};
} | [
"tyrostudioofficial@gmail.com"
] | tyrostudioofficial@gmail.com |
05d52f77b03f8c1169c2fcb0a123c2959e12e141 | 85a22f15ea9b58061360e491ea0a1a6f6db4371b | /android/app/src/main/java/com/githubpopular/MainActivity.java | a03929adb4d4ae02fb0974b3ead4f089a1ec681b | [] | no_license | jinhuizxc/GithubPopular | 0e3bdad0b1a3befab443fb84ed673e73e4cb70f5 | 199858055abc23550279986bbf7b889fbe91f0ae | refs/heads/master | 2021-01-19T23:21:31.384652 | 2017-09-01T01:56:29 | 2017-09-01T01:56:29 | 101,264,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 604 | java | package com.githubpopular;
import com.facebook.react.ReactActivity;
import com.cboy.rn.splashscreen.SplashScreen;
import android.os.Bundle;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this,true);
super.onCreate(savedInstanceState);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "GithubPopular";
}
}
| [
"1004260403@qq.com"
] | 1004260403@qq.com |
0636ee62f2a9a682bbcaad0b30a32c90c4099a87 | c920521efc38fcb6a2e53be801251ba97a6429de | /proj1/enigma/FixedRotor.java | 3fa227c47a8863431ca2e2e42c34033bb7bc0d39 | [] | no_license | oldjack233/oldjack-cs61b | ede12fc977807f1414f0f2d1b78640280398d9f9 | 82eda3f65180f77b97138ef37c5ba9ddc1e985f4 | refs/heads/master | 2022-07-07T10:37:41.467007 | 2020-05-15T21:51:22 | 2020-05-15T21:51:22 | 260,060,917 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package enigma;
/** Class that represents a rotor that has no ratchet and does not advance.
* @author Ziyuan Tang
*/
class FixedRotor extends Rotor {
/** A non-moving rotor named NAME whose permutation at the 0 setting
* is given by PERM. */
FixedRotor(String name, Permutation perm) {
super(name, perm);
}
@Override
void advance() {
}
}
| [
"oldjack@berkeley.edu"
] | oldjack@berkeley.edu |
2aa59065202b5f8fd47cbd439cc90978c120afd5 | 1eddde0af3bca5cc5edf97661916b666f5499709 | /demo100/demo100/Subject8.java | 3cf92a863fa007bf57958da7054f9ca580d712d5 | [] | no_license | zhangzhaobinzzz/demo3 | cebe98320ccb67bdcfd8cc69ee44bf69ec540d98 | 00f9bead33424e6bce4097fa31da1f5e0f2e84e5 | refs/heads/master | 2023-08-25T03:30:49.448990 | 2021-10-28T13:35:03 | 2021-10-28T13:35:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,398 | java | package demo100;
import java.util.Scanner;
public class Subject8 {
String name;
int passWord;
public void adminInfo(){
System.out.println("姓名:"+name+"密码:"+passWord);
}
public void modifyInfo(){
}
public static void main(String[] args) {
Subject8 sub1=new Subject8();
sub1.name="admin1";
sub1.passWord=111;
sub1.adminInfo();
Subject8 sub2=new Subject8();
sub2.name="admin2";
sub2.passWord=222;
sub2.adminInfo();
Subject8 sub3=new Subject8();
sub3.name="admin3";
sub3.passWord=333;
sub3.adminInfo();
Scanner input=new Scanner(System.in);
boolean isFlag=true;
while(isFlag){
System.out.println("请输入用户名:");
String name=input.next();
System.out.println("请输入密码:");
int passWord=input.nextInt();
if(sub3.name.equals("admin3")&&sub3.passWord==passWord){
System.out.println("请输入新密码");
passWord=input.nextInt();
sub3.passWord=passWord;
System.out.println("密码修改成功,密码为:"+sub3.passWord);
isFlag=false;
}
else{
System.out.println("用户名和密码不匹配!");
}
}
}
}
| [
"2571117914@qq.com"
] | 2571117914@qq.com |
49d39eb22a6d6b0a093bcf92db20c8ffa8275d25 | 325c999e5774123fb15d486cb87317f5bf35a16c | /src/main/java/com/atlaspharmacy/atlaspharmacy/pharmacy/service/impl/PharmacyPricelistService.java | 4fd9972617998c8da36f79d99bf39a5405eee312 | [] | no_license | jelena-vlajkov/isa-team14 | 8a92339999e387d3ac604e79d96a5251c3179046 | a6e69beca52e814770ab116644476ac36373f095 | refs/heads/develop | 2023-04-26T17:36:10.412891 | 2021-06-06T20:10:46 | 2021-06-06T20:10:46 | 307,682,787 | 1 | 4 | null | 2021-06-06T20:10:47 | 2020-10-27T11:49:12 | Java | UTF-8 | Java | false | false | 1,693 | java | package com.atlaspharmacy.atlaspharmacy.pharmacy.service.impl;
import com.atlaspharmacy.atlaspharmacy.pharmacy.domain.PharmacyPricelist;
import com.atlaspharmacy.atlaspharmacy.pharmacy.domain.PricelistType;
import com.atlaspharmacy.atlaspharmacy.pharmacy.repository.PharmacyPricelistRepository;
import com.atlaspharmacy.atlaspharmacy.pharmacy.service.IPharmacyPricelistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class PharmacyPricelistService implements IPharmacyPricelistService {
private final PharmacyPricelistRepository pharmacyPricelistRepository;
@Autowired
public PharmacyPricelistService(PharmacyPricelistRepository pharmacyPricelistRepository) {
this.pharmacyPricelistRepository = pharmacyPricelistRepository;
}
@Override
public double counselingCost(Long pharmacyId) throws Exception {
PharmacyPricelist pharmacyPricelist = pharmacyPricelistRepository.findPricelistByPharmacyAndType(pharmacyId, PricelistType.Values.Counseling);
if (pharmacyPricelist != null) {
return pharmacyPricelist.getCost();
}
throw new Exception("No pricelist for todays date");
}
@Override
public double examinationCost(Long pharmacyId) throws Exception {
PharmacyPricelist pharmacyPricelist = pharmacyPricelistRepository.findPricelistByPharmacyAndType(pharmacyId, PricelistType.Values.Examination);
if (pharmacyPricelist != null) {
return pharmacyPricelist.getCost();
}
throw new Exception("No pricelist for todays date");
}
}
| [
"vlajkovj31@gmail.com"
] | vlajkovj31@gmail.com |
fcb2529edd4a88da93d01acf88f80eec72214f8a | 7b82d70ba5fef677d83879dfeab859d17f4809aa | /_part2/firefly_luna/firefly/src/main/java/luna/com/firefly/entity/system/SystemDic.java | ee59c4d86ea54d292efad93e7b6dc67a60270a89 | [
"Apache-2.0"
] | permissive | apollowesley/jun_test | fb962a28b6384c4097c7a8087a53878188db2ebc | c7a4600c3f0e1b045280eaf3464b64e908d2f0a2 | refs/heads/main | 2022-12-30T20:47:36.637165 | 2020-10-13T18:10:46 | 2020-10-13T18:10:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,399 | java | package luna.com.firefly.entity.system;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* <系统字典表>
*
* @author 陆小凤
* @version [1.0, 2015年7月17日]
*/
@Data
@Entity
@Table(name = "SYSTEM_DIC")
public class SystemDic implements Serializable
{
/**
* 注释内容
*/
private static final long serialVersionUID = -2339751794840917306L;
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "TYPE")
private String type;
@Column(name = "NAME")
private String name;
@Column(name = "VALUE")
private String value;
@Column(name = "DESCRIPTION")
private String desc;
@Column(name = "SORT_NUM")
private Integer sortNum;
/**
* 创建时间
*/
private Date createTime;
/**
* 状态更改时间
*/
private Date updateTime;
public SystemDic()
{
}
@Override
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
| [
"wujun728@hotmail.com"
] | wujun728@hotmail.com |
c460fb6c9c4a6ec01293117f76e3581da2a74a48 | 43693d93b4d3c7a322cfe36f7bd28bfa3ba79584 | /app/src/main/java/com/android/yardsale/interfaces/OnAsyncTaskCompleted.java | bc8b36a4a920045c9c877c8364d07a0d870cd613 | [
"Apache-2.0"
] | permissive | Prajakta-Ashwini/YardSale | 05117460bedbdf9b2ba4c23a2d5bb0a293651984 | f4a102dff86c0ab9e42d7761b4703e8e5382c598 | refs/heads/master | 2016-08-12T14:53:30.651381 | 2015-07-03T03:35:37 | 2015-07-03T03:35:37 | 36,718,353 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package com.android.yardsale.interfaces;
public interface OnAsyncTaskCompleted{
void onTaskCompleted();
} | [
"pshegde@ncsu.edu"
] | pshegde@ncsu.edu |
651c66db64f4a0e656477fcf4f570ed20e2315c4 | f23505325e28726cdaeb2669b04e2151f5977e75 | /chnp-manager/src/main/java/chnp/manager/generator/model/query/GnrFilepathQuery.java | 7606be09e466777d7eb67f12a8225912ad8664e4 | [] | no_license | radtek/chnp | ac18835ff7b57a6259dfdcecebe3505578c06f10 | 1991db72815114a729b1a34812c2dce942628285 | refs/heads/master | 2020-06-17T16:30:18.200702 | 2019-03-08T02:55:53 | 2019-03-08T02:55:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,350 | java | package chnp.manager.generator.model.query;
import chnp.manager.common.entity.PaginationQuery;
public class GnrFilepathQuery extends PaginationQuery{
private Integer id;
private Integer projectId;
private String outputPath;
private String fileSuffix;
private Integer createUser;
private java.util.Date createTimeBegin;
private String createTimeBeginString;
private java.util.Date createTimeEnd;
private String createTimeEndString;
private java.util.Date modifiedTimeBegin;
private String modifiedTimeBeginString;
private java.util.Date modifiedTimeEnd;
private String modifiedTimeEndString;
public GnrFilepathQuery() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public String getOutputPath() {
return outputPath;
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public String getFileSuffix() {
return fileSuffix;
}
public void setFileSuffix(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public Integer getCreateUser() {
return createUser;
}
public void setCreateUser(Integer createUser) {
this.createUser = createUser;
}
public java.util.Date getCreateTimeBegin() {
return createTimeBegin;
}
public void setCreateTimeBegin(java.util.Date createTimeBegin) {
this.createTimeBegin = createTimeBegin;
this.createTimeBeginString = getCreateTimeBeginString();
}
public String getCreateTimeBeginString() {
if (null == createTimeBegin) {
return null;
}
return this.createTimeBeginString = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeBegin);
}
public void setCreateTimeBeginString(String createTimeBeginString) throws java.text.ParseException {
if(null!=createTimeBeginString && !"".equals(createTimeBeginString)){
setCreateTimeBegin(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(createTimeBeginString));
}
}
public java.util.Date getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(java.util.Date createTimeEnd) {
this.createTimeEnd = createTimeEnd;
this.createTimeEndString = getCreateTimeEndString();
}
public String getCreateTimeEndString() {
if (null == createTimeEnd) {
return null;
}
return this.createTimeEndString = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeEnd);
}
public void setCreateTimeEndString(String createTimeEndString) throws java.text.ParseException{
if(null!=createTimeEndString && !"".equals(createTimeEndString)) {
setCreateTimeEnd(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(createTimeEndString));
}
}
public java.util.Date getModifiedTimeBegin() {
return modifiedTimeBegin;
}
public void setModifiedTimeBegin(java.util.Date modifiedTimeBegin) {
this.modifiedTimeBegin = modifiedTimeBegin;
this.modifiedTimeBeginString = getModifiedTimeBeginString();
}
public String getModifiedTimeBeginString() {
if (null == modifiedTimeBegin) {
return null;
}
return this.modifiedTimeBeginString = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(modifiedTimeBegin);
}
public void setModifiedTimeBeginString(String modifiedTimeBeginString) throws java.text.ParseException {
if(null!=modifiedTimeBeginString && !"".equals(modifiedTimeBeginString)){
setModifiedTimeBegin(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(modifiedTimeBeginString));
}
}
public java.util.Date getModifiedTimeEnd() {
return modifiedTimeEnd;
}
public void setModifiedTimeEnd(java.util.Date modifiedTimeEnd) {
this.modifiedTimeEnd = modifiedTimeEnd;
this.modifiedTimeEndString = getModifiedTimeEndString();
}
public String getModifiedTimeEndString() {
if (null == modifiedTimeEnd) {
return null;
}
return this.modifiedTimeEndString = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(modifiedTimeEnd);
}
public void setModifiedTimeEndString(String modifiedTimeEndString) throws java.text.ParseException{
if(null!=modifiedTimeEndString && !"".equals(modifiedTimeEndString)) {
setModifiedTimeEnd(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(modifiedTimeEndString));
}
}
}
| [
"1069106742@qq.com"
] | 1069106742@qq.com |
b423c658219a0ef2ad67f24b29cbee961071811b | 1f2f836db097427bb00dd261222695102ec600cc | /src/main/java/com/mastek/farmertomarket/dao/itemJPADAO.java | 268eada000ef1d259f41a57a296129312b4ee6a9 | [] | no_license | lukerowley101/farmer2market | 36246c07d5ec3bdc895eba457c5cea0e24f14072 | 3907fe2d9484cc280c9c8715affd973fe9ac4ded | refs/heads/master | 2022-12-11T19:16:13.125117 | 2020-09-08T13:26:34 | 2020-09-08T13:26:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package com.mastek.farmertomarket.dao;
import org.springframework.data.repository.CrudRepository;
import com.mastek.farmertomarket.entities.item;
public interface itemJPADAO extends CrudRepository<item, Integer>{
}
| [
"44974926+sohail61072@users.noreply.github.com"
] | 44974926+sohail61072@users.noreply.github.com |
4b2ca8ceeed910306b88996f977c3ea6ef026d78 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i3134.java | a33aa8eb02b32deb2a5c32cdd5881b8e75bdfdad | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | package number_of_direct_superinterfaces;
public interface i3134 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
38af78be7721d49a128c6ec222458fc8c907283d | c499b84fbe2d9188241bbdc8a74dd02f950b8086 | /src/mx/uam/is/practicadiseno/negocio/ManejadorProxy.java | 00c105c522f33a945f8d1a5d9ec098293d62fd33 | [] | no_license | AlanSanchezUAM/Practica5_v4 | f7dbfdb050cbcb2de30e1345af845be14401e902 | cf2a1df26525b6bb4a21f217248a316294b2957d | refs/heads/main | 2023-04-19T18:19:46.826581 | 2021-05-16T22:28:35 | 2021-05-16T22:28:35 | 367,977,866 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,503 | java | package mx.uam.is.practicadiseno.negocio;
public class ManejadorProxy implements Manejador {
Manejador manejador;
public ManejadorProxy(Manejador manejador) {
this.manejador = manejador;
}
@Override
public String[] dameDatos() {
// TODO Auto-generated method stub
System.out.println("Se invocó al metodo dameDatos()");
return manejador.dameDatos();
}
@Override
public boolean agrega(String dato) {
// TODO Auto-generated method stub
System.out.println("Se invocó al método agrega(String dato)");
return manejador.agrega(dato);
}
@Override
public boolean borra(String dato) {
// TODO Auto-generated method stub
System.out.println("Se invocó al método borra(String dato)");
return manejador.borra(dato);
}
@Override
public void finaliza() {
// TODO Auto-generated method stub
System.out.println("Se invocó al método finaliza()");
manejador.finaliza();
}
@Override
public boolean agregaObservador(Observador o) {
// TODO Auto-generated method stub
System.out.println("Se invocó al método agregaObservador(Observador o)");
return manejador.agregaObservador(o);
}
@Override
public boolean quitaObservador(Observador o) {
// TODO Auto-generated method stub
System.out.println("Se invocó al método quitaObservador(Observador o)");
return manejador.quitaObservador(o);
}
@Override
public void notifica() {
// TODO Auto-generated method stub
System.out.println("Se invocó al metodo notifica()");
manejador.notifica();
}
} | [
"76186996+AlanSanchezUAM@users.noreply.github.com"
] | 76186996+AlanSanchezUAM@users.noreply.github.com |
2687bcada2f5fbd78d93e2ba23d015c0892ebdfb | eb00a00804794a0b57a125fd99629b9232b1212e | /src/main/java/com/urbain/photocollector/repositotries/FactureRepository.java | 63948f7b4176f2d9a107389dc6b536c87e25ca95 | [] | no_license | Urbain3000/photo-collector | 134082f7016afbb7e9dd060ad587e6fbc038410d | 035dd03807ff18285f7a58bb61f0a77d225ebb85 | refs/heads/master | 2022-12-25T00:45:00.000587 | 2020-09-27T20:35:33 | 2020-09-27T20:35:33 | 299,065,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | //package com.urbain.photocollector.repositotries;
//
//import org.springframework.data.repository.CrudRepository;
//import org.springframework.stereotype.Repository;
//
//import com.urbain.photocollector.entities.FactureEntity;
//
//@Repository
//public interface FactureRepository extends CrudRepository<FactureEntity, Long> {
//
//}
| [
"bkone.m2i@gmail.com"
] | bkone.m2i@gmail.com |
1dcc9046f09ebdaa227568972992bed122e78355 | 6a6d6cbf921f9d6b1293e828e047ed1727b04962 | /src/shape/RectangleGroup.java | 408d23780d5c7287006fa2a694906ac219325664 | [] | no_license | cyrilleio/Kinetics | fee6315a568d4d5dfc37b3c1c908bc34eb93336d | 5d7d49e0905fb18408efb0ede2e14cfb98db01f6 | refs/heads/master | 2022-11-21T20:10:20.992979 | 2020-07-29T13:55:46 | 2020-07-29T13:55:46 | 267,106,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,654 | java | package shape;
import geometry.Line;
import geometry.Point;
import geometry.Rectangle;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.scene.paint.Color;
import javafx.scene.shape.StrokeType;
import structures.Complex;
import structures.Constant;
import java.util.ArrayList;
public class RectangleGroup extends ShapeGroup {
private final Rectangle r0, r1, r2;
public RectangleGroup(Point center, double width, double space){
this.space = space;
this.center = center;
this.property = new SimpleDoubleProperty();
this.children = new ArrayList<>();
this.lines = new ArrayList<>();
this.r0 = new Rectangle(center,width, width);
this.r1 = r0.duplicate(space);
this.r2 = r1.duplicate(space);
this.outerObservable = this.r0.duplicate(-Constant.SHAPE_STROKE_WIDTH);
this.observable = this.r1.duplicate(0);
this.observable.setStroke(Constant.OBSERVABLE_SHAPE_STROKE);
this.observable.setFill(Constant.OBSERVABLE_SHAPE_FILL);
this.observable.setStrokeWidth(space);
this.outerObservable.setFill(null);
this.outerObservable.setStroke(Constant.OUTER_OBSERVABLE_FILL);
this.outerObservable.setStrokeWidth(2*space);
this.outerObservable.setStrokeType(StrokeType.OUTSIDE);
bindCursor(this.r1.getP1());
build();
}
public void build() {
bindArc();
this.children.add(this.r0);
this.children.add(this.r1);
this.children.add(this.r2);
this.lines.add(new Line(this.r1.getP1(),this.r1.getP2()));
this.lines.add(new Line(this.r1.getP2(),this.r1.getP3()));
this.lines.add(new Line(this.r1.getP3(),this.r1.getP4()));
this.lines.add(new Line(this.r1.getP4(),this.r1.getP1()));
this.children.addAll(this.lines);
this.children.add(this.cursor);
this.children.add(this.observable);
this.children.add(this.outerObservable);
this.getChildren().setAll(this.children);
}
public void bindArc(){
property.addListener((observableValue, number, t1) -> {
double t = (double) t1;
int i =(int)Math.floor(t);
lines.get(i).scale(t - i);
bindings();
});
}
@Override
public double getCurrentX() {
return 0;
}
@Override
public double getCurrentY() {
return 0;
}
public Complex getCurrentPosition(){
return this.lines.get((int) Math.floor(this.property.get())).position().getAffix();
}
public void bindings(){
this.cursor.setCenter(getCurrentPosition());
}
} | [
"penanklihicyrille@yahoo.com"
] | penanklihicyrille@yahoo.com |
debcb2bda303eb23b1b9376c06f79454fdff6b57 | 4fa942cc15c9c40035d9932642128e0fc45a927b | /src/hidra/metaheuristics/cssmopso/CSSMOPSOConstants.java | 4757b5208d7598015b27860a371446c842542fc3 | [] | no_license | renanalencar/mofss-algorithm | 0cd8f52909408e9807a51d3baf8f3f388e1f4bb3 | 6a91c53b737b56bd8513a2bc42be47698357e29d | refs/heads/master | 2021-08-28T18:49:17.447252 | 2017-12-13T01:03:49 | 2017-12-13T01:03:55 | 112,488,789 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hidra.metaheuristics.cssmopso;
/**
*
* @author Guest
*/
public class CSSMOPSOConstants {
public static final int NCALLOBJECTIVEFUNCTION = 200000;
public static final int SWARMSIZE = 20;
public static final int EXTERNALARCHIVESIZE = 200;
public static final int NMAXPBESTS = 1;
public static final int MNEARESTNEIGHBORS = 10;
public static final int F1 = 0;
public static final int F2 = 1;
public static final double COGNITION_LEARNIN_GRATE = 1.49445;
public static final double SOCIAL_LEARNING_RATE = 1.49445;
public static final double MAXINERTIA = 0.9;
public static final double MININERTIA = 0.4;
public static final double MUTATIONPERCENTUALMOPSO = 0.5;
public static final double MUTATIONPERCENTUALPARTICLES = 0.2;
public static final double MUTATIONPERCENTUALDIMENSIONS = 0.1;
public static final double INITIALSDMUTATIONGAUSSIAN = 1.0;
public static final double FINALSDMUTATIONGAUSSIAN = 0.1;
public static final double STANDARDDEVIATIONMUTATIONGAUSSIAN = 0.01;
public static final double SIGMA = 0.2;
public static final int NGRIDBYDIMENSION = 30;
}
| [
"renan.costaalencar@gmail.com"
] | renan.costaalencar@gmail.com |
4b2ca6b20fff69e19d9be6f3a4c4cf7707cf8293 | 0b36dc41663acb7a418388272533c49b70922403 | /eby-chat spring-4.2.0/src/main/java/com/kk/controller/UploadController.java | e303f5d0b7b1e07f9452bb22b36ef6d5f4aa9608 | [] | no_license | kongzhidea/spring-mvc | 8fa6fab8780f79626d015e73e11b92d55bdf0e5c | b88ecc53d35211c2d3108b9f05d599ed00f76e71 | refs/heads/master | 2020-04-12T06:41:50.680183 | 2018-10-10T03:12:48 | 2018-10-10T03:12:48 | 64,271,506 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,561 | java | package com.kk.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
* UploadController
*/
@Controller
@RequestMapping("upload")
public class UploadController {
public static final Log logger = LogFactory.getLog(UploadController.class);
@RequestMapping("")
public String test(HttpServletRequest request,
HttpServletResponse response, Model model) {
return "upload";
}
@RequestMapping(value = "/create", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String create(HttpServletRequest request,
HttpServletResponse response, Model model,
@RequestParam("file_name") MultipartFile file) {
try {
System.out.println(file.getOriginalFilename() + ".." + file.getSize());
return "upload.create";
} catch (Exception e) {
logger.error("catch error! " + e.getMessage(), e);
}
return "upload.error";
}
}
| [
"563150913@qq.com"
] | 563150913@qq.com |
6453d9241a9985e28df5220ad9e6bdf6cc90414e | 234f40fff23013b5a833dca80708c33e6ac3a228 | /project/quartz/src/test/java/com/xia/quartz/spring/NopService.java | 525314dadfe714b3772d7c6eeaffb2dcc0f86af1 | [] | no_license | lemonzone2010/calvin | c6655dd15c3518cf1877870bb1fdc7140a40374f | 1ecc9d5bec48650c711b1c0a9d7ccaf3a83214ea | refs/heads/master | 2022-12-23T17:26:31.147996 | 2012-07-17T08:49:32 | 2012-07-17T08:49:32 | 36,861,037 | 0 | 0 | null | 2022-12-15T23:58:25 | 2015-06-04T09:28:54 | Java | UTF-8 | Java | false | false | 197 | java | package com.xia.quartz.spring;
import org.springframework.stereotype.Component;
@Component
public class NopService {
public void test() {
System.out.println("NopBean.test");
}
}
| [
"hsiayong@96a9805f-92f8-c556-2e62-a92eab900872"
] | hsiayong@96a9805f-92f8-c556-2e62-a92eab900872 |
bffac425b187315e31efc42f4db7fc3d41680972 | 74d19918a07ec897bb6ccf4c20721a878b14e625 | /Server/src/server/model/players/combat/AttackPlayer.java | dd0e7873abe24101914ef77fb1139dc734b1b808 | [
"WTFPL"
] | permissive | CoderMMK/RSPS123 | 34eb7b4738f8783d18182aa49c5553a1d20d50ab | 5cf72f4203626e3bf3ab8790072547e260afa3f5 | refs/heads/master | 2021-01-21T18:57:33.941278 | 2017-05-22T20:38:56 | 2017-05-22T20:38:56 | 92,096,549 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 32,832 | java | package server.model.players.combat;
import server.Config;
import server.Server;
import server.event.CycleEvent;
import server.event.CycleEventContainer;
import server.event.CycleEventHandler;
import server.model.players.Client;
import server.model.players.PlayerHandler;
import server.model.players.combat.range.RangeData;
import server.util.Misc;
public class AttackPlayer {
public static void applyPlayerHit(final Client c, final int i) {
c.stopPlayerSkill = false;
if (!c.usingClaws) {
c.getCombat().applyPlayerMeleeDamage(i, 1,
Misc.random(c.getCombat().calculateMeleeMaxHit()));
if (c.doubleHit) {
if (!c.oldSpec) {
c.getCombat().applyPlayerMeleeDamage(i, 2,
Misc.random(c.getCombat().calculateMeleeMaxHit()));
} else {
CycleEventHandler.getSingleton().addEvent(c,
new CycleEvent() {
@Override
public void execute(
CycleEventContainer container) {
c.getCombat().applyPlayerMeleeDamage(
i,
2,
Misc.random(c.getCombat()
.calculateMeleeMaxHit()));
container.stop();
}
@Override
public void stop() {
}
}, 1);
}
}
}
}
public static void applyPlayerMeleeDamage(Client c, int i, int damageMask,
int damage) {
c.previousDamage = damage;
Client o = (Client) PlayerHandler.players[i];
if (o == null) {
return;
}
boolean veracsEffect = false;
boolean guthansEffect = false;
if (c.getPA().fullVeracs()) {
if (Misc.random(4) == 1) {
veracsEffect = true;
}
}
if (c.getPA().fullGuthans()) {
if (Misc.random(4) == 1) {
guthansEffect = true;
}
}
if (!c.usingClaws) {
if (damageMask == 1) {
damage = c.delayedDamage;
c.delayedDamage = 0;
} else {
damage = c.delayedDamage2;
c.delayedDamage2 = 0;
}
}
if (Misc.random(o.getCombat().calculateMeleeDefence()) > Misc.random(c
.getCombat().calculateMeleeAttack()) && !veracsEffect) {
damage = 0;
c.bonusAttack = 0;
} else if (c.playerEquipment[c.playerWeapon] == 5698
&& o.poisonDamage <= 0 && Misc.random(3) == 1) {
o.getPA().appendPoison(13);
c.bonusAttack += damage / 3;
} else {
c.bonusAttack += damage / 3;
}
if (o.prayerActive[18]
&& System.currentTimeMillis() - o.protMeleeDelay > 1500
&& !veracsEffect) { // if prayer active reduce damage by 40%
damage = (int) damage * 60 / 100;
}
if (c.maxNextHit && !c.usingClaws) {
damage = c.getCombat().calculateMeleeMaxHit();
}
if (damage > 0 && guthansEffect) {
c.playerLevel[3] += damage;
if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
c.getPA().refreshSkill(3);
o.gfx0(398);
}
if (c.ssSpec && damageMask == 2) {
damage = 5 + Misc.random(11);
c.ssSpec = false;
}
if (PlayerHandler.players[i].playerLevel[3] - damage < 0) {
damage = PlayerHandler.players[i].playerLevel[3];
}
if (o.vengOn && damage > 0)
c.getCombat().appendVengeance(i, damage);
if (damage > 0)
c.getCombat().applyRecoil(damage, i);
switch (c.specEffect) {
case 1: // dragon scimmy special
if (damage > 0) {
if (o.prayerActive[16] || o.prayerActive[17]
|| o.prayerActive[18]) {
o.headIcon = -1;
o.getPA().sendFrame36(c.PRAYER_GLOW[16], 0);
o.getPA().sendFrame36(c.PRAYER_GLOW[17], 0);
o.getPA().sendFrame36(c.PRAYER_GLOW[18], 0);
}
o.sendMessage("You have been injured!");
o.stopPrayerDelay = System.currentTimeMillis();
o.prayerActive[16] = false;
o.prayerActive[17] = false;
o.prayerActive[18] = false;
o.getPA().requestUpdates();
}
break;
case 2:
if (damage > 0) {
if (o.freezeTimer <= 0)
o.freezeTimer = 30;
o.gfx0(369);
o.sendMessage("You have been frozen.");
o.frozenBy = c.playerId;
o.stopMovement();
c.sendMessage("You freeze your enemy.");
}
break;
case 3:
if (damage > 0) {
o.playerLevel[1] -= damage;
o.sendMessage("You feel weak.");
if (o.playerLevel[1] < 1)
o.playerLevel[1] = 1;
o.getPA().refreshSkill(1);
}
break;
case 4:
if (damage > 0) {
if (c.playerLevel[3] + damage > c.getLevelForXP(c.playerXP[3]))
if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
;
else
c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
else
c.playerLevel[3] += damage;
c.getPA().refreshSkill(3);
}
break;
}
c.specEffect = 0;
if (c.fightMode == 3) { // check
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 0);
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 1);
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 2);
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 3);
c.getPA().refreshSkill(0);
c.getPA().refreshSkill(1);
c.getPA().refreshSkill(2);
c.getPA().refreshSkill(3);
} else {
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE), c.fightMode);
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 3);
c.getPA().refreshSkill(c.fightMode);
c.getPA().refreshSkill(3);
}
PlayerHandler.players[i].logoutDelay = System.currentTimeMillis();
PlayerHandler.players[i].underAttackBy = c.playerId;
PlayerHandler.players[i].killerId = c.playerId;
PlayerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
if (c.killedBy != PlayerHandler.players[i].playerId)
c.totalPlayerDamageDealt = 0;
c.killedBy = PlayerHandler.players[i].playerId;
c.getCombat().applySmite(i, damage);
switch (damageMask) {
case 1:
PlayerHandler.players[i].dealDamage(damage);
PlayerHandler.players[i].damageTaken[c.playerId] += damage;
c.totalPlayerDamageDealt += damage;
PlayerHandler.players[i].updateRequired = true;
o.getPA().refreshSkill(3);
break;
case 2:
PlayerHandler.players[i].dealDamage(damage);
PlayerHandler.players[i].damageTaken[c.playerId] += damage;
c.totalPlayerDamageDealt += damage;
PlayerHandler.players[i].updateRequired = true;
c.doubleHit = false;
o.getPA().refreshSkill(3);
break;
}
PlayerHandler.players[i].handleHitMask(damage);
}
public static void playerDelayedHit(final Client c, final int i) {
if (PlayerHandler.players[i] != null) {
if (PlayerHandler.players[i].isDead || c.isDead
|| PlayerHandler.players[i].playerLevel[3] <= 0
|| c.playerLevel[3] <= 0) {
c.playerIndex = 0;
return;
}
if (PlayerHandler.players[i].respawnTimer > 0) {
c.faceUpdate(0);
c.playerIndex = 0;
return;
}
Client o = (Client) PlayerHandler.players[i];
o.getPA().removeAllWindows();
if (o.playerIndex <= 0 && o.npcIndex <= 0) {
if (o.autoRet == 1) {
o.playerIndex = c.playerId;
}
}
if (o.attackTimer <= 3 || o.attackTimer == 0 && o.playerIndex == 0
&& !c.castingMagic) { // block animation
o.startAnimation(o.getCombat().getBlockEmote());
}
if (o.inTrade) {
o.getTradeAndDuel().declineTrade();
}
if (c.projectileStage == 0 && !c.usingMagic) { // melee hit damage
c.getCombat().applyPlayerHit(c, i);
}
c.getCombat().addCharge();
if (!c.castingMagic && c.projectileStage > 0) { // range hit damage
int damage = Misc.random(c.getCombat().rangeMaxHit());
int damage2 = -1;
if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1) {
damage2 = Misc.random(c.getCombat().rangeMaxHit());
}
c.rangeEndGFX = RangeData.getRangeEndGFX(c);
if (Misc.random(10 + o.getCombat().calculateRangeDefence()) > Misc
.random(10 + c.getCombat().calculateRangeAttack())
&& !c.ignoreDefence) {
damage = 0;
}
if (c.playerEquipment[3] == 9185) {
if (Misc.random(10) == 1) {
if (damage > 0) {
c.boltDamage = damage;
c.getCombat().crossbowSpecial(c, i);
damage *= c.crossbowDamage;
}
}
}
if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1) {
if (Misc.random(10 + o.getCombat().calculateRangeDefence()) > Misc
.random(10 + c.getCombat().calculateRangeAttack()))
damage2 = 0;
}
if (c.dbowSpec) {
o.gfx100(c.lastArrowUsed == 11212 ? 1100 : 1103);
if (damage < 8)
damage = 8;
if (damage2 < 8)
damage2 = 8;
c.dbowSpec = false;
}
if (o.prayerActive[17]
&& System.currentTimeMillis() - o.protRangeDelay > 1500) { // if
// prayer
// active
// reduce
// damage
// by
// half
damage = (int) damage * 60 / 100;
if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1)
damage2 = (int) damage2 * 60 / 100;
}
if (PlayerHandler.players[i].playerLevel[3] - damage < 0) {
damage = PlayerHandler.players[i].playerLevel[3];
}
if (PlayerHandler.players[i].playerLevel[3] - damage - damage2 < 0) {
damage2 = PlayerHandler.players[i].playerLevel[3] - damage;
}
if (damage < 0)
damage = 0;
if (damage2 < 0 && damage2 != -1)
damage2 = 0;
if (o.vengOn) {
c.getCombat().appendVengeance(i, damage);
c.getCombat().appendVengeance(i, damage2);
}
if (damage > 0)
c.getCombat().applyRecoil(damage, i);
if (damage2 > 0)
c.getCombat().applyRecoil(damage2, i);
if (c.fightMode == 3) {
c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
4);
c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
1);
c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
3);
c.getPA().refreshSkill(1);
c.getPA().refreshSkill(3);
c.getPA().refreshSkill(4);
} else {
c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE), 4);
c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
3);
c.getPA().refreshSkill(3);
c.getPA().refreshSkill(4);
}
boolean dropArrows = true;
for (int noArrowId : c.NO_ARROW_DROP) {
if (c.lastWeaponUsed == noArrowId) {
dropArrows = false;
break;
}
}
if (dropArrows) {
c.getItems().dropArrowPlayer();
}
if (c.rangeEndGFX > 0
&& !c.getCombat().usingBolts(c.lastArrowUsed)) {
if (c.rangeEndGFXHeight) {
o.gfx100(c.rangeEndGFX);
} else {
o.gfx0(c.rangeEndGFX);
}
}
PlayerHandler.players[i].underAttackBy = c.playerId;
PlayerHandler.players[i].logoutDelay = System
.currentTimeMillis();
PlayerHandler.players[i].singleCombatDelay = System
.currentTimeMillis();
PlayerHandler.players[i].killerId = c.playerId;
PlayerHandler.players[i].dealDamage(damage);
PlayerHandler.players[i].damageTaken[c.playerId] += damage;
c.killedBy = PlayerHandler.players[i].playerId;
PlayerHandler.players[i].handleHitMask(damage);
c.ignoreDefence = false;
if (damage2 != -1) {
PlayerHandler.players[i].dealDamage(damage2);
PlayerHandler.players[i].damageTaken[c.playerId] += damage2;
PlayerHandler.players[i].handleHitMask(damage2);
}
o.getPA().refreshSkill(3);
PlayerHandler.players[i].updateRequired = true;
c.getCombat().applySmite(i, damage);
if (damage2 != -1)
c.getCombat().applySmite(i, damage2);
} else if (c.projectileStage > 0) { // magic hit damageno0b
int damage = 0;
if (c.spellSwap) {
c.spellSwap = false;
c.setSidebarInterface(6, 16640);
c.playerMagicBook = 2;
c.gfx0(-1);
}
if (c.fullVoidMage()
&& c.playerEquipment[c.playerWeapon] == 8841) {
damage = Misc.random(c.getCombat().magicMaxHit() + 13);
} else {
damage = Misc.random(c.getCombat().magicMaxHit());
}
if (c.getCombat().godSpells()) {
if (System.currentTimeMillis() - c.godSpellDelay < Config.GOD_SPELL_CHARGE) {
damage += 10;
}
}
if (c.magicFailed)
damage = 0;
if (o.prayerActive[16]
&& System.currentTimeMillis() - o.protMageDelay > 1500) { // if
// prayer
// active
// reduce
// damage
// by
// half
damage = (int) damage * 60 / 100;
}
if (PlayerHandler.players[i].playerLevel[3] - damage < 0) {
damage = PlayerHandler.players[i].playerLevel[3];
}
if (o.vengOn)
c.getCombat().appendVengeance(i, damage);
if (damage > 0)
c.getCombat().applyRecoil(damage, i);
if (c.magicDef) {
c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3),
1);
c.getPA().refreshSkill(1);
}
c.getPA().addSkillXP(
(c.MAGIC_SPELLS[c.oldSpellId][7] + damage
* Config.MAGIC_EXP_RATE), 6);
c.getPA().addSkillXP(
(c.MAGIC_SPELLS[c.oldSpellId][7] + damage
* Config.MAGIC_EXP_RATE / 3), 3);
c.getPA().refreshSkill(3);
c.getPA().refreshSkill(6);
if (c.getCombat().getEndGfxHeight() == 100 && !c.magicFailed) { // end
// GFX
PlayerHandler.players[i]
.gfx100(c.MAGIC_SPELLS[c.oldSpellId][5]);
} else if (!c.magicFailed) {
PlayerHandler.players[i]
.gfx0(c.MAGIC_SPELLS[c.oldSpellId][5]);
} else if (c.magicFailed) {
PlayerHandler.players[i].gfx100(85);
}
if (!c.magicFailed) {
if (System.currentTimeMillis()
- PlayerHandler.players[i].reduceStat > 35000) {
PlayerHandler.players[i].reduceStat = System
.currentTimeMillis();
switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
case 12987:
case 13011:
case 12999:
case 13023:
PlayerHandler.players[i].playerLevel[0] -= ((o
.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[0]) * 10) / 100);
break;
}
}
switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
case 12445: // teleblock
if (System.currentTimeMillis() - o.teleBlockDelay > o.teleBlockLength) {
o.teleBlockDelay = System.currentTimeMillis();
o.sendMessage("You have been teleblocked.");
if (o.prayerActive[16]
&& System.currentTimeMillis()
- o.protMageDelay > 1500)
o.teleBlockLength = 150000;
else
o.teleBlockLength = 300000;
}
break;
case 12901:
case 12919: // blood spells
case 12911:
case 12929:
int heal = (int) (damage / 4);
if (c.playerLevel[3] + heal > c.getPA().getLevelForXP(
c.playerXP[3])) {
c.playerLevel[3] = c.getPA().getLevelForXP(
c.playerXP[3]);
} else {
c.playerLevel[3] += heal;
}
c.getPA().refreshSkill(3);
break;
case 1153:
PlayerHandler.players[i].playerLevel[0] -= ((o.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[0]) * 5) / 100);
o.sendMessage("Your attack level has been reduced!");
PlayerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System
.currentTimeMillis();
o.getPA().refreshSkill(0);
break;
case 1157:
PlayerHandler.players[i].playerLevel[2] -= ((o.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[2]) * 5) / 100);
o.sendMessage("Your strength level has been reduced!");
PlayerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System
.currentTimeMillis();
o.getPA().refreshSkill(2);
break;
case 1161:
PlayerHandler.players[i].playerLevel[1] -= ((o.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[1]) * 5) / 100);
o.sendMessage("Your defence level has been reduced!");
PlayerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System
.currentTimeMillis();
o.getPA().refreshSkill(1);
break;
case 1542:
PlayerHandler.players[i].playerLevel[1] -= ((o.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[1]) * 10) / 100);
o.sendMessage("Your defence level has been reduced!");
PlayerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System
.currentTimeMillis();
o.getPA().refreshSkill(1);
break;
case 1543:
PlayerHandler.players[i].playerLevel[2] -= ((o.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[2]) * 10) / 100);
o.sendMessage("Your strength level has been reduced!");
PlayerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System
.currentTimeMillis();
o.getPA().refreshSkill(2);
break;
case 1562:
PlayerHandler.players[i].playerLevel[0] -= ((o.getPA()
.getLevelForXP(
PlayerHandler.players[i].playerXP[0]) * 10) / 100);
o.sendMessage("Your attack level has been reduced!");
PlayerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System
.currentTimeMillis();
o.getPA().refreshSkill(0);
break;
}
}
PlayerHandler.players[i].logoutDelay = System
.currentTimeMillis();
PlayerHandler.players[i].underAttackBy = c.playerId;
PlayerHandler.players[i].killerId = c.playerId;
PlayerHandler.players[i].singleCombatDelay = System
.currentTimeMillis();
if (c.getCombat().magicMaxHit() != 0) {
PlayerHandler.players[i].dealDamage(damage);
PlayerHandler.players[i].damageTaken[c.playerId] += damage;
c.totalPlayerDamageDealt += damage;
if (!c.magicFailed) {
PlayerHandler.players[i].handleHitMask(damage);
}
}
c.getCombat().applySmite(i, damage);
c.killedBy = PlayerHandler.players[i].playerId;
o.getPA().refreshSkill(3);
PlayerHandler.players[i].updateRequired = true;
c.usingMagic = false;
c.castingMagic = false;
if (o.inMulti() && c.getCombat().multis()) {
c.barrageCount = 0;
for (int j = 0; j < PlayerHandler.players.length; j++) {
if (PlayerHandler.players[j] != null) {
if (j == o.playerId)
continue;
if (c.barrageCount >= 9)
break;
if (o.goodDistance(o.getX(), o.getY(),
PlayerHandler.players[j].getX(),
PlayerHandler.players[j].getY(), 1))
c.getCombat().appendMultiBarrage(j,
c.magicFailed);
}
}
}
c.getPA().refreshSkill(3);
c.getPA().refreshSkill(6);
c.oldSpellId = 0;
}
}
c.getPA().requestUpdates();
if (c.bowSpecShot <= 0) {
c.oldPlayerIndex = 0;
c.projectileStage = 0;
c.lastWeaponUsed = 0;
c.doubleHit = false;
c.bowSpecShot = 0;
}
if (c.bowSpecShot != 0) {
c.bowSpecShot = 0;
}
}
public static void attackPlayer(Client c, int i) {
if (PlayerHandler.players[i] != null) {
if (PlayerHandler.players[i].isDead) {
c.getCombat().resetPlayerAttack();
return;
}
if (c.respawnTimer > 0 || PlayerHandler.players[i].respawnTimer > 0) {
c.getCombat().resetPlayerAttack();
return;
}
if (!c.getCombat().checkReqs()) {
return;
}
boolean sameSpot = c.absX == PlayerHandler.players[i].getX()
&& c.absY == PlayerHandler.players[i].getY();
if (!c.goodDistance(PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), c.getX(), c.getY(), 25)
&& !sameSpot) {
c.getCombat().resetPlayerAttack();
return;
}
if (PlayerHandler.players[i].respawnTimer > 0) {
PlayerHandler.players[i].playerIndex = 0;
c.getCombat().resetPlayerAttack();
return;
}
if (PlayerHandler.players[i].heightLevel != c.heightLevel) {
c.getCombat().resetPlayerAttack();
return;
}
c.followId = i;
c.followId2 = 0;
if (c.attackTimer <= 0) {
c.usingBow = false;
c.specEffect = 0;
c.usingRangeWeapon = false;
c.rangeItemUsed = 0;
c.usingBow = false;
c.usingArrows = false;
c.usingOtherRangeWeapons = false;
c.usingCross = c.playerEquipment[c.playerWeapon] == 9185;
c.projectileStage = 0;
if (c.absX == PlayerHandler.players[i].absX
&& c.absY == PlayerHandler.players[i].absY) {
if (c.freezeTimer > 0) {
c.getCombat().resetPlayerAttack();
return;
}
c.followId = i;
c.attackTimer = 0;
return;
}
// c.sendMessage("Made it here1.");
if (!c.usingMagic) {
for (int bowId : c.BOWS) {
if (c.playerEquipment[c.playerWeapon] == bowId) {
c.usingBow = true;
for (int arrowId : c.ARROWS) {
if (c.playerEquipment[c.playerArrows] == arrowId) {
c.usingArrows = true;
}
}
}
}
for (int otherRangeId : c.OTHER_RANGE_WEAPONS) {
if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
c.usingOtherRangeWeapons = true;
}
}
}
if (c.autocasting) {
c.spellId = c.autocastId;
c.usingMagic = true;
}
if (c.spellId > 0) {
c.usingMagic = true;
}
c.attackTimer = c.getCombat().getAttackDelay(
c.getItems()
.getItemName(c.playerEquipment[c.playerWeapon])
.toLowerCase());
if (c.clanWarRule[2]
&& (c.usingBow || c.usingOtherRangeWeapons)) {
c.sendMessage("You are not allowed to use ranged during this war!");
return;
}
if (c.clanWarRule[0]
&& (!c.usingBow && !c.usingOtherRangeWeapons && !c.usingMagic)) {
c.sendMessage("You are not allowed to use melee during this war!");
return;
}
if (c.clanWarRule[1] && c.usingMagic) {
c.sendMessage("You are not allowed to use magic during this war!");
c.getCombat().resetPlayerAttack();
return;
}
if(c.duelRule[9]){
boolean canUseWeapon = false;
for(int funWeapon: Config.FUN_WEAPONS) {
if(c.playerEquipment[c.playerWeapon] == funWeapon) {
canUseWeapon = true;
}
}
if(!canUseWeapon) {
c.sendMessage("You can only use fun weapons in this duel!");
c.getCombat().resetPlayerAttack();
return;
}
}
if(c.duelRule[2] && (c.usingBow || c.usingOtherRangeWeapons)) {
c.sendMessage("Range has been disabled in this duel!");
c.getCombat().resetPlayerAttack();
return;
}
if(c.duelRule[3] && (!c.usingBow && !c.usingOtherRangeWeapons && !c.usingMagic)) {
c.sendMessage("Melee has been disabled in this duel!");
c.getCombat().resetPlayerAttack();
return;
}
if(c.duelRule[4] && c.usingMagic) {
c.sendMessage("Magic has been disabled in this duel!");
c.getCombat().resetPlayerAttack();
return;
}
if ((!c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 4) && (c.usingOtherRangeWeapons
&& !c.usingBow && !c.usingMagic))
|| (!c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 2) && (!c.usingOtherRangeWeapons
&& c.getCombat().usingHally() && !c.usingBow && !c.usingMagic))
|| (!c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), c.getCombat()
.getRequiredDistance()) && (!c.usingOtherRangeWeapons
&& !c.getCombat().usingHally() && !c.usingBow && !c.usingMagic))
|| (!c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 10) && (c.usingBow || c.usingMagic))) {
c.attackTimer = 1;
if (!c.usingBow && !c.usingMagic
&& !c.usingOtherRangeWeapons && c.freezeTimer > 0)
c.getCombat().resetPlayerAttack();
return;
}
if (!c.usingCross
&& !c.usingArrows
&& c.usingBow
&& (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)
&& !c.usingMagic) {
c.sendMessage("You have run out of arrows!");
c.stopMovement();
c.getCombat().resetPlayerAttack();
return;
}
if (c.getCombat().correctBowAndArrows() < c.playerEquipment[c.playerArrows]
&& Config.CORRECT_ARROWS
&& c.usingBow
&& !c.getCombat().usingCrystalBow()
&& c.playerEquipment[c.playerWeapon] != 9185
&& !c.usingMagic) {
c.sendMessage("You can't use "
+ c.getItems()
.getItemName(
c.playerEquipment[c.playerArrows])
.toLowerCase()
+ "s with a "
+ c.getItems()
.getItemName(
c.playerEquipment[c.playerWeapon])
.toLowerCase() + ".");
c.stopMovement();
c.getCombat().resetPlayerAttack();
return;
}
if (c.playerEquipment[c.playerWeapon] == 9185
&& !c.getCombat().properBolts() && !c.usingMagic) {
c.sendMessage("You must use bolts with a crossbow.");
c.stopMovement();
c.getCombat().resetPlayerAttack();
return;
}
if (c.usingBow || c.usingMagic || c.usingOtherRangeWeapons
|| c.getCombat().usingHally()) {
c.stopMovement();
}
if (!c.getCombat().checkMagicReqs(c.spellId)) {
c.stopMovement();
c.getCombat().resetPlayerAttack();
return;
}
c.faceUpdate(i + 32768);
if(c.duelStatus != 5) {
if (!c.attackedPlayers.contains(c.playerIndex)
&& !PlayerHandler.players[c.playerIndex].attackedPlayers
.contains(c.playerId)) {
c.attackedPlayers.add(c.playerIndex);
c.isSkulled = true;
c.skullTimer = Config.SKULL_TIMER;
c.headIconPk = 0;
c.getPA().requestUpdates();
}
}
c.specAccuracy = 1.0;
c.specDamage = 1.0;
c.delayedDamage = c.delayedDamage2 = 0;
if (c.usingSpecial && !c.usingMagic) {
if(c.duelRule[10] && c.duelStatus == 5) {
c.sendMessage("Special attacks have been disabled during this duel!");
c.usingSpecial = false;
c.getItems().updateSpecialBar();
c.getCombat().resetPlayerAttack();
return;
}
if (c.getCombat().checkSpecAmount(
c.playerEquipment[c.playerWeapon])) {
c.lastArrowUsed = c.playerEquipment[c.playerArrows];
c.getCombat().activateSpecial(
c.playerEquipment[c.playerWeapon], i);
c.followId = c.playerIndex;
return;
} else {
c.sendMessage("You don't have the required special energy to use this attack.");
c.usingSpecial = false;
c.getItems().updateSpecialBar();
c.playerIndex = 0;
return;
}
}
if (c.playerLevel[3] > 0 && !c.isDead
&& PlayerHandler.players[i].playerLevel[3] > 0) {
if (!c.usingMagic) {
c.startAnimation(c
.getCombat()
.getWepAnim(
c.getItems()
.getItemName(
c.playerEquipment[c.playerWeapon])
.toLowerCase()));
c.mageFollow = false;
} else {
c.startAnimation(c.MAGIC_SPELLS[c.spellId][2]);
c.mageFollow = true;
c.followId = c.playerIndex;
}
}
PlayerHandler.players[i].underAttackBy = c.playerId;
PlayerHandler.players[i].logoutDelay = System
.currentTimeMillis();
PlayerHandler.players[i].singleCombatDelay = System
.currentTimeMillis();
PlayerHandler.players[i].killerId = c.playerId;
c.lastArrowUsed = 0;
c.rangeItemUsed = 0;
if (!c.usingBow && !c.usingMagic && !c.usingOtherRangeWeapons) { // melee
// hit
// delay
c.followId = PlayerHandler.players[c.playerIndex].playerId;
c.getPA().followPlayer();
c.hitDelay = c.getCombat().getHitDelay(
i,
c.getItems()
.getItemName(
c.playerEquipment[c.playerWeapon])
.toLowerCase());
c.delayedDamage = Misc.random(c.getCombat()
.calculateMeleeMaxHit());
c.projectileStage = 0;
c.oldPlayerIndex = i;
}
if (c.usingBow && !c.usingOtherRangeWeapons && !c.usingMagic
|| c.usingCross) { // range hit delay
if (c.playerEquipment[c.playerWeapon] >= 4212
&& c.playerEquipment[c.playerWeapon] <= 4223) {
c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
c.crystalBowArrowCount++;
} else {
c.rangeItemUsed = c.playerEquipment[c.playerArrows];
c.getItems().deleteArrow();
}
if (c.fightMode == 2)
c.attackTimer--;
if (c.usingCross)
c.usingBow = true;
c.usingBow = true;
c.followId = PlayerHandler.players[c.playerIndex].playerId;
c.getPA().followPlayer();
c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
c.lastArrowUsed = c.playerEquipment[c.playerArrows];
c.gfx100(c.getCombat().getRangeStartGFX());
c.hitDelay = c.getCombat().getHitDelay(
i,
c.getItems()
.getItemName(
c.playerEquipment[c.playerWeapon])
.toLowerCase());
c.projectileStage = 1;
c.oldPlayerIndex = i;
c.getCombat().fireProjectilePlayer();
}
if (c.usingOtherRangeWeapons) { // knives, darts, etc hit delay
c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
c.getItems().deleteEquipment();
c.usingRangeWeapon = true;
c.followId = PlayerHandler.players[c.playerIndex].playerId;
c.getPA().followPlayer();
c.gfx100(c.getCombat().getRangeStartGFX());
if (c.fightMode == 2)
c.attackTimer--;
c.hitDelay = c.getCombat().getHitDelay(
i,
c.getItems()
.getItemName(
c.playerEquipment[c.playerWeapon])
.toLowerCase());
c.projectileStage = 1;
c.oldPlayerIndex = i;
c.getCombat().fireProjectilePlayer();
}
if (c.usingMagic) { // magic hit delay
int pX = c.getX();
int pY = c.getY();
int nX = PlayerHandler.players[i].getX();
int nY = PlayerHandler.players[i].getY();
int offX = (pY - nY) * -1;
int offY = (pX - nX) * -1;
c.castingMagic = true;
c.projectileStage = 2;
if (c.MAGIC_SPELLS[c.spellId][3] > 0) {
if (c.getCombat().getStartGfxHeight() == 100) {
c.gfx100(c.MAGIC_SPELLS[c.spellId][3]);
} else {
c.gfx0(c.MAGIC_SPELLS[c.spellId][3]);
}
}
if (c.MAGIC_SPELLS[c.spellId][4] > 0) {
c.getPA().createPlayersProjectile(pX, pY, offX, offY,
50, 78, c.MAGIC_SPELLS[c.spellId][4],
c.getCombat().getStartHeight(),
c.getCombat().getEndHeight(), -i - 1,
c.getCombat().getStartDelay());
}
if (c.autocastId > 0) {
c.followId = c.playerIndex;
c.followDistance = 5;
}
c.hitDelay = c.getCombat().getHitDelay(
i,
c.getItems()
.getItemName(
c.playerEquipment[c.playerWeapon])
.toLowerCase());
c.oldPlayerIndex = i;
c.oldSpellId = c.spellId;
c.spellId = 0;
Client o = (Client) PlayerHandler.players[i];
if (c.MAGIC_SPELLS[c.oldSpellId][0] == 12891 && o.isMoving) {
// c.sendMessage("Barrage projectile..");
c.getPA().createPlayersProjectile(pX, pY, offX, offY,
50, 85, 368, 25, 25, -i - 1,
c.getCombat().getStartDelay());
}
if (Misc.random(o.getCombat().mageDef()) > Misc.random(c
.getCombat().mageAtk())) {
// if(Misc.random(o.getCombat().mageAtk()) >
// Misc.random(o.getCombat().mageDef())) {
c.magicFailed = true;
} else {
c.magicFailed = false;
}
// if(Misc.random(o.getCombat().mageAtk()) >
// Misc.random(o.getCombat().mageDef())) {
// c.magicFailed = false;
// } else if(Misc.random(o.getCombat().mageAtk()) <
// Misc.random(o.getCombat().mageDef())) {
// c.magicFailed = true;
// }
int freezeDelay = c.getCombat().getFreezeTime();// freeze
// time
if (freezeDelay > 0
&& PlayerHandler.players[i].freezeTimer <= -3
&& !c.magicFailed) {
PlayerHandler.players[i].freezeTimer = freezeDelay;
o.resetWalkingQueue();
o.sendMessage("You have been frozen.");
o.frozenBy = c.playerId;
}
if (!c.autocasting && c.spellId <= 0)
c.playerIndex = 0;
}
if (c.usingBow && Config.CRYSTAL_BOW_DEGRADES) { // crystal bow
// degrading
if (c.playerEquipment[c.playerWeapon] == 4212) { // new
// crystal
// bow
// becomes
// full
// bow
// on
// the
// first
// shot
c.getItems().wearItem(4214, 1, 3);
}
if (c.crystalBowArrowCount >= 250) {
switch (c.playerEquipment[c.playerWeapon]) {
case 4223: // 1/10 bow
c.getItems().wearItem(-1, 1, 3);
c.sendMessage("Your crystal bow has fully degraded.");
if (!c.getItems().addItem(4207, 1)) {
Server.itemHandler.createGroundItem(c, 4207,
c.getX(), c.getY(), 1, c.getId());
}
c.crystalBowArrowCount = 0;
break;
default:
c.getItems().wearItem(
++c.playerEquipment[c.playerWeapon], 1, 3);
c.sendMessage("Your crystal bow degrades.");
c.crystalBowArrowCount = 0;
break;
}
}
}
}
}
}
} | [
"matthew.kinnear@hotmail.com"
] | matthew.kinnear@hotmail.com |
0575ff6df019abdb868f469f98838150672d68ee | 7cf488de6e2624116d71ee96677383f96840ae30 | /src/App/Distribucion_Laplace.java | deefa13643c2c9ebce88610c7b74c44001ad9f2c | [] | no_license | MvegaR/LabCIM | bf1424da580c9c056dafdd937be914402f4b64c2 | 5112f189ee1971208764c8e58b63aabeab1e9962 | refs/heads/master | 2021-01-10T15:48:16.059648 | 2016-01-08T02:42:14 | 2016-01-08T02:42:14 | 48,813,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,450 | java | package app;
public class Distribucion_Laplace {
public static final double E = 2.7182818284590452354;
public static final double PI = 3.14159265358979323846;
protected float b; //debe ser mayor a 0
protected Float u;
protected Float x;
protected float Resultado;
Distribucion_Laplace(){
b=u=x=Resultado=0;
}
/* Clase destinana al c�lculo probabilistico de la distribuci�n de Laplace
* Formula de la distribucion de Laplace:
* F(x)=0,5[1+sgn(x-u)(1-exp(-|x-u|/b))]
* variables:
* u, x, b que debe ser mayor a 0
*
*/
public boolean ComprobarVariables(float b, float u, float x){
if(b>0){
this.b=b;
this.u=u;
this.x=x;
return true;
}
return false;
}
public int SignumXU(float x, float u){
float base;
int resultado;
if(x==u & x==0 & u==0){
return 0;
}else{
base= x+u;
if(base<0){
base= base *-1;
}
resultado= (int) ((x+u)/base);
return resultado;
}
}
public float Calculo(float b, float u, float x){
System.out.println("*Distribucion Laplace");
float exponente;// resultado;
if(ComprobarVariables(b, u, x)==true){
exponente= (x - u);
if(exponente<0){
exponente= exponente *-1;
}
exponente= (exponente/b) *-1;
Resultado= (float) (0.5*(1 + SignumXU(x,-u)*(1 - Math.pow(E, exponente))));
System.out.println("Con x: "+x+"\nb: " +b+ "\nu: "+u+"\nResultado: "+ Resultado);
return Resultado;
}
return -1;
}
}
| [
"mvegar@alumnos.ubiobio.cl"
] | mvegar@alumnos.ubiobio.cl |
a3eb5aa6150640ea2e65c13e9b23e466ad42b532 | f9afba88a391228a802902b64216c2512cb1009d | /irc5-demographics-plugin/src/main/java/org/apache/turbine/app/xnat/modules/screens/XDATScreen_edit_irc5_participantData.java | 7d4877ca5e9a8c321c0bcb0b76e347a431726c3f | [] | no_license | QBI-Software/XNAT_modules | cf584453489f8639786b391e7157ae7920e893fd | 9971395067d6fb1513a6fd674c89e39e7c6e88b4 | refs/heads/master | 2021-08-02T07:55:00.090325 | 2021-07-21T08:38:55 | 2021-07-21T08:38:55 | 68,763,541 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | /*
* GENERATED FILE
* Created on Mon Mar 27 08:57:11 AEST 2017
*
*/
package org.apache.turbine.app.xnat.modules.screens;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
import org.nrg.xft.ItemI;
/**
* @author XDAT
*
*/
public class XDATScreen_edit_irc5_participantData extends org.nrg.xdat.turbine.modules.screens.EditScreenA {
static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(XDATScreen_edit_irc5_participantData.class);
/* (non-Javadoc)
* @see org.nrg.xdat.turbine.modules.screens.EditScreenA#getElementName()
*/
public String getElementName() {
return "irc5:qbiccDemographics";
}
public ItemI getEmptyItem(RunData data) throws Exception
{
return super.getEmptyItem(data);
}
/* (non-Javadoc)
* @see org.nrg.xdat.turbine.modules.screens.SecureReport#finalProcessing(org.apache.turbine.util.RunData, org.apache.velocity.context.Context)
*/
public void finalProcessing(RunData data, Context context) {
}}
| [
"e.cooperwilliams@uq.edu.au"
] | e.cooperwilliams@uq.edu.au |
2bd6e827376a5741cfe400dff210543cca712822 | 36b7671ded78fed50432623f532c9db4269e05f5 | /javaFun/Basic.java | d7c9b093657cfaa0425af6539bf593ec06ba58ea | [] | no_license | Chiefautoparts/javaWork | 66b6cdea9a1ffc663c924ea52814112db85aea25 | 3ceb560c87f3d5cd1e4bfd15c086c750a8f03316 | refs/heads/master | 2020-05-30T14:45:03.691402 | 2019-06-02T21:43:37 | 2019-06-02T21:43:37 | 189,799,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | java | import java.util.ArrayList;
public class Basic {
// Print 1 - 255
public int num() {
for (int i = 0; i < 256; i++){
return i;
}
}
// Print odd numbers between 1-255
public int odd(){
ArrayList<Integer> oddArray = new ArrayList<Integer>();
for(int i = 0; i < 256; i++){
if (i % 2 == 1){
oddArray.add(i);
}
}
return oddArray;
}
// Print sum
public int sum() {
int temp = 0;
for (int i = 0; i < 256; i++) {
temp += i;
i++;
}
return temp;
}
// Iterate through an array
public int iter(int[] array) {
for(int i = 0; i < array.length+1; i++){
return array[i];
}
}
// find max
// Get average
// Array with Odd number
// Greater that y
// Square the values
// Eliminate Negative numbers
// Max, Min and Average
// Shifting the values in the Array
}
// | [
"chieftautoparts@outlook.com"
] | chieftautoparts@outlook.com |
d38aaae01498803f2494d5016cd0b2707a3b6130 | 79b6d1038f6e9673fdb479482ef0a8a7de1893aa | /src/main/java/com/desk/java/apiclient/model/InteractionLinks.java | 73c960f1cb640a07e9dc2c6707807e09124c7eb6 | [] | permissive | forcedotcom/scmt-server | 870cf1a9123ee8b5fffb424c54d9e29de98a60e6 | 645a7150893c3f6204763102fae555744a0c2cfb | refs/heads/master | 2022-02-22T05:53:24.327486 | 2022-02-12T08:37:16 | 2022-02-12T08:37:16 | 80,548,131 | 3 | 6 | BSD-3-Clause | 2018-12-14T19:18:06 | 2017-01-31T18:20:43 | Java | UTF-8 | Java | false | false | 5,936 | java | /*
* Copyright (c) 2017, Salesforce.com, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.desk.java.apiclient.model;
import com.google.gson.annotations.SerializedName;
import org.jetbrains.annotations.Nullable;
import java.io.Serializable;
public class InteractionLinks extends Links implements Serializable
{
private static final long serialVersionUID = 1564333269335931295L;
// common links
@SerializedName("case")
private Link caseLink;
private Link customer;
private Link sent_by;
private Link erased_by;
private Link hidden_by;
// email links
private Link splits;
private Link attachments;
// phone links
private Link entered_by;
// chat links
private Link created_by;
// twitter links
private Link twitter_account;
private Link favorited_by_twitter_account;
private Link retweeted_by;
private Link favorited_by;
// community question links
private Link topic;
private Link best_answer;
private Link answers_disallowed_by;
// common links
@Nullable
/**
* Retrieve the case this interaction belongs to
* @return the case this interaction belongs to
*/
public Link getCaseLink()
{
return caseLink;
}
@Nullable
/**
* Retrieve the customer that sent this interaction.
* @return the customer that sent this interaction
*/
public Link getCustomer()
{
return this.customer;
}
@Nullable
/**
* Retrieve the user that erased this interaction.
* @return the user that erased this interaction
*/
public Link getErasedBy()
{
return this.erased_by;
}
@Nullable
/**
* Retrieve the user that hid this interaction.
* @return the user that hid this interaction
*/
public Link getHiddenBy()
{
return this.hidden_by;
}
@Nullable
/**
* Retrieve the user that sent this interaction.
* @return the user that sent this interaction
*/
public Link getSentBy()
{
return this.sent_by;
}
// email links
@Nullable
/**
* Retrieve the case splits associated with this interaction
* @return the case splits associated with this interaction
*/
public Link getSplits()
{
return this.splits;
}
@Nullable
/**
* Retrieve the attachments associated to this interaction.
* @return the attachments associated to this interaction
*/
public Link getAttachments()
{
return this.attachments;
}
// phone links
@Nullable
/**
* Retrieve the user that entered this interaction.
* @return the user that entered this interaction
*/
public Link getEnteredBy()
{
return this.entered_by;
}
// chat links
/**
* Retrieve the user who sent the chat message.
* @return The user who sent the chat message.
*/
public Link getCreatedBy()
{
return created_by;
}
// twitter links
/**
* Retrieve the twitter account that created this tweet.
* @return the twitter account that created this tweet
*/
public Link getTwitterAccount()
{
return twitter_account;
}
/**
* Retrieve the twitter account that favorited this tweet.
* @return the twitter account that favorited this tweet
*/
public Link getFavoritedByTwitterAccount()
{
return favorited_by_twitter_account;
}
/**
* Retrieve who re-tweeted this tweet.
* @return who re-tweeted this tweet
*/
public Link getRetweetedBy()
{
return retweeted_by;
}
/**
* Retrieve who favorited this tweet.
* @return who favorited this tweet
*/
public Link getFavoritedBy()
{
return favorited_by;
}
// community question links
/**
* Retrieve topics for this question.
* @return topics for this question
*/
public Link getTopic()
{
return topic;
}
/**
* Retrieve link to best answer to this question.
* @return link to best answer to this question
*/
public Link getBestAnswer()
{
return best_answer;
}
/**
* Retrieve user who disallowed answers.
* @return user who disallowed answers
*/
public Link getAnswersDisallowedBy()
{
return answers_disallowed_by;
}
}
| [
"thomas@stachl.me"
] | thomas@stachl.me |
a3653af1481355ff916ce5446c7ec3467e0f862e | b56ce7122bdb0c9baac033bb871cad5cdf203d07 | /src/main/java/me/lachlanap/balloonbox/core/messaging/SimpleMessageListener.java | a6fd1f7e9670835e31bbaeb6426fbce9c25aa4b1 | [
"MIT"
] | permissive | thorinii/balloon-box | 7a21ae2191235eda29ce2dd0edfef033ca6cafae | 02e6f537329e0cf5c80dd0cd4a05fb3cc5f7228e | refs/heads/master | 2020-05-21T11:34:46.319696 | 2014-02-15T06:59:57 | 2014-02-15T06:59:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 846 | java | package me.lachlanap.balloonbox.core.messaging;
import me.lachlanap.balloonbox.core.level.EndOfLevelInfo;
/**
*
* @author lachlan
*/
public class SimpleMessageListener implements MessageListener {
protected SimpleMessageListener() {
}
@Override
public boolean disconnectTransientListeners() {
return false;
}
@Override
public void collectedBalloon() {
}
@Override
public void collectedBattery() {
}
@Override
public void collectedLife() {
}
@Override
public void died() {
}
@Override
public void endOfLevel(EndOfLevelInfo info) {
}
@Override
public void nextLevel() {
}
@Override
public void restartLevel() {
}
@Override
public void exitLevel() {
}
@Override
public void toggleDevTools() {
}
}
| [
"flipsidelachy@gmail.com"
] | flipsidelachy@gmail.com |
6737ead45dabd1e097be7d629ed5168fbd101632 | 491a0054d69f834e87c41ce6c2665bd32d62afc9 | /src/main/java/zhou/yi/T1_helloworld/App.java | a984d1128a701cf21beeb53e57024bdb44896ca7 | [] | no_license | renmingpinming/rabbitmq-test | 3ff5fdaf0767220debb2c07427973d7cc30a914b | 506978f6b40ba9f5c61c8d82c844e6a03734a4b9 | refs/heads/master | 2020-05-01T14:38:32.345715 | 2019-03-26T01:36:11 | 2019-03-26T01:36:11 | 177,525,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,224 | java | package zhou.yi.T1_helloworld;
import com.rabbitmq.client.*;
import org.junit.Test;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
/**
* @Author: XiaoLang
* @Date: 2019/3/25 11:33
*/
public class App {
@Test
public void send() throws IOException, TimeoutException {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare("hello", false, false, false, null);
// 将第二个参数设为true,表示声明一个需要持久化的队列。
// 需要注意的是,若你已经定义了一个非持久的,同名字的队列,要么将其先删除(不然会报错),要么换一个名字。
// channel.queueDeclare("hello", true, false, false, null);
channel.basicPublish("", "hello", null, "Hello World3".getBytes());
// 修改了第三个参数,这是表明消息需要持久化
// channel.basicPublish("", "hello", MessageProperties.PERSISTENT_TEXT_PLAIN, "Hello World3".getBytes());
channel.close();
connection.close();
}
@Test
public void receive() throws Exception {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare("hello", false, false, false, null);
channel.basicConsume("hello", true, new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
System.out.println(new String(body, "UTF-8"));
}
});
synchronized (this){
// 因为以上接收消息的方法是异步的(非阻塞),当采用单元测试方式执行该方法时,程序会在打印消息前结束,因此使用wait来防止程序提前终止。若使用main方法执行,则不需要担心该问题。
wait();
}
}
}
| [
"renmingpinming@163.com"
] | renmingpinming@163.com |
17875350f1d83983b0c9676b41b8cdc7ccb98895 | 40d4b43779690206ba4d303a9e63eddf94243d0a | /Backend/pki/src/main/java/com/bsep/pki/model/User.java | 2cb44220f26f366c5ec61e2f5da4b3aec99ce355 | [] | no_license | LazarJovic/bsepTim13 | f34292303d11542c3e7df26c4b16c327c5779e2c | 5673497c09683dd1219f974b2c763a4a11d36595 | refs/heads/master | 2023-01-30T06:34:46.539848 | 2020-04-14T11:30:26 | 2020-04-14T11:30:26 | 247,959,560 | 0 | 0 | null | 2023-01-07T16:38:51 | 2020-03-17T12:05:00 | Java | UTF-8 | Java | false | false | 3,167 | java | package com.bsep.pki.model;
import javax.persistence.*;
@Entity
@Table(name = "users")
public class User {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column(name = "given_name")
private String givenName;
@Column(name = "last_name")
private String lastName;
@Column(name = "common_name")
private String commonName;
@Column(name = "country")
private String country;
@Column(name = "organization")
private String organization;
@Column(name = "organization_unit")
private String organizationUnit;
@Column(name = "locality")
private String locality;
@Column(name = "email")
private String email;
@Column(name = "isCA")
private boolean isCA;
@Column( name = "numberOfCert")
private Long numberOfCert;
public User() {}
public User(String givenName, String lastName, String commonName, String country, String organization,
String organizationUnit, String locality, String email, boolean isCA, Long numberOfCert) {
this.givenName = givenName;
this.lastName = lastName;
this.commonName = commonName;
this.country = country;
this.organization = organization;
this.organizationUnit = organizationUnit;
this.locality = locality;
this.email = email;
this.isCA = isCA;
this.numberOfCert = numberOfCert;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getGivenName() {
return givenName;
}
public void setGivenName(String givenName) {
this.givenName = givenName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getCommonName() {
return commonName;
}
public void setCommonName(String commonName) {
this.commonName = commonName;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization;
}
public String getOrganizationUnit() {
return organizationUnit;
}
public void setOrganizationUnit(String organizationUnit) {
this.organizationUnit = organizationUnit;
}
public String getLocality() {
return locality;
}
public void setLocality(String locality) {
this.locality = locality;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean isCA() {
return isCA;
}
public void setCA(boolean CA) {
isCA = CA;
}
public Long getNumberOfCert() {
return numberOfCert;
}
public void setNumberOfCert(Long numberOfCert) {
this.numberOfCert = numberOfCert;
}
}
| [
"lazar.13jovic@gmail.com"
] | lazar.13jovic@gmail.com |
7cfbd96f5407771c94fcae86e74e8a74d2b501fe | 61bf70fba1aecafe6f0413f90f48b1b478ba1dee | /src/main/java/ro/uTech/security/repository/UserRoleRepository.java | aef948063daebf01408f462321de3e3b8967bceb | [] | no_license | maraconstantinescu1125/utech | de37e861e2eaa5d312eee5b7f4c2f724ea9b2276 | f607022c68f145407f05b73fededd4e14095e542 | refs/heads/master | 2020-04-16T18:52:17.778448 | 2018-12-09T21:00:13 | 2018-12-09T21:00:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package ro.uTech.security.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import ro.uTech.security.model.domain.User;
import ro.uTech.security.model.domain.UserRole;
public interface UserRoleRepository extends JpaRepository<UserRole, Long> {
UserRole findByUser(@Param("user") User user);
}
| [
"cosmin.baciu@fidelia.biz"
] | cosmin.baciu@fidelia.biz |
1c0844c2eda69e456ff46d62d6537431aa538f51 | 28e842f4a75a14fab3c9b612ed73482cd4f44cae | /src/Alunos.java | 8155fc5ef95e7cac08d9b4fb06d629ee9cb7f63d | [] | no_license | Devisson9/lpoo | f8d78ab0b968772b9e6cf752ab279526ace178c7 | 5308df890e6253184a1179400b6c79559723d2e2 | refs/heads/master | 2020-08-10T00:26:47.186856 | 2019-10-10T15:22:04 | 2019-10-10T15:22:04 | 214,209,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java |
public class Alunos {
int codAluno;
String nome;
String nota1;
String nota2;
String nota3;
String nota4;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getTurma() {
return turma;
}
public void setTurma(String turma) {
this.turma = turma;
}
public String geEscola() {
return escola;
}
public void setEscola(String escola) {
this.escola = escola;
}
| [
"devisson.oliveira2641@gmail.com"
] | devisson.oliveira2641@gmail.com |
1556a9aa6dc74d2d080020e067f3de49d5cd208b | 0207f7cb0d0d741e66887c0f39c349693d7eddb5 | /Tienda/src/main/java/com/tienda/service/db/CategoriaServiceJpa.java | f9d13318f872d9a6bb1f6408e08208c956b62c27 | [] | no_license | javier17/Tienda---Old---2 | 9bc170060b0a3f4e68c636c81b684134a030e001 | b714ef9bb58d7fb88294596d7d11644f00aa15b2 | refs/heads/master | 2022-08-28T11:36:56.565846 | 2020-05-26T02:05:56 | 2020-05-26T02:05:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package com.tienda.service.db;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tienda.model.Categoria;
import com.tienda.repository.ICategoriaRepository;
import com.tienda.service.ICategoriaService;
@Service
public class CategoriaServiceJpa implements ICategoriaService{
@Autowired
private ICategoriaRepository categoriasRepo;
@Override
public void guardar(Categoria categoria) {
categoriasRepo.save(categoria);
}
@Override
public List<Categoria> buscarTodas() {
return categoriasRepo.findAll();
}
@Override
public Categoria buscarPorId(Integer idCategoria) {
Optional<Categoria> optional = categoriasRepo.findById(idCategoria);
if(optional.isPresent()) {
return optional.get();
}
return null;
}
}
| [
"javierpita17@hotmail.com"
] | javierpita17@hotmail.com |
844d98a2d77ac0ea0bf2d0eeb256035554b67d83 | 2cff2c32964026d230d042d1b3f7092369a0d4cb | /src/main/java/cs601/webmail/WebMailServer.java | fe84360ce02b5124ef0e5452f336a2108d06033f | [] | no_license | YuanyuanZh/webmail-project | 8974dade3f9fddd438720e4b49de19112cc200cc | 64bbd6f44b7b1d7ac05bae5d89141dde2b3c97d0 | refs/heads/master | 2021-01-10T14:40:16.910535 | 2014-12-04T05:49:49 | 2014-12-04T05:49:49 | 50,327,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,672 | java | package cs601.webmail;
import cs601.webmail.auth.AuthenticationCheckFilter;
import cs601.webmail.auth.AccessAuditFilter;
import cs601.webmail.util.PropertyExpander;
import org.apache.log4j.BasicConfigurator;
import cs601.webmail.pages.DispatchServlet;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.*;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import javax.servlet.DispatcherType;
import java.util.EnumSet;
import java.io.File;
import java.io.FileNotFoundException;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
/**
* Created by yuanyuan on 10/22/14.
*/
public class WebMailServer{
public static void main(String[] args) throws Exception {
BasicConfigurator.configure();
String classPath = "";
try {
classPath = WebMailServer.class.getResource("").getPath();
} catch (Exception e) {
e.printStackTrace();
}
Configuration configuration = Configuration.getDefault();
String logDir = PropertyExpander.expandSystemProperties("${user.home}/webmail/logs");
String staticFilesDir = System.getProperty("user.dir") + "/webroot";
Server server = new Server(8080);
System.out.println("Server starting...");
System.out.println("----------------------------------------------------");
System.out.println("Static Dir: " + staticFilesDir);
System.out.println("Log Dir: " + logDir);
System.out.println("User Dir: " + System.getProperty("user.dir"));
System.out.println("Application Work Dir: " + configuration.get(Configuration.WORK_DIR));
System.out.println("----------------------------------------------------");
ServletContextHandler context = new
ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
//support https
String jettyDistKeystore = "keystore";
String keystorePath = jettyDistKeystore;
File keystoreFile = new File(keystorePath);
if (!keystoreFile.exists()) {
throw new FileNotFoundException(keystoreFile.getAbsolutePath());
}
//Server server = new Server();
// HTTP Configuration
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(8443);
http_config.setOutputBufferSize(32768);
// HTTP connector
ServerConnector http = new ServerConnector(server,
new HttpConnectionFactory(http_config));
http.setPort(8080);
http.setIdleTimeout(30000);
// SSL Context Factory for HTTPS and SPDY
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(keystoreFile.getAbsolutePath());
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
// HTTPS Configuration
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
// HTTPS connector
ServerConnector https = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, "http/1.1"),
new HttpConnectionFactory(https_config));
https.setPort(8443);
https.setIdleTimeout(500000);
// Set the connectors
server.setConnectors(new Connector[]{http, https});
server.setHandler(context);
// Audit all the request. Log their path and more information to log file.
FilterHolder auditFilter = new FilterHolder(AccessAuditFilter.class);
context.addFilter(auditFilter, "/*", EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST));
// Login checking.
FilterHolder loginFilter = new FilterHolder(AuthenticationCheckFilter.class);
context.addFilter(loginFilter, "/*", EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST));
// add a simple Servlet at "/dynamic/*"
ServletHolder holderDynamic = new ServletHolder("dynamic", DispatchServlet.class);
context.addServlet(holderDynamic, "/*");
// add special pathspec of "/home/" content mapped to the homePath
ServletHolder holderHome = new ServletHolder("static-home", DefaultServlet.class);
holderHome.setInitParameter("resourceBase", staticFilesDir + "/files");
holderHome.setInitParameter("dirAllowed","true");
holderHome.setInitParameter("pathInfoOnly","true");
context.addServlet(holderHome, "/files/*");
ServletHolder resourcesHome = new ServletHolder("resources", DefaultServlet.class);
resourcesHome.setInitParameter("resourceBase", staticFilesDir + "/resources");
resourcesHome.setInitParameter("dirAllowed","true");
resourcesHome.setInitParameter("pathInfoOnly","true");
context.addServlet(resourcesHome, "/resources/*");
// Lastly, the default servlet for root content (always needed, to satisfy servlet spec)
// It is important that this is last.
ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
holderPwd.setInitParameter("resourceBase","/tmp/foo");
holderPwd.setInitParameter("dirAllowed","true");
context.addServlet(holderPwd, "/");
// log using NCSA (common log format)
// http://en.wikipedia.org/wiki/Common_Log_Format
NCSARequestLog requestLog = new NCSARequestLog();
requestLog.setFilename(logDir + "/yyyy_mm_dd.request.log");
requestLog.setFilenameDateFormat("yyyy_MM_dd");
requestLog.setRetainDays(90);
requestLog.setAppend(true);
requestLog.setExtended(true);
requestLog.setLogCookies(false);
requestLog.setLogTimeZone("GMT");
RequestLogHandler requestLogHandler = new RequestLogHandler();
requestLogHandler.setRequestLog(requestLog);
requestLogHandler.setServer(server);
server.start();
server.join();
}
}
| [
"yzhang171@dons.usfca.edu"
] | yzhang171@dons.usfca.edu |
b1a0053e0cb2a8fb3f1228870d5108cd6299509f | 629a1c72056f38bd238e021335432b40364a609b | /src/main/java/com/finance/utils/TestUtil.java | 369eb4722d7f49b57f96b1291a5f023fae9e768e | [] | no_license | sambitbhoi/TestAutomation | 66ce7c23a6edf5b8d7046578f923d8c3bab2b6ab | 8e079b9b6c58ca1d3893f29fcddc041921256dec | refs/heads/master | 2023-05-26T09:26:48.706288 | 2019-07-13T18:52:53 | 2019-07-13T19:02:39 | 196,756,768 | 2 | 0 | null | 2023-05-09T18:10:32 | 2019-07-13T19:01:41 | HTML | UTF-8 | Java | false | false | 149 | java | package com.finance.utils;
public class TestUtil {
public static long PAGE_LOAD_TIMEOUT = 20;
public static long IMPLICIT_WAIT = 20;
}
| [
"sambit362789@wipro.com"
] | sambit362789@wipro.com |
a9c32a52cd2c8bc13c56d77317dd8f3a8c991bb9 | 954bd8c43237b879fdd659a0f4c207a6ec0da7ea | /java.labs/jdnc-trunk/src/mattnathan/ScalableIcons/java/org/jdesktop/swingx/icon/compound/AbstractPolicy.java | 28387102eef3d0b2afed21a54f45524999589959 | [] | no_license | bothmagic/marxenter-labs | 5e85921ae5b964b9cd58c98602a0faf85be4264e | cf1040e4de8cf4fd13b95470d6846196e1c73ff4 | refs/heads/master | 2021-01-10T14:15:31.594790 | 2013-12-20T11:22:53 | 2013-12-20T11:22:53 | 46,557,821 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,956 | java | /*
* $Id: AbstractPolicy.java 2629 2008-08-06 08:27:49Z mattnathan $
*
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
* Santa Clara, California 95054, U.S.A. All rights reserved.
*/
package org.jdesktop.swingx.icon.compound;
import java.awt.AlphaComposite;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import javax.swing.Icon;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.jdesktop.swingx.icon.CompoundIcon;
import org.jdesktop.swingx.icon.IconUtilities;
import org.jdesktop.swingx.util.LocationPolicy;
/**
* Defines a set of common properties for CompoundIcon.Policy implementations. This policy provides support for
* specifying a scale factor which can be used to reduce the size of subsequent icons and a visibleIcons property which
* can be used to specify how many icons are painted before the opacity fades to 0. Use CONTAINER_SIZE to make all icons
* be painted but fading to transparent after the last icon.
*
* <p> For convenience a paintOffset property is included which can be used to specify which icon should be at the front
* of the stack. This is a lot more performant than rearranging the child icons in CompoundIcon and should be used where
* this behaviour is required.
*
* @author <a href="mailto:mattnathan@dev.java.net">Matt Nathan</a>
*/
public abstract class AbstractPolicy implements CompoundIcon.Policy {
/**
* The variable to use for setVisibleIcons if you want the icons to fade to
* nothing at the containers size.
*/
public static final int CONTAINER_SIZE = -1;
/**
* The variable to use if you want all icons to be opaque. this is the
* default value.
*/
public static final int ALL_VISIBLE = -2;
/**
* Defines the proportion of the size subsequent children will be painted at.
*/
private float scaleFactor;
/**
* Defines how many icons will be visible before the opacity setting reaches
* 0.
*/
private int visibleIcons;
/**
* Defines which child icon should be at the front of the stack.
*/
private int paintOffset = 0;
public AbstractPolicy() {
this(1, ALL_VISIBLE);
}
public AbstractPolicy(float scaleFactor, int visibleIcons) {
this.scaleFactor = scaleFactor;
this.visibleIcons = visibleIcons;
}
/**
* Paint a given child on the graphics given.
*
* @param container The containing Icon.
* @param child The Icon to paint.
* @param index the index of the icon to paint
* @param c The component calling the painting.
* @param g The graphics to paint to.
* @param x The x coordinate of the whole icon.
* @param y The y coordinate of the whole icon.
* @param width The width of the whole icon.
* @param height The height of the whole icon.
* @param location The location to paint the child.
*/
protected void paintChild(CompoundIcon container, Icon child, int index, Component c, Graphics g, int x, int y, int width, int height,
LocationPolicy location) {
float scale = (float) Math.pow(getScaleFactor(), index);
float opacity = getOpcaityFactor();
float alpha = 1;
if (opacity < 0) {
if (opacity == ALL_VISIBLE) {
alpha = 1;
} else if (opacity == CONTAINER_SIZE) {
alpha = 1 - (index / (float) container.getSize());
}
} else {
alpha = 1 - ((1 - getOpcaityFactor()) * index);
}
if (alpha > 0 && scale > 0) {
Graphics2D g2 = (Graphics2D) g;
// alpha
Composite comp = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
// scale
int nw = (int) (width * scale);
int nh = (int) (height * scale);
Point p = location.locate(new Dimension(nw, nh), new Dimension(width, height), null);
x += p.x;
y += p.y;
height = nh;
width = nw;
IconUtilities.paintChild(child, c, g, x, y, width, height, container.getChildLocationPolicy(), container.getChildScalePolicy());
g2.setComposite(comp);
}
}
/**
* Returns the next icon in the list.
*
* @param icon The container.
* @param index The current index.
* @param numIcons The total number of icons.
* @return The next index.
*/
protected int getNextIconIndex(CompoundIcon icon, int index, int numIcons) {
return (index + 1) % numIcons;
}
/**
* Gets the index in container of the icon which should be placed at the
* front.
*
* @param container The container.
* @return The first icon given the offset.
*/
protected int getFrontIconIndex(CompoundIcon container) {
int offset = getPaintOffset();
int size = container.getSize();
int index = -1;
if (size > 0) {
index = offset % size;
}
return index;
}
/**
* Returns an iterator that iterates through the children in the given icon
* starting at the paintOffset and wrapping around where necessary. The
* returned iterators add, set and remove methods are not supported.
* <p>
* The returned iterator will determine the starting element from the first
* call to next or previous. If next is called first then the starting
* position will be the paintOffset, if previous is called first then the
* initial element will be the item before the paintOffset, wrapping if
* necessary.
*
* @param icon The container.
* @return An iterator which starts at the offset icon.
*/
protected ListIterator<Icon> getOffsetIcons(final CompoundIcon icon) {
return new ListIterator<Icon>() {
private int size = icon.getSize();
private int current = size == 0 ? 0 : getPaintOffset() % size;
private int count = 0;
private boolean countSet = false;
public boolean hasNext() {
return countSet ? count < size : size > 0;
}
public Icon next() {
if (!countSet) {
count = 0;
countSet = true;
}
if (count >= size) {
throw new NoSuchElementException("Cannot return the next entry when none exist");
}
Icon result = icon.getIcon(current);
current = nextIndex();
count++;
return result;
}
public int nextIndex() {
return countSet ? (current + 1) % size : current;
}
public boolean hasPrevious() {
return countSet ? count >= 0 : size > 0;
}
public Icon previous() {
if (!countSet) {
countSet = true;
count = size;
current = previousIndex();
}
if (count < 0) {
throw new ArrayIndexOutOfBoundsException("Cannot return the previous entry when none exist");
}
Icon result = icon.getIcon(current);
current = previousIndex();
count--;
return result;
}
public int previousIndex() {
return countSet ? (current + size - 1) % size : (current + size - 1) % size;
}
public void remove() {
throw new UnsupportedOperationException();
}
public void set(Icon o) {
throw new UnsupportedOperationException();
}
public void add(Icon o) {
throw new UnsupportedOperationException();
}
};
}
/**
* Gets the factor by which subsequent children's opacity will be set.
*
* @return The opacity factor.
*/
public float getOpcaityFactor() {
return getVisibleIcons() < 0 ? getVisibleIcons() : 1 - (1 / (float) getVisibleIcons());
}
/**
* Returns the number of icons that will be visible before the opacity
* reaches 0.
*
* @return Number of visible icons.
*/
public int getVisibleIcons() {
return visibleIcons;
}
/**
* Get the offset of the child which should be painted on top.
*
* @return The offset for the first icon.
*/
public int getPaintOffset() {
return paintOffset;
}
/**
* Gets the factor by which subsequent child icons will be scaled.
*
* @return The scale factor.
*/
public float getScaleFactor() {
return scaleFactor;
}
/**
* Set the factor by which subsequent children's opacity will be set.
*
* @param opcaityFactor The opacity value multiplier.
*/
public void setOpcaityFactor(float opcaityFactor) {
this.visibleIcons = (int) Math.ceil(1 / (1 - opcaityFactor));
}
/**
* Set the number of icons that will be visible before their opacity reaches
* 0. Set to -1 for all icons to be visible.
*
* @param visibleIcons The total number of visible icons.
*/
public void setVisibleIcons(int visibleIcons) {
this.visibleIcons = visibleIcons;
}
/**
* Set the offset of the child icon which would be painted on top. The
* actual index of the top child will be {@code paintOffset % numChildren}
* and the order of children painted will follow in an increasing order
* wrapping when necessary.
*
* @param paintOffset The first icon offset.
*/
public void setPaintOffset(int paintOffset) {
this.paintOffset = paintOffset;
}
/**
* Set the factor by which subsequent children will be scaled. The size of
* children is calculated via the formula: {@code s - (1 - scaleFactor) * s *
* i} where s is the top child's size and i is the index of the subsequent
* child.
*
* @param scaleFactor The factor by which icons will be scaled.
*/
public void setScaleFactor(float scaleFactor) {
this.scaleFactor = scaleFactor;
}
}
| [
"markus.taubert@c8aec436-628a-29fb-4c76-4f2700b0ca23"
] | markus.taubert@c8aec436-628a-29fb-4c76-4f2700b0ca23 |
b6f2ff9bc4eb0c3789a80699c4bb5dc1a10d67ae | e661f802cd96699379aa3b3fc8617d9cafb83bb0 | /src/udpChatWithGUI/UDPChat.java | f81f7ecf434579b46590dc0b0cb13db59b7c6cf0 | [] | no_license | MarwinPhilips/marwin-philips-java-exercises | 446da62a7a808e560dda2eb57dac3a2e5a66a711 | 399fcfd9dbe38dfca926bdbb1e0a554992008562 | refs/heads/master | 2016-08-12T17:32:46.675490 | 2015-11-06T13:43:28 | 2015-11-06T13:43:28 | 36,251,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,383 | java | package udpChatWithGUI;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Enumeration;
public class UDPChat implements Chat {
static {
System.out.println("Available networks");
try {
Enumeration<NetworkInterface> ifs;
ifs = NetworkInterface.getNetworkInterfaces();
while (ifs.hasMoreElements()) {
NetworkInterface networkInterface = ifs.nextElement();
System.out.println(networkInterface.getName());
}
} catch (SocketException e) {
e.printStackTrace();
}
}
// Maximum time to live (TTL) for each Dtagram
public static final int TTL = 2;
// Maximum bytes to transport in a single Datagram
public static final int MAX_MESSAGE_SIZE = 1000;
// Multicast address in IPv4 or IPv6
public static final String IPv6MCAST_ADDR = "FF7E:230::1234";
public static final String IPv4MCAST_ADDR = "224.0.1.0";
// Port assigned to this program
public static final int PORT = 6543;
// Name of the network on which the Multicast is established
public static final String NETWORK_NAME = "wlan0";
public static final String IP_MCAST_ADDR = IPv4MCAST_ADDR;
private final MulticastSocket socket;
private final InetAddress group;
public UDPChat() throws IOException {
group = InetAddress.getByName(IP_MCAST_ADDR);
this.socket = new MulticastSocket(PORT);
socket.setNetworkInterface(NetworkInterface.getByName(NETWORK_NAME));
socket.setTimeToLive(TTL);
socket.joinGroup(group);
}
@Override
protected void finalize() throws Throwable {
socket.leaveGroup(group);
super.finalize();
}
@Override
public byte[] receive() throws IOException {
byte[] buf = new byte[UDPChat.MAX_MESSAGE_SIZE];
DatagramPacket datagramPacket = new DatagramPacket(buf, buf.length);
socket.receive(datagramPacket);
return Arrays.copyOfRange(buf, datagramPacket.getOffset(),
datagramPacket.getLength());
}
@Override
public void send(byte[] message) throws IOException {
if (message == null || message.length > MAX_MESSAGE_SIZE)
throw new IllegalArgumentException();
DatagramPacket msg = new DatagramPacket(message, message.length, group,
PORT);
socket.send(msg);
}
}
| [
"marwin.philips@gmail.com@ef681cb1-40c9-8e58-19f0-1f2f723a8d04"
] | marwin.philips@gmail.com@ef681cb1-40c9-8e58-19f0-1f2f723a8d04 |
40311221aed892d502d00e25f81e00e49abcfa4e | 25172128913f5b15786fed86623a9dc622436a0d | /app/src/main/java/com/iwebsapp/reqresjava/ui/login/presenter/LoginPresenter.java | 0f6b8fdb668796970fad1ff7e237688b1caed990 | [] | no_license | Mirellitha27/ReqResJava | c86ff0fc0014f9901a18d3f571dca0830d947767 | 7499289580956eecbcca189867459c920d0a60d0 | refs/heads/main | 2023-07-15T21:55:42.150389 | 2021-09-02T07:24:50 | 2021-09-02T07:24:50 | 402,251,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.iwebsapp.reqresjava.ui.login.presenter;
import com.iwebsapp.reqresjava.ui.login.view.LoginView;
public interface LoginPresenter extends LoginView {
void login(String email, String password);
}
| [
"anamireyaj@gmail.com"
] | anamireyaj@gmail.com |
b027c12ed33a293198a579fb315e9fcd4dfad83d | 1eb2fb89fd086cf0852ee74f88728588a8d2d3d1 | /cracking/src/main/java/c14_java/e14_06/CircularArray.java | e5a4c7d373e29857d91a070cf38987e4a36aab97 | [] | no_license | mebubo/education | c4693cf59942833ec0fda8f8d55be8ef30ab1620 | d61024f802ace74aa9be0ea99b1132199ef2017e | refs/heads/master | 2021-01-01T05:48:16.825269 | 2014-07-07T21:51:19 | 2014-07-07T21:51:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | package c14_java.e14_06;
import java.util.Iterator;
public class CircularArray<T> implements Iterable {
T[] array;
int head = 0;
public CircularArray(T[] array) {
this.array = array;
}
public CircularArray(int size) {
array = (T[]) new Object[size];
}
public void rotate(int amount) {
head = convert(amount);
}
private int convert(int i) {
i = i % array.length;
if (i < 0) {
i = array.length + i;
}
return (head + i) % array.length;
}
public T get(int i) {
return array[convert(i)];
}
public void set(int i, T e) {
array[convert(i)] = e;
}
public T[] toArray() {
T[] result = (T[]) new Object[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = get(i);
}
return result;
}
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
int i = 0;
@Override
public boolean hasNext() {
return i < array.length;
}
@Override
public T next() {
return get(i++);
}
};
}
}
| [
"dolgovs@gmail.com"
] | dolgovs@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.