blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
b6e9d60302e23939b4156775bc54743378f1275a
9,586,367,031,267
a323e15846f73f355b75b47b6a72b0ae0f667b70
/inputs/InteractUpdate.java
eb6a9f393ca865b27baf464250f806a81b1ee885
[ "MIT" ]
permissive
sep35/Engine
https://github.com/sep35/Engine
c854b48495d6e88980fb627893aa2a64ba3838f4
672d10768398e57039092cca901b77d746252d0d
refs/heads/master
2021-01-01T05:40:31.545000
2015-03-21T21:38:18
2015-03-21T21:38:18
32,651,073
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package inputs; import attributes.AbstractAttribute; import boardObjectModels.Patch; public class InteractUpdate extends AbstractUpdate{ private Patch myActor; private Patch myReceiver; private AbstractAttribute myAttribute; public InteractUpdate(Patch actor, AbstractAttribute attribute, Patch receiver){ myActor = actor; myReceiver = receiver; myAttribute = attribute; } public Patch getActor(){ return myActor; } public Patch getReceiver(){ return myReceiver; } public AbstractAttribute getAttribute(){ return myAttribute; } public AbstractUpdate oppositeMethod() { // TODO Auto-generated method stub return null; } @Override public AbstractUpdate getMyOpposite () { // TODO Auto-generated method stub return null; } }
UTF-8
Java
978
java
InteractUpdate.java
Java
[]
null
[]
package inputs; import attributes.AbstractAttribute; import boardObjectModels.Patch; public class InteractUpdate extends AbstractUpdate{ private Patch myActor; private Patch myReceiver; private AbstractAttribute myAttribute; public InteractUpdate(Patch actor, AbstractAttribute attribute, Patch receiver){ myActor = actor; myReceiver = receiver; myAttribute = attribute; } public Patch getActor(){ return myActor; } public Patch getReceiver(){ return myReceiver; } public AbstractAttribute getAttribute(){ return myAttribute; } public AbstractUpdate oppositeMethod() { // TODO Auto-generated method stub return null; } @Override public AbstractUpdate getMyOpposite () { // TODO Auto-generated method stub return null; } }
978
0.599182
0.599182
40
23.450001
19.132368
88
false
false
0
0
0
0
0
0
0.65
false
false
4
28db43b859365f8fd44506a9e9dd6bf1d00c2313
2,353,642,132,950
a82ee117e6bb6002104fc659d585f31b2e746777
/app/src/main/java/com/example/carinfo/VehicleList.java
8ba0542103f1bde95cbe3e0eb9778ad78298efcf
[]
no_license
mnkkhan/CarInfo
https://github.com/mnkkhan/CarInfo
4adfc4cabe88fc89a8cf45c45335604e581806e2
bfdb709c1d679bf0432667cc613697418a1507ef
refs/heads/master
2023-02-07T20:10:05.056000
2020-12-29T08:13:55
2020-12-29T08:13:55
325,203,804
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.carinfo; import android.content.Intent; import android.database.Cursor; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SearchView; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class VehicleList extends AppCompatActivity { VehicleDataBase dv=new VehicleDataBase(this); SearchView searchView; RecyclerView itemList; List<Item> listitem= new ArrayList<>(); VehicleAdapter adapter; String id; String Auid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_vehicle_list); itemList = (RecyclerView) findViewById(R.id.itemList); itemList.setHasFixedSize(true); Auid=getIntent().getStringExtra("varA"); Cursor res=dv.DisplayAll(); if (res!=null && res.getCount()>0) { int i=0; while (res.moveToNext()) { listitem.add(new Item(res.getString(1),res.getString(2),Auid)); i++; } }else { Toast.makeText(getApplicationContext(),"No Vehicle Record Found",Toast.LENGTH_SHORT).show(); } LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this); itemList.setLayoutManager(linearLayoutManager); adapter=new VehicleAdapter(listitem,VehicleList.this); itemList.setAdapter(adapter); } @Override public void onBackPressed() { Intent intent=new Intent(getApplicationContext(),MainActivity.class); startActivity(intent); finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu,menu); final MenuItem myActionMenuItem = menu.findItem(R.id.search); searchView=(SearchView)myActionMenuItem.getActionView(); ((EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)).setHintTextColor(getResources().getColor(R.color.white)); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { if (!searchView.isIconified()){ searchView.setIconified(true); } myActionMenuItem.collapseActionView(); return false; } @Override public boolean onQueryTextChange(String s) { final List<Item> filtermodelist=filter(listitem,s); adapter.setfilter(filtermodelist); return false; } }); return true; } private List<Item> filter(List<Item> p1, String query) { query=query.toLowerCase(); final List<Item> filteredModeList=new ArrayList<>(); for(Item model:p1) { final String text=model.getNumber().toLowerCase(); if (text.startsWith(query)) { filteredModeList.add(model); } } return filteredModeList; } private void changeSearchViewTextColor(View view){ if (view!=null) { if (view instanceof TextView){ ((TextView) view).setTextColor(Color.WHITE); return; }else if (view instanceof ViewGroup){ ViewGroup viewGroup=(ViewGroup) view; for (int i=0;i<viewGroup.getChildCount();i++){ changeSearchViewTextColor(viewGroup.getChildAt(i)); } } } } }
UTF-8
Java
4,204
java
VehicleList.java
Java
[]
null
[]
package com.example.carinfo; import android.content.Intent; import android.database.Cursor; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SearchView; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class VehicleList extends AppCompatActivity { VehicleDataBase dv=new VehicleDataBase(this); SearchView searchView; RecyclerView itemList; List<Item> listitem= new ArrayList<>(); VehicleAdapter adapter; String id; String Auid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_vehicle_list); itemList = (RecyclerView) findViewById(R.id.itemList); itemList.setHasFixedSize(true); Auid=getIntent().getStringExtra("varA"); Cursor res=dv.DisplayAll(); if (res!=null && res.getCount()>0) { int i=0; while (res.moveToNext()) { listitem.add(new Item(res.getString(1),res.getString(2),Auid)); i++; } }else { Toast.makeText(getApplicationContext(),"No Vehicle Record Found",Toast.LENGTH_SHORT).show(); } LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this); itemList.setLayoutManager(linearLayoutManager); adapter=new VehicleAdapter(listitem,VehicleList.this); itemList.setAdapter(adapter); } @Override public void onBackPressed() { Intent intent=new Intent(getApplicationContext(),MainActivity.class); startActivity(intent); finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu,menu); final MenuItem myActionMenuItem = menu.findItem(R.id.search); searchView=(SearchView)myActionMenuItem.getActionView(); ((EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)).setHintTextColor(getResources().getColor(R.color.white)); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { if (!searchView.isIconified()){ searchView.setIconified(true); } myActionMenuItem.collapseActionView(); return false; } @Override public boolean onQueryTextChange(String s) { final List<Item> filtermodelist=filter(listitem,s); adapter.setfilter(filtermodelist); return false; } }); return true; } private List<Item> filter(List<Item> p1, String query) { query=query.toLowerCase(); final List<Item> filteredModeList=new ArrayList<>(); for(Item model:p1) { final String text=model.getNumber().toLowerCase(); if (text.startsWith(query)) { filteredModeList.add(model); } } return filteredModeList; } private void changeSearchViewTextColor(View view){ if (view!=null) { if (view instanceof TextView){ ((TextView) view).setTextColor(Color.WHITE); return; }else if (view instanceof ViewGroup){ ViewGroup viewGroup=(ViewGroup) view; for (int i=0;i<viewGroup.getChildCount();i++){ changeSearchViewTextColor(viewGroup.getChildAt(i)); } } } } }
4,204
0.635823
0.632969
132
30.85606
24.859951
153
false
false
0
0
0
0
0
0
0.598485
false
false
4
0c93c06c62f35bc39ac4946c610b226f2f38f7db
19,499,151,557,780
c987a4404531b3a4e38cc8199e0bc0cfd54225ad
/zap-service/src/test/java/at/msol/mops/zap/service/dto/assembler/VerfahrenAssemblerTest.java
16c8d0b1ba7380ad13fafe325c9c200e7d6399e0
[]
no_license
Slatko/zap
https://github.com/Slatko/zap
f203b4b3d97d3c50b9b1cfd01747ea115866d45a
fe2614f04bf9a3679512f4db8a0c2a7701130550
refs/heads/master
2018-12-24T14:17:17.547000
2018-10-17T09:45:31
2018-10-17T09:45:31
153,430,177
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.msol.mops.zap.service.dto.assembler; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.beteiligtePerson1; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.urkunde1; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.verfahren1; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapAnwenderZt; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapAnwenderZtAdmin; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapAnwenderZtMa; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapOrg1; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; import at.msol.mops.zap.persistence.model.org.ZapAnwender; import at.msol.mops.zap.persistence.model.org.ZapOrganisation; import at.msol.mops.zap.persistence.model.verfahren.Urkunde; import at.msol.mops.zap.persistence.model.verfahren.Verfahren; import at.msol.mops.zap.service.dto.verfahren.VerfahrenInfo; public class VerfahrenAssemblerTest { @Test public void testAssembleVerfahren() throws Exception { /* prepare */ ZapAnwender verfahrensErsteller = zapAnwenderZt(); verfahrensErsteller.setId(1L); ZapAnwender letzterBearbeiter = zapAnwenderZtMa(); letzterBearbeiter.setId(2L); ZapAnwender zivilTechniker = zapAnwenderZtAdmin(); zivilTechniker.setId(3L); ZapOrganisation zapOrganisation = zapOrg1(); zapOrganisation.setId(4L); Verfahren verfahren = verfahren1(); verfahren.setVerfahrensErsteller(verfahrensErsteller); verfahren.setZivilTechniker(zivilTechniker); verfahren.setLetzterBearbeiter(letzterBearbeiter); verfahren.setZapOrganisation(zapOrganisation); verfahren.addBeteiligter(beteiligtePerson1()); Urkunde urkunde = urkunde1(); urkunde.setDateiErsteller(verfahrensErsteller); urkunde.setArchivEinbringer(verfahrensErsteller); verfahren.addDatei(urkunde); /* call test method */ VerfahrenAssembler verfahrenAssembler = new VerfahrenAssembler(new BeteiligterAssembler(), new DateiAssembler()); VerfahrenInfo verfahrenInfo = verfahrenAssembler.assemble(verfahren); /* checks */ assertEquals(verfahrensErsteller.getId(), Long.valueOf(verfahrenInfo.getVerfahrensErstellerId())); assertEquals(zivilTechniker.getId(), Long.valueOf(verfahrenInfo.getZivilTechnikerId())); assertEquals(letzterBearbeiter.getId(), verfahrenInfo.getLetzterBearbeiterId()); assertEquals(zapOrganisation.getId(), Long.valueOf(verfahrenInfo.getZapOrganisationId())); assertNotNull(verfahrenInfo.getVerfahrenDto()); assertEquals(1, verfahrenInfo.getBeteiligterInfos().size()); assertEquals(1, verfahrenInfo.getUrkundeInfos().size()); assertEquals(verfahren.getAntragsArten().size(), verfahrenInfo.getAntragsArten().size()); } }
UTF-8
Java
2,955
java
VerfahrenAssemblerTest.java
Java
[]
null
[]
package at.msol.mops.zap.service.dto.assembler; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.beteiligtePerson1; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.urkunde1; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.verfahren1; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapAnwenderZt; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapAnwenderZtAdmin; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapAnwenderZtMa; import static at.msol.mops.zap.persistence.helper.TestEntityFactory.zapOrg1; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; import at.msol.mops.zap.persistence.model.org.ZapAnwender; import at.msol.mops.zap.persistence.model.org.ZapOrganisation; import at.msol.mops.zap.persistence.model.verfahren.Urkunde; import at.msol.mops.zap.persistence.model.verfahren.Verfahren; import at.msol.mops.zap.service.dto.verfahren.VerfahrenInfo; public class VerfahrenAssemblerTest { @Test public void testAssembleVerfahren() throws Exception { /* prepare */ ZapAnwender verfahrensErsteller = zapAnwenderZt(); verfahrensErsteller.setId(1L); ZapAnwender letzterBearbeiter = zapAnwenderZtMa(); letzterBearbeiter.setId(2L); ZapAnwender zivilTechniker = zapAnwenderZtAdmin(); zivilTechniker.setId(3L); ZapOrganisation zapOrganisation = zapOrg1(); zapOrganisation.setId(4L); Verfahren verfahren = verfahren1(); verfahren.setVerfahrensErsteller(verfahrensErsteller); verfahren.setZivilTechniker(zivilTechniker); verfahren.setLetzterBearbeiter(letzterBearbeiter); verfahren.setZapOrganisation(zapOrganisation); verfahren.addBeteiligter(beteiligtePerson1()); Urkunde urkunde = urkunde1(); urkunde.setDateiErsteller(verfahrensErsteller); urkunde.setArchivEinbringer(verfahrensErsteller); verfahren.addDatei(urkunde); /* call test method */ VerfahrenAssembler verfahrenAssembler = new VerfahrenAssembler(new BeteiligterAssembler(), new DateiAssembler()); VerfahrenInfo verfahrenInfo = verfahrenAssembler.assemble(verfahren); /* checks */ assertEquals(verfahrensErsteller.getId(), Long.valueOf(verfahrenInfo.getVerfahrensErstellerId())); assertEquals(zivilTechniker.getId(), Long.valueOf(verfahrenInfo.getZivilTechnikerId())); assertEquals(letzterBearbeiter.getId(), verfahrenInfo.getLetzterBearbeiterId()); assertEquals(zapOrganisation.getId(), Long.valueOf(verfahrenInfo.getZapOrganisationId())); assertNotNull(verfahrenInfo.getVerfahrenDto()); assertEquals(1, verfahrenInfo.getBeteiligterInfos().size()); assertEquals(1, verfahrenInfo.getUrkundeInfos().size()); assertEquals(verfahren.getAntragsArten().size(), verfahrenInfo.getAntragsArten().size()); } }
2,955
0.781388
0.77665
64
44.171875
31.333166
117
false
false
0
0
0
0
0
0
0.8125
false
false
4
21e88afd70f2d137679f1f7035d9bdd52a19433a
11,003,706,226,763
edfa05b040a311d60b3540c9131b20ee47dc9ac2
/aconf-service/src/main/java/com/github/bh/aconf/service/FilterCacheService.java
1872b7f2a0f3f8070a0eb457ba4daaa634c489f7
[]
no_license
BenHaiXiao/aconf
https://github.com/BenHaiXiao/aconf
92ba31d8a31c56a43a6935e9f02f7205145d8706
ba237b8a2e6ab3efe393b4256478032906fd589a
refs/heads/master
2021-04-12T03:30:41.059000
2018-04-07T13:23:35
2018-04-07T13:23:35
125,700,399
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.bh.aconf.service; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.github.bh.aconf.common.constants.FilterBelongType; import com.github.bh.aconf.common.constants.FilterType; import com.github.bh.aconf.common.utils.JsonUtils; import com.github.bh.aconf.common.utils.VersionConverter; import com.github.bh.aconf.filter.BoundaryUtils; import com.github.bh.aconf.filter.FilterConfig; import com.github.bh.aconf.persist.base.model.FilterMeta; import net.sf.ehcache.Ehcache; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.text.SimpleDateFormat; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 过滤匹配规划缓存处理。 * <p> * 缓存内存为:bssId/conditionId : List of {@link FilterConfig} * * @author xiaobenhai * Date: 2017/2/20 * Time: 11:33 */ @Service public class FilterCacheService { private static final Logger LOGGER = LoggerFactory.getLogger(FilterCacheService.class); private static final String CACHE_NAME = "filters"; private static final String BSS_CACHE_KEY_PREFIX = "bss-"; private static final String ITEM_CACHE_KEY_PREFIX = "item-"; private static final String CONDITION_CACHE_KEY_PREFIX = "condition-"; @Autowired private FilterMetaService filterMetaService; @Autowired private CacheManager cacheManager; public static ConcurrentHashMap<String,Long> emptyCacheMerge = new ConcurrentHashMap<String,Long>(); @PostConstruct public void initCache() { updateFilterCache(); } public List<FilterConfig> getFilterConfigsFromCache(long belongId, FilterBelongType belongType) { if (FilterBelongType.BSS == belongType) { return getFilterConfigsFromCache(getBssCacheKey(belongId)); } if (FilterBelongType.CONDITION == belongType) { return getFilterConfigsFromCache(getConfigConditionCacheKey(belongId)); } return Collections.emptyList(); } public List<FilterConfig> getFilterConfigsFromDb(long belongId, FilterBelongType belongType) { return transform(filterMetaService.getValidFilterMetas(belongId, belongType)); } private List<FilterConfig> getFilterConfigsFromCache(String key) { Cache filtersCache = getFiltersCache(); if (filtersCache == null) { return Collections.emptyList(); } Cache.ValueWrapper valueWrapper = filtersCache.get(key); if (valueWrapper == null) { //LOGGER.warn("cache value is empty >>> key:{}", key); if(!emptyCacheMerge.containsKey(key)) emptyCacheMerge.put(key, 0L); return Collections.emptyList(); } return (List<FilterConfig>) valueWrapper.get(); } private String getBssCacheKey(long bssId) { return BSS_CACHE_KEY_PREFIX + bssId; } private String getConfigItemCacheKey(long configItemId) { return ITEM_CACHE_KEY_PREFIX + configItemId; } private String getConfigConditionCacheKey(long conditionId) { return CONDITION_CACHE_KEY_PREFIX + conditionId; } public void updateFilterCache() { Cache filtersCache = getFiltersCache(); if (filtersCache == null) { return; } Ehcache ehcache = (Ehcache) filtersCache.getNativeCache(); List<String> keys = ehcache.getKeys(); Map<String, List<FilterConfig>> filterMap = assemble(getAllValidFilterMetasFromDb()); for (String key : keys) { if (!filterMap.containsKey(key)) { filtersCache.evict(key); } } for (Map.Entry entry : filterMap.entrySet()) { filtersCache.put(entry.getKey(), entry.getValue()); } } private Cache getFiltersCache() { Cache filtersCache = cacheManager.getCache(CACHE_NAME); if (filtersCache == null) { LOGGER.warn("getFiltersCache:error >>> cache name:{}", CACHE_NAME); return null; } return filtersCache; } private Map<String, List<FilterConfig>> assemble(List<FilterMeta> metas) { Map<String, List<FilterConfig>> filterMap = Maps.newHashMap(); for (FilterMeta meta : metas) { if ("version".equals(meta.getBasis()) || "osversion".equals(meta.getBasis())) { List<String> boundaryList = BoundaryUtils.splitJson(meta.getBoundary()); List<String> numVersionList = Lists.newLinkedList(); for(String version : boundaryList){ numVersionList.add(String.valueOf(VersionConverter.convert(version))); } meta.setBoundary(JsonUtils.toJson(numVersionList)); //meta.setBoundary(String.valueOf(VersionConverter.convert(meta.getBoundary()))); }else if ("datetime".equals(meta.getBasis())) { List<String> boundaryList = BoundaryUtils.splitJson(meta.getBoundary()); List<String> numDatetimeList = Lists.newLinkedList(); for(String datetime : boundaryList){ Long d = DatetimeConverter(datetime); if(d!=null && d>0){ numDatetimeList.add(String.valueOf(d)); } } meta.setBoundary(JsonUtils.toJson(numDatetimeList)); } long belongId = meta.getBelongId(); if (FilterBelongType.BSS.isMe(meta.getBelongType())) { fill(getBssCacheKey(belongId), filterMap, meta); } // else if (FilterBelongType.ITEM.isMe(meta.getBelongType())) { // fill(getConfigItemCacheKey(belongId), filterMap, meta); // } else if (FilterBelongType.CONDITION.isMe(meta.getBelongType())) { fill(getConfigConditionCacheKey(belongId), filterMap, meta); } } return filterMap; } private List<FilterMeta> getAllValidFilterMetasFromDb() { try { List<FilterMeta> metas = filterMetaService.getAllValidFilterMetas(); if (metas == null) { LOGGER.warn("getAllValidConditionMetas from db:empty"); return Collections.emptyList(); } return metas; } catch (Exception e) { LOGGER.error("getAllValidFilterMetasFromDb error", e); } return Collections.emptyList(); } private void fill(String cacheKey, Map<String, List<FilterConfig>> filterMap, FilterMeta meta) { List<FilterConfig> configs = filterMap.get(cacheKey); if (configs == null) { configs = Lists.newArrayList(); filterMap.put(cacheKey, configs); } configs.add(transform(meta)); } private FilterConfig transform(FilterMeta meta) { if (meta == null) { return null; } return new FilterConfig(meta.getBasis(), meta.getOperator(), meta.getBoundary(), FilterType.valueOf(meta.getBasisType())); } private List<FilterConfig> transform(List<FilterMeta> metas) { if (CollectionUtils.isEmpty(metas)) { return Collections.emptyList(); } return Lists.transform(metas, new Function<FilterMeta, FilterConfig>() { @Override public FilterConfig apply(FilterMeta meta) { return transform(meta); } }); } private Long DatetimeConverter(String datetime) { try{ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sf.parse(datetime).getTime(); }catch(Exception e){ LOGGER.warn("DatetimeConverter error:"+datetime, e); return null; } } }
UTF-8
Java
8,132
java
FilterCacheService.java
Java
[ { "context": "ionId : List of {@link FilterConfig}\n *\n * @author xiaobenhai\n * Date: 2017/2/20\n * Time: 11:33\n */\n@Service\npu", "end": 1185, "score": 0.9992867708206177, "start": 1175, "tag": "USERNAME", "value": "xiaobenhai" } ]
null
[]
package com.github.bh.aconf.service; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.github.bh.aconf.common.constants.FilterBelongType; import com.github.bh.aconf.common.constants.FilterType; import com.github.bh.aconf.common.utils.JsonUtils; import com.github.bh.aconf.common.utils.VersionConverter; import com.github.bh.aconf.filter.BoundaryUtils; import com.github.bh.aconf.filter.FilterConfig; import com.github.bh.aconf.persist.base.model.FilterMeta; import net.sf.ehcache.Ehcache; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.text.SimpleDateFormat; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 过滤匹配规划缓存处理。 * <p> * 缓存内存为:bssId/conditionId : List of {@link FilterConfig} * * @author xiaobenhai * Date: 2017/2/20 * Time: 11:33 */ @Service public class FilterCacheService { private static final Logger LOGGER = LoggerFactory.getLogger(FilterCacheService.class); private static final String CACHE_NAME = "filters"; private static final String BSS_CACHE_KEY_PREFIX = "bss-"; private static final String ITEM_CACHE_KEY_PREFIX = "item-"; private static final String CONDITION_CACHE_KEY_PREFIX = "condition-"; @Autowired private FilterMetaService filterMetaService; @Autowired private CacheManager cacheManager; public static ConcurrentHashMap<String,Long> emptyCacheMerge = new ConcurrentHashMap<String,Long>(); @PostConstruct public void initCache() { updateFilterCache(); } public List<FilterConfig> getFilterConfigsFromCache(long belongId, FilterBelongType belongType) { if (FilterBelongType.BSS == belongType) { return getFilterConfigsFromCache(getBssCacheKey(belongId)); } if (FilterBelongType.CONDITION == belongType) { return getFilterConfigsFromCache(getConfigConditionCacheKey(belongId)); } return Collections.emptyList(); } public List<FilterConfig> getFilterConfigsFromDb(long belongId, FilterBelongType belongType) { return transform(filterMetaService.getValidFilterMetas(belongId, belongType)); } private List<FilterConfig> getFilterConfigsFromCache(String key) { Cache filtersCache = getFiltersCache(); if (filtersCache == null) { return Collections.emptyList(); } Cache.ValueWrapper valueWrapper = filtersCache.get(key); if (valueWrapper == null) { //LOGGER.warn("cache value is empty >>> key:{}", key); if(!emptyCacheMerge.containsKey(key)) emptyCacheMerge.put(key, 0L); return Collections.emptyList(); } return (List<FilterConfig>) valueWrapper.get(); } private String getBssCacheKey(long bssId) { return BSS_CACHE_KEY_PREFIX + bssId; } private String getConfigItemCacheKey(long configItemId) { return ITEM_CACHE_KEY_PREFIX + configItemId; } private String getConfigConditionCacheKey(long conditionId) { return CONDITION_CACHE_KEY_PREFIX + conditionId; } public void updateFilterCache() { Cache filtersCache = getFiltersCache(); if (filtersCache == null) { return; } Ehcache ehcache = (Ehcache) filtersCache.getNativeCache(); List<String> keys = ehcache.getKeys(); Map<String, List<FilterConfig>> filterMap = assemble(getAllValidFilterMetasFromDb()); for (String key : keys) { if (!filterMap.containsKey(key)) { filtersCache.evict(key); } } for (Map.Entry entry : filterMap.entrySet()) { filtersCache.put(entry.getKey(), entry.getValue()); } } private Cache getFiltersCache() { Cache filtersCache = cacheManager.getCache(CACHE_NAME); if (filtersCache == null) { LOGGER.warn("getFiltersCache:error >>> cache name:{}", CACHE_NAME); return null; } return filtersCache; } private Map<String, List<FilterConfig>> assemble(List<FilterMeta> metas) { Map<String, List<FilterConfig>> filterMap = Maps.newHashMap(); for (FilterMeta meta : metas) { if ("version".equals(meta.getBasis()) || "osversion".equals(meta.getBasis())) { List<String> boundaryList = BoundaryUtils.splitJson(meta.getBoundary()); List<String> numVersionList = Lists.newLinkedList(); for(String version : boundaryList){ numVersionList.add(String.valueOf(VersionConverter.convert(version))); } meta.setBoundary(JsonUtils.toJson(numVersionList)); //meta.setBoundary(String.valueOf(VersionConverter.convert(meta.getBoundary()))); }else if ("datetime".equals(meta.getBasis())) { List<String> boundaryList = BoundaryUtils.splitJson(meta.getBoundary()); List<String> numDatetimeList = Lists.newLinkedList(); for(String datetime : boundaryList){ Long d = DatetimeConverter(datetime); if(d!=null && d>0){ numDatetimeList.add(String.valueOf(d)); } } meta.setBoundary(JsonUtils.toJson(numDatetimeList)); } long belongId = meta.getBelongId(); if (FilterBelongType.BSS.isMe(meta.getBelongType())) { fill(getBssCacheKey(belongId), filterMap, meta); } // else if (FilterBelongType.ITEM.isMe(meta.getBelongType())) { // fill(getConfigItemCacheKey(belongId), filterMap, meta); // } else if (FilterBelongType.CONDITION.isMe(meta.getBelongType())) { fill(getConfigConditionCacheKey(belongId), filterMap, meta); } } return filterMap; } private List<FilterMeta> getAllValidFilterMetasFromDb() { try { List<FilterMeta> metas = filterMetaService.getAllValidFilterMetas(); if (metas == null) { LOGGER.warn("getAllValidConditionMetas from db:empty"); return Collections.emptyList(); } return metas; } catch (Exception e) { LOGGER.error("getAllValidFilterMetasFromDb error", e); } return Collections.emptyList(); } private void fill(String cacheKey, Map<String, List<FilterConfig>> filterMap, FilterMeta meta) { List<FilterConfig> configs = filterMap.get(cacheKey); if (configs == null) { configs = Lists.newArrayList(); filterMap.put(cacheKey, configs); } configs.add(transform(meta)); } private FilterConfig transform(FilterMeta meta) { if (meta == null) { return null; } return new FilterConfig(meta.getBasis(), meta.getOperator(), meta.getBoundary(), FilterType.valueOf(meta.getBasisType())); } private List<FilterConfig> transform(List<FilterMeta> metas) { if (CollectionUtils.isEmpty(metas)) { return Collections.emptyList(); } return Lists.transform(metas, new Function<FilterMeta, FilterConfig>() { @Override public FilterConfig apply(FilterMeta meta) { return transform(meta); } }); } private Long DatetimeConverter(String datetime) { try{ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sf.parse(datetime).getTime(); }catch(Exception e){ LOGGER.warn("DatetimeConverter error:"+datetime, e); return null; } } }
8,132
0.646332
0.64448
215
36.665115
28.344057
130
false
false
0
0
0
0
0
0
0.739535
false
false
4
3f43abda65775e718930e4b120899a4a2065e4c0
37,709,812,875,748
6caf6479f5785d3bf3db37a8d86708e0b8bca938
/src/com/huadian/tools/Tools.java
8da643aaf855a5a138ba1cdf05f923a1ff313966
[]
no_license
BingBoy/Huadian
https://github.com/BingBoy/Huadian
808592f69ef6249108e44645daa71221fb73b193
9194646cb179c5dbbe812dddee67b54ab01a43ab
refs/heads/master
2020-06-06T15:09:20.070000
2014-09-27T10:34:29
2014-09-27T10:34:29
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huadian.tools; import android.app.Activity; import android.content.Context; import android.content.Intent; /** * 工具类 * @author sunpeng * */ public class Tools { private static Tools instance = null; private Tools(){} /** * 获取实例对象 * @return */ public static Tools getInstance(){ if(null == instance){ instance = new Tools(); } return instance; } /** * 通用跳转 * @param intent * @param context * @param className * @param isClose */ public void goToActivity(Intent intent,Context context , Class<?> className , boolean isClose ){ intent.setClass(context, className); if(isClose){ ((Activity)context).finish(); } } /** * 带动画效果的跳转 * @param intent * @param context * @param className * @param isClose * @param enterAnim * @param exitAnim */ public void goToActivity(Intent intent,Context context , Class<?> className , boolean isClose ,int enterAnim , int exitAnim) { goToActivity(intent ,context , className , isClose); ((Activity)context).overridePendingTransition(enterAnim, exitAnim); } }
UTF-8
Java
1,130
java
Tools.java
Java
[ { "context": "rt android.content.Intent;\n\n\n/**\n * 工具类\n * @author sunpeng\n *\n */\npublic class Tools {\n\t\n\tprivate static To", "end": 151, "score": 0.9980568289756775, "start": 144, "tag": "USERNAME", "value": "sunpeng" } ]
null
[]
package com.huadian.tools; import android.app.Activity; import android.content.Context; import android.content.Intent; /** * 工具类 * @author sunpeng * */ public class Tools { private static Tools instance = null; private Tools(){} /** * 获取实例对象 * @return */ public static Tools getInstance(){ if(null == instance){ instance = new Tools(); } return instance; } /** * 通用跳转 * @param intent * @param context * @param className * @param isClose */ public void goToActivity(Intent intent,Context context , Class<?> className , boolean isClose ){ intent.setClass(context, className); if(isClose){ ((Activity)context).finish(); } } /** * 带动画效果的跳转 * @param intent * @param context * @param className * @param isClose * @param enterAnim * @param exitAnim */ public void goToActivity(Intent intent,Context context , Class<?> className , boolean isClose ,int enterAnim , int exitAnim) { goToActivity(intent ,context , className , isClose); ((Activity)context).overridePendingTransition(enterAnim, exitAnim); } }
1,130
0.668199
0.668199
60
17.133333
22.811157
128
false
false
0
0
0
0
0
0
1.35
false
false
4
a642a688d003004f0352d567b39ab8e1890884b2
39,015,482,930,462
eee407be3e281adb44dc98ccfb09d80c94a2e811
/src/com/company/QLNV.java
8d833eb25f65b7089494c5304969a809e85ceda0
[]
no_license
TongDucChung/CaseStudyModul2
https://github.com/TongDucChung/CaseStudyModul2
9006ed894f29c0cbde50d5a14ebed010940cb099
9b51575b253c3c57e82b904f2daf8d705a5f9f4c
refs/heads/master
2023-06-19T20:15:46.656000
2021-07-09T02:24:07
2021-07-09T02:24:07
384,298,746
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.io.*; import java.util.ArrayList; import java.util.Scanner; public class QLNV { static File file = new File("QLNV.txt"); static ArrayList<NhanVien> list = new ArrayList<>(); static Scanner scanner = new Scanner(System.in); public static void addNhanVien (int choise1) { NhanVien nhanVien; if (choise1 == 1) nhanVien = taoNhanVienFullTime(); else nhanVien = taoNhanVienPartTime(); list.add(nhanVien); } private static NhanVienPartTime taoNhanVienPartTime () { System.out.println("Nhap ten nhan vien Part Time"); String name = scanner.nextLine(); boolean status = getstatus(); int luong = getluong(); System.out.println("Nhập id"); String id = scanner.nextLine(); System.out.println("Nhập vào số giờ"); int soGio = Integer.parseInt(scanner.nextLine()); NhanVienPartTime nhanVienPartTime = new NhanVienPartTime(name, id, status, luong, soGio); return nhanVienPartTime; } private static NhanVienFullTime taoNhanVienFullTime () { System.out.println("Nhap ten nhan vien Full Time"); String name = scanner.nextLine(); boolean status = getstatus(); int luong = getluong(); System.out.println("Nhập id"); String id = scanner.nextLine(); NhanVienFullTime nhanVienFullTime = new NhanVienFullTime(name, id, status, luong); return nhanVienFullTime; } public static void findByName () { System.out.println(" Nhập vào tên cần tìm"); String name1 = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getName().equals(name1)) { index = i; System.out.println(list.get(i)); } } if (index == -1) { System.out.println(" Không có nhân viên này "); } } public static void checkStatusNhanVien () { System.out.println("Nhập vào tên nhân viên muốn check"); String name = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getName().equals(name)) { index = i; System.out.println(list.get(i).isStatus()); } } if (index == -1) { System.out.println(" Không có nhân viên này "); } } public static void editNhanVien () { System.out.println("Nhập vào id nhân viên cần chỉnh sửa"); String id = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getId().equals(id)) { index = i; if (list.get(i) instanceof NhanVienPartTime) { list.set(i, taoNhanVienPartTime()); } else { list.set(i, taoNhanVienFullTime()); } } } if (index == -1) { System.out.println("Không có nhân viên này "); } } public static void show () { for (NhanVien c : list) { System.out.println(c); } } public static boolean getstatus () { while (true) { try { System.out.println("Nhập trạng thái "); System.out.println("1.Đang làm việc "); System.out.println("2.Đang nghỉ "); System.out.print("Nhập lựa chọn của bạn : "); int x = Integer.parseInt(scanner.nextLine()); if (x == 1) { return true; } else if (x == 2) { return false; } else throw new InterruptedException(); } catch (InterruptedException e) { System.out.println("Sai định dạng !!!"); } } } public static int getluong () { while (true) { try { System.out.print("Nhập lương của nhân viên : "); return Integer.parseInt(scanner.nextLine()); } catch (Exception e) { System.out.println("Sai định dạng"); } } } public static void changeStatus () { System.out.println("Nhập vào Id"); String id = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getId() == id) { index = i; if (getstatus() == true) { list.get(i).setStatus(false); System.out.println("Nhân viên có id " + id + "đang nghỉ."); } else { list.get(i).setStatus(true); System.out.println("Nhân viên có id " + id + "đang làm"); } } } } public static ArrayList<NhanVien> docFile () { ArrayList<NhanVien> list2 = new ArrayList<>(); try { if (!file.exists()) { file.createNewFile(); } FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String line = ""; while ((line = bufferedReader.readLine()) != null) { String[] str = line.split(","); if (str.length >= 4) { list2.add(new NhanVien(str[0],str[1],Boolean.parseBoolean(scanner.nextLine()),Integer.parseInt(scanner.nextLine()))); } } bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return list2; } public static void ghiFile (File file) throws IOException { BufferedWriter bufferedWriter = null; try { FileWriter fileWriter = new FileWriter(file, false); bufferedWriter = new BufferedWriter(fileWriter); for (NhanVien a : list) { bufferedWriter.write(a.ghi()); bufferedWriter.newLine(); } } catch (IOException e) { e.printStackTrace(); } finally { bufferedWriter.close(); } } }
UTF-8
Java
6,378
java
QLNV.java
Java
[]
null
[]
package com.company; import java.io.*; import java.util.ArrayList; import java.util.Scanner; public class QLNV { static File file = new File("QLNV.txt"); static ArrayList<NhanVien> list = new ArrayList<>(); static Scanner scanner = new Scanner(System.in); public static void addNhanVien (int choise1) { NhanVien nhanVien; if (choise1 == 1) nhanVien = taoNhanVienFullTime(); else nhanVien = taoNhanVienPartTime(); list.add(nhanVien); } private static NhanVienPartTime taoNhanVienPartTime () { System.out.println("Nhap ten nhan vien Part Time"); String name = scanner.nextLine(); boolean status = getstatus(); int luong = getluong(); System.out.println("Nhập id"); String id = scanner.nextLine(); System.out.println("Nhập vào số giờ"); int soGio = Integer.parseInt(scanner.nextLine()); NhanVienPartTime nhanVienPartTime = new NhanVienPartTime(name, id, status, luong, soGio); return nhanVienPartTime; } private static NhanVienFullTime taoNhanVienFullTime () { System.out.println("Nhap ten nhan vien Full Time"); String name = scanner.nextLine(); boolean status = getstatus(); int luong = getluong(); System.out.println("Nhập id"); String id = scanner.nextLine(); NhanVienFullTime nhanVienFullTime = new NhanVienFullTime(name, id, status, luong); return nhanVienFullTime; } public static void findByName () { System.out.println(" Nhập vào tên cần tìm"); String name1 = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getName().equals(name1)) { index = i; System.out.println(list.get(i)); } } if (index == -1) { System.out.println(" Không có nhân viên này "); } } public static void checkStatusNhanVien () { System.out.println("Nhập vào tên nhân viên muốn check"); String name = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getName().equals(name)) { index = i; System.out.println(list.get(i).isStatus()); } } if (index == -1) { System.out.println(" Không có nhân viên này "); } } public static void editNhanVien () { System.out.println("Nhập vào id nhân viên cần chỉnh sửa"); String id = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getId().equals(id)) { index = i; if (list.get(i) instanceof NhanVienPartTime) { list.set(i, taoNhanVienPartTime()); } else { list.set(i, taoNhanVienFullTime()); } } } if (index == -1) { System.out.println("Không có nhân viên này "); } } public static void show () { for (NhanVien c : list) { System.out.println(c); } } public static boolean getstatus () { while (true) { try { System.out.println("Nhập trạng thái "); System.out.println("1.Đang làm việc "); System.out.println("2.Đang nghỉ "); System.out.print("Nhập lựa chọn của bạn : "); int x = Integer.parseInt(scanner.nextLine()); if (x == 1) { return true; } else if (x == 2) { return false; } else throw new InterruptedException(); } catch (InterruptedException e) { System.out.println("Sai định dạng !!!"); } } } public static int getluong () { while (true) { try { System.out.print("Nhập lương của nhân viên : "); return Integer.parseInt(scanner.nextLine()); } catch (Exception e) { System.out.println("Sai định dạng"); } } } public static void changeStatus () { System.out.println("Nhập vào Id"); String id = scanner.nextLine(); int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i).getId() == id) { index = i; if (getstatus() == true) { list.get(i).setStatus(false); System.out.println("Nhân viên có id " + id + "đang nghỉ."); } else { list.get(i).setStatus(true); System.out.println("Nhân viên có id " + id + "đang làm"); } } } } public static ArrayList<NhanVien> docFile () { ArrayList<NhanVien> list2 = new ArrayList<>(); try { if (!file.exists()) { file.createNewFile(); } FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String line = ""; while ((line = bufferedReader.readLine()) != null) { String[] str = line.split(","); if (str.length >= 4) { list2.add(new NhanVien(str[0],str[1],Boolean.parseBoolean(scanner.nextLine()),Integer.parseInt(scanner.nextLine()))); } } bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return list2; } public static void ghiFile (File file) throws IOException { BufferedWriter bufferedWriter = null; try { FileWriter fileWriter = new FileWriter(file, false); bufferedWriter = new BufferedWriter(fileWriter); for (NhanVien a : list) { bufferedWriter.write(a.ghi()); bufferedWriter.newLine(); } } catch (IOException e) { e.printStackTrace(); } finally { bufferedWriter.close(); } } }
6,378
0.507175
0.503029
194
31.324741
22.899437
137
false
false
0
0
0
0
0
0
0.556701
false
false
4
88f6766a497c11ed2f9a26a8fd5b219ca979cde9
36,790,689,888,531
7cdc8a049391a34b640c4b4c1c9ced5988d9ff32
/src/main/java/org/ganjp/gone/common/service/AbstractService.java
6dbc262260f5aaffb2ceb556945dd4db77879f91
[]
no_license
ganjpxm/GOneSpring
https://github.com/ganjpxm/GOneSpring
4a2dc1fb04e34b82745a0f9322decf4ef7d2313b
7f3441f41cb77f31e3bc54a552c0fb833ef776df
refs/heads/master
2021-01-10T20:20:46.480000
2015-04-18T08:39:36
2015-04-18T08:39:36
29,973,754
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.ganjp.gone.common.service; import java.io.Serializable; import java.util.List; import java.util.Map; import org.ganjp.gone.common.dao.Operations; import org.ganjp.gone.common.model.Page; import org.ganjp.gone.common.model.PropertyFilter; import org.springframework.transaction.annotation.Transactional; @Transactional public abstract class AbstractService<T extends Serializable> implements Operations<T> { @Override public T findOne(final String id) { return getDao().findOne(id); } @Override public List<T> findAll() { return getDao().findAll(); } @Override public void create(final T entity) { getDao().create(entity); } @Override public T update(final T entity) { return getDao().update(entity); } @Override public void delete(final T entity) { getDao().delete(entity); } @Override public void deleteById(final String entityId) { getDao().deleteById(entityId); } /** * <p>get all records and support order</p> * * @param String * @param boolean * @return List<T> */ public List<T> findAllWithOrder(Class<T> entityClass, String orderBy, boolean isAsc) { return getDao().findAllWithOrder(entityClass, orderBy, isAsc); } /** * <p>get match records by fieldName</p> * * @param String * @param Object * @return List<T> */ public List<T> findByField(Class<T> entityClass, final String fieldName, final Object value) { return getDao().findByField(entityClass, fieldName, value); } /** * <p>get match records by fieldName with order</p> * * @param entityClass * @param fieldName * @param value * @param orderBy * @param isAsc * @return List<T> */ public List<T> findByField(Class<T> entityClass, final String fieldName, final Object value, final String orderBy, final boolean isAsc) { return getDao().findByField(entityClass, fieldName, value, orderBy, isAsc); } /** * <p>find By PropertyFilter List</p> * * @param List<PropertyFilter> new PropertyFilter("EQS_loginName", "admin") * @return List<T> */ public List<T> findByPropertyFilterList(Class<T> entityClass, List<PropertyFilter> filters) { return getDao().findByPropertyFilterList(entityClass, filters); } /** * <p>findByPropertyFilterList</p> * * @param entityClass * @param filters * @param orderBy * @param isAsc * @return */ public List<T> findByPropertyFilterList(Class<T> entityClass, List<PropertyFilter> filters, String orderBy, boolean isAsc) { return getDao().findByPropertyFilterList(entityClass, filters, orderBy, isAsc); } //------------ find by hql /** * <p>search unique object by hql</p> * * @param hql eg: from User u where loginName=? and userPassword=? * @param Object... "ganjp","123" * @return X */ public <X> X findUniqueByHql(final String hql, final Object... values) { return getDao().findUniqueByHql(hql, values); } /** * <p>search unique object by hql</p> * * @param hql eg:from AmUser where userName=:userName * @param Map eg:map.put("userName", "ganjp"); * @return X */ public <X> X findUniqueByHql(final String hql, final Map<String, ?> values) { return getDao().findUniqueByHql(hql, values); } /** * <p>search objects by hql</p> * * @param hql eg:from User u where loginName=? and userPassword=? * @param values eg:"ganjp","123" * @return List<X> */ public <X> List<X> findByHql(final String hql, final Object... values) { return getDao().findByHql(hql, values); } /** * <p>search objects by hql</p> * * @param hql eg: from AmUser where userName=:userName * @param values map.put("userName", "ganjp"); * @return */ public <X> List<X> findByHql(final String hql, final Map<String, ?> values) { return getDao().findByHql(hql, values); } /** * <p>search objects by hql and page</p> * * @param pageNo eg:1 * @param pageSize eg:5 * @param hql eg:from AmUser where email like ? * @param Object... eg:"%illume%" * @return Page<T> */ public Page<T> fetchPageByHql(final int pageNo, final int pageSize, final String hql, final Object... values) { return getDao().fetchPageByHql(pageNo, pageSize, hql, values); } /** * <p>search objects by hql and page</p> * * @param Page<T> eg:new Page<AmUser>(5). * @param hql eg:from AmUser where email like ? * @param Object... eg:"%illume%" * @return Page<T> */ public Page<T> fetchPageByHql(final Page<T> page, final String hql, final Object... values) { return getDao().fetchPageByHql(page, hql, values); } /** * <p>execute hql</p> * * @param hql eg:"update User set status='disabled' where id=?" * @param Object... eg:'122222222222323435345443' */ public void batchExecute(final String hql, final Object... values) { getDao().batchExecute(hql, values); } protected abstract Operations<T> getDao(); }
UTF-8
Java
4,916
java
AbstractService.java
Java
[ { "context": "ame=? and userPassword=?\n\t * @param Object... \"ganjp\",\"123\"\n\t * @return X\n\t */\n\tpublic <X> X findUniqu", "end": 2814, "score": 0.4848611652851105, "start": 2812, "tag": "USERNAME", "value": "jp" }, { "context": "=:userName\n\t * @param Map eg:map.put(\"userN...
null
[]
package org.ganjp.gone.common.service; import java.io.Serializable; import java.util.List; import java.util.Map; import org.ganjp.gone.common.dao.Operations; import org.ganjp.gone.common.model.Page; import org.ganjp.gone.common.model.PropertyFilter; import org.springframework.transaction.annotation.Transactional; @Transactional public abstract class AbstractService<T extends Serializable> implements Operations<T> { @Override public T findOne(final String id) { return getDao().findOne(id); } @Override public List<T> findAll() { return getDao().findAll(); } @Override public void create(final T entity) { getDao().create(entity); } @Override public T update(final T entity) { return getDao().update(entity); } @Override public void delete(final T entity) { getDao().delete(entity); } @Override public void deleteById(final String entityId) { getDao().deleteById(entityId); } /** * <p>get all records and support order</p> * * @param String * @param boolean * @return List<T> */ public List<T> findAllWithOrder(Class<T> entityClass, String orderBy, boolean isAsc) { return getDao().findAllWithOrder(entityClass, orderBy, isAsc); } /** * <p>get match records by fieldName</p> * * @param String * @param Object * @return List<T> */ public List<T> findByField(Class<T> entityClass, final String fieldName, final Object value) { return getDao().findByField(entityClass, fieldName, value); } /** * <p>get match records by fieldName with order</p> * * @param entityClass * @param fieldName * @param value * @param orderBy * @param isAsc * @return List<T> */ public List<T> findByField(Class<T> entityClass, final String fieldName, final Object value, final String orderBy, final boolean isAsc) { return getDao().findByField(entityClass, fieldName, value, orderBy, isAsc); } /** * <p>find By PropertyFilter List</p> * * @param List<PropertyFilter> new PropertyFilter("EQS_loginName", "admin") * @return List<T> */ public List<T> findByPropertyFilterList(Class<T> entityClass, List<PropertyFilter> filters) { return getDao().findByPropertyFilterList(entityClass, filters); } /** * <p>findByPropertyFilterList</p> * * @param entityClass * @param filters * @param orderBy * @param isAsc * @return */ public List<T> findByPropertyFilterList(Class<T> entityClass, List<PropertyFilter> filters, String orderBy, boolean isAsc) { return getDao().findByPropertyFilterList(entityClass, filters, orderBy, isAsc); } //------------ find by hql /** * <p>search unique object by hql</p> * * @param hql eg: from User u where loginName=? and userPassword=? * @param Object... "ganjp","123" * @return X */ public <X> X findUniqueByHql(final String hql, final Object... values) { return getDao().findUniqueByHql(hql, values); } /** * <p>search unique object by hql</p> * * @param hql eg:from AmUser where userName=:userName * @param Map eg:map.put("userName", "ganjp"); * @return X */ public <X> X findUniqueByHql(final String hql, final Map<String, ?> values) { return getDao().findUniqueByHql(hql, values); } /** * <p>search objects by hql</p> * * @param hql eg:from User u where loginName=? and userPassword=? * @param values eg:"ganjp","123" * @return List<X> */ public <X> List<X> findByHql(final String hql, final Object... values) { return getDao().findByHql(hql, values); } /** * <p>search objects by hql</p> * * @param hql eg: from AmUser where userName=:userName * @param values map.put("userName", "ganjp"); * @return */ public <X> List<X> findByHql(final String hql, final Map<String, ?> values) { return getDao().findByHql(hql, values); } /** * <p>search objects by hql and page</p> * * @param pageNo eg:1 * @param pageSize eg:5 * @param hql eg:from AmUser where email like ? * @param Object... eg:"%illume%" * @return Page<T> */ public Page<T> fetchPageByHql(final int pageNo, final int pageSize, final String hql, final Object... values) { return getDao().fetchPageByHql(pageNo, pageSize, hql, values); } /** * <p>search objects by hql and page</p> * * @param Page<T> eg:new Page<AmUser>(5). * @param hql eg:from AmUser where email like ? * @param Object... eg:"%illume%" * @return Page<T> */ public Page<T> fetchPageByHql(final Page<T> page, final String hql, final Object... values) { return getDao().fetchPageByHql(page, hql, values); } /** * <p>execute hql</p> * * @param hql eg:"update User set status='disabled' where id=?" * @param Object... eg:'122222222222323435345443' */ public void batchExecute(final String hql, final Object... values) { getDao().batchExecute(hql, values); } protected abstract Operations<T> getDao(); }
4,916
0.662327
0.655614
185
25.572973
27.544878
138
false
false
0
0
0
0
0
0
1.243243
false
false
4
f042554ac7ac8542efa435a1b58a242cf3b0774c
39,333,310,531,069
6339b39b7524b7e98ccc42f157c8670765cca3ff
/src/edu/upenn/cis455/webserver/Controller.java
51c2e153830be1211e8b28ef87362de68d0fefbe
[]
no_license
karanpradhan/Webserver
https://github.com/karanpradhan/Webserver
838fa80d1c04a64c08338b90c040f567dc96db70
3ff8f330adc3c154ed68bbe8a166fb4b8bfc5d27
refs/heads/master
2016-09-03T07:38:28.126000
2015-02-07T22:47:50
2015-02-07T22:47:50
30,472,817
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.upenn.cis455.webserver; /* * Class which has a thread object waiting for the shutdown signal * Has a reference to the thread pool so that it can interrupt the working threads. */ class Controller implements Runnable{ ThreadPool t_pool; //static Boolean shutdown; Thread t; Object shutdown_lock; /* * Contructor for the class which starts the threads * @param ThreadPool The thread pool reference * * @param Object The shutdown lock for synchronization */ Controller(ThreadPool t_pool,Object shutdown_lock) { this.t_pool=t_pool; //shutdown=false; Thread t = new Thread(this,"Controller"); this.shutdown_lock=shutdown_lock; t.start(); } /* * (non-Javadoc) * @see java.lang.Runnable#run() * Run method which takes care of shutting down all the threads. */ public void run() { System.out.println("Controller is waiting"); synchronized(shutdown_lock) { { while(!HttpServer.shutdown){ try { shutdown_lock.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } System.out.println("Controller is up"); for( Worker w : t_pool.getWorkers()) { w.t.interrupt(); } Thread.currentThread().interrupt(); System.out.println("Shutting down the controller"); // notifyAll(); } static void setShutdown() { HttpServer.shutdown=true; } }
UTF-8
Java
1,398
java
Controller.java
Java
[]
null
[]
package edu.upenn.cis455.webserver; /* * Class which has a thread object waiting for the shutdown signal * Has a reference to the thread pool so that it can interrupt the working threads. */ class Controller implements Runnable{ ThreadPool t_pool; //static Boolean shutdown; Thread t; Object shutdown_lock; /* * Contructor for the class which starts the threads * @param ThreadPool The thread pool reference * * @param Object The shutdown lock for synchronization */ Controller(ThreadPool t_pool,Object shutdown_lock) { this.t_pool=t_pool; //shutdown=false; Thread t = new Thread(this,"Controller"); this.shutdown_lock=shutdown_lock; t.start(); } /* * (non-Javadoc) * @see java.lang.Runnable#run() * Run method which takes care of shutting down all the threads. */ public void run() { System.out.println("Controller is waiting"); synchronized(shutdown_lock) { { while(!HttpServer.shutdown){ try { shutdown_lock.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } System.out.println("Controller is up"); for( Worker w : t_pool.getWorkers()) { w.t.interrupt(); } Thread.currentThread().interrupt(); System.out.println("Shutting down the controller"); // notifyAll(); } static void setShutdown() { HttpServer.shutdown=true; } }
1,398
0.680257
0.678112
65
20.507692
20.089127
83
false
false
0
0
0
0
0
0
1.861538
false
false
4
35bb5b70da2fe953ffc619cf7c1ffc84de5b7a30
24,687,472,084,034
db27a288cb19902016cd62c6d00c056662768427
/aula02/exercicios/Exercicio04.java
4b1b1a7f8d5798ae7599b52d633d1fc6dd12da6a
[]
no_license
ARPugles/treinamentogama
https://github.com/ARPugles/treinamentogama
423f9cc9fc56168c27641ac4d6fc651d739f331d
48f99fc4ea7112ec58186b0907fda7d87bcd47ad
refs/heads/master
2023-04-09T13:21:22.656000
2021-04-09T19:01:18
2021-04-09T19:01:18
349,539,466
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exercicios; import java.util.Scanner; public class Exercicio04 { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); double salario, prestacao; System.out.println("Qual o valor do salário bruto?"); salario = entrada.nextDouble(); System.out.println("Qual o valor da prestação?"); prestacao = entrada.nextDouble(); if(prestacao > (salario * 0.3)) { System.out.println("Empréstimo não concedido."); } else { System.out.println("Empréstimo concedido."); } entrada.close(); } }
UTF-8
Java
637
java
Exercicio04.java
Java
[]
null
[]
package exercicios; import java.util.Scanner; public class Exercicio04 { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); double salario, prestacao; System.out.println("Qual o valor do salário bruto?"); salario = entrada.nextDouble(); System.out.println("Qual o valor da prestação?"); prestacao = entrada.nextDouble(); if(prestacao > (salario * 0.3)) { System.out.println("Empréstimo não concedido."); } else { System.out.println("Empréstimo concedido."); } entrada.close(); } }
637
0.602219
0.59588
24
25.291666
21.728397
61
false
false
0
0
0
0
0
0
0.5
false
false
4
aa6d7b874ac0e064aa940da0b92150deb6617292
16,192,026,757,457
5308f6b4d3f71d941e5c9311dd53b4cffa663d28
/car-backend/CorrectionWebServiceJPA-master/CorrectionWebServiceJPA-master/src/main/java/com/univ/repository/CarRepository.java
fcca10b8a5bb48db6ee285e34e42c22e37c1dd86
[]
no_license
LucasEFREI/FinalProject-ISTCC
https://github.com/LucasEFREI/FinalProject-ISTCC
80891f8748d20f34251997c66cefdb1f08042f58
c4ee0d65d937aa94f8940f0d3d7ffef230077be5
refs/heads/main
2023-01-11T20:37:41.151000
2020-11-11T15:30:06
2020-11-11T15:30:06
310,647,944
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.univ.repository; import com.univ.model.Car; import org.springframework.data.repository.CrudRepository; public interface CarRepository extends CrudRepository<Car, Long> { Car findByPlateNumber(String plateNumber); }
UTF-8
Java
233
java
CarRepository.java
Java
[]
null
[]
package com.univ.repository; import com.univ.model.Car; import org.springframework.data.repository.CrudRepository; public interface CarRepository extends CrudRepository<Car, Long> { Car findByPlateNumber(String plateNumber); }
233
0.815451
0.815451
8
28.125
24.922066
66
false
false
0
0
0
0
0
0
0.625
false
false
4
21f1e87b473f1fac6a6ce92a2eaeecb250de61f3
39,556,648,815,878
2da87d8ef7afa718de7efa72e16848799c73029f
/ikep4-lightpack/src/main/java/com/lgcns/ikep4/lightpack/meetingroom/service/EquipmentService.java
47e450210f42faf4380123b9cff712e48d205b8c
[]
no_license
haifeiforwork/ehr-moo
https://github.com/haifeiforwork/ehr-moo
d3ee29e2cae688f343164384958f3560255e52b2
921ff597b316a9a0111ed4db1d5b63b88838d331
refs/heads/master
2020-05-03T02:34:00.078000
2018-04-05T00:54:04
2018-04-05T00:54:04
178,373,434
0
1
null
true
2019-03-29T09:21:01
2019-03-29T09:21:01
2018-04-24T04:14:23
2018-04-05T00:55:08
124,050
0
0
0
null
false
null
/* * Copyright (C) 2011 LG CNS Inc. * All rights reserved. * * 모든 권한은 LG CNS(http://www.lgcns.com)에 있으며, * LG CNS의 허락없이 소스 및 이진형식으로 재배포, 사용하는 행위를 금지합니다. */ package com.lgcns.ikep4.lightpack.meetingroom.service; import java.util.List; import java.util.Map; import com.lgcns.ikep4.framework.core.service.GenericService; import com.lgcns.ikep4.framework.web.SearchResult; import com.lgcns.ikep4.lightpack.meetingroom.model.Equipment; import com.lgcns.ikep4.lightpack.meetingroom.model.MeetingRoomSearchCondition; /** * 기자재 관리 서비스 구현체 * * @author 박철종(cjpark@thebne.com) * @version $Id: MaterialsServiceImpl.java 16243 2011-08-18 04:10:43Z cjpark $ * */ public interface EquipmentService extends GenericService<Equipment, String> { /** * 기자재 조회 * * @param searchCondition 검색 조건 * @return */ public SearchResult<Equipment> list(MeetingRoomSearchCondition searchCondition); /** * 기자재 목록 * * @param portalId 포탈 아이디 * @return */ public List<Equipment> equipmentList(String portalId); /** * 정렬순서(Sort order) 최대값 가져오기 * * @return */ public String getMaxSortOrder(); /** * 해당 기자재의 정렬순서를 목록에서 한단계 위로 올림 * * @param map 이동 조건 * @return */ public void goUp(Map<String, String> map); /** * 해당 기자재의 정렬순서를 목록에서 한단계 아래로 내림 * * @param map 이동 조건 * @return */ public void goDown(Map<String, String> map); }
UTF-8
Java
1,640
java
EquipmentService.java
Java
[ { "context": "chCondition;\n\n/**\n * 기자재 관리 서비스 구현체\n * \n * @author 박철종(cjpark@thebne.com)\n * @version $Id: MaterialsServ", "end": 560, "score": 0.9998931884765625, "start": 557, "tag": "NAME", "value": "박철종" }, { "context": "dition;\n\n/**\n * 기자재 관리 서비스 구현체\n * \n * @author 박철종(...
null
[]
/* * Copyright (C) 2011 LG CNS Inc. * All rights reserved. * * 모든 권한은 LG CNS(http://www.lgcns.com)에 있으며, * LG CNS의 허락없이 소스 및 이진형식으로 재배포, 사용하는 행위를 금지합니다. */ package com.lgcns.ikep4.lightpack.meetingroom.service; import java.util.List; import java.util.Map; import com.lgcns.ikep4.framework.core.service.GenericService; import com.lgcns.ikep4.framework.web.SearchResult; import com.lgcns.ikep4.lightpack.meetingroom.model.Equipment; import com.lgcns.ikep4.lightpack.meetingroom.model.MeetingRoomSearchCondition; /** * 기자재 관리 서비스 구현체 * * @author 박철종(<EMAIL>) * @version $Id: MaterialsServiceImpl.java 16243 2011-08-18 04:10:43Z cjpark $ * */ public interface EquipmentService extends GenericService<Equipment, String> { /** * 기자재 조회 * * @param searchCondition 검색 조건 * @return */ public SearchResult<Equipment> list(MeetingRoomSearchCondition searchCondition); /** * 기자재 목록 * * @param portalId 포탈 아이디 * @return */ public List<Equipment> equipmentList(String portalId); /** * 정렬순서(Sort order) 최대값 가져오기 * * @return */ public String getMaxSortOrder(); /** * 해당 기자재의 정렬순서를 목록에서 한단계 위로 올림 * * @param map 이동 조건 * @return */ public void goUp(Map<String, String> map); /** * 해당 기자재의 정렬순서를 목록에서 한단계 아래로 내림 * * @param map 이동 조건 * @return */ public void goDown(Map<String, String> map); }
1,630
0.690511
0.670073
65
20.092308
23.022213
81
false
false
0
0
0
0
0
0
0.8
false
false
4
90430b5f9e4b4707204b5736af17cb2739113432
35,442,070,173,552
66d3122f8f031d6e8b27e8ead7aa5ae0d7e33b45
/net/minecraft/advancement/criterion/FishingRodHookedCriterion.java
c191fa5360f9b10ab27b65c216b8f534061eacb9
[]
no_license
gurachan/minecraft1.14-dp
https://github.com/gurachan/minecraft1.14-dp
c10059787555028f87a4c8183ff74e6e1cfbf056
34daddc03be27d5a0ee2ab9bc8b1deb050277208
refs/heads/master
2022-01-07T01:43:52.836000
2019-05-08T17:18:13
2019-05-08T17:18:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.minecraft.advancement.criterion; import java.util.List; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import java.util.Set; import com.google.gson.JsonElement; import java.util.Iterator; import net.minecraft.entity.ItemEntity; import java.util.Collection; import net.minecraft.entity.projectile.FishHookEntity; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.predicate.entity.EntityPredicate; import net.minecraft.predicate.item.ItemPredicate; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.common.collect.Maps; import net.minecraft.advancement.PlayerAdvancementTracker; import java.util.Map; import net.minecraft.util.Identifier; public class FishingRodHookedCriterion implements Criterion<Conditions> { private static final Identifier ID; private final Map<PlayerAdvancementTracker, Handler> b; public FishingRodHookedCriterion() { this.b = Maps.newHashMap(); } @Override public Identifier getId() { return FishingRodHookedCriterion.ID; } @Override public void beginTrackingCondition(final PlayerAdvancementTracker manager, final ConditionsContainer<Conditions> conditionsContainer) { Handler handler3 = this.b.get(manager); if (handler3 == null) { handler3 = new Handler(manager); this.b.put(manager, handler3); } handler3.addCondition(conditionsContainer); } @Override public void endTrackingCondition(final PlayerAdvancementTracker manager, final ConditionsContainer<Conditions> conditionsContainer) { final Handler handler3 = this.b.get(manager); if (handler3 != null) { handler3.removeCondition(conditionsContainer); if (handler3.isEmpty()) { this.b.remove(manager); } } } @Override public void endTracking(final PlayerAdvancementTracker playerAdvancementTracker) { this.b.remove(playerAdvancementTracker); } @Override public Conditions conditionsFromJson(final JsonObject obj, final JsonDeserializationContext jsonDeserializationContext) { final ItemPredicate itemPredicate3 = ItemPredicate.deserialize(obj.get("rod")); final EntityPredicate entityPredicate4 = EntityPredicate.deserialize(obj.get("entity")); final ItemPredicate itemPredicate4 = ItemPredicate.deserialize(obj.get("item")); return new Conditions(itemPredicate3, entityPredicate4, itemPredicate4); } public void handle(final ServerPlayerEntity serverPlayerEntity, final ItemStack itemStack, final FishHookEntity fishHookEntity, final Collection<ItemStack> collection) { final Handler handler5 = this.b.get(serverPlayerEntity.getAdvancementManager()); if (handler5 != null) { handler5.handle(serverPlayerEntity, itemStack, fishHookEntity, collection); } } static { ID = new Identifier("fishing_rod_hooked"); } public static class Conditions extends AbstractCriterionConditions { private final ItemPredicate rod; private final EntityPredicate entity; private final ItemPredicate item; public Conditions(final ItemPredicate entity, final EntityPredicate item, final ItemPredicate itemPredicate3) { super(FishingRodHookedCriterion.ID); this.rod = entity; this.entity = item; this.item = itemPredicate3; } public static Conditions create(final ItemPredicate itemPredicate1, final EntityPredicate entityPredicate, final ItemPredicate itemPredicate3) { return new Conditions(itemPredicate1, entityPredicate, itemPredicate3); } public boolean matches(final ServerPlayerEntity serverPlayerEntity, final ItemStack itemStack, final FishHookEntity fishHookEntity, final Collection<ItemStack> collection) { if (!this.rod.test(itemStack)) { return false; } if (!this.entity.test(serverPlayerEntity, fishHookEntity.hookedEntity)) { return false; } if (this.item != ItemPredicate.ANY) { boolean boolean5 = false; if (fishHookEntity.hookedEntity instanceof ItemEntity) { final ItemEntity itemEntity6 = (ItemEntity)fishHookEntity.hookedEntity; if (this.item.test(itemEntity6.getStack())) { boolean5 = true; } } for (final ItemStack itemStack2 : collection) { if (this.item.test(itemStack2)) { boolean5 = true; break; } } if (!boolean5) { return false; } } return true; } @Override public JsonElement toJson() { final JsonObject jsonObject1 = new JsonObject(); jsonObject1.add("rod", this.rod.serialize()); jsonObject1.add("entity", this.entity.serialize()); jsonObject1.add("item", this.item.serialize()); return jsonObject1; } } static class Handler { private final PlayerAdvancementTracker manager; private final Set<ConditionsContainer<Conditions>> conditions; public Handler(final PlayerAdvancementTracker manager) { this.conditions = Sets.newHashSet(); this.manager = manager; } public boolean isEmpty() { return this.conditions.isEmpty(); } public void addCondition(final ConditionsContainer<Conditions> conditionsContainer) { this.conditions.add(conditionsContainer); } public void removeCondition(final ConditionsContainer<Conditions> conditionsContainer) { this.conditions.remove(conditionsContainer); } public void handle(final ServerPlayerEntity serverPlayerEntity, final ItemStack itemStack, final FishHookEntity fishHookEntity, final Collection<ItemStack> collection) { List<ConditionsContainer<Conditions>> list5 = null; for (final ConditionsContainer<Conditions> conditionsContainer7 : this.conditions) { if (conditionsContainer7.getConditions().matches(serverPlayerEntity, itemStack, fishHookEntity, collection)) { if (list5 == null) { list5 = Lists.newArrayList(); } list5.add(conditionsContainer7); } } if (list5 != null) { for (final ConditionsContainer<Conditions> conditionsContainer7 : list5) { conditionsContainer7.apply(this.manager); } } } } }
UTF-8
Java
7,093
java
FishingRodHookedCriterion.java
Java
[]
null
[]
package net.minecraft.advancement.criterion; import java.util.List; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import java.util.Set; import com.google.gson.JsonElement; import java.util.Iterator; import net.minecraft.entity.ItemEntity; import java.util.Collection; import net.minecraft.entity.projectile.FishHookEntity; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.predicate.entity.EntityPredicate; import net.minecraft.predicate.item.ItemPredicate; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.common.collect.Maps; import net.minecraft.advancement.PlayerAdvancementTracker; import java.util.Map; import net.minecraft.util.Identifier; public class FishingRodHookedCriterion implements Criterion<Conditions> { private static final Identifier ID; private final Map<PlayerAdvancementTracker, Handler> b; public FishingRodHookedCriterion() { this.b = Maps.newHashMap(); } @Override public Identifier getId() { return FishingRodHookedCriterion.ID; } @Override public void beginTrackingCondition(final PlayerAdvancementTracker manager, final ConditionsContainer<Conditions> conditionsContainer) { Handler handler3 = this.b.get(manager); if (handler3 == null) { handler3 = new Handler(manager); this.b.put(manager, handler3); } handler3.addCondition(conditionsContainer); } @Override public void endTrackingCondition(final PlayerAdvancementTracker manager, final ConditionsContainer<Conditions> conditionsContainer) { final Handler handler3 = this.b.get(manager); if (handler3 != null) { handler3.removeCondition(conditionsContainer); if (handler3.isEmpty()) { this.b.remove(manager); } } } @Override public void endTracking(final PlayerAdvancementTracker playerAdvancementTracker) { this.b.remove(playerAdvancementTracker); } @Override public Conditions conditionsFromJson(final JsonObject obj, final JsonDeserializationContext jsonDeserializationContext) { final ItemPredicate itemPredicate3 = ItemPredicate.deserialize(obj.get("rod")); final EntityPredicate entityPredicate4 = EntityPredicate.deserialize(obj.get("entity")); final ItemPredicate itemPredicate4 = ItemPredicate.deserialize(obj.get("item")); return new Conditions(itemPredicate3, entityPredicate4, itemPredicate4); } public void handle(final ServerPlayerEntity serverPlayerEntity, final ItemStack itemStack, final FishHookEntity fishHookEntity, final Collection<ItemStack> collection) { final Handler handler5 = this.b.get(serverPlayerEntity.getAdvancementManager()); if (handler5 != null) { handler5.handle(serverPlayerEntity, itemStack, fishHookEntity, collection); } } static { ID = new Identifier("fishing_rod_hooked"); } public static class Conditions extends AbstractCriterionConditions { private final ItemPredicate rod; private final EntityPredicate entity; private final ItemPredicate item; public Conditions(final ItemPredicate entity, final EntityPredicate item, final ItemPredicate itemPredicate3) { super(FishingRodHookedCriterion.ID); this.rod = entity; this.entity = item; this.item = itemPredicate3; } public static Conditions create(final ItemPredicate itemPredicate1, final EntityPredicate entityPredicate, final ItemPredicate itemPredicate3) { return new Conditions(itemPredicate1, entityPredicate, itemPredicate3); } public boolean matches(final ServerPlayerEntity serverPlayerEntity, final ItemStack itemStack, final FishHookEntity fishHookEntity, final Collection<ItemStack> collection) { if (!this.rod.test(itemStack)) { return false; } if (!this.entity.test(serverPlayerEntity, fishHookEntity.hookedEntity)) { return false; } if (this.item != ItemPredicate.ANY) { boolean boolean5 = false; if (fishHookEntity.hookedEntity instanceof ItemEntity) { final ItemEntity itemEntity6 = (ItemEntity)fishHookEntity.hookedEntity; if (this.item.test(itemEntity6.getStack())) { boolean5 = true; } } for (final ItemStack itemStack2 : collection) { if (this.item.test(itemStack2)) { boolean5 = true; break; } } if (!boolean5) { return false; } } return true; } @Override public JsonElement toJson() { final JsonObject jsonObject1 = new JsonObject(); jsonObject1.add("rod", this.rod.serialize()); jsonObject1.add("entity", this.entity.serialize()); jsonObject1.add("item", this.item.serialize()); return jsonObject1; } } static class Handler { private final PlayerAdvancementTracker manager; private final Set<ConditionsContainer<Conditions>> conditions; public Handler(final PlayerAdvancementTracker manager) { this.conditions = Sets.newHashSet(); this.manager = manager; } public boolean isEmpty() { return this.conditions.isEmpty(); } public void addCondition(final ConditionsContainer<Conditions> conditionsContainer) { this.conditions.add(conditionsContainer); } public void removeCondition(final ConditionsContainer<Conditions> conditionsContainer) { this.conditions.remove(conditionsContainer); } public void handle(final ServerPlayerEntity serverPlayerEntity, final ItemStack itemStack, final FishHookEntity fishHookEntity, final Collection<ItemStack> collection) { List<ConditionsContainer<Conditions>> list5 = null; for (final ConditionsContainer<Conditions> conditionsContainer7 : this.conditions) { if (conditionsContainer7.getConditions().matches(serverPlayerEntity, itemStack, fishHookEntity, collection)) { if (list5 == null) { list5 = Lists.newArrayList(); } list5.add(conditionsContainer7); } } if (list5 != null) { for (final ConditionsContainer<Conditions> conditionsContainer7 : list5) { conditionsContainer7.apply(this.manager); } } } } }
7,093
0.642887
0.63612
176
39.301136
35.80035
181
false
false
0
0
0
0
0
0
0.590909
false
false
4
7b5987846c0729c1077c12918949c348296ac657
39,616,778,354,808
ab37843135084eac85c46ee66e22403c6d7042a8
/tv-remoter/src/main/java/com/baofeng/fengmi/remoter/RemoteControlActivity.java
2785df74040f56745250c6da140c299c6609d1d1
[ "Apache-2.0" ]
permissive
battleground/joker
https://github.com/battleground/joker
471268594382c1ed73556860e5f0e34ebbe63464
c366ba17a13be43a6caedf7eb4c3fe8757ab1ecc
refs/heads/master
2020-06-13T13:22:08.120000
2017-06-09T11:59:01
2017-06-09T11:59:01
75,373,816
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.baofeng.fengmi.remoter; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import com.abooc.airremoter.Sender; import com.abooc.joker.dialog.ScannerSamples; import com.abooc.joker.dialog.ScanningDialog; import com.abooc.upnp.DlnaManager; import com.abooc.upnp.extra.Filter; import com.abooc.upnp.model.DeviceDisplay; import org.fourthline.cling.model.meta.Device; /** * 遥控器 */ public class RemoteControlActivity extends AppCompatActivity implements ScanningDialog.OnSelectedDeviceListener { public static void launch(Context context) { Intent intent = new Intent(context, RemoteControlActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); } private TextView mTitleText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tv_control); attachActionBar(); attachRemoter("127.0.0.1"); } private void attachActionBar() { mTitleText = (TextView) findViewById(R.id.Title); } @Override public void onResume() { super.onResume(); } public void onBackEvent(View view) { super.onBackPressed(); } public void onShowDevicesEvent(View view) { ScannerSamples.onSelectedDeviceListener = this; ScannerSamples.title = "选择要连接的设备"; ScannerSamples.error = "未找到可用设备"; ScannerSamples.show(this, iBaoFengTVFilter); } private Filter iBaoFengTVFilter = new Filter() { @Override public boolean check(Device device) { return true; // return BaofengSupport.isBaofengTV(device); } }; @Override public void onSelectedDevice(DeviceDisplay deviceDisplay) { beRemoter(deviceDisplay); } private void beRemoter(DeviceDisplay display) { DlnaManager.getInstance().unbound(); DlnaManager.getInstance().bind(display.getOriginDevice(), null); display.setChecked(true); String host = display.getHost(); attachRemoter(host); } private void attachRemoter(String host) { Sender sender = SenderImpl.buildSender(host); KeyboardRemoter remoter = new KeyboardRemoter(sender); Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_tv_control); RemoteControlFragment control = (RemoteControlFragment) fragment; control.setRemoter(remoter); } public void onSwitchEvent(View view) { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_tv_control); RemoteControlFragment control = (RemoteControlFragment) fragment; control.doKeyboardSwitch(); } }
UTF-8
Java
3,001
java
RemoteControlActivity.java
Java
[ { "context": " attachActionBar();\n\n attachRemoter(\"127.0.0.1\");\n\n }\n\n private void attachActionBar() {\n ", "end": 1184, "score": 0.9992100596427917, "start": 1175, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package com.baofeng.fengmi.remoter; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import com.abooc.airremoter.Sender; import com.abooc.joker.dialog.ScannerSamples; import com.abooc.joker.dialog.ScanningDialog; import com.abooc.upnp.DlnaManager; import com.abooc.upnp.extra.Filter; import com.abooc.upnp.model.DeviceDisplay; import org.fourthline.cling.model.meta.Device; /** * 遥控器 */ public class RemoteControlActivity extends AppCompatActivity implements ScanningDialog.OnSelectedDeviceListener { public static void launch(Context context) { Intent intent = new Intent(context, RemoteControlActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); } private TextView mTitleText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tv_control); attachActionBar(); attachRemoter("127.0.0.1"); } private void attachActionBar() { mTitleText = (TextView) findViewById(R.id.Title); } @Override public void onResume() { super.onResume(); } public void onBackEvent(View view) { super.onBackPressed(); } public void onShowDevicesEvent(View view) { ScannerSamples.onSelectedDeviceListener = this; ScannerSamples.title = "选择要连接的设备"; ScannerSamples.error = "未找到可用设备"; ScannerSamples.show(this, iBaoFengTVFilter); } private Filter iBaoFengTVFilter = new Filter() { @Override public boolean check(Device device) { return true; // return BaofengSupport.isBaofengTV(device); } }; @Override public void onSelectedDevice(DeviceDisplay deviceDisplay) { beRemoter(deviceDisplay); } private void beRemoter(DeviceDisplay display) { DlnaManager.getInstance().unbound(); DlnaManager.getInstance().bind(display.getOriginDevice(), null); display.setChecked(true); String host = display.getHost(); attachRemoter(host); } private void attachRemoter(String host) { Sender sender = SenderImpl.buildSender(host); KeyboardRemoter remoter = new KeyboardRemoter(sender); Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_tv_control); RemoteControlFragment control = (RemoteControlFragment) fragment; control.setRemoter(remoter); } public void onSwitchEvent(View view) { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_tv_control); RemoteControlFragment control = (RemoteControlFragment) fragment; control.doKeyboardSwitch(); } }
3,001
0.702192
0.699494
101
28.356436
25.585649
113
false
false
0
0
0
0
0
0
0.49505
false
false
4
e136fd3517927d3dc96f7c1042c8afa1a611353d
3,238,405,350,411
9e826f50c6eb2c14ab40f1948ff3c2fa9858fe49
/app/src/main/java/com/lulu/todayinhistory/mvp/contract/DetialMessageContract.java
8cb6696e52666fb3b974de7e4139cb3ee9839e39
[]
no_license
fengyalu/TodayInHisTory
https://github.com/fengyalu/TodayInHisTory
81e3ab8b3953e02b8f858856d83b3a88525ddc55
5acd9aed93b07f6d3ca4724e16fb772c2ff19021
refs/heads/master
2020-04-10T20:42:32.397000
2018-12-26T09:19:34
2018-12-26T09:19:34
161,276,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lulu.todayinhistory.mvp.contract; import com.lulu.todayinhistory.base.BaseModel; import com.lulu.todayinhistory.base.BasePresenter; import com.lulu.todayinhistory.base.BaseView; import com.lulu.todayinhistory.bean.DetialMessageInfo; import com.lulu.todayinhistory.exception.ExceptionHandle; import rx.Observable; /** * Created by fyl on 2018/11/29 0029. */ public interface DetialMessageContract { interface View extends BaseView { void onSucceed(DetialMessageInfo.ResultBeanX result); void onFail(ExceptionHandle.ResponeThrowable e); } interface Model extends BaseModel { Observable<DetialMessageInfo> detialMessage(String titleid,String appkey); } abstract class Presenter extends BasePresenter<View,Model> { public abstract void detialMessage(String titleid); } }
UTF-8
Java
844
java
DetialMessageContract.java
Java
[ { "context": "nHandle;\n\nimport rx.Observable;\n\n/**\n * Created by fyl on 2018/11/29 0029.\n */\n\npublic interface DetialM", "end": 349, "score": 0.9994994401931763, "start": 346, "tag": "USERNAME", "value": "fyl" } ]
null
[]
package com.lulu.todayinhistory.mvp.contract; import com.lulu.todayinhistory.base.BaseModel; import com.lulu.todayinhistory.base.BasePresenter; import com.lulu.todayinhistory.base.BaseView; import com.lulu.todayinhistory.bean.DetialMessageInfo; import com.lulu.todayinhistory.exception.ExceptionHandle; import rx.Observable; /** * Created by fyl on 2018/11/29 0029. */ public interface DetialMessageContract { interface View extends BaseView { void onSucceed(DetialMessageInfo.ResultBeanX result); void onFail(ExceptionHandle.ResponeThrowable e); } interface Model extends BaseModel { Observable<DetialMessageInfo> detialMessage(String titleid,String appkey); } abstract class Presenter extends BasePresenter<View,Model> { public abstract void detialMessage(String titleid); } }
844
0.767772
0.753555
29
28.103449
25.916769
82
false
false
0
0
0
0
0
0
0.448276
false
false
4
2365471e382b99849aa9964bfc1fa5f137beee19
13,735,305,452,343
c24b975f4aa23eba5ca75a2703369fe5351c1a56
/provisioning/provisioning-api/src/main/java/com/evolveum/midpoint/provisioning/api/ItemComparisonResult.java
63bfa8505875e956817b7b442f89f102a5220b5f
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "EPL-1.0", "CDDL-1.0", "MIT", "GPL-1.0-or-later", "MPL-2.0", "LicenseRef-scancode-proprietary-license", "EUPL-1.2" ]
permissive
bshp/midpoint
https://github.com/bshp/midpoint
8dc765af70f10213984a101c91377269e115e9bd
4ac56e84d6087d7d19c73315a5d28576711b3be6
refs/heads/master
2023-03-06T06:25:39.380000
2023-03-02T18:29:56
2023-03-02T18:29:56
105,560,061
0
0
Apache-2.0
true
2019-11-02T22:39:56
2017-10-02T16:54:14
2018-06-08T14:56:47
2019-11-02T22:39:56
122,128
0
0
0
Java
false
false
/* * Copyright (c) 2010-2018 Evolveum and contributors * * This work is dual-licensed under the Apache License 2.0 * and European Union Public License. See LICENSE file for details. */ package com.evolveum.midpoint.provisioning.api; /** * @author semancik * */ public enum ItemComparisonResult { /** * Value matches. Stored value is different. */ MATCH, /** * Value mismatch. Stored value is the same. */ MISMATCH, /** * Cannot compare. Comparison is not applicable. */ NOT_APPLICABLE }
UTF-8
Java
554
java
ItemComparisonResult.java
Java
[ { "context": "volveum.midpoint.provisioning.api;\n\n/**\n * @author semancik\n *\n */\npublic enum ItemComparisonResult {\n\n /*", "end": 262, "score": 0.9946846961975098, "start": 254, "tag": "USERNAME", "value": "semancik" } ]
null
[]
/* * Copyright (c) 2010-2018 Evolveum and contributors * * This work is dual-licensed under the Apache License 2.0 * and European Union Public License. See LICENSE file for details. */ package com.evolveum.midpoint.provisioning.api; /** * @author semancik * */ public enum ItemComparisonResult { /** * Value matches. Stored value is different. */ MATCH, /** * Value mismatch. Stored value is the same. */ MISMATCH, /** * Cannot compare. Comparison is not applicable. */ NOT_APPLICABLE }
554
0.640794
0.622744
30
17.466667
21.110397
67
false
false
0
0
0
0
0
0
0.1
false
false
4
144a952b21c33b79b7ec5563cb4d6f3ff259807e
8,907,762,243,344
74ec9493eb5158af91c9e5c26452396e4ff34010
/src/main/java/com/project/trabab/CommentController.java
cd7859e566561849e5503b124eb72a60df47ede8
[]
no_license
everoad/trabab
https://github.com/everoad/trabab
871720af49e1e98f7087d6406a28ad11687185f8
2cddf1df42dd5b891dd2667359fe970206b66958
refs/heads/master
2021-01-12T12:21:31.338000
2016-10-31T16:34:24
2016-10-31T16:34:24
72,455,946
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.project.trabab; import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.project.trabab.service.CommentService; import com.project.trabab.vo.CommentVO; @Controller("*.comment") public class CommentController { @Autowired private CommentService commentService; @RequestMapping("list_view.comment") public @ResponseBody List<HashMap<String, String>> getCommentList(CommentVO commentVo) { return commentService.getCommentList(commentVo); } @RequestMapping("writeOk.comment") public @ResponseBody HashMap<String, String> writeCommentOk(CommentVO commentVo, HttpSession session) { commentVo.setMember_no((String) session.getAttribute("member_no")); return commentService.writeCommentOk(commentVo); } @RequestMapping("deleteOk.comment") public @ResponseBody HashMap<String, String> deleteCommentOk(CommentVO commentVo) { return commentService.deleteCommentOk(commentVo); } }
UTF-8
Java
1,193
java
CommentController.java
Java
[]
null
[]
package com.project.trabab; import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.project.trabab.service.CommentService; import com.project.trabab.vo.CommentVO; @Controller("*.comment") public class CommentController { @Autowired private CommentService commentService; @RequestMapping("list_view.comment") public @ResponseBody List<HashMap<String, String>> getCommentList(CommentVO commentVo) { return commentService.getCommentList(commentVo); } @RequestMapping("writeOk.comment") public @ResponseBody HashMap<String, String> writeCommentOk(CommentVO commentVo, HttpSession session) { commentVo.setMember_no((String) session.getAttribute("member_no")); return commentService.writeCommentOk(commentVo); } @RequestMapping("deleteOk.comment") public @ResponseBody HashMap<String, String> deleteCommentOk(CommentVO commentVo) { return commentService.deleteCommentOk(commentVo); } }
1,193
0.809723
0.809723
38
30.394737
28.64992
104
false
false
0
0
0
0
0
0
1.105263
false
false
4
8551e90fc202c89b81ff2b142d1fc994bfc22883
8,778,913,171,315
17f190f6df39cea23f08706ed0e36c31339b2463
/src/main/java/com/project/spring/model/DisAnsStatus.java
0d3f7f73611fe2aa4bc586d673bdeb5ecb1d1439
[ "MIT" ]
permissive
sushant097/MultiLearningPlatform
https://github.com/sushant097/MultiLearningPlatform
6be8eef41c2075e8ffde228a3df1925844bea3eb
09556bcd318f6f5af48374d9e5f88d8fe5c2b408
refs/heads/master
2022-12-21T05:12:33.445000
2019-12-26T12:08:59
2019-12-26T12:08:59
150,434,273
4
0
MIT
false
2022-12-16T04:24:30
2018-09-26T13:50:24
2019-12-26T12:09:02
2022-12-16T04:24:27
3,773
1
0
11
JavaScript
false
false
package com.project.spring.model; public class DisAnsStatus { private int disAnsStatusId; private String email; private String category; // discussion or discussionAnswer public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } private int status; public int getDisAnsStatusId() { return disAnsStatusId; } public void setDisAnsStatusId(int disAnsStatusId) { this.disAnsStatusId = disAnsStatusId; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } }
UTF-8
Java
720
java
DisAnsStatus.java
Java
[]
null
[]
package com.project.spring.model; public class DisAnsStatus { private int disAnsStatusId; private String email; private String category; // discussion or discussionAnswer public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } private int status; public int getDisAnsStatusId() { return disAnsStatusId; } public void setDisAnsStatusId(int disAnsStatusId) { this.disAnsStatusId = disAnsStatusId; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } }
720
0.722222
0.722222
45
15
16.357126
59
false
false
0
0
0
0
0
0
1.155556
false
false
4
462d9966864f9d5116975ee98dbbb1adcf35d494
8,778,913,170,209
3a322a8a276986f9a9a592cf47ad7b0d8339fc52
/src/com/petredy/redmagic/client/render/RenderMesh.java
01eb9e8d649bdbd0b66abfd17e755dd88776be8d
[]
no_license
petredy/redmagic
https://github.com/petredy/redmagic
69bfd60dfce5dd65de377e2e48ce854151557cc4
7f271b5e5afb3c71c7181fedaed2b47015e9451d
refs/heads/master
2020-05-05T04:23:06.673000
2014-09-19T16:55:13
2014-09-19T16:55:13
24,116,588
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.petredy.redmagic.client.render; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL15; import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL30; import com.petredy.redmagic.client.opengl.Mesh; import com.petredy.redmagic.client.opengl.Shader; public class RenderMesh { private Mesh mesh; public RenderMesh(Mesh mesh){ this.mesh = mesh; } public void begin(Shader shader){ GL20.glUniformMatrix4(shader.getModelId(), false, mesh.getBuffer()); GL30.glBindVertexArray(mesh.getObjectId()); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, mesh.getIndexId()); } public void render(){ GL11.glDrawElements(GL11.GL_TRIANGLES, mesh.getIndexLength(), GL11.GL_UNSIGNED_BYTE, 0); } public void end(){ GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); } }
UTF-8
Java
989
java
RenderMesh.java
Java
[]
null
[]
package com.petredy.redmagic.client.render; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL15; import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL30; import com.petredy.redmagic.client.opengl.Mesh; import com.petredy.redmagic.client.opengl.Shader; public class RenderMesh { private Mesh mesh; public RenderMesh(Mesh mesh){ this.mesh = mesh; } public void begin(Shader shader){ GL20.glUniformMatrix4(shader.getModelId(), false, mesh.getBuffer()); GL30.glBindVertexArray(mesh.getObjectId()); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, mesh.getIndexId()); } public void render(){ GL11.glDrawElements(GL11.GL_TRIANGLES, mesh.getIndexLength(), GL11.GL_UNSIGNED_BYTE, 0); } public void end(){ GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); } }
989
0.750253
0.705763
43
22
22.62125
90
false
false
0
0
0
0
0
0
1.627907
false
false
4
44295e0ad2b6443067ca82217cc65c3c6acbd230
20,435,454,418,807
3f366e27a590d55a94e2c231484da0b3e4902577
/core/src/ethanjones/cubes/core/util/Lock.java
da72c76c404277bad2b7704e06d8fbf451356453
[ "MIT" ]
permissive
amineprog/Cubes
https://github.com/amineprog/Cubes
1d6e3440d9dee7b0ab51cd2e87d783a941df9376
da101d8c732b2b818f1f4ed176e54ba57efc2380
refs/heads/master
2020-04-19T12:24:30.842000
2019-01-29T01:29:26
2019-01-29T01:29:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ethanjones.cubes.core.util; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; public class Lock { private static final ReentrantLock multiLock = new ReentrantLock(true); private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private ReentrantReadWriteLock.ReadLock read = lock.readLock(); private ReentrantReadWriteLock.WriteLock write = lock.writeLock(); public Lock readLock() { read.lock(); return this; } public Lock writeLock() { write.lock(); return this; } public Lock readUnlock() { read.unlock(); return this; } public Lock writeUnlock() { write.unlock(); return this; } public <T> T readUnlock(T t) { read.unlock(); return t; } public <T> T writeUnlock(T t) { write.unlock(); return t; } public boolean ownedByCurrentThread() { return lock.isWriteLockedByCurrentThread(); } public boolean readLocked() { return lock.getReadLockCount() > 0; } public static boolean tryToLock(boolean write, HasLock lock) { java.util.concurrent.locks.Lock l = write ? lock.getLock().write : lock.getLock().read; return l.tryLock(); } public static void waitToLock(boolean write, HasLock lock) { java.util.concurrent.locks.Lock l = write ? lock.getLock().write : lock.getLock().read; while (true) { if (l.tryLock()) return; Thread.yield(); } } public static void waitToLockAll(boolean write, HasLock... locks) { while (true) { if (lockAll(write, locks)) return; Thread.yield(); } } public static boolean lockAll(boolean write, HasLock... locks) { multiLock.lock(); int i = 0; boolean fail = false; for (; i < locks.length; i++) { if (locks[i] == null) continue; Lock l = locks[i].getLock(); boolean b; if (write) b = l.write.tryLock(); else b = l.read.tryLock(); if (!b) { fail = true; break; } } if (fail) { for (int j = 0; j < i; j++) { if (locks[j] == null) continue; Lock l = locks[j].getLock(); if (write) l.write.unlock(); else l.read.unlock(); } } multiLock.unlock(); return !fail; } public static interface HasLock { public Lock getLock(); } }
UTF-8
Java
2,356
java
Lock.java
Java
[]
null
[]
package ethanjones.cubes.core.util; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; public class Lock { private static final ReentrantLock multiLock = new ReentrantLock(true); private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private ReentrantReadWriteLock.ReadLock read = lock.readLock(); private ReentrantReadWriteLock.WriteLock write = lock.writeLock(); public Lock readLock() { read.lock(); return this; } public Lock writeLock() { write.lock(); return this; } public Lock readUnlock() { read.unlock(); return this; } public Lock writeUnlock() { write.unlock(); return this; } public <T> T readUnlock(T t) { read.unlock(); return t; } public <T> T writeUnlock(T t) { write.unlock(); return t; } public boolean ownedByCurrentThread() { return lock.isWriteLockedByCurrentThread(); } public boolean readLocked() { return lock.getReadLockCount() > 0; } public static boolean tryToLock(boolean write, HasLock lock) { java.util.concurrent.locks.Lock l = write ? lock.getLock().write : lock.getLock().read; return l.tryLock(); } public static void waitToLock(boolean write, HasLock lock) { java.util.concurrent.locks.Lock l = write ? lock.getLock().write : lock.getLock().read; while (true) { if (l.tryLock()) return; Thread.yield(); } } public static void waitToLockAll(boolean write, HasLock... locks) { while (true) { if (lockAll(write, locks)) return; Thread.yield(); } } public static boolean lockAll(boolean write, HasLock... locks) { multiLock.lock(); int i = 0; boolean fail = false; for (; i < locks.length; i++) { if (locks[i] == null) continue; Lock l = locks[i].getLock(); boolean b; if (write) b = l.write.tryLock(); else b = l.read.tryLock(); if (!b) { fail = true; break; } } if (fail) { for (int j = 0; j < i; j++) { if (locks[j] == null) continue; Lock l = locks[j].getLock(); if (write) l.write.unlock(); else l.read.unlock(); } } multiLock.unlock(); return !fail; } public static interface HasLock { public Lock getLock(); } }
2,356
0.616723
0.61545
105
21.438095
21.575085
91
false
false
0
0
0
0
0
0
0.514286
false
false
4
0aad71c28e21aa3d78c0015e244e810b42b81030
12,206,297,059,161
cd803fd8026ab09da1e14f8c3935906470073e32
/src/com/net/toooen/api/request/news/NewsSelectNumRequest.java
9a494b82e8a7f44f9bb6fc1fbd4a0b475be67cc0
[]
no_license
wsfPeter/phoneSys_interface
https://github.com/wsfPeter/phoneSys_interface
001fa8ad8019bcd529d2f0d83a28eef6617a4322
495bebdbf2db222b0f6d039fba5db4082902ddc2
refs/heads/master
2021-01-10T02:20:23.464000
2016-04-07T04:38:41
2016-04-07T04:38:41
55,663,759
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.net.toooen.api.request.news; import javax.validation.constraints.NotNull; import com.net.toooen.api.request.Request; /** * @ClassName: NewsSelectNumRequest * @Description: 新闻查看次数请求参数 * @author wangshaofeng * @date 2016年3月20日 下午4:17:37 */ public class NewsSelectNumRequest extends Request { private static final long serialVersionUID = 7586245769047041158L; /** * @Fields newsId : 新闻ID */ private Integer newsId; /** * @Fields userId : 用户Id */ private Integer userId; @NotNull public Integer getNewsId() { return newsId; } public void setNewsId(Integer newsId) { this.newsId = newsId; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } }
UTF-8
Java
838
java
NewsSelectNumRequest.java
Java
[ { "context": "umRequest\r\n * @Description: 新闻查看次数请求参数\r\n * @author wangshaofeng\r\n * @date 2016年3月20日 下午4:17:37\r\n */\r\npublic class", "end": 232, "score": 0.9978254437446594, "start": 220, "tag": "USERNAME", "value": "wangshaofeng" } ]
null
[]
package com.net.toooen.api.request.news; import javax.validation.constraints.NotNull; import com.net.toooen.api.request.Request; /** * @ClassName: NewsSelectNumRequest * @Description: 新闻查看次数请求参数 * @author wangshaofeng * @date 2016年3月20日 下午4:17:37 */ public class NewsSelectNumRequest extends Request { private static final long serialVersionUID = 7586245769047041158L; /** * @Fields newsId : 新闻ID */ private Integer newsId; /** * @Fields userId : 用户Id */ private Integer userId; @NotNull public Integer getNewsId() { return newsId; } public void setNewsId(Integer newsId) { this.newsId = newsId; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } }
838
0.6775
0.63875
44
16.181818
17.337915
67
false
false
0
0
0
0
0
0
0.818182
false
false
4
9c95c760a0f2b901d1e42da8e1010698f6fcaaa5
4,810,363,441,120
a8e074031d286a16e68cd7a0e97cf60c769d3481
/zombies/src/main/java/me/selslack/codingame/zombies/server/SimpleGameTask.java
0f4bac93ec61fb376a69a6a470a19eb5b73352af
[]
no_license
selslack/codingame
https://github.com/selslack/codingame
a4ccbdcb2cbf67bf420e4e2bc08dc89efbe92c0d
813ef22c3ca0fa183273155a70d8e65f37ece140
refs/heads/master
2021-01-19T03:20:23.996000
2018-08-11T20:39:19
2018-08-11T20:39:19
36,057,302
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.selslack.codingame.zombies.server; import me.selslack.codingame.zombies.Game; import me.selslack.codingame.zombies.GameState; import me.selslack.codingame.zombies.Player; import me.selslack.codingame.zombies.mcts.Config; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.RecursiveTask; public class SimpleGameTask extends RecursiveTask<Integer> { final private GameState state; final private Config config; public SimpleGameTask(GameState start, Config config) { this.config = config; this.state = start.clone(); } @Override protected Integer compute() { Player player = new Player(state.clone(), new InternalCommunicator(), config); while (!state.isTerminal()) { Game.process(state, ForkJoinTask.adapt(player::process).fork().join()); } return state.score; } }
UTF-8
Java
887
java
SimpleGameTask.java
Java
[]
null
[]
package me.selslack.codingame.zombies.server; import me.selslack.codingame.zombies.Game; import me.selslack.codingame.zombies.GameState; import me.selslack.codingame.zombies.Player; import me.selslack.codingame.zombies.mcts.Config; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.RecursiveTask; public class SimpleGameTask extends RecursiveTask<Integer> { final private GameState state; final private Config config; public SimpleGameTask(GameState start, Config config) { this.config = config; this.state = start.clone(); } @Override protected Integer compute() { Player player = new Player(state.clone(), new InternalCommunicator(), config); while (!state.isTerminal()) { Game.process(state, ForkJoinTask.adapt(player::process).fork().join()); } return state.score; } }
887
0.713641
0.713641
30
28.6
24.725965
86
false
false
0
0
0
0
0
0
0.6
false
false
4
f3bfdd7d709637fb61cc6ceb8da8d73ff079caf7
7,438,883,398,693
891f139788df477982e93780b4341eda822a6118
/processing/DCFProcessor.java
2cf070541baa7d9f20b088554e4cc6dd15873d3d
[]
no_license
vishalhawa/FirmFinancials
https://github.com/vishalhawa/FirmFinancials
2e8c2d3aedfde3219398037fdb3a202ed3bddbd6
0f3331b2e13320dce9b5a7f684b39dbd96004889
refs/heads/master
2021-01-01T18:17:17.785000
2015-07-31T18:27:05
2015-07-31T18:27:05
40,018,270
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package processing; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; import dao.PortfolioDAO; public class DCFProcessor { PortfolioDAO dao = new PortfolioDAO(); double USInflation = 0; double USGDP = 0; double USTBond = 0; double USMarketReturn = 0; public DCFProcessor(){ HashMap<String,Double> indexMap = new HashMap<String,Double>(); dao.getSetUSIndices(true,indexMap); USGDP = indexMap.get("USGDP"); USInflation = indexMap.get("USInflation"); USTBond = indexMap.get("^TYX"); USMarketReturn = indexMap.get("MarketReturn"); } public void calculateUSDCF (){ HashMap<String,Double> indexMap = new HashMap<String,Double>(); dao.getSetUSIndices(true,indexMap); LinkedHashMap<String,Properties> scrips = dao.getNYSEticker(); LinkedHashMap<String,Properties> dcfList = new LinkedHashMap<String,Properties>(); double costOfEquity = 0; double growthRate = 0; double marketPremium = 0; double DCFPrice = 0; int counter =0; for (String stk:scrips.keySet()){ System.out.println("NYSE Set "+(scrips.size()-(counter++))+" "+scrips.get(stk).get("Beta") ); if(!stk.startsWith("MF-")){ try{ double PEForward = Double.valueOf( scrips.get(stk).get("PEForward").toString()); double beta = Double.valueOf( scrips.get(stk).get("Beta").toString()); double PEG5 = Double.valueOf(scrips.get(stk).get("PEG5").toString()); double divYield = Double.valueOf(scrips.get(stk).get("DividendYield").toString())/100; double adjEPS = Double.valueOf(scrips.get(stk).get("EPS").toString())-divYield*Double.valueOf( scrips.get(stk).get("closeprice").toString()); costOfEquity = indexMap.get("^TYX").doubleValue()/100 + beta*(indexMap.get("MarketReturn").doubleValue()/100-indexMap.get("^TYX").doubleValue()/100); if(PEG5 !=0){ Properties prop = new Properties(); growthRate = PEForward/PEG5/100; double growthValue = adjEPS + adjEPS*(1+growthRate)/(1+costOfEquity)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),2)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),3)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),4); DCFPrice = growthValue + (adjEPS*Math.pow((1+growthRate),5.0)/(costOfEquity-indexMap.get("USInflation")/100-indexMap.get("USGDP")/100))/Math.pow((1+costOfEquity),5.0); System.out.println("Stock.."+stk+" Beta "+beta+ " COE "+costOfEquity+" GR "+growthRate+" DCF "+DCFPrice); prop.put("CostOfEquity",costOfEquity); prop.put("GrowthRate",growthRate); prop.put("DCFPrice",DCFPrice); dcfList.put(stk,prop); // dao.setUSDCFPrice(stk, costOfEquity, growthRate, DCFPrice); } // if = avoid NaN } // try catch(Exception e){ System.out.println("Exception.."+stk); e.printStackTrace(); } }// out IF }// for dao.setUSDCFPrice(dcfList); } public void calculateUSDCF(String stk, Map dataMap){ Properties prop = (Properties)dataMap.get(stk); //.getProperty("Beta"); computeDCF( stk, dataMap ); // System.out.println(stk+" datamap : "+prop.get("Volatility")); } private double computeDCF(String stk, Map<String,Properties> scrips ){ double costOfEquity = 0; double growthRate = 0; double marketPremium = 0; double DCFPrice = 0; // System.out.println("US DATA: "+USInflation+ " "+ USGDP + " " + USTBond +" "+ USMarketReturn+" " ); if(!stk.startsWith("MF-")){ try{ double PEForward = Double.valueOf( scrips.get(stk).getProperty("Forward P/E","0")); double beta = Double.valueOf( scrips.get(stk).getProperty("Beta:","0")); double PEG5 = Double.valueOf(scrips.get(stk).getProperty("PEG Ratio","0")); double divYield = Double.valueOf(scrips.get(stk).getProperty("Forward Annual Dividend Yield","0"))/100; double adjEPS = Double.valueOf(scrips.get(stk).getProperty("Diluted EPS","0").toString())-divYield*Double.valueOf( scrips.get(stk).getProperty("("+stk+")","0").toString()); costOfEquity = USTBond/100 + beta*(USMarketReturn/100-USTBond/100); if(PEG5 !=0){ growthRate = PEForward/PEG5/100; double growthValue = adjEPS + adjEPS*(1+growthRate)/(1+costOfEquity)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),2)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),3)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),4); DCFPrice = growthValue + (adjEPS*Math.pow((1+growthRate),5.0)/(costOfEquity-USInflation/100-USGDP/100))/Math.pow((1+costOfEquity),5.0); // System.out.println("Stock.."+stk+" Beta "+beta+ " COE "+costOfEquity+" GR "+growthRate+" PROP "+(Properties)scrips.get(stk)); Properties pp = (Properties)scrips.get(stk); pp.setProperty("COE", ""+costOfEquity); pp.setProperty("GrowthRate", ""+growthRate); pp.setProperty("DCFPrice", ""+DCFPrice); scrips.put(stk, pp); //dao.setUSDCFPrice(stk, costOfEquity, growthRate, DCFPrice); } // if = avoid NaN } // try catch(Exception e){ System.out.println("Exception.."+stk); e.printStackTrace(); } }// out IF return DCFPrice; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new DCFProcessor().calculateUSDCF(); } }
UTF-8
Java
5,170
java
DCFProcessor.java
Java
[]
null
[]
package processing; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; import dao.PortfolioDAO; public class DCFProcessor { PortfolioDAO dao = new PortfolioDAO(); double USInflation = 0; double USGDP = 0; double USTBond = 0; double USMarketReturn = 0; public DCFProcessor(){ HashMap<String,Double> indexMap = new HashMap<String,Double>(); dao.getSetUSIndices(true,indexMap); USGDP = indexMap.get("USGDP"); USInflation = indexMap.get("USInflation"); USTBond = indexMap.get("^TYX"); USMarketReturn = indexMap.get("MarketReturn"); } public void calculateUSDCF (){ HashMap<String,Double> indexMap = new HashMap<String,Double>(); dao.getSetUSIndices(true,indexMap); LinkedHashMap<String,Properties> scrips = dao.getNYSEticker(); LinkedHashMap<String,Properties> dcfList = new LinkedHashMap<String,Properties>(); double costOfEquity = 0; double growthRate = 0; double marketPremium = 0; double DCFPrice = 0; int counter =0; for (String stk:scrips.keySet()){ System.out.println("NYSE Set "+(scrips.size()-(counter++))+" "+scrips.get(stk).get("Beta") ); if(!stk.startsWith("MF-")){ try{ double PEForward = Double.valueOf( scrips.get(stk).get("PEForward").toString()); double beta = Double.valueOf( scrips.get(stk).get("Beta").toString()); double PEG5 = Double.valueOf(scrips.get(stk).get("PEG5").toString()); double divYield = Double.valueOf(scrips.get(stk).get("DividendYield").toString())/100; double adjEPS = Double.valueOf(scrips.get(stk).get("EPS").toString())-divYield*Double.valueOf( scrips.get(stk).get("closeprice").toString()); costOfEquity = indexMap.get("^TYX").doubleValue()/100 + beta*(indexMap.get("MarketReturn").doubleValue()/100-indexMap.get("^TYX").doubleValue()/100); if(PEG5 !=0){ Properties prop = new Properties(); growthRate = PEForward/PEG5/100; double growthValue = adjEPS + adjEPS*(1+growthRate)/(1+costOfEquity)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),2)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),3)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),4); DCFPrice = growthValue + (adjEPS*Math.pow((1+growthRate),5.0)/(costOfEquity-indexMap.get("USInflation")/100-indexMap.get("USGDP")/100))/Math.pow((1+costOfEquity),5.0); System.out.println("Stock.."+stk+" Beta "+beta+ " COE "+costOfEquity+" GR "+growthRate+" DCF "+DCFPrice); prop.put("CostOfEquity",costOfEquity); prop.put("GrowthRate",growthRate); prop.put("DCFPrice",DCFPrice); dcfList.put(stk,prop); // dao.setUSDCFPrice(stk, costOfEquity, growthRate, DCFPrice); } // if = avoid NaN } // try catch(Exception e){ System.out.println("Exception.."+stk); e.printStackTrace(); } }// out IF }// for dao.setUSDCFPrice(dcfList); } public void calculateUSDCF(String stk, Map dataMap){ Properties prop = (Properties)dataMap.get(stk); //.getProperty("Beta"); computeDCF( stk, dataMap ); // System.out.println(stk+" datamap : "+prop.get("Volatility")); } private double computeDCF(String stk, Map<String,Properties> scrips ){ double costOfEquity = 0; double growthRate = 0; double marketPremium = 0; double DCFPrice = 0; // System.out.println("US DATA: "+USInflation+ " "+ USGDP + " " + USTBond +" "+ USMarketReturn+" " ); if(!stk.startsWith("MF-")){ try{ double PEForward = Double.valueOf( scrips.get(stk).getProperty("Forward P/E","0")); double beta = Double.valueOf( scrips.get(stk).getProperty("Beta:","0")); double PEG5 = Double.valueOf(scrips.get(stk).getProperty("PEG Ratio","0")); double divYield = Double.valueOf(scrips.get(stk).getProperty("Forward Annual Dividend Yield","0"))/100; double adjEPS = Double.valueOf(scrips.get(stk).getProperty("Diluted EPS","0").toString())-divYield*Double.valueOf( scrips.get(stk).getProperty("("+stk+")","0").toString()); costOfEquity = USTBond/100 + beta*(USMarketReturn/100-USTBond/100); if(PEG5 !=0){ growthRate = PEForward/PEG5/100; double growthValue = adjEPS + adjEPS*(1+growthRate)/(1+costOfEquity)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),2)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),3)+adjEPS*Math.pow((1+growthRate)/(1+costOfEquity),4); DCFPrice = growthValue + (adjEPS*Math.pow((1+growthRate),5.0)/(costOfEquity-USInflation/100-USGDP/100))/Math.pow((1+costOfEquity),5.0); // System.out.println("Stock.."+stk+" Beta "+beta+ " COE "+costOfEquity+" GR "+growthRate+" PROP "+(Properties)scrips.get(stk)); Properties pp = (Properties)scrips.get(stk); pp.setProperty("COE", ""+costOfEquity); pp.setProperty("GrowthRate", ""+growthRate); pp.setProperty("DCFPrice", ""+DCFPrice); scrips.put(stk, pp); //dao.setUSDCFPrice(stk, costOfEquity, growthRate, DCFPrice); } // if = avoid NaN } // try catch(Exception e){ System.out.println("Exception.."+stk); e.printStackTrace(); } }// out IF return DCFPrice; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new DCFProcessor().calculateUSDCF(); } }
5,170
0.680464
0.660348
127
39.70866
43.736526
226
false
false
0
0
0
0
0
0
3.354331
false
false
4
794d25f4e17dc104bbb9330450cc69ca4541a22d
5,832,565,647,297
5f79dcae95801be05f0990ab3617622a71172127
/limit-service/src/main/java/com/narendra/limitservice/MyConfiguration.java
6838c91efea32f008f48f52cf7a9743c6b526d19
[]
no_license
narendrasingh86/springboot-microservices
https://github.com/narendrasingh86/springboot-microservices
252c759cbf9327c2f3ddc5a27e7f23f1a7d749e2
97e1dcc2fc053d24da122cf831cf1bed5bc3a05a
refs/heads/master
2022-12-17T20:14:48.269000
2020-09-19T17:09:18
2020-09-19T17:09:18
296,907,726
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.narendra.limitservice; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration @ConfigurationProperties("limit") public class MyConfiguration { private String minimum; private String maximum; public String getMinimum() { return minimum; } public void setMinimum(String minimum) { this.minimum = minimum; } public String getMaximum() { return maximum; } public void setMaximum(String maximum) { this.maximum = maximum; } }
UTF-8
Java
556
java
MyConfiguration.java
Java
[]
null
[]
package com.narendra.limitservice; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration @ConfigurationProperties("limit") public class MyConfiguration { private String minimum; private String maximum; public String getMinimum() { return minimum; } public void setMinimum(String minimum) { this.minimum = minimum; } public String getMaximum() { return maximum; } public void setMaximum(String maximum) { this.maximum = maximum; } }
556
0.77518
0.77518
29
18.206896
19.471251
75
false
false
0
0
0
0
0
0
0.965517
false
false
4
52ae310000df0aec8220a3e46863360cc965874e
21,861,383,580,054
2ded1865eeee0f5bb09e59c2bc2dd368b5009718
/org.datasphere.mdm.core/src/main/java/org/datasphere/mdm/core/type/model/instance/AbstractNamedDisplayableImpl.java
f36a8eb043ddaf56b4aaa5add20e10ca381c27ad
[]
no_license
datasphere-oss/datasphere-mdm
https://github.com/datasphere-oss/datasphere-mdm
4d0fcabaafc1acd05b0955e8bee4e695e9e8fd50
971079f105cf92951df658a187d34e88044ef5d4
refs/heads/main
2023-08-20T20:58:41.403000
2021-10-17T07:23:20
2021-10-17T07:23:20
417,416,422
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.datasphere.mdm.core.type.model.instance; import org.datasphere.mdm.core.type.model.NamedDisplayableElement; /** * @author Mikhail Mikhailov on Oct 7, 2020 * Just name, displayName holder. */ public abstract class AbstractNamedDisplayableImpl implements NamedDisplayableElement { /** * Name. */ private final String name; /** * Display name. */ private final String displayName; /** * Display name. */ private final String description; /** * Constructor. */ protected AbstractNamedDisplayableImpl(String name, String displayName) { super(); this.name = name; this.displayName = displayName; this.description = null; } /** * Constructor. */ protected AbstractNamedDisplayableImpl(String name, String displayName, String description) { super(); this.name = name; this.displayName = displayName; this.description = description; } /** * {@inheritDoc} */ @Override public String getName() { return name; } /** * {@inheritDoc} */ @Override public String getDisplayName() { return displayName; } /** * {@inheritDoc} */ @Override public String getDescription() { return description; } }
UTF-8
Java
1,359
java
AbstractNamedDisplayableImpl.java
Java
[ { "context": "ype.model.NamedDisplayableElement;\n\n/**\n * @author Mikhail Mikhailov on Oct 7, 2020\n * Just name, displayName holder.\n", "end": 154, "score": 0.9998157620429993, "start": 137, "tag": "NAME", "value": "Mikhail Mikhailov" } ]
null
[]
package org.datasphere.mdm.core.type.model.instance; import org.datasphere.mdm.core.type.model.NamedDisplayableElement; /** * @author <NAME> on Oct 7, 2020 * Just name, displayName holder. */ public abstract class AbstractNamedDisplayableImpl implements NamedDisplayableElement { /** * Name. */ private final String name; /** * Display name. */ private final String displayName; /** * Display name. */ private final String description; /** * Constructor. */ protected AbstractNamedDisplayableImpl(String name, String displayName) { super(); this.name = name; this.displayName = displayName; this.description = null; } /** * Constructor. */ protected AbstractNamedDisplayableImpl(String name, String displayName, String description) { super(); this.name = name; this.displayName = displayName; this.description = description; } /** * {@inheritDoc} */ @Override public String getName() { return name; } /** * {@inheritDoc} */ @Override public String getDisplayName() { return displayName; } /** * {@inheritDoc} */ @Override public String getDescription() { return description; } }
1,348
0.597498
0.593819
61
21.278688
20.591364
97
false
false
0
0
0
0
0
0
0.344262
false
false
4
ec423922e47bff3cd2ac6daab99e9e09093042be
5,128,190,989,297
737662ad5cbfc13532ec8079a50a76f9cd6bedba
/ProjetoIntegrador/src/controller/RegistroController.java
240d59544feaf9a2276377a434a40de702e31bec
[]
no_license
tiffany-philippi/Registro-Entrada-e-Saida
https://github.com/tiffany-philippi/Registro-Entrada-e-Saida
265c8196ad8e0b6b0eb0e19717371c837a449257
e20c3fb5918b750d451291a4110e948ede950890
refs/heads/master
2020-05-29T11:21:11.057000
2019-07-04T20:25:51
2019-07-04T20:25:51
189,113,372
0
0
null
false
2019-06-22T22:39:15
2019-05-28T22:45:00
2019-06-19T20:44:42
2019-06-22T22:39:15
2,187
0
0
0
Java
false
false
package controller; import java.sql.SQLException; import model.Aluno; import model.Registro; import model.Responsavel; import repository.AlunoRepository; import repository.RegistroRepository; public class RegistroController { private RegistroRepository repository; public RegistroController() { this.repository = new RegistroRepository(); } /** * Método para salvar o Registro no repositório. * @param registro Novo registro * @throws SQLException */ public void persistir(Registro registro) throws SQLException { this.repository.persistir(registro); } public Registro consultar(String matricula) throws SQLException{ return this.repository.consultar(matricula); } public void excluir (String codPront) throws SQLException { this.repository.remover(codPront); } }
ISO-8859-2
Java
841
java
RegistroController.java
Java
[]
null
[]
package controller; import java.sql.SQLException; import model.Aluno; import model.Registro; import model.Responsavel; import repository.AlunoRepository; import repository.RegistroRepository; public class RegistroController { private RegistroRepository repository; public RegistroController() { this.repository = new RegistroRepository(); } /** * Método para salvar o Registro no repositório. * @param registro Novo registro * @throws SQLException */ public void persistir(Registro registro) throws SQLException { this.repository.persistir(registro); } public Registro consultar(String matricula) throws SQLException{ return this.repository.consultar(matricula); } public void excluir (String codPront) throws SQLException { this.repository.remover(codPront); } }
841
0.743743
0.743743
37
20.567568
20.53019
65
false
false
0
0
0
0
0
0
0.837838
false
false
4
5da8d4adba5c14cb0cca46283eddf605e21cfae5
32,169,305,072,871
ed3b775258808b1f3df94c139d8f7db396cff58b
/src/com/parker/comprepair/CompanyInformationPanel.java
a290b44315fed0d4dfc154ae7624fc3aa1ffe907
[]
no_license
parkjohnston/Xtend
https://github.com/parkjohnston/Xtend
1d50676c3c9078c84d25a9f5e6268c29cd7085d0
6dc8a9f0c8f0201b81eb6dbc0b19198224086ebe
HEAD
2019-02-04T07:46:56.199000
2015-07-06T22:22:11
2015-07-06T22:22:11
30,607,240
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.parker.comprepair; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import javax.swing.DefaultComboBoxModel; import javax.swing.text.MaskFormatter; /** * * @author andrew */ public class CompanyInformationPanel extends javax.swing.JDialog { Global global; int phoneTypeOneID; int phoneTypeTwoID; ResultSet companyName; ResultSet storeDetails; /** * Creates new form CompanyInformationPanel * * @param parent * @param modal * @param globalPassed */ public CompanyInformationPanel(java.awt.Frame parent, boolean modal, Global globalPassed) { super(parent, modal); initComponents(); global = globalPassed; setActive(); CancelButton.requestFocusInWindow(); this.setLocationRelativeTo(parent); this.setVisible(true); } private void setActive() { loadStateDropDown(); loadPhoneTypeDropDown(); loadInformation(); } private void loadStateDropDown() { StateComboBox.addItem(""); for (String state : global.states) { StateComboBox.addItem(state); } } private void loadPhoneTypeDropDown() { ResultSet phoneType = PhoneType.getAllPhoneType(global); DefaultComboBoxModel dt = new DefaultComboBoxModel(); PhoneTypeComboBoxOne.setModel(dt); PhoneTypeComboBoxOne.addItem(new Item<>("0", "")); DefaultComboBoxModel dtf = new DefaultComboBoxModel(); PhoneTypeComboBoxTwo.setModel(dtf); PhoneTypeComboBoxTwo.addItem(new Item<>("0", "")); try { phoneType.beforeFirst(); while (phoneType.next()) { String description = phoneType.getString("PhoneType"); String keyID = phoneType.getString("PhoneTypeID"); PhoneTypeComboBoxOne.addItem(new Item<>(keyID, description)); PhoneTypeComboBoxTwo.addItem(new Item<>(keyID, description)); } } catch (SQLException ex) { AirBrake.sendSQLError(global, ex); } } private void loadInformation() { try { //Passed ResultSet (unhardcode later) companyName = Company.getCompanyFromID(global, 1); storeDetails = Company.getStoreFromID(global, 1); //prep phone types Item phoneTypeOne = new Item<>(storeDetails.getString("PhoneNumber1Type"), PhoneType.getPhoneTypeByID(global, storeDetails.getInt("PhoneNumber1Type"))); Item phoneTypeTwo = new Item<>(storeDetails.getString("PhoneNumber2Type"), PhoneType.getPhoneTypeByID(global, storeDetails.getInt("PhoneNumber2Type"))); //Load Boxes CompanyNameTextBox.setText(companyName.getString("CompanyName")); WebsiteTextBox.setText(companyName.getString("Website")); Address1TextBox.setText(storeDetails.getString("Address1")); Address2TextBox.setText(storeDetails.getString("Address2")); Address3TextBox.setText(storeDetails.getString("Address3")); CityTextBox.setText(storeDetails.getString("City")); StateComboBox.setSelectedItem(storeDetails.getString("State")); ZipTextBox.setText(storeDetails.getString("Zip")); PhoneNumber1FormattedTextBox.setText(storeDetails.getString("PhoneNumber1")); if (!"".equals(phoneTypeOne.toString())) { PhoneTypeComboBoxOne.setSelectedItem(phoneTypeOne); } PhoneNumber2FormattedTextBox.setText(storeDetails.getString("PhoneNumber2")); if (!"".equals(phoneTypeTwo.toString())) { PhoneTypeComboBoxTwo.setSelectedItem(phoneTypeTwo); } EmailTextBox.setText(storeDetails.getString("EmailAddress")); salesTaxTextBox.setText(storeDetails.getString("SalesTax") + "%"); } catch (SQLException ex) { AirBrake.sendSQLError(global, ex); } } private void saveInformation() { Company company = new Company(); Company store = new Company(); company.companyID = 1; company.companyName = CompanyNameTextBox.getText().trim(); company.companyWebsite = WebsiteTextBox.getText().trim(); store.storeID = 1; store.address1 = Address1TextBox.getText().trim(); store.address2 = Address2TextBox.getText().trim(); store.address3 = Address3TextBox.getText().trim(); store.city = CityTextBox.getText().trim(); store.state = StateComboBox.getSelectedItem().toString().trim(); store.zipCode = ZipTextBox.getText().trim(); store.phoneNumber1 = PhoneNumber1FormattedTextBox.getText().replaceAll("[^0-9]", "").trim(); store.phoneNumberType1 = phoneTypeOneID; store.phoneNumber2 = PhoneNumber2FormattedTextBox.getText().replaceAll("[^0-9]", "").trim(); store.phoneNumberType2 = phoneTypeTwoID; store.emailAddress = EmailTextBox.getText().trim(); store.SalesTax = Double.parseDouble(salesTaxTextBox.getText().replaceAll("[^0-9.]", "").trim()); Company.updateCompany(global, company); Company.updateStore(global, store); } private void DisabledFields() { //Set Boxes as Disabled CompanyNameTextBox.setEnabled(false); Address1TextBox.setEnabled(false); Address2TextBox.setEnabled(false); Address3TextBox.setEnabled(false); CityTextBox.setEnabled(false); StateComboBox.setEnabled(false); ZipTextBox.setEnabled(false); PhoneNumber1FormattedTextBox.setEnabled(false); PhoneTypeComboBoxOne.setEnabled(false); PhoneNumber2FormattedTextBox.setEnabled(false); PhoneTypeComboBoxTwo.setEnabled(false); EmailTextBox.setEnabled(false); WebsiteTextBox.setEnabled(false); salesTaxTextBox.setEnabled(false); //Set Boxes with Disabled Background CompanyNameTextBox.setBackground(global.disabledFields); Address1TextBox.setBackground(global.disabledFields); Address2TextBox.setBackground(global.disabledFields); Address3TextBox.setBackground(global.disabledFields); CityTextBox.setBackground(global.disabledFields); ZipTextBox.setBackground(global.disabledFields); PhoneNumber1FormattedTextBox.setBackground(global.disabledFields); PhoneNumber2FormattedTextBox.setBackground(global.disabledFields); EmailTextBox.setBackground(global.disabledFields); WebsiteTextBox.setBackground(global.disabledFields); salesTaxTextBox.setBackground(global.disabledFields); } private void EditableFields() { //Set Boxes as Editable CompanyNameTextBox.setEnabled(true); Address1TextBox.setEnabled(true); Address2TextBox.setEnabled(true); Address3TextBox.setEnabled(true); CityTextBox.setEnabled(true); StateComboBox.setEnabled(true); ZipTextBox.setEnabled(true); PhoneNumber1FormattedTextBox.setEnabled(true); PhoneTypeComboBoxOne.setEnabled(true); PhoneNumber2FormattedTextBox.setEnabled(true); PhoneTypeComboBoxTwo.setEnabled(true); EmailTextBox.setEnabled(true); WebsiteTextBox.setEnabled(true); salesTaxTextBox.setEnabled(true); //Set Boxes with White Background CompanyNameTextBox.setBackground(global.enabledFields); Address1TextBox.setBackground(global.enabledFields); Address2TextBox.setBackground(global.enabledFields); Address3TextBox.setBackground(global.enabledFields); CityTextBox.setBackground(global.enabledFields); ZipTextBox.setBackground(global.enabledFields); PhoneNumber1FormattedTextBox.setBackground(global.enabledFields); PhoneNumber2FormattedTextBox.setBackground(global.enabledFields); EmailTextBox.setBackground(global.enabledFields); WebsiteTextBox.setBackground(global.enabledFields); salesTaxTextBox.setBackground(global.enabledFields); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel7 = new javax.swing.JLabel(); WebsiteTextBox = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); EmailTextBox = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); Address3TextBox = new javax.swing.JTextField(); try{ MaskFormatter mf1 = new MaskFormatter("(###) ###-####"); PhoneNumber1FormattedTextBox = new javax.swing.JFormattedTextField(mf1); try{ MaskFormatter mf2 = new MaskFormatter("(###) ###-####"); PhoneNumber2FormattedTextBox = new javax.swing.JFormattedTextField(mf2); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); ZipTextBox = new javax.swing.JTextField(); Address2TextBox = new javax.swing.JTextField(); Address1TextBox = new javax.swing.JTextField(); CompanyNameTextBox = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); StateComboBox = new javax.swing.JComboBox(); CityTextBox = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); PhoneTypeComboBoxOne = new javax.swing.JComboBox(); PhoneTypeComboBoxTwo = new javax.swing.JComboBox(); jLabel8 = new javax.swing.JLabel(); salesTaxTextBox = new javax.swing.JTextField(); CancelButton = new javax.swing.JButton(); EditSaveToggleButton = new javax.swing.JToggleButton(); jLabel12 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jLabel7.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel7.setText("Website:"); WebsiteTextBox.setBackground(new java.awt.Color(238, 238, 238)); WebsiteTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N WebsiteTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); WebsiteTextBox.setEnabled(false); jLabel6.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel6.setText("Email:"); EmailTextBox.setBackground(new java.awt.Color(238, 238, 238)); EmailTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N EmailTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); EmailTextBox.setEnabled(false); jLabel4.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel4.setText("Phone Number:"); jLabel5.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setText("Phone Number:"); Address3TextBox.setBackground(new java.awt.Color(238, 238, 238)); Address3TextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N Address3TextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); Address3TextBox.setEnabled(false); }catch(ParseException e) {} PhoneNumber1FormattedTextBox.setBackground(new java.awt.Color(238, 238, 238)); PhoneNumber1FormattedTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); PhoneNumber1FormattedTextBox.setEnabled(false); PhoneNumber1FormattedTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N }catch(ParseException e) {} PhoneNumber2FormattedTextBox.setBackground(new java.awt.Color(238, 238, 238)); PhoneNumber2FormattedTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); PhoneNumber2FormattedTextBox.setEnabled(false); PhoneNumber2FormattedTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel9.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel9.setText("Address 2:"); jLabel10.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel10.setText("Address 3:"); jLabel11.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel11.setText("City/State/Zip:"); jLabel2.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel2.setText("Company Name:"); ZipTextBox.setBackground(new java.awt.Color(238, 238, 238)); ZipTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N ZipTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); ZipTextBox.setEnabled(false); Address2TextBox.setBackground(new java.awt.Color(238, 238, 238)); Address2TextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N Address2TextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); Address2TextBox.setEnabled(false); Address1TextBox.setBackground(new java.awt.Color(238, 238, 238)); Address1TextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N Address1TextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); Address1TextBox.setEnabled(false); CompanyNameTextBox.setBackground(new java.awt.Color(238, 238, 238)); CompanyNameTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N CompanyNameTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); CompanyNameTextBox.setEnabled(false); jLabel3.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setText("Address 1:"); StateComboBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N StateComboBox.setEnabled(false); CityTextBox.setBackground(new java.awt.Color(238, 238, 238)); CityTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N CityTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); CityTextBox.setEnabled(false); jLabel1.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Company Information"); PhoneTypeComboBoxOne.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N PhoneTypeComboBoxOne.setEnabled(false); PhoneTypeComboBoxOne.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PhoneTypeComboBoxOneActionPerformed(evt); } }); PhoneTypeComboBoxTwo.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N PhoneTypeComboBoxTwo.setEnabled(false); PhoneTypeComboBoxTwo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PhoneTypeComboBoxTwoActionPerformed(evt); } }); jLabel8.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel8.setText("Sales Tax:"); salesTaxTextBox.setBackground(new java.awt.Color(238, 238, 238)); salesTaxTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N salesTaxTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); salesTaxTextBox.setEnabled(false); CancelButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N CancelButton.setText("Cancel"); CancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelButtonActionPerformed(evt); } }); EditSaveToggleButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N EditSaveToggleButton.setText("Edit"); EditSaveToggleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EditSaveToggleButtonActionPerformed(evt); } }); jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(CityTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(StateComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ZipTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(Address1TextBox) .addComponent(Address2TextBox) .addComponent(Address3TextBox) .addComponent(CompanyNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(PhoneNumber2FormattedTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE) .addComponent(PhoneNumber1FormattedTextBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(PhoneTypeComboBoxTwo, 0, 108, Short.MAX_VALUE) .addComponent(PhoneTypeComboBoxOne, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(EmailTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE) .addComponent(WebsiteTextBox, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(salesTaxTextBox)))) .addGap(31, 31, 31)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(EditSaveToggleButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(CancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()))) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel4, jLabel5, jLabel6, jLabel7, jLabel8}); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel2, jLabel3, jLabel9}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(CompanyNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(PhoneNumber1FormattedTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(PhoneTypeComboBoxOne, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Address1TextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(jLabel5) .addComponent(PhoneNumber2FormattedTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(PhoneTypeComboBoxTwo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Address2TextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(jLabel6) .addComponent(EmailTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Address3TextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10) .addComponent(WebsiteTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ZipTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(StateComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(CityTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11) .addComponent(jLabel8) .addComponent(salesTaxTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(CancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(EditSaveToggleButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {Address1TextBox, Address2TextBox, Address3TextBox, CityTextBox, CompanyNameTextBox, EmailTextBox, PhoneNumber1FormattedTextBox, PhoneNumber2FormattedTextBox, PhoneTypeComboBoxOne, PhoneTypeComboBoxTwo, StateComboBox, WebsiteTextBox, ZipTextBox, jLabel10, jLabel11, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, salesTaxTextBox}); pack(); }// </editor-fold>//GEN-END:initComponents private void EditSaveToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditSaveToggleButtonActionPerformed if ("Save".equals(EditSaveToggleButton.getText())) { //Save Information saveInformation(); DisabledFields(); EditSaveToggleButton.setText("Edit"); } else { EditableFields(); EditSaveToggleButton.setText("Save"); } }//GEN-LAST:event_EditSaveToggleButtonActionPerformed private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed this.dispose(); }//GEN-LAST:event_CancelButtonActionPerformed private void PhoneTypeComboBoxOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneTypeComboBoxOneActionPerformed if (!"".equals(PhoneTypeComboBoxOne.getSelectedItem().toString())) { Item item = (Item) PhoneTypeComboBoxOne.getSelectedItem(); phoneTypeOneID = Integer.parseInt(item.getValue().toString()); System.out.println("Phone Type 1 ComboBox\nID: " + item.getValue() + "\nName: " + item.getDescription() + "\n---------------"); } else { System.out.println("Phone Type 1 ComboBox\nID: -1\nName: BLANK\n---------------"); } }//GEN-LAST:event_PhoneTypeComboBoxOneActionPerformed private void PhoneTypeComboBoxTwoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneTypeComboBoxTwoActionPerformed if (!"".equals(PhoneTypeComboBoxTwo.getSelectedItem().toString())) { Item item = (Item) PhoneTypeComboBoxTwo.getSelectedItem(); phoneTypeTwoID = Integer.parseInt(item.getValue().toString()); System.out.println("Phone Type 2 ComboBox\nID: " + item.getValue() + "\nName: " + item.getDescription() + "\n---------------"); } else { System.out.println("Phone Type 2 ComboBox\nID: -1\nName: BLANK\n---------------"); } }//GEN-LAST:event_PhoneTypeComboBoxTwoActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField Address1TextBox; private javax.swing.JTextField Address2TextBox; private javax.swing.JTextField Address3TextBox; private javax.swing.JButton CancelButton; private javax.swing.JTextField CityTextBox; private javax.swing.JTextField CompanyNameTextBox; private javax.swing.JToggleButton EditSaveToggleButton; private javax.swing.JTextField EmailTextBox; private javax.swing.JFormattedTextField PhoneNumber1FormattedTextBox; private javax.swing.JFormattedTextField PhoneNumber2FormattedTextBox; private javax.swing.JComboBox PhoneTypeComboBoxOne; private javax.swing.JComboBox PhoneTypeComboBoxTwo; private javax.swing.JComboBox StateComboBox; private javax.swing.JTextField WebsiteTextBox; private javax.swing.JTextField ZipTextBox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JTextField salesTaxTextBox; // End of variables declaration//GEN-END:variables }
UTF-8
Java
33,153
java
CompanyInformationPanel.java
Java
[ { "context": "javax.swing.text.MaskFormatter;\n\n/**\n *\n * @author andrew\n */\npublic class CompanyInformationPanel extends ", "end": 412, "score": 0.8303245306015015, "start": 406, "tag": "NAME", "value": "andrew" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.parker.comprepair; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import javax.swing.DefaultComboBoxModel; import javax.swing.text.MaskFormatter; /** * * @author andrew */ public class CompanyInformationPanel extends javax.swing.JDialog { Global global; int phoneTypeOneID; int phoneTypeTwoID; ResultSet companyName; ResultSet storeDetails; /** * Creates new form CompanyInformationPanel * * @param parent * @param modal * @param globalPassed */ public CompanyInformationPanel(java.awt.Frame parent, boolean modal, Global globalPassed) { super(parent, modal); initComponents(); global = globalPassed; setActive(); CancelButton.requestFocusInWindow(); this.setLocationRelativeTo(parent); this.setVisible(true); } private void setActive() { loadStateDropDown(); loadPhoneTypeDropDown(); loadInformation(); } private void loadStateDropDown() { StateComboBox.addItem(""); for (String state : global.states) { StateComboBox.addItem(state); } } private void loadPhoneTypeDropDown() { ResultSet phoneType = PhoneType.getAllPhoneType(global); DefaultComboBoxModel dt = new DefaultComboBoxModel(); PhoneTypeComboBoxOne.setModel(dt); PhoneTypeComboBoxOne.addItem(new Item<>("0", "")); DefaultComboBoxModel dtf = new DefaultComboBoxModel(); PhoneTypeComboBoxTwo.setModel(dtf); PhoneTypeComboBoxTwo.addItem(new Item<>("0", "")); try { phoneType.beforeFirst(); while (phoneType.next()) { String description = phoneType.getString("PhoneType"); String keyID = phoneType.getString("PhoneTypeID"); PhoneTypeComboBoxOne.addItem(new Item<>(keyID, description)); PhoneTypeComboBoxTwo.addItem(new Item<>(keyID, description)); } } catch (SQLException ex) { AirBrake.sendSQLError(global, ex); } } private void loadInformation() { try { //Passed ResultSet (unhardcode later) companyName = Company.getCompanyFromID(global, 1); storeDetails = Company.getStoreFromID(global, 1); //prep phone types Item phoneTypeOne = new Item<>(storeDetails.getString("PhoneNumber1Type"), PhoneType.getPhoneTypeByID(global, storeDetails.getInt("PhoneNumber1Type"))); Item phoneTypeTwo = new Item<>(storeDetails.getString("PhoneNumber2Type"), PhoneType.getPhoneTypeByID(global, storeDetails.getInt("PhoneNumber2Type"))); //Load Boxes CompanyNameTextBox.setText(companyName.getString("CompanyName")); WebsiteTextBox.setText(companyName.getString("Website")); Address1TextBox.setText(storeDetails.getString("Address1")); Address2TextBox.setText(storeDetails.getString("Address2")); Address3TextBox.setText(storeDetails.getString("Address3")); CityTextBox.setText(storeDetails.getString("City")); StateComboBox.setSelectedItem(storeDetails.getString("State")); ZipTextBox.setText(storeDetails.getString("Zip")); PhoneNumber1FormattedTextBox.setText(storeDetails.getString("PhoneNumber1")); if (!"".equals(phoneTypeOne.toString())) { PhoneTypeComboBoxOne.setSelectedItem(phoneTypeOne); } PhoneNumber2FormattedTextBox.setText(storeDetails.getString("PhoneNumber2")); if (!"".equals(phoneTypeTwo.toString())) { PhoneTypeComboBoxTwo.setSelectedItem(phoneTypeTwo); } EmailTextBox.setText(storeDetails.getString("EmailAddress")); salesTaxTextBox.setText(storeDetails.getString("SalesTax") + "%"); } catch (SQLException ex) { AirBrake.sendSQLError(global, ex); } } private void saveInformation() { Company company = new Company(); Company store = new Company(); company.companyID = 1; company.companyName = CompanyNameTextBox.getText().trim(); company.companyWebsite = WebsiteTextBox.getText().trim(); store.storeID = 1; store.address1 = Address1TextBox.getText().trim(); store.address2 = Address2TextBox.getText().trim(); store.address3 = Address3TextBox.getText().trim(); store.city = CityTextBox.getText().trim(); store.state = StateComboBox.getSelectedItem().toString().trim(); store.zipCode = ZipTextBox.getText().trim(); store.phoneNumber1 = PhoneNumber1FormattedTextBox.getText().replaceAll("[^0-9]", "").trim(); store.phoneNumberType1 = phoneTypeOneID; store.phoneNumber2 = PhoneNumber2FormattedTextBox.getText().replaceAll("[^0-9]", "").trim(); store.phoneNumberType2 = phoneTypeTwoID; store.emailAddress = EmailTextBox.getText().trim(); store.SalesTax = Double.parseDouble(salesTaxTextBox.getText().replaceAll("[^0-9.]", "").trim()); Company.updateCompany(global, company); Company.updateStore(global, store); } private void DisabledFields() { //Set Boxes as Disabled CompanyNameTextBox.setEnabled(false); Address1TextBox.setEnabled(false); Address2TextBox.setEnabled(false); Address3TextBox.setEnabled(false); CityTextBox.setEnabled(false); StateComboBox.setEnabled(false); ZipTextBox.setEnabled(false); PhoneNumber1FormattedTextBox.setEnabled(false); PhoneTypeComboBoxOne.setEnabled(false); PhoneNumber2FormattedTextBox.setEnabled(false); PhoneTypeComboBoxTwo.setEnabled(false); EmailTextBox.setEnabled(false); WebsiteTextBox.setEnabled(false); salesTaxTextBox.setEnabled(false); //Set Boxes with Disabled Background CompanyNameTextBox.setBackground(global.disabledFields); Address1TextBox.setBackground(global.disabledFields); Address2TextBox.setBackground(global.disabledFields); Address3TextBox.setBackground(global.disabledFields); CityTextBox.setBackground(global.disabledFields); ZipTextBox.setBackground(global.disabledFields); PhoneNumber1FormattedTextBox.setBackground(global.disabledFields); PhoneNumber2FormattedTextBox.setBackground(global.disabledFields); EmailTextBox.setBackground(global.disabledFields); WebsiteTextBox.setBackground(global.disabledFields); salesTaxTextBox.setBackground(global.disabledFields); } private void EditableFields() { //Set Boxes as Editable CompanyNameTextBox.setEnabled(true); Address1TextBox.setEnabled(true); Address2TextBox.setEnabled(true); Address3TextBox.setEnabled(true); CityTextBox.setEnabled(true); StateComboBox.setEnabled(true); ZipTextBox.setEnabled(true); PhoneNumber1FormattedTextBox.setEnabled(true); PhoneTypeComboBoxOne.setEnabled(true); PhoneNumber2FormattedTextBox.setEnabled(true); PhoneTypeComboBoxTwo.setEnabled(true); EmailTextBox.setEnabled(true); WebsiteTextBox.setEnabled(true); salesTaxTextBox.setEnabled(true); //Set Boxes with White Background CompanyNameTextBox.setBackground(global.enabledFields); Address1TextBox.setBackground(global.enabledFields); Address2TextBox.setBackground(global.enabledFields); Address3TextBox.setBackground(global.enabledFields); CityTextBox.setBackground(global.enabledFields); ZipTextBox.setBackground(global.enabledFields); PhoneNumber1FormattedTextBox.setBackground(global.enabledFields); PhoneNumber2FormattedTextBox.setBackground(global.enabledFields); EmailTextBox.setBackground(global.enabledFields); WebsiteTextBox.setBackground(global.enabledFields); salesTaxTextBox.setBackground(global.enabledFields); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel7 = new javax.swing.JLabel(); WebsiteTextBox = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); EmailTextBox = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); Address3TextBox = new javax.swing.JTextField(); try{ MaskFormatter mf1 = new MaskFormatter("(###) ###-####"); PhoneNumber1FormattedTextBox = new javax.swing.JFormattedTextField(mf1); try{ MaskFormatter mf2 = new MaskFormatter("(###) ###-####"); PhoneNumber2FormattedTextBox = new javax.swing.JFormattedTextField(mf2); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); ZipTextBox = new javax.swing.JTextField(); Address2TextBox = new javax.swing.JTextField(); Address1TextBox = new javax.swing.JTextField(); CompanyNameTextBox = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); StateComboBox = new javax.swing.JComboBox(); CityTextBox = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); PhoneTypeComboBoxOne = new javax.swing.JComboBox(); PhoneTypeComboBoxTwo = new javax.swing.JComboBox(); jLabel8 = new javax.swing.JLabel(); salesTaxTextBox = new javax.swing.JTextField(); CancelButton = new javax.swing.JButton(); EditSaveToggleButton = new javax.swing.JToggleButton(); jLabel12 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jLabel7.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel7.setText("Website:"); WebsiteTextBox.setBackground(new java.awt.Color(238, 238, 238)); WebsiteTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N WebsiteTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); WebsiteTextBox.setEnabled(false); jLabel6.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel6.setText("Email:"); EmailTextBox.setBackground(new java.awt.Color(238, 238, 238)); EmailTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N EmailTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); EmailTextBox.setEnabled(false); jLabel4.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel4.setText("Phone Number:"); jLabel5.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setText("Phone Number:"); Address3TextBox.setBackground(new java.awt.Color(238, 238, 238)); Address3TextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N Address3TextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); Address3TextBox.setEnabled(false); }catch(ParseException e) {} PhoneNumber1FormattedTextBox.setBackground(new java.awt.Color(238, 238, 238)); PhoneNumber1FormattedTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); PhoneNumber1FormattedTextBox.setEnabled(false); PhoneNumber1FormattedTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N }catch(ParseException e) {} PhoneNumber2FormattedTextBox.setBackground(new java.awt.Color(238, 238, 238)); PhoneNumber2FormattedTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); PhoneNumber2FormattedTextBox.setEnabled(false); PhoneNumber2FormattedTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel9.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel9.setText("Address 2:"); jLabel10.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel10.setText("Address 3:"); jLabel11.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel11.setText("City/State/Zip:"); jLabel2.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel2.setText("Company Name:"); ZipTextBox.setBackground(new java.awt.Color(238, 238, 238)); ZipTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N ZipTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); ZipTextBox.setEnabled(false); Address2TextBox.setBackground(new java.awt.Color(238, 238, 238)); Address2TextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N Address2TextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); Address2TextBox.setEnabled(false); Address1TextBox.setBackground(new java.awt.Color(238, 238, 238)); Address1TextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N Address1TextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); Address1TextBox.setEnabled(false); CompanyNameTextBox.setBackground(new java.awt.Color(238, 238, 238)); CompanyNameTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N CompanyNameTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); CompanyNameTextBox.setEnabled(false); jLabel3.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setText("Address 1:"); StateComboBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N StateComboBox.setEnabled(false); CityTextBox.setBackground(new java.awt.Color(238, 238, 238)); CityTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N CityTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); CityTextBox.setEnabled(false); jLabel1.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Company Information"); PhoneTypeComboBoxOne.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N PhoneTypeComboBoxOne.setEnabled(false); PhoneTypeComboBoxOne.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PhoneTypeComboBoxOneActionPerformed(evt); } }); PhoneTypeComboBoxTwo.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N PhoneTypeComboBoxTwo.setEnabled(false); PhoneTypeComboBoxTwo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PhoneTypeComboBoxTwoActionPerformed(evt); } }); jLabel8.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel8.setText("Sales Tax:"); salesTaxTextBox.setBackground(new java.awt.Color(238, 238, 238)); salesTaxTextBox.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N salesTaxTextBox.setDisabledTextColor(new java.awt.Color(0, 0, 0)); salesTaxTextBox.setEnabled(false); CancelButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N CancelButton.setText("Cancel"); CancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelButtonActionPerformed(evt); } }); EditSaveToggleButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N EditSaveToggleButton.setText("Edit"); EditSaveToggleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EditSaveToggleButtonActionPerformed(evt); } }); jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(CityTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(StateComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ZipTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(Address1TextBox) .addComponent(Address2TextBox) .addComponent(Address3TextBox) .addComponent(CompanyNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(PhoneNumber2FormattedTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE) .addComponent(PhoneNumber1FormattedTextBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(PhoneTypeComboBoxTwo, 0, 108, Short.MAX_VALUE) .addComponent(PhoneTypeComboBoxOne, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(EmailTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE) .addComponent(WebsiteTextBox, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(salesTaxTextBox)))) .addGap(31, 31, 31)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(EditSaveToggleButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(CancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()))) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel4, jLabel5, jLabel6, jLabel7, jLabel8}); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel2, jLabel3, jLabel9}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(CompanyNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(PhoneNumber1FormattedTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(PhoneTypeComboBoxOne, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Address1TextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(jLabel5) .addComponent(PhoneNumber2FormattedTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(PhoneTypeComboBoxTwo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Address2TextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(jLabel6) .addComponent(EmailTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Address3TextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10) .addComponent(WebsiteTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ZipTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(StateComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(CityTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11) .addComponent(jLabel8) .addComponent(salesTaxTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(CancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(EditSaveToggleButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {Address1TextBox, Address2TextBox, Address3TextBox, CityTextBox, CompanyNameTextBox, EmailTextBox, PhoneNumber1FormattedTextBox, PhoneNumber2FormattedTextBox, PhoneTypeComboBoxOne, PhoneTypeComboBoxTwo, StateComboBox, WebsiteTextBox, ZipTextBox, jLabel10, jLabel11, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, salesTaxTextBox}); pack(); }// </editor-fold>//GEN-END:initComponents private void EditSaveToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditSaveToggleButtonActionPerformed if ("Save".equals(EditSaveToggleButton.getText())) { //Save Information saveInformation(); DisabledFields(); EditSaveToggleButton.setText("Edit"); } else { EditableFields(); EditSaveToggleButton.setText("Save"); } }//GEN-LAST:event_EditSaveToggleButtonActionPerformed private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed this.dispose(); }//GEN-LAST:event_CancelButtonActionPerformed private void PhoneTypeComboBoxOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneTypeComboBoxOneActionPerformed if (!"".equals(PhoneTypeComboBoxOne.getSelectedItem().toString())) { Item item = (Item) PhoneTypeComboBoxOne.getSelectedItem(); phoneTypeOneID = Integer.parseInt(item.getValue().toString()); System.out.println("Phone Type 1 ComboBox\nID: " + item.getValue() + "\nName: " + item.getDescription() + "\n---------------"); } else { System.out.println("Phone Type 1 ComboBox\nID: -1\nName: BLANK\n---------------"); } }//GEN-LAST:event_PhoneTypeComboBoxOneActionPerformed private void PhoneTypeComboBoxTwoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneTypeComboBoxTwoActionPerformed if (!"".equals(PhoneTypeComboBoxTwo.getSelectedItem().toString())) { Item item = (Item) PhoneTypeComboBoxTwo.getSelectedItem(); phoneTypeTwoID = Integer.parseInt(item.getValue().toString()); System.out.println("Phone Type 2 ComboBox\nID: " + item.getValue() + "\nName: " + item.getDescription() + "\n---------------"); } else { System.out.println("Phone Type 2 ComboBox\nID: -1\nName: BLANK\n---------------"); } }//GEN-LAST:event_PhoneTypeComboBoxTwoActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField Address1TextBox; private javax.swing.JTextField Address2TextBox; private javax.swing.JTextField Address3TextBox; private javax.swing.JButton CancelButton; private javax.swing.JTextField CityTextBox; private javax.swing.JTextField CompanyNameTextBox; private javax.swing.JToggleButton EditSaveToggleButton; private javax.swing.JTextField EmailTextBox; private javax.swing.JFormattedTextField PhoneNumber1FormattedTextBox; private javax.swing.JFormattedTextField PhoneNumber2FormattedTextBox; private javax.swing.JComboBox PhoneTypeComboBoxOne; private javax.swing.JComboBox PhoneTypeComboBoxTwo; private javax.swing.JComboBox StateComboBox; private javax.swing.JTextField WebsiteTextBox; private javax.swing.JTextField ZipTextBox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JTextField salesTaxTextBox; // End of variables declaration//GEN-END:variables }
33,153
0.662745
0.64501
574
56.757839
44.04253
442
false
false
0
0
0
0
0
0
1.057491
false
false
4
6c156cf116dd1157d7ffa707c6a1c2628978877d
15,539,191,716,008
06f991ea7ccf35ed65bf8b81ef61ec04c0232ce6
/后端开发/算法/算法整理/Gre/管道网络.java
391f7aff75229a914484f778ca78b181a1aff083
[]
no_license
DeYuZhao/MyWiki
https://github.com/DeYuZhao/MyWiki
3e963283afb67b290b455120809518939a3a9694
339738c44335ea27047e1baed93daf4e3167f1ce
refs/heads/master
2020-05-30T12:24:05.873000
2019-11-28T13:14:12
2019-11-28T13:14:12
189,732,459
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package Gre; import java.util.ArrayList; import java.util.Scanner; /** * @author zhaodeyu * @classname Gre.管道网络 * @description TODO * @date 2019-11-28 09:36 */ public class 管道网络 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int testNum = Integer.parseInt(sc.nextLine()); while (testNum-- > 0) { String[] inputs = sc.nextLine().split(" "); int houseNum = Integer.parseInt(inputs[0]); int pipeNum = Integer.parseInt(inputs[1]); int[] startPtr = new int[houseNum+1]; int[] endPtr = new int[houseNum+1]; int[] diameter = new int[houseNum+1]; int result = 0; int[][] input = new int[pipeNum][3]; for (int i = 0; i < pipeNum; i++) { String[] temp = sc.nextLine().split(" "); input[i][0] = Integer.parseInt(temp[0]); input[i][1] = Integer.parseInt(temp[1]); input[i][2] = Integer.parseInt(temp[2]); startPtr[input[i][0]] = input[i][1]; endPtr[input[i][1]] = input[i][0]; diameter[input[i][0]] = input[i][2]; } for (int i = 0; i < houseNum; i++) { if(endPtr[i] == 0 && startPtr[i] != 0) result++; } System.out.println(result); for (int i = 0; i < houseNum; i++) { if (endPtr[i] == 0 && startPtr[i] > 0) { result = Integer.MAX_VALUE; int n = i; while (startPtr[n] != 0) { if (diameter[n] < result) { result = diameter[n]; } n = startPtr[n]; } System.out.println(i + " " + n + " " + result); } } } } }
UTF-8
Java
2,023
java
管道网络.java
Java
[ { "context": "rayList;\nimport java.util.Scanner;\n\n/**\n * @author zhaodeyu\n * @classname Gre.管道网络\n * @description TODO\n * @d", "end": 92, "score": 0.9991471767425537, "start": 84, "tag": "USERNAME", "value": "zhaodeyu" } ]
null
[]
package Gre; import java.util.ArrayList; import java.util.Scanner; /** * @author zhaodeyu * @classname Gre.管道网络 * @description TODO * @date 2019-11-28 09:36 */ public class 管道网络 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int testNum = Integer.parseInt(sc.nextLine()); while (testNum-- > 0) { String[] inputs = sc.nextLine().split(" "); int houseNum = Integer.parseInt(inputs[0]); int pipeNum = Integer.parseInt(inputs[1]); int[] startPtr = new int[houseNum+1]; int[] endPtr = new int[houseNum+1]; int[] diameter = new int[houseNum+1]; int result = 0; int[][] input = new int[pipeNum][3]; for (int i = 0; i < pipeNum; i++) { String[] temp = sc.nextLine().split(" "); input[i][0] = Integer.parseInt(temp[0]); input[i][1] = Integer.parseInt(temp[1]); input[i][2] = Integer.parseInt(temp[2]); startPtr[input[i][0]] = input[i][1]; endPtr[input[i][1]] = input[i][0]; diameter[input[i][0]] = input[i][2]; } for (int i = 0; i < houseNum; i++) { if(endPtr[i] == 0 && startPtr[i] != 0) result++; } System.out.println(result); for (int i = 0; i < houseNum; i++) { if (endPtr[i] == 0 && startPtr[i] > 0) { result = Integer.MAX_VALUE; int n = i; while (startPtr[n] != 0) { if (diameter[n] < result) { result = diameter[n]; } n = startPtr[n]; } System.out.println(i + " " + n + " " + result); } } } } }
2,023
0.415047
0.395117
64
30.359375
20.277271
67
false
false
0
0
0
0
0
0
0.515625
false
false
4
b1688bb021552d5e599a49344473e85f01e9264e
3,736,621,549,116
043c7a046c4d951ed92b5e19b971f8de551cf472
/domain/src/main/java/org/communinet/billing/domain/Plan.java
616f93c143514610c4cec1de55ab0ad181a8c2b1
[]
no_license
rdouman/cNetBilling
https://github.com/rdouman/cNetBilling
58e315920af27bc2b247592f0c440ecc520492e5
b7c404ad78d88384a6ab749f7ba71e910796c96d
refs/heads/master
2016-09-03T06:22:21.784000
2014-09-23T21:55:34
2014-09-23T21:56:18
12,663,283
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.communinet.billing.domain; public class Plan { private int planId; private String planDesc; private int limit; public int getPlanId() { return planId; } public void setPlanId(int planId) { this.planId = planId; } public String getPlanDesc() { return planDesc; } public void setPlanDesc(String planDesc) { this.planDesc = planDesc; } public int getLimit() { return limit; } public void setLimit(int limit) { this.limit = limit; } }
UTF-8
Java
475
java
Plan.java
Java
[]
null
[]
package org.communinet.billing.domain; public class Plan { private int planId; private String planDesc; private int limit; public int getPlanId() { return planId; } public void setPlanId(int planId) { this.planId = planId; } public String getPlanDesc() { return planDesc; } public void setPlanDesc(String planDesc) { this.planDesc = planDesc; } public int getLimit() { return limit; } public void setLimit(int limit) { this.limit = limit; } }
475
0.703158
0.703158
28
15.964286
13.345631
43
false
false
0
0
0
0
0
0
1.357143
false
false
4
d39b742425a2362fa01b9702804f9f929d13a5bb
32,272,384,323,880
e2ffa89a449ef3b44b5821b61a29cf0541d9ebc7
/batman-api/src/main/java/com/mo9/batman/entity/FinancialIndexBO.java
8390e6696254dda4505b40a94364a10f491c7100
[]
no_license
fangqiming/financial
https://github.com/fangqiming/financial
058686922b808cda7f98b4106546f97789cd9650
a1f3420316e92722c4c95de7db2f913cbb257f88
refs/heads/master
2020-03-06T16:14:29.830000
2018-04-17T10:45:48
2018-04-17T10:45:48
126,970,051
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mo9.batman.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; /** * @Author:qmfang * @Description: 财务指标信息 * @Date:Created in 10:24 2018/3/26 * @Modified By: */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class FinancialIndexBO { private List<String> title; private List<List<String>> report; private List<List<String>> simple; private List<List<String>> year; }
UTF-8
Java
517
java
FinancialIndexBO.java
Java
[ { "context": "structor;\n\nimport java.util.List;\n\n/**\n * @Author:qmfang\n * @Description: 财务指标信息\n * @Date:Created in 10:24", "end": 188, "score": 0.9996559619903564, "start": 182, "tag": "USERNAME", "value": "qmfang" } ]
null
[]
package com.mo9.batman.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; /** * @Author:qmfang * @Description: 财务指标信息 * @Date:Created in 10:24 2018/3/26 * @Modified By: */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class FinancialIndexBO { private List<String> title; private List<List<String>> report; private List<List<String>> simple; private List<List<String>> year; }
517
0.740594
0.716832
25
19.200001
13.151425
38
false
false
0
0
0
0
0
0
0.4
false
false
4
1c010401b49655cc358fcb8e5963cade76f246f8
28,776,280,936,510
6aa1b15c44d575825fb58b5270fb9ee4facf4cc9
/STUDY/src/com/javalec/ex06/_01_TvTest.java
1926bb54f3f665d7e0f6acb738e357211d89a581
[]
no_license
adadsw/JavaClassAtAcademy
https://github.com/adadsw/JavaClassAtAcademy
17572c284dec426d7b356c046dc29d436a2a50ce
477e98d95e6c5f8c98988df843cecd01197aaac1
refs/heads/master
2021-05-04T10:41:14.837000
2018-09-27T08:52:45
2018-09-27T08:52:45
44,162,798
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javalec.ex06; public class _01_TvTest { public static void main(String[] args) { //클래스는 디자인이며, 이 디자인을 바탕으로 만들어진 메모리 공간의 객체이다. Tv t = new Tv(); t.channel = 7; t.channeldown(); System.out.println("channel : " + t.channel); t.channelup(); System.out.println("channel : " + t.channel); Tv t2 = new Tv(); t2.channel = 10; System.out.println("t2.channel : " + t2.channel); t2.channelup(); System.out.println("t2.channel : " + t2.channel); t2.channeldown(); System.out.println("t2.channel : " + t2.channel); Tv t3 = new Tv(); t3.color = "red"; System.out.println("t3.color : " + t3.color); System.out.println("t3.power : " + t3.power); t3.power(); System.out.println("t3.power : " + t3.power); t3.volume = 10; System.out.println("t3.volume : " + t3.volume); t3.volumeup(); System.out.println("t3.volume : " + t3.volume); t3.volumedown(); System.out.println("t3.volume : " + t3.volume); } }
UTF-8
Java
1,058
java
_01_TvTest.java
Java
[]
null
[]
package com.javalec.ex06; public class _01_TvTest { public static void main(String[] args) { //클래스는 디자인이며, 이 디자인을 바탕으로 만들어진 메모리 공간의 객체이다. Tv t = new Tv(); t.channel = 7; t.channeldown(); System.out.println("channel : " + t.channel); t.channelup(); System.out.println("channel : " + t.channel); Tv t2 = new Tv(); t2.channel = 10; System.out.println("t2.channel : " + t2.channel); t2.channelup(); System.out.println("t2.channel : " + t2.channel); t2.channeldown(); System.out.println("t2.channel : " + t2.channel); Tv t3 = new Tv(); t3.color = "red"; System.out.println("t3.color : " + t3.color); System.out.println("t3.power : " + t3.power); t3.power(); System.out.println("t3.power : " + t3.power); t3.volume = 10; System.out.println("t3.volume : " + t3.volume); t3.volumeup(); System.out.println("t3.volume : " + t3.volume); t3.volumedown(); System.out.println("t3.volume : " + t3.volume); } }
1,058
0.596579
0.559356
35
26.4
17.709078
51
false
false
0
0
0
0
0
0
2.485714
false
false
4
bbff9b8543e277aeefe610177f47b1c81b5c6d73
28,776,280,939,450
78d1cc160181eee36e0fed53a1c27519e78f0747
/src/main/java/org/kavaproject/kavatouch/dispatch/DispatchQueue.java
b2d8b0fa2223653664dc770a69ee94464fa117b8
[ "BSD-3-Clause", "MIT", "Apache-2.0", "BSD-2-Clause" ]
permissive
KavaProject/KavaTouch
https://github.com/KavaProject/KavaTouch
ed3c30c1b3d8ce5d20d12e013c09d82302764c52
a5a815797c62694f0ad2e56334365548b7db1cc2
refs/heads/master
2021-01-25T08:36:59.365000
2014-03-29T11:20:20
2014-03-29T11:20:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2013 The Kava Project Developers. See the COPYRIGHT file at the top-level directory of this distribution * and at http://kavaproject.org/COPYRIGHT. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the * MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, * modified, or distributed except according to those terms. */ package org.kavaproject.kavatouch.dispatch; import android.os.Handler; import org.kavaproject.kavatouch.dispatch.staging.DispatchOnce; import org.kavaproject.kavatouch.internal.CFunction; import org.kavaproject.kavatouch.internal.CTypedef; import org.kavaproject.kavatouch.internal.Header; import org.kavaproject.kavatouch.util.NotImplementedException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @Header("queue") @CTypedef("dispatch_queue_t") public class DispatchQueue extends DispatchObject implements DispatchQueueItem, DispatchSink { public static Handler timerHandler; public static Thread mainThread; private static DispatchQueue sMainQueue; private static ThreadPoolDispatcher sDispatcher; private static Handler mainHandler; final Map contexts = new HashMap(); final Map<Object, DispatchFunction> destructors = new HashMap<Object, DispatchFunction>(); private final AtomicInteger mSuspendCount = new AtomicInteger(); private final AtomicInteger mBarrierCounter = new AtomicInteger(); private final ConcurrentLinkedQueue<DispatchQueueItem> mQueues = new ConcurrentLinkedQueue<DispatchQueueItem>(); private final boolean mSerial; volatile String label; private volatile int mFinishedBarrier = 1; private volatile DispatchSink mTargetQueue; @CFunction("dispatch_queue_create") public DispatchQueue(String label, DispatchQueueType attr) { this(sDispatcher.defaultPriorityOvercommitQueue, attr != DispatchQueueType.CONCURRENT, label); } DispatchQueue(DispatchSink targetQueue, boolean serial, String label) { mTargetQueue = targetQueue; mSerial = serial; this.label = label; } public static void init(Handler timerHandler, Handler mainHandler, Thread mainThread) { DispatchQueue.timerHandler = timerHandler; DispatchQueue.mainHandler = mainHandler; DispatchQueue.mainThread = mainThread; sMainQueue = new DispatchQueue(null, true, "dispatch_queue_main"); sDispatcher = new ThreadPoolDispatcher(Runtime.getRuntime().availableProcessors() * 4); } @CFunction("dispatch_get_global_queue") public static final DispatchQueue getGlobalQueue(DispatchQueuePriority priority) { switch (priority) { case LOW: return sDispatcher.lowPriorityQueue; case DEFAULT: return sDispatcher.defaultPriorityQueue; case HIGH: return sDispatcher.highPriorityQueue; case BACKGROUND: return sDispatcher.bgPriorityQueue; default: throw new IllegalArgumentException(); } } @CFunction("dispatch_get_main_queue") public static final DispatchQueue getMainQueue() { return sMainQueue; } @CFunction("dispatch_main") public static final void main() { DispatchSink sink = new DispatchSink() { @Override public void push(final DispatchQueueItem item) { mainHandler.post(new Runnable() { @Override public void run() { while (item.executeNextBlock()) { //empty } } }); } }; sMainQueue.setTargetQueue(sink); mainHandler.post(new Runnable() { @Override public void run() { while (sMainQueue.executeNextBlock()) { //empty } } }); } public void setTargetQueue(DispatchSink queue) { mTargetQueue = queue; } @Override public boolean executeNextBlock() { if (mSuspendCount.get() > 0) { return false; } boolean res = false; Iterator<DispatchQueueItem> it = mQueues.iterator(); while (it.hasNext()) { DispatchQueueItem item = it.next(); if (item.isEmpty()) { it.remove(); continue; } res = item.executeNextBlock(); if (res || mSerial) { break; } } return res; } @Override public boolean canExecute() { return !isEmpty(); } @Override public boolean isEmpty() { return mQueues.isEmpty(); } @CFunction("dispatch_once") public static final void dispatchOnce(DispatchOnce predicate, Runnable block) { throw new NotImplementedException(); } @CFunction("dispatch_get_specific") public static Object getSpecificForCurrentQueue(Object key) { DispatchQueue queue = getCurrentQueue(); return queue.getSpecific(key); } @CFunction("dispatch_queue_get_specific") public Object getSpecific(Object key) { return contexts.get(key); } @CFunction("dispatch_get_current_queue") public static final DispatchQueue getCurrentQueue() { DispatchQueue dq = DispatchBlock.currentQueue.get(); if (dq != null) { return dq; } else if (mainThread == Thread.currentThread()) { return sMainQueue; } else { return sDispatcher.defaultPriorityQueue; } } @CFunction("dispatch_queue_set_specific") public void setSpecific(Object key, Object context, DispatchFunction destructor) { contexts.put(key, context); destructors.put(key, destructor); } @CFunction("dispatch_barrier_async") public void dispatchBarrierAsync(DispatchBlock block) { throw new NotImplementedException(); } @CFunction("dispatch_after") public void dispatchAfter(DispatchTime when, final DispatchBlock block) { Runnable callback = new Runnable() { @Override public void run() { dispatchAsync(block); } }; timerHandler.postDelayed(callback, TimeUnit.MILLISECONDS.convert(when.remainingTime(), when.unit())); } @CFunction("dispatch_async") public void dispatchAsync(DispatchBlock block) { dispatch(block, null); } void dispatch(DispatchBlock block, Semaphore semaphore) { block.waitingOnBarrier = mBarrierCounter.get(); block.queue = this; block.executionFinishedSemaphore = semaphore; push(block); } @CFunction("dispatch_sync") public void dispatchSync(DispatchBlock block) { Semaphore sema = new Semaphore(0); dispatch(block, sema); sema.acquireUninterruptibly(); } @CFunction("dispatch_queue_get_label") public String getLabel() { return label; } @CFunction("dispatch_apply") public void dispatchApply(int iterations, DispatchBlock block) { block.iterations = iterations; dispatch(block, null); } @CFunction("dispatch_resume") public void resume() { int i = mSuspendCount.decrementAndGet(); if (i == 0) { DispatchQueueItem item = mQueues.peek(); if (item != null && item.canExecute()) { pushToTargetQueue(); } } } @CFunction("dispatch_suspend") public void suspend() { int i = mSuspendCount.incrementAndGet(); } @Override public void push(DispatchQueueItem item) { if (!mQueues.contains(item)) { mQueues.add(item); pushToTargetQueue(); } } @CFunction("dispatch_barrier_sync") public void dispatchBarrierSync(DispatchBlock block) { Semaphore semaphore = new Semaphore(0); block.isBarrier = true; dispatch(block, semaphore); mBarrierCounter.incrementAndGet(); semaphore.acquireUninterruptibly(); } public int getFinishedBarrier() { return mFinishedBarrier; } void onBarrierPassed() { mFinishedBarrier++; } private void pushToTargetQueue() { DispatchSink targetQueue = mTargetQueue; if (targetQueue != null) { targetQueue.push(this); } } }
UTF-8
Java
8,804
java
DispatchQueue.java
Java
[]
null
[]
/* * Copyright 2013 The Kava Project Developers. See the COPYRIGHT file at the top-level directory of this distribution * and at http://kavaproject.org/COPYRIGHT. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the * MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, * modified, or distributed except according to those terms. */ package org.kavaproject.kavatouch.dispatch; import android.os.Handler; import org.kavaproject.kavatouch.dispatch.staging.DispatchOnce; import org.kavaproject.kavatouch.internal.CFunction; import org.kavaproject.kavatouch.internal.CTypedef; import org.kavaproject.kavatouch.internal.Header; import org.kavaproject.kavatouch.util.NotImplementedException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @Header("queue") @CTypedef("dispatch_queue_t") public class DispatchQueue extends DispatchObject implements DispatchQueueItem, DispatchSink { public static Handler timerHandler; public static Thread mainThread; private static DispatchQueue sMainQueue; private static ThreadPoolDispatcher sDispatcher; private static Handler mainHandler; final Map contexts = new HashMap(); final Map<Object, DispatchFunction> destructors = new HashMap<Object, DispatchFunction>(); private final AtomicInteger mSuspendCount = new AtomicInteger(); private final AtomicInteger mBarrierCounter = new AtomicInteger(); private final ConcurrentLinkedQueue<DispatchQueueItem> mQueues = new ConcurrentLinkedQueue<DispatchQueueItem>(); private final boolean mSerial; volatile String label; private volatile int mFinishedBarrier = 1; private volatile DispatchSink mTargetQueue; @CFunction("dispatch_queue_create") public DispatchQueue(String label, DispatchQueueType attr) { this(sDispatcher.defaultPriorityOvercommitQueue, attr != DispatchQueueType.CONCURRENT, label); } DispatchQueue(DispatchSink targetQueue, boolean serial, String label) { mTargetQueue = targetQueue; mSerial = serial; this.label = label; } public static void init(Handler timerHandler, Handler mainHandler, Thread mainThread) { DispatchQueue.timerHandler = timerHandler; DispatchQueue.mainHandler = mainHandler; DispatchQueue.mainThread = mainThread; sMainQueue = new DispatchQueue(null, true, "dispatch_queue_main"); sDispatcher = new ThreadPoolDispatcher(Runtime.getRuntime().availableProcessors() * 4); } @CFunction("dispatch_get_global_queue") public static final DispatchQueue getGlobalQueue(DispatchQueuePriority priority) { switch (priority) { case LOW: return sDispatcher.lowPriorityQueue; case DEFAULT: return sDispatcher.defaultPriorityQueue; case HIGH: return sDispatcher.highPriorityQueue; case BACKGROUND: return sDispatcher.bgPriorityQueue; default: throw new IllegalArgumentException(); } } @CFunction("dispatch_get_main_queue") public static final DispatchQueue getMainQueue() { return sMainQueue; } @CFunction("dispatch_main") public static final void main() { DispatchSink sink = new DispatchSink() { @Override public void push(final DispatchQueueItem item) { mainHandler.post(new Runnable() { @Override public void run() { while (item.executeNextBlock()) { //empty } } }); } }; sMainQueue.setTargetQueue(sink); mainHandler.post(new Runnable() { @Override public void run() { while (sMainQueue.executeNextBlock()) { //empty } } }); } public void setTargetQueue(DispatchSink queue) { mTargetQueue = queue; } @Override public boolean executeNextBlock() { if (mSuspendCount.get() > 0) { return false; } boolean res = false; Iterator<DispatchQueueItem> it = mQueues.iterator(); while (it.hasNext()) { DispatchQueueItem item = it.next(); if (item.isEmpty()) { it.remove(); continue; } res = item.executeNextBlock(); if (res || mSerial) { break; } } return res; } @Override public boolean canExecute() { return !isEmpty(); } @Override public boolean isEmpty() { return mQueues.isEmpty(); } @CFunction("dispatch_once") public static final void dispatchOnce(DispatchOnce predicate, Runnable block) { throw new NotImplementedException(); } @CFunction("dispatch_get_specific") public static Object getSpecificForCurrentQueue(Object key) { DispatchQueue queue = getCurrentQueue(); return queue.getSpecific(key); } @CFunction("dispatch_queue_get_specific") public Object getSpecific(Object key) { return contexts.get(key); } @CFunction("dispatch_get_current_queue") public static final DispatchQueue getCurrentQueue() { DispatchQueue dq = DispatchBlock.currentQueue.get(); if (dq != null) { return dq; } else if (mainThread == Thread.currentThread()) { return sMainQueue; } else { return sDispatcher.defaultPriorityQueue; } } @CFunction("dispatch_queue_set_specific") public void setSpecific(Object key, Object context, DispatchFunction destructor) { contexts.put(key, context); destructors.put(key, destructor); } @CFunction("dispatch_barrier_async") public void dispatchBarrierAsync(DispatchBlock block) { throw new NotImplementedException(); } @CFunction("dispatch_after") public void dispatchAfter(DispatchTime when, final DispatchBlock block) { Runnable callback = new Runnable() { @Override public void run() { dispatchAsync(block); } }; timerHandler.postDelayed(callback, TimeUnit.MILLISECONDS.convert(when.remainingTime(), when.unit())); } @CFunction("dispatch_async") public void dispatchAsync(DispatchBlock block) { dispatch(block, null); } void dispatch(DispatchBlock block, Semaphore semaphore) { block.waitingOnBarrier = mBarrierCounter.get(); block.queue = this; block.executionFinishedSemaphore = semaphore; push(block); } @CFunction("dispatch_sync") public void dispatchSync(DispatchBlock block) { Semaphore sema = new Semaphore(0); dispatch(block, sema); sema.acquireUninterruptibly(); } @CFunction("dispatch_queue_get_label") public String getLabel() { return label; } @CFunction("dispatch_apply") public void dispatchApply(int iterations, DispatchBlock block) { block.iterations = iterations; dispatch(block, null); } @CFunction("dispatch_resume") public void resume() { int i = mSuspendCount.decrementAndGet(); if (i == 0) { DispatchQueueItem item = mQueues.peek(); if (item != null && item.canExecute()) { pushToTargetQueue(); } } } @CFunction("dispatch_suspend") public void suspend() { int i = mSuspendCount.incrementAndGet(); } @Override public void push(DispatchQueueItem item) { if (!mQueues.contains(item)) { mQueues.add(item); pushToTargetQueue(); } } @CFunction("dispatch_barrier_sync") public void dispatchBarrierSync(DispatchBlock block) { Semaphore semaphore = new Semaphore(0); block.isBarrier = true; dispatch(block, semaphore); mBarrierCounter.incrementAndGet(); semaphore.acquireUninterruptibly(); } public int getFinishedBarrier() { return mFinishedBarrier; } void onBarrierPassed() { mFinishedBarrier++; } private void pushToTargetQueue() { DispatchSink targetQueue = mTargetQueue; if (targetQueue != null) { targetQueue.push(this); } } }
8,804
0.634484
0.632894
277
30.783394
25.014725
119
false
false
0
0
0
0
0
0
0.472924
false
false
4
0cffd9962b785e35a19c688452dbb073fa4c9213
18,794,776,906,601
3e5db00e8b31094407583c8f891fdac9295b0002
/MyJava/src/main/java/interview/animals/YP/IsPalindrome.java
8c705f49ab038518ce001a3fd764126129670549
[]
no_license
humpydonkey/Portfolio
https://github.com/humpydonkey/Portfolio
b719db5de36b9343c9c6c85d4254cb9d8d1adaa2
4bccec6fafe3edb6f06f06a40478a5efc3f9a4d6
refs/heads/master
2021-01-17T11:06:52.045000
2021-01-04T00:01:26
2021-01-04T00:01:26
21,042,347
4
4
null
false
2021-01-20T22:37:37
2014-06-20T15:19:58
2021-01-04T00:01:38
2021-01-20T22:37:36
16,054
5
4
2
Java
false
false
package interview.company.yelp; import static org.junit.Assert.assertEquals; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import org.junit.Test; public class IsPalindrome { public static void main(String args[]) throws Exception { String input = null; try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); } if (input == null) System.out.println("No input"); else System.out.println(isPalindrome(input)); } public static boolean isPalindrome(String S) { Map<Character, Integer> cmap = new HashMap<Character, Integer>(); int oddCnt = 0; for (int i = 0; i < S.length(); i++) { char ci = S.charAt(i); Integer cnt = cmap.get(ci); cnt = cnt == null ? 1 : cnt + 1; cmap.put(ci, cnt); oddCnt = cnt % 2 == 1 ? oddCnt + 1 : oddCnt - 1; } return oddCnt <= 1; } @Test public void test1() { // TODO Write input, result, answer assertEquals(true, true); } }
UTF-8
Java
1,105
java
IsPalindrome.java
Java
[]
null
[]
package interview.company.yelp; import static org.junit.Assert.assertEquals; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import org.junit.Test; public class IsPalindrome { public static void main(String args[]) throws Exception { String input = null; try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); } if (input == null) System.out.println("No input"); else System.out.println(isPalindrome(input)); } public static boolean isPalindrome(String S) { Map<Character, Integer> cmap = new HashMap<Character, Integer>(); int oddCnt = 0; for (int i = 0; i < S.length(); i++) { char ci = S.charAt(i); Integer cnt = cmap.get(ci); cnt = cnt == null ? 1 : cnt + 1; cmap.put(ci, cnt); oddCnt = cnt % 2 == 1 ? oddCnt + 1 : oddCnt - 1; } return oddCnt <= 1; } @Test public void test1() { // TODO Write input, result, answer assertEquals(true, true); } }
1,105
0.671493
0.662443
46
23.02174
19.155529
82
false
false
0
0
0
0
0
0
1.956522
false
false
4
46bf511128027a80d9879e6e53d6851890c770c0
32,246,614,473,471
bc6e1f78736e3eeb746314186c87dd85adc90d7c
/src/main/java/com/perficient/rms/dao/EmployeeVisaDao.java
953f36756e0fc1ae14a6e32ff4aa6f629c5321ec
[]
no_license
rsdgjb/TPT-portlet
https://github.com/rsdgjb/TPT-portlet
cca98c63c70b2ad012e5c0a187a2daba1f827929
749ad39cebc22725a46aaddfc9772c4a17f49635
refs/heads/master
2016-09-06T18:22:13.030000
2013-04-12T07:38:15
2013-04-12T07:38:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.perficient.rms.dao; import com.perficient.rms.domain.Visa; import java.util.List; import javax.persistence.RollbackException; /** * * @author Sean.Pan */ public interface EmployeeVisaDao { List<Visa> searchVisaByPassportId(int passportid); Visa searchVisaByVisaId(int id); void addVisa(Visa vs) throws RollbackException ; void removeVisa(Visa vs) throws RollbackException ; void updateVisa(Visa vs) throws RollbackException ; List<Visa> searchVisaByPassportIdAndCountry(int passportid,String country); }
UTF-8
Java
647
java
EmployeeVisaDao.java
Java
[ { "context": ".persistence.RollbackException;\n\n/**\n *\n * @author Sean.Pan\n */\npublic interface EmployeeVisaDao {\n\n List<", "end": 267, "score": 0.9998527765274048, "start": 259, "tag": "NAME", "value": "Sean.Pan" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.perficient.rms.dao; import com.perficient.rms.domain.Visa; import java.util.List; import javax.persistence.RollbackException; /** * * @author Sean.Pan */ public interface EmployeeVisaDao { List<Visa> searchVisaByPassportId(int passportid); Visa searchVisaByVisaId(int id); void addVisa(Visa vs) throws RollbackException ; void removeVisa(Visa vs) throws RollbackException ; void updateVisa(Visa vs) throws RollbackException ; List<Visa> searchVisaByPassportIdAndCountry(int passportid,String country); }
647
0.755796
0.755796
24
25.958334
23.761803
79
false
false
0
0
0
0
0
0
0.541667
false
false
4
c77f824bc724b0935a8ea8196f7beafdfac44aee
9,268,539,491,939
01643b0e09a087890978d9db274194fef7518b09
/src/ui/MapPanel.java
35d668938631b141dc54742b92cb83c43082dafa
[]
no_license
domslozan/tesina-fia
https://github.com/domslozan/tesina-fia
fc7a7b8ecba16724725f94d6e9121cce32c3eaa4
a896db4ee75f109ff08d6918be5ed27e0a5aa814
refs/heads/master
2021-01-12T22:14:48.657000
2015-01-07T22:14:26
2015-01-07T22:14:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ui; import algorithms.Pathfinder; import graph.Path; import graph.Utils; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Shape; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.swing.JPanel; import javax.swing.event.MouseInputAdapter; import org.jgrapht.graph.DefaultWeightedEdge; import tiling.Tile; import tiling.WallListTileMap; public class MapPanel extends JPanel { private final WallListTileMap map; private List<PathfinderWrapper> pathfinders; private final Map<PathfinderWrapper, Path<Tile, DefaultWeightedEdge>> paths; private final Map<PathfinderWrapper, BufferedImage> fillImages; private final FillListener listener; private Tile start, goal; private MapLegend legend; public MapPanel(WallListTileMap map) { super(); this.map = map; this.paths = new HashMap<PathfinderWrapper, Path<Tile, DefaultWeightedEdge>>(); this.fillImages = new HashMap<PathfinderWrapper, BufferedImage>(); this.listener = new FillListener(); this.setPreferredSize(new Dimension((int) map.getWidth(), (int) map.getHeight())); this.addMouseListener(newMouseListener()); } public void setLegend(MapLegend l) { this.legend = l; } private MouseListener newMouseListener() { return new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent me) { Point point = me.getPoint(); switch (me.getButton()) { case MouseEvent.BUTTON1: start = map.getTileContaining(new Point2D.Double(point.x, point.y)); updatePaths(); repaint(); break; case MouseEvent.BUTTON3: goal = map.getTileContaining(new Point2D.Double(point.x, point.y)); updatePaths(); repaint(); break; } } }; } private MouseListener newLegendElementListener(final PathfinderWrapper pf) { return new MouseInputAdapter() { @Override public void mouseEntered(MouseEvent me) { setDrawDetail(pf); repaint(); } @Override public void mouseExited(MouseEvent me) { unsetDrawDetail(pf); repaint(); } }; } private boolean drawDetail = false; private Path<Tile, DefaultWeightedEdge> pathDetail; private BufferedImage fillDetail; private void setDrawDetail(PathfinderWrapper pf) { drawDetail = true; pathDetail = paths.get(pf); fillDetail = fillImages.get(pf); } private void unsetDrawDetail(PathfinderWrapper pf) { drawDetail = false; } private void setupPathfinders() { paths.clear(); fillImages.clear(); listener.clear(); legend.clearElements(); pathfinders = PathfinderFactory.allPathfinders(map); for (PathfinderWrapper pf : pathfinders) { pf.addListener(listener); legend.addElement(pf, newLegendElementListener(pf)); } } private void updatePaths() { if (start == null || goal == null) { return; } setupPathfinders(); for (PathfinderWrapper pf : pathfinders) { BufferedImage fill = new BufferedImage((int) map.getWidth(), (int) map.getHeight(), BufferedImage.TYPE_INT_ARGB); fillImages.put(pf, fill); listener.setGraphics(pf, fill.createGraphics()); Path<Tile, DefaultWeightedEdge> path = pf.findPath(start, goal); Tile current = followPath(path, pf); while (!(current == goal)) { Path<Tile, DefaultWeightedEdge> restOfPath = pf.findPath(current, goal); path = path.mergeWith(restOfPath); current = followPath(restOfPath, pf); } paths.put(pf, path); System.err.println(pf.getName() + ": path cost = " + path.cost() + ", opened nodes = " + listener.openedCount(pf)); } } private Tile followPath(Path<Tile, DefaultWeightedEdge> path, Pathfinder<Tile, DefaultWeightedEdge> pf) { Iterator<Tile> i = path.iterator(); Tile n = i.next(); while (i.hasNext()) { Map<DefaultWeightedEdge, Double> wrongEdges = Utils.wrongEdges(pf.getGraph(), n); if (!wrongEdges.isEmpty()) { for (Map.Entry<DefaultWeightedEdge, Double> e : wrongEdges.entrySet()) { pf.updateGraphEdge(e.getKey(), e.getValue()); } return n; } n = i.next(); } return n; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); drawTiles((Graphics2D) g.create()); drawWalls((Graphics2D) g.create()); drawHiddenWalls((Graphics2D) g.create()); if (drawDetail) { ((Graphics2D) g.create()).drawImage(fillDetail, null, null); } drawPaths((Graphics2D) g.create()); if (drawDetail) { Graphics2D gc = (Graphics2D) g.create(); gc.setColor(Color.RED); gc.setStroke(new BasicStroke(3f)); if (pathDetail.length() > 0) { Iterator<Tile> i = pathDetail.iterator(); Point2D last = i.next().getCenter(); while (i.hasNext()) { Point2D n = i.next().getCenter(); gc.drawLine((int) last.getX(), (int) last.getY(), (int) n.getX(), (int) n.getY()); last = n; } } } drawEndpoints((Graphics2D) g.create()); } private void drawFill(Graphics2D g, PathfinderWrapper pfw) { if (fillImages.isEmpty()) { return; } BufferedImage fill = fillImages.get(pfw); g.drawImage(fill, null, null); } private void drawEndpoints(Graphics2D g) { g.setStroke(new BasicStroke(3f)); g.setColor(Color.RED); if (start != null) { Rectangle2D r = start.asRectangle(); g.drawOval((int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); } if (goal != null) { Rectangle2D r = goal.asRectangle(); g.fillOval((int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); } } private void drawWalls(Graphics2D g) { Iterator<Shape> i = map.wallIterator(); g.setColor(Color.BLACK); while (i.hasNext()) { Shape s = i.next(); g.fill(s); } } private void drawHiddenWalls(Graphics2D g) { Iterator<Shape> i = map.hiddenWallIterator(); g.setColor(Color.GRAY); while (i.hasNext()) { Shape s = i.next(); g.fill(s); } } private void drawTiles(Graphics2D g) { Iterator<Tile> i = map.iterator(); g.setColor(Color.GRAY); while (i.hasNext()) { g.draw(i.next().asRectangle()); } } private void drawPaths(Graphics2D g) { for (Map.Entry<PathfinderWrapper, Path<Tile, DefaultWeightedEdge>> e : paths.entrySet()) { g.setColor(e.getKey().getPathColor()); g.setStroke(e.getKey().getPathStroke()); if (e.getValue().length() > 0) { Iterator<Tile> i = e.getValue().iterator(); Point2D last = i.next().getCenter(); while (i.hasNext()) { Point2D n = i.next().getCenter(); g.drawLine((int) last.getX(), (int) last.getY(), (int) n.getX(), (int) n.getY()); last = n; } } } } }
UTF-8
Java
8,300
java
MapPanel.java
Java
[]
null
[]
package ui; import algorithms.Pathfinder; import graph.Path; import graph.Utils; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Shape; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.swing.JPanel; import javax.swing.event.MouseInputAdapter; import org.jgrapht.graph.DefaultWeightedEdge; import tiling.Tile; import tiling.WallListTileMap; public class MapPanel extends JPanel { private final WallListTileMap map; private List<PathfinderWrapper> pathfinders; private final Map<PathfinderWrapper, Path<Tile, DefaultWeightedEdge>> paths; private final Map<PathfinderWrapper, BufferedImage> fillImages; private final FillListener listener; private Tile start, goal; private MapLegend legend; public MapPanel(WallListTileMap map) { super(); this.map = map; this.paths = new HashMap<PathfinderWrapper, Path<Tile, DefaultWeightedEdge>>(); this.fillImages = new HashMap<PathfinderWrapper, BufferedImage>(); this.listener = new FillListener(); this.setPreferredSize(new Dimension((int) map.getWidth(), (int) map.getHeight())); this.addMouseListener(newMouseListener()); } public void setLegend(MapLegend l) { this.legend = l; } private MouseListener newMouseListener() { return new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent me) { Point point = me.getPoint(); switch (me.getButton()) { case MouseEvent.BUTTON1: start = map.getTileContaining(new Point2D.Double(point.x, point.y)); updatePaths(); repaint(); break; case MouseEvent.BUTTON3: goal = map.getTileContaining(new Point2D.Double(point.x, point.y)); updatePaths(); repaint(); break; } } }; } private MouseListener newLegendElementListener(final PathfinderWrapper pf) { return new MouseInputAdapter() { @Override public void mouseEntered(MouseEvent me) { setDrawDetail(pf); repaint(); } @Override public void mouseExited(MouseEvent me) { unsetDrawDetail(pf); repaint(); } }; } private boolean drawDetail = false; private Path<Tile, DefaultWeightedEdge> pathDetail; private BufferedImage fillDetail; private void setDrawDetail(PathfinderWrapper pf) { drawDetail = true; pathDetail = paths.get(pf); fillDetail = fillImages.get(pf); } private void unsetDrawDetail(PathfinderWrapper pf) { drawDetail = false; } private void setupPathfinders() { paths.clear(); fillImages.clear(); listener.clear(); legend.clearElements(); pathfinders = PathfinderFactory.allPathfinders(map); for (PathfinderWrapper pf : pathfinders) { pf.addListener(listener); legend.addElement(pf, newLegendElementListener(pf)); } } private void updatePaths() { if (start == null || goal == null) { return; } setupPathfinders(); for (PathfinderWrapper pf : pathfinders) { BufferedImage fill = new BufferedImage((int) map.getWidth(), (int) map.getHeight(), BufferedImage.TYPE_INT_ARGB); fillImages.put(pf, fill); listener.setGraphics(pf, fill.createGraphics()); Path<Tile, DefaultWeightedEdge> path = pf.findPath(start, goal); Tile current = followPath(path, pf); while (!(current == goal)) { Path<Tile, DefaultWeightedEdge> restOfPath = pf.findPath(current, goal); path = path.mergeWith(restOfPath); current = followPath(restOfPath, pf); } paths.put(pf, path); System.err.println(pf.getName() + ": path cost = " + path.cost() + ", opened nodes = " + listener.openedCount(pf)); } } private Tile followPath(Path<Tile, DefaultWeightedEdge> path, Pathfinder<Tile, DefaultWeightedEdge> pf) { Iterator<Tile> i = path.iterator(); Tile n = i.next(); while (i.hasNext()) { Map<DefaultWeightedEdge, Double> wrongEdges = Utils.wrongEdges(pf.getGraph(), n); if (!wrongEdges.isEmpty()) { for (Map.Entry<DefaultWeightedEdge, Double> e : wrongEdges.entrySet()) { pf.updateGraphEdge(e.getKey(), e.getValue()); } return n; } n = i.next(); } return n; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); drawTiles((Graphics2D) g.create()); drawWalls((Graphics2D) g.create()); drawHiddenWalls((Graphics2D) g.create()); if (drawDetail) { ((Graphics2D) g.create()).drawImage(fillDetail, null, null); } drawPaths((Graphics2D) g.create()); if (drawDetail) { Graphics2D gc = (Graphics2D) g.create(); gc.setColor(Color.RED); gc.setStroke(new BasicStroke(3f)); if (pathDetail.length() > 0) { Iterator<Tile> i = pathDetail.iterator(); Point2D last = i.next().getCenter(); while (i.hasNext()) { Point2D n = i.next().getCenter(); gc.drawLine((int) last.getX(), (int) last.getY(), (int) n.getX(), (int) n.getY()); last = n; } } } drawEndpoints((Graphics2D) g.create()); } private void drawFill(Graphics2D g, PathfinderWrapper pfw) { if (fillImages.isEmpty()) { return; } BufferedImage fill = fillImages.get(pfw); g.drawImage(fill, null, null); } private void drawEndpoints(Graphics2D g) { g.setStroke(new BasicStroke(3f)); g.setColor(Color.RED); if (start != null) { Rectangle2D r = start.asRectangle(); g.drawOval((int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); } if (goal != null) { Rectangle2D r = goal.asRectangle(); g.fillOval((int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); } } private void drawWalls(Graphics2D g) { Iterator<Shape> i = map.wallIterator(); g.setColor(Color.BLACK); while (i.hasNext()) { Shape s = i.next(); g.fill(s); } } private void drawHiddenWalls(Graphics2D g) { Iterator<Shape> i = map.hiddenWallIterator(); g.setColor(Color.GRAY); while (i.hasNext()) { Shape s = i.next(); g.fill(s); } } private void drawTiles(Graphics2D g) { Iterator<Tile> i = map.iterator(); g.setColor(Color.GRAY); while (i.hasNext()) { g.draw(i.next().asRectangle()); } } private void drawPaths(Graphics2D g) { for (Map.Entry<PathfinderWrapper, Path<Tile, DefaultWeightedEdge>> e : paths.entrySet()) { g.setColor(e.getKey().getPathColor()); g.setStroke(e.getKey().getPathStroke()); if (e.getValue().length() > 0) { Iterator<Tile> i = e.getValue().iterator(); Point2D last = i.next().getCenter(); while (i.hasNext()) { Point2D n = i.next().getCenter(); g.drawLine((int) last.getX(), (int) last.getY(), (int) n.getX(), (int) n.getY()); last = n; } } } } }
8,300
0.560361
0.556626
264
30.439394
25.6346
127
false
false
0
0
0
0
0
0
0.689394
false
false
4
ce4e1d7d97f2737b7a29409afef209c0793e1204
27,075,473,848,071
137f49a271ce51d33a9d07bf41e4a9a6dc52b5b5
/JPsTale-AssetLoader/src/test/java/org/pstale/app/TestAnimation.java
793b1de95b787f0c35ac6afc03becfeb1ae10216
[]
no_license
JPsTale/jpstale
https://github.com/JPsTale/jpstale
a2203c9327e186600ab050b7ea876401e31ab3f9
3bcb653546a2164c3b352569f481d732f2c65ceb
refs/heads/master
2023-08-31T13:13:32.460000
2018-05-09T17:54:40
2018-05-09T17:54:40
111,260,561
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.pstale.app; import org.pstale.assets.AssetFactory; import com.jme3.animation.AnimControl; import com.jme3.animation.Skeleton; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.scene.Node; import com.jme3.scene.debug.SkeletonDebugger; /** * 测试动画播放 * * @author yanmaoyuan * */ public class TestAnimation extends TestBase { @Override public void init() { float scale = 0.1f; Node npc = AssetFactory.loadCharacter("char/monster/death_knight/death_knight.inx"); npc.scale(scale); rootNode.attachChild(npc); AnimControl ac = npc.getControl(AnimControl.class); if (ac != null) { final Skeleton skel = ac.getSkeleton(); SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", skel); final Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Green); mat.getAdditionalRenderState().setDepthTest(false); skeletonDebug.setMaterial(mat); npc.attachChild(skeletonDebug); ac.createChannel().setAnim("Anim"); } cam.setLocation(new Vector3f(0, 5, 10)); } public static void main(String[] args) { new TestAnimation().start(); } }
UTF-8
Java
1,375
java
TestAnimation.java
Java
[ { "context": "ug.SkeletonDebugger;\n\n/**\n * 测试动画播放\n * \n * @author yanmaoyuan\n *\n */\npublic class TestAnimation extends TestBas", "end": 352, "score": 0.9993165731430054, "start": 342, "tag": "USERNAME", "value": "yanmaoyuan" } ]
null
[]
package org.pstale.app; import org.pstale.assets.AssetFactory; import com.jme3.animation.AnimControl; import com.jme3.animation.Skeleton; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.scene.Node; import com.jme3.scene.debug.SkeletonDebugger; /** * 测试动画播放 * * @author yanmaoyuan * */ public class TestAnimation extends TestBase { @Override public void init() { float scale = 0.1f; Node npc = AssetFactory.loadCharacter("char/monster/death_knight/death_knight.inx"); npc.scale(scale); rootNode.attachChild(npc); AnimControl ac = npc.getControl(AnimControl.class); if (ac != null) { final Skeleton skel = ac.getSkeleton(); SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", skel); final Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Green); mat.getAdditionalRenderState().setDepthTest(false); skeletonDebug.setMaterial(mat); npc.attachChild(skeletonDebug); ac.createChannel().setAnim("Anim"); } cam.setLocation(new Vector3f(0, 5, 10)); } public static void main(String[] args) { new TestAnimation().start(); } }
1,375
0.658107
0.646368
50
26.26
25.118767
97
false
false
0
0
0
0
0
0
0.58
false
false
4
c85f62117692ae7082916e00d1860ae3caa0f9af
3,607,772,545,085
f6492d94b7f8b25d38e0f047f25ca26bad12f1ed
/ff/src/Ex12t3/Staff.java
e07ac68edd6b018722dcff52199c049ed7867335
[]
no_license
zdlgv5/JavaLearningProcess
https://github.com/zdlgv5/JavaLearningProcess
8ddb41bc2afc65c8c33fc7ef5e46b805e849fc61
cbf0f7a382d0c555ef8347ef7e6927ec1217ea47
refs/heads/master
2020-08-05T03:34:57.595000
2016-08-27T06:43:31
2016-08-27T06:43:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Ex12t3; public class Staff extends Employee{ String duty; public void shuchu(){ super.shuchu(); System.out.println("ְλ:"+duty); } public Staff(String name, String address, String telphone, String email, String office, String wage, String hireday, String duty) { super(name, address, telphone, email, office, wage, hireday); this.duty = duty; } public Staff() { // TODO Auto-generated constructor stub } }
UTF-8
Java
437
java
Staff.java
Java
[]
null
[]
package Ex12t3; public class Staff extends Employee{ String duty; public void shuchu(){ super.shuchu(); System.out.println("ְλ:"+duty); } public Staff(String name, String address, String telphone, String email, String office, String wage, String hireday, String duty) { super(name, address, telphone, email, office, wage, hireday); this.duty = duty; } public Staff() { // TODO Auto-generated constructor stub } }
437
0.705747
0.698851
18
23.166666
22.674631
73
false
false
0
0
0
0
0
0
2.166667
false
false
4
c0be95afd7238d9dbabba365ff462adcf7067bc3
28,948,079,587,908
ee582e2220db571d92c7be09521ca0ed8628c0de
/src/java/AbstractFactory/TvAbstractFactory.java
e8b726ddcb6875c448c004d630460e6a305657d7
[]
no_license
CarlPopoca/PatronesDisenoJAVA
https://github.com/CarlPopoca/PatronesDisenoJAVA
2e714e2e9a85ed3044b0d9c4059acfefa96de0bb
06fb91c8e47699f5009308c04db9a6e933423d5e
refs/heads/master
2022-05-24T01:14:38.923000
2020-01-21T23:09:09
2020-01-21T23:09:09
235,457,622
0
1
null
false
2022-04-18T02:29:24
2020-01-21T22:55:00
2020-01-21T23:09:45
2022-04-18T02:29:23
6,394
0
1
1
Java
false
false
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package AbstractFactory; /** * Clase abstracta que sirve para implementar la creacion de la TV y del color * */ public abstract class TvAbstractFactory { public abstract TV createTV(); public abstract Color createColor(); }
UTF-8
Java
342
java
TvAbstractFactory.java
Java
[]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package AbstractFactory; /** * Clase abstracta que sirve para implementar la creacion de la TV y del color * */ public abstract class TvAbstractFactory { public abstract TV createTV(); public abstract Color createColor(); }
342
0.710526
0.710526
15
21.799999
23.452648
78
false
false
0
0
0
0
0
0
0.333333
false
false
4
d0049d61bd17520da6e53dfaf67c46eacf09cf38
1,606,317,791,223
1e9ffb0437d19ec0fcd5d7019c06756e28266c32
/app/src/main/java/com/yunsen/enjoy/activity/order/GaiYaOrderInfoActivity.java
d5e5e58734b7675ef67c3da066187d850311c032
[]
no_license
zyjy33/chiDing
https://github.com/zyjy33/chiDing
e9266d4d477002e1bf3e7eafb8ed254f05578656
d49a5cc9486ef490a2cd852f68f0bb1d1dcbd2df
refs/heads/master
2020-03-24T17:06:13.594000
2018-09-14T04:53:55
2018-09-14T04:53:55
142,849,110
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yunsen.enjoy.activity.order; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.yunsen.enjoy.R; import com.yunsen.enjoy.activity.BaseFragmentActivity; import com.yunsen.enjoy.common.Constants; import com.yunsen.enjoy.ui.UIHelper; import com.yunsen.enjoy.widget.GlideCircleTransform; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by Administrator on 2018/7/12/012. * 盖亚订单详情页面 */ public class GaiYaOrderInfoActivity extends BaseFragmentActivity { @Bind(R.id.action_bar_title) TextView actionBarTitle; @Bind(R.id.order_info_finish) TextView orderInfoFinish; @Bind(R.id.order_info_icon) ImageView orderInfoIcon; @Bind(R.id.order_info_money) TextView orderInfoMoney; @Bind(R.id.order_info_state) TextView orderInfoState; @Bind(R.id.order_info_balance) TextView orderInfoBalance; private String mActType; private String mPayMoney; @Override public int getLayout() { return R.layout.activity_order_info; } @Override protected void initView() { ButterKnife.bind(this); actionBarTitle.setText("订单详情"); } @Override protected void initData(Bundle savedInstanceState) { Intent intent = getIntent(); mActType = intent.getStringExtra(Constants.ACT_TYPE_KEY); mPayMoney = intent.getStringExtra(Constants.PAY_MONEY); Glide.with(this) .load(R.mipmap.login_icon) .transform(new GlideCircleTransform(this)) .into(orderInfoIcon); orderInfoBalance.setText("-" + mPayMoney + "元"); orderInfoMoney.setText(mPayMoney + "元"); orderInfoState.setText(mActType); } @Override protected void initListener() { } @OnClick({R.id.action_back, R.id.order_info_finish}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.action_back: UIHelper.showHomeActivity(this); finish(); break; case R.id.order_info_finish: UIHelper.showHomeActivity(this); finish(); break; } } }
UTF-8
Java
2,383
java
GaiYaOrderInfoActivity.java
Java
[ { "context": "fe;\nimport butterknife.OnClick;\n\n/**\n * Created by Administrator on 2018/7/12/012.\n * 盖亚订单详情页面\n */\n\npublic class G", "end": 556, "score": 0.5968850255012512, "start": 543, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package com.yunsen.enjoy.activity.order; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.yunsen.enjoy.R; import com.yunsen.enjoy.activity.BaseFragmentActivity; import com.yunsen.enjoy.common.Constants; import com.yunsen.enjoy.ui.UIHelper; import com.yunsen.enjoy.widget.GlideCircleTransform; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by Administrator on 2018/7/12/012. * 盖亚订单详情页面 */ public class GaiYaOrderInfoActivity extends BaseFragmentActivity { @Bind(R.id.action_bar_title) TextView actionBarTitle; @Bind(R.id.order_info_finish) TextView orderInfoFinish; @Bind(R.id.order_info_icon) ImageView orderInfoIcon; @Bind(R.id.order_info_money) TextView orderInfoMoney; @Bind(R.id.order_info_state) TextView orderInfoState; @Bind(R.id.order_info_balance) TextView orderInfoBalance; private String mActType; private String mPayMoney; @Override public int getLayout() { return R.layout.activity_order_info; } @Override protected void initView() { ButterKnife.bind(this); actionBarTitle.setText("订单详情"); } @Override protected void initData(Bundle savedInstanceState) { Intent intent = getIntent(); mActType = intent.getStringExtra(Constants.ACT_TYPE_KEY); mPayMoney = intent.getStringExtra(Constants.PAY_MONEY); Glide.with(this) .load(R.mipmap.login_icon) .transform(new GlideCircleTransform(this)) .into(orderInfoIcon); orderInfoBalance.setText("-" + mPayMoney + "元"); orderInfoMoney.setText(mPayMoney + "元"); orderInfoState.setText(mActType); } @Override protected void initListener() { } @OnClick({R.id.action_back, R.id.order_info_finish}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.action_back: UIHelper.showHomeActivity(this); finish(); break; case R.id.order_info_finish: UIHelper.showHomeActivity(this); finish(); break; } } }
2,383
0.659873
0.655626
85
26.705883
17.990078
66
false
false
0
0
0
0
0
0
0.470588
false
false
4
6c8192c8d570eee4cd83901ffe290c6bc63fda34
14,920,716,407,420
7ced6c0ed03f2f9345bbc06a09dbbcf5c8687619
/catering-basic-server/catering-goods/catering-goods-server/src/main/java/com/meiyuan/catering/goods/entity/CateringGoodsExtendPropertyEntity.java
c91327df32d3118f426da4436aab1cfe1b22a8b3
[]
no_license
haorq/food-word
https://github.com/haorq/food-word
c14d5752c6492aed4a6a1410f9e0352479460da0
18a71259d77b4d96261dab8ed51ca1f109ab5c2f
refs/heads/master
2023-01-01T12:19:48.967000
2020-10-26T07:32:25
2020-10-26T07:32:25
307,292,398
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.meiyuan.catering.goods.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.meiyuan.catering.core.entity.IdEntity; import lombok.Data; import java.io.Serializable; /** * 商品扩展属性表(CateringGoodsExtendProperty)实体类 * * @author wxf * @since 2020-03-09 17:36:32 */ @Data @TableName("catering_goods_extend_property") public class CateringGoodsExtendPropertyEntity extends IdEntity implements Serializable { private static final long serialVersionUID = -92963120211306627L; /** * 商品id */ @TableField(value = "goods_id") private Long goodsId; /** * 商品编号 */ @TableField(value = "spu_code") private String spuCode; /** * 字段名 */ @TableField(value = "goods_extend_property_field") private String goodsExtendPropertyField; /** * 字段值 */ @TableField(value = "goods_extend_property_value") private String goodsExtendPropertyValue; /** * 1-不启用,2-启用 */ @TableField(value = "field_status") private Integer fieldStatus; }
UTF-8
Java
1,170
java
CateringGoodsExtendPropertyEntity.java
Java
[ { "context": "展属性表(CateringGoodsExtendProperty)实体类\n *\n * @author wxf\n * @since 2020-03-09 17:36:32\n */\n@Data\n@TableNam", "end": 318, "score": 0.9996203780174255, "start": 315, "tag": "USERNAME", "value": "wxf" } ]
null
[]
package com.meiyuan.catering.goods.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.meiyuan.catering.core.entity.IdEntity; import lombok.Data; import java.io.Serializable; /** * 商品扩展属性表(CateringGoodsExtendProperty)实体类 * * @author wxf * @since 2020-03-09 17:36:32 */ @Data @TableName("catering_goods_extend_property") public class CateringGoodsExtendPropertyEntity extends IdEntity implements Serializable { private static final long serialVersionUID = -92963120211306627L; /** * 商品id */ @TableField(value = "goods_id") private Long goodsId; /** * 商品编号 */ @TableField(value = "spu_code") private String spuCode; /** * 字段名 */ @TableField(value = "goods_extend_property_field") private String goodsExtendPropertyField; /** * 字段值 */ @TableField(value = "goods_extend_property_value") private String goodsExtendPropertyValue; /** * 1-不启用,2-启用 */ @TableField(value = "field_status") private Integer fieldStatus; }
1,170
0.6819
0.65233
46
23.282608
19.768951
69
false
false
0
0
0
0
0
0
0.282609
false
false
4
d8137169bd901b1ea7dd3973584df7f102a5e9ce
3,229,815,429,225
0df4eddc77bfc20ae6b02a08436dfbbbcbfb1e33
/src/test/java/com/kanke/api/ObjectFactoryTest.java
c59ae7606200356646af89ae27f092c65b7b85ba
[]
no_license
kanke/Challenge
https://github.com/kanke/Challenge
05f09491c91b6394266bea6872887844998be1cb
e515ff9613f915258179bbe6b11434aba8773ca4
refs/heads/master
2016-08-10T12:40:17.327000
2015-11-25T13:24:04
2015-11-25T13:24:04
46,749,625
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kanke.api; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.runners.MockitoJUnitRunner; import static junit.framework.Assert.assertNotNull; import static org.mockito.Mockito.*; /** * Created by kishaku on 24/11/2015. */ @RunWith(MockitoJUnitRunner.class) public class ObjectFactoryTest { @Spy @InjectMocks ObjectFactory objectFactory; @After public void validate() { validateMockitoUsage(); } @Before public void setup() { } @Test public void shouldCreateExpense() { Expense expense = new Expense(); objectFactory.createExpense(); assertNotNull(expense); verify(objectFactory, atLeastOnce()).createExpense(); } }
UTF-8
Java
857
java
ObjectFactoryTest.java
Java
[ { "context": "t static org.mockito.Mockito.*;\n\n/**\n * Created by kishaku on 24/11/2015.\n */\n@RunWith(MockitoJUnitRunner.cl", "end": 348, "score": 0.9996446967124939, "start": 341, "tag": "USERNAME", "value": "kishaku" } ]
null
[]
package com.kanke.api; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.runners.MockitoJUnitRunner; import static junit.framework.Assert.assertNotNull; import static org.mockito.Mockito.*; /** * Created by kishaku on 24/11/2015. */ @RunWith(MockitoJUnitRunner.class) public class ObjectFactoryTest { @Spy @InjectMocks ObjectFactory objectFactory; @After public void validate() { validateMockitoUsage(); } @Before public void setup() { } @Test public void shouldCreateExpense() { Expense expense = new Expense(); objectFactory.createExpense(); assertNotNull(expense); verify(objectFactory, atLeastOnce()).createExpense(); } }
857
0.696616
0.687281
44
18.477272
16.79487
61
false
false
0
0
0
0
0
0
0.386364
false
false
4
19e2ab85e453f06a7fc53d718f3e431ac39a23b4
128,849,038,183
9af796b3b3a7b21bd4574badafa357910370e9cb
/chushimodole/src/main/java/com/example/administrator/chushi/fragment/mine/CheckAddressActivity.java
e3011dec287b0979f6558c67fb90e6f3edff5b53
[]
no_license
liubiao1102/chushi
https://github.com/liubiao1102/chushi
6d1489ab6d53a9b79b0b325b770920f525064444
b16c666316be2e67bfd961db041fc662c03cd9dd
refs/heads/master
2020-04-24T17:43:56.667000
2019-02-23T01:30:10
2019-02-23T01:30:10
172,157,215
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.administrator.chushi.fragment.mine; import android.content.Intent; import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.example.administrator.chushi.R; import com.example.administrator.chushi.base.BaseActivity; import com.example.administrator.chushi.bean.AddressLieBiaoBean; import com.example.administrator.chushi.utils.MyContants; import com.example.administrator.chushi.utils.MyUtils; import com.google.gson.Gson; import com.lzy.okgo.OkGo; import com.lzy.okgo.callback.StringCallback; import java.util.List; import okhttp3.Call; import okhttp3.Response; public class CheckAddressActivity extends BaseActivity implements View.OnClickListener { private RecyclerView address_recycler; private MyAddressAdapter myAddressAdapter; private ImageView tv_back; private TextView add_address; private List<AddressLieBiaoBean.DataBean> data; private String userid; private String token; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_check_address); initView(); initData(); } private void initView() { add_address= (TextView) findViewById(R.id.add_address); add_address.setOnClickListener(this); tv_back= (ImageView) findViewById(R.id.tv_back); tv_back.setOnClickListener(this); address_recycler= (RecyclerView) findViewById(R.id.address_recycler); initNet(); } private void initNet() { userid = MyUtils.getUserid(this); token = MyUtils.getToken(this); OkGo.get(MyContants.BASEURL + "Address/lists/") .tag(this) .params("userid", userid) .params("token", token) .execute(new StringCallback() { @Override public void onSuccess(String s, Call call, Response response) { Gson gson = new Gson(); AddressLieBiaoBean addressLieBiaoBean = gson.fromJson(s, AddressLieBiaoBean.class); if (addressLieBiaoBean.getCode() == 200) { data = addressLieBiaoBean.getData(); } else { Toast.makeText(CheckAddressActivity.this, "还没有添加地址呢,快去添加吧", Toast.LENGTH_SHORT).show(); } initData(); } @Override public void onError(Call call, Response response, Exception e) { Toast.makeText(CheckAddressActivity.this, "请检查网络或重试", Toast.LENGTH_SHORT).show(); Log.e("请求失败", "失败原因:" + response); } }); } private void initData() { myAddressAdapter = new MyAddressAdapter(R.layout.check_address_item, data); address_recycler.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false)); address_recycler.setNestedScrollingEnabled(false); address_recycler.setAdapter(myAddressAdapter); myAddressAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { Intent intent = getIntent(); if (data.size()<=0){ intent.putExtra("username",""); intent.putExtra("mobile", ""); intent.putExtra("address",""); intent.putExtra("area", ""); intent.putExtra("c_id",""); intent.putExtra("v_id",""); intent.putExtra("x_id",""); }else { intent.putExtra("username", data.get(position).getUsername()); intent.putExtra("mobile", data.get(position).getMobile()); intent.putExtra("address", data.get(position).getAddress()); intent.putExtra("area", data.get(position).getArea()); intent.putExtra("c_id", data.get(position).getC_id()); intent.putExtra("v_id", data.get(position).getV_id()); intent.putExtra("x_id", data.get(position).getX_id()); } setResult(0, intent); finish(); } }); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.tv_back: Intent intent = getIntent(); intent.putExtra("username", ""); setResult(0, intent); finish(); break; case R.id.add_address: Intent intent1=new Intent(CheckAddressActivity.this,BianJiAddressActivity.class); intent1.putExtra("username", ""); startActivityForResult(intent1,0); break; } } @Override public void onBackPressed() { Intent intent = getIntent(); intent.putExtra("username", ""); setResult(0, intent); super.onBackPressed(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null) { initNet(); } } class MyAddressAdapter extends BaseQuickAdapter<AddressLieBiaoBean.DataBean, BaseViewHolder>{ public MyAddressAdapter(@LayoutRes int layoutResId, @Nullable List<AddressLieBiaoBean.DataBean> data) { super(layoutResId, data); } @Override protected void convert(BaseViewHolder helper, AddressLieBiaoBean.DataBean item) { helper.setText(R.id.tv_name,item.getUsername()); helper.setText(R.id.tv_phone,item.getMobile()); helper.setText(R.id.tv_address, item.getArea() + "" + item.getAddress()); TextView tv_moren = helper.getView(R.id.tv_moren); String status = item.getStatus(); tv_moren.setText(status); if (status.equals("1")){ tv_moren.setText("默认地址"); }else if (status.equals("0")){ tv_moren.setText(""); } } } }
UTF-8
Java
6,838
java
CheckAddressActivity.java
Java
[]
null
[]
package com.example.administrator.chushi.fragment.mine; import android.content.Intent; import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.example.administrator.chushi.R; import com.example.administrator.chushi.base.BaseActivity; import com.example.administrator.chushi.bean.AddressLieBiaoBean; import com.example.administrator.chushi.utils.MyContants; import com.example.administrator.chushi.utils.MyUtils; import com.google.gson.Gson; import com.lzy.okgo.OkGo; import com.lzy.okgo.callback.StringCallback; import java.util.List; import okhttp3.Call; import okhttp3.Response; public class CheckAddressActivity extends BaseActivity implements View.OnClickListener { private RecyclerView address_recycler; private MyAddressAdapter myAddressAdapter; private ImageView tv_back; private TextView add_address; private List<AddressLieBiaoBean.DataBean> data; private String userid; private String token; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_check_address); initView(); initData(); } private void initView() { add_address= (TextView) findViewById(R.id.add_address); add_address.setOnClickListener(this); tv_back= (ImageView) findViewById(R.id.tv_back); tv_back.setOnClickListener(this); address_recycler= (RecyclerView) findViewById(R.id.address_recycler); initNet(); } private void initNet() { userid = MyUtils.getUserid(this); token = MyUtils.getToken(this); OkGo.get(MyContants.BASEURL + "Address/lists/") .tag(this) .params("userid", userid) .params("token", token) .execute(new StringCallback() { @Override public void onSuccess(String s, Call call, Response response) { Gson gson = new Gson(); AddressLieBiaoBean addressLieBiaoBean = gson.fromJson(s, AddressLieBiaoBean.class); if (addressLieBiaoBean.getCode() == 200) { data = addressLieBiaoBean.getData(); } else { Toast.makeText(CheckAddressActivity.this, "还没有添加地址呢,快去添加吧", Toast.LENGTH_SHORT).show(); } initData(); } @Override public void onError(Call call, Response response, Exception e) { Toast.makeText(CheckAddressActivity.this, "请检查网络或重试", Toast.LENGTH_SHORT).show(); Log.e("请求失败", "失败原因:" + response); } }); } private void initData() { myAddressAdapter = new MyAddressAdapter(R.layout.check_address_item, data); address_recycler.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false)); address_recycler.setNestedScrollingEnabled(false); address_recycler.setAdapter(myAddressAdapter); myAddressAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { Intent intent = getIntent(); if (data.size()<=0){ intent.putExtra("username",""); intent.putExtra("mobile", ""); intent.putExtra("address",""); intent.putExtra("area", ""); intent.putExtra("c_id",""); intent.putExtra("v_id",""); intent.putExtra("x_id",""); }else { intent.putExtra("username", data.get(position).getUsername()); intent.putExtra("mobile", data.get(position).getMobile()); intent.putExtra("address", data.get(position).getAddress()); intent.putExtra("area", data.get(position).getArea()); intent.putExtra("c_id", data.get(position).getC_id()); intent.putExtra("v_id", data.get(position).getV_id()); intent.putExtra("x_id", data.get(position).getX_id()); } setResult(0, intent); finish(); } }); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.tv_back: Intent intent = getIntent(); intent.putExtra("username", ""); setResult(0, intent); finish(); break; case R.id.add_address: Intent intent1=new Intent(CheckAddressActivity.this,BianJiAddressActivity.class); intent1.putExtra("username", ""); startActivityForResult(intent1,0); break; } } @Override public void onBackPressed() { Intent intent = getIntent(); intent.putExtra("username", ""); setResult(0, intent); super.onBackPressed(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null) { initNet(); } } class MyAddressAdapter extends BaseQuickAdapter<AddressLieBiaoBean.DataBean, BaseViewHolder>{ public MyAddressAdapter(@LayoutRes int layoutResId, @Nullable List<AddressLieBiaoBean.DataBean> data) { super(layoutResId, data); } @Override protected void convert(BaseViewHolder helper, AddressLieBiaoBean.DataBean item) { helper.setText(R.id.tv_name,item.getUsername()); helper.setText(R.id.tv_phone,item.getMobile()); helper.setText(R.id.tv_address, item.getArea() + "" + item.getAddress()); TextView tv_moren = helper.getView(R.id.tv_moren); String status = item.getStatus(); tv_moren.setText(status); if (status.equals("1")){ tv_moren.setText("默认地址"); }else if (status.equals("0")){ tv_moren.setText(""); } } } }
6,838
0.595597
0.593085
169
39.047337
26.9652
115
false
false
0
0
0
0
0
0
0.87574
false
false
4
e39cfff30d5ab4796914b6feb95b97fb8664737a
19,988,777,832,604
c146f5aa0a1ea4503ce9f66c2141c0ad289f21e0
/src/main/java/hard/Shortest_Distance_from_All_Buildings_317.java
2b7ab5690ba87eb32dc886ce6472f655a924acf3
[]
no_license
chenlijie/leetcode
https://github.com/chenlijie/leetcode
f59bd06ad800caa5a431fa0ff343838ce46a2312
6f298e94f9290294dd590515f8d734bc2fcb7329
refs/heads/master
2021-01-20T14:16:09.788000
2020-01-14T00:15:47
2020-01-14T00:15:47
78,302,178
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hard; import com.sun.org.apache.xerces.internal.impl.xpath.regex.Match; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; /** * Created by chenlijie on 11/18/17. */ public class Shortest_Distance_from_All_Buildings_317 { static int shortestDistance(int[][] grid) { int m = grid.length; int n = grid[0].length; int[][] dis = new int[m][n]; int start = 0; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == 1) { bfs(grid, dis, i, j, start--, m, n); } } } return min; } static int min = Integer.MAX_VALUE; static int[][] dirs = new int[][] { {1,0}, {-1,0}, {0,1}, {0,-1}}; static void bfs(int[][] grid, int[][] dis, int i, int j, int start, int m, int n) { Queue<int[]> queue = new LinkedList<>(); queue.add(new int[]{i, j}); int level = 0; min = Integer.MAX_VALUE; while (!queue.isEmpty()) { level++; int size = queue.size(); for (int k = 0; k < size; k++) { int[] cur = queue.poll(); for (int[] d : dirs) { int d1 = cur[0] + d[0]; int d2 = cur[1] + d[1]; if (d1 >= 0 && d1 < m && d2 >= 0 && d2 < n && grid[d1][d2] == start) { grid[d1][d2] -= 1; dis[d1][d2] += level; min = Math.min(min, dis[d1][d2]); queue.offer(new int[]{d1, d2}); } } } } } public static void main(String[] args) { int[][] grid = new int[][] { {1, 0, 2, 0, 1}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0} }; System.out.println(shortestDistance(grid)); } }
UTF-8
Java
1,977
java
Shortest_Distance_from_All_Buildings_317.java
Java
[ { "context": "l.List;\nimport java.util.Queue;\n\n/**\n * Created by chenlijie on 11/18/17.\n */\npublic class Shortest_Distance_f", "end": 214, "score": 0.9991878867149353, "start": 205, "tag": "USERNAME", "value": "chenlijie" } ]
null
[]
package hard; import com.sun.org.apache.xerces.internal.impl.xpath.regex.Match; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; /** * Created by chenlijie on 11/18/17. */ public class Shortest_Distance_from_All_Buildings_317 { static int shortestDistance(int[][] grid) { int m = grid.length; int n = grid[0].length; int[][] dis = new int[m][n]; int start = 0; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == 1) { bfs(grid, dis, i, j, start--, m, n); } } } return min; } static int min = Integer.MAX_VALUE; static int[][] dirs = new int[][] { {1,0}, {-1,0}, {0,1}, {0,-1}}; static void bfs(int[][] grid, int[][] dis, int i, int j, int start, int m, int n) { Queue<int[]> queue = new LinkedList<>(); queue.add(new int[]{i, j}); int level = 0; min = Integer.MAX_VALUE; while (!queue.isEmpty()) { level++; int size = queue.size(); for (int k = 0; k < size; k++) { int[] cur = queue.poll(); for (int[] d : dirs) { int d1 = cur[0] + d[0]; int d2 = cur[1] + d[1]; if (d1 >= 0 && d1 < m && d2 >= 0 && d2 < n && grid[d1][d2] == start) { grid[d1][d2] -= 1; dis[d1][d2] += level; min = Math.min(min, dis[d1][d2]); queue.offer(new int[]{d1, d2}); } } } } } public static void main(String[] args) { int[][] grid = new int[][] { {1, 0, 2, 0, 1}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0} }; System.out.println(shortestDistance(grid)); } }
1,977
0.414264
0.382903
75
25.360001
21.935444
90
false
false
0
0
0
0
0
0
0.946667
false
false
4
cee81218fc47df0978ef7d1e36566ac12ca196c0
19,988,777,832,195
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes9.dex_source_from_JADX/com/facebook/messaging/payment/awareness/PaymentAwarenessFragment.java
c5fc4f2083554e97798d54c10e141133ef59ae3c
[]
no_license
pxson001/facebook-app
https://github.com/pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758000
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.facebook.messaging.payment.awareness; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.facebook.base.fragment.FbFragment; import com.facebook.inject.FbInjector; import com.facebook.loom.logger.LogEntry.EntryType; import com.facebook.loom.logger.Logger; /* compiled from: interstitialInfo */ public class PaymentAwarenessFragment extends FbFragment { public Listener f12812a; /* compiled from: interstitialInfo */ public interface Listener { void mo508a(); } /* compiled from: interstitialInfo */ public class C14411 { public final /* synthetic */ PaymentAwarenessFragment f12810a; C14411(PaymentAwarenessFragment paymentAwarenessFragment) { this.f12810a = paymentAwarenessFragment; } } public static PaymentAwarenessFragment m13152a(PaymentAwarenessMode paymentAwarenessMode) { Bundle bundle = new Bundle(); bundle.putSerializable("payment_awareness_mode", paymentAwarenessMode); PaymentAwarenessFragment paymentAwarenessFragment = new PaymentAwarenessFragment(); paymentAwarenessFragment.g(bundle); return paymentAwarenessFragment; } public final void m13156c(@Nullable Bundle bundle) { super.c(bundle); Class cls = PaymentAwarenessFragment.class; FbInjector.get(getContext()); } public final View m13154a(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { int a = Logger.a(2, EntryType.LIFECYCLE_FRAGMENT_START, 995844986); View inflate = layoutInflater.inflate(2130903324, viewGroup, false); Logger.a(2, EntryType.LIFECYCLE_FRAGMENT_END, 1696367118, a); return inflate; } public final void m13155a(View view, @Nullable Bundle bundle) { super.a(view, bundle); PaymentAwarenessView b = m13153b((PaymentAwarenessMode) this.s.getSerializable("payment_awareness_mode")); b.setListener(new C14411(this)); ((ViewGroup) view.findViewById(2131559223)).addView((View) b); } private PaymentAwarenessView m13153b(PaymentAwarenessMode paymentAwarenessMode) { PaymentAwarenessView defaultPaymentAwarenessView; DefaultPaymentAwarenessViewParamsBuilder newBuilder; switch (paymentAwarenessMode) { case GROUP_COMMERCE: defaultPaymentAwarenessView = new DefaultPaymentAwarenessView(getContext()); newBuilder = DefaultPaymentAwarenessViewParams.newBuilder(); newBuilder.f12796a = b(2131241063); newBuilder = newBuilder; newBuilder.f12798c = new PaymentAwarenessRow(2131241064, 2130841205); newBuilder = newBuilder; newBuilder.f12799d = new PaymentAwarenessRow(2131241065, 2130840384); newBuilder = newBuilder; newBuilder.f12800e = new PaymentAwarenessRow(2131241066, 2130838384); newBuilder = newBuilder; newBuilder.f12801f = 2131241067; newBuilder = newBuilder; newBuilder.f12802g = 2130904645; defaultPaymentAwarenessView.setViewParams(newBuilder.m13140h()); return defaultPaymentAwarenessView; case ORION_SEND: defaultPaymentAwarenessView = new DefaultPaymentAwarenessView(getContext()); newBuilder = DefaultPaymentAwarenessViewParams.newBuilder(); newBuilder.f12796a = b(2131241056); newBuilder = newBuilder; newBuilder.f12797b = b(2131241057); newBuilder = newBuilder; newBuilder.f12798c = new PaymentAwarenessRow(2131241058, 2130838043); newBuilder = newBuilder; newBuilder.f12799d = new PaymentAwarenessRow(2131241059, 2130840384); newBuilder = newBuilder; newBuilder.f12800e = new PaymentAwarenessRow(2131241060, 2130838384); newBuilder = newBuilder; newBuilder.f12801f = 2131241062; newBuilder = newBuilder; newBuilder.f12802g = 2130905929; defaultPaymentAwarenessView.setViewParams(newBuilder.m13140h()); return defaultPaymentAwarenessView; default: throw new IllegalArgumentException("Invalid PaymentAwarenessMode provided: " + paymentAwarenessMode); } } }
UTF-8
Java
4,553
java
PaymentAwarenessFragment.java
Java
[]
null
[]
package com.facebook.messaging.payment.awareness; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.facebook.base.fragment.FbFragment; import com.facebook.inject.FbInjector; import com.facebook.loom.logger.LogEntry.EntryType; import com.facebook.loom.logger.Logger; /* compiled from: interstitialInfo */ public class PaymentAwarenessFragment extends FbFragment { public Listener f12812a; /* compiled from: interstitialInfo */ public interface Listener { void mo508a(); } /* compiled from: interstitialInfo */ public class C14411 { public final /* synthetic */ PaymentAwarenessFragment f12810a; C14411(PaymentAwarenessFragment paymentAwarenessFragment) { this.f12810a = paymentAwarenessFragment; } } public static PaymentAwarenessFragment m13152a(PaymentAwarenessMode paymentAwarenessMode) { Bundle bundle = new Bundle(); bundle.putSerializable("payment_awareness_mode", paymentAwarenessMode); PaymentAwarenessFragment paymentAwarenessFragment = new PaymentAwarenessFragment(); paymentAwarenessFragment.g(bundle); return paymentAwarenessFragment; } public final void m13156c(@Nullable Bundle bundle) { super.c(bundle); Class cls = PaymentAwarenessFragment.class; FbInjector.get(getContext()); } public final View m13154a(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { int a = Logger.a(2, EntryType.LIFECYCLE_FRAGMENT_START, 995844986); View inflate = layoutInflater.inflate(2130903324, viewGroup, false); Logger.a(2, EntryType.LIFECYCLE_FRAGMENT_END, 1696367118, a); return inflate; } public final void m13155a(View view, @Nullable Bundle bundle) { super.a(view, bundle); PaymentAwarenessView b = m13153b((PaymentAwarenessMode) this.s.getSerializable("payment_awareness_mode")); b.setListener(new C14411(this)); ((ViewGroup) view.findViewById(2131559223)).addView((View) b); } private PaymentAwarenessView m13153b(PaymentAwarenessMode paymentAwarenessMode) { PaymentAwarenessView defaultPaymentAwarenessView; DefaultPaymentAwarenessViewParamsBuilder newBuilder; switch (paymentAwarenessMode) { case GROUP_COMMERCE: defaultPaymentAwarenessView = new DefaultPaymentAwarenessView(getContext()); newBuilder = DefaultPaymentAwarenessViewParams.newBuilder(); newBuilder.f12796a = b(2131241063); newBuilder = newBuilder; newBuilder.f12798c = new PaymentAwarenessRow(2131241064, 2130841205); newBuilder = newBuilder; newBuilder.f12799d = new PaymentAwarenessRow(2131241065, 2130840384); newBuilder = newBuilder; newBuilder.f12800e = new PaymentAwarenessRow(2131241066, 2130838384); newBuilder = newBuilder; newBuilder.f12801f = 2131241067; newBuilder = newBuilder; newBuilder.f12802g = 2130904645; defaultPaymentAwarenessView.setViewParams(newBuilder.m13140h()); return defaultPaymentAwarenessView; case ORION_SEND: defaultPaymentAwarenessView = new DefaultPaymentAwarenessView(getContext()); newBuilder = DefaultPaymentAwarenessViewParams.newBuilder(); newBuilder.f12796a = b(2131241056); newBuilder = newBuilder; newBuilder.f12797b = b(2131241057); newBuilder = newBuilder; newBuilder.f12798c = new PaymentAwarenessRow(2131241058, 2130838043); newBuilder = newBuilder; newBuilder.f12799d = new PaymentAwarenessRow(2131241059, 2130840384); newBuilder = newBuilder; newBuilder.f12800e = new PaymentAwarenessRow(2131241060, 2130838384); newBuilder = newBuilder; newBuilder.f12801f = 2131241062; newBuilder = newBuilder; newBuilder.f12802g = 2130905929; defaultPaymentAwarenessView.setViewParams(newBuilder.m13140h()); return defaultPaymentAwarenessView; default: throw new IllegalArgumentException("Invalid PaymentAwarenessMode provided: " + paymentAwarenessMode); } } }
4,553
0.67494
0.593894
101
44.079208
29.099585
117
false
false
0
0
0
0
0
0
0.821782
false
false
4
0980f98593e8f2f32879cf3a9bab571d134b5a1f
26,190,710,596,957
37c6c0f2bf5143e5fdca5f5cd3852293376d1374
/app/src/main/java/my/dzeko/timetable/wrappers/SharedPreferencesWrapper.java
a3badc952dd3a544e9234b2ba1b7cc4f40952a3f
[]
no_license
dzeko14/timetable
https://github.com/dzeko14/timetable
e889442a8f7f53f5626dacc7c6321f4ba311b799
d63ff1cd1f0db5c6c8364cc6e4684c793a8c82c1
refs/heads/master
2021-07-18T21:32:28.359000
2018-12-05T23:08:02
2018-12-05T23:08:02
140,744,472
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package my.dzeko.timetable.wrappers; import android.content.Context; import android.content.SharedPreferences; import android.support.v7.preference.PreferenceManager; import my.dzeko.timetable.R; public class SharedPreferencesWrapper { private static final String SELECTED_GROUP = "selected_group"; private static final String KEY_DATE = "key_date"; private static final String SELECTED_BOTTOM_NAV_FRAGMENT = "selected_bottom_fragment"; private static String CURRENT_WEEK_KEY; private static String FIRST_WEEK_VALUE; private static String SECOND_WEEK_VALUE; private static String SUBJECT_NOTIFICATION_TIME_KEY; private static SharedPreferencesWrapper mInstance; private SharedPreferencesWrapper(){ } public static void initialize(Context context) { if (mInstance != null) return; mInstance = new SharedPreferencesWrapper(); mInstance.mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); CURRENT_WEEK_KEY = context.getString(R.string.weeks_prefs_key); FIRST_WEEK_VALUE = context.getString(R.string.first_week_prefs_value); SECOND_WEEK_VALUE = context.getString(R.string.second_week_prefs_value); SUBJECT_NOTIFICATION_TIME_KEY = context.getString(R.string.next_subject_time_key); } public static SharedPreferencesWrapper getInstance(){ return mInstance; } private SharedPreferences mSharedPreferences; public void setSelectedGroup(String group) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putString(SELECTED_GROUP, group); editor.apply(); } public String getSelectedGroup() { return mSharedPreferences.getString(SELECTED_GROUP, null); } public void removeSelectedGroup() { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.remove(SELECTED_GROUP); editor.apply(); } public void setKeyDate(long keyDateLong) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putLong(KEY_DATE, keyDateLong); editor.apply(); } public long getKeyDate() { return mSharedPreferences.getLong(KEY_DATE, -1); } public void setSelectedFragment(int fragmentId) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putInt(SELECTED_BOTTOM_NAV_FRAGMENT, fragmentId); editor.apply(); } public int getSelectedFragmentId() { return mSharedPreferences.getInt(SELECTED_BOTTOM_NAV_FRAGMENT, -1); } public void registerChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener){ mSharedPreferences.registerOnSharedPreferenceChangeListener(listener); } public void unregisterChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener){ mSharedPreferences.unregisterOnSharedPreferenceChangeListener(listener); } public void setCurrentWeek(boolean isFirstWeek){ SharedPreferences.Editor editor = mSharedPreferences.edit(); if (isFirstWeek) { editor.putString(CURRENT_WEEK_KEY, FIRST_WEEK_VALUE); } else { editor.putString(CURRENT_WEEK_KEY, SECOND_WEEK_VALUE); } editor.apply(); } public int getSubjectNotificationTime(){ return Integer.parseInt(mSharedPreferences.getString(SUBJECT_NOTIFICATION_TIME_KEY, "21")); } }
UTF-8
Java
3,448
java
SharedPreferencesWrapper.java
Java
[]
null
[]
package my.dzeko.timetable.wrappers; import android.content.Context; import android.content.SharedPreferences; import android.support.v7.preference.PreferenceManager; import my.dzeko.timetable.R; public class SharedPreferencesWrapper { private static final String SELECTED_GROUP = "selected_group"; private static final String KEY_DATE = "key_date"; private static final String SELECTED_BOTTOM_NAV_FRAGMENT = "selected_bottom_fragment"; private static String CURRENT_WEEK_KEY; private static String FIRST_WEEK_VALUE; private static String SECOND_WEEK_VALUE; private static String SUBJECT_NOTIFICATION_TIME_KEY; private static SharedPreferencesWrapper mInstance; private SharedPreferencesWrapper(){ } public static void initialize(Context context) { if (mInstance != null) return; mInstance = new SharedPreferencesWrapper(); mInstance.mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); CURRENT_WEEK_KEY = context.getString(R.string.weeks_prefs_key); FIRST_WEEK_VALUE = context.getString(R.string.first_week_prefs_value); SECOND_WEEK_VALUE = context.getString(R.string.second_week_prefs_value); SUBJECT_NOTIFICATION_TIME_KEY = context.getString(R.string.next_subject_time_key); } public static SharedPreferencesWrapper getInstance(){ return mInstance; } private SharedPreferences mSharedPreferences; public void setSelectedGroup(String group) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putString(SELECTED_GROUP, group); editor.apply(); } public String getSelectedGroup() { return mSharedPreferences.getString(SELECTED_GROUP, null); } public void removeSelectedGroup() { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.remove(SELECTED_GROUP); editor.apply(); } public void setKeyDate(long keyDateLong) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putLong(KEY_DATE, keyDateLong); editor.apply(); } public long getKeyDate() { return mSharedPreferences.getLong(KEY_DATE, -1); } public void setSelectedFragment(int fragmentId) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putInt(SELECTED_BOTTOM_NAV_FRAGMENT, fragmentId); editor.apply(); } public int getSelectedFragmentId() { return mSharedPreferences.getInt(SELECTED_BOTTOM_NAV_FRAGMENT, -1); } public void registerChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener){ mSharedPreferences.registerOnSharedPreferenceChangeListener(listener); } public void unregisterChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener){ mSharedPreferences.unregisterOnSharedPreferenceChangeListener(listener); } public void setCurrentWeek(boolean isFirstWeek){ SharedPreferences.Editor editor = mSharedPreferences.edit(); if (isFirstWeek) { editor.putString(CURRENT_WEEK_KEY, FIRST_WEEK_VALUE); } else { editor.putString(CURRENT_WEEK_KEY, SECOND_WEEK_VALUE); } editor.apply(); } public int getSubjectNotificationTime(){ return Integer.parseInt(mSharedPreferences.getString(SUBJECT_NOTIFICATION_TIME_KEY, "21")); } }
3,448
0.718097
0.716647
97
34.546391
30.207537
102
false
false
0
0
0
0
0
0
0.546392
false
false
4
99c74c72c539c0cd80b5f40e99adb506a522bdf6
19,988,777,836,074
25947d36e383ce8fcc9a5298cafda3eab60427c5
/AndroidNetworkManager/src/main/java/aaverin/android/net/AbstractNetworkManager.java
b4705a83eb92cd7e13cc3f717d4bd8f4bcd0f93a
[]
no_license
AAverin/android-rest-test
https://github.com/AAverin/android-rest-test
5c9b08eadf0fb537be5580d8609ffece08eb389c
8cd5b3d201b97edc2dddf95c7432a89ff5e022fd
refs/heads/master
2020-04-06T04:31:30.120000
2016-01-05T19:20:35
2016-01-05T19:20:35
16,002,810
5
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @author Anton Averin <a.a.averin@gmail.com> * <p/> * Basic Network Manager abstraction - interface for possible implementations */ package aaverin.android.net; public abstract class AbstractNetworkManager { public abstract void subscribe(NetworkListener listener); public abstract void unsubscribe(NetworkListener listener); public abstract boolean isSubscribed(NetworkListener listener); public abstract void clearListeners(); public abstract void putMessage(NetworkMessage message); public abstract void releaseQueue(); protected abstract void sendMessage(final NetworkMessage message); protected abstract void sendNextMessage(); public abstract void close(); }
UTF-8
Java
751
java
AbstractNetworkManager.java
Java
[ { "context": "/**\r\n * @author Anton Averin <a.a.averin@gmail.com>\r\n * <p/>\r\n * Basic Network", "end": 28, "score": 0.9998893737792969, "start": 16, "tag": "NAME", "value": "Anton Averin" }, { "context": "/**\r\n * @author Anton Averin <a.a.averin@gmail.com>\r\n * <p/>\r\n * Bas...
null
[]
/** * @author <NAME> <<EMAIL>> * <p/> * Basic Network Manager abstraction - interface for possible implementations */ package aaverin.android.net; public abstract class AbstractNetworkManager { public abstract void subscribe(NetworkListener listener); public abstract void unsubscribe(NetworkListener listener); public abstract boolean isSubscribed(NetworkListener listener); public abstract void clearListeners(); public abstract void putMessage(NetworkMessage message); public abstract void releaseQueue(); protected abstract void sendMessage(final NetworkMessage message); protected abstract void sendNextMessage(); public abstract void close(); }
732
0.732357
0.732357
29
23.896551
27.355066
77
false
false
0
0
0
0
0
0
0.344828
false
false
4
237fc79e84d84edb4b48887762109907d2461789
25,520,695,707,107
0ac51cd023350ca440eb4fb041d8a5837796729c
/src/main/java/com/traiana/stash/api/TagComparator.java
107fb74c5317689c9f81ca32815aa8288c1462bb
[]
no_license
nipponilyal/stash-utils
https://github.com/nipponilyal/stash-utils
8bf35fa751951c277f92fdad3a7e95eed9cbb7f7
d3233d8a2e8c88f2b41c5639d27d919ecb8dc30d
HEAD
2016-08-24T02:58:01.459000
2016-07-16T07:47:32
2016-07-16T07:47:32
62,967,672
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.traiana.stash.api; import java.util.Comparator; import java.util.List; /** * Created by ilyal on 12/11/2015. */ public class TagComparator implements Comparator<String> { public boolean equals(TagComparator comparator){ return true; } /* Compare the following tags type by 1.2.3.4: - APP_NAME-1.2.3.4 - APP_NAME-1.2.3.4-5.6.7.8 */ public int compare(String tag1, String tag2){ String [] _tag1 = tag1.split("-"); String [] _tag2 = tag2.split("-"); int j=1; if (_tag1.length == 3 && _tag2.length == 3) j=2; String version1 = _tag1[_tag1.length-j]; String version2 = _tag2[_tag2.length-j]; String [] _version1 = version1.split("\\."); String [] _version2 = version2.split("\\."); for (int i=0;i<_version1.length;i++){ if (Integer.valueOf(_version1[i]) > Integer.valueOf(_version2[i])){ return 1; } else if (Integer.valueOf(_version1[i]) < Integer.valueOf(_version2[i])){ return -1; } } return 0; } }
UTF-8
Java
1,144
java
TagComparator.java
Java
[ { "context": "arator;\nimport java.util.List;\n\n/**\n * Created by ilyal on 12/11/2015.\n */\npublic class TagComparator imp", "end": 108, "score": 0.9962440729141235, "start": 103, "tag": "USERNAME", "value": "ilyal" } ]
null
[]
package com.traiana.stash.api; import java.util.Comparator; import java.util.List; /** * Created by ilyal on 12/11/2015. */ public class TagComparator implements Comparator<String> { public boolean equals(TagComparator comparator){ return true; } /* Compare the following tags type by 1.2.3.4: - APP_NAME-1.2.3.4 - APP_NAME-1.2.3.4-5.6.7.8 */ public int compare(String tag1, String tag2){ String [] _tag1 = tag1.split("-"); String [] _tag2 = tag2.split("-"); int j=1; if (_tag1.length == 3 && _tag2.length == 3) j=2; String version1 = _tag1[_tag1.length-j]; String version2 = _tag2[_tag2.length-j]; String [] _version1 = version1.split("\\."); String [] _version2 = version2.split("\\."); for (int i=0;i<_version1.length;i++){ if (Integer.valueOf(_version1[i]) > Integer.valueOf(_version2[i])){ return 1; } else if (Integer.valueOf(_version1[i]) < Integer.valueOf(_version2[i])){ return -1; } } return 0; } }
1,144
0.536713
0.488636
44
25
23.127119
84
false
false
0
0
0
0
0
0
0.409091
false
false
4
61addfbad4f0f8530dac1a7d27d46e5845c8fced
21,904,333,240,093
3f3eb3acde241e9eb838423b193e21f1422cb62f
/src/main/java/ismetsandikci/hrmanagementsystem/api/controllers/JobPostingsController.java
d26297afd4c996745c2e65fcbeae1d2837b052d9
[]
no_license
ismetsandikci/hr-management-system
https://github.com/ismetsandikci/hr-management-system
70b869c18e1411597b84e0d8966eea5e349804f1
51db15f3f73892b6fc35e1af3508644ae1f0300e
refs/heads/main
2023-06-08T11:15:38.869000
2021-06-27T06:01:44
2021-06-27T06:01:44
367,112,758
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ismetsandikci.hrmanagementsystem.api.controllers; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import ismetsandikci.hrmanagementsystem.business.abstracts.JobPostingService; import ismetsandikci.hrmanagementsystem.core.utilities.results.DataResult; import ismetsandikci.hrmanagementsystem.core.utilities.results.Result; import ismetsandikci.hrmanagementsystem.entities.concretes.JobPosting; import ismetsandikci.hrmanagementsystem.entities.dtos.JobPostingListDto; @RestController @RequestMapping("/api/jobpostings") @CrossOrigin public class JobPostingsController { private JobPostingService jobPostingService; @Autowired public JobPostingsController(JobPostingService jobPostingService) { super(); this.jobPostingService = jobPostingService; } @GetMapping("/getall") public DataResult<List<JobPosting>> getAll() { return this.jobPostingService.getAll(); } @GetMapping("/getById") public DataResult<JobPosting> getById(@RequestParam int id) { return this.jobPostingService.getById(id); } @GetMapping("/getByIsActiveTrue") public DataResult<List<JobPostingListDto>> getByIsActiveTrue() { return this.jobPostingService.getByIsActiveTrue(); } @GetMapping("/getAllByEmployerIdDto") public DataResult<List<JobPostingListDto>> getAllByEmployerIdDto(@RequestParam int employerId) { return this.jobPostingService.getAllByEmployerIdDto(employerId); } @GetMapping("/getByEmployer_IdAndIsActiveTrue") public DataResult<List<JobPostingListDto>> getByEmployer_IdAndIsActiveTrue(@RequestParam int employerId) { return this.jobPostingService.getByEmployer_IdAndIsActiveTrue(employerId); } @GetMapping("/getActiveSortedByCreatedDate") public DataResult<List<JobPostingListDto>> getActiveSortedByCreatedDate() { return this.jobPostingService.getActiveSortedByCreatedDate(); } /* @PostMapping("/changeStatus") public boolean changeStatus(@RequestParam int employerId, @RequestParam int jobPostingId, @RequestParam boolean status) { return this.jobPostingService.changeStatus(employerId, jobPostingId, status ); } */ @PostMapping("/add") public Result add(@RequestBody JobPosting jobPosting){ return this.jobPostingService.add(jobPosting); } }
UTF-8
Java
2,683
java
JobPostingsController.java
Java
[]
null
[]
package ismetsandikci.hrmanagementsystem.api.controllers; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import ismetsandikci.hrmanagementsystem.business.abstracts.JobPostingService; import ismetsandikci.hrmanagementsystem.core.utilities.results.DataResult; import ismetsandikci.hrmanagementsystem.core.utilities.results.Result; import ismetsandikci.hrmanagementsystem.entities.concretes.JobPosting; import ismetsandikci.hrmanagementsystem.entities.dtos.JobPostingListDto; @RestController @RequestMapping("/api/jobpostings") @CrossOrigin public class JobPostingsController { private JobPostingService jobPostingService; @Autowired public JobPostingsController(JobPostingService jobPostingService) { super(); this.jobPostingService = jobPostingService; } @GetMapping("/getall") public DataResult<List<JobPosting>> getAll() { return this.jobPostingService.getAll(); } @GetMapping("/getById") public DataResult<JobPosting> getById(@RequestParam int id) { return this.jobPostingService.getById(id); } @GetMapping("/getByIsActiveTrue") public DataResult<List<JobPostingListDto>> getByIsActiveTrue() { return this.jobPostingService.getByIsActiveTrue(); } @GetMapping("/getAllByEmployerIdDto") public DataResult<List<JobPostingListDto>> getAllByEmployerIdDto(@RequestParam int employerId) { return this.jobPostingService.getAllByEmployerIdDto(employerId); } @GetMapping("/getByEmployer_IdAndIsActiveTrue") public DataResult<List<JobPostingListDto>> getByEmployer_IdAndIsActiveTrue(@RequestParam int employerId) { return this.jobPostingService.getByEmployer_IdAndIsActiveTrue(employerId); } @GetMapping("/getActiveSortedByCreatedDate") public DataResult<List<JobPostingListDto>> getActiveSortedByCreatedDate() { return this.jobPostingService.getActiveSortedByCreatedDate(); } /* @PostMapping("/changeStatus") public boolean changeStatus(@RequestParam int employerId, @RequestParam int jobPostingId, @RequestParam boolean status) { return this.jobPostingService.changeStatus(employerId, jobPostingId, status ); } */ @PostMapping("/add") public Result add(@RequestBody JobPosting jobPosting){ return this.jobPostingService.add(jobPosting); } }
2,683
0.819605
0.819605
74
35.256756
31.455271
122
false
false
0
0
0
0
0
0
1.135135
false
false
4
a80fa5ee68be37d75717dc0a80b1ecc2fc82faf5
13,176,959,696,287
bc8ce01b20941d799114d46738329b78b3ab0e4b
/client/src/main/java/class158.java
f0df24fd7cbfeb5526de29aa8b98de20b49151d1
[]
permissive
rsbox/rsbox
https://github.com/rsbox/rsbox
dd8d87112066f2a7719221d705e5a77e62cbdfa5
7961e53f4e9c132b1f140dca7250d9dcf0b0f7bb
refs/heads/master
2023-08-17T04:04:23.631000
2023-08-09T16:31:04
2023-08-09T16:31:04
197,709,170
3
3
Apache-2.0
false
2019-07-19T14:43:43
2019-07-19T05:43:31
2019-07-19T13:46:06
2019-07-19T14:43:42
60
2
1
0
Kotlin
false
false
public class class158 extends class179 { int field1743; // $FF: synthetic field final class173 this$0; class158(class173 var1, String var2, int var3) { super(var1, var2); this.this$0 = var1; this.field1743 = var3; } public int method3416() { return 0; } public int method3418() { return this.field1743; } }
UTF-8
Java
367
java
class158.java
Java
[]
null
[]
public class class158 extends class179 { int field1743; // $FF: synthetic field final class173 this$0; class158(class173 var1, String var2, int var3) { super(var1, var2); this.this$0 = var1; this.field1743 = var3; } public int method3416() { return 0; } public int method3418() { return this.field1743; } }
367
0.610354
0.487738
19
18.31579
14.56041
51
false
false
0
0
0
0
0
0
0.526316
false
false
4
522932bd9a9640abbfa9ad74ba4106a179a1d83c
19,292,993,121,139
c32d1d567d12928ffe7b52ffe09de9a64db0b39e
/new/201907/src/函数式编程/MessageBuilder.java
5b764fe4b58c4bf63b56991fee08e11040225769
[]
no_license
madokast/JavaLearning
https://github.com/madokast/JavaLearning
fdafb1f1770ff4839898bbfacaec25dd651a72e6
b6c419e152f13c2d8688644b102b80624ae8b433
refs/heads/master
2022-12-24T13:14:44.659000
2020-01-03T07:10:18
2020-01-03T07:10:18
159,938,675
0
0
null
false
2022-12-16T06:44:43
2018-12-01T11:40:59
2020-01-03T07:11:10
2022-12-16T06:44:40
381,292
0
0
74
HTML
false
false
package 函数式编程; /** * 利用 lambda 优化日志案例 * 延迟加载案例 */ public interface MessageBuilder { //拼接消息 String builderMessage(); }
UTF-8
Java
177
java
MessageBuilder.java
Java
[]
null
[]
package 函数式编程; /** * 利用 lambda 优化日志案例 * 延迟加载案例 */ public interface MessageBuilder { //拼接消息 String builderMessage(); }
177
0.648855
0.648855
11
10.909091
10.958222
33
false
false
0
0
0
0
0
0
0.181818
false
false
4
75984fa1c45ba814dd52ebe8a198edf87f12d67c
24,421,184,100,687
197eb95289c580fcf187ba94111f8ccc8b4d2551
/spring_base/ch4/src/main/java/com/fastcampus/ch4/dao/CommentDaoImpl.java
d2cacd96804af5ad2528be9a2d6b6e02dd5cf134
[]
no_license
kimhyonseong/basic
https://github.com/kimhyonseong/basic
0b322e7cabfb6a8e78e7a467f29f4d23328beb01
83b91ceb3e5616b1c05914e9a58f2a76cb2d95d0
refs/heads/master
2023-03-18T06:18:48.629000
2022-06-27T07:06:50
2022-06-27T07:06:50
251,600,863
0
0
null
false
2023-03-06T19:21:26
2020-03-31T12:48:10
2022-02-15T13:33:51
2023-03-06T19:21:19
59,330
0
0
57
Java
false
false
package com.fastcampus.ch4.dao; import com.fastcampus.ch4.domain.CommentDto; import org.apache.ibatis.session.*; import org.springframework.beans.factory.annotation.*; import org.springframework.stereotype.*; import java.util.*; @Repository public class CommentDaoImpl implements CommentDao { @Autowired private SqlSession session; private static String namespace = "com.fastcampus.ch4.dao.CommentMapper."; @Override public int count(Integer bno) throws Exception { return session.selectOne(namespace+"count", bno); } // T selectOne(String statement) @Override public int deleteAll(Integer bno) { return session.delete(namespace+"deleteAll", bno); } // int delete(String statement) @Override public int delete(Integer cno, String commenter) throws Exception { Map map = new HashMap(); map.put("cno", cno); map.put("commenter", commenter); return session.delete(namespace+"delete", map); } // int delete(String statement, Object parameter) @Override public int insert(CommentDto dto) throws Exception { return session.insert(namespace+"insert", dto); } // int insert(String statement, Object parameter) @Override public List<CommentDto> selectAll(Integer bno) throws Exception { return session.selectList(namespace+"selectAll", bno); } // List<E> selectList(String statement) @Override public CommentDto select(Integer cno) throws Exception { return session.selectOne(namespace + "select", cno); } // T selectOne(String statement, Object parameter) @Override public int update(CommentDto dto) throws Exception { return session.update(namespace+"update", dto); } // int update(String statement, Object parameter) }
UTF-8
Java
1,798
java
CommentDaoImpl.java
Java
[]
null
[]
package com.fastcampus.ch4.dao; import com.fastcampus.ch4.domain.CommentDto; import org.apache.ibatis.session.*; import org.springframework.beans.factory.annotation.*; import org.springframework.stereotype.*; import java.util.*; @Repository public class CommentDaoImpl implements CommentDao { @Autowired private SqlSession session; private static String namespace = "com.fastcampus.ch4.dao.CommentMapper."; @Override public int count(Integer bno) throws Exception { return session.selectOne(namespace+"count", bno); } // T selectOne(String statement) @Override public int deleteAll(Integer bno) { return session.delete(namespace+"deleteAll", bno); } // int delete(String statement) @Override public int delete(Integer cno, String commenter) throws Exception { Map map = new HashMap(); map.put("cno", cno); map.put("commenter", commenter); return session.delete(namespace+"delete", map); } // int delete(String statement, Object parameter) @Override public int insert(CommentDto dto) throws Exception { return session.insert(namespace+"insert", dto); } // int insert(String statement, Object parameter) @Override public List<CommentDto> selectAll(Integer bno) throws Exception { return session.selectList(namespace+"selectAll", bno); } // List<E> selectList(String statement) @Override public CommentDto select(Integer cno) throws Exception { return session.selectOne(namespace + "select", cno); } // T selectOne(String statement, Object parameter) @Override public int update(CommentDto dto) throws Exception { return session.update(namespace+"update", dto); } // int update(String statement, Object parameter) }
1,798
0.701335
0.699666
53
32.943398
23.837038
78
false
false
0
0
0
0
0
0
0.603774
false
false
4
c7df012c2ad2c0d1f6aa40c6e54fbd606bf4ecd5
11,338,713,722,221
5910b8d3b71f3e7986db162f4079bfaac4ce37f8
/src/main/java/com/verdantartifice/primalmagick/common/theorycrafting/ItemTagProjectMaterial.java
722da063ed3a76423a56e197bd36cb8c0d456110
[ "MIT" ]
permissive
dreamlibrarian/PrimalMagic
https://github.com/dreamlibrarian/PrimalMagic
6394c7cf9070468a3f3340c77428c6891592091e
c4410b23d695f429f105fd0ab36e9e9993642140
refs/heads/master
2023-03-07T05:32:21.632000
2022-01-24T01:48:27
2022-01-24T01:48:27
240,937,091
0
0
MIT
true
2020-02-17T06:06:42
2020-02-16T17:47:59
2020-02-17T05:52:49
2020-02-17T06:06:42
3,311
0
0
0
Java
false
false
package com.verdantartifice.primalmagick.common.theorycrafting; import java.util.HashSet; import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import com.verdantartifice.primalmagick.common.research.CompoundResearchKey; import com.verdantartifice.primalmagick.common.util.InventoryUtils; import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.SerializationTags; import net.minecraft.tags.Tag; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; /** * Definition of a project material that requires an item stack from a given tag, which may or may not be * consumed as part of the project. * * @author Daedalus4096 */ public class ItemTagProjectMaterial extends AbstractProjectMaterial { public static final String TYPE = "tag"; public static final IProjectMaterialSerializer<ItemTagProjectMaterial> SERIALIZER = new ItemTagProjectMaterial.Serializer(); protected ResourceLocation tagName; protected int quantity; protected boolean consumed; public ItemTagProjectMaterial() { super(); this.tagName = null; this.quantity = -1; this.consumed = false; } public ItemTagProjectMaterial(@Nonnull ResourceLocation tagName, int quantity, boolean consumed) { super(); this.tagName = tagName; this.quantity = quantity; this.consumed = consumed; } public ItemTagProjectMaterial(@Nonnull ResourceLocation tagName, boolean consumed) { this(tagName, 1, consumed); } @Override public CompoundTag serializeNBT() { CompoundTag tag = super.serializeNBT(); if (this.tagName != null) { tag.putString("TagName", this.tagName.toString()); } tag.putInt("Quantity", this.quantity); tag.putBoolean("Consumed", this.consumed); return tag; } @Override public void deserializeNBT(CompoundTag nbt) { super.deserializeNBT(nbt); if (nbt.contains("TagName")) { this.tagName = new ResourceLocation(nbt.getString("TagName")); } else { this.tagName = null; } this.quantity = nbt.getInt("Quantity"); this.consumed = nbt.getBoolean("Consumed"); } @Override protected String getMaterialType() { return TYPE; } @Override public boolean isSatisfied(Player player, Set<Block> surroundings) { if (InventoryUtils.isPlayerCarrying(player, this.tagName, this.quantity)) { return true; } else if (!this.consumed && this.quantity == 1 && surroundings != null) { // Only allow satisfaction from surroundings if not consuming the material and only one item is required Tag<Block> tag = SerializationTags.getInstance().getOrEmpty(Registry.BLOCK_REGISTRY).getTagOrEmpty(this.tagName); Set<Block> intersection = new HashSet<>(surroundings); intersection.retainAll(tag.getValues()); return !intersection.isEmpty(); } return false; } @Override public boolean consume(Player player) { // Remove items matching this material's tag from the player's inventory if it's supposed to be consumed if (this.consumed) { return InventoryUtils.consumeItem(player, this.tagName, this.quantity); } else { return true; } } @Nullable public ResourceLocation getTagName() { return this.tagName; } public int getQuantity() { return this.quantity; } @Override public boolean isConsumed() { return this.consumed; } @Override public void toNetwork(FriendlyByteBuf buf) { SERIALIZER.toNetwork(buf, this); } @Override public AbstractProjectMaterial copy() { ItemTagProjectMaterial material = new ItemTagProjectMaterial(); material.tagName = new ResourceLocation(this.tagName.toString()); material.quantity = this.quantity; material.consumed = this.consumed; material.selected = this.selected; material.weight = this.weight; material.bonusReward = this.bonusReward; if (this.requiredResearch != null) { material.requiredResearch = this.requiredResearch.copy(); } return material; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (consumed ? 1231 : 1237); result = prime * result + quantity; result = prime * result + ((tagName == null) ? 0 : tagName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ItemTagProjectMaterial other = (ItemTagProjectMaterial) obj; if (consumed != other.consumed) return false; if (quantity != other.quantity) return false; if (tagName == null) { if (other.tagName != null) return false; } else if (!tagName.equals(other.tagName)) return false; return true; } public static class Serializer implements IProjectMaterialSerializer<ItemTagProjectMaterial> { @Override public ItemTagProjectMaterial read(ResourceLocation projectId, JsonObject json) { String nameStr = json.getAsJsonPrimitive("name").getAsString(); if (nameStr == null) { throw new JsonSyntaxException("Illegal tag name in material JSON for project " + projectId.toString()); } ResourceLocation tagName = new ResourceLocation(nameStr); boolean consumed = json.getAsJsonPrimitive("consumed").getAsBoolean(); int quantity = json.getAsJsonPrimitive("quantity").getAsInt(); ItemTagProjectMaterial retVal = new ItemTagProjectMaterial(tagName, quantity, consumed); retVal.setWeight(json.getAsJsonPrimitive("weight").getAsDouble()); if (json.has("bonus_reward")) { retVal.setBonusReward(json.getAsJsonPrimitive("bonus_reward").getAsDouble()); } if (json.has("required_research")) { retVal.setRequiredResearch(CompoundResearchKey.parse(json.getAsJsonPrimitive("required_research").getAsString())); } return retVal; } @Override public ItemTagProjectMaterial fromNetwork(FriendlyByteBuf buf) { ItemTagProjectMaterial material = new ItemTagProjectMaterial(buf.readResourceLocation(), buf.readVarInt(), buf.readBoolean()); material.setWeight(buf.readDouble()); material.setBonusReward(buf.readDouble()); CompoundResearchKey research = CompoundResearchKey.parse(buf.readUtf()); if (research != null) { material.setRequiredResearch(research); } return material; } @Override public void toNetwork(FriendlyByteBuf buf, ItemTagProjectMaterial material) { buf.writeResourceLocation(material.tagName); buf.writeVarInt(material.quantity); buf.writeBoolean(material.consumed); buf.writeDouble(material.weight); buf.writeDouble(material.bonusReward); buf.writeUtf(material.requiredResearch == null ? "" : material.requiredResearch.toString()); } } }
UTF-8
Java
7,908
java
ItemTagProjectMaterial.java
Java
[ { "context": " * consumed as part of the project.\n * \n * @author Daedalus4096\n */\npublic class ItemTagProjectMaterial extends A", "end": 921, "score": 0.9996858835220337, "start": 909, "tag": "USERNAME", "value": "Daedalus4096" } ]
null
[]
package com.verdantartifice.primalmagick.common.theorycrafting; import java.util.HashSet; import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import com.verdantartifice.primalmagick.common.research.CompoundResearchKey; import com.verdantartifice.primalmagick.common.util.InventoryUtils; import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.SerializationTags; import net.minecraft.tags.Tag; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; /** * Definition of a project material that requires an item stack from a given tag, which may or may not be * consumed as part of the project. * * @author Daedalus4096 */ public class ItemTagProjectMaterial extends AbstractProjectMaterial { public static final String TYPE = "tag"; public static final IProjectMaterialSerializer<ItemTagProjectMaterial> SERIALIZER = new ItemTagProjectMaterial.Serializer(); protected ResourceLocation tagName; protected int quantity; protected boolean consumed; public ItemTagProjectMaterial() { super(); this.tagName = null; this.quantity = -1; this.consumed = false; } public ItemTagProjectMaterial(@Nonnull ResourceLocation tagName, int quantity, boolean consumed) { super(); this.tagName = tagName; this.quantity = quantity; this.consumed = consumed; } public ItemTagProjectMaterial(@Nonnull ResourceLocation tagName, boolean consumed) { this(tagName, 1, consumed); } @Override public CompoundTag serializeNBT() { CompoundTag tag = super.serializeNBT(); if (this.tagName != null) { tag.putString("TagName", this.tagName.toString()); } tag.putInt("Quantity", this.quantity); tag.putBoolean("Consumed", this.consumed); return tag; } @Override public void deserializeNBT(CompoundTag nbt) { super.deserializeNBT(nbt); if (nbt.contains("TagName")) { this.tagName = new ResourceLocation(nbt.getString("TagName")); } else { this.tagName = null; } this.quantity = nbt.getInt("Quantity"); this.consumed = nbt.getBoolean("Consumed"); } @Override protected String getMaterialType() { return TYPE; } @Override public boolean isSatisfied(Player player, Set<Block> surroundings) { if (InventoryUtils.isPlayerCarrying(player, this.tagName, this.quantity)) { return true; } else if (!this.consumed && this.quantity == 1 && surroundings != null) { // Only allow satisfaction from surroundings if not consuming the material and only one item is required Tag<Block> tag = SerializationTags.getInstance().getOrEmpty(Registry.BLOCK_REGISTRY).getTagOrEmpty(this.tagName); Set<Block> intersection = new HashSet<>(surroundings); intersection.retainAll(tag.getValues()); return !intersection.isEmpty(); } return false; } @Override public boolean consume(Player player) { // Remove items matching this material's tag from the player's inventory if it's supposed to be consumed if (this.consumed) { return InventoryUtils.consumeItem(player, this.tagName, this.quantity); } else { return true; } } @Nullable public ResourceLocation getTagName() { return this.tagName; } public int getQuantity() { return this.quantity; } @Override public boolean isConsumed() { return this.consumed; } @Override public void toNetwork(FriendlyByteBuf buf) { SERIALIZER.toNetwork(buf, this); } @Override public AbstractProjectMaterial copy() { ItemTagProjectMaterial material = new ItemTagProjectMaterial(); material.tagName = new ResourceLocation(this.tagName.toString()); material.quantity = this.quantity; material.consumed = this.consumed; material.selected = this.selected; material.weight = this.weight; material.bonusReward = this.bonusReward; if (this.requiredResearch != null) { material.requiredResearch = this.requiredResearch.copy(); } return material; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (consumed ? 1231 : 1237); result = prime * result + quantity; result = prime * result + ((tagName == null) ? 0 : tagName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ItemTagProjectMaterial other = (ItemTagProjectMaterial) obj; if (consumed != other.consumed) return false; if (quantity != other.quantity) return false; if (tagName == null) { if (other.tagName != null) return false; } else if (!tagName.equals(other.tagName)) return false; return true; } public static class Serializer implements IProjectMaterialSerializer<ItemTagProjectMaterial> { @Override public ItemTagProjectMaterial read(ResourceLocation projectId, JsonObject json) { String nameStr = json.getAsJsonPrimitive("name").getAsString(); if (nameStr == null) { throw new JsonSyntaxException("Illegal tag name in material JSON for project " + projectId.toString()); } ResourceLocation tagName = new ResourceLocation(nameStr); boolean consumed = json.getAsJsonPrimitive("consumed").getAsBoolean(); int quantity = json.getAsJsonPrimitive("quantity").getAsInt(); ItemTagProjectMaterial retVal = new ItemTagProjectMaterial(tagName, quantity, consumed); retVal.setWeight(json.getAsJsonPrimitive("weight").getAsDouble()); if (json.has("bonus_reward")) { retVal.setBonusReward(json.getAsJsonPrimitive("bonus_reward").getAsDouble()); } if (json.has("required_research")) { retVal.setRequiredResearch(CompoundResearchKey.parse(json.getAsJsonPrimitive("required_research").getAsString())); } return retVal; } @Override public ItemTagProjectMaterial fromNetwork(FriendlyByteBuf buf) { ItemTagProjectMaterial material = new ItemTagProjectMaterial(buf.readResourceLocation(), buf.readVarInt(), buf.readBoolean()); material.setWeight(buf.readDouble()); material.setBonusReward(buf.readDouble()); CompoundResearchKey research = CompoundResearchKey.parse(buf.readUtf()); if (research != null) { material.setRequiredResearch(research); } return material; } @Override public void toNetwork(FriendlyByteBuf buf, ItemTagProjectMaterial material) { buf.writeResourceLocation(material.tagName); buf.writeVarInt(material.quantity); buf.writeBoolean(material.consumed); buf.writeDouble(material.weight); buf.writeDouble(material.bonusReward); buf.writeUtf(material.requiredResearch == null ? "" : material.requiredResearch.toString()); } } }
7,908
0.642387
0.640111
219
35.109589
30.082031
138
false
false
0
0
0
0
0
0
0.552511
false
false
4
660184c86dfd1e56770407e398549a6d5c0567e7
24,008,867,238,991
50565cfde1e2ea1072dda0c3c37861c5b943107c
/src/com/debt/interceptor/commonInterceptor.java
daf177e62cc299d1d8da3cfae390d8173f748aaf
[]
no_license
908311595/debtsys4j
https://github.com/908311595/debtsys4j
46f9996305cc16c664865a7390a679b6cff058b3
0e44d22661cb7a217f9dd6fa0eb37e84ae0df07b
refs/heads/master
2016-08-05T04:06:11.378000
2015-06-02T08:28:22
2015-06-02T08:28:22
27,174,445
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.debt.interceptor; import java.util.Map; import com.debt.entity.Operator; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.AbstractInterceptor; /** * 公共拦截器,检测session是否有(Operator)manager存在 * @author 陈捷 * */ public class commonInterceptor extends AbstractInterceptor { private static final long serialVersionUID = -9200549638751569109L; /** * 检测用户session是否有效,有效则可以处理相应业务 */ @SuppressWarnings("rawtypes") @Override public String intercept(ActionInvocation invoke) throws Exception { ActionContext ac=invoke.getInvocationContext(); Map sessionMap=ac.getSession(); Operator manager=(Operator) sessionMap.get("manager"); if(manager!=null){ return invoke.invoke(); } return Action.LOGIN; } }
UTF-8
Java
970
java
commonInterceptor.java
Java
[ { "context": "公共拦截器,检测session是否有(Operator)manager存在\r\n * @author 陈捷\r\n *\r\n */\r\npublic class commonInterceptor extends ", "end": 356, "score": 0.9870975613594055, "start": 354, "tag": "NAME", "value": "陈捷" } ]
null
[]
package com.debt.interceptor; import java.util.Map; import com.debt.entity.Operator; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.AbstractInterceptor; /** * 公共拦截器,检测session是否有(Operator)manager存在 * @author 陈捷 * */ public class commonInterceptor extends AbstractInterceptor { private static final long serialVersionUID = -9200549638751569109L; /** * 检测用户session是否有效,有效则可以处理相应业务 */ @SuppressWarnings("rawtypes") @Override public String intercept(ActionInvocation invoke) throws Exception { ActionContext ac=invoke.getInvocationContext(); Map sessionMap=ac.getSession(); Operator manager=(Operator) sessionMap.get("manager"); if(manager!=null){ return invoke.invoke(); } return Action.LOGIN; } }
970
0.743333
0.717778
36
23
22.263573
68
false
false
0
0
0
0
0
0
1.111111
false
false
4
6d72f6d830a239abffdfbc7a9f08413f567c4fdd
30,116,310,679,670
36a329cf1c77d22fa8102c1c88e7bdbe8ed2f480
/src/test/java/com/liuweiren/leetcode/SolutionInterview004Test.java
93edc20000b905c2a224f8050c3b7361fcf0d227
[]
no_license
LiuWeiren/LeetCode
https://github.com/LiuWeiren/LeetCode
877eda1de70dd6d8f62bf8c73f7cce12c990a52c
3d6708138baf702b7d091fd7f113303e10a18136
refs/heads/main
2021-12-03T08:17:11.751000
2021-11-10T03:43:45
2021-11-10T03:43:45
248,106,726
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.liuweiren.leetcode; import org.junit.jupiter.api.Test; import java.util.Arrays; class SolutionInterview004Test { SolutionInterview004 solution = new SolutionInterview004(); @Test void getLeastNumbers() { int[] arr = {3,2,1}; int k = 2; System.out.println(Arrays.toString(solution.getLeastNumbers(arr, k))); } }
UTF-8
Java
368
java
SolutionInterview004Test.java
Java
[]
null
[]
package com.liuweiren.leetcode; import org.junit.jupiter.api.Test; import java.util.Arrays; class SolutionInterview004Test { SolutionInterview004 solution = new SolutionInterview004(); @Test void getLeastNumbers() { int[] arr = {3,2,1}; int k = 2; System.out.println(Arrays.toString(solution.getLeastNumbers(arr, k))); } }
368
0.67663
0.641304
18
19.5
22.266691
78
false
false
0
0
0
0
0
0
0.555556
false
false
4
c3a0b4fec0cc58875724922059231555e1aa4ded
33,054,068,332,582
5fe33aed8d7072812e12f552fe0ac58c36f4ad68
/src/nlr_parser/MastEntry.java
00f0abf4a61085da9726c51879a01f77614ce0ca
[]
no_license
steuernb/MutantHunter
https://github.com/steuernb/MutantHunter
50bf20ae094c07a2041761e5a3a815e825fa9226
b2a3abeb898d394b825abb9f4911f86edccaf9a4
refs/heads/master
2021-01-10T03:27:04.789000
2019-10-08T09:28:43
2019-10-08T09:28:43
44,801,170
6
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package nlr_parser; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MastEntry { String id; String name; int length; double combined_p_value; double p_value; double e_value; Vector<MastMotifHit> hits; public MastEntry(String entryString){ Pattern p = Pattern.compile("<sequence\\s+id=\"(\\w+)\"\\s+db=\"(\\w+)\"\\s+num=\"(\\d+)\"\\s+name=\"(.+?)\"\\s+comment=\"(.*?)\"\\s+length=\"(\\d+)\">"); Matcher m = p.matcher(entryString); m.find(); this.id = m.group(1); this.name = m.group(4); this.length = Integer.parseInt(m.group(6)); this.combined_p_value = Double.parseDouble(entryString.split("combined_pvalue=\"")[1].split("\"")[0]); this.e_value = Double.parseDouble(entryString.split("evalue=\"")[1].split("\"")[0]); p = Pattern.compile("<seg start=\"(\\d+)\">\\s*<data>([\\w*]+)\\s*</data>"); m = p.matcher(entryString); hits = new Vector<MastMotifHit>(); p = Pattern.compile("<hit\\s+pos=\"(\\d+)\"\\s+gap=\"(\\d+)\"\\s+motif=\"(\\w+)\"\\s+pvalue=\"([\\w-\\.]+)\"\\s+match=\"([\\s+]+)\"/>"); m = p.matcher(entryString); while(m.find()){ MastMotifHit hit = new MastMotifHit(this.name, m.group(0) ); hits.add( hit ); } } public String getId() { return id; } public String getName() { return name; } public int getLength() { return length; } public double getP_value() { return p_value; } public double getE_value() { return e_value; } public Vector<MastMotifHit> getHits() { return hits; } }
UTF-8
Java
1,631
java
MastEntry.java
Java
[]
null
[]
package nlr_parser; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MastEntry { String id; String name; int length; double combined_p_value; double p_value; double e_value; Vector<MastMotifHit> hits; public MastEntry(String entryString){ Pattern p = Pattern.compile("<sequence\\s+id=\"(\\w+)\"\\s+db=\"(\\w+)\"\\s+num=\"(\\d+)\"\\s+name=\"(.+?)\"\\s+comment=\"(.*?)\"\\s+length=\"(\\d+)\">"); Matcher m = p.matcher(entryString); m.find(); this.id = m.group(1); this.name = m.group(4); this.length = Integer.parseInt(m.group(6)); this.combined_p_value = Double.parseDouble(entryString.split("combined_pvalue=\"")[1].split("\"")[0]); this.e_value = Double.parseDouble(entryString.split("evalue=\"")[1].split("\"")[0]); p = Pattern.compile("<seg start=\"(\\d+)\">\\s*<data>([\\w*]+)\\s*</data>"); m = p.matcher(entryString); hits = new Vector<MastMotifHit>(); p = Pattern.compile("<hit\\s+pos=\"(\\d+)\"\\s+gap=\"(\\d+)\"\\s+motif=\"(\\w+)\"\\s+pvalue=\"([\\w-\\.]+)\"\\s+match=\"([\\s+]+)\"/>"); m = p.matcher(entryString); while(m.find()){ MastMotifHit hit = new MastMotifHit(this.name, m.group(0) ); hits.add( hit ); } } public String getId() { return id; } public String getName() { return name; } public int getLength() { return length; } public double getP_value() { return p_value; } public double getE_value() { return e_value; } public Vector<MastMotifHit> getHits() { return hits; } }
1,631
0.56591
0.561006
100
15.25
26.735136
156
false
false
0
0
0
0
0
0
1.58
false
false
4
2d45e553005c60cd230715043303d5b75592cb2a
21,036,749,830,908
e62a582f5196ab9bb2ed8582d229c31c4d0f0304
/src/com/caiqian/Dynamic/ClimbingStairs/Solution.java
c031b9337d42b860e37d971a0e4ae60524d9d822
[]
no_license
SGN196/Algorithm
https://github.com/SGN196/Algorithm
ec8e41222543ed27846ac5786ae5feb2d338a522
74d6b710fc1c08ade6d5dec234326c38c68ef207
refs/heads/master
2020-04-10T22:45:45.907000
2019-01-24T15:08:33
2019-01-24T15:08:33
161,331,941
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.caiqian.Dynamic.ClimbingStairs; /** * @author SGN196 * @date 2019/1/14 22:03 */ public class Solution { public static int[] x = new int[47]; public Solution(){ x[0] = 0; x[1] = 1; x[2] = 2; int i = 1; int j = 2; for (int k = 3; k < 47 ; k++) { j = i + j; i = j - i; x[k] = j; System.out.println(j + " " + k); } } public int climbStairs(int n) { return x[n]; } public static void main(String[] args) { System.out.println(Integer.MAX_VALUE); new Solution(); } }
UTF-8
Java
638
java
Solution.java
Java
[ { "context": "om.caiqian.Dynamic.ClimbingStairs;\n\n/**\n * @author SGN196\n * @date 2019/1/14 22:03\n */\n\npublic class Soluti", "end": 66, "score": 0.9996504783630371, "start": 60, "tag": "USERNAME", "value": "SGN196" } ]
null
[]
package com.caiqian.Dynamic.ClimbingStairs; /** * @author SGN196 * @date 2019/1/14 22:03 */ public class Solution { public static int[] x = new int[47]; public Solution(){ x[0] = 0; x[1] = 1; x[2] = 2; int i = 1; int j = 2; for (int k = 3; k < 47 ; k++) { j = i + j; i = j - i; x[k] = j; System.out.println(j + " " + k); } } public int climbStairs(int n) { return x[n]; } public static void main(String[] args) { System.out.println(Integer.MAX_VALUE); new Solution(); } }
638
0.445141
0.402821
35
17.228571
14.832562
46
false
false
0
0
0
0
0
0
0.457143
false
false
4
d25cf4d77c149c76b1ebb44334a3acd513991eb9
1,941,325,240,583
8246da9a0ea49ef6e70bfb6bc05148fb6134ed89
/dianping2/src/main/java/com/dianping/booking/view/TimePickerView.java
7759adb114fb5d2e7accb22f68d5ff51dfa4b629
[]
no_license
hezhongqiang/Dianping
https://github.com/hezhongqiang/Dianping
2708824e30339e1abfb85e028bd27778e26adb56
b1a4641be06857fcf65466ce04f3de6b0b6f05ef
refs/heads/master
2020-05-29T08:48:38.251000
2016-01-13T08:09:05
2016-01-13T08:09:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dianping.booking.view; import android.content.Context; import android.os.Handler; import android.util.AttributeSet; import android.util.SparseArray; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.dianping.base.widget.NumberPicker; import com.dianping.booking.BookingDateItem; import com.dianping.v1.R.id; import java.util.ArrayList; import java.util.Calendar; public class TimePickerView extends LinearLayout { private static final int HOUR_CHANGE = 0; private static final int MINUTE_CHANGE = 1; private Button button1; private Button button2; private View buttonView; private ArrayList<BookingDateItem> hourList; private NumberPicker hourPicker; private Handler mHandler = new TimePickerView.1(this); private OnButtonClickListener mListener; private SparseArray<ArrayList<BookingDateItem>> minuteMap; private NumberPicker minutePicker; private TextView textView; private int timeInterval; public TimePickerView(Context paramContext) { super(paramContext); } public TimePickerView(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); } private void setHourTipView(int paramInt1, int paramInt2) { if ((this.hourList == null) || (this.hourList.size() <= 0)); while (true) { return; if (((BookingDateItem)this.hourList.get(paramInt1)).status != 1) break; if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == 1) { this.textView.setVisibility(8); this.buttonView.setVisibility(0); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == -1) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status != -2) continue; this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); return; } if (((BookingDateItem)this.hourList.get(paramInt1)).status == -1) { if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == -1) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == -2) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); return; } this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } if (((BookingDateItem)this.hourList.get(paramInt1)).status == -2) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); return; } this.textView.setVisibility(8); this.buttonView.setVisibility(0); } private void setMinuteTipView(int paramInt1, int paramInt2) { if ((this.minuteMap == null) || (this.minuteMap.get(paramInt1) == null) || (((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2) == null)); do { return; if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == 1) { this.textView.setVisibility(8); this.buttonView.setVisibility(0); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status != -1) continue; this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } while (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status != -2); this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); } private void setViewDate() { this.hourPicker.setMaxValue(23); this.hourPicker.setMinValue(0); this.hourPicker.setWrapSelectorWheel(false); this.minutePicker.setMinValue(0); if (this.timeInterval == 0) this.timeInterval = 30; this.minutePicker.setMaxValue(60 / this.timeInterval - 1); this.minutePicker.setWrapSelectorWheel(false); ArrayList localArrayList = new ArrayList(); int i = 0; while (i < 60 / this.timeInterval) { localArrayList.add(this.timeInterval * i + ""); i += 1; } this.minutePicker.setDisplayedValues((String[])localArrayList.toArray(new String[0])); this.hourPicker.setOnValueChangedListener(new TimePickerView.4(this)); this.minutePicker.setOnValueChangedListener(new TimePickerView.5(this)); } public int getSelectHour() { if (this.hourPicker != null) return this.hourPicker.getValue(); return 0; } public int getSelectMinute() { if (this.minutePicker != null) return this.minutePicker.getValue() * this.timeInterval; return 0; } protected void onFinishInflate() { super.onFinishInflate(); this.hourPicker = ((NumberPicker)findViewById(R.id.hourPicker)); this.minutePicker = ((NumberPicker)findViewById(R.id.minutePicker)); this.textView = ((TextView)findViewById(R.id.text)); this.buttonView = findViewById(R.id.button_layout); this.button1 = ((Button)findViewById(R.id.button1)); this.button2 = ((Button)findViewById(R.id.button2)); this.hourPicker.setWrapSelectorWheel(false); this.minutePicker.setWrapSelectorWheel(false); this.hourPicker.setInputEnabled(false); this.minutePicker.setInputEnabled(false); this.button1.setOnClickListener(new TimePickerView.2(this)); this.button2.setOnClickListener(new TimePickerView.3(this)); } public void setDate(ArrayList<BookingDateItem> paramArrayList, SparseArray<ArrayList<BookingDateItem>> paramSparseArray, int paramInt) { this.hourList = paramArrayList; this.minuteMap = paramSparseArray; this.timeInterval = paramInt; if ((this.hourList == null) || (this.minuteMap == null)) return; setViewDate(); } public void setOnButtonClickListener(OnButtonClickListener paramOnButtonClickListener) { this.mListener = paramOnButtonClickListener; } public void setSelectDate(Calendar paramCalendar) { Calendar localCalendar = Calendar.getInstance(); localCalendar.setTimeInMillis(paramCalendar.getTimeInMillis()); this.hourPicker.setValue(localCalendar.get(11)); this.minutePicker.setValue(localCalendar.get(12) / this.timeInterval); if ((this.hourList == null) || (this.hourList.size() <= 0) || (this.minuteMap == null)) return; setHourTipView(this.hourPicker.getValue(), this.minutePicker.getValue()); } public static abstract interface OnButtonClickListener { public abstract void onNegativeButtonClick(); public abstract void onPositiveButtonClick(); } } /* Location: C:\Users\xuetong\Desktop\dazhongdianping7.9.6\ProjectSrc\classes-dex2jar.jar * Qualified Name: com.dianping.booking.view.TimePickerView * JD-Core Version: 0.6.0 */
UTF-8
Java
7,519
java
TimePickerView.java
Java
[ { "context": "nClick();\n }\n}\n\n/* Location: C:\\Users\\xuetong\\Desktop\\dazhongdianping7.9.6\\ProjectSrc\\classe", "end": 7215, "score": 0.8450722694396973, "start": 7212, "tag": "USERNAME", "value": "uet" } ]
null
[]
package com.dianping.booking.view; import android.content.Context; import android.os.Handler; import android.util.AttributeSet; import android.util.SparseArray; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.dianping.base.widget.NumberPicker; import com.dianping.booking.BookingDateItem; import com.dianping.v1.R.id; import java.util.ArrayList; import java.util.Calendar; public class TimePickerView extends LinearLayout { private static final int HOUR_CHANGE = 0; private static final int MINUTE_CHANGE = 1; private Button button1; private Button button2; private View buttonView; private ArrayList<BookingDateItem> hourList; private NumberPicker hourPicker; private Handler mHandler = new TimePickerView.1(this); private OnButtonClickListener mListener; private SparseArray<ArrayList<BookingDateItem>> minuteMap; private NumberPicker minutePicker; private TextView textView; private int timeInterval; public TimePickerView(Context paramContext) { super(paramContext); } public TimePickerView(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); } private void setHourTipView(int paramInt1, int paramInt2) { if ((this.hourList == null) || (this.hourList.size() <= 0)); while (true) { return; if (((BookingDateItem)this.hourList.get(paramInt1)).status != 1) break; if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == 1) { this.textView.setVisibility(8); this.buttonView.setVisibility(0); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == -1) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status != -2) continue; this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); return; } if (((BookingDateItem)this.hourList.get(paramInt1)).status == -1) { if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == -1) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == -2) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); return; } this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } if (((BookingDateItem)this.hourList.get(paramInt1)).status == -2) { this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); return; } this.textView.setVisibility(8); this.buttonView.setVisibility(0); } private void setMinuteTipView(int paramInt1, int paramInt2) { if ((this.minuteMap == null) || (this.minuteMap.get(paramInt1) == null) || (((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2) == null)); do { return; if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status == 1) { this.textView.setVisibility(8); this.buttonView.setVisibility(0); return; } if (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status != -1) continue; this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("该时段不接受订位"); return; } while (((BookingDateItem)((ArrayList)this.minuteMap.get(paramInt1)).get(paramInt2)).status != -2); this.textView.setVisibility(0); this.buttonView.setVisibility(8); this.textView.setText("座位已满,请另选时段"); } private void setViewDate() { this.hourPicker.setMaxValue(23); this.hourPicker.setMinValue(0); this.hourPicker.setWrapSelectorWheel(false); this.minutePicker.setMinValue(0); if (this.timeInterval == 0) this.timeInterval = 30; this.minutePicker.setMaxValue(60 / this.timeInterval - 1); this.minutePicker.setWrapSelectorWheel(false); ArrayList localArrayList = new ArrayList(); int i = 0; while (i < 60 / this.timeInterval) { localArrayList.add(this.timeInterval * i + ""); i += 1; } this.minutePicker.setDisplayedValues((String[])localArrayList.toArray(new String[0])); this.hourPicker.setOnValueChangedListener(new TimePickerView.4(this)); this.minutePicker.setOnValueChangedListener(new TimePickerView.5(this)); } public int getSelectHour() { if (this.hourPicker != null) return this.hourPicker.getValue(); return 0; } public int getSelectMinute() { if (this.minutePicker != null) return this.minutePicker.getValue() * this.timeInterval; return 0; } protected void onFinishInflate() { super.onFinishInflate(); this.hourPicker = ((NumberPicker)findViewById(R.id.hourPicker)); this.minutePicker = ((NumberPicker)findViewById(R.id.minutePicker)); this.textView = ((TextView)findViewById(R.id.text)); this.buttonView = findViewById(R.id.button_layout); this.button1 = ((Button)findViewById(R.id.button1)); this.button2 = ((Button)findViewById(R.id.button2)); this.hourPicker.setWrapSelectorWheel(false); this.minutePicker.setWrapSelectorWheel(false); this.hourPicker.setInputEnabled(false); this.minutePicker.setInputEnabled(false); this.button1.setOnClickListener(new TimePickerView.2(this)); this.button2.setOnClickListener(new TimePickerView.3(this)); } public void setDate(ArrayList<BookingDateItem> paramArrayList, SparseArray<ArrayList<BookingDateItem>> paramSparseArray, int paramInt) { this.hourList = paramArrayList; this.minuteMap = paramSparseArray; this.timeInterval = paramInt; if ((this.hourList == null) || (this.minuteMap == null)) return; setViewDate(); } public void setOnButtonClickListener(OnButtonClickListener paramOnButtonClickListener) { this.mListener = paramOnButtonClickListener; } public void setSelectDate(Calendar paramCalendar) { Calendar localCalendar = Calendar.getInstance(); localCalendar.setTimeInMillis(paramCalendar.getTimeInMillis()); this.hourPicker.setValue(localCalendar.get(11)); this.minutePicker.setValue(localCalendar.get(12) / this.timeInterval); if ((this.hourList == null) || (this.hourList.size() <= 0) || (this.minuteMap == null)) return; setHourTipView(this.hourPicker.getValue(), this.minutePicker.getValue()); } public static abstract interface OnButtonClickListener { public abstract void onNegativeButtonClick(); public abstract void onPositiveButtonClick(); } } /* Location: C:\Users\xuetong\Desktop\dazhongdianping7.9.6\ProjectSrc\classes-dex2jar.jar * Qualified Name: com.dianping.booking.view.TimePickerView * JD-Core Version: 0.6.0 */
7,519
0.695864
0.681627
218
32.834862
28.278761
148
false
false
0
0
0
0
0
0
0.642202
false
false
4
65f024debbd0c1755bad0a18a34c5363af7d43b0
27,023,934,247,195
d9de548b99de7622c4f17f41749a6afe47c11aa2
/HW13-0036478527/src/main/java/hr/fer/zemris/java/hw13/servlets/ColorSetterServlet.java
f1e5d10ad53c58d231dff1dade97e1d117ca1414
[]
no_license
lukadante/OPJJ
https://github.com/lukadante/OPJJ
235b9b4abc664fea00a0646ac1ba73569621ade6
78739822088a2a4b916aecd3f9d41c29dfd008fd
refs/heads/master
2020-12-28T03:20:31.743000
2016-03-12T13:07:03
2016-03-12T13:07:03
35,557,660
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hr.fer.zemris.java.hw13.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * ColorSetterServlet is a servlet which changes background color of all * application's pages. Color is set through parameter with name * {@link #BG_COLOR}. * * @author Luka Skugor * */ @WebServlet(name = "colorsetter", urlPatterns = { "/setcolor" }) public class ColorSetterServlet extends HttpServlet { /** * Serial */ private static final long serialVersionUID = 1L; /** * Parameter name through which background color is set. */ public static final String BG_COLOR = "pickedBgColor"; /** * Default background color value. */ public static final String DEFAULT_COLOR = "FFFFFF"; /* * (non-Javadoc) * * @see * javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest * , javax.servlet.http.HttpServletResponse) */ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String color = req.getParameter(BG_COLOR); if (color != null && (color.length() == 6 || color.length() == 3) && color.matches("[0-9a-fA-F]+")) { req.getSession().setAttribute(BG_COLOR, color); } req.getRequestDispatcher("/colors.jsp").forward(req, resp); } }
UTF-8
Java
1,472
java
ColorSetterServlet.java
Java
[ { "context": "ter with name\n * {@link #BG_COLOR}.\n * \n * @author Luka Skugor\n *\n */\n@WebServlet(name = \"colorsetter\", urlPatte", "end": 478, "score": 0.9998552203178406, "start": 467, "tag": "NAME", "value": "Luka Skugor" } ]
null
[]
package hr.fer.zemris.java.hw13.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * ColorSetterServlet is a servlet which changes background color of all * application's pages. Color is set through parameter with name * {@link #BG_COLOR}. * * @author <NAME> * */ @WebServlet(name = "colorsetter", urlPatterns = { "/setcolor" }) public class ColorSetterServlet extends HttpServlet { /** * Serial */ private static final long serialVersionUID = 1L; /** * Parameter name through which background color is set. */ public static final String BG_COLOR = "pickedBgColor"; /** * Default background color value. */ public static final String DEFAULT_COLOR = "FFFFFF"; /* * (non-Javadoc) * * @see * javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest * , javax.servlet.http.HttpServletResponse) */ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String color = req.getParameter(BG_COLOR); if (color != null && (color.length() == 6 || color.length() == 3) && color.matches("[0-9a-fA-F]+")) { req.getSession().setAttribute(BG_COLOR, color); } req.getRequestDispatcher("/colors.jsp").forward(req, resp); } }
1,467
0.720109
0.715353
56
25.285715
25.01265
78
false
false
0
0
0
0
0
0
1.089286
false
false
4
ec96effc38d08a9663e40cf01b53b0f7ac125197
19,035,295,084,348
2090d36edf6ce4171f18b93342089ee251b529ae
/src/main/java/com/xnx3/j2ee/init/InitApplication.java
65f20a3972a10cb6576cb7428680abd28a426e79
[ "Apache-2.0" ]
permissive
leiyaSun/wangmarket
https://github.com/leiyaSun/wangmarket
d758f554986f6768f9717a8b44cc62f696180d5c
c92803166297fab3032c2dfa85feffe9c3525b13
refs/heads/master
2020-06-02T10:56:26.449000
2019-06-06T01:23:51
2019-06-06T01:23:51
191,132,982
1
0
Apache-2.0
true
2019-06-10T09:00:31
2019-06-10T09:00:30
2019-06-06T01:23:58
2019-06-06T01:23:56
111,586
0
0
0
null
false
false
package com.xnx3.j2ee.init; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import com.aliyun.oss.model.CannedAccessControlList; import com.aliyun.oss.model.CreateBucketRequest; import com.xnx3.ConfigManagerUtil; import com.xnx3.DateUtil; import com.xnx3.j2ee.Global; import com.xnx3.j2ee.func.AttachmentFile; import com.xnx3.j2ee.func.Log; import com.xnx3.j2ee.func.OSS; import com.xnx3.j2ee.generateCache.Message; import com.xnx3.j2ee.generateCache.PayLog; import com.xnx3.j2ee.generateCache.Role; import com.xnx3.j2ee.generateCache.SmsLog; import com.xnx3.j2ee.generateCache.User; import com.xnx3.j2ee.service.SqlService; import com.xnx3.net.OSSUtil; /** * 系统启动初始化 * @author 管雷鸣 */ @Component public class InitApplication implements CommandLineRunner{ @Resource private SqlService sqlService; @Value("${spring.datasource.driver-class-name}") private String databaseSourceDriverClassName; public InitApplication() { Log.debug("项目启动后开启自动初始化缓存数据加载"); } public void run(String... args) throws Exception { //加在systemConfig.xml中自动检测的项 boolean checkDb = ConfigManagerUtil.getSingleton("systemConfig.xml").getValue("startAutoCheck.db").equals("true"); try { //数据库自动检测 if(checkDb){ checkDb(); } } catch (org.springframework.beans.factory.NoSuchBeanDefinitionException e) { //未使用数据库,此项忽略 if(checkDb){ Log.info("检测到spring中没有sqlService这个bean,也就是当前项目未使用数据库!数据库自动检测略过"); } } //设置 附件存储 的位置,是阿里云,还是本地。参数来源于数据库 AttachmentFile.mode = Global.get("ATTACHMENT_FILE_MODE"); if(AttachmentFile.mode == null){ AttachmentFile.mode = AttachmentFile.MODE_LOCAL_FILE; Log.info("AttachmentFile.mode = "+AttachmentFile.mode); } //如果使用的是阿里云OSS,进行OSS初始化赋值。 if(AttachmentFile.isMode(AttachmentFile.MODE_ALIYUN_OSS)){ initOssConfig(); } //附件、文件的请求网址(CDN会先查找数据库配置的此项,若此项没有配置,才会使用xnx3Config.xml中配置的oss的cdn),本地服务器作为存储磁盘,必须使用数据库配置的此附件地址 if(AttachmentFile.netUrl() == null){ Log.debug("未发现当前上传图片、附件所使用的域名。"); Log.debug(" 设置方式:"); Log.debug(" 1. 本项目在开启后,取第一次访问时使用的url,作为当前的 ATTACHMENT_FILE_URL"); Log.debug(" 2. 进入总管理后台-系统管理-系统变量,设置ATTACHMENT_FILE_URL变量,加上图片等附件的访问域名,格式如: http://res.weiunity.com/"); Log.debug(" 3. 您在程序中自行进行设置AttachmentFile.setNetUrl(url);"); } Log.debug("AttachmentFile.url : "+AttachmentFile.netUrl()); /*以下为生成相关数据缓存*/ try { new Message(); } catch (Throwable e) {} try { new PayLog(); } catch (Throwable e) {} try { new SmsLog(); } catch (Throwable e) {} try { new User(); } catch (Throwable e) {} } /** * 项目自动运行后,检测数据库是否导入 iw.sql */ public void checkDb(){ //判断一下,当 system 表中有数据时,才会加载postClass、role、system等数据库信息。反之,如果system表没有数据,也就是认为开发者刚吧iw框架假设起来,还没有往里填充数据,既然没有数据,便不需要加载这几个数据表的数据了 boolean useDB = false; if(databaseSourceDriverClassName.equals("org.sqlite.JDBC")){ //使用sqlite Log.info("Using the database : Sqlite"); useDB = true; }else{ //使用Mysql Log.info("Using the database : Mysql"); List<Map<String,Object>> map = sqlService.findMapBySqlQuery("SHOW TABLES LIKE '%system%'"); if(map.size() > 0){ useDB = true; } } //如果使用数据库,则加载初始化的一些数据 if(useDB){ // generateCache_postClass(); readSystemTable(); try { new Role().role(sqlService); } catch (Throwable e) { Log.debug("权限系统异常:"+e.getMessage()+",如果您当前项目使用不到权限编辑操作,此项忽略即可"); } }else{ Global.databaseCreateFinish = false; Global.databaseCreateFinish_explain = "数据库异常:请将数据库中的初始数据导入,数据文件地址 https://github.com/xnx3/iw/blob/master/iw.sql"; Log.debug(Global.databaseCreateFinish_explain); } } /** * 生成缓存数据,v4.3更新,转移到 插件 bbs 中 */ // public void generateCache_postClass(){ // try { // final List<Map<String,Object>> list = sqlService.findMapBySqlQuery("SELECT id,name FROM post_class WHERE isdelete = 0"); // new Thread(new Runnable() { // public void run() { // new Bbs().postClassByListMap(list); // } // }).start(); // } catch (Throwable e) { // Log.debug("自动创建论坛板块缓存时出现异常:"+e.getMessage()+",若用不到论坛功能,此项忽略即可"); // } // } /** * 读system表数据 */ public void readSystemTable(){ Global.system.clear(); Log.debug("开始装载System数据表信息"); List<Map<String,Object>> list = sqlService.findMapBySqlQuery("SELECT name,value FROM system"); for (int i = 0; i < list.size(); i++) { Map<String, Object> map = list.get(i); String name = map.get("name").toString(); String value = map.get("value") != null? map.get("value").toString():""; Global.system.put(name, value); Log.debug(name+"="+value); } Log.info("system 表数据载入内存完毕,共"+list.size()+"条数据"); } /** * 检测OSS配置信息,服务于 {@link OSS},保证其能正常使用的配置是否正常 */ public void initOssConfig(){ OSSUtil.accessKeyId = Global.get("ALIYUN_ACCESSKEYID"); OSSUtil.accessKeySecret = Global.get("ALIYUN_ACCESSKEYSECRET"); OSSUtil.bucketName = Global.get("ALIYUN_OSS_BUCKETNAME"); OSSUtil.endpoint = Global.get("ALIYUN_OSS_ENDPOINT"); OSSUtil.url = AttachmentFile.netUrl(); boolean checkOss = ConfigManagerUtil.getSingleton("systemConfig.xml").getValue("startAutoCheck.oss").equals("true"); if(!checkOss){ //若不启用OSS自检,直接退出此方法即可 return; } if(OSSUtil.accessKeyId == null || OSSUtil.accessKeySecret.length() < 10){ Log.info("OSS对象存储初始化时,accessKeyId 或 accessKeyId 无有效值(字符小于10)"); return; } } }
UTF-8
Java
6,747
java
InitApplication.java
Java
[ { "context": " com.xnx3.net.OSSUtil;\n\n/**\n * 系统启动初始化\n * @author 管雷鸣\n */\n@Component\npublic class InitApplication imple", "end": 875, "score": 0.9635812640190125, "start": 872, "tag": "NAME", "value": "管雷鸣" }, { "context": "= \"数据库异常:请将数据库中的初始数据导入,数据文件地址 https://github.com/xnx3...
null
[]
package com.xnx3.j2ee.init; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import com.aliyun.oss.model.CannedAccessControlList; import com.aliyun.oss.model.CreateBucketRequest; import com.xnx3.ConfigManagerUtil; import com.xnx3.DateUtil; import com.xnx3.j2ee.Global; import com.xnx3.j2ee.func.AttachmentFile; import com.xnx3.j2ee.func.Log; import com.xnx3.j2ee.func.OSS; import com.xnx3.j2ee.generateCache.Message; import com.xnx3.j2ee.generateCache.PayLog; import com.xnx3.j2ee.generateCache.Role; import com.xnx3.j2ee.generateCache.SmsLog; import com.xnx3.j2ee.generateCache.User; import com.xnx3.j2ee.service.SqlService; import com.xnx3.net.OSSUtil; /** * 系统启动初始化 * @author 管雷鸣 */ @Component public class InitApplication implements CommandLineRunner{ @Resource private SqlService sqlService; @Value("${spring.datasource.driver-class-name}") private String databaseSourceDriverClassName; public InitApplication() { Log.debug("项目启动后开启自动初始化缓存数据加载"); } public void run(String... args) throws Exception { //加在systemConfig.xml中自动检测的项 boolean checkDb = ConfigManagerUtil.getSingleton("systemConfig.xml").getValue("startAutoCheck.db").equals("true"); try { //数据库自动检测 if(checkDb){ checkDb(); } } catch (org.springframework.beans.factory.NoSuchBeanDefinitionException e) { //未使用数据库,此项忽略 if(checkDb){ Log.info("检测到spring中没有sqlService这个bean,也就是当前项目未使用数据库!数据库自动检测略过"); } } //设置 附件存储 的位置,是阿里云,还是本地。参数来源于数据库 AttachmentFile.mode = Global.get("ATTACHMENT_FILE_MODE"); if(AttachmentFile.mode == null){ AttachmentFile.mode = AttachmentFile.MODE_LOCAL_FILE; Log.info("AttachmentFile.mode = "+AttachmentFile.mode); } //如果使用的是阿里云OSS,进行OSS初始化赋值。 if(AttachmentFile.isMode(AttachmentFile.MODE_ALIYUN_OSS)){ initOssConfig(); } //附件、文件的请求网址(CDN会先查找数据库配置的此项,若此项没有配置,才会使用xnx3Config.xml中配置的oss的cdn),本地服务器作为存储磁盘,必须使用数据库配置的此附件地址 if(AttachmentFile.netUrl() == null){ Log.debug("未发现当前上传图片、附件所使用的域名。"); Log.debug(" 设置方式:"); Log.debug(" 1. 本项目在开启后,取第一次访问时使用的url,作为当前的 ATTACHMENT_FILE_URL"); Log.debug(" 2. 进入总管理后台-系统管理-系统变量,设置ATTACHMENT_FILE_URL变量,加上图片等附件的访问域名,格式如: http://res.weiunity.com/"); Log.debug(" 3. 您在程序中自行进行设置AttachmentFile.setNetUrl(url);"); } Log.debug("AttachmentFile.url : "+AttachmentFile.netUrl()); /*以下为生成相关数据缓存*/ try { new Message(); } catch (Throwable e) {} try { new PayLog(); } catch (Throwable e) {} try { new SmsLog(); } catch (Throwable e) {} try { new User(); } catch (Throwable e) {} } /** * 项目自动运行后,检测数据库是否导入 iw.sql */ public void checkDb(){ //判断一下,当 system 表中有数据时,才会加载postClass、role、system等数据库信息。反之,如果system表没有数据,也就是认为开发者刚吧iw框架假设起来,还没有往里填充数据,既然没有数据,便不需要加载这几个数据表的数据了 boolean useDB = false; if(databaseSourceDriverClassName.equals("org.sqlite.JDBC")){ //使用sqlite Log.info("Using the database : Sqlite"); useDB = true; }else{ //使用Mysql Log.info("Using the database : Mysql"); List<Map<String,Object>> map = sqlService.findMapBySqlQuery("SHOW TABLES LIKE '%system%'"); if(map.size() > 0){ useDB = true; } } //如果使用数据库,则加载初始化的一些数据 if(useDB){ // generateCache_postClass(); readSystemTable(); try { new Role().role(sqlService); } catch (Throwable e) { Log.debug("权限系统异常:"+e.getMessage()+",如果您当前项目使用不到权限编辑操作,此项忽略即可"); } }else{ Global.databaseCreateFinish = false; Global.databaseCreateFinish_explain = "数据库异常:请将数据库中的初始数据导入,数据文件地址 https://github.com/xnx3/iw/blob/master/iw.sql"; Log.debug(Global.databaseCreateFinish_explain); } } /** * 生成缓存数据,v4.3更新,转移到 插件 bbs 中 */ // public void generateCache_postClass(){ // try { // final List<Map<String,Object>> list = sqlService.findMapBySqlQuery("SELECT id,name FROM post_class WHERE isdelete = 0"); // new Thread(new Runnable() { // public void run() { // new Bbs().postClassByListMap(list); // } // }).start(); // } catch (Throwable e) { // Log.debug("自动创建论坛板块缓存时出现异常:"+e.getMessage()+",若用不到论坛功能,此项忽略即可"); // } // } /** * 读system表数据 */ public void readSystemTable(){ Global.system.clear(); Log.debug("开始装载System数据表信息"); List<Map<String,Object>> list = sqlService.findMapBySqlQuery("SELECT name,value FROM system"); for (int i = 0; i < list.size(); i++) { Map<String, Object> map = list.get(i); String name = map.get("name").toString(); String value = map.get("value") != null? map.get("value").toString():""; Global.system.put(name, value); Log.debug(name+"="+value); } Log.info("system 表数据载入内存完毕,共"+list.size()+"条数据"); } /** * 检测OSS配置信息,服务于 {@link OSS},保证其能正常使用的配置是否正常 */ public void initOssConfig(){ OSSUtil.accessKeyId = Global.get("ALIYUN_ACCESSKEYID"); OSSUtil.accessKeySecret = Global.get("ALIYUN_ACCESSKEYSECRET"); OSSUtil.bucketName = Global.get("ALIYUN_OSS_BUCKETNAME"); OSSUtil.endpoint = Global.get("ALIYUN_OSS_ENDPOINT"); OSSUtil.url = AttachmentFile.netUrl(); boolean checkOss = ConfigManagerUtil.getSingleton("systemConfig.xml").getValue("startAutoCheck.oss").equals("true"); if(!checkOss){ //若不启用OSS自检,直接退出此方法即可 return; } if(OSSUtil.accessKeyId == null || OSSUtil.accessKeySecret.length() < 10){ Log.info("OSS对象存储初始化时,accessKeyId 或 accessKeyId 无有效值(字符小于10)"); return; } } }
6,747
0.70155
0.694439
191
27.717278
27.60252
126
false
false
0
0
0
0
0
0
2.246073
false
false
4
14b85426778f8d4b3d1b7714f5514bb5a99b6719
30,296,699,320,734
402b5395520b7f980a6469af3d58b2eabc25540a
/src/main/java/coreen/util/IdMap.java
2559d9435257d242022f5e22537eac38b53d04b6
[]
no_license
radughetu/coreen
https://github.com/radughetu/coreen
a65d14e90d3650fb4541f9a3cbb4bc5afff47b15
f6f238d2d3dfcbc38cbd63fb2d36656605ddccc2
refs/heads/master
2021-01-20T11:32:10.324000
2011-09-19T00:46:03
2011-09-19T00:46:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// // $Id$ package coreen.util; import java.util.HashMap; import java.util.Map; import com.threerings.gwt.util.Value; /** * A convenient map from an id to {@link Value}s which automatically creates entries as needed. */ public class IdMap<T> { /** * Creates an id map with the supplied default value. */ public static <T> IdMap<T> create (T defval) { return new IdMap<T>(defval); } /** * Returns, creating if needed, the value for the specified id. */ public Value<T> get (long id) { Value<T> value = _map.get(id); if (value == null) { _map.put(id, value = Value.create(_defval)); } return value; } protected IdMap (T defval) { _defval = defval; } protected T _defval; protected Map<Long, Value<T>> _map = new HashMap<Long, Value<T>>(); }
UTF-8
Java
876
java
IdMap.java
Java
[]
null
[]
// // $Id$ package coreen.util; import java.util.HashMap; import java.util.Map; import com.threerings.gwt.util.Value; /** * A convenient map from an id to {@link Value}s which automatically creates entries as needed. */ public class IdMap<T> { /** * Creates an id map with the supplied default value. */ public static <T> IdMap<T> create (T defval) { return new IdMap<T>(defval); } /** * Returns, creating if needed, the value for the specified id. */ public Value<T> get (long id) { Value<T> value = _map.get(id); if (value == null) { _map.put(id, value = Value.create(_defval)); } return value; } protected IdMap (T defval) { _defval = defval; } protected T _defval; protected Map<Long, Value<T>> _map = new HashMap<Long, Value<T>>(); }
876
0.578767
0.578767
42
19.857143
22.743467
95
false
false
0
0
0
0
0
0
0.380952
false
false
4
9324df460e179892f222e81dacffc7369ebf4ef8
33,105,607,939,319
83ba2b03e982e8536d7b0f8820d8d84a1c7e5739
/chainStore/code/java/storePrj/chainRestClient/src/main/java/com/hq/chainClient/service/chainCard/apiData/MemberCardAllotForm.java
27251392c4a822475bd2bcbaf2e171a127d9cb48
[]
no_license
wengxingxia/saas-java
https://github.com/wengxingxia/saas-java
ddc21a9fe386c7903f494452a5bd8df84c30383b
635fec53d0c1b5c179dd0104ef60def06c2a2538
refs/heads/master
2020-03-31T12:17:09.370000
2018-10-09T07:49:35
2018-10-09T07:49:35
152,210,173
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hq.chainClient.service.chainCard.apiData; import java.util.HashSet; import java.util.Set; public class MemberCardAllotForm { private String id; private Set<Long> applyStoreIds = new HashSet<Long>(); public static MemberCardAllotForm newInstance() { return new MemberCardAllotForm(); } public static MemberCardAllotForm newInstance(String idP, Set<Long> applyStoreIdsP) { MemberCardAllotForm data = new MemberCardAllotForm(); data.id = idP; data.applyStoreIds = applyStoreIdsP; return data; } public String getId() { return id; } public void setId(String id) { this.id = id; } public Set<Long> getApplyStoreIds() { return applyStoreIds; } public void setApplyStoreIds(Set<Long> applyStoreIds) { this.applyStoreIds = applyStoreIds; } }
UTF-8
Java
786
java
MemberCardAllotForm.java
Java
[]
null
[]
package com.hq.chainClient.service.chainCard.apiData; import java.util.HashSet; import java.util.Set; public class MemberCardAllotForm { private String id; private Set<Long> applyStoreIds = new HashSet<Long>(); public static MemberCardAllotForm newInstance() { return new MemberCardAllotForm(); } public static MemberCardAllotForm newInstance(String idP, Set<Long> applyStoreIdsP) { MemberCardAllotForm data = new MemberCardAllotForm(); data.id = idP; data.applyStoreIds = applyStoreIdsP; return data; } public String getId() { return id; } public void setId(String id) { this.id = id; } public Set<Long> getApplyStoreIds() { return applyStoreIds; } public void setApplyStoreIds(Set<Long> applyStoreIds) { this.applyStoreIds = applyStoreIds; } }
786
0.746819
0.746819
36
20.833334
21.885433
86
false
false
0
0
0
0
0
0
1.305556
false
false
4
32e18daffc9812e374cf2b2d3b66a6ff70dace70
12,498,354,832,270
d27a42e941145d33f19d30532a755b77db2e7273
/MedicationRecord/app/src/main/java/com/jsc5565/medication/medicationrecord/AddMedicationActivity.java
377aa9ed314d3ce1642408013b9b8b4652e17498
[]
no_license
jsc2576/ShowClock
https://github.com/jsc2576/ShowClock
85e794cec1e441740ad3b2c649c15c6068317731
cf7097a3b2d9facaed21bcbec2a531b1b655722a
refs/heads/master
2021-03-30T16:03:31.046000
2018-01-19T06:54:05
2018-01-19T06:54:05
83,188,087
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jsc5565.medication.medicationrecord; import android.media.Image; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.AppCompatSpinner; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageView; import org.json.JSONObject; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import hiruashi.jsc5565.packingproject.Packing.PackHttpTask; public class AddMedicationActivity extends AppCompatActivity implements View.OnClickListener{ AppCompatSpinner medi_maker; AppCompatSpinner medi_color; AppCompatSpinner medi_u_shp; AppCompatSpinner medi_shp; AppCompatSpinner medi_split_line; PackHttpTask[] packHttpTasks; String url = "http://ec2-13-124-90-171.ap-northeast-2.compute.amazonaws.com"; String[] path = {"/getInfo/maker", "/getInfo/mediColor", "/getInfo/mediUShape", "/getInfo/mediShape", "/getInfo/mediSplitLine"}; String get_list_path = "/mediType/getName"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_medication); ImageView search = (ImageView)findViewById(R.id.medi_search_list); search.setOnClickListener(this); medi_maker = (AppCompatSpinner)findViewById(R.id.medi_maker); medi_color = (AppCompatSpinner)findViewById(R.id.medi_color); medi_u_shp = (AppCompatSpinner)findViewById(R.id.medi_u_shp); medi_shp = (AppCompatSpinner)findViewById(R.id.medi_shp); medi_split_line = (AppCompatSpinner)findViewById(R.id.medi_split_line); packHttpTasks = new PackHttpTask[5]; ArrayAdapter[] arrayAdapters = new ArrayAdapter[5]; for(int i=0; i<5; i++){ packHttpTasks[i] = new PackHttpTask(url+path[i]); packHttpTasks[i].setRequestMethod("POST"); try { String result = packHttpTasks[i].execute().get(); List result_list = FormattoList(result); arrayAdapters[i] = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, result_list); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } medi_maker.setAdapter(arrayAdapters[0]); medi_color.setAdapter(arrayAdapters[1]); medi_u_shp.setAdapter(arrayAdapters[2]); medi_shp.setAdapter(arrayAdapters[3]); medi_split_line.setAdapter(arrayAdapters[4]); } public List FormattoList(String a){ Log.i("string", a); a = a.replace("[", ""); a = a.replace("]", ""); a = a.replace("\"", ""); List list = Arrays.asList(a.split(",")); return list; } @Override public void onClick(View view) { PackHttpTask pht = new PackHttpTask(url+get_list_path); pht.setRequestMethod("POST"); HashMap req_data = new HashMap(); req_data.put("medi_maker", medi_maker.getSelectedItem().toString()); req_data.put("medi_color", medi_color.getSelectedItem().toString()); req_data.put("medi_u_shp", medi_u_shp.getSelectedItem().toString()); req_data.put("medi_shp", medi_shp.getSelectedItem().toString()); req_data.put("medi_split_line", medi_split_line.getSelectedItem().toString()); JSONObject req_json = new JSONObject(req_data); pht.setData(req_json.toString()); try { String result = pht.execute().get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } }
UTF-8
Java
3,900
java
AddMedicationActivity.java
Java
[]
null
[]
package com.jsc5565.medication.medicationrecord; import android.media.Image; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.AppCompatSpinner; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageView; import org.json.JSONObject; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import hiruashi.jsc5565.packingproject.Packing.PackHttpTask; public class AddMedicationActivity extends AppCompatActivity implements View.OnClickListener{ AppCompatSpinner medi_maker; AppCompatSpinner medi_color; AppCompatSpinner medi_u_shp; AppCompatSpinner medi_shp; AppCompatSpinner medi_split_line; PackHttpTask[] packHttpTasks; String url = "http://ec2-13-124-90-171.ap-northeast-2.compute.amazonaws.com"; String[] path = {"/getInfo/maker", "/getInfo/mediColor", "/getInfo/mediUShape", "/getInfo/mediShape", "/getInfo/mediSplitLine"}; String get_list_path = "/mediType/getName"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_medication); ImageView search = (ImageView)findViewById(R.id.medi_search_list); search.setOnClickListener(this); medi_maker = (AppCompatSpinner)findViewById(R.id.medi_maker); medi_color = (AppCompatSpinner)findViewById(R.id.medi_color); medi_u_shp = (AppCompatSpinner)findViewById(R.id.medi_u_shp); medi_shp = (AppCompatSpinner)findViewById(R.id.medi_shp); medi_split_line = (AppCompatSpinner)findViewById(R.id.medi_split_line); packHttpTasks = new PackHttpTask[5]; ArrayAdapter[] arrayAdapters = new ArrayAdapter[5]; for(int i=0; i<5; i++){ packHttpTasks[i] = new PackHttpTask(url+path[i]); packHttpTasks[i].setRequestMethod("POST"); try { String result = packHttpTasks[i].execute().get(); List result_list = FormattoList(result); arrayAdapters[i] = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, result_list); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } medi_maker.setAdapter(arrayAdapters[0]); medi_color.setAdapter(arrayAdapters[1]); medi_u_shp.setAdapter(arrayAdapters[2]); medi_shp.setAdapter(arrayAdapters[3]); medi_split_line.setAdapter(arrayAdapters[4]); } public List FormattoList(String a){ Log.i("string", a); a = a.replace("[", ""); a = a.replace("]", ""); a = a.replace("\"", ""); List list = Arrays.asList(a.split(",")); return list; } @Override public void onClick(View view) { PackHttpTask pht = new PackHttpTask(url+get_list_path); pht.setRequestMethod("POST"); HashMap req_data = new HashMap(); req_data.put("medi_maker", medi_maker.getSelectedItem().toString()); req_data.put("medi_color", medi_color.getSelectedItem().toString()); req_data.put("medi_u_shp", medi_u_shp.getSelectedItem().toString()); req_data.put("medi_shp", medi_shp.getSelectedItem().toString()); req_data.put("medi_split_line", medi_split_line.getSelectedItem().toString()); JSONObject req_json = new JSONObject(req_data); pht.setData(req_json.toString()); try { String result = pht.execute().get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } }
3,900
0.654615
0.646667
107
35.448597
27.389278
132
false
false
0
0
0
0
0
0
0.794393
false
false
4
e9fdaa4174c69c45e017850615b807a6242f348e
21,251,498,199,156
131a54cbc8bdd4fca14156042ecb9571620c5ef1
/src/dao/TipoCarnavalDao.java
42f16a0ed0eedc0617d7ac1c7c14ca8b6bbe7247
[]
no_license
JonatasRodrigues/gestao-carnaval
https://github.com/JonatasRodrigues/gestao-carnaval
ea0d0b5037af284b3c92dc61d6d8049055545f38
9945248bd900310ff030ddd3e5536aaa2306b19c
refs/heads/master
2016-08-08T09:22:14.066000
2015-06-19T00:57:52
2015-06-19T00:57:52
34,172,093
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import model.TipoCarnaval; public class TipoCarnavalDao extends ConnectionFactory { public List<TipoCarnaval> findAll() { List<TipoCarnaval> lista = new ArrayList<>(); try { open(); Statement stm = con.createStatement(); ResultSet rs = stm.executeQuery("Select * from tipo_carnaval"); while (rs.next()) { TipoCarnaval tipoCarnaval = new TipoCarnaval(); tipoCarnaval.setId(rs.getInt("idTipoCarnaval")); tipoCarnaval.setDescricao(rs.getString("descricao")); lista.add(tipoCarnaval); } stm.close(); close(); } catch (Exception e) { e.printStackTrace(); } return lista; } public TipoCarnaval obterPorId(int idTipoCarnaval){ TipoCarnaval tipoCarnaval = new TipoCarnaval(); try { open(); String sql = "Select * from tipo_carnaval WHERE idTipoCarnaval = ?"; stmt = con.prepareStatement(sql); stmt.setInt(1,idTipoCarnaval); ResultSet rs = stmt.executeQuery(); while (rs.next()) { tipoCarnaval.setId(idTipoCarnaval); tipoCarnaval.setDescricao(rs.getString("descricao")); } stmt.close(); close(); } catch (Exception e) { e.printStackTrace(); } return tipoCarnaval; } }
UTF-8
Java
1,337
java
TipoCarnavalDao.java
Java
[]
null
[]
package dao; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import model.TipoCarnaval; public class TipoCarnavalDao extends ConnectionFactory { public List<TipoCarnaval> findAll() { List<TipoCarnaval> lista = new ArrayList<>(); try { open(); Statement stm = con.createStatement(); ResultSet rs = stm.executeQuery("Select * from tipo_carnaval"); while (rs.next()) { TipoCarnaval tipoCarnaval = new TipoCarnaval(); tipoCarnaval.setId(rs.getInt("idTipoCarnaval")); tipoCarnaval.setDescricao(rs.getString("descricao")); lista.add(tipoCarnaval); } stm.close(); close(); } catch (Exception e) { e.printStackTrace(); } return lista; } public TipoCarnaval obterPorId(int idTipoCarnaval){ TipoCarnaval tipoCarnaval = new TipoCarnaval(); try { open(); String sql = "Select * from tipo_carnaval WHERE idTipoCarnaval = ?"; stmt = con.prepareStatement(sql); stmt.setInt(1,idTipoCarnaval); ResultSet rs = stmt.executeQuery(); while (rs.next()) { tipoCarnaval.setId(idTipoCarnaval); tipoCarnaval.setDescricao(rs.getString("descricao")); } stmt.close(); close(); } catch (Exception e) { e.printStackTrace(); } return tipoCarnaval; } }
1,337
0.666417
0.665669
51
24.215687
19.538111
71
false
false
0
0
0
0
0
0
2.627451
false
false
4
c79e19fcca1738703f1b96fd17a03f178f15da87
11,312,943,898,783
6b5719c3ede6a1947f04c0ca3661bed7209d11d0
/src/SalaPersister.java
7b961992b9ff4942407a6a857b077c78eaa68758
[]
no_license
kaiqueferreiratemp/Gerenciador_de_treinamento
https://github.com/kaiqueferreiratemp/Gerenciador_de_treinamento
ebfa788b475cc88ea02ebaa5c397b302e16c178e
1012fcdd2ca9ed79345b6423bc81cc72ed6406e4
refs/heads/master
2023-03-22T04:08:58.970000
2021-02-28T19:24:45
2021-02-28T19:24:45
343,194,111
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import java.util.regex.Pattern; public class SalaPersister { public void limparSalas() throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter("Salas.txt")); writer.close(); } public void escritaSalas(CadastroSalasEspacos sala) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter("Salas.txt", true)); writer.write(sala.nome+","); writer.write(String.valueOf(sala.lotacao)); writer.newLine(); writer.close(); } public ArrayList<CadastroSalasEspacos> leituraSalas() throws IOException { ArrayList<CadastroSalasEspacos> _listaDeSalas = new ArrayList<>(); Scanner scan = new Scanner(new File("Salas.txt")); scan.useDelimiter(Pattern.compile(",")); while (scan.hasNext()) { CadastroSalasEspacos sala = new CadastroSalasEspacos(); sala.setNome(scan.next()); sala.setLotacao(Integer.parseInt(scan.nextLine().substring(1))); _listaDeSalas.add(sala); } return _listaDeSalas; } }
UTF-8
Java
1,264
java
SalaPersister.java
Java
[]
null
[]
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import java.util.regex.Pattern; public class SalaPersister { public void limparSalas() throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter("Salas.txt")); writer.close(); } public void escritaSalas(CadastroSalasEspacos sala) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter("Salas.txt", true)); writer.write(sala.nome+","); writer.write(String.valueOf(sala.lotacao)); writer.newLine(); writer.close(); } public ArrayList<CadastroSalasEspacos> leituraSalas() throws IOException { ArrayList<CadastroSalasEspacos> _listaDeSalas = new ArrayList<>(); Scanner scan = new Scanner(new File("Salas.txt")); scan.useDelimiter(Pattern.compile(",")); while (scan.hasNext()) { CadastroSalasEspacos sala = new CadastroSalasEspacos(); sala.setNome(scan.next()); sala.setLotacao(Integer.parseInt(scan.nextLine().substring(1))); _listaDeSalas.add(sala); } return _listaDeSalas; } }
1,264
0.667722
0.66693
38
32.236843
26.268286
86
false
false
0
0
0
0
0
0
0.657895
false
false
4
e9f4e1a2f17c1bdc41f3d529d4e0438130a90a56
15,668,040,717,869
d71ba238d842b96eba67f6d9379765ce3ec82e9b
/sunshine-base/src/main/java/red/lixiang/tools/algorithm/stack/Main.java
9fa7c617cad128098c3be9e7668189763d48501f
[ "MIT" ]
permissive
xiaodaojava/sunshine
https://github.com/xiaodaojava/sunshine
8b3b9c40577d9d88ce59b69ec0ed31018d7f2e6b
a7f505b27d0b912b6998eccd9095648c58118c9b
refs/heads/master
2022-12-13T19:55:42.989000
2022-12-05T14:48:49
2022-12-05T14:48:49
242,741,257
24
7
MIT
false
2020-09-02T08:52:06
2020-02-24T13:19:00
2020-08-27T07:00:52
2020-09-02T08:52:06
427
13
2
0
Java
false
false
package red.lixiang.tools.algorithm.stack; import java.util.ArrayDeque; import java.util.Deque; import java.util.Stack; public class Main { public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<>(); deque.push(3); deque.push(5); Integer poll = deque.pop(); System.out.println(deque); } }
UTF-8
Java
364
java
Main.java
Java
[]
null
[]
package red.lixiang.tools.algorithm.stack; import java.util.ArrayDeque; import java.util.Deque; import java.util.Stack; public class Main { public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<>(); deque.push(3); deque.push(5); Integer poll = deque.pop(); System.out.println(deque); } }
364
0.64011
0.634615
16
21.75
16.219202
50
false
false
0
0
0
0
0
0
0.5625
false
false
4
22df4e94c1845b06f1b88a495d8cb32cb8bbb58c
21,397,527,084,609
ac49190345e921dded73833e24bd2ca7a0a31578
/HW11-0036489629/src/hr/fer/zemris/java/hw11/jnotepadpp/local/AbstractLocalizationProvider.java
e697d399b4e95990d8b915c8d85dd1b648dfa7d7
[]
no_license
the-JJ/FER-OPJJ
https://github.com/the-JJ/FER-OPJJ
a15871cfd042662bebb1416969b2e96832c0ec07
fce1288119b60c3a3666c09c463fdc7d208d1888
refs/heads/master
2021-06-01T18:00:16.700000
2016-09-03T10:58:24
2016-09-03T10:58:24
67,282,608
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package hr.fer.zemris.java.hw11.jnotepadpp.local; import java.util.LinkedList; import java.util.List; /** * Implements ILocalizationProvider interface and adds it the ability to * register, de-register and inform (fire() method) listeners. It is an abstract * class – it does not implement getString(...) method. * * @author Juraj Juričić */ public abstract class AbstractLocalizationProvider implements ILocalizationProvider { /** The list of listeners. */ private List<ILocalizationListener> listeners = new LinkedList<>(); @Override public void addLocalizationListener(ILocalizationListener l) { listeners.add(l); } @Override public void removeLocalizationListener(ILocalizationListener l) { listeners.remove(l); } /** * Notifies all registered listeners about the change. */ protected void fire() { for (ILocalizationListener l : listeners) { l.localizationChanged(); } } }
UTF-8
Java
922
java
AbstractLocalizationProvider.java
Java
[ { "context": "not implement getString(...) method.\n *\n * @author Juraj Juričić\n */\npublic abstract class AbstractLocalizationPro", "end": 345, "score": 0.9998798966407776, "start": 332, "tag": "NAME", "value": "Juraj Juričić" } ]
null
[]
package hr.fer.zemris.java.hw11.jnotepadpp.local; import java.util.LinkedList; import java.util.List; /** * Implements ILocalizationProvider interface and adds it the ability to * register, de-register and inform (fire() method) listeners. It is an abstract * class – it does not implement getString(...) method. * * @author <NAME> */ public abstract class AbstractLocalizationProvider implements ILocalizationProvider { /** The list of listeners. */ private List<ILocalizationListener> listeners = new LinkedList<>(); @Override public void addLocalizationListener(ILocalizationListener l) { listeners.add(l); } @Override public void removeLocalizationListener(ILocalizationListener l) { listeners.remove(l); } /** * Notifies all registered listeners about the change. */ protected void fire() { for (ILocalizationListener l : listeners) { l.localizationChanged(); } } }
913
0.744009
0.74183
38
23.18421
24.894361
80
false
false
0
0
0
0
0
0
0.894737
false
false
4
25a7c351333538bac787c7b63558c28391dfb6ba
8,074,538,576,977
8058df2aab36493374f587de4489ea77ccbedd41
/Defense/Manife/src/app/src/main/java/com/sctf2019/manife/HashBuilder.java
32c6a926fb554077d5c1a163f1464aeb00c36f70
[]
no_license
synod2/sstf2019
https://github.com/synod2/sstf2019
4a6cea95f5dc0033b42e242f5c6bdca38e887eb6
4dc6c70cf290168aab0eb8212f2b8004feaf97d8
refs/heads/master
2020-07-12T17:53:24.964000
2019-08-28T07:47:40
2019-08-28T07:47:40
204,876,601
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sctf2019.manife; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.content.res.XmlResourceParser; import android.util.Log; import androidx.annotation.NonNull; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.nio.charset.Charset; import java.security.MessageDigest; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_DOCUMENT; import static org.xmlpull.v1.XmlPullParser.START_TAG; /** * @author vkarko * @since 30.05.19 18:21 */ public class HashBuilder extends Visitor<HashNode> { private final MessageDigest md; private final Map<String, Set<String>> excludes = new HashMap<>(); public HashBuilder(@NonNull MessageDigest md) { this.md = md; } public HashBuilder excludeTag(String name) { excludes.computeIfAbsent(name, __ -> new HashSet<>()); return this; } public HashBuilder excludeAttribute(String tagName, String attrName) { excludes.computeIfAbsent(tagName, __ -> new HashSet<>()).add(attrName); return this; } @Override protected boolean onVisit(@NonNull HashNode node) { node.value = CryptoUtils.toHex(md.digest(node.value.getBytes(Charset.forName("UTF-8")))); if (!node.isEmpty()) { byte[] bytes = new byte[md.getDigestLength()]; for (Node<String> kid : node) { bytes = CryptoUtils.xor(bytes, CryptoUtils.toBytes(kid.value)); } node.value = CryptoUtils.toHex(md.digest(CryptoUtils.add(CryptoUtils.toBytes(node.value), bytes))); } return true; } @NonNull public HashNode build(@NonNull Context context) { try { final AssetManager assetManager = context.createPackageContext(context.getPackageName(), 0).getAssets(); final HashNode root = new HashNode(); try (final XmlResourceParser parser = assetManager.openXmlResourceParser(0, "AndroidManifest.xml")) { HashNode current = root; for (int event = parser.getEventType(); event != XmlPullParser.END_DOCUMENT; event = parser.nextToken()) { switch (event) { case START_DOCUMENT: break; case START_TAG: { final String tag = parser.getName(); final Set<String> banned = excludes.getOrDefault(tag, Collections.emptySet()); //noinspection ConstantConditions if (!excludes.containsKey(tag) || !banned.isEmpty()) { current = new HashNode(tag, current); Log.i("HashBuilder", current.toString()); for (int i = 0; i < parser.getAttributeCount(); i++) { final String attribute = parser.getAttributeName(i); //noinspection ConstantConditions if (!banned.contains(attribute)) { final HashNode n = new HashNode(attribute + "=" + parser.getAttributeValue(i), current); Log.i("HashBuilder", n.toString()); } } } } break; case END_TAG: { if (current != null) { current = current.getParent(); } } break; default: throw new UnsupportedOperationException(); } } } catch (IOException | XmlPullParserException e) { throw new RuntimeException(e); } accept(root); return root; } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException(e); } } }
UTF-8
Java
4,423
java
HashBuilder.java
Java
[ { "context": "ull.v1.XmlPullParser.START_TAG;\r\n\r\n/**\r\n * @author vkarko\r\n * @since 30.05.19 18:21\r\n */\r\npublic class Hash", "end": 776, "score": 0.9941189289093018, "start": 770, "tag": "USERNAME", "value": "vkarko" } ]
null
[]
package com.sctf2019.manife; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.content.res.XmlResourceParser; import android.util.Log; import androidx.annotation.NonNull; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.nio.charset.Charset; import java.security.MessageDigest; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_DOCUMENT; import static org.xmlpull.v1.XmlPullParser.START_TAG; /** * @author vkarko * @since 30.05.19 18:21 */ public class HashBuilder extends Visitor<HashNode> { private final MessageDigest md; private final Map<String, Set<String>> excludes = new HashMap<>(); public HashBuilder(@NonNull MessageDigest md) { this.md = md; } public HashBuilder excludeTag(String name) { excludes.computeIfAbsent(name, __ -> new HashSet<>()); return this; } public HashBuilder excludeAttribute(String tagName, String attrName) { excludes.computeIfAbsent(tagName, __ -> new HashSet<>()).add(attrName); return this; } @Override protected boolean onVisit(@NonNull HashNode node) { node.value = CryptoUtils.toHex(md.digest(node.value.getBytes(Charset.forName("UTF-8")))); if (!node.isEmpty()) { byte[] bytes = new byte[md.getDigestLength()]; for (Node<String> kid : node) { bytes = CryptoUtils.xor(bytes, CryptoUtils.toBytes(kid.value)); } node.value = CryptoUtils.toHex(md.digest(CryptoUtils.add(CryptoUtils.toBytes(node.value), bytes))); } return true; } @NonNull public HashNode build(@NonNull Context context) { try { final AssetManager assetManager = context.createPackageContext(context.getPackageName(), 0).getAssets(); final HashNode root = new HashNode(); try (final XmlResourceParser parser = assetManager.openXmlResourceParser(0, "AndroidManifest.xml")) { HashNode current = root; for (int event = parser.getEventType(); event != XmlPullParser.END_DOCUMENT; event = parser.nextToken()) { switch (event) { case START_DOCUMENT: break; case START_TAG: { final String tag = parser.getName(); final Set<String> banned = excludes.getOrDefault(tag, Collections.emptySet()); //noinspection ConstantConditions if (!excludes.containsKey(tag) || !banned.isEmpty()) { current = new HashNode(tag, current); Log.i("HashBuilder", current.toString()); for (int i = 0; i < parser.getAttributeCount(); i++) { final String attribute = parser.getAttributeName(i); //noinspection ConstantConditions if (!banned.contains(attribute)) { final HashNode n = new HashNode(attribute + "=" + parser.getAttributeValue(i), current); Log.i("HashBuilder", n.toString()); } } } } break; case END_TAG: { if (current != null) { current = current.getParent(); } } break; default: throw new UnsupportedOperationException(); } } } catch (IOException | XmlPullParserException e) { throw new RuntimeException(e); } accept(root); return root; } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException(e); } } }
4,423
0.542392
0.537192
118
35.483051
31.520435
128
false
false
0
0
0
0
0
0
0.601695
false
false
4
cae5ca6e4726e030b80e24431e5c0df315da2f25
17,910,013,685,418
8e14990b0dea30418d0cedf72de4db187e743c5c
/client/src/main/java/client/service/Checkout.java
479d2fc5f9c15120d7a596b1385062eb06828de0
[]
no_license
magnuspaal/minigit
https://github.com/magnuspaal/minigit
6da9008a01da1590a79776a9c2732192d5e42eab
0191dab66b1adfba42abd7a8b614e2de93f2fa8f
refs/heads/master
2020-04-28T05:24:04.836000
2019-05-16T07:38:37
2019-05-16T07:38:37
175,018,575
0
1
null
false
2019-05-12T16:32:37
2019-03-11T14:33:26
2019-05-12T16:18:20
2019-05-12T16:32:37
1,337
0
0
0
Java
false
false
package client.service; import models.Utils; import models.ZipUtils; import net.lingala.zip4j.exception.ZipException; import java.io.IOException; public class Checkout { public static void checkout(String commitHash) throws ZipException, IOException { Utils.cleanWorkingDirectory(); ZipUtils.extractZipFile(String.valueOf(Utils.seekMinigitFolder().resolve(commitHash + ".zip")), String.valueOf(Utils.seekRepoRootFolder())); } }
UTF-8
Java
456
java
Checkout.java
Java
[]
null
[]
package client.service; import models.Utils; import models.ZipUtils; import net.lingala.zip4j.exception.ZipException; import java.io.IOException; public class Checkout { public static void checkout(String commitHash) throws ZipException, IOException { Utils.cleanWorkingDirectory(); ZipUtils.extractZipFile(String.valueOf(Utils.seekMinigitFolder().resolve(commitHash + ".zip")), String.valueOf(Utils.seekRepoRootFolder())); } }
456
0.765351
0.763158
15
29.4
38.861805
148
false
false
0
0
0
0
0
0
0.6
false
false
4
f98390a27b5b239f35b9560efb8db27eef2ec434
16,535,624,155,180
6faa437b23555e38d37294a45dcdbef0d956e4ac
/src/main/java/jenkinsPages/JenkinsNewItemPage.java
893962d9a08bebdae9f0b93dcc83edca42948dd2
[]
no_license
matt712/testing-assess
https://github.com/matt712/testing-assess
26b340c986287667d13ca00c9f518681696105b0
e0df61a3198410d4ac7481556c660973e8cc40c2
refs/heads/master
2020-04-26T05:09:41.152000
2019-03-01T13:27:20
2019-03-01T13:27:20
173,324,655
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jenkinsPages; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; public class JenkinsNewItemPage { private WebDriver driver; @FindBy(id="name") private WebElement entryBox; @FindBy(className="hudson_model_FreeStyleProject") private WebElement freestyleBox; @FindBy(id="ok-button") private WebElement entryButton; public void enterNameOfItem() { entryBox.click(); } public void clickFreeBox() { freestyleBox.click(); } public void clickEntryButton() { entryButton.click(); } }
UTF-8
Java
673
java
JenkinsNewItemPage.java
Java
[]
null
[]
package jenkinsPages; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; public class JenkinsNewItemPage { private WebDriver driver; @FindBy(id="name") private WebElement entryBox; @FindBy(className="hudson_model_FreeStyleProject") private WebElement freestyleBox; @FindBy(id="ok-button") private WebElement entryButton; public void enterNameOfItem() { entryBox.click(); } public void clickFreeBox() { freestyleBox.click(); } public void clickEntryButton() { entryButton.click(); } }
673
0.780089
0.780089
28
23.035715
16.012232
51
false
false
0
0
0
0
0
0
1.178571
false
false
4
9ce9beb4de30f1c631957b06d272bb4bb7c8e723
11,802,570,142,551
3191281513d3174a55e7ad1ca5b1c29f607e19b3
/aeron-client/src/main/java/io/aeron/command/CounterMessageFlyweight.java
7f3291952932e55ab41df0f91424c7e13697635b
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
real-logic/aeron
https://github.com/real-logic/aeron
df84f5b97586abc9be04dc8110755db8b30dc9c1
d3414aa2bbb3f498af40429a152aa9f1057e24ee
refs/heads/master
2023-08-28T16:14:02.028000
2023-08-28T15:26:29
2023-08-28T15:26:29
16,621,659
4,254
663
Apache-2.0
false
2023-09-13T03:36:19
2014-02-07T17:16:58
2023-09-12T11:30:12
2023-09-13T02:53:34
62,086
6,692
829
19
Java
false
false
/* * Copyright 2014-2023 Real Logic Limited. * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.aeron.command; import io.aeron.exceptions.ControlProtocolException; import org.agrona.DirectBuffer; import org.agrona.MutableDirectBuffer; import static io.aeron.ErrorCode.MALFORMED_COMMAND; import static org.agrona.BitUtil.*; /** * Message to denote a new counter. * <p> * <b>Note:</b> Layout should be SBE 2.0 compliant so that the label length is aligned. * * @see ControlProtocolEvents * <pre> * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Client ID | * | | * +---------------------------------------------------------------+ * | Correlation ID | * | | * +---------------------------------------------------------------+ * | Counter Type ID | * +---------------------------------------------------------------+ * | Key Length | * +---------------------------------------------------------------+ * | Key Buffer ... * ... | * +---------------------------------------------------------------+ * | Label Length | * +---------------------------------------------------------------+ * | Label (ASCII) ... * ... | * +---------------------------------------------------------------+ * </pre> */ public class CounterMessageFlyweight extends CorrelatedMessageFlyweight { private static final int COUNTER_TYPE_ID_FIELD_OFFSET = CORRELATION_ID_FIELD_OFFSET + SIZE_OF_LONG; private static final int KEY_LENGTH_OFFSET = COUNTER_TYPE_ID_FIELD_OFFSET + SIZE_OF_INT; static final int KEY_BUFFER_OFFSET = KEY_LENGTH_OFFSET + SIZE_OF_INT; private static final int MINIMUM_LENGTH = KEY_BUFFER_OFFSET + SIZE_OF_INT; /** * Wrap the buffer at a given offset for updates. * * @param buffer to wrap. * @param offset at which the message begins. * @return this for a fluent API. */ public CounterMessageFlyweight wrap(final MutableDirectBuffer buffer, final int offset) { super.wrap(buffer, offset); return this; } /** * Get type id field. * * @return type id field. */ public int typeId() { return buffer.getInt(offset + COUNTER_TYPE_ID_FIELD_OFFSET); } /** * Set counter type id field. * * @param typeId field value. * @return this for a fluent API. */ public CounterMessageFlyweight typeId(final int typeId) { buffer.putInt(offset + COUNTER_TYPE_ID_FIELD_OFFSET, typeId); return this; } /** * Relative offset of the key buffer. * * @return relative offset of the key buffer. */ public int keyBufferOffset() { return KEY_BUFFER_OFFSET; } /** * Length of the key buffer in bytes. * * @return length of key buffer in bytes. */ public int keyBufferLength() { return buffer.getInt(offset + KEY_LENGTH_OFFSET); } /** * Fill the key buffer. * * @param keyBuffer containing the optional key for the counter. * @param keyOffset within the keyBuffer at which the key begins. * @param keyLength of the key in the keyBuffer. * @return this for a fluent API. */ public CounterMessageFlyweight keyBuffer(final DirectBuffer keyBuffer, final int keyOffset, final int keyLength) { buffer.putInt(offset + KEY_LENGTH_OFFSET, keyLength); if (null != keyBuffer && keyLength > 0) { buffer.putBytes(offset + KEY_BUFFER_OFFSET, keyBuffer, keyOffset, keyLength); } return this; } /** * Relative offset of label buffer. * * @return relative offset of label buffer. */ public int labelBufferOffset() { return labelLengthOffset() + SIZE_OF_INT; } /** * Length of label buffer in bytes. * * @return length of label buffer in bytes. */ public int labelBufferLength() { return buffer.getInt(offset + labelLengthOffset()); } /** * Fill the label buffer. * * @param labelBuffer containing the mandatory label for the counter. * @param labelOffset within the labelBuffer at which the label begins. * @param labelLength of the label in the labelBuffer. * @return this for a fluent API. */ public CounterMessageFlyweight labelBuffer( final DirectBuffer labelBuffer, final int labelOffset, final int labelLength) { final int labelLengthOffset = labelLengthOffset(); buffer.putInt(offset + labelLengthOffset, labelLength); if (null != labelBuffer && labelLength > 0) { buffer.putBytes(offset + labelLengthOffset + SIZE_OF_INT, labelBuffer, labelOffset, labelLength); } return this; } /** * Fill the label. * * @param label for the counter. * @return this for a fluent API. */ public CounterMessageFlyweight label(final String label) { buffer.putStringAscii(offset + labelLengthOffset(), label); return this; } /** * Get the length of the current message. * <p> * NB: must be called after the data is written in order to be accurate. * * @return the length of the current message */ public int length() { final int labelOffset = labelLengthOffset(); return labelOffset + SIZE_OF_INT + labelBufferLength(); } /** * Validate buffer length is long enough for message. * * @param msgTypeId type of message. * @param length of message in bytes to validate. */ public void validateLength(final int msgTypeId, final int length) { if (length < MINIMUM_LENGTH) { throw new ControlProtocolException( MALFORMED_COMMAND, "command=" + msgTypeId + " too short: length=" + length); } final int labelOffset = labelLengthOffset(); if ((length - labelOffset) < SIZE_OF_INT) { throw new ControlProtocolException( MALFORMED_COMMAND, "command=" + msgTypeId + " too short for key: length=" + length); } final int encodedLength = length(); if (length < encodedLength) { throw new ControlProtocolException( MALFORMED_COMMAND, "command=" + msgTypeId + " too short for label: length=" + length + " encodedLength=" + encodedLength); } } /** * Compute the length of the command message given key and label length. * * @param keyLength to be appended. * @param labelLength to be appended. * @return the length of the command message given key and label length. */ public static int computeLength(final int keyLength, final int labelLength) { return MINIMUM_LENGTH + align(keyLength, SIZE_OF_INT) + SIZE_OF_INT + labelLength; } /** * {@inheritDoc} */ public String toString() { return "CounterMessageFlyweight{" + "clientId=" + clientId() + ", correlationId=" + correlationId() + ", typeId=" + typeId() + ", keyBufferOffset=" + keyBufferOffset() + ", keyBufferLength=" + keyBufferLength() + ", labelLengthOffset=" + labelLengthOffset() + ", labelBufferOffset=" + labelBufferOffset() + ", labelBufferLength=" + labelBufferLength() + ", length=" + length() + "}"; } private int labelLengthOffset() { return KEY_BUFFER_OFFSET + align(keyBufferLength(), SIZE_OF_INT); } }
UTF-8
Java
8,873
java
CounterMessageFlyweight.java
Java
[]
null
[]
/* * Copyright 2014-2023 Real Logic Limited. * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.aeron.command; import io.aeron.exceptions.ControlProtocolException; import org.agrona.DirectBuffer; import org.agrona.MutableDirectBuffer; import static io.aeron.ErrorCode.MALFORMED_COMMAND; import static org.agrona.BitUtil.*; /** * Message to denote a new counter. * <p> * <b>Note:</b> Layout should be SBE 2.0 compliant so that the label length is aligned. * * @see ControlProtocolEvents * <pre> * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Client ID | * | | * +---------------------------------------------------------------+ * | Correlation ID | * | | * +---------------------------------------------------------------+ * | Counter Type ID | * +---------------------------------------------------------------+ * | Key Length | * +---------------------------------------------------------------+ * | Key Buffer ... * ... | * +---------------------------------------------------------------+ * | Label Length | * +---------------------------------------------------------------+ * | Label (ASCII) ... * ... | * +---------------------------------------------------------------+ * </pre> */ public class CounterMessageFlyweight extends CorrelatedMessageFlyweight { private static final int COUNTER_TYPE_ID_FIELD_OFFSET = CORRELATION_ID_FIELD_OFFSET + SIZE_OF_LONG; private static final int KEY_LENGTH_OFFSET = COUNTER_TYPE_ID_FIELD_OFFSET + SIZE_OF_INT; static final int KEY_BUFFER_OFFSET = KEY_LENGTH_OFFSET + SIZE_OF_INT; private static final int MINIMUM_LENGTH = KEY_BUFFER_OFFSET + SIZE_OF_INT; /** * Wrap the buffer at a given offset for updates. * * @param buffer to wrap. * @param offset at which the message begins. * @return this for a fluent API. */ public CounterMessageFlyweight wrap(final MutableDirectBuffer buffer, final int offset) { super.wrap(buffer, offset); return this; } /** * Get type id field. * * @return type id field. */ public int typeId() { return buffer.getInt(offset + COUNTER_TYPE_ID_FIELD_OFFSET); } /** * Set counter type id field. * * @param typeId field value. * @return this for a fluent API. */ public CounterMessageFlyweight typeId(final int typeId) { buffer.putInt(offset + COUNTER_TYPE_ID_FIELD_OFFSET, typeId); return this; } /** * Relative offset of the key buffer. * * @return relative offset of the key buffer. */ public int keyBufferOffset() { return KEY_BUFFER_OFFSET; } /** * Length of the key buffer in bytes. * * @return length of key buffer in bytes. */ public int keyBufferLength() { return buffer.getInt(offset + KEY_LENGTH_OFFSET); } /** * Fill the key buffer. * * @param keyBuffer containing the optional key for the counter. * @param keyOffset within the keyBuffer at which the key begins. * @param keyLength of the key in the keyBuffer. * @return this for a fluent API. */ public CounterMessageFlyweight keyBuffer(final DirectBuffer keyBuffer, final int keyOffset, final int keyLength) { buffer.putInt(offset + KEY_LENGTH_OFFSET, keyLength); if (null != keyBuffer && keyLength > 0) { buffer.putBytes(offset + KEY_BUFFER_OFFSET, keyBuffer, keyOffset, keyLength); } return this; } /** * Relative offset of label buffer. * * @return relative offset of label buffer. */ public int labelBufferOffset() { return labelLengthOffset() + SIZE_OF_INT; } /** * Length of label buffer in bytes. * * @return length of label buffer in bytes. */ public int labelBufferLength() { return buffer.getInt(offset + labelLengthOffset()); } /** * Fill the label buffer. * * @param labelBuffer containing the mandatory label for the counter. * @param labelOffset within the labelBuffer at which the label begins. * @param labelLength of the label in the labelBuffer. * @return this for a fluent API. */ public CounterMessageFlyweight labelBuffer( final DirectBuffer labelBuffer, final int labelOffset, final int labelLength) { final int labelLengthOffset = labelLengthOffset(); buffer.putInt(offset + labelLengthOffset, labelLength); if (null != labelBuffer && labelLength > 0) { buffer.putBytes(offset + labelLengthOffset + SIZE_OF_INT, labelBuffer, labelOffset, labelLength); } return this; } /** * Fill the label. * * @param label for the counter. * @return this for a fluent API. */ public CounterMessageFlyweight label(final String label) { buffer.putStringAscii(offset + labelLengthOffset(), label); return this; } /** * Get the length of the current message. * <p> * NB: must be called after the data is written in order to be accurate. * * @return the length of the current message */ public int length() { final int labelOffset = labelLengthOffset(); return labelOffset + SIZE_OF_INT + labelBufferLength(); } /** * Validate buffer length is long enough for message. * * @param msgTypeId type of message. * @param length of message in bytes to validate. */ public void validateLength(final int msgTypeId, final int length) { if (length < MINIMUM_LENGTH) { throw new ControlProtocolException( MALFORMED_COMMAND, "command=" + msgTypeId + " too short: length=" + length); } final int labelOffset = labelLengthOffset(); if ((length - labelOffset) < SIZE_OF_INT) { throw new ControlProtocolException( MALFORMED_COMMAND, "command=" + msgTypeId + " too short for key: length=" + length); } final int encodedLength = length(); if (length < encodedLength) { throw new ControlProtocolException( MALFORMED_COMMAND, "command=" + msgTypeId + " too short for label: length=" + length + " encodedLength=" + encodedLength); } } /** * Compute the length of the command message given key and label length. * * @param keyLength to be appended. * @param labelLength to be appended. * @return the length of the command message given key and label length. */ public static int computeLength(final int keyLength, final int labelLength) { return MINIMUM_LENGTH + align(keyLength, SIZE_OF_INT) + SIZE_OF_INT + labelLength; } /** * {@inheritDoc} */ public String toString() { return "CounterMessageFlyweight{" + "clientId=" + clientId() + ", correlationId=" + correlationId() + ", typeId=" + typeId() + ", keyBufferOffset=" + keyBufferOffset() + ", keyBufferLength=" + keyBufferLength() + ", labelLengthOffset=" + labelLengthOffset() + ", labelBufferOffset=" + labelBufferOffset() + ", labelBufferLength=" + labelBufferLength() + ", length=" + length() + "}"; } private int labelLengthOffset() { return KEY_BUFFER_OFFSET + align(keyBufferLength(), SIZE_OF_INT); } }
8,873
0.530373
0.524513
268
32.108208
29.08235
119
false
false
0
0
0
0
0
0
0.343284
false
false
4
f3dafccfdfd87aabb105350114b82575e377960a
23,974,507,458,862
b868b5f00f76430aafec96327fbaa4171e144cb8
/TestGit/src/com/test/pojo/Student_PersonalInfo.java
83c15201308364a38c9c1b861a16a9376e4f9944
[]
no_license
Kundan2015/TestGit
https://github.com/Kundan2015/TestGit
c963b8a6afc41b84f4b69792a48812bf5fbc3a16
aa713dd85d7576f27ce6e8e45234901a5609a7a3
refs/heads/master
2020-03-23T15:52:43.399000
2019-03-06T12:25:47
2019-03-06T12:25:47
141,780,153
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test.pojo; public class Student_PersonalInfo { int sid; String sname; String address; public int getSid() { return sid; } public void setSid(int sid) { this.sid = sid; } public String getSname() { return sname; } public void setSname(String sname) { this.sname = sname; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
UTF-8
Java
456
java
Student_PersonalInfo.java
Java
[]
null
[]
package com.test.pojo; public class Student_PersonalInfo { int sid; String sname; String address; public int getSid() { return sid; } public void setSid(int sid) { this.sid = sid; } public String getSname() { return sname; } public void setSname(String sname) { this.sname = sname; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
456
0.644737
0.644737
26
15.538462
12.453701
41
false
false
0
0
0
0
0
0
1.461538
false
false
4
8cdff200e1dd2fe04430591b792d237d50f95f02
1,812,476,239,146
02a4449e9964dce7b128a87145547a8a8d0d1179
/src/model/Port.java
18eb49dbf0f4c5e25ecda5c85301ee671713f002
[]
no_license
smrealms/TheLazyTrader
https://github.com/smrealms/TheLazyTrader
affa59c7b73fcc65f0d7bcd44d8a43cba3cfe391
5a01be84ba3f3d9ab149a99a08a18ff0749eb82e
refs/heads/main
2022-10-21T00:35:28.433000
2022-09-28T01:38:08
2022-09-28T01:38:08
233,709,382
1
2
null
false
2022-09-28T01:38:10
2020-01-13T22:46:34
2022-09-26T07:05:14
2022-09-28T01:38:08
16,672
1
2
1
Java
false
false
package model; import java.util.HashMap; import java.util.Map; public class Port { private int portLevel; private int portRace; private final Map<Integer, Good> goods = new HashMap<Integer, Good>(); public Port() { // for(int i=0;i<goods.length;i++) // { // goods[i]=new Good(i); // } } public Port(int _portLevel) { // Port(); this.portLevel = _portLevel; } public void setPortLevel(int _portLevel) { this.portLevel = _portLevel; } public void setPortRace(int _portRace) { this.portRace = _portRace; } public void setGoodDistance(int goodId, int distanceIndex) { this.goods.get(goodId).setDistanceIndex(distanceIndex); } public void addPortBuy(int _goodId) { this.goods.put(_goodId, new Good(_goodId, Good.BUYS)); } public void addPortBuy(int _goodId, int distance) { this.goods.put(_goodId, new Good(_goodId, Good.BUYS, distance)); } public void addPortSell(int _goodId) { this.goods.put(_goodId, new Good(_goodId, Good.SELLS)); } public void addPortSell(int _goodId, int distance) { this.goods.put(_goodId, new Good(_goodId, Good.SELLS, distance)); } public int getGoodStatus(int _goodId) { Good g = this.goods.get(_goodId); if (g == null) return Good.UNAVAILABLE; return g.getState(); } public int getPortLevel() { return this.portLevel; } public int getPortRace() { return this.portRace; } public int getGoodDistance(int _goodId) { Good g = this.goods.get(_goodId); if (g == null) return 0; return g.getDistanceIndex(); } public Map<Integer, Good> getGoods() { return this.goods; } public boolean hasX(Object x) { if (x instanceof Good) { Good thisGood = this.goods.get(((Good) x).getGoodId()); if(thisGood!=null) return thisGood.matchesState(((Good) x).getState()); } if(x instanceof String) { String s = ((String)x).toUpperCase(); if(s.equals("GOODS")) return !this.getGoods().isEmpty(); if(s.equals("BOUGHT")||s.equals("SOLD")||s.equals("EITHER")) { for (Good g : this.getGoods().values()) { int state = g.getState(); return (s.equals("BOUGHT")&&state==Good.BUYS) || (s.equals("SOLD")&&state==Good.SELLS) || (s.equals("EITHER")&&(state==Good.SELLS||state==Good.BUYS)); } } } return false; } }
UTF-8
Java
2,277
java
Port.java
Java
[]
null
[]
package model; import java.util.HashMap; import java.util.Map; public class Port { private int portLevel; private int portRace; private final Map<Integer, Good> goods = new HashMap<Integer, Good>(); public Port() { // for(int i=0;i<goods.length;i++) // { // goods[i]=new Good(i); // } } public Port(int _portLevel) { // Port(); this.portLevel = _portLevel; } public void setPortLevel(int _portLevel) { this.portLevel = _portLevel; } public void setPortRace(int _portRace) { this.portRace = _portRace; } public void setGoodDistance(int goodId, int distanceIndex) { this.goods.get(goodId).setDistanceIndex(distanceIndex); } public void addPortBuy(int _goodId) { this.goods.put(_goodId, new Good(_goodId, Good.BUYS)); } public void addPortBuy(int _goodId, int distance) { this.goods.put(_goodId, new Good(_goodId, Good.BUYS, distance)); } public void addPortSell(int _goodId) { this.goods.put(_goodId, new Good(_goodId, Good.SELLS)); } public void addPortSell(int _goodId, int distance) { this.goods.put(_goodId, new Good(_goodId, Good.SELLS, distance)); } public int getGoodStatus(int _goodId) { Good g = this.goods.get(_goodId); if (g == null) return Good.UNAVAILABLE; return g.getState(); } public int getPortLevel() { return this.portLevel; } public int getPortRace() { return this.portRace; } public int getGoodDistance(int _goodId) { Good g = this.goods.get(_goodId); if (g == null) return 0; return g.getDistanceIndex(); } public Map<Integer, Good> getGoods() { return this.goods; } public boolean hasX(Object x) { if (x instanceof Good) { Good thisGood = this.goods.get(((Good) x).getGoodId()); if(thisGood!=null) return thisGood.matchesState(((Good) x).getState()); } if(x instanceof String) { String s = ((String)x).toUpperCase(); if(s.equals("GOODS")) return !this.getGoods().isEmpty(); if(s.equals("BOUGHT")||s.equals("SOLD")||s.equals("EITHER")) { for (Good g : this.getGoods().values()) { int state = g.getState(); return (s.equals("BOUGHT")&&state==Good.BUYS) || (s.equals("SOLD")&&state==Good.SELLS) || (s.equals("EITHER")&&(state==Good.SELLS||state==Good.BUYS)); } } } return false; } }
2,277
0.650856
0.649978
115
18.799999
23.2376
155
false
false
0
0
0
0
0
0
1.904348
false
false
4
ee52c93b2fc2b21cf49f148ad8c25373c5de8424
7,756,710,970,814
e1f613c0836e8bfe2a6bb8b8dbbaef1289fec81b
/src/com/libr/user/NewUser.java
2a47e821a6addb5a7f713166e7a92a310469aa43
[]
no_license
aglimmer/jsp-book-manage
https://github.com/aglimmer/jsp-book-manage
506cd2faa9f97b31fbfb2951232d9da265f9ac4c
2a1f2d6b2406334a6ae66744fc56630c582b088e
refs/heads/master
2023-04-26T20:20:42.927000
2021-05-15T05:41:17
2021-05-15T05:41:17
367,549,291
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.libr.user; public class NewUser { public NewUser() { // TODO Auto-generated constructor stub } private String userid; private String userpassword; private String email; // [我最好的朋友叫什么名字][我最想去的地方][我最喜欢的水果] private String question1; private String question2; private String answer1; private String answer2; private int grade; private String phone; private String realname; private String idcard; public void setUserid(String userid) { this.userid = userid; } public String getUserid() { return userid; } public void setUserpassword(String userpassword) { this.userpassword = userpassword; } public String getUserpassword() { return userpassword; } public void setEmail(String email) { this.email = email; } public String getEmail() { return email; } public void setGrade(int grade) { this.grade = grade; } public int getGrade() { return grade; } public String getRealname() { return realname; } public void setRealname(String reamname) { this.realname = reamname; } public void setIdcard(String idcard) { this.idcard = idcard; } public String getIdcard() { return idcard; } public String getPhone() { // TODO Auto-generated method stub return phone; } public void setPhone(String phone) { this.phone = phone; } public void setQuestion1(String question1) { this.question1 = question1; } public String getQuestion1() { return question1; } public void setAnswer1(String answer1) { this.answer1=answer1; } public String getAnswer1() { // TODO Auto-generated method stub return answer1; } public void setQuestion2(String question2) { this.question2 = question2; } public String getQuestion2() { return question2; } public void setAnswer2(String answer2) { this.answer2 = answer2; } public String getAnswer2() { // TODO Auto-generated method stub return answer2; } }
UTF-8
Java
1,961
java
NewUser.java
Java
[ { "context": "sword(String userpassword) {\n\t\tthis.userpassword = userpassword;\n\t}\n\tpublic String getUserpassword() {\n\t\treturn u", "end": 634, "score": 0.8562813997268677, "start": 622, "tag": "PASSWORD", "value": "userpassword" } ]
null
[]
package com.libr.user; public class NewUser { public NewUser() { // TODO Auto-generated constructor stub } private String userid; private String userpassword; private String email; // [我最好的朋友叫什么名字][我最想去的地方][我最喜欢的水果] private String question1; private String question2; private String answer1; private String answer2; private int grade; private String phone; private String realname; private String idcard; public void setUserid(String userid) { this.userid = userid; } public String getUserid() { return userid; } public void setUserpassword(String userpassword) { this.userpassword = <PASSWORD>; } public String getUserpassword() { return userpassword; } public void setEmail(String email) { this.email = email; } public String getEmail() { return email; } public void setGrade(int grade) { this.grade = grade; } public int getGrade() { return grade; } public String getRealname() { return realname; } public void setRealname(String reamname) { this.realname = reamname; } public void setIdcard(String idcard) { this.idcard = idcard; } public String getIdcard() { return idcard; } public String getPhone() { // TODO Auto-generated method stub return phone; } public void setPhone(String phone) { this.phone = phone; } public void setQuestion1(String question1) { this.question1 = question1; } public String getQuestion1() { return question1; } public void setAnswer1(String answer1) { this.answer1=answer1; } public String getAnswer1() { // TODO Auto-generated method stub return answer1; } public void setQuestion2(String question2) { this.question2 = question2; } public String getQuestion2() { return question2; } public void setAnswer2(String answer2) { this.answer2 = answer2; } public String getAnswer2() { // TODO Auto-generated method stub return answer2; } }
1,959
0.710623
0.695971
103
17.553398
14.384949
51
false
false
0
0
0
0
0
0
1.553398
false
false
4
7c9acaaeb0583e95cfa127e71c54e46c8a8fca9b
28,776,280,891,275
e395b872652d751c141c793f5a05474e9d7a7c0c
/SolvationOfSimpleMath/src/FloadDouble.java
3eff609fb5264c4e4f00a47295ab3750766bb7f7
[]
no_license
betov91/JavaTasks
https://github.com/betov91/JavaTasks
0fae8a8e7cf7fca261c37ef2026f10d73a3971dc
27158321f2491a7c9f5b5a382f9feb262d98a1a5
refs/heads/master
2020-03-27T15:37:44.516000
2018-08-30T09:40:01
2018-08-30T09:40:01
146,729,297
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class FloadDouble { public static void main(String[] args){ float floatPI = 3.141592653589793238f; double doublePI = 3.141592653589793238; System.out.println("FloatPI is: " + floatPI); System.out.print("DoublePI is: " + doublePI); } }
UTF-8
Java
288
java
FloadDouble.java
Java
[]
null
[]
public class FloadDouble { public static void main(String[] args){ float floatPI = 3.141592653589793238f; double doublePI = 3.141592653589793238; System.out.println("FloatPI is: " + floatPI); System.out.print("DoublePI is: " + doublePI); } }
288
0.628472
0.496528
14
19.571428
22.56962
53
false
false
0
0
0
0
0
0
0.285714
false
false
4
5191ea0a3465e72dcc5aa35e34b1e85cbb8c8545
31,774,168,095,905
ecb7e109a62f6a2a130e3320ed1fb580ba4fc2de
/reference-code/esr/esale-tenants/src/main/java/jp/co/softbrain/esales/tenants/web/rest/FeedBackStatusResource.java
bd49211b5a5493b977bc06cb25b40e44a8b208f7
[]
no_license
nisheeth84/prjs_sample
https://github.com/nisheeth84/prjs_sample
df732bc1eb58bc4fd4da6e76e6d59a2e81f53204
3fb10823ca4c0eb3cd92bcd2d5d4abc8d59436d9
refs/heads/master
2022-12-25T22:44:14.767000
2020-10-07T14:55:52
2020-10-07T14:55:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jp.co.softbrain.esales.tenants.web.rest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import jp.co.softbrain.esales.tenants.service.FeedBackStatusService; import jp.co.softbrain.esales.tenants.service.dto.CreateFeedBackStatusOutDTO; import jp.co.softbrain.esales.tenants.service.dto.GetFeedBackStatusOutDTO; import jp.co.softbrain.esales.tenants.tenant.util.JwtTokenUtil; /** * FeedBackStatusResource * * @author DatDV */ @RestController @RequestMapping("/api") public class FeedBackStatusResource { @Autowired private FeedBackStatusService feedBackStatusService; @Autowired private JwtTokenUtil jwtTokenUtil; /** * createFeedBackStatusOpen * * @return CreateFeedBackStatusOutDTO : DTO out of API * createFeedBackStatusOpen */ @PostMapping(path = "/create-feed-back-status-open", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<CreateFeedBackStatusOutDTO> createFeedBackStatusOpen() { return ResponseEntity.ok(feedBackStatusService.createFeedBackStatusOpen(jwtTokenUtil.getEmployeeIdFromToken(), jwtTokenUtil.getTenantIdFromToken())); } /** * createFeedBackStatusOpen * * @return GetFeedBackStatusOutDTO : DTO out of API getFeedBackStatusOpen */ @PostMapping(path = "/get-feed-back-status-open", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<GetFeedBackStatusOutDTO> getFeedBackStatusOpen() { return ResponseEntity.ok(feedBackStatusService.getFeedBackStatusOpen(jwtTokenUtil.getEmployeeIdFromToken(), jwtTokenUtil.getTenantIdFromToken())); } }
UTF-8
Java
2,040
java
FeedBackStatusResource.java
Java
[ { "context": "til;\n\n/**\n * FeedBackStatusResource\n * \n * @author DatDV\n */\n@RestController\n@RequestMapping(\"/api\")\npubli", "end": 728, "score": 0.9995981454849243, "start": 723, "tag": "USERNAME", "value": "DatDV" } ]
null
[]
package jp.co.softbrain.esales.tenants.web.rest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import jp.co.softbrain.esales.tenants.service.FeedBackStatusService; import jp.co.softbrain.esales.tenants.service.dto.CreateFeedBackStatusOutDTO; import jp.co.softbrain.esales.tenants.service.dto.GetFeedBackStatusOutDTO; import jp.co.softbrain.esales.tenants.tenant.util.JwtTokenUtil; /** * FeedBackStatusResource * * @author DatDV */ @RestController @RequestMapping("/api") public class FeedBackStatusResource { @Autowired private FeedBackStatusService feedBackStatusService; @Autowired private JwtTokenUtil jwtTokenUtil; /** * createFeedBackStatusOpen * * @return CreateFeedBackStatusOutDTO : DTO out of API * createFeedBackStatusOpen */ @PostMapping(path = "/create-feed-back-status-open", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<CreateFeedBackStatusOutDTO> createFeedBackStatusOpen() { return ResponseEntity.ok(feedBackStatusService.createFeedBackStatusOpen(jwtTokenUtil.getEmployeeIdFromToken(), jwtTokenUtil.getTenantIdFromToken())); } /** * createFeedBackStatusOpen * * @return GetFeedBackStatusOutDTO : DTO out of API getFeedBackStatusOpen */ @PostMapping(path = "/get-feed-back-status-open", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<GetFeedBackStatusOutDTO> getFeedBackStatusOpen() { return ResponseEntity.ok(feedBackStatusService.getFeedBackStatusOpen(jwtTokenUtil.getEmployeeIdFromToken(), jwtTokenUtil.getTenantIdFromToken())); } }
2,040
0.771569
0.771569
52
38.23077
37.625492
146
false
false
0
0
0
0
0
0
0.403846
false
false
4
bd1355e523b38658a8b73ea6416f6664db33cd63
26,577,257,670,676
d42e147707107ac8a5b4ff6cd502f461590e05a5
/src/src/etud/iia/jeux/vue/custom/PanelLog.java
7ea37b7f4a6926ac9a38f3cf728255ec7a163fb8
[]
no_license
thierrysup/AI-Multi-Player-Ngay-Cameroonian-FarNorth-Game
https://github.com/thierrysup/AI-Multi-Player-Ngay-Cameroonian-FarNorth-Game
4ab521d5b31127a4183d12e892e8cbbd2f82c4fb
2ff71bdec17dd6a9e63a19139aa16f51f760b272
refs/heads/master
2021-01-20T05:57:17.277000
2017-04-30T04:43:05
2017-04-30T04:43:05
89,828,869
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package src.etud.iia.jeux.vue.custom; import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JPanel; /** * * @author Thierry TCHINDA && Mercedes KADJE */ public class PanelLog extends JPanel{ private static final long serialVersionUID = 1L; private ImageIcon background; public PanelLog(){ super(); this.background = new ImageIcon("src/ressources/images/logo.jpg"); } public void setBackground(ImageIcon background){ this.background = background; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(background.getImage(), 107, 10, this); } }
UTF-8
Java
881
java
PanelLog.java
Java
[ { "context": "con;\nimport javax.swing.JPanel;\n\n/**\n *\n * @author Thierry TCHINDA && Mercedes KADJE\n */\npublic class PanelLog exten", "end": 341, "score": 0.9998717308044434, "start": 326, "tag": "NAME", "value": "Thierry TCHINDA" }, { "context": "wing.JPanel;\n\n/**\n *\n * @a...
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package src.etud.iia.jeux.vue.custom; import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JPanel; /** * * @author <NAME> && <NAME> */ public class PanelLog extends JPanel{ private static final long serialVersionUID = 1L; private ImageIcon background; public PanelLog(){ super(); this.background = new ImageIcon("src/ressources/images/logo.jpg"); } public void setBackground(ImageIcon background){ this.background = background; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(background.getImage(), 107, 10, this); } }
864
0.682179
0.675369
34
24.911764
22.661665
79
false
false
0
0
0
0
0
0
0.5
false
false
4
9fa82932940110d481a514f2de2a587d1ad1b008
3,272,765,107,879
e23bc2b8039ae544e110bd3d732e7ae62d223445
/src/HappyNumber.java
7804c7828be06e183cdb28b4afb0915aac7aa451
[]
no_license
manujbhardwaj/leetcode_prac
https://github.com/manujbhardwaj/leetcode_prac
88442a6e79b3edbfa9d94a92be64338d9b2314b7
8f6cfbebcb04a9500614f0827b4a112170a35511
refs/heads/master
2021-01-17T20:49:03.999000
2018-06-20T20:07:12
2018-06-20T20:07:12
84,149,517
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers. Example: 19 is a happy number 12 + 92 = 82 82 + 22 = 68 62 + 82 = 100 12 + 02 + 02 = 1 */ public class HappyNumber { public boolean isHappy(int n) { int slow = n, fast = n; do{ slow = calcHappy(slow); fast = calcHappy(fast); fast = calcHappy(fast); }while(slow != fast); return (slow == 1); } int calcHappy(int n){ int sum = 0; while(n != 0){ sum = sum + (int)Math.pow(n%10,2); n = n/10; } return sum; } }
UTF-8
Java
982
java
HappyNumber.java
Java
[]
null
[]
/* Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers. Example: 19 is a happy number 12 + 92 = 82 82 + 22 = 68 62 + 82 = 100 12 + 02 + 02 = 1 */ public class HappyNumber { public boolean isHappy(int n) { int slow = n, fast = n; do{ slow = calcHappy(slow); fast = calcHappy(fast); fast = calcHappy(fast); }while(slow != fast); return (slow == 1); } int calcHappy(int n){ int sum = 0; while(n != 0){ sum = sum + (int)Math.pow(n%10,2); n = n/10; } return sum; } }
982
0.581466
0.541752
36
26.277779
19.977224
71
false
false
0
0
0
0
0
0
0.416667
false
false
4
a40786786b1b1e08d3a73d686190a4c267fc89b7
7,404,523,658,025
dd5e927e7d4e449cdeba1897ec91376098e12822
/src/main/java/com/basicauth/service/approval/ApprovalRuleResult.java
f56fa1f54f58255274af32eb80474a5959148d1e
[]
no_license
VarArenz028/mace-backend-v2
https://github.com/VarArenz028/mace-backend-v2
288cd4fe7cf016a274081d2d050b8c5b7e0d7fe6
38335fb0d383e0288ef3cc4dc26791431d9f8a0b
refs/heads/master
2020-03-27T02:18:49.928000
2018-08-23T01:11:54
2018-08-23T01:11:54
145,781,171
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.basicauth.service.approval; import static com.basicauth.config.Constants.DEFAULT_GROUP; import static com.basicauth.config.Constants.REQUEST_AUTOMATIC_APPROVED; /** * Return object of an Approval Rule. * Contains result information regarding execution of an Approval Rule * (e.g. Request Status, Status Assignee, result message to indicate reason why a request was routed or disapproved) */ public class ApprovalRuleResult { private Integer resultCode; private String resultMessage; private String requestStatus; private String statusAssignee; //Set default values here. public ApprovalRuleResult(){ this.statusAssignee = DEFAULT_GROUP; this.requestStatus = REQUEST_AUTOMATIC_APPROVED; } public Integer getResultCode() { return resultCode; } public void setResultCode(Integer resultCode) { this.resultCode = resultCode; } public String getResultMessage() { return resultMessage; } public void setResultMessage(String resultMessage) { this.resultMessage = resultMessage; } public String getRequestStatus() { return requestStatus; } public void setRequestStatus(String requestStatus) { this.requestStatus = requestStatus; } public String getStatusAssignee() { return statusAssignee; } public void setStatusAssignee(String statusAssignee) { this.statusAssignee = statusAssignee; } }
UTF-8
Java
1,482
java
ApprovalRuleResult.java
Java
[]
null
[]
package com.basicauth.service.approval; import static com.basicauth.config.Constants.DEFAULT_GROUP; import static com.basicauth.config.Constants.REQUEST_AUTOMATIC_APPROVED; /** * Return object of an Approval Rule. * Contains result information regarding execution of an Approval Rule * (e.g. Request Status, Status Assignee, result message to indicate reason why a request was routed or disapproved) */ public class ApprovalRuleResult { private Integer resultCode; private String resultMessage; private String requestStatus; private String statusAssignee; //Set default values here. public ApprovalRuleResult(){ this.statusAssignee = DEFAULT_GROUP; this.requestStatus = REQUEST_AUTOMATIC_APPROVED; } public Integer getResultCode() { return resultCode; } public void setResultCode(Integer resultCode) { this.resultCode = resultCode; } public String getResultMessage() { return resultMessage; } public void setResultMessage(String resultMessage) { this.resultMessage = resultMessage; } public String getRequestStatus() { return requestStatus; } public void setRequestStatus(String requestStatus) { this.requestStatus = requestStatus; } public String getStatusAssignee() { return statusAssignee; } public void setStatusAssignee(String statusAssignee) { this.statusAssignee = statusAssignee; } }
1,482
0.709177
0.709177
57
25
24.851135
116
false
false
0
0
0
0
0
0
0.333333
false
false
4
1770572f93f5f5dc0f9f530758c444d1b784ade3
17,489,106,853,289
c42c0d7c870255056a67c9e926919571e600d4c4
/abstract/src/main/java/de/unia/oc/robotcontrol/flow/function/ProcessorTransformation.java
54c7322335f87ac8d402f53be599a99096b8d101
[]
no_license
maxi-k/bachelor-code
https://github.com/maxi-k/bachelor-code
8e41826638dde69f86984116d6034b3f03fb3733
41aead531215af3d4eb78f3d14ff7a9d7a0501cb
refs/heads/master
2020-03-30T05:14:46.413000
2018-09-20T04:38:36
2018-09-20T04:38:36
150,788,944
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* %FILE_TEMPLATE_TEXT% */ package de.unia.oc.robotcontrol.flow.function; import org.reactivestreams.Processor; import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; import java.util.function.Function; /** * Interface for Functions that transform a {@link Processor} to a {@link Processor}. * Includes utility methods for creating, combining, and applying them. * * @param <I1> the type of element the input processor can receive * @param <O1> the type of element the input processor emits * @param <I2> the type of element the resulting processor can receive * @param <O2> the type of element the resulting processor emits */ public interface ProcessorTransformation<I1, O1, I2, O2> extends Function<Processor<I1, O1>, Processor<I2, O2>> { /** * Map the values a processor receives and emits, * using <code>inputFn</code> as the function that transforms * inputs ({@link Subscriber} side of the processor), and * <code>outputFn</code> to transform the outputs * ({@link Publisher} side of the processor) * * @param processor the {@link Processor to transform} * @param inputFn the function to apply to inputs before they reach the processor * @param outputFn the function to apply to outputs after they leave the processor * @param <T1> the type of values the given processor can receive * @param <R1> the type of values the given processor emits * @param <T2> the type of values the resulting processor can receive * @param <R2> the type of values the resulting processor will emit * * @return a new instance of {@link Processor} */ static <T1, R1, T2, R2> Processor<T2, R2> mapProcessor( Processor<T1, R1> processor, Function<T2, T1> inputFn, Function<R1, R2> outputFn ) { return liftProcessor(inputFn, outputFn).apply(processor); } /** * Return a function that transformas a given {@link Processor}, * using <code>inputFn</code> as the function that transforms * inputs ({@link Subscriber} side of the processor), and * <code>outputFn</code> to transform the outputs * ({@link Publisher} side of the processor) * * @param inputFn the function to apply to inputs before they reach the processor * @param outputFn the function to apply to outputs after they leave the processor * @param <T1> the type of values the given processor can receive * @param <R1> the type of values the given processor emits * @param <T2> the type of values the resulting processor can receive * @param <R2> the type of values the resulting processor will emit * * @return a function that will transform a given {@link Processor} to * a {@link Processor} using the given functions */ static <T1, R1, T2, R2> Function<Processor<T1, R1>, Processor<T2, R2>> liftProcessor( Function<? super T2, ? extends T1> inputFn, Function<? super R1, ? extends R2> outputFn ) { return (Processor<T1, R1> actual) -> new Processor<T2, R2>() { @Override public void onSubscribe(Subscription s) { actual.onSubscribe(s); } @Override public void onNext(T2 t2) { actual.onNext(inputFn.apply(t2)); } @Override public void onError(Throwable t) { actual.onError(t); } @Override public void onComplete() { actual.onComplete(); } @Override public void subscribe(Subscriber<? super R2> actualS) { actual.subscribe(new Subscriber<R1>() { @Override public void onSubscribe(Subscription s) { actualS.onSubscribe(s); } @Override public void onNext(R1 r1) { actualS.onNext(outputFn.apply(r1)); } @Override public void onError(Throwable t) { actualS.onError(t); } @Override public void onComplete() { actualS.onComplete(); } }); } }; } /** * Map the values a processor receives and emits, * using <code>subscriberFn</code> as the function that transforms * inputs ({@link Subscriber} side of the processor), and * <code>publisherFn</code> to transform the outputs * ({@link Publisher} side of the processor) * * @param processor the {@link Processor to transform} * @param subscriberFn the function to apply to inputs before they reach the processor * by transforming the {@link Subscriber} part of the passed processor * @param publisherFn the function to apply to outputs after they leave the processor * by transformaing the {@link Publisher} part of the passed processor * @param <T1> the type of values the given processor can receive * @param <R1> the type of values the given processor emits * @param <T2> the type of values the resulting processor can receive * @param <R2> the type of values the resulting processor will emit * @return A new instance of {@link Processor} */ static <T1, R1, T2, R2> Processor<T2, R2> transformProcessor( Processor<T1, R1> processor, Function<? super Subscriber<T1>, ? extends Subscriber<T2>> subscriberFn, Function<? super Publisher<R1>, ? extends Publisher<R2>> publisherFn ) { Subscriber<? super T2> sub = subscriberFn.apply(processor); Publisher<? extends R2> pub = publisherFn.apply(processor); return new Processor<T2, R2>() { @Override public void subscribe(Subscriber<? super R2> subscriber) { pub.subscribe(subscriber); } @Override public void onSubscribe(Subscription subscription) { sub.onSubscribe(subscription); } @Override public void onNext(T2 next) { sub.onNext(next); } @Override public void onError(Throwable throwable) { sub.onError(throwable); } @Override public void onComplete() { sub.onComplete(); } }; } }
UTF-8
Java
6,671
java
ProcessorTransformation.java
Java
[]
null
[]
/* %FILE_TEMPLATE_TEXT% */ package de.unia.oc.robotcontrol.flow.function; import org.reactivestreams.Processor; import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; import java.util.function.Function; /** * Interface for Functions that transform a {@link Processor} to a {@link Processor}. * Includes utility methods for creating, combining, and applying them. * * @param <I1> the type of element the input processor can receive * @param <O1> the type of element the input processor emits * @param <I2> the type of element the resulting processor can receive * @param <O2> the type of element the resulting processor emits */ public interface ProcessorTransformation<I1, O1, I2, O2> extends Function<Processor<I1, O1>, Processor<I2, O2>> { /** * Map the values a processor receives and emits, * using <code>inputFn</code> as the function that transforms * inputs ({@link Subscriber} side of the processor), and * <code>outputFn</code> to transform the outputs * ({@link Publisher} side of the processor) * * @param processor the {@link Processor to transform} * @param inputFn the function to apply to inputs before they reach the processor * @param outputFn the function to apply to outputs after they leave the processor * @param <T1> the type of values the given processor can receive * @param <R1> the type of values the given processor emits * @param <T2> the type of values the resulting processor can receive * @param <R2> the type of values the resulting processor will emit * * @return a new instance of {@link Processor} */ static <T1, R1, T2, R2> Processor<T2, R2> mapProcessor( Processor<T1, R1> processor, Function<T2, T1> inputFn, Function<R1, R2> outputFn ) { return liftProcessor(inputFn, outputFn).apply(processor); } /** * Return a function that transformas a given {@link Processor}, * using <code>inputFn</code> as the function that transforms * inputs ({@link Subscriber} side of the processor), and * <code>outputFn</code> to transform the outputs * ({@link Publisher} side of the processor) * * @param inputFn the function to apply to inputs before they reach the processor * @param outputFn the function to apply to outputs after they leave the processor * @param <T1> the type of values the given processor can receive * @param <R1> the type of values the given processor emits * @param <T2> the type of values the resulting processor can receive * @param <R2> the type of values the resulting processor will emit * * @return a function that will transform a given {@link Processor} to * a {@link Processor} using the given functions */ static <T1, R1, T2, R2> Function<Processor<T1, R1>, Processor<T2, R2>> liftProcessor( Function<? super T2, ? extends T1> inputFn, Function<? super R1, ? extends R2> outputFn ) { return (Processor<T1, R1> actual) -> new Processor<T2, R2>() { @Override public void onSubscribe(Subscription s) { actual.onSubscribe(s); } @Override public void onNext(T2 t2) { actual.onNext(inputFn.apply(t2)); } @Override public void onError(Throwable t) { actual.onError(t); } @Override public void onComplete() { actual.onComplete(); } @Override public void subscribe(Subscriber<? super R2> actualS) { actual.subscribe(new Subscriber<R1>() { @Override public void onSubscribe(Subscription s) { actualS.onSubscribe(s); } @Override public void onNext(R1 r1) { actualS.onNext(outputFn.apply(r1)); } @Override public void onError(Throwable t) { actualS.onError(t); } @Override public void onComplete() { actualS.onComplete(); } }); } }; } /** * Map the values a processor receives and emits, * using <code>subscriberFn</code> as the function that transforms * inputs ({@link Subscriber} side of the processor), and * <code>publisherFn</code> to transform the outputs * ({@link Publisher} side of the processor) * * @param processor the {@link Processor to transform} * @param subscriberFn the function to apply to inputs before they reach the processor * by transforming the {@link Subscriber} part of the passed processor * @param publisherFn the function to apply to outputs after they leave the processor * by transformaing the {@link Publisher} part of the passed processor * @param <T1> the type of values the given processor can receive * @param <R1> the type of values the given processor emits * @param <T2> the type of values the resulting processor can receive * @param <R2> the type of values the resulting processor will emit * @return A new instance of {@link Processor} */ static <T1, R1, T2, R2> Processor<T2, R2> transformProcessor( Processor<T1, R1> processor, Function<? super Subscriber<T1>, ? extends Subscriber<T2>> subscriberFn, Function<? super Publisher<R1>, ? extends Publisher<R2>> publisherFn ) { Subscriber<? super T2> sub = subscriberFn.apply(processor); Publisher<? extends R2> pub = publisherFn.apply(processor); return new Processor<T2, R2>() { @Override public void subscribe(Subscriber<? super R2> subscriber) { pub.subscribe(subscriber); } @Override public void onSubscribe(Subscription subscription) { sub.onSubscribe(subscription); } @Override public void onNext(T2 next) { sub.onNext(next); } @Override public void onError(Throwable throwable) { sub.onError(throwable); } @Override public void onComplete() { sub.onComplete(); } }; } }
6,671
0.595263
0.583571
170
38.241177
27.938915
113
false
false
0
0
0
0
0
0
0.411765
false
false
4
4b7f2f0d33074a47bef77c3ccf39e34510d3e674
5,463,198,427,358
2d396e9c89db28decbc7b8f34728efcb450a2106
/app/src/main/java/com/example/rosa/noticias/Datasource.java
94273482e525d22d1b8bce348b9ea5c7a1a2efde
[]
no_license
rosamarisantos/repo
https://github.com/rosamarisantos/repo
5a281e985834f356db5f8e9dadb1a58c912e85aa
cef76a8a60e34b3d7e5d7de6b229f8761aeee8f2
refs/heads/master
2020-05-04T21:04:23.747000
2019-06-04T11:22:51
2019-06-04T11:22:51
179,463,052
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.rosa.noticias; import java.util.List; public interface Datasource { public void getNoticias(String source, NoticiasCallback noticiasCallback); public void getNoticia(int id, NoticiaCallback noticiaCallback); interface NoticiaCallback { public void onNoticiaCargada(Noticia noticia); public void onNoticiaError(); } interface NoticiasCallback { public void onNoticiasCargadas(List<Noticia> noticias); public void onNoticiasError(); } }
UTF-8
Java
514
java
Datasource.java
Java
[]
null
[]
package com.example.rosa.noticias; import java.util.List; public interface Datasource { public void getNoticias(String source, NoticiasCallback noticiasCallback); public void getNoticia(int id, NoticiaCallback noticiaCallback); interface NoticiaCallback { public void onNoticiaCargada(Noticia noticia); public void onNoticiaError(); } interface NoticiasCallback { public void onNoticiasCargadas(List<Noticia> noticias); public void onNoticiasError(); } }
514
0.733463
0.733463
17
29.235294
24.725622
78
false
false
0
0
0
0
0
0
0.588235
false
false
4
8528f95059d77312def74bb1a70c419e973cee41
33,320,356,337,047
6585fcd04f1060d6d7ee190d92050972ea4b2a79
/common/src/main/java/com/yangsheng991/ecommerce/common/domain/enumeration/OrderStatus.java
2d194e3672ef7b49d97dc7317669d766e6e1e671
[]
no_license
yangsheng991/ecommerce
https://github.com/yangsheng991/ecommerce
4045885ae60adc9c328ab3c4208bcda214144794
3d30a814ebdbd837a845f8cb0dea4b3eb6468531
refs/heads/master
2018-02-09T07:10:47.656000
2017-08-15T14:42:46
2017-08-15T14:42:46
96,695,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yangsheng991.ecommerce.common.domain.enumeration; /** * Created by sheng on 2017/7/9. */ public enum OrderStatus { START, PAYMENT_DONE, DELIVERYING, DONE, REFUND; }
UTF-8
Java
186
java
OrderStatus.java
Java
[ { "context": "erce.common.domain.enumeration;\n\n/**\n * Created by sheng on 2017/7/9.\n */\npublic enum OrderStatus {\n\n S", "end": 86, "score": 0.9933860301971436, "start": 81, "tag": "USERNAME", "value": "sheng" } ]
null
[]
package com.yangsheng991.ecommerce.common.domain.enumeration; /** * Created by sheng on 2017/7/9. */ public enum OrderStatus { START, PAYMENT_DONE, DELIVERYING, DONE, REFUND; }
186
0.72043
0.672043
10
17.6
22.118771
61
false
false
0
0
0
0
0
0
0.6
false
false
4
54b4d9d62426438ebb82807af741d9dc4ba00999
23,124,103,937,582
16a631c5a612f56cacd9cd04893b7b52888ddad2
/src/controllor/action/reviewboard/AdminCommentAddAction.java
6269ec05ddc092ba8988238b81e52b6eebcb50a6
[]
no_license
brightest-ko/Jsp-terraHotel
https://github.com/brightest-ko/Jsp-terraHotel
18f245d61d9591caa43fbb2f9f979df9045377a2
1e2b87e3d7ac63b59d957c536b0d0af548c6e0ec
refs/heads/master
2020-03-10T13:57:55.991000
2018-04-16T02:45:04
2018-04-16T02:45:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controllor.action.reviewboard; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import controllor.action.*; import reviewboard.*; public class AdminCommentAddAction implements Action { public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); ReviewDAO reviewdao = new ReviewDAO(); ReviewBean reviewbean = new ReviewBean(); ReviewCommentBean reviewcomment = new ReviewCommentBean();// String stype=null; String sword=null; if(request.getParameter("selectType")!=null) { stype = request.getParameter("selectType"); sword = (String)request.getParameter("selectWord"); request.setAttribute("selectType", stype); request.setAttribute("selectWord", sword); } String pageno=null; if (request.getParameter("pageno") != null) { pageno = request.getParameter("pageno"); request.setAttribute("pageno", pageno); } ActionForward forward = new ActionForward(); HttpSession session = request.getSession(); String id = (String)session.getAttribute("user_id");//세션 아이디 //아이디 받음 //아이디 참조, 글번호 참조, 내용 3개를 보내고 try { reviewcomment.setRc_id(id);// reviewcomment.setRc_num(Integer.parseInt(request.getParameter("rc_num"))); reviewcomment.setRc_content(request.getParameter("rc_content")); int x=reviewdao.commentInsert(reviewcomment); if (x == 0) { return null; } //int pageno = Integer.parseInt(request.getParameter("pageno")); forward.setRedirect(true); if(request.getParameter("selectType")!=null) { forward.setUrl("./AdminReviewUpdateViewAction.ro?num=" + reviewcomment.getRc_num()+ "&pageno="+pageno+"&selectType="+stype+"&selectWord="+sword); return forward; } else { forward.setUrl( "./AdminReviewUpdateViewAction.ro?num=" + reviewcomment.getRc_num()+ "&pageno="+pageno); return forward; } //forward.setUrl("./AdminReviewUpdateViewAction.ro?num=" + reviewcomment.getRc_num()+"&pageno="+pageno);//?pageno=<%=pageno %> //return forward; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
UTF-8
Java
2,495
java
AdminCommentAddAction.java
Java
[]
null
[]
package controllor.action.reviewboard; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import controllor.action.*; import reviewboard.*; public class AdminCommentAddAction implements Action { public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); ReviewDAO reviewdao = new ReviewDAO(); ReviewBean reviewbean = new ReviewBean(); ReviewCommentBean reviewcomment = new ReviewCommentBean();// String stype=null; String sword=null; if(request.getParameter("selectType")!=null) { stype = request.getParameter("selectType"); sword = (String)request.getParameter("selectWord"); request.setAttribute("selectType", stype); request.setAttribute("selectWord", sword); } String pageno=null; if (request.getParameter("pageno") != null) { pageno = request.getParameter("pageno"); request.setAttribute("pageno", pageno); } ActionForward forward = new ActionForward(); HttpSession session = request.getSession(); String id = (String)session.getAttribute("user_id");//세션 아이디 //아이디 받음 //아이디 참조, 글번호 참조, 내용 3개를 보내고 try { reviewcomment.setRc_id(id);// reviewcomment.setRc_num(Integer.parseInt(request.getParameter("rc_num"))); reviewcomment.setRc_content(request.getParameter("rc_content")); int x=reviewdao.commentInsert(reviewcomment); if (x == 0) { return null; } //int pageno = Integer.parseInt(request.getParameter("pageno")); forward.setRedirect(true); if(request.getParameter("selectType")!=null) { forward.setUrl("./AdminReviewUpdateViewAction.ro?num=" + reviewcomment.getRc_num()+ "&pageno="+pageno+"&selectType="+stype+"&selectWord="+sword); return forward; } else { forward.setUrl( "./AdminReviewUpdateViewAction.ro?num=" + reviewcomment.getRc_num()+ "&pageno="+pageno); return forward; } //forward.setUrl("./AdminReviewUpdateViewAction.ro?num=" + reviewcomment.getRc_num()+"&pageno="+pageno);//?pageno=<%=pageno %> //return forward; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
2,495
0.67923
0.677181
70
32.871429
26.064163
129
false
false
0
0
0
0
0
0
3.342857
false
false
4
121cc950fe703a784ad7fc10dc9830c30239d3f2
25,168,508,381,555
5b2c309c903625b14991568c442eb3a889762c71
/classes/b/a/a/m.java
541dce9347fc3a7357f767dca97b8cf737ee6a90
[]
no_license
iidioter/xueqiu
https://github.com/iidioter/xueqiu
c71eb4bcc53480770b9abe20c180da693b2d7946
a7d8d7dfbaf9e603f72890cf861ed494099f5a80
refs/heads/master
2020-12-14T23:55:07.246000
2016-10-08T08:56:27
2016-10-08T08:56:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package b.a.a; final class m { final Object a; final k b; final int c; volatile boolean d; m(Object paramObject, k paramk) { this.a = paramObject; this.b = paramk; this.c = 0; this.d = true; } public final boolean equals(Object paramObject) { boolean bool2 = false; boolean bool1 = bool2; if ((paramObject instanceof m)) { paramObject = (m)paramObject; bool1 = bool2; if (this.a == ((m)paramObject).a) { bool1 = bool2; if (this.b.equals(((m)paramObject).b)) { bool1 = true; } } } return bool1; } public final int hashCode() { return this.a.hashCode() + this.b.d.hashCode(); } } /* Location: E:\apk\xueqiu2\classes-dex2jar.jar!\b\a\a\m.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
870
java
m.java
Java
[]
null
[]
package b.a.a; final class m { final Object a; final k b; final int c; volatile boolean d; m(Object paramObject, k paramk) { this.a = paramObject; this.b = paramk; this.c = 0; this.d = true; } public final boolean equals(Object paramObject) { boolean bool2 = false; boolean bool1 = bool2; if ((paramObject instanceof m)) { paramObject = (m)paramObject; bool1 = bool2; if (this.a == ((m)paramObject).a) { bool1 = bool2; if (this.b.equals(((m)paramObject).b)) { bool1 = true; } } } return bool1; } public final int hashCode() { return this.a.hashCode() + this.b.d.hashCode(); } } /* Location: E:\apk\xueqiu2\classes-dex2jar.jar!\b\a\a\m.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
870
0.550575
0.528736
47
17.531916
16.548897
75
false
false
0
0
0
0
0
0
0.382979
false
false
4
fde5b9dd2aeb41738e11c52e979e98456aa31555
29,892,972,398,699
cb6a44e49c766f34f712b501068b2f1f72482b20
/app/src/main/java/com/footbar/player_list/AsyncHttp.java
250064046f4c5552e5f413e93abf6df27ea74b96
[]
no_license
xavier-breuil/player_list
https://github.com/xavier-breuil/player_list
5a2df8e15614a49a19163f9b008d6f0235168a33
78bf62e2a94cfd68951cb5a0f53ee1a1730ff10d
refs/heads/master
2016-09-14T07:39:51.851000
2016-05-05T21:00:32
2016-05-05T21:00:32
57,966,347
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.footbar.player_list; import android.os.AsyncTask; public class AsyncHttp extends AsyncTask<String, Integer, String> { // Class to create a thread that will get the data from the internet page private HttpClient httpClient = new HttpClient(); // HttpClient will communicate with the internet page private AsyncHttpObserver obs; // the observer will treat the result once the internet page sent them public AsyncHttp(AsyncHttpObserver obs) { this.obs = obs; } @Override protected String doInBackground(String... arg0) { // ask the content of the internet page return httpClient.doHttpGET(arg0[0]); } protected void onPostExecute(String result) { // the observer deals with the data from the page obs.onPostExecute(result); } public interface AsyncHttpObserver { //Interface to implement to deal with the result of the page public void onPostExecute(String result); } }
UTF-8
Java
991
java
AsyncHttp.java
Java
[]
null
[]
package com.footbar.player_list; import android.os.AsyncTask; public class AsyncHttp extends AsyncTask<String, Integer, String> { // Class to create a thread that will get the data from the internet page private HttpClient httpClient = new HttpClient(); // HttpClient will communicate with the internet page private AsyncHttpObserver obs; // the observer will treat the result once the internet page sent them public AsyncHttp(AsyncHttpObserver obs) { this.obs = obs; } @Override protected String doInBackground(String... arg0) { // ask the content of the internet page return httpClient.doHttpGET(arg0[0]); } protected void onPostExecute(String result) { // the observer deals with the data from the page obs.onPostExecute(result); } public interface AsyncHttpObserver { //Interface to implement to deal with the result of the page public void onPostExecute(String result); } }
991
0.701312
0.698285
30
32
31.239931
107
false
false
0
0
0
0
0
0
0.333333
false
false
4
9829314de89994e2b0451314c0b81e2253635be0
17,282,948,451,798
95fa09b3ff191041a5b3ce576bafdb612f6a0a37
/risk-server/src/main/java/com/fable/risk/bean/filemanager/FilePercentBean.java
03070d3ca84b75d27a9e795b56210b3e034958ef
[]
no_license
wangyuh/nongsh
https://github.com/wangyuh/nongsh
21888ed79fd94681b9fedd3a4f80f543b45eb340
fb578af973c98c1b624d2581793d673601e00705
refs/heads/master
2020-02-27T12:09:58.742000
2017-07-18T02:28:15
2017-07-18T02:28:15
95,529,619
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fable.risk.bean.filemanager; public class FilePercentBean { public FilePercentBean() { } public FilePercentBean(int percent) { this.percent = percent; } private float percent; public float getPercent() { return percent; } public void setPercent(float percent) { this.percent = percent; } }
UTF-8
Java
323
java
FilePercentBean.java
Java
[]
null
[]
package com.fable.risk.bean.filemanager; public class FilePercentBean { public FilePercentBean() { } public FilePercentBean(int percent) { this.percent = percent; } private float percent; public float getPercent() { return percent; } public void setPercent(float percent) { this.percent = percent; } }
323
0.721362
0.721362
21
14.380953
15.116929
40
false
false
0
0
0
0
0
0
0.952381
false
false
4
f52d66291f19c2aa2064a363d04f6eb7c5897468
7,851,200,282,915
2836af61d8c925c7cff32675a777e04569748746
/HelloWeb/src/main/java/com/demo/dao/impl/Role_AccessDapImpl.java
6926592a445c312318487491c96879e90abcc2ec
[]
no_license
zero000816/HelloWeb
https://github.com/zero000816/HelloWeb
02a24521b8e8d3758d53deee6356346d444a7101
61350a1a0104229a5627b7a5674791ebe1d78050
refs/heads/master
2023-01-07T12:20:07.234000
2020-11-04T15:51:59
2020-11-04T15:51:59
310,039,822
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.demo.dao.impl; import com.demo.dao.DaoCon; import com.demo.dao.Role_AccessDao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; public class Role_AccessDapImpl implements Role_AccessDao { @Override public List<Integer> findAllAidByRid(int rid) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; DaoCon dao= new DaoCon(); Connection con=dao.connection(); String sql = "select aid from role_access where rid=?"; try { ps = con.prepareStatement(sql); ps.setInt(1,rid); rs = ps.executeQuery(); List<Integer> list = new ArrayList<>(); while (rs.next()){ list.add(rs.getInt(1)); } return list; }catch (Exception e){ e.printStackTrace(); } return null; } }
UTF-8
Java
986
java
Role_AccessDapImpl.java
Java
[]
null
[]
package com.demo.dao.impl; import com.demo.dao.DaoCon; import com.demo.dao.Role_AccessDao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; public class Role_AccessDapImpl implements Role_AccessDao { @Override public List<Integer> findAllAidByRid(int rid) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; DaoCon dao= new DaoCon(); Connection con=dao.connection(); String sql = "select aid from role_access where rid=?"; try { ps = con.prepareStatement(sql); ps.setInt(1,rid); rs = ps.executeQuery(); List<Integer> list = new ArrayList<>(); while (rs.next()){ list.add(rs.getInt(1)); } return list; }catch (Exception e){ e.printStackTrace(); } return null; } }
986
0.593306
0.591278
35
27.171429
15.799612
63
false
false
0
0
0
0
0
0
0.657143
false
false
4
d9fccc4e4fbc82cce19f2a4574359430ea6339a1
29,085,518,568,371
5eebeae1fb0740272dd101b70f22b59596ce87f1
/src/es/clementin/comrade/Leaf.java
dd59ae42591443a60e410279d18c4aeacfe3be73
[]
no_license
lavelle/comrade2
https://github.com/lavelle/comrade2
0eb14cb590c7d15d8dec689ca47ca15d27e2df66
30e39c0f51c9239e1cb2e4c7644fe466124ceb88
refs/heads/master
2018-12-29T20:45:34.375000
2012-11-27T23:56:10
2012-11-27T23:56:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.clementin.comrade; import java.util.ArrayList; import java.util.List; import com.jme3.math.Quaternion; import com.jme3.math.Transform; import com.jme3.math.Vector3f; class Leaf { private Vector3f[] vertices = new Vector3f[]{ new Vector3f(1, 0, 0), new Vector3f(2, 2, 0), new Vector3f(0, 2, 0), new Vector3f(0, 2, 0), new Vector3f(2, 2, 0), new Vector3f(1, 4, 0), }; Leaf(Vector3f position){ Vector3f rotation = Rand.vector3f(0, Util.TAU); float scale = 0.4f; Transform tr = new Transform(); Quaternion q = new Quaternion(); q.fromAngles(rotation.x, rotation.y, rotation.z); tr.setRotation(q); tr.setScale(scale); for(Vector3f v:vertices){ tr.transformVector(v, v); v.set(v.add(position)); } } public float[] getVertices(){ int numFloats = vertices.length * 3; float[] v = new float[numFloats]; for(int i = 0; i < vertices.length; i++){ v[i * 3 + 0] = vertices[i].x; v[i * 3 + 1] = vertices[i].y; v[i * 3 + 2] = vertices[i].z; } return v; } } class Leaves extends EntityStatic { protected List<Leaf> leaves = new ArrayList<Leaf>(); private static final int trianglesPerLeaf = 2; public Leaves(int numLeaves){ super(Textures.leaves); this.numTriangles = numLeaves * trianglesPerLeaf; this.numVertices = verticesPerTriangle * numTriangles; } protected void addLeaves(){ } protected void generateBuffers(){ allocateBuffers(); for(Leaf leaf:leaves){ vertices.put(leaf.getVertices()); } for(int i = 0; i < numTriangles; i++){ textureCoords.put(new float[]{0, 0, 0, 1, 1, 0}); normals.put(new float[]{0, 1, 0}); } flipBuffers(); bindBuffers(); } public void deleteBuffers() { } }
UTF-8
Java
1,746
java
Leaf.java
Java
[]
null
[]
package es.clementin.comrade; import java.util.ArrayList; import java.util.List; import com.jme3.math.Quaternion; import com.jme3.math.Transform; import com.jme3.math.Vector3f; class Leaf { private Vector3f[] vertices = new Vector3f[]{ new Vector3f(1, 0, 0), new Vector3f(2, 2, 0), new Vector3f(0, 2, 0), new Vector3f(0, 2, 0), new Vector3f(2, 2, 0), new Vector3f(1, 4, 0), }; Leaf(Vector3f position){ Vector3f rotation = Rand.vector3f(0, Util.TAU); float scale = 0.4f; Transform tr = new Transform(); Quaternion q = new Quaternion(); q.fromAngles(rotation.x, rotation.y, rotation.z); tr.setRotation(q); tr.setScale(scale); for(Vector3f v:vertices){ tr.transformVector(v, v); v.set(v.add(position)); } } public float[] getVertices(){ int numFloats = vertices.length * 3; float[] v = new float[numFloats]; for(int i = 0; i < vertices.length; i++){ v[i * 3 + 0] = vertices[i].x; v[i * 3 + 1] = vertices[i].y; v[i * 3 + 2] = vertices[i].z; } return v; } } class Leaves extends EntityStatic { protected List<Leaf> leaves = new ArrayList<Leaf>(); private static final int trianglesPerLeaf = 2; public Leaves(int numLeaves){ super(Textures.leaves); this.numTriangles = numLeaves * trianglesPerLeaf; this.numVertices = verticesPerTriangle * numTriangles; } protected void addLeaves(){ } protected void generateBuffers(){ allocateBuffers(); for(Leaf leaf:leaves){ vertices.put(leaf.getVertices()); } for(int i = 0; i < numTriangles; i++){ textureCoords.put(new float[]{0, 0, 0, 1, 1, 0}); normals.put(new float[]{0, 1, 0}); } flipBuffers(); bindBuffers(); } public void deleteBuffers() { } }
1,746
0.639748
0.607675
87
19.068966
16.841242
56
false
false
0
0
0
0
0
0
2.172414
false
false
4
e1c39d7c66e99905bbcc49ed822a5891fc41d0c5
20,770,461,861,870
9db6efa2f14baa0f4172272e361e1ed0c9940065
/aliyun-java-sdk-cloudwf/src/main/java/com/aliyuncs/cloudwf/transform/v20170328/ResetApResponseUnmarshaller.java
8e4f40c33f7dc0d5e3cae587dfd6b351711a2f07
[ "Apache-2.0" ]
permissive
ResetFull/aliyun-openapi-java-sdk
https://github.com/ResetFull/aliyun-openapi-java-sdk
31fb2c2f7c2b939df4c9067f7a221c3f2c7cef2e
e299d1778d514cd555c870a3b1de117ae3b34474
refs/heads/master
2021-08-31T04:50:07.771000
2017-12-20T12:28:50
2017-12-20T12:28:50
114,978,860
1
0
null
true
2017-12-21T07:57:54
2017-12-21T07:57:54
2017-12-21T01:39:27
2017-12-20T12:28:57
5,100
0
0
0
null
false
null
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.aliyuncs.cloudwf.transform.v20170328; import com.aliyuncs.cloudwf.model.v20170328.ResetApResponse; import com.aliyuncs.transform.UnmarshallerContext; public class ResetApResponseUnmarshaller { public static ResetApResponse unmarshall(ResetApResponse resetApResponse, UnmarshallerContext context) { resetApResponse.setRequestId(context.stringValue("ResetApResponse.RequestId")); resetApResponse.setSuccess(context.booleanValue("ResetApResponse.Success")); resetApResponse.setMessage(context.stringValue("ResetApResponse.Message")); resetApResponse.setData(context.stringValue("ResetApResponse.Data")); resetApResponse.setErrorCode(context.integerValue("ResetApResponse.ErrorCode")); resetApResponse.setErrorMsg(context.stringValue("ResetApResponse.ErrorMsg")); return resetApResponse; } }
UTF-8
Java
1,643
java
ResetApResponseUnmarshaller.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.aliyuncs.cloudwf.transform.v20170328; import com.aliyuncs.cloudwf.model.v20170328.ResetApResponse; import com.aliyuncs.transform.UnmarshallerContext; public class ResetApResponseUnmarshaller { public static ResetApResponse unmarshall(ResetApResponse resetApResponse, UnmarshallerContext context) { resetApResponse.setRequestId(context.stringValue("ResetApResponse.RequestId")); resetApResponse.setSuccess(context.booleanValue("ResetApResponse.Success")); resetApResponse.setMessage(context.stringValue("ResetApResponse.Message")); resetApResponse.setData(context.stringValue("ResetApResponse.Data")); resetApResponse.setErrorCode(context.integerValue("ResetApResponse.ErrorCode")); resetApResponse.setErrorMsg(context.stringValue("ResetApResponse.ErrorMsg")); return resetApResponse; } }
1,643
0.788801
0.776628
38
42.078949
31.0385
105
false
false
0
0
0
0
0
0
0.921053
false
false
4
cc397e5ee13f2165b1df0a4726788d2032fe0588
22,909,355,605,961
e069ea139afea25c48297ae92257d60bb4068b19
/src/main/java/com/fuck/dao/impl/TestDaoImpl.java
549f045a17c2547584a18092311da2434b574541
[]
no_license
bucketyan/ssm-demo
https://github.com/bucketyan/ssm-demo
161769893860ec92be18b57540e4c1403496bfd1
36f25b58a12734f8bac7e5c05a101f404f508fa8
refs/heads/master
2020-03-09T22:51:12.550000
2018-04-11T06:35:52
2018-04-11T06:35:52
129,044,746
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fuck.dao.impl; import com.fuck.dao.TestDao; import org.apache.ibatis.session.SqlSession; import org.springframework.stereotype.Repository; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * DESCRIPTION: * * @author * @create 2018-04-11 下午2:04 * created by fuck~ **/ @Repository public class TestDaoImpl implements TestDao { @Resource private SqlSession sqlSession; @Override public List<Map<String, Object>> queryData() { return sqlSession.selectList("DataSourceMapper.query"); } }
UTF-8
Java
571
java
TestDaoImpl.java
Java
[ { "context": "@author\n * @create 2018-04-11 下午2:04\n * created by fuck~\n **/\n@Repository\npublic class TestDaoImpl implem", "end": 314, "score": 0.7499880194664001, "start": 310, "tag": "USERNAME", "value": "fuck" } ]
null
[]
package com.fuck.dao.impl; import com.fuck.dao.TestDao; import org.apache.ibatis.session.SqlSession; import org.springframework.stereotype.Repository; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * DESCRIPTION: * * @author * @create 2018-04-11 下午2:04 * created by fuck~ **/ @Repository public class TestDaoImpl implements TestDao { @Resource private SqlSession sqlSession; @Override public List<Map<String, Object>> queryData() { return sqlSession.selectList("DataSourceMapper.query"); } }
571
0.726631
0.707231
28
19.25
17.997272
63
false
false
0
0
0
0
0
0
0.357143
false
false
4
1bee0e1c3d07472df3df9c313da86ddd61b1a826
3,607,772,565,663
06e1e20a94761da01e8ddbf265d0297fc802f849
/groupsDynamics_v2/groupsDynamics_v2/src/pl/edu/agh/sna/measures/DiffSizeTimesMeasure.java
dbbbba65bdd058cf572e35151ae86e337590abe1
[]
no_license
costrella/toik
https://github.com/costrella/toik
788eaf8847fa4107f9b9ae1151bca82b84e4931b
ce769e816c0db84c32890e236a678c9c1ed4ef3a
refs/heads/master
2021-01-22T09:33:37.143000
2015-09-06T21:27:44
2015-09-06T21:27:44
41,623,468
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.edu.agh.sna.measures; import java.util.Set; public class DiffSizeTimesMeasure { public int calculate(Set<String> set1, Set<String> set2) { int size1 = set1.size(); int size2 = set2.size(); if (size1 == 0 || size2 == 0) { return 0; } else if (size1 < size2) { return size2 / size1; } else { return size1 / size2; } } }
UTF-8
Java
357
java
DiffSizeTimesMeasure.java
Java
[]
null
[]
package pl.edu.agh.sna.measures; import java.util.Set; public class DiffSizeTimesMeasure { public int calculate(Set<String> set1, Set<String> set2) { int size1 = set1.size(); int size2 = set2.size(); if (size1 == 0 || size2 == 0) { return 0; } else if (size1 < size2) { return size2 / size1; } else { return size1 / size2; } } }
357
0.62465
0.577031
20
16.85
16.100544
59
false
false
0
0
0
0
0
0
1.65
false
false
4
ffdcc42f37ec855143f75c7717ff9c76fd67f46e
17,660,905,582,003
b8dbe3bf1bcbc5958ef24248a3ffddea822e805c
/Module_1LabAssignment7/eis/src/main/java/Test.java
8c472b1dda6ee3e8114ed5667ad6bcfed39d29ad
[]
no_license
Suparna-25/Suparna_labAssignment
https://github.com/Suparna-25/Suparna_labAssignment
7296d6f4e9e3bdc79a2fec38723b2ed09d225de9
433fd01aad64a2145659251f4add7ccb64397c25
refs/heads/master
2023-02-03T21:42:28.708000
2020-12-14T03:26:16
2020-12-14T03:26:16
306,255,220
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Shape{ public static void display(){ System.out.println("Display Of Shape"); } } class Circle extends Shape{ public static void display(){ System.out.println("Display Of Circle"); } } public class Test{ public static void main(String args[]) { Shape s=new Shape(); Circle c=new Circle(); Shape s1=new Circle(); s.display(); c.display(); s1.display(); } }
UTF-8
Java
386
java
Test.java
Java
[]
null
[]
class Shape{ public static void display(){ System.out.println("Display Of Shape"); } } class Circle extends Shape{ public static void display(){ System.out.println("Display Of Circle"); } } public class Test{ public static void main(String args[]) { Shape s=new Shape(); Circle c=new Circle(); Shape s1=new Circle(); s.display(); c.display(); s1.display(); } }
386
0.663212
0.658031
21
17.380953
13.716435
42
false
false
0
0
0
0
0
0
1.47619
false
false
4
077ac69802ef4b88c8dd91ff3891b8064f7d8386
1,305,670,103,412
6be0fd5ef7dd4864a2be5bcf5d1fd253b787df4c
/src/leetcode/medium/RestoreIpAddresses.java
34601123e2b5c221d4a5142342d17a124036db86
[]
no_license
jutao/KotlinAlgorithmTest
https://github.com/jutao/KotlinAlgorithmTest
63770366bb90f301fb9da1fe326939a24222746f
a04a0960509268c3dcccc1e565c72695ee63efdd
refs/heads/master
2021-01-24T12:23:31.564000
2019-10-25T07:18:13
2019-10-25T07:18:13
123,134,098
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode.medium; import java.util.ArrayList; import java.util.List; /** * author:jutao * time:2019/5/23 * description:93. 复原IP地址 * 给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式。 */ public class RestoreIpAddresses { public static void main(String[] args) { System.out.println(new RestoreIpAddresses().restoreIpAddresses("12345") + ""); } List<String> list; public List<String> restoreIpAddresses(String ip) { list = new ArrayList<>(); if (ip.length() < 4) { return list; } if (ip.length() > 12) { return list; } if (ip.length() > 4 && Long.valueOf(ip) == 0) { return list; } restoreIpAddresses(ip, "", 1); return list; } private void restoreIpAddresses(String ip, String s, int count) { if (count == 4) { if (ip.length() <= 3) { if (ip.length() > 1 && ip.substring(0, 1).equals("0")) { return; } if (Integer.valueOf(ip) > 255) { return; } list.add(s.substring(1) + "." + ip); } return; } for (int i = 1; i < Math.min(4, ip.length()); i++) { String temp = ip.substring(0, i); if (temp.length() > 1 && temp.substring(0, 1).equals("0")) { break; } int number = Integer.valueOf(temp); if (number > 255) { continue; } restoreIpAddresses(ip.substring(i), s + "." + number, count + 1); } } }
UTF-8
Java
1,712
java
RestoreIpAddresses.java
Java
[ { "context": ".ArrayList;\nimport java.util.List;\n\n/**\n * author:jutao\n * time:2019/5/23\n * description:93. 复原IP地址\n * 给定", "end": 97, "score": 0.9993929862976074, "start": 92, "tag": "USERNAME", "value": "jutao" } ]
null
[]
package leetcode.medium; import java.util.ArrayList; import java.util.List; /** * author:jutao * time:2019/5/23 * description:93. 复原IP地址 * 给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式。 */ public class RestoreIpAddresses { public static void main(String[] args) { System.out.println(new RestoreIpAddresses().restoreIpAddresses("12345") + ""); } List<String> list; public List<String> restoreIpAddresses(String ip) { list = new ArrayList<>(); if (ip.length() < 4) { return list; } if (ip.length() > 12) { return list; } if (ip.length() > 4 && Long.valueOf(ip) == 0) { return list; } restoreIpAddresses(ip, "", 1); return list; } private void restoreIpAddresses(String ip, String s, int count) { if (count == 4) { if (ip.length() <= 3) { if (ip.length() > 1 && ip.substring(0, 1).equals("0")) { return; } if (Integer.valueOf(ip) > 255) { return; } list.add(s.substring(1) + "." + ip); } return; } for (int i = 1; i < Math.min(4, ip.length()); i++) { String temp = ip.substring(0, i); if (temp.length() > 1 && temp.substring(0, 1).equals("0")) { break; } int number = Integer.valueOf(temp); if (number > 255) { continue; } restoreIpAddresses(ip.substring(i), s + "." + number, count + 1); } } }
1,712
0.471306
0.446276
59
26.762712
21.288446
86
false
false
0
0
0
0
0
0
0.542373
false
false
4
7e308b60b737f87e949580305924e45a17d81791
33,337,536,172,975
cefecfea3d635eeb08b1a4423d73f633c8d175df
/app/src/main/java/wlj/myapplication/databinding/bean/UserBean.java
6e046030d6c46873c304036da9c24fd0e54e718c
[]
no_license
chenyuexueer/MyTestProject
https://github.com/chenyuexueer/MyTestProject
f316453877ff17a050f34c7b0be459d732ea6bca
36cec9490f6bda4df9f05fd16a733b404153076f
refs/heads/master
2021-06-04T18:25:37.204000
2019-12-25T01:37:26
2019-12-25T01:37:26
134,673,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package wlj.myapplication.databinding.bean; /** * ================================================ * Created by ${chenyuexueer} * 时间: 2018/8/28. * 说明:DataBinddingActivity数据 * ================================================ */ public class UserBean { private String name; //姓名 private String pwd; //密码 public UserBean(String name, String pwd) { this.name = name; this.pwd = pwd; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } }
UTF-8
Java
699
java
UserBean.java
Java
[ { "context": "=================================\n * Created by ${chenyuexueer}\n * 时间: 2018/8/28.\n * 说明:DataBinddingActivity数据\n ", "end": 128, "score": 0.9995779991149902, "start": 116, "tag": "USERNAME", "value": "chenyuexueer" } ]
null
[]
package wlj.myapplication.databinding.bean; /** * ================================================ * Created by ${chenyuexueer} * 时间: 2018/8/28. * 说明:DataBinddingActivity数据 * ================================================ */ public class UserBean { private String name; //姓名 private String pwd; //密码 public UserBean(String name, String pwd) { this.name = name; this.pwd = pwd; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } }
699
0.493333
0.482963
33
19.484848
15.844168
51
false
false
0
0
0
0
0
0
0.30303
false
false
4
467cb812906a24cc0d37f36fbe3161de4aec1117
36,361,193,148,004
ea8b8eb32914d30805d911697fca0325bccd8211
/src/me/zccshome/parameterEstimation/Data.java
aef748023680c2620b38ae65dcf7e2e0cef89ec9
[]
no_license
zccshome/PRML
https://github.com/zccshome/PRML
c5ff214102ff9ea3e7bfa81669d4e614102ed395
2ef284f871c1527920939ef7d73df71673a2c82d
refs/heads/master
2016-09-06T16:44:16.304000
2014-01-17T17:57:40
2014-01-17T17:57:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.zccshome.parameterEstimation; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Data { private List<Double> data; public Data() { data = new ArrayList<Double>(); for(int i = 0; i < 10; i++) { data.add(nextGaussion(2, 0.1)); } for(int i = 0; i < 10; i++) { data.add(nextGaussion(3, 0.1)); } for(int i = 0; i < 10; i++) { data.add(nextGaussion(4, 0.1)); } } public double nextGaussion(double u, double sigma) { Random random = new Random(); double num = random.nextGaussian(); // System.out.println(num); return num * sigma + u; } public List<Double> getData() { return data; } public void setData(List<Double> data) { this.data = data; } }
UTF-8
Java
739
java
Data.java
Java
[]
null
[]
package me.zccshome.parameterEstimation; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Data { private List<Double> data; public Data() { data = new ArrayList<Double>(); for(int i = 0; i < 10; i++) { data.add(nextGaussion(2, 0.1)); } for(int i = 0; i < 10; i++) { data.add(nextGaussion(3, 0.1)); } for(int i = 0; i < 10; i++) { data.add(nextGaussion(4, 0.1)); } } public double nextGaussion(double u, double sigma) { Random random = new Random(); double num = random.nextGaussian(); // System.out.println(num); return num * sigma + u; } public List<Double> getData() { return data; } public void setData(List<Double> data) { this.data = data; } }
739
0.631935
0.607578
36
19.527779
15.186774
53
false
false
0
0
0
0
0
0
1.972222
false
false
4
704cb8c95c65f4cc446068b6c17b1b84bd51f722
36,361,193,148,776
8fb8e98118fddd0499f8b25e60a0b18b59cf0881
/src/test/java/com/localmarketplace/web/rest/ProviderRatingResourceIntTest.java
7af2242fde695d192fb7daa52fd8acb228d600e2
[]
no_license
thecomputerguy/localmarketplace
https://github.com/thecomputerguy/localmarketplace
ca9dbfb874e5774ee2cb9e18e9b48b04e4173fed
4259b7f29723d61e38cf25ec4787c41a9ea2a314
refs/heads/master
2021-05-09T04:31:33.002000
2018-02-07T21:39:36
2018-02-07T21:39:36
119,275,124
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.localmarketplace.web.rest; import com.localmarketplace.LocalmarketplaceApp; import com.localmarketplace.domain.ProviderRating; import com.localmarketplace.repository.ProviderRatingRepository; import com.localmarketplace.service.ProviderRatingService; import com.localmarketplace.service.dto.ProviderRatingDTO; import com.localmarketplace.service.mapper.ProviderRatingMapper; import com.localmarketplace.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.util.List; import static com.localmarketplace.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the ProviderRatingResource REST controller. * * @see ProviderRatingResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = LocalmarketplaceApp.class) public class ProviderRatingResourceIntTest { private static final Long DEFAULT_AVG_PUNCTUALITY_RATING = 1L; private static final Long UPDATED_AVG_PUNCTUALITY_RATING = 2L; private static final Long DEFAULT_AVG_PROF_RATING = 1L; private static final Long UPDATED_AVG_PROF_RATING = 2L; private static final Long DEFAULT_AVG_ETI_RATING = 1L; private static final Long UPDATED_AVG_ETI_RATING = 2L; private static final Long DEFAULT_AVG_COMM_RATING = 1L; private static final Long UPDATED_AVG_COMM_RATING = 2L; private static final Long DEFAULT_AVG_PRICE_RATING = 1L; private static final Long UPDATED_AVG_PRICE_RATING = 2L; private static final Long DEFAULT_AVG_OVERALL_RATING = 1L; private static final Long UPDATED_AVG_OVERALL_RATING = 2L; private static final Long DEFAULT_LAST_UPDATED_ON = 1L; private static final Long UPDATED_LAST_UPDATED_ON = 2L; @Autowired private ProviderRatingRepository providerRatingRepository; @Autowired private ProviderRatingMapper providerRatingMapper; @Autowired private ProviderRatingService providerRatingService; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restProviderRatingMockMvc; private ProviderRating providerRating; @Before public void setup() { MockitoAnnotations.initMocks(this); final ProviderRatingResource providerRatingResource = new ProviderRatingResource(providerRatingService); this.restProviderRatingMockMvc = MockMvcBuilders.standaloneSetup(providerRatingResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static ProviderRating createEntity(EntityManager em) { ProviderRating providerRating = new ProviderRating() .avgPunctualityRating(DEFAULT_AVG_PUNCTUALITY_RATING) .avgProfRating(DEFAULT_AVG_PROF_RATING) .avgEtiRating(DEFAULT_AVG_ETI_RATING) .avgCommRating(DEFAULT_AVG_COMM_RATING) .avgPriceRating(DEFAULT_AVG_PRICE_RATING) .avgOverallRating(DEFAULT_AVG_OVERALL_RATING) .lastUpdatedOn(DEFAULT_LAST_UPDATED_ON); return providerRating; } @Before public void initTest() { providerRating = createEntity(em); } @Test @Transactional public void createProviderRating() throws Exception { int databaseSizeBeforeCreate = providerRatingRepository.findAll().size(); // Create the ProviderRating ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(providerRating); restProviderRatingMockMvc.perform(post("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isCreated()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeCreate + 1); ProviderRating testProviderRating = providerRatingList.get(providerRatingList.size() - 1); assertThat(testProviderRating.getAvgPunctualityRating()).isEqualTo(DEFAULT_AVG_PUNCTUALITY_RATING); assertThat(testProviderRating.getAvgProfRating()).isEqualTo(DEFAULT_AVG_PROF_RATING); assertThat(testProviderRating.getAvgEtiRating()).isEqualTo(DEFAULT_AVG_ETI_RATING); assertThat(testProviderRating.getAvgCommRating()).isEqualTo(DEFAULT_AVG_COMM_RATING); assertThat(testProviderRating.getAvgPriceRating()).isEqualTo(DEFAULT_AVG_PRICE_RATING); assertThat(testProviderRating.getAvgOverallRating()).isEqualTo(DEFAULT_AVG_OVERALL_RATING); assertThat(testProviderRating.getLastUpdatedOn()).isEqualTo(DEFAULT_LAST_UPDATED_ON); } @Test @Transactional public void createProviderRatingWithExistingId() throws Exception { int databaseSizeBeforeCreate = providerRatingRepository.findAll().size(); // Create the ProviderRating with an existing ID providerRating.setId(1L); ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(providerRating); // An entity with an existing ID cannot be created, so this API call must fail restProviderRatingMockMvc.perform(post("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isBadRequest()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllProviderRatings() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); // Get all the providerRatingList restProviderRatingMockMvc.perform(get("/api/provider-ratings?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(providerRating.getId().intValue()))) .andExpect(jsonPath("$.[*].avgPunctualityRating").value(hasItem(DEFAULT_AVG_PUNCTUALITY_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgProfRating").value(hasItem(DEFAULT_AVG_PROF_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgEtiRating").value(hasItem(DEFAULT_AVG_ETI_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgCommRating").value(hasItem(DEFAULT_AVG_COMM_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgPriceRating").value(hasItem(DEFAULT_AVG_PRICE_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgOverallRating").value(hasItem(DEFAULT_AVG_OVERALL_RATING.intValue()))) .andExpect(jsonPath("$.[*].lastUpdatedOn").value(hasItem(DEFAULT_LAST_UPDATED_ON.intValue()))); } @Test @Transactional public void getProviderRating() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); // Get the providerRating restProviderRatingMockMvc.perform(get("/api/provider-ratings/{id}", providerRating.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(providerRating.getId().intValue())) .andExpect(jsonPath("$.avgPunctualityRating").value(DEFAULT_AVG_PUNCTUALITY_RATING.intValue())) .andExpect(jsonPath("$.avgProfRating").value(DEFAULT_AVG_PROF_RATING.intValue())) .andExpect(jsonPath("$.avgEtiRating").value(DEFAULT_AVG_ETI_RATING.intValue())) .andExpect(jsonPath("$.avgCommRating").value(DEFAULT_AVG_COMM_RATING.intValue())) .andExpect(jsonPath("$.avgPriceRating").value(DEFAULT_AVG_PRICE_RATING.intValue())) .andExpect(jsonPath("$.avgOverallRating").value(DEFAULT_AVG_OVERALL_RATING.intValue())) .andExpect(jsonPath("$.lastUpdatedOn").value(DEFAULT_LAST_UPDATED_ON.intValue())); } @Test @Transactional public void getNonExistingProviderRating() throws Exception { // Get the providerRating restProviderRatingMockMvc.perform(get("/api/provider-ratings/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateProviderRating() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); int databaseSizeBeforeUpdate = providerRatingRepository.findAll().size(); // Update the providerRating ProviderRating updatedProviderRating = providerRatingRepository.findOne(providerRating.getId()); // Disconnect from session so that the updates on updatedProviderRating are not directly saved in db em.detach(updatedProviderRating); updatedProviderRating .avgPunctualityRating(UPDATED_AVG_PUNCTUALITY_RATING) .avgProfRating(UPDATED_AVG_PROF_RATING) .avgEtiRating(UPDATED_AVG_ETI_RATING) .avgCommRating(UPDATED_AVG_COMM_RATING) .avgPriceRating(UPDATED_AVG_PRICE_RATING) .avgOverallRating(UPDATED_AVG_OVERALL_RATING) .lastUpdatedOn(UPDATED_LAST_UPDATED_ON); ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(updatedProviderRating); restProviderRatingMockMvc.perform(put("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isOk()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeUpdate); ProviderRating testProviderRating = providerRatingList.get(providerRatingList.size() - 1); assertThat(testProviderRating.getAvgPunctualityRating()).isEqualTo(UPDATED_AVG_PUNCTUALITY_RATING); assertThat(testProviderRating.getAvgProfRating()).isEqualTo(UPDATED_AVG_PROF_RATING); assertThat(testProviderRating.getAvgEtiRating()).isEqualTo(UPDATED_AVG_ETI_RATING); assertThat(testProviderRating.getAvgCommRating()).isEqualTo(UPDATED_AVG_COMM_RATING); assertThat(testProviderRating.getAvgPriceRating()).isEqualTo(UPDATED_AVG_PRICE_RATING); assertThat(testProviderRating.getAvgOverallRating()).isEqualTo(UPDATED_AVG_OVERALL_RATING); assertThat(testProviderRating.getLastUpdatedOn()).isEqualTo(UPDATED_LAST_UPDATED_ON); } @Test @Transactional public void updateNonExistingProviderRating() throws Exception { int databaseSizeBeforeUpdate = providerRatingRepository.findAll().size(); // Create the ProviderRating ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(providerRating); // If the entity doesn't have an ID, it will be created instead of just being updated restProviderRatingMockMvc.perform(put("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isCreated()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteProviderRating() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); int databaseSizeBeforeDelete = providerRatingRepository.findAll().size(); // Get the providerRating restProviderRatingMockMvc.perform(delete("/api/provider-ratings/{id}", providerRating.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(ProviderRating.class); ProviderRating providerRating1 = new ProviderRating(); providerRating1.setId(1L); ProviderRating providerRating2 = new ProviderRating(); providerRating2.setId(providerRating1.getId()); assertThat(providerRating1).isEqualTo(providerRating2); providerRating2.setId(2L); assertThat(providerRating1).isNotEqualTo(providerRating2); providerRating1.setId(null); assertThat(providerRating1).isNotEqualTo(providerRating2); } @Test @Transactional public void dtoEqualsVerifier() throws Exception { TestUtil.equalsVerifier(ProviderRatingDTO.class); ProviderRatingDTO providerRatingDTO1 = new ProviderRatingDTO(); providerRatingDTO1.setId(1L); ProviderRatingDTO providerRatingDTO2 = new ProviderRatingDTO(); assertThat(providerRatingDTO1).isNotEqualTo(providerRatingDTO2); providerRatingDTO2.setId(providerRatingDTO1.getId()); assertThat(providerRatingDTO1).isEqualTo(providerRatingDTO2); providerRatingDTO2.setId(2L); assertThat(providerRatingDTO1).isNotEqualTo(providerRatingDTO2); providerRatingDTO1.setId(null); assertThat(providerRatingDTO1).isNotEqualTo(providerRatingDTO2); } @Test @Transactional public void testEntityFromId() { assertThat(providerRatingMapper.fromId(42L).getId()).isEqualTo(42); assertThat(providerRatingMapper.fromId(null)).isNull(); } }
UTF-8
Java
15,484
java
ProviderRatingResourceIntTest.java
Java
[]
null
[]
package com.localmarketplace.web.rest; import com.localmarketplace.LocalmarketplaceApp; import com.localmarketplace.domain.ProviderRating; import com.localmarketplace.repository.ProviderRatingRepository; import com.localmarketplace.service.ProviderRatingService; import com.localmarketplace.service.dto.ProviderRatingDTO; import com.localmarketplace.service.mapper.ProviderRatingMapper; import com.localmarketplace.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.util.List; import static com.localmarketplace.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the ProviderRatingResource REST controller. * * @see ProviderRatingResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = LocalmarketplaceApp.class) public class ProviderRatingResourceIntTest { private static final Long DEFAULT_AVG_PUNCTUALITY_RATING = 1L; private static final Long UPDATED_AVG_PUNCTUALITY_RATING = 2L; private static final Long DEFAULT_AVG_PROF_RATING = 1L; private static final Long UPDATED_AVG_PROF_RATING = 2L; private static final Long DEFAULT_AVG_ETI_RATING = 1L; private static final Long UPDATED_AVG_ETI_RATING = 2L; private static final Long DEFAULT_AVG_COMM_RATING = 1L; private static final Long UPDATED_AVG_COMM_RATING = 2L; private static final Long DEFAULT_AVG_PRICE_RATING = 1L; private static final Long UPDATED_AVG_PRICE_RATING = 2L; private static final Long DEFAULT_AVG_OVERALL_RATING = 1L; private static final Long UPDATED_AVG_OVERALL_RATING = 2L; private static final Long DEFAULT_LAST_UPDATED_ON = 1L; private static final Long UPDATED_LAST_UPDATED_ON = 2L; @Autowired private ProviderRatingRepository providerRatingRepository; @Autowired private ProviderRatingMapper providerRatingMapper; @Autowired private ProviderRatingService providerRatingService; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restProviderRatingMockMvc; private ProviderRating providerRating; @Before public void setup() { MockitoAnnotations.initMocks(this); final ProviderRatingResource providerRatingResource = new ProviderRatingResource(providerRatingService); this.restProviderRatingMockMvc = MockMvcBuilders.standaloneSetup(providerRatingResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static ProviderRating createEntity(EntityManager em) { ProviderRating providerRating = new ProviderRating() .avgPunctualityRating(DEFAULT_AVG_PUNCTUALITY_RATING) .avgProfRating(DEFAULT_AVG_PROF_RATING) .avgEtiRating(DEFAULT_AVG_ETI_RATING) .avgCommRating(DEFAULT_AVG_COMM_RATING) .avgPriceRating(DEFAULT_AVG_PRICE_RATING) .avgOverallRating(DEFAULT_AVG_OVERALL_RATING) .lastUpdatedOn(DEFAULT_LAST_UPDATED_ON); return providerRating; } @Before public void initTest() { providerRating = createEntity(em); } @Test @Transactional public void createProviderRating() throws Exception { int databaseSizeBeforeCreate = providerRatingRepository.findAll().size(); // Create the ProviderRating ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(providerRating); restProviderRatingMockMvc.perform(post("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isCreated()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeCreate + 1); ProviderRating testProviderRating = providerRatingList.get(providerRatingList.size() - 1); assertThat(testProviderRating.getAvgPunctualityRating()).isEqualTo(DEFAULT_AVG_PUNCTUALITY_RATING); assertThat(testProviderRating.getAvgProfRating()).isEqualTo(DEFAULT_AVG_PROF_RATING); assertThat(testProviderRating.getAvgEtiRating()).isEqualTo(DEFAULT_AVG_ETI_RATING); assertThat(testProviderRating.getAvgCommRating()).isEqualTo(DEFAULT_AVG_COMM_RATING); assertThat(testProviderRating.getAvgPriceRating()).isEqualTo(DEFAULT_AVG_PRICE_RATING); assertThat(testProviderRating.getAvgOverallRating()).isEqualTo(DEFAULT_AVG_OVERALL_RATING); assertThat(testProviderRating.getLastUpdatedOn()).isEqualTo(DEFAULT_LAST_UPDATED_ON); } @Test @Transactional public void createProviderRatingWithExistingId() throws Exception { int databaseSizeBeforeCreate = providerRatingRepository.findAll().size(); // Create the ProviderRating with an existing ID providerRating.setId(1L); ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(providerRating); // An entity with an existing ID cannot be created, so this API call must fail restProviderRatingMockMvc.perform(post("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isBadRequest()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllProviderRatings() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); // Get all the providerRatingList restProviderRatingMockMvc.perform(get("/api/provider-ratings?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(providerRating.getId().intValue()))) .andExpect(jsonPath("$.[*].avgPunctualityRating").value(hasItem(DEFAULT_AVG_PUNCTUALITY_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgProfRating").value(hasItem(DEFAULT_AVG_PROF_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgEtiRating").value(hasItem(DEFAULT_AVG_ETI_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgCommRating").value(hasItem(DEFAULT_AVG_COMM_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgPriceRating").value(hasItem(DEFAULT_AVG_PRICE_RATING.intValue()))) .andExpect(jsonPath("$.[*].avgOverallRating").value(hasItem(DEFAULT_AVG_OVERALL_RATING.intValue()))) .andExpect(jsonPath("$.[*].lastUpdatedOn").value(hasItem(DEFAULT_LAST_UPDATED_ON.intValue()))); } @Test @Transactional public void getProviderRating() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); // Get the providerRating restProviderRatingMockMvc.perform(get("/api/provider-ratings/{id}", providerRating.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(providerRating.getId().intValue())) .andExpect(jsonPath("$.avgPunctualityRating").value(DEFAULT_AVG_PUNCTUALITY_RATING.intValue())) .andExpect(jsonPath("$.avgProfRating").value(DEFAULT_AVG_PROF_RATING.intValue())) .andExpect(jsonPath("$.avgEtiRating").value(DEFAULT_AVG_ETI_RATING.intValue())) .andExpect(jsonPath("$.avgCommRating").value(DEFAULT_AVG_COMM_RATING.intValue())) .andExpect(jsonPath("$.avgPriceRating").value(DEFAULT_AVG_PRICE_RATING.intValue())) .andExpect(jsonPath("$.avgOverallRating").value(DEFAULT_AVG_OVERALL_RATING.intValue())) .andExpect(jsonPath("$.lastUpdatedOn").value(DEFAULT_LAST_UPDATED_ON.intValue())); } @Test @Transactional public void getNonExistingProviderRating() throws Exception { // Get the providerRating restProviderRatingMockMvc.perform(get("/api/provider-ratings/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateProviderRating() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); int databaseSizeBeforeUpdate = providerRatingRepository.findAll().size(); // Update the providerRating ProviderRating updatedProviderRating = providerRatingRepository.findOne(providerRating.getId()); // Disconnect from session so that the updates on updatedProviderRating are not directly saved in db em.detach(updatedProviderRating); updatedProviderRating .avgPunctualityRating(UPDATED_AVG_PUNCTUALITY_RATING) .avgProfRating(UPDATED_AVG_PROF_RATING) .avgEtiRating(UPDATED_AVG_ETI_RATING) .avgCommRating(UPDATED_AVG_COMM_RATING) .avgPriceRating(UPDATED_AVG_PRICE_RATING) .avgOverallRating(UPDATED_AVG_OVERALL_RATING) .lastUpdatedOn(UPDATED_LAST_UPDATED_ON); ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(updatedProviderRating); restProviderRatingMockMvc.perform(put("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isOk()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeUpdate); ProviderRating testProviderRating = providerRatingList.get(providerRatingList.size() - 1); assertThat(testProviderRating.getAvgPunctualityRating()).isEqualTo(UPDATED_AVG_PUNCTUALITY_RATING); assertThat(testProviderRating.getAvgProfRating()).isEqualTo(UPDATED_AVG_PROF_RATING); assertThat(testProviderRating.getAvgEtiRating()).isEqualTo(UPDATED_AVG_ETI_RATING); assertThat(testProviderRating.getAvgCommRating()).isEqualTo(UPDATED_AVG_COMM_RATING); assertThat(testProviderRating.getAvgPriceRating()).isEqualTo(UPDATED_AVG_PRICE_RATING); assertThat(testProviderRating.getAvgOverallRating()).isEqualTo(UPDATED_AVG_OVERALL_RATING); assertThat(testProviderRating.getLastUpdatedOn()).isEqualTo(UPDATED_LAST_UPDATED_ON); } @Test @Transactional public void updateNonExistingProviderRating() throws Exception { int databaseSizeBeforeUpdate = providerRatingRepository.findAll().size(); // Create the ProviderRating ProviderRatingDTO providerRatingDTO = providerRatingMapper.toDto(providerRating); // If the entity doesn't have an ID, it will be created instead of just being updated restProviderRatingMockMvc.perform(put("/api/provider-ratings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(providerRatingDTO))) .andExpect(status().isCreated()); // Validate the ProviderRating in the database List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteProviderRating() throws Exception { // Initialize the database providerRatingRepository.saveAndFlush(providerRating); int databaseSizeBeforeDelete = providerRatingRepository.findAll().size(); // Get the providerRating restProviderRatingMockMvc.perform(delete("/api/provider-ratings/{id}", providerRating.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<ProviderRating> providerRatingList = providerRatingRepository.findAll(); assertThat(providerRatingList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(ProviderRating.class); ProviderRating providerRating1 = new ProviderRating(); providerRating1.setId(1L); ProviderRating providerRating2 = new ProviderRating(); providerRating2.setId(providerRating1.getId()); assertThat(providerRating1).isEqualTo(providerRating2); providerRating2.setId(2L); assertThat(providerRating1).isNotEqualTo(providerRating2); providerRating1.setId(null); assertThat(providerRating1).isNotEqualTo(providerRating2); } @Test @Transactional public void dtoEqualsVerifier() throws Exception { TestUtil.equalsVerifier(ProviderRatingDTO.class); ProviderRatingDTO providerRatingDTO1 = new ProviderRatingDTO(); providerRatingDTO1.setId(1L); ProviderRatingDTO providerRatingDTO2 = new ProviderRatingDTO(); assertThat(providerRatingDTO1).isNotEqualTo(providerRatingDTO2); providerRatingDTO2.setId(providerRatingDTO1.getId()); assertThat(providerRatingDTO1).isEqualTo(providerRatingDTO2); providerRatingDTO2.setId(2L); assertThat(providerRatingDTO1).isNotEqualTo(providerRatingDTO2); providerRatingDTO1.setId(null); assertThat(providerRatingDTO1).isNotEqualTo(providerRatingDTO2); } @Test @Transactional public void testEntityFromId() { assertThat(providerRatingMapper.fromId(42L).getId()).isEqualTo(42); assertThat(providerRatingMapper.fromId(null)).isNull(); } }
15,484
0.732111
0.727848
329
46.063831
33.35886
120
false
false
0
0
0
0
0
0
0.422492
false
false
4
a669abba135c7d01d14ea64c920922114ba47224
19,791,209,365,792
da08926a725d57168e20a1e9d67d5dfffb6328f2
/21_CollectionAPI/src/collection/test1/ArrayList3.java
e700f11b9aafb86eb310bdab79634bb098acaad2
[]
no_license
Yejun4911/Java
https://github.com/Yejun4911/Java
122a26938faa1a8c80e057efc8e9f8381f49cfa8
f0bc27abea997a1b2ff89aafea43c6208caf8ed4
refs/heads/master
2023-05-07T05:33:41.490000
2021-05-19T09:55:01
2021-05-19T09:55:01
311,555,943
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collection.test1; import java.util.ArrayList; import java.util.List; /* * List * 순서를 가지면서 객체를 저장하는방식 * 중복은 허용한다. * */ public class ArrayList3 { public static void main(String[] args) { List<String> list = new ArrayList<String>(); list.add("강호동"); list.add("이수근"); list.add("강호동"); list.add("서장훈"); list.add("김희철"); System.out.println(list); //3번째 객체를 삭제 //삭제된 데이타를 출력 //첫번째 데이터를 아이유로 수정 list.remove(2); list.set(0,"아이유"); System.out.println(list); int cnt=0; // for(String str: list) { // if(str.equals("서장훈")) System.out.println(list.get(cnt)); // cnt++; // } for(int i=0; i<list.size(); i++) { if(list.get(i).equals("서장훈"))System.out.println(list.get(i)); } } }
UHC
Java
876
java
ArrayList3.java
Java
[ { "context": "ring> list = new ArrayList<String>();\n\t\tlist.add(\"강호동\");\n\t\tlist.add(\"이수근\");\n\t\tlist.add(\"강호동\");\n\t\tlist.a", "end": 265, "score": 0.9995283484458923, "start": 262, "tag": "NAME", "value": "강호동" }, { "context": "rayList<String>();\n\t\tlist.add(\"강호동\");\n...
null
[]
package collection.test1; import java.util.ArrayList; import java.util.List; /* * List * 순서를 가지면서 객체를 저장하는방식 * 중복은 허용한다. * */ public class ArrayList3 { public static void main(String[] args) { List<String> list = new ArrayList<String>(); list.add("강호동"); list.add("이수근"); list.add("강호동"); list.add("서장훈"); list.add("김희철"); System.out.println(list); //3번째 객체를 삭제 //삭제된 데이타를 출력 //첫번째 데이터를 아이유로 수정 list.remove(2); list.set(0,"아이유"); System.out.println(list); int cnt=0; // for(String str: list) { // if(str.equals("서장훈")) System.out.println(list.get(cnt)); // cnt++; // } for(int i=0; i<list.size(); i++) { if(list.get(i).equals("서장훈"))System.out.println(list.get(i)); } } }
876
0.610497
0.600829
37
18.567568
15.541645
64
false
false
0
0
0
0
0
0
1.810811
false
false
4
f4b0ec333896c3c833df2c5d8d98fbe019367b57
16,810,502,038,384
d901b805025971068343c6ea33b28428a37a6275
/app/src/main/java/org/forceclose/threemeals/TiffinAdapter.java
3e50db4cc7b0bbde49c8c2a281dd3d8eb364c8c4
[]
no_license
bapatparthasarthi/ThreeMeals
https://github.com/bapatparthasarthi/ThreeMeals
05200b9d240a65f69db9d6d46750acf0f74900cb
558642327d1d3a439e736220dab321f7a56df92a
refs/heads/master
2020-03-22T20:29:05.534000
2018-07-11T16:48:35
2018-07-11T16:48:35
140,604,085
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.forceclose.threemeals; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.Image; import android.os.Build; import android.support.v4.app.ActivityOptionsCompat; import android.support.v4.view.ViewCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import java.util.List; public class TiffinAdapter extends RecyclerView.Adapter<TiffinAdapter.CardViewHolder> { String imageURL = "http://www.threemeals.in/android/uploads/products/"; @Override public TiffinAdapter.CardViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.tiffin_layout, parent, false); return new TiffinAdapter.CardViewHolder(itemView); } @Override public void onBindViewHolder(final TiffinAdapter.CardViewHolder holder, int position) { TiffinAdapter.Info i = info.get(position); Picasso.with(holder.tiffinImage.getContext()).load(imageURL+i.image).placeholder(R.mipmap.logobw).into(holder.tiffinImage); holder.tiffinTitle.setText(i.title); //CardViewHolder.tiffinDescription.setText(i.description); holder.tiffinPrice.setText(i.price); if (i.category.equals("Veg")) { holder.tiffinCategory.setImageResource(R.mipmap.veg_icon); } else if (i.category.equals("Non-veg")) { holder.tiffinCategory.setImageResource(R.mipmap.nonveg_icon); } holder.setIsRecyclable(false); holder.addTiffin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { holder.tiffinImage.setTransitionName("tiffin_image"); } TiffinService.clickAddTiffin(holder.getAdapterPosition(),view.getContext(),holder.tiffinImage); } }); /*CardViewHolder.substractTiffin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TiffinService.clickSubtractTiffin(holder.getAdapterPosition()); } });*/ } @Override public int getItemCount() { return info.size(); } static class Info { String image; String title; //String description; String price; String category; //int count; Info(String tiffinImage,String tiffinTitle,String tiffinPrice,String tiffinCategory) { image = tiffinImage; title = tiffinTitle; //description = tiffinDescription; price = tiffinPrice; category = tiffinCategory; //count = tiffinCount; } } public static List<TiffinAdapter.Info> info; TiffinAdapter(List<TiffinAdapter.Info> info) { TiffinAdapter.info = info; } static class CardViewHolder extends RecyclerView.ViewHolder { TextView tiffinTitle; ImageView tiffinImage; //static TextView tiffinDescription; TextView tiffinPrice; //static TextView tiffinCount; Button addTiffin;//substractTiffin; ImageView tiffinCategory; CardViewHolder(View itemView) { super(itemView); tiffinTitle = itemView.findViewById(R.id.tiffin_title_add); tiffinImage = itemView.findViewById(R.id.tiffin_image); //tiffinDescription = itemView.findViewById(R.id.tiffin_description); tiffinPrice = itemView.findViewById(R.id.tiffin_price); //tiffinCount = itemView.findViewById(R.id.tiffin_count); addTiffin = itemView.findViewById(R.id.tiffin_add);; //substractTiffin = itemView.findViewById(R.id.tiffin_substract); tiffinCategory = itemView.findViewById(R.id.type_icon); } } }
UTF-8
Java
4,213
java
TiffinAdapter.java
Java
[]
null
[]
package org.forceclose.threemeals; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.Image; import android.os.Build; import android.support.v4.app.ActivityOptionsCompat; import android.support.v4.view.ViewCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import java.util.List; public class TiffinAdapter extends RecyclerView.Adapter<TiffinAdapter.CardViewHolder> { String imageURL = "http://www.threemeals.in/android/uploads/products/"; @Override public TiffinAdapter.CardViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.tiffin_layout, parent, false); return new TiffinAdapter.CardViewHolder(itemView); } @Override public void onBindViewHolder(final TiffinAdapter.CardViewHolder holder, int position) { TiffinAdapter.Info i = info.get(position); Picasso.with(holder.tiffinImage.getContext()).load(imageURL+i.image).placeholder(R.mipmap.logobw).into(holder.tiffinImage); holder.tiffinTitle.setText(i.title); //CardViewHolder.tiffinDescription.setText(i.description); holder.tiffinPrice.setText(i.price); if (i.category.equals("Veg")) { holder.tiffinCategory.setImageResource(R.mipmap.veg_icon); } else if (i.category.equals("Non-veg")) { holder.tiffinCategory.setImageResource(R.mipmap.nonveg_icon); } holder.setIsRecyclable(false); holder.addTiffin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { holder.tiffinImage.setTransitionName("tiffin_image"); } TiffinService.clickAddTiffin(holder.getAdapterPosition(),view.getContext(),holder.tiffinImage); } }); /*CardViewHolder.substractTiffin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TiffinService.clickSubtractTiffin(holder.getAdapterPosition()); } });*/ } @Override public int getItemCount() { return info.size(); } static class Info { String image; String title; //String description; String price; String category; //int count; Info(String tiffinImage,String tiffinTitle,String tiffinPrice,String tiffinCategory) { image = tiffinImage; title = tiffinTitle; //description = tiffinDescription; price = tiffinPrice; category = tiffinCategory; //count = tiffinCount; } } public static List<TiffinAdapter.Info> info; TiffinAdapter(List<TiffinAdapter.Info> info) { TiffinAdapter.info = info; } static class CardViewHolder extends RecyclerView.ViewHolder { TextView tiffinTitle; ImageView tiffinImage; //static TextView tiffinDescription; TextView tiffinPrice; //static TextView tiffinCount; Button addTiffin;//substractTiffin; ImageView tiffinCategory; CardViewHolder(View itemView) { super(itemView); tiffinTitle = itemView.findViewById(R.id.tiffin_title_add); tiffinImage = itemView.findViewById(R.id.tiffin_image); //tiffinDescription = itemView.findViewById(R.id.tiffin_description); tiffinPrice = itemView.findViewById(R.id.tiffin_price); //tiffinCount = itemView.findViewById(R.id.tiffin_count); addTiffin = itemView.findViewById(R.id.tiffin_add);; //substractTiffin = itemView.findViewById(R.id.tiffin_substract); tiffinCategory = itemView.findViewById(R.id.type_icon); } } }
4,213
0.672917
0.672205
107
38.373833
28.183153
131
false
false
0
0
0
0
0
0
0.71028
false
false
4
833166f49730a84c94e95a8678913b3dd5501cab
35,046,933,167,521
e4aa8c9b583e7a18cebee4e10041f097209a1721
/user-service/src/main/java/com/project/userservice/controller/UserController.java
d93d6224baf2d26e02ea91b6ea42987c4469bdd2
[]
no_license
swapnilganjale/microservices
https://github.com/swapnilganjale/microservices
52ae14859f9bf285f54749cba0cd901cbb754d29
b290e1134659512c72795ad3047409a8a62f5b54
refs/heads/master
2020-05-09T05:57:09.664000
2019-04-12T10:49:34
2019-04-12T10:49:34
180,988,729
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.project.userservice.controller; import java.io.IOException; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.core.JsonProcessingException; import com.project.userservice.dto.ChangePasswordDTO; import com.project.userservice.dto.UserDTO; import com.project.userservice.dto.UserInfoDTO; import com.project.userservice.dto.UserRoleDTO; import com.project.userservice.exception.CustomException; import com.project.userservice.page.dto.PageDTO; import com.project.userservice.page.dto.PagingAndSortingRequest; import com.project.userservice.service.UserService; @CrossOrigin @RestController @RequestMapping({ "/users" }) public class UserController { @Autowired private UserService userService; /** * this will give All users info * * @return * @throws CustomException */ @GetMapping("/getAllUsers") public List<UserDTO> getAllUsers() throws CustomException { return userService.getAllUsers(); } @GetMapping("/getuser") public String getuser() { return "Feign client request from User Service"; } /** * this will give users info by id * * @return * @throws CustomException */ @GetMapping("/{id}") public UserRoleDTO getUser(@PathVariable("id") String id) throws CustomException { return userService.getUserInfo(Integer.parseInt(id)); } /** * retrun all the uses with paginantion * * @param pageRequest * @return */ @PostMapping("/getAllUsers") public PageDTO<UserDTO> getUsers(@RequestBody PagingAndSortingRequest pageRequest) { return userService.findWithOptionalParameters(pageRequest); } /** * api will update the user data * * @param userDto * @return * @throws CustomException * @throws JsonProcessingException */ @PutMapping("") public void updateUser(@RequestBody UserDTO userDto) throws CustomException, JsonProcessingException { userService.updateUser(userDto); } /** * creates new user record * * @param userDto * @return * @throws CustomException * @throws JsonProcessingException */ @PostMapping("") public UserDTO addUser(@RequestBody UserDTO userDto) throws CustomException, JsonProcessingException { System.out.println(userDto.toString()); userService.saveUser(userDto); return userDto; } /** * used to hard delete usr record from admin panel * * @param userDto * @return * @throws JsonProcessingException * @throws CustomException */ @DeleteMapping("{id}") public UserDTO user(@PathVariable("id") String id) throws JsonProcessingException, CustomException { userService.deleteUser(Integer.parseInt(id)); return null; } /** * api used to get profile information of perticular user * * @return * @throws CustomException */ @GetMapping("/profile") public UserInfoDTO getUserProfileInfo() throws CustomException { return userService.getUserProfileInfo(); } /** * api used to update the information of profile of logged in user * * @param userInfo * @return * @throws CustomException * @throws IOException */ @PostMapping("/update") public String updateUserProfile(@RequestBody UserInfoDTO userInfo) throws CustomException, IOException { userService.updateUserInfo(userInfo); return "User Profile Updated Successfully"; } /** * this api is used to change the password of user * * @param changePasswordDto * @return * @throws CustomException */ @PostMapping("/changepassowrd") public String changePassword(@RequestBody @Valid ChangePasswordDTO changePasswordDto) throws CustomException { System.out.println("old password == " + changePasswordDto.getExistingPassword()); userService.changePasswordOfUser(changePasswordDto); return "password has been changed"; } /** * this api will send the email to registered user to change the password * * @param email * @return * @throws CustomException */ @GetMapping("/forgetpassword/{id}") public String forgotPassword(@PathVariable("id") String email) throws CustomException { return userService.forgetPassword(email); } }
UTF-8
Java
4,668
java
UserController.java
Java
[]
null
[]
package com.project.userservice.controller; import java.io.IOException; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.core.JsonProcessingException; import com.project.userservice.dto.ChangePasswordDTO; import com.project.userservice.dto.UserDTO; import com.project.userservice.dto.UserInfoDTO; import com.project.userservice.dto.UserRoleDTO; import com.project.userservice.exception.CustomException; import com.project.userservice.page.dto.PageDTO; import com.project.userservice.page.dto.PagingAndSortingRequest; import com.project.userservice.service.UserService; @CrossOrigin @RestController @RequestMapping({ "/users" }) public class UserController { @Autowired private UserService userService; /** * this will give All users info * * @return * @throws CustomException */ @GetMapping("/getAllUsers") public List<UserDTO> getAllUsers() throws CustomException { return userService.getAllUsers(); } @GetMapping("/getuser") public String getuser() { return "Feign client request from User Service"; } /** * this will give users info by id * * @return * @throws CustomException */ @GetMapping("/{id}") public UserRoleDTO getUser(@PathVariable("id") String id) throws CustomException { return userService.getUserInfo(Integer.parseInt(id)); } /** * retrun all the uses with paginantion * * @param pageRequest * @return */ @PostMapping("/getAllUsers") public PageDTO<UserDTO> getUsers(@RequestBody PagingAndSortingRequest pageRequest) { return userService.findWithOptionalParameters(pageRequest); } /** * api will update the user data * * @param userDto * @return * @throws CustomException * @throws JsonProcessingException */ @PutMapping("") public void updateUser(@RequestBody UserDTO userDto) throws CustomException, JsonProcessingException { userService.updateUser(userDto); } /** * creates new user record * * @param userDto * @return * @throws CustomException * @throws JsonProcessingException */ @PostMapping("") public UserDTO addUser(@RequestBody UserDTO userDto) throws CustomException, JsonProcessingException { System.out.println(userDto.toString()); userService.saveUser(userDto); return userDto; } /** * used to hard delete usr record from admin panel * * @param userDto * @return * @throws JsonProcessingException * @throws CustomException */ @DeleteMapping("{id}") public UserDTO user(@PathVariable("id") String id) throws JsonProcessingException, CustomException { userService.deleteUser(Integer.parseInt(id)); return null; } /** * api used to get profile information of perticular user * * @return * @throws CustomException */ @GetMapping("/profile") public UserInfoDTO getUserProfileInfo() throws CustomException { return userService.getUserProfileInfo(); } /** * api used to update the information of profile of logged in user * * @param userInfo * @return * @throws CustomException * @throws IOException */ @PostMapping("/update") public String updateUserProfile(@RequestBody UserInfoDTO userInfo) throws CustomException, IOException { userService.updateUserInfo(userInfo); return "User Profile Updated Successfully"; } /** * this api is used to change the password of user * * @param changePasswordDto * @return * @throws CustomException */ @PostMapping("/changepassowrd") public String changePassword(@RequestBody @Valid ChangePasswordDTO changePasswordDto) throws CustomException { System.out.println("old password == " + changePasswordDto.getExistingPassword()); userService.changePasswordOfUser(changePasswordDto); return "password has been changed"; } /** * this api will send the email to registered user to change the password * * @param email * @return * @throws CustomException */ @GetMapping("/forgetpassword/{id}") public String forgotPassword(@PathVariable("id") String email) throws CustomException { return userService.forgetPassword(email); } }
4,668
0.756213
0.756213
180
24.933332
26.186426
111
false
false
0
0
0
0
0
0
1.038889
false
false
4
59a28dcf05db17afe1e671e1f45b18e31ea837ea
35,192,962,047,115
126214a888167a0fd4e817f0b4af08422c136a69
/src/dao/BillDAO.java
e9b6062958cb516d9c080f6a26732788f798e055
[]
no_license
TruongGiangVu/CoffeeShop-project-Java-programing
https://github.com/TruongGiangVu/CoffeeShop-project-Java-programing
6aed819437345b7596307e72b8bffb5adb402416
242821dd11a0b1a161830a39473faa97784b5f81
refs/heads/master
2020-07-25T00:50:40.440000
2019-09-12T17:44:03
2019-09-12T17:44:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao; import java.sql.ResultSet; import java.util.ArrayList; import dto.Bill; public class BillDAO { public ArrayList<Bill> readAll(){ ArrayList<Bill> arr = new ArrayList<Bill>(); String sql = "select * from bill;"; DataTransfer data = new DataTransfer(); try { data.connect(); ResultSet rs = data.execute(sql); while(rs.next()) { Bill p = new Bill(); p.setBill_id(rs.getString("bill_id")); p.setEmp_id(rs.getString("emp_id")); p.setCus_id(rs.getString("cus_id")); p.setDate(rs.getString("date")); p.setStatus(rs.getInt("status")); p.setSale_id(rs.getString("sale_id")); p.setSale_total(rs.getDouble("sale_total")); arr.add(p); } }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return arr; } public ArrayList<Bill> read(){ ArrayList<Bill> arr = new ArrayList<Bill>(); String sql = "select * from bill where status <> 2 ;"; DataTransfer data = new DataTransfer(); try { data.connect(); ResultSet rs = data.execute(sql); while(rs.next()) { Bill p = new Bill(); p.setBill_id(rs.getString("bill_id")); p.setEmp_id(rs.getString("emp_id")); p.setCus_id(rs.getString("cus_id")); p.setDate(rs.getString("date")); p.setStatus(rs.getInt("status")); p.setSale_id(rs.getString("sale_id")); p.setSale_total(rs.getDouble("sale_total")); arr.add(p); } }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return arr; } public int delete(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("delete from bill where bill_id = '%s';", id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int add(Bill p) { DataTransfer data = new DataTransfer(); String sql =String.format("insert into bill(bill_id,emp_id,cus_id,date,sale_id,sale_total,status) " + "values ('%s','%s','%s','%s','%s',%f,%d);", p.getBill_id(),p.getEmp_id(),p.getCus_id(),p.getDateStr(),p.getSale_id(),p.getSale_total(),p.getStatus()); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int lock(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set status = 1 " + "where bill_id = '%s';",id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int active(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set status = 0 " + "where bill_id = '%s';",id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int disable(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set status = 2 " + "where bill_id = '%s';",id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int update(Bill p) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set emp_id = '%s', cus_id = '%s', date = '%s', sale_id = '%s', sale_total = %f, status = %d " + "where bill_id = '%s';",p.getEmp_id(),p.getCus_id(),p.getDateStr(),p.getSale_id(),p.getSale_total(),p.getStatus(),p.getBill_id()); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } }
UTF-8
Java
4,018
java
BillDAO.java
Java
[]
null
[]
package dao; import java.sql.ResultSet; import java.util.ArrayList; import dto.Bill; public class BillDAO { public ArrayList<Bill> readAll(){ ArrayList<Bill> arr = new ArrayList<Bill>(); String sql = "select * from bill;"; DataTransfer data = new DataTransfer(); try { data.connect(); ResultSet rs = data.execute(sql); while(rs.next()) { Bill p = new Bill(); p.setBill_id(rs.getString("bill_id")); p.setEmp_id(rs.getString("emp_id")); p.setCus_id(rs.getString("cus_id")); p.setDate(rs.getString("date")); p.setStatus(rs.getInt("status")); p.setSale_id(rs.getString("sale_id")); p.setSale_total(rs.getDouble("sale_total")); arr.add(p); } }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return arr; } public ArrayList<Bill> read(){ ArrayList<Bill> arr = new ArrayList<Bill>(); String sql = "select * from bill where status <> 2 ;"; DataTransfer data = new DataTransfer(); try { data.connect(); ResultSet rs = data.execute(sql); while(rs.next()) { Bill p = new Bill(); p.setBill_id(rs.getString("bill_id")); p.setEmp_id(rs.getString("emp_id")); p.setCus_id(rs.getString("cus_id")); p.setDate(rs.getString("date")); p.setStatus(rs.getInt("status")); p.setSale_id(rs.getString("sale_id")); p.setSale_total(rs.getDouble("sale_total")); arr.add(p); } }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return arr; } public int delete(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("delete from bill where bill_id = '%s';", id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int add(Bill p) { DataTransfer data = new DataTransfer(); String sql =String.format("insert into bill(bill_id,emp_id,cus_id,date,sale_id,sale_total,status) " + "values ('%s','%s','%s','%s','%s',%f,%d);", p.getBill_id(),p.getEmp_id(),p.getCus_id(),p.getDateStr(),p.getSale_id(),p.getSale_total(),p.getStatus()); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int lock(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set status = 1 " + "where bill_id = '%s';",id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int active(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set status = 0 " + "where bill_id = '%s';",id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int disable(String id) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set status = 2 " + "where bill_id = '%s';",id); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } public int update(Bill p) { DataTransfer data = new DataTransfer(); String sql =String.format("update bill set emp_id = '%s', cus_id = '%s', date = '%s', sale_id = '%s', sale_total = %f, status = %d " + "where bill_id = '%s';",p.getEmp_id(),p.getCus_id(),p.getDateStr(),p.getSale_id(),p.getSale_total(),p.getStatus(),p.getBill_id()); int check = 0; try { data.connect(); check = data.update(sql); }catch(Exception e) { e.printStackTrace(); }finally { data.close(); } return check; } }
4,018
0.592086
0.589597
150
24.786667
23.166237
156
false
false
0
0
0
0
0
0
3.18
false
false
4
813596deb0ee77d4152dec4b3d8f6f2e773a1b35
1,005,022,410,452
d16f17f3b9d0aa12c240d01902a41adba20fad12
/src/leetcode/leetcode12xx/leetcode1203/Solution.java
42197c4df4e644d77969a5205591d93d92eb7432
[]
no_license
redsun9/leetcode
https://github.com/redsun9/leetcode
79f9293b88723d2fd123d9e10977b685d19b2505
67d6c16a1b4098277af458849d352b47410518ee
refs/heads/master
2023-06-23T19:37:42.719000
2023-06-09T21:11:39
2023-06-09T21:11:39
242,967,296
38
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode.leetcode12xx.leetcode1203; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; public class Solution { public static final int[] EMPTY_RESPONSE = new int[0]; public int[] sortItems(int n, int m, int[] group, List<List<Integer>> beforeItems) { int totalNumberOfGroups = 0; Map<Integer, Integer> groupIdMap = new HashMap<>(); //parameter id to given id List<List<Integer>> memberOfGroups = new ArrayList<>(); for (int i = 0; i < n; i++) { if (group[i] == -1) { group[i] = totalNumberOfGroups++; memberOfGroups.add(Collections.singletonList(i)); } else { Integer id = groupIdMap.get(group[i]); List<Integer> memberOfGroup; if (id == null) { id = totalNumberOfGroups++; groupIdMap.put(group[i], id); memberOfGroup = new ArrayList<>(); memberOfGroups.add(memberOfGroup); } else { memberOfGroup = memberOfGroups.get(id); } memberOfGroup.add(i); group[i] = id; } } int[] ans = new int[n]; int pos = 0; Boolean[] markedElement = new Boolean[n]; Boolean[] markedGroup = new Boolean[totalNumberOfGroups]; Stack<Pair> groupStack = new Stack<>(); Stack<Pair> memberStack = new Stack<>(); for (int groupId = 0; groupId < totalNumberOfGroups; groupId++) groupStack.push(new Pair(groupId, false)); while (!groupStack.isEmpty()) { Pair groupPair = groupStack.pop(); int groupId = groupPair.argument; if (markedGroup[groupId] == null) { markedGroup[groupId] = false; groupStack.push(new Pair(groupId, true)); for (Integer member : memberOfGroups.get(groupId)) { for (Integer prev : beforeItems.get(member)) { if (group[prev] != groupId) groupStack.push(new Pair(group[prev], false)); } } } else if (!markedGroup[groupId]) { if (!groupPair.afterRecursion) return EMPTY_RESPONSE; markedGroup[groupId] = true; for (Integer memberId : memberOfGroups.get(groupId)) memberStack.push(new Pair(memberId, false)); while (!memberStack.isEmpty()) { Pair memberPair = memberStack.pop(); int memberId = memberPair.argument; if (markedElement[memberId] == null) { markedElement[memberId] = false; memberStack.push(new Pair(memberId, true)); for (Integer prev : beforeItems.get(memberId)) { if (group[prev] == groupId) memberStack.push(new Pair(prev, false)); } } else if (!markedElement[memberId]) { if (!memberPair.afterRecursion) return EMPTY_RESPONSE; markedElement[memberId] = true; ans[pos++] = memberId; } } } } return ans; } private static class Pair { final int argument; final boolean afterRecursion; public Pair(int argument, boolean afterRecursion) { this.argument = argument; this.afterRecursion = afterRecursion; } } }
UTF-8
Java
3,664
java
Solution.java
Java
[]
null
[]
package leetcode.leetcode12xx.leetcode1203; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; public class Solution { public static final int[] EMPTY_RESPONSE = new int[0]; public int[] sortItems(int n, int m, int[] group, List<List<Integer>> beforeItems) { int totalNumberOfGroups = 0; Map<Integer, Integer> groupIdMap = new HashMap<>(); //parameter id to given id List<List<Integer>> memberOfGroups = new ArrayList<>(); for (int i = 0; i < n; i++) { if (group[i] == -1) { group[i] = totalNumberOfGroups++; memberOfGroups.add(Collections.singletonList(i)); } else { Integer id = groupIdMap.get(group[i]); List<Integer> memberOfGroup; if (id == null) { id = totalNumberOfGroups++; groupIdMap.put(group[i], id); memberOfGroup = new ArrayList<>(); memberOfGroups.add(memberOfGroup); } else { memberOfGroup = memberOfGroups.get(id); } memberOfGroup.add(i); group[i] = id; } } int[] ans = new int[n]; int pos = 0; Boolean[] markedElement = new Boolean[n]; Boolean[] markedGroup = new Boolean[totalNumberOfGroups]; Stack<Pair> groupStack = new Stack<>(); Stack<Pair> memberStack = new Stack<>(); for (int groupId = 0; groupId < totalNumberOfGroups; groupId++) groupStack.push(new Pair(groupId, false)); while (!groupStack.isEmpty()) { Pair groupPair = groupStack.pop(); int groupId = groupPair.argument; if (markedGroup[groupId] == null) { markedGroup[groupId] = false; groupStack.push(new Pair(groupId, true)); for (Integer member : memberOfGroups.get(groupId)) { for (Integer prev : beforeItems.get(member)) { if (group[prev] != groupId) groupStack.push(new Pair(group[prev], false)); } } } else if (!markedGroup[groupId]) { if (!groupPair.afterRecursion) return EMPTY_RESPONSE; markedGroup[groupId] = true; for (Integer memberId : memberOfGroups.get(groupId)) memberStack.push(new Pair(memberId, false)); while (!memberStack.isEmpty()) { Pair memberPair = memberStack.pop(); int memberId = memberPair.argument; if (markedElement[memberId] == null) { markedElement[memberId] = false; memberStack.push(new Pair(memberId, true)); for (Integer prev : beforeItems.get(memberId)) { if (group[prev] == groupId) memberStack.push(new Pair(prev, false)); } } else if (!markedElement[memberId]) { if (!memberPair.afterRecursion) return EMPTY_RESPONSE; markedElement[memberId] = true; ans[pos++] = memberId; } } } } return ans; } private static class Pair { final int argument; final boolean afterRecursion; public Pair(int argument, boolean afterRecursion) { this.argument = argument; this.afterRecursion = afterRecursion; } } }
3,664
0.524563
0.521288
87
41.114941
25.35741
114
false
false
0
0
0
0
0
0
0.758621
false
false
4
969c86eaa7a4969b25daf0cf47c954c6cf5ea80b
38,379,827,764,520
5ffa4bc18e4e32fbc5a5fcc5b0100b2a3eb00712
/MyApplication/app/src/main/java/com/example/myapplication/DMTest.java
936b663b8b735df9090dbbad2bcc5ed2d1ea0d76
[]
no_license
1173710201/-
https://github.com/1173710201/-
90322772e708d67e36e55c7beb53f9b0ecaef4f8
59dd0a976d5dfa5a4cd2cd48886e32cb751a2e28
refs/heads/master
2021-06-27T02:43:56.212000
2021-04-24T22:33:34
2021-04-24T22:33:34
225,113,099
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.MediaController; import android.widget.VideoView; import com.example.myapplication.bean.vDanmu; import com.example.myapplication.connect.BitmapUtils; import com.example.myapplication.connect.Connect; import com.example.myapplication.connect.MyCacheStuffer; import com.kd.easybarrage.Barrage; import com.kd.easybarrage.BarrageView; import net.sf.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import master.flame.danmaku.danmaku.model.BaseDanmaku; import master.flame.danmaku.danmaku.model.DanmakuTimer; import master.flame.danmaku.danmaku.model.IDanmakus; import master.flame.danmaku.danmaku.model.android.BaseCacheStuffer; import master.flame.danmaku.danmaku.model.android.DanmakuContext; import master.flame.danmaku.danmaku.model.android.Danmakus; import master.flame.danmaku.danmaku.parser.BaseDanmakuParser; import master.flame.danmaku.ui.widget.DanmakuView; public class DMTest extends AppCompatActivity { private VideoView videoView; /** * 弹幕控件 */ private DanmakuView mDanmakuView; /** * 弹幕的上下文 */ private DanmakuContext mContext; /** * 背景的颜色 */ private EditText dmContent; private Button dmFly; private String[] mContentColorBg = {"#0099ff", "#b2d15c", "#b9b9f1", "#f46c77"}; private List<vDanmu> vDanmus = new ArrayList<>(); private int idx; private static Bitmap getBitmap(Context context, int vectorDrawableId) { Bitmap bitmap = null; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { Drawable vectorDrawable = context.getDrawable(vectorDrawableId); bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); vectorDrawable.draw(canvas); } else { bitmap = BitmapFactory.decodeResource(context.getResources(), vectorDrawableId); } return bitmap; } private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); String result = (String) msg.obj; System.out.println("resultis:"+result); JSONArray jsonArray = JSONArray.fromObject(result); for (int i = 0;i<jsonArray.size();i++) { net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(jsonArray.get(i).toString()); vDanmu temp = new vDanmu(); temp.setContent((String)jsonObject.get("content")); temp.setTime((Integer)jsonObject.get("time")); vDanmus.add(temp); } } }; private Handler handler2 = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); System.out.println(msg); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getSupportActionBar() != null){ getSupportActionBar().hide(); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_dmtest); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } vDanmus.clear(); idx = 0; Connect conn = new Connect(); conn.sendReq2(handler,1,"vDanmu/get?idvideo="+getIntent().getIntExtra("id",1),"GET",null,MainActivity.TOKEN); bindViews(); initDanmuKu(); dmContent = findViewById(R.id.editText15); dmFly = findViewById(R.id.buttonFly); dmFly.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String dm = dmContent.getText().toString(); addDanmaku(true,dm); org.json.JSONObject object= new JSONObject(); try { object.put("idvideo", getIntent().getIntExtra("id",1)); object.put("who","hyf"); object.put("content",dm); object.put("time",mDanmakuView.getCurrentTime()); Connect conn = new Connect(); conn.sendReq2(handler2,1,"vDanmu/add","POST",String.valueOf(object),MainActivity.TOKEN); }catch (JSONException e){ e.printStackTrace(); } long tm = mDanmakuView.getCurrentTime(); } }); /*BarrageView barrageView = (BarrageView)findViewById(R.id.barrageView); barrageView.destroy(); barrageView.addBarrage(new Barrage("三天之内撒了你"));*/ } private void bindViews(){ videoView = findViewById(R.id.videoView2); videoView.setVideoPath("http://39.105.21.114:12306/file/video/get?filename="+getIntent().getStringExtra("url")); videoView.setMediaController(new MediaController(this)); videoView.start(); } private void initDanmuKu(){ mDanmakuView = findViewById(R.id.sv_danmaku); //设置最大显示行数 HashMap<Integer, Integer> maxLInesPair = new HashMap<>(16); maxLInesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 8); //设置是否禁止重叠 HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>(16); overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true); overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true); //创建弹幕上下文 mContext = DanmakuContext.create(); //设置一些相关的配置 mContext.setDuplicateMergingEnabled(false) //是否重复合并 .setScrollSpeedFactor(1.2f) //设置文字的比例 .setScaleTextSize(1.2f) //图文混排的时候使用! .setCacheStuffer(new MyCacheStuffer(this), mBackgroundCacheStuffer) //设置显示最大行数 .setMaximumLines(maxLInesPair) //设置防,null代表可以重叠 .preventOverlapping(overlappingEnablePair); //设置解析器 if (mDanmakuView != null) { BaseDanmakuParser defaultDanmakuParser = getDefaultDanmakuParser(); //相应的回掉 mDanmakuView.setCallback(new master.flame.danmaku.controller.DrawHandler.Callback() { @Override public void updateTimer(DanmakuTimer timer) { //定时器更新的时候回掉 /* System.out.println(timer.currMillisecond); if (timer.currMillisecond > 1000 && timer.currMillisecond<1300){ addDanmaku(false,"测试"+(timer.currMillisecond)); }*/ if(!vDanmus.isEmpty()&&idx<vDanmus.size()){ if(vDanmus.get(idx).getTime()<=timer.currMillisecond){ addDanmaku(false,vDanmus.get(idx).getContent()); idx++; } } } @Override public void drawingFinished() { //弹幕绘制完成时回掉 } @Override public void danmakuShown(BaseDanmaku danmaku) { //弹幕展示的时候回掉 } @Override public void prepared() { //弹幕准备好的时候回掉,这里启动弹幕 mDanmakuView.start(); } }); mDanmakuView.prepare(defaultDanmakuParser, mContext); mDanmakuView.enableDanmakuDrawingCache(true); } } /** * @author : 贺金龙 * email : 753355530@qq.com * create at 2018/7/13 11:21 * description : 缓存相关的内容 */ private BaseCacheStuffer.Proxy mBackgroundCacheStuffer = new BaseCacheStuffer.Proxy() { @Override public void prepareDrawing(BaseDanmaku danmaku, boolean fromWorkerThread) { // 根据你的条件检查是否需要需要更新弹幕 } @Override public void releaseResource(BaseDanmaku danmaku) { //清理相应的数据 danmaku.tag = null; } }; /** * @author : 贺金龙 * email : 753355530@qq.com * create at 2018/7/12 18:26 * description : 添加弹幕的方法 */ public void add(View view) { addDanmaku(false,"TT"); } /** * @author : 贺金龙 * email : 753355530@qq.com * create at 2018/7/12 18:31 * description : 添加弹幕的方法 */ private void addDanmaku(boolean islive,String text) { //创建一个弹幕对象,这里后面的属性是设置滚动方向的! BaseDanmaku danmaku = mContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL); if (danmaku == null || mDanmakuView == null) { return; } //设置相应的数据 Bitmap showBitmap = getBitmap(DMTest.this, R.mipmap.ic_launcher); showBitmap = BitmapUtils.getShowPicture(showBitmap); Map<String, Object> map = new HashMap<>(16); map.put("content",text); map.put("bitmap", showBitmap); Random random = new Random(); int randomNum = random.nextInt(mContentColorBg.length); map.put("color", mContentColorBg[randomNum]); danmaku.tag = map; //弹幕显示的文字 danmaku.text = "这是一条弹幕" + System.nanoTime(); //设置相应的边距 danmaku.padding = 5; // 可能会被各种过滤器过滤并隐藏显示,若果是本机发送的弹幕,建议设置成1; danmaku.priority = 0; //是否是直播弹幕 danmaku.isLive = islive; danmaku.setTime(mDanmakuView.getCurrentTime() + 1200); //设置文字大小 danmaku.textSize = 15f; //设置文字颜色 danmaku.textColor = Color.RED; //设置阴影的颜色 danmaku.textShadowColor = Color.WHITE; // danmaku.underlineColor = Color.GREEN; //设置背景颜色 danmaku.borderColor = Color.GREEN; //添加这条弹幕,也就相当于发送 mDanmakuView.addDanmaku(danmaku); } /** * @author : 贺金龙 * email : 753355530@qq.com * create at 2018/7/13 11:27 * description : 添加图文混排的弹幕 */ public void addImage(View view) { BaseDanmaku danmaku = mContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL); if (danmaku == null || mDanmakuView == null) { return; } //设置相应的数据 Bitmap showBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.account); showBitmap = BitmapUtils.getShowPicture(showBitmap); Map<String, Object> map = new HashMap<>(16); map.put("content", "这里是显示的内容"); map.put("bitmap", showBitmap); Random random = new Random(); int randomNum = random.nextInt(mContentColorBg.length); map.put("color", mContentColorBg[randomNum]); danmaku.tag = map; danmaku.textSize = 0; danmaku.padding = 10; danmaku.text = ""; // 一定会显示, 一般用于本机发送的弹幕 danmaku.priority = 1; danmaku.isLive = false; danmaku.setTime(mDanmakuView.getCurrentTime()); danmaku.textColor = Color.WHITE; // 重要:如果有图文混排,最好不要设置描边(设textShadowColor=0),否则会进行两次复杂的绘制导致运行效率降低 danmaku.textShadowColor = 0; mDanmakuView.addDanmaku(danmaku); } /** * @author : 贺金龙 * email : 753355530@qq.com * create at 2018/7/12 18:30 * description : 最简单的解析器 */ public static BaseDanmakuParser getDefaultDanmakuParser() { return new BaseDanmakuParser() { @Override protected IDanmakus parse() { return new Danmakus(); } }; } @Override protected void onPause() { super.onPause(); if (mDanmakuView != null && mDanmakuView.isPrepared()) { mDanmakuView.pause(); } } @Override protected void onResume() { super.onResume(); if (mDanmakuView != null && mDanmakuView.isPrepared() && mDanmakuView.isPaused()) { mDanmakuView.resume(); } } @Override protected void onDestroy() { super.onDestroy(); if (mDanmakuView != null) { // dont forget release! mDanmakuView.release(); mDanmakuView = null; } } @Override public void onBackPressed() { super.onBackPressed(); if (mDanmakuView != null) { // dont forget release! mDanmakuView.release(); mDanmakuView = null; } } }
UTF-8
Java
14,166
java
DMTest.java
Java
[ { "context": "deoView2);\n videoView.setVideoPath(\"http://39.105.21.114:12306/file/video/get?filename=\"+getIntent().getSt", "end": 5814, "score": 0.9995380640029907, "start": 5801, "tag": "IP_ADDRESS", "value": "39.105.21.114" }, { "context": "e(true);\n }\n }\n ...
null
[]
package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.MediaController; import android.widget.VideoView; import com.example.myapplication.bean.vDanmu; import com.example.myapplication.connect.BitmapUtils; import com.example.myapplication.connect.Connect; import com.example.myapplication.connect.MyCacheStuffer; import com.kd.easybarrage.Barrage; import com.kd.easybarrage.BarrageView; import net.sf.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import master.flame.danmaku.danmaku.model.BaseDanmaku; import master.flame.danmaku.danmaku.model.DanmakuTimer; import master.flame.danmaku.danmaku.model.IDanmakus; import master.flame.danmaku.danmaku.model.android.BaseCacheStuffer; import master.flame.danmaku.danmaku.model.android.DanmakuContext; import master.flame.danmaku.danmaku.model.android.Danmakus; import master.flame.danmaku.danmaku.parser.BaseDanmakuParser; import master.flame.danmaku.ui.widget.DanmakuView; public class DMTest extends AppCompatActivity { private VideoView videoView; /** * 弹幕控件 */ private DanmakuView mDanmakuView; /** * 弹幕的上下文 */ private DanmakuContext mContext; /** * 背景的颜色 */ private EditText dmContent; private Button dmFly; private String[] mContentColorBg = {"#0099ff", "#b2d15c", "#b9b9f1", "#f46c77"}; private List<vDanmu> vDanmus = new ArrayList<>(); private int idx; private static Bitmap getBitmap(Context context, int vectorDrawableId) { Bitmap bitmap = null; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { Drawable vectorDrawable = context.getDrawable(vectorDrawableId); bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); vectorDrawable.draw(canvas); } else { bitmap = BitmapFactory.decodeResource(context.getResources(), vectorDrawableId); } return bitmap; } private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); String result = (String) msg.obj; System.out.println("resultis:"+result); JSONArray jsonArray = JSONArray.fromObject(result); for (int i = 0;i<jsonArray.size();i++) { net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(jsonArray.get(i).toString()); vDanmu temp = new vDanmu(); temp.setContent((String)jsonObject.get("content")); temp.setTime((Integer)jsonObject.get("time")); vDanmus.add(temp); } } }; private Handler handler2 = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); System.out.println(msg); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getSupportActionBar() != null){ getSupportActionBar().hide(); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_dmtest); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } vDanmus.clear(); idx = 0; Connect conn = new Connect(); conn.sendReq2(handler,1,"vDanmu/get?idvideo="+getIntent().getIntExtra("id",1),"GET",null,MainActivity.TOKEN); bindViews(); initDanmuKu(); dmContent = findViewById(R.id.editText15); dmFly = findViewById(R.id.buttonFly); dmFly.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String dm = dmContent.getText().toString(); addDanmaku(true,dm); org.json.JSONObject object= new JSONObject(); try { object.put("idvideo", getIntent().getIntExtra("id",1)); object.put("who","hyf"); object.put("content",dm); object.put("time",mDanmakuView.getCurrentTime()); Connect conn = new Connect(); conn.sendReq2(handler2,1,"vDanmu/add","POST",String.valueOf(object),MainActivity.TOKEN); }catch (JSONException e){ e.printStackTrace(); } long tm = mDanmakuView.getCurrentTime(); } }); /*BarrageView barrageView = (BarrageView)findViewById(R.id.barrageView); barrageView.destroy(); barrageView.addBarrage(new Barrage("三天之内撒了你"));*/ } private void bindViews(){ videoView = findViewById(R.id.videoView2); videoView.setVideoPath("http://172.16.58.3:12306/file/video/get?filename="+getIntent().getStringExtra("url")); videoView.setMediaController(new MediaController(this)); videoView.start(); } private void initDanmuKu(){ mDanmakuView = findViewById(R.id.sv_danmaku); //设置最大显示行数 HashMap<Integer, Integer> maxLInesPair = new HashMap<>(16); maxLInesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 8); //设置是否禁止重叠 HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>(16); overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true); overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true); //创建弹幕上下文 mContext = DanmakuContext.create(); //设置一些相关的配置 mContext.setDuplicateMergingEnabled(false) //是否重复合并 .setScrollSpeedFactor(1.2f) //设置文字的比例 .setScaleTextSize(1.2f) //图文混排的时候使用! .setCacheStuffer(new MyCacheStuffer(this), mBackgroundCacheStuffer) //设置显示最大行数 .setMaximumLines(maxLInesPair) //设置防,null代表可以重叠 .preventOverlapping(overlappingEnablePair); //设置解析器 if (mDanmakuView != null) { BaseDanmakuParser defaultDanmakuParser = getDefaultDanmakuParser(); //相应的回掉 mDanmakuView.setCallback(new master.flame.danmaku.controller.DrawHandler.Callback() { @Override public void updateTimer(DanmakuTimer timer) { //定时器更新的时候回掉 /* System.out.println(timer.currMillisecond); if (timer.currMillisecond > 1000 && timer.currMillisecond<1300){ addDanmaku(false,"测试"+(timer.currMillisecond)); }*/ if(!vDanmus.isEmpty()&&idx<vDanmus.size()){ if(vDanmus.get(idx).getTime()<=timer.currMillisecond){ addDanmaku(false,vDanmus.get(idx).getContent()); idx++; } } } @Override public void drawingFinished() { //弹幕绘制完成时回掉 } @Override public void danmakuShown(BaseDanmaku danmaku) { //弹幕展示的时候回掉 } @Override public void prepared() { //弹幕准备好的时候回掉,这里启动弹幕 mDanmakuView.start(); } }); mDanmakuView.prepare(defaultDanmakuParser, mContext); mDanmakuView.enableDanmakuDrawingCache(true); } } /** * @author : 贺金龙 * email : <EMAIL> * create at 2018/7/13 11:21 * description : 缓存相关的内容 */ private BaseCacheStuffer.Proxy mBackgroundCacheStuffer = new BaseCacheStuffer.Proxy() { @Override public void prepareDrawing(BaseDanmaku danmaku, boolean fromWorkerThread) { // 根据你的条件检查是否需要需要更新弹幕 } @Override public void releaseResource(BaseDanmaku danmaku) { //清理相应的数据 danmaku.tag = null; } }; /** * @author : 贺金龙 * email : <EMAIL> * create at 2018/7/12 18:26 * description : 添加弹幕的方法 */ public void add(View view) { addDanmaku(false,"TT"); } /** * @author : 贺金龙 * email : <EMAIL> * create at 2018/7/12 18:31 * description : 添加弹幕的方法 */ private void addDanmaku(boolean islive,String text) { //创建一个弹幕对象,这里后面的属性是设置滚动方向的! BaseDanmaku danmaku = mContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL); if (danmaku == null || mDanmakuView == null) { return; } //设置相应的数据 Bitmap showBitmap = getBitmap(DMTest.this, R.mipmap.ic_launcher); showBitmap = BitmapUtils.getShowPicture(showBitmap); Map<String, Object> map = new HashMap<>(16); map.put("content",text); map.put("bitmap", showBitmap); Random random = new Random(); int randomNum = random.nextInt(mContentColorBg.length); map.put("color", mContentColorBg[randomNum]); danmaku.tag = map; //弹幕显示的文字 danmaku.text = "这是一条弹幕" + System.nanoTime(); //设置相应的边距 danmaku.padding = 5; // 可能会被各种过滤器过滤并隐藏显示,若果是本机发送的弹幕,建议设置成1; danmaku.priority = 0; //是否是直播弹幕 danmaku.isLive = islive; danmaku.setTime(mDanmakuView.getCurrentTime() + 1200); //设置文字大小 danmaku.textSize = 15f; //设置文字颜色 danmaku.textColor = Color.RED; //设置阴影的颜色 danmaku.textShadowColor = Color.WHITE; // danmaku.underlineColor = Color.GREEN; //设置背景颜色 danmaku.borderColor = Color.GREEN; //添加这条弹幕,也就相当于发送 mDanmakuView.addDanmaku(danmaku); } /** * @author : 贺金龙 * email : <EMAIL> * create at 2018/7/13 11:27 * description : 添加图文混排的弹幕 */ public void addImage(View view) { BaseDanmaku danmaku = mContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL); if (danmaku == null || mDanmakuView == null) { return; } //设置相应的数据 Bitmap showBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.account); showBitmap = BitmapUtils.getShowPicture(showBitmap); Map<String, Object> map = new HashMap<>(16); map.put("content", "这里是显示的内容"); map.put("bitmap", showBitmap); Random random = new Random(); int randomNum = random.nextInt(mContentColorBg.length); map.put("color", mContentColorBg[randomNum]); danmaku.tag = map; danmaku.textSize = 0; danmaku.padding = 10; danmaku.text = ""; // 一定会显示, 一般用于本机发送的弹幕 danmaku.priority = 1; danmaku.isLive = false; danmaku.setTime(mDanmakuView.getCurrentTime()); danmaku.textColor = Color.WHITE; // 重要:如果有图文混排,最好不要设置描边(设textShadowColor=0),否则会进行两次复杂的绘制导致运行效率降低 danmaku.textShadowColor = 0; mDanmakuView.addDanmaku(danmaku); } /** * @author : 贺金龙 * email : <EMAIL> * create at 2018/7/12 18:30 * description : 最简单的解析器 */ public static BaseDanmakuParser getDefaultDanmakuParser() { return new BaseDanmakuParser() { @Override protected IDanmakus parse() { return new Danmakus(); } }; } @Override protected void onPause() { super.onPause(); if (mDanmakuView != null && mDanmakuView.isPrepared()) { mDanmakuView.pause(); } } @Override protected void onResume() { super.onResume(); if (mDanmakuView != null && mDanmakuView.isPrepared() && mDanmakuView.isPaused()) { mDanmakuView.resume(); } } @Override protected void onDestroy() { super.onDestroy(); if (mDanmakuView != null) { // dont forget release! mDanmakuView.release(); mDanmakuView = null; } } @Override public void onBackPressed() { super.onBackPressed(); if (mDanmakuView != null) { // dont forget release! mDanmakuView.release(); mDanmakuView = null; } } }
14,119
0.599549
0.585714
381
33.908138
23.941738
120
false
false
0
0
0
0
0
0
0.611549
false
false
4