blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
68431585633d65c3529caee83e6fca441a28e0d9
20,650,202,765,528
2e9032af0b6803239c2d52ff3bdc77be53ab1ea0
/assignment3/studentOrientation/src/studentOrientation/bookStore/Books.java
4aa8ed335a6f052682012adcde34e4ca4d265a32
[ "MIT" ]
permissive
hbagdi/cs542
https://github.com/hbagdi/cs542
69fb0d2f24a5c4478ba0257ca7b3633a56939f52
18bdf5a423f53a32ae5ecce50f1e62ba02cc57d8
refs/heads/master
2021-06-11T20:56:11.299000
2016-12-15T14:30:25
2016-12-15T14:30:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package studentOrientation.bookStore; enum Books { HEAD_FIRST_DESIGN_PATTERNS("Head First Design Patterns", 30.0), HEAD_FIRST_DESIGN_PATTERNS2("Head First Design Patterns2", 50.0); private final double price; private final String title; private Books(String title_in, double price_in) { title = title_in; price = price_in; } public double getPrice() { return price; } public String getTitle() { return title; } }
UTF-8
Java
438
java
Books.java
Java
[]
null
[]
package studentOrientation.bookStore; enum Books { HEAD_FIRST_DESIGN_PATTERNS("Head First Design Patterns", 30.0), HEAD_FIRST_DESIGN_PATTERNS2("Head First Design Patterns2", 50.0); private final double price; private final String title; private Books(String title_in, double price_in) { title = title_in; price = price_in; } public double getPrice() { return price; } public String getTitle() { return title; } }
438
0.714612
0.696347
22
18.90909
20.484825
75
false
false
0
0
0
0
0
0
1.454545
false
false
4
8b7d8adcf3c269b778c2b6db41b1d6c0178d82a2
20,650,202,766,173
49a99336c3c4b7dcf9e16b51ec9f68758dc7670e
/src/com/saubao/szuclass/HomeFragment.java
0889eeced974026bf0212f808c6dbddc337db71b
[]
no_license
DoubleJB/SZUClass
https://github.com/DoubleJB/SZUClass
d12b8dff51cd7e88b04c5f5c9ad991468d244a4c
215d79d63f9401e92e0782332c4643d77761ceec
refs/heads/master
2020-04-09T16:06:05.700000
2014-04-24T10:21:20
2014-04-24T10:21:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.saubao.szuclass; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ViewSwitcher; public class HomeFragment extends Fragment{ private View layoutView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { layoutView = inflater.inflate(R.layout.home_fragment, null); ViewSwitcher vs = (ViewSwitcher)layoutView.findViewById(R.id.home_view_switcher); vs.setDisplayedChild(0); Button Login = (Button)layoutView.findViewById(R.id.login_submit); Login.setText("haha"); return layoutView; } }
UTF-8
Java
739
java
HomeFragment.java
Java
[]
null
[]
package com.saubao.szuclass; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ViewSwitcher; public class HomeFragment extends Fragment{ private View layoutView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { layoutView = inflater.inflate(R.layout.home_fragment, null); ViewSwitcher vs = (ViewSwitcher)layoutView.findViewById(R.id.home_view_switcher); vs.setDisplayedChild(0); Button Login = (Button)layoutView.findViewById(R.id.login_submit); Login.setText("haha"); return layoutView; } }
739
0.79161
0.788904
25
28.559999
26.130564
100
false
false
0
0
0
0
0
0
1.48
false
false
4
09b251381d076acc52183b3c684ff435d4b2f6a5
14,147,622,302,313
db5c256bbf37ec68ddf6d44c2ed1283eafcdb7f4
/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/express/request/WxMaExpressOrderShopDetail.java
638bca6ddcc8d1cfe6d56b01083cd8f1b74c9f96
[ "Apache-2.0" ]
permissive
Wechat-Group/WxJava
https://github.com/Wechat-Group/WxJava
4d724e7a2669b28f2fe6090e4b3b4a91e9ca3876
13f9c64643c72433207ab4b53dd2a43d7b1c23f6
refs/heads/develop
2023-08-19T01:34:13.885000
2023-08-17T04:54:01
2023-08-17T04:54:01
49,122,742
18,244
5,637
Apache-2.0
true
2023-09-11T02:06:02
2016-01-06T08:24:05
2023-09-10T16:16:05
2023-09-11T02:06:01
16,420
28,066
8,331
18
Java
false
false
package cn.binarywang.wx.miniapp.bean.express.request; import com.google.gson.annotations.SerializedName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; /** * 商品详情 */ @Data @NoArgsConstructor @AllArgsConstructor public class WxMaExpressOrderShopDetail implements Serializable { private static final long serialVersionUID = 5988620921216969796L; /** * 商品名称 * <pre> * 是否必填: 否 * 描述: 最多40汉字 * </pre> */ @SerializedName("goods_name") private String goodsName; /** * 商品图片url * <pre> * 是否必填: 否 * </pre> */ @SerializedName("goods_img_url") private String goodsImgUrl; /** * 商品详情描述 * <pre> * 是否必填: 否 * 描述: 最多40汉字 * </pre> */ @SerializedName("goods_desc") private String goodsDesc; }
UTF-8
Java
926
java
WxMaExpressOrderShopDetail.java
Java
[]
null
[]
package cn.binarywang.wx.miniapp.bean.express.request; import com.google.gson.annotations.SerializedName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; /** * 商品详情 */ @Data @NoArgsConstructor @AllArgsConstructor public class WxMaExpressOrderShopDetail implements Serializable { private static final long serialVersionUID = 5988620921216969796L; /** * 商品名称 * <pre> * 是否必填: 否 * 描述: 最多40汉字 * </pre> */ @SerializedName("goods_name") private String goodsName; /** * 商品图片url * <pre> * 是否必填: 否 * </pre> */ @SerializedName("goods_img_url") private String goodsImgUrl; /** * 商品详情描述 * <pre> * 是否必填: 否 * 描述: 最多40汉字 * </pre> */ @SerializedName("goods_desc") private String goodsDesc; }
926
0.670702
0.642857
51
15.196078
16.534004
68
false
false
0
0
0
0
0
0
0.196078
false
false
4
974b7183c9ffeb6d8136c0c0a6ff7c389cd82179
1,563,368,138,157
1ecfa9c5b1a58959e64140e33d8d6de81b9b31ee
/app/src/main/java/andela/checkpoint/stilld/adapters/MovementsAdapter.java
3fc3c6973738d80a74bed62bfeaf3bcab3d2234c
[]
no_license
andela-ftchirou/checkpoint-four
https://github.com/andela-ftchirou/checkpoint-four
83eeaaa2d06543f13c941c682478225d53bad275
6244ffc393ef91e534c568ad047ec5b62b21fd77
refs/heads/master
2017-11-26T11:44:43.191000
2016-08-09T08:53:03
2016-08-09T08:53:03
45,362,661
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package andela.checkpoint.stilld.adapters; 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.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import org.joda.time.DateTime; import java.util.ArrayList; import java.util.List; import andela.checkpoint.stilld.R; import andela.checkpoint.stilld.models.Movement; import andela.checkpoint.stilld.utilities.Utils; /** * An adapter which can be bound to a recycler view to display {@link Movement}s. */ public class MovementsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private final static int STILL_MOVEMENT_VIEW_TYPE = 0; private final static int MOVEMENT_VIEW_TYPE = 1; private Context context; private List<Movement> movements; public MovementsAdapter(Context context) { this.context = context; this.movements = new ArrayList<>(); } public MovementsAdapter(Context context, List<Movement> movements) { this(context); this.movements = movements; } public void addMovement(Movement movement) { movements.add(movement); notifyItemInserted(movements.size() - 1); } public void setMovements(List<Movement> movements) { this.movements = movements; notifyDataSetChanged(); } @Override public int getItemViewType(int position) { Movement movement = movements.get(position); if (movement.getType() == Movement.Type.STILL) { return STILL_MOVEMENT_VIEW_TYPE; } return MOVEMENT_VIEW_TYPE; } @Override public int getItemCount() { return movements.size(); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == STILL_MOVEMENT_VIEW_TYPE) { return new StillMovementItemViewHolder(LayoutInflater.from(context).inflate(R.layout.still_movement_item_view, parent, false)); } return new MovementItemViewHolder(LayoutInflater.from(context).inflate(R.layout.movement_item_view, parent, false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { Movement movement = movements.get(position); if (movement.getType() == Movement.Type.STILL) { bindStillMovementView((StillMovementItemViewHolder) viewHolder, position); } else { bindMovementView((MovementItemViewHolder) viewHolder, position); } } private void bindStillMovementView(StillMovementItemViewHolder viewHolder, int position) { viewHolder.topLine.setVisibility(position == 0 ? View.INVISIBLE : View.VISIBLE); viewHolder.bottomLine.setVisibility(position == getItemCount() - 1 ? View.INVISIBLE : View.VISIBLE); Movement movement = movements.get(position); DateTime when = movement.getWhen(); viewHolder.when.setText(String.format("%02d:%02d", when.getHourOfDay(), when.getMinuteOfHour())); viewHolder.location.setText(movement.getLocation()); if (movement.getTimeSpent() <= 0) { viewHolder.timeSpent.setVisibility(View.GONE); } else { viewHolder.timeSpent.setVisibility(View.VISIBLE); viewHolder.timeSpent.setText(Utils.millisToString(movement.getTimeSpent(), context)); } } private void bindMovementView(MovementItemViewHolder viewHolder, int position) { viewHolder.topLine.setVisibility(position == 0 ? View.INVISIBLE : View.VISIBLE); viewHolder.bottomLine.setVisibility(position == getItemCount() - 1 ? View.INVISIBLE : View.VISIBLE); Movement movement = movements.get(position); DateTime when = movement.getWhen(); viewHolder.when.setText(String.format("%02d:%02d", when.getHourOfDay(), when.getMinuteOfHour())); switch (movement.getType()) { case WALKING: viewHolder.icon.setBackgroundResource(R.drawable.walking_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_walk_white_18dp); break; case RUNNING: viewHolder.icon.setBackgroundResource(R.drawable.running_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_run_white_18dp); break; case IN_CAR: viewHolder.icon.setBackgroundResource(R.drawable.in_car_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_car_white_18dp); break; case ON_BICYCLE: viewHolder.icon.setBackgroundResource(R.drawable.on_bicycle_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_bike_white_18dp); break; default: break; } } public static class MovementItemViewHolder extends RecyclerView.ViewHolder { public FrameLayout itemView; public View topLine; public View bottomLine; public ImageView icon; public TextView when; public MovementItemViewHolder(View view) { super(view); itemView = (FrameLayout) view; topLine = view.findViewById(R.id.movement_icon_top_line); bottomLine = view.findViewById(R.id.movement_icon_bottom_line); icon = (ImageView) view.findViewById(R.id.movement_icon); when = (TextView) view.findViewById(R.id.movement_when_text_view); } } public static class StillMovementItemViewHolder extends RecyclerView.ViewHolder { private FrameLayout itemView; public View topLine; public View bottomLine; public TextView when; public TextView location; public TextView timeSpent; public StillMovementItemViewHolder(View view) { super(view); itemView = (FrameLayout) view; topLine = view.findViewById(R.id.still_movement_icon_top_line); bottomLine = view.findViewById(R.id.still_movement_icon_bottom_line); when = (TextView) view.findViewById(R.id.still_movement_when_text_view); location = (TextView) view.findViewById(R.id.still_movement_location); timeSpent = (TextView) view.findViewById(R.id.still_movement_time_spent); } } }
UTF-8
Java
6,572
java
MovementsAdapter.java
Java
[]
null
[]
package andela.checkpoint.stilld.adapters; 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.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import org.joda.time.DateTime; import java.util.ArrayList; import java.util.List; import andela.checkpoint.stilld.R; import andela.checkpoint.stilld.models.Movement; import andela.checkpoint.stilld.utilities.Utils; /** * An adapter which can be bound to a recycler view to display {@link Movement}s. */ public class MovementsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private final static int STILL_MOVEMENT_VIEW_TYPE = 0; private final static int MOVEMENT_VIEW_TYPE = 1; private Context context; private List<Movement> movements; public MovementsAdapter(Context context) { this.context = context; this.movements = new ArrayList<>(); } public MovementsAdapter(Context context, List<Movement> movements) { this(context); this.movements = movements; } public void addMovement(Movement movement) { movements.add(movement); notifyItemInserted(movements.size() - 1); } public void setMovements(List<Movement> movements) { this.movements = movements; notifyDataSetChanged(); } @Override public int getItemViewType(int position) { Movement movement = movements.get(position); if (movement.getType() == Movement.Type.STILL) { return STILL_MOVEMENT_VIEW_TYPE; } return MOVEMENT_VIEW_TYPE; } @Override public int getItemCount() { return movements.size(); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == STILL_MOVEMENT_VIEW_TYPE) { return new StillMovementItemViewHolder(LayoutInflater.from(context).inflate(R.layout.still_movement_item_view, parent, false)); } return new MovementItemViewHolder(LayoutInflater.from(context).inflate(R.layout.movement_item_view, parent, false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { Movement movement = movements.get(position); if (movement.getType() == Movement.Type.STILL) { bindStillMovementView((StillMovementItemViewHolder) viewHolder, position); } else { bindMovementView((MovementItemViewHolder) viewHolder, position); } } private void bindStillMovementView(StillMovementItemViewHolder viewHolder, int position) { viewHolder.topLine.setVisibility(position == 0 ? View.INVISIBLE : View.VISIBLE); viewHolder.bottomLine.setVisibility(position == getItemCount() - 1 ? View.INVISIBLE : View.VISIBLE); Movement movement = movements.get(position); DateTime when = movement.getWhen(); viewHolder.when.setText(String.format("%02d:%02d", when.getHourOfDay(), when.getMinuteOfHour())); viewHolder.location.setText(movement.getLocation()); if (movement.getTimeSpent() <= 0) { viewHolder.timeSpent.setVisibility(View.GONE); } else { viewHolder.timeSpent.setVisibility(View.VISIBLE); viewHolder.timeSpent.setText(Utils.millisToString(movement.getTimeSpent(), context)); } } private void bindMovementView(MovementItemViewHolder viewHolder, int position) { viewHolder.topLine.setVisibility(position == 0 ? View.INVISIBLE : View.VISIBLE); viewHolder.bottomLine.setVisibility(position == getItemCount() - 1 ? View.INVISIBLE : View.VISIBLE); Movement movement = movements.get(position); DateTime when = movement.getWhen(); viewHolder.when.setText(String.format("%02d:%02d", when.getHourOfDay(), when.getMinuteOfHour())); switch (movement.getType()) { case WALKING: viewHolder.icon.setBackgroundResource(R.drawable.walking_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_walk_white_18dp); break; case RUNNING: viewHolder.icon.setBackgroundResource(R.drawable.running_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_run_white_18dp); break; case IN_CAR: viewHolder.icon.setBackgroundResource(R.drawable.in_car_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_car_white_18dp); break; case ON_BICYCLE: viewHolder.icon.setBackgroundResource(R.drawable.on_bicycle_movement_background); viewHolder.icon.setImageResource(R.drawable.ic_directions_bike_white_18dp); break; default: break; } } public static class MovementItemViewHolder extends RecyclerView.ViewHolder { public FrameLayout itemView; public View topLine; public View bottomLine; public ImageView icon; public TextView when; public MovementItemViewHolder(View view) { super(view); itemView = (FrameLayout) view; topLine = view.findViewById(R.id.movement_icon_top_line); bottomLine = view.findViewById(R.id.movement_icon_bottom_line); icon = (ImageView) view.findViewById(R.id.movement_icon); when = (TextView) view.findViewById(R.id.movement_when_text_view); } } public static class StillMovementItemViewHolder extends RecyclerView.ViewHolder { private FrameLayout itemView; public View topLine; public View bottomLine; public TextView when; public TextView location; public TextView timeSpent; public StillMovementItemViewHolder(View view) { super(view); itemView = (FrameLayout) view; topLine = view.findViewById(R.id.still_movement_icon_top_line); bottomLine = view.findViewById(R.id.still_movement_icon_bottom_line); when = (TextView) view.findViewById(R.id.still_movement_when_text_view); location = (TextView) view.findViewById(R.id.still_movement_location); timeSpent = (TextView) view.findViewById(R.id.still_movement_time_spent); } } }
6,572
0.667377
0.663573
208
30.596153
33.046158
139
false
false
0
0
0
0
0
0
0.495192
false
false
4
7bac76a218cd317605b45c4dbf379f96e43d7196
22,462,679,011,875
4e24a923151373fe6350f680ee92723824c64003
/app/src/main/java/com/droidsonroids/workcation/screens/main/map/DetailsFragmentPresenterImpl.java
5faf16ac75e36c7252c5416f0fbd3746674f9e3e
[ "Apache-2.0" ]
permissive
MatejVukosav/Workcation
https://github.com/MatejVukosav/Workcation
8d9f54800f2a58e5b86e9ecc243890fd15d09acc
e9fdb5e42bdf2920e79fbdd96a73b41dac069359
refs/heads/master
2021-01-19T09:10:29.161000
2017-10-07T14:37:34
2017-10-07T14:37:34
87,734,478
0
0
null
true
2017-04-09T19:43:52
2017-04-09T19:43:52
2017-04-09T19:42:33
2017-03-21T10:00:29
4,937
0
0
0
null
null
null
package com.droidsonroids.workcation.screens.main.map; import com.droidsonroids.workcation.common.maps.MapsUtil; import com.droidsonroids.workcation.common.data.providers.MapDataProvider; import com.droidsonroids.workcation.common.model.Bounds; import com.droidsonroids.workcation.common.model.DirectionsResponse; import com.droidsonroids.workcation.common.model.Distance; import com.droidsonroids.workcation.common.model.Duration; import com.droidsonroids.workcation.common.data.providers.MapsApiManager; import com.droidsonroids.workcation.common.model.Route; import com.droidsonroids.workcation.common.mvp.MvpPresenterImpl; import com.google.android.gms.maps.model.LatLng; import com.google.gson.Gson; import com.google.maps.android.PolyUtil; import java.io.IOException; import java.util.ArrayList; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; public class DetailsFragmentPresenterImpl extends MvpPresenterImpl<DetailsFragmentMvp.View> implements DetailsFragmentMvp.Presenter { private MapsApiManager mapsApiManager = MapsApiManager.instance(); private MapDataProvider mapDataProvider = MapDataProvider.instance(); @Override public void drawRoute( final LatLng first, final int position ) { final LatLng second = new LatLng( mapDataProvider.getLatByPosition( position ), mapDataProvider.getLngByPosition( position ) ); mapsApiManager.getRoute( first, second, new Callback() { @Override public void onFailure( final Call call, final IOException e ) { e.printStackTrace(); } @Override public void onResponse( final Call call, final Response response ) throws IOException { Route route = new Gson() .fromJson( response.body().charStream(), DirectionsResponse.class ) .getRoutes() .get( 0 ); providePolylineToDraw( route.getOverviewPolyline().getPoints() ); updateMapZoomAndRegion( route.getBounds() ); updateData( position, route.getLegs().get( 0 ).getDistance(), route.getLegs().get( 0 ).getDuration() ); } } ); } @Override public void provideBaliData() { getView().provideBaliData( mapDataProvider.providePlacesList() ); } @Override public void onBackPressedWithScene() { getView().onBackPressedWithScene( mapDataProvider.provideLatLngBoundsForAllPlaces() ); } @Override public void moveMapAndAddMarker() { getView().moveMapAndAddMaker( mapDataProvider.provideLatLngBoundsForAllPlaces() ); } private void updateMapZoomAndRegion( final Bounds bounds ) { bounds .getSouthwest() .setLat( MapsUtil.increaseLatitude( bounds ) ); getView() .updateMapZoomAndRegion( bounds.getNortheastLatLng(), bounds.getSouthwestLatLng() ); } private void providePolylineToDraw( final String points ) { getView() .drawPolyLinesOnMap( new ArrayList<>( PolyUtil.decode( points ) ) ); } private void updateData( int position, Distance distance, Duration duration ) { getView() .updateData( position, distance, duration ); } }
UTF-8
Java
3,318
java
DetailsFragmentPresenterImpl.java
Java
[]
null
[]
package com.droidsonroids.workcation.screens.main.map; import com.droidsonroids.workcation.common.maps.MapsUtil; import com.droidsonroids.workcation.common.data.providers.MapDataProvider; import com.droidsonroids.workcation.common.model.Bounds; import com.droidsonroids.workcation.common.model.DirectionsResponse; import com.droidsonroids.workcation.common.model.Distance; import com.droidsonroids.workcation.common.model.Duration; import com.droidsonroids.workcation.common.data.providers.MapsApiManager; import com.droidsonroids.workcation.common.model.Route; import com.droidsonroids.workcation.common.mvp.MvpPresenterImpl; import com.google.android.gms.maps.model.LatLng; import com.google.gson.Gson; import com.google.maps.android.PolyUtil; import java.io.IOException; import java.util.ArrayList; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; public class DetailsFragmentPresenterImpl extends MvpPresenterImpl<DetailsFragmentMvp.View> implements DetailsFragmentMvp.Presenter { private MapsApiManager mapsApiManager = MapsApiManager.instance(); private MapDataProvider mapDataProvider = MapDataProvider.instance(); @Override public void drawRoute( final LatLng first, final int position ) { final LatLng second = new LatLng( mapDataProvider.getLatByPosition( position ), mapDataProvider.getLngByPosition( position ) ); mapsApiManager.getRoute( first, second, new Callback() { @Override public void onFailure( final Call call, final IOException e ) { e.printStackTrace(); } @Override public void onResponse( final Call call, final Response response ) throws IOException { Route route = new Gson() .fromJson( response.body().charStream(), DirectionsResponse.class ) .getRoutes() .get( 0 ); providePolylineToDraw( route.getOverviewPolyline().getPoints() ); updateMapZoomAndRegion( route.getBounds() ); updateData( position, route.getLegs().get( 0 ).getDistance(), route.getLegs().get( 0 ).getDuration() ); } } ); } @Override public void provideBaliData() { getView().provideBaliData( mapDataProvider.providePlacesList() ); } @Override public void onBackPressedWithScene() { getView().onBackPressedWithScene( mapDataProvider.provideLatLngBoundsForAllPlaces() ); } @Override public void moveMapAndAddMarker() { getView().moveMapAndAddMaker( mapDataProvider.provideLatLngBoundsForAllPlaces() ); } private void updateMapZoomAndRegion( final Bounds bounds ) { bounds .getSouthwest() .setLat( MapsUtil.increaseLatitude( bounds ) ); getView() .updateMapZoomAndRegion( bounds.getNortheastLatLng(), bounds.getSouthwestLatLng() ); } private void providePolylineToDraw( final String points ) { getView() .drawPolyLinesOnMap( new ArrayList<>( PolyUtil.decode( points ) ) ); } private void updateData( int position, Distance distance, Duration duration ) { getView() .updateData( position, distance, duration ); } }
3,318
0.690476
0.688668
87
37.137932
33.604931
135
false
false
0
0
0
0
0
0
0.551724
false
false
4
f805923619f307bffb942a579908ebe29df54075
2,078,764,234,621
0664c4939795bea99597ae15a6d59508e80044d0
/Touring/FXMLOutputController.java
35a6b0bf339a780016edf4a41c6396b752f19081
[]
no_license
antarezaghifary/AntaTravel
https://github.com/antarezaghifary/AntaTravel
ffeb13ac1ccb7502d4aad8d4118d420440b715de
079ba9e9a9786f7c7d248ba8d1391d3c12e06480
refs/heads/master
2021-08-23T07:58:32.936000
2017-12-04T07:15:19
2017-12-04T07:15:19
112,802,764
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Touring; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXDialog; import com.jfoenix.controls.JFXDialogLayout; import java.net.URL; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.ButtonType; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import javafx.scene.layout.StackPane; import javafx.scene.text.Text; import javafx.stage.Stage; import javax.swing.JOptionPane; import koneksi.koneksi; /** * FXML Controller class * * @author Skaha_AM */ public class FXMLOutputController implements Initializable { @FXML private JFXButton id_print; @FXML private JFXButton id_update; @FXML private StackPane stack; @FXML private TableColumn<TabelData, String> id_penumpang; @FXML private TableColumn<TabelData, String> nama1; @FXML private TableColumn<TabelData, String> alamat1; @FXML private TableColumn<TabelData, String> tujuan1; @FXML private TableColumn<TabelData, String> tgl1; @FXML private TableColumn<TabelData, String> tlp1; @FXML private TableColumn<TabelData, String> paket1; @FXML private TableColumn<TabelData, String> jam; @FXML private TableColumn<TabelData, String> harga1; @FXML private TableColumn<TabelData, String> kendaraan1; @FXML private TableColumn<TabelData, String> kembali; @FXML private JFXButton id_exit; private ObservableList<TabelData> data; @FXML private TableView<TabelData> tabel; private String nama; private String tujuan; private String tgl; private String paket; private String jam1; private String kembali1; private String dialogH; private String dialog; Connection con; Statement stat; ResultSet rs; String sql; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO koneksi DB = new koneksi(); DB.config(); con = DB.con; stat = DB.stm; tabel.setOnMousePressed(new EventHandler<MouseEvent>(){ @Override public void handle(MouseEvent event) { nama = tabel.getSelectionModel().getSelectedItem().getname(); tujuan = tabel.getSelectionModel().getSelectedItem().gettujuan(); tgl = tabel.getSelectionModel().getSelectedItem().gettgl(); paket =tabel.getSelectionModel().getSelectedItem().getpaket(); jam1 =tabel.getSelectionModel().getSelectedItem().getjam(); kembali1 =tabel.getSelectionModel().getSelectedItem().getkembalian(); dialogH = "Hai, "+nama; dialog = "\nJam : "+jam1 + "\nTujuan : "+tujuan + "\nBerangkat Tanggal : "+tgl + "\nUang Kembalian : Rp. "+kembali1; } }); } @FXML private void print(ActionEvent event) { Dialog("Okay",dialogH,dialog); } @FXML private void update(ActionEvent event) { try { data = FXCollections.observableArrayList(); // Execute query and store result in a resultset rs = stat.executeQuery("SELECT `nama`,`harga`,`alamat`,`tujuan`,`tgl_pesan`,`tlp`,`paket`,`jam`,`kendaraan`,`kembali` FROM `penumpang`"); while (rs.next()) { //get string from db,whichever way data.add(new TabelData(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4),rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10))); } } catch (SQLException ex) { System.err.println("Error"+ex); } //Set cell value factory to tableview. //NB.PropertyValue Factory must be the same with the one set in model class. nama1.setCellValueFactory(new PropertyValueFactory<>("nama")); alamat1.setCellValueFactory(new PropertyValueFactory<>("alamat")); tujuan1.setCellValueFactory(new PropertyValueFactory<>("tujuan")); tgl1.setCellValueFactory(new PropertyValueFactory<>("tgl")); tlp1.setCellValueFactory(new PropertyValueFactory<>("tlp")); paket1.setCellValueFactory(new PropertyValueFactory<>("paket")); jam.setCellValueFactory(new PropertyValueFactory<>("jam")); harga1.setCellValueFactory(new PropertyValueFactory<>("harga")); kendaraan1.setCellValueFactory(new PropertyValueFactory<>("kendaraan")); kembali.setCellValueFactory(new PropertyValueFactory<>("kembalian")); tabel.setItems(data); } @FXML private void exit(ActionEvent event) { // get a handle to the stage // String selection = selection.getText(); Alert alert = new Alert(AlertType.CONFIRMATION, "Close " + "Program" + " ?", ButtonType.YES, ButtonType.CANCEL); alert.showAndWait(); if (alert.getResult() == ButtonType.YES) { //do stuff Stage stage = (Stage) id_exit.getScene().getWindow(); // do what you have to do stage.close(); } } public void Dialog(String b,String p){ stack.setDisable(false); JFXDialogLayout content = new JFXDialogLayout(); content.setHeading(new Text(p)); JFXDialog dialog = new JFXDialog(stack,content,JFXDialog.DialogTransition.CENTER); JFXButton btn = new JFXButton(b); btn.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent event){ dialog.close(); stack.setDisable(true); } }); content.setActions(btn); dialog.show(); } public void Dialog(String b,String h,String p){ stack.setDisable(false); JFXDialogLayout content = new JFXDialogLayout(); content.setHeading(new Text(h)); content.setBody(new Text(p)); JFXDialog dialog = new JFXDialog(stack,content,JFXDialog.DialogTransition.CENTER); JFXButton btn = new JFXButton(b); btn.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent event){ dialog.close(); stack.setDisable(true); } }); content.setActions(btn); dialog.show(); } }
UTF-8
Java
7,274
java
FXMLOutputController.java
Java
[ { "context": "\n\r\n\r\n/**\r\n * FXML Controller class\r\n *\r\n * @author Skaha_AM\r\n */\r\npublic class FXMLOutputController implement", "end": 1238, "score": 0.998934805393219, "start": 1230, "tag": "USERNAME", "value": "Skaha_AM" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Touring; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXDialog; import com.jfoenix.controls.JFXDialogLayout; import java.net.URL; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.ButtonType; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import javafx.scene.layout.StackPane; import javafx.scene.text.Text; import javafx.stage.Stage; import javax.swing.JOptionPane; import koneksi.koneksi; /** * FXML Controller class * * @author Skaha_AM */ public class FXMLOutputController implements Initializable { @FXML private JFXButton id_print; @FXML private JFXButton id_update; @FXML private StackPane stack; @FXML private TableColumn<TabelData, String> id_penumpang; @FXML private TableColumn<TabelData, String> nama1; @FXML private TableColumn<TabelData, String> alamat1; @FXML private TableColumn<TabelData, String> tujuan1; @FXML private TableColumn<TabelData, String> tgl1; @FXML private TableColumn<TabelData, String> tlp1; @FXML private TableColumn<TabelData, String> paket1; @FXML private TableColumn<TabelData, String> jam; @FXML private TableColumn<TabelData, String> harga1; @FXML private TableColumn<TabelData, String> kendaraan1; @FXML private TableColumn<TabelData, String> kembali; @FXML private JFXButton id_exit; private ObservableList<TabelData> data; @FXML private TableView<TabelData> tabel; private String nama; private String tujuan; private String tgl; private String paket; private String jam1; private String kembali1; private String dialogH; private String dialog; Connection con; Statement stat; ResultSet rs; String sql; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO koneksi DB = new koneksi(); DB.config(); con = DB.con; stat = DB.stm; tabel.setOnMousePressed(new EventHandler<MouseEvent>(){ @Override public void handle(MouseEvent event) { nama = tabel.getSelectionModel().getSelectedItem().getname(); tujuan = tabel.getSelectionModel().getSelectedItem().gettujuan(); tgl = tabel.getSelectionModel().getSelectedItem().gettgl(); paket =tabel.getSelectionModel().getSelectedItem().getpaket(); jam1 =tabel.getSelectionModel().getSelectedItem().getjam(); kembali1 =tabel.getSelectionModel().getSelectedItem().getkembalian(); dialogH = "Hai, "+nama; dialog = "\nJam : "+jam1 + "\nTujuan : "+tujuan + "\nBerangkat Tanggal : "+tgl + "\nUang Kembalian : Rp. "+kembali1; } }); } @FXML private void print(ActionEvent event) { Dialog("Okay",dialogH,dialog); } @FXML private void update(ActionEvent event) { try { data = FXCollections.observableArrayList(); // Execute query and store result in a resultset rs = stat.executeQuery("SELECT `nama`,`harga`,`alamat`,`tujuan`,`tgl_pesan`,`tlp`,`paket`,`jam`,`kendaraan`,`kembali` FROM `penumpang`"); while (rs.next()) { //get string from db,whichever way data.add(new TabelData(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4),rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10))); } } catch (SQLException ex) { System.err.println("Error"+ex); } //Set cell value factory to tableview. //NB.PropertyValue Factory must be the same with the one set in model class. nama1.setCellValueFactory(new PropertyValueFactory<>("nama")); alamat1.setCellValueFactory(new PropertyValueFactory<>("alamat")); tujuan1.setCellValueFactory(new PropertyValueFactory<>("tujuan")); tgl1.setCellValueFactory(new PropertyValueFactory<>("tgl")); tlp1.setCellValueFactory(new PropertyValueFactory<>("tlp")); paket1.setCellValueFactory(new PropertyValueFactory<>("paket")); jam.setCellValueFactory(new PropertyValueFactory<>("jam")); harga1.setCellValueFactory(new PropertyValueFactory<>("harga")); kendaraan1.setCellValueFactory(new PropertyValueFactory<>("kendaraan")); kembali.setCellValueFactory(new PropertyValueFactory<>("kembalian")); tabel.setItems(data); } @FXML private void exit(ActionEvent event) { // get a handle to the stage // String selection = selection.getText(); Alert alert = new Alert(AlertType.CONFIRMATION, "Close " + "Program" + " ?", ButtonType.YES, ButtonType.CANCEL); alert.showAndWait(); if (alert.getResult() == ButtonType.YES) { //do stuff Stage stage = (Stage) id_exit.getScene().getWindow(); // do what you have to do stage.close(); } } public void Dialog(String b,String p){ stack.setDisable(false); JFXDialogLayout content = new JFXDialogLayout(); content.setHeading(new Text(p)); JFXDialog dialog = new JFXDialog(stack,content,JFXDialog.DialogTransition.CENTER); JFXButton btn = new JFXButton(b); btn.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent event){ dialog.close(); stack.setDisable(true); } }); content.setActions(btn); dialog.show(); } public void Dialog(String b,String h,String p){ stack.setDisable(false); JFXDialogLayout content = new JFXDialogLayout(); content.setHeading(new Text(h)); content.setBody(new Text(p)); JFXDialog dialog = new JFXDialog(stack,content,JFXDialog.DialogTransition.CENTER); JFXButton btn = new JFXButton(b); btn.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent event){ dialog.close(); stack.setDisable(true); } }); content.setActions(btn); dialog.show(); } }
7,274
0.633902
0.629365
202
33.980198
26.893991
205
false
false
0
0
0
0
0
0
0.787129
false
false
4
ebd3ebb4b4afd7d0895305ef5ec47af7d8112cf9
20,959,440,453,188
22b15893aba7e400dad3098dc1008fce6dabfc3b
/src/app/commands/external/ChangeRecorderStatusCommand.java
e696df4797244dff24120a6f14164a0b29575e28
[]
no_license
KostasThan/FTTSApi
https://github.com/KostasThan/FTTSApi
32683196fa6a324cc7134d2cf0490cf85f18eca4
b876ae844783b8867ed811324c36e81fe80529cc
refs/heads/master
2023-02-23T11:50:09.441000
2021-01-27T17:56:18
2021-01-27T17:56:18
281,740,863
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.commands.external; import java.util.function.Supplier; import app.model.usermacro.CommandRecorder; /** * This class is responsible for setting the {@link ChangeRecorderStatusCommand} to a provided Boolean. */ public class ChangeRecorderStatusCommand implements ExternalCommand { private CommandRecorder recorder; private Supplier<Boolean> enabledSupplier; /** * * @param recorder A {@link CommandRecorder} instance to set its enabled status. * @param enabledSupplier A Boolean Supplier to provide the enabling or not of * the recorder. */ public ChangeRecorderStatusCommand(CommandRecorder recorder, Supplier<Boolean> enabledSupplier) { this.recorder = recorder; this.enabledSupplier = enabledSupplier; } /**@Override * Sets the {@link CommandRecorder} status to the value the Boolean Supplier * provides. * */ public void execute() { recorder.setEnabled(enabledSupplier.get()); } }
UTF-8
Java
966
java
ChangeRecorderStatusCommand.java
Java
[]
null
[]
package app.commands.external; import java.util.function.Supplier; import app.model.usermacro.CommandRecorder; /** * This class is responsible for setting the {@link ChangeRecorderStatusCommand} to a provided Boolean. */ public class ChangeRecorderStatusCommand implements ExternalCommand { private CommandRecorder recorder; private Supplier<Boolean> enabledSupplier; /** * * @param recorder A {@link CommandRecorder} instance to set its enabled status. * @param enabledSupplier A Boolean Supplier to provide the enabling or not of * the recorder. */ public ChangeRecorderStatusCommand(CommandRecorder recorder, Supplier<Boolean> enabledSupplier) { this.recorder = recorder; this.enabledSupplier = enabledSupplier; } /**@Override * Sets the {@link CommandRecorder} status to the value the Boolean Supplier * provides. * */ public void execute() { recorder.setEnabled(enabledSupplier.get()); } }
966
0.738095
0.738095
34
27.411764
31.327602
103
true
false
0
0
0
0
0
0
0.941176
false
false
4
f8f9aa6b9ce9e2d3695478daa254eab28d38da97
7,352,984,076,862
bf842c0f05fe27f0652e09edb5645528a2e94205
/FileInputOutput/src/ByteOutputStreamDemo1.java
29419f7b196fc459e90973c6b7514d463dbc9416
[]
no_license
chamanbharti/core-java-project
https://github.com/chamanbharti/core-java-project
804dd3fce33823308bf08b2cad47380ae08aa3ba
6bc9f5cfe0466e2ae7fa78a6eb52eba69407610a
refs/heads/master
2021-01-21T16:18:12.232000
2017-05-20T11:08:15
2017-05-20T11:08:15
91,882,464
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.ByteArrayOutputStream; import java.io.IOException; public class ByteOutputStreamDemo1 { public static void main(String[] args) throws IOException { byte alphabets[]={'A','B','C','D','E','F','G'}; ByteArrayOutputStream baos=new ByteArrayOutputStream(); baos.write(alphabets); System.out.println("Getting all the bytes from the stream: "+baos.toString()); baos.close(); //to write a part of byte array ByteArrayOutputStream baos2=new ByteArrayOutputStream(); baos2.write(alphabets,2,4); System.out.println("Getting 4 bytes starting from 2: "+baos2.toString()); baos2.close(); } }
UTF-8
Java
624
java
ByteOutputStreamDemo1.java
Java
[]
null
[]
import java.io.ByteArrayOutputStream; import java.io.IOException; public class ByteOutputStreamDemo1 { public static void main(String[] args) throws IOException { byte alphabets[]={'A','B','C','D','E','F','G'}; ByteArrayOutputStream baos=new ByteArrayOutputStream(); baos.write(alphabets); System.out.println("Getting all the bytes from the stream: "+baos.toString()); baos.close(); //to write a part of byte array ByteArrayOutputStream baos2=new ByteArrayOutputStream(); baos2.write(alphabets,2,4); System.out.println("Getting 4 bytes starting from 2: "+baos2.toString()); baos2.close(); } }
624
0.719551
0.705128
22
27.363636
25.558392
80
false
false
0
0
0
0
0
0
2
false
false
4
7bda7c69ec4fed48dc628949b6a8d08e2f2c2517
34,763,465,327,174
f2015daaa757f53ad1f63ea79e7c7f34f6987e18
/src/lab02/MenuPrincipal.java
45a55399640e99d2896897cd4e560350298d10ad
[]
no_license
ariannmichael/lab02
https://github.com/ariannmichael/lab02
9e8844c073e5e6195917d2bcf29458cf9d1b69f6
e536eeb4230e364eedf47c5412b8e5239f405bba
refs/heads/master
2016-09-15T09:20:29.281000
2016-07-05T12:21:43
2016-07-05T12:21:43
62,634,480
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lab02; import java.util.Scanner; public class MenuPrincipal { /* * Nao eh necessario nenhum atributo de classe, pois todas as funcoes sao * realizadas na classe CompraLojaoP2 e os atributos dessa classe sao * necessarios apenas no escopo do main. */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Bem vindo ao Lojao LP2!"); System.out.println("Menu Inicial: Digite uma das opcoes abaixo: "); System.out.println("1 - Realizar compra."); System.out.println("2 - Mudar preco base de um produtos."); System.out.println("3 - Sair"); System.out.print("Opcao: "); int opcao = scanner.nextInt(); scanner.nextLine(); switch (opcao) { case 1: CompraLojaoP2.quantidadeProdutos(); CompraLojaoP2.cadastraProduto(); CompraLojaoP2.porcentagem(); CompraLojaoP2.finalizacao(); break; case 2: System.out.println("Digite o novo preco: "); double novoPreco = scanner.nextDouble(); scanner.nextLine(); CompraLojaoP2.mudaPreco(novoPreco); break; default: break; } } }
UTF-8
Java
1,153
java
MenuPrincipal.java
Java
[]
null
[]
package lab02; import java.util.Scanner; public class MenuPrincipal { /* * Nao eh necessario nenhum atributo de classe, pois todas as funcoes sao * realizadas na classe CompraLojaoP2 e os atributos dessa classe sao * necessarios apenas no escopo do main. */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Bem vindo ao Lojao LP2!"); System.out.println("Menu Inicial: Digite uma das opcoes abaixo: "); System.out.println("1 - Realizar compra."); System.out.println("2 - Mudar preco base de um produtos."); System.out.println("3 - Sair"); System.out.print("Opcao: "); int opcao = scanner.nextInt(); scanner.nextLine(); switch (opcao) { case 1: CompraLojaoP2.quantidadeProdutos(); CompraLojaoP2.cadastraProduto(); CompraLojaoP2.porcentagem(); CompraLojaoP2.finalizacao(); break; case 2: System.out.println("Digite o novo preco: "); double novoPreco = scanner.nextDouble(); scanner.nextLine(); CompraLojaoP2.mudaPreco(novoPreco); break; default: break; } } }
1,153
0.660017
0.647875
45
23.622223
21.337801
74
false
false
0
0
0
0
0
0
2.4
false
false
4
324247de9029c44ad732af9a0bf47ae0e0de4389
24,111,946,465,351
33282cfe27f403129526a3285c009ff1e35d3d53
/src/com/ymh/animal/Shout.java
a9068ce44a2c67f2119b898f122a2f15f40460a3
[]
no_license
Jeremaihyang/plugin
https://github.com/Jeremaihyang/plugin
869c3a78402282b14a912e0fbf496138c0085453
faf3903b8a64f7a8c41d1c69ff950171a0ca1a13
refs/heads/master
2020-04-06T14:02:44.081000
2018-11-14T09:44:23
2018-11-14T09:44:23
157,525,568
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ymh.animal; /** * @author: ymh * @date: 2018/11/14 * @description: **/ public interface Shout { void shout(); }
UTF-8
Java
135
java
Shout.java
Java
[ { "context": "package com.ymh.animal;\n\n/**\n * @author: ymh\n * @date: 2018/11/14\n * @description:\n **/\npublic", "end": 44, "score": 0.9996756315231323, "start": 41, "tag": "USERNAME", "value": "ymh" } ]
null
[]
package com.ymh.animal; /** * @author: ymh * @date: 2018/11/14 * @description: **/ public interface Shout { void shout(); }
135
0.592593
0.533333
11
11.272727
9.235218
24
false
false
0
0
0
0
0
0
0.181818
false
false
4
9f9ee979d9cb1e24043f5b7970be9b56f027cbdb
37,495,064,510,909
538bd1b2bb1a3aa761e265c03cbf409a9f17d94a
/Eclipse_LEARNJAVA/HibernateAnnotations/src/com/st/hibernate/test/AnnonTationOneToOneTestCase.java
dc986d22a9417d8bd88f1dc026eef23673a49a39
[]
no_license
12chakram/allsamples
https://github.com/12chakram/allsamples
6cb2ad8cc64519c4997ddd900ac8c111693cb5c4
2230c8eb0b04984efe153cd51d785d1b63fa0234
refs/heads/master
2021-01-01T15:24:49.807000
2014-06-23T22:49:48
2014-06-23T22:49:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//OneToOneTestCase.java package com.st.hibernate.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Configuration; import com.st.hibernate.vo.EmployeeOneToOne; import com.st.hibernate.vo.PersonalDetails; /** * @author user * */ public class AnnonTationOneToOneTestCase { /** * @param args */ public static void main(String[] args) throws Exception { AnnotationConfiguration cfg = new AnnotationConfiguration(); cfg.configure(); SessionFactory sf = cfg.buildSessionFactory(); Session session = sf.openSession(); EmployeeOneToOne e = (EmployeeOneToOne) session.load(EmployeeOneToOne.class, 101); System.out.println("Name:"+e.getName()); System.out.println("Sal:"+e.getSal()); PersonalDetails pd = e.getPddetails(); //System.out.println("Lname:"+pd.getLname()); /* PersonalDetails pd = (PersonalDetails)session.load(PersonalDetails.class, 101); //EmployeeOneToOne e = (EmployeeOneToOne)session.load(EmployeeOneToOne.class, 101); EmployeeOneToOne e = pd.getEmp(); System.out.println("Name:"+pd.getFname()); System.out.println("sal:"+e.getSal()); System.out.println("name:"+e.getName()); System.out.println("Empno:"+e.getEmpno()); session.close(); */ }//main }//class
UTF-8
Java
1,308
java
AnnonTationOneToOneTestCase.java
Java
[ { "context": ".st.hibernate.vo.PersonalDetails;\n\n\n/**\n * @author user\n *\n */\npublic class AnnonTationOneToOneTestCase {", "end": 324, "score": 0.9943755269050598, "start": 320, "tag": "USERNAME", "value": "user" } ]
null
[]
//OneToOneTestCase.java package com.st.hibernate.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Configuration; import com.st.hibernate.vo.EmployeeOneToOne; import com.st.hibernate.vo.PersonalDetails; /** * @author user * */ public class AnnonTationOneToOneTestCase { /** * @param args */ public static void main(String[] args) throws Exception { AnnotationConfiguration cfg = new AnnotationConfiguration(); cfg.configure(); SessionFactory sf = cfg.buildSessionFactory(); Session session = sf.openSession(); EmployeeOneToOne e = (EmployeeOneToOne) session.load(EmployeeOneToOne.class, 101); System.out.println("Name:"+e.getName()); System.out.println("Sal:"+e.getSal()); PersonalDetails pd = e.getPddetails(); //System.out.println("Lname:"+pd.getLname()); /* PersonalDetails pd = (PersonalDetails)session.load(PersonalDetails.class, 101); //EmployeeOneToOne e = (EmployeeOneToOne)session.load(EmployeeOneToOne.class, 101); EmployeeOneToOne e = pd.getEmp(); System.out.println("Name:"+pd.getFname()); System.out.println("sal:"+e.getSal()); System.out.println("name:"+e.getName()); System.out.println("Empno:"+e.getEmpno()); session.close(); */ }//main }//class
1,308
0.736239
0.729358
68
18.235294
23.022442
83
false
false
0
0
0
0
0
0
0.573529
false
false
4
19804525710ff35f16f00b1341d1ca64a015cb17
6,768,868,495,627
52a71f0ea809d49dc9dfeb79fea6aac3762f768b
/linkkin/app/src/main/java/com/asif/linkkin/utils/SharedDataSaveLoad.java
48dc416fe8f37369683e38f64cd093d44c586151
[]
no_license
mhd-asif/Android
https://github.com/mhd-asif/Android
c0ec0fba9d905d712a596473d60419a8ed9fb620
8f0c184fcd24a72719a41305867c319fb338d1cd
refs/heads/master
2021-01-10T06:30:02.299000
2018-03-13T02:43:18
2018-03-13T02:43:18
52,959,192
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.asif.linkkin.utils; import android.content.Context; import android.content.SharedPreferences; import com.asif.linkkin.R; /** * Created by newton-pc on 6/22/2015. */ public class SharedDataSaveLoad { public static void save(Context context, String key, String value) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key),Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, value); editor.commit(); } public static void save(Context context,String key, int value) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key),Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt(key, value); editor.commit(); } public static String load(Context context, String key) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key), Context.MODE_PRIVATE); return sharedPreferences.getString(key, ""); } public static int loadInteger(Context context,String key) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key), Context.MODE_PRIVATE); return sharedPreferences.getInt(key, 0); } public static void remove(Context context,String key){ SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key),Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.remove(key); editor.commit(); } }
UTF-8
Java
1,869
java
SharedDataSaveLoad.java
Java
[ { "context": "es;\n\nimport com.asif.linkkin.R;\n\n/**\n * Created by newton-pc on 6/22/2015.\n */\npublic class SharedDataSaveLoad", "end": 163, "score": 0.9996278285980225, "start": 154, "tag": "USERNAME", "value": "newton-pc" } ]
null
[]
package com.asif.linkkin.utils; import android.content.Context; import android.content.SharedPreferences; import com.asif.linkkin.R; /** * Created by newton-pc on 6/22/2015. */ public class SharedDataSaveLoad { public static void save(Context context, String key, String value) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key),Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, value); editor.commit(); } public static void save(Context context,String key, int value) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key),Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt(key, value); editor.commit(); } public static String load(Context context, String key) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key), Context.MODE_PRIVATE); return sharedPreferences.getString(key, ""); } public static int loadInteger(Context context,String key) { SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key), Context.MODE_PRIVATE); return sharedPreferences.getInt(key, 0); } public static void remove(Context context,String key){ SharedPreferences sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.preference_file_key),Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.remove(key); editor.commit(); } }
1,869
0.736758
0.732477
43
42.465115
48.775875
161
false
false
0
0
0
0
0
0
0.837209
false
false
4
3274f6ff5e7dd46c30cb9873e0f1349abde80d26
35,759,897,733,870
58f97a630f198073ea86314dd916f272220609a3
/springboot-01/src/test/java/com/cwn/springboot/Springboot01ApplicationTests.java
a21eae96be8433426bac24701689b461334f4594
[]
no_license
cwn132/springboot-01
https://github.com/cwn132/springboot-01
c9b53aa8225db5275a2c4368c5ae6be689dbe660
7584d63da75b26d1c7b2470805de6d82868eef85
refs/heads/master
2020-04-28T03:38:55.671000
2019-04-18T09:37:23
2019-04-18T09:37:23
174,937,455
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cwn.springboot; import com.cwn.springboot.bean.UserVO; import com.cwn.springboot.service.AccountService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest(classes = Springboot01Application.class) public class Springboot01ApplicationTests { // Logger logger= LoggerFactory.getLogger(getClass()); @Autowired DataSource dataSource; @Autowired private AccountService accountService; @Test public void contextLoads() throws SQLException { System.out.println("测试事务处理"); //测试事务处理 System.out.println(dataSource.getClass()); Connection con=dataSource.getConnection(); System.out.println(con); con.close(); } @Test public void testSelecUser(){ UserVO users= accountService.getUserInfoById(1); System.out.println(users.getUserid()); System.out.println(users.getAge()); System.out.println(users.getSex()); } }
UTF-8
Java
1,308
java
Springboot01ApplicationTests.java
Java
[]
null
[]
package com.cwn.springboot; import com.cwn.springboot.bean.UserVO; import com.cwn.springboot.service.AccountService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest(classes = Springboot01Application.class) public class Springboot01ApplicationTests { // Logger logger= LoggerFactory.getLogger(getClass()); @Autowired DataSource dataSource; @Autowired private AccountService accountService; @Test public void contextLoads() throws SQLException { System.out.println("测试事务处理"); //测试事务处理 System.out.println(dataSource.getClass()); Connection con=dataSource.getConnection(); System.out.println(con); con.close(); } @Test public void testSelecUser(){ UserVO users= accountService.getUserInfoById(1); System.out.println(users.getUserid()); System.out.println(users.getAge()); System.out.println(users.getSex()); } }
1,308
0.733645
0.728972
50
24.66
20.736065
62
false
false
0
0
0
0
0
0
0.48
false
false
4
187acb2cf45f6ffed7f85eb42cc4547572480c87
34,016,141,027,243
ce7f3538aa56c55f5ce70ed9cecb621bc63d9536
/android/stable/src/Mono/src/main/java/com/fourtwosix/mono/utils/ZipHelper.java
c95756efd261852e02fd9d8b2caf0ebf704bcac0
[]
no_license
ozone-development/mono-ozone-mobile-prototype
https://github.com/ozone-development/mono-ozone-mobile-prototype
a070287ba79e0786d988a563d70394b7425b4cca
1dc7b81f32bc9b4821af7f29609f667c2be5694c
refs/heads/master
2018-01-10T16:03:14.141000
2016-02-02T16:44:40
2016-02-02T16:44:40
50,843,433
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fourtwosix.mono.utils; /** * Created by Corey on 1/30/14. */ public class ZipHelper { }
UTF-8
Java
103
java
ZipHelper.java
Java
[ { "context": "kage com.fourtwosix.mono.utils;\n\n/**\n * Created by Corey on 1/30/14.\n */\npublic class ZipHelper {\n}\n", "end": 59, "score": 0.9395686388015747, "start": 54, "tag": "USERNAME", "value": "Corey" } ]
null
[]
package com.fourtwosix.mono.utils; /** * Created by Corey on 1/30/14. */ public class ZipHelper { }
103
0.679612
0.631068
7
13.714286
14.119027
34
false
false
0
0
0
0
0
0
0.142857
false
false
4
235c14352836e06d10d1855ee131823e38856d9b
37,014,028,170,211
14956dbed8ae4fba1d65b9829d9405fcf43ac698
/Cyber Security/Capture the Flag Competitions/2020/STACK the Flags/Mobile/Decompiled/sources/f/a/a/a/a/c/c/a.java
54a250d0ea5c6f29169f9bcdd26b569386071fd4
[]
no_license
Hackin7/Programming-Crappy-Solutions
https://github.com/Hackin7/Programming-Crappy-Solutions
ae8bbddad92a48cf70976cec91bf66234c9b4d39
ffa3b3c26a6a06446cc49c8ac4f35b6d30b1ee0f
refs/heads/master
2023-03-21T01:21:00.764000
2022-12-28T14:22:33
2022-12-28T14:22:33
201,292,128
12
7
null
false
2023-03-05T16:05:34
2019-08-08T16:00:21
2023-01-10T17:53:26
2023-03-05T16:05:30
1,484,903
8
5
24
Roff
false
false
package f.a.a.a.a.c.c; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import sg.gov.tech.ctf.mobile.R; import sg.gov.tech.ctf.mobile.User.UserHomeActivity; public class a extends RecyclerView.g<View$OnClickListenerC0064a> { /* renamed from: c reason: collision with root package name */ public ArrayList<b> f2868c; /* renamed from: d reason: collision with root package name */ public b f2869d; public interface b { } /* Return type fixed from 'androidx.recyclerview.widget.RecyclerView$b0' to match base method */ @Override // androidx.recyclerview.widget.RecyclerView.g public /* bridge */ /* synthetic */ View$OnClickListenerC0064a j(ViewGroup viewGroup, int i) { return s(viewGroup); } public a(ArrayList<b> arrayList, b aboutListener) { this.f2868c = arrayList; this.f2869d = aboutListener; } public View$OnClickListenerC0064a s(ViewGroup parent) { return new View$OnClickListenerC0064a(LayoutInflater.from(parent.getContext()).inflate(R.layout.about_us_card_design, parent, false), this.f2869d); } /* renamed from: r */ public void h(View$OnClickListenerC0064a holder, int position) { b aboutHelperClass = this.f2868c.get(position); holder.u.setText(aboutHelperClass.b()); holder.v.setText(aboutHelperClass.c()); holder.w.setBackground(aboutHelperClass.a()); } @Override // androidx.recyclerview.widget.RecyclerView.g public int c() { return this.f2868c.size(); } /* renamed from: f.a.a.a.a.c.c.a$a reason: collision with other inner class name */ public static class View$OnClickListenerC0064a extends RecyclerView.b0 implements View.OnClickListener { public TextView u; public TextView v; public RelativeLayout w; public b x; public View$OnClickListenerC0064a(View itemView, b aboutListener) { super(itemView); this.u = (TextView) itemView.findViewById(R.id.about_us_text_details); this.v = (TextView) itemView.findViewById(R.id.about_us_text); this.w = (RelativeLayout) itemView.findViewById(R.id.about_us_bg); this.x = aboutListener; itemView.setOnClickListener(this); } public void onClick(View view) { ((UserHomeActivity) this.x).b(j()); } } }
UTF-8
Java
2,650
java
a.java
Java
[]
null
[]
package f.a.a.a.a.c.c; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import sg.gov.tech.ctf.mobile.R; import sg.gov.tech.ctf.mobile.User.UserHomeActivity; public class a extends RecyclerView.g<View$OnClickListenerC0064a> { /* renamed from: c reason: collision with root package name */ public ArrayList<b> f2868c; /* renamed from: d reason: collision with root package name */ public b f2869d; public interface b { } /* Return type fixed from 'androidx.recyclerview.widget.RecyclerView$b0' to match base method */ @Override // androidx.recyclerview.widget.RecyclerView.g public /* bridge */ /* synthetic */ View$OnClickListenerC0064a j(ViewGroup viewGroup, int i) { return s(viewGroup); } public a(ArrayList<b> arrayList, b aboutListener) { this.f2868c = arrayList; this.f2869d = aboutListener; } public View$OnClickListenerC0064a s(ViewGroup parent) { return new View$OnClickListenerC0064a(LayoutInflater.from(parent.getContext()).inflate(R.layout.about_us_card_design, parent, false), this.f2869d); } /* renamed from: r */ public void h(View$OnClickListenerC0064a holder, int position) { b aboutHelperClass = this.f2868c.get(position); holder.u.setText(aboutHelperClass.b()); holder.v.setText(aboutHelperClass.c()); holder.w.setBackground(aboutHelperClass.a()); } @Override // androidx.recyclerview.widget.RecyclerView.g public int c() { return this.f2868c.size(); } /* renamed from: f.a.a.a.a.c.c.a$a reason: collision with other inner class name */ public static class View$OnClickListenerC0064a extends RecyclerView.b0 implements View.OnClickListener { public TextView u; public TextView v; public RelativeLayout w; public b x; public View$OnClickListenerC0064a(View itemView, b aboutListener) { super(itemView); this.u = (TextView) itemView.findViewById(R.id.about_us_text_details); this.v = (TextView) itemView.findViewById(R.id.about_us_text); this.w = (RelativeLayout) itemView.findViewById(R.id.about_us_bg); this.x = aboutListener; itemView.setOnClickListener(this); } public void onClick(View view) { ((UserHomeActivity) this.x).b(j()); } } }
2,650
0.660755
0.638868
72
34.805557
31.716032
155
false
false
0
0
0
0
0
0
0.541667
false
false
4
97551714eb93e74e10d31a3ec826ff6133e4f941
37,125,697,321,003
3f0add3e810ce5fe583e1936304d0fcc2458e4de
/core/src/main/java/edu/neu/ccs/pyramid/application/FeatureBinarizer.java
8ee1b98d519b8f7005da42f28d43cd3521ed6e29
[ "Apache-2.0" ]
permissive
5l1v3r1/pyramid-1
https://github.com/5l1v3r1/pyramid-1
9067cf246276f898603b13d4283db8bd596c7ff9
68df0531475ac89b0169fd4aa98a278db9ff9df2
refs/heads/master
2022-12-27T15:33:10.758000
2020-05-16T19:40:58
2020-05-16T19:40:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.neu.ccs.pyramid.application; import edu.neu.ccs.pyramid.configuration.Config; import edu.neu.ccs.pyramid.dataset.DataSet; import edu.neu.ccs.pyramid.dataset.DataSetType; import edu.neu.ccs.pyramid.dataset.DataSetUtil; import edu.neu.ccs.pyramid.dataset.TRECFormat; import java.util.List; /** * Created by chengli on 6/11/15. */ public class FeatureBinarizer { public static void main(String[] args) throws Exception{ Config config = new Config(args[0]); System.out.println(config); List<String> inputs = config.getStrings("input.trecFolders"); List<String> outputs = config.getStrings("output.trecFolders"); if (inputs.size()!=outputs.size()){ throw new IllegalArgumentException("inputs.size()!=outputs.size()"); } for (int i=0;i<inputs.size();i++){ String input = inputs.get(i); String output = outputs.get(i); binarize(config,input,output); } } private static void binarize(Config config, String inputData, String outputData) throws Exception{ String dataType = config.getString("dataSetType"); DataSet dataSet; switch (dataType){ case "reg": dataSet = TRECFormat.loadRegDataSet(inputData, DataSetType.REG_SPARSE,true); break; case "clf": dataSet = TRECFormat.loadClfDataSet(inputData,DataSetType.CLF_SPARSE,true); break; case "multiLabel": dataSet = TRECFormat.loadMultiLabelClfDataSet(inputData,DataSetType.ML_CLF_SPARSE,true); break; default: throw new IllegalArgumentException("unknown type"); } DataSetUtil.binarizeFeature(dataSet); TRECFormat.save(dataSet,outputData); } }
UTF-8
Java
1,839
java
FeatureBinarizer.java
Java
[ { "context": "Format;\n\nimport java.util.List;\n\n/**\n * Created by chengli on 6/11/15.\n */\npublic class FeatureBinarizer {\n ", "end": 328, "score": 0.9994427561759949, "start": 321, "tag": "USERNAME", "value": "chengli" } ]
null
[]
package edu.neu.ccs.pyramid.application; import edu.neu.ccs.pyramid.configuration.Config; import edu.neu.ccs.pyramid.dataset.DataSet; import edu.neu.ccs.pyramid.dataset.DataSetType; import edu.neu.ccs.pyramid.dataset.DataSetUtil; import edu.neu.ccs.pyramid.dataset.TRECFormat; import java.util.List; /** * Created by chengli on 6/11/15. */ public class FeatureBinarizer { public static void main(String[] args) throws Exception{ Config config = new Config(args[0]); System.out.println(config); List<String> inputs = config.getStrings("input.trecFolders"); List<String> outputs = config.getStrings("output.trecFolders"); if (inputs.size()!=outputs.size()){ throw new IllegalArgumentException("inputs.size()!=outputs.size()"); } for (int i=0;i<inputs.size();i++){ String input = inputs.get(i); String output = outputs.get(i); binarize(config,input,output); } } private static void binarize(Config config, String inputData, String outputData) throws Exception{ String dataType = config.getString("dataSetType"); DataSet dataSet; switch (dataType){ case "reg": dataSet = TRECFormat.loadRegDataSet(inputData, DataSetType.REG_SPARSE,true); break; case "clf": dataSet = TRECFormat.loadClfDataSet(inputData,DataSetType.CLF_SPARSE,true); break; case "multiLabel": dataSet = TRECFormat.loadMultiLabelClfDataSet(inputData,DataSetType.ML_CLF_SPARSE,true); break; default: throw new IllegalArgumentException("unknown type"); } DataSetUtil.binarizeFeature(dataSet); TRECFormat.save(dataSet,outputData); } }
1,839
0.63404
0.630234
53
33.698112
28.036085
104
false
false
0
0
0
0
0
0
0.735849
false
false
4
c6093431b2b493e4de78ffc29e891e368c08dfec
31,387,621,061,033
3017062f50059d8cb18659287981a7b31ee19280
/src/main/java/com/funtalk/utils/Utils.java
b5e76fea0a31d5d7c0c240ace46d69eb12fd2f1a
[]
no_license
funtalkTelecom/funtalk-iot-web
https://github.com/funtalkTelecom/funtalk-iot-web
e4ee4a8a2c2a66a9b73fb2eee24f658c0b38d1f4
566af392a7afd1ed2e5718b861502ec2bfae6812
refs/heads/master
2022-12-12T11:15:22.043000
2020-09-11T03:55:23
2020-09-11T03:55:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.funtalk.utils; import net.sf.json.JSONObject; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.*; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; public class Utils { public static final Logger log = LoggerFactory.getLogger(Utils.class); public static String returnResult(Result res){ return returnJson(res.getCode(), res.getMsg()); } private static String returnJson(int code, Object data){ Result res = new Result(code, data); JSONObject jobj = JSONObject.fromObject(res); return render(jobj.toString(), "text/json;charset=UTF-8"); } public static String renderHtml(HttpServletResponse response,String text) { return render(text, "text/html;charset=UTF-8"); } public static String renderJson(HttpServletResponse response,String text) { return render(text, "text/json;charset=UTF-8"); } public static String renderXml(String text) { return render(text, "text/xml;charset=UTF-8"); } public static String render(String text, String contentType) { HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse(); PrintWriter w = null; try{ response.setHeader("Cache-Control", "no-cache"); response.setContentType(contentType); w = response.getWriter(); w.write(text); w.flush(); } catch (Exception e) { log.error("", e); } finally { if(w != null){ w.close(); w = null; } } return null; } /* * 是否以AJAX的方式提交的 * @return * */ public final static boolean isAjax(HttpServletRequest request){ String requestType =request.getHeader("X-Requested-With"); String app = request.getParameter("__app"); if ((requestType != null && requestType.equals("XMLHttpRequest")) ||(app != null && "xcx".equals(app))) { return true; } else { return false; } } public static String formatXlsCell(HSSFCell cell) { if (cell == null) { return ""; } DecimalFormat df = new DecimalFormat("0.00"); switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_NUMERIC: //日期格式的处理 if (HSSFDateUtil.isCellDateFormatted(cell)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue())).toString(); } return df.format(cell.getNumericCellValue()); //字符串 case HSSFCell.CELL_TYPE_STRING: return cell.getStringCellValue(); // 公式 case HSSFCell.CELL_TYPE_FORMULA: return cell.getCellFormula(); // 空白 case HSSFCell.CELL_TYPE_BLANK: return ""; // 布尔取值 case HSSFCell.CELL_TYPE_BOOLEAN: return cell.getBooleanCellValue() + ""; //错误类型 case HSSFCell.CELL_TYPE_ERROR: return cell.getErrorCellValue() + ""; } return ""; } public static Map<String,String> getParamMap(HttpServletRequest request) { Map<String,String> params = new HashMap<>(); Enumeration<?> e= request.getParameterNames(); while (e.hasMoreElements()) { String object = (String) e.nextElement(); String[] values = (String[])request.getParameterValues(object); String valueStr = ""; for (int i = 0; i < values.length; i++) { valueStr = (i == values.length - 1) ? valueStr + values[i]: valueStr + values[i] + ","; } //乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化 //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk"); params.put(object, valueStr); } return params; } public static String getParamBody(HttpServletRequest request) { InputStream is = null; BufferedReader reader = null; try { is = request.getInputStream(); reader = new BufferedReader(new InputStreamReader(is,"UTF-8")); StringBuffer buffer = new StringBuffer(); String line=null; while((line = reader.readLine())!=null){ buffer.append(line); } return buffer.toString(); } catch (Exception e) { log.error("解析参数流异常",e); return null; }finally{ try { if(is != null) { is.close(); is = null; } if(reader != null){ reader.close(); reader = null; } } catch (IOException e) { log.error("",e); } } } public static Map<String, String> xmlToMap(String strXML) throws Exception { try { Map<String, String> data = new HashMap<String, String>(); DocumentBuilder documentBuilder = newDocumentBuilder(); InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8")); org.w3c.dom.Document doc = documentBuilder.parse(stream); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getDocumentElement().getChildNodes(); for (int idx = 0; idx < nodeList.getLength(); ++idx) { Node node = nodeList.item(idx); if (node.getNodeType() == Node.ELEMENT_NODE) { org.w3c.dom.Element element = (org.w3c.dom.Element) node; data.put(element.getNodeName(), element.getTextContent()); } } try { stream.close(); } catch (Exception ex) { // do nothing } return data; } catch (Exception ex) { log.info("Invalid XML, can not convert to map. Error message: {}. XML content: {}", ex.getMessage(), strXML); throw ex; } } /** * 将Map转换为XML格式的字符串 * * @param data Map类型数据 * @return XML格式的字符串 * @throws Exception */ public static String mapToXml(Map<String, String> data) throws Exception { org.w3c.dom.Document document = newDocument(); org.w3c.dom.Element root = document.createElement("xml"); document.appendChild(root); for (String key: data.keySet()) { String value = data.get(key); if (value == null) { value = ""; } value = value.trim(); org.w3c.dom.Element filed = document.createElement(key); filed.appendChild(document.createTextNode(value)); root.appendChild(filed); } TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); DOMSource source = new DOMSource(document); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); transformer.transform(source, result); String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", ""); try { writer.close(); } catch (Exception ex) { } return output; } public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); documentBuilderFactory.setXIncludeAware(false); documentBuilderFactory.setExpandEntityReferences(false); return documentBuilderFactory.newDocumentBuilder(); } public static Document newDocument() throws ParserConfigurationException { return newDocumentBuilder().newDocument(); } public static String getIpAddress(HttpServletRequest request) { String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); System.out.println("-------Proxy-Client-IP------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); System.out.println("-------WL-Proxy-Client-IP------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_CLIENT_IP"); System.out.println("-------HTTP_CLIENT_IP------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_X_FORWARDED_FOR"); System.out.println("-------HTTP_X_FORWARDED_FOR------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); System.out.println("-------WL-Proxy-Client-IP------>"+ip); } return ip; } public static Map<String, String> getHeadersInfo(HttpServletRequest request) { Map<String, String> map = new HashMap<String, String>(); Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String key = (String) headerNames.nextElement(); String value = request.getHeader(key); map.put(key, value); } return map; } }
UTF-8
Java
9,755
java
Utils.java
Java
[]
null
[]
package com.funtalk.utils; import net.sf.json.JSONObject; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.*; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; public class Utils { public static final Logger log = LoggerFactory.getLogger(Utils.class); public static String returnResult(Result res){ return returnJson(res.getCode(), res.getMsg()); } private static String returnJson(int code, Object data){ Result res = new Result(code, data); JSONObject jobj = JSONObject.fromObject(res); return render(jobj.toString(), "text/json;charset=UTF-8"); } public static String renderHtml(HttpServletResponse response,String text) { return render(text, "text/html;charset=UTF-8"); } public static String renderJson(HttpServletResponse response,String text) { return render(text, "text/json;charset=UTF-8"); } public static String renderXml(String text) { return render(text, "text/xml;charset=UTF-8"); } public static String render(String text, String contentType) { HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse(); PrintWriter w = null; try{ response.setHeader("Cache-Control", "no-cache"); response.setContentType(contentType); w = response.getWriter(); w.write(text); w.flush(); } catch (Exception e) { log.error("", e); } finally { if(w != null){ w.close(); w = null; } } return null; } /* * 是否以AJAX的方式提交的 * @return * */ public final static boolean isAjax(HttpServletRequest request){ String requestType =request.getHeader("X-Requested-With"); String app = request.getParameter("__app"); if ((requestType != null && requestType.equals("XMLHttpRequest")) ||(app != null && "xcx".equals(app))) { return true; } else { return false; } } public static String formatXlsCell(HSSFCell cell) { if (cell == null) { return ""; } DecimalFormat df = new DecimalFormat("0.00"); switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_NUMERIC: //日期格式的处理 if (HSSFDateUtil.isCellDateFormatted(cell)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue())).toString(); } return df.format(cell.getNumericCellValue()); //字符串 case HSSFCell.CELL_TYPE_STRING: return cell.getStringCellValue(); // 公式 case HSSFCell.CELL_TYPE_FORMULA: return cell.getCellFormula(); // 空白 case HSSFCell.CELL_TYPE_BLANK: return ""; // 布尔取值 case HSSFCell.CELL_TYPE_BOOLEAN: return cell.getBooleanCellValue() + ""; //错误类型 case HSSFCell.CELL_TYPE_ERROR: return cell.getErrorCellValue() + ""; } return ""; } public static Map<String,String> getParamMap(HttpServletRequest request) { Map<String,String> params = new HashMap<>(); Enumeration<?> e= request.getParameterNames(); while (e.hasMoreElements()) { String object = (String) e.nextElement(); String[] values = (String[])request.getParameterValues(object); String valueStr = ""; for (int i = 0; i < values.length; i++) { valueStr = (i == values.length - 1) ? valueStr + values[i]: valueStr + values[i] + ","; } //乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化 //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk"); params.put(object, valueStr); } return params; } public static String getParamBody(HttpServletRequest request) { InputStream is = null; BufferedReader reader = null; try { is = request.getInputStream(); reader = new BufferedReader(new InputStreamReader(is,"UTF-8")); StringBuffer buffer = new StringBuffer(); String line=null; while((line = reader.readLine())!=null){ buffer.append(line); } return buffer.toString(); } catch (Exception e) { log.error("解析参数流异常",e); return null; }finally{ try { if(is != null) { is.close(); is = null; } if(reader != null){ reader.close(); reader = null; } } catch (IOException e) { log.error("",e); } } } public static Map<String, String> xmlToMap(String strXML) throws Exception { try { Map<String, String> data = new HashMap<String, String>(); DocumentBuilder documentBuilder = newDocumentBuilder(); InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8")); org.w3c.dom.Document doc = documentBuilder.parse(stream); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getDocumentElement().getChildNodes(); for (int idx = 0; idx < nodeList.getLength(); ++idx) { Node node = nodeList.item(idx); if (node.getNodeType() == Node.ELEMENT_NODE) { org.w3c.dom.Element element = (org.w3c.dom.Element) node; data.put(element.getNodeName(), element.getTextContent()); } } try { stream.close(); } catch (Exception ex) { // do nothing } return data; } catch (Exception ex) { log.info("Invalid XML, can not convert to map. Error message: {}. XML content: {}", ex.getMessage(), strXML); throw ex; } } /** * 将Map转换为XML格式的字符串 * * @param data Map类型数据 * @return XML格式的字符串 * @throws Exception */ public static String mapToXml(Map<String, String> data) throws Exception { org.w3c.dom.Document document = newDocument(); org.w3c.dom.Element root = document.createElement("xml"); document.appendChild(root); for (String key: data.keySet()) { String value = data.get(key); if (value == null) { value = ""; } value = value.trim(); org.w3c.dom.Element filed = document.createElement(key); filed.appendChild(document.createTextNode(value)); root.appendChild(filed); } TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); DOMSource source = new DOMSource(document); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); transformer.transform(source, result); String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", ""); try { writer.close(); } catch (Exception ex) { } return output; } public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); documentBuilderFactory.setXIncludeAware(false); documentBuilderFactory.setExpandEntityReferences(false); return documentBuilderFactory.newDocumentBuilder(); } public static Document newDocument() throws ParserConfigurationException { return newDocumentBuilder().newDocument(); } public static String getIpAddress(HttpServletRequest request) { String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); System.out.println("-------Proxy-Client-IP------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); System.out.println("-------WL-Proxy-Client-IP------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_CLIENT_IP"); System.out.println("-------HTTP_CLIENT_IP------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_X_FORWARDED_FOR"); System.out.println("-------HTTP_X_FORWARDED_FOR------>"+ip); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); System.out.println("-------WL-Proxy-Client-IP------>"+ip); } return ip; } public static Map<String, String> getHeadersInfo(HttpServletRequest request) { Map<String, String> map = new HashMap<String, String>(); Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String key = (String) headerNames.nextElement(); String value = request.getHeader(key); map.put(key, value); } return map; } }
9,755
0.699551
0.695997
310
29.867743
26.935143
119
false
false
0
0
0
0
0
0
2.6
false
false
4
daaca7b0aff0c94d00d571ad7d0c74b67427df77
24,395,414,260,300
c186a38048f3840762d84272f74323da87de256c
/social/src/main/java/org/soluvas/social/Target.java
20dddbfe7fbfe31c437be7b91125ac7b56f28059
[]
no_license
soluvas/soluvas-framework
https://github.com/soluvas/soluvas-framework
15090df3dd6ef1f0db30595073909684a78bb6d0
5061ae21cad2472cf0b1e62ae906affb8e132787
refs/heads/master
2022-12-11T18:48:40.633000
2021-10-09T19:42:30
2021-10-09T19:42:30
3,869,967
10
5
null
false
2022-11-24T04:38:40
2012-03-29T19:56:33
2022-10-24T01:54:51
2022-11-24T04:38:37
19,775
10
5
43
Java
false
false
/** */ package org.soluvas.social; import java.util.List; import org.soluvas.commons.Describable; import org.soluvas.commons.NsPrefixable; import org.soluvas.social.impl.TargetImpl; import org.soluvas.social.schema.TargetType; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Target</b></em>'. * <!-- end-user-doc --> * * <!-- begin-model-doc --> * Objects * * Objects represent "entities" that users can act on in your app. Most Open Graph objects are web pages hosted on a public website, with Open Graph-specific meta tags embedded within the page. Facebook routinely scrapes these web pages, extracting the data contained in the meta tags in order to generate stories that it displays on peoples' News Feeds and Timelines. * * Previously, users were able to connect to objects in your app via the like action. Now, you can model user interactions with custom actions and objects for richer connections with your users. * Types * Built-in Objects * * Facebook has defined a set of objects that can be used without any further customization on your part. * * Article * Blog * Book * Profile (External) * Movie * TV Episode * TV Show * Video * Website * * Custom Objects * * You have the ability to create your own objects and define all properties of those objects. * Privacy Model * * Objects are public entities that reside on the internet and must be available to Facebook's "scraper". All information defined in an object should be considered as public. You should anticipate that all information is easily accessible to anyone on the internet and therefore, no sensitive information or information that is exclusive for a user or set of users is stored. * * ______________________ * * Direct and Indirect Objects * * A direct object is the receiver of action within a sentence, as in "He hit the ball." Be careful to distinguish between a direct object and an object complement: * * They named their daughter Natasha. * * In that sentence, "daughter" is the direct object and "Natasha" is the object complement, which renames or describes the direct object. * * The indirect object identifies to or for whom or what the action of the verb is performed. The direct object and indirect object are different people or places or things. The direct objects in the sentences below are in boldface; the indirect objects are in italics. * * The instructor gave his students A's. * Grandfather left Rosalita and Raoul all his money. * Jo-Bob sold me her boat. * * Incidentally, the word me (and similar object-form pronouns such as him, us, them) is not always an indirect object; it will also serve, sometimes, as a direct object. * * Bless me/her/us! * Call me/him/them if you have questions. * * In English, nouns and their accompanying modifiers (articles and adjectives) do not change form when they are used as objects or indirect objects, as they do in many other languages. "The radio is on the desk" and "I borrowed the radio" contain exactly the same word form used for quite different functions. This is not true of pronouns, however, which use different forms for different functions. (He [subject] loves his grandmother. His grandmother loves him [object].) (See, also, pronoun cases.) * * Reference: http://grammar.ccc.commnet.edu/grammar/objects.htm * <!-- end-model-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link org.soluvas.social.Target#getTargetType <em>Target Type</em>}</li> * <li>{@link org.soluvas.social.Target#getTitle <em>Title</em>}</li> * <li>{@link org.soluvas.social.Target#getImages <em>Images</em>}</li> * <li>{@link org.soluvas.social.Target#getUri <em>Uri</em>}</li> * <li>{@link org.soluvas.social.Target#getTypeName <em>Type Name</em>}</li> * </ul> * </p> * * @see org.soluvas.social.SocialPackage#getTarget() * @model abstract="true" * @generated */ @JsonDeserialize(as=TargetImpl.class) public interface Target extends NsPrefixable, Describable { /** * Returns the value of the '<em><b>Target Type</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Target Type</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Target Type</em>' reference. * @see #setTargetType(TargetType) * @see org.soluvas.social.SocialPackage#getTarget_TargetType() * @model * @generated */ TargetType getTargetType(); /** * Sets the value of the '{@link org.soluvas.social.Target#getTargetType <em>Target Type</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Target Type</em>' reference. * @see #getTargetType() * @generated */ void setTargetType(TargetType value); /** * Returns the value of the '<em><b>Title</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Object Name. * <!-- end-model-doc --> * @return the value of the '<em>Title</em>' attribute. * @see #setTitle(String) * @see org.soluvas.social.SocialPackage#getTarget_Title() * @model * @generated */ String getTitle(); /** * Sets the value of the '{@link org.soluvas.social.Target#getTitle <em>Title</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Title</em>' attribute. * @see #getTitle() * @generated */ void setTitle(String value); /** * Returns the value of the '<em><b>Images</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Array of images * <!-- end-model-doc --> * @return the value of the '<em>Images</em>' attribute. * @see #setImages(List) * @see org.soluvas.social.SocialPackage#getTarget_Images() * @model dataType="org.soluvas.commons.List<org.eclipse.emf.ecore.EString>" many="false" * @generated */ List<String> getImages(); /** * Sets the value of the '{@link org.soluvas.social.Target#getImages <em>Images</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Images</em>' attribute. * @see #getImages() * @generated */ void setImages(List<String> value); /** * Returns the value of the '<em><b>Uri</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Open Graph URL of the Profile * <!-- end-model-doc --> * @return the value of the '<em>Uri</em>' attribute. * @see #setUri(String) * @see org.soluvas.social.SocialPackage#getTarget_Uri() * @model * @generated */ String getUri(); /** * Sets the value of the '{@link org.soluvas.social.Target#getUri <em>Uri</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Uri</em>' attribute. * @see #getUri() * @generated */ void setUri(String value); /** * Returns the value of the '<em><b>Type Name</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Type Name</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Type Name</em>' attribute. * @see #setTypeName(String) * @see org.soluvas.social.SocialPackage#getTarget_TypeName() * @model * @generated */ String getTypeName(); /** * Sets the value of the '{@link org.soluvas.social.Target#getTypeName <em>Type Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Type Name</em>' attribute. * @see #getTypeName() * @generated */ void setTypeName(String value); } // Target
UTF-8
Java
7,958
java
Target.java
Java
[ { "context": "t complement:\n * \n * They named their daughter Natasha.\n * \n * In that sentence, \"daughter\" is the direc", "end": 2112, "score": 0.999711811542511, "start": 2105, "tag": "NAME", "value": "Natasha" }, { "context": "their daughter Natasha.\n * \n * In that sente...
null
[]
/** */ package org.soluvas.social; import java.util.List; import org.soluvas.commons.Describable; import org.soluvas.commons.NsPrefixable; import org.soluvas.social.impl.TargetImpl; import org.soluvas.social.schema.TargetType; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Target</b></em>'. * <!-- end-user-doc --> * * <!-- begin-model-doc --> * Objects * * Objects represent "entities" that users can act on in your app. Most Open Graph objects are web pages hosted on a public website, with Open Graph-specific meta tags embedded within the page. Facebook routinely scrapes these web pages, extracting the data contained in the meta tags in order to generate stories that it displays on peoples' News Feeds and Timelines. * * Previously, users were able to connect to objects in your app via the like action. Now, you can model user interactions with custom actions and objects for richer connections with your users. * Types * Built-in Objects * * Facebook has defined a set of objects that can be used without any further customization on your part. * * Article * Blog * Book * Profile (External) * Movie * TV Episode * TV Show * Video * Website * * Custom Objects * * You have the ability to create your own objects and define all properties of those objects. * Privacy Model * * Objects are public entities that reside on the internet and must be available to Facebook's "scraper". All information defined in an object should be considered as public. You should anticipate that all information is easily accessible to anyone on the internet and therefore, no sensitive information or information that is exclusive for a user or set of users is stored. * * ______________________ * * Direct and Indirect Objects * * A direct object is the receiver of action within a sentence, as in "He hit the ball." Be careful to distinguish between a direct object and an object complement: * * They named their daughter Natasha. * * In that sentence, "daughter" is the direct object and "Natasha" is the object complement, which renames or describes the direct object. * * The indirect object identifies to or for whom or what the action of the verb is performed. The direct object and indirect object are different people or places or things. The direct objects in the sentences below are in boldface; the indirect objects are in italics. * * The instructor gave his students A's. * Grandfather left Rosalita and Raoul all his money. * Jo-Bob sold me her boat. * * Incidentally, the word me (and similar object-form pronouns such as him, us, them) is not always an indirect object; it will also serve, sometimes, as a direct object. * * Bless me/her/us! * Call me/him/them if you have questions. * * In English, nouns and their accompanying modifiers (articles and adjectives) do not change form when they are used as objects or indirect objects, as they do in many other languages. "The radio is on the desk" and "I borrowed the radio" contain exactly the same word form used for quite different functions. This is not true of pronouns, however, which use different forms for different functions. (He [subject] loves his grandmother. His grandmother loves him [object].) (See, also, pronoun cases.) * * Reference: http://grammar.ccc.commnet.edu/grammar/objects.htm * <!-- end-model-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link org.soluvas.social.Target#getTargetType <em>Target Type</em>}</li> * <li>{@link org.soluvas.social.Target#getTitle <em>Title</em>}</li> * <li>{@link org.soluvas.social.Target#getImages <em>Images</em>}</li> * <li>{@link org.soluvas.social.Target#getUri <em>Uri</em>}</li> * <li>{@link org.soluvas.social.Target#getTypeName <em>Type Name</em>}</li> * </ul> * </p> * * @see org.soluvas.social.SocialPackage#getTarget() * @model abstract="true" * @generated */ @JsonDeserialize(as=TargetImpl.class) public interface Target extends NsPrefixable, Describable { /** * Returns the value of the '<em><b>Target Type</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Target Type</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Target Type</em>' reference. * @see #setTargetType(TargetType) * @see org.soluvas.social.SocialPackage#getTarget_TargetType() * @model * @generated */ TargetType getTargetType(); /** * Sets the value of the '{@link org.soluvas.social.Target#getTargetType <em>Target Type</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Target Type</em>' reference. * @see #getTargetType() * @generated */ void setTargetType(TargetType value); /** * Returns the value of the '<em><b>Title</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Object Name. * <!-- end-model-doc --> * @return the value of the '<em>Title</em>' attribute. * @see #setTitle(String) * @see org.soluvas.social.SocialPackage#getTarget_Title() * @model * @generated */ String getTitle(); /** * Sets the value of the '{@link org.soluvas.social.Target#getTitle <em>Title</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Title</em>' attribute. * @see #getTitle() * @generated */ void setTitle(String value); /** * Returns the value of the '<em><b>Images</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Array of images * <!-- end-model-doc --> * @return the value of the '<em>Images</em>' attribute. * @see #setImages(List) * @see org.soluvas.social.SocialPackage#getTarget_Images() * @model dataType="org.soluvas.commons.List<org.eclipse.emf.ecore.EString>" many="false" * @generated */ List<String> getImages(); /** * Sets the value of the '{@link org.soluvas.social.Target#getImages <em>Images</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Images</em>' attribute. * @see #getImages() * @generated */ void setImages(List<String> value); /** * Returns the value of the '<em><b>Uri</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Open Graph URL of the Profile * <!-- end-model-doc --> * @return the value of the '<em>Uri</em>' attribute. * @see #setUri(String) * @see org.soluvas.social.SocialPackage#getTarget_Uri() * @model * @generated */ String getUri(); /** * Sets the value of the '{@link org.soluvas.social.Target#getUri <em>Uri</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Uri</em>' attribute. * @see #getUri() * @generated */ void setUri(String value); /** * Returns the value of the '<em><b>Type Name</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Type Name</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Type Name</em>' attribute. * @see #setTypeName(String) * @see org.soluvas.social.SocialPackage#getTarget_TypeName() * @model * @generated */ String getTypeName(); /** * Sets the value of the '{@link org.soluvas.social.Target#getTypeName <em>Type Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Type Name</em>' attribute. * @see #getTypeName() * @generated */ void setTypeName(String value); } // Target
7,958
0.667253
0.667253
217
35.67281
57.668919
502
false
false
0
0
0
0
0
0
0.728111
false
false
4
5021767ca5ba3c31b912ebff2e2b6c6cc17d6a22
32,375,463,525,295
8beba3ec839fc0203fd954105390b5b054ab72cb
/src/test/java/com/examples/one/petstore/KittenTest.java
ad830370ec391fc7958e0b96d0c5e4ffe2480d0b
[]
no_license
buhaa95/CI_Tutorial
https://github.com/buhaa95/CI_Tutorial
4c70dcb4f8c639b75ac56d12752af2f917abf947
5cb3e81c44989105c34813a4ef627f1951c0df62
refs/heads/master
2016-06-07T17:04:59.236000
2016-03-14T09:16:59
2016-03-14T09:16:59
53,835,704
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.examples.one.petstore; import org.junit.*; public class KittenTest{ Kitten k; public KittenTest(){ } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { k = null; } @Test (expected = IllegalArgumentException.class) public void BreedTest(){ k = new Kitten(2, "Sparkles", "Cat"); } }
UTF-8
Java
531
java
KittenTest.java
Java
[]
null
[]
package com.examples.one.petstore; import org.junit.*; public class KittenTest{ Kitten k; public KittenTest(){ } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { k = null; } @Test (expected = IllegalArgumentException.class) public void BreedTest(){ k = new Kitten(2, "Sparkles", "Cat"); } }
531
0.553672
0.551789
34
14.617647
14.307576
53
false
false
0
0
0
0
0
0
0.205882
false
false
4
71eec520206353e054004c7afd7f9e65780b1642
16,741,782,552,156
2c1a008f32f187b70f941117d5a27b6b0ea1155a
/example-netty/src/main/java/com/youthlin/example/chat/server/Server.java
9a2454ec84e683d6e8ef67eee9737875b50364fa
[]
no_license
YouthLin/examples
https://github.com/YouthLin/examples
9354401e3d279d0ba299f31bd3d560001490d2c2
8a44ffe80f45f176b39a720c97710355eecd8509
refs/heads/master
2021-01-23T04:40:03.811000
2021-01-15T13:06:10
2021-01-15T13:06:10
86,230,277
6
5
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.youthlin.example.chat.server; import com.youthlin.example.chat.handler.ImIdleHandler; import com.youthlin.example.chat.handler.PacketCodecHandler; import com.youthlin.example.chat.handler.Splitter; import com.youthlin.example.chat.server.handler.AuthHandler; import com.youthlin.example.chat.server.handler.HeartBeatRequestHandler; import com.youthlin.example.chat.server.handler.LoginRequestHandler; import com.youthlin.example.chat.server.handler.ServerHandler; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 创建: youthlin.chen * 时间: 2018-11-12 16:10 */ public class Server { private static final Logger LOGGER = LoggerFactory.getLogger(Server.class); public static void main(String[] args) { NioEventLoopGroup boos = new NioEventLoopGroup(); NioEventLoopGroup worker = new NioEventLoopGroup(); ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(boos, worker) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<NioSocketChannel>() { @Override protected void initChannel(NioSocketChannel ch) { ch.pipeline().addLast(new ImIdleHandler()); ch.pipeline().addLast(new Splitter()); ch.pipeline().addLast(PacketCodecHandler.INSTANCE); ch.pipeline().addLast(LoginRequestHandler.INSTANCE); ch.pipeline().addLast(HeartBeatRequestHandler.INSTANCE); ch.pipeline().addLast(AuthHandler.INSTANCE); ch.pipeline().addLast(ServerHandler.INSTANCE); } }) .childOption(ChannelOption.SO_KEEPALIVE, true)//开启 TCP 心跳机制 .childOption(ChannelOption.TCP_NODELAY, true)//高实时性有数据就马上发送 .option(ChannelOption.SO_BACKLOG, 1024)//临时存放已完成三次握手的请求的队列的最大长度 连接建立频繁处理新连接较慢则增大 ; bind(bootstrap, 1884); } private static void bind(ServerBootstrap serverBootstrap, int port) { serverBootstrap.bind(port).addListener(future -> { if (future.isSuccess()) { LOGGER.info("bind on port: {}", port); } else { bind(serverBootstrap, port + 1); } }); } }
UTF-8
Java
2,760
java
Server.java
Java
[ { "context": "ogger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * 创建: youthlin.chen\n * 时间: 2018-11-12 16:10\n */\npublic class Server {", "end": 844, "score": 0.9975677728652954, "start": 831, "tag": "USERNAME", "value": "youthlin.chen" } ]
null
[]
package com.youthlin.example.chat.server; import com.youthlin.example.chat.handler.ImIdleHandler; import com.youthlin.example.chat.handler.PacketCodecHandler; import com.youthlin.example.chat.handler.Splitter; import com.youthlin.example.chat.server.handler.AuthHandler; import com.youthlin.example.chat.server.handler.HeartBeatRequestHandler; import com.youthlin.example.chat.server.handler.LoginRequestHandler; import com.youthlin.example.chat.server.handler.ServerHandler; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 创建: youthlin.chen * 时间: 2018-11-12 16:10 */ public class Server { private static final Logger LOGGER = LoggerFactory.getLogger(Server.class); public static void main(String[] args) { NioEventLoopGroup boos = new NioEventLoopGroup(); NioEventLoopGroup worker = new NioEventLoopGroup(); ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(boos, worker) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<NioSocketChannel>() { @Override protected void initChannel(NioSocketChannel ch) { ch.pipeline().addLast(new ImIdleHandler()); ch.pipeline().addLast(new Splitter()); ch.pipeline().addLast(PacketCodecHandler.INSTANCE); ch.pipeline().addLast(LoginRequestHandler.INSTANCE); ch.pipeline().addLast(HeartBeatRequestHandler.INSTANCE); ch.pipeline().addLast(AuthHandler.INSTANCE); ch.pipeline().addLast(ServerHandler.INSTANCE); } }) .childOption(ChannelOption.SO_KEEPALIVE, true)//开启 TCP 心跳机制 .childOption(ChannelOption.TCP_NODELAY, true)//高实时性有数据就马上发送 .option(ChannelOption.SO_BACKLOG, 1024)//临时存放已完成三次握手的请求的队列的最大长度 连接建立频繁处理新连接较慢则增大 ; bind(bootstrap, 1884); } private static void bind(ServerBootstrap serverBootstrap, int port) { serverBootstrap.bind(port).addListener(future -> { if (future.isSuccess()) { LOGGER.info("bind on port: {}", port); } else { bind(serverBootstrap, port + 1); } }); } }
2,760
0.660227
0.651515
61
42.27869
26.461931
96
false
false
0
0
0
0
0
0
0.655738
false
false
4
2e61e8c0a8a057e187b7c1505e64e6c35999550a
2,585,570,317,387
dd64b400610b5ffbdc72bdcead66d0b12d30d83c
/server/src/main/java/com/goldcap/model/GoldcapUser.java
3d1e3f1994fc45ce77dea9836613c5ebae530c3e
[]
no_license
MilosCuic/goldcapProject
https://github.com/MilosCuic/goldcapProject
4eba16cb3daae2aa0b72d6b7967669abc5c9a462
9a7551787cd47edc52d20c6bea34ee9575cfc8e9
refs/heads/master
2022-06-20T18:01:08.052000
2020-05-14T22:24:55
2020-05-14T22:24:55
260,880,594
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.goldcap.model; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.Proxy; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Collection; import java.util.List; @Entity @Getter @Setter @Proxy(lazy=false) public class GoldcapUser implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column private String firstName; @Column private String lastName; @Email @NotNull(message = "e-mail cant be null") @NotEmpty(message = "e-mail field is required") @Column(nullable = false , unique = true) private String email; @NotNull(message = "username cant be null") @NotEmpty(message = "username field is required") @Column(nullable = false , unique = true) private String username; @Column(nullable = false , length = 255) @NotNull(message = "password cant be null") @NotEmpty private String password; @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY , mappedBy = "goldcapUser") @JsonIgnore private List<Order> orders; //TODO Switch to SET<ROLE> , REMOVE ROLL OR ADD ROLE TO USER @ManyToMany(cascade = CascadeType.ALL , fetch = FetchType.EAGER) private List<Role> roles; @Column(name = "enabled") private boolean verified = false; public void addRole(Role role){ if(!roles.contains(role)){ roles.add(role); } } /* * UserDetails interface methods * * * */ //TODO add roles @Override public Collection<? extends GrantedAuthority> getAuthorities() { return null; } @Override @JsonIgnore public boolean isAccountNonExpired() { return true; } @Override @JsonIgnore public boolean isAccountNonLocked() { return true; } @Override @JsonIgnore public boolean isCredentialsNonExpired() { return true; } @Override @JsonIgnore public boolean isEnabled() { return true; } }
UTF-8
Java
2,358
java
GoldcapUser.java
Java
[]
null
[]
package com.goldcap.model; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.Proxy; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Collection; import java.util.List; @Entity @Getter @Setter @Proxy(lazy=false) public class GoldcapUser implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column private String firstName; @Column private String lastName; @Email @NotNull(message = "e-mail cant be null") @NotEmpty(message = "e-mail field is required") @Column(nullable = false , unique = true) private String email; @NotNull(message = "username cant be null") @NotEmpty(message = "username field is required") @Column(nullable = false , unique = true) private String username; @Column(nullable = false , length = 255) @NotNull(message = "password cant be null") @NotEmpty private String password; @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY , mappedBy = "goldcapUser") @JsonIgnore private List<Order> orders; //TODO Switch to SET<ROLE> , REMOVE ROLL OR ADD ROLE TO USER @ManyToMany(cascade = CascadeType.ALL , fetch = FetchType.EAGER) private List<Role> roles; @Column(name = "enabled") private boolean verified = false; public void addRole(Role role){ if(!roles.contains(role)){ roles.add(role); } } /* * UserDetails interface methods * * * */ //TODO add roles @Override public Collection<? extends GrantedAuthority> getAuthorities() { return null; } @Override @JsonIgnore public boolean isAccountNonExpired() { return true; } @Override @JsonIgnore public boolean isAccountNonLocked() { return true; } @Override @JsonIgnore public boolean isCredentialsNonExpired() { return true; } @Override @JsonIgnore public boolean isEnabled() { return true; } }
2,358
0.677269
0.675997
99
22.818182
20.029455
93
false
false
0
0
0
0
0
0
0.353535
false
false
4
70c2c4131f27d729b3beb1a1fe94e4c901fd4fd6
24,713,241,866,398
5f3f11435552a59d3918fafcef62ea0310def356
/src/java_review/Day0206.java
fb1414209779e64288d3a3feb5dab1eda4995198
[]
no_license
tevfikakgun/techproedsummer2020turkish
https://github.com/tevfikakgun/techproedsummer2020turkish
43a4340206ec5861a2c542ff3c059c5438fc254d
9bfdcd86b4f51b59cb4162d6ff22164820b10d1a
refs/heads/master
2022-11-10T06:52:32.641000
2020-06-28T12:07:00
2020-06-28T12:07:00
275,576,132
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package java_review; import java.util.Scanner; public class Day0206 { public static void main(String[] args) { // Kullanıcıdan bir sayı girmesini isteyiniz // Sayı tek sayı ise "Sayınız tek sayıdır." // Sayı çift sayı ise "Sayınız çift sayıdır." yazdırınız Scanner scan = new Scanner(System.in); System.out.println("Bir tam sayı giriniz"); int num = scan.nextInt(); // if (num%2==0) { // System.out.println("Sayımız Çift sayıdır"); // }else { // System.out.println("Sayımız Tek sayıdır"); // } String result = (num%2==0)?"Sayımız Çift sayıdır":"Sayımız Tek sayıdır"; System.out.println(result); scan.close(); } }
ISO-8859-9
Java
686
java
Day0206.java
Java
[]
null
[]
package java_review; import java.util.Scanner; public class Day0206 { public static void main(String[] args) { // Kullanıcıdan bir sayı girmesini isteyiniz // Sayı tek sayı ise "Sayınız tek sayıdır." // Sayı çift sayı ise "Sayınız çift sayıdır." yazdırınız Scanner scan = new Scanner(System.in); System.out.println("Bir tam sayı giriniz"); int num = scan.nextInt(); // if (num%2==0) { // System.out.println("Sayımız Çift sayıdır"); // }else { // System.out.println("Sayımız Tek sayıdır"); // } String result = (num%2==0)?"Sayımız Çift sayıdır":"Sayımız Tek sayıdır"; System.out.println(result); scan.close(); } }
686
0.675425
0.66306
25
24.879999
21.113636
74
false
false
0
0
0
0
0
0
1.76
false
false
4
9b403c435152c49cdfcebd3e4d340fa39ed12d6b
9,371,618,697,064
9bca8e27abd9958a26ed59e2e6ad4ea328cdb4d0
/src/org/usfirst/frc/team4239/robot/RobotMap.java
2135b06a4a183905dd7b87a7cb9098b57f5fb029
[]
no_license
WARPSPEED4239/2018Robot
https://github.com/WARPSPEED4239/2018Robot
838c1654167361cd5afb9426a976487b582960b9
2700b81b7db1486d5ef7f51da741437abf4d019c
refs/heads/master
2021-03-27T08:42:56.758000
2018-11-22T03:34:18
2018-11-22T03:34:18
117,930,689
0
0
null
false
2018-11-15T02:58:18
2018-01-18T04:07:12
2018-11-14T21:58:39
2018-11-15T00:28:56
2,579
0
0
0
Java
false
null
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package org.usfirst.frc.team4239.robot; import org.usfirst.frc.team4239.robot.State.CodeExecutionState; /** * The RobotMap is a mapping from the ports sensors and actuators are wired into * to a variable name. This provides flexibility changing wiring, makes checking * the wiring easier and significantly reduces the number of magic numbers * floating around. */ public class RobotMap { public static int drivetrainMotorLeftOne = 1, drivetrainMotorLeftTwo = 2, drivetrainMotorLeftThree = 3, drivetrainMotorRightFour = 4, drivetrainMotorRightFive = 5, drivetrainMotorRightSix = 6, rgbCanifier = 7; public static int liftMotor = 0, intakeMotorLeft = 1, //30 AMPS climberMotor = 2, intakeMotorRight = 3; //30 AMPS public static int drivetrainSolenoidLowGear = 0, drivetrainSolenoidHighGear = 1; public static int liftBottomSwitch = 0, liftTopSwitch = 1; public static CodeExecutionState executionState = CodeExecutionState.Debug; }
UTF-8
Java
1,484
java
RobotMap.java
Java
[]
null
[]
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package org.usfirst.frc.team4239.robot; import org.usfirst.frc.team4239.robot.State.CodeExecutionState; /** * The RobotMap is a mapping from the ports sensors and actuators are wired into * to a variable name. This provides flexibility changing wiring, makes checking * the wiring easier and significantly reduces the number of magic numbers * floating around. */ public class RobotMap { public static int drivetrainMotorLeftOne = 1, drivetrainMotorLeftTwo = 2, drivetrainMotorLeftThree = 3, drivetrainMotorRightFour = 4, drivetrainMotorRightFive = 5, drivetrainMotorRightSix = 6, rgbCanifier = 7; public static int liftMotor = 0, intakeMotorLeft = 1, //30 AMPS climberMotor = 2, intakeMotorRight = 3; //30 AMPS public static int drivetrainSolenoidLowGear = 0, drivetrainSolenoidHighGear = 1; public static int liftBottomSwitch = 0, liftTopSwitch = 1; public static CodeExecutionState executionState = CodeExecutionState.Debug; }
1,484
0.616577
0.592992
46
31.282608
28.469406
80
false
false
0
0
0
0
0
0
1.565217
false
false
4
807d6454fb913896bc793a31bf9e81753b4938c0
19,499,151,588,393
57c6697e0e2df88b6987a70ea424a72d8564b358
/src/test/java/com/study/test/handler/SpringControllerTest.java
6f88e4b97d9e1ccf2bddba50dbb5c07b0a5821e7
[]
no_license
wuhgogo/Tests
https://github.com/wuhgogo/Tests
e7a97539417812660a7647b931f245b44132423f
f4599aeb4f6413b23564bc483317d624cfa18a4f
refs/heads/master
2021-04-26T11:49:45.080000
2018-06-25T16:11:12
2018-06-25T16:11:12
124,005,467
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.study.test.handler; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; public class SpringControllerTest implements Controller{ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String testValue = "SpringTest"; ModelAndView mv = new ModelAndView(); mv.addObject(testValue); mv.setViewName("WEB-INF/index.jsp"); return mv; } }
UTF-8
Java
566
java
SpringControllerTest.java
Java
[]
null
[]
package com.study.test.handler; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; public class SpringControllerTest implements Controller{ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String testValue = "SpringTest"; ModelAndView mv = new ModelAndView(); mv.addObject(testValue); mv.setViewName("WEB-INF/index.jsp"); return mv; } }
566
0.809187
0.809187
19
28.842106
28.396189
111
false
false
0
0
0
0
0
0
1.263158
false
false
4
b503d3c909ff2057b0bce156408accfb005452d5
7,481,833,056,965
9531b3b12c5bab7722a5d96d6441a4e6d99482cc
/src/main/java/fx/lang/Dbl.java
27c80583d7199857de9dcd6ae6d3da0deb6cca7d
[ "MIT" ]
permissive
farizfadian/fxcode
https://github.com/farizfadian/fxcode
67c7740be519c5a6e757e1591e4017d73e7ca527
16624ff3bbfa996dd69c44ff5ef1a6b8c8f95697
refs/heads/master
2018-10-10T08:20:22.362000
2018-08-23T09:57:16
2018-08-23T09:57:16
104,072,374
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fx.lang; import java.io.Serializable; public final class Dbl implements Serializable { private static final long serialVersionUID = -4327068542884543617L; public static double set(int value) { return (double) value; } public static double set(float value) { return Double.parseDouble(Float.toString(value)); } public static double set(long value) { return Double.parseDouble(Long.toString(value)); } public static double set(double value) { return value; } public static double set(Number value) { return value == null ? 0.0 : value.doubleValue(); } public static double set(String value) { return value == null ? 0.0 : Double.parseDouble(value); } public static double set(Object value) { try { return value == null ? 0.0 : Double.parseDouble(value.toString()); } catch(NumberFormatException nfe) { try { return Num.getNumberInstance().parse(value.toString()).doubleValue(); } catch(Throwable t) { return 0.0; } } catch(Exception e) { return 0.0; } } public static double get(Number value) { return (value == null ? 0.0 : value.doubleValue()); } public static double get(int value) { return (double) value; } public static double get(float value) { return (double) value; } public static double get(long value) { return (double) value; } public static double get(double value) { return (double) value; } public static double get(String value) { try { return (value == null ? 0.0 : Double.parseDouble(value)); } catch(NumberFormatException nfe) { try { return Num.get(value).doubleValue(); } catch(Throwable t) { return 0.0; } } catch(Throwable t) { try { return RegExp.parseDouble(value); } catch(Throwable t2) { return 0.0; } } } public static double get(Object value) { return (value == null ? 0.0 : get(value.toString())); } public static double add(int... values) { double result = 0.0; for(int value : values) result += get(value); return result; } public static double add(float... values) { double result = 0.0; for(float value : values) result += get(value); return result; } public static double add(long... values) { double result = 0.0; for(long value : values) result += get(value); return result; } public static double add(double... values) { double result = 0.0; for(double value : values) result += value; return result; } public static double add(Number... values) { double result = 0.0; for(Number value : values) result += get(value); return result; } public static double add(String... values) { double result = 0.0; for(String value : values) result += get(value); return result; } public static double add(Object... values) { double result = 0.0; for(Object value : values) result += get(value); return result; } public static double avg(int... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(float... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(long... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(double... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(Number... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(String... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(Object... values) { return values == null ? 0.0 : add(values) / values.length; } }
UTF-8
Java
4,490
java
Dbl.java
Java
[]
null
[]
package fx.lang; import java.io.Serializable; public final class Dbl implements Serializable { private static final long serialVersionUID = -4327068542884543617L; public static double set(int value) { return (double) value; } public static double set(float value) { return Double.parseDouble(Float.toString(value)); } public static double set(long value) { return Double.parseDouble(Long.toString(value)); } public static double set(double value) { return value; } public static double set(Number value) { return value == null ? 0.0 : value.doubleValue(); } public static double set(String value) { return value == null ? 0.0 : Double.parseDouble(value); } public static double set(Object value) { try { return value == null ? 0.0 : Double.parseDouble(value.toString()); } catch(NumberFormatException nfe) { try { return Num.getNumberInstance().parse(value.toString()).doubleValue(); } catch(Throwable t) { return 0.0; } } catch(Exception e) { return 0.0; } } public static double get(Number value) { return (value == null ? 0.0 : value.doubleValue()); } public static double get(int value) { return (double) value; } public static double get(float value) { return (double) value; } public static double get(long value) { return (double) value; } public static double get(double value) { return (double) value; } public static double get(String value) { try { return (value == null ? 0.0 : Double.parseDouble(value)); } catch(NumberFormatException nfe) { try { return Num.get(value).doubleValue(); } catch(Throwable t) { return 0.0; } } catch(Throwable t) { try { return RegExp.parseDouble(value); } catch(Throwable t2) { return 0.0; } } } public static double get(Object value) { return (value == null ? 0.0 : get(value.toString())); } public static double add(int... values) { double result = 0.0; for(int value : values) result += get(value); return result; } public static double add(float... values) { double result = 0.0; for(float value : values) result += get(value); return result; } public static double add(long... values) { double result = 0.0; for(long value : values) result += get(value); return result; } public static double add(double... values) { double result = 0.0; for(double value : values) result += value; return result; } public static double add(Number... values) { double result = 0.0; for(Number value : values) result += get(value); return result; } public static double add(String... values) { double result = 0.0; for(String value : values) result += get(value); return result; } public static double add(Object... values) { double result = 0.0; for(Object value : values) result += get(value); return result; } public static double avg(int... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(float... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(long... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(double... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(Number... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(String... values) { return values == null ? 0.0 : add(values) / values.length; } public static double avg(Object... values) { return values == null ? 0.0 : add(values) / values.length; } }
4,490
0.534298
0.519154
173
24.953756
20.934198
85
false
false
0
0
0
0
0
0
0.300578
false
false
4
6d806f1d020e3d2a589500721dab764a7111e2bc
996,432,475,120
df700ac3a3d48e24a70da9b13fc3a3e560e4987c
/src/main/java/com/mugglestar/io/IODemo.java
113a1b282e017ebb54cb2c05af68dd5320a884b5
[]
no_license
MuggleStar/java-base
https://github.com/MuggleStar/java-base
c5a79a6975ac7e2db33696edc00c9868daa688fb
3490ceedcbbf2beda67cafc8bd11ebf0e53dd05c
refs/heads/develop
2021-04-11T15:46:10.348000
2021-01-16T16:20:47
2021-01-16T16:20:47
249,034,592
0
0
null
false
2020-10-13T20:56:47
2020-03-21T18:15:44
2020-09-20T14:14:47
2020-10-13T20:56:46
66
0
0
1
Java
false
false
package com.mugglestar.io; import java.io.*; /** * 流范例 * * @author lujianrong */ public class IODemo { /** * 字节流: * InputStream * OutputStream * FileInputStream * FileOutputStream * BufferedInputStream * BufferedOutputStream * 字符流: * Writer * Reader * FileReader * FileWriter * BufferedReader * BufferedWriter */ static String filestr = "E:\\tmp\\123.txt"; static String filestr2 = "E:\\tmp\\456.txt"; static File file = new File(filestr); static File file2 = new File(filestr2); /** * 字符流无缓存 */ static void testReadAndWriter() throws IOException { FileReader fileReader = new FileReader(file); FileWriter fileWriter = new FileWriter(file2); int ch = 0;//字符流读取的是字符,用int存储 while ((ch = fileReader.read()) != -1) { fileWriter.write(ch); } fileReader.close(); fileWriter.close(); } /** * 字符缓存流 */ static void testReadAndWriter2() throws IOException { FileReader fileReader = new FileReader(file); FileWriter fileWriter = new FileWriter(file2); BufferedReader bufferedReader = new BufferedReader(fileReader); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); String line = null; while ((line = bufferedReader.readLine()) != null) { bufferedWriter.write(line); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } /** * 字节流无缓存 */ static void testInputAndOutPutStream() throws IOException { FileInputStream inputStream = new FileInputStream(file); FileOutputStream outputStream = new FileOutputStream(file2); int ch = 0;//字符流读取的是字符,用int存储 while ((ch = inputStream.read()) != -1) { outputStream.write(ch); } inputStream.close(); outputStream.close(); } /** * 字节缓存流 */ static void testInputAndOutPutStream2() throws IOException { FileInputStream inputStream = new FileInputStream(file); FileOutputStream outputStream = new FileOutputStream(file2); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream); byte[] arr = new byte[100]; while ((bufferedInputStream.read(arr)) != -1) { bufferedOutputStream.write(arr); } bufferedInputStream.close(); bufferedOutputStream.close(); } /** * 转换流: * InputStreamReader :字节到字符的桥梁。解码。 * OutputStreamWriter:字符到字节的桥梁。编码。 */ static void testStreamReader() throws IOException { FileInputStream inputStream = new FileInputStream(file); FileOutputStream outputStream = new FileOutputStream(file2); //字节流 转字符流 InputStreamReader inputStreamReader = new InputStreamReader(inputStream); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter); String line = null; while ((line = bufferedReader.readLine()) != null) { bufferedWriter.write(line); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } public static void main(String[] args) { try { testStreamReader(); } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
3,903
java
IODemo.java
Java
[ { "context": "r.io;\n\nimport java.io.*;\n\n/**\n * 流范例\n *\n * @author lujianrong\n */\npublic class IODemo {\n\n\n /**\n * 字节流:\n ", "end": 82, "score": 0.9918112754821777, "start": 72, "tag": "USERNAME", "value": "lujianrong" } ]
null
[]
package com.mugglestar.io; import java.io.*; /** * 流范例 * * @author lujianrong */ public class IODemo { /** * 字节流: * InputStream * OutputStream * FileInputStream * FileOutputStream * BufferedInputStream * BufferedOutputStream * 字符流: * Writer * Reader * FileReader * FileWriter * BufferedReader * BufferedWriter */ static String filestr = "E:\\tmp\\123.txt"; static String filestr2 = "E:\\tmp\\456.txt"; static File file = new File(filestr); static File file2 = new File(filestr2); /** * 字符流无缓存 */ static void testReadAndWriter() throws IOException { FileReader fileReader = new FileReader(file); FileWriter fileWriter = new FileWriter(file2); int ch = 0;//字符流读取的是字符,用int存储 while ((ch = fileReader.read()) != -1) { fileWriter.write(ch); } fileReader.close(); fileWriter.close(); } /** * 字符缓存流 */ static void testReadAndWriter2() throws IOException { FileReader fileReader = new FileReader(file); FileWriter fileWriter = new FileWriter(file2); BufferedReader bufferedReader = new BufferedReader(fileReader); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); String line = null; while ((line = bufferedReader.readLine()) != null) { bufferedWriter.write(line); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } /** * 字节流无缓存 */ static void testInputAndOutPutStream() throws IOException { FileInputStream inputStream = new FileInputStream(file); FileOutputStream outputStream = new FileOutputStream(file2); int ch = 0;//字符流读取的是字符,用int存储 while ((ch = inputStream.read()) != -1) { outputStream.write(ch); } inputStream.close(); outputStream.close(); } /** * 字节缓存流 */ static void testInputAndOutPutStream2() throws IOException { FileInputStream inputStream = new FileInputStream(file); FileOutputStream outputStream = new FileOutputStream(file2); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream); byte[] arr = new byte[100]; while ((bufferedInputStream.read(arr)) != -1) { bufferedOutputStream.write(arr); } bufferedInputStream.close(); bufferedOutputStream.close(); } /** * 转换流: * InputStreamReader :字节到字符的桥梁。解码。 * OutputStreamWriter:字符到字节的桥梁。编码。 */ static void testStreamReader() throws IOException { FileInputStream inputStream = new FileInputStream(file); FileOutputStream outputStream = new FileOutputStream(file2); //字节流 转字符流 InputStreamReader inputStreamReader = new InputStreamReader(inputStream); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter); String line = null; while ((line = bufferedReader.readLine()) != null) { bufferedWriter.write(line); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } public static void main(String[] args) { try { testStreamReader(); } catch (IOException e) { e.printStackTrace(); } } }
3,903
0.616815
0.610348
142
25.133802
24.155083
91
false
false
0
0
0
0
0
0
0.338028
false
false
4
ea6535cb01454ff5e02e43ec3a78fe06a86f735c
7,962,869,377,768
bb8603445930c3dd99a4f4d081d81a9553dfd3eb
/app/src/main/java/com/elitedevelopers/ilibrary/activities/SplashScreen.java
8236eeb19f0f7b9e3b734b49db7035c92e372e62
[]
no_license
mknishad/ILibrary
https://github.com/mknishad/ILibrary
a851b1a387334691c0dd1aad1baba172408fefa7
a4c081b4408deb76aae39034d6fc6816676632b6
refs/heads/master
2021-01-20T21:13:02.370000
2016-07-26T15:24:39
2016-07-26T15:24:39
63,807,215
2
3
null
false
2016-08-23T11:16:02
2016-07-20T19:07:30
2016-08-06T15:08:28
2016-07-26T15:25:02
638
1
3
0
Java
null
null
package com.elitedevelopers.ilibrary.activities; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.TextView; import com.elitedevelopers.ilibrary.R; /** * Created by Nishad on 21-Jul-16. */ public class SplashScreen extends Activity { private final int SPLASH_DISPLAY_LENGTH = 3000; // set the delay for category screen @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.splash_screen); /* New Handler to start the LoginActivity-Activity * and close this Splash-Screen after some seconds.*/ new Handler().postDelayed(new Runnable(){ @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent mainIntent = new Intent(SplashScreen.this,LoginActivity.class); SplashScreen.this.startActivity(mainIntent); SplashScreen.this.finish(); } }, SPLASH_DISPLAY_LENGTH); Animation a = AnimationUtils.loadAnimation(this, R.anim.scale); a.reset(); TextView tv = (TextView) findViewById(R.id.tvAppName); tv.clearAnimation(); tv.startAnimation(a); } }
UTF-8
Java
1,402
java
SplashScreen.java
Java
[ { "context": "com.elitedevelopers.ilibrary.R;\n\n/**\n * Created by Nishad on 21-Jul-16.\n */\npublic class SplashScreen exten", "end": 347, "score": 0.9970723986625671, "start": 341, "tag": "NAME", "value": "Nishad" } ]
null
[]
package com.elitedevelopers.ilibrary.activities; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.TextView; import com.elitedevelopers.ilibrary.R; /** * Created by Nishad on 21-Jul-16. */ public class SplashScreen extends Activity { private final int SPLASH_DISPLAY_LENGTH = 3000; // set the delay for category screen @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.splash_screen); /* New Handler to start the LoginActivity-Activity * and close this Splash-Screen after some seconds.*/ new Handler().postDelayed(new Runnable(){ @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent mainIntent = new Intent(SplashScreen.this,LoginActivity.class); SplashScreen.this.startActivity(mainIntent); SplashScreen.this.finish(); } }, SPLASH_DISPLAY_LENGTH); Animation a = AnimationUtils.loadAnimation(this, R.anim.scale); a.reset(); TextView tv = (TextView) findViewById(R.id.tvAppName); tv.clearAnimation(); tv.startAnimation(a); } }
1,402
0.667618
0.661912
45
30.177778
24.702036
88
false
false
0
0
0
0
0
0
0.533333
false
false
4
8c4b98ade2a1c990d170db275aa4e50a73c68d5e
7,962,869,376,106
f6605d33049744bc183bfe83c799a53abe84fc92
/aric-spring/aric-spring-j2ee/aric-spring-j2ee-io/src/main/java/io/FileUtils.java
3b5eaed89e8934203e06c4b88ca79113d48fa118
[ "MIT" ]
permissive
wzzlh/JavaStudy
https://github.com/wzzlh/JavaStudy
7ad54c5922e7ff071caab3e2413f672fa5a88aab
42b14017a62d531dafc867b7baf35d9ebf6a97cb
refs/heads/master
2020-05-17T04:45:16.974000
2017-09-19T09:56:33
2017-09-19T09:56:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io; import java.io.*; /** * Created by tom.lee on 2016/3/7. */ public final class FileUtils { /** * byte数组大小 */ private static final int CACHE_SIZE=1024; /** * 枚举类型 */ public enum FILE_TYPE { TEXT, BINARY; FILE_TYPE(){ } } /** * 复制文件 * @param src 文件地址 * @param destination 目标地址 * @param fileType 文件类型 * @param readerSize 读取大小 */ public static void copyFile(String src,String destination,FILE_TYPE fileType,int readerSize){ if(fileType.equals(FILE_TYPE.BINARY)){ copyBinary(src, destination, readerSize); } if(fileType.equals(FILE_TYPE.TEXT)){ copyText(src,destination); } } /** * 复制文件 * @param src 文件地址 * @param destination 目标地址 * @param fileType 文件类型 */ public static void copyFile(String src,String destination,FILE_TYPE fileType){ copyFile(src,destination,fileType,CACHE_SIZE); } /** * 复制文本 * @param src 原地址 * @param destination 目标地址 */ static void copyText(String src,String destination){ BufferedWriter bufferedWriter=null; BufferedReader bufferedReader=null; try { FileReader fileReader=new FileReader(new File(src)); FileWriter fileWriter=new FileWriter(new File(destination)); bufferedReader=new BufferedReader(fileReader); bufferedWriter=new BufferedWriter(fileWriter); String line; while ((line=bufferedReader.readLine())!=null){ bufferedWriter.write(line); bufferedWriter.newLine(); bufferedWriter.flush(); } }catch (Exception e){ e.printStackTrace(); }finally { if (bufferedWriter!=null){ try { bufferedWriter.close(); } catch (IOException e) { e.printStackTrace(); } } if(bufferedReader!=null){ try { bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 复制二进制文件 * @param src * @param destination * @param readerSize */ static void copyBinary(String src,String destination,int readerSize){ BufferedInputStream bufferedInputStream= null; BufferedOutputStream bufferedOutputStream= null; try { FileInputStream fileInputStream = new FileInputStream(new File(src)); FileOutputStream fileOutputStream = new FileOutputStream(new File(destination)); bufferedInputStream=new BufferedInputStream(fileInputStream); bufferedOutputStream =new BufferedOutputStream(fileOutputStream); byte [] b=new byte[readerSize]; int len; while ((len=bufferedInputStream.read(b))!=-1){ bufferedOutputStream.write(b,0,len); bufferedOutputStream.flush(); } } catch (Exception e) { e.printStackTrace(); }finally { if(bufferedOutputStream!=null){ try { bufferedOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if(bufferedInputStream!=null){ try { bufferedInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 复制文件 * @param src 文件地址 * @param destination 目标地址 */ public static void copyFile(String src,String destination){ copyBinary(src,destination,CACHE_SIZE); } /** * 空字符验证 * @param str * @return */ public static boolean isEmpty(String str){ return str==null||str.length()==0; } public static void main(String [] a){ // copyFile("C:\\Users\\Administrator\\Desktop\\hadoop-1伪集群搭建.txt" // ,"hadoop伪集群搭建0.txt", FILE_TYPE.TEXT); // BufferedInputStream bufferedInputStream= null; // // try { // FileInputStream fileInputStream = new FileInputStream(new File("hadoop伪集群搭建.txt")); // bufferedInputStream=new BufferedInputStream(fileInputStream); // byte [] b=new byte[1024]; // int len; // while ((len=bufferedInputStream.read(b))!=-1){ // System.out.print(new String(b,0,len)); // } // } catch (Exception e) { // e.printStackTrace(); // }finally { // if(bufferedInputStream!=null){ // try { // bufferedInputStream.close(); // } catch (IOException e) { // e.printStackTrace(); // } // } // } writer(); } public static void writer(){ RandomAccessFile randomAccessFile=null; try { randomAccessFile=new RandomAccessFile(new File("hadoop伪集群搭建0.txt"),"rw"); byte r[]=new byte[1024]; int len; while ((len=randomAccessFile.read(r))!=-1){ String string =new String(r,0,len); string=string.replaceAll("hadoop","openStack"); System.err.print(string); } }catch (Exception e){ e.printStackTrace(); }finally { try { randomAccessFile.close(); } catch (IOException e) { e.printStackTrace(); } } } }
UTF-8
Java
5,974
java
FileUtils.java
Java
[ { "context": "package io;\n\nimport java.io.*;\n\n/**\n * Created by tom.lee on 2016/3/7.\n */\npublic final class FileUtils {\n ", "end": 57, "score": 0.9993767142295837, "start": 50, "tag": "USERNAME", "value": "tom.lee" } ]
null
[]
package io; import java.io.*; /** * Created by tom.lee on 2016/3/7. */ public final class FileUtils { /** * byte数组大小 */ private static final int CACHE_SIZE=1024; /** * 枚举类型 */ public enum FILE_TYPE { TEXT, BINARY; FILE_TYPE(){ } } /** * 复制文件 * @param src 文件地址 * @param destination 目标地址 * @param fileType 文件类型 * @param readerSize 读取大小 */ public static void copyFile(String src,String destination,FILE_TYPE fileType,int readerSize){ if(fileType.equals(FILE_TYPE.BINARY)){ copyBinary(src, destination, readerSize); } if(fileType.equals(FILE_TYPE.TEXT)){ copyText(src,destination); } } /** * 复制文件 * @param src 文件地址 * @param destination 目标地址 * @param fileType 文件类型 */ public static void copyFile(String src,String destination,FILE_TYPE fileType){ copyFile(src,destination,fileType,CACHE_SIZE); } /** * 复制文本 * @param src 原地址 * @param destination 目标地址 */ static void copyText(String src,String destination){ BufferedWriter bufferedWriter=null; BufferedReader bufferedReader=null; try { FileReader fileReader=new FileReader(new File(src)); FileWriter fileWriter=new FileWriter(new File(destination)); bufferedReader=new BufferedReader(fileReader); bufferedWriter=new BufferedWriter(fileWriter); String line; while ((line=bufferedReader.readLine())!=null){ bufferedWriter.write(line); bufferedWriter.newLine(); bufferedWriter.flush(); } }catch (Exception e){ e.printStackTrace(); }finally { if (bufferedWriter!=null){ try { bufferedWriter.close(); } catch (IOException e) { e.printStackTrace(); } } if(bufferedReader!=null){ try { bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 复制二进制文件 * @param src * @param destination * @param readerSize */ static void copyBinary(String src,String destination,int readerSize){ BufferedInputStream bufferedInputStream= null; BufferedOutputStream bufferedOutputStream= null; try { FileInputStream fileInputStream = new FileInputStream(new File(src)); FileOutputStream fileOutputStream = new FileOutputStream(new File(destination)); bufferedInputStream=new BufferedInputStream(fileInputStream); bufferedOutputStream =new BufferedOutputStream(fileOutputStream); byte [] b=new byte[readerSize]; int len; while ((len=bufferedInputStream.read(b))!=-1){ bufferedOutputStream.write(b,0,len); bufferedOutputStream.flush(); } } catch (Exception e) { e.printStackTrace(); }finally { if(bufferedOutputStream!=null){ try { bufferedOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if(bufferedInputStream!=null){ try { bufferedInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 复制文件 * @param src 文件地址 * @param destination 目标地址 */ public static void copyFile(String src,String destination){ copyBinary(src,destination,CACHE_SIZE); } /** * 空字符验证 * @param str * @return */ public static boolean isEmpty(String str){ return str==null||str.length()==0; } public static void main(String [] a){ // copyFile("C:\\Users\\Administrator\\Desktop\\hadoop-1伪集群搭建.txt" // ,"hadoop伪集群搭建0.txt", FILE_TYPE.TEXT); // BufferedInputStream bufferedInputStream= null; // // try { // FileInputStream fileInputStream = new FileInputStream(new File("hadoop伪集群搭建.txt")); // bufferedInputStream=new BufferedInputStream(fileInputStream); // byte [] b=new byte[1024]; // int len; // while ((len=bufferedInputStream.read(b))!=-1){ // System.out.print(new String(b,0,len)); // } // } catch (Exception e) { // e.printStackTrace(); // }finally { // if(bufferedInputStream!=null){ // try { // bufferedInputStream.close(); // } catch (IOException e) { // e.printStackTrace(); // } // } // } writer(); } public static void writer(){ RandomAccessFile randomAccessFile=null; try { randomAccessFile=new RandomAccessFile(new File("hadoop伪集群搭建0.txt"),"rw"); byte r[]=new byte[1024]; int len; while ((len=randomAccessFile.read(r))!=-1){ String string =new String(r,0,len); string=string.replaceAll("hadoop","openStack"); System.err.print(string); } }catch (Exception e){ e.printStackTrace(); }finally { try { randomAccessFile.close(); } catch (IOException e) { e.printStackTrace(); } } } }
5,974
0.516794
0.511946
214
25.990654
22.506903
97
false
false
0
0
0
0
0
0
0.420561
false
false
4
018cb5a3b925c24cb45f64613154dec94d168e0b
3,109,556,341,098
24cbcdca006e609a8a0be65bf07d729195a1647d
/src/main/java/com/bib404/system_bib404/service/impl/PrestamoServiceImpl.java
55b2fa3c321cda38c5a0ebff70516717ee8e494b
[ "MIT" ]
permissive
rodrigoPM/bib404
https://github.com/rodrigoPM/bib404
3a641e192d961c77cd8dfb0d92fb6b95737ac4a4
e6c0082a7f9f09b31e2b9aa2ae6b87a231be116e
refs/heads/master
2020-03-29T18:08:28.540000
2018-12-03T20:26:55
2018-12-03T20:26:55
150,196,507
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bib404.system_bib404.service.impl; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.bib404.system_bib404.Repository.PrestamoRepository; import com.bib404.system_bib404.component.PrestamoConverter; import com.bib404.system_bib404.entity.Prestamo; import com.bib404.system_bib404.entity.RecursoEspecifico; import com.bib404.system_bib404.entity.Usuario; import com.bib404.system_bib404.model.PrestamoModel; import com.bib404.system_bib404.service.PrestamoService; @Service("prestamoServiceImpl") public class PrestamoServiceImpl implements PrestamoService{ @Autowired @Qualifier("prestamoRepository") private PrestamoRepository prestamoRepository; @Autowired @Qualifier("prestamoConverter") private PrestamoConverter prestamoConverter; @Override public PrestamoModel addPrestamo(PrestamoModel prestamoModel) { Prestamo prestamo =prestamoRepository.save(prestamoConverter.convertPrestamoModel2Prestamo(prestamoModel)); return prestamoConverter.convertPrestamo2PrestamoModel(prestamo); } @Override public Prestamo findPrestamoById(int id) { return prestamoRepository.findById(id); } public PrestamoModel findPrestamoByIdModel(int id) { return prestamoConverter.convertPrestamo2PrestamoModel(findPrestamoById(id)); } @Override public Prestamo addPres(Prestamo prestamo) { return prestamoRepository.save(prestamo); } @Override public List<PrestamoModel> listPrestamos(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==1).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } return prestamoModels; } public List<PrestamoModel> listPrestados(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==2).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { Date fech = new Date(); if(fech.before(prestamo.getFecha_devolucion()) || fech.equals(prestamo.getFecha_devolucion())) { prestamo.setMora(false); prestamoRepository.save(prestamo); prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } } return prestamoModels; } public List<PrestamoModel> listPrestadosMora(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==2).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { Date fech = new Date(); if(fech.after(prestamo.getFecha_devolucion())) { prestamo.setMora(true); prestamoRepository.save(prestamo); prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } } return prestamoModels; } public List<PrestamoModel> listDenegados(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==0).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } return prestamoModels; } public List<PrestamoModel> listRecibidos(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==3).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } return prestamoModels; } @Override public List<Prestamo> listPrestadosEspecificos(int id_user) { List<Prestamo> prestamos=prestamoRepository.findByUsuarioId(id_user); List<Prestamo> resultado=prestamos.stream().filter(x -> !x.getRecursoEspecifico().getFormato_recurso().getNombre_formato().equals("Fisico") && x.getEstado()==2).collect(Collectors.toList()); List<Prestamo> variable=new ArrayList<Prestamo>(); for(Prestamo prestamo:resultado) { Date fech = new Date(); if(fech.before(prestamo.getFecha_devolucion()) || fech.equals(prestamo.getFecha_devolucion())) { variable.add(prestamo); } else { prestamo.setEstado(3); } } return variable; } public String pdf(int id_prestamo) { Prestamo prestamo=prestamoRepository.findById(id_prestamo); String archivo=prestamo.getRecursoEspecifico().getArchivo(); return archivo; } }
UTF-8
Java
5,123
java
PrestamoServiceImpl.java
Java
[]
null
[]
package com.bib404.system_bib404.service.impl; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.bib404.system_bib404.Repository.PrestamoRepository; import com.bib404.system_bib404.component.PrestamoConverter; import com.bib404.system_bib404.entity.Prestamo; import com.bib404.system_bib404.entity.RecursoEspecifico; import com.bib404.system_bib404.entity.Usuario; import com.bib404.system_bib404.model.PrestamoModel; import com.bib404.system_bib404.service.PrestamoService; @Service("prestamoServiceImpl") public class PrestamoServiceImpl implements PrestamoService{ @Autowired @Qualifier("prestamoRepository") private PrestamoRepository prestamoRepository; @Autowired @Qualifier("prestamoConverter") private PrestamoConverter prestamoConverter; @Override public PrestamoModel addPrestamo(PrestamoModel prestamoModel) { Prestamo prestamo =prestamoRepository.save(prestamoConverter.convertPrestamoModel2Prestamo(prestamoModel)); return prestamoConverter.convertPrestamo2PrestamoModel(prestamo); } @Override public Prestamo findPrestamoById(int id) { return prestamoRepository.findById(id); } public PrestamoModel findPrestamoByIdModel(int id) { return prestamoConverter.convertPrestamo2PrestamoModel(findPrestamoById(id)); } @Override public Prestamo addPres(Prestamo prestamo) { return prestamoRepository.save(prestamo); } @Override public List<PrestamoModel> listPrestamos(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==1).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } return prestamoModels; } public List<PrestamoModel> listPrestados(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==2).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { Date fech = new Date(); if(fech.before(prestamo.getFecha_devolucion()) || fech.equals(prestamo.getFecha_devolucion())) { prestamo.setMora(false); prestamoRepository.save(prestamo); prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } } return prestamoModels; } public List<PrestamoModel> listPrestadosMora(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==2).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { Date fech = new Date(); if(fech.after(prestamo.getFecha_devolucion())) { prestamo.setMora(true); prestamoRepository.save(prestamo); prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } } return prestamoModels; } public List<PrestamoModel> listDenegados(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==0).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } return prestamoModels; } public List<PrestamoModel> listRecibidos(int id_bib) { List<Prestamo> prestamos=prestamoRepository.listPrestamos(id_bib); List<Prestamo> valprestamos= prestamos.stream().filter(x -> x.getEstado()==3).collect(Collectors.toList()); List<PrestamoModel> prestamoModels=new ArrayList<PrestamoModel>(); for(Prestamo prestamo:valprestamos) { prestamoModels.add(prestamoConverter.convertPrestamo2PrestamoModel(prestamo)); } return prestamoModels; } @Override public List<Prestamo> listPrestadosEspecificos(int id_user) { List<Prestamo> prestamos=prestamoRepository.findByUsuarioId(id_user); List<Prestamo> resultado=prestamos.stream().filter(x -> !x.getRecursoEspecifico().getFormato_recurso().getNombre_formato().equals("Fisico") && x.getEstado()==2).collect(Collectors.toList()); List<Prestamo> variable=new ArrayList<Prestamo>(); for(Prestamo prestamo:resultado) { Date fech = new Date(); if(fech.before(prestamo.getFecha_devolucion()) || fech.equals(prestamo.getFecha_devolucion())) { variable.add(prestamo); } else { prestamo.setEstado(3); } } return variable; } public String pdf(int id_prestamo) { Prestamo prestamo=prestamoRepository.findById(id_prestamo); String archivo=prestamo.getRecursoEspecifico().getArchivo(); return archivo; } }
5,123
0.782159
0.769861
130
38.407692
33.694714
192
false
false
0
0
0
0
0
0
2.084615
false
false
4
fe82fde8f6da8dac8ab765bdb9eed9edad484c1a
12,429,635,386,404
ed00b4e887a3e314e1497aea88aa5c1b07135f9c
/springMVCDemo/src/main/java/redis/util/JedisCallback.java
d04701eb77fe8e0c52a22321973aae26a8858590
[]
no_license
wwzskyrain/java_code_growup
https://github.com/wwzskyrain/java_code_growup
84847f7730d49260b120cee5892d0585e143746f
9f99e1357e718cd5421b5a7ddd96aa88864c2491
refs/heads/master
2022-12-24T20:25:43.554000
2020-09-23T02:59:56
2020-09-23T02:59:56
99,775,114
0
0
null
false
2022-12-16T12:06:58
2017-08-09T06:53:38
2020-09-23T03:00:08
2022-12-16T12:06:54
74,256
0
0
27
Java
false
false
package redis.util; import redis.clients.jedis.Jedis; public interface JedisCallback<T> { public T doInJedis(Jedis jedis); }
UTF-8
Java
132
java
JedisCallback.java
Java
[]
null
[]
package redis.util; import redis.clients.jedis.Jedis; public interface JedisCallback<T> { public T doInJedis(Jedis jedis); }
132
0.75
0.75
8
15.5
16.007811
36
false
false
0
0
0
0
0
0
0.375
false
false
4
5e5536666c443e76c7f6650615a5d66eeb2696a2
9,053,791,071,303
e27c271cbf515c116c84ccc11870bc0cdeca9150
/mobile/SensorCollectorProject/SensorCollectorLibrary/src/main/java/eu/liveandgov/wp1/sensor_collector/transfer/TransferThreadPost.java
673254da4b0ba081f77e46589404b5724b54e128
[ "MIT" ]
permissive
HeinrichHartmann/MORA
https://github.com/HeinrichHartmann/MORA
245b8061e8a99bfcc4277ec817c82c221a9c9fbd
0d5bff044f082e953b00da3d4216b26771d37592
refs/heads/master
2020-12-30T18:30:47.875000
2014-09-28T09:21:41
2014-09-28T09:21:41
21,853,230
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package eu.liveandgov.wp1.sensor_collector.transfer; import android.content.SharedPreferences; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.HttpHostConnectException; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import eu.liveandgov.wp1.sensor_collector.GlobalContext; import eu.liveandgov.wp1.sensor_collector.R; import eu.liveandgov.wp1.sensor_collector.ServiceSensorControl; import eu.liveandgov.wp1.sensor_collector.configuration.SensorCollectionOptions; import eu.liveandgov.wp1.sensor_collector.logging.LogPrincipal; import eu.liveandgov.wp1.sensor_collector.persistence.Persistor; import eu.liveandgov.wp1.util.LocalBuilder; /** * Transfer sensor.log file to server using HTTP/POST request * <p/> * Use: * * .setup() - setup instance * * .doTransfer() - trigger sample transfer * <p/> * Created by hartmann on 8/30/13. */ public class TransferThreadPost implements Runnable, TransferManager { private final Logger log = LogPrincipal.get(); private Thread thread; private Persistor persistor; private File stageFile; public TransferThreadPost(Persistor persistor, File stageFile) { this.stageFile = stageFile; this.persistor = persistor; thread = new Thread(this); } @Override public void doTransfer() { if (thread.isAlive()) { log.info("Already running."); return; } if (thread.getState() == Thread.State.TERMINATED) thread = new Thread(this); thread.start(); } @Override public boolean isTransferring() { return thread.isAlive(); } @Override public boolean hasStagedSamples() { return stageFile.length() > 0; } @Override public void deleteStagedSamples() { stageFile.delete(); } @Override public String getStatus() { final StringBuilder stringBuilder = LocalBuilder.acquireBuilder(); stringBuilder.append("StageFile: "); stringBuilder.append(Math.round(stageFile.length() / 1024.0)); stringBuilder.append("kb. "); if (isTransferring()) stringBuilder.append("transferring"); else stringBuilder.append("waiting"); return stringBuilder.toString(); } public void run() { boolean success; try { // TODO: Check methods if with success return should rather throw an exception in // order to make calling more uniform. // get stage file if (stageFile.exists()) { log.info("Found old stage file."); } else { success = persistor.exportSamples(stageFile); if (!success) { log.error("Staging failed"); return; } } boolean isCompressed = infereCompressionStatusOf(stageFile); // transfer staged File success = transferFile(stageFile, isCompressed); if (!success) { log.error("Transfer failed"); return; } // delete local copy success = stageFile.delete(); if (!success) { log.error("Deletion failed"); return; } // terminate log.info("Transfer finished successfully"); } catch (IOException e) { log.error("Error opening stage file", e); } } private boolean infereCompressionStatusOf(File stageFile) throws IOException { log.info("Inferring compression of " + stageFile); FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(stageFile); // Read files first two bytes and check against the magic-number final int first = fileInputStream.read(); final int second = fileInputStream.read(); return first == 0x1f && second == 0x8b; } finally { if (fileInputStream != null) { fileInputStream.close(); } } } public boolean transferFile(File file, boolean compressed) { try { String dst = getAddress(); log.info("Destination of upload is: " + dst); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(dst); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); multipartEntityBuilder.addBinaryBody("upfile", file); httppost.setEntity(multipartEntityBuilder.build()); httppost.addHeader("COMPRESSED", String.valueOf(compressed)); httppost.addHeader("CHECKSUM", String.valueOf(file.length())); httppost.addHeader("ID", GlobalContext.getUserId()); httppost.addHeader("SECRET", getSecret()); HttpResponse response = httpclient.execute(httppost); log.info("Response of upload: " + EntityUtils.toString(response.getEntity())); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_ACCEPTED) { log.error("Upload failed w/ Status Code:" + status); return false; } } catch (HttpHostConnectException e) { log.error("Connection Refused", e); return false; } catch (IOException e) { log.error("IO exception occured", e); return false; } return true; } private String getAddress() { SharedPreferences settings = GlobalContext.context.getSharedPreferences(GlobalContext.context.getString(R.string.spn), 0); return settings.getString(GlobalContext.context.getString(R.string.prf_upload_address), SensorCollectionOptions.DEFAULT_UPLOAD); } private String getSecret() { SharedPreferences settings = GlobalContext.context.getSharedPreferences(GlobalContext.context.getString(R.string.spn), 0); return settings.getString(GlobalContext.context.getString(R.string.prf_secret), ""); } public boolean transferFile(File file) { return transferFile(file, false); } }
UTF-8
Java
6,592
java
TransferThreadPost.java
Java
[ { "context": "() - trigger sample transfer\n * <p/>\n * Created by hartmann on 8/30/13.\n */\npublic class TransferThreadPost i", "end": 1196, "score": 0.6981012225151062, "start": 1188, "tag": "USERNAME", "value": "hartmann" } ]
null
[]
package eu.liveandgov.wp1.sensor_collector.transfer; import android.content.SharedPreferences; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.HttpHostConnectException; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import eu.liveandgov.wp1.sensor_collector.GlobalContext; import eu.liveandgov.wp1.sensor_collector.R; import eu.liveandgov.wp1.sensor_collector.ServiceSensorControl; import eu.liveandgov.wp1.sensor_collector.configuration.SensorCollectionOptions; import eu.liveandgov.wp1.sensor_collector.logging.LogPrincipal; import eu.liveandgov.wp1.sensor_collector.persistence.Persistor; import eu.liveandgov.wp1.util.LocalBuilder; /** * Transfer sensor.log file to server using HTTP/POST request * <p/> * Use: * * .setup() - setup instance * * .doTransfer() - trigger sample transfer * <p/> * Created by hartmann on 8/30/13. */ public class TransferThreadPost implements Runnable, TransferManager { private final Logger log = LogPrincipal.get(); private Thread thread; private Persistor persistor; private File stageFile; public TransferThreadPost(Persistor persistor, File stageFile) { this.stageFile = stageFile; this.persistor = persistor; thread = new Thread(this); } @Override public void doTransfer() { if (thread.isAlive()) { log.info("Already running."); return; } if (thread.getState() == Thread.State.TERMINATED) thread = new Thread(this); thread.start(); } @Override public boolean isTransferring() { return thread.isAlive(); } @Override public boolean hasStagedSamples() { return stageFile.length() > 0; } @Override public void deleteStagedSamples() { stageFile.delete(); } @Override public String getStatus() { final StringBuilder stringBuilder = LocalBuilder.acquireBuilder(); stringBuilder.append("StageFile: "); stringBuilder.append(Math.round(stageFile.length() / 1024.0)); stringBuilder.append("kb. "); if (isTransferring()) stringBuilder.append("transferring"); else stringBuilder.append("waiting"); return stringBuilder.toString(); } public void run() { boolean success; try { // TODO: Check methods if with success return should rather throw an exception in // order to make calling more uniform. // get stage file if (stageFile.exists()) { log.info("Found old stage file."); } else { success = persistor.exportSamples(stageFile); if (!success) { log.error("Staging failed"); return; } } boolean isCompressed = infereCompressionStatusOf(stageFile); // transfer staged File success = transferFile(stageFile, isCompressed); if (!success) { log.error("Transfer failed"); return; } // delete local copy success = stageFile.delete(); if (!success) { log.error("Deletion failed"); return; } // terminate log.info("Transfer finished successfully"); } catch (IOException e) { log.error("Error opening stage file", e); } } private boolean infereCompressionStatusOf(File stageFile) throws IOException { log.info("Inferring compression of " + stageFile); FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(stageFile); // Read files first two bytes and check against the magic-number final int first = fileInputStream.read(); final int second = fileInputStream.read(); return first == 0x1f && second == 0x8b; } finally { if (fileInputStream != null) { fileInputStream.close(); } } } public boolean transferFile(File file, boolean compressed) { try { String dst = getAddress(); log.info("Destination of upload is: " + dst); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(dst); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); multipartEntityBuilder.addBinaryBody("upfile", file); httppost.setEntity(multipartEntityBuilder.build()); httppost.addHeader("COMPRESSED", String.valueOf(compressed)); httppost.addHeader("CHECKSUM", String.valueOf(file.length())); httppost.addHeader("ID", GlobalContext.getUserId()); httppost.addHeader("SECRET", getSecret()); HttpResponse response = httpclient.execute(httppost); log.info("Response of upload: " + EntityUtils.toString(response.getEntity())); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_ACCEPTED) { log.error("Upload failed w/ Status Code:" + status); return false; } } catch (HttpHostConnectException e) { log.error("Connection Refused", e); return false; } catch (IOException e) { log.error("IO exception occured", e); return false; } return true; } private String getAddress() { SharedPreferences settings = GlobalContext.context.getSharedPreferences(GlobalContext.context.getString(R.string.spn), 0); return settings.getString(GlobalContext.context.getString(R.string.prf_upload_address), SensorCollectionOptions.DEFAULT_UPLOAD); } private String getSecret() { SharedPreferences settings = GlobalContext.context.getSharedPreferences(GlobalContext.context.getString(R.string.spn), 0); return settings.getString(GlobalContext.context.getString(R.string.prf_secret), ""); } public boolean transferFile(File file) { return transferFile(file, false); } }
6,592
0.628337
0.624393
206
30.995146
27.660652
136
false
false
0
0
0
0
0
0
0.514563
false
false
4
3ecb505f1873aff955906703a6c0cede98cf8db4
1,529,008,379,334
78c305853742830a15168c0e5b1d41d7a87416aa
/BIGRWeb/source/com/ardais/bigr/lims/web/form/LimsPathLabForm.java
8fd264dcc29c8c6bc42c85c0225f99cc7b80bd43
[]
no_license
bellmit/BIGR
https://github.com/bellmit/BIGR
84d7fabf25f35388420bf847bdb59afb945a2e8c
7c538f9e14a4394f2e7a126bf396881a108302ae
refs/heads/master
2022-01-27T17:57:08.303000
2013-10-03T17:55:22
2013-10-03T17:55:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ardais.bigr.lims.web.form; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import com.ardais.bigr.api.ApiFunctions; import com.ardais.bigr.api.ValidateIds; import com.ardais.bigr.iltds.btx.BTXDetails; import com.ardais.bigr.lims.btx.BTXDetailsPathLabSlides; import com.ardais.bigr.lims.javabeans.SlideData; import com.ardais.bigr.web.action.BigrActionMapping; import com.ardais.bigr.web.form.BigrActionForm; import com.gulfstreambio.gboss.GbossFactory; /** * @author JThompson * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class LimsPathLabForm extends BigrActionForm { private String _limsUserId; private String _newSlideId; private String _newBmsValue; private String[] _slideIdList; private String[] _bmsValueList; private String[] _sampleIdList; private String[] _diNameList; private String[] _caseIdList; private String[] _sampleTypeDisplayList; private String[] _procedureList; private String[] _cutLevelList; private String _operationType; private String[] _getReport; /** * @see com.ardais.bigr.web.form.BigrActionForm#doReset(BigrActionMapping, HttpServletRequest) */ protected void doReset(BigrActionMapping mapping, HttpServletRequest request) { } /** * @see com.ardais.bigr.web.form.BigrActionForm#doValidate(BigrActionMapping, HttpServletRequest) */ public ActionErrors doValidate(BigrActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (mapping.getPath().equals("/lims/limsPathLab")) { //validate valid user id. if (ApiFunctions.isEmpty(getLimsUserId())) { errors.add("user", new ActionError("lims.error.invalidLIMSUser")); setLimsUserId(null); } //No sample entered and "Get Report" button pressed. else if (ApiFunctions.isEmpty(getNewSlideId()) && ApiFunctions.isEmpty(getGetReport())) { //Set operation type. setOperationType(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER); } //Slide Id entered and "Get Report" button not pressed. else if (!ApiFunctions.isEmpty(getNewSlideId()) && ApiFunctions.isEmpty(getGetReport())) { //Set operation type. setOperationType(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE); //Check for the slide format if (!ValidateIds.isValid(getNewSlideId(), ValidateIds.TYPESET_SLIDE, false)) { errors.add("newSlide", new ActionError("lims.error.invalidSlideFormat", getNewSlideId())); } //validate sample id doesn't already exist in list if (getSlideIdList() != null) { List slides = Arrays.asList(getSlideIdList()); if (slides.contains(getNewSlideId())) { errors.add( "duplicateSlide", new ActionError("lims.error.duplicateSlide", getNewSlideId())); setNewSlideId(null); } } } //"Get Report" button pressed. else if (!ApiFunctions.isEmpty(getGetReport())) { //Set operation type. setOperationType(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT); } } return errors; } /** * @see com.ardais.bigr.iltds.btx.DescribableIntoBtxDetails#describeIntoBtxDetails(BTXDetails, BigrActionMapping, HttpServletRequest) */ public void describeIntoBtxDetails( BTXDetails btxDetails, BigrActionMapping mapping, HttpServletRequest request) { BTXDetailsPathLabSlides createSlidesPrepare = (BTXDetailsPathLabSlides) btxDetails; //If user entered User Id. if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER)) { createSlidesPrepare.setOperationType(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER); createSlidesPrepare.setLimsUserId(getLimsUserId()); } //If user entered/scanned slide Id. else if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE)) { createSlidesPrepare.setOperationType(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE); createSlidesPrepare.setLimsUserId(getLimsUserId()); createSlidesPrepare.setCurrentSlide(getNewSlideId()); } //If "Get Report" button pressed else if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT)) { createSlidesPrepare.setOperationType(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT); String[] slides = getSlideIdList(); //Add all the slides to List. ArrayList slideDataBeans = new ArrayList(); for (int i = 0; i < slides.length; i++) { SlideData slideData = new SlideData(); slideData.setSlideId(slides[i]); slideDataBeans.add(slideData); } createSlidesPrepare.setLimsUserId(getLimsUserId()); createSlidesPrepare.setSlideData(slideDataBeans); } } /** * @see com.ardais.bigr.web.form.BigrActionForm#populateFromBtxDetails(BTXDetails) */ public void populateFromBtxDetails(BTXDetails btxDetails) { BTXDetailsPathLabSlides createSlidesPrepare = (BTXDetailsPathLabSlides) btxDetails; //If user enters/scans user Id. if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER)) { if (!createSlidesPrepare.isTransactionCompleted()) { setLimsUserId(null); } } //If user enters/scans sample Id. if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE)) { if (createSlidesPrepare.isTransactionCompleted()) { //Add new slide Id to slide id list. setSlideIdList(addItemToArray(getNewSlideId(), getSlideIdList())); //add the Bms value for the new slide to the Bms value list setBmsValueList( addItemToArray(createSlidesPrepare.getCurrentBmsValue(), getBmsValueList())); } setNewSlideId(null); } //If "get Report" button is pressed if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT)) { List list = createSlidesPrepare.getSlideData(); String[] sampleLabelList = new String[list.size()]; String[] bmsYNList = new String[list.size()]; String[] slideLabelList = new String[list.size()]; String[] donorInstNameList = new String[list.size()]; String[] caseIdList = new String[list.size()]; String[] sampleTypeDisplayList = new String[list.size()]; String[] procedureList = new String[list.size()]; String[] cutLevelList = new String[list.size()]; //Loop thriugh the results. for (int i = 0; i < list.size(); i++) { SlideData slide = (SlideData) list.get(i); String sampleTypeCid = slide.getSampleTypeCid(); String sampleTypeDisplay = (ApiFunctions.isEmpty(sampleTypeCid) ? "" : GbossFactory.getInstance().getDescription(sampleTypeCid)); sampleLabelList[i] = slide.getSampleId(); bmsYNList[i] = slide.getBmsYN(); slideLabelList[i] = slide.getSlideId(); donorInstNameList[i] = slide.getDonorInstitutionName(); caseIdList[i] = slide.getCaseId(); sampleTypeDisplayList[i] = sampleTypeDisplay; procedureList[i] = slide.getProcedure(); cutLevelList[i] = String.valueOf(slide.getCutLevel()); } //Set the lists to form setSampleIdList(sampleLabelList); setBmsValueList(bmsYNList); setSlideIdList(slideLabelList); setDiNameList(donorInstNameList); setCaseIdList(caseIdList); setCutLevelList(cutLevelList); setSampleTypeDisplayList(sampleTypeDisplayList); setProcedureList(procedureList); } } /** * Adds item to myArray. * @param <code>String</code> item * @param <code>String[]</code> myArray. */ private String[] addItemToArray(String item, String[] myArray) { if (!ApiFunctions.isEmpty(item)) { if (ApiFunctions.isEmpty(myArray)) { return myArray = new String[] { item }; } else { String[] temp = new String[myArray.length + 1]; System.arraycopy(myArray, 0, temp, 0, myArray.length); temp[temp.length - 1] = item; return temp; } } else { return null; } } /** * Returns the limsUserId. * @return String */ public String getLimsUserId() { return _limsUserId; } /** * Returns the newSlideId. * @return String */ public String getNewSlideId() { return _newSlideId; } /** * Returns the slideIdList. * @return String[] */ public String[] getSlideIdList() { return _slideIdList; } /** * Sets the limsUserId. * @param limsUserId The limsUserId to set */ public void setLimsUserId(String limsUserId) { _limsUserId = limsUserId; } /** * Sets the newSlideId. * @param newSlideId The newSlideId to set */ public void setNewSlideId(String newSlideId) { _newSlideId = newSlideId; } /** * Sets the slideIdList. * @param slideIdList The slideIdList to set */ public void setSlideIdList(String[] slideIdList) { _slideIdList = slideIdList; } /** * Returns the cutLevelList. * @return String[] */ public String[] getCutLevelList() { return _cutLevelList; } /** * Returns the diNameList. * @return String[] */ public String[] getDiNameList() { return _diNameList; } /** * Returns the sampleTypeDisplayList. * @return String[] */ public String[] getSampleTypeDisplayList() { return _sampleTypeDisplayList; } /** * Returns the procedureList. * @return String[] */ public String[] getProcedureList() { return _procedureList; } /** * Returns the sampleIdList. * @return String[] */ public String[] getSampleIdList() { return _sampleIdList; } /** * Sets the cutLevelList. * @param cutLevelList The cutLevelList to set */ public void setCutLevelList(String[] cutLevelList) { _cutLevelList = cutLevelList; } /** * Sets the diNameList. * @param diNameList The diNameList to set */ public void setDiNameList(String[] diNameList) { _diNameList = diNameList; } /** * Sets the sampleTypeDisplayList. * @param sampleTypeDisplayList The sampleTypeDisplayList to set */ public void setSampleTypeDisplayList(String[] sampleTypeDisplayList) { _sampleTypeDisplayList = sampleTypeDisplayList; } /** * Sets the procedureList. * @param procedureList The procedureList to set */ public void setProcedureList(String[] procedureList) { _procedureList = procedureList; } /** * Sets the sampleIdList. * @param sampleIdList The sampleIdList to set */ public void setSampleIdList(String[] sampleIdList) { _sampleIdList = sampleIdList; } /** * Returns the caseIdList. * @return String[] */ public String[] getCaseIdList() { return _caseIdList; } /** * Sets the caseIdList. * @param caseIdList The caseIdList to set */ public void setCaseIdList(String[] caseIdList) { _caseIdList = caseIdList; } /** * Returns the operationType. * @return String */ public String getOperationType() { return _operationType; } /** * Sets the operationType. * @param operationType The operationType to set */ public void setOperationType(String operationType) { _operationType = operationType; } /** * Returns the getReport. * @return String[] */ public String[] getGetReport() { return _getReport; } /** * Sets the getReport. * @param getReport The getReport to set */ public void setGetReport(String[] getReport) { _getReport = getReport; } /** * @return */ public String[] getBmsValueList() { return _bmsValueList; } /** * @return */ public String getNewBmsValue() { return _newBmsValue; } /** * @param strings */ public void setBmsValueList(String[] strings) { _bmsValueList = strings; } /** * @param string */ public void setNewBmsValue(String string) { _newBmsValue = string; } }
UTF-8
Java
12,295
java
LimsPathLabForm.java
Java
[ { "context": ".gulfstreambio.gboss.GbossFactory;\n\n/**\n * @author JThompson\n *\n * To change this generated comment edit the t", "end": 659, "score": 0.984082818031311, "start": 650, "tag": "NAME", "value": "JThompson" } ]
null
[]
package com.ardais.bigr.lims.web.form; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import com.ardais.bigr.api.ApiFunctions; import com.ardais.bigr.api.ValidateIds; import com.ardais.bigr.iltds.btx.BTXDetails; import com.ardais.bigr.lims.btx.BTXDetailsPathLabSlides; import com.ardais.bigr.lims.javabeans.SlideData; import com.ardais.bigr.web.action.BigrActionMapping; import com.ardais.bigr.web.form.BigrActionForm; import com.gulfstreambio.gboss.GbossFactory; /** * @author JThompson * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class LimsPathLabForm extends BigrActionForm { private String _limsUserId; private String _newSlideId; private String _newBmsValue; private String[] _slideIdList; private String[] _bmsValueList; private String[] _sampleIdList; private String[] _diNameList; private String[] _caseIdList; private String[] _sampleTypeDisplayList; private String[] _procedureList; private String[] _cutLevelList; private String _operationType; private String[] _getReport; /** * @see com.ardais.bigr.web.form.BigrActionForm#doReset(BigrActionMapping, HttpServletRequest) */ protected void doReset(BigrActionMapping mapping, HttpServletRequest request) { } /** * @see com.ardais.bigr.web.form.BigrActionForm#doValidate(BigrActionMapping, HttpServletRequest) */ public ActionErrors doValidate(BigrActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (mapping.getPath().equals("/lims/limsPathLab")) { //validate valid user id. if (ApiFunctions.isEmpty(getLimsUserId())) { errors.add("user", new ActionError("lims.error.invalidLIMSUser")); setLimsUserId(null); } //No sample entered and "Get Report" button pressed. else if (ApiFunctions.isEmpty(getNewSlideId()) && ApiFunctions.isEmpty(getGetReport())) { //Set operation type. setOperationType(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER); } //Slide Id entered and "Get Report" button not pressed. else if (!ApiFunctions.isEmpty(getNewSlideId()) && ApiFunctions.isEmpty(getGetReport())) { //Set operation type. setOperationType(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE); //Check for the slide format if (!ValidateIds.isValid(getNewSlideId(), ValidateIds.TYPESET_SLIDE, false)) { errors.add("newSlide", new ActionError("lims.error.invalidSlideFormat", getNewSlideId())); } //validate sample id doesn't already exist in list if (getSlideIdList() != null) { List slides = Arrays.asList(getSlideIdList()); if (slides.contains(getNewSlideId())) { errors.add( "duplicateSlide", new ActionError("lims.error.duplicateSlide", getNewSlideId())); setNewSlideId(null); } } } //"Get Report" button pressed. else if (!ApiFunctions.isEmpty(getGetReport())) { //Set operation type. setOperationType(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT); } } return errors; } /** * @see com.ardais.bigr.iltds.btx.DescribableIntoBtxDetails#describeIntoBtxDetails(BTXDetails, BigrActionMapping, HttpServletRequest) */ public void describeIntoBtxDetails( BTXDetails btxDetails, BigrActionMapping mapping, HttpServletRequest request) { BTXDetailsPathLabSlides createSlidesPrepare = (BTXDetailsPathLabSlides) btxDetails; //If user entered User Id. if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER)) { createSlidesPrepare.setOperationType(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER); createSlidesPrepare.setLimsUserId(getLimsUserId()); } //If user entered/scanned slide Id. else if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE)) { createSlidesPrepare.setOperationType(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE); createSlidesPrepare.setLimsUserId(getLimsUserId()); createSlidesPrepare.setCurrentSlide(getNewSlideId()); } //If "Get Report" button pressed else if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT)) { createSlidesPrepare.setOperationType(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT); String[] slides = getSlideIdList(); //Add all the slides to List. ArrayList slideDataBeans = new ArrayList(); for (int i = 0; i < slides.length; i++) { SlideData slideData = new SlideData(); slideData.setSlideId(slides[i]); slideDataBeans.add(slideData); } createSlidesPrepare.setLimsUserId(getLimsUserId()); createSlidesPrepare.setSlideData(slideDataBeans); } } /** * @see com.ardais.bigr.web.form.BigrActionForm#populateFromBtxDetails(BTXDetails) */ public void populateFromBtxDetails(BTXDetails btxDetails) { BTXDetailsPathLabSlides createSlidesPrepare = (BTXDetailsPathLabSlides) btxDetails; //If user enters/scans user Id. if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_SCAN_USER)) { if (!createSlidesPrepare.isTransactionCompleted()) { setLimsUserId(null); } } //If user enters/scans sample Id. if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_ADD_SLIDE)) { if (createSlidesPrepare.isTransactionCompleted()) { //Add new slide Id to slide id list. setSlideIdList(addItemToArray(getNewSlideId(), getSlideIdList())); //add the Bms value for the new slide to the Bms value list setBmsValueList( addItemToArray(createSlidesPrepare.getCurrentBmsValue(), getBmsValueList())); } setNewSlideId(null); } //If "get Report" button is pressed if (getOperationType().equals(BTXDetailsPathLabSlides.OP_TYPE_GET_REPORT)) { List list = createSlidesPrepare.getSlideData(); String[] sampleLabelList = new String[list.size()]; String[] bmsYNList = new String[list.size()]; String[] slideLabelList = new String[list.size()]; String[] donorInstNameList = new String[list.size()]; String[] caseIdList = new String[list.size()]; String[] sampleTypeDisplayList = new String[list.size()]; String[] procedureList = new String[list.size()]; String[] cutLevelList = new String[list.size()]; //Loop thriugh the results. for (int i = 0; i < list.size(); i++) { SlideData slide = (SlideData) list.get(i); String sampleTypeCid = slide.getSampleTypeCid(); String sampleTypeDisplay = (ApiFunctions.isEmpty(sampleTypeCid) ? "" : GbossFactory.getInstance().getDescription(sampleTypeCid)); sampleLabelList[i] = slide.getSampleId(); bmsYNList[i] = slide.getBmsYN(); slideLabelList[i] = slide.getSlideId(); donorInstNameList[i] = slide.getDonorInstitutionName(); caseIdList[i] = slide.getCaseId(); sampleTypeDisplayList[i] = sampleTypeDisplay; procedureList[i] = slide.getProcedure(); cutLevelList[i] = String.valueOf(slide.getCutLevel()); } //Set the lists to form setSampleIdList(sampleLabelList); setBmsValueList(bmsYNList); setSlideIdList(slideLabelList); setDiNameList(donorInstNameList); setCaseIdList(caseIdList); setCutLevelList(cutLevelList); setSampleTypeDisplayList(sampleTypeDisplayList); setProcedureList(procedureList); } } /** * Adds item to myArray. * @param <code>String</code> item * @param <code>String[]</code> myArray. */ private String[] addItemToArray(String item, String[] myArray) { if (!ApiFunctions.isEmpty(item)) { if (ApiFunctions.isEmpty(myArray)) { return myArray = new String[] { item }; } else { String[] temp = new String[myArray.length + 1]; System.arraycopy(myArray, 0, temp, 0, myArray.length); temp[temp.length - 1] = item; return temp; } } else { return null; } } /** * Returns the limsUserId. * @return String */ public String getLimsUserId() { return _limsUserId; } /** * Returns the newSlideId. * @return String */ public String getNewSlideId() { return _newSlideId; } /** * Returns the slideIdList. * @return String[] */ public String[] getSlideIdList() { return _slideIdList; } /** * Sets the limsUserId. * @param limsUserId The limsUserId to set */ public void setLimsUserId(String limsUserId) { _limsUserId = limsUserId; } /** * Sets the newSlideId. * @param newSlideId The newSlideId to set */ public void setNewSlideId(String newSlideId) { _newSlideId = newSlideId; } /** * Sets the slideIdList. * @param slideIdList The slideIdList to set */ public void setSlideIdList(String[] slideIdList) { _slideIdList = slideIdList; } /** * Returns the cutLevelList. * @return String[] */ public String[] getCutLevelList() { return _cutLevelList; } /** * Returns the diNameList. * @return String[] */ public String[] getDiNameList() { return _diNameList; } /** * Returns the sampleTypeDisplayList. * @return String[] */ public String[] getSampleTypeDisplayList() { return _sampleTypeDisplayList; } /** * Returns the procedureList. * @return String[] */ public String[] getProcedureList() { return _procedureList; } /** * Returns the sampleIdList. * @return String[] */ public String[] getSampleIdList() { return _sampleIdList; } /** * Sets the cutLevelList. * @param cutLevelList The cutLevelList to set */ public void setCutLevelList(String[] cutLevelList) { _cutLevelList = cutLevelList; } /** * Sets the diNameList. * @param diNameList The diNameList to set */ public void setDiNameList(String[] diNameList) { _diNameList = diNameList; } /** * Sets the sampleTypeDisplayList. * @param sampleTypeDisplayList The sampleTypeDisplayList to set */ public void setSampleTypeDisplayList(String[] sampleTypeDisplayList) { _sampleTypeDisplayList = sampleTypeDisplayList; } /** * Sets the procedureList. * @param procedureList The procedureList to set */ public void setProcedureList(String[] procedureList) { _procedureList = procedureList; } /** * Sets the sampleIdList. * @param sampleIdList The sampleIdList to set */ public void setSampleIdList(String[] sampleIdList) { _sampleIdList = sampleIdList; } /** * Returns the caseIdList. * @return String[] */ public String[] getCaseIdList() { return _caseIdList; } /** * Sets the caseIdList. * @param caseIdList The caseIdList to set */ public void setCaseIdList(String[] caseIdList) { _caseIdList = caseIdList; } /** * Returns the operationType. * @return String */ public String getOperationType() { return _operationType; } /** * Sets the operationType. * @param operationType The operationType to set */ public void setOperationType(String operationType) { _operationType = operationType; } /** * Returns the getReport. * @return String[] */ public String[] getGetReport() { return _getReport; } /** * Sets the getReport. * @param getReport The getReport to set */ public void setGetReport(String[] getReport) { _getReport = getReport; } /** * @return */ public String[] getBmsValueList() { return _bmsValueList; } /** * @return */ public String getNewBmsValue() { return _newBmsValue; } /** * @param strings */ public void setBmsValueList(String[] strings) { _bmsValueList = strings; } /** * @param string */ public void setNewBmsValue(String string) { _newBmsValue = string; } }
12,295
0.670842
0.670354
421
28.204275
24.844524
135
false
false
0
0
0
0
0
0
0.342043
false
false
4
12c39fe092c6f61af3f3298060f64fa77489e975
20,057,497,284,696
b8030dd6216fad13eed7db64b862a9c1ba2ee5ea
/src/com/human/ex/practice01.java
49f5ec4e6082321695a479ef6ffaa9c66d3ec0b2
[]
no_license
ISOGAWAMOMOKO/HumanBackup
https://github.com/ISOGAWAMOMOKO/HumanBackup
c0e5959d94ca533a3c3d44f7fac6866553e7d642
d709e38ff4e8d2ece0d5d4c3948be4c781e72529
refs/heads/master
2023-01-05T13:53:46.686000
2020-10-21T08:07:31
2020-10-21T08:07:31
305,867,736
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.human.ex; public class practice01 { public static void main(String[] args) { // // 1.while문과 for문을 이용해서 왼쪽 순서도를 프로그램으로 구현해 보자. // int a=2; // int b=1; // b++; // System.out.println(a); // System.out.println(b); // // // while(b<15) { // a=a+1; // b=b+a; // } // System.out.println(a); // System.out.println(b); // // //2.100의 모든 약수 // int a=100; // for(int i=1;i<=a;i++) { // if(100%i==0) { // System.out.println(i); // } // } // // //3.두 수를 입력받아 두수의 공통된 약수를 모두 출력해 보자. // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // for(int i=1;i<=a;i++) { // if(a%i==0) { // for(int j=1;j<=b;j++) { // if(b%j==0) { // if(i==j) { // System.out.println(j); // } // } // } // } // } // // // //4.두수를 입력받아 두수의 최대 공약수를 구하는 프로그램 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int c=0;//최대 공약수 // for(int i=1;i<=a;i++) { // if(a%i==0) { // for(int j=1;j<=b;j++) { // if(b%j==0) { // if(i==j) { // c=i; // } // } // } // } // } // System.out.println(c); // // //5.사용자에게 숫자를 하나 입력받아 입력한 숫자들의 합이 100이 될때까지 계속입력을 받다가 100이 넘으면 합산을 출력 // int sum=0; // while(sum<=100) { // System.out.print("합이 100이 될때까지 계속입력 하세요>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // sum+=a; // } // System.out.print(sum); // // // //6.사용자에게 계속해서 숫자를 입력받아 1~10사이의 숫자를 3번 입력 할 때 까지 반복한다. // //입력이 끝나면 잘못 입력한 회수와 제대로 입력한 회수를 출력하고 사용자가 제대로 입력한 총합을 출력 // // int counta=0; // int countmiss=0; // int sum=0; // // for(;;) { // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // if(a>0&&a<=10) { // sum+=a; // counta++; // }else { // countmiss++; // } // if(counta==3) { // break; // } // } // System.out.println("잘못 입력한 회수는>>"+countmiss); // System.out.println("제대로 입력한 회수는>>"+counta); // System.out.println("입력한 숫자의 총합은"+sum); // // // //7.두수를 입력 받아 공배수 중 가장 작은 배수를 최소 공배수를 출력 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int c=0; // // // //8.3개의 수를 입력 받아 가장 작은 수와 가장 큰수를 출력 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력3>>"); // int c=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // // if(a>b) { // int t; // t=a; // a=b; // b=t; // if(b>c) { // t=c; // c=b; // b=t; // } // } // System.out.println("가장 작은 수는"+a); // System.out.println("가장 큰수는"+c); // // //9.100이하의 수학과목 점수를 5번 입력받아 60이하 탈락자가 몇명인지 출력하는 프로그램 // // int count=0; // // for(int i=1;i<=5;i++) { // System.out.print("수학과목 점수입력"+i+"번>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // if(a<60) { // count++; // } // } // System.out.print("달락자는"+count+"명"); // // //10. 1부터 차례대로 더한 총합이 최초 100을 넘기 직전까지 누적한 결과값을 순서대로 출력하시오. // //1:1 2:3 3:6 4:10 5:15 6:21 // int sum=0; // for(int i=1;;i++) { // if(sum<=100) { // sum+=i; // System.out.println(i+":"+sum); // }else { // break; // } // } // // //11. 문자열과 숫자를 입력받아 입력받은 문자열을 숫자만큼 출력 // // //12. 입력받은 두수 사이의 숫자들의 합을 구하는 프로그램 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int sum=0; // // for(int i=a+1;i<b;i++) { // sum+=i; // } // System.out.print(sum); // // //13. 수를 하나 입력받아 소수인지 아닌지 판별하는 프로그램 // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int count=0; // // for(int i=1;i<=a;i++) { // if(a%i==0) { // count++; // } // } // if(count==2) { // System.out.print("소수이다"); // }else if(count>2){ // System.out.print("소수아니다"); // } // // //14. 두 수를 입력 받아 첫 번째수 부터 시작하여 하나씩 카운트하여 두번째수 수 만큼 화면에 출력 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // for(int i=1;i<=b;i++) { // System.out.print(a); // a++; // } // // //15. 1~9 사이의 숫자를 하나 입력받아 해당 숫자의 구구단을 출력 // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int sum=0; // // System.out.println(a+"단의 구구는"); // // for(int i=1;i<10;i++) { // sum=a*i; // System.out.println(a+"*"+i+"="+sum); // } // // //16. 숫자를 하나 입력받아 1~1000사이에 입력받은 숫자의 배수가 몇 개인지 출력 // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int count=0; // for(int i=1;i<=1000;i++){ // if(i%a==0) { // count++; // } // // System.out.println("입력받은 숫자의 배수는"+count+"게"); // //17. 사용자에게 행과 열을 입력받아 행과 열에 맞춰서 1부터 100까지 출력하는 프로그램 System.out.print("숫자입력>>"); int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine());//행 System.out.print("숫자입력>>"); int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine());//열 int c=1; int j; for(int i=1;i<=b;i++) { for(j=c;j<=a;j++) { System.out.print(j); } System.out.print("\n"); } //18.1 2 3 4 5 // 10 9 8 7 6 // 11 12 13 14 15 // 21 22 23 24 25 //19. 해당 달의 시작 요일과 일수를 입력 받아 달력을 출력해 보자.\t 탭을 이용해서 만들어 보자. //20. 컴퓨터가 던진 동전이 앞면 인지 뒷면 인지 맞추는 프로그램을 구현해 보자. //맞춘 회수와 틀린 회수를 기록해서 보여주자. //21. 컴퓨터가 던진 주사위를 맞추는 프로그램을 구현해 보자. 맞춘 회수와 틀린 회수를 기록해서 보여 주자. } }
UHC
Java
8,037
java
practice01.java
Java
[]
null
[]
package com.human.ex; public class practice01 { public static void main(String[] args) { // // 1.while문과 for문을 이용해서 왼쪽 순서도를 프로그램으로 구현해 보자. // int a=2; // int b=1; // b++; // System.out.println(a); // System.out.println(b); // // // while(b<15) { // a=a+1; // b=b+a; // } // System.out.println(a); // System.out.println(b); // // //2.100의 모든 약수 // int a=100; // for(int i=1;i<=a;i++) { // if(100%i==0) { // System.out.println(i); // } // } // // //3.두 수를 입력받아 두수의 공통된 약수를 모두 출력해 보자. // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // for(int i=1;i<=a;i++) { // if(a%i==0) { // for(int j=1;j<=b;j++) { // if(b%j==0) { // if(i==j) { // System.out.println(j); // } // } // } // } // } // // // //4.두수를 입력받아 두수의 최대 공약수를 구하는 프로그램 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int c=0;//최대 공약수 // for(int i=1;i<=a;i++) { // if(a%i==0) { // for(int j=1;j<=b;j++) { // if(b%j==0) { // if(i==j) { // c=i; // } // } // } // } // } // System.out.println(c); // // //5.사용자에게 숫자를 하나 입력받아 입력한 숫자들의 합이 100이 될때까지 계속입력을 받다가 100이 넘으면 합산을 출력 // int sum=0; // while(sum<=100) { // System.out.print("합이 100이 될때까지 계속입력 하세요>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // sum+=a; // } // System.out.print(sum); // // // //6.사용자에게 계속해서 숫자를 입력받아 1~10사이의 숫자를 3번 입력 할 때 까지 반복한다. // //입력이 끝나면 잘못 입력한 회수와 제대로 입력한 회수를 출력하고 사용자가 제대로 입력한 총합을 출력 // // int counta=0; // int countmiss=0; // int sum=0; // // for(;;) { // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // if(a>0&&a<=10) { // sum+=a; // counta++; // }else { // countmiss++; // } // if(counta==3) { // break; // } // } // System.out.println("잘못 입력한 회수는>>"+countmiss); // System.out.println("제대로 입력한 회수는>>"+counta); // System.out.println("입력한 숫자의 총합은"+sum); // // // //7.두수를 입력 받아 공배수 중 가장 작은 배수를 최소 공배수를 출력 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int c=0; // // // //8.3개의 수를 입력 받아 가장 작은 수와 가장 큰수를 출력 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력3>>"); // int c=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // // if(a>b) { // int t; // t=a; // a=b; // b=t; // if(b>c) { // t=c; // c=b; // b=t; // } // } // System.out.println("가장 작은 수는"+a); // System.out.println("가장 큰수는"+c); // // //9.100이하의 수학과목 점수를 5번 입력받아 60이하 탈락자가 몇명인지 출력하는 프로그램 // // int count=0; // // for(int i=1;i<=5;i++) { // System.out.print("수학과목 점수입력"+i+"번>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // if(a<60) { // count++; // } // } // System.out.print("달락자는"+count+"명"); // // //10. 1부터 차례대로 더한 총합이 최초 100을 넘기 직전까지 누적한 결과값을 순서대로 출력하시오. // //1:1 2:3 3:6 4:10 5:15 6:21 // int sum=0; // for(int i=1;;i++) { // if(sum<=100) { // sum+=i; // System.out.println(i+":"+sum); // }else { // break; // } // } // // //11. 문자열과 숫자를 입력받아 입력받은 문자열을 숫자만큼 출력 // // //12. 입력받은 두수 사이의 숫자들의 합을 구하는 프로그램 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int sum=0; // // for(int i=a+1;i<b;i++) { // sum+=i; // } // System.out.print(sum); // // //13. 수를 하나 입력받아 소수인지 아닌지 판별하는 프로그램 // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int count=0; // // for(int i=1;i<=a;i++) { // if(a%i==0) { // count++; // } // } // if(count==2) { // System.out.print("소수이다"); // }else if(count>2){ // System.out.print("소수아니다"); // } // // //14. 두 수를 입력 받아 첫 번째수 부터 시작하여 하나씩 카운트하여 두번째수 수 만큼 화면에 출력 // System.out.print("숫자입력1>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // System.out.print("숫자입력2>>"); // int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // for(int i=1;i<=b;i++) { // System.out.print(a); // a++; // } // // //15. 1~9 사이의 숫자를 하나 입력받아 해당 숫자의 구구단을 출력 // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int sum=0; // // System.out.println(a+"단의 구구는"); // // for(int i=1;i<10;i++) { // sum=a*i; // System.out.println(a+"*"+i+"="+sum); // } // // //16. 숫자를 하나 입력받아 1~1000사이에 입력받은 숫자의 배수가 몇 개인지 출력 // System.out.print("숫자입력>>"); // int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()); // int count=0; // for(int i=1;i<=1000;i++){ // if(i%a==0) { // count++; // } // // System.out.println("입력받은 숫자의 배수는"+count+"게"); // //17. 사용자에게 행과 열을 입력받아 행과 열에 맞춰서 1부터 100까지 출력하는 프로그램 System.out.print("숫자입력>>"); int a=Integer.parseInt((new java.util.Scanner(System.in)).nextLine());//행 System.out.print("숫자입력>>"); int b=Integer.parseInt((new java.util.Scanner(System.in)).nextLine());//열 int c=1; int j; for(int i=1;i<=b;i++) { for(j=c;j<=a;j++) { System.out.print(j); } System.out.print("\n"); } //18.1 2 3 4 5 // 10 9 8 7 6 // 11 12 13 14 15 // 21 22 23 24 25 //19. 해당 달의 시작 요일과 일수를 입력 받아 달력을 출력해 보자.\t 탭을 이용해서 만들어 보자. //20. 컴퓨터가 던진 동전이 앞면 인지 뒷면 인지 맞추는 프로그램을 구현해 보자. //맞춘 회수와 틀린 회수를 기록해서 보여주자. //21. 컴퓨터가 던진 주사위를 맞추는 프로그램을 구현해 보자. 맞춘 회수와 틀린 회수를 기록해서 보여 주자. } }
8,037
0.517472
0.486877
251
23.653387
21.243687
75
false
false
0
0
0
0
0
0
2.988048
false
false
4
66d30604cc5c3deba158bf9866bb5c6f7b5d5bf9
28,260,884,864,021
928ed25a070c7b832567ea1317f206b2a80a32e7
/app_charting/src/main/java/com/bloomcyclecare/cmcc/ui/cycle/LayerListFragment.java
e54318b8b9514c30805bf893245842425d996939
[]
no_license
parkeroth/ChartyMcChartChart
https://github.com/parkeroth/ChartyMcChartChart
7e098162418387d9c7ac33279f015bec5df2654f
66e2961887274712927e628fd175d27dd7ea8742
refs/heads/master
2021-01-19T21:40:18.747000
2020-12-26T12:38:37
2020-12-26T12:38:37
88,672,354
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bloomcyclecare.cmcc.ui.cycle; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.bloomcyclecare.cmcc.R; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import io.reactivex.functions.Consumer; import io.reactivex.subjects.PublishSubject; /** * Created by parkeroth on 11/23/17. */ public class LayerListFragment extends Fragment { public static final String KEYS_ARG = "keys"; public static final String VALS_ARG = "vals"; private int mKeyArrayId; private int mValArrayId; private LayerAdapter mAdapter; private RecyclerView mRecyclerView; private EntryListView mEntryListView; private DialogFragment mParent; static LayerListFragment newInstance(int keyArrayId, int valArrayId) { LayerListFragment fragment = new LayerListFragment(); Bundle args = new Bundle(); args.putInt(KEYS_ARG, keyArrayId); args.putInt(VALS_ARG, valArrayId); fragment.setArguments(args); return fragment; } @Override public void onAttach(Context context) { super.onAttach(context); mEntryListView = (EntryListView) getActivity(); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); mKeyArrayId = args.getInt(KEYS_ARG); mValArrayId = args.getInt(VALS_ARG); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_layer_list, null, false); mRecyclerView = view.findViewById(R.id.layer_recycler_view); mParent = (DialogFragment) getParentFragment(); String[] keys = getResources().getStringArray(mKeyArrayId); String[] vals = getResources().getStringArray(mValArrayId); Map<String, String> wellnessItems = new HashMap<>(); for (int i=0; i < keys.length; i++) { wellnessItems.put(keys[i], vals[i]); } mAdapter = new LayerAdapter(wellnessItems, getActivity()); mAdapter.clickStream().subscribe(new Consumer<String>() { @Override public void accept(String s) throws Exception { mEntryListView.setOverlay(s); mParent.dismiss(); } }); mRecyclerView.setLayoutManager( new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false)); mRecyclerView.setAdapter(mAdapter); return view; } private static class LayerAdapter extends RecyclerView.Adapter<LayerOptionViewHolder> { private final Map<Integer, String> wellnessItemIndex = new HashMap<>(); private final Map<String, String> wellnessItems = new LinkedHashMap<>(); private final Context mContex; private final PublishSubject<String> mClickPublisher = PublishSubject.create(); public LayerAdapter(Map<String, String> wellnessItems, Context context) { mContex = context; int index = 0; for (Map.Entry<String, String> entry : wellnessItems.entrySet()) { this.wellnessItemIndex.put(index++, entry.getKey()); this.wellnessItems.put(entry.getKey(), entry.getValue()); } } public PublishSubject<String> clickStream() { return mClickPublisher; } @Override public LayerOptionViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { int layoutIdForListItem = R.layout.list_item_layer; LayoutInflater inflater = LayoutInflater.from(mContex); boolean shouldAttachToParentImmediately = false; View view = inflater.inflate(layoutIdForListItem, parent, shouldAttachToParentImmediately); return new LayerOptionViewHolder(view, mClickPublisher); } @Override public void onBindViewHolder(LayerOptionViewHolder holder, int position) { String key = wellnessItemIndex.get(position); holder.bind(key, wellnessItems.get(key)); } @Override public int getItemCount() { return wellnessItems.size(); } } private static class LayerOptionViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mOptionTitle; private PublishSubject<String> mPublisher; private String key; public LayerOptionViewHolder(View itemView, PublishSubject<String> publisher) { super(itemView); itemView.setOnClickListener(this); mPublisher = publisher; mOptionTitle = itemView.findViewById(R.id.tv_layer_item); } public void bind(String key, String value) { this.key = key; mOptionTitle.setText(value); } public String getKey() { return key; } @Override public void onClick(View view) { mPublisher.onNext(key); } } }
UTF-8
Java
5,061
java
LayerListFragment.java
Java
[ { "context": "ctivex.subjects.PublishSubject;\n\n/**\n * Created by parkeroth on 11/23/17.\n */\n\npublic class LayerListFragment ", "end": 684, "score": 0.9996449947357178, "start": 675, "tag": "USERNAME", "value": "parkeroth" } ]
null
[]
package com.bloomcyclecare.cmcc.ui.cycle; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.bloomcyclecare.cmcc.R; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import io.reactivex.functions.Consumer; import io.reactivex.subjects.PublishSubject; /** * Created by parkeroth on 11/23/17. */ public class LayerListFragment extends Fragment { public static final String KEYS_ARG = "keys"; public static final String VALS_ARG = "vals"; private int mKeyArrayId; private int mValArrayId; private LayerAdapter mAdapter; private RecyclerView mRecyclerView; private EntryListView mEntryListView; private DialogFragment mParent; static LayerListFragment newInstance(int keyArrayId, int valArrayId) { LayerListFragment fragment = new LayerListFragment(); Bundle args = new Bundle(); args.putInt(KEYS_ARG, keyArrayId); args.putInt(VALS_ARG, valArrayId); fragment.setArguments(args); return fragment; } @Override public void onAttach(Context context) { super.onAttach(context); mEntryListView = (EntryListView) getActivity(); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); mKeyArrayId = args.getInt(KEYS_ARG); mValArrayId = args.getInt(VALS_ARG); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_layer_list, null, false); mRecyclerView = view.findViewById(R.id.layer_recycler_view); mParent = (DialogFragment) getParentFragment(); String[] keys = getResources().getStringArray(mKeyArrayId); String[] vals = getResources().getStringArray(mValArrayId); Map<String, String> wellnessItems = new HashMap<>(); for (int i=0; i < keys.length; i++) { wellnessItems.put(keys[i], vals[i]); } mAdapter = new LayerAdapter(wellnessItems, getActivity()); mAdapter.clickStream().subscribe(new Consumer<String>() { @Override public void accept(String s) throws Exception { mEntryListView.setOverlay(s); mParent.dismiss(); } }); mRecyclerView.setLayoutManager( new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false)); mRecyclerView.setAdapter(mAdapter); return view; } private static class LayerAdapter extends RecyclerView.Adapter<LayerOptionViewHolder> { private final Map<Integer, String> wellnessItemIndex = new HashMap<>(); private final Map<String, String> wellnessItems = new LinkedHashMap<>(); private final Context mContex; private final PublishSubject<String> mClickPublisher = PublishSubject.create(); public LayerAdapter(Map<String, String> wellnessItems, Context context) { mContex = context; int index = 0; for (Map.Entry<String, String> entry : wellnessItems.entrySet()) { this.wellnessItemIndex.put(index++, entry.getKey()); this.wellnessItems.put(entry.getKey(), entry.getValue()); } } public PublishSubject<String> clickStream() { return mClickPublisher; } @Override public LayerOptionViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { int layoutIdForListItem = R.layout.list_item_layer; LayoutInflater inflater = LayoutInflater.from(mContex); boolean shouldAttachToParentImmediately = false; View view = inflater.inflate(layoutIdForListItem, parent, shouldAttachToParentImmediately); return new LayerOptionViewHolder(view, mClickPublisher); } @Override public void onBindViewHolder(LayerOptionViewHolder holder, int position) { String key = wellnessItemIndex.get(position); holder.bind(key, wellnessItems.get(key)); } @Override public int getItemCount() { return wellnessItems.size(); } } private static class LayerOptionViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mOptionTitle; private PublishSubject<String> mPublisher; private String key; public LayerOptionViewHolder(View itemView, PublishSubject<String> publisher) { super(itemView); itemView.setOnClickListener(this); mPublisher = publisher; mOptionTitle = itemView.findViewById(R.id.tv_layer_item); } public void bind(String key, String value) { this.key = key; mOptionTitle.setText(value); } public String getKey() { return key; } @Override public void onClick(View view) { mPublisher.onNext(key); } } }
5,061
0.725548
0.723968
163
30.04908
26.697994
121
false
false
0
0
0
0
0
0
0.668712
false
false
4
3915badd16be1e27e6ac9758c4c62e0e64844868
21,088,289,434,002
e9b497c60fc2a263e3345f53c2f1b269c484de04
/src/fr/dorvak/workmc/commands/HelpCommand.java
a4dea45c33ee4f2c3da24f4c73823b1fda6fbfdb
[ "MIT" ]
permissive
DorvakOff/WorkMC
https://github.com/DorvakOff/WorkMC
46ab510904b2deb092eeb81ae16319d24dfb3152
9699aab6e2e3a4a9bbca27308bc34fbb8929300f
refs/heads/master
2020-12-27T04:22:55.668000
2020-02-05T14:27:28
2020-02-05T14:27:28
237,763,880
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.dorvak.workmc.commands; import java.awt.Color; import fr.dorvak.betterjda.lite.commands.Command; import fr.dorvak.betterjda.lite.commands.CommandResult; import fr.dorvak.betterjda.lite.commands.CommandSenderType; import fr.dorvak.betterjda.lite.commands.listeners.CommandListener; import fr.dorvak.betterjda.lite.utils.EmbedHelper; import fr.dorvak.workmc.WorkMc; import fr.dorvak.workmc.utils.Constants; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.Permission; import net.dv8tion.jda.core.entities.Member; import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.entities.User; import net.dv8tion.jda.core.entities.impl.UserImpl; /** * @author Dorvak * * Licensed with MIT - Author must be mentionned */ public class HelpCommand extends CommandListener { @Override public CommandResult perform(Command command, String[] args) { if(command.getCommandSenderType() == CommandSenderType.CONSOLE) return CommandResult.COMMAND_NOT_ALLOWED; User user = command.getPerformer(); String prefix = WorkMc.getInstance().getPrefixOnDiscord(); TextChannel channel = command.getTextChannel(); Member member = WorkMc.getInstance().getJDA().getGuildById(Constants.GUILD_ID).getMember(user); EmbedBuilder embed = EmbedHelper.getBasicEmbed(); embed.setColor(Color.CYAN); embed.setTitle("Voici la liste des commandes : (préfixe: !)"); embed.addField(prefix + "help", "Vous affiche la commande d'aide.", false); embed.addField(prefix + "ticket", "Créez un ticket.", false); embed.addField(prefix + "level / " + prefix + "rank <@membre (optionnel)>", "Obtenez votre level ou celui d'un membre.", false); embed.addField(prefix + "levels / " + prefix + "top", "Regardez le classement des niveaux du serveur.", false); embed.addField(prefix + "google", "T'aide à chercher quand tu y arrive pas.", false); embed.addField(prefix + "dispo list", "Affiche la liste des vendeurs de services disponible.", false); embed.addField(prefix + "suggest", "Permet de faire une suggestion.", false); EmbedBuilder more = EmbedHelper.getBasicEmbed(); more.setColor(Color.CYAN); more.setTitle("Commandes supplémentaires : "); if(AvailableCommand.canUseCommand(member)) { more.addField(prefix + "dispo", "Affichez vous comme disponible ou indisponible.", false); } if(member.hasPermission(Permission.KICK_MEMBERS)) { more.addField(prefix + "kick <joueur> <raison (optionnel)>", "Excluez un joueur.", false); } if(member.hasPermission(Permission.BAN_MEMBERS)) { more.addField(prefix + "ban <joueur> <raison (optionnel)>", "Bannissez un joueur.", false); more.addField(prefix + "tempban <joueur> <temps (en jours)> <raison (optionnel)>", "Bannissez un joueur temporairement.", false); more.addField(prefix + "unban <joueur>", "Débannissez un joueur.", false); } if(member.hasPermission(Permission.MESSAGE_MANAGE)) { more.addField(prefix + "warn <joueur> <raison (optionnel)>", "Avertissez un joueur.", false); more.addField(prefix + "warns <joueur>", "Récupérez la liste des avertissements d'un joueur.", false); more.addField(prefix + "mute <joueur> <raison>", "Rendez muet un joueur.", false); more.addField(prefix + "tempmute <joueur> <temps> <raison>", "Rendez muet un joueur temporairement.", false); more.addField(prefix + "unmute <joueur>", "Libérez ce joueur du silence.", false); more.addField(prefix + "clear <montant>", "Nettoyez les messages d'un salon", false); } if (!user.hasPrivateChannel()) user.openPrivateChannel().complete(); ((UserImpl)user).getPrivateChannel().sendMessage(embed.build()).submit() .whenComplete((v, error) -> { if(error != null) { channel.sendMessage("Vos messages privés semblent bloqués, envoie de la liste des commandes ici...").submit(); channel.sendMessage(embed.build()).submit(); if(more.getFields().size() != 0) { channel.sendMessage(more.build()).queue(); } } else { if(more.getFields().size() != 0) { ((UserImpl) user).getPrivateChannel().sendMessage(more.build()).queue(); } channel.sendMessage("La liste des commandes vous a été envoyé en message privé " + user.getAsMention()).submit(); } }); return CommandResult.SUCCESS; } }
ISO-8859-1
Java
4,402
java
HelpCommand.java
Java
[ { "context": "da.core.entities.impl.UserImpl;\r\n\r\n/**\r\n * @author Dorvak\r\n *\r\n * Licensed with MIT - Author must be mentio", "end": 731, "score": 0.9033604264259338, "start": 725, "tag": "USERNAME", "value": "Dorvak" } ]
null
[]
package fr.dorvak.workmc.commands; import java.awt.Color; import fr.dorvak.betterjda.lite.commands.Command; import fr.dorvak.betterjda.lite.commands.CommandResult; import fr.dorvak.betterjda.lite.commands.CommandSenderType; import fr.dorvak.betterjda.lite.commands.listeners.CommandListener; import fr.dorvak.betterjda.lite.utils.EmbedHelper; import fr.dorvak.workmc.WorkMc; import fr.dorvak.workmc.utils.Constants; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.Permission; import net.dv8tion.jda.core.entities.Member; import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.entities.User; import net.dv8tion.jda.core.entities.impl.UserImpl; /** * @author Dorvak * * Licensed with MIT - Author must be mentionned */ public class HelpCommand extends CommandListener { @Override public CommandResult perform(Command command, String[] args) { if(command.getCommandSenderType() == CommandSenderType.CONSOLE) return CommandResult.COMMAND_NOT_ALLOWED; User user = command.getPerformer(); String prefix = WorkMc.getInstance().getPrefixOnDiscord(); TextChannel channel = command.getTextChannel(); Member member = WorkMc.getInstance().getJDA().getGuildById(Constants.GUILD_ID).getMember(user); EmbedBuilder embed = EmbedHelper.getBasicEmbed(); embed.setColor(Color.CYAN); embed.setTitle("Voici la liste des commandes : (préfixe: !)"); embed.addField(prefix + "help", "Vous affiche la commande d'aide.", false); embed.addField(prefix + "ticket", "Créez un ticket.", false); embed.addField(prefix + "level / " + prefix + "rank <@membre (optionnel)>", "Obtenez votre level ou celui d'un membre.", false); embed.addField(prefix + "levels / " + prefix + "top", "Regardez le classement des niveaux du serveur.", false); embed.addField(prefix + "google", "T'aide à chercher quand tu y arrive pas.", false); embed.addField(prefix + "dispo list", "Affiche la liste des vendeurs de services disponible.", false); embed.addField(prefix + "suggest", "Permet de faire une suggestion.", false); EmbedBuilder more = EmbedHelper.getBasicEmbed(); more.setColor(Color.CYAN); more.setTitle("Commandes supplémentaires : "); if(AvailableCommand.canUseCommand(member)) { more.addField(prefix + "dispo", "Affichez vous comme disponible ou indisponible.", false); } if(member.hasPermission(Permission.KICK_MEMBERS)) { more.addField(prefix + "kick <joueur> <raison (optionnel)>", "Excluez un joueur.", false); } if(member.hasPermission(Permission.BAN_MEMBERS)) { more.addField(prefix + "ban <joueur> <raison (optionnel)>", "Bannissez un joueur.", false); more.addField(prefix + "tempban <joueur> <temps (en jours)> <raison (optionnel)>", "Bannissez un joueur temporairement.", false); more.addField(prefix + "unban <joueur>", "Débannissez un joueur.", false); } if(member.hasPermission(Permission.MESSAGE_MANAGE)) { more.addField(prefix + "warn <joueur> <raison (optionnel)>", "Avertissez un joueur.", false); more.addField(prefix + "warns <joueur>", "Récupérez la liste des avertissements d'un joueur.", false); more.addField(prefix + "mute <joueur> <raison>", "Rendez muet un joueur.", false); more.addField(prefix + "tempmute <joueur> <temps> <raison>", "Rendez muet un joueur temporairement.", false); more.addField(prefix + "unmute <joueur>", "Libérez ce joueur du silence.", false); more.addField(prefix + "clear <montant>", "Nettoyez les messages d'un salon", false); } if (!user.hasPrivateChannel()) user.openPrivateChannel().complete(); ((UserImpl)user).getPrivateChannel().sendMessage(embed.build()).submit() .whenComplete((v, error) -> { if(error != null) { channel.sendMessage("Vos messages privés semblent bloqués, envoie de la liste des commandes ici...").submit(); channel.sendMessage(embed.build()).submit(); if(more.getFields().size() != 0) { channel.sendMessage(more.build()).queue(); } } else { if(more.getFields().size() != 0) { ((UserImpl) user).getPrivateChannel().sendMessage(more.build()).queue(); } channel.sendMessage("La liste des commandes vous a été envoyé en message privé " + user.getAsMention()).submit(); } }); return CommandResult.SUCCESS; } }
4,402
0.700775
0.698952
96
43.708332
37.176918
132
false
false
0
0
0
0
0
0
2.833333
false
false
4
7a249bd94879239adc7a914881ea8eb6105cc16c
2,267,742,742,326
e2e76eac51e52a2ba20b2b54f85e8c79bde98599
/api/src/main/java/com/example/api/Book.java
b80e9894274c8f877c962bad985763e4cf1a9952
[]
no_license
alanteriBW/bookworm
https://github.com/alanteriBW/bookworm
c9855c61a1e2193007054c4487cb0f745c712414
d5741f45a660c3734b24caee6acd44151b25e4b1
refs/heads/main
2023-08-15T17:07:34.802000
2021-09-08T11:52:08
2021-09-08T11:52:08
403,995,373
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.api; import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity @Data public class Book { private @Id @GeneratedValue Long id; private String title; private String author; private Long rating; public Book(String title, String author){ this.title = title; this.author = author; } public Book() {} @Override public String toString() { return "Book{" + "id=" + this.id + ", title='" + this.title + '\'' + ", author='" + this.author + '\'' + '}'; } }
UTF-8
Java
611
java
Book.java
Java
[]
null
[]
package com.example.api; import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity @Data public class Book { private @Id @GeneratedValue Long id; private String title; private String author; private Long rating; public Book(String title, String author){ this.title = title; this.author = author; } public Book() {} @Override public String toString() { return "Book{" + "id=" + this.id + ", title='" + this.title + '\'' + ", author='" + this.author + '\'' + '}'; } }
611
0.623568
0.623568
30
19.366667
22.95573
117
false
false
0
0
0
0
0
0
0.5
false
false
4
f215d20c5c76f0f7debb7c68316695ef6c866ab9
8,632,884,312,147
958226fea088875c62f64016cd9ed8544880f9f3
/src/main/java/io/minimum/servinator/NameList.java
d81348c086f85a842e9ae5f4a177991b6937c30c
[]
no_license
minecrafter/Servinator
https://github.com/minecrafter/Servinator
6cba4937904b59cb2c1752928e29025f329ba4e9
23a3b5ae7496949bd47afc64324dac163245be8d
refs/heads/master
2021-01-21T12:03:26.133000
2017-02-26T17:05:59
2017-02-26T17:05:59
42,020,746
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.minimum.servinator; import com.google.common.base.Preconditions; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.io.CharStreams; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.List; import java.util.Random; public class NameList { private static NameList INSTANCE; public static NameList instance() { if (INSTANCE == null) INSTANCE = new NameList(); return INSTANCE; } private final List<String> suffixes; private final ListMultimap<String, String> prefixes; private final Random random = new Random(); private NameList() { suffixes = ImmutableList.copyOf(getLines("suffixes.txt")); ImmutableListMultimap.Builder<String, String> prefixBuilder = ImmutableListMultimap.builder(); prefixBuilder.putAll("generic-english", getLines("lists/generic-english.txt")); prefixBuilder.putAll("latin-derived", getLines("lists/latin-derived.txt")); prefixes = prefixBuilder.build(); } public String generateName(String kind) { Preconditions.checkNotNull(kind, "kind"); Preconditions.checkArgument(prefixes.containsKey(kind), "no such kind found"); String prefix = prefixes.get(kind).get(random.nextInt(prefixes.get(kind).size())); String suffix = suffixes.get(random.nextInt(suffixes.size())); return prefix + suffix; } private List<String> getLines(String file) { try (Reader reader = new InputStreamReader(ClassLoader.getSystemClassLoader().getResourceAsStream(file))) { return CharStreams.readLines(reader); } catch (IOException e) { throw new AssertionError(e); } } }
UTF-8
Java
1,918
java
NameList.java
Java
[]
null
[]
package io.minimum.servinator; import com.google.common.base.Preconditions; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.io.CharStreams; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.List; import java.util.Random; public class NameList { private static NameList INSTANCE; public static NameList instance() { if (INSTANCE == null) INSTANCE = new NameList(); return INSTANCE; } private final List<String> suffixes; private final ListMultimap<String, String> prefixes; private final Random random = new Random(); private NameList() { suffixes = ImmutableList.copyOf(getLines("suffixes.txt")); ImmutableListMultimap.Builder<String, String> prefixBuilder = ImmutableListMultimap.builder(); prefixBuilder.putAll("generic-english", getLines("lists/generic-english.txt")); prefixBuilder.putAll("latin-derived", getLines("lists/latin-derived.txt")); prefixes = prefixBuilder.build(); } public String generateName(String kind) { Preconditions.checkNotNull(kind, "kind"); Preconditions.checkArgument(prefixes.containsKey(kind), "no such kind found"); String prefix = prefixes.get(kind).get(random.nextInt(prefixes.get(kind).size())); String suffix = suffixes.get(random.nextInt(suffixes.size())); return prefix + suffix; } private List<String> getLines(String file) { try (Reader reader = new InputStreamReader(ClassLoader.getSystemClassLoader().getResourceAsStream(file))) { return CharStreams.readLines(reader); } catch (IOException e) { throw new AssertionError(e); } } }
1,918
0.706986
0.706986
55
33.872726
28.897345
115
false
false
0
0
0
0
0
0
0.654545
false
false
4
cf2bea37dbb5c4108c8310d7864e8d2cc860cf1c
11,003,706,249,074
73f28b105a5fd70b18b2c3df8d46dc065e2c6338
/reverseStringII.java
712e284fc6b2c225f088119507b56ddffb62bf3b
[]
no_license
AnnieZhou08/LeetAlgo
https://github.com/AnnieZhou08/LeetAlgo
b3f311f48ec6fdc496ef9aeacff4a2102a9780da
1026a4c10b1859b2aabcb2f8b4a9b4da5f5322ba
refs/heads/master
2021-05-04T06:07:47.587000
2017-05-08T16:36:20
2017-05-08T16:36:20
71,029,199
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Solution { public String reverseString(String s) { char [] newstring = s.toCharArray(); int i = 0; int j = newstring.length-1; while (i < j){ char temp; temp = newstring[i]; newstring[i] = newstring[j]; newstring[j] = temp; i++; j--; } return String.valueOf(newstring); } }
UTF-8
Java
403
java
reverseStringII.java
Java
[]
null
[]
public class Solution { public String reverseString(String s) { char [] newstring = s.toCharArray(); int i = 0; int j = newstring.length-1; while (i < j){ char temp; temp = newstring[i]; newstring[i] = newstring[j]; newstring[j] = temp; i++; j--; } return String.valueOf(newstring); } }
403
0.48139
0.476427
15
25.933332
13.308978
44
false
false
0
0
0
0
0
0
0.666667
false
false
4
16a92f077e4af9da1eaadb85acafb1732f7719a7
24,515,673,327,017
f9b245f3a15dc4b0ded78abe16c53d65e495e074
/src/Problem_Q字符串对比.java
821ad43a1b66388bbd49cbed4e75befeea5cd14f
[]
no_license
7rikka/JavaProject
https://github.com/7rikka/JavaProject
d8c6ab1db9d11e88de487f7f3d4cc24ac3842cb2
01bcb05d59ecc5572451da22eff0b205dee2d283
refs/heads/master
2018-04-04T09:45:28.101000
2017-06-01T04:06:11
2017-06-01T04:06:11
88,968,226
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; /** * Created by Administrator on 2017/5/19 0019. */ public class Problem_Q字符串对比 { public static void main(String[] args) { Scanner cin=new Scanner(System.in); String s1=cin.next(); String s2=cin.next(); if (s1.length()!=s2.length()) System.out.println(1); else if (s1.length()==s2.length()&&s1.equals(s2)) System.out.println(2); else if (s1.length()==s2.length()&&s1.toLowerCase().equals(s2.toLowerCase())) System.out.println(3); else if (s1.length()==s2.length()&&!s1.toLowerCase().equals(s2.toLowerCase())) System.out.println(4); } }
UTF-8
Java
688
java
Problem_Q字符串对比.java
Java
[]
null
[]
import java.util.Scanner; /** * Created by Administrator on 2017/5/19 0019. */ public class Problem_Q字符串对比 { public static void main(String[] args) { Scanner cin=new Scanner(System.in); String s1=cin.next(); String s2=cin.next(); if (s1.length()!=s2.length()) System.out.println(1); else if (s1.length()==s2.length()&&s1.equals(s2)) System.out.println(2); else if (s1.length()==s2.length()&&s1.toLowerCase().equals(s2.toLowerCase())) System.out.println(3); else if (s1.length()==s2.length()&&!s1.toLowerCase().equals(s2.toLowerCase())) System.out.println(4); } }
688
0.581121
0.535398
20
32.900002
23.777931
86
false
false
0
0
0
0
0
0
0.4
false
false
4
e8749bbbecbeb5fad063dfecdb7b1053f6a91a92
1,065,151,958,180
1e453fb1d378a4c694f1e6e0421533c0d7f75eb0
/src/main/java/entities/IO.java
f6d4cbf1b3a6cf398e7c2f22575112f0e4fe01bc
[]
no_license
theBarber/myPrivate
https://github.com/theBarber/myPrivate
307b66a8c63b81570999ef9f9bd647f0abf6522f
1ab617e2ae9944d48fbfc28cb6a77ad4dbdf0213
refs/heads/master
2022-12-10T07:43:26.805000
2020-08-27T11:24:27
2020-08-27T11:24:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package entities; import static java.util.Objects.requireNonNull; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import entities.ramp.app.api.Creative; import infra.module.WithId; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.TreeSet; import java.util.stream.Stream; @JsonInclude(JsonInclude.Include.NON_NULL) public class IO implements WithId<Integer>{ public int ioId; @JsonProperty("creatives") public List<Creative> creatives = new ArrayList<>(); @JsonProperty("deals") public List<Deal> deals = new ArrayList<>(); @JsonProperty("LI") private List<LineItem> lineItems = new ArrayList<>(); public IO(@JsonProperty("ioId") int id) { this.ioId = requireNonNull(id); } @Override public Integer getId() { return ioId; } public Stream<LineItem> lineItems() { return this.lineItems.stream(); } public void addLineItem(LineItem li) { lineItems.add(li); } }
UTF-8
Java
1,167
java
IO.java
Java
[]
null
[]
package entities; import static java.util.Objects.requireNonNull; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import entities.ramp.app.api.Creative; import infra.module.WithId; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.TreeSet; import java.util.stream.Stream; @JsonInclude(JsonInclude.Include.NON_NULL) public class IO implements WithId<Integer>{ public int ioId; @JsonProperty("creatives") public List<Creative> creatives = new ArrayList<>(); @JsonProperty("deals") public List<Deal> deals = new ArrayList<>(); @JsonProperty("LI") private List<LineItem> lineItems = new ArrayList<>(); public IO(@JsonProperty("ioId") int id) { this.ioId = requireNonNull(id); } @Override public Integer getId() { return ioId; } public Stream<LineItem> lineItems() { return this.lineItems.stream(); } public void addLineItem(LineItem li) { lineItems.add(li); } }
1,167
0.684662
0.684662
45
23.933332
19.031437
61
false
false
0
0
0
0
0
0
0.466667
false
false
4
d60991a439ba7d68daa5e2414d56ee69a18f152f
34,969,623,742,976
ae2f39269b3bc7df1981ba21a58027c540763f4a
/backend-mybatis/src/main/java/com/idgenerali/backendmybatis/service/ProductService.java
82fbfccd1587cfbf37e0e11266b2c884ba02e986
[]
no_license
dickanirwansyah/spring-boot-course
https://github.com/dickanirwansyah/spring-boot-course
50599fea1302476ddd7404616420b9853842cbf8
c496b89632226124360fb5064d3384e9ba893229
refs/heads/master
2023-04-27T04:46:42.645000
2020-05-11T11:28:52
2020-05-11T11:28:52
228,291,205
0
1
null
false
2023-04-14T17:54:55
2019-12-16T03:00:50
2020-05-11T11:29:41
2023-04-14T17:54:54
247
0
1
4
Java
false
false
package com.idgenerali.backendmybatis.service; import com.idgenerali.backendmybatis.model.Product; import java.util.ArrayList; public interface ProductService { ArrayList<Product> listProducts(); Product findById(int id); Product findByName(String name); boolean save(Product product); boolean update(Product product); boolean handleSaveOrUpdate(Product product); boolean delete(int id); }
UTF-8
Java
421
java
ProductService.java
Java
[]
null
[]
package com.idgenerali.backendmybatis.service; import com.idgenerali.backendmybatis.model.Product; import java.util.ArrayList; public interface ProductService { ArrayList<Product> listProducts(); Product findById(int id); Product findByName(String name); boolean save(Product product); boolean update(Product product); boolean handleSaveOrUpdate(Product product); boolean delete(int id); }
421
0.764846
0.764846
15
27.066668
17.536501
51
false
false
0
0
0
0
0
0
0.666667
false
false
4
76973cf4bfc11bb5244532cbfa8986265d9afde6
8,306,466,810,977
e4d5cf0eabf78f1318c3e83fb3f23adc10ae9bf8
/students-affairs/src/main/java/com/faculty/studentsaffairs/service/TermTypeService.java
f0786395de73d9964f11cd137766b360f1d3fc27
[]
no_license
abbasbanani94/students-affairs
https://github.com/abbasbanani94/students-affairs
8429648df8ba10dd799df5374ec60e0a3476feed
b959c10003706b5fc27d6711b3140af2d7034f26
refs/heads/main
2023-07-20T05:47:13.222000
2021-08-19T22:25:04
2021-08-19T22:25:04
393,789,533
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.faculty.studentsaffairs.service; import com.faculty.studentsaffairs.repository.TermTypeRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class TermTypeService { @Autowired TermTypeRepository termTypeRepository; }
UTF-8
Java
324
java
TermTypeService.java
Java
[]
null
[]
package com.faculty.studentsaffairs.service; import com.faculty.studentsaffairs.repository.TermTypeRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class TermTypeService { @Autowired TermTypeRepository termTypeRepository; }
324
0.839506
0.839506
12
26
24.038164
65
false
false
0
0
0
0
0
0
0.416667
false
false
4
093534a1ba8141134f483c5053d64836a7e02e56
4,844,723,124,295
6b70147f2239e808f8cf21fc2376bda0971f1540
/Math20170104/src/com/vector/study07/Main.java
42bae6c6c7a9862a66c5bb60c156cee624081d84
[]
no_license
shangxin10/arithmetic
https://github.com/shangxin10/arithmetic
5f48f501e4fe6f0c8088b8abc5c11eb79d6d7cda
3932a325f1677589abb688feb8a87ca56f007e76
refs/heads/master
2017-05-11T22:47:05.944000
2017-02-22T03:16:14
2017-02-22T03:16:14
82,754,437
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vector.study07; /** * 问题描述   输入两个整数a和b,输出这两个整数的和。a和b都不超过100位。 算法描述   由于a和b都比较大,所以不能直接使用语言中的标准数据类型来存储。对于这种问题,一般使用数组来处理。   定义一个数组A,A[0]用于存储a的个位,A[1]用于存储a的十位,依此类推。同样可以用一个数组B来存储b。   计算c = a + b的时候,首先将A[0]与B[0]相加,如果有进位产生,则把进位(即和的十位数)存入r,把和的个位数存入C[0],即C[0]等于(A[0]+B[0])%10。然后计算A[1]与B[1]相加,这时还应将低位进上来的值r也加起来,即C[1]应该是A[1]、B[1]和r三个数的和.如果又有进位产生,则仍可将新的进位存入到r中,和的个位存到C[1]中。依此类推,即可求出C的所有位。   最后将C输出即可。 输入格式   输入包括两行,第一行为一个非负整数a,第二行为一个非负整数b。两个整数都不超过100位,两数的最高位都不是0。 输出格式   输出一行,表示a + b的值。 样例输入 20100122201001221234567890 2010012220100122 样例输出 20100122203011233454668012 */ import java.util.Scanner; public class Main { public Main(){ Scanner in = new Scanner(System.in); String firststr = in.nextLine(); String secondstr = in.nextLine(); in.close(); int [] first = new int[firststr.length()]; for(int i = 0;i<firststr.length();i++){ first[firststr.length()-1-i] = firststr.charAt(i)-'0'; } int [] second = new int[secondstr.length()]; for(int i = 0;i<secondstr.length();i++){ second[secondstr.length()-1-i] = secondstr.charAt(i)-'0'; } add(first,second); } public static void main(String[] args){ new Main(); } public void add(int[] first,int[]second){ int large = first.length > second.length ? first.length:second.length; int[] sum = new int[large]; int litter = first.length < second.length ? first.length:second.length; int temp = 0; for(int i = 0;i<litter;i++){ sum[i] = (first[i]+second[i]+temp)%10; if(first[i]+second[i]+temp>=10){ temp = (first[i]+second[i]+temp)/10; }else{ temp = 0; } } if(first.length==litter){ push(sum,second,litter,temp); }else{ push(sum,first,litter,temp); } } public void push(int[] sum,int[] large,int litter,int temp){ for(int j = 0;j<sum.length-litter;j++){ sum[litter+j] = (large[litter+j]+temp)%10; if((large[litter+j]+temp)>=10){ temp = (large[litter+j]+temp)/10; }else{ temp = 0; } } if(temp!=0){ System.out.print(temp); } for(int j = sum.length-1;j>=0;j--){ System.out.print(sum[j]); } } }
GB18030
Java
2,773
java
Main.java
Java
[]
null
[]
package com.vector.study07; /** * 问题描述   输入两个整数a和b,输出这两个整数的和。a和b都不超过100位。 算法描述   由于a和b都比较大,所以不能直接使用语言中的标准数据类型来存储。对于这种问题,一般使用数组来处理。   定义一个数组A,A[0]用于存储a的个位,A[1]用于存储a的十位,依此类推。同样可以用一个数组B来存储b。   计算c = a + b的时候,首先将A[0]与B[0]相加,如果有进位产生,则把进位(即和的十位数)存入r,把和的个位数存入C[0],即C[0]等于(A[0]+B[0])%10。然后计算A[1]与B[1]相加,这时还应将低位进上来的值r也加起来,即C[1]应该是A[1]、B[1]和r三个数的和.如果又有进位产生,则仍可将新的进位存入到r中,和的个位存到C[1]中。依此类推,即可求出C的所有位。   最后将C输出即可。 输入格式   输入包括两行,第一行为一个非负整数a,第二行为一个非负整数b。两个整数都不超过100位,两数的最高位都不是0。 输出格式   输出一行,表示a + b的值。 样例输入 20100122201001221234567890 2010012220100122 样例输出 20100122203011233454668012 */ import java.util.Scanner; public class Main { public Main(){ Scanner in = new Scanner(System.in); String firststr = in.nextLine(); String secondstr = in.nextLine(); in.close(); int [] first = new int[firststr.length()]; for(int i = 0;i<firststr.length();i++){ first[firststr.length()-1-i] = firststr.charAt(i)-'0'; } int [] second = new int[secondstr.length()]; for(int i = 0;i<secondstr.length();i++){ second[secondstr.length()-1-i] = secondstr.charAt(i)-'0'; } add(first,second); } public static void main(String[] args){ new Main(); } public void add(int[] first,int[]second){ int large = first.length > second.length ? first.length:second.length; int[] sum = new int[large]; int litter = first.length < second.length ? first.length:second.length; int temp = 0; for(int i = 0;i<litter;i++){ sum[i] = (first[i]+second[i]+temp)%10; if(first[i]+second[i]+temp>=10){ temp = (first[i]+second[i]+temp)/10; }else{ temp = 0; } } if(first.length==litter){ push(sum,second,litter,temp); }else{ push(sum,first,litter,temp); } } public void push(int[] sum,int[] large,int litter,int temp){ for(int j = 0;j<sum.length-litter;j++){ sum[litter+j] = (large[litter+j]+temp)%10; if((large[litter+j]+temp)>=10){ temp = (large[litter+j]+temp)/10; }else{ temp = 0; } } if(temp!=0){ System.out.print(temp); } for(int j = sum.length-1;j>=0;j--){ System.out.print(sum[j]); } } }
2,773
0.649013
0.591719
82
24.329268
27.57962
201
false
false
0
0
0
0
0
0
2.256098
false
false
4
c6bfa77e1aa6b711e69d373b9eff014f817944cd
14,980,845,990,592
893bfeeab3638207485ce9b7b0441db7707cc141
/YGCommunity/src/main/java/com/yonggang/ygcommunity/Activity/Server/SignedPersonActivity.java
65298acbde2c9c9ffd4c4249cadf7e33910ba1f3
[]
no_license
Acelyy/YGCommunity
https://github.com/Acelyy/YGCommunity
09de99461f334b9822f56c242d7b184ef5072a04
fd342d7e0d7f22e82f9e6f2ba60da4e177f4d946
refs/heads/master
2020-03-26T15:35:30.522000
2018-11-12T01:59:30
2018-11-12T01:59:30
145,052,509
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yonggang.ygcommunity.Activity.Server; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.yonggang.ygcommunity.BaseActivity; import com.yonggang.ygcommunity.Entry.Signed; import com.yonggang.ygcommunity.Entry.User; import com.yonggang.ygcommunity.R; import com.yonggang.ygcommunity.View.CircleImageView; import com.yonggang.ygcommunity.httpUtil.HttpUtil; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import rx.Subscriber; import static com.yonggang.ygcommunity.R.id.phone; public class SignedPersonActivity extends BaseActivity { @BindView(R.id.list_signed) PullToRefreshListView listSigned; private String id; private List<User> list_more; private int total; private SignedAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signed_person); ButterKnife.bind(this); id = getIntent().getExtras().getString("id"); get_signed(1); // 上拉加载更多,分页加载 listSigned.getLoadingLayoutProxy(false, true).setPullLabel("加载更多"); listSigned.getLoadingLayoutProxy(false, true).setRefreshingLabel("加载中..."); listSigned.getLoadingLayoutProxy(false, true).setReleaseLabel("松开加载"); // 下拉刷新 listSigned.getLoadingLayoutProxy(true, false).setPullLabel("下拉刷新"); listSigned.getLoadingLayoutProxy(true, false).setRefreshingLabel("更新中..."); listSigned.getLoadingLayoutProxy(true, false).setReleaseLabel("松开更新"); listSigned.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { get_signed(1); } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { get_signed(adapter.getCount() / 10 + 1); } }); } @OnClick(R.id.img_finish) public void onViewClicked() { finish(); } private void get_signed(final int page) { Subscriber subscriber = new Subscriber<Signed>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { Log.i("error", e.toString()); Toast.makeText(SignedPersonActivity.this, "网络中断,请检查您的网络状态", Toast.LENGTH_SHORT).show(); listSigned.onRefreshComplete(); } @Override public void onNext(Signed data) { Log.i("get_signed", data.toString()); if (page == 1) { list_more = data.getMore(); adapter = new SignedAdapter(); listSigned.setAdapter(adapter); } else { list_more.addAll(data.getMore()); adapter.notifyDataSetChanged(); } if (adapter.getCount() < total) { listSigned.setMode(PullToRefreshBase.Mode.BOTH); } else { listSigned.setMode(PullToRefreshBase.Mode.PULL_FROM_START); } listSigned.onRefreshComplete(); } }; HttpUtil.getInstance().get_more_verify(subscriber, id, page); } class SignedAdapter extends BaseAdapter { @Override public int getCount() { return list_more.size(); } @Override public Object getItem(int position) { return list_more.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(SignedPersonActivity.this).inflate(R.layout.item_more, null); holder.head = (CircleImageView) convertView.findViewById(R.id.head); holder.name = (TextView) convertView.findViewById(R.id.name); holder.phone = (TextView) convertView.findViewById(phone); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.name.setText(list_more.get(position).getUsername()); String phone = list_more.get(position).getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); holder.phone.setText(phone); Glide.with(getApplicationContext()) .load(list_more.get(position).getFace_url()) .into(holder.head); return convertView; } class ViewHolder { CircleImageView head; TextView name; TextView phone; } } }
UTF-8
Java
5,574
java
SignedPersonActivity.java
Java
[]
null
[]
package com.yonggang.ygcommunity.Activity.Server; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.yonggang.ygcommunity.BaseActivity; import com.yonggang.ygcommunity.Entry.Signed; import com.yonggang.ygcommunity.Entry.User; import com.yonggang.ygcommunity.R; import com.yonggang.ygcommunity.View.CircleImageView; import com.yonggang.ygcommunity.httpUtil.HttpUtil; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import rx.Subscriber; import static com.yonggang.ygcommunity.R.id.phone; public class SignedPersonActivity extends BaseActivity { @BindView(R.id.list_signed) PullToRefreshListView listSigned; private String id; private List<User> list_more; private int total; private SignedAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signed_person); ButterKnife.bind(this); id = getIntent().getExtras().getString("id"); get_signed(1); // 上拉加载更多,分页加载 listSigned.getLoadingLayoutProxy(false, true).setPullLabel("加载更多"); listSigned.getLoadingLayoutProxy(false, true).setRefreshingLabel("加载中..."); listSigned.getLoadingLayoutProxy(false, true).setReleaseLabel("松开加载"); // 下拉刷新 listSigned.getLoadingLayoutProxy(true, false).setPullLabel("下拉刷新"); listSigned.getLoadingLayoutProxy(true, false).setRefreshingLabel("更新中..."); listSigned.getLoadingLayoutProxy(true, false).setReleaseLabel("松开更新"); listSigned.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { get_signed(1); } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { get_signed(adapter.getCount() / 10 + 1); } }); } @OnClick(R.id.img_finish) public void onViewClicked() { finish(); } private void get_signed(final int page) { Subscriber subscriber = new Subscriber<Signed>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { Log.i("error", e.toString()); Toast.makeText(SignedPersonActivity.this, "网络中断,请检查您的网络状态", Toast.LENGTH_SHORT).show(); listSigned.onRefreshComplete(); } @Override public void onNext(Signed data) { Log.i("get_signed", data.toString()); if (page == 1) { list_more = data.getMore(); adapter = new SignedAdapter(); listSigned.setAdapter(adapter); } else { list_more.addAll(data.getMore()); adapter.notifyDataSetChanged(); } if (adapter.getCount() < total) { listSigned.setMode(PullToRefreshBase.Mode.BOTH); } else { listSigned.setMode(PullToRefreshBase.Mode.PULL_FROM_START); } listSigned.onRefreshComplete(); } }; HttpUtil.getInstance().get_more_verify(subscriber, id, page); } class SignedAdapter extends BaseAdapter { @Override public int getCount() { return list_more.size(); } @Override public Object getItem(int position) { return list_more.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(SignedPersonActivity.this).inflate(R.layout.item_more, null); holder.head = (CircleImageView) convertView.findViewById(R.id.head); holder.name = (TextView) convertView.findViewById(R.id.name); holder.phone = (TextView) convertView.findViewById(phone); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.name.setText(list_more.get(position).getUsername()); String phone = list_more.get(position).getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); holder.phone.setText(phone); Glide.with(getApplicationContext()) .load(list_more.get(position).getFace_url()) .into(holder.head); return convertView; } class ViewHolder { CircleImageView head; TextView name; TextView phone; } } }
5,574
0.613487
0.611294
159
33.415092
25.948982
111
false
false
0
0
0
0
0
0
0.591195
false
false
4
a1af716b6ee6124d697c5dada339129934c99dde
20,091,857,074,444
821663dfdf5442f8cfb8989ff6c495f1dbec33a5
/src/leetcode/middle/Sixteen.java
c38a701293287253a6c0347afb2fe004e6d6640d
[]
no_license
mosune/leetcode
https://github.com/mosune/leetcode
f5d40f674ffb291b3bfecf8350b827887f141957
48c37bc7e4b507a86168c4ddabe6165b84d9dfe4
refs/heads/master
2021-07-14T16:09:58.330000
2020-07-17T03:45:54
2020-07-17T03:45:54
187,820,365
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode.middle; import java.util.Arrays; /** * 16. 最接近的三数之和 * * 给定一个包括 n 个整数的数组 nums 和 一个目标值 target。找出 nums 中的三个整数,使得它们的和与 target 最接近。返回这三个数的和。假定每组输入只存在唯一答案。 * *   * * 示例: * * 输入:nums = [-1,2,1,-4], target = 1 * 输出:2 * 解释:与 target 最接近的和是 2 (-1 + 2 + 1 = 2) 。 *   * * 提示: * * 3 <= nums.length <= 10^3 * -10^3 <= nums[i] <= 10^3 * -10^4 <= target <= 10^4 * * @author gcg * @create 2020-06-17 13:31 **/ public class Sixteen { public int threeSumClosest(int[] nums, int target) { Arrays.sort(nums); int num = nums[0] + nums[1] + nums[2], n = Math.abs(num - target); for (int i = 0; i < nums.length - 2; i++) { int left = i + 1, right = nums.length - 1, result; if (nums[i] >= target) { result = nums[i] + nums[i + 1] + nums[i + 2]; if (Math.abs(result - target) < n) return result; } while (left < right) { result = left + right + nums[i]; if (result < target) left++; else if (result == target) return target; else right--; if (Math.abs(result - target) < n) { num = result; n = Math.abs(result - target); } } } return num; } }
UTF-8
Java
1,538
java
Sixteen.java
Java
[ { "context": "] <= 10^3\n * -10^4 <= target <= 10^4\n *\n * @author gcg\n * @create 2020-06-17 13:31\n **/\npublic class Six", "end": 399, "score": 0.9996532201766968, "start": 396, "tag": "USERNAME", "value": "gcg" } ]
null
[]
package leetcode.middle; import java.util.Arrays; /** * 16. 最接近的三数之和 * * 给定一个包括 n 个整数的数组 nums 和 一个目标值 target。找出 nums 中的三个整数,使得它们的和与 target 最接近。返回这三个数的和。假定每组输入只存在唯一答案。 * *   * * 示例: * * 输入:nums = [-1,2,1,-4], target = 1 * 输出:2 * 解释:与 target 最接近的和是 2 (-1 + 2 + 1 = 2) 。 *   * * 提示: * * 3 <= nums.length <= 10^3 * -10^3 <= nums[i] <= 10^3 * -10^4 <= target <= 10^4 * * @author gcg * @create 2020-06-17 13:31 **/ public class Sixteen { public int threeSumClosest(int[] nums, int target) { Arrays.sort(nums); int num = nums[0] + nums[1] + nums[2], n = Math.abs(num - target); for (int i = 0; i < nums.length - 2; i++) { int left = i + 1, right = nums.length - 1, result; if (nums[i] >= target) { result = nums[i] + nums[i + 1] + nums[i + 2]; if (Math.abs(result - target) < n) return result; } while (left < right) { result = left + right + nums[i]; if (result < target) left++; else if (result == target) return target; else right--; if (Math.abs(result - target) < n) { num = result; n = Math.abs(result - target); } } } return num; } }
1,538
0.463378
0.426009
55
23.327272
23.089592
96
false
false
0
0
0
0
0
0
0.436364
false
false
4
3d96796c931c966fda762fdacbd32c02c0e0e107
35,459,250,018,407
c20c3cb1699f726fc285a6917d0ee673915f5b06
/meep/MeepYoutube/src/com/oregonscientific/meep/youtube/ui/fragment/RightMenuFragment.java
8d3c88d192b128140a29fd09d9b9419cf36526e3
[ "Apache-2.0" ]
permissive
zoozooll/MyExercise
https://github.com/zoozooll/MyExercise
35a18c0ead552d5be45f627066a5066f6cc8c99b
1be14e0252babb28e32951fa1e35fc867a6ac070
refs/heads/master
2023-04-04T04:24:14.275000
2021-04-18T15:01:03
2021-04-18T15:01:03
108,665,215
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.oregonscientific.meep.youtube.ui.fragment; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.LinearLayout; import android.widget.ListView; import com.oregonscientific.meep.youtube.YouTubeUtility; import com.oregonscientific.meep.youtube.Consts; import com.oregonscientific.meep.youtube.ui.adapter.YoutubeObject; import com.oregonscientific.meep.youtube.ui.adapter.ViewHolder; import com.oregonscientific.meep.customfont.MyTextView; import com.oregonscientific.meep.youtube.R; import com.oregonscientific.meep.youtube.YouTubeUtility; import com.oregonscientific.meep.youtube.ui.adapter.BookmarkAdapter; import com.oregonscientific.meep.youtube.ui.adapter.ListAdapterWebsite; import com.oregonscientific.meep.youtube.ui.adapter.RecommendationAdapter; import com.oregonscientific.meep.youtube.ui.adapter.YoutubeObject; import com.oregonscientific.meep.ServiceManager; import com.oregonscientific.meep.account.Account; import com.oregonscientific.meep.account.AccountManager; import com.oregonscientific.meep.customdialog.CommonPopup; import com.oregonscientific.meep.customdialog.CommonPopup.OnClickOkButtonListener; import com.oregonscientific.meep.customfont.MyTextView; import com.oregonscientific.meep.permission.Component; import com.oregonscientific.meep.permission.Permission; import com.oregonscientific.meep.permission.PermissionManager; import com.oregonscientific.meep.recommendation.IRecommendationServiceCallback; import com.oregonscientific.meep.recommendation.Recommendation; import com.oregonscientific.meep.recommendation.RecommendationManager; public class RightMenuFragment extends Fragment { public static final String TAG = "RightMenuFragment"; private static final int MODE_OS = 0; private static final int MODE_PARENTS = 1; private static final int MODE_BOOKMARK = 2; private int mode; MyTextView menuTitle; MyTextView menuTitleShadow; View menuBackground; ListView listview; ArrayList<YoutubeObject> osList; ArrayList<YoutubeObject> parentsList; ArrayList<String> bookmarkList; RecommendationAdapter osAdapter; RecommendationAdapter parentAdapter; BookmarkAdapter bookmarkAdapter; MainViewCallback mainViewCallback; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreate"); View view = inflater.inflate(R.layout.right_menu, container, false); menuTitle = (MyTextView) view.findViewById(R.id.menu_title); menuTitleShadow = (MyTextView) view.findViewById(R.id.menu_title_shadow); menuBackground = view.findViewById(R.id.menu_background); listview = (ListView) view.findViewById(R.id.listview); //2013-4-22 -Amy- when click listview ,remove black background listview.setCacheColorHint(Color.TRANSPARENT); osList = new ArrayList<YoutubeObject>(); parentsList = new ArrayList<YoutubeObject>(); bookmarkList = new ArrayList<String>(); osAdapter = new RecommendationAdapter(getActivity(), R.layout.item_recommend, osList); parentAdapter = new RecommendationAdapter(getActivity(), R.layout.item_recommend, parentsList); view.findViewById(R.id.tab_os).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { displayOsRecommendations(); } }); view.findViewById(R.id.tab_parents).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { displayParentsRecommendations(); } }); //2013-5-10 -Amy- remove bookmark button /*view.findViewById(R.id.tab_bookmark).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { displayBookmark(); } });*/ initListview(); return view; } public void initListview() { listview.setAdapter(osAdapter); mainViewCallback = (MainViewCallback) getActivity(); listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { mainViewCallback.actionSelectedItem(((ViewHolder) arg1.getTag()).youtubeObject.getUrl()); marqueeView(arg1); } }); } public void displayOsRecommendations() { Log.d(TAG, "tab:os-blue"); mode = MODE_OS; menuTitle.setText(R.string.menu_os_recommendations); menuTitleShadow.setText(R.string.menu_os_recommendations); menuTitleShadow.setStroke(5, getResources().getColor(R.color.shadowblue)); menuBackground.setBackgroundResource(R.drawable.b_left_bg_os); // TODO:update list listview.setAdapter(osAdapter); osAdapter.notifyDataSetChanged(); listview.setOnItemLongClickListener(null); } public void displayParentsRecommendations() { Log.d(TAG, "tab:parents-yellow"); mode = MODE_PARENTS; menuTitle.setText(R.string.menu_parents_recommendations); menuTitleShadow.setText(R.string.menu_parents_recommendations); menuTitleShadow.setStroke(5, getResources().getColor(R.color.shadowyellow)); menuBackground.setBackgroundResource(R.drawable.b_left_bg_parents); // TODO:update list listview.setAdapter(parentAdapter); parentAdapter.notifyDataSetChanged(); listview.setOnItemLongClickListener(null); } public void displayBookmark() { Log.d(TAG, "tab:bookmark-red"); menuTitle.setText(R.string.menu_bookmark); menuTitleShadow.setText(R.string.menu_bookmark); menuTitleShadow.setStroke(5, getResources().getColor(R.color.shadowred)); menuBackground.setBackgroundResource(R.drawable.b_left_bg_bookmark); //TODO:update list listview.setAdapter(bookmarkAdapter); bookmarkAdapter.notifyDataSetChanged(); } public void initRecommendationList() { getCurrentAllRecommendations(); setListenerRecommendationsFromServer(); } public void refresh() { osAdapter.notifyDataSetChanged(); parentAdapter.notifyDataSetChanged(); } public void marqueeView(View view) { view.setSelected(true); view.requestFocus(); } public void setListenerRecommendationsFromServer() { Log.e("XXXXX","setListenerRecommendationsFromServer"); RecommendationManager recommendationManager = (RecommendationManager) ServiceManager.getService(getActivity().getApplicationContext(), ServiceManager.RECOMMENDATION_SERVICE); registerCallbackForRecommendation(RecommendationManager.TYPE_YOUTUBE_FROM_ADMIN, Consts.TYPE_OS_RECOMMENDATION, recommendationManager); registerCallbackForRecommendation(RecommendationManager.TYPE_YOUTUBE_FROM_PARENT, Consts.TYPE_PARENTS_RECOMMENDATION, recommendationManager); } private void registerCallbackForRecommendation(String serviceType, final int localType, RecommendationManager recommendationManager) { recommendationManager.registerCallback(serviceType, new IRecommendationServiceCallback() { @Override public IBinder asBinder() { // TODO Auto-generated method stub return null; } @Override public void onReceiveRecommendation(List<Recommendation> arg0) throws RemoteException { List<Recommendation> list = arg0; updateRecommendationList(list, localType); } }); } public void getCurrentAllRecommendations() { Log.e("XXXXX","getCurrentAllRecommendations"); ExecutorService service = Executors.newSingleThreadExecutor(); service.execute(new Runnable() { @Override public void run() { RecommendationManager recommendationManager = (RecommendationManager) ServiceManager.getService(getActivity().getApplicationContext(), ServiceManager.RECOMMENDATION_SERVICE); String userID = YouTubeUtility.getAccountID(getActivity()); if (userID == null || userID.equals("")) { YouTubeUtility.printLogcatDebugMessage("Meeptag is Empty"); } else { YouTubeUtility.printLogcatDebugMessage("Meeptag is " + userID); //2013-06-14 - raymond - enhance recommendation loading speed try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } List<Recommendation> list = recommendationManager.getAllRecommendations(userID); updateRecommendationList(list); } } }); } Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); refresh(); } }; /** * Update mixed type list * * @param list */ public void updateRecommendationList(List<Recommendation> list) { if (list != null) { osList.clear(); parentsList.clear(); for (Recommendation r : list) { YoutubeObject object = YoutubeObject.generateFromRecommendation(r); String type = r.getType(); if (type.equals(RecommendationManager.TYPE_YOUTUBE_FROM_ADMIN)) { YouTubeUtility.printLogcatDebugMessage("Recommendation List(os) item : "+object.getUrl()); osList.add(object); } else if (type.equals(RecommendationManager.TYPE_YOUTUBE_FROM_PARENT)) { YouTubeUtility.printLogcatDebugMessage("Recommendation List(parent) item : "+object.getUrl()); parentsList.add(object); } } handler.sendEmptyMessage(0); } else { YouTubeUtility.printLogcatDebugMessage("Recommendation List(0&1) is NULL"); } } /** * Update Specific type list * * @param list * @param type */ public void updateRecommendationList(List<Recommendation> list, int type) { if (list != null) { if (type == Consts.TYPE_OS_RECOMMENDATION) { osList.clear(); for (Recommendation r : list) { YoutubeObject object = YoutubeObject.generateFromRecommendation(r); osList.add(object); } osAdapter.notifyDataSetChanged(); } else if (type == Consts.TYPE_PARENTS_RECOMMENDATION) { parentsList.clear(); for (Recommendation r : list) { YoutubeObject object = YoutubeObject.generateFromRecommendation(r); parentsList.add(object); } parentAdapter.notifyDataSetChanged(); } } else { YouTubeUtility.printLogcatDebugMessage("Recommendation List(" + type + ") is NULL"); } } public void testdata() { /* osList.add("http://www.google.com"); osList.add("http://www.dogonews.com"); osList.add("http://pbskids.org"); osList.add("http://eo.ucar.edu/webweather"); parentsList.add("http://oregonscientific.com/products_learningAndFun.asp"); parentsList.add("http://http://kickinkitchen.tv"); parentsList.add("http://www.timeforkids.com/news"); parentsList.add("http://cartoonnetwork.com"); bookmarkList.add("http://nick.com"); bookmarkList.add("http://www.factmonster.com"); bookmarkList.add("http://www.sciencemadesimple.com"); */ } public interface MainViewCallback { public void actionSelectedItem(String videoId); } }
UTF-8
Java
11,090
java
RightMenuFragment.java
Java
[ { "context": "ssage(\"Meeptag is \" + userID);\n\t\t\t\t\t//2013-06-14 - raymond - enhance recommendation loading speed\n\t\t\t\t\ttry {", "end": 8250, "score": 0.9633829593658447, "start": 8243, "tag": "NAME", "value": "raymond" } ]
null
[]
package com.oregonscientific.meep.youtube.ui.fragment; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.LinearLayout; import android.widget.ListView; import com.oregonscientific.meep.youtube.YouTubeUtility; import com.oregonscientific.meep.youtube.Consts; import com.oregonscientific.meep.youtube.ui.adapter.YoutubeObject; import com.oregonscientific.meep.youtube.ui.adapter.ViewHolder; import com.oregonscientific.meep.customfont.MyTextView; import com.oregonscientific.meep.youtube.R; import com.oregonscientific.meep.youtube.YouTubeUtility; import com.oregonscientific.meep.youtube.ui.adapter.BookmarkAdapter; import com.oregonscientific.meep.youtube.ui.adapter.ListAdapterWebsite; import com.oregonscientific.meep.youtube.ui.adapter.RecommendationAdapter; import com.oregonscientific.meep.youtube.ui.adapter.YoutubeObject; import com.oregonscientific.meep.ServiceManager; import com.oregonscientific.meep.account.Account; import com.oregonscientific.meep.account.AccountManager; import com.oregonscientific.meep.customdialog.CommonPopup; import com.oregonscientific.meep.customdialog.CommonPopup.OnClickOkButtonListener; import com.oregonscientific.meep.customfont.MyTextView; import com.oregonscientific.meep.permission.Component; import com.oregonscientific.meep.permission.Permission; import com.oregonscientific.meep.permission.PermissionManager; import com.oregonscientific.meep.recommendation.IRecommendationServiceCallback; import com.oregonscientific.meep.recommendation.Recommendation; import com.oregonscientific.meep.recommendation.RecommendationManager; public class RightMenuFragment extends Fragment { public static final String TAG = "RightMenuFragment"; private static final int MODE_OS = 0; private static final int MODE_PARENTS = 1; private static final int MODE_BOOKMARK = 2; private int mode; MyTextView menuTitle; MyTextView menuTitleShadow; View menuBackground; ListView listview; ArrayList<YoutubeObject> osList; ArrayList<YoutubeObject> parentsList; ArrayList<String> bookmarkList; RecommendationAdapter osAdapter; RecommendationAdapter parentAdapter; BookmarkAdapter bookmarkAdapter; MainViewCallback mainViewCallback; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreate"); View view = inflater.inflate(R.layout.right_menu, container, false); menuTitle = (MyTextView) view.findViewById(R.id.menu_title); menuTitleShadow = (MyTextView) view.findViewById(R.id.menu_title_shadow); menuBackground = view.findViewById(R.id.menu_background); listview = (ListView) view.findViewById(R.id.listview); //2013-4-22 -Amy- when click listview ,remove black background listview.setCacheColorHint(Color.TRANSPARENT); osList = new ArrayList<YoutubeObject>(); parentsList = new ArrayList<YoutubeObject>(); bookmarkList = new ArrayList<String>(); osAdapter = new RecommendationAdapter(getActivity(), R.layout.item_recommend, osList); parentAdapter = new RecommendationAdapter(getActivity(), R.layout.item_recommend, parentsList); view.findViewById(R.id.tab_os).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { displayOsRecommendations(); } }); view.findViewById(R.id.tab_parents).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { displayParentsRecommendations(); } }); //2013-5-10 -Amy- remove bookmark button /*view.findViewById(R.id.tab_bookmark).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { displayBookmark(); } });*/ initListview(); return view; } public void initListview() { listview.setAdapter(osAdapter); mainViewCallback = (MainViewCallback) getActivity(); listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { mainViewCallback.actionSelectedItem(((ViewHolder) arg1.getTag()).youtubeObject.getUrl()); marqueeView(arg1); } }); } public void displayOsRecommendations() { Log.d(TAG, "tab:os-blue"); mode = MODE_OS; menuTitle.setText(R.string.menu_os_recommendations); menuTitleShadow.setText(R.string.menu_os_recommendations); menuTitleShadow.setStroke(5, getResources().getColor(R.color.shadowblue)); menuBackground.setBackgroundResource(R.drawable.b_left_bg_os); // TODO:update list listview.setAdapter(osAdapter); osAdapter.notifyDataSetChanged(); listview.setOnItemLongClickListener(null); } public void displayParentsRecommendations() { Log.d(TAG, "tab:parents-yellow"); mode = MODE_PARENTS; menuTitle.setText(R.string.menu_parents_recommendations); menuTitleShadow.setText(R.string.menu_parents_recommendations); menuTitleShadow.setStroke(5, getResources().getColor(R.color.shadowyellow)); menuBackground.setBackgroundResource(R.drawable.b_left_bg_parents); // TODO:update list listview.setAdapter(parentAdapter); parentAdapter.notifyDataSetChanged(); listview.setOnItemLongClickListener(null); } public void displayBookmark() { Log.d(TAG, "tab:bookmark-red"); menuTitle.setText(R.string.menu_bookmark); menuTitleShadow.setText(R.string.menu_bookmark); menuTitleShadow.setStroke(5, getResources().getColor(R.color.shadowred)); menuBackground.setBackgroundResource(R.drawable.b_left_bg_bookmark); //TODO:update list listview.setAdapter(bookmarkAdapter); bookmarkAdapter.notifyDataSetChanged(); } public void initRecommendationList() { getCurrentAllRecommendations(); setListenerRecommendationsFromServer(); } public void refresh() { osAdapter.notifyDataSetChanged(); parentAdapter.notifyDataSetChanged(); } public void marqueeView(View view) { view.setSelected(true); view.requestFocus(); } public void setListenerRecommendationsFromServer() { Log.e("XXXXX","setListenerRecommendationsFromServer"); RecommendationManager recommendationManager = (RecommendationManager) ServiceManager.getService(getActivity().getApplicationContext(), ServiceManager.RECOMMENDATION_SERVICE); registerCallbackForRecommendation(RecommendationManager.TYPE_YOUTUBE_FROM_ADMIN, Consts.TYPE_OS_RECOMMENDATION, recommendationManager); registerCallbackForRecommendation(RecommendationManager.TYPE_YOUTUBE_FROM_PARENT, Consts.TYPE_PARENTS_RECOMMENDATION, recommendationManager); } private void registerCallbackForRecommendation(String serviceType, final int localType, RecommendationManager recommendationManager) { recommendationManager.registerCallback(serviceType, new IRecommendationServiceCallback() { @Override public IBinder asBinder() { // TODO Auto-generated method stub return null; } @Override public void onReceiveRecommendation(List<Recommendation> arg0) throws RemoteException { List<Recommendation> list = arg0; updateRecommendationList(list, localType); } }); } public void getCurrentAllRecommendations() { Log.e("XXXXX","getCurrentAllRecommendations"); ExecutorService service = Executors.newSingleThreadExecutor(); service.execute(new Runnable() { @Override public void run() { RecommendationManager recommendationManager = (RecommendationManager) ServiceManager.getService(getActivity().getApplicationContext(), ServiceManager.RECOMMENDATION_SERVICE); String userID = YouTubeUtility.getAccountID(getActivity()); if (userID == null || userID.equals("")) { YouTubeUtility.printLogcatDebugMessage("Meeptag is Empty"); } else { YouTubeUtility.printLogcatDebugMessage("Meeptag is " + userID); //2013-06-14 - raymond - enhance recommendation loading speed try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } List<Recommendation> list = recommendationManager.getAllRecommendations(userID); updateRecommendationList(list); } } }); } Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); refresh(); } }; /** * Update mixed type list * * @param list */ public void updateRecommendationList(List<Recommendation> list) { if (list != null) { osList.clear(); parentsList.clear(); for (Recommendation r : list) { YoutubeObject object = YoutubeObject.generateFromRecommendation(r); String type = r.getType(); if (type.equals(RecommendationManager.TYPE_YOUTUBE_FROM_ADMIN)) { YouTubeUtility.printLogcatDebugMessage("Recommendation List(os) item : "+object.getUrl()); osList.add(object); } else if (type.equals(RecommendationManager.TYPE_YOUTUBE_FROM_PARENT)) { YouTubeUtility.printLogcatDebugMessage("Recommendation List(parent) item : "+object.getUrl()); parentsList.add(object); } } handler.sendEmptyMessage(0); } else { YouTubeUtility.printLogcatDebugMessage("Recommendation List(0&1) is NULL"); } } /** * Update Specific type list * * @param list * @param type */ public void updateRecommendationList(List<Recommendation> list, int type) { if (list != null) { if (type == Consts.TYPE_OS_RECOMMENDATION) { osList.clear(); for (Recommendation r : list) { YoutubeObject object = YoutubeObject.generateFromRecommendation(r); osList.add(object); } osAdapter.notifyDataSetChanged(); } else if (type == Consts.TYPE_PARENTS_RECOMMENDATION) { parentsList.clear(); for (Recommendation r : list) { YoutubeObject object = YoutubeObject.generateFromRecommendation(r); parentsList.add(object); } parentAdapter.notifyDataSetChanged(); } } else { YouTubeUtility.printLogcatDebugMessage("Recommendation List(" + type + ") is NULL"); } } public void testdata() { /* osList.add("http://www.google.com"); osList.add("http://www.dogonews.com"); osList.add("http://pbskids.org"); osList.add("http://eo.ucar.edu/webweather"); parentsList.add("http://oregonscientific.com/products_learningAndFun.asp"); parentsList.add("http://http://kickinkitchen.tv"); parentsList.add("http://www.timeforkids.com/news"); parentsList.add("http://cartoonnetwork.com"); bookmarkList.add("http://nick.com"); bookmarkList.add("http://www.factmonster.com"); bookmarkList.add("http://www.sciencemadesimple.com"); */ } public interface MainViewCallback { public void actionSelectedItem(String videoId); } }
11,090
0.762308
0.758341
332
32.403614
28.928761
178
false
false
0
0
0
0
0
0
2.406626
false
false
4
37064027c61c95379540a42024018aa5b16bef4d
35,459,250,018,292
df29271587e037f00544e3db6e9430971980877f
/src/AutomatoUI/Automato.java
13c1dbe31938c922b10a710a8ec2a8f7e964be8f
[]
no_license
GustGimenez/Maquina_Turing
https://github.com/GustGimenez/Maquina_Turing
eb50439486de8aba7055468467ad331a4a550389
fd4c4db4cdfb3f851e37b059d5b364c05d307425
refs/heads/master
2020-03-09T20:15:28.785000
2018-06-28T19:34:36
2018-06-28T19:34:36
128,822,225
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package AutomatoUI; import AutomatoUI.Color.RainbowScale; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.util.ArrayList; /** * * @author fabio */ public class Automato { private ArrayList<Vertice> vertices; private ArrayList<Aresta> arestas; private Vertice Inicial; // Mantém o inicial para ser mais facilmente manipulado private int numFitas; public Automato() { this.vertices = new ArrayList(); this.arestas = new ArrayList(); } public ArrayList<Vertice> getVertices() { return vertices; } public ArrayList<Aresta> getArestas() { return arestas; } public void setNumFitas(int numFitas) { this.numFitas = numFitas; } public int getNumFitas() { return this.numFitas; } //Retona a posição do inicial public int getIni() { return this.Inicial.getPos(); } // Seta um novo vertice inicial public void setInicial(Vertice Inicial) { this.Inicial = Inicial; } // Retona o objeto vertice inicial public Vertice getInicial() { return Inicial; } public void addVertice(Vertice v) { this.vertices.add(v); int num = vertices.size(); v.setEstado(v.getEstado() + (num - 1)); int passo = 255 / num; int i = 0; RainbowScale cs = new RainbowScale(); for (Vertice v1 : vertices) { v1.setColor(cs.getColor(i * passo)); i++; } } // retona a string de uma transição que foi clicada public String getStrTrans(Point p) { String str; for (Aresta a : this.arestas) { str = a.editaTransicao(p); if (str != null) { return str; } } return null; } //retorna uma aresta que foi clicada public Aresta getArestas(Point p) { String str; for (Aresta a : this.arestas) { str = a.editaTransicao(p); if (str != null) { return a; } } return null; } // Retorna uma dimensão baseado nos vertices mais distantes em relação a origem public java.awt.Dimension getSize() { if (this.vertices.size() > 0) { float maxX = vertices.get(0).getX(); float minX = vertices.get(0).getX(); float maxY = vertices.get(0).getY(); float minY = vertices.get(0).getY(); //Encontra o maior e menor valores para X e Y for (Vertice v : this.vertices) { if (maxX < v.getX()) { maxX = v.getX(); } else if (minX > v.getX()) { minX = v.getX(); } if (maxY < v.getY()) { maxY = v.getY(); } else if (minY > v.getY()) { minY = v.getY(); } } int w = (int) (maxX + (this.vertices.get(0).getRaio() * 5)) + 350; int h = (int) (maxY + (this.vertices.get(0).getRaio() * 5)); return new java.awt.Dimension(w, h); } else { return new java.awt.Dimension(500, 500); } } public Dimension getDimensao() { int x = 0, y = 0; for (Vertice v : vertices) { if (v.getX() > x) { x = v.getX(); } if (v.getY() > y) { y = v.getY(); } } return new Dimension(x + 50, y + 50); } // Normaliza os estados apos uma alteração (remoção de um estado) private void setEstados() { int i = 0; for (Vertice v : vertices) { v.setEstado("q" + i++); v.setPos(i); } } // Normaliza as posições do vertice de acordo com ArrayList public void setPos() { int i = 0; for (Vertice v : vertices) { v.setPos(i++); } } /* *@arg estado posição do estado que está sendo selecionado Seta estado como selecionado e retorna para que possa ser manipulado */ public Vertice setSelected(int estado) { Vertice v = this.vertices.get(estado); v.setFocus(true); return v; } // Percorre as transições para recuperar o alfabeto public ArrayList<Character> getAlfabeto() { ArrayList<Character> alfa = new ArrayList(); for (Aresta a : arestas) { for (String s : a.getTrans()) { String[] arrayStr = s.split(";"); if (!alfa.contains(arrayStr[0].charAt(0))) { alfa.add(arrayStr[0].charAt(0)); } if (!alfa.contains(arrayStr[1].charAt(0))) { alfa.add(arrayStr[1].charAt(0)); } } } return alfa; } public void draw(Graphics2D g) { for (Vertice v : vertices) { v.desenha(g); } for (Aresta a : arestas) { a.draw(g); } } public Vertice busca(int x, int y) { int x1, y1, r; r = 20; for (Vertice v : vertices) { x1 = Math.abs(v.getX() - x); y1 = Math.abs(v.getY() - y); if (x1 < r && y1 < r) { return v; } } return null; } public Aresta addAresta(Vertice v1, Vertice v2) { for (Aresta a : arestas) { Vertice vo = a.getOrigem(); Vertice vd = a.getDestino(); if (v1.equals(vo) && v2.equals(vd)) { return a; } } for (Aresta a : arestas) { Vertice vo = a.getOrigem(); Vertice vd = a.getDestino(); if (v2.equals(vo) && v1.equals(vd)) { a.setTipo(2); Aresta a1 = new Aresta(v1, v2, 3); this.arestas.add(a1); return a1; } } Aresta a; if (v1.equals(v2)) { a = new Aresta(v1, v2, 4); } else { a = new Aresta(v1, v2, 1); } this.arestas.add(a); return a; } public void removeTransicao(Point p) { for (Aresta a : this.arestas) { if (a.excluiTransicao(p)) { if (a.getTrans().size() == 0) { if (a.getTipo() == 2 || a.getTipo() == 3) { for (Aresta a1 : arestas) { if (a1.getOrigem().equals(a.getDestino()) && a1.getDestino().equals(a.getOrigem())) { a1.setTipo(1); } } } this.arestas.remove(a); } return; } } } public void verificaLabel(Point p) { int yC, yB, xD, xE; int largura; for (Vertice v : this.vertices) { if (v.getLabel() != null) { largura = v.getLabel().length() * 5 + 15; yC = v.getY() + v.getRaio(); xD = v.getX() + v.getRaio() + largura / 2; yB = v.getY() + v.getRaio() + 15; xE = v.getX() - v.getRaio() - largura / 2; if (p.getX() >= xE && p.getX() <= xD) { if (p.getY() >= yC && p.getY() <= yB) { v.setLabel(null); } } }//Verifica se tem label } } public void removeVertice(Vertice vertice) { int num = this.arestas.size(); Aresta a; for (int i = 0; i < num; i++) { a = this.arestas.get(i); if (a.getOrigem().equals(vertice) || a.getDestino().equals(vertice)) { this.arestas.remove(a); i--; num--; } } this.vertices.remove(vertice); setEstados(); } /* Pega as transições de v1 para os outros vertices e copia para v2 ou seja, para cada transição de v1 para vx, cria uma transição v2 para vx */ private void copiaTrans(Vertice v1, Vertice vc) { for (int i = 0; i < this.arestas.size(); i++) { Aresta a = this.arestas.get(i); if (a.getOrigem().equals(v1)) { Aresta a2 = this.addAresta(vc, a.getDestino()); for (String s : a.getTrans()) { a2.addTransicao(s, null); } } } } // nome auto explicativo private void resetVisita() { for (Vertice v : this.vertices) { v.setVisitado(false); } } //verifica se existe uma transição vazia saindo de v private boolean tranVazia(Vertice v) { for (Aresta a : this.arestas) { if (a.getOrigem().equals(v)) { ArrayList<String> trans = a.getTrans(); for (String s : trans) { if (s.charAt(0) == '\u25A1') { return true; } } } } return false; } // dada uma aresta, verificar qual posição da aresta corresponde a transição vazia // retorna -1 em caso não exista tal transição private int tranVazia(Aresta a, int i) { for (; i < a.getTrans().size(); i++) { String c = a.getTrans().get(i); if (c.charAt(0) == '\u25A1') { return i; } i++; } return -1; } //remove transição vazia de um vertice private void removeVazio(Vertice v) { if (v.isVisitado()) { return; } v.setVisitado(true); if (!this.tranVazia(v)) { return; } int k = 0; for (int i = 0; i < this.arestas.size(); i++) { Aresta a = this.arestas.get(i); if (a.getOrigem().equals(v)) { k = this.tranVazia(this.arestas.get(i), k); if (k != -1) { removeVazio(a.getDestino()); this.copiaTrans(a.getDestino(), v); a.getTrans().remove(k); if (a.getTrans().isEmpty()) { this.arestas.remove(a); i--; } v.setFim(a.getDestino().isFim()); } k = 0; } } } // Remove transições vazias (Função de automatos) de todos os vertices public void removeVazio() { this.resetVisita(); for (Vertice v : this.vertices) { this.removeVazio(v); } } // Cria label de descrição para um vertice public void criarLabel(String label, Vertice vertice) { for (int i = 0; i < this.vertices.size(); i++) { if (this.vertices.get(i).equals(vertice)) { this.vertices.get(i).setLabel(label); } } } }
UTF-8
Java
11,262
java
Automato.java
Java
[ { "context": "nt;\nimport java.util.ArrayList;\n\n/**\n *\n * @author fabio\n */\npublic class Automato {\n\n private ArrayLis", "end": 374, "score": 0.8879548907279968, "start": 369, "tag": "USERNAME", "value": "fabio" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package AutomatoUI; import AutomatoUI.Color.RainbowScale; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.util.ArrayList; /** * * @author fabio */ public class Automato { private ArrayList<Vertice> vertices; private ArrayList<Aresta> arestas; private Vertice Inicial; // Mantém o inicial para ser mais facilmente manipulado private int numFitas; public Automato() { this.vertices = new ArrayList(); this.arestas = new ArrayList(); } public ArrayList<Vertice> getVertices() { return vertices; } public ArrayList<Aresta> getArestas() { return arestas; } public void setNumFitas(int numFitas) { this.numFitas = numFitas; } public int getNumFitas() { return this.numFitas; } //Retona a posição do inicial public int getIni() { return this.Inicial.getPos(); } // Seta um novo vertice inicial public void setInicial(Vertice Inicial) { this.Inicial = Inicial; } // Retona o objeto vertice inicial public Vertice getInicial() { return Inicial; } public void addVertice(Vertice v) { this.vertices.add(v); int num = vertices.size(); v.setEstado(v.getEstado() + (num - 1)); int passo = 255 / num; int i = 0; RainbowScale cs = new RainbowScale(); for (Vertice v1 : vertices) { v1.setColor(cs.getColor(i * passo)); i++; } } // retona a string de uma transição que foi clicada public String getStrTrans(Point p) { String str; for (Aresta a : this.arestas) { str = a.editaTransicao(p); if (str != null) { return str; } } return null; } //retorna uma aresta que foi clicada public Aresta getArestas(Point p) { String str; for (Aresta a : this.arestas) { str = a.editaTransicao(p); if (str != null) { return a; } } return null; } // Retorna uma dimensão baseado nos vertices mais distantes em relação a origem public java.awt.Dimension getSize() { if (this.vertices.size() > 0) { float maxX = vertices.get(0).getX(); float minX = vertices.get(0).getX(); float maxY = vertices.get(0).getY(); float minY = vertices.get(0).getY(); //Encontra o maior e menor valores para X e Y for (Vertice v : this.vertices) { if (maxX < v.getX()) { maxX = v.getX(); } else if (minX > v.getX()) { minX = v.getX(); } if (maxY < v.getY()) { maxY = v.getY(); } else if (minY > v.getY()) { minY = v.getY(); } } int w = (int) (maxX + (this.vertices.get(0).getRaio() * 5)) + 350; int h = (int) (maxY + (this.vertices.get(0).getRaio() * 5)); return new java.awt.Dimension(w, h); } else { return new java.awt.Dimension(500, 500); } } public Dimension getDimensao() { int x = 0, y = 0; for (Vertice v : vertices) { if (v.getX() > x) { x = v.getX(); } if (v.getY() > y) { y = v.getY(); } } return new Dimension(x + 50, y + 50); } // Normaliza os estados apos uma alteração (remoção de um estado) private void setEstados() { int i = 0; for (Vertice v : vertices) { v.setEstado("q" + i++); v.setPos(i); } } // Normaliza as posições do vertice de acordo com ArrayList public void setPos() { int i = 0; for (Vertice v : vertices) { v.setPos(i++); } } /* *@arg estado posição do estado que está sendo selecionado Seta estado como selecionado e retorna para que possa ser manipulado */ public Vertice setSelected(int estado) { Vertice v = this.vertices.get(estado); v.setFocus(true); return v; } // Percorre as transições para recuperar o alfabeto public ArrayList<Character> getAlfabeto() { ArrayList<Character> alfa = new ArrayList(); for (Aresta a : arestas) { for (String s : a.getTrans()) { String[] arrayStr = s.split(";"); if (!alfa.contains(arrayStr[0].charAt(0))) { alfa.add(arrayStr[0].charAt(0)); } if (!alfa.contains(arrayStr[1].charAt(0))) { alfa.add(arrayStr[1].charAt(0)); } } } return alfa; } public void draw(Graphics2D g) { for (Vertice v : vertices) { v.desenha(g); } for (Aresta a : arestas) { a.draw(g); } } public Vertice busca(int x, int y) { int x1, y1, r; r = 20; for (Vertice v : vertices) { x1 = Math.abs(v.getX() - x); y1 = Math.abs(v.getY() - y); if (x1 < r && y1 < r) { return v; } } return null; } public Aresta addAresta(Vertice v1, Vertice v2) { for (Aresta a : arestas) { Vertice vo = a.getOrigem(); Vertice vd = a.getDestino(); if (v1.equals(vo) && v2.equals(vd)) { return a; } } for (Aresta a : arestas) { Vertice vo = a.getOrigem(); Vertice vd = a.getDestino(); if (v2.equals(vo) && v1.equals(vd)) { a.setTipo(2); Aresta a1 = new Aresta(v1, v2, 3); this.arestas.add(a1); return a1; } } Aresta a; if (v1.equals(v2)) { a = new Aresta(v1, v2, 4); } else { a = new Aresta(v1, v2, 1); } this.arestas.add(a); return a; } public void removeTransicao(Point p) { for (Aresta a : this.arestas) { if (a.excluiTransicao(p)) { if (a.getTrans().size() == 0) { if (a.getTipo() == 2 || a.getTipo() == 3) { for (Aresta a1 : arestas) { if (a1.getOrigem().equals(a.getDestino()) && a1.getDestino().equals(a.getOrigem())) { a1.setTipo(1); } } } this.arestas.remove(a); } return; } } } public void verificaLabel(Point p) { int yC, yB, xD, xE; int largura; for (Vertice v : this.vertices) { if (v.getLabel() != null) { largura = v.getLabel().length() * 5 + 15; yC = v.getY() + v.getRaio(); xD = v.getX() + v.getRaio() + largura / 2; yB = v.getY() + v.getRaio() + 15; xE = v.getX() - v.getRaio() - largura / 2; if (p.getX() >= xE && p.getX() <= xD) { if (p.getY() >= yC && p.getY() <= yB) { v.setLabel(null); } } }//Verifica se tem label } } public void removeVertice(Vertice vertice) { int num = this.arestas.size(); Aresta a; for (int i = 0; i < num; i++) { a = this.arestas.get(i); if (a.getOrigem().equals(vertice) || a.getDestino().equals(vertice)) { this.arestas.remove(a); i--; num--; } } this.vertices.remove(vertice); setEstados(); } /* Pega as transições de v1 para os outros vertices e copia para v2 ou seja, para cada transição de v1 para vx, cria uma transição v2 para vx */ private void copiaTrans(Vertice v1, Vertice vc) { for (int i = 0; i < this.arestas.size(); i++) { Aresta a = this.arestas.get(i); if (a.getOrigem().equals(v1)) { Aresta a2 = this.addAresta(vc, a.getDestino()); for (String s : a.getTrans()) { a2.addTransicao(s, null); } } } } // nome auto explicativo private void resetVisita() { for (Vertice v : this.vertices) { v.setVisitado(false); } } //verifica se existe uma transição vazia saindo de v private boolean tranVazia(Vertice v) { for (Aresta a : this.arestas) { if (a.getOrigem().equals(v)) { ArrayList<String> trans = a.getTrans(); for (String s : trans) { if (s.charAt(0) == '\u25A1') { return true; } } } } return false; } // dada uma aresta, verificar qual posição da aresta corresponde a transição vazia // retorna -1 em caso não exista tal transição private int tranVazia(Aresta a, int i) { for (; i < a.getTrans().size(); i++) { String c = a.getTrans().get(i); if (c.charAt(0) == '\u25A1') { return i; } i++; } return -1; } //remove transição vazia de um vertice private void removeVazio(Vertice v) { if (v.isVisitado()) { return; } v.setVisitado(true); if (!this.tranVazia(v)) { return; } int k = 0; for (int i = 0; i < this.arestas.size(); i++) { Aresta a = this.arestas.get(i); if (a.getOrigem().equals(v)) { k = this.tranVazia(this.arestas.get(i), k); if (k != -1) { removeVazio(a.getDestino()); this.copiaTrans(a.getDestino(), v); a.getTrans().remove(k); if (a.getTrans().isEmpty()) { this.arestas.remove(a); i--; } v.setFim(a.getDestino().isFim()); } k = 0; } } } // Remove transições vazias (Função de automatos) de todos os vertices public void removeVazio() { this.resetVisita(); for (Vertice v : this.vertices) { this.removeVazio(v); } } // Cria label de descrição para um vertice public void criarLabel(String label, Vertice vertice) { for (int i = 0; i < this.vertices.size(); i++) { if (this.vertices.get(i).equals(vertice)) { this.vertices.get(i).setLabel(label); } } } }
11,262
0.465419
0.455437
401
26.980049
20.401569
113
false
false
0
0
0
0
0
0
0.441397
false
false
4
4fd3411f6b2aad65b4da7062f1958406f790f372
32,804,960,275,507
ce268cb1db503ec92f103ff397277d9fdbcc7abc
/AtCoderPractice/03-ABC081A/Main.java
23eecf370238258d3a947c621f5397721c7e2aa9
[]
no_license
yrockfield/AtCoder
https://github.com/yrockfield/AtCoder
e78822f69814717d2b4b31aaad3f36c496e025a0
9d3ab94ce4adcaa0c67bae6361421f19256b048f
refs/heads/master
2020-04-21T20:30:24.432000
2019-04-22T02:39:53
2019-04-22T02:39:53
169,847,009
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); String inpStr = sc.nextLine(); // 一桁ずつ取得 int s1 = Integer.parseInt(inpStr.substring(0,1)); int s2 = Integer.parseInt(inpStr.substring(1,2)); int s3 = Integer.parseInt(inpStr.substring(2,3)); //s1からs3のうち、"1"の個数 int kosu = s1 + s2 + s3; sc.close(); // 出力 System.out.println(kosu); } }
UTF-8
Java
571
java
Main.java
Java
[]
null
[]
import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); String inpStr = sc.nextLine(); // 一桁ずつ取得 int s1 = Integer.parseInt(inpStr.substring(0,1)); int s2 = Integer.parseInt(inpStr.substring(1,2)); int s3 = Integer.parseInt(inpStr.substring(2,3)); //s1からs3のうち、"1"の個数 int kosu = s1 + s2 + s3; sc.close(); // 出力 System.out.println(kosu); } }
571
0.692737
0.664804
25
20.52
18.553965
59
false
false
0
0
0
0
0
0
1.56
false
false
4
0a95d12096726b556952e90a795c9d3df44ceb14
37,984,690,768,129
4d62117c596c8868bfae0003475d06345c87317f
/app/src/main/java/com/example/xlibrary/ui/login/LoginActivity.java
5eae6058809808372e0eb7864f7752c98552aec8
[]
no_license
Kimsy99/xlibrary
https://github.com/Kimsy99/xlibrary
43390be7d431f6152f73ac5fdc0e79ea5163a2a1
4c416af114febbb06160dd4412bf809f01ba801c
refs/heads/main
2023-08-10T18:42:17.118000
2021-09-22T08:22:40
2021-09-22T08:22:40
384,366,694
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.xlibrary.ui.login; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.os.Bundle; import android.text.TextUtils; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.example.xlibrary.DatabaseHelper; import com.example.xlibrary.MainActivity; import com.example.xlibrary.R; import com.example.xlibrary.ui.signup.SignUpActivity; public class LoginActivity extends AppCompatActivity { DatabaseHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); TextView signIn = findViewById(R.id.link_signup); Button signInSubmit = findViewById(R.id.sign_in_btn); signIn.setOnClickListener(v -> startActivity(new Intent(LoginActivity.this, SignUpActivity.class))); signInSubmit.setOnClickListener(v -> { db = new DatabaseHelper(this); EditText emailInput = findViewById(R.id.loginEmail); String email = emailInput.getText().toString(); EditText pwdInput = findViewById(R.id.loginPasswordTextInput); String pwd = pwdInput.getText().toString(); if (TextUtils.isEmpty(email)){ Toast.makeText(this, "Please enter Email.", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(pwd)){ Toast.makeText(this, "Please enter Password.", Toast.LENGTH_SHORT).show(); return;} Cursor result = db.getUser(email, pwd); if (result != null && result.getCount() == 1 && result.moveToFirst()) { SharedPreferences sp = this.getSharedPreferences("user", 0); SharedPreferences.Editor editor = sp.edit(); editor.putInt("uid", result.getInt(0)); editor.putString("username", result.getString(1)); editor.putString("email", email); editor.putString("password", pwd); editor.putInt("admin", result.getInt(4)); editor.apply(); result.close(); startActivity(new Intent(LoginActivity.this, MainActivity.class)); } else { Toast.makeText(this, "Wrong Email/Password, please enter again.", Toast.LENGTH_SHORT).show(); } }); } }
UTF-8
Java
2,552
java
LoginActivity.java
Java
[ { "context": "ail);\n editor.putString(\"password\", pwd);\n editor.putInt(\"admin\", result.g", "end": 2180, "score": 0.990603506565094, "start": 2177, "tag": "PASSWORD", "value": "pwd" } ]
null
[]
package com.example.xlibrary.ui.login; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.os.Bundle; import android.text.TextUtils; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.example.xlibrary.DatabaseHelper; import com.example.xlibrary.MainActivity; import com.example.xlibrary.R; import com.example.xlibrary.ui.signup.SignUpActivity; public class LoginActivity extends AppCompatActivity { DatabaseHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); TextView signIn = findViewById(R.id.link_signup); Button signInSubmit = findViewById(R.id.sign_in_btn); signIn.setOnClickListener(v -> startActivity(new Intent(LoginActivity.this, SignUpActivity.class))); signInSubmit.setOnClickListener(v -> { db = new DatabaseHelper(this); EditText emailInput = findViewById(R.id.loginEmail); String email = emailInput.getText().toString(); EditText pwdInput = findViewById(R.id.loginPasswordTextInput); String pwd = pwdInput.getText().toString(); if (TextUtils.isEmpty(email)){ Toast.makeText(this, "Please enter Email.", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(pwd)){ Toast.makeText(this, "Please enter Password.", Toast.LENGTH_SHORT).show(); return;} Cursor result = db.getUser(email, pwd); if (result != null && result.getCount() == 1 && result.moveToFirst()) { SharedPreferences sp = this.getSharedPreferences("user", 0); SharedPreferences.Editor editor = sp.edit(); editor.putInt("uid", result.getInt(0)); editor.putString("username", result.getString(1)); editor.putString("email", email); editor.putString("password", pwd); editor.putInt("admin", result.getInt(4)); editor.apply(); result.close(); startActivity(new Intent(LoginActivity.this, MainActivity.class)); } else { Toast.makeText(this, "Wrong Email/Password, please enter again.", Toast.LENGTH_SHORT).show(); } }); } }
2,552
0.644984
0.643025
60
41.549999
26.23193
109
false
false
0
0
0
0
0
0
0.983333
false
false
4
71949779e1c3b201ac3d8d574be9bdb0e57410fa
34,978,213,687,343
231b8bfd668b315f5127c365be302ea092f71333
/pesquisa/src/main/java/br/com/sysdesc/pesquisa/components/CampoPesquisaMultiSelect.java
88399d5941e98c071ef8319a45b3a02625aa3397
[]
no_license
leandroZanatta/SysDesc
https://github.com/leandroZanatta/SysDesc
98142b525a854ea346f285d0c65c584de007b9c2
0cb39f594dc92c53ca8f8896c24c48b62675c513
refs/heads/master
2022-11-17T01:57:28.012000
2019-10-13T03:31:15
2019-10-13T03:31:15
186,448,488
0
1
null
false
2022-11-10T20:48:10
2019-05-13T15:36:28
2019-10-13T03:32:03
2022-11-10T20:48:07
528,084
0
0
16
Java
false
false
package br.com.sysdesc.pesquisa.components; import static br.com.sysdesc.util.resources.Resources.OPTION_VALIDACAO; import static br.com.sysdesc.util.resources.Resources.translate; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.Insets; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import com.mysema.query.BooleanBuilder; import br.com.sysdesc.pesquisa.enumeradores.PesquisaEnum; import br.com.sysdesc.pesquisa.ui.FrmPesquisa; import br.com.sysdesc.service.interfaces.impl.AbstractGenericService; import br.com.sysdesc.util.classes.ImageUtil; import br.com.sysdesc.util.classes.ListUtil; import br.com.sysdesc.util.exception.SysDescException; import net.miginfocom.swing.MigLayout; public abstract class CampoPesquisaMultiSelect<T> extends JPanel { private static final long serialVersionUID = 1L; private final AbstractGenericService<T> genericService; private final PesquisaEnum pesquisaEnum; private final Long codigoUsuario; private JButton btPesquisa; private JTextField txValorPesquisa; private List<T> objetosPesquisados = new ArrayList<>(); private Boolean pesquisaOk = Boolean.FALSE; public CampoPesquisaMultiSelect(AbstractGenericService<T> genericService, PesquisaEnum pesquisaEnum, Long codigoUsuario) { this.genericService = genericService; this.pesquisaEnum = pesquisaEnum; this.codigoUsuario = codigoUsuario; initComponents(); } private void initComponents() { txValorPesquisa = new JTextField(); btPesquisa = new JButton(); btPesquisa.setIcon(ImageUtil.resize("search.png", 16, 16)); btPesquisa.setMargin(new Insets(0, 0, 0, 0)); btPesquisa.addActionListener((e) -> validarPesquisa()); txValorPesquisa.setEditable(Boolean.FALSE); setLayout(new MigLayout("", "[grow][0.00]", "[grow]")); add(txValorPesquisa, "growx"); add(btPesquisa, "east"); } private void validarPesquisa() { if (validar()) { abrirPesquisa(); } } public Boolean validar() { return Boolean.TRUE; } private void abrirPesquisa() { try { JFrame parent = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, this); FrmPesquisa<T> frmPesquisa = new FrmPesquisa<T>(parent, pesquisaEnum, getPreFilter(), genericService, codigoUsuario, Boolean.TRUE); frmPesquisa.setVisible(Boolean.TRUE); this.pesquisaOk = frmPesquisa.getOk(); if (frmPesquisa.getOk()) { this.objetosPesquisados = frmPesquisa.getObjetos(); this.carregarCampo(); return; } } catch (SysDescException e) { showMessageDialog(null, e.getMensagem(), translate(OPTION_VALIDACAO), JOptionPane.WARNING_MESSAGE); } txValorPesquisa.setText(""); this.objetosPesquisados = new ArrayList<>(); } public void setValue(List<T> objeto) { this.objetosPesquisados = objeto; carregarCampo(); } protected <K> void carregarCampo() { if (ListUtil.isNullOrEmpty(this.objetosPesquisados)) { txValorPesquisa.setText(""); return; } txValorPesquisa.setText(this.formatarValorCampo()); }; private String formatarValorCampo() { if (this.objetosPesquisados.size() == 1) { return this.formatarValorCampoSingle(this.objetosPesquisados.get(0)); } return this.formatarValorCampoMultiple(this.objetosPesquisados); } protected abstract String formatarValorCampoMultiple(List<T> objetosPesquisados); protected abstract String formatarValorCampoSingle(T objeto); public Boolean getPesquisaOk() { return pesquisaOk; } public List<T> getObjetosPesquisado() { return objetosPesquisados; } public BooleanBuilder getPreFilter() { return new BooleanBuilder(); } public void bloquear(Boolean editable) { btPesquisa.setEnabled(editable); } }
UTF-8
Java
4,014
java
CampoPesquisaMultiSelect.java
Java
[]
null
[]
package br.com.sysdesc.pesquisa.components; import static br.com.sysdesc.util.resources.Resources.OPTION_VALIDACAO; import static br.com.sysdesc.util.resources.Resources.translate; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.Insets; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import com.mysema.query.BooleanBuilder; import br.com.sysdesc.pesquisa.enumeradores.PesquisaEnum; import br.com.sysdesc.pesquisa.ui.FrmPesquisa; import br.com.sysdesc.service.interfaces.impl.AbstractGenericService; import br.com.sysdesc.util.classes.ImageUtil; import br.com.sysdesc.util.classes.ListUtil; import br.com.sysdesc.util.exception.SysDescException; import net.miginfocom.swing.MigLayout; public abstract class CampoPesquisaMultiSelect<T> extends JPanel { private static final long serialVersionUID = 1L; private final AbstractGenericService<T> genericService; private final PesquisaEnum pesquisaEnum; private final Long codigoUsuario; private JButton btPesquisa; private JTextField txValorPesquisa; private List<T> objetosPesquisados = new ArrayList<>(); private Boolean pesquisaOk = Boolean.FALSE; public CampoPesquisaMultiSelect(AbstractGenericService<T> genericService, PesquisaEnum pesquisaEnum, Long codigoUsuario) { this.genericService = genericService; this.pesquisaEnum = pesquisaEnum; this.codigoUsuario = codigoUsuario; initComponents(); } private void initComponents() { txValorPesquisa = new JTextField(); btPesquisa = new JButton(); btPesquisa.setIcon(ImageUtil.resize("search.png", 16, 16)); btPesquisa.setMargin(new Insets(0, 0, 0, 0)); btPesquisa.addActionListener((e) -> validarPesquisa()); txValorPesquisa.setEditable(Boolean.FALSE); setLayout(new MigLayout("", "[grow][0.00]", "[grow]")); add(txValorPesquisa, "growx"); add(btPesquisa, "east"); } private void validarPesquisa() { if (validar()) { abrirPesquisa(); } } public Boolean validar() { return Boolean.TRUE; } private void abrirPesquisa() { try { JFrame parent = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, this); FrmPesquisa<T> frmPesquisa = new FrmPesquisa<T>(parent, pesquisaEnum, getPreFilter(), genericService, codigoUsuario, Boolean.TRUE); frmPesquisa.setVisible(Boolean.TRUE); this.pesquisaOk = frmPesquisa.getOk(); if (frmPesquisa.getOk()) { this.objetosPesquisados = frmPesquisa.getObjetos(); this.carregarCampo(); return; } } catch (SysDescException e) { showMessageDialog(null, e.getMensagem(), translate(OPTION_VALIDACAO), JOptionPane.WARNING_MESSAGE); } txValorPesquisa.setText(""); this.objetosPesquisados = new ArrayList<>(); } public void setValue(List<T> objeto) { this.objetosPesquisados = objeto; carregarCampo(); } protected <K> void carregarCampo() { if (ListUtil.isNullOrEmpty(this.objetosPesquisados)) { txValorPesquisa.setText(""); return; } txValorPesquisa.setText(this.formatarValorCampo()); }; private String formatarValorCampo() { if (this.objetosPesquisados.size() == 1) { return this.formatarValorCampoSingle(this.objetosPesquisados.get(0)); } return this.formatarValorCampoMultiple(this.objetosPesquisados); } protected abstract String formatarValorCampoMultiple(List<T> objetosPesquisados); protected abstract String formatarValorCampoSingle(T objeto); public Boolean getPesquisaOk() { return pesquisaOk; } public List<T> getObjetosPesquisado() { return objetosPesquisados; } public BooleanBuilder getPreFilter() { return new BooleanBuilder(); } public void bloquear(Boolean editable) { btPesquisa.setEnabled(editable); } }
4,014
0.730443
0.726956
158
23.405064
24.917595
104
false
false
0
0
0
0
0
0
1.525316
false
false
4
2d4cd195a286fd74b683111368eb316bebdd9647
12,120,397,757,676
ced8d8ee92a8212802fda4ea6fa66aaa5a0cb5be
/src/t832/Main.java
85e4e032e0251d71b440d46296dc837d3f73aaf9
[]
no_license
YueYongDev/LeetCode
https://github.com/YueYongDev/LeetCode
75a50ab93c5a7899d84893e7eeef454defe8b334
fe8d8e1a170ce6e298b41a8e20e5d924e34774d6
refs/heads/master
2020-03-16T18:56:06.842000
2019-10-16T13:01:44
2019-10-16T13:01:44
132,892,846
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package t832; public class Main { public static void main(String[] args) { int[][] B = {{1,1,0,0},{1,0,0,1},{0,1,1,1},{1,0,1,0}}; int[][] A=new Main().flipAndInvertImage(B); for (int i = 0; i < A.length; i++) { for (int j = 0; j < A[i].length; j++) { System.out.print(A[i][j] + " "); } System.out.println(); } } public int[][] flipAndInvertImage(int[][] A) { int row=A.length; int column=A[0].length; int[][] res=new int[row][column]; for (int i = 0; i < A.length; i++) { for (int j = A[i].length-1; j >=0 ; j--) { res[i][column-j-1]=reverse(A[i][j]); } } return res; } private int reverse(int x){ if (x==0) return 1; else return 0; } }
UTF-8
Java
867
java
Main.java
Java
[]
null
[]
package t832; public class Main { public static void main(String[] args) { int[][] B = {{1,1,0,0},{1,0,0,1},{0,1,1,1},{1,0,1,0}}; int[][] A=new Main().flipAndInvertImage(B); for (int i = 0; i < A.length; i++) { for (int j = 0; j < A[i].length; j++) { System.out.print(A[i][j] + " "); } System.out.println(); } } public int[][] flipAndInvertImage(int[][] A) { int row=A.length; int column=A[0].length; int[][] res=new int[row][column]; for (int i = 0; i < A.length; i++) { for (int j = A[i].length-1; j >=0 ; j--) { res[i][column-j-1]=reverse(A[i][j]); } } return res; } private int reverse(int x){ if (x==0) return 1; else return 0; } }
867
0.422145
0.388697
34
24.5
19.483402
62
false
false
0
0
0
0
0
0
1.029412
false
false
4
6cab558100c79e1aafcfdb537d6d94aabe0dbbb6
6,777,458,418,812
a629377627604b074545a69c43fb36e145ebac20
/src/Main.java
4c2a31ca6a8ac638d858bd040642e6292d863677
[]
no_license
Jonixo/WY-Space-exercise
https://github.com/Jonixo/WY-Space-exercise
492167e72934b25e5a0cfc96ff2875ec4e2ba78f
46acd443bcf83f6af16cfa8ff4036927de3e644c
refs/heads/master
2022-12-22T18:59:45.232000
2020-09-27T19:50:14
2020-09-27T19:50:14
299,034,694
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; class Main { //Encapsulates reading data from txt file. public static int[] readData (String filename, int[] halfHourPeriods) { try { //Reading file (got the name from function parameter), didn't get the filename from user since It didn't mentioned in task File myObj = new File(filename); Scanner myReader = new Scanner(myObj); //Loop to read every line one by one and process it while (myReader.hasNextLine()) { //In loop first action is to read next line String data = myReader.nextLine(); //Split read line with "," String[] splitted = data.split(","); //Getting starting hour and converting it to index for a loop int startIndex; String[] splitStartHour = splitted[2].split(":"); //I'm multiplying hour with two and adding 1 if the M is 30 to get the correlating index. startIndex = Integer.parseInt(splitStartHour[0]) * 2; if (splitStartHour[1].equals("30")) startIndex++; //Same stuff but for end index int endIndex; String[] splitendHour = splitted[3].split(":"); endIndex = Integer.parseInt(splitendHour[0]) * 2; if (splitendHour[1].equals("30")) endIndex++; /*After I figured out the start and end index, I created a loop to fill affected indexes. * Ex. If the starting hour is 14:00 and the ending hour is 16:30 and the downlink is 5. * I converted 14:00 to (14*2)=28. index and 16:30 = (16*3)+1=33. index * Now I'm filling indexes 28-33 with 5. * */ for (int i = startIndex; startIndex <= endIndex; startIndex++) halfHourPeriods[startIndex] = halfHourPeriods[startIndex] + Integer.parseInt(splitted[1]); } //closing file reader myReader.close(); } catch ( FileNotFoundException e) { //Error in case file is not found. System.out.println("An error occurred."); e.printStackTrace(); } return halfHourPeriods; } //Finds max value in given int array public static int findMax(int[] values) { int max = values[0]; for(int i = 1; i < values.length;i++) { if(values[i] > max) { max = values[i]; } } return max; } //Asks user for bandwidth public static int getBandwidth(){ Scanner in = new Scanner(System.in); System.out.println("Please enter bandwidth of ground station."); int bandwidth = in.nextInt(); return bandwidth; } //Compares bandwidth to max downlink and prints result. public static void compareAndResult(int max, int bandwidth){ if(max<=bandwidth) System.out.println("Maximum amount of downlink is: "+max+" and ground station's bandwidth is: "+bandwidth+"." + " Ground station can handle this downlink."); else System.out.println("Maximum amount of downlink is: "+max+" and ground station's bandwidth is: "+bandwidth+"." + " Ground station can't handle this downlink."); } public static void main(String[] args) { /* I decided to divide a day with 30m intervals since each satellite has a downlink rate measured in units * per 30 minutes. * (ex; index 0 = 00:00, index 1 = 00:30, index 2 = 01:00 ... index 47 = 23:30) * Since I only need to know what is the total downlink every interval I didn't stored any information * regarding satellites names. I found out which hour satellite became available and unavailable, * converted it to correlated index of interval, created a for loop to appended affected indexes and appended * affected indexes with the downlink value read from the file. After that find out the max value in the * array and compared it to inputted ground station bandwidth to check if bandwidth is enough. * */ String filename="pass-schedule.txt"; int max,bandwidth; // Creating an array with 30m intervals int[] halfHourPeriods; halfHourPeriods = new int[48]; //filling arraylist with 0 incase no satellite passes for an interval and it makes easier to append for(int i=0;i<48;i++) halfHourPeriods[i]=0; //calling method to read data halfHourPeriods= Main.readData(filename,halfHourPeriods); //calling method to find max value in array max= Main.findMax(halfHourPeriods); //calling method to get bandwidth bandwidth= Main.getBandwidth(); //calling method to compare results Main.compareAndResult(max,bandwidth); } }
UTF-8
Java
5,120
java
Main.java
Java
[]
null
[]
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; class Main { //Encapsulates reading data from txt file. public static int[] readData (String filename, int[] halfHourPeriods) { try { //Reading file (got the name from function parameter), didn't get the filename from user since It didn't mentioned in task File myObj = new File(filename); Scanner myReader = new Scanner(myObj); //Loop to read every line one by one and process it while (myReader.hasNextLine()) { //In loop first action is to read next line String data = myReader.nextLine(); //Split read line with "," String[] splitted = data.split(","); //Getting starting hour and converting it to index for a loop int startIndex; String[] splitStartHour = splitted[2].split(":"); //I'm multiplying hour with two and adding 1 if the M is 30 to get the correlating index. startIndex = Integer.parseInt(splitStartHour[0]) * 2; if (splitStartHour[1].equals("30")) startIndex++; //Same stuff but for end index int endIndex; String[] splitendHour = splitted[3].split(":"); endIndex = Integer.parseInt(splitendHour[0]) * 2; if (splitendHour[1].equals("30")) endIndex++; /*After I figured out the start and end index, I created a loop to fill affected indexes. * Ex. If the starting hour is 14:00 and the ending hour is 16:30 and the downlink is 5. * I converted 14:00 to (14*2)=28. index and 16:30 = (16*3)+1=33. index * Now I'm filling indexes 28-33 with 5. * */ for (int i = startIndex; startIndex <= endIndex; startIndex++) halfHourPeriods[startIndex] = halfHourPeriods[startIndex] + Integer.parseInt(splitted[1]); } //closing file reader myReader.close(); } catch ( FileNotFoundException e) { //Error in case file is not found. System.out.println("An error occurred."); e.printStackTrace(); } return halfHourPeriods; } //Finds max value in given int array public static int findMax(int[] values) { int max = values[0]; for(int i = 1; i < values.length;i++) { if(values[i] > max) { max = values[i]; } } return max; } //Asks user for bandwidth public static int getBandwidth(){ Scanner in = new Scanner(System.in); System.out.println("Please enter bandwidth of ground station."); int bandwidth = in.nextInt(); return bandwidth; } //Compares bandwidth to max downlink and prints result. public static void compareAndResult(int max, int bandwidth){ if(max<=bandwidth) System.out.println("Maximum amount of downlink is: "+max+" and ground station's bandwidth is: "+bandwidth+"." + " Ground station can handle this downlink."); else System.out.println("Maximum amount of downlink is: "+max+" and ground station's bandwidth is: "+bandwidth+"." + " Ground station can't handle this downlink."); } public static void main(String[] args) { /* I decided to divide a day with 30m intervals since each satellite has a downlink rate measured in units * per 30 minutes. * (ex; index 0 = 00:00, index 1 = 00:30, index 2 = 01:00 ... index 47 = 23:30) * Since I only need to know what is the total downlink every interval I didn't stored any information * regarding satellites names. I found out which hour satellite became available and unavailable, * converted it to correlated index of interval, created a for loop to appended affected indexes and appended * affected indexes with the downlink value read from the file. After that find out the max value in the * array and compared it to inputted ground station bandwidth to check if bandwidth is enough. * */ String filename="pass-schedule.txt"; int max,bandwidth; // Creating an array with 30m intervals int[] halfHourPeriods; halfHourPeriods = new int[48]; //filling arraylist with 0 incase no satellite passes for an interval and it makes easier to append for(int i=0;i<48;i++) halfHourPeriods[i]=0; //calling method to read data halfHourPeriods= Main.readData(filename,halfHourPeriods); //calling method to find max value in array max= Main.findMax(halfHourPeriods); //calling method to get bandwidth bandwidth= Main.getBandwidth(); //calling method to compare results Main.compareAndResult(max,bandwidth); } }
5,120
0.588672
0.57207
125
39.967999
34.73671
134
false
false
0
0
0
0
0
0
0.464
false
false
4
bdedd314047bfd0bf6c0ca520e222cea2b811edf
25,426,206,419,649
f6f23825811090e12a1bab5561bb3c02d54d8964
/src/main/java/com/ag777/util/lang/interf/Disposable.java
01efb7df52410a38ed4af55491dcb98cf84c68c6
[]
no_license
ag777/utils
https://github.com/ag777/utils
00ef84fcfd90413e90e3666d0f9284ee995dcead
bfa26f05f8ec2ad59f129f96c33ed54e8c3234ef
refs/heads/master
2023-08-17T20:39:15.887000
2023-08-16T08:19:31
2023-08-16T08:19:31
95,071,236
2
2
null
false
2022-05-20T21:42:10
2017-06-22T03:35:48
2021-11-02T03:10:08
2022-05-20T21:42:10
19,351
1
2
1
Java
false
false
package com.ag777.util.lang.interf; public interface Disposable { public void dispose(); }
UTF-8
Java
94
java
Disposable.java
Java
[]
null
[]
package com.ag777.util.lang.interf; public interface Disposable { public void dispose(); }
94
0.755319
0.723404
6
14.666667
14.749764
35
false
false
0
0
0
0
0
0
0.5
false
false
4
53322d03d153ad997c57a3e99974d44a55db2774
28,578,712,402,201
bb15b4749b09dc73fecbd1d809fcb618cecb5798
/sveditor/plugins/org.sveditor.core.tests/src/org/sveditor/core/tests/open_decl/TestOpenDeclUBus.java
2bab7cf4e809ff799def83482a94669927cf438c
[]
no_license
stevenaz/sveditor
https://github.com/stevenaz/sveditor
eb26bdac7df283d964c74aaab4cf63d8606b09b9
b777a8ffe0a674d7b274b4982b15fa80d0070926
refs/heads/master
2021-09-27T06:40:04.183000
2021-09-09T21:55:07
2021-09-09T21:55:07
3,244,123
0
0
null
true
2021-09-09T21:55:08
2012-01-23T04:07:16
2021-09-09T21:54:31
2021-09-09T21:55:07
50,802
1
0
0
Java
false
false
/* * Copyright (c) 2008-2020 Matthew Ballance and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0/. * * SPDX-License-Identifier: EPL-2.0 * */ package org.sveditor.core.tests.open_decl; import java.io.File; import java.io.InputStream; import java.util.List; import org.sveditor.core.tests.SVCoreTestCaseBase; import org.sveditor.core.tests.SVCoreTestsPlugin; import org.sveditor.core.tests.utils.BundleUtils; import org.sveditor.core.tests.utils.TestUtils; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.sveditor.core.SVCorePlugin; import org.sveditor.core.Tuple; import org.sveditor.core.db.ISVDBScopeItem; import org.sveditor.core.db.SVDBFile; import org.sveditor.core.db.index.ISVDBFileSystemProvider; import org.sveditor.core.db.index.SVDBIndexCollection; import org.sveditor.core.db.project.SVDBProjectData; import org.sveditor.core.db.project.SVDBProjectManager; import org.sveditor.core.db.project.SVProjectFileWrapper; import org.sveditor.core.db.search.SVDBSearchResult; import org.sveditor.core.expr_utils.SVExprContext; import org.sveditor.core.open_decl.OpenDeclResult; import org.sveditor.core.open_decl.OpenDeclUtils; import org.sveditor.core.scanutils.StringBIDITextScanner; public class TestOpenDeclUBus extends SVCoreTestCaseBase { public void testUBusOutsideWorkspaceFile() { SVCorePlugin.getDefault().enableDebug(false); SVDBProjectData pd = setupUBusProject(); SVDBIndexCollection index = pd.getProjectIndexMgr(); String test_lib_sv = "${workspace_loc}/ubus/examples/test_lib.sv"; List<SVDBSearchResult<SVDBFile>> result = index.findFile(test_lib_sv); assertEquals(1, result.size()); SVDBSearchResult<SVDBFile> r = result.get(0); ISVDBFileSystemProvider fs = r.getIndex().getFileSystemProvider(); InputStream in = fs.openStream(test_lib_sv); assertNotNull(in); String input = TestUtils.readInput(in); fs.closeStream(in); StringBIDITextScanner scanner = new StringBIDITextScanner(input); int offset = input.indexOf("extends uvm_test"); offset += "extends u".length(); scanner.seek(offset); int line = getLineOfIndex(input, offset); Tuple<SVExprContext, ISVDBScopeItem> ctxt_r = OpenDeclUtils.getContextScope(r.getItem(), line, scanner); List<OpenDeclResult> results = OpenDeclUtils.openDecl( ctxt_r.first(), ctxt_r.second(), index); assertEquals(1, results.size()); } private int getLineOfIndex(String str, int offset) { int line=1, idx=0; while (idx <= offset) { if (str.charAt(idx) == '\n') { line++; } idx++; } return line; } private SVDBProjectData setupUBusProject() { BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle()); utils.unpackBundleZipToFS("/uvm.zip", fTmpDir); File ubus = new File(fTmpDir, "uvm/examples/integrated/ubus"); final IProject p = TestUtils.createProject("ubus", ubus); addProject(p); final SVDBProjectManager pmgr = SVCorePlugin.getDefault().getProjMgr(); SVDBProjectData pd = pmgr.getProjectData(p); TestUtils.copy( "+incdir+${workspace_loc}/ubus/sv\n" + "+incdir+${workspace_loc}/ubus/examples\n" + "+incdir+../../../src\n" + "../../../src/uvm_pkg.sv\n" + "${workspace_loc}/ubus/examples/ubus_tb_top.sv\n" + "${workspace_loc}/ubus/sv/ubus_version.svh\n", p.getFile(new Path("sve.f"))); SVProjectFileWrapper fw = pd.getProjectFileWrapper(); fw.addArgFilePath("${workspace_loc}/ubus/sve.f"); pd.setProjectFileWrapper(fw); Job j = new Job("Rebuild Index") { @Override protected IStatus run(IProgressMonitor monitor) { pmgr.rebuildProject(new NullProgressMonitor(), p, true); return Status.OK_STATUS; } }; j.schedule(); try { j.join(); } catch (InterruptedException e) {} // boolean build_res = false; // // for (int i=0; i<16; i++) { // build_res = pmgr.rebuildProject(new NullProgressMonitor(), p, false); // if (build_res) { // break; // } // } // // assertTrue(build_res); return pd; } }
UTF-8
Java
4,423
java
TestOpenDeclUBus.java
Java
[ { "context": "/* \n * Copyright (c) 2008-2020 Matthew Ballance and others.\n *\n * This program and the accompanyi", "end": 47, "score": 0.9998067617416382, "start": 31, "tag": "NAME", "value": "Matthew Ballance" } ]
null
[]
/* * Copyright (c) 2008-2020 <NAME> and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0/. * * SPDX-License-Identifier: EPL-2.0 * */ package org.sveditor.core.tests.open_decl; import java.io.File; import java.io.InputStream; import java.util.List; import org.sveditor.core.tests.SVCoreTestCaseBase; import org.sveditor.core.tests.SVCoreTestsPlugin; import org.sveditor.core.tests.utils.BundleUtils; import org.sveditor.core.tests.utils.TestUtils; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.sveditor.core.SVCorePlugin; import org.sveditor.core.Tuple; import org.sveditor.core.db.ISVDBScopeItem; import org.sveditor.core.db.SVDBFile; import org.sveditor.core.db.index.ISVDBFileSystemProvider; import org.sveditor.core.db.index.SVDBIndexCollection; import org.sveditor.core.db.project.SVDBProjectData; import org.sveditor.core.db.project.SVDBProjectManager; import org.sveditor.core.db.project.SVProjectFileWrapper; import org.sveditor.core.db.search.SVDBSearchResult; import org.sveditor.core.expr_utils.SVExprContext; import org.sveditor.core.open_decl.OpenDeclResult; import org.sveditor.core.open_decl.OpenDeclUtils; import org.sveditor.core.scanutils.StringBIDITextScanner; public class TestOpenDeclUBus extends SVCoreTestCaseBase { public void testUBusOutsideWorkspaceFile() { SVCorePlugin.getDefault().enableDebug(false); SVDBProjectData pd = setupUBusProject(); SVDBIndexCollection index = pd.getProjectIndexMgr(); String test_lib_sv = "${workspace_loc}/ubus/examples/test_lib.sv"; List<SVDBSearchResult<SVDBFile>> result = index.findFile(test_lib_sv); assertEquals(1, result.size()); SVDBSearchResult<SVDBFile> r = result.get(0); ISVDBFileSystemProvider fs = r.getIndex().getFileSystemProvider(); InputStream in = fs.openStream(test_lib_sv); assertNotNull(in); String input = TestUtils.readInput(in); fs.closeStream(in); StringBIDITextScanner scanner = new StringBIDITextScanner(input); int offset = input.indexOf("extends uvm_test"); offset += "extends u".length(); scanner.seek(offset); int line = getLineOfIndex(input, offset); Tuple<SVExprContext, ISVDBScopeItem> ctxt_r = OpenDeclUtils.getContextScope(r.getItem(), line, scanner); List<OpenDeclResult> results = OpenDeclUtils.openDecl( ctxt_r.first(), ctxt_r.second(), index); assertEquals(1, results.size()); } private int getLineOfIndex(String str, int offset) { int line=1, idx=0; while (idx <= offset) { if (str.charAt(idx) == '\n') { line++; } idx++; } return line; } private SVDBProjectData setupUBusProject() { BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle()); utils.unpackBundleZipToFS("/uvm.zip", fTmpDir); File ubus = new File(fTmpDir, "uvm/examples/integrated/ubus"); final IProject p = TestUtils.createProject("ubus", ubus); addProject(p); final SVDBProjectManager pmgr = SVCorePlugin.getDefault().getProjMgr(); SVDBProjectData pd = pmgr.getProjectData(p); TestUtils.copy( "+incdir+${workspace_loc}/ubus/sv\n" + "+incdir+${workspace_loc}/ubus/examples\n" + "+incdir+../../../src\n" + "../../../src/uvm_pkg.sv\n" + "${workspace_loc}/ubus/examples/ubus_tb_top.sv\n" + "${workspace_loc}/ubus/sv/ubus_version.svh\n", p.getFile(new Path("sve.f"))); SVProjectFileWrapper fw = pd.getProjectFileWrapper(); fw.addArgFilePath("${workspace_loc}/ubus/sve.f"); pd.setProjectFileWrapper(fw); Job j = new Job("Rebuild Index") { @Override protected IStatus run(IProgressMonitor monitor) { pmgr.rebuildProject(new NullProgressMonitor(), p, true); return Status.OK_STATUS; } }; j.schedule(); try { j.join(); } catch (InterruptedException e) {} // boolean build_res = false; // // for (int i=0; i<16; i++) { // build_res = pmgr.rebuildProject(new NullProgressMonitor(), p, false); // if (build_res) { // break; // } // } // // assertTrue(build_res); return pd; } }
4,413
0.725073
0.7201
148
28.885136
23.087532
82
false
false
0
0
0
0
0
0
2.081081
false
false
4
1eb4668bf66b7f0b0f5e8bb4902418b55a674539
6,055,903,942,176
21cc03663cbf5b2b938cf299daec6951669254c1
/Board.java
c609cb0854005272a18f9823447f95afef78bd36
[]
no_license
csanc195/Java-Nth-queen-problem
https://github.com/csanc195/Java-Nth-queen-problem
3a46080c508d73273d9adc380b820c816a7b0700
c1cc22ac8afdf44d953a031a018e66ee8e3b5eeb
refs/heads/master
2021-04-28T21:34:59.403000
2017-01-01T06:45:16
2017-01-01T06:45:16
77,768,762
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @author CarlosSanchez P_ID:5446178 */ import static java.lang.Math.abs; /** * The following final class contains a family of methods which are used * to create a chess board and using backtracking with recursion proceeds * to populate it with the greatest amount of queens that can be placed * without them attacking each other. This number N is determined by the * length of any size of the board. For example: a board of size 8 can * contain at most 8 queens placed in on non conflicting positions. * @author CarlosSanchez * */ public final class Board { private static boolean found; /** * The following method uses the Number n as the dimensions of a board * of chess of variable length, and prints a single board representation * with n queens where each one of the queens is positioned in a way * where they are not attacking each other * @param n This is the size of the board. * @return The array representation of the two dimensional board which contains * the correct positions of the queens which do not attack one another. */ public static int[] nQueens(int n){ int[] board = new int[n]; placeQueens(0, board); return board; } /** * The following method uses an integer array to construct a board * of chess with N queens, where each queen is free from attacking each * other. Parameter x is the current queen position and Parameter board is * the array representing the two-dimensional board. * @param x The current queen position. * @param board The two Dimensional board. */ public static void placeQueens(int x, int[] board) { int n = board.length; for (int i = 0; i < n && !found; i++) { if (canPlace(x, i, board)) { board[x] = i+1; if (x == n - 1) { found = true; }else { placeQueens(x + 1, board); } } } } /** * The following method uses the current coordinates of the queen which * is trying to be placed and decides if the current tentative possition * is free from any other attacking queen. * @param row The row of the tentative queen. * @param col The column of the tentative queen. * @param board The array representation of the two dimensional board. * @return True if the queen can be placed safely (without conflicts with * other queens), and false if it can not. */ public static boolean canPlace(int row, int col, int[]board) { for (int i = 0; i < row; i++) { if (((board[i]-1) == col) || (abs(i - row) == abs((board[i]-1) - col))) { return false; } } return true; } /** * The following method prints the array entered by parameters interpreting it * as an array representation of a two dimensional chess board, and places * each queen in its respective location. * @param board */ public static void printBoard(int [] board){ int n = board.length; System.out.println("\nSquare board representation:"); for(int i=1; i<= n; i++){ for(int j=0; j< n; j++){ if(board[j] == i){ System.out.printf("%s", " [Q] "); }else{ System.out.printf("%s", " [.] "); } } System.out.println("\n"); } } }
UTF-8
Java
3,138
java
Board.java
Java
[ { "context": "/**\n * @author CarlosSanchez P_ID:5446178\n */\n\nimport static java.lang.Math.ab", "end": 28, "score": 0.9978883862495422, "start": 15, "tag": "NAME", "value": "CarlosSanchez" }, { "context": "laced in on non conflicting positions. \n * @author CarlosSanchez\n *\n */\...
null
[]
/** * @author CarlosSanchez P_ID:5446178 */ import static java.lang.Math.abs; /** * The following final class contains a family of methods which are used * to create a chess board and using backtracking with recursion proceeds * to populate it with the greatest amount of queens that can be placed * without them attacking each other. This number N is determined by the * length of any size of the board. For example: a board of size 8 can * contain at most 8 queens placed in on non conflicting positions. * @author CarlosSanchez * */ public final class Board { private static boolean found; /** * The following method uses the Number n as the dimensions of a board * of chess of variable length, and prints a single board representation * with n queens where each one of the queens is positioned in a way * where they are not attacking each other * @param n This is the size of the board. * @return The array representation of the two dimensional board which contains * the correct positions of the queens which do not attack one another. */ public static int[] nQueens(int n){ int[] board = new int[n]; placeQueens(0, board); return board; } /** * The following method uses an integer array to construct a board * of chess with N queens, where each queen is free from attacking each * other. Parameter x is the current queen position and Parameter board is * the array representing the two-dimensional board. * @param x The current queen position. * @param board The two Dimensional board. */ public static void placeQueens(int x, int[] board) { int n = board.length; for (int i = 0; i < n && !found; i++) { if (canPlace(x, i, board)) { board[x] = i+1; if (x == n - 1) { found = true; }else { placeQueens(x + 1, board); } } } } /** * The following method uses the current coordinates of the queen which * is trying to be placed and decides if the current tentative possition * is free from any other attacking queen. * @param row The row of the tentative queen. * @param col The column of the tentative queen. * @param board The array representation of the two dimensional board. * @return True if the queen can be placed safely (without conflicts with * other queens), and false if it can not. */ public static boolean canPlace(int row, int col, int[]board) { for (int i = 0; i < row; i++) { if (((board[i]-1) == col) || (abs(i - row) == abs((board[i]-1) - col))) { return false; } } return true; } /** * The following method prints the array entered by parameters interpreting it * as an array representation of a two dimensional chess board, and places * each queen in its respective location. * @param board */ public static void printBoard(int [] board){ int n = board.length; System.out.println("\nSquare board representation:"); for(int i=1; i<= n; i++){ for(int j=0; j< n; j++){ if(board[j] == i){ System.out.printf("%s", " [Q] "); }else{ System.out.printf("%s", " [.] "); } } System.out.println("\n"); } } }
3,138
0.665392
0.659337
100
30.379999
26.702353
81
false
false
0
0
0
0
0
0
1.96
false
false
4
69a14de164541b529f0676066afca056a48a33dc
6,055,903,943,577
ac0f6e99379bcc48301beb18374bac14b568d73c
/Software2G/src/com/software2g/vo/Entidaddonante.java
9321e1b025993a66685eaa203f836a8a50469f89
[]
no_license
torvicgomez/software2g
https://github.com/torvicgomez/software2g
8ce0e7ee49b786a65ad1c3284f4a28c43abf0200
f5325c3a9e3fb17c753dc3d6fdd5d0d422c9f757
refs/heads/master
2020-12-24T14:46:10.924000
2015-08-23T19:16:14
2015-08-23T19:16:14
41,489,960
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.software2g.vo; import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.List; /** * The persistent class for the entidaddonante database table. * */ @Entity @Table(schema="CONTABLE", name="ENTIDADDONANTE") public class Entidaddonante implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name="ENTIDADDONANTE_ENDOID_GENERATOR", sequenceName="CONTABLE.S_ENDO_ID") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ENTIDADDONANTE_ENDOID_GENERATOR") @Column(name="endo_id") private long endoId; @Column(name="endo_descripcion") private String endoDescripcion; @Column(name="endo_fechamodificacion") private String endoFechamodificacion; @Column(name="endo_hora") private String endoHora; @Column(name="endo_nit") private BigDecimal endoNit; @Column(name="endo_razonsocial") private String endoRazonsocial; @Column(name="endo_registradopor") private String endoRegistradopor; @Column(name="endo_representantelegal") private String endoRepresentantelegal; //bi-directional many-to-one association to Donacion @OneToMany(mappedBy="entidaddonante") private List<Donacion> donacions; public Entidaddonante() { } public long getEndoId() { return this.endoId; } public void setEndoId(long endoId) { this.endoId = endoId; } public String getEndoDescripcion() { return this.endoDescripcion; } public void setEndoDescripcion(String endoDescripcion) { this.endoDescripcion = endoDescripcion; } public String getEndoFechamodificacion() { return this.endoFechamodificacion; } public void setEndoFechamodificacion(String endoFechamodificacion) { this.endoFechamodificacion = endoFechamodificacion; } public String getEndoHora() { return this.endoHora; } public void setEndoHora(String endoHora) { this.endoHora = endoHora; } public BigDecimal getEndoNit() { return this.endoNit; } public void setEndoNit(BigDecimal endoNit) { this.endoNit = endoNit; } public String getEndoRazonsocial() { return this.endoRazonsocial; } public void setEndoRazonsocial(String endoRazonsocial) { this.endoRazonsocial = endoRazonsocial; } public String getEndoRegistradopor() { return this.endoRegistradopor; } public void setEndoRegistradopor(String endoRegistradopor) { this.endoRegistradopor = endoRegistradopor; } public String getEndoRepresentantelegal() { return this.endoRepresentantelegal; } public void setEndoRepresentantelegal(String endoRepresentantelegal) { this.endoRepresentantelegal = endoRepresentantelegal; } public List<Donacion> getDonacions() { return this.donacions; } public void setDonacions(List<Donacion> donacions) { this.donacions = donacions; } public Donacion addDonacions(Donacion donacions) { getDonacions().add(donacions); donacions.setEntidaddonante(this); return donacions; } public Donacion removeDonacions(Donacion donacions) { getDonacions().remove(donacions); donacions.setEntidaddonante(null); return donacions; } }
UTF-8
Java
3,222
java
Entidaddonante.java
Java
[]
null
[]
package com.software2g.vo; import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.List; /** * The persistent class for the entidaddonante database table. * */ @Entity @Table(schema="CONTABLE", name="ENTIDADDONANTE") public class Entidaddonante implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name="ENTIDADDONANTE_ENDOID_GENERATOR", sequenceName="CONTABLE.S_ENDO_ID") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ENTIDADDONANTE_ENDOID_GENERATOR") @Column(name="endo_id") private long endoId; @Column(name="endo_descripcion") private String endoDescripcion; @Column(name="endo_fechamodificacion") private String endoFechamodificacion; @Column(name="endo_hora") private String endoHora; @Column(name="endo_nit") private BigDecimal endoNit; @Column(name="endo_razonsocial") private String endoRazonsocial; @Column(name="endo_registradopor") private String endoRegistradopor; @Column(name="endo_representantelegal") private String endoRepresentantelegal; //bi-directional many-to-one association to Donacion @OneToMany(mappedBy="entidaddonante") private List<Donacion> donacions; public Entidaddonante() { } public long getEndoId() { return this.endoId; } public void setEndoId(long endoId) { this.endoId = endoId; } public String getEndoDescripcion() { return this.endoDescripcion; } public void setEndoDescripcion(String endoDescripcion) { this.endoDescripcion = endoDescripcion; } public String getEndoFechamodificacion() { return this.endoFechamodificacion; } public void setEndoFechamodificacion(String endoFechamodificacion) { this.endoFechamodificacion = endoFechamodificacion; } public String getEndoHora() { return this.endoHora; } public void setEndoHora(String endoHora) { this.endoHora = endoHora; } public BigDecimal getEndoNit() { return this.endoNit; } public void setEndoNit(BigDecimal endoNit) { this.endoNit = endoNit; } public String getEndoRazonsocial() { return this.endoRazonsocial; } public void setEndoRazonsocial(String endoRazonsocial) { this.endoRazonsocial = endoRazonsocial; } public String getEndoRegistradopor() { return this.endoRegistradopor; } public void setEndoRegistradopor(String endoRegistradopor) { this.endoRegistradopor = endoRegistradopor; } public String getEndoRepresentantelegal() { return this.endoRepresentantelegal; } public void setEndoRepresentantelegal(String endoRepresentantelegal) { this.endoRepresentantelegal = endoRepresentantelegal; } public List<Donacion> getDonacions() { return this.donacions; } public void setDonacions(List<Donacion> donacions) { this.donacions = donacions; } public Donacion addDonacions(Donacion donacions) { getDonacions().add(donacions); donacions.setEntidaddonante(this); return donacions; } public Donacion removeDonacions(Donacion donacions) { getDonacions().remove(donacions); donacions.setEntidaddonante(null); return donacions; } }
3,222
0.738672
0.738051
139
21.208633
21.737967
95
false
false
0
0
0
0
0
0
1.122302
false
false
4
10830e6ad5218c462d8fcf2644fae66db2179b9a
24,816,321,107,033
0e1deeba68514dbedf1b22a031faba8c079b2207
/src/main/java/com/solehin/model/CustomerProfile.java
ba5cf52861310aa25d0eb5cd7950290bacad80e5
[]
no_license
rajanjoshi/ai_4_eye
https://github.com/rajanjoshi/ai_4_eye
edc0b423a2f88d92aa0908351d9c902178943167
b8606d172f05ab9b1b9353e70d26d10ca0355dc5
refs/heads/main
2023-03-08T17:47:42.459000
2021-02-25T09:38:43
2021-02-25T09:38:43
341,938,764
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.solehin.model; import lombok.Builder; import lombok.Data; @Data @Builder public class CustomerProfile { private String customerId; private String firstName; private String lastName; private Channel channel; private Long pin; private String cardNumber; private Long sessionTimeOut; private String sessionId; }
UTF-8
Java
350
java
CustomerProfile.java
Java
[ { "context": " {\n private String customerId;\n private String firstName;\n private String lastName;\n private Channel c", "end": 175, "score": 0.9949948787689209, "start": 166, "tag": "NAME", "value": "firstName" }, { "context": "Id;\n private String firstName;\n private...
null
[]
package com.solehin.model; import lombok.Builder; import lombok.Data; @Data @Builder public class CustomerProfile { private String customerId; private String firstName; private String lastName; private Channel channel; private Long pin; private String cardNumber; private Long sessionTimeOut; private String sessionId; }
350
0.757143
0.757143
20
16.5
12.519984
31
false
false
0
0
0
0
0
0
0.55
false
false
4
d836de4b107a7b895aec2bebcee3a30926915778
1,211,180,797,019
3d6fe58e439f38f4e2a7f6219e008ae931500eea
/wechat-core/src/main/java/com/wechat/util/AccessTokenUtils.java
55189f4b82043fd81cbe6019f997c7c73875ad1f
[]
no_license
13823615485/panzhenxing
https://github.com/13823615485/panzhenxing
a5ac5b7dd91277cb6acd8f693f85ec969fe3ed73
7e91b68590860af9138b5da23dd9be6e54a8490c
refs/heads/master
2021-06-11T14:09:09.844000
2019-07-27T13:24:56
2019-07-27T13:24:56
199,133,546
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wechat.util; import com.wechat.cache.CacheConfig; import com.wechat.entity.token.AccessToken; import com.wechat.util.message.AccessTokenMessage; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import java.util.Date; /** * Created with IntelliJ IDEA. * * @Description: 获取accessToken * @Author: zhengyw * @Date: 2017/11/30 14:51 * @Version: 1.0 */ public class AccessTokenUtils { private static final Logger logger = LogManager.getLogger(AccessTokenUtils.class); private static String APPID = ""; private static String APPSECRET = ""; public AccessTokenUtils(String appid, String appsecret){ this.APPID = appid; this.APPSECRET = appsecret; } /** * 获取access_token(默认APPID) */ public static AccessToken getAccessToken(){ AccessToken accessToken = CacheConfig.accessTokens.get(APPID); if(accessToken == null){ accessToken = AccessTokenMessage.token(APPID, APPSECRET); if(accessToken != null){ accessToken.setCurrentTime(new Date().getTime()); CacheConfig.accessTokens.put(APPID, accessToken); } } logger.info(String.format("APPID:[%s] 的accessToken:【%s】 expires_in:【%s】", APPID, accessToken.getAccess_token(), accessToken.getExpires_in())); return accessToken; } /** * 获取access_token(指定APPID) * * @param appid 第三方用户唯一凭证 * @param appsecret 第三方用户唯一凭证密钥,即appsecret */ public static AccessToken getAccessToken(String appid, String appsecret){ AccessToken accessToken = CacheConfig.accessTokens.get(appid); if(accessToken == null){ accessToken = AccessTokenMessage.token(appid, appsecret); if(accessToken != null){ accessToken.setCurrentTime(new Date().getTime()); CacheConfig.accessTokens.put(appid, accessToken); } } logger.info(String.format("APPID:[%s] 的accessToken:【%s】 expires_in:【%s】", appid, accessToken.getAccess_token(), accessToken.getExpires_in())); return accessToken; } }
UTF-8
Java
2,339
java
AccessTokenUtils.java
Java
[ { "context": "\r\n *\r\n * @Description: 获取accessToken\r\n * @Author: zhengyw\r\n * @Date: 2017/11/30 14:51\r\n * @Version: 1.0\r\n *", "end": 354, "score": 0.9996289610862732, "start": 347, "tag": "USERNAME", "value": "zhengyw" } ]
null
[]
package com.wechat.util; import com.wechat.cache.CacheConfig; import com.wechat.entity.token.AccessToken; import com.wechat.util.message.AccessTokenMessage; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import java.util.Date; /** * Created with IntelliJ IDEA. * * @Description: 获取accessToken * @Author: zhengyw * @Date: 2017/11/30 14:51 * @Version: 1.0 */ public class AccessTokenUtils { private static final Logger logger = LogManager.getLogger(AccessTokenUtils.class); private static String APPID = ""; private static String APPSECRET = ""; public AccessTokenUtils(String appid, String appsecret){ this.APPID = appid; this.APPSECRET = appsecret; } /** * 获取access_token(默认APPID) */ public static AccessToken getAccessToken(){ AccessToken accessToken = CacheConfig.accessTokens.get(APPID); if(accessToken == null){ accessToken = AccessTokenMessage.token(APPID, APPSECRET); if(accessToken != null){ accessToken.setCurrentTime(new Date().getTime()); CacheConfig.accessTokens.put(APPID, accessToken); } } logger.info(String.format("APPID:[%s] 的accessToken:【%s】 expires_in:【%s】", APPID, accessToken.getAccess_token(), accessToken.getExpires_in())); return accessToken; } /** * 获取access_token(指定APPID) * * @param appid 第三方用户唯一凭证 * @param appsecret 第三方用户唯一凭证密钥,即appsecret */ public static AccessToken getAccessToken(String appid, String appsecret){ AccessToken accessToken = CacheConfig.accessTokens.get(appid); if(accessToken == null){ accessToken = AccessTokenMessage.token(appid, appsecret); if(accessToken != null){ accessToken.setCurrentTime(new Date().getTime()); CacheConfig.accessTokens.put(appid, accessToken); } } logger.info(String.format("APPID:[%s] 的accessToken:【%s】 expires_in:【%s】", appid, accessToken.getAccess_token(), accessToken.getExpires_in())); return accessToken; } }
2,339
0.617295
0.6102
75
28.066668
26.736408
86
false
false
0
0
0
0
0
0
0.48
false
false
4
84298a2aefd43c21a2aabed3f5c63e1ae93ed168
652,835,094,634
99b577a1c397919197fecbc7ecf6fa003df96e85
/design-pattern/factory/src/main/java/com.hansn/service/CookFactory.java
bca634e1f606c7ae1a1e98cdadf700f5b52a6008
[]
no_license
nepu-folkgroup/java-advance
https://github.com/nepu-folkgroup/java-advance
d0c4bcafdffe7aedc2b492f50ffd6378c4061aae
92a45771b683b9d01721f7f552c9516e8c0b4c08
refs/heads/master
2021-02-05T16:58:11.032000
2019-11-20T08:52:24
2019-11-20T08:52:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hansn.service; public abstract class CookFactory { public abstract Resaurant createRestaurant(); }
UTF-8
Java
116
java
CookFactory.java
Java
[]
null
[]
package com.hansn.service; public abstract class CookFactory { public abstract Resaurant createRestaurant(); }
116
0.784483
0.784483
5
22.200001
19.177069
49
false
false
0
0
0
0
0
0
0.4
false
false
4
364e4c857102ce7faee048fe2d7b86017ba4e34a
10,977,936,429,197
9757bbb318fa245dcdb099ce356ddbeff5f2fbaf
/src/test/java/g0201_0300/s0233_number_of_digit_one/SolutionTest.java
271391539eed3613a321346e5e882a8162889bb3
[ "MIT" ]
permissive
javadev/LeetCode-in-Java
https://github.com/javadev/LeetCode-in-Java
181aebf56caa51a4442f07466e89b869aa217424
413de2cb56123d3844a1b142eec7e9a8182c78fb
refs/heads/main
2023-08-31T01:46:52.740000
2023-08-30T08:45:06
2023-08-30T08:45:06
426,947,282
103
57
MIT
false
2023-09-14T08:08:08
2021-11-11T09:46:12
2023-09-12T18:14:49
2023-09-14T08:08:07
8,748
91
44
0
Java
false
false
package g0201_0300.s0233_number_of_digit_one; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.jupiter.api.Test; class SolutionTest { @Test void countDigitOne() { assertThat(new Solution().countDigitOne(13), equalTo(6)); } @Test void countDigitOne2() { assertThat(new Solution().countDigitOne(0), equalTo(0)); } }
UTF-8
Java
428
java
SolutionTest.java
Java
[]
null
[]
package g0201_0300.s0233_number_of_digit_one; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.jupiter.api.Test; class SolutionTest { @Test void countDigitOne() { assertThat(new Solution().countDigitOne(13), equalTo(6)); } @Test void countDigitOne2() { assertThat(new Solution().countDigitOne(0), equalTo(0)); } }
428
0.700935
0.658879
18
22.777779
22.594383
65
false
false
0
0
0
0
0
0
0.444444
false
false
4
54b22a1eb504e99779bdfb4e7a82ea7bb10ae54f
2,920,577,827,452
efe51331ee9d71fc7d84394a8e36b95d435efe5d
/src/main/java/org/wargamer2010/signshop/hooks/LWCHook.java
c6d813b3e6c8b74d14d2b1100e2feb9e9946e47d
[ "MIT" ]
permissive
wargamer/SignShop
https://github.com/wargamer/SignShop
98efe041cdb8d23bb5469222583c32e254e04c42
257fb614ce5497e561910da46a3f6812dd3d058a
refs/heads/master
2023-05-31T20:56:17.393000
2022-05-22T00:40:38
2022-05-22T00:40:38
3,630,391
24
96
MIT
false
2023-05-23T20:11:18
2012-03-05T19:15:19
2022-01-19T15:36:18
2023-05-23T20:11:18
2,414
23
50
12
Java
false
false
package org.wargamer2010.signshop.hooks; import com.griefcraft.cache.BlockCache; import org.bukkit.block.Block; import org.bukkit.entity.Player; import com.griefcraft.lwc.LWCPlugin; import com.griefcraft.lwc.LWC; import com.griefcraft.model.Protection; public class LWCHook implements Hook { @Override public String getName() { return "LWC"; } @Override public Boolean canBuild(Player player, Block block) { if(HookManager.getHook("LWC") == null) return true; LWC lwc = (((LWCPlugin) HookManager.getHook("LWC"))).getLWC(); if(lwc != null) if(lwc.findProtection(block) != null) return lwc.canAccessProtection(player, block); return true; } @Override public Boolean protectBlock(Player player, Block block) { if(HookManager.getHook("LWC") == null) return false; LWC lwc = (((LWCPlugin) HookManager.getHook("LWC"))).getLWC(); if(lwc == null) return false; if(lwc.findProtection(block) == null) { Protection protection = new Protection(); Protection prot = lwc.getPhysicalDatabase().registerProtection(BlockCache.getInstance().getBlockId(block), Protection.Type.PRIVATE, block.getWorld().getName(), player.getUniqueId().toString(), "", block.getX(), block.getY(), block.getZ()); lwc.getPhysicalDatabase().saveProtection(prot); return true; } return false; } }
UTF-8
Java
1,521
java
LWCHook.java
Java
[]
null
[]
package org.wargamer2010.signshop.hooks; import com.griefcraft.cache.BlockCache; import org.bukkit.block.Block; import org.bukkit.entity.Player; import com.griefcraft.lwc.LWCPlugin; import com.griefcraft.lwc.LWC; import com.griefcraft.model.Protection; public class LWCHook implements Hook { @Override public String getName() { return "LWC"; } @Override public Boolean canBuild(Player player, Block block) { if(HookManager.getHook("LWC") == null) return true; LWC lwc = (((LWCPlugin) HookManager.getHook("LWC"))).getLWC(); if(lwc != null) if(lwc.findProtection(block) != null) return lwc.canAccessProtection(player, block); return true; } @Override public Boolean protectBlock(Player player, Block block) { if(HookManager.getHook("LWC") == null) return false; LWC lwc = (((LWCPlugin) HookManager.getHook("LWC"))).getLWC(); if(lwc == null) return false; if(lwc.findProtection(block) == null) { Protection protection = new Protection(); Protection prot = lwc.getPhysicalDatabase().registerProtection(BlockCache.getInstance().getBlockId(block), Protection.Type.PRIVATE, block.getWorld().getName(), player.getUniqueId().toString(), "", block.getX(), block.getY(), block.getZ()); lwc.getPhysicalDatabase().saveProtection(prot); return true; } return false; } }
1,521
0.627876
0.625247
49
30.061224
30.134668
143
false
false
0
0
0
0
0
0
0.612245
false
false
4
136d9cfb9fe8a5c705adb76f61debabafb47e0cf
4,440,996,252,364
87393505aac6dc9bbdb312307588ba709e84c5b4
/Soutils/src/com/jeromewagener/soutils/utilities/InetAddressUtilities.java
5a1e08993facdd83d30a4d4e47fe140e2a2edc1f
[ "MIT" ]
permissive
jeromewagener/Soutils
https://github.com/jeromewagener/Soutils
c212463dc71533825770d09ca136f81dd837b0e4
27ab7d6746ab71b296fa624bbfff9fb07c5d7884
refs/heads/master
2020-12-24T13:43:58.020000
2014-01-27T00:32:28
2014-01-27T00:32:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* The MIT License (MIT) Copyright (c) 2012 Jerome Wagener Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ package com.jeromewagener.soutils.utilities; import java.net.InetAddress; import java.net.InterfaceAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; /** A repository for various IP address related functionality */ public class InetAddressUtilities { /** Get the IP version 4 address of the local device * @return the IP version 4 IP address of the local device * @throws SocketException */ public static String getCurrentIPv4Address() throws SocketException { for (Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces(); networkInterfaceEnumeration.hasMoreElements();) { NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement(); for (Enumeration<InetAddress> ipAddressEnumeration = networkInterface.getInetAddresses(); ipAddressEnumeration.hasMoreElements();) { InetAddress inetAddress = ipAddressEnumeration.nextElement(); if (!inetAddress.isLoopbackAddress() && Soutilities.isValidIPv4Address(inetAddress.getHostAddress())) { return inetAddress.getHostAddress().toString(); } } } return null; } /** Get the network mac address of the local device * @return the network mac address of the local device * @throws SocketException * @throws UnknownHostException */ public static String getCurrentNetworkMacAddress() throws SocketException, UnknownHostException { return getNetworkMacAddress(getCurrentIPv4Address()); } /** Get the network mac address associated with a particular IP address * @param ipAddress the IP address for which the mac address is requested * @return the network mac address * @throws UnknownHostException * @throws SocketException */ public static String getNetworkMacAddress(String ipAddress) throws UnknownHostException, SocketException { String networkMacAddressAsString = ""; InetAddress address = InetAddress.getByName(ipAddress); NetworkInterface networkInterface = NetworkInterface.getByInetAddress(address); if (networkInterface != null) { byte[] networkMacAddress = networkInterface.getHardwareAddress(); if (networkMacAddress != null) { for (int i = 0; i < networkMacAddress.length; i++) { networkMacAddressAsString += String.format( "%02X%s", networkMacAddress[i], (i < networkMacAddress.length - 1) ? ":" : ""); } } else { throw new RuntimeException("Cannot determine network mac address"); } } return networkMacAddressAsString; } /** Get a mapping of all assigned IP-addresses to their according broadcast addresses * @return a mapping of all assigned IP-addresses to their according broadcast addresses * @throws SocketException */ public static HashMap<InetAddress, InetAddress> getAllIPsAndAssignedBroadcastAddresses() throws SocketException { HashMap<InetAddress, InetAddress> ipAndBroadcastAddresses = new HashMap<InetAddress, InetAddress>(); Enumeration<?> networkInterfaces; networkInterfaces = NetworkInterface.getNetworkInterfaces(); while(networkInterfaces.hasMoreElements()) { NetworkInterface networkInterface = (NetworkInterface) networkInterfaces.nextElement(); if(networkInterface != null && !networkInterface.isLoopback() && networkInterface.isUp()) { Iterator<?> it = networkInterface.getInterfaceAddresses().iterator(); while (it.hasNext()) { InterfaceAddress interfaceAddress = (InterfaceAddress) it.next(); if (interfaceAddress != null && interfaceAddress.getBroadcast() != null) { ipAndBroadcastAddresses.put(interfaceAddress.getAddress(), interfaceAddress.getBroadcast()); } } } } return ipAndBroadcastAddresses; } }
UTF-8
Java
4,894
java
InetAddressUtilities.java
Java
[ { "context": "/* The MIT License (MIT)\n\nCopyright (c) 2012 Jerome Wagener\n\nPermission is hereby granted, free of charge, to", "end": 59, "score": 0.9998005628585815, "start": 45, "tag": "NAME", "value": "Jerome Wagener" } ]
null
[]
/* The MIT License (MIT) Copyright (c) 2012 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ package com.jeromewagener.soutils.utilities; import java.net.InetAddress; import java.net.InterfaceAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; /** A repository for various IP address related functionality */ public class InetAddressUtilities { /** Get the IP version 4 address of the local device * @return the IP version 4 IP address of the local device * @throws SocketException */ public static String getCurrentIPv4Address() throws SocketException { for (Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces(); networkInterfaceEnumeration.hasMoreElements();) { NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement(); for (Enumeration<InetAddress> ipAddressEnumeration = networkInterface.getInetAddresses(); ipAddressEnumeration.hasMoreElements();) { InetAddress inetAddress = ipAddressEnumeration.nextElement(); if (!inetAddress.isLoopbackAddress() && Soutilities.isValidIPv4Address(inetAddress.getHostAddress())) { return inetAddress.getHostAddress().toString(); } } } return null; } /** Get the network mac address of the local device * @return the network mac address of the local device * @throws SocketException * @throws UnknownHostException */ public static String getCurrentNetworkMacAddress() throws SocketException, UnknownHostException { return getNetworkMacAddress(getCurrentIPv4Address()); } /** Get the network mac address associated with a particular IP address * @param ipAddress the IP address for which the mac address is requested * @return the network mac address * @throws UnknownHostException * @throws SocketException */ public static String getNetworkMacAddress(String ipAddress) throws UnknownHostException, SocketException { String networkMacAddressAsString = ""; InetAddress address = InetAddress.getByName(ipAddress); NetworkInterface networkInterface = NetworkInterface.getByInetAddress(address); if (networkInterface != null) { byte[] networkMacAddress = networkInterface.getHardwareAddress(); if (networkMacAddress != null) { for (int i = 0; i < networkMacAddress.length; i++) { networkMacAddressAsString += String.format( "%02X%s", networkMacAddress[i], (i < networkMacAddress.length - 1) ? ":" : ""); } } else { throw new RuntimeException("Cannot determine network mac address"); } } return networkMacAddressAsString; } /** Get a mapping of all assigned IP-addresses to their according broadcast addresses * @return a mapping of all assigned IP-addresses to their according broadcast addresses * @throws SocketException */ public static HashMap<InetAddress, InetAddress> getAllIPsAndAssignedBroadcastAddresses() throws SocketException { HashMap<InetAddress, InetAddress> ipAndBroadcastAddresses = new HashMap<InetAddress, InetAddress>(); Enumeration<?> networkInterfaces; networkInterfaces = NetworkInterface.getNetworkInterfaces(); while(networkInterfaces.hasMoreElements()) { NetworkInterface networkInterface = (NetworkInterface) networkInterfaces.nextElement(); if(networkInterface != null && !networkInterface.isLoopback() && networkInterface.isUp()) { Iterator<?> it = networkInterface.getInterfaceAddresses().iterator(); while (it.hasNext()) { InterfaceAddress interfaceAddress = (InterfaceAddress) it.next(); if (interfaceAddress != null && interfaceAddress.getBroadcast() != null) { ipAndBroadcastAddresses.put(interfaceAddress.getAddress(), interfaceAddress.getBroadcast()); } } } } return ipAndBroadcastAddresses; } }
4,886
0.768492
0.765836
116
41.189655
33.851837
115
false
false
0
0
0
0
0
0
2.163793
false
false
4
d5a33b4793aee77b7dcf4ced6ddbcbc8212e4a11
22,471,268,939,219
4340bbcb8c82661da2cb722001082c6443513df2
/src/de/bfhh/stilleoertchenhamburg/activites/ActivityMenuBase.java
155694aa31519b80091dccfd022d48b39fd67b78
[]
no_license
JenniferSpry/Toilettenfinder-Hamburg
https://github.com/JenniferSpry/Toilettenfinder-Hamburg
d59a654cdd194619e6d6a22a330ca04ef3bd33e0
5c1980229429ac619fbab92ca1ea0dc001217649
refs/heads/master
2016-09-05T09:27:02.933000
2015-09-11T10:36:38
2015-09-11T10:36:38
42,302,663
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.bfhh.stilleoertchenhamburg.activites; import de.bfhh.stilleoertchenhamburg.R; import android.content.Intent; import android.view.Menu; import android.view.MenuItem; /** * Magical Menu providing class because I don't want to copy paste this into * every Activity * * @author Jenne */ public class ActivityMenuBase extends ActivityBase { @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { // if user clicks on the app icon (home button), current activity is // closed case android.R.id.home: this.finish(); return true; case R.id.menu_map: Intent map = new Intent(this, ActivityMap.class); // set flag for intent to get activity from stack if it's already // running map.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(map); return true; case R.id.menu_impressum: Intent activityImpressum = new Intent(getApplicationContext(), ActivityImpressum.class); activityImpressum.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(activityImpressum); return true; case R.id.menu_toi_list: Intent activityToiletList = new Intent(getApplicationContext(), ActivityToiletList.class); activityToiletList.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(activityToiletList); return true; default: return super.onOptionsItemSelected(item); } } }
UTF-8
Java
1,687
java
ActivityMenuBase.java
Java
[ { "context": "y paste this into\n * every Activity\n * \n * @author Jenne\n */\n\npublic class ActivityMenuBase extends Activi", "end": 297, "score": 0.9997214078903198, "start": 292, "tag": "NAME", "value": "Jenne" } ]
null
[]
package de.bfhh.stilleoertchenhamburg.activites; import de.bfhh.stilleoertchenhamburg.R; import android.content.Intent; import android.view.Menu; import android.view.MenuItem; /** * Magical Menu providing class because I don't want to copy paste this into * every Activity * * @author Jenne */ public class ActivityMenuBase extends ActivityBase { @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { // if user clicks on the app icon (home button), current activity is // closed case android.R.id.home: this.finish(); return true; case R.id.menu_map: Intent map = new Intent(this, ActivityMap.class); // set flag for intent to get activity from stack if it's already // running map.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(map); return true; case R.id.menu_impressum: Intent activityImpressum = new Intent(getApplicationContext(), ActivityImpressum.class); activityImpressum.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(activityImpressum); return true; case R.id.menu_toi_list: Intent activityToiletList = new Intent(getApplicationContext(), ActivityToiletList.class); activityToiletList.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(activityToiletList); return true; default: return super.onOptionsItemSelected(item); } } }
1,687
0.74511
0.74511
57
28.596491
23.175804
76
false
false
0
0
0
0
0
0
2.122807
false
false
4
8452c29c640ad253f6dd8ad19eac8d7f836b0c0f
32,220,844,717,967
ee4c67c8b629b50f9f213e6a655c55b672c7300c
/Asst-5/src/edu/neu/cs5200/asst5/orm/models/Tower.java
c89151fe40523a39bc2e65dcaabb0680b175650d
[]
no_license
ravisantoshgudimetla/CS5200
https://github.com/ravisantoshgudimetla/CS5200
23707185f6401047fad6e610cc33c4a06a5e2001
b0cda34cbce1d355caaf22529dfd84c52cf42247
refs/heads/master
2021-01-18T22:01:09.980000
2016-09-09T03:13:42
2016-09-09T03:13:42
32,903,469
0
0
null
false
2016-06-11T04:18:40
2015-03-26T02:37:23
2015-04-22T00:11:17
2016-06-11T04:18:40
3,423
0
0
0
Java
null
null
package edu.neu.cs5200.asst5.orm.models; import java.util.List; import javax.persistence.*; @Entity public class Tower { @Id private int id; private String name; private double height; private int sides; @ManyToOne @JoinColumn(name="siteId") private Site site; @OneToMany(mappedBy="tower", cascade=CascadeType.ALL, orphanRemoval=true) private List<Equipment> equipments; public Tower() { super(); } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public double getHeight() { return this.height; } public void setHeight(double height) { this.height = height; } public int getSides() { return this.sides; } public void setSides(int sides) { this.sides = sides; } }
UTF-8
Java
873
java
Tower.java
Java
[]
null
[]
package edu.neu.cs5200.asst5.orm.models; import java.util.List; import javax.persistence.*; @Entity public class Tower { @Id private int id; private String name; private double height; private int sides; @ManyToOne @JoinColumn(name="siteId") private Site site; @OneToMany(mappedBy="tower", cascade=CascadeType.ALL, orphanRemoval=true) private List<Equipment> equipments; public Tower() { super(); } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public double getHeight() { return this.height; } public void setHeight(double height) { this.height = height; } public int getSides() { return this.sides; } public void setSides(int sides) { this.sides = sides; } }
873
0.678121
0.672394
53
15.45283
14.356073
74
false
false
0
0
0
0
0
0
1.283019
false
false
4
6e5e2caa51b1aadacadc4c9f7e846bb7e4ca11ac
16,192,026,751,547
2092ca58e1a897c431be7f224307c8a7bd22c085
/com/sinch/android/rtc/internal/service/http/SinchHttpServiceObserver.java
391f0c6b1d2c8d2732cd93fa18b73abe581a3824
[]
no_license
atresumes/Tele-1
https://github.com/atresumes/Tele-1
33f4bc7445a136fc666d9c581d6b9395c1d8ec44
96aeb6b34e41d553ec79deaca332e974dea29c24
refs/heads/master
2020-03-21T11:24:53.093000
2018-06-24T18:19:24
2018-06-24T18:19:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sinch.android.rtc.internal.service.http; public interface SinchHttpServiceObserver { void onHttpRequestSent(String str, String str2, byte[] bArr); }
UTF-8
Java
166
java
SinchHttpServiceObserver.java
Java
[]
null
[]
package com.sinch.android.rtc.internal.service.http; public interface SinchHttpServiceObserver { void onHttpRequestSent(String str, String str2, byte[] bArr); }
166
0.789157
0.783133
5
32.200001
26.813429
65
false
false
0
0
0
0
0
0
0.8
false
false
4
241ca6c7d0c24787a32fd0d8a2665de3fb3701ec
2,954,937,565,122
787f8173c14793ecd496ee533aba954aefd5cb83
/src/main/java/ch/bfh/btx8081/weiss/model/Drug.java
3ff9f8a6959450f23a4d088dc93b71964c6e7b1d
[]
no_license
k-tipp/ch.bfh.btx8081.w2015.weiss
https://github.com/k-tipp/ch.bfh.btx8081.w2015.weiss
92d44b177f88094b12a41b70b17eea5003a8dfc9
64be3f6e1496e6f5b8c6a8c43e391a7e8954a1bf
refs/heads/master
2021-01-21T14:01:47.542000
2016-05-26T12:03:01
2016-05-26T12:03:01
42,653,573
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ch.bfh.btx8081.weiss.model; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; /** * The Class DangerToOthers represents the status of the danger to other * indicator for a patient. */ @Entity public class Drug { /** The drug id. */ @Id @GeneratedValue(strategy = GenerationType.TABLE) private long drugID = 0; /** The drug name. */ private String name = null; /** The drug active ingredient. */ private String active_ingredient = null; /** The drug dosage form. */ private String dosage_form = null; /** The drug picture. */ private String picture = null; /** The drug compendium link. */ private String compendium = null; /** The medications for this patient. */ // Eager loading for being able to display stuff with toString(), without // explicitly loading @OneToMany(mappedBy = "drug", fetch = FetchType.EAGER) private List<Medication> medications = null; /** * Instantiates a new drug. */ public Drug() { } public Drug(int id) { setDrugID(id); } public long getDrugID() { return drugID; } public void setDrugID(long drugID) { this.drugID = drugID; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPicture() { return picture; } public void setPicture(String picture) { this.picture = picture; } public String getActive_ingredient() { return active_ingredient; } public void setActive_ingredient(String active_ingredient) { this.active_ingredient = active_ingredient; } public String getDosageForm() { return dosage_form; } public void setDosageForm(String dosage_form) { this.dosage_form = dosage_form; } public String getCompendium() { return compendium; } public void setCompendium(String compendium) { this.compendium = compendium; } }
UTF-8
Java
2,020
java
Drug.java
Java
[]
null
[]
package ch.bfh.btx8081.weiss.model; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; /** * The Class DangerToOthers represents the status of the danger to other * indicator for a patient. */ @Entity public class Drug { /** The drug id. */ @Id @GeneratedValue(strategy = GenerationType.TABLE) private long drugID = 0; /** The drug name. */ private String name = null; /** The drug active ingredient. */ private String active_ingredient = null; /** The drug dosage form. */ private String dosage_form = null; /** The drug picture. */ private String picture = null; /** The drug compendium link. */ private String compendium = null; /** The medications for this patient. */ // Eager loading for being able to display stuff with toString(), without // explicitly loading @OneToMany(mappedBy = "drug", fetch = FetchType.EAGER) private List<Medication> medications = null; /** * Instantiates a new drug. */ public Drug() { } public Drug(int id) { setDrugID(id); } public long getDrugID() { return drugID; } public void setDrugID(long drugID) { this.drugID = drugID; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPicture() { return picture; } public void setPicture(String picture) { this.picture = picture; } public String getActive_ingredient() { return active_ingredient; } public void setActive_ingredient(String active_ingredient) { this.active_ingredient = active_ingredient; } public String getDosageForm() { return dosage_form; } public void setDosageForm(String dosage_form) { this.dosage_form = dosage_form; } public String getCompendium() { return compendium; } public void setCompendium(String compendium) { this.compendium = compendium; } }
2,020
0.709406
0.706931
106
18.066038
18.213238
74
false
false
0
0
0
0
0
0
1.056604
false
false
4
8d60d5c0c86f8c6bceaa85b0a6439829883dd300
39,384,850,105,865
9adf09424591491ae58642450e5a46817f8cc33c
/src/main/java/com/rocksea/api/entry/GPS.java
a799f266d3fe327babbb215fb656434707278c96
[]
no_license
PandaAshe/webapi
https://github.com/PandaAshe/webapi
139a39fdad87ba753a022cf7768385798168063d
f3cdca9cfc9b9de744dc29d55dfeda770cc0fa87
refs/heads/master
2021-01-21T01:26:04.526000
2017-08-30T12:14:35
2017-08-30T12:14:35
101,876,571
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rocksea.api.entry; import org.json.JSONException; import org.json.JSONObject; /** * Created by Mrw on 2017/8/14. * */ public class GPS { public byte GpsIsValid; public double GpsLongitude; public double GpsLatitude; public String GPSJson(){ JSONObject object = new JSONObject(); try { object.put("GpsIsValid",GpsIsValid); object.put("GpsLongitude",GpsLongitude); object.put("GpsLatitude",GpsLatitude); }catch (JSONException e){ e.printStackTrace(); } return object.toString(); } }
UTF-8
Java
609
java
GPS.java
Java
[ { "context": "on;\nimport org.json.JSONObject;\n\n/**\n * Created by Mrw on 2017/8/14.\n *\n */\n\npublic class GPS\n{\n publ", "end": 113, "score": 0.9995194673538208, "start": 110, "tag": "USERNAME", "value": "Mrw" } ]
null
[]
package com.rocksea.api.entry; import org.json.JSONException; import org.json.JSONObject; /** * Created by Mrw on 2017/8/14. * */ public class GPS { public byte GpsIsValid; public double GpsLongitude; public double GpsLatitude; public String GPSJson(){ JSONObject object = new JSONObject(); try { object.put("GpsIsValid",GpsIsValid); object.put("GpsLongitude",GpsLongitude); object.put("GpsLatitude",GpsLatitude); }catch (JSONException e){ e.printStackTrace(); } return object.toString(); } }
609
0.615764
0.604269
29
20
17.174561
52
false
false
0
0
0
0
0
0
0.517241
false
false
4
bd486f229ec0f6b3b92494a15a4c6966baf4e777
16,853,451,679,132
0e9782fc0ef8bd8a64f41620e6a8fd40a4c2d21d
/src/main/java/com/example/VehicleManagementSystem/controller/UserController.java
99a76bfbe1949c86e2172bf4d778aef28c5f6505
[]
no_license
khushanksethi/VehicleMangementSystem
https://github.com/khushanksethi/VehicleMangementSystem
79d01773c0124bac4b9f5bb351fd6882cbdfcf55
b8a6431b5b636520c4af8e251fb0ccf8a2445cf6
refs/heads/master
2022-12-07T10:54:16.401000
2020-08-26T06:28:09
2020-08-26T06:28:09
290,224,918
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.VehicleManagementSystem.controller; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.example.VehicleManagementSystem.model.UserModel; import com.example.VehicleManagementSystem.model.VehicleModel; import com.example.VehicleManagementSystem.repository.UserRepository; import com.example.VehicleManagementSystem.repository.VehicleRepository; import com.example.VehicleManagementSystem.service.UserService; @RestController public class UserController { @Autowired UserService userservice; @Autowired UserRepository userRepo; @Autowired VehicleRepository vehicleRepo; //create new User or Update existing User details @GetMapping("/createUser") @ResponseStatus(HttpStatus.CREATED) public UserModel saveOrUpdateUser(@RequestBody UserModel user, Model m){ return userservice.saveOrUpdateUser(user,m); } //retrieve User details using User id @GetMapping("/getUser") public @ResponseBody UserModel getUser(@RequestParam("userId") int userId) { return userRepo.findById(userId); } //retrieve user details using vehicle plate number @GetMapping("/getUserByVehicle") public @ResponseBody UserModel getUserByVehicle(@RequestParam("plateNumber") String plateNumber){ return userRepo.findUserByVehicle(plateNumber); } //retrieve details of set of vehicles owned by given user @GetMapping("/getVehiclesByUser") public @ResponseBody Set<VehicleModel> getVehiclesByUser(@RequestParam("userId") int userId){ return vehicleRepo.getVehiclesByUser(userId); } }
UTF-8
Java
2,009
java
UserController.java
Java
[]
null
[]
package com.example.VehicleManagementSystem.controller; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.example.VehicleManagementSystem.model.UserModel; import com.example.VehicleManagementSystem.model.VehicleModel; import com.example.VehicleManagementSystem.repository.UserRepository; import com.example.VehicleManagementSystem.repository.VehicleRepository; import com.example.VehicleManagementSystem.service.UserService; @RestController public class UserController { @Autowired UserService userservice; @Autowired UserRepository userRepo; @Autowired VehicleRepository vehicleRepo; //create new User or Update existing User details @GetMapping("/createUser") @ResponseStatus(HttpStatus.CREATED) public UserModel saveOrUpdateUser(@RequestBody UserModel user, Model m){ return userservice.saveOrUpdateUser(user,m); } //retrieve User details using User id @GetMapping("/getUser") public @ResponseBody UserModel getUser(@RequestParam("userId") int userId) { return userRepo.findById(userId); } //retrieve user details using vehicle plate number @GetMapping("/getUserByVehicle") public @ResponseBody UserModel getUserByVehicle(@RequestParam("plateNumber") String plateNumber){ return userRepo.findUserByVehicle(plateNumber); } //retrieve details of set of vehicles owned by given user @GetMapping("/getVehiclesByUser") public @ResponseBody Set<VehicleModel> getVehiclesByUser(@RequestParam("userId") int userId){ return vehicleRepo.getVehiclesByUser(userId); } }
2,009
0.8223
0.8223
60
32.483334
27.779783
98
false
false
0
0
0
0
0
0
1.066667
false
false
4
1c66f1085809d99941d66367bcda6bd7769f95e3
28,827,820,500,504
b5f7649421b5e05d5b9e7fcb96be7f2fbab48bbe
/hoverlibs/src/main/java/ichen/chu/hoverlibs/ContentDisplay.java
69ff1a5afd24f51d61c565101c8e58b85b0ee8e4
[ "MIT" ]
permissive
VHCC/DrawNSend2019
https://github.com/VHCC/DrawNSend2019
49bdc30710f02ce31825ca284dd0f7a768da85d9
d75467a7a5865187f2b9f09cc31016c7a2b15de8
refs/heads/master_new
2020-08-29T10:03:54.830000
2019-11-27T18:20:17
2019-11-27T18:20:17
218,000,904
1
0
null
false
2019-11-20T08:37:31
2019-10-28T08:37:09
2019-11-20T08:34:40
2019-11-20T08:37:31
550
0
0
0
Java
false
false
/* * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *    http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ichen.chu.hoverlibs; import android.content.Context; import android.graphics.Color; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; /** * Rectangular area that displays {@link Content}. A {@code ContentDisplay} also renders a caret * that points at a tab. */ class ContentDisplay extends RelativeLayout { private static final String TAG = "ContentDisplay"; private View mContainer; private FrameLayout mContentView; private Drawable mContentBackground; private TabSelectorView mTabSelectorView; private FloatingTab mSelectedTab; private Content mContent; private boolean mIsVisible = false; private final ViewTreeObserver.OnGlobalLayoutListener mMyVisibilityWatcher = new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mIsVisible && VISIBLE != getVisibility()) { mIsVisible = false; // Went from visible to not-visible. Hide tab selector to avoid visual artifacts // when we appear again. mTabSelectorView.setVisibility(INVISIBLE); } else { mIsVisible = true; } } }; private final FloatingTab.OnPositionChangeListener mOnTabPositionChangeListener = new FloatingTab.OnPositionChangeListener() { @Override public void onPositionChange(@NonNull Point position) { Log.d(TAG, mSelectedTab + " tab moved to " + position); updateTabSelectorPosition(); setPadding(0, position.y + (mSelectedTab.getTabSize() / 2), 0, 0); // We have received an affirmative position for the selected tab. Show tab selector. mTabSelectorView.setVisibility(VISIBLE); } @Override public void onDockChange(@NonNull Point dock) { // No-op. } }; public ContentDisplay(@NonNull Context context) { super(context); init(); } private void init() { LayoutInflater.from(getContext()).inflate(R.layout.view_hover_menu_content, this, true); mContainer = findViewById(R.id.container); expandToScreenBounds(); int backgroundCornerRadiusPx = (int) getResources().getDimension(R.dimen.hover_navigator_corner_radius); mTabSelectorView = (TabSelectorView) findViewById(R.id.tabselector); mTabSelectorView.setPadding(backgroundCornerRadiusPx, 0, backgroundCornerRadiusPx, 0); mContentView = (FrameLayout) findViewById(R.id.view_content_container); mContentBackground = ContextCompat.getDrawable(getContext(), R.drawable.round_rect_white); mContentView.setBackgroundDrawable(mContentBackground); getViewTreeObserver().addOnGlobalLayoutListener(mMyVisibilityWatcher); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); ViewGroup.LayoutParams layoutParams = getLayoutParams(); layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; setLayoutParams(layoutParams); } public void enableDebugMode(boolean debugMode) { if (debugMode) { setBackgroundColor(0x88FFFF00); } else { setBackgroundColor(Color.TRANSPARENT); } } public void selectedTabIs(@Nullable FloatingTab tab) { // Disconnect from old selected tab. if (null != mSelectedTab) { mSelectedTab.removeOnPositionChangeListener(mOnTabPositionChangeListener); } mSelectedTab = tab; // Connect to new selected tab. if (null != mSelectedTab) { updateTabSelectorPosition(); mSelectedTab.addOnPositionChangeListener(mOnTabPositionChangeListener); } else { mTabSelectorView.setVisibility(INVISIBLE); } } private void updateTabSelectorPosition() { Point tabPosition = mSelectedTab.getPosition(); Log.d(TAG, "Updating tab position to " + tabPosition.x); mTabSelectorView.setSelectorPosition(tabPosition.x); } public void displayContent(@Nullable Content content) { if (content == mContent) { // If content hasn't changed then we don't need to do anything. return; } if (null != mContent) { mContentView.removeView(mContent.getView()); mContent.onHidden(); } mContent = content; if (null != mContent) { mContentView.addView(mContent.getView()); mContent.onShown(); if (content.isFullscreen()) { expandToScreenBounds(); } else { wrapContent(); } } } public void expandToScreenBounds() { RelativeLayout.LayoutParams layoutParams = (LayoutParams) mContainer.getLayoutParams(); layoutParams.height = 0; layoutParams.addRule(ALIGN_PARENT_TOP); layoutParams.addRule(ALIGN_PARENT_BOTTOM); mContainer.setLayoutParams(layoutParams); } public void wrapContent() { RelativeLayout.LayoutParams layoutParams = (LayoutParams) mContainer.getLayoutParams(); layoutParams.height = LayoutParams.WRAP_CONTENT; layoutParams.addRule(ALIGN_PARENT_TOP); layoutParams.addRule(ALIGN_PARENT_BOTTOM, 0); // This means "remove rule". Can't use removeRule() until API 17. mContainer.setLayoutParams(layoutParams); } }
UTF-8
Java
6,521
java
ContentDisplay.java
Java
[]
null
[]
/* * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *    http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ichen.chu.hoverlibs; import android.content.Context; import android.graphics.Color; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; /** * Rectangular area that displays {@link Content}. A {@code ContentDisplay} also renders a caret * that points at a tab. */ class ContentDisplay extends RelativeLayout { private static final String TAG = "ContentDisplay"; private View mContainer; private FrameLayout mContentView; private Drawable mContentBackground; private TabSelectorView mTabSelectorView; private FloatingTab mSelectedTab; private Content mContent; private boolean mIsVisible = false; private final ViewTreeObserver.OnGlobalLayoutListener mMyVisibilityWatcher = new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mIsVisible && VISIBLE != getVisibility()) { mIsVisible = false; // Went from visible to not-visible. Hide tab selector to avoid visual artifacts // when we appear again. mTabSelectorView.setVisibility(INVISIBLE); } else { mIsVisible = true; } } }; private final FloatingTab.OnPositionChangeListener mOnTabPositionChangeListener = new FloatingTab.OnPositionChangeListener() { @Override public void onPositionChange(@NonNull Point position) { Log.d(TAG, mSelectedTab + " tab moved to " + position); updateTabSelectorPosition(); setPadding(0, position.y + (mSelectedTab.getTabSize() / 2), 0, 0); // We have received an affirmative position for the selected tab. Show tab selector. mTabSelectorView.setVisibility(VISIBLE); } @Override public void onDockChange(@NonNull Point dock) { // No-op. } }; public ContentDisplay(@NonNull Context context) { super(context); init(); } private void init() { LayoutInflater.from(getContext()).inflate(R.layout.view_hover_menu_content, this, true); mContainer = findViewById(R.id.container); expandToScreenBounds(); int backgroundCornerRadiusPx = (int) getResources().getDimension(R.dimen.hover_navigator_corner_radius); mTabSelectorView = (TabSelectorView) findViewById(R.id.tabselector); mTabSelectorView.setPadding(backgroundCornerRadiusPx, 0, backgroundCornerRadiusPx, 0); mContentView = (FrameLayout) findViewById(R.id.view_content_container); mContentBackground = ContextCompat.getDrawable(getContext(), R.drawable.round_rect_white); mContentView.setBackgroundDrawable(mContentBackground); getViewTreeObserver().addOnGlobalLayoutListener(mMyVisibilityWatcher); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); ViewGroup.LayoutParams layoutParams = getLayoutParams(); layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; setLayoutParams(layoutParams); } public void enableDebugMode(boolean debugMode) { if (debugMode) { setBackgroundColor(0x88FFFF00); } else { setBackgroundColor(Color.TRANSPARENT); } } public void selectedTabIs(@Nullable FloatingTab tab) { // Disconnect from old selected tab. if (null != mSelectedTab) { mSelectedTab.removeOnPositionChangeListener(mOnTabPositionChangeListener); } mSelectedTab = tab; // Connect to new selected tab. if (null != mSelectedTab) { updateTabSelectorPosition(); mSelectedTab.addOnPositionChangeListener(mOnTabPositionChangeListener); } else { mTabSelectorView.setVisibility(INVISIBLE); } } private void updateTabSelectorPosition() { Point tabPosition = mSelectedTab.getPosition(); Log.d(TAG, "Updating tab position to " + tabPosition.x); mTabSelectorView.setSelectorPosition(tabPosition.x); } public void displayContent(@Nullable Content content) { if (content == mContent) { // If content hasn't changed then we don't need to do anything. return; } if (null != mContent) { mContentView.removeView(mContent.getView()); mContent.onHidden(); } mContent = content; if (null != mContent) { mContentView.addView(mContent.getView()); mContent.onShown(); if (content.isFullscreen()) { expandToScreenBounds(); } else { wrapContent(); } } } public void expandToScreenBounds() { RelativeLayout.LayoutParams layoutParams = (LayoutParams) mContainer.getLayoutParams(); layoutParams.height = 0; layoutParams.addRule(ALIGN_PARENT_TOP); layoutParams.addRule(ALIGN_PARENT_BOTTOM); mContainer.setLayoutParams(layoutParams); } public void wrapContent() { RelativeLayout.LayoutParams layoutParams = (LayoutParams) mContainer.getLayoutParams(); layoutParams.height = LayoutParams.WRAP_CONTENT; layoutParams.addRule(ALIGN_PARENT_TOP); layoutParams.addRule(ALIGN_PARENT_BOTTOM, 0); // This means "remove rule". Can't use removeRule() until API 17. mContainer.setLayoutParams(layoutParams); } }
6,521
0.672649
0.669121
184
34.429348
29.68211
130
false
false
0
0
0
0
0
0
0.51087
false
false
4
cf1782e9a61e4cdf4774c35a00927ef0b3bb5865
9,302,899,191,566
ee436cebd6e9051146d14b18b8da15f859afbf39
/src/main/java/model/enums/RequestType.java
694bf145f292caa57ea49a12ef510a12d99c8902
[]
no_license
AlexMostipan/TimeTracking
https://github.com/AlexMostipan/TimeTracking
b8342b2c2bebfb85d6c6cd15be8dda7e670f010b
b1f230628d504e28b28ecc3e12c346070bc0e4f5
refs/heads/master
2022-06-29T00:58:43.814000
2019-10-16T09:39:50
2019-10-16T09:39:50
189,224,502
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.enums; public enum RequestType { GETTING, DELETING }
UTF-8
Java
72
java
RequestType.java
Java
[]
null
[]
package model.enums; public enum RequestType { GETTING, DELETING }
72
0.736111
0.736111
5
13.4
10.669583
25
false
false
0
0
0
0
0
0
0.4
false
false
4
59ab95d7f7a2875b01719f579df31d9f2c273e13
20,504,173,895,160
c0e63f1574631cb9976611662e05ec4d36f3369a
/FluxoCaixa/src/br/com/fluxocaixa/dao/InterfaceDAO.java
50068b91350ed03e207eddeee832486ea5bee8a5
[]
no_license
oGutortolan/fluxo-caixa-java-desktop
https://github.com/oGutortolan/fluxo-caixa-java-desktop
8ec6561301959aeb3695a14aa7ce8da577e059d6
84375a414725950c7eb9f6af70ce5ba45dd6a4ab
refs/heads/master
2023-01-15T22:58:46.064000
2020-11-26T00:33:29
2020-11-26T00:33:29
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.fluxocaixa.dao; import java.util.List; public interface InterfaceDAO<T> { public void inserir(T referencia); public void deletar(T referencia); public List<T> buscar(); public T buscarId(Integer id); public void atualizar(T referencia); }
UTF-8
Java
261
java
InterfaceDAO.java
Java
[]
null
[]
package br.com.fluxocaixa.dao; import java.util.List; public interface InterfaceDAO<T> { public void inserir(T referencia); public void deletar(T referencia); public List<T> buscar(); public T buscarId(Integer id); public void atualizar(T referencia); }
261
0.758621
0.758621
11
22.727272
14.346941
37
false
false
0
0
0
0
0
0
1.090909
false
false
4
d78185e1ee3d3a5e554e80fabfa43f21782863dd
5,205,500,389,740
9645771f3af6756aa65fbbfe18c6c761ec9305bf
/Practice_DN_auto/src/FinalPractice2/Khoa.java
cab02cb54a6669bc122cce6f8569e21c8dbba672
[]
no_license
vanvtt-0952/Java-example
https://github.com/vanvtt-0952/Java-example
126f1a93da068d422ccfb3d9344006165428fa5b
ed1bc0694103d989f20b8076089b2d66022d90f4
refs/heads/master
2023-03-18T16:39:09.031000
2023-03-18T05:50:33
2023-03-18T06:24:48
243,703,367
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FinalPractice2; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; public class Khoa { private String ten; private List<SinhVien> listSinhVien; public Khoa(String ten, List<SinhVien> listSinhVien) { this.ten = ten; this.listSinhVien = listSinhVien; } // tổng số sinh viên chính quy của khoa public int countSinhVienChinhQuy() { // cách truyền thống tường minh =)) // int count = 0; // for (SinhVien student : this.getListSinhVien()) { // if (student instanceof SinhVienChinhQuy) { // count += 1; // } // } // return count; // cach 2 return (int) this.getListSinhVien().stream().filter(student -> student instanceof SinhVienChinhQuy).count(); } // sinh viên có điểm đầu vào cao nhất của khoa public List<SinhVien> sinhVienCoDiemDauVaoCaoNhat() { // Float maxPoint = Float.MIN_VALUE; // List<SinhVien> listSinhVienCoDiemCaoNhat = new ArrayList<SinhVien>(); // // for (SinhVien sinhVien : this.getListSinhVien()) { // if (maxPoint > sinhVien.getDiemDauVao()) { // continue; // } // if (maxPoint < sinhVien.getDiemDauVao()) { // listSinhVienCoDiemCaoNhat.clear(); // maxPoint = sinhVien.getDiemDauVao(); // } // listSinhVienCoDiemCaoNhat.add(sinhVien); // } // // return listSinhVienCoDiemCaoNhat; // Cach 2 /* * Lấy ra điểm cao nhất * Lấy ra danh sách sinh viên có điểm bằng điểm cao nhất */ Float max = (float) this.getListSinhVien() .stream() .mapToDouble(v -> v.getDiemDauVao()) .max().orElse(0); return this.listSinhVien.stream().filter(sv -> sv.getDiemDauVao() == max).collect(Collectors.toList()); // cái này dùng khi chỉ tìm ra sinh viên điểm cao nhất - sinh viên đầu tiên // Sau đó lại lấy điểm tìm ra sinh viên có cùng số điểm trên :v hơi vòng vo nhưng vẫn ra kết quả :v // SinhVien sinhVienHasMaxByPoint = this.getListSinhVien() // .stream() // .max(Comparator.comparing(SinhVien::getDiemDauVao)) // .orElse(null); // return this.listSinhVien.stream().filter(sv -> sv.getDiemDauVao() == sinhVienHasMaxByPoint.getDiemDauVao()).collect(Collectors.toList()); } public void hienThiThongTin() { System.out.println("===== Khoa "); System.out.println("Name: " + ten); System.out.println("____ Danh sach sinh vien cua khoa ____ "); listSinhVien.forEach(sv -> sv.hienThiThongTin()); } public String getTen() { return ten; } public void setTen(String ten) { this.ten = ten; } public List<SinhVien> getListSinhVien() { return listSinhVien; } public void setListSinhVien(List<SinhVien> listSinhVien) { this.listSinhVien = listSinhVien; } }
UTF-8
Java
2,821
java
Khoa.java
Java
[]
null
[]
package FinalPractice2; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; public class Khoa { private String ten; private List<SinhVien> listSinhVien; public Khoa(String ten, List<SinhVien> listSinhVien) { this.ten = ten; this.listSinhVien = listSinhVien; } // tổng số sinh viên chính quy của khoa public int countSinhVienChinhQuy() { // cách truyền thống tường minh =)) // int count = 0; // for (SinhVien student : this.getListSinhVien()) { // if (student instanceof SinhVienChinhQuy) { // count += 1; // } // } // return count; // cach 2 return (int) this.getListSinhVien().stream().filter(student -> student instanceof SinhVienChinhQuy).count(); } // sinh viên có điểm đầu vào cao nhất của khoa public List<SinhVien> sinhVienCoDiemDauVaoCaoNhat() { // Float maxPoint = Float.MIN_VALUE; // List<SinhVien> listSinhVienCoDiemCaoNhat = new ArrayList<SinhVien>(); // // for (SinhVien sinhVien : this.getListSinhVien()) { // if (maxPoint > sinhVien.getDiemDauVao()) { // continue; // } // if (maxPoint < sinhVien.getDiemDauVao()) { // listSinhVienCoDiemCaoNhat.clear(); // maxPoint = sinhVien.getDiemDauVao(); // } // listSinhVienCoDiemCaoNhat.add(sinhVien); // } // // return listSinhVienCoDiemCaoNhat; // Cach 2 /* * Lấy ra điểm cao nhất * Lấy ra danh sách sinh viên có điểm bằng điểm cao nhất */ Float max = (float) this.getListSinhVien() .stream() .mapToDouble(v -> v.getDiemDauVao()) .max().orElse(0); return this.listSinhVien.stream().filter(sv -> sv.getDiemDauVao() == max).collect(Collectors.toList()); // cái này dùng khi chỉ tìm ra sinh viên điểm cao nhất - sinh viên đầu tiên // Sau đó lại lấy điểm tìm ra sinh viên có cùng số điểm trên :v hơi vòng vo nhưng vẫn ra kết quả :v // SinhVien sinhVienHasMaxByPoint = this.getListSinhVien() // .stream() // .max(Comparator.comparing(SinhVien::getDiemDauVao)) // .orElse(null); // return this.listSinhVien.stream().filter(sv -> sv.getDiemDauVao() == sinhVienHasMaxByPoint.getDiemDauVao()).collect(Collectors.toList()); } public void hienThiThongTin() { System.out.println("===== Khoa "); System.out.println("Name: " + ten); System.out.println("____ Danh sach sinh vien cua khoa ____ "); listSinhVien.forEach(sv -> sv.hienThiThongTin()); } public String getTen() { return ten; } public void setTen(String ten) { this.ten = ten; } public List<SinhVien> getListSinhVien() { return listSinhVien; } public void setListSinhVien(List<SinhVien> listSinhVien) { this.listSinhVien = listSinhVien; } }
2,821
0.675596
0.673395
96
27.385416
27.62561
142
false
false
0
0
0
0
0
0
1.916667
false
false
4
c7f8b70a0539a86911d888c696cabad249c9b7fc
1,580,548,011,221
ee256e33f4c10eb9d6d56416f16f874c68123461
/coplime/coplime-ejb/src/java/DAO/impl/JPA_mysql/NotificacionDAO_impl.java
da619f8403fade52b2bd3e772034582cfc8afc89
[]
no_license
wigtor/proyecto-PINGESO
https://github.com/wigtor/proyecto-PINGESO
53ff2d09d6c922f43168bc5fda4b9275d10c893e
35b155ba403dfe32cb7856e3ee350e2094e76737
refs/heads/master
2016-09-06T00:19:11.439000
2013-09-05T17:48:09
2013-09-05T17:48:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package DAO.impl.JPA_mysql; import DAO.interfaces.NotificacionDAO; import entities.Notificacion; import java.util.Collection; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.Query; /** * * @author victor */ public class NotificacionDAO_impl extends genericDAO_impl<Notificacion> implements NotificacionDAO{ public NotificacionDAO_impl(EntityManager em) { super(Notificacion.class); this.em = em; } //Poner otras funciones extra que sólo haga este DAO @Override public Integer countPorRevisar(String username) { Query q = this.em.createNamedQuery("Notificacion.countNoRevisadasUsuarioDestinatario"); q.setParameter("username", username); Long resultado; try { resultado = (Long)q.getSingleResult(); } catch (NoResultException nre) { return 0; } //System.out.println("Notificaciones por revisar para el usuario con username: "+username+" son:"+resultado); return new Integer(resultado.intValue()); } @Override public Collection<Notificacion> findAllOfUser(String username) { Query q = this.em.createNamedQuery("Notificacion.findByUsuarioDestinatario"); q.setParameter("username", username); return (Collection<Notificacion>)q.getResultList(); } }
UTF-8
Java
1,526
java
NotificacionDAO_impl.java
Java
[ { "context": "import javax.persistence.Query;\n\n/**\n *\n * @author victor\n */\npublic class NotificacionDAO_impl extends gen", "end": 368, "score": 0.9690041542053223, "start": 362, "tag": "USERNAME", "value": "victor" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package DAO.impl.JPA_mysql; import DAO.interfaces.NotificacionDAO; import entities.Notificacion; import java.util.Collection; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.Query; /** * * @author victor */ public class NotificacionDAO_impl extends genericDAO_impl<Notificacion> implements NotificacionDAO{ public NotificacionDAO_impl(EntityManager em) { super(Notificacion.class); this.em = em; } //Poner otras funciones extra que sólo haga este DAO @Override public Integer countPorRevisar(String username) { Query q = this.em.createNamedQuery("Notificacion.countNoRevisadasUsuarioDestinatario"); q.setParameter("username", username); Long resultado; try { resultado = (Long)q.getSingleResult(); } catch (NoResultException nre) { return 0; } //System.out.println("Notificaciones por revisar para el usuario con username: "+username+" son:"+resultado); return new Integer(resultado.intValue()); } @Override public Collection<Notificacion> findAllOfUser(String username) { Query q = this.em.createNamedQuery("Notificacion.findByUsuarioDestinatario"); q.setParameter("username", username); return (Collection<Notificacion>)q.getResultList(); } }
1,526
0.678689
0.678033
50
29.5
28.146936
117
false
false
0
0
0
0
0
0
0.46
false
false
4
f360ddfabb4e77f969824721e00cb7c46c9732c7
27,822,798,185,669
cc002f5d0d9c22e64583f45d3f1a58efdce0fc79
/src/main/java/es/BulkInsert.java
93723635725438e0932049744e3e20bc7c9cddfd
[]
no_license
coki230/test
https://github.com/coki230/test
886597daf9fd3f8e25dd8d51c83e98caaf4853ad
0c87b8eb38631cabe44dcab7055a8e71bbdb0dc9
refs/heads/master
2022-07-03T12:53:54.546000
2020-07-10T03:31:22
2020-07-10T03:31:22
15,443,400
0
0
null
false
2022-06-17T03:21:25
2013-12-26T01:48:53
2020-07-10T03:31:36
2022-06-17T03:21:24
8,361
0
0
3
Java
false
false
package es; import org.apache.http.HttpHost; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.unit.TimeValue; import java.io.IOException; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; public class BulkInsert { public static void main(String[] args) { BulkInsert bulkInsert = new BulkInsert(); BulkRequest request = new BulkRequest(); IndexRequest in1 = new IndexRequest(); in1.id("1"); in1.type("type"); in1.index("test"); Map<String, String> souce = new HashMap<>(); souce.put("age", "3"); souce.put("name", "lucy"); in1.source(souce); IndexRequest in2 = new IndexRequest(); in2.id("1"); in2.type("type"); in2.index("test"); Map<String, String> souce2 = new HashMap<>(); souce2.put("age", "34"); souce2.put("name", "lucy"); in2.source(souce2); request.add(in1); request.add(in2); bulkInsert.synchronousBulk(request); } public void synchronousBulk(BulkRequest request) { RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("localhost", 9200, "http"))); request.timeout(TimeValue.timeValueMinutes(2)); request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL); request.waitForActiveShards(ActiveShardCount.ONE); try { int size = request.requests().size(); BulkResponse responses = client.bulk(request); System.out.println(responses); } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
2,039
java
BulkInsert.java
Java
[ { "context": "souce.put(\"age\", \"3\");\n souce.put(\"name\", \"lucy\");\n in1.source(souce);\n IndexReques", "end": 972, "score": 0.9994440674781799, "start": 968, "tag": "NAME", "value": "lucy" }, { "context": "ce2.put(\"age\", \"34\");\n souce2.put(\"n...
null
[]
package es; import org.apache.http.HttpHost; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.unit.TimeValue; import java.io.IOException; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; public class BulkInsert { public static void main(String[] args) { BulkInsert bulkInsert = new BulkInsert(); BulkRequest request = new BulkRequest(); IndexRequest in1 = new IndexRequest(); in1.id("1"); in1.type("type"); in1.index("test"); Map<String, String> souce = new HashMap<>(); souce.put("age", "3"); souce.put("name", "lucy"); in1.source(souce); IndexRequest in2 = new IndexRequest(); in2.id("1"); in2.type("type"); in2.index("test"); Map<String, String> souce2 = new HashMap<>(); souce2.put("age", "34"); souce2.put("name", "lucy"); in2.source(souce2); request.add(in1); request.add(in2); bulkInsert.synchronousBulk(request); } public void synchronousBulk(BulkRequest request) { RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("localhost", 9200, "http"))); request.timeout(TimeValue.timeValueMinutes(2)); request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL); request.waitForActiveShards(ActiveShardCount.ONE); try { int size = request.requests().size(); BulkResponse responses = client.bulk(request); System.out.println(responses); } catch (IOException e) { e.printStackTrace(); } } }
2,039
0.648847
0.636096
59
33.559322
18.784479
72
false
false
0
0
0
0
0
0
0.864407
false
false
4
ba13b1704932e8742511283dd6dd34e20d30cd75
23,304,492,593,527
dafb9bf7fe24c0fbae299cfad637da575387757c
/src/main/java/sample/jna/graalvm/Kernelz32.java
f4f63e39afa2bf7ea41a16753255316c9ef72060
[ "MIT" ]
permissive
bojanv55/jna-graalvm
https://github.com/bojanv55/jna-graalvm
d6d64df17d19821c034dba14cd8edb7142009042
5b5f141330ee22bb7e851f9c73a1109723d3527d
refs/heads/main
2023-08-31T13:24:22.518000
2021-10-08T08:03:51
2021-10-08T08:03:51
414,750,599
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample.jna.graalvm; import com.sun.jna.Library; public interface Kernelz32 extends Library { int GetTickCount(); }
UTF-8
Java
127
java
Kernelz32.java
Java
[]
null
[]
package sample.jna.graalvm; import com.sun.jna.Library; public interface Kernelz32 extends Library { int GetTickCount(); }
127
0.771654
0.755906
7
17.142857
15.941218
44
false
false
0
0
0
0
0
0
0.428571
false
false
4
cbdfb695ac61b97c85e628eed41e2824b7add21c
32,263,794,369,175
4bb27dfa6bc859d1b8221c58c0d5dade38d36a80
/logisticsc/src/main/java/com/brightsoft/dao/yc/IYcPostDao.java
ebd06b7eef0eb8eb97e6e488c1c68b223b3e0f55
[]
no_license
zhonglh/logisticsc
https://github.com/zhonglh/logisticsc
5f0e6be6dd7fd193af31f2d71a37c81dad9fb019
d11a285882c051e9d2790e0413e42971aa837682
refs/heads/master
2021-12-28T03:38:17.035000
2018-01-21T11:49:56
2018-01-21T11:49:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.brightsoft.dao.yc; import java.util.List; import com.brightsoft.entity.YcPost; import com.brightsoft.utils.yc.ISqlDao; /** * YcPost数据层 * Auther:FENG */ public interface IYcPostDao extends ISqlDao<YcPost> { /** * 职位集合查询 * Author:luojing * 2016年6月16日 下午4:16:25 */ public List<YcPost> getPost(YcPost post); }
UTF-8
Java
366
java
IYcPostDao.java
Java
[ { "context": "oft.utils.yc.ISqlDao; \n/** \n* YcPost数据层 \n* Auther:FENG \n*/ \npublic interface IYcPostDao extends ISqlDao<", "end": 165, "score": 0.9995847344398499, "start": 161, "tag": "USERNAME", "value": "FENG" }, { "context": "s ISqlDao<YcPost> { \n\n\t/**\n\t * 职位集合查询\n\t * A...
null
[]
package com.brightsoft.dao.yc; import java.util.List; import com.brightsoft.entity.YcPost; import com.brightsoft.utils.yc.ISqlDao; /** * YcPost数据层 * Auther:FENG */ public interface IYcPostDao extends ISqlDao<YcPost> { /** * 职位集合查询 * Author:luojing * 2016年6月16日 下午4:16:25 */ public List<YcPost> getPost(YcPost post); }
366
0.710059
0.674556
18
17.777779
16.396326
55
false
false
0
0
0
0
0
0
0.611111
false
false
4
70517d246d5531ce35afdb7cfc6f78b945954a6a
25,031,069,454,952
14746c4b8511abe301fd470a152de627327fe720
/soroush-android-1.10.0_source_from_JADX/com/google/p173d/p177b/C1969e.java
e3841cc583a814fa95ae27fc83546802b2044bfe
[]
no_license
maasalan/soroush-messenger-apis
https://github.com/maasalan/soroush-messenger-apis
3005c4a43123c6543dbcca3dd9084f95e934a6f4
29867bf53a113a30b1aa36719b1c7899b991d0a8
refs/heads/master
2020-03-21T21:23:20.693000
2018-06-28T19:57:01
2018-06-28T19:57:01
139,060,676
3
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.p173d.p177b; import java.util.List; public final class C1969e { public final byte[] f6612a; public int f6613b; public final String f6614c; public final List<byte[]> f6615d; public final String f6616e; public Integer f6617f; public Integer f6618g; public Object f6619h; public final int f6620i; public final int f6621j; public C1969e(byte[] bArr, String str, List<byte[]> list, String str2) { this(bArr, str, list, str2, -1, -1); } public C1969e(byte[] bArr, String str, List<byte[]> list, String str2, int i, int i2) { this.f6612a = bArr; this.f6613b = bArr == null ? 0 : bArr.length * 8; this.f6614c = str; this.f6615d = list; this.f6616e = str2; this.f6620i = i2; this.f6621j = i; } }
UTF-8
Java
830
java
C1969e.java
Java
[]
null
[]
package com.google.p173d.p177b; import java.util.List; public final class C1969e { public final byte[] f6612a; public int f6613b; public final String f6614c; public final List<byte[]> f6615d; public final String f6616e; public Integer f6617f; public Integer f6618g; public Object f6619h; public final int f6620i; public final int f6621j; public C1969e(byte[] bArr, String str, List<byte[]> list, String str2) { this(bArr, str, list, str2, -1, -1); } public C1969e(byte[] bArr, String str, List<byte[]> list, String str2, int i, int i2) { this.f6612a = bArr; this.f6613b = bArr == null ? 0 : bArr.length * 8; this.f6614c = str; this.f6615d = list; this.f6616e = str2; this.f6620i = i2; this.f6621j = i; } }
830
0.613253
0.49759
30
26.666666
20.394989
91
false
false
0
0
0
0
0
0
1.1
false
false
4
af45afd81b2159b6669d9467fed8340bae9ff809
7,267,084,710,662
db558c6a00423e616a79afb173ea95f0aec055f1
/Chapter_05/Exercise05_48/Exercise05_48.java
cf15405994a9030902735a9d2374cbcf5c0ee91d
[]
no_license
Zhandos-Hello-World/Introduction-to-Java
https://github.com/Zhandos-Hello-World/Introduction-to-Java
79e455b86269e9cb6d1521de3f49dbddb980cc22
7ce2a220265cd48545dfb2d760c37e95acdffb88
refs/heads/main
2023-06-29T11:29:55.865000
2021-08-03T07:25:13
2021-08-03T07:25:13
350,361,967
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* (Process string) Write a program that prompts the user to enter a string and displays the characters at even positions. Here is a sample run: Enter a string: Beijing Chicago ejnhcg */ import java.util.Scanner; public class Exercise05_48{ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a string: "); String a = input.nextLine(); for(int i = 0; i < a.length(); i++){ if(i % 2 != 0 && a.charAt(i) != ' '){ System.out.print(a.charAt(i)); } } } }
UTF-8
Java
601
java
Exercise05_48.java
Java
[]
null
[]
/* (Process string) Write a program that prompts the user to enter a string and displays the characters at even positions. Here is a sample run: Enter a string: Beijing Chicago ejnhcg */ import java.util.Scanner; public class Exercise05_48{ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a string: "); String a = input.nextLine(); for(int i = 0; i < a.length(); i++){ if(i % 2 != 0 && a.charAt(i) != ' '){ System.out.print(a.charAt(i)); } } } }
601
0.577371
0.565724
20
29
22.706827
85
false
false
0
0
0
0
0
0
0.35
false
false
4
bc1f60291157acfaa52079a1570c4fde431a582a
3,521,873,186,240
b5454f3c04423d9aaf333e0efaa4aa791c20f4fb
/src/main/java/com/shakeToPay/examples/clients/testClient/integrations/mono/dto/request/GetOrderInfoRequest.java
9873ce8be0f70d08d331d5b80bb83d048a998470
[]
no_license
ShaketoPay/shakeToPayJavaClientExample
https://github.com/ShaketoPay/shakeToPayJavaClientExample
4421babce2f2dff4d2cb7425ce45a9b61ef5bc69
a92a1c40ce3313178b3d9481abdc7fa1c6fbca8a
refs/heads/main
2023-04-04T19:39:37.042000
2021-03-30T12:23:05
2021-03-30T12:23:05
352,990,911
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shakeToPay.examples.clients.testClient.integrations.mono.dto.request; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.ToString; @ToString public class GetOrderInfoRequest extends OperationInfo { @JsonProperty("tableNumber") private final String tableNumber; @JsonProperty("orders") public List<OrderInfo> orders; @JsonProperty("state") private final String state = Statuses.SUCCESS_STATUS; // required public GetOrderInfoRequest(String rID, String tableNumber, List<OrderInfo> orders) { super(rID); this.tableNumber = tableNumber; this.orders = orders; } @ToString @AllArgsConstructor public static class OrderInfo { @JsonProperty("billId") private final String billId; @JsonProperty("orderNumber") private final Integer orderNumber; @JsonProperty("totalSum") private final Double totalSum; @JsonProperty("guests") private final List<GuestInfo> guests; } @ToString @AllArgsConstructor public static class GuestInfo { @JsonProperty("name") private final String name; @JsonProperty("dishes") private final List<DishInfo> dishes; } @ToString @AllArgsConstructor public static class DishInfo { @JsonProperty("name") private final String name; @JsonProperty("count") private final Double count; @JsonProperty("sum") private final Double sum; @JsonProperty("category") private final String category; @JsonProperty("orderNumber") private final String orderNumber; } }
UTF-8
Java
1,750
java
GetOrderInfoRequest.java
Java
[]
null
[]
package com.shakeToPay.examples.clients.testClient.integrations.mono.dto.request; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.ToString; @ToString public class GetOrderInfoRequest extends OperationInfo { @JsonProperty("tableNumber") private final String tableNumber; @JsonProperty("orders") public List<OrderInfo> orders; @JsonProperty("state") private final String state = Statuses.SUCCESS_STATUS; // required public GetOrderInfoRequest(String rID, String tableNumber, List<OrderInfo> orders) { super(rID); this.tableNumber = tableNumber; this.orders = orders; } @ToString @AllArgsConstructor public static class OrderInfo { @JsonProperty("billId") private final String billId; @JsonProperty("orderNumber") private final Integer orderNumber; @JsonProperty("totalSum") private final Double totalSum; @JsonProperty("guests") private final List<GuestInfo> guests; } @ToString @AllArgsConstructor public static class GuestInfo { @JsonProperty("name") private final String name; @JsonProperty("dishes") private final List<DishInfo> dishes; } @ToString @AllArgsConstructor public static class DishInfo { @JsonProperty("name") private final String name; @JsonProperty("count") private final Double count; @JsonProperty("sum") private final Double sum; @JsonProperty("category") private final String category; @JsonProperty("orderNumber") private final String orderNumber; } }
1,750
0.669143
0.669143
74
22.662163
20.101954
88
false
false
0
0
0
0
0
0
0.324324
false
false
4
db8d37684a29affc3a619316bec645e023a177d3
26,749,056,375,923
ffcb9d34462b11a39666406d847d47b59d4283ff
/apl-wms-outstorage-order-pojo-master/apl-wms-outstorage-operator-pojo/src/main/java/com/apl/wms/outstorage/operator/pojo/po/PullBatchOrderPo.java
9b7df3a39f8f92f11264739057a37d8bb8622236
[]
no_license
hujiren/wms-outstorage-order-java
https://github.com/hujiren/wms-outstorage-order-java
a58202fe7581111c190d66718afca76e9262797b
2a59d22985d94fbedc5ad0f59f59f22d2bf9e876
refs/heads/master
2023-03-07T15:30:55.346000
2021-02-18T06:07:11
2021-02-18T06:07:11
339,952,490
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.apl.wms.outstorage.operator.pojo.po; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.sql.Timestamp; /** * <p> * 拣货批次 持久化对象 * </p> * * @author cy * @since 2020-06-08 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("pull_batch_order") @ApiModel(value="批次订单 持久化对象", description="批次订单 持久化对象") public class PullBatchOrderPo extends Model<PullBatchOrderPo> { @TableId(value = "id", type = IdType.INPUT) @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; @ApiModelProperty(name = "batchId" , value = "批次id" , required = true) @NotEmpty(message = "批次id不能为空") private Long batchId; @ApiModelProperty(name = "orderId" , value = "订单Id" , required = true) @NotNull(message = "订单Id不能为空") @Min(value = 0 , message = "订单id不不合法") @JsonFormat(shape = JsonFormat.Shape.STRING) private Long orderId; private static final long serialVersionUID=1L; @Override protected Serializable pkVal() { return this.id; } }
UTF-8
Java
1,645
java
PullBatchOrderPo.java
Java
[ { "context": "p;\n\n/**\n * <p>\n * 拣货批次 持久化对象\n * </p>\n *\n * @author cy\n * @since 2020-06-08\n */\n@Data\n@EqualsAndHashCode", "end": 701, "score": 0.9904648065567017, "start": 699, "tag": "USERNAME", "value": "cy" } ]
null
[]
package com.apl.wms.outstorage.operator.pojo.po; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.sql.Timestamp; /** * <p> * 拣货批次 持久化对象 * </p> * * @author cy * @since 2020-06-08 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("pull_batch_order") @ApiModel(value="批次订单 持久化对象", description="批次订单 持久化对象") public class PullBatchOrderPo extends Model<PullBatchOrderPo> { @TableId(value = "id", type = IdType.INPUT) @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; @ApiModelProperty(name = "batchId" , value = "批次id" , required = true) @NotEmpty(message = "批次id不能为空") private Long batchId; @ApiModelProperty(name = "orderId" , value = "订单Id" , required = true) @NotNull(message = "订单Id不能为空") @Min(value = 0 , message = "订单id不不合法") @JsonFormat(shape = JsonFormat.Shape.STRING) private Long orderId; private static final long serialVersionUID=1L; @Override protected Serializable pkVal() { return this.id; } }
1,645
0.739496
0.733032
56
26.625
22.035332
74
false
false
0
0
0
0
0
0
0.482143
false
false
4
0b39d74e9480414945128c53db395757d98d65d1
25,426,206,439,966
a4eaad346b50bef2d17bdc6279e206986c27c789
/RemoveElement2.java
bff4635b4ea0e8b854247cdb35ac25be3cecb4cb
[]
no_license
wenjin1997/leetcode
https://github.com/wenjin1997/leetcode
446dc911c0ec962e3ba483fd9d385d2e6e031f30
7da5a75b4871a4640e7e45c291e74f0b174411b5
refs/heads/main
2023-04-08T05:54:33.201000
2021-04-28T12:12:58
2021-04-28T12:12:58
314,579,111
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode; import java.util.Scanner; // 27.移除元素 双指针法 public class RemoveElement2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int val = in.nextInt(); int n = in.nextInt(); int left = 0; int[] nums = new int[n]; for(int i = 0; i < n; i++) { nums[i] = in.nextInt(); } for(int right = 0; right < n; right++) { if(nums[right] != val) { nums[left] = nums[right]; left++; } } System.out.println(left); for(int i = 0; i < n; i++) { System.out.print(nums[i]); } } }
UTF-8
Java
577
java
RemoveElement2.java
Java
[]
null
[]
package leetcode; import java.util.Scanner; // 27.移除元素 双指针法 public class RemoveElement2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int val = in.nextInt(); int n = in.nextInt(); int left = 0; int[] nums = new int[n]; for(int i = 0; i < n; i++) { nums[i] = in.nextInt(); } for(int right = 0; right < n; right++) { if(nums[right] != val) { nums[left] = nums[right]; left++; } } System.out.println(left); for(int i = 0; i < n; i++) { System.out.print(nums[i]); } } }
577
0.554367
0.541889
32
16.53125
13.25468
41
false
false
0
0
0
0
0
0
2.34375
false
false
4
b39ff1b3af0bb1df5dfc6c6abd881089f08c2875
26,379,689,182,707
0fb0d3acd7b92527c44cccb755e54b7c662f47bd
/src/main/java/com/alexshay/shape/task/servise/cube/VoluemCubeServise.java
81527d426a275c070b67ee19d06117c849023fa7
[]
no_license
AlexandrShaikouski/shapeAlexandrShaikouski
https://github.com/AlexandrShaikouski/shapeAlexandrShaikouski
e5aeca6dc1066c095b9dee326f0e71d680901a95
dc187da954f1b41386a0a953f43e40b7ac6a5066
refs/heads/master
2020-04-12T20:33:54.047000
2018-12-21T17:19:11
2018-12-21T17:19:11
162,740,182
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alexshay.shape.task.servise.cube; import com.alexshay.shape.task.entity.ParametrShape; import com.alexshay.shape.task.entity.shape.Cube; import com.alexshay.shape.task.entity.Shape; import com.alexshay.shape.task.servise.BaseParametr; import com.alexshay.shape.task.servise.exception.ParametrException; public class VoluemCubeServise extends BaseParametr { @Override public void parametr(Shape shape, ParametrShape parametrShape) { try { Cube cube = (Cube) shape; parametrShape.setVoluem(Math.pow(cube.getLengthEdge(),3)); nextParametr(shape,parametrShape); } catch (ParametrException e) { log.info("Parameter is uncorrect"); } } }
UTF-8
Java
730
java
VoluemCubeServise.java
Java
[]
null
[]
package com.alexshay.shape.task.servise.cube; import com.alexshay.shape.task.entity.ParametrShape; import com.alexshay.shape.task.entity.shape.Cube; import com.alexshay.shape.task.entity.Shape; import com.alexshay.shape.task.servise.BaseParametr; import com.alexshay.shape.task.servise.exception.ParametrException; public class VoluemCubeServise extends BaseParametr { @Override public void parametr(Shape shape, ParametrShape parametrShape) { try { Cube cube = (Cube) shape; parametrShape.setVoluem(Math.pow(cube.getLengthEdge(),3)); nextParametr(shape,parametrShape); } catch (ParametrException e) { log.info("Parameter is uncorrect"); } } }
730
0.713699
0.712329
20
35.5
23.502127
70
false
false
0
0
0
0
0
0
0.65
false
false
4
91e8c44927f03ea2b0b358d45c9da81d89ecb32a
30,193,620,145,370
b211f9520a599332cb6d7a6ad469d20f4717d8f0
/src/main/java/fr/gaiacraft/gaiacore/util/PlayerProfile.java
63765cf0d5be5c8b18940460660717747b14590d
[]
no_license
GaiaMMORPG/GaiaCore
https://github.com/GaiaMMORPG/GaiaCore
1e510a7564614c9c5fa045d1492c3eb7238f48ac
2c2c3bba9e29c7a52be319e4941ff343fd24f671
refs/heads/master
2020-03-21T00:57:59.083000
2018-06-28T15:32:03
2018-06-28T15:32:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.gaiacraft.gaiacore.util; import java.util.UUID; public class PlayerProfile { private UUID uuid; private String name; //Maybe useless private String[] jobs; private int[] XP; /** * Create new profile * @param playerUUID UniqueId of player */ public PlayerProfile(UUID playerUUID){ this.uuid = playerUUID; this.jobs = new String[]{"Vagabond","undefined","undefined"}; this.XP = new int[]{0, 0, 0}; } public UUID getUUID() { return uuid; } public void AddXP(int value, int pos){ if(value >= 0 && value <= 2) this.XP[pos] += value; } /** * Removes fixed XP from job slot * @param value XP to remove (POSITIVE VALUE ONLY) * @param pos Slot to apply changes */ public void SubXP(int value, int pos){ if((pos >= 0 && pos <= 2) && value > 0) this.XP[pos] -= value; } /** * Function to change Job /!\ WARNING changing job reset XP of the slot * @param job Job from Jobs enum * @param pos Job slot to change */ public void SetJob(Jobs job, int pos){ //DONE: Make parameter from ENUM-only this.jobs[pos] = job.name; this.XP[pos] = 0; } public void GetJob(int pos){ } public enum Jobs{ WANDERER(0, "Vagabond"), LUMBERJACK(1, "Bûcheron"), MINER(2, "Mineur"), ROGUE(3, "Assassin"), TRADER(4, "Marchand"), THIEF(5, "Voleur"), CRAFTMAN(6, "Artisan"), BLACKSMITH(7, "Forgeron"), FARMER(8, "Paysan"), FISHERMAN(9, "Pêcheur"), GUARD(10, "Garde"), BREEDER(11, "Eleveur"), MAGE(12, "Enchanteur"); private String name; private int id; Jobs(int ID, String nom){ this.name = nom; this.id = ID; } public String getName(){ return this.name; } public int getId(){ return this.id; } } }
UTF-8
Java
2,043
java
PlayerProfile.java
Java
[ { "context": "ob(int pos){\n\n }\n\n public enum Jobs{\n WANDERER(0, \"Vagabond\"),\n LUMBERJACK(1, \"Bûcheron\")", "end": 1357, "score": 0.8994261026382446, "start": 1349, "tag": "NAME", "value": "WANDERER" }, { "context": " }\n\n public enum Jobs{\n ...
null
[]
package fr.gaiacraft.gaiacore.util; import java.util.UUID; public class PlayerProfile { private UUID uuid; private String name; //Maybe useless private String[] jobs; private int[] XP; /** * Create new profile * @param playerUUID UniqueId of player */ public PlayerProfile(UUID playerUUID){ this.uuid = playerUUID; this.jobs = new String[]{"Vagabond","undefined","undefined"}; this.XP = new int[]{0, 0, 0}; } public UUID getUUID() { return uuid; } public void AddXP(int value, int pos){ if(value >= 0 && value <= 2) this.XP[pos] += value; } /** * Removes fixed XP from job slot * @param value XP to remove (POSITIVE VALUE ONLY) * @param pos Slot to apply changes */ public void SubXP(int value, int pos){ if((pos >= 0 && pos <= 2) && value > 0) this.XP[pos] -= value; } /** * Function to change Job /!\ WARNING changing job reset XP of the slot * @param job Job from Jobs enum * @param pos Job slot to change */ public void SetJob(Jobs job, int pos){ //DONE: Make parameter from ENUM-only this.jobs[pos] = job.name; this.XP[pos] = 0; } public void GetJob(int pos){ } public enum Jobs{ WANDERER(0, "Vagabond"), LUMBERJACK(1, "Bûcheron"), MINER(2, "Mineur"), ROGUE(3, "Assassin"), TRADER(4, "Marchand"), THIEF(5, "Voleur"), CRAFTMAN(6, "Artisan"), BLACKSMITH(7, "Forgeron"), FARMER(8, "Paysan"), FISHERMAN(9, "Pêcheur"), GUARD(10, "Garde"), BREEDER(11, "Eleveur"), MAGE(12, "Enchanteur"); private String name; private int id; Jobs(int ID, String nom){ this.name = nom; this.id = ID; } public String getName(){ return this.name; } public int getId(){ return this.id; } } }
2,043
0.527193
0.514944
92
21.184782
17.060589
75
false
false
0
0
0
0
0
0
0.619565
false
false
4
01e62876ea37748c416fa2dfb09baf77b766f1e4
32,847,909,917,460
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_59eb6b4ce6edf1c4c2a629afef1d3913e7c38a27/ChangePswdAction/9_59eb6b4ce6edf1c4c2a629afef1d3913e7c38a27_ChangePswdAction_s.java
336fb43d700e23434dcadfb212b7a46e6719563c
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
package com.nclodger.control.action.access; import com.nclodger.control.action.Action; import com.nclodger.dao.UserDao; import com.nclodger.domain.Users; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Created with IntelliJ IDEA. * User: Miredean * Date: 23.11.13 * Time: 23:27 * To change this template use File | Settings | File Templates. */ public class ChangePswdAction extends Action { @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { UserDao userDao = new UserDao(); //validation of old pass String oldpass = request.getParameter("oldpswd"); String email = request.getSession().getAttribute("email").toString(); if(!oldpass.equals(userDao.getPasswordbyEmail(email))){ request.setAttribute("notify_wrongpswd",true); return "ussettings"; } int idUser = userDao.getUserId(request.getSession().getAttribute("email").toString()); Users u = new Users(request.getParameter("password").toString(),idUser); userDao.updatePswd(u); request.setAttribute("notify_changepswd","Your password has been successfully changed!"); return "ussettings"; } }
UTF-8
Java
1,324
java
9_59eb6b4ce6edf1c4c2a629afef1d3913e7c38a27_ChangePswdAction_s.java
Java
[ { "context": ";\n \n /**\n * Created with IntelliJ IDEA.\n * User: Miredean\n * Date: 23.11.13\n * Time: 23:27\n * To change ", "end": 314, "score": 0.9996281862258911, "start": 306, "tag": "USERNAME", "value": "Miredean" } ]
null
[]
package com.nclodger.control.action.access; import com.nclodger.control.action.Action; import com.nclodger.dao.UserDao; import com.nclodger.domain.Users; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Created with IntelliJ IDEA. * User: Miredean * Date: 23.11.13 * Time: 23:27 * To change this template use File | Settings | File Templates. */ public class ChangePswdAction extends Action { @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { UserDao userDao = new UserDao(); //validation of old pass String oldpass = request.getParameter("oldpswd"); String email = request.getSession().getAttribute("email").toString(); if(!oldpass.equals(userDao.getPasswordbyEmail(email))){ request.setAttribute("notify_wrongpswd",true); return "ussettings"; } int idUser = userDao.getUserId(request.getSession().getAttribute("email").toString()); Users u = new Users(request.getParameter("password").toString(),idUser); userDao.updatePswd(u); request.setAttribute("notify_changepswd","Your password has been successfully changed!"); return "ussettings"; } }
1,324
0.685045
0.677492
36
35.75
29.471621
103
false
false
0
0
0
0
0
0
0.611111
false
false
4
14c5377fed016c3a2b4754f9c618e0ce2ef876c6
2,843,268,392,535
a514fb582b9356c2d7718b2cd8b924573d27d29e
/src/main/java/com/assessment/Entity/SeatReservation.java
7e177c061e01078243a7391b388b014e6c9ad286
[]
no_license
ManishaAppu/bookMyMovie
https://github.com/ManishaAppu/bookMyMovie
53cead4527a75f6a12e3066665f8ebc1ef4da68b
552fc539870bd6c46c5ed63075aec533f9f328d4
refs/heads/main
2023-06-07T08:06:36.833000
2021-07-01T17:00:46
2021-07-01T17:00:46
382,085,731
0
0
null
false
2021-07-01T17:00:46
2021-07-01T15:56:22
2021-07-01T15:56:28
2021-07-01T17:00:46
17
0
0
0
null
false
false
package com.assessment.Entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; @Entity @Table(name="seat_reservation") @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class SeatReservation { public SeatReservation(int movieReservationId, int seatNumber) { this.movieReservationId = movieReservationId; this.seatNumber = seatNumber; } @Id @Column(name="seat_reservation_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int seatReservationId; @Column(name="movie_reservation_id") private int movieReservationId; @Column(name="seat_number") private int seatNumber; }
UTF-8
Java
750
java
SeatReservation.java
Java
[]
null
[]
package com.assessment.Entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; @Entity @Table(name="seat_reservation") @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class SeatReservation { public SeatReservation(int movieReservationId, int seatNumber) { this.movieReservationId = movieReservationId; this.seatNumber = seatNumber; } @Id @Column(name="seat_reservation_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int seatReservationId; @Column(name="movie_reservation_id") private int movieReservationId; @Column(name="seat_number") private int seatNumber; }
750
0.748
0.748
35
20.428572
18.365007
68
false
false
0
0
0
0
0
0
0.342857
false
false
4
0759da5ef6f67877f43216d836d6602fbf8adaab
29,360,396,482,653
0c47a33b2d57d263adc4df79e3d80d529c34e53f
/app/src/main/java/gullideckel/seasonhunter/CostumLayouts/LocationPicker/PickerConfirm.java
ac7035a239445e933acd2b30d3992f0125bb5f41
[]
no_license
Gullideckel100kg/SeasonHunter
https://github.com/Gullideckel100kg/SeasonHunter
71ee0154c56ac4577c969d9991d921c23a033189
dd3337ef57c44d2f28a97006eda75c72845bf212
refs/heads/master
2021-06-21T14:54:04.161000
2019-07-16T19:32:49
2019-07-16T19:32:49
145,876,967
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gullideckel.seasonhunter.CostumLayouts.LocationPicker; import android.graphics.Bitmap; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import com.google.android.gms.maps.model.Marker; import gullideckel.seasonhunter.Interfaces.IAddressSelected; import gullideckel.seasonhunter.Interfaces.ICancelCommand; import gullideckel.seasonhunter.Interfaces.ICompanyAddress; import gullideckel.seasonhunter.Objects.Job.CompanyAddress; import gullideckel.seasonhunter.R; import gullideckel.seasonhunter.Statics.StaticMethod; public class PickerConfirm { private Marker marker; private CompanyAddress address; private Bitmap bitmap; private LayoutInflater inflater; private FrameLayout frm; private IAddressSelected listener; private TextView txtCoordinates; private TextView txtAddress; private ImageView imgMap; private Button btnChange; private Button btnSelect; private Button select; public PickerConfirm(Button select, IAddressSelected listener, Marker marker, CompanyAddress address, Bitmap bitmap, LayoutInflater inflater, FrameLayout frm) { this.marker = marker; this.address = address; this.bitmap = bitmap; this.inflater = inflater; this.frm = frm; this.listener = listener; this.select = select; } public View getView() { View v = inflater.inflate(R.layout.frag_location_picker_confirm, null); v.bringToFront(); v.setBackgroundColor(Color.WHITE); txtCoordinates = (TextView) v.findViewById(R.id.txtPickerCoordinates); txtAddress = (TextView) v.findViewById(R.id.txtPickerAddress); imgMap = (ImageView) v.findViewById(R.id.imgPickerMap); btnChange = (Button) v.findViewById(R.id.btnPickerChange); btnSelect = (Button) v.findViewById(R.id.btnPickerSelect); txtCoordinates.setText(StaticMethod.GPSConvert(address.getLatitude(), address.getLongitude())); txtAddress.setText(address.getAddress()); imgMap.setImageBitmap(bitmap); btnSelect.setOnClickListener(Select); btnChange.setOnClickListener(Change); return v; } private View.OnClickListener Change =new View.OnClickListener() { @Override public void onClick(View v) { marker.remove(); frm.removeAllViews(); select.setVisibility(View.VISIBLE); } }; private View.OnClickListener Select = new View.OnClickListener() { @Override public void onClick(View v) { marker.remove(); listener.OnSelected(); select.setVisibility(View.VISIBLE); } }; }
UTF-8
Java
3,098
java
PickerConfirm.java
Java
[]
null
[]
package gullideckel.seasonhunter.CostumLayouts.LocationPicker; import android.graphics.Bitmap; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import com.google.android.gms.maps.model.Marker; import gullideckel.seasonhunter.Interfaces.IAddressSelected; import gullideckel.seasonhunter.Interfaces.ICancelCommand; import gullideckel.seasonhunter.Interfaces.ICompanyAddress; import gullideckel.seasonhunter.Objects.Job.CompanyAddress; import gullideckel.seasonhunter.R; import gullideckel.seasonhunter.Statics.StaticMethod; public class PickerConfirm { private Marker marker; private CompanyAddress address; private Bitmap bitmap; private LayoutInflater inflater; private FrameLayout frm; private IAddressSelected listener; private TextView txtCoordinates; private TextView txtAddress; private ImageView imgMap; private Button btnChange; private Button btnSelect; private Button select; public PickerConfirm(Button select, IAddressSelected listener, Marker marker, CompanyAddress address, Bitmap bitmap, LayoutInflater inflater, FrameLayout frm) { this.marker = marker; this.address = address; this.bitmap = bitmap; this.inflater = inflater; this.frm = frm; this.listener = listener; this.select = select; } public View getView() { View v = inflater.inflate(R.layout.frag_location_picker_confirm, null); v.bringToFront(); v.setBackgroundColor(Color.WHITE); txtCoordinates = (TextView) v.findViewById(R.id.txtPickerCoordinates); txtAddress = (TextView) v.findViewById(R.id.txtPickerAddress); imgMap = (ImageView) v.findViewById(R.id.imgPickerMap); btnChange = (Button) v.findViewById(R.id.btnPickerChange); btnSelect = (Button) v.findViewById(R.id.btnPickerSelect); txtCoordinates.setText(StaticMethod.GPSConvert(address.getLatitude(), address.getLongitude())); txtAddress.setText(address.getAddress()); imgMap.setImageBitmap(bitmap); btnSelect.setOnClickListener(Select); btnChange.setOnClickListener(Change); return v; } private View.OnClickListener Change =new View.OnClickListener() { @Override public void onClick(View v) { marker.remove(); frm.removeAllViews(); select.setVisibility(View.VISIBLE); } }; private View.OnClickListener Select = new View.OnClickListener() { @Override public void onClick(View v) { marker.remove(); listener.OnSelected(); select.setVisibility(View.VISIBLE); } }; }
3,098
0.713363
0.713041
99
30.292929
25.929295
162
false
false
0
0
0
0
0
0
0.717172
false
false
4
477d5826c4c22ebad2d9a51838316fd4cbfccab5
10,574,209,540,896
bce99c3327d192d1cb1ca0bafec184a02c0453e6
/ProjectTGFinal/db/userDB/UserDto.java
4a9d03208e2088174976025ba5535e5459da597e
[]
no_license
csk746/Projects
https://github.com/csk746/Projects
d3bad2c37c8c3eeaf77346caa4f05eaf44dc2da5
9c86780cc72a328c5b7ab7d87bf82ac131aa2eca
refs/heads/master
2020-12-24T21:21:58.321000
2017-10-03T10:39:08
2017-10-03T10:39:08
57,425,396
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package userDB; public class UserDto { private String id; private String pw; public String getId() { return id; } public void setId(String id) { System.out.println("setID:" + id); this.id = id; } public String getPw() { return pw; } public void setPw(String pw) { System.out.println("setPW:" + pw); this.pw = pw; } }
UTF-8
Java
349
java
UserDto.java
Java
[]
null
[]
package userDB; public class UserDto { private String id; private String pw; public String getId() { return id; } public void setId(String id) { System.out.println("setID:" + id); this.id = id; } public String getPw() { return pw; } public void setPw(String pw) { System.out.println("setPW:" + pw); this.pw = pw; } }
349
0.627507
0.627507
27
11.925926
12.195706
36
false
false
0
0
0
0
0
0
1.222222
false
false
4
8411e96fdec09e7493fa876982df9e35b6d070b5
27,127,013,486,582
c4f9ca44752f80957b8b03079c68e243f7deeba6
/src/main/java/se/rosa/domain/Account.java
b6f196bf5ff55f71da6442d1f5468bf0b1b65e4b
[]
no_license
strobbann/myfirstmaven
https://github.com/strobbann/myfirstmaven
c9fb39f72b5a171dd2cd0b257ad237bf6d310665
c59ae6f639b5d95cd9bfcd827f70c4d16666d6e5
refs/heads/master
2021-07-05T23:01:38.395000
2019-06-04T08:21:33
2019-06-04T08:21:33
189,584,433
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package se.rosa.domain; import java.util.Objects; public class Account { private Long id; private Double balance; private String name; private Account(Long id, Double balance, String name) { this.id = Objects.requireNonNull(id, "id cannot be null"); this.balance = Objects.requireNonNull(balance, "balance cannot be null"); this.name = Objects.requireNonNull(name, "name cannot be null"); } public Long getId() { return id; } public Double getBalance() { return balance; } public String getName() { return name; } public static Builder builder() { return new Builder(); } public static class Builder { private Long id; private Double balance; private String name; public Builder withId(Long id) { this.id = id; return this; } public Builder withBalance(Double balance) { this.balance = balance; return this; } public Builder withName(String name) { this.name = name; return this; } public Account build() { return new Account(id, balance, name); } } }
UTF-8
Java
1,096
java
Account.java
Java
[]
null
[]
package se.rosa.domain; import java.util.Objects; public class Account { private Long id; private Double balance; private String name; private Account(Long id, Double balance, String name) { this.id = Objects.requireNonNull(id, "id cannot be null"); this.balance = Objects.requireNonNull(balance, "balance cannot be null"); this.name = Objects.requireNonNull(name, "name cannot be null"); } public Long getId() { return id; } public Double getBalance() { return balance; } public String getName() { return name; } public static Builder builder() { return new Builder(); } public static class Builder { private Long id; private Double balance; private String name; public Builder withId(Long id) { this.id = id; return this; } public Builder withBalance(Double balance) { this.balance = balance; return this; } public Builder withName(String name) { this.name = name; return this; } public Account build() { return new Account(id, balance, name); } } }
1,096
0.649635
0.649635
58
16.896551
18.121895
75
false
false
0
0
0
0
0
0
1.741379
false
false
4
1a171d7ab9e37911ee5719d92e28e45ad970d2b9
11,562,052,008,662
39ece629bd8ab48d9b152d2992e64cd50af5ecaa
/src/main/java/com/example/shiro/repository/PermissionRepository.java
ae068013a56ff384fd2c39e351f4d4574417c80e
[]
no_license
FraserYu/shiroLearning
https://github.com/FraserYu/shiroLearning
d588111e875d529487a004a2c8ab5854a3e8ce41
de8ea79e92a0e63bc73073c002ddd985d187fbce
refs/heads/master
2020-03-28T11:54:39.300000
2019-10-15T06:58:15
2019-10-15T06:58:15
148,255,698
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.shiro.repository; import com.example.shiro.entity.Permission; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface PermissionRepository extends JpaRepository<Permission, Long> { @Query(value = "select permId from RolePermRel pr where pr.roleId in ?1") List<Long> findRolePerm(List<Long> roleIds); List<Permission> findByIdIn(List<Long> ids); }
UTF-8
Java
548
java
PermissionRepository.java
Java
[]
null
[]
package com.example.shiro.repository; import com.example.shiro.entity.Permission; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface PermissionRepository extends JpaRepository<Permission, Long> { @Query(value = "select permId from RolePermRel pr where pr.roleId in ?1") List<Long> findRolePerm(List<Long> roleIds); List<Permission> findByIdIn(List<Long> ids); }
548
0.793796
0.791971
19
27.842106
27.913897
79
false
false
0
0
0
0
0
0
0.473684
false
false
4
28916d21399ccedf39ce81576f0763fa779fdf8d
9,036,611,238,776
30cf1313f598d6d3828eb277416bb3e45d1ef65e
/src/main/java/org/lazycat/lang/Comparables.java
51670d98b25f88e08e1e5b83e85b515aae838fb1
[]
no_license
paganini2008/lazycat-lang
https://github.com/paganini2008/lazycat-lang
e04684811c4b98b0dd24f128593baea12cf7c12e
4f04d3ae109c5d3b51cc8ea3f5ab160f45d71479
refs/heads/master
2020-01-22T19:58:46.103000
2019-03-11T14:27:09
2019-03-11T14:27:09
84,772,134
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.lazycat.lang; import java.util.Collection; public class Comparables { private Comparables() { } public static void main(String[] args) { } public static <T extends Comparable<T>> T max(T a, T b) { return compareTo(a, b) >= 0 ? a : b; } public static <T extends Comparable<T>> T min(T a, T b) { return compareTo(a, b) <= 0 ? a : b; } public static <T extends Comparable<T>> int compareTo(T a, T b) { if (a != null && b != null) { if (a.getClass() == b.getClass()) { return a.compareTo(b); } throw new IllegalArgumentException( "Mismatched type for " + a.getClass().getName() + " and " + b.getClass().getName()); } if (a != null && b == null) { return 1; } if (a == null && b != null) { return -1; } return 0; } public static <T extends Comparable<T>> boolean contains(T[] array, T value) { if (array != null) { for (T t : array) { if (compareTo(t, value) == 0) { return true; } } } return false; } public static <T extends Comparable<T>> boolean contains(Collection<T> c, T value) { if (c != null) { for (T t : c) { if (compareTo(t, value) == 0) { return true; } } } return false; } public static <T extends Comparable<T>> boolean notIn(T value, T left, T right) { return !in(value, left, right); } public static <T extends Comparable<T>> boolean in(T value, T left, T right) { if (value.getClass() == left.getClass() && left.getClass() == right.getClass()) { return value.compareTo(left) > 0 && value.compareTo(left) < 0; } throw new ClassCastException(value.getClass().getName() + " and " + left.getClass().getName() + " and " + right.getClass().getName() + " are not same type."); } public static <T extends Comparable<T>> boolean between(T value, T left, T right) { if (value.getClass() == left.getClass() && left.getClass() == right.getClass()) { return value.compareTo(left) >= 0 && value.compareTo(left) <= 0; } throw new ClassCastException(value.getClass().getName() + " and " + left.getClass().getName() + " and " + right.getClass().getName() + " are not same type."); } public static <T extends Comparable<T>> boolean notBetween(T value, T left, T right) { return !between(value, left, right); } public static <T extends Comparable<T>> T max(T[] array) { Assert.isTrue(ArrayUtils.isEmpty(array), "Empty array."); T max = array[0]; for (T t : array) { max = max(max, t); } return max; } public static <T extends Comparable<T>> T min(T[] array) { Assert.isTrue(ArrayUtils.isEmpty(array), "Empty array."); T min = array[0]; for (T t : array) { min = min(min, t); } return min; } }
UTF-8
Java
2,690
java
Comparables.java
Java
[]
null
[]
package org.lazycat.lang; import java.util.Collection; public class Comparables { private Comparables() { } public static void main(String[] args) { } public static <T extends Comparable<T>> T max(T a, T b) { return compareTo(a, b) >= 0 ? a : b; } public static <T extends Comparable<T>> T min(T a, T b) { return compareTo(a, b) <= 0 ? a : b; } public static <T extends Comparable<T>> int compareTo(T a, T b) { if (a != null && b != null) { if (a.getClass() == b.getClass()) { return a.compareTo(b); } throw new IllegalArgumentException( "Mismatched type for " + a.getClass().getName() + " and " + b.getClass().getName()); } if (a != null && b == null) { return 1; } if (a == null && b != null) { return -1; } return 0; } public static <T extends Comparable<T>> boolean contains(T[] array, T value) { if (array != null) { for (T t : array) { if (compareTo(t, value) == 0) { return true; } } } return false; } public static <T extends Comparable<T>> boolean contains(Collection<T> c, T value) { if (c != null) { for (T t : c) { if (compareTo(t, value) == 0) { return true; } } } return false; } public static <T extends Comparable<T>> boolean notIn(T value, T left, T right) { return !in(value, left, right); } public static <T extends Comparable<T>> boolean in(T value, T left, T right) { if (value.getClass() == left.getClass() && left.getClass() == right.getClass()) { return value.compareTo(left) > 0 && value.compareTo(left) < 0; } throw new ClassCastException(value.getClass().getName() + " and " + left.getClass().getName() + " and " + right.getClass().getName() + " are not same type."); } public static <T extends Comparable<T>> boolean between(T value, T left, T right) { if (value.getClass() == left.getClass() && left.getClass() == right.getClass()) { return value.compareTo(left) >= 0 && value.compareTo(left) <= 0; } throw new ClassCastException(value.getClass().getName() + " and " + left.getClass().getName() + " and " + right.getClass().getName() + " are not same type."); } public static <T extends Comparable<T>> boolean notBetween(T value, T left, T right) { return !between(value, left, right); } public static <T extends Comparable<T>> T max(T[] array) { Assert.isTrue(ArrayUtils.isEmpty(array), "Empty array."); T max = array[0]; for (T t : array) { max = max(max, t); } return max; } public static <T extends Comparable<T>> T min(T[] array) { Assert.isTrue(ArrayUtils.isEmpty(array), "Empty array."); T min = array[0]; for (T t : array) { min = min(min, t); } return min; } }
2,690
0.607807
0.602974
102
25.372549
28.763035
105
false
false
0
0
0
0
0
0
2.22549
false
false
4
3e1ed2f78f53050cd306fa2ffed69e6562ac0a6e
128,849,071,780
6fff15c0a3729222fc078ffd93fec3531bed0d72
/app/src/main/java/my/verysimple/testproject/fragment/TransactionsFragment.java
9920dec517c09a2cd1553aaf7123b3ca5f4754d5
[]
no_license
Klaustrafobius/simple_code_test_project
https://github.com/Klaustrafobius/simple_code_test_project
9f3ccc7dcd83fc3c5d31674525f226bb34bf3a54
cb388cd176f5d3c2c33a67e81b9e4b88ff7efb4f
refs/heads/master
2018-01-08T02:23:41.554000
2016-03-09T08:43:03
2016-03-09T09:20:41
52,870,109
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package my.verysimple.testproject.fragment; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.TextView; import my.verysimple.testproject.R; import my.verysimple.testproject.adapter.TransactionAdapter; import my.verysimple.testproject.data.ProductViewModel; import my.verysimple.testproject.util.Extra; /** * Created by Dima S. on 18.01.2016. */ public class TransactionsFragment extends BaseListFragment { private ViewHolder mHolder; private ProductViewModel mProduct; public static TransactionsFragment newInstance(ProductViewModel product) { Bundle args = new Bundle(); args.putParcelable(Extra.PRODUCT, product); TransactionsFragment fragment = new TransactionsFragment(); fragment.setArguments(args); return fragment; } @Override public int getContentLayoutResId() { return R.layout.fragment_transactions; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { if (mHolder != null) return; mProduct = getArguments() == null ? null : getArguments().getParcelable(Extra.PRODUCT); mHolder = new ViewHolder(view); mHolder.list.setLayoutManager(new LinearLayoutManager(getContext())); mHolder.toolbar.setTitle(R.string.title_transactions); mHolder.toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); mHolder.toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed()); if (updateFragmentState(mProduct.getTransactions())) { mHolder.total.setText(getString(R.string.transaction_total_title, mProduct.getTotalInPounds())); mHolder.list.setAdapter(new TransactionAdapter(mProduct.getTransactions())); } } private static final class ViewHolder { public final View root; public final RecyclerView list; public final Toolbar toolbar; public final TextView total; public ViewHolder(View root) { this.root = root; list = (RecyclerView) root.findViewById(R.id.list); toolbar = (Toolbar) root.findViewById(R.id.toolbar); total = (TextView) root.findViewById(R.id.total); } } }
UTF-8
Java
2,390
java
TransactionsFragment.java
Java
[ { "context": "ysimple.testproject.util.Extra;\n\n/**\n * Created by Dima S. on 18.01.2016.\n */\npublic class TransactionsFragm", "end": 496, "score": 0.9997220039367676, "start": 490, "tag": "NAME", "value": "Dima S" } ]
null
[]
package my.verysimple.testproject.fragment; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.TextView; import my.verysimple.testproject.R; import my.verysimple.testproject.adapter.TransactionAdapter; import my.verysimple.testproject.data.ProductViewModel; import my.verysimple.testproject.util.Extra; /** * Created by <NAME>. on 18.01.2016. */ public class TransactionsFragment extends BaseListFragment { private ViewHolder mHolder; private ProductViewModel mProduct; public static TransactionsFragment newInstance(ProductViewModel product) { Bundle args = new Bundle(); args.putParcelable(Extra.PRODUCT, product); TransactionsFragment fragment = new TransactionsFragment(); fragment.setArguments(args); return fragment; } @Override public int getContentLayoutResId() { return R.layout.fragment_transactions; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { if (mHolder != null) return; mProduct = getArguments() == null ? null : getArguments().getParcelable(Extra.PRODUCT); mHolder = new ViewHolder(view); mHolder.list.setLayoutManager(new LinearLayoutManager(getContext())); mHolder.toolbar.setTitle(R.string.title_transactions); mHolder.toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); mHolder.toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed()); if (updateFragmentState(mProduct.getTransactions())) { mHolder.total.setText(getString(R.string.transaction_total_title, mProduct.getTotalInPounds())); mHolder.list.setAdapter(new TransactionAdapter(mProduct.getTransactions())); } } private static final class ViewHolder { public final View root; public final RecyclerView list; public final Toolbar toolbar; public final TextView total; public ViewHolder(View root) { this.root = root; list = (RecyclerView) root.findViewById(R.id.list); toolbar = (Toolbar) root.findViewById(R.id.toolbar); total = (TextView) root.findViewById(R.id.total); } } }
2,390
0.706276
0.701674
70
33.142857
28.528826
108
false
false
0
0
0
0
0
0
0.557143
false
false
4
83ca690aa47705212dc218bd1f44c65839e5470d
32,813,550,191,020
b4269a50c161e521b5ac9d9164645b5eab21502f
/viewer-selection/src/main/java/de/javagl/viewer/selection/SelectionHandlers.java
6d7ac801b5ead4658bf60d634684a16ba0997d50
[]
no_license
javagl/Viewer
https://github.com/javagl/Viewer
f93417fe0d89e0ec9ebf88ad6f663659cbed14b0
4936f1af8af11cec43201de2aeb9c2fc551bd9d7
refs/heads/master
2020-05-29T19:44:02.394000
2020-01-29T16:52:57
2020-01-29T16:52:57
39,520,735
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * www.javagl.de - Viewer * * Copyright (c) 2013-2020 Marco Hutter - http://www.javagl.de * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package de.javagl.viewer.selection; /** * Methods to create {@link SelectionHandler} instances */ public class SelectionHandlers { /** * Creates a new {@link SelectionHandler} that responds to mouse * clicks.<br> * <br> * When it is {@link SelectionHandler#connect connected} to a viewer and * a selection model, it will use the given {@link PointBasedSelector} * to determine the elements that are affected by the mouse input. * * @param <T> The type of the elements * * @param pointBasedSelector The {@link PointBasedSelector}. * May not be <code>null</code>. * @return The {@link SelectionHandler} */ public static <T> SelectionHandler<T> createClick( PointBasedSelector<T> pointBasedSelector) { return new ClickSelectionHandler<T>(pointBasedSelector); } /** * Creates a new {@link SelectionHandler} that allows selecting elements * with a lasso.<br> * <br> * When it is {@link SelectionHandler#connect connected} to a viewer and * a selection model, it will use the given {@link ShapeBasedSelector} * to determine the elements that are affected by the mouse input. * * @param <T> The type of the elements * * @param shapeBasedSelector The {@link ShapeBasedSelector}. * May not be <code>null</code>. * @return The {@link SelectionHandler} */ public static <T> SelectionHandler<T> createLasso( ShapeBasedSelector<T> shapeBasedSelector) { return new LassoSelectionHandler<T>(shapeBasedSelector); } /** * Creates a new {@link SelectionHandler} that allows selecting elements * with a rectangle.<br> * <br> * When it is {@link SelectionHandler#connect connected} to a viewer and * a selection model, it will use the given {@link ShapeBasedSelector} * to determine the elements that are affected by the mouse input. * * @param <T> The type of the elements * * @param shapeBasedSelector The {@link ShapeBasedSelector}. * May not be <code>null</code>. * @return The {@link SelectionHandler} */ public static <T> SelectionHandler<T> createRectangle( ShapeBasedSelector<T> shapeBasedSelector) { return new RectangleSelectionHandler<T>(shapeBasedSelector); } /** * Private constructor to prevent instantiation */ private SelectionHandlers() { // Private constructor to prevent instantiation } }
UTF-8
Java
3,831
java
SelectionHandlers.java
Java
[ { "context": "javagl.de - Viewer\r\n *\r\n * Copyright (c) 2013-2020 Marco Hutter - http://www.javagl.de\r\n * \r\n * Permission is her", "end": 74, "score": 0.9998400211334229, "start": 62, "tag": "NAME", "value": "Marco Hutter" } ]
null
[]
/* * www.javagl.de - Viewer * * Copyright (c) 2013-2020 <NAME> - http://www.javagl.de * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package de.javagl.viewer.selection; /** * Methods to create {@link SelectionHandler} instances */ public class SelectionHandlers { /** * Creates a new {@link SelectionHandler} that responds to mouse * clicks.<br> * <br> * When it is {@link SelectionHandler#connect connected} to a viewer and * a selection model, it will use the given {@link PointBasedSelector} * to determine the elements that are affected by the mouse input. * * @param <T> The type of the elements * * @param pointBasedSelector The {@link PointBasedSelector}. * May not be <code>null</code>. * @return The {@link SelectionHandler} */ public static <T> SelectionHandler<T> createClick( PointBasedSelector<T> pointBasedSelector) { return new ClickSelectionHandler<T>(pointBasedSelector); } /** * Creates a new {@link SelectionHandler} that allows selecting elements * with a lasso.<br> * <br> * When it is {@link SelectionHandler#connect connected} to a viewer and * a selection model, it will use the given {@link ShapeBasedSelector} * to determine the elements that are affected by the mouse input. * * @param <T> The type of the elements * * @param shapeBasedSelector The {@link ShapeBasedSelector}. * May not be <code>null</code>. * @return The {@link SelectionHandler} */ public static <T> SelectionHandler<T> createLasso( ShapeBasedSelector<T> shapeBasedSelector) { return new LassoSelectionHandler<T>(shapeBasedSelector); } /** * Creates a new {@link SelectionHandler} that allows selecting elements * with a rectangle.<br> * <br> * When it is {@link SelectionHandler#connect connected} to a viewer and * a selection model, it will use the given {@link ShapeBasedSelector} * to determine the elements that are affected by the mouse input. * * @param <T> The type of the elements * * @param shapeBasedSelector The {@link ShapeBasedSelector}. * May not be <code>null</code>. * @return The {@link SelectionHandler} */ public static <T> SelectionHandler<T> createRectangle( ShapeBasedSelector<T> shapeBasedSelector) { return new RectangleSelectionHandler<T>(shapeBasedSelector); } /** * Private constructor to prevent instantiation */ private SelectionHandlers() { // Private constructor to prevent instantiation } }
3,825
0.664317
0.662229
101
35.930695
27.391281
76
false
false
0
0
0
0
0
0
0.287129
false
false
4
2621f59d2035755f0c992be0d666993ec9b76535
19,387,482,421,893
12c89c84c366598a4c2f70a16913be7e752fad25
/passwordComplexityChecker/src/com/company/Main.java
c24d8eaaea843ddd7a457605e1acc1c2973f8203
[]
no_license
wakkoTheWarner/passwordChecker
https://github.com/wakkoTheWarner/passwordChecker
836885b4d145bf56c64d6d642863db863561aec0
6acc903db6f41c4889d132e95e4d2bec99ef761c
refs/heads/main
2023-07-02T20:02:20.830000
2021-08-02T19:20:21
2021-08-02T19:20:21
392,037,820
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.util.Scanner; public class Main { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { // variables String repeat = "yes"; // code while (repeat.equalsIgnoreCase("yes")) { System.out.println("Enter a password: "); String userInput = scanner.next(); System.out.println("Is the password complex? " + isPasswordComplex(userInput)); System.out.print("\nWould you like to repeat? "); repeat = scanner.next(); } sayingGoodbye(); } public static boolean isPasswordComplex(String password) { // variables boolean result; // code passwordChecker checkerA = new passwordChecker(password); result = checkerA.findComplexity(); return result; } public static void sayingGoodbye() { System.out.println("\n*********************"); System.out.println("** Goodbye! :) **"); System.out.println("*********************"); } }
UTF-8
Java
1,089
java
Main.java
Java
[]
null
[]
package com.company; import java.util.Scanner; public class Main { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { // variables String repeat = "yes"; // code while (repeat.equalsIgnoreCase("yes")) { System.out.println("Enter a password: "); String userInput = scanner.next(); System.out.println("Is the password complex? " + isPasswordComplex(userInput)); System.out.print("\nWould you like to repeat? "); repeat = scanner.next(); } sayingGoodbye(); } public static boolean isPasswordComplex(String password) { // variables boolean result; // code passwordChecker checkerA = new passwordChecker(password); result = checkerA.findComplexity(); return result; } public static void sayingGoodbye() { System.out.println("\n*********************"); System.out.println("** Goodbye! :) **"); System.out.println("*********************"); } }
1,089
0.561983
0.561983
38
27.657894
23.491629
91
false
false
0
0
0
0
0
0
0.5
false
false
4
65a07f0e00e6fcaef6e4d660d71f6c50fa5871c5
9,294,309,249,340
836f5af601fd4d22e3280120b6b8c48e65d9dbb3
/src/main/java/com/zq/myweb/controller/MyWeb.java
16c020b1a6f3b06286118cfeeda19ff3919b7194
[]
no_license
zhangquan11/MyWeb
https://github.com/zhangquan11/MyWeb
690a4a87ddfefaf806ce15beee162233689eccd5
3070f96447e58ceb7e7798056e89367bc8f4ba8f
refs/heads/master
2023-02-19T14:21:36.759000
2021-01-23T05:57:27
2021-01-23T05:57:27
331,801,127
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zq.myweb.controller; import com.zq.myweb.service.impl.HttpServer; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; /** * @description: * @author: ZQ * @date: 2021-01-22-11:37 */ public class MyWeb { public void startServer(int port) { try { @SuppressWarnings("resource") ServerSocket serverSocket = new ServerSocket(port); while (true) { Socket socket = serverSocket.accept(); new HttpServer(socket).start(); } } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
673
java
MyWeb.java
Java
[ { "context": "java.net.Socket;\n\n/**\n * @description:\n * @author: ZQ\n * @date: 2021-01-22-11:37\n */\npublic class MyWeb", "end": 226, "score": 0.9973238706588745, "start": 224, "tag": "USERNAME", "value": "ZQ" } ]
null
[]
package com.zq.myweb.controller; import com.zq.myweb.service.impl.HttpServer; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; /** * @description: * @author: ZQ * @date: 2021-01-22-11:37 */ public class MyWeb { public void startServer(int port) { try { @SuppressWarnings("resource") ServerSocket serverSocket = new ServerSocket(port); while (true) { Socket socket = serverSocket.accept(); new HttpServer(socket).start(); } } catch (IOException e) { e.printStackTrace(); } } }
673
0.594354
0.576523
31
20.709677
17.680304
63
false
false
0
0
0
0
0
0
0.322581
false
false
4
f14b80291a3a0cc4fb0a3be65e645c93b4374313
17,368,847,768,478
dc6d26bad0c608aa1cce4da39b0615f1942d1e54
/app/src/main/java/com/example/rohit/cryptogame/UsernameFragment.java
1a35379afe4a14f2a55da93ecb112d0298541f76
[]
no_license
rokafella/CryptoGame
https://github.com/rokafella/CryptoGame
cf8f65df2edd95185ef314b4a70d6c7bf0481ebb
9fe42a63868b75b7f18db880d4225672fc7e42c8
refs/heads/master
2020-06-05T00:27:29.846000
2015-04-23T09:03:00
2015-04-23T09:03:00
33,085,022
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.rohit.cryptogame; import android.content.Context; import android.os.Bundle; import android.app.Fragment; import android.os.IBinder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; public class UsernameFragment extends Fragment { private EditText et; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_username, container, false); Button btn = (Button) view.findViewById(R.id.btn_saveuser); et = (EditText) view.findViewById(R.id.txt_username); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { closeKeyboard(getActivity(), et.getWindowToken()); ((MainActivity) getActivity()).saveUser(et.getText().toString()); } }); return view; } public static void closeKeyboard(Context c, IBinder windowToken) { InputMethodManager mgr = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(windowToken, 0); } }
UTF-8
Java
1,411
java
UsernameFragment.java
Java
[ { "context": "package com.example.rohit.cryptogame;\n\nimport android.content.Context;\nimpo", "end": 25, "score": 0.8129856586456299, "start": 20, "tag": "USERNAME", "value": "rohit" } ]
null
[]
package com.example.rohit.cryptogame; import android.content.Context; import android.os.Bundle; import android.app.Fragment; import android.os.IBinder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; public class UsernameFragment extends Fragment { private EditText et; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_username, container, false); Button btn = (Button) view.findViewById(R.id.btn_saveuser); et = (EditText) view.findViewById(R.id.txt_username); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { closeKeyboard(getActivity(), et.getWindowToken()); ((MainActivity) getActivity()).saveUser(et.getText().toString()); } }); return view; } public static void closeKeyboard(Context c, IBinder windowToken) { InputMethodManager mgr = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(windowToken, 0); } }
1,411
0.691708
0.690999
41
33.414635
27.205608
103
false
false
0
0
0
0
0
0
0.682927
false
false
4
13e7efb8b0f84d4c4c4ef3d081f9c44620a9ec9f
10,943,576,699,050
c293e6a44456906741bd47688b955db930a6acb2
/ProjetoSeuBarriga/src/main/java/Tests/RemoverMovimentacaoContaTest.java
4b1c3138894085e2bf9dbc377590e791b06830d9
[]
no_license
viniciusflores/SeleniumWebDriverComJava
https://github.com/viniciusflores/SeleniumWebDriverComJava
2cb4c5088bb20d7ad480a3a5f7bc9b2bf7e85892
c12076839b86ac573e033d8a1e52d8b38c2d7217
refs/heads/master
2020-04-17T15:28:15.440000
2019-05-05T22:20:34
2019-05-05T22:20:34
166,700,307
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Tests; import static Core.Propiedades.NOME_CONTA_ALTERADA; import org.testng.Assert; import org.testng.annotations.Test; import Core.BaseTest; import Pages.ContasPage; import Pages.MenuPage; //@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class RemoverMovimentacaoContaTest extends BaseTest { MenuPage menuPage = new MenuPage(); ContasPage contasPage = new ContasPage(); @Test public void test7_ExcluirContaComMovimentacao(){ menuPage.acessarTelaListarConta(); contasPage.clicarExcluirConta(NOME_CONTA_ALTERADA); Assert.assertEquals("Conta em uso na movimentações", contasPage.obterMensagemErro()); } }
UTF-8
Java
665
java
RemoverMovimentacaoContaTest.java
Java
[]
null
[]
package Tests; import static Core.Propiedades.NOME_CONTA_ALTERADA; import org.testng.Assert; import org.testng.annotations.Test; import Core.BaseTest; import Pages.ContasPage; import Pages.MenuPage; //@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class RemoverMovimentacaoContaTest extends BaseTest { MenuPage menuPage = new MenuPage(); ContasPage contasPage = new ContasPage(); @Test public void test7_ExcluirContaComMovimentacao(){ menuPage.acessarTelaListarConta(); contasPage.clicarExcluirConta(NOME_CONTA_ALTERADA); Assert.assertEquals("Conta em uso na movimentações", contasPage.obterMensagemErro()); } }
665
0.769231
0.767722
24
25.625
23.704453
87
false
false
0
0
0
0
0
0
1.166667
false
false
4
b4808814ab1325bac6516322e014e240357bb490
10,943,576,702,100
11b003b203027724409d2ff9358cd24a4d9c44fb
/src/main/java/com/jas/admin/dao/AdminCodAirportDao.java
768c9abb060608f03815f9989fab9aa67963c758
[]
no_license
suwookChoi/project1
https://github.com/suwookChoi/project1
6906be9c0956c9a970c579cba8ce44c697108a8d
73479ef5bfee9851bc6db460edbad27b1fbae285
refs/heads/master
2022-12-14T22:58:38.671000
2020-09-07T13:18:48
2020-09-07T13:18:48
291,723,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jas.admin.dao; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; import org.springframework.stereotype.Repository; import com.ibatis.sqlmap.client.SqlMapClient; @Repository public class AdminCodAirportDao extends SqlMapClientDaoSupport { @Autowired protected void initDAO(SqlMapClient sqlMapClient) { this.setSqlMapClient(sqlMapClient); } /** * 공항 관리 리스트 조회 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public List<HashMap<String, Object>> getAirportList(HashMap<String, Object> reqMap) throws DataAccessException { return (List<HashMap<String, Object>>)getSqlMapClientTemplate().queryForList("adminCodAirport.getAirportList", reqMap); } /** * 공항 관리 중복 검사 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public List<HashMap<String, Object>> findAirport(HashMap<String, Object> reqMap) { return getSqlMapClientTemplate().queryForList("adminCodAirport.findAirport", reqMap); } /** * 공항 관리 생성 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public HashMap<String, Object> createAirport(HashMap<String, Object> reqMap) throws DataAccessException { return (HashMap<String, Object>)getSqlMapClientTemplate().insert("adminCodAirport.createAirport", reqMap); } /** * 공항 관리 상세 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public HashMap<String, Object> selectAirport(HashMap<String, Object> params) throws DataAccessException { return (HashMap<String, Object>) getSqlMapClientTemplate().queryForObject("adminCodAirport.selectAirport", params); } /** * 공항 관리 삭제 * @param request * @param model * @return * @throws Exception */ public void deleteAirport(HashMap<String, Object> param){ getSqlMapClientTemplate().update("adminCodAirport.deleteAirport", param); } }
UTF-8
Java
2,100
java
AdminCodAirportDao.java
Java
[]
null
[]
package com.jas.admin.dao; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; import org.springframework.stereotype.Repository; import com.ibatis.sqlmap.client.SqlMapClient; @Repository public class AdminCodAirportDao extends SqlMapClientDaoSupport { @Autowired protected void initDAO(SqlMapClient sqlMapClient) { this.setSqlMapClient(sqlMapClient); } /** * 공항 관리 리스트 조회 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public List<HashMap<String, Object>> getAirportList(HashMap<String, Object> reqMap) throws DataAccessException { return (List<HashMap<String, Object>>)getSqlMapClientTemplate().queryForList("adminCodAirport.getAirportList", reqMap); } /** * 공항 관리 중복 검사 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public List<HashMap<String, Object>> findAirport(HashMap<String, Object> reqMap) { return getSqlMapClientTemplate().queryForList("adminCodAirport.findAirport", reqMap); } /** * 공항 관리 생성 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public HashMap<String, Object> createAirport(HashMap<String, Object> reqMap) throws DataAccessException { return (HashMap<String, Object>)getSqlMapClientTemplate().insert("adminCodAirport.createAirport", reqMap); } /** * 공항 관리 상세 * @param model * @throws Exception */ @SuppressWarnings("unchecked") public HashMap<String, Object> selectAirport(HashMap<String, Object> params) throws DataAccessException { return (HashMap<String, Object>) getSqlMapClientTemplate().queryForObject("adminCodAirport.selectAirport", params); } /** * 공항 관리 삭제 * @param request * @param model * @return * @throws Exception */ public void deleteAirport(HashMap<String, Object> param){ getSqlMapClientTemplate().update("adminCodAirport.deleteAirport", param); } }
2,100
0.756158
0.756158
69
28.42029
33.572075
121
false
false
0
0
0
0
0
0
1.275362
false
false
4
7a12ec8b0f68ea48153dae61a592bae5c63795f9
2,439,541,449,734
e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0
/sample-project-5400/src/main/java/com/example/project/sample5400/other/sample6/Other6_271.java
3ce6fa27b7f46c42dd2ce90ea761e56c9a8d3d40
[]
no_license
snicoll-scratches/test-spring-components-index
https://github.com/snicoll-scratches/test-spring-components-index
77e0ad58c8646c7eb1d1563bf31f51aa42a0636e
aa48681414a11bb704bdbc8acabe45fa5ef2fd2d
refs/heads/main
2021-06-13T08:46:58.532000
2019-12-09T15:11:10
2019-12-09T15:11:10
65,806,297
5
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.project.sample5400.other.sample6; public class Other6_271 { }
UTF-8
Java
84
java
Other6_271.java
Java
[]
null
[]
package com.example.project.sample5400.other.sample6; public class Other6_271 { }
84
0.785714
0.678571
5
15.8
20.913155
53
false
false
0
0
0
0
0
0
0.2
false
false
4
4409279b2e684cc24270d342664edd4d57db427a
32,933,809,250,678
59abd5ab3b59f97016edd9dd59b8e6e895ec5ff7
/AutowiringAnnotationOverProperty/src/main/java/com/spring/AutowiringAnnotationOverProperty/Student.java
416b44563817882c1e564f7d3defb561c95d0ce2
[ "MIT" ]
permissive
TheLogicalNights/spring-framework
https://github.com/TheLogicalNights/spring-framework
262569180ed5734f9d8c2e99e746e7a4c8245ab0
1f1b895a14cf3f08fe3be956b3f083704338b343
refs/heads/main
2023-06-05T10:43:27.313000
2021-06-26T15:57:41
2021-06-26T15:57:41
378,109,487
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.spring.AutowiringAnnotationOverProperty; import org.springframework.beans.factory.annotation.Autowired; public class Student { @Autowired private Address address; public Student(Address address) { this.address = address; } @Override public String toString() { return "Student [address=" + address + "]"; } }
UTF-8
Java
344
java
Student.java
Java
[]
null
[]
package com.spring.AutowiringAnnotationOverProperty; import org.springframework.beans.factory.annotation.Autowired; public class Student { @Autowired private Address address; public Student(Address address) { this.address = address; } @Override public String toString() { return "Student [address=" + address + "]"; } }
344
0.729651
0.729651
22
14.636364
18.533865
62
false
false
0
0
0
0
0
0
0.909091
false
false
4
8f11cd0b8136dd91a4409c465c160ae5adbe44a9
14,190,571,952,354
fd5e569258276e43f3134b4b07bb8c9344ff34cc
/src/com/sabel/decorator/Klimaanlage.java
2b0df13b45ddb2246d7a8df2639fc5895002861e
[]
no_license
go2k/swt_decorator
https://github.com/go2k/swt_decorator
f5466c32508e177f74a96955ab3f9316ccea6c3c
8093e7abbc6da6e52d8819c62e3e952f9d021675
refs/heads/master
2020-03-10T05:53:03.169000
2018-04-12T09:32:25
2018-04-12T09:32:25
129,226,961
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sabel.decorator; public class Klimaanlage extends Sonderausstattung { public Klimaanlage(Auto auto) { super(auto); } @Override public double getPreis() { return auto.getPreis() + 1500.00; } @Override public void druckeInfo() { auto.druckeInfo(); System.out.print(", Klimaanlage"); } }
UTF-8
Java
366
java
Klimaanlage.java
Java
[]
null
[]
package com.sabel.decorator; public class Klimaanlage extends Sonderausstattung { public Klimaanlage(Auto auto) { super(auto); } @Override public double getPreis() { return auto.getPreis() + 1500.00; } @Override public void druckeInfo() { auto.druckeInfo(); System.out.print(", Klimaanlage"); } }
366
0.60929
0.592896
20
17.299999
16.526039
52
false
false
0
0
0
0
0
0
0.3
false
false
4