blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
d78fe7c8bbf571ccafc63b131c8f17b7a71cba9f
Java
goofyahead/volleyStats
/app/src/main/java/com/mgl/volleystats/models/Reception.java
UTF-8
354
2.109375
2
[]
no_license
package com.mgl.volleystats.models; /** * Created by goofyahead on 10/23/15. */ public class Reception extends Play { private String type = Reception.class.getSimpleName(); public Reception(String playerId, int quality, String timeStamp, String matchId, String teamId) { super(playerId, quality, timeStamp, matchId, teamId); } }
true
ec59349cca44d5ec0239b7f38c2abebfd480bad3
Java
IvanPavlovets/ipavlovets
/chapter_003/src/main/java/ru/job4j/collections/convert/ConvertList2Array.java
UTF-8
1,182
3.453125
3
[ "Apache-2.0" ]
permissive
package ru.job4j.collections.convert; import java.util.Arrays; import java.util.List; public class ConvertList2Array { /** * Метод равномерно разбивает коллекцию list на количество строк двумерного массива. * В методе организуеться проверка - если количество элементов не кратно количеству строк * (результат в переменной tail), * то оставшееся количество в массиве заполняеться нулями * (заполняем коллекцию на недостающее кол-во). * * @param list * @return */ public int[][] toArray(List<Integer> list, int rows) { int cells = (int) Math.ceil((double) list.size() / rows); int[][] array = new int[rows][cells]; int out = 0; int in = 0; for (Integer integer : list) { array[out][in++] = integer; if (in == cells) { out++; in = 0; } } return array; } }
true
573786f93abf6e7e2e5c74f18b23524152df7169
Java
flame-stream/FlameStream
/runtime/src/test/java/com/spbsu/flamestream/runtime/sum/Reduce.java
UTF-8
382
2.3125
2
[ "Apache-2.0" ]
permissive
package com.spbsu.flamestream.runtime.sum; import com.spbsu.flamestream.core.graph.SerializableFunction; import java.util.List; import java.util.stream.Stream; final class Reduce implements SerializableFunction<List<Numb>, Stream<Sum>> { @Override public Stream<Sum> apply(List<Numb> group) { return Stream.of(new Sum(group.get(0).value() + group.get(1).value())); } }
true
d03e0cf581acf3901dce37cf5f801ff32d742a4f
Java
quirinal36/DadaBrick
/src/main/java/dada/brick/com/service/PhotoInfoService.java
UTF-8
1,722
2.0625
2
[]
no_license
package dada.brick.com.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import dada.brick.com.dao.PhotoInfoDAO; import dada.brick.com.vo.PhotoInfo; @Component("photoInfoService") public class PhotoInfoService implements DataService<PhotoInfo> { @Autowired PhotoInfoDAO dao; @Override public int insert(PhotoInfo input) { // TODO Auto-generated method stub return dao.insert(input); } public int insert(List<PhotoInfo> input) { return dao.insert(input); } @Override public int update(PhotoInfo input) { return dao.update(input); } public int update(List<PhotoInfo> list) { return dao.update(list); } public int updateOrder(List<PhotoInfo> list) { return dao.updateOrder(list); } public int updateProducts(List<PhotoInfo> list) { return dao.updateProducts(list); } @Override public int delete(PhotoInfo input) { return dao.delete(input); } @Override public List<PhotoInfo> select() { // TODO Auto-generated method stub return null; } @Override public List<PhotoInfo> select(PhotoInfo input) { return dao.select(input); } @Override public PhotoInfo selectOne(PhotoInfo input) { // TODO Auto-generated method stub return dao.selectOne(input); } @Override public int count(PhotoInfo input) { // TODO Auto-generated method stub return 0; } public List<PhotoInfo> selectProducts(){ return dao.selectProducts(); } public PhotoInfo selectNext(PhotoInfo input) { return dao.selectNext(input); } public PhotoInfo selectPrev(PhotoInfo input) { return dao.selectPrev(input); } }
true
f846b3bd05fa76d1885f8578ec20d4795bc69869
Java
SagarDep/Custom-Gallery
/app/src/main/java/com/orgware/customgallery/adapter/folder/FolderAdapter.java
UTF-8
2,884
2.28125
2
[ "Apache-2.0" ]
permissive
package com.orgware.customgallery.adapter.folder; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import com.bumptech.glide.Glide; import com.orgware.customgallery.model.FolderItem; import com.orgware.customgallery.R; import java.util.ArrayList; import java.util.List; /** * Created by nandagopal on 12/14/16. */ public class FolderAdapter extends RecyclerView.Adapter<FolderAdapter.FolderViewHolder> { private List<String> folderNameList = new ArrayList<>(); private List<String> folderIconList = new ArrayList<>(); private List<FolderItem> folderItemList; private Context context; private LayoutInflater inflater; private ClickManager clickManager; public FolderAdapter(Context context, ClickManager clickManager) { this.context = context; this.clickManager = clickManager; inflater = LayoutInflater.from(context); folderItemList = new ArrayList<>(); } public void setFolderItemList(List<FolderItem> itemList) { if (folderItemList == null) return; folderItemList.clear(); folderItemList.addAll(itemList); notifyDataSetChanged(); } public interface ClickManager { void onItemClick(FolderItem folderItem); } @Override public FolderViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = inflater.inflate(R.layout.item_folder, parent, false); return new FolderViewHolder(view); } @Override public void onBindViewHolder(FolderViewHolder holder, int position) { FolderItem folderItem = folderItemList.get(position); holder.setFolderDataToView(folderItem); } @Override public int getItemCount() { return folderItemList.size(); } class FolderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @BindView(R.id.folder_icon) ImageView folderIcon; @BindView(R.id.folder_name) TextView folderName; public FolderViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnClickListener(this); } public void setFolderDataToView(FolderItem item) { folderName.setText(item.getFolderName()); Glide.with(context) .load(item.getFolderIcon()) .placeholder(R.drawable.folder) .error(R.drawable.folder) .centerCrop() .animate(R.anim.slide_up) .into(folderIcon); } @Override public void onClick(View view) { int position = getAdapterPosition(); if (position < 0) return; FolderItem folderItem = folderItemList.get(position); if (clickManager != null) { clickManager.onItemClick(folderItem); } } } }
true
bba8eac61db057dbd1d59dc30bbfb8e3e810f2e8
Java
hustChen/swordtooffer
/src/FindPath.java
UTF-8
942
3.140625
3
[]
no_license
import java.util.ArrayList; /** * Created by chensq on 17-2-9. * 为毛要从跟节点一直到叶子节点,无聊 */ public class FindPath { ArrayList<ArrayList<Integer>> result=new ArrayList<>(); ArrayList<Integer> tmp=new ArrayList<>(); public ArrayList<ArrayList<Integer>> FindPath(TreeNode root, int target) { find(root,target); return result; } private void find(TreeNode node,int target){ if(node==null) return; tmp.add(node.val); if(target-node.val==0&&node.right==null&&node.left==null) result.add(new ArrayList<>(tmp)); find(node.left,target-node.val); find(node.right,target-node.val); tmp.remove(tmp.size()-1); } private class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; } } }
true
f1501e16b948a898896f2be357f7a55a4a3a0b19
Java
bellmit/Advance-1
/realproject/aiwue2/aiwue/src/main/java/com/aiwue/model/FavoriteArticle.java
UTF-8
538
1.992188
2
[ "Apache-2.0" ]
permissive
package com.aiwue.model; /** * Created by 44548 on 2016/5/29. */ public class FavoriteArticle extends Article { private int favoriteId; //收藏id private long favoriteTime; //收藏时间 public int getFavoriteId() { return favoriteId; } public void setFavoriteId(int favoriteId) { this.favoriteId = favoriteId; } public long getFavoriteTime() { return favoriteTime; } public void setFavoriteTime(long favoriteTime) { this.favoriteTime = favoriteTime; } }
true
ea7396473bdb95613722f492a7fc064af2a25a55
Java
susimian/test_security2
/src/main/java/com/simian/test_security2/config/WebSecurityConfig.java
UTF-8
4,704
2.203125
2
[]
no_license
package com.simian.test_security2.config; import com.simian.test_security2.component.AuthenticationAccessDeniedHandler; import com.simian.test_security2.component.CustomAccessDecisionManager; import com.simian.test_security2.component.CustomFilterInvocationSecurityMetadataSource; import com.simian.test_security2.component.SimpleAuthenticationEntryPoint; import com.simian.test_security2.controller.CustomLogoutHandler; import com.simian.test_security2.controller.CustomLogoutSuccessHandler; import com.simian.test_security2.filter.JWTFilter; import com.simian.test_security2.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.ObjectPostProcessor; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired UserService userService; @Autowired AuthenticationAccessDeniedHandler authenticationAccessDeniedHandler; @Autowired JWTFilter jwtAuthenticationFilter; @Autowired CustomLogoutHandler customLogoutHandler; @Autowired CustomLogoutSuccessHandler customLogoutSuccessHandler; @Bean PasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(); } /*@Bean RoleHierarchy roleHierarchy(){ RoleHierarchyImpl roleHierarchy = new RoleHierarchyImpl(); String hierarchy = "ROLE_admin > ROLE_user"; roleHierarchy.setHierarchy(hierarchy); return roleHierarchy; }*/ @Bean CustomFilterInvocationSecurityMetadataSource cfisms(){ return new CustomFilterInvocationSecurityMetadataSource(); } @Bean CustomAccessDecisionManager cadm(){ return new CustomAccessDecisionManager(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userService); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/login.html"); web.ignoring().antMatchers("/register"); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() { @Override public <O extends FilterSecurityInterceptor> O postProcess(O o) { o.setSecurityMetadataSource(cfisms()); o.setAccessDecisionManager(cadm()); return o; } }) .and() // session 生成策略用无状态策略 .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) .formLogin() .loginPage("/login.html") .loginProcessingUrl("/login") .usernameParameter("name") .passwordParameter("password") .successForwardUrl("/login/success") .failureForwardUrl("/login/failure") .permitAll() .and() .logout() .addLogoutHandler(customLogoutHandler).logoutSuccessHandler(customLogoutSuccessHandler) .and() .csrf().disable() .exceptionHandling().accessDeniedHandler(authenticationAccessDeniedHandler) .authenticationEntryPoint(new SimpleAuthenticationEntryPoint()); //以下这句就可以控制单个用户只能创建一个session,也就只能在服务器登录一次 //http.sessionManagement().maximumSessions(1).expiredUrl("/login"); } }
true
e6eb259200512af2bd42ae1899d7165c2686159a
Java
cnywb/ford-mediadata-mgt
/mgt-api/src/main/java/com/ford/mediadata/mgt/entity/im/ImCodeType.java
UTF-8
2,299
2.078125
2
[]
no_license
package com.ford.mediadata.mgt.entity.im; import javax.persistence.*; import com.ford.mediadata.mgt.entity.VersionEntity; /** * 字典大类 * Created by ziv.hung on 15/10/13. * * @since 1.0 */ @Entity @Table(name = "MD_IM_CODE_TYPE") public class ImCodeType extends VersionEntity { /** 物理主键 */ @Id @Column(name = "ID", nullable = false) @GeneratedValue(strategy=GenerationType.SEQUENCE,generator = "SEQ_MD_IM_CODE_TYPE") @SequenceGenerator(name = "SEQ_MD_IM_CODE_TYPE",allocationSize=1,sequenceName = "SEQ_MD_IM_CODE_TYPE") protected Long id; /** * 字典大类代码 */ @Column(name = "CODE") private String code; /** * 类型代码,用来区分各种字典分类 */ @Column(name = "TYPE_CODE") private String typeCode; /** * 中文名称 */ @Column(name = "NAME_CN") private String nameCn; /** * 英文名称 */ @Column(name = "NAME_EN") private String nameEn; /** * 描述 */ @Column(name = "COMMENT_") private String comment; /** * 是允许客户修改 1 可以 0 不可以 */ @Column(name = "ENABLE_") private boolean enable = true; public String getTypeCode() { return typeCode; } public void setTypeCode(String typeCode) { this.typeCode = typeCode; } public String getNameCn() { return nameCn; } public void setNameCn(String nameCn) { this.nameCn = nameCn; } public String getNameEn() { return nameEn; } public void setNameEn(String nameEn) { this.nameEn = nameEn; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public boolean isEnable() { return enable; } public void setEnable(boolean enable) { this.enable = enable; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
true
3e5e637f6511a93617cce59462172c23a2b32c1b
Java
Ypalav/tracker
/api/tracker/src/main/java/io/egen/service/VehicleServiceImpl.java
UTF-8
920
2.25
2
[]
no_license
package io.egen.service; import io.egen.entity.Vehicle; import io.egen.exception.NotFoundException; import io.egen.repository.VehicleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * Created by Yogesh on 6/12/2017. */ @Service public class VehicleServiceImpl implements VehicleService { @Autowired private VehicleRepository vehicleRepository; @Transactional public void upsert(List<Vehicle> vehicleList) { for(Vehicle v:vehicleList) { Vehicle existingVehicle = vehicleRepository.findById(v.getVin()); if (existingVehicle == null) { vehicleRepository.insert(v); } vehicleRepository.update(v); } } }
true
d03efecb80a69fa4e2e7959f74074dfe3dbe9ef4
Java
probasranjan/aoneposapp
/dev-1.0/src/net/authorize/android/SDKActivity.java
UTF-8
6,431
2.015625
2
[]
no_license
package net.authorize.android; import java.util.ArrayList; import java.util.HashMap; import net.authorize.Environment; import net.authorize.android.dialog.Dialog_ShoppingDetails; import net.authorize.util.HttpClient; import net.authorize.util.StringUtils; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.util.Log; import android.util.SparseBooleanArray; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import com.aoneposapp.R; public class SDKActivity extends Activity { private EditText editText_ItemName, editText_Cost; private Button button_Cart, button_Transaction; private ListView listView; private ArrayList<HashMap<String, String>> arrayList_Details; private MultiSelectionAdapter<ArrayList<HashMap<String, String>>> adapter; public static AuthNet authNet; static { HttpClient.HTTP_CONNECTION_TIMEOUT = 0; HttpClient.HTTP_SOCKET_CONNECTION_TIMEOUT = 0; Environment env = Environment.SANDBOX; authNet = AuthNet .getInstance(env, R.layout.authnet_mobile_merchant_auth_dialog, R.id.authnet_loginid_edit, R.id.authnet_password_edit, R.id.authnet_auth_cancel_button, R.id.authnet_auth_login_button); } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadMainPage(); } private void loadMainPage() { setContentView(R.layout.main); editText_ItemName=(EditText)findViewById(R.id.editText_ItemName); editText_Cost=(EditText)findViewById(R.id.editText_Cost); button_Cart=(Button)findViewById(R.id.button_Cart); button_Transaction=(Button)findViewById(R.id.button_Transaction); arrayList_Details=new ArrayList<HashMap<String,String>>(); listView = (ListView) findViewById(R.id.lv_list); // AIM View aimButton = findViewById(R.id.button_Transaction); aimButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Log.e("arrayList_Details",""+arrayList_Details); new Dialog_ShoppingDetails(SDKActivity.this,SDKActivity.this,arrayList_Details); // Intent intent = new Intent(v.getContext(), AIMActivity.class); // startActivity(intent); } }); button_Cart.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { HashMap<String, String> map=new HashMap<String, String>(); map.put("Item",""+editText_ItemName.getText().toString().trim()); map.put("Cost",""+editText_Cost.getText().toString().trim()); arrayList_Details.add(map); adapter = new MultiSelectionAdapter<ArrayList<HashMap<String, String>>>(SDKActivity.this, arrayList_Details); listView.setAdapter(adapter); editText_ItemName.setText(""); editText_Cost.setText(""); } }); // footer addFooter(this, (LinearLayout) findViewById(R.id.MainFooterLayout), -1); } /** * Add a footer to the context with the footerLayout. * * @param context * @param footerLayout * @param subFooterStringId * = will look for the */ public static void addFooter(Context context, LinearLayout footerLayout, int subFooterStringId) { // footer LinearLayout.LayoutParams footerParams = new LinearLayout.LayoutParams( android.widget.LinearLayout.LayoutParams.FILL_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT); footerParams.setMargins(0, 10, 0, 20); Resources resources = context.getResources(); StringBuilder sb = new StringBuilder( resources.getString(R.string.footer_description)); try { String subFooter = resources.getString(subFooterStringId); if (StringUtils.isNotEmpty(subFooter)) { sb.append("\n").append(subFooter); } } catch (Resources.NotFoundException nfe) { ; } TextView authNetFooter = new TextView(context); authNetFooter.setGravity(Gravity.CENTER | Gravity.BOTTOM); authNetFooter.setText(sb.toString()); authNetFooter.setLayoutParams(footerParams); footerLayout.addView(authNetFooter); } public class MultiSelectionAdapter<T> extends BaseAdapter { Context mContext; LayoutInflater mInflater; ArrayList<HashMap<String, String>> mList; SparseBooleanArray mSparseBooleanArray; View convertView; public MultiSelectionAdapter(Context context,ArrayList<HashMap<String, String>> list) { // TODO Auto-generated constructor stub this.mContext = context; mInflater = LayoutInflater.from(mContext); mSparseBooleanArray = new SparseBooleanArray(); mList = new ArrayList<HashMap<String, String>>(); this.mList = list; } public ArrayList<Integer> getCheckedItems() { ArrayList<Integer> mTempArry = new ArrayList<Integer>(); for (int i = 0; i < mList.size(); i++) { if (mSparseBooleanArray.get(i)) mTempArry.add(Integer.parseInt(mList.get(i).get("eid"))); } return mTempArry; } @Override public int getCount() { return mList.size(); } @Override public Object getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } private class ViewHolder { TextView item,cost; } @Override public View getView(final int position, View v,ViewGroup parent) { convertView=v; try { final ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.row_textview, null); holder = new ViewHolder(); holder.item = (TextView) convertView.findViewById(R.id.tv_Item); holder.cost=(TextView)convertView.findViewById(R.id.tv_cost); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.item.setText(""+mList.get(position).get("Item")); holder.cost.setText(""+mList.get(position).get("Cost")); Log.e("Cost",""+mList.get(position).get("Cost")); } catch (Exception e) { e.getMessage(); } return convertView; } } }
true
16d4fc4a75fcf814db4d30777361046acb0db1ef
Java
automateeverything891/RestAssuredBDDConcepts
/src/test/java/serializationANDdeserialization/VideoGameAPISerialization.java
UTF-8
1,015
2.421875
2
[]
no_license
package serializationANDdeserialization; import java.sql.Timestamp; import org.testng.annotations.Test; import io.restassured.http.ContentType; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; public class VideoGameAPISerialization { @Test(priority=1) public void postVideoGameSerializationXML() { VideoGame vg=new VideoGame(); vg.setSID(13); vg.setName("PUBG"); vg.setReleaseDate("2020-03-23"); vg.setRating("Violent"); vg.setReviewScore(5); vg.setCategory("PvP"); given() .contentType("application/xml") // For JSON Response Validation // .contentType("application/json") .body(vg) .when() .post("http://localhost:8080/app/videogames") .then() .log().all() .body(equalTo("{\"status\": \"Record Added Successfully\"}")); } @Test(priority=2) public void getVideoGameSerializationXML() { VideoGame vg=get("http://localhost:8080/app/videogames/13").as(VideoGame.class); System.out.println(vg.getVideoGameDetails()); } }
true
6a833fd42ee715aa2671b05339c2ed584a45c3b1
Java
CraigP17/GameBoi-CSC207
/phase2/app/src/main/java/com/example/gameboi/BonusSpinner/SpinnerCalc.java
UTF-8
1,922
3.640625
4
[]
no_license
package com.example.gameboi.BonusSpinner; /** * This class is responsible for calculating where the wheel landed and the User's multiplier */ class SpinnerCalc { /** * This is a string of the sections of the spinning wheel, representing the multiplier that the * User gets * It follows the order of the wheel, @drawable/spinningwheel.png */ private final int[] SECTIONS = {1, 3, 1, 2}; /** * Gets the User;s new multiplier after spinning the bonus wheel * degree is * * @param multiplier The User's multiplier before getting the bonus multiplier * @param degree The degree of the wheel of where it landed * @return the User's new multiplier including the bonus */ int getNewMultiplier(int multiplier, int degree) { return multiplier * getWheelSection(360 - (degree % 360)); } /** * Calculates the multiplier that the User gets after spinning the wheel, by taking the degree * of where it landed on and giving which section 1, 2, 3x of what the User gets * * @param degrees The degree of the wheel that the spinner landed on * @return The multiplier String of which section of the wheel it is on */ private int getWheelSection(int degrees) { //Divide the 360 degree wheel into angles for each sector on the Spinner float halfSector = 360f / 4f; int i = 0; int multiplyNum = 0; do { // Get the angles of each section of the spinner wheel float start = halfSector * (i); float end = halfSector * (i + 1); // if degrees is in this section of the wheel, set text to that section if (degrees >= start && degrees < end) { multiplyNum = SECTIONS[i]; } i++; } while (multiplyNum == 0 && i < SECTIONS.length); return multiplyNum; } }
true
57febf82b4d99e0a4c375b79672438e5e0eb44e1
Java
caadi0/leetcode
/155. Min Stack.java
UTF-8
1,121
3.59375
4
[]
no_license
public class MinStack { Stack<Integer> stack = new Stack<Integer>(); Stack<Integer> minStack = new Stack<Integer>(); /** initialize your data structure here. */ public MinStack() { } public void push(int x) { stack.push(x); if(minStack.empty()) { minStack.push(x); } else { int min = minStack.pop(); if(min >= x) { minStack.push(min); minStack.push(x); } else { minStack.push(min); } } } public void pop() { int pop = stack.pop(); if(pop == getMin()) { minStack.pop(); } } public int top() { int top = stack.pop(); stack.push(top); return top; } public int getMin() { int top = minStack.pop(); minStack.push(top); return top; } } /** * Your MinStack object will be instantiated and called as such: * MinStack obj = new MinStack(); * obj.push(x); * obj.pop(); * int param_3 = obj.top(); * int param_4 = obj.getMin(); */
true
85ee4f639202d048b151a3befddbaccb2307b6a3
Java
msasanksai/EVOLVFIT-Backend
/API/src/main/java/com/backend/API/repository/commentRepo.java
UTF-8
424
1.789063
2
[]
no_license
package com.backend.API.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.backend.API.entity.Comments; @Repository public interface commentRepo extends JpaRepository<Comments, Integer> { public List<Comments> findByPostId(int postid); }
true
e7bee93d48e646caf38ac086a9d0e3a8b22b0eb8
Java
gzsltt/JavaProjects
/RoutingProtocal/src/f/DJThread.java
UTF-8
489
2.375
2
[]
no_license
package f; public class DJThread implements Runnable{ public void run() { while(true) { try { Thread.sleep(5000); Shortest s=new Shortest(); Route route=new Route(); int start=route.node_port-2000; // for(int i=0;i<6;i++) // { // for(int j=0;j<6;j++) // { // System.out.print(Route.graph[i][j]); // } // System.out.println(); // } s.Dijkstra(start); Thread.sleep(Route.shortOutputTime); } catch(Exception e) { e.printStackTrace(); } }} }
true
7e9b1a7d201836b27d598dbefcf6dc1947b7cc80
Java
imzwz/pyalg
/codejam/three1.java
UTF-8
1,125
3.21875
3
[]
no_license
import java.io.*; public class three1{ static String infile = "in.txt"; static String outfile = "out.txt"; public static void fun() throws IOException{ BufferedReader in = new BufferedReader(new FileReader(infile)); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outfile,false))); int line = Integer.parseInt(in.readLine()); for(int i=1;i<=line;i++){ String[] parts = in.readLine().split(" "); int r = Integer.parseInt(parts[0]); int c = Integer.parseInt(parts[1]); int w = Integer.parseInt(parts[2]); int n=0; /*for(int j=1;j<=d;j++){ if(sum<j){ sum++; n++; } sum=sum+parts[1].charAt(j)-'0'; }*/ n = ((c/w)+w-1)*r; out.printf("Case #%d: %d",i,n); out.println(); out.flush(); } in.close(); out.close(); } public static void main(String[] args)throws IOException{ fun(); } }
true
0167b6161bf2557559842dd201590f0d1033776b
Java
baopengjian/Ray_DailyWork
/app/src/main/java/com/example/baopengjian/ray_dailywork/nineth/TextNumberPicker.java
UTF-8
2,062
2.390625
2
[]
no_license
package com.example.baopengjian.ray_dailywork.nineth; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.NumberPicker; import com.example.baopengjian.ray_dailywork.util.UtilsDensity; import java.lang.reflect.Field; /** * Created by Ray on 2019-11-21. */ public class TextNumberPicker extends NumberPicker { public TextNumberPicker(Context context) { super(context); } public TextNumberPicker(Context context, AttributeSet attrs) { super(context, attrs); } public TextNumberPicker(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public void addView(View child, int index, ViewGroup.LayoutParams params) { super.addView(child, index, params); updateView(child); } private void updateView(View child) { if (child instanceof EditText) { ((EditText) child).setTextSize(24); } } public static void setDividerColor(NumberPicker picker, ColorDrawable color) { Field field = null; try { field = NumberPicker.class.getDeclaredField("mSelectionDivider"); if (field != null) { field.setAccessible(true); field.set(picker, color); } } catch (Exception e) { e.printStackTrace(); } } public static void setDividerHeight(NumberPicker picker, int h) { Field[] fields = NumberPicker.class.getDeclaredFields(); for (Field field : fields) { if (field.getName().equals("mSelectionDividerHeight")) { field.setAccessible(true); try { field.set(picker, h); } catch (IllegalAccessException e) { e.printStackTrace(); } break; } } } }
true
5481728ac83722a4e139e8ce2cab8170e111a0b4
Java
michellegardner77/MockTwitter
/app/src/main/java/com/mgard/mock_twitter/models/Post.java
UTF-8
776
2.453125
2
[]
no_license
package com.mgard.mock_twitter.models; import java.util.Date; /** * Created by mgard on 3/5/2017. */ public class Post { private String postText; private String submitter; private Date submitDate; public Post (String postText, String submitter, Date submitDate){ this.postText = postText; this.submitter = submitter; this.submitDate = submitDate; } public Post (String postText, String submitter){ this.postText = postText; this.submitter = submitter; this.submitDate = new Date(); } public String getPostText() { return postText; } public String getSubmitter() { return submitter; } public Date getSubmitDate() { return submitDate; } }
true
32e7ee453b036ee45df83021f84322c7a0c35308
Java
lihanxiang1/TaoBao
/app/src/main/java/com/bwie/lonely/taobao/home/Fragment_HomePage.java
UTF-8
4,342
1.84375
2
[]
no_license
package com.bwie.lonely.taobao.home; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageView; import com.bwie.lonely.taobao.R; import com.bwie.lonely.taobao.home.adapter.MyHomeXrAdapter; import com.bwie.lonely.taobao.home.bean.HomeBean; import com.bwie.lonely.taobao.home.presenter.HomePresenter; import com.bwie.lonely.taobao.home.sousuo.SearchGoodsPage; import com.bwie.lonely.taobao.home.view.IHomeView; import com.bwie.lonely.taobao.other.ToastUtil; import com.jcodecraeer.xrecyclerview.XRecyclerView; import com.xys.libzxing.zxing.activity.CaptureActivity; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.Unbinder; import static android.app.Activity.RESULT_OK; /** * Created by Lonely on 2017/12/6. */ public class Fragment_HomePage extends Fragment implements IHomeView { Unbinder unbinder; HomePresenter presenter; MyHomeXrAdapter adapter; @BindView(R.id.title_zxing) ImageView titleZxing; @BindView(R.id.title_edit) EditText titleEdit; @BindView(R.id.title_search_img) ImageView titleSearchImg; @BindView(R.id.title_user_content) ImageView titleUserContent; @BindView(R.id.home_xrecyclerview) XRecyclerView homeXrecyclerview; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.home, null); // homeXrecyclerview = view.findViewById(R.id.home_xrecyclerview); unbinder = ButterKnife.bind(this, view); initView(); return view; } private void initView() { presenter = new HomePresenter(this); presenter.getData(); homeXrecyclerview.setLayoutManager(new LinearLayoutManager(getActivity())); titleEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getActivity(), SearchGoodsPage.class)); } }); } @Override public void ShowHomeData(HomeBean homeBean) { homeXrecyclerview.setAdapter(adapter = new MyHomeXrAdapter(homeBean, getActivity())); // 上拉刷新和下拉刷新的监听事件 homeXrecyclerview.setPullRefreshEnabled(true); homeXrecyclerview.setLoadingMoreEnabled(true); homeXrecyclerview.setLoadingListener(new XRecyclerView.LoadingListener() { @Override public void onRefresh() { // 下拉刷新 homeXrecyclerview.refreshComplete(); } @Override public void onLoadMore() { // 上拉加载 homeXrecyclerview.loadMoreComplete(); } }); } @Override public void onDestroyView() { super.onDestroyView(); unbinder.unbind(); } @OnClick({R.id.title_zxing, R.id.title_search_img, R.id.title_user_content}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.title_zxing: // 二维码 startActivityForResult(new Intent(getActivity(), CaptureActivity.class), 0); break; case R.id.title_search_img: // 跳转到搜索页面 ToastUtil.show(getActivity(), "跳转到搜索页面(未完善)", 2000); break; case R.id.title_user_content: // 消息列表 ToastUtil.show(getActivity(), "消息列表(未完善)", 2000); break; } } // 二维码回调处理 @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { String result = data.getExtras().getString("result"); ToastUtil.show(getActivity(), "扫描结果:" + result, 2000); } } }
true
35fbb35d579d2050b176e50373bdbb2defee31e1
Java
mayankmikin/nodemcu_rest
/src/main/java/com/whitehall/esp/microservices/services/PlanService.java
UTF-8
1,102
2.171875
2
[]
no_license
package com.whitehall.esp.microservices.services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.whitehall.esp.microservices.model.Plan; import com.whitehall.esp.microservices.repositories.PlanRepository; import lombok.extern.slf4j.Slf4j; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @Service @Slf4j public class PlanService { @Autowired PlanRepository repository; public Mono<Plan> findPlanByID(String id){ return repository.findByPlanId(id); } public Flux<Plan> getAllPlan(){ return repository.findAll(); } public Mono<Plan> addPlan(Plan p){ return repository.save(p); } public Flux<Plan> addMultiplePlan(Iterable<Plan> p){ return repository.saveAll(p); } public void deletePlan(Plan p){ repository.delete(p); } public void deleteMultiplePlan(Iterable<Plan> p){ repository.deleteAll(p); } public Mono<Plan> updatePlan(Plan p){ return repository.save(p); } public Flux<Plan> updateMultiplePlan(Iterable<Plan> p){ return repository.saveAll(p); } }
true
38749d0d951bd78f68eb6e32df13f780229cbcf3
Java
antest1/KcaSampleClient
/app/src/main/java/com/antest1/kcasampleclient/MainActivity.java
UTF-8
4,506
2.125
2
[ "Apache-2.0" ]
permissive
package com.antest1.kcasampleclient; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.ButtonBarLayout; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.widget.Button; import android.widget.CompoundButton; import android.widget.TextView; import android.widget.Toast; import android.widget.ToggleButton; import com.google.gson.JsonObject; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.Locale; import static com.antest1.kcasampleclient.KcaConstants.CONTENT_URI; import static com.antest1.kcasampleclient.KcaUtils.getKcIntent; public class MainActivity extends AppCompatActivity { ToggleButton btn_receiver; Button btn_launch; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ((TextView) findViewById(R.id.content_response)).setMovementMethod(new ScrollingMovementMethod()); btn_receiver = (ToggleButton) findViewById(R.id.btn_receiver); btn_receiver.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { Intent service_intent = new Intent(getApplicationContext(), KcaClientService.class); if (b) { startService(service_intent); } else { stopService(service_intent); } } }); btn_launch = (Button) findViewById(R.id.btn_launch); btn_launch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent kcIntent = getKcIntent(getApplicationContext()); if (kcIntent != null) { startActivity(kcIntent); } else { Toast.makeText(getApplicationContext(), "Kancolle not installed", Toast.LENGTH_LONG).show(); } } }); } @Override protected void onStart() { super.onStart(); setContext(); } public void setContext() { JsonObject data = new JsonObject(); Cursor cursor = getContentResolver().query(CONTENT_URI, null, null, null, null, null); if(cursor != null) { // Toast.makeText(getApplicationContext(), String.format(Locale.US, "%d %d", cursor.getColumnCount(), cursor.getCount()), Toast.LENGTH_LONG).show(); if (cursor.moveToFirst()) { // Convert to JsonObject data data.addProperty("url", cursor.getString(cursor.getColumnIndex("URL"))); data.addProperty("request", cursor.getString(cursor.getColumnIndex("REQUEST"))); data.addProperty("response", cursor.getString(cursor.getColumnIndex("RESPONSE"))); data.addProperty("timestamp", cursor.getLong(cursor.getColumnIndex("TIMESTAMP"))); // Display ((TextView) findViewById(R.id.content_ts)).setText(data.get("timestamp").getAsString()); ((TextView) findViewById(R.id.content_url)).setText(data.get("url").getAsString()); String request = data.get("request").getAsString(); try { request = URLDecoder.decode(request, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } ((TextView) findViewById(R.id.content_request)).setText(request); String response = data.get("response").getAsString(); ((TextView) findViewById(R.id.label_response)).setText(String.format(Locale.US, "Response (%d)", response.length())); ((TextView) findViewById(R.id.content_response)).setText(response); } cursor.close(); } else { ((TextView) findViewById(R.id.content_ts)).setText(""); ((TextView) findViewById(R.id.content_url)).setText("No Data"); ((TextView) findViewById(R.id.content_request)).setText(""); ((TextView) findViewById(R.id.label_response)).setText("Response"); ((TextView) findViewById(R.id.content_response)).setText(""); } } }
true
2967e11b6d0db38f5c94932929fb17e2d772db64
Java
Quantium-Nonsense/ProjectOmega
/Backend/src/main/java/com/project/omega/helper/TestingConstant.java
UTF-8
337
1.554688
2
[]
no_license
package com.project.omega.helper; public interface TestingConstant { public static final Long TEST_ID_1 = 1L; public static final Long TEST_ID_2 = 2L; public static final String TEST_EMAIL_1 = "a@a.com"; public static final String TEST_EMAIL_2 = "b@b.com"; public static final String TEST_PASSWORD = "password"; }
true
b1cd301b444881b137b6dcc08bc97262eea9d1b8
Java
mansar3/PolicyCenter
/src/main/java/pageobjects/FLMH3/FLMH3Qualification.java
UTF-8
1,539
2.28125
2
[]
no_license
package pageobjects.FLMH3; import Helpers.CenterSeleniumHelper; import pageobjects.WizardPanelBase.Qualification; /** * Created by ssai on 3/3/2017. */ public class FLMH3Qualification extends Qualification<FLMH3Qualification> { public FLMH3Questionnaire questionnaire = new FLMH3Questionnaire(sh); public FLMH3Qualification(CenterSeleniumHelper sh, Path path) { super(sh, path); } public FLMH3PolicyInfo next() { super.policyInfoNext(); return new FLMH3PolicyInfo(sh, path); } public FLMH3Qualification setOfferingSelection(String text) { return super.setOfferingSelection(text); } public String getOfferingSelection() { return super.getOfferingSelection(); } public FLMH3Qualification setPolicyType(String text) { return super.setPolicyType(text); } public String getPolicyType() { return super.getPolicyType(); } public class FLMH3Questionnaire extends Questionnaire<FLMH3Questionnaire> { public FLMH3Questionnaire(CenterSeleniumHelper sh) { super(sh); } public String getQuestionText(int questionNum) { return super.getQuestionText(questionNum); } public FLMH3Questionnaire answerYes(int questionNum) { return super.answerYes(questionNum); } public FLMH3Questionnaire answerNo(int questionNum) { return super.answerNo(questionNum); } } }
true
8b68f39396488aa34238a36ac574f858b6cb1668
Java
Gopinathks7/CONT
/src/test/java/CONT/CONT/MyReport.java
UTF-8
1,018
1.984375
2
[]
no_license
package CONT.CONT; import java.lang.reflect.Method; import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; public class MyReport { ExtentReports eRports; ExtentTest eTest; @BeforeSuite public void setExtent() { eRports = new ExtentReports(".//target/ExtenetReport"+".html"); } @AfterSuite public void closingReport() { eRports.flush(); } @BeforeMethod public void getMethodsName(Method method) { eTest=eRports.startTest(method.getName()); } @AfterMethod public void getFailedMethod(ITestResult result) { if(result.getStatus()==ITestResult.FAILURE) { eTest.log(LogStatus.FAIL,"Method is Failed"); } else { eTest.log(LogStatus.PASS,"Mehod is passed"); } eRports.endTest(eTest); } }
true
605511df285de17ec8e7ad4dd4bd68683fc9ff59
Java
anankitpatil/Unlaze
/app/src/main/java/com/unlazeapp/unlaze/ConnectionFragment.java
UTF-8
12,331
2.09375
2
[]
no_license
package com.unlazeapp.unlaze; import android.content.Intent; import android.location.Location; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; import com.unlazeapp.R; import com.unlazeapp.utils.ApiService; import com.unlazeapp.utils.ApiServiceListener; import com.unlazeapp.utils.ApiServiceListenerP; import com.unlazeapp.utils.GlobalVars; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; /** * Created by AP on 15/07/15. */ public class ConnectionFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { private static final String KEY_TITLE = "Conversations"; ImageLoader imageLoader = ImageLoader.getInstance(); SwipeRefreshLayout swipeLayout; public ConnectionFragment() { // Required empty public constructor } public static ConnectionFragment newInstance(String title) { ConnectionFragment f = new ConnectionFragment(); Bundle args = new Bundle(); args.putString(KEY_TITLE, title); f.setArguments(args); return (f); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.fragment_connections, container, false); // pull to refresh swipeLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_container); swipeLayout.setOnRefreshListener(this); // get requests connectionFetch(v); return v; } public void connectionFetch (final View v) { try { ApiService call = ApiService.getInstance(); call.getConnect(GlobalVars.getInstance().userDetail.getString("id"), new ApiServiceListenerP() { @Override public void onSuccess(JSONArray result) { // clear final TableLayout tl = (TableLayout) v.findViewById(R.id.connection_results); tl.removeAllViews(); // make requests global GlobalVars.getInstance().userConnect = result; if (GlobalVars.getInstance().userConnect.length() > 0) { for (int k = 0; k < GlobalVars.getInstance().userConnect.length(); k++) { try { if (GlobalVars.getInstance().userConnect.getJSONObject(k).getBoolean("valid")) { ApiService call = ApiService.getInstance(); call.getDetail(GlobalVars.getInstance().userConnect.getJSONObject(k).getString("_with"), new ApiServiceListener() { @Override public void onSuccess(final JSONObject result) { // Create search results view final LayoutInflater inflater = getActivity().getLayoutInflater(); final TableRow row = (TableRow) inflater.inflate(R.layout.item_search, null, true); final ImageView face = (ImageView) row.findViewById(R.id.icon); final TextView firstLine = (TextView) row.findViewById(R.id.firstLine); final TextView secondLine = (TextView) row.findViewById(R.id.secondLine); final ImageView icon = (ImageView) row.findViewById(R.id.activity_icon); try { // Calculate age final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); final String dateInString = result.getString("birth"); Calendar dob = Calendar.getInstance(); try { dob.setTime(formatter.parse(dateInString)); } catch (ParseException e) { e.printStackTrace(); } Calendar today = Calendar.getInstance(); int age = today.get(Calendar.YEAR) - dob.get(Calendar.YEAR); if (today.get(Calendar.MONTH) < dob.get(Calendar.MONTH)) { age--; } else if (today.get(Calendar.MONTH) == dob.get(Calendar.MONTH) && today.get(Calendar.DAY_OF_MONTH) < dob.get(Calendar.DAY_OF_MONTH)) { age--; } try { firstLine.setText(result.getString("name") + ", " + age); } catch (JSONException e) { e.printStackTrace(); } // Get distance float results[] = new float[2]; Location.distanceBetween( GlobalVars.getInstance().latitude, GlobalVars.getInstance().longitude, result.getJSONObject("coords").getJSONArray("coordinates").getDouble(1), result.getJSONObject("coords").getJSONArray("coordinates").getDouble(0), results); if (result.has("city")) { secondLine.setText(result.getString("city") + ", " + roundOff(results[0] * 0.001) + " km away"); } else { secondLine.setText("Unknown, " + roundOff(results[0] * 0.001) + " km away"); } ApiService call = ApiService.getInstance(); call.getActivity(result.getString("id"), new ApiServiceListenerP() { @Override public void onSuccess(JSONArray result) { // set activity icon if (result.length() > 0) { for (int k = 0; k < result.length(); k++) { try { if (result.getJSONObject(k).getBoolean("valid")) { for (int j = 0; j < GlobalVars.getInstance().activityList.length; j++) { if (result.getJSONObject(k).getString("_type").equals(GlobalVars.getInstance().activityList[j])) { icon.setImageResource(GlobalVars.getInstance().activityRIcons[j]); } } } } catch (JSONException e) { e.printStackTrace(); } } } } @Override public void onFailure() { } }); // profile pic final DisplayImageOptions options; options = new DisplayImageOptions.Builder() .displayer(new FadeInBitmapDisplayer(600)) .cacheInMemory(true) .cacheOnDisk(true) .build(); imageLoader.displayImage("https://graph.facebook.com/" + result.getString("id") + "/picture?type=normal", face, options); } catch (JSONException e) { e.printStackTrace(); } // Add click listener on item; row.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Show person detail GlobalVars.getInstance().personDetail = result; // Start personView Intent i = new Intent(getActivity(), ChatActivity.class); startActivityForResult(i, 0); } }); tl.addView(row); } @Override public void onFailure() { } }); } } catch (JSONException e) { e.printStackTrace(); } } } else { // show no notifications message } swipeLayout.setRefreshing(false); } @Override public void onFailure() { } }); } catch (JSONException e) { e.printStackTrace(); } } double roundOff(double d) { DecimalFormat twoDForm = new DecimalFormat("#.#"); return Double.valueOf(twoDForm.format(d)); } @Override public void onRefresh() { // refresh user and populate connections connectionFetch(getView()); } }
true
8eeb3b991fddd38809c2afcdc6c3686d1f4c9f3b
Java
combineads/plugin-presto-phoenix
/src/test/java/com/facebook/presto/plugin/phoenix/TestingPhoenixServer.java
UTF-8
3,406
1.9375
2
[]
no_license
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.presto.plugin.phoenix; import com.facebook.presto.spi.PrestoException; import io.airlift.log.Logger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MiniHBaseCluster; import java.io.Closeable; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import static com.facebook.presto.spi.StandardErrorCode.SERVER_SHUTTING_DOWN; import static java.lang.String.format; public final class TestingPhoenixServer implements Closeable { private static final Logger LOG = Logger.get(TestingPhoenixServer.class); private HBaseTestingUtility hbaseTestingUtility; private int port; private final Configuration conf = HBaseConfiguration.create(); public TestingPhoenixServer() { this.conf.setInt(HConstants.MASTER_INFO_PORT, -1); this.conf.setInt(HConstants.REGIONSERVER_INFO_PORT, -1); this.conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); this.conf.set("hbase.regionserver.wal.codec", "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec"); this.conf.setBoolean("phoenix.schema.isNamespaceMappingEnabled", true); this.hbaseTestingUtility = new HBaseTestingUtility(conf); try { this.port = randomPort(); this.hbaseTestingUtility.startMiniZKCluster(1, port); MiniHBaseCluster hbm = hbaseTestingUtility.startMiniHBaseCluster(1, 4); hbm.waitForActiveAndReadyMaster(); LOG.info("Phoenix server ready: %s", getJdbcUrl()); } catch (Exception e) { throw new IllegalStateException("Can't start phoenix server.", e); } Runtime.getRuntime().addShutdownHook(new Thread(() -> { close(); })); } public void close() { if (hbaseTestingUtility != null) { try { LOG.info("Shutting down HBase cluster."); hbaseTestingUtility.shutdownMiniHBaseCluster(); hbaseTestingUtility.shutdownMiniZKCluster(); } catch (IOException e) { Thread.currentThread().interrupt(); throw new PrestoException(SERVER_SHUTTING_DOWN, "Failed to shutdown HTU instance", e); } hbaseTestingUtility = null; } } private static int randomPort() throws IOException { try (ServerSocket socket = new ServerSocket()) { socket.bind(new InetSocketAddress(0)); return socket.getLocalPort(); } } public String getJdbcUrl() { return format("jdbc:phoenix:localhost:%d:/hbase", port); } }
true
74f762c20aa32d8fd33b5ebdf4e30a02a073a2b9
Java
i3oys1205/ShoppingProject
/Shopping/src/main/java/com/shopping/method/FileSelect.java
UTF-8
2,438
2.8125
3
[]
no_license
package com.shopping.method; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; public class FileSelect { public StringBuffer fileRead(String html , String template , HttpServletRequest request) { StringBuffer buffer = new StringBuffer(); String path = null; if(template.equals("builder")){ path = request.getServletContext().getRealPath("/")+"builder/editor/"+html+".html"; }else{ path = request.getServletContext().getRealPath("/")+"builder/view/"+html+".html"; } File file = new File(path); boolean isExists = file.exists(); if (isExists) { char[] ch = new char[(int) file.length()]; try { BufferedReader br = new BufferedReader(new FileReader(file)); br.read(ch); buffer.append(ch); br.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { System.out.println("No exists File"); } return buffer; } public StringBuffer fileWrite(String html , String template , HttpServletRequest request ,String contents){ StringBuffer stat = new StringBuffer(); String path = null; if(template.equals("builder")){ path = request.getServletContext().getRealPath("/")+"builder/editor/"+html+".html"; }else{ path = request.getServletContext().getRealPath("/")+"builder/view/"+html+".html"; } try{ BufferedWriter fw = new BufferedWriter(new FileWriter(path, false)); fw.write(contents.toString()); fw.flush(); fw.close(); stat.append("200"); }catch(Exception e){ e.printStackTrace(); stat.append("400"); } return stat; } public StringBuffer fileApply(String html , String template , HttpServletRequest request ,String contents){ StringBuffer stat = new StringBuffer(); String path = null; path = request.getServletContext().getRealPath("/")+"builder/view/"+html+".html"; try{ BufferedWriter fw = new BufferedWriter(new FileWriter(path, false)); fw.write(contents.toString()); fw.flush(); fw.close(); stat.append("200"); }catch(Exception e){ e.printStackTrace(); stat.append("400"); } return stat; } }
true
bdf0136983ab7f5b70bf4f0949bef4dd315a66b8
Java
dangarmol/java-games
/Game of Life (2015)/Workspace Practica 2/Juego Vida/src/juegoVida/Controlador.java
WINDOWS-1250
1,405
3.28125
3
[ "MIT" ]
permissive
package juegoVida; import java.util.Scanner; import comandos.Comando; import comandos.ParserComandos; public class Controlador{ private Mundo mundo; private Scanner in; public Controlador(Mundo mundo, Scanner in) { this.mundo = mundo; this.in = in; } /** * Realiza la simulacion, para ello lee por pantalla lo que escribe el usuario y ejecita el programa */ public void realizaSimulacion() { do { System.out.println(mundo.toString()); System.out.println("Elija un comando: "); // solicitud del comando System.out.println("Comando > "); String opcion = in.nextLine(); opcion = opcion.toUpperCase(); String[] words = opcion.split(" "); Comando comando = ParserComandos.parseaComandos(words); //busca el comando comparandolo if (comando != null) { comando.ejecuta(this.mundo); //si lo encuentra, lo ejecuta } else System.out.println("Comando incorrecto"); GuiaEjecucion.textoAyuda(); //muestra codigos de mensaje que no afecten a evoluciona GuiaEjecucion.pasosDados(); //muestra codigos de mensajes que tengan que ver con los movimientos de las celulas } while (!mundo.esSimulacionTerminada()); //en casod e que el usuario esciba el comando SALIR, se termina la ejecucin } }
true
88a5a61038086c272fccbe9602064c430bacf8b3
Java
harman-ryanchen/training_ryanproject
/WeiXinDemo/app/src/main/java/com/example/ryan/weixindemo/fragment/ExtraBaseFragment.java
UTF-8
1,197
1.992188
2
[]
no_license
package com.example.ryan.weixindemo.fragment; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.ryan.weixindemo.fragment.tabfragment.BaseFragment; import com.example.ryan.weixindemo.util.LogUtil; /** * Created by studio02 on 1/26/16. */ public abstract class ExtraBaseFragment extends BaseFragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { LogUtil.d("test_tool_bar"); initToolBar(); return super.onCreateView(inflater, container, savedInstanceState); } @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); LogUtil.d("test_tool_bar"); LogUtil.l(hidden); if (!hidden){ initToolBar(); onShow(); }else{ onHide(); } } public abstract void initToolBar(); public abstract void onShow(); public abstract void onHide(); }
true
b390ba524163b32f9e0aeba8fe6bc27fde941a04
Java
wheejuni/stock-crawler
/src/main/java/com/example/demo/support/domain/ScheduledTasks.java
UTF-8
1,322
2.359375
2
[ "MIT" ]
permissive
package com.example.demo.support.domain; import com.example.demo.service.StockService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; import java.util.Date; @Component public class ScheduledTasks { private static final Logger logger = LoggerFactory.getLogger(ScheduledTasks.class); private static final SimpleDateFormat dateformat = new SimpleDateFormat("HH:mm:ss"); @Autowired private StockService stockService; @Scheduled(cron = "0 * 9-23 * * MON-FRI") public void getAllStock() throws Exception { logger.info("평일 9시-16시까지 1분마다 자동업데이트"); stockService.getAllStock(); } @Scheduled(cron = "1 * 16 * * MON-FRI") public void detailWholeUpdate() throws Exception { logger.info("평일 16:01, 장 종료 후 전체 업데이트 진행"); stockService.detailWholeUpdate(); } @Scheduled(cron = "0 0 0 * * SAT,SUN") public void getWeekUpdate() throws Exception { logger.info("토, 일 0시0분0초에 전체 주식정보 업데이트"); stockService.detailWholeUpdate(); } }
true
5557ab321d90d605d3e3fe98cc9cf3e3afa16a61
Java
AddAd-Team/AddAd-Android
/app/src/main/java/com/add/ad/presentation/ui/fragment/main/mypage/etc/myad/MyAdFragment.java
UTF-8
2,422
1.804688
2
[]
no_license
package com.add.ad.presentation.ui.fragment.main.mypage.etc.myad; import android.os.Bundle; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModelStoreOwner; import androidx.recyclerview.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.add.ad.R; import com.add.ad.databinding.FragmentMyAdBinding; import com.add.ad.presentation.adapter.MyAdAdapter; import com.add.ad.presentation.base.BaseFragment; import com.add.ad.presentation.ui.dialog.SelectDialogFragment; import com.add.ad.presentation.viewModel.mypage.myad.MyAdViewModel; import dagger.hilt.android.AndroidEntryPoint; @AndroidEntryPoint public class MyAdFragment extends BaseFragment<FragmentMyAdBinding, MyAdViewModel> { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setLayout(R.layout.fragment_my_ad); View v = super.onCreateView(inflater, container, savedInstanceState); viewModel.getMyAdList(); viewModel.myAdResult = new MutableLiveData<>(true); return v; } @Override protected Class<MyAdViewModel> getViewModelClass() { return MyAdViewModel.class; } @Override protected ViewModelStoreOwner getVmOwner() { return requireActivity(); } @Override protected void observeEvent() { viewModel.creatorAdEvent.observe(this, mVoid -> { binding.myAdApplyRecyclerView.setAdapter(new MyAdAdapter(viewModel.creatorAdList.getValue(), viewModel)); binding.myAdApplyRecyclerView.setLayoutManager(new LinearLayoutManager(this.getContext())); }); viewModel.advertiserAdEvent.observe(this, mVoid -> { binding.myAdUploadRecyclerView.setAdapter(new MyAdAdapter(viewModel.advertiserAdList.getValue(), viewModel)); binding.myAdUploadRecyclerView.setLayoutManager(new LinearLayoutManager(this.getContext())); }); viewModel.clickSelectEvent.observe(this, mVoid -> { SelectDialogFragment selectDialogFragment = new SelectDialogFragment(); selectDialogFragment.show(requireActivity().getSupportFragmentManager(), "SelectDialogFragment"); }); viewModel.stopProgressEvent.observe(this, mVoid -> { binding.myAdProgressBar.setVisibility(View.GONE); }); } }
true
5c6db12ddf6b8109ed7d37fc8f755fb942d4b161
Java
ameyapatil1986/mongo
/src/Arrays/RelativeRanks.java
UTF-8
1,225
3.59375
4
[]
no_license
package Arrays; import java.util.*; /** * https://leetcode.com/problems/relative-ranks/ * * Input: [5, 4, 3, 2, 1] * Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"] * Explanation: The first three athletes got the top three highest scores, * so they got "Gold Medal", "Silver Medal" and "Bronze Medal". * For the left two athletes, you just need to output their relative ranks according to their scores. */ public class RelativeRanks { public String[] findRelativeRanks(int[] nums) { int[] c_nums = nums.clone(); Arrays.sort(c_nums); // highest number i.e. last item in list has higest rank Map<Integer, Integer> ranks = new HashMap<>(); int rank = 1; for(int i = c_nums.length - 1; i >= 0; i--){ ranks.put(c_nums[i], rank++); } String[] medals = {"Gold Medal", "Silver Medal", "Bronze Medal"}; String[] ans = new String[nums.length]; for(int i = 0; i < nums.length; i++){ int num = nums[i]; int r = ranks.get(num); if (r <= 3){ ans[i] = medals[r-1]; }else{ ans[i] = r + ""; } } return ans; } }
true
514d9efa02810416994c56640b9aaf56d429e836
Java
Beedraz/recovered-from-google-code
/semantics/src/test/java/org/beedraz/semantics_II/expression/TestAbstractEditableExpressionBeed.java
UTF-8
2,928
1.984375
2
[ "Apache-2.0" ]
permissive
/*<license> Copyright 2007 - $Date$ by the authors mentioned below. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. </license>*/ package org.beedraz.semantics_II.expression; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.ppwcode.metainfo_I.License.Type.APACHE_V2; import org.beedraz.semantics_II.StubEvent; import org.beedraz.semantics_II.StubListener; import org.beedraz.semantics_II.aggregate.AggregateBeed; import org.beedraz.semantics_II.aggregate.AggregateEvent; import org.beedraz.semantics_II.bean.StubBeanBeed; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.ppwcode.metainfo_I.Copyright; import org.ppwcode.metainfo_I.License; import org.ppwcode.metainfo_I.vcs.SvnInfo; @Copyright("2007 - $Date$, Beedraz authors") @License(APACHE_V2) @SvnInfo(revision = "$Revision$", date = "$Date$") public class TestAbstractEditableExpressionBeed { @Before public void setUp() throws Exception { // NOP } @After public void tearDown() throws Exception { // NOP } private AggregateBeed $owner = new StubBeanBeed(); private StubEditableExpressionBeed $editableBeed = new StubEditableExpressionBeed($owner); private StubEvent $event1 = new StubEvent($editableBeed); private StubListener<AggregateEvent> $listener1 = new StubListener<AggregateEvent>(); private StubListener<AggregateEvent> $listener2 = new StubListener<AggregateEvent>(); @Test public void constructor() { assertTrue($owner.isAggregateElement($editableBeed)); // the abstract property beed should be registered with the owner: // add listeners to the property beed $owner.addListener($listener1); $owner.addListener($listener2); assertNull($listener1.$event); assertNull($listener2.$event); // fire a change on the registered beed $editableBeed.publicTopologicalUpdateStart($event1); // listeners of the aggregate beed should be notified assertNotNull($listener1.$event); assertNotNull($listener2.$event); assertEquals(1, $listener1.$event.getComponentEvents().size()); assertEquals(1, $listener2.$event.getComponentEvents().size()); assertTrue($listener1.$event.getComponentEvents().contains($event1)); assertTrue($listener2.$event.getComponentEvents().contains($event1)); } }
true
f2d237cbd32c9a9da802f80bec217fded83eb2dd
Java
furkatkhalilov/mentoringHours
/src/day27/Task5.java
UTF-8
549
3.375
3
[]
no_license
package day27; public class Task5 { // You are given a double array named customer. Each inner array represents the payments, that customer made. // Create a method, which will return the maximum payments of the richest customer. public static void main(String[] args) { String [][] customers = {{"$50", "$100", "$200"},{"$10","$1000", "$50"},{"$400","$300", "$10", "$300"},{"$600", "$400", "$70"}}; // output should be $1070. } public int maximumWealth(String[][] customers) { return 0; } }
true
c9a4630b0a38a5b6fb0201c4821216af7a17e1f1
Java
mbagusp19/Pemrograman-Berorientasi-Objek
/Pertemuan 10/Tugas/CthClassNotFoundException.java
UTF-8
297
2.578125
3
[]
no_license
package com.pboreg; public class CthClassNotFoundException { public static void main(String[] args) { try { Class.forName("Class"); } catch (ClassNotFoundException ex) { System.out.println("Error " + ex); } } }
true
f53a0cea633cc51ff3880e1563e4282d90ac271f
Java
nishanthvasudeva19/UKonnekt
/src/com/seteam3/ukonnekt/SelectLogInAs.java
UTF-8
1,724
2.171875
2
[]
no_license
package com.seteam3.ukonnekt; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class SelectLogInAs extends Activity { Button selectStudent; Button selectProfessor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.selectloginas); selectStudent = (Button) findViewById(R.id.buttonStudent); selectProfessor = (Button) findViewById(R.id.buttonProfessor); selectStudent.setOnClickListener(new OnClickListener() { public void onClick(View v) { //Intent use to take the User to a new activity, and pass the selected Button value, as Student or Professor Intent intent = new Intent(SelectLogInAs.this, LogIn.class); intent.putExtra("item", "Student"); startActivity(intent); // Animations Created // Activity Switched Using Slide Up Animation overridePendingTransition(R.anim.fadein, R.anim.slideup); } }); selectProfessor.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(SelectLogInAs.this, LogIn.class); intent.putExtra("item", "Professor"); startActivity(intent); // Animations Created // Activity Switched Using Slide Up Animation overridePendingTransition(R.anim.fadein, R.anim.slideup); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.log_in, menu); return true; } }
true
968746f72704001bc2e57f0ee98086c02481f7f4
Java
Vijimolvv/inheritance-and-encapsulation
/Project/src/interfacepgms/Interfacefreshgrad.java
UTF-8
2,969
3.078125
3
[]
no_license
package interfacepgms; import java.util.Scanner; public class Interfacefreshgrad { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.println("1.Current Account\n2.Savings Account"); int n=s.nextInt(); double maint=50.00,current=100.00,charge,charge1; switch(n) { case 1: System.out.println("Name"); String name=s.next(); System.out.println("Account Number"); String acno=s.next(); System.out.println("Account Balance"); int bal=s.nextInt(); System.out.println("Enter the Start Date(yyyy-mm-dd)"); int dat=s.nextInt(); System.out.println("Enter the Years"); int year=s.nextInt(); charge1=maint*year; System.out.printf("Maintainence Charge For current Account %d",charge1); case 2: System.out.println("Name"); String name1=s.next(); System.out.println("Account Number"); String acno1=s.next(); System.out.println("Account Balance"); int bal1=s.nextInt(); System.out.println("Enter the Start Date(yyyy-mm-dd)"); int dat1=s.nextInt(); System.out.println("Enter the Years"); int year1=s.nextInt(); charge=maint*year1; System.out.printf("Maintainence Charge For Savings Account %d",charge); Account s1=new Account(); Savingsaccount s2=new Savingsaccount(); Currentaccount1 s3=new Currentaccount1(); s2.savingsac(name1,acno1,bal1,dat1,year1,charge); s3.currentac(name,acno,bal,dat,year,charge1); } } } interface maintainanceCharge { public void currentac(String name,String acno,int bal,int dat,int year,double charge1); } interface maintainanceCharge1 { public void savingsac(String name1,String acno1,int bal1,int dat1,int year1,double charge); } abstract class Account implements maintainanceCharge ,maintainanceCharge1 { public void currentac(String name,String acno,int cno,int bal,int dat,int year,double charge1) { System.out.println("Name"+name); System.out.println("Account Number : "+acno); System.out.println("Account Balance: "+bal); System.out.println("Enter the Start Date(yyyy-mm-dd) : "+dat); System.out.println("Enter the Years : "+year); System.out.println("Maintainence Charge For Current Account"+charge1); } public void update(String name1,String acno1,int cno1,int bal1,int dat1,int year1,double charge) { System.out.println("Name"+name1); System.out.println("Account Number : "+acno1); System.out.println("Account Balance: "+bal1); System.out.println("Enter the Start Date(yyyy-mm-dd) : "+dat1); System.out.println("Enter the Years : "+year1); System.out.println("Maintainence Charge For Current Account"+charge); } }
true
8bc53bb6463437541b9d025ff9939bed2afbd198
Java
mrinvisible21/udharapp
/app/src/main/java/com/example/udhar/AddUser.java
UTF-8
7,115
2.078125
2
[]
no_license
package com.example.udhar; import android.app.ProgressDialog; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.valdesekamdem.library.mdtoast.MDToast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; import java.util.Map; public class AddUser extends AppCompatActivity { ProgressDialog pd; EditText name,mobile,address,password,cpassword; Button register; SessionManager sessionManager; HashMap<String, String> user; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_user); sessionManager = new SessionManager(getApplicationContext()); user = sessionManager.getUserDetails(); Mytoolbar(); Init(); } private void Init() { name=(EditText)findViewById(R.id.name); mobile=(EditText)findViewById(R.id.mobile); address=(EditText)findViewById(R.id.address); password=(EditText)findViewById(R.id.password); cpassword=(EditText)findViewById(R.id.cpassword); register=(Button)findViewById(R.id.register); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ValidateForm(); } }); } private void ValidateForm() { if (name.getText().toString().equalsIgnoreCase("")){ MDToast mdToast = MDToast.makeText(AddUser.this, "Enter Name",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else if (mobile.getText().toString().equalsIgnoreCase("")){ MDToast mdToast = MDToast.makeText(AddUser.this, "Enter Mobile Number",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else if (mobile.getText().toString().length()<10){ MDToast mdToast = MDToast.makeText(AddUser.this, "Enter 10 digits Mobile Number",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else if (address.getText().toString().equalsIgnoreCase("")){ MDToast mdToast = MDToast.makeText(AddUser.this, "Enter Address",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else if (password.getText().toString().equalsIgnoreCase("")){ MDToast mdToast = MDToast.makeText(AddUser.this, "Enter Password",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else if (cpassword.getText().toString().equalsIgnoreCase("")){ MDToast mdToast = MDToast.makeText(AddUser.this, "Confirm Your Password",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else if (!cpassword.getText().toString().equalsIgnoreCase(password.getText().toString())){ MDToast mdToast = MDToast.makeText(AddUser.this, "Confirm Password Not Matching",2,MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 0); mdToast.show(); } else{ RegisterUser(); } } private void Mytoolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("User Registration"); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_24dp); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void RegisterUser() { pd=new ProgressDialog(this); pd.setMessage("Adding Please wait....."); pd.show(); RequestQueue queue = Volley.newRequestQueue(AddUser.this); StringRequest postRequest = new StringRequest(Request.Method.POST,BaseURL.ADD_USER , new Response.Listener<String>() { @Override public void onResponse(String response) { pd.dismiss(); NextActivity(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { pd.dismiss(); } } ) { @Override protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("u_name", name.getText().toString()); params.put("u_mobile", mobile.getText().toString()); params.put("u_address", address.getText().toString()); params.put("u_password", cpassword.getText().toString()); params.put("token",BaseURL.MY_KEY); return params; } }; postRequest.setRetryPolicy(new DefaultRetryPolicy(0, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); queue.add(postRequest); } private void NextActivity(String response) { try { JSONArray jsonarray = new JSONArray(response); JSONObject jsonobject = jsonarray.getJSONObject(0); String message = jsonobject.getString("message"); String error = jsonobject.getString("error"); if(error.equalsIgnoreCase("false")) { MDToast mdToast = MDToast.makeText(AddUser.this, message, 10, MDToast.TYPE_SUCCESS); mdToast.setGravity(Gravity.TOP | Gravity.CENTER, 0, 0); mdToast.show(); Intent intent=new Intent(AddUser.this,Login.class); startActivity(intent); finish(); } else if(error.equalsIgnoreCase("true")) { MDToast mdToast = MDToast.makeText(AddUser.this, message, 10, MDToast.TYPE_ERROR); mdToast.setGravity(Gravity.TOP | Gravity.CENTER, 0, 0); mdToast.show(); Intent intent=new Intent(AddUser.this,Login.class); startActivity(intent); finish(); } } catch (JSONException e) { e.printStackTrace(); } } }
true
ae2c88ade6645eb96964cbf7fe2d23c912ad2c71
Java
MAUH96/AstonIndoorMaps
/app/src/main/java/com/example/astonindoor/onMapPin/OnPinClickListener.java
UTF-8
143
1.53125
2
[]
no_license
package com.example.astonindoor.onMapPin; import android.view.View; public interface OnPinClickListener { void onPinClick(Pin pin); }
true
f6a8a0904c0da37f8e887e0badf3efdbf96db6be
Java
elvircrn/RMA-Zadaca
/app/src/main/java/ba/unsa/etf/rma/elvircrn/movieinfo/managers/SearchManager.java
UTF-8
1,119
2.5
2
[]
no_license
package ba.unsa.etf.rma.elvircrn.movieinfo.managers; import ba.unsa.etf.rma.elvircrn.movieinfo.factories.services.ServiceFactory; import ba.unsa.etf.rma.elvircrn.movieinfo.services.dto.ActorSearchResponseDTO; import ba.unsa.etf.rma.elvircrn.movieinfo.services.dto.MovieSearchResponseDTO; import ba.unsa.etf.rma.elvircrn.movieinfo.services.interfaces.ISearchService; import io.reactivex.Single; /** * Initialization-on-demand holder idion za thread-safe i brzu inicijalizaciju. */ public class SearchManager { ISearchService service; private static class LazyHolder { static final SearchManager INSTANCE = new SearchManager(); } private SearchManager() { service = ServiceFactory.getInstance().createSerachService(); } public Single<ActorSearchResponseDTO> searchActorByName(String name) { return service.searchActorsByName(name); } public Single<MovieSearchResponseDTO> searchMovieByName(String name) { return service.searchMovieByName(name); } public static SearchManager getInstance() { return LazyHolder.INSTANCE; } }
true
8744fbf92a92083a355229c33b6ad15e26dc0305
Java
studanshu/sf-tt-monad-stream
/src/main/java/superiterable/School.java
UTF-8
1,469
3.34375
3
[]
no_license
package superiterable; import student.Student; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Consumer; import java.util.function.Predicate; public class School { public static void main(String[] args) { SuperIterable<Student> roster = new SuperIterable<>(Arrays.asList( Student.ofNameGpaCourses("Fred", 2.2, "Math", "Physics"), Student.ofNameGpaCourses("Jim", 3.2, "Art"), Student.ofNameGpaCourses("Sheila", 3.7, "Math", "Physics", "Quantum Mechanics") )); // forEvery(roster, s -> System.out.println(s)); // forEvery(roster, System.out::println); // forEvery(filter(roster, s -> s.getCourses().size() < 3), s -> System.out.println(">> " + s)); // forEvery(filter(Arrays.asList("Fred", "Jim", "Sheila"), s -> s.length() > 3), System.out::println); roster.forEach(System.out::println); roster // .filter(s -> s.getGpa() > 3) .flatMap(s -> new SuperIterable<>(s.getCourses())) .forEach(System.out::println); roster .filter(s -> s.getCourses().size() < 3) .forEach(s -> System.out.println(">> " + s)); new SuperIterable<>(Arrays.asList("Fred", "Jim", "Sheila")) .filter(s -> s.length() > 3) .map(s -> s.length()) .forEach(System.out::println); } }
true
8627a03e8635875d07af6339dcf729e16864ee94
Java
VladGuskov/sarafan
/src/main/java/com/codegod/sarafan/repo/UserDetailsRepo.java
UTF-8
464
1.953125
2
[]
no_license
package com.codegod.sarafan.repo; import com.codegod.sarafan.domain.User; import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; /** * @author XE on 03.09.2019 * @project sarafan */ public interface UserDetailsRepo extends JpaRepository<User,String> { @EntityGraph(attributePaths = { "subscriptions", "subscribers" }) Optional<User> findById(String s); }
true
f069f634c003ae5346f581d4c32ebe82ebc9583b
Java
kelu124/pyS3
/org/apache/poi/hssf/util/HSSFCellUtil.java
UTF-8
1,928
2.34375
2
[ "MIT" ]
permissive
package org.apache.poi.hssf.util; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.util.CellUtil; import org.apache.poi.util.Removal; @Deprecated @Removal(version = "3.17") public final class HSSFCellUtil { private HSSFCellUtil() { } public static HSSFRow getRow(int rowIndex, HSSFSheet sheet) { return (HSSFRow) CellUtil.getRow(rowIndex, sheet); } public static HSSFCell getCell(HSSFRow row, int columnIndex) { return (HSSFCell) CellUtil.getCell(row, columnIndex); } public static HSSFCell createCell(HSSFRow row, int column, String value, HSSFCellStyle style) { return (HSSFCell) CellUtil.createCell(row, column, value, style); } public static HSSFCell createCell(HSSFRow row, int column, String value) { return createCell(row, column, value, null); } public static void setAlignment(HSSFCell cell, HSSFWorkbook workbook, short align) { setAlignment(cell, HorizontalAlignment.forInt(align)); } public static void setAlignment(HSSFCell cell, HorizontalAlignment align) { CellUtil.setAlignment(cell, align); } public static void setFont(HSSFCell cell, HSSFWorkbook workbook, HSSFFont font) { CellUtil.setFont(cell, font); } public static void setCellStyleProperty(HSSFCell cell, HSSFWorkbook workbook, String propertyName, Object propertyValue) { CellUtil.setCellStyleProperty(cell, propertyName, propertyValue); } public static HSSFCell translateUnicodeValues(HSSFCell cell) { CellUtil.translateUnicodeValues(cell); return cell; } }
true
46c83dcb170f9656ab448e1be78d2e740dc71397
Java
aguscorvo/VacunasUY
/Codigo/Android/app/src/main/java/vacunasuy/componentemovil/second/MapDeptoLoc.java
UTF-8
9,549
2
2
[]
no_license
package vacunasuy.componentemovil.second; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.util.JsonReader; import android.util.JsonToken; import android.util.Log; import android.view.View; import android.widget.ExpandableListAdapter; import android.widget.ExpandableListView; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.List; import vacunasuy.componentemovil.R; import vacunasuy.componentemovil.constant.ConnConstant; import vacunasuy.componentemovil.obj.DtDepartamento; import vacunasuy.componentemovil.obj.DtLocalidad; public class MapDeptoLoc extends AppCompatActivity { private static final String TAG = "VacunasUY"; ConnectivityManager connMgr; NetworkInfo networkInfo; ExpandableListView expandableListView; ExpandableListAdapter expandableListAdapter; Intent result; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); result = new Intent(); buscarDepartamentos(); String title = getString(R.string.app_name) + " - " + getString(R.string.title_seleccionar)+ " " + getString(R.string.title_localidad); setTitle(title); setContentView(R.layout.activity_map_depto_loc); } @Override public void onBackPressed() { //super.onBackPressed(); } private void addDepartamentos(List<DtDepartamento> departamentos){ Log.i(TAG, "addDepartamentos List<DtDepartamento>: " + departamentos.size()); if(departamentos.size()!=0){ expandableListView = findViewById(R.id.expandableListView); expandableListAdapter = new CustomExpandableListAdapter(MapDeptoLoc.this, departamentos); expandableListView.setAdapter(expandableListAdapter); expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { } }); expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { @Override public void onGroupCollapse(int groupPosition) { } }); expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { result.putExtra("departamento", departamentos.get(groupPosition).getId().toString()); result.putExtra("localidad", departamentos.get(groupPosition).getLocalidades().get(childPosition).getId().toString()); MapDeptoLoc.this.setResult(RESULT_OK, result); finish(); return false; } }); }else { result.putExtra("departamento", -1); result.putExtra("localidad", -1); MapDeptoLoc.this.setResult(RESULT_CANCELED, result); finish(); } } private void buscarDepartamentos() { connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); networkInfo = connMgr.getActiveNetworkInfo(); String stringUrl = ConnConstant.API_DEPARTAMENTOS_URL; if (networkInfo != null && networkInfo.isConnected()) { new MapDeptoLoc.DownloadDepartamentosTask().execute(stringUrl); } else { } } private class DownloadDepartamentosTask extends AsyncTask<String, Void, Object> { @Override protected Object doInBackground(String... urls) { // params comes from the execute() call: params[0] is the url. try { return VacunatoriosInfoGralUrl(urls[0]); } catch (IOException e) { return getString(R.string.err_recuperarpag); } } // onPostExecute displays the results of the AsyncTask. @Override protected void onPostExecute(Object result) { if (result instanceof ArrayList) { List<DtDepartamento> departamentos = (List<DtDepartamento>) result; addDepartamentos(departamentos); }else if(result instanceof String){ Log.i("onPostExecute", "response: " + ((String) result)); } } } private List<DtDepartamento> VacunatoriosInfoGralUrl(String myurl) throws IOException { InputStream is = null; HttpURLConnection conn = null; try { URL url = new URL(myurl); conn = (HttpURLConnection) url.openConnection(); //conn.setRequestProperty("User-Agent", ConnConstant.USER_AGENT); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestMethod("GET"); conn.setDoInput(true); // Starts the query conn.connect(); //int response = conn.getResponseCode(); is = conn.getInputStream(); return readInfoGralJsonStream(is); // Makes sure that the InputStream is closed after the app is // finished using it. } finally { if (is != null) { is.close(); conn.disconnect(); } } } public List<DtDepartamento> readInfoGralJsonStream(InputStream in) throws IOException { //creating an InputStreamReader object InputStreamReader isReader = new InputStreamReader(in); //Creating a BufferedReader object BufferedReader breader = new BufferedReader(isReader); StringBuffer sb = new StringBuffer(); String str; while((str = breader.readLine())!= null){ sb.append(str); } JsonReader reader = new JsonReader(new StringReader(sb.toString())); try { return readRESTMessage(reader); } finally { reader.close(); } } public List<DtDepartamento> readRESTMessage(JsonReader reader) throws IOException { Boolean ok = false; String mensaje = null; List<DtDepartamento> res = null; reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("ok")) { ok = reader.nextBoolean(); }else if (name.equals("mensaje")) { mensaje = reader.nextString(); } else if (name.equals("cuerpo") && reader.peek() != JsonToken.NULL) { res = readInfoGralDepartamentoArray(reader); } else { reader.skipValue(); } } reader.endObject(); return res; } public List<DtDepartamento> readInfoGralDepartamentoArray(JsonReader reader) throws IOException { List<DtDepartamento> departamentos = new ArrayList<DtDepartamento>(); reader.beginArray(); while (reader.hasNext()) { departamentos.add((DtDepartamento) readDepartamento(reader)); } reader.endArray(); return departamentos; } public DtDepartamento readDepartamento(JsonReader reader) throws IOException { Integer id = null; String nombre = null; List<DtLocalidad> localidades = null; reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("id") && reader.peek() != JsonToken.NULL) { id = reader.nextInt(); } else if (name.equals("nombre") && reader.peek() != JsonToken.NULL) { nombre = reader.nextString(); } else if (name.equals("localidades") && reader.peek() != JsonToken.NULL) { localidades = readLocalidadArray(reader); } else { reader.skipValue(); } } reader.endObject(); return new DtDepartamento(id, nombre, localidades); } public List<DtLocalidad> readLocalidadArray(JsonReader reader) throws IOException { List<DtLocalidad> localidades = new ArrayList<DtLocalidad>(); reader.beginArray(); while (reader.hasNext()) { localidades.add(readLocalidad(reader)); } reader.endArray(); return localidades; } public DtLocalidad readLocalidad(JsonReader reader) throws IOException { Integer id = null; String nombre = null; reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("id") && reader.peek() != JsonToken.NULL) { id = reader.nextInt(); } else if (name.equals("nombre") && reader.peek() != JsonToken.NULL) { nombre = reader.nextString(); } else { reader.skipValue(); } } reader.endObject(); return new DtLocalidad(id, nombre); } }
true
addafef68617a24895e0f0447a44c9cb38fcaf89
Java
DmitryOvchinikov/RecipeSuggester
/app/src/main/java/com/android/recipesuggester/activities/LoadingActivity.java
UTF-8
6,446
2.109375
2
[]
no_license
package com.android.recipesuggester.activities; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.airbnb.lottie.LottieAnimationView; import com.android.recipesuggester.R; import com.android.recipesuggester.data.Recipe; import com.android.recipesuggester.data.User; import com.bumptech.glide.Glide; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.gson.Gson; import com.opencsv.CSVReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class LoadingActivity extends AppCompatActivity { //ANIMATIONS private LottieAnimationView loading_ANIM_animation; //IMGS private ImageView loading_IMG_logo; //TXT private TextView loading_LBL_title; //DATA private String[] ingredients; private User user; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_loading); findViews(); glideIMGS(); setAnimations(); try { readIngredients(); } catch (IOException e) { e.printStackTrace(); } initUser(); } // Initializing a User either by creating it or from the firebase auth. private void initUser() { user = new User(); LoadingActivity.this.runOnUiThread(new Runnable() { @Override public void run() { final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("users"); databaseReference.child(firebaseUser.getUid()).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { if (snapshot.getValue() != null) { user = snapshot.getValue(User.class); if (user.getIngredients() == null) { user.setIngredients(new ArrayList<String>()); } Log.d("oof", "User loaded successfully from the database!"); } else { user.setEmail(firebaseUser.getEmail()); user.setIngredients(new ArrayList<String>()); user.setIngredientsString(""); user.setRecipes(new ArrayList<Recipe>()); Log.d("oof", "User created successfully!"); } //Waiting for a second after the user is fetched Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { continueToMain(); } }; handler.postDelayed(runnable, 1000); handler.removeCallbacksAndMessages(runnable); } @Override public void onCancelled(@NonNull DatabaseError error) { Log.d("oof", "Database read cancelled while fetching a user!"); continueToMain(); } }); } }); } private void continueToMain() { Intent intent = new Intent(LoadingActivity.this, MainActivity.class); Gson gson = new Gson(); intent.putExtra("user", gson.toJson(user)); intent.putExtra("ingredients", ingredients); intent.putExtra("user_name", FirebaseAuth.getInstance().getCurrentUser().getDisplayName()); startActivity(intent); finish(); } // Reading ingredients from a CSV file private void readIngredients() throws IOException { InputStream is = this.getResources().openRawResource(R.raw.ingredients); InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8); List<String[]> ingredientList = new CSVReader(reader).readAll(); listToStringArray(ingredientList); } // Transforming a list to a string array private void listToStringArray(List<String[]> ingredientList) { ingredients = new String[ingredientList.size()]; for (int i = 0; i < ingredientList.size(); i++) { ingredients[i] = Arrays.toString(ingredientList.get(i)); ingredients[i] = ingredients[i].replace("[", ""); ingredients[i] = ingredients[i].replace("]", ""); } } private void setAnimations() { Animation top_animation = AnimationUtils.loadAnimation(this, R.anim.top_animation); Animation bot_animation = AnimationUtils.loadAnimation(this, R.anim.bot_animation); loading_IMG_logo.setAnimation(top_animation); loading_LBL_title.setAnimation(top_animation); loading_ANIM_animation.setAnimation(bot_animation); } private void glideIMGS() { Glide.with(this).load(R.drawable.ic_launcher).into(loading_IMG_logo); } private void findViews() { loading_IMG_logo = findViewById(R.id.loading_IMG_logo); loading_LBL_title = findViewById(R.id.loading_LBL_title); loading_ANIM_animation = findViewById(R.id.loading_ANIM_animation); } }
true
b07ffd84e7788ccbf572b160bc8b97eeec0504c5
Java
FaedDroneLogistics/FAED-Project
/KMLGenerator/src/model/ScreenOverlay.java
UTF-8
1,904
2.75
3
[]
no_license
/* * Author: Julio Bondia, Marc Gonzàlez * E-mail: {julio.bondia13, marcgc21}@gmail.com * * FAED Project - Google Summer of Code 2015 */ package model; public class ScreenOverlay { public class OverlayLocation { public static final String TOP_LEFT = "\t\t<overlayXY x=\"0\" y=\"1\" xunits=\"fraction\" yunits=\"fraction\"/>\n" + "\t\t<screenXY x=\"0\" y=\"1\" xunits=\"fraction\" yunits=\"fraction\"/>\n" + "\t\t<rotationXY x=\"0\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n" + "\t\t<size x=\"0\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n"; public static final String BOTTOM_RIGHT = "\t\t<overlayXY x=\"1\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n" + "\t\t<screenXY x=\"1\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n" + "\t\t<rotationXY x=\"0\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n" + "\t\t<size x=\"0\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n"; } private String name; private String imagePath; private String overlayLocation; /** * Screen overlay constructor * * @param name - name of the overlay * @param imagePath - path to the image to be shown * @param overlayLocation - OverlayLocation, where to put the information on the screen */ public ScreenOverlay(String name, String imagePath, String overlayLocation) { super(); this.name = name; this.imagePath = imagePath; this.overlayLocation = overlayLocation; } /*** Getters and Setters ***/ public String getName() { return name; } public void setName(String name) { this.name = name; } public String getImagePath() { return imagePath; } public void setImagePath(String imagePath) { this.imagePath = imagePath; } public String getOverlayLocation() { return overlayLocation; } public void setOverlayLocation(String overlayLocation) { this.overlayLocation = overlayLocation; } }
true
5a39f48bbf86536f663b736a5b4c6443f5b32ee5
Java
Man4ester/telegram_bot_daily_reporter
/src/main/java/bismark/models/TimeReminder.java
UTF-8
370
2.546875
3
[]
no_license
package bismark.models; public class TimeReminder { private int hour; private int minutes; public int getHour() { return hour; } public void setHour(int hour) { this.hour = hour; } public int getMinutes() { return minutes; } public void setMinutes(int minutes) { this.minutes = minutes; } }
true
13d22593e04011fdfe864d6349d9b7e46e905597
Java
lalosuarez/hazelcast
/hazelcast-client/src/main/java/com/example/hazelcastclient/HazelcastCacheRepository.java
UTF-8
2,270
2.75
3
[]
no_license
package com.example.hazelcastclient; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IMap; public class HazelcastCacheRepository implements CacheRepository { private IMap<Object, Object> map; private HazelcastInstance hazelcastInstance; public HazelcastCacheRepository(HazelcastInstance hazelcastInstance, String mapName) { this.hazelcastInstance = hazelcastInstance; map = hazelcastInstance.getMap(mapName); } /** * This method overrides a method already defined in a parent class and defines how it will be executed for the CacheRepository class. * * @see CacheRepository#save(String, Object) * @since R1707 */ @Override public void save(String key, Object value) { if (map == null) return; map.put(key, value); } /** * This method overrides a method already defined in a parent class and defines how it will be executed for the CacheRepository class. * * @see CacheRepository#findBy(String) * @since R1707 */ @Override public Object findBy(String key) { if (map == null) return null; return map.get(key); } /** * This method overrides a method already defined in a parent class and defines how it will be executed for the CacheRepository class. * * @see CacheRepository#findAll() * @since R1707 */ @Override public IMap<Object, Object> findAll() { if (map == null) return null; return map; } /** * This method overrides a method already defined in a parent class and defines how it will be executed for the CacheRepository class. * * @see CacheRepository#deleteBy(String) * @since R1707 */ @Override public void deleteBy(String key) { if (map == null) return; map.remove(key); } /** * This method overrides a method already defined in a parent class and defines how it will be executed for the CacheRepository class. * * @see CacheRepository#deleteAll() * @since R1707 */ @Override public void deleteAll() { if (map == null) return; map.evictAll(); } }
true
d23ed1d5d97fc9fed5e02fa02cad82cf847d7ba7
Java
unc-mobile/Sensors
/app/src/main/java/com/example/scroggo/sensorpractice/MainActivity.java
UTF-8
2,533
2.3125
2
[]
no_license
package com.example.scroggo.sensorpractice; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.RecyclerView; import android.content.Context; import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorManager; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import org.w3c.dom.Text; import java.util.List; public class MainActivity extends AppCompatActivity implements View.OnClickListener { static final String SENSOR_NAME = "sensor"; static final String SENSOR_TYPE = "sensor_type"; static final String SENSOR_STRING_TYPE = "sensor_string_type"; private LinearLayout mLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); List<Sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_ALL); mLayout = findViewById(R.id.linear); for (Sensor sensor : sensors) { TextView name = addField(sensor.getName()); name.setOnClickListener(this); name.setTag(sensor); addField("\tTYPE: " + sensor.getStringType() + " (" + sensor.getType() + ")"); float range = sensor.getMaximumRange(); addField("\tMaximum range: " + range); addField("\tResolution: " + sensor.getResolution()); addField("\tMin Delay: " + sensor.getMinDelay()); addField("\tPower: " + sensor.getPower()); addField("\tVendor: " + sensor.getVendor()); addField("\tVersion: " + sensor.getVersion()); addField("\tIsWakeUp: " + sensor.isWakeUpSensor()); } } private TextView addField(String text) { TextView textView = new TextView(this); textView.setText(text); mLayout.addView(textView); return textView; } @Override public void onClick(View view) { TextView textView = (TextView) view; String name = textView.getText().toString(); Sensor sensor = (Sensor) textView.getTag(); Intent intent = new Intent(this, SensorStats.class); intent.putExtra(SENSOR_NAME, name); intent.putExtra(SENSOR_TYPE, sensor.getType()); intent.putExtra(SENSOR_STRING_TYPE, sensor.getStringType()); startActivity(intent); } }
true
1cf5c796e1574e505e4e2e49db068cbce2c9c857
Java
MaStanford/OMDBApp
/app/src/main/java/mark/stanford/com/omdb/network/RetroNetworkService.java
UTF-8
712
2.28125
2
[]
no_license
package mark.stanford.com.omdb.network; import io.reactivex.Observable; import mark.stanford.com.omdb.models.MovieSearchResultWrapper; import mark.stanford.com.omdb.models.Movie; import retrofit2.http.GET; import retrofit2.http.Query; public interface RetroNetworkService { String BASE_URI = "http://www.omdbapi.com/"; String API_KEY = "c02b6340"; @GET("?apikey=" + API_KEY) Observable<Movie> getMovie(@Query("i") String id); @GET("?apikey=" + API_KEY) Observable<MovieSearchResultWrapper> searchMovies(@Query("s") String searchTerm); @GET("?apikey=" + API_KEY) Observable<MovieSearchResultWrapper> searchMoviesPage(@Query("s") String searchTerm, @Query("page") int page); }
true
bdb70b04a19ab52bfd1c1658f2725196801d766f
Java
mikeg2/Cueify
/Work Space/Cueify/src/com/cueify/gui/panel/cuetable/helper/ReorderableCueTable.java
UTF-8
2,044
2.40625
2
[]
no_license
package com.cueify.gui.panel.cuetable.helper; import javafx.beans.InvalidationListener; import javafx.beans.Observable; import javafx.event.EventHandler; import javafx.scene.control.TableRow; import javafx.scene.control.TableView; import javafx.scene.input.DragEvent; import javafx.util.Callback; import com.cueify.cue.Cue; import com.cueify.cuelist.CueList; import com.cueify.cuelist.CueListItem; import com.cueify.extension.LocalDragboard; import com.cueify.extension.reorder.ReorderableTable; public class ReorderableCueTable extends ReorderableTable<CueListItem> { private CueList list; public ReorderableCueTable(CueList cueList) { list = cueList; updateListLink(); makeReorderableCueTable(this); } public ReorderableCueTable() { makeReorderableCueTable(this); } private void updateListLink() { list.addListener(new InvalidationListener() { @Override public void invalidated(Observable observable) { setItems(list); } }); } private void makeReorderableCueTable(TableView<CueListItem> tableView) { ReorderableTable.<CueListItem>makeReorderTable(tableView); final Callback<TableView<CueListItem>, TableRow<CueListItem>> oldFactory = tableView.getRowFactory(); tableView.setRowFactory(new Callback<TableView<CueListItem>, TableRow<CueListItem>>() { @Override public TableRow<CueListItem> call(TableView<CueListItem> param) { final TableRow<CueListItem> row = oldFactory.call(param); row.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { System.out.println("CUE"); CueListItem item = LocalDragboard.getInstance().<CueListItem>getValue(CueListItem.class); list.remove(item.getCue()); list.add( row.getIndex(), item); } }); return row; } }); } //Model public CueList getList() { return list; } public void setList(CueList list) { if (list == null) { return; } this.list = list; getItems().setAll(list); updateListLink(); } }
true
3092794a0b88429572940c18e5480c99905b0753
Java
JitenderBhati/LibraryService-JPOP
/user_service/src/main/java/com/epam/user_service/api/dto/UserDto.java
UTF-8
421
1.867188
2
[]
no_license
package com.epam.user_service.api.dto; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; @Data public class UserDto { @JsonProperty("id") private int id; @JsonProperty("firstname") private String firstname; @JsonProperty("lastname") private String lastname; @JsonProperty("age") private int age; @JsonProperty("address") private AddressDto address; }
true
355f45f59a0ca4695a1c821e0e6148dde8a8f78c
Java
marcusportmann/mmp-java
/src/mmp-application/src/main/java/guru/mmp/application/codes/CodeProviderConfig.java
UTF-8
2,269
2.28125
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2017 Marcus Portmann * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package guru.mmp.application.codes; /** * The <code>CodeProviderConfig</code> class stores the configuration information for a code * provider. This is the configuration read from the META-INF/CodesConfig.xml configuration files * on the classpath. * * @author Marcus Portmann */ public class CodeProviderConfig { /** * The fully qualified name of the class that implements the code provider. */ private String className; /** * The name of the code provider. */ private String name; /** * Constructs a new <code>CodeProviderConfig</code>. * * @param name the name of the code provider * @param className fully qualified name of the class that implements the code provider */ CodeProviderConfig(String name, String className) { this.name = name; this.className = className; } /** * Returns the name of the code provider. * * @return the name of the code provider */ public String getName() { return name; } /** * Set the fully qualified name of the class that implements the code provider. * * @param className the fully qualified name of the class that implements the code provider */ public void setClassName(String className) { this.className = className; } /** * Set the name of the code provider. * * @param name the name of the code provider */ public void setName(String name) { this.name = name; } /** * Return the fully qualified name of the class that implements the code provider. * * @return the fully qualified name of the class that implements the code provider */ String getClassName() { return className; } }
true
fe36306df9f0187d20cbd6731cf281b579348c41
Java
mgalarza005/betsProiektua
/Bets/src/gui/LangileaSortuGUI.java
UTF-8
3,366
2.53125
3
[]
no_license
package gui; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import businessLogic.BLFacade; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPasswordField; import java.awt.Font; public class LangileaSortuGUI extends JFrame { private JPanel contentPane; private JTextField textField; private JPasswordField passwordField; private JPasswordField passwordField_1; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LangileaSortuGUI frame = new LangileaSortuGUI(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public LangileaSortuGUI() { //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new JLabel("Sortu ezazu langile berri bat"); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 17)); lblNewLabel.setBounds(98, 13, 257, 24); contentPane.add(lblNewLabel); textField = new JTextField(); textField.setBounds(187, 64, 116, 22); contentPane.add(textField); textField.setColumns(10); JLabel lblIzena = new JLabel("Izena:"); lblIzena.setBounds(34, 71, 56, 16); contentPane.add(lblIzena); JLabel lblPasahitza = new JLabel("Pasahitza:"); lblPasahitza.setBounds(34, 103, 88, 16); contentPane.add(lblPasahitza); JLabel lblPasahitzaErrepikatu = new JLabel("Pasahitza errepikatu:"); lblPasahitzaErrepikatu.setBounds(34, 153, 141, 16); contentPane.add(lblPasahitzaErrepikatu); passwordField = new JPasswordField(); passwordField.setBounds(187, 99, 116, 22); contentPane.add(passwordField); passwordField_1 = new JPasswordField(); passwordField_1.setBounds(187, 150, 116, 22); contentPane.add(passwordField_1); JLabel emaitzaLabel_1 = new JLabel(""); emaitzaLabel_1.setEnabled(false); emaitzaLabel_1.setBounds(34, 202, 224, 38); contentPane.add(emaitzaLabel_1); JButton btnLangileaGorde = new JButton("Langilea gorde"); btnLangileaGorde.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { BLFacade negozioLogika=MainGUI.getBusinessLogic(); boolean a = negozioLogika.workerIzenaOndo(textField.getText()); if(a) { if(negozioLogika.passOndo(new String(passwordField.getPassword()), new String(passwordField_1.getPassword()))) { negozioLogika.langileBerriaSortu(textField.getText(),new String(passwordField.getPassword())); emaitzaLabel_1.setEnabled(true); emaitzaLabel_1.setText("Langilea sartu duzu"); }else { emaitzaLabel_1.setEnabled(true); emaitzaLabel_1.setText("Pasahitzak ez dira berdinak"); } }else { emaitzaLabel_1.setEnabled(true); emaitzaLabel_1.setText("Dagoeneko, existitzen da langile bat izen horrekin"); } } }); btnLangileaGorde.setBounds(270, 202, 128, 38); contentPane.add(btnLangileaGorde); } }
true
95875abeaa53bc2f23784ae147f05a8a6292fe0b
Java
rabidi/Bibal_abidi_tebba
/src/com/dao/DaoUser.java
UTF-8
146
1.640625
2
[]
no_license
package com.dao; import com.metier.Usager; public interface DaoUser { public void addUsage(Usager u); public void afficher() ; }
true
408831a2478052856fc849112cd010e51023076c
Java
aniketbhatnagar/simple-trading-bot
/src/main/java/com/sonar/trading/queue/Queue.java
UTF-8
161
2.078125
2
[]
no_license
package com.sonar.trading.queue; public interface Queue<M> { void publish(M message); void subscribe(String subscriberId, Subscriber<M> subscriber); }
true
9c5ccfb29bea6fab25499e116ed681263f4958dc
Java
Youthbo1/spring_demo
/src/java/com/dao/impl/RoleDAOImpl.java
UTF-8
317
1.648438
2
[]
no_license
package com.dao.impl; import com.dao.IRoleDAO; import org.springframework.stereotype.Component; /** * \Date: 2018/1/25 * \ * \Description: * \ */ @Component public class RoleDAOImpl implements IRoleDAO { public boolean findAll() { System.out.println("RoleDAOImpl--"); return true; } }
true
c3b9661659f9ee4f07694da001ac59b3a18f0c46
Java
AllBinary/AllBinary-Platform
/j2me/input/NoGyroSensorJavaLibraryM/src/main/java/org/allbinary/input/gyro/GyroSensorFactory.java
UTF-8
800
1.914063
2
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
/* * AllBinary Open License Version 1 * Copyright (c) 2011 AllBinary * * By agreeing to this license you and any business entity you represent are * legally bound to the AllBinary Open License Version 1 legal agreement. * * You may obtain the AllBinary Open License Version 1 legal agreement from * AllBinary or the root directory of AllBinary's AllBinary Platform repository. * * Created By: Travis Berthelot * */ package org.allbinary.input.gyro; public class GyroSensorFactory { private static AllBinaryOrientationSensor allBinaryGyroSensor; public static void init() throws Exception { GyroSensorFactory.allBinaryGyroSensor = new NoGyroSensor(); } public static AllBinaryOrientationSensor getInstance() { return GyroSensorFactory.allBinaryGyroSensor; } }
true
2ba2740e8bb24ff2ef1a62f1d11f482ef9c54f1c
Java
dikshaTomar/Assignment
/server.java
UTF-8
541
2.53125
3
[]
no_license
package diksha; import java.io.*; import java.net.*; import java.util.*; public class server{ public static void main(String a[]) { try { ServerSocket se=new ServerSocket(3300); Socket ss=se.accept(); DataInputStream di =new DataInputStream(ss.getInputStream()); String msg=(String)di.readUTF(): System.out.println(msg); } catch(Exception e) { System.out.println("Exception is"+e.toString()); } } }
true
65235a5c4c7ddb8aba0d331eec2aad3765d7b650
Java
phongluyen00/CalendarKMA
/app/src/main/java/com/example/retrofitrxjava/home/adapter/BannerAdapter.java
UTF-8
1,709
2.296875
2
[]
no_license
package com.example.retrofitrxjava.home.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.LayoutRes; import androidx.annotation.NonNull; import androidx.databinding.DataBindingUtil; import androidx.viewpager.widget.PagerAdapter; import com.example.retrofitrxjava.BR; import com.example.retrofitrxjava.databinding.ItemBannerBinding; import com.example.retrofitrxjava.model.ModelResponse; import java.util.ArrayList; public class BannerAdapter<T extends ModelResponse> extends PagerAdapter { private ArrayList<T> data; private @LayoutRes int resId; LayoutInflater mLayoutInflater; public BannerAdapter(Context context, ArrayList<T> data, int resId) { this.data = data; mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.resId = resId; } @Override public int getCount() { return data.size(); } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { return view.equals(object); } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, final int position) { ItemBannerBinding binding = DataBindingUtil.inflate(mLayoutInflater,resId, container, false); T t = data.get(position); binding.setVariable(BR.item, t); container.addView(binding.getRoot()); return binding.getRoot(); } @Override public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { container.removeView((View) object); } }
true
0ae2588b057c422f9a5c4e96e07920eb83446e5f
Java
peintune/BinaryTreeNode
/Solution.java
UTF-8
821
3.609375
4
[]
no_license
public class Solution{ static List<String> binaryTreePaths = new ArrayList<String>(); public static List<String> iteratorPath(TreeNode node){ pareseNode(node,null); return binaryTreePaths; } public static void pareseNode(TreeNode node,TreeNode parentNode) { if(null == parentNode){ node.appendPath(""); }else{ node.appendPath(parentNode.getPath()); } //leaf node if (!node.hasLeftNode() && !node.hasRightNode()) { binaryTreePaths.add( node.getPath()); } else { if (node.hasLeftNode()) { pareseNode(node.getLeftNode(),node); } if (node.hasRightNode()) { pareseNode(node.getRightNode(),node); } } } }
true
b6a348a151a1e05ad0e496236ba6fa3f73c45f09
Java
mohoromitch/REST-System-Stat-Broadcaster
/src/main/java/com/mohorovich/mitchell/rssb/pollers/NetPoller.java
UTF-8
298
1.9375
2
[ "MIT" ]
permissive
package com.mohorovich.mitchell.rssb.pollers; import com.mohorovich.mitchell.rssb.runnables.NetRunnable; /** * Created by mitchellmohorovich on 2016-02-06. */ public class NetPoller extends MetricPoller { public NetPoller() { super(); this.thread = new Thread(new NetRunnable(this)); } }
true
4a9e263ba2c6cfb55fe5f8355c7218a901934add
Java
gmz07dnz/gamze
/src/day31exceptions/E04.java
ISO-8859-9
414
3.375
3
[]
no_license
package day31exceptions; public class E04 { //ArrayIndexOutOfBoundsException public static void main(String[] args) { int arr[] = {11, 12, 13}; System.out.println(arr[0]); // 11 System.out.println(arr[1]); // 12 try { System.out.println(arr[3]); // exception }catch(ArrayIndexOutOfBoundsException e) { System.out.println("Array'de olmayan bir index'i kullanyorsunuz"); } } }
true
102635770a6e213eff890d16956b3e40da6bd41a
Java
mbocs/GLANET
/Doktora/src/fastdirtysolutions/ConvertCellLineNametoUpperCase.java
UTF-8
1,741
3.03125
3
[]
no_license
/** * @author Burcak Otlu Saritas * * */ package fastdirtysolutions; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Locale; import common.Commons; public class ConvertCellLineNametoUpperCase { public void convertCellLineNametoUpperCase(String inputFileName, String outputFileName){ String strLine; String cellLineName; int indexofFirstTab; try { FileReader fileReader = new FileReader(inputFileName); FileWriter fileWriter = new FileWriter(outputFileName); BufferedReader bufferedReader = new BufferedReader(fileReader); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); while((strLine = bufferedReader.readLine())!=null){ indexofFirstTab = strLine.indexOf('\t'); cellLineName = strLine.substring(0,indexofFirstTab); bufferedWriter.write(cellLineName.toUpperCase(Locale.ENGLISH) + "\t" + strLine.substring(indexofFirstTab+1) +"\n"); } bufferedWriter.close(); bufferedReader.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * @param args */ public static void main(String[] args) { String inputFileName = Commons.DNASE_CELL_LINE_WHOLE_GENOME_USING_INTERVAL_TREE; String outputFileName = Commons.DUMMY_DNASE_CELL_LINE_WHOLE_GENOME_USING_INTERVAL_TREE; ConvertCellLineNametoUpperCase convert = new ConvertCellLineNametoUpperCase(); convert.convertCellLineNametoUpperCase(inputFileName,outputFileName); } }
true
55fcf908a91ee0d410cb5e669da8c268b1da1b3e
Java
CaseySchurman/VoGo_SeniorProject
/app/src/main/java/com/example/caseyschurman/vogo_seniorproject/app/VolunteerOpportunity.java
UTF-8
908
2.609375
3
[]
no_license
package com.example.caseyschurman.vogo_seniorproject.app; import java.util.ArrayList; import java.util.List; /** * Created by casey.schurman on 3/1/2016. */ public class VolunteerOpportunity { private String mName; private ArrayList<String> mRelevantSkills; private String mOrganization; private String mAddress; public VolunteerOpportunity(String name, ArrayList<String> relevantSkills, String organization, String address) { mName = name; mRelevantSkills = relevantSkills; mOrganization = organization; mAddress = address; } public String getName() { return mName; } public ArrayList<String> getRelevantSkills(){ return mRelevantSkills; } public String getOrganization(){ return mOrganization; } public String getAddress(){ return mAddress; } }
true
7ac9d225af08b2ea0b16e6d83f6a8ceedf4dc742
Java
mreetyunjaya/super-cloudops
/super-devops-common/src/main/java/com/wl4g/devops/common/logging/TraceLoggingMDCFilter.java
UTF-8
8,983
1.8125
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2017 ~ 2025 the original author or authors. <wanglsir@gmail.com, 983708408@qq.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.wl4g.devops.common.logging; import org.slf4j.Logger; import org.slf4j.MDC; import org.springframework.context.ApplicationContext; import javax.servlet.*; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import static java.lang.String.format; import static java.lang.String.valueOf; import static java.lang.System.currentTimeMillis; import static org.apache.commons.lang3.StringUtils.contains; import static org.apache.commons.lang3.StringUtils.isBlank; import static com.wl4g.devops.common.logging.TraceLoggingMDCFilter.TraceMDCDefinition.*; import static com.wl4g.devops.components.tools.common.lang.Assert2.notNullOf; import static com.wl4g.devops.components.tools.common.log.SmartLoggerFactory.getLogger; import java.io.IOException; import java.util.Enumeration; import java.util.concurrent.atomic.AtomicLong; /** * Add the MDC parameter option to the logback log output. Note that this filter * should be placed before other filters as much as possible. By default, for * example, "requestid", "requestseq", "timestamp", "uri" will be added to the * MDC context.</br> * </br> * 1) Among them, requestid and requestseq are used for call chain tracking, and * developers usually do not need to modify them manually.</br> * </br> * 2) Timestamp is the time stamp when the request starts to be processed by the * servlet. It is designed to be the start time when the filter executes. This * value can be used to determine the efficiency of internal program * execution.</br> * </br> * 3) Uri is the URI value of the current request.</br> * * Use: We can use the variables in MDC through %X{key} in the layout section of * logback.xml, for example: vim application.yml * * <pre> * logging: * pattern: * console: ${logging.pattern.file} * #file: '%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID} --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}' * file: '%d{yy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:%4p} ${PID} [%t] <font color = red>[%X{_H_:X-Request-ID}] [%X{_H_:X-Request-Seq}] [%X{_C_:${spring.cloud.devops.iam.client.cookie.name}}]</font> - %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:%wEx}' * </pre> * * @author Wangl.sir <wanglsir@gmail.com, 983708408@qq.com> * @version v1.0 2020年2月26日 * @since */ public abstract class TraceLoggingMDCFilter implements Filter { public static final long DEFAULT_CACHE_REFRESH_MS = 500L; public static final String HEADER_REQUEST_ID = "X-Request-ID"; public static final String HEADER_REQUEST_SEQ = "X-Request-Seq"; final protected Logger log = getLogger(getClass()); /** * Spring application context. */ final protected ApplicationContext context; /** * Cache refresh timestamp. */ final private AtomicLong cacheRefreshLastTime = new AtomicLong(0); /** * Whether to enable the headers mapping. for example: * <b>%X{_C_:JSESSIONID}</b></br> */ protected boolean enableMappedCookies; /** * Whether to enable the headers mapping. for example: * <b>%X{_H_:X-Forwarded-For}</b></br> */ protected boolean enableMappedHeaders; /** * Whether to enable the headers mapping. for example: * <b>%X{_P_:userId}</b></br> */ protected boolean enableMappedParameters; public TraceLoggingMDCFilter(ApplicationContext context) { notNullOf(context, "applicationContext"); this.context = context; // Initializing mapped MDC configuration refreshMappedConfigIfNecessary(); } public boolean isEnableMappedCookies() { return enableMappedCookies; } public boolean isEnableMappedHeaders() { return enableMappedHeaders; } public boolean isEnableMappedParameters() { return enableMappedParameters; } @Override public void init(FilterConfig config) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; try { // Refreshing MDC mapped(If necessary). refreshMappedConfigIfNecessary(); // Set logging MDC setLoggingMDC(req); } catch (Exception e) { log.error(format("Could't set logging MDC. uri: %s", req.getRequestURI()), e); } try { chain.doFilter(request, response); } finally { MDC.clear(); // must } } @Override public void destroy() { } /** * Automatically set trace log MDC * * @param req */ protected void setLoggingMDC(HttpServletRequest req) { // Set basic MDC MDC.put(KEY_REQUEST_ID, req.getHeader(HEADER_REQUEST_ID)); String requestSeq = req.getHeader(HEADER_REQUEST_SEQ); MDC.put(KEY_REQUEST_SEQ, requestSeq); if (!isBlank(requestSeq)) { // seq will be like:000, real seq is the number of "0" String nextSeq = requestSeq + "0"; MDC.put(KEY_NEXT_REQUEST_SEQ, nextSeq); } else { MDC.put(KEY_NEXT_REQUEST_SEQ, "0"); } MDC.put(KEY_TIMESTAMP, valueOf(currentTimeMillis())); MDC.put(KEY_URI, req.getRequestURI()); // Set headers MDC if (isEnableMappedCookies()) { Enumeration<String> e = req.getHeaderNames(); if (e != null) { while (e.hasMoreElements()) { String header = e.nextElement(); String value = req.getHeader(header); MDC.put(KEY_PREFIX_HEADER + header, value); } } } // Set cookies MDC if (isEnableMappedCookies()) { Cookie[] cookies = req.getCookies(); if (cookies != null && cookies.length > 0) { for (Cookie cookie : cookies) { String name = cookie.getName(); String value = cookie.getValue(); MDC.put(KEY_PREFIX_COOKIE + name, value); } } } // Set parameters MDC if (isEnableMappedParameters()) { Enumeration<String> e = req.getParameterNames(); if (e != null) { while (e.hasMoreElements()) { String key = e.nextElement(); String value = req.getParameter(key); MDC.put(KEY_PREFIX_PARAMETER + key, value); } } } } /** * Refreshing MDC mapped by patterns, When the logging configuration is * modified, it can be updated in time * * @return */ protected boolean refreshMappedConfigIfNecessary() { long now = currentTimeMillis(); if ((now - cacheRefreshLastTime.get()) < DEFAULT_CACHE_REFRESH_MS) { return false; } String consolePattern = context.getEnvironment().getProperty("logging.pattern.console"); String filePattern = context.getEnvironment().getProperty("logging.pattern.file"); this.enableMappedCookies = isMappedMDCField(consolePattern, filePattern, KEY_PREFIX_COOKIE); this.enableMappedHeaders = isMappedMDCField(consolePattern, filePattern, KEY_PREFIX_HEADER); this.enableMappedParameters = isMappedMDCField(consolePattern, filePattern, KEY_PREFIX_PARAMETER); cacheRefreshLastTime.set(now); return true; } /** * * Check if MDC field is enabled. * * @param consolePattern * @param filePattern * @param mdcField * @return */ private boolean isMappedMDCField(String consolePattern, String filePattern, String mdcField) { // for example: %X{_C_:JSESSIONID} => %X{_C_: String mdcFieldFull = "%X{" + mdcField; return contains(consolePattern, mdcFieldFull) || contains(filePattern, mdcFieldFull); } /** * Tracking log dyeing MDC constants. * * @author Wangl.sir <wanglsir@gmail.com, 983708408@qq.com> * @version v1.0 2020年2月26日 * @since */ public static class TraceMDCDefinition { public static final String KEY_REQUEST_ID = "requestId"; public static final String KEY_REQUEST_SEQ = "requestSeq"; /** * When the tracking chain is distributed, the used SEQ is generated by * filter, and usually the developer does not need to modify it. */ public static final String KEY_NEXT_REQUEST_SEQ = "nextRequestSeq"; public static final String KEY_URI = "_uri_"; /** * Timestamp when the request enters the filter */ public static final String KEY_TIMESTAMP = "_timestamp_"; public static final String KEY_PREFIX_COOKIE = "_C_:"; public static final String KEY_PREFIX_HEADER = "_H_:"; public static final String KEY_PREFIX_PARAMETER = "_P_:"; } }
true
aedccfb32784a9d3382ab163481c03601cce4e0e
Java
fitflowappp/backend
/Yoga/src/main/java/com/magpie/getui/getui/service/MsgSender.java
UTF-8
274
1.65625
2
[]
no_license
package com.magpie.getui.getui.service; import com.magpie.getui.getui.cache.GetuiMessage; public interface MsgSender { public boolean send(String uid, GetuiMessage msg, boolean sendOffline); public boolean sendAll(GetuiMessage msg, boolean sendOffline); }
true
29a1fa3d3c775b8b84e15c2d7baf248b0d3f8709
Java
qsw1214/teachin
/src/main/java/com/dizhejiang/teachin/Service/impl/ReportServiceImpl.java
UTF-8
976
2.15625
2
[]
no_license
package com.dizhejiang.teachin.Service.impl; import com.dizhejiang.teachin.Service.ReportService; import com.dizhejiang.teachin.mapper.ReportMapper; import com.dizhejiang.teachin.model.Report; import com.dizhejiang.teachin.vo.ResponseVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; /** * @Author wuqi * @Date 2019/10/29 */ @Service public class ReportServiceImpl implements ReportService { @Autowired private ReportMapper reportMapper; @Override public ResponseVo myReport(Report report) { if(report.getTeachinId()==null){ return ResponseVo.error("宣讲会id不能为空"); } if(StringUtils.isEmpty( report.getType())){ return ResponseVo.error("举报类型不能为空"); } reportMapper.save(report); return ResponseVo.success("举报成功,等待审核!"); } }
true
d1da8d17556a923a2036408118ae54ea0a0a8105
Java
michal1188/Hosting_photos
/src/main/java/zaliczenie/Hosting_photos/gui/admin/ListaGaleriiGui.java
UTF-8
2,145
2.21875
2
[]
no_license
package zaliczenie.Hosting_photos.gui.admin; import com.vaadin.flow.component.UI; import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.combobox.ComboBox; import com.vaadin.flow.component.html.Anchor; import com.vaadin.flow.component.html.Label; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.router.Route; import org.springframework.beans.factory.annotation.Autowired; import zaliczenie.Hosting_photos.model.Galleria; import zaliczenie.Hosting_photos.model.Image; import zaliczenie.Hosting_photos.service.GalleryUploader; import zaliczenie.Hosting_photos.service.ImageUploader; import java.util.List; @Route("admin/lista_galerii") public class ListaGaleriiGui extends VerticalLayout { private ImageUploader imageUploader; private GalleryUploader galleryUploader; @Autowired public ListaGaleriiGui(GalleryUploader galleryUploader,ImageUploader imageUploader) { this.galleryUploader = galleryUploader; this.imageUploader=imageUploader; List<String>lista=galleryUploader.lista_gallerii(); /// List<Image> lista_zdj= imageUploader.lista_zdjec(); Label label= new Label("Lista Galerii"); add(label); for (int i=0;i<lista.size();i++){ Label label2= new Label(); Button button= new Button("Usuń"); int finalI = i; button.addClickListener(buttonClickEvent ->{ // for(Image im:lista_zdj){ // if(im.getGalleria().getId().equals(finalI)){ // imageUploader.delete_item(im.getId().intValue()); // } // } galleryUploader.delete_item(finalI); UI.getCurrent().getPage().reload(); label.setText("Usunięto galerie"); add(label); } ); label2.setText(lista.get(i)); add(label2); add(button); } Anchor logout = new Anchor("logout", "Log out"); add(logout); } }
true
112a254507dbf4728881ddf50547b8570090eea1
Java
q15751261559/Data-structure-and-algorithm
/src/Graph.java
UTF-8
414
1.976563
2
[]
no_license
public interface Graph<T> { int vertexCount(); T get(int i); void set(int i,T x); int insert(T x); void insert(int i,int j,int w); T remove(int i); void remove(int i,int j); int search(T key); T remove(T key); int weight(int i,int j); void DFSTraverse(int i); void BFSTraverse(int i); void minSpanTree(); void shortestPath(int i); void shortestPath(); }
true
ee90a9141010e0bc0d7fb83853778521b457e026
Java
junxigu/Examples
/ThinkingInJava/src/main/java/guerer/example/util/JGrep.java
UTF-8
585
3
3
[]
no_license
package guerer.example.util; import java.util.regex.Matcher; import java.util.regex.Pattern; //A very simple version of the "grep" program. // {Args: JGrep.java "\\b[Ssct]\\w+"} public class JGrep { public static void main(String[] args) throws Exception { if (args.length < 2) { Print.print("Usage: java JGrep file regex"); return; } Matcher m = Pattern.compile(args[1]).matcher(""); int index = 0; for (String line : new TextFile(args[0])) { m.reset(line); while (m.find()) { Print.print(index++ + ": " + m.group() + ": " + m.start()); } } } }
true
6386440bdd162f824a1355505aa8e64d05e57cb3
Java
wawaeasybuy/jobandroid
/Job_employer/app/src/main/java/com/example/ryo/job_employer/models/GetCodeBody.java
UTF-8
431
1.90625
2
[ "MIT" ]
permissive
package com.example.ryo.job_employer.models; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import java.io.Serializable; /** * Created by Administrator on 2015/12/5. */ @JsonIgnoreProperties(ignoreUnknown = true) public class GetCodeBody implements Serializable { public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String tel; }
true
98bb37e6e71ef496c8e035e92a6fb22154488616
Java
WaveZhou/MeiZhuangShop
/repository/shop/src/com/zx/service/ArticleTypeService.java
UTF-8
335
1.664063
2
[]
no_license
package com.zx.service; import java.util.List; import com.zx.vo.ArticleType; public interface ArticleTypeService { //获取所有的一级商品类型 List<ArticleType> findAllFirstArticleTypes(); //根据一级商品类型获取所有的二级商品类型 List<ArticleType> findAllSecondArticleTypes(String firstTypeCode); }
true
4379740b82d30b806a9124ed7f58fc1cb1fa8e8b
Java
ArchkWay/brewmapp
/app/src/main/java/com/brewmapp/data/db/contract/UiSettingRepo.java
UTF-8
494
1.835938
2
[]
no_license
package com.brewmapp.data.db.contract; import com.brewmapp.data.entity.UiSettingContainer; import ru.frosteye.ovsa.data.storage.Repo; /** * Created by Kras on 13.10.2017. */ public interface UiSettingRepo extends Repo<UiSettingContainer> { int getnActiveFragment(); void setActiveFragment(int nActiveFragment); void setnActiveTabEventFragment(int nActiveTabEventFragment ); int getnActiveTabEventFragment(); void setIsOnLine(boolean online); boolean isOnLine(); }
true
059cf1410d713f4417db59368ab61f56321c79db
Java
ziqin/fastjson
/src/test/java/com/alibaba/json/bvt/issue_2100/Issue2189.java
UTF-8
725
1.96875
2
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
package com.alibaba.json.bvt.issue_2100; import com.alibaba.fastjson.JSONPath; import junit.framework.TestCase; public class Issue2189 extends TestCase { public void test_for_issue() throws Exception { String str = "[{\"id\":\"1\",\"name\":\"a\"},{\"id\":\"2\",\"name\":\"b\"}]"; assertEquals("[\"1\",\"2\"]", JSONPath.extract(str, "$.*.id") .toString() ); } public void test_for_issue_1() throws Exception { String str = "[{\"id\":\"1\",\"name\":\"a\"},{\"id\":\"2\",\"name\":\"b\"}]"; assertEquals("[\"2\"]", JSONPath.extract(str, "$.*[?(@.name=='b')].id") .toString() ); } }
true
42b8ed0e1a9edb115fcee1c9a8e91a3013f63eaa
Java
isolatelearn/attendance
/src/main/java/com/hjy/service/employeeService.java
UTF-8
3,235
2.59375
3
[]
no_license
package com.hjy.service; import com.hjy.entity.employee; import com.hjy.repository.EmployeeRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.lang.reflect.Array; import java.util.*; @Service public class employeeService { @Autowired private EmployeeRepository EmployeeRepository; //登录接口 public Map login(String password, String num) { employee emp = EmployeeRepository.findByPasswordAndNum(password,num); System.out.println(password); System.out.println(num); Map<Object, Object> map = new HashMap<>(); if(emp != null){ int id = emp.getId(); String username = emp.getUsername(); String department = emp.getDepartment(); map.put("code","200"); map.put("msg","登录成功"); map.put("id",id); map.put("name",username); map.put("department",department); }else{ map.put("code","400"); map.put("msg","登录失败"); } return map; } // 个人信息 public employee getMsg(int id){ employee res = EmployeeRepository.findById(id).get(); return res; } // 修改个人信息 public Map editOrAddMsg(employee body){ Map<Object, Object> map = new HashMap<>(); employee emp = new employee(); emp.setId(body.getId()); emp.setDepartment(body.getDepartment());//部门 1 emp.setGender(body.getGender());//性别 2 emp.setNum(body.getNum());//登录账号 员工编号 3 emp.setPassword(body.getPassword());//登录密码 4 emp.setPosition(body.getPosition());//职位 5 emp.setRole(body.getRole());//角色 6 emp.setUsername(body.getUsername());//姓名 7 emp.setPhone(body.getPhone());//电话号码 8 emp.setAddress(body.getAddress());//地址 9 emp.setEmail(body.getEmail());//邮件 10 emp.setJointime(body.getJointime());//入职时间 11 emp.setAge(body.getAge()); //年龄 employee emp2 = EmployeeRepository.save(emp); map.put("msg","成功"); map.put("code","200"); return map; } // 展示所有员工信息 public List<employee> showEmployee (){ List<employee> obj = EmployeeRepository.findAll(); return obj; } // 按照名字搜索某个员工 public Map findByUsernameLike (String name){ Map<Object, Object> map = new HashMap<>(); List<employee> emp= EmployeeRepository.findAllByUsernameLike(name); if(emp != null){ map.put("code","200"); map.put("data",emp); }else{ map.put("code","400"); map.put("data","查询失败"); } return map; } // 删除员工 public Map deleteByIds(int id) { Map<Object, Object> map = new HashMap<>(); EmployeeRepository.deleteById(id); map.put("msg","删除成功"); map.put("code","200"); return map; } }
true
d972b0173a39c590a0af04e6d6490bdda2b951db
Java
fbeautyleg/EatingHelper
/app/src/main/java/com/hy/eatinghelper/quickopen/http/code/ErrorCode.java
UTF-8
2,441
2.4375
2
[]
no_license
package com.hy.eatinghelper.quickopen.http.code; import com.hy.eatinghelper.quickopen.utils.toast.ToastUtils; /** * Created by huyin on 2017/9/17. */ public class ErrorCode { public static int errorCode; public static void handleHeaderCode(int headerCode) { switch (headerCode) { case 1: ToastUtils.toast("服务器内部错误,请再次请求"); break; case 2: ToastUtils.toast("服务暂不可用,请再次请求"); break; case 3: ToastUtils.toast("调用的API不存在,请检查后重新尝试"); break; case 4: ToastUtils.toast("集群超限额"); break; case 6: ToastUtils.toast("无权限访问该用户数据"); break; case 17: ToastUtils.toast("每天请求量超限额"); break; case 18: ToastUtils.toast("QPS超限额"); break; case 100: ToastUtils.toast("无效的access_token参数,请检查后重新尝试"); break; case 110: ToastUtils.toast("access_token无效"); break; case 111: ToastUtils.toast("access token过期"); break; case 282000: ToastUtils.toast("服务器内部错误,请再次请求"); break; case 282004: ToastUtils.toast("请求参数格式不正确"); break; case 282900: ToastUtils.toast("必传字段为空"); break; case 282901: ToastUtils.toast("场景ID校验失败,请确认console中app和场景是否关联"); break; case 282902: ToastUtils.toast("UNIT环境启动中,请稍后再试"); break; case 282903: ToastUtils.toast("UNIT系统异常"); break; default: ToastUtils.toast("未知错误"); break; } } }
true
b2a3aa05c14488130398ae2b0118f79244c3a245
Java
EstebanDalelR/tinderAnalysis
/apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/google/android/m4b/maps/StreetViewPanoramaOptions.java
UTF-8
4,978
1.90625
2
[]
no_license
package com.google.android.m4b.maps; import android.os.Parcel; import com.google.android.m4b.maps.model.LatLng; import com.google.android.m4b.maps.model.StreetViewPanoramaCamera; import com.google.android.m4b.maps.p111k.C5468c; import com.google.android.m4b.maps.p124x.C5534a; public final class StreetViewPanoramaOptions implements C5468c { public static final StreetViewPanoramaOptionsCreator CREATOR = new StreetViewPanoramaOptionsCreator(); /* renamed from: a */ private final int f23599a; /* renamed from: b */ private StreetViewPanoramaCamera f23600b; /* renamed from: c */ private String f23601c; /* renamed from: d */ private LatLng f23602d; /* renamed from: e */ private Integer f23603e; /* renamed from: f */ private Boolean f23604f; /* renamed from: g */ private Boolean f23605g; /* renamed from: h */ private Boolean f23606h; /* renamed from: i */ private Boolean f23607i; /* renamed from: j */ private Boolean f23608j; public final int describeContents() { return 0; } StreetViewPanoramaOptions(int i, StreetViewPanoramaCamera streetViewPanoramaCamera, String str, LatLng latLng, Integer num, byte b, byte b2, byte b3, byte b4, byte b5) { this.f23604f = Boolean.valueOf(true); this.f23605g = Boolean.valueOf(true); this.f23606h = Boolean.valueOf(true); this.f23607i = Boolean.valueOf(true); this.f23599a = i; this.f23600b = streetViewPanoramaCamera; this.f23602d = latLng; this.f23603e = num; this.f23601c = str; this.f23604f = C5534a.m24048a(b); this.f23605g = C5534a.m24048a(b2); this.f23606h = C5534a.m24048a(b3); this.f23607i = C5534a.m24048a(b4); this.f23608j = C5534a.m24048a(b5); } public final void writeToParcel(Parcel parcel, int i) { StreetViewPanoramaOptionsCreator.m20406a(this, parcel, i); } /* renamed from: a */ final int m27653a() { return this.f23599a; } /* renamed from: b */ final byte m27654b() { return C5534a.m24047a(this.f23604f); } /* renamed from: c */ final byte m27655c() { return C5534a.m24047a(this.f23605g); } /* renamed from: d */ final byte m27656d() { return C5534a.m24047a(this.f23606h); } /* renamed from: e */ final byte m27657e() { return C5534a.m24047a(this.f23607i); } /* renamed from: f */ final byte m27658f() { return C5534a.m24047a(this.f23608j); } public StreetViewPanoramaOptions() { this.f23604f = Boolean.valueOf(true); this.f23605g = Boolean.valueOf(true); this.f23606h = Boolean.valueOf(true); this.f23607i = Boolean.valueOf(true); this.f23599a = 1; } public final StreetViewPanoramaOptions panoramaCamera(StreetViewPanoramaCamera streetViewPanoramaCamera) { this.f23600b = streetViewPanoramaCamera; return this; } public final StreetViewPanoramaOptions panoramaId(String str) { this.f23601c = str; return this; } public final StreetViewPanoramaOptions position(LatLng latLng) { this.f23602d = latLng; return this; } public final StreetViewPanoramaOptions position(LatLng latLng, Integer num) { this.f23602d = latLng; this.f23603e = num; return this; } public final StreetViewPanoramaOptions userNavigationEnabled(boolean z) { this.f23604f = Boolean.valueOf(z); return this; } public final StreetViewPanoramaOptions zoomGesturesEnabled(boolean z) { this.f23605g = Boolean.valueOf(z); return this; } public final StreetViewPanoramaOptions panningGesturesEnabled(boolean z) { this.f23606h = Boolean.valueOf(z); return this; } public final StreetViewPanoramaOptions streetNamesEnabled(boolean z) { this.f23607i = Boolean.valueOf(z); return this; } public final StreetViewPanoramaOptions useViewLifecycleInFragment(boolean z) { this.f23608j = Boolean.valueOf(z); return this; } public final StreetViewPanoramaCamera getStreetViewPanoramaCamera() { return this.f23600b; } public final LatLng getPosition() { return this.f23602d; } public final Integer getRadius() { return this.f23603e; } public final String getPanoramaId() { return this.f23601c; } public final Boolean getUserNavigationEnabled() { return this.f23604f; } public final Boolean getZoomGesturesEnabled() { return this.f23605g; } public final Boolean getPanningGesturesEnabled() { return this.f23606h; } public final Boolean getStreetNamesEnabled() { return this.f23607i; } public final Boolean getUseViewLifecycleInFragment() { return this.f23608j; } }
true
21083cd0eab6d13eb09b5075178a2f64af8e935c
Java
BasicStore/RP3_Struts_3rd
/WEB-INF/src/com/fdm/shopping/DataModel.java
UTF-8
241
1.945313
2
[]
no_license
package com.fdm.shopping; public class DataModel { private int id; public DataModel() { } public int getId() { return id; } public void setId(int id) { this.id = id; } }
true
2173b1e74029213d9f72cd8e0d41b448a44dbf8c
Java
pudenko/IdeaProjects
/008_exeption/src/com/lessons/igor/ex013/Main.java
UTF-8
740
3.40625
3
[]
no_license
package com.lessons.igor.ex013; class MyExeption extends Exception { public MyExeption(String s) { super(s); } } class MyExeption2 extends Exception { public MyExeption2(String s) { super(s); } } public class Main { public static void main(String[] args) { try { if (1 == 1) throw new Exception("test1"); if (1 == 1) throw new MyExeption("test2"); throw new MyExeption2("test3"); } catch (MyExeption2 e) { System.out.println(e.getMessage()); } catch (MyExeption e) { System.out.println(e.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); } } }
true
7c8cc29aa6789b45c03b3c8f77de6e502b4b6331
Java
HarkerRobo/RoboCode2018
/src/org/usfirst/frc/team1072/robot/commands/v2/LowLevelCommand.java
UTF-8
552
2.265625
2
[]
no_license
package org.usfirst.frc.team1072.robot.commands.v2; import org.usfirst.frc.team1072.robot.Robot; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; /** * @author joel * */ public class LowLevelCommand extends SetElevatorCommand { /** * @param height */ public LowLevelCommand(double height) { super(height); } /* (non-Javadoc) * @see org.usfirst.frc.team1072.robot.commands.v2.SetElevatorCommand#initialize() */ @Override protected void initialize() { Robot.intake.getRaise().set(Value.kForward); super.initialize(); } }
true
1f83999882fd94375dbf4019fe42559a9f7be621
Java
rseiler/lcmip
/lcmip-demo/src/main/java/at/rseiler/lcmip/demo/UnusedClass.java
UTF-8
205
2.421875
2
[ "Apache-2.0" ]
permissive
package at.rseiler.lcmip.demo; public class UnusedClass { private static final String NOT_IMPORTANT = "not important"; public void unused() { System.out.println(NOT_IMPORTANT); } }
true
3b53d7c8a2533315bf964ebda306a6bbbc58a870
Java
hanadbruno/tst
/src/test/java/TestRomanTest.java
UTF-8
545
2.890625
3
[]
no_license
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class TestRomanTest { @Test public void fromOneToI() { assertEquals("I", new RomanNumbers().toRoman(1)); } @Test public void fromTwoToII() { assertEquals("II", new RomanNumbers().toRoman(2)); } @Test public void fromThreeToIII() { assertEquals("III", new RomanNumbers().toRoman(3)); } @Test public void fromFourToIV() { assertEquals("IV", new RomanNumbers().toRoman(4)); } }
true
134971b6910dbef7a6ff4d20bd77ea2023686575
Java
mintchocoicecream/SOULMOVIE
/mapper/HomeMapper.java
UTF-8
933
2.03125
2
[]
no_license
package com.soulmovie.mapper; import java.util.List; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import com.soulmovie.vo.MovieVO; public interface HomeMapper { @Insert({"INSERT INTO USER1 VALUES(MY_GET_SEQ_NUMBER, #{obj.username}, ", "#{obj.password}, #{obj.role}, SYSDATE)"}) public int insertMember(@Param("obj") MovieVO obj); // @Select({"SELECT * FROM" , // " (SELECT " , // " MOVIE_CODE, MOVIE_TITLE, MOVIE_DATE, MOVIE_NATION, MOVIE_GENRE, MOVIE_DIRECTOR, MOVIE_ACTOR, MOVIE_CNT, MOVIE_FREQ" , // " ROW_NUMBER() OVER (ORDER BY MOVIE_CNT DESC) ROWN " , // " FROM " , // " MOVIE" , // " WHERE)" , // " WHERE ROWN BETWEEN 1 AND 6"}) // public List<MovieVO> homeMovie(); @Select({"SELECT MOVIE_CODE, MOVIE_IMG FROM MOVIE WHERE MOVIE_CODE=#{no}"}) public MovieVO selectBoardImg1(int no); }
true
006ea2c8c9a64122f363e377cdc80e490e9e8250
Java
leon-pash-ok/ChipProject
/src/main/java/com/leonpasha/corp/chip/chip_generator/ChipGenerator.java
UTF-8
1,544
3
3
[]
no_license
package com.leonpasha.corp.chip.chip_generator; import com.leonpasha.corp.chip.pojo.Chip; import com.leonpasha.corp.chip.pojo.ChipTypeOfCargo; import java.security.InvalidParameterException; import java.util.Optional; import java.util.Random; public class ChipGenerator { private static int maxCountOfShip = 10; private static int countOfCreatedShip = 0; public static Optional<Chip> generateChip(){ if ( !isEnough()) { ChipTypeOfCargo cargo = generateTypeOfCargo(generateInt()); int roominess = generateRoominess(generateInt()); Chip chip = new Chip(cargo, roominess); System.out.println("New chip created. " + chip.toString()); countOfCreatedShip++; System.out.println("countOfCreatedShip = " + countOfCreatedShip); return Optional.of(chip); } else{ return Optional.empty(); } } private static int generateInt(){ Random random = new Random(); return random.nextInt(3) + 1; } private static ChipTypeOfCargo generateTypeOfCargo(int num){ return ChipTypeOfCargo.getType(num); } private static int generateRoominess(int num){ switch (num){ case 1: return 10; case 2: return 50; case 3: return 100; default: throw new InvalidParameterException("Invalid number: " + num); } } public static boolean isEnough(){ return maxCountOfShip < countOfCreatedShip; } }
true
04431a9973cf25d43ffe30fbf1a875e5b10f1cf0
Java
Drilonpacarizi/VacumCleaner
/Vacum.java
UTF-8
8,915
2.84375
3
[]
no_license
import java.util.ArrayList; import java.util.Arrays; public class Vacum { public int leviz() { return (int) (Math.random() * 3.9); } public int leviz(int l) { int answer = (int) (Math.random() * 3.9); while (answer == l) { answer = (int) (Math.random() * 3.9); } return answer; } public String[][] harta(String[][] h,String [][]harta, int i, int j, int d) { String[][] rez = harta; if(!kontrolloMurin(i,j,d)){ return rez; } if (d == 0) { rez[i - 1][j] = h[i - 1][j]; if (rez[i - 1][j] == " M ") { rez[i - 1][j] = "[ ]"; } } else { if (d == 1) { rez[i + 1][j] = h[i + 1][j]; if (rez[i + 1][j] == " M ") { rez[i + 1][j] = "[ ]"; } } else { if (d == 2 ) { rez[i][j + 1] = h[i][j + 1]; if (rez[i][j + 1] == " M ") { rez[i][j + 1] = "[ ]"; } } else { if (d == 3) { rez[i][j - 1] = h[i][j - 1]; if (rez[i][j - 1] == " M ") { rez[i][j - 1] = "[ ]"; } } } } } return rez; } public boolean kontrolloMurin(int i, int j, int d) { boolean answer = false; switch (d) { case 0: { i--; break; } case 1: { i++; break; } case 2: { j++; break; } case 3: { j--; break; } default: break; } if (i <= 9 && i >= 0) { if (j <= 9 && j >= 0) { answer = true; } } return answer; } public boolean kontrolloPengesen(String[][] h, int i, int j, int d) { boolean answer = false; boolean p = true; switch (d) { case 0: { if (!kontrolloMurin(i, j, 0)) { p = false; break; } i--; break; } case 1: { if (!kontrolloMurin(i, j, 1)) { p = false; break; } i++; break; } case 2: { if (!kontrolloMurin(i, j, 2)) { p = false; break; } j++; break; } case 3: { if (!kontrolloMurin(i, j, 3)) { p = false; break; } j--; break; } default: break; } if (h[i][j] != " P " && h[i][j] != null) { answer = true; } return answer; } public ArrayList<Integer>[] mbaroLojen(String[][] h, int x, int y) { ArrayList<Integer> levizjet = new ArrayList<>(); Fillimi: for (int i = 0; i < 10000; i++) { int d = leviz(); int c = 0; while (!(kontrolloPengesen(h, x, y, d) && kontrolloMurin(x, y, d))) { //while(!kontrolloMurin(x,y,d)){ d = leviz(d); c++; if (c > 100) break Fillimi; } c = 0; switch (d) { case 0: { x--; break; } case 1: { x++; break; } case 2: { y++; break; } case 3: { y--; break; } default: break; } levizjet.add(d); if (x == 0 && y == 0) { //System.out.println(x + " " + y + " " + i); break; } } ArrayList<Integer> rez = new ArrayList<>(); rez.add(x); rez.add(y); return new ArrayList[]{rez, levizjet}; } public ArrayList<Integer>[] min(String[][] harta,int x,int y) { Vacum v = new Vacum(); int numri = 10000; String[][] matrica = harta; ArrayList<Integer>[][] vargu = new ArrayList[numri][2]; for (int i = 0; i < numri; i++) { vargu[i] = v.mbaroLojen(matrica, x, y); } int min = 10000; int index = 0; for (int i = 0; i < numri; i++) { if (vargu[i][0].get(0).intValue() == 0 && vargu[i][0].get(1).intValue() == 0) if (min > vargu[i][1].size()) { min = vargu[i][1].size(); index = i; } } /*if (min == 10000) { System.out.println("Pas 10000 hapave ju nuk keni gjetur zgjidhjen"); } else { System.out.println("Indexi i rastit me te mire eshte: " + index + "\n" + "Minimumi i levizjeve eshte: " + min); }*/ return vargu[index]; } public void fshijDhomen(String[][] h) { int count = 0; int denimi = -1000; int trosha = 0; int x = 0, y = 0; String[][] harta = new String[10][10]; Fillimi: for (int i = 0; (i < 2000)&&(count<2000)&&(trosha<33); i++) { int d = leviz(); int c = 0; while (!(kontrolloPengesen(h, x, y, d) && kontrolloMurin(x, y, d))) { harta = harta(h,harta, x, y, d); d = leviz(d); count++; denimi--; c++; if (c > 100) { break Fillimi; } } harta = harta(h,harta, x, y, d); /*c = 0;*/ switch (d) { case 0: { x--; break; } case 1: { x++; break; } case 2: { y++; break; } case 3: { y--; break; } default: break; } count++; if (h[x][y] == " M ") { h[x][y] = "[ ]"; trosha++; denimi+=10; } else{ denimi-=1; } /* System.out.println(d);*/ } System.out.println("Dhoma e paster eshte: \n"); for(String [] k : h) { for (String k1 : k) { System.out.print(k1 + " "); } System.out.println(); } System.out.println("Pozita ku ka perfundu fshirjen e dhomes: "+ x+" "+y); System.out.println(); System.out.println("Dhoma ne memorien e fshises"); for(String [] k : harta) { for (String k1 : k) { System.out.print(k1 + " "); } System.out.println(); } System.out.println("\n"); ArrayList<Integer>[] v =min(harta,x,y); System.out.println("Levizjet per tu kthyer mrapa: "+v[1].toString()); System.out.println("Numri i hapave per ta fshire dhomen eshte "+count+ "\nNumri i hapave per tu kthyer mrapa eshte: "+ v[1].size()); if(v[0].size()==10000){ System.out.println("Maximumi eshte 10000"); } else if(v[0].size()<10000) denimi = denimi+1000; System.out.println("Denimi eshte : "+denimi); } public static void main(String[] args) { World c = new World(); Vacum v = new Vacum(); String[][] matrica = c.ktheMatricen(); System.out.println("Dhoma per tu fshire eshte"); for (int i = 0; i < matrica.length; i++) { for (int j = 0; j < matrica[0].length; j++) { System.out.print(matrica[i][j] + " "); } System.out.println(); } //System.out.println(Arrays.toString(v.min())); v.fshijDhomen(matrica); } }
true
3fa416a95c7d45162a0d840adcbe977343649cbc
Java
d-khvoia/kaylemains
/src/main/java/com/cybertournaments/kaylemains/exception/MatchNotFoundException.java
UTF-8
214
2.046875
2
[]
no_license
package com.cybertournaments.kaylemains.exception; public class MatchNotFoundException extends RuntimeException { public MatchNotFoundException(Long id) { super("Could not find match " + id); } }
true
75af019c5014ed93016454ae7092b395a5c36a24
Java
gyoogle/gs_Algorithm
/Algorithm(Study)/문제 풀이/swexpert&정올/역량테스트/Solution_1949_등산로조성_김규석.java
UTF-8
2,608
3.09375
3
[]
no_license
package SW; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class Solution_1949_등산로조성_김규석 { static class San{ int y; int x; San(int y, int x){ this.y = y; this.x = x; } } static int N,K; static int[][] map; static boolean[][] visited; static int[] dy = {0,0,-1,1}; static int[] dx = {-1,1,0,0}; static ArrayList<San> san; static int max = 0; static int cnt; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ts = Integer.parseInt(br.readLine().trim()); for (int t = 1; t <= ts; t++) { StringTokenizer st = new StringTokenizer(br.readLine().trim(), " "); N = Integer.parseInt(st.nextToken()); // 지도 한 변 길이 K = Integer.parseInt(st.nextToken()); // 공사 가능 깊이 map = new int[N][N]; max = Integer.MIN_VALUE; int maxHeight = 0; // 가장 큰 지형 높이 찾기 for (int i = 0; i < N; i++) { st = new StringTokenizer(br.readLine().trim(), " "); for (int j = 0; j < N; j++) { map[i][j] = Integer.parseInt(st.nextToken()); if(maxHeight < map[i][j]) maxHeight = map[i][j]; } } san = new ArrayList<>(); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if(map[i][j] == maxHeight) san.add(new San(i,j)); } } visited = new boolean[N][N]; for (int i = 0; i < san.size(); i++) { San s = san.get(i); cnt = 1; for (int j = 0; j < N; j++) { for (int z = 0; z < N; z++) { for (int k = K; k >= 0; k--) { map[j][z] -= k; visited[s.y][s.x] = true; dfs(s.y, s.x, cnt); visited[s.y][s.x] = false; map[j][z] += k; } } } } System.out.println("#"+t+" " + max); } } static public void dfs(int y, int x, int len) { if(max < len) { max = len; } for (int i = 0; i < 4; i++) { int ny = y + dy[i]; int nx = x + dx[i]; if(ny>=0 && nx>=0 && ny<N && nx<N && !visited[ny][nx]) { if(map[ny][nx] < map[y][x]){ visited[ny][nx] = true; dfs(ny, nx, len+1); visited[ny][nx] = false; } } } } static public boolean checking(int y, int x) { for (int i = 0; i < 4; i++) { int ny = y + dy[i]; int nx = x + dx[i]; if(ny>=0 && nx>=0 && ny<N && nx<N) { if(map[ny][nx] < map[y][x] && !visited[ny][nx]) continue; else return false; } } return true; } }
true
9d8f2746f20e811b8143ff63f3cb14f7c399ec08
Java
Tay-Dz/ICE_Final
/src/test/java/com/qa/choonz/Cuke/AlbumPageTest.java
UTF-8
4,723
2.140625
2
[ "MIT" ]
permissive
package com.qa.choonz.Cuke; import static org.assertj.core.api.Assertions.assertThat; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; public class AlbumPageTest { WebDriver driver; WebDriverWait wait; Actions action; @Before("@tagAlbum") public void init() { System.setProperty("webdriver.edge.driver","C:\\Users\\taydz\\Desktop\\Choonz-Starter-master\\src\\test\\resources\\msedgedriver.exe"); driver = new EdgeDriver(); wait = new WebDriverWait(driver,15); action = new Actions(driver); } @Given("I am logged in and on the Album page") public void logged_in_and_on_Album_page() throws Throwable { driver.get("http://127.0.0.1:5500/src/main/resources/static/html/Album.html?user=1"); } @Given("I am not logged in and on the Album page") public void not_logged_in_and_on_Album_page() throws Throwable { driver.get("http://127.0.0.1:5500/src/main/resources/static/html/Album.html"); } @When("I click on the Album with id {int}") public void select_Album(int id) throws Throwable { WebElement AlbumRow = driver.findElement(By.id("AlbumRow"+id)); action.moveToElement(AlbumRow); WebElement AlbumLink = driver.findElement(By.id("ViewAlbumButton"+id)); wait.until(ExpectedConditions.visibilityOf(AlbumLink)); wait.until(ExpectedConditions.elementToBeClickable(AlbumLink)); AlbumLink.click(); } @When("I open the album side bar and select Albums by {int}") public void select_by_artist(int artistID) throws Throwable { WebElement openFilter = driver.findElement(By.id("FilterByBTN")); wait.until(ExpectedConditions.visibilityOf(openFilter)); wait.until(ExpectedConditions.elementToBeClickable(openFilter)); openFilter.click(); WebElement OrderLink = driver.findElement(By.id("Order_Artist"+artistID)); wait.until(ExpectedConditions.visibilityOf(OrderLink)); wait.until(ExpectedConditions.elementToBeClickable(OrderLink)); OrderLink.click(); } @When("I open the album side bar and select {int} Albums") public void select_by_genre(int genreID) throws Throwable { WebElement openFilter = driver.findElement(By.id("FilterByBTN")); wait.until(ExpectedConditions.visibilityOf(openFilter)); wait.until(ExpectedConditions.elementToBeClickable(openFilter)); openFilter.click(); WebElement OrderLink = driver.findElement(By.id("Order_Genre"+genreID)); wait.until(ExpectedConditions.visibilityOf(OrderLink)); wait.until(ExpectedConditions.elementToBeClickable(OrderLink)); OrderLink.click(); } @Then("I will be on the Album page with album id {int} and not be logged in") public void assert_not_logged_in_on_albums_page(int id) throws Throwable { assertThat(driver.getCurrentUrl()).isEqualTo("http://127.0.0.1:5500/src/main/resources/static/html/Track.html?user=0&albums="+id); } @Then("I will be on the Album page with album id {int} and be logged in") public void assert_logged_in_on_albums_page(int id) throws Throwable { assertThat(driver.getCurrentUrl()).isEqualTo("http://127.0.0.1:5500/src/main/resources/static/html/Track.html?user=1&albums="+id); } @Then("I will be on the Artists page for {int} and not be logged in") public void assert_not_logged_in_on_artists_page(int id) throws Throwable { assertThat(driver.getCurrentUrl()).isEqualTo("http://127.0.0.1:5500/src/main/resources/static/html/Album.html?user=0&artists="+id); } @Then("I will be on the Artists page for {int} and be logged in") public void assert_logged_in_on_artists_page(int id) throws Throwable { assertThat(driver.getCurrentUrl()).isEqualTo("http://127.0.0.1:5500/src/main/resources/static/html/Album.html?user=1&artists="+id); } @Then("I will be on the Genre page for {int} and not be logged in") public void assert_not_logged_in_on_genres_page(int id) throws Throwable { assertThat(driver.getCurrentUrl()).isEqualTo("http://127.0.0.1:5500/src/main/resources/static/html/Album.html?user=0&genres="+id); } @Then("I will be on the Genre page for {int} and be logged in") public void assert_logged_in_on_genres_page(int id) throws Throwable { assertThat(driver.getCurrentUrl()).isEqualTo("http://127.0.0.1:5500/src/main/resources/static/html/Album.html?user=1&genres="+id); } @After("@tagAlbum") public void quit() { driver.quit(); } }
true
652c622176df59ec87a9283c7b14a70f58dddca6
Java
Nur137/Android-Projects
/Mongla Port Authority/app/src/main/java/com/example/nur/monglaport/UI/Containers.java
UTF-8
7,385
2.03125
2
[]
no_license
package com.example.nur.monglaport.UI; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.KeyEvent; import android.widget.ListView; import android.widget.Toast; import com.example.nur.monglaport.Class.Config; import com.example.nur.monglaport.Class.Container; import com.example.nur.monglaport.Class.ContainerArrayAdapter; import com.example.nur.monglaport.Local_Database.Containersdb; import com.example.nur.monglaport.R; import com.firebase.client.Firebase; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; public class Containers extends AppCompatActivity { int i,t_d,t_r,f_d,f_r; ListView lis; Firebase firebase; ArrayList<Container> containers; ArrayList<String> str; private static final String HTML_TAG_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>"; String res; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_containers); lis=(ListView)findViewById(R.id.lst); firebase = new Firebase(Config.FIREBASE_URL); containers = new ArrayList<Container>(); str=new ArrayList<String>(); res=new String(); Containersdb containersdb=new Containersdb(Containers.this); try { containersdb.open(); containers=containersdb.getData(); containersdb.close(); set_list(); } catch (SQLException e) { e.printStackTrace(); } if(isInternetConnected(Containers.this)==false) { Toast.makeText(Containers.this,"You are seeing offline data",Toast.LENGTH_SHORT).show(); } else { new doit().execute(); } } public class doit extends AsyncTask<Void, Void, Void> { String words = new String(); @Override protected Void doInBackground(Void... params) { try { Document doc = Jsoup.connect("http://www.mpa.gov.bd/site/page/df5cde85-f5dd-4623-b445-7a0d044d1dba/container").get(); Elements elements=doc.select("div[id*=printable_area"); for (Element x : elements) { words += x.getElementsByTag("table"); } words = words.replace("&amp;", "&"); words = words.replace("&nbsp;", ""); for (i = 0; i < words.length(); i++) { String x = new String(); if (words.charAt(i) == '<' && words.charAt(i + 1) == 't' && words.charAt(i + 2) == 'd') { while(words.charAt(i)!='>')i++; while (!(words.charAt(i) == '<' && words.charAt(i+1) == '/' && words.charAt(i+2) == 't')) { res += words.charAt(i); x += words.charAt(i); i++; } String d=new String(); int mc=0,k,ln=x.length(); for(k=0;k<ln;k++) { if(mc==2)d+=x.charAt(k); if(x.charAt(k)=='>')mc++; if(x.charAt(k)=='<' && mc==2)mc=0; } d=d.replaceAll("<",""); str.add(d); } } Containersdb containersdb=new Containersdb(Containers.this); try { containersdb.open(); containersdb.delete_all(); containersdb.close(); } catch (SQLException e) { e.printStackTrace(); } t_d=t_r=f_d=f_r=0; for (i = 11; i < str.size()-21; i += 8) { Container container=new Container(); container.setSlno(str.get(i)); container.setA_name(str.get(i+1)); container.setTwd(str.get(i+2)); container.setTwr(str.get(i+3)); container.setFord(str.get(i+4)); container.setForr(str.get(i+5)); t_d+=Integer.parseInt(str.get(i+2).trim()); t_r+=Integer.parseInt(str.get(i+3).trim()); f_d+=Integer.parseInt(str.get(i+4).trim()); f_r+=Integer.parseInt(str.get(i+5).trim()); Containersdb contdb=new Containersdb(Containers.this); try { contdb.open(); contdb.createEntry(str.get(i),str.get(i+1),str.get(i+2),str.get(i+3),str.get(i+4),str.get(i+5)); contdb.close(); } catch (SQLException e) { e.printStackTrace(); } containers.add(container); } Container cont=new Container(); cont.setSlno("Total"); cont.setA_name(" "); cont.setTwd(Integer.toString(t_d)); cont.setTwr(Integer.toString(t_r)); cont.setFord(Integer.toString(f_d)); cont.setForr(Integer.toString(f_r)); containers.add(cont); Containersdb contdb2=new Containersdb(Containers.this); try { contdb2.open(); contdb2.createEntry("Total"," ",Integer.toString(t_d),Integer.toString(t_r),Integer.toString(f_d),Integer.toString(f_r)); contdb2.close(); } catch (SQLException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void avoid) { super.onPostExecute(avoid); res=Integer.toString(words.length()); Toast.makeText(Containers.this, "Data updated", Toast.LENGTH_SHORT).show(); Containersdb containersdb=new Containersdb(Containers.this); try { containersdb.open(); containers=containersdb.getData(); containersdb.close(); set_list(); } catch (SQLException e) { e.printStackTrace(); } } } public void set_list() { ContainerArrayAdapter eq=new ContainerArrayAdapter(this,containers); lis.setAdapter(eq); } public static boolean isInternetConnected(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); } }
true
01ffaddbe5f5b9e673f003ba9d1e4b1710e128fa
Java
uchachaduneli/hr
/src/main/java/ge/economy/hr/dto/SysUserGroupDTO.java
UTF-8
1,506
2.375
2
[]
no_license
/* * 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 ge.economy.hr.dto; import com.fasterxml.jackson.annotation.JsonInclude; import ge.economy.hr.model.SysUserGroup; import java.util.ArrayList; import java.util.List; /** * @author uchachaduneli */ @JsonInclude(JsonInclude.Include.ALWAYS) public class SysUserGroupDTO { private Integer id; private Integer userId; private Integer groupId; public static SysUserGroupDTO parse(SysUserGroup obj) { SysUserGroupDTO objDTO = new SysUserGroupDTO(); objDTO.setId(obj.getId()); objDTO.setUserId(obj.getUserId()); objDTO.setGroupId(obj.getGroupId()); return objDTO; } public static List<SysUserGroupDTO> parseToList(List<SysUserGroup> list) { List<SysUserGroupDTO> dTOs = new ArrayList<SysUserGroupDTO>(); for (SysUserGroup p : list) { dTOs.add(SysUserGroupDTO.parse(p)); } return dTOs; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public Integer getGroupId() { return groupId; } public void setGroupId(Integer groupId) { this.groupId = groupId; } }
true
f2e69e014162c0477c21dfd20e2df955466a7aae
Java
kotelliada/FlickrClient
/app/src/main/java/io/github/kotelliada/flickrlient/model/Photo.java
UTF-8
895
2.375
2
[]
no_license
package io.github.kotelliada.flickrlient.model; public class Photo { private String id; private String title; private String url; private String latitude; private String longitude; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getLatitude() { return latitude; } public void setLatitude(String latitude) { this.latitude = latitude; } public String getLongitude() { return longitude; } public void setLongitude(String longitude) { this.longitude = longitude; } }
true
807f1317e230c472ad141609b67d864e75ad1661
Java
SS88/reservation
/src/main/java/com/reservation/dao/AdminDao.java
UTF-8
310
1.914063
2
[]
no_license
package com.reservation.dao; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.reservation.model.utilisteur.Admin; @Repository public interface AdminDao extends CrudRepository<Admin, Long> { Admin findByUsername(String adminname); }
true
b4c39e47c7b303083a70a28a557f482e3abefe37
Java
Cento98/1-DAM
/Tema - 6/Ejer9.java
UTF-8
519
3.703125
4
[]
no_license
import java.util.Scanner; public class Ejer9 { public static void main (String [] args){ Scanner lector = new Scanner (System.in); System.out.println("Introduce el numero para calcular su sumatorio"); int num = lector.nextInt(); int total=sumatorio(num); System.out.println("El sumatorio de "+num+" es: "+total); } static int sumatorio(int a){ int suma=0; for (int i=1;i<=a;i++){ suma=suma+i; } return suma; } }
true
58c771b0abf9ee5d6765ec22161643c70648a1b3
Java
nendraharyo/presensimahasiswa-sourcecode
/android/support/v7/app/AppCompatDelegateImplBase$1.java
UTF-8
2,464
1.867188
2
[]
no_license
package android.support.v7.app; import android.content.res.Resources.NotFoundException; final class AppCompatDelegateImplBase$1 implements Thread.UncaughtExceptionHandler { AppCompatDelegateImplBase$1(Thread.UncaughtExceptionHandler paramUncaughtExceptionHandler) {} private boolean shouldWrapException(Throwable paramThrowable) { boolean bool1 = false; boolean bool2 = paramThrowable instanceof Resources.NotFoundException; if (bool2) { String str1 = ((Throwable)paramThrowable).getMessage(); if (str1 != null) { String str2 = "drawable"; boolean bool3 = str1.contains(str2); if (!bool3) { str2 = "Drawable"; bool2 = str1.contains(str2); if (!bool2) {} } else { bool1 = true; } } } return bool1; } public void uncaughtException(Thread paramThread, Throwable paramThrowable) { boolean bool = shouldWrapException(paramThrowable); Object localObject1; if (bool) { localObject1 = new android/content/res/Resources$NotFoundException; Object localObject2 = new java/lang/StringBuilder; ((StringBuilder)localObject2).<init>(); String str = paramThrowable.getMessage(); localObject2 = ((StringBuilder)localObject2).append(str); str = ". If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info."; localObject2 = str; ((Resources.NotFoundException)localObject1).<init>((String)localObject2); localObject2 = paramThrowable.getCause(); ((Throwable)localObject1).initCause((Throwable)localObject2); localObject2 = paramThrowable.getStackTrace(); ((Throwable)localObject1).setStackTrace((StackTraceElement[])localObject2); localObject2 = this.val$defHandler; ((Thread.UncaughtExceptionHandler)localObject2).uncaughtException(paramThread, (Throwable)localObject1); } for (;;) { return; localObject1 = this.val$defHandler; ((Thread.UncaughtExceptionHandler)localObject1).uncaughtException(paramThread, paramThrowable); } } } /* Location: C:\Users\haryo\Desktop\enjarify-master\presensi-enjarify.jar!\android\support\v7\app\AppCompatDelegateImplBase$1.class * Java compiler version: 5 (49.0) * JD-Core Version: 0.7.1 */
true
32d2e96ee13e74c2a3a801d57d8c9c2dcf123597
Java
gspandy/zx-parent
/ink-msgcenter/ink-msgcenter-api/src/main/java/com/ink/msgcenter/api/model/input/SmsModel.java
UTF-8
1,452
1.859375
2
[]
no_license
package com.ink.msgcenter.api.model.input; import java.util.Date; /** * 短信发送接口超类bean * Created by aiyungui on 2016/5/24. */ public class SmsModel extends MsgInput{ private static final long serialVersionUID = 1952831239667263234L; /*模版ID*/ private String tempId ; /*业务单号*/ private String bizId; /*模版参数集合*/ private String paramJson; /*发送时间*/ private Date sendTime; /*通道代码*/ private String chnCode; /*状态通知*/ private String reportUrl; public String getTempId() { return tempId; } public void setTempId(String tempId) { this.tempId = tempId; } public String getBizId() { return bizId; } public void setBizId(String bizId) { this.bizId = bizId; } public String getParamJson() { return paramJson; } public void setParamJson(String paramJson) { this.paramJson = paramJson; } public Date getSendTime() { return sendTime; } public void setSendTime(Date sendTime) { this.sendTime = sendTime; } public String getChnCode() { return chnCode; } public void setChnCode(String chnCode) { this.chnCode = chnCode; } public String getReportUrl() { return reportUrl; } public void setReportUrl(String reportUrl) { this.reportUrl = reportUrl; } }
true
94e52aa76a4911d8d18ad28fbba6450e1361fdda
Java
Bloombox/Java
/src/main/java/io/opencannabis/schema/inventory/TagReportOriginOrBuilder.java
UTF-8
4,196
1.796875
2
[ "MIT", "Apache-2.0" ]
permissive
/* * Copyright 2019, Momentum Ideas Co. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: inventory/rfid/LLRP.proto package io.opencannabis.schema.inventory; public interface TagReportOriginOrBuilder extends // @@protoc_insertion_point(interface_extends:opencannabis.inventory.rfid.TagReportOrigin) com.google.protobuf.MessageOrBuilder { /** * <pre> * Describes the RFID reader/controller device which is reporting a tag. Readers control antennae, and emit read * events over LLRP to facilitate RF operations. * </pre> * * <code>.opencannabis.inventory.rfid.Reader reader = 1 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes info about the RFID reader device involved in a tag report."];</code> */ boolean hasReader(); /** * <pre> * Describes the RFID reader/controller device which is reporting a tag. Readers control antennae, and emit read * events over LLRP to facilitate RF operations. * </pre> * * <code>.opencannabis.inventory.rfid.Reader reader = 1 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes info about the RFID reader device involved in a tag report."];</code> */ io.opencannabis.schema.inventory.Reader getReader(); /** * <pre> * Describes the RFID reader/controller device which is reporting a tag. Readers control antennae, and emit read * events over LLRP to facilitate RF operations. * </pre> * * <code>.opencannabis.inventory.rfid.Reader reader = 1 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes info about the RFID reader device involved in a tag report."];</code> */ io.opencannabis.schema.inventory.ReaderOrBuilder getReaderOrBuilder(); /** * <pre> * Describes the partner account to which the reader device is assigned, if applicable, so that it may be reported to * telemetry or inventory systems along with the location at which the device is located. * </pre> * * <code>string partner = 2 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes the partner account to which the reader device is assigned."];</code> */ java.lang.String getPartner(); /** * <pre> * Describes the partner account to which the reader device is assigned, if applicable, so that it may be reported to * telemetry or inventory systems along with the location at which the device is located. * </pre> * * <code>string partner = 2 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes the partner account to which the reader device is assigned."];</code> */ com.google.protobuf.ByteString getPartnerBytes(); /** * <pre> * Describes the location account, owned by the partner account specified, where the RFID reader device is physically * located. Annotates RFID traffic with licensure/physical boundaries. * </pre> * * <code>string location = 3 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes the location, owned by the partner, where the RFID reader is located."];</code> */ java.lang.String getLocation(); /** * <pre> * Describes the location account, owned by the partner account specified, where the RFID reader device is physically * located. Annotates RFID traffic with licensure/physical boundaries. * </pre> * * <code>string location = 3 [(.gen_bq_schema.require) = true, (.gen_bq_schema.description) = "Describes the location, owned by the partner, where the RFID reader is located."];</code> */ com.google.protobuf.ByteString getLocationBytes(); }
true
9f6d05b71dbca92a7514222e9e8d0153163df902
Java
LuizGGeas/Multimodal
/src/Aresta.java
UTF-8
629
3.125
3
[]
no_license
/** * @author Luiz Gabriel de S. N. * @version 1.0 * <p> * Classe responsável pela criação das arestas a inicializarem a matriz */ public class Aresta { private int v1, v2; private int value; private Types transporte; Aresta(int v1, int v2, int value, Types transporte) { this.v1 = v1; this.v2 = v2; this.value = value; this.transporte = transporte; } int getv1(){ return v1; } int getv2(){ return v2; } int getValue(){ return value; } Types getTtransporte(){ return transporte; } @Override public String toString(){ return "("+v1 +","+v2 + "-"+ value + ")"; } }
true
d0b94a7dcf0c72368f0a3f0d48630fb38b0579de
Java
lvsdian/seckill
/src/main/java/cn/andios/seckill/access/SecKillUserContext.java
UTF-8
574
2.484375
2
[]
no_license
package cn.andios.seckill.access; import cn.andios.seckill.domain.SecKillUser; /** * @description:ThreadLocal是绑定到当前线程的,多线程情况下不会有冲突,所以用它来存secKillUser * @author:LSD * @when:2019/10/23/12:33 */ public class SecKillUserContext { private static ThreadLocal<SecKillUser> userHolder = new ThreadLocal<SecKillUser>(); public static void setSecKillUser(SecKillUser secKillUser) { userHolder.set(secKillUser); } public static SecKillUser getSecKillUser(){ return userHolder.get(); } }
true