blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
8fb35f9ea4a6e3245c8f7047366901a4efa9aeae
bc57bbb218a6aad2871b08aa03f0000e853f473e
/plugins/sonar/src/test/files/compatibility/android_application/src/test-common/java/igel/example_android_application/TestCommonClass.java
91c30a9ccffec09899a32692852a982fa6e342ed
[ "Apache-2.0" ]
permissive
igeldev/gradle-plugins
63555dc8a5288c3ef64db1cc3f700ad6bc394b09
4da98fcb03e92ce8ba28415693321cefb766397a
refs/heads/master
2021-01-17T03:18:27.358393
2018-01-20T18:45:59
2018-01-20T18:45:59
54,995,090
0
0
null
null
null
null
UTF-8
Java
false
false
876
java
package igel.example_android_application; import android.content.Context; import android.content.res.Resources; import android.util.TypedValue; import org.junit.Assert; public class TestCommonClass { public static void assertDpPx(Context context, int expectedDp, int actualPx) { Resources resources = context.getResources(); float deltaPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, resources.getDisplayMetrics()); float expectedPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, expectedDp, resources.getDisplayMetrics()); Assert.assertTrue( String.format( "expected size is %s, actual size is %s, delta is %s", expectedPx, actualPx, deltaPx), Math.abs(expectedPx - actualPx) <= deltaPx); } }
f8243c62d5ede3b4a3d099a091f5fdbd9eed1ba2
d3596e8876c212a12ac684cca7d3961738cdc2f7
/app/src/main/java/com/hippo/ehviewer/widget/GalleryListView.java
6130d9f712f9385a25961b25125d9d91188a9857
[]
no_license
jackyyf/EhViewer
0c186a9ff65e984243baa137796e59123f0ff1a0
30ff85e25b64a97f1009649927b7ec0e837387d5
refs/heads/dev0121
2020-12-11T09:05:58.330160
2015-07-07T15:32:43
2015-07-07T15:32:43
38,840,061
1
0
null
2015-07-09T19:11:24
2015-07-09T19:11:24
null
UTF-8
Java
false
false
670
java
/* * Copyright (C) 2015 Hippo Seven * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hippo.ehviewer.widget; public class GalleryListView { }
9124464e3c1abb944836d36d533aa788adac0382
db3a31645f40981771442b7378da444deb29667f
/src/main/java/com/sarc/bean/Item_Sell_Amount.java
494cb8e82cd2acfac2225750d01d47d78ce37cf4
[]
no_license
shalikaprasad/WarrantySystem
1b6bfadb7310e93218c5859fe280ffe1797bcb61
2c54a6799bf6e91880e44f46ba77ac1cc2fd0747
refs/heads/master
2021-06-17T03:52:34.695840
2019-07-14T18:10:02
2019-07-14T18:10:02
179,512,165
0
0
null
null
null
null
UTF-8
Java
false
false
1,587
java
package com.sarc.bean; import javax.persistence.*; import java.util.Set; @Entity @Table(name="Item_Sell_Amount") public class Item_Sell_Amount { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "item_sell_amount_id", nullable = false) private int item_sell_amount_id; private double item_sell_amount_value; private double item_down_payment; private double item_monthly_payment; private double item_interes; public Item_Sell_Amount() { super(); } public int getItem_sell_amount_id() { return item_sell_amount_id; } public void setItem_sell_amount_id(int item_sell_amount_id) { this.item_sell_amount_id = item_sell_amount_id; } public double getItem_sell_amount_value() { return item_sell_amount_value; } public void setItem_sell_amount_value(double item_sell_amount_value) { this.item_sell_amount_value = item_sell_amount_value; } public double getItem_down_payment() { return item_down_payment; } public void setItem_down_payment(double item_down_payment) { this.item_down_payment = item_down_payment; } public double getItem_monthly_payment() { return item_monthly_payment; } public void setItem_monthly_payment(double item_monthly_payment) { this.item_monthly_payment = item_monthly_payment; } public double getItem_interes() { return item_interes; } public void setItem_interes(double item_interes) { this.item_interes = item_interes; } }
26b8ef0ca1fb50088226e0e9525520d6e0bdf43f
05a0d830c7d6759b281434f28755124fb707ecfd
/src/plan_runner/thetajoin/indexes/Index.java
800a2d9baeb62e20c30347d8b628828b8a9e77b7
[ "Apache-2.0" ]
permissive
linearregression/squall
590ee8652a5aa20824d541951e5039d2e513491c
7e6e8f341754fe3a93f2c607bdb893a4a9f03e1d
refs/heads/master
2020-12-28T22:22:10.073655
2014-12-23T20:22:51
2014-12-23T20:22:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
package plan_runner.thetajoin.indexes; import gnu.trove.list.array.TIntArrayList; import java.io.Serializable; /** * @author Zervos Theta-Join Index interface. All indexes (Hash, B+, etc) should * implement this). Key is a string and value is a list of row-ids in * the storage structures (where the tuples are saved) */ public interface Index<KeyType> extends Serializable { public TIntArrayList getValues(int operator, KeyType key); public TIntArrayList getValuesWithOutOperator(KeyType key, KeyType... keys); public void put(Integer row_id, KeyType key); }
877b91b6e562d3239debb38307c1ad76e7a06ebc
71a4923fd7e78ffc7859fed614bb8d00e8c2e634
/app/src/main/java/com/delta/smt/ui/Personal/my_order/no_payment/order_detail/mvp/OrderDetailModel.java
ca304435ba3c470ba042ce96cd7c60bb502df3d1
[]
no_license
zhangfuxiang/Tea_Market
1ee325b7cd568855c53037ec91610d1c02394ec4
1ec994c34e7d3244381e843434f33eb0e1cb052c
refs/heads/master
2020-12-02T17:50:43.400572
2017-07-06T14:52:55
2017-07-06T14:52:55
96,438,251
8
0
null
null
null
null
UTF-8
Java
false
false
1,238
java
package com.delta.smt.ui.Personal.my_order.no_payment.order_detail.mvp; import com.delta.commonlibs.utils.RxsRxSchedulers; import com.delta.smt.api.ApiService; import com.delta.smt.base.BaseModel; import com.delta.smt.entity.ItemBean1; import com.delta.smt.entity.ItemOrderDetail; import com.delta.smt.entity.ItemPaySuccess; import java.util.Map; import okhttp3.ResponseBody; import rx.Observable; /** * Created by Fuxiang.Zhang on 2017/4/27. */ public class OrderDetailModel extends BaseModel<ApiService> implements OrderDetailContract.Model { public OrderDetailModel(ApiService apiService) { super(apiService); } @Override public Observable<ResponseBody> getOrderDetail(String token, String id) { return getService().getOrderDetail(token,id).compose(RxsRxSchedulers.<ResponseBody>io_main()); } @Override public Observable<ResponseBody> cancelOrder(String token, String id) { return getService().cancelOrder(token,id).compose(RxsRxSchedulers. <ResponseBody>io_main()); } @Override public Observable<ResponseBody> payOrder(Map<String, String> queryMap) { return getService().payOrder(queryMap).compose(RxsRxSchedulers.<ResponseBody>io_main()); } }
375354bb1df78ecbcc166d297050bd75d70cd1bd
739ec012fafbe6936d926171417690efc470ccd8
/PractisePrograms/source/Interface/TestWalkyTalky.java
e7163330273a34101e1ff2e50baee3dc521e3d6d
[]
no_license
abhibala19/CoreJavaPrograms
ea47fd87d6611434aacefc777fcd2251ec8e6d7d
3921accf89174ad5b73f9d7f65c1e2193f7d9825
refs/heads/main
2023-08-21T12:00:02.360457
2021-10-22T11:03:49
2021-10-22T11:03:49
386,220,782
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package Interface; public class TestWalkyTalky { public static void main(String[] args) { Transmitter t1=new FMTransmitter(); Transmitter t2=new AMTransmitter(); Receiver r1=new FMReceiver(); Receiver r2=new AMReceiver(); WalkyTalky w1=new WalkyTalky(t1, r2); WalkyTalky w2=new WalkyTalky(t2, r1); w1.transmit("hey,hi how are you ?"); w2.transmit("hey,hi how are yo? ,how is going?"); System.out.println(w1.receive()); System.out.println(w2.receive()); } }
f78a1c1c31c9b7bae4beec84592e41fc20d6a926
4ea961284c06788c9bac1b31d35d2188003b88da
/PHAS3459/src/module6/Theory.java
e6d5d7ef9693bab549e59370145777bd5edbe712
[]
no_license
glukicov/JavaCourse
8fe657e2eca043fc184d44ef9234b6124c462b71
b145ecac446899ffd24d3f41a36f43d52982209e
refs/heads/master
2021-05-27T23:28:40.554105
2014-12-17T20:52:54
2014-12-17T20:52:54
25,164,512
1
0
null
null
null
null
UTF-8
Java
false
false
186
java
package module6; public interface Theory { // Defines a protocol of behaviour that can be implemented by any class, // anywhere in the hierarchy double y(double x); }
0d3111719e15839906eb9232919baea90e474255
9888e6dbf1ca643b27d2a9f1857d6fed66360811
/src/main/java/com/office/pojo/AdministratorsExample.java
e6c0135166ade8b6d7deafb6426d9f4ac87b57f3
[]
no_license
usefullname/school_project
64a145cea518e6fa70efd2c3f353af057f6c33f1
98b78661aea267b12452b6fcdd239c850b3dd21c
refs/heads/master
2020-03-26T05:15:53.489102
2018-08-13T08:48:45
2018-08-13T08:48:45
144,547,327
0
0
null
null
null
null
UTF-8
Java
false
false
15,654
java
package com.office.pojo; import java.util.ArrayList; import java.util.List; public class AdministratorsExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public AdministratorsExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andAnoIsNull() { addCriterion("ANo is null"); return (Criteria) this; } public Criteria andAnoIsNotNull() { addCriterion("ANo is not null"); return (Criteria) this; } public Criteria andAnoEqualTo(Integer value) { addCriterion("ANo =", value, "ano"); return (Criteria) this; } public Criteria andAnoNotEqualTo(Integer value) { addCriterion("ANo <>", value, "ano"); return (Criteria) this; } public Criteria andAnoGreaterThan(Integer value) { addCriterion("ANo >", value, "ano"); return (Criteria) this; } public Criteria andAnoGreaterThanOrEqualTo(Integer value) { addCriterion("ANo >=", value, "ano"); return (Criteria) this; } public Criteria andAnoLessThan(Integer value) { addCriterion("ANo <", value, "ano"); return (Criteria) this; } public Criteria andAnoLessThanOrEqualTo(Integer value) { addCriterion("ANo <=", value, "ano"); return (Criteria) this; } public Criteria andAnoIn(List<Integer> values) { addCriterion("ANo in", values, "ano"); return (Criteria) this; } public Criteria andAnoNotIn(List<Integer> values) { addCriterion("ANo not in", values, "ano"); return (Criteria) this; } public Criteria andAnoBetween(Integer value1, Integer value2) { addCriterion("ANo between", value1, value2, "ano"); return (Criteria) this; } public Criteria andAnoNotBetween(Integer value1, Integer value2) { addCriterion("ANo not between", value1, value2, "ano"); return (Criteria) this; } public Criteria andGlnoIsNull() { addCriterion("GLNo is null"); return (Criteria) this; } public Criteria andGlnoIsNotNull() { addCriterion("GLNo is not null"); return (Criteria) this; } public Criteria andGlnoEqualTo(Integer value) { addCriterion("GLNo =", value, "glno"); return (Criteria) this; } public Criteria andGlnoNotEqualTo(Integer value) { addCriterion("GLNo <>", value, "glno"); return (Criteria) this; } public Criteria andGlnoGreaterThan(Integer value) { addCriterion("GLNo >", value, "glno"); return (Criteria) this; } public Criteria andGlnoGreaterThanOrEqualTo(Integer value) { addCriterion("GLNo >=", value, "glno"); return (Criteria) this; } public Criteria andGlnoLessThan(Integer value) { addCriterion("GLNo <", value, "glno"); return (Criteria) this; } public Criteria andGlnoLessThanOrEqualTo(Integer value) { addCriterion("GLNo <=", value, "glno"); return (Criteria) this; } public Criteria andGlnoIn(List<Integer> values) { addCriterion("GLNo in", values, "glno"); return (Criteria) this; } public Criteria andGlnoNotIn(List<Integer> values) { addCriterion("GLNo not in", values, "glno"); return (Criteria) this; } public Criteria andGlnoBetween(Integer value1, Integer value2) { addCriterion("GLNo between", value1, value2, "glno"); return (Criteria) this; } public Criteria andGlnoNotBetween(Integer value1, Integer value2) { addCriterion("GLNo not between", value1, value2, "glno"); return (Criteria) this; } public Criteria andAnameIsNull() { addCriterion("AName is null"); return (Criteria) this; } public Criteria andAnameIsNotNull() { addCriterion("AName is not null"); return (Criteria) this; } public Criteria andAnameEqualTo(String value) { addCriterion("AName =", value, "aname"); return (Criteria) this; } public Criteria andAnameNotEqualTo(String value) { addCriterion("AName <>", value, "aname"); return (Criteria) this; } public Criteria andAnameGreaterThan(String value) { addCriterion("AName >", value, "aname"); return (Criteria) this; } public Criteria andAnameGreaterThanOrEqualTo(String value) { addCriterion("AName >=", value, "aname"); return (Criteria) this; } public Criteria andAnameLessThan(String value) { addCriterion("AName <", value, "aname"); return (Criteria) this; } public Criteria andAnameLessThanOrEqualTo(String value) { addCriterion("AName <=", value, "aname"); return (Criteria) this; } public Criteria andAnameLike(String value) { addCriterion("AName like", value, "aname"); return (Criteria) this; } public Criteria andAnameNotLike(String value) { addCriterion("AName not like", value, "aname"); return (Criteria) this; } public Criteria andAnameIn(List<String> values) { addCriterion("AName in", values, "aname"); return (Criteria) this; } public Criteria andAnameNotIn(List<String> values) { addCriterion("AName not in", values, "aname"); return (Criteria) this; } public Criteria andAnameBetween(String value1, String value2) { addCriterion("AName between", value1, value2, "aname"); return (Criteria) this; } public Criteria andAnameNotBetween(String value1, String value2) { addCriterion("AName not between", value1, value2, "aname"); return (Criteria) this; } public Criteria andAsexIsNull() { addCriterion("ASex is null"); return (Criteria) this; } public Criteria andAsexIsNotNull() { addCriterion("ASex is not null"); return (Criteria) this; } public Criteria andAsexEqualTo(String value) { addCriterion("ASex =", value, "asex"); return (Criteria) this; } public Criteria andAsexNotEqualTo(String value) { addCriterion("ASex <>", value, "asex"); return (Criteria) this; } public Criteria andAsexGreaterThan(String value) { addCriterion("ASex >", value, "asex"); return (Criteria) this; } public Criteria andAsexGreaterThanOrEqualTo(String value) { addCriterion("ASex >=", value, "asex"); return (Criteria) this; } public Criteria andAsexLessThan(String value) { addCriterion("ASex <", value, "asex"); return (Criteria) this; } public Criteria andAsexLessThanOrEqualTo(String value) { addCriterion("ASex <=", value, "asex"); return (Criteria) this; } public Criteria andAsexLike(String value) { addCriterion("ASex like", value, "asex"); return (Criteria) this; } public Criteria andAsexNotLike(String value) { addCriterion("ASex not like", value, "asex"); return (Criteria) this; } public Criteria andAsexIn(List<String> values) { addCriterion("ASex in", values, "asex"); return (Criteria) this; } public Criteria andAsexNotIn(List<String> values) { addCriterion("ASex not in", values, "asex"); return (Criteria) this; } public Criteria andAsexBetween(String value1, String value2) { addCriterion("ASex between", value1, value2, "asex"); return (Criteria) this; } public Criteria andAsexNotBetween(String value1, String value2) { addCriterion("ASex not between", value1, value2, "asex"); return (Criteria) this; } public Criteria andAtelIsNull() { addCriterion("ATel is null"); return (Criteria) this; } public Criteria andAtelIsNotNull() { addCriterion("ATel is not null"); return (Criteria) this; } public Criteria andAtelEqualTo(String value) { addCriterion("ATel =", value, "atel"); return (Criteria) this; } public Criteria andAtelNotEqualTo(String value) { addCriterion("ATel <>", value, "atel"); return (Criteria) this; } public Criteria andAtelGreaterThan(String value) { addCriterion("ATel >", value, "atel"); return (Criteria) this; } public Criteria andAtelGreaterThanOrEqualTo(String value) { addCriterion("ATel >=", value, "atel"); return (Criteria) this; } public Criteria andAtelLessThan(String value) { addCriterion("ATel <", value, "atel"); return (Criteria) this; } public Criteria andAtelLessThanOrEqualTo(String value) { addCriterion("ATel <=", value, "atel"); return (Criteria) this; } public Criteria andAtelLike(String value) { addCriterion("ATel like", value, "atel"); return (Criteria) this; } public Criteria andAtelNotLike(String value) { addCriterion("ATel not like", value, "atel"); return (Criteria) this; } public Criteria andAtelIn(List<String> values) { addCriterion("ATel in", values, "atel"); return (Criteria) this; } public Criteria andAtelNotIn(List<String> values) { addCriterion("ATel not in", values, "atel"); return (Criteria) this; } public Criteria andAtelBetween(String value1, String value2) { addCriterion("ATel between", value1, value2, "atel"); return (Criteria) this; } public Criteria andAtelNotBetween(String value1, String value2) { addCriterion("ATel not between", value1, value2, "atel"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
285409703d2adbbef66947eb831abeaba3eb88be
c6dba569868ad390684ad70179f8cd47ee21a571
/app/src/main/java/com/wxl/uidemo/widget/ItemSwitchLayout.java
f3604b269caedfbcd64fde76653033a03967a57e
[]
no_license
wwuxl/UIDemo
3eaa0591ed73e6cc67260443194db4cf9efc6e44
b20ed798b83b1d273c4f2cb7e5e18eeca20a0bbd
refs/heads/master
2021-05-11T10:43:01.413666
2018-01-19T10:07:39
2018-01-19T10:07:39
118,109,444
1
0
null
null
null
null
UTF-8
Java
false
false
3,509
java
package com.wxl.uidemo.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.Switch; import android.widget.TextView; import com.wxl.uidemo.R; /** * Created by WXL on 2017/12/22. */ public class ItemSwitchLayout extends LinearLayout { private View mItemView; private View mLineView; private String itemTitle; private boolean isVisible; private boolean isCheck; private Switch mOptionSwitch; private TextView mOptionText; private OnCheckedChangeListener mListener; public ItemSwitchLayout(Context context) { this(context,null); } public ItemSwitchLayout(Context context, @Nullable AttributeSet attrs) { this(context, attrs,0); } public ItemSwitchLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setBackgroundColor(Color.WHITE); setOrientation(VERTICAL); LayoutParams params1=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT); mItemView = LayoutInflater.from(getContext()).inflate(R.layout.view_switch_layout,null); mItemView.setLayoutParams(params1); addView(mItemView); LayoutParams params=new LayoutParams(LayoutParams.MATCH_PARENT,1); mLineView = new View(getContext()); mLineView.setLayoutParams(params); mLineView.setBackgroundColor(getResources().getColor(R.color.line_color_dddddd)); addView(mLineView); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ItemSwitchLayout); itemTitle = typedArray.getString(R.styleable.ItemSwitchLayout_itemTitle); isVisible =typedArray.getBoolean(R.styleable.ItemSwitchLayout_linVisible,false); isCheck =typedArray.getBoolean(R.styleable.ItemSwitchLayout_switchCheck,false); typedArray.recycle(); initView(); } private void initView() { mOptionSwitch = mItemView.findViewById(R.id.option_switch); mOptionText = mItemView.findViewById(R.id.option_text); mOptionSwitch.setChecked(isCheck); mOptionText.setText(itemTitle); mLineView.setVisibility(isVisible?VISIBLE:GONE); mOptionSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if(mListener!=null){ mListener.onCheckedChanged(b); } } }); } public void setChecked(boolean isCheck){ this.isCheck=isCheck; mOptionSwitch.setChecked(isCheck); } public void setItemTitle(String itemTitle){ this.itemTitle=itemTitle; mOptionText.setText(itemTitle); } public View getItemView() { return mItemView; } public String getItemTitle() { return itemTitle; } public boolean isCheck() { return mOptionSwitch.isChecked(); } public interface OnCheckedChangeListener{ void onCheckedChanged(boolean isCheck); } public void setOnCheckedChangeListener(OnCheckedChangeListener listener){ mListener = listener; } }
7d86828a9d48940607fe088416bab303505a0549
e190a46252e099559eb4d6c3c6743d562b868987
/AddUserPage.java
5479cf5dbeb4e7229f65831793da5b63ea4bbe04
[]
no_license
LiamDonoghue20/TestsLiam
87243baadc21afcdbdee2214edc4a58ba8e16ab3
8f169672c71c3e2f9a0196ca6c958e62651a2848
refs/heads/master
2020-03-21T02:28:22.452841
2018-06-25T08:54:55
2018-06-25T08:54:55
138,000,223
0
0
null
2018-06-25T08:52:52
2018-06-20T08:06:14
Java
UTF-8
Java
false
false
1,621
java
package liamGroupID.DemoQAFunctions; import static org.junit.Assert.assertEquals; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; //this class is no long of use public class AddUserPage { @FindBy(xpath = "//*[@id=\"systemUser_userType\"]") private WebElement userRoleSelect; @FindBy(xpath="//*[@id=\"systemUser_employeeName_empName\"]") public WebElement employeeNameInput; @FindBy(xpath="//*[@id=\"systemUser_userName\"]") public WebElement usernameInput; @FindBy(xpath="//*[@id=\"systemUser_status\"]") WebElement userStatusSelect; @FindBy(xpath="//*[@id=\"systemUser_password\"]") public WebElement userPasswordInput; @FindBy(xpath="//*[@id=\"systemUser_confirmPassword\"]") private WebElement userPasswordConfirm; @FindBy(xpath="//*[@id=\"btnSave\"]") private WebElement saveBtn; public void createUser() { userRoleSelect.click(); userRoleSelect.sendKeys(Keys.UP); userRoleSelect.sendKeys(Keys.UP); employeeNameInput.click(); employeeNameInput.sendKeys("h"); employeeNameInput.sendKeys(Keys.ENTER); usernameInput.click(); usernameInput.sendKeys("aaLiamAccount123"); userPasswordInput.click(); userPasswordInput.sendKeys("passw0rd!123"); userPasswordConfirm.click(); userPasswordConfirm.sendKeys("passw0rd!123"); } public void clickSave() { saveBtn.click(); } }
f1b91dc98ecc5d44bbded82e4a2243f4fbcea136
2872b93caebdec8d4658650bf380ea53de439f98
/s85JAVAweb06/src/main/java/com/servlet/UserServlet.java
5270a4fc1893cedf3e1df5ecbf4d5f67a840bdc0
[]
no_license
Michael-nan/sunjob
9ce4845e39cdffd56eab2ad178eae5a999bc50b6
9b5bc6fc045a8fdc2b3599c2203a28c0a7d88f6a
refs/heads/master
2022-12-28T21:28:32.672425
2020-10-18T09:00:24
2020-10-18T09:00:24
305,053,256
0
0
null
null
null
null
UTF-8
Java
false
false
2,661
java
package com.servlet; import com.dao.UserDao; import com.pojo.UserInfo; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; @WebServlet("/user.do") public class UserServlet extends HttpServlet { private UserDao userDao=new UserDao();//DAO全局,多个方法需要用 @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String p=request.getParameter("p"); if("fenye".equals(p)){ //如果参数是分页 就做分页的操作 doFenYe(request,response); } if ("deletebyusername".equals(p)){ doDeleteByName(request,response); } } private void doDeleteByName(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username=request.getParameter("username"); userDao.deleteByUsername(username); doFenYe(request,response);//刷新 } private void doFenYe(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int page=1; int size=3;////如果用户没有指定页数页条数 给默认值 String pageString=request.getParameter("page"); if(pageString!=null && pageString.trim().length()>0){ page=Integer.parseInt(pageString); } String sizeString=request.getParameter("size"); if (sizeString!=null && sizeString.trim().length()>0){ size=Integer.parseInt(sizeString); } //越界判断 if (page<1){ page=1; } //总页数=总条数(数据库查)/每一页的条数size /* Double count=userDao.getCount(); int pageCount=Math.ceil(count/size); */ int count=userDao.getCount(); int pageCount= count%size==0 ? count/size: count/size + 1; if (page>pageCount){ page=pageCount; } List<UserInfo> list=userDao.fenye(page,size);//查询 Map map=new HashMap(); map.put("page",page);//当前页 map.put("size",size);//每一页条数 map.put("list",list);//该页的数据 map.put("count",count);//总条数 map.put("pageCount",pageCount);//总页数 request.setAttribute("map",map);//存值 request.getRequestDispatcher("show.jsp").forward(request,response); } }
b07cb133f0ea69889aa8836910ebabb90e65aec4
3c4634d4dca604f5389ad77a5a9eb244c1eb2f8b
/resttemplate/src/main/java/io/simpolor/resttemplate/controller/WelcomeController.java
dc4026214e0f7b1e9a3a89108e1dfe114835ddde
[]
no_license
simpolor/sample-springboot-web
6b88237117c8fd61fb2d4aae007d42e48dc774a3
ac8c2323afe280104e8c7494a92d27c27776f618
refs/heads/master
2023-08-31T07:29:50.324801
2023-08-23T13:02:18
2023-08-23T13:02:18
218,306,705
0
0
null
2021-06-04T02:17:42
2019-10-29T14:28:13
Java
UTF-8
Java
false
false
403
java
package io.simpolor.resttemplate.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class WelcomeController { @RequestMapping({"/", "/index", "/welcome"}) @ResponseBody public String welcome() { return "restTemplate"; } }
217c10334e8e8e2ed7ce30ec84e46575ce6182a0
a54cfc768f1e0385a7c8f99db7acd56cea50e709
/WebPoker/src/Servlets/GameRoom/GetTableInfoServlet.java
d53ce4ae475ea24a7bee9d626f62089f348ef46a
[]
no_license
avithalker/TexasHoldemPoker
784dd14ce7fe8b4ecbd0805b2e5d7fb40700b85a
f687a6d9e771cde39138bd165dc7ad9122d4a203
refs/heads/master
2021-05-10T14:37:39.054251
2018-03-08T20:12:21
2018-03-08T20:12:21
118,525,142
2
1
null
null
null
null
UTF-8
Java
false
false
1,560
java
package Servlets.GameRoom; import PokerDtos.TableInfoDto; import ServletContexts.GameRoom; import ServletContexts.GameRoomManager; import ServletUtils.ServletContextUtils; import ServletUtils.SessionUtils; import com.google.gson.Gson; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(name = "GetTableInfoServlet", urlPatterns = {"/GameRoom/tableInfo"}) public class GetTableInfoServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); String userName = SessionUtils.getUsername(req); if(userName == null){ throw new ServletException("Error- player is not logged in!"); } GameRoomManager lobby = ServletContextUtils.getServerLobby(getServletContext()); GameRoom gameRoom = lobby.getRoomByPlayer(userName); if(gameRoom == null) throw new ServletException("Error- player didn't join to a game room!"); TableInfoDto tableInfoDto = gameRoom.getTableInfo(); Gson jsonParser = new Gson(); String tableInfoJson = jsonParser.toJson(tableInfoDto); try (PrintWriter out = resp.getWriter()) { out.write(tableInfoJson); out.flush(); } } }
1b28e02106ff99a97e2e1523d6bc3869072c2892
cfed8f6e13c33776e4b6e9d81fb01abbcc5bee35
/src/main/java/org/luc4ir/evaluator/RCDEvaluator.java
1246030b7d69b686f5f5e4e36962062212978aed
[]
no_license
gdebasis/luc4ir
b4bbb1004e56cb16fedd5eb03ba8b163a85754a2
156dea5c89ddb10de862035a790c1226fcf9d327
refs/heads/master
2023-09-01T05:39:28.129598
2023-04-21T16:09:42
2023-04-21T16:09:42
209,828,964
0
0
null
2023-08-24T20:27:49
2019-09-20T15:56:29
Java
UTF-8
Java
false
false
5,258
java
/* * 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 org.luc4ir.evaluator; import java.io.*; import java.util.*; import org.apache.commons.io.FileUtils; import org.apache.james.mime4j.Charsets; import org.apache.lucene.analysis.en.EnglishAnalyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.luc4ir.indexing.TrecDocIndexer; /** * * @author debforit */ class PredRelPair { String id; String pred; String rel; public PredRelPair(String id, String pred, String rel) { this.id = id; this.pred = TrecDocIndexer.analyze(new StandardAnalyzer(), pred); this.rel = TrecDocIndexer.analyze(new StandardAnalyzer(), rel); } public float getSim(int ngramSize) { DocVector predvec = new DocVector(pred, ngramSize); DocVector refvec = new DocVector(rel, ngramSize); return ngramSize>0? predvec.cosineSim(refvec): predvec.jaccard(refvec); } @Override public String toString() { return id + "\t" + pred + "\t" + rel; } } public class RCDEvaluator { Map<String, List<String>> equivQueries; Map<String, PredRelPair> predRelPairs; //static public int N = 5; RCDEvaluator(String predRelTsv, String equivFile) throws Exception { loadEquivQueries(equivFile); loadPredRelPair(predRelTsv); } final void loadEquivQueries(String equivFile) throws Exception { FileReader fr = new FileReader(equivFile); BufferedReader br = new BufferedReader(fr); String line; equivQueries = new HashMap<>(); int i=1; while ((line = br.readLine()) != null) { List<String> queries = new ArrayList<>(); String[] tokens = line.split("\\s+"); for (String token: tokens) { queries.add(token); } equivQueries.put(String.format("Q%d", i), queries); i++; } br.close(); fr.close(); } final void loadPredRelPair(String predRelFile) throws IOException { predRelPairs = new HashMap<>(); List<String> lines = FileUtils.readLines(new File(predRelFile), Charsets.UTF_8); for (String line: lines) { String[] tokens = line.split("\t"); PredRelPair predrel = new PredRelPair(tokens[0], tokens[1], tokens[2]); predRelPairs.put(predrel.id, predrel); } } float printAvgNGramMatchStats(int ngramValue) { float avg = 0; int numEvaluated = 0; boolean evaluate; for (List<String> equivQueries: equivQueries.values()) { // Merge the rel/pred sets for this query group... StringBuffer relTextBuff = new StringBuffer(); StringBuffer predTextBuff = new StringBuffer(); StringBuffer idBuff = new StringBuffer(); evaluate = true; for (String qid: equivQueries) { PredRelPair tuple = predRelPairs.get(qid); if (tuple==null) { evaluate = false; break; } predTextBuff.append(tuple.pred).append(" "); relTextBuff.append(tuple.rel).append(" "); idBuff.append(qid).append(" "); } if (!evaluate) continue; String predTextStr = predTextBuff.toString().trim(); String relTextStr = relTextBuff.toString().trim(); String id = idBuff.toString().trim(); PredRelPair tuple = new PredRelPair(id, predTextStr, relTextStr); float sim = tuple.getSim(ngramValue); System.out.println(tuple.toString() + "\t" + sim); avg += sim; numEvaluated++; } avg = avg/(float)numEvaluated; System.out.println(String.format("Avg. %d-gram Cosine-Sim = %.4f", ngramValue, avg)); return avg; } public static void main(String[] args) { if (args.length < 2) { System.err.println("usage: java Evaluator <pred-rel file> <equiv query list>"); System.err.println("Evaluating on default arguments"); // else demo on the sample provide... args = new String[3]; args[0] = "rcd/pred_rel.txt"; args[1] = "rcd/equiv.txt"; // ths would only be present after u run the index } try { RCDEvaluator rcdeval = new RCDEvaluator(args[0], args[1]); float n_sum = 12.0f; // 3+4+5=12 float wavg = 0; for (int n=3; n<=5; n++) { float w = n/n_sum; // the higher the n the higher the weight float val = rcdeval.printAvgNGramMatchStats(n); wavg += w*val; } System.out.println("BLEU = " + wavg); rcdeval.printAvgNGramMatchStats(0); } catch (Exception ex) { ex.printStackTrace(); } } }
b2281fcaaca91a7a7c8a60889859c4ced37e7cbe
1c24c5cd794d2ac425a123a86ec2563909392ed1
/GeoTracer/app/src/main/java/com/geotracer/geotracer/db/local/BucketUtility.java
7f8e3340e4f4246ac22fe7931ceeb191d5a78560
[]
no_license
GeoTrackerUnipi/GeoTracker
dfa88c65de14e71069fce2812a8bd6521f1c796a
2cff824cee2b3533f06735785b7fec062c1bed5d
refs/heads/main
2023-05-07T19:29:33.317632
2021-05-22T10:30:04
2021-05-22T10:30:04
366,026,756
0
0
null
null
null
null
UTF-8
Java
false
false
5,553
java
package com.geotracer.geotracer.db.local; import com.geotracer.geotracer.utils.generics.RetStatus; import com.geotracer.geotracer.utils.generics.OpStatus; import com.google.firebase.firestore.CollectionReference; import com.google.firebase.firestore.FirebaseFirestore; import java.util.Calendar; import android.util.Log; import io.paperdb.Book; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; ////// BUCKETS // A bucket represents a location from which the user listens updated. It is used to receive // updated from all the places where the user pass-through // Data Format: BUCKET: expire @SuppressWarnings("all") public class BucketUtility { private final Book buckets; private static final String TAG = "KeyValueManagement/BucketUtility"; BucketUtility(Book buckets){ this.buckets = buckets; } // insert a new bucket for message notifications // Returns: // - OpStatus.ILLEGAL_ARGUMENT: illegal argument provided to the function // - OpStatus.OK: the bucket is added to the store // - OpStatus.PRESENT: the bucket is already present inside the store // - OpStatus.ERROR: an error has occurred during the request public OpStatus insertBucket( String bucket ){ if( bucket == null || bucket.length() == 0 ) return OpStatus.ILLEGAL_ARGUMENT; try { // verify the presence of the bucket if (buckets.contains(bucket)) return OpStatus.PRESENT; // add remotely the bucket to the list of available addRemoteBucket(bucket); // we create an expire time of 14 days Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH, 14); // bucket not present so we can insert it buckets.write(bucket, calendar.getTime()); Log.d(TAG,"Bucket " + bucket + " added locally"); return OpStatus.OK; }catch(RuntimeException e){ e.printStackTrace(); return OpStatus.ERROR; } } // removes a registered bucket // Returns: // - OpStatus.ILLEGAL_ARGUMENT: illegal argument provided to the function // - OpStatus.OK: the bucket is correctly removed from the store // - OpStatus.NOT_PRESENT: the bucket is not present inside the store // - OpStatus.ERROR: an error has occurred during the request public OpStatus removeBucket(String bucket){ if( bucket == null || bucket.length() == 0 ) return OpStatus.ILLEGAL_ARGUMENT; try { // verifying the bucket is present if( buckets.contains(bucket)) { // removing the bucket buckets.delete(bucket); Log.d(TAG,"Bucket " + bucket + " removed"); return OpStatus.OK; }else return OpStatus.NOT_PRESENT; }catch(RuntimeException e){ e.printStackTrace(); return OpStatus.ERROR; } } // returns all the saved buckets // Returns: // - OpStatus.OK: return all the saved buckets // - OpStatus.ERROR: an error has occurred during the request public RetStatus<List<String>> getBuckets(){ try { return new RetStatus<>(buckets.getAllKeys(),OpStatus.OK); }catch(RuntimeException e){ e.printStackTrace(); return new RetStatus<>(null, OpStatus.ERROR); } } // drop the buckets from the local database // Returns: // - OpStatus.OK: buckets removed // - OpStatus.ERROR: an error has occurred during the buckets removal public OpStatus dropAllBuckets(){ try{ buckets.destroy(); return OpStatus.OK; }catch(RuntimeException e){ e.printStackTrace(); return OpStatus.ERROR; } } // registry on the firestore database the bucket. Function required to supply the lack of the // back-end. Helps the database to remove old data knowing the registered buckets without any // remote code execution // Returns: // - OpStatus.ILLEGAL_ARGUMENT: illegal argument provided to the function // - OpStatus.OK: the bucket is correctly added // - OpStatus.ERROR: some error happened during function execution private OpStatus addRemoteBucket(String bucket ){ if( bucket == null || bucket.length() == 0 ) return OpStatus.ILLEGAL_ARGUMENT; try { FirebaseFirestore firestore = FirebaseFirestore.getInstance(); CollectionReference collection = firestore.collection("buckets"); collection.whereEqualTo("bucket", bucket).get().addOnSuccessListener(queryDocumentSnapshots -> { // if the bucket isn't present we insert it into the registry if (queryDocumentSnapshots.getDocuments().size() == 0) { Map<String, String> bucketMap = new HashMap<>(); bucketMap.put("bucket", bucket); collection.add(bucketMap).addOnSuccessListener(documentReference -> Log.d(TAG, "Bucket " + bucket + " added remotely")); } }); }catch(RuntimeException e){ e.printStackTrace(); return OpStatus.ERROR; } return OpStatus.OK; } }
a3f5e87137dcd449f1813f301aaf7273804ce64a
8152c2e1860c3efab120859b3d9e8afba5a714ed
/Java/11-Tutorial/4/AccountTest.java
6615d01e1a1e0a85bb1ac52449b0e5bb5c3ce0f2
[]
no_license
naufal-dean/Praktikum-Object-Oriented-Programming
1ec49e5b334441f673abb0dbee6d61d7b7aa6641
d193fd4b321cf774643aa7a2b3fc6740b5a41193
refs/heads/master
2020-12-29T12:29:29.130757
2020-04-28T22:35:27
2020-04-28T22:35:27
238,607,521
4
6
null
null
null
null
UTF-8
Java
false
false
1,071
java
// Nama : Naufal Dean Anugrah // NIM : 13518123 // Tanggal : 9 April 2020 // Topik : Assertion public class AccountTest { public AccountTest() { // Tidak melakukan apa-apa } public void test() { // Melakukan tes terhadap method transfer. // Asumsikan method lainnya benar. // TEST 1 Account a = AccountFactory.withBalance(20); Account b = AccountFactory.withBalance(0); try { a.transfer(b, 20); } catch (InvalidAmountException e) { assert false; } assert a.getNumOfTransaction() == 1; assert b.getNumOfTransaction() == 1; assert a.getBalance() == 0; assert b.getBalance() == 20; // TEST 2 Account c = AccountFactory.withBalance(20); Account d = AccountFactory.withBalance(0); try { c.transfer(d, 25); assert false; } catch (InvalidAmountException e) { // pass } assert c.getNumOfTransaction() == 0; assert d.getNumOfTransaction() == 0; assert c.getBalance() == 20; assert d.getBalance() == 0; } }
dde38371f21a37311cd9faad186bc4386cb165b0
f9b9f85c36cba67c39f2c453f63781dec810365a
/app/src/main/java/ganesh/com/flipview/views/NumberTextView.java
ae672f9ed6defdbe1086e12dcd59ea26f015f422
[]
no_license
ganeshAghav/FlipView
984916adb8ba72a268bcfa8c70426a692ed620b5
fd95b8f0ff29111e91112c3d7632631be300ddc9
refs/heads/master
2020-03-27T01:06:31.478824
2018-08-22T08:55:32
2018-08-22T08:55:32
145,682,697
0
0
null
null
null
null
UTF-8
Java
false
false
1,240
java
/* Copyright 2012 Aphid Mobile 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 ganesh.com.flipview.views; import android.content.Context; import android.graphics.Color; import android.view.Gravity; import android.widget.TextView; public class NumberTextView extends TextView { private int number; public NumberTextView(Context context, int number) { super(context); setNumber(number); setTextColor(Color.BLACK); setBackgroundColor(Color.WHITE); setGravity(Gravity.CENTER); } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; setText(String.valueOf(number)); } @Override public String toString() { return "NumberTextView: " + number; } }
0d7a6d3d2917cf0423a4091727c55757b6150ef7
974b1bf979cb7b46e81a4368d8f9a3d5ef86827e
/code/iaas/model/src/main/java/io/cattle/platform/core/cleanup/TableCleanup.java
a83e5c9195000f3cbb808fde9822a660d2921b88
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
janeczku/cattle
5e83b3a445ff405815bb1dbe7863898ced2c2df2
f5e05aa79f072c58ed6244c5ecb1f0a686bbee0a
refs/heads/master
2021-01-11T02:48:23.429263
2016-10-14T05:49:03
2016-10-14T05:49:03
33,400,458
0
0
null
2015-04-04T09:26:27
2015-04-04T09:26:27
null
UTF-8
Java
false
false
12,660
java
package io.cattle.platform.core.cleanup; import io.cattle.platform.core.model.tables.*; import io.cattle.platform.db.jooq.dao.impl.AbstractJooqDao; import io.cattle.platform.object.jooq.utils.JooqUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import org.jooq.Field; import org.jooq.Record1; import org.jooq.Result; import org.jooq.ResultQuery; import org.jooq.Table; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.netflix.config.DynamicIntProperty; import com.netflix.config.DynamicLongProperty; import com.netflix.config.DynamicPropertyFactory; /** * Programmatically delete purged database rows after they reach a configurable age. * * @author joliver * */ public class TableCleanup extends AbstractJooqDao { private static final Logger log = LoggerFactory.getLogger(TableCleanup.class); public static final DynamicIntProperty QUERY_LIMIT_ROWS = DynamicPropertyFactory.getInstance().getIntProperty("cleanup.query_limit.rows", 100); public static final DynamicLongProperty DEFAULT_AGE_LIMIT_HOURS = DynamicPropertyFactory.getInstance().getLongProperty("cleanup.age_limit.hours", 168); public static final DynamicLongProperty PROCESS_INSTANCE_AGE_LIMIT_SECONDS = DynamicPropertyFactory.getInstance().getLongProperty( "process_instance.purge.after.seconds", DEFAULT_AGE_LIMIT_HOURS.get()); public static final DynamicLongProperty EVENT_AGE_LIMIT_SECONDS = DynamicPropertyFactory.getInstance().getLongProperty( "events.purge.after.seconds", DEFAULT_AGE_LIMIT_HOURS.get()); public static final DynamicLongProperty AUDIT_LOG_AGE_LIMIT_SECONDS = DynamicPropertyFactory.getInstance().getLongProperty( "audit_log.purge.after.seconds", DEFAULT_AGE_LIMIT_HOURS.get()); public static final DynamicLongProperty SERVICE_LOG_AGE_LIMIT_SECONDS = DynamicPropertyFactory.getInstance().getLongProperty( "service_log.purge.after.seconds", DEFAULT_AGE_LIMIT_HOURS.get()); public static final Long SECOND_MILLIS = 1000L; public static final Long HOUR_MILLIS = 60 * 60 * SECOND_MILLIS; private List<CleanableTable> processInstanceTables; private List<CleanableTable> eventTables; private List<CleanableTable> auditLogTables; private List<CleanableTable> serviceLogTables; private List<CleanableTable> otherTables; public TableCleanup() { this.processInstanceTables = getProcessInstanceTables(); this.eventTables = getEventTables(); this.auditLogTables = getAuditLogTables(); this.serviceLogTables = getServiceLogTables(); this.otherTables = getOtherTables(); } public void cleanup() { long current = new Date().getTime(); Date processInstanceCutoff = new Date(current - PROCESS_INSTANCE_AGE_LIMIT_SECONDS.get() * SECOND_MILLIS); cleanup("process_instance", processInstanceTables, processInstanceCutoff); Date eventTableCutoff = new Date(current - EVENT_AGE_LIMIT_SECONDS.get() * SECOND_MILLIS); cleanup("event", eventTables, eventTableCutoff); Date auditLogCutoff = new Date(current - AUDIT_LOG_AGE_LIMIT_SECONDS.get() * SECOND_MILLIS); cleanup("audit_log", auditLogTables, auditLogCutoff); Date serviceLogCutoff = new Date(current - SERVICE_LOG_AGE_LIMIT_SECONDS.get() * SECOND_MILLIS); cleanup("service_log", serviceLogTables, serviceLogCutoff); Date otherCutoff = new Date(current - DEFAULT_AGE_LIMIT_HOURS.getValue() * HOUR_MILLIS); cleanup("other", otherTables, otherCutoff); } private void cleanup(String name, List<CleanableTable> tables, Date cutoffTime) { log.info("Cleanup {} tables started (cutoff={})", name, cutoffTime); for (CleanableTable cleanableTable : tables) { Table<?> table = cleanableTable.table; Field<Long> id = cleanableTable.idField; Field<Date> remove = cleanableTable.removeField; ResultQuery<Record1<Long>> ids = create() .select(id) .from(table) .where(remove.lt(cutoffTime)) .limit(QUERY_LIMIT_ROWS.getValue()); int deletedRows = 0; Result<Record1<Long>> toDelete; while ((toDelete = ids.fetch()).size() > 0) { List<Long> idsToDelete = new ArrayList<>(); for (Record1<Long> record : toDelete) { idsToDelete.add(record.value1()); } try { deletedRows += create() .delete(table) .where(id.in(idsToDelete)) .execute(); } catch (org.jooq.exception.DataAccessException e) { log.error(e.getMessage()); break; } } log.info("Deleted " + deletedRows + " rows from " + table); } log.info("Cleanup {} tables completed", name); } /** * Sorts a list of tables by their primary key references such that tables may be cleaned in an order * that doesn't violate any key constraints. * * @param tables The list of tables to sort */ public static List<CleanableTable> sortByReferences(List<CleanableTable> tables) { List<CleanableTable> unsorted = new ArrayList<CleanableTable>(tables); List<CleanableTable> sorted = new ArrayList<CleanableTable>(); int tableCount = unsorted.size(); while (tableCount > 0) { for (int i = 0; i < unsorted.size(); i++) { CleanableTable table = unsorted.get(i); List<CleanableTable> others = new ArrayList<CleanableTable>(unsorted); others.remove(i); if (!JooqUtils.isReferencedBy(table.table, stripContext(others))) { sorted.add(unsorted.remove(i--)); } } if (tableCount == unsorted.size()) { log.error("Cycle detected in table references! Aborting."); System.exit(1); } else { tableCount = unsorted.size(); } } if (log.isDebugEnabled()) { log.debug("Table cleanup plan:"); for (CleanableTable table : sorted) { log.debug(table.toString()); } } return sorted; } private static List<Table<?>> stripContext(List<CleanableTable> cleanableTables) { List<Table<?>> tables = new ArrayList<Table<?>>(); for (CleanableTable cleanableTable : cleanableTables) { tables.add(cleanableTable.table); } return tables; } private static List<CleanableTable> getProcessInstanceTables() { List<CleanableTable> tables = Arrays.asList( CleanableTable.from(ProcessExecutionTable.PROCESS_EXECUTION), CleanableTable.from(ProcessInstanceTable.PROCESS_INSTANCE)); return sortByReferences(tables); } private static List<CleanableTable> getEventTables() { List<CleanableTable> tables = Arrays.asList( CleanableTable.from(ContainerEventTable.CONTAINER_EVENT), CleanableTable.from(ServiceEventTable.SERVICE_EVENT)); return sortByReferences(tables); } private static List<CleanableTable> getAuditLogTables() { return Arrays.asList(CleanableTable.from(AuditLogTable.AUDIT_LOG)); } private static List<CleanableTable> getServiceLogTables() { return Arrays.asList(CleanableTable.from(ServiceLogTable.SERVICE_LOG)); } private static List<CleanableTable> getOtherTables() { List<CleanableTable> tables = Arrays.asList( CleanableTable.from(AccountTable.ACCOUNT), CleanableTable.from(AgentTable.AGENT), CleanableTable.from(AgentGroupTable.AGENT_GROUP), CleanableTable.from(AuthTokenTable.AUTH_TOKEN), CleanableTable.from(BackupTable.BACKUP), CleanableTable.from(BackupTargetTable.BACKUP_TARGET), CleanableTable.from(CertificateTable.CERTIFICATE), CleanableTable.from(ClusterHostMapTable.CLUSTER_HOST_MAP), CleanableTable.from(ConfigItemStatusTable.CONFIG_ITEM_STATUS), CleanableTable.from(CredentialTable.CREDENTIAL), CleanableTable.from(CredentialInstanceMapTable.CREDENTIAL_INSTANCE_MAP), CleanableTable.from(DeploymentUnitTable.DEPLOYMENT_UNIT), CleanableTable.from(DynamicSchemaTable.DYNAMIC_SCHEMA), CleanableTable.from(ExternalEventTable.EXTERNAL_EVENT), CleanableTable.from(ExternalHandlerTable.EXTERNAL_HANDLER), CleanableTable.from(ExternalHandlerExternalHandlerProcessMapTable.EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP), CleanableTable.from(ExternalHandlerProcessTable.EXTERNAL_HANDLER_PROCESS), CleanableTable.from(GenericObjectTable.GENERIC_OBJECT), CleanableTable.from(HealthcheckInstanceTable.HEALTHCHECK_INSTANCE), CleanableTable.from(HealthcheckInstanceHostMapTable.HEALTHCHECK_INSTANCE_HOST_MAP), CleanableTable.from(HostTable.HOST), CleanableTable.from(HostIpAddressMapTable.HOST_IP_ADDRESS_MAP), CleanableTable.from(HostLabelMapTable.HOST_LABEL_MAP), CleanableTable.from(HostVnetMapTable.HOST_VNET_MAP), CleanableTable.from(ImageTable.IMAGE), CleanableTable.from(ImageStoragePoolMapTable.IMAGE_STORAGE_POOL_MAP), CleanableTable.from(InstanceTable.INSTANCE), CleanableTable.from(InstanceHostMapTable.INSTANCE_HOST_MAP), CleanableTable.from(InstanceLabelMapTable.INSTANCE_LABEL_MAP), CleanableTable.from(InstanceLinkTable.INSTANCE_LINK), CleanableTable.from(IpAddressTable.IP_ADDRESS), CleanableTable.from(IpAddressNicMapTable.IP_ADDRESS_NIC_MAP), CleanableTable.from(IpAssociationTable.IP_ASSOCIATION), CleanableTable.from(IpPoolTable.IP_POOL), CleanableTable.from(LabelTable.LABEL), CleanableTable.from(MachineDriverTable.MACHINE_DRIVER), CleanableTable.from(MountTable.MOUNT), CleanableTable.from(NetworkTable.NETWORK), CleanableTable.from(NetworkServiceTable.NETWORK_SERVICE), CleanableTable.from(NetworkServiceProviderTable.NETWORK_SERVICE_PROVIDER), CleanableTable.from(NetworkServiceProviderInstanceMapTable.NETWORK_SERVICE_PROVIDER_INSTANCE_MAP), CleanableTable.from(NicTable.NIC), CleanableTable.from(OfferingTable.OFFERING), CleanableTable.from(PhysicalHostTable.PHYSICAL_HOST), CleanableTable.from(PortTable.PORT), CleanableTable.from(ProjectMemberTable.PROJECT_MEMBER), CleanableTable.from(ResourcePoolTable.RESOURCE_POOL), CleanableTable.from(ServiceTable.SERVICE), CleanableTable.from(ServiceConsumeMapTable.SERVICE_CONSUME_MAP), CleanableTable.from(ServiceExposeMapTable.SERVICE_EXPOSE_MAP), CleanableTable.from(ServiceIndexTable.SERVICE_INDEX), CleanableTable.from(ServiceLogTable.SERVICE_LOG), CleanableTable.from(SnapshotTable.SNAPSHOT), CleanableTable.from(StackTable.STACK), CleanableTable.from(StoragePoolTable.STORAGE_POOL), CleanableTable.from(StoragePoolHostMapTable.STORAGE_POOL_HOST_MAP), CleanableTable.from(SubnetTable.SUBNET), CleanableTable.from(SubnetVnetMapTable.SUBNET_VNET_MAP), CleanableTable.from(TaskInstanceTable.TASK_INSTANCE), CleanableTable.from(UserPreferenceTable.USER_PREFERENCE), CleanableTable.from(VnetTable.VNET), CleanableTable.from(VolumeTable.VOLUME), CleanableTable.from(VolumeStoragePoolMapTable.VOLUME_STORAGE_POOL_MAP), CleanableTable.from(ZoneTable.ZONE)); return sortByReferences(tables); } }
8383180097603c0b692177810e1437960ae255df
52249f9f8c45524e72ca16cc24a185130b399c48
/src/org/virtue/game/Lobby.java
3c6d34e13088986e93197f0d1c596d106d38d121
[ "MIT" ]
permissive
kayla06/VirtueRS3
4a7d9d7ba900ee8743d90f37d9e80f416bf5093f
5d6bd2eaf06a9b0b78d25dc9df4b0fec7a30ce6c
refs/heads/master
2021-01-13T09:04:22.705902
2016-03-26T07:30:36
2016-03-26T07:30:36
54,774,808
0
1
null
2016-03-26T10:51:47
2016-03-26T10:51:47
null
UTF-8
Java
false
false
1,917
java
/** * Copyright (c) 2014 Virtue Studios * * 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 org.virtue.game; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.virtue.game.node.ServerNode; /** * @author Im Frizzy <skype:kfriz1998> * @since Aug 8, 2014 */ public class Lobby extends ServerNode { /** * The {@link Logger} instance */ private static Logger logger = LoggerFactory.getLogger(Lobby.class); /** * The {@link Lobby} instance */ public static Lobby instance; /** * Returns the {@link Lobby} instance */ public static Lobby getInstance() { if (instance == null) { try { instance = new Lobby(); } catch (Exception e) { logger.error("Error creating new Lobby instance", e); } } return instance; } private Lobby() { super(1100, 2048); } }
a79bbc2cce86ff8babc5d19fea6f7f4e2f75f886
356f1196f434b4b5c9bcb165a3607ee5b95e7b3c
/Fragment - Eesty/java/FragmentAccount.java
694f30fc9da356c318653b36280185d60a74b924
[]
no_license
thethoainguyenn/android-tutorial
b6c1c2e8413953fb8ef681a33ba57fbb1ebd474a
1783cfd7f76f8fe9381eb79ef1f746bf66f2f60a
refs/heads/master
2021-04-15T15:12:35.728037
2018-03-26T16:27:00
2018-03-26T16:27:00
126,198,791
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
package com.example.thoailun.eesty; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * Created by THOAILUN on 03/22/18. */ public class FragmentAccount extends Fragment { @Nullable @Override // LayoutInflater : connect public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_account, container, false); } }
2d2509296701ad6c42627e5f65e2fd40c59285f1
41a529551cfa07cf5541ddd39b07defe21b01c27
/Practice(Beginner)/Piece of cake.java
96afb8305129c8d345a40f1b75d89593e8f56222
[ "Apache-2.0" ]
permissive
codersaga/Codechef
0c67a399141e3b65687d4341590ffd99ebb6b2a0
d513accf229d3ef5a05a6911f22fde78420aac2b
refs/heads/master
2022-06-06T03:48:03.531356
2020-05-06T15:16:35
2020-05-06T15:16:35
260,625,020
7
1
null
2020-05-02T15:36:54
2020-05-02T06:05:10
Java
UTF-8
Java
false
false
945
java
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int q=0;q<t;q++){ String str=sc.next(); int c[]=new int[26]; for(int i=0;i<26;i++) c[i]=0; int ind=0; int max=Integer.MIN_VALUE; for(int i=0;i<str.length();i++){ int index=str.charAt(i)-'a'; c[index]++; if(c[index]>max) { max=c[index]; ind=index; } } int sum=0; for(int i=0;i<26;i++){ if(i!=ind) sum=sum+c[i]; } if(sum==max) System.out.println("YES"); else System.out.println("NO"); } } }
618b9ba56ca19c1f1efd3ca52cc9ef5e46f7f039
5372902d54b69edfc37049f29a8768d1059e6595
/batty/ui/CommonProxy.java
3ab1fe064e62f9915ad1a505dd8608390ef686f1
[]
no_license
RtHiaHB/batty-ui-forge
b1495a95862ea6068e0d9afb18ef4009cb95a9ea
cd1071215236a4b41a65036b50b04864b102928c
refs/heads/master
2023-08-12T04:08:13.543894
2017-04-08T10:33:03
2017-04-08T10:33:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package batty.ui; /** * * @author BatHeart */ public class CommonProxy { // Client stuff public void registerRenderers() { // Nothing here as the server doesn't render graphics or entities! } }
bc4eff778aea5b5b7e2c08c3599dc369773cc9df
41cbd04c26aa22b0113b0ba986372ccaa1db7d82
/src/controller/SaveAction.java
d2f19b6d02b69af27291055a306baf04a2599445
[]
no_license
dgzzhb/OakFormGenerator
7111bacb7a0627f9557791a56f2e97cdda5d5a0b
cd5a66f067437221ca92fe18f7eba875399364c8
refs/heads/master
2021-01-10T12:01:35.332827
2015-07-14T04:10:26
2015-07-14T04:10:26
35,968,508
0
0
null
null
null
null
UTF-8
Java
false
false
3,983
java
package controller; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.simple.JSONObject; @WebServlet("/SaveAction") public class SaveAction extends HttpServlet{ /** * */ private static final long serialVersionUID = 1L; private static JSONObject obj=new JSONObject(); private void process(HttpServletRequest request, String name ){ String prmtr = request.getParameter(name); System.out.println("reading Prmtr in prcs: "+prmtr); obj.put(name, prmtr); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("saveaction called"); String prmtr = req.getParameter("nameOfInstitution"); System.out.println("reading Prmtr in prcs: "+prmtr); req.setAttribute("nameOfInstitution", prmtr); URL url = new URL(new String("http://localhost:8080/OakFormGenerator/index.do")); URLConnection con = url.openConnection(); con.setRequestProperty("Cookie", "JSESSIONID="+req.getParameter("sid")); System.out.println("reading sessionid: "+req.getParameter("sid")); BufferedReader bf = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; String html = ""; while ((inputLine = bf.readLine()) != null){ html += inputLine + "\n";} bf.close(); System.out.println("reading html: "+html); //String[] prmtr = req.getParameterValues("limitBusiness"); //System.out.println("reading Attr: "+attr); //System.out.println("reading Prmtr: "+prmtr[0]); //System.out.println("reading Attr: "+attr); //System.out.println("reading Prmtr: "+prmtr[1]); System.out.print("haha"); resp.setContentType("application/octet-stream"); resp.setHeader("Content-Disposition", "attachment;filename=downloadfilename.html"); StringBuffer sb = new StringBuffer(html); InputStream in = new ByteArrayInputStream(sb.toString().getBytes("UTF-8")); ServletOutputStream out = resp.getOutputStream(); byte[] buffer = new byte[4096]; int length; while ((length = in.read(buffer)) > 0){ out.write(buffer, 0, length); } in.close(); out.flush(); // byte[] outputByte = new byte[8192]; // //copy binary contect to output stream // while(in.read(outputByte, 0, 8192) != -1) // { // out.write(outputByte, 0, 8192); // } // in.close(); // out.flush(); out.close(); } public String perform(HttpServletRequest request) { process(request, "nameOfInstitution"); process(request, "nameOfInstitutionA"); process(request, "nameOfInstitutionA"); process(request, "nameOfInstitutionA"); process(request, "nameOfInstitutionA"); process(request, "nameOfInstitutionA"); try { PrintWriter writer; FileWriter fw = new FileWriter("/users/ThomasZhao/Documents/out.JSON"); fw.write(obj.toJSONString()); System.out.println("jinto"); fw.close(); writer = new PrintWriter("save.json", "UTF-8"); writer.println(obj.toJSONString()); writer.close(); } catch (FileNotFoundException | UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //String prmtr = request.getParameter("nameOfInstitutionA"); //System.out.println("reading Prmtr: "+prmtr); return "readableForm.jsp"; } }
fa5cf431fb667252b090accef4158498007ebdda
c757aa4bd954b89d5f1532a6b3bac8a685c5fe4f
/src/main/java/com/hand/entity/User.java
23facc2886b86ac4dc2566bbaaf475e2bb4ed55f
[]
no_license
haoshangoog/Infomanage
8546fff27dd04343fa358eb273c12595efa0fd0f
de7e706db3e29502a5fc010f7185af6e06e28cd2
refs/heads/master
2021-01-12T14:07:16.464603
2017-05-05T18:33:20
2017-05-05T18:33:20
70,167,600
0
0
null
null
null
null
UTF-8
Java
false
false
1,490
java
package com.hand.entity; import java.io.Serializable; import javax.persistence.*; import com.google.gson.annotations.Expose; @Entity(name="user") public class User implements Serializable { @Id @GeneratedValue @Column(name="id") @Expose private int id; @Column(name="accountName") @Expose private String accountName; @Column(name="realName") @Expose private String realName; @Column(name="password") @Expose private String password; @Column(name="identity") @Expose private Integer identity = 1; // 含有两个角色 用户和管理员 默认是普通用户 @Column(name="deleteflag") @Expose private Integer deleteFlag = 0; // 删除标志符 0 代表false 1 代表true-已删除 public int getId() { return id; } public void setId(int id) { this.id = id; } public String getAccountName() { return accountName; } public void setAccountName(String accountName) { this.accountName = accountName; } public String getRealName() { return realName; } public void setRealName(String realName) { this.realName = realName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Integer getIdentity() { return identity; } public void setIdentity(Integer identity) { this.identity = identity; } public Integer getDeleteFlag() { return deleteFlag; } public void setDeleteFlag(Integer deleteFlag) { this.deleteFlag = deleteFlag; } }
bf6e1f32b987289c95b642d0d7cd37499b805534
0ad5458bf9edd95d4c03d4b10d7f644022a59cd7
/src/main/java/ch/ethz/idsc/owl/math/group/Se3Geodesic.java
4a3032299901a8fd9e5d4d0b807aaeaf40984d47
[]
no_license
yangshuo11/owl
596e2e15ab7463944df0daecf34f1c74cb2806cc
9e8a917ab34d7283dc0cc3514689a6e7683d5e98
refs/heads/master
2020-04-05T08:44:51.622349
2018-10-29T05:56:00
2018-10-29T05:56:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
// code by jph package ch.ethz.idsc.owl.math.group; import ch.ethz.idsc.owl.math.GeodesicInterface; import ch.ethz.idsc.tensor.Scalar; import ch.ethz.idsc.tensor.Tensor; import ch.ethz.idsc.tensor.mat.LinearSolve; /** geodesic in special Euclidean group SE(3) of affine transformations * * input p and q are 4 x 4 matrices that encode affine transformations */ public enum Se3Geodesic implements GeodesicInterface { INSTANCE; // --- @Override public Tensor split(Tensor p, Tensor q, Scalar scalar) { return p.dot(Se3Exponential.INSTANCE.exp(Se3Exponential.INSTANCE.log(LinearSolve.of(p, q)).multiply(scalar))); } }
b8a089e88e0c0955582b02a3cc4109eb6fd7bb14
e444840974f119d920bade3659890bff37159d27
/core/src/com/andrzej/company/states/MenuState.java
5ce8341f54881f87003f6a33818fb821e02ec9ca
[]
no_license
Andrzej1991/FlappyBird
dbbe2c724574c953baba655e2bd56926d1ae7e7b
65e41e1199e0ca348a2943fb3146424647574c67
refs/heads/master
2021-01-01T05:20:13.395733
2016-05-26T16:51:22
2016-05-26T16:51:22
57,432,047
0
0
null
null
null
null
UTF-8
Java
false
false
1,195
java
package com.andrzej.company.states; import com.andrzej.company.FlappyDemo; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; /** * Created by Andrzej on 2016-02-03. */ public class MenuState extends State { private Texture background; private Texture playBtn; public MenuState(GameStateManager gsm) { super(gsm); cam.setToOrtho(false, FlappyDemo.WIDTH / 2, FlappyDemo.HEIGHT / 2); background = new Texture("bg.png"); playBtn = new Texture("playbtn.png"); } @Override public void handleInput() { if(Gdx.input.justTouched()){ gsm.set(new PlayState(gsm)); } } @Override public void update(float dt) { handleInput(); } @Override public void render(SpriteBatch sb) { sb.setProjectionMatrix(cam.combined); sb.begin(); sb.draw(background, 0, 0); sb.draw(playBtn, (FlappyDemo.WIDTH/2)- cam.position.x - playBtn.getWidth() /2, cam.position.y); sb.end(); } @Override public void dispose() { background.dispose(); playBtn.dispose(); } }
b1587f88cc017a3cc9c3878ad72da5b42c72546e
0c9e4eef62b45bd135c2704a04cd57cc1964288a
/samplersFramework/src/main/java/org/cientopolis/samplers/framework/soundRecord/service/RecordingService.java
d3c155d3d8241a0e6a8fdcc72e76d6a6a580dd1f
[]
no_license
cientopolis/samplers
5bed59958fdab37c72a0c8a6f6cf4937d4d5efce
433de9d6b732879757080e63264930373f52de36
refs/heads/master
2022-09-27T06:45:33.371853
2022-09-16T01:19:03
2022-09-16T01:19:03
73,843,566
2
1
null
2018-04-22T01:59:26
2016-11-15T18:34:16
Java
UTF-8
Java
false
false
3,375
java
package org.cientopolis.samplers.framework.soundRecord.service; import android.app.Service; import android.content.Intent; import android.media.MediaRecorder; import android.os.Binder; import android.os.IBinder; import android.support.annotation.Nullable; import android.util.Log; import org.cientopolis.samplers.persistence.MultimediaIOManagement; import java.io.File; import java.io.IOException; import java.util.TimerTask; /** * Created by laura on 06/09/17. */ public class RecordingService extends Service { private MediaRecorder mRecorder; private long mStartingTimeMillis = 0; private long mElapsedMillis = 0; private TimerTask mIncrementTimerTask = null; /*MultimediaIOManagement future responsibility*/ private String mFileName = null; private String mFilePath = null; /**/ private static final String LOG_TAG = "RecordingService"; // Binder given to clients private final IBinder mBinder = new LocalBinder(); @Nullable @Override public IBinder onBind(Intent intent) { return mBinder; } public void setFileNameAndPath(){ try { File f = MultimediaIOManagement.saveTempAudioFile(getApplicationContext(), MultimediaIOManagement.SOUND_EXTENSION); mFileName = f.toString(); mFilePath = f.getAbsolutePath(); } catch (IOException e){ e.printStackTrace(); Log.e(LOG_TAG, "error creating temp sound file"); } } @Override public void onDestroy() { if (mRecorder != null) { stopRecording(); } Log.e(LOG_TAG, "SERVICE DESTROY"); super.onDestroy(); } public void startRecording(){ setFileNameAndPath(); mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); mRecorder.setOutputFile(mFilePath); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); mRecorder.setAudioChannels(1); //HIGH_QUALITY mRecorder.setAudioSamplingRate(44100); mRecorder.setAudioEncodingBitRate(192000); try { mRecorder.prepare(); mRecorder.start(); mStartingTimeMillis = System.currentTimeMillis(); //startTimer(); //startForeground(1, createNotification()); } catch (IOException e) { Log.e(LOG_TAG, "prepare() failed"); } } public RecordingItem getRecordingItem() { RecordingItem recordingItem = new RecordingItem(); recordingItem.setFilePath(mFileName); recordingItem.setLength((int)mElapsedMillis); return recordingItem; } public void stopRecording() { mRecorder.stop(); mElapsedMillis = (System.currentTimeMillis() - mStartingTimeMillis); mRecorder.release(); //remove notification if (mIncrementTimerTask != null) { mIncrementTimerTask.cancel(); mIncrementTimerTask = null; } mRecorder = null; } public class LocalBinder extends Binder { public RecordingService getService() { // Return this instance of LocalService so clients can call public methods return RecordingService.this; } } }
cb3977f10c8995d0e3165254276e29bf56f56cf3
0979557921fb2e2341c7a25fca017ad24afae4e8
/app/src/main/java/com/example/vladok/testtask/util/Constants.java
d8d241ad480eb213f76e5997a69ed8c2416d0838
[]
no_license
kUzmeN/PageScroller
6f303389bd2a3b32f4c3b210887c71ab15e7d77b
cf0cab3d3490df3c3370877edf458721c39d5212
refs/heads/master
2020-06-15T05:45:53.831771
2016-12-01T19:30:12
2016-12-01T19:30:12
75,322,683
0
0
null
null
null
null
UTF-8
Java
false
false
153
java
package com.example.vladok.testtask.util; public class Constants { public static final String URL_BASE = "http://jsonplaceholder.typicode.com"; }
89385e6a714f692eedc3658246abbbd35b87046e
fb8403a47ee8aebcf312c998bbad0b206e0b830f
/src/Inherit/GrandChild.java
da3cd61817a9b8d141a5dbe3303dcf2519123552
[]
no_license
MiguelVera08/codeup-java-exercises
78026c9391bf987131bba8bd38408947b864f6c3
87a5c2abb3f9f88f847ef6a39bd0b1824626e784
refs/heads/master
2020-12-21T19:26:02.772576
2020-03-11T15:09:30
2020-03-11T15:09:30
236,534,560
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package Inherit; public class GrandChild extends ParentTwo{ public void methodD(){ System.out.println("Hello from Grandchild class."); } }
70d8865bf228cec8a8b0895f92bcd981ba4983aa
e919f39538f7b650534d9187dc5e12799214ce99
/src/differential/Differential_if.java
31133e41058c0fda2bbbaa676d15948ef423592f
[]
no_license
radbump1/Differential
2910dfdc839e8f711ff443fbe02f193a7f156754
152d0dbba458061376a4c87ce79a31a9d5115f9f
refs/heads/master
2021-05-07T04:59:07.098705
2017-11-20T04:26:54
2017-11-20T04:26:54
111,361,027
0
0
null
null
null
null
UTF-8
Java
false
false
141
java
package differential; public interface Differential_if { public double getRx(); public double getDx(); public double getRe(); }
[ "50616030@50616030-PC" ]
50616030@50616030-PC
8336c23c7c81197e70b86ef3aec9544a05a73548
3b250c5782afb12c22044377210242565c65ab82
/src/main/java/com/jamesskipp/albatross/converter/DataFormatConverter.java
9a242651ad122a7e3e55d62aeae722855e2aefdc
[]
no_license
jamesskipp/albatross
419eef6bbc6eb44d72d718c5209baa1b24e86f3a
26b94f3b99003aa894dae86317058014432bd5cc
refs/heads/master
2023-04-10T18:50:46.690904
2021-04-27T02:14:36
2021-04-27T02:14:36
361,938,602
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.jamesskipp.albatross.converter; import com.jamesskipp.albatross.util.ConverterUtils; import com.jamesskipp.albatross.util.DataFormat; import javax.persistence.Converter; @Converter(autoApply = true) public class DataFormatConverter extends DbCharEnumConverter<DataFormat> { @Override public DataFormat convertToEntityAttribute(Character code) { return ConverterUtils.convertToEntityAttribute(DataFormat.values(), code); } }
0d666c9dd720c1e77f22643058e873d3c393281b
7f88a7f38be239e3335a60dcca095e7086c1a885
/app/src/main/java/se/alkohest/irkksome/ui/connection/LegacyConnectionsAdapter.java
d538a5c6be1100f83e47878f3076809816f57a91
[ "Beerware" ]
permissive
hedmanw/irkksome
7f2424c17a2ad6d76fe0bc0f6c94b97080a9668e
2e387ea207bd82cc8c04836069afc8e2b0ec962d
refs/heads/develop
2021-07-05T11:20:47.488942
2017-09-28T13:40:40
2017-09-28T13:40:40
21,955,545
3
0
null
2017-09-28T13:40:41
2014-07-17T19:56:28
Java
UTF-8
Java
false
false
2,080
java
package se.alkohest.irkksome.ui.connection; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import java.util.List; import se.alkohest.irkksome.R; import se.alkohest.irkksome.model.impl.IrkksomeConnectionEB; import se.alkohest.irkksome.util.DateFormatUtil; public class LegacyConnectionsAdapter extends BaseAdapter { private List<IrkksomeConnectionEB> dataset; private final LayoutInflater inflater; public LegacyConnectionsAdapter(Context context, List<IrkksomeConnectionEB> connectionsList) { this.inflater = LayoutInflater.from(context); this.dataset = connectionsList; } public void setNewData(List<IrkksomeConnectionEB> connectionsList) { this.dataset = connectionsList; notifyDataSetChanged(); } @Override public int getCount() { return dataset.size(); } @Override public IrkksomeConnectionEB getItem(int position) { return dataset.get(position); } @Override public long getItemId(int position) { return getItem(position).getId(); } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.server_connect_list_item, parent, false); } TextView nickname = (TextView) convertView.findViewById(android.R.id.title); TextView hostname = (TextView) convertView.findViewById(android.R.id.text1); TextView lastAccessed = (TextView) convertView.findViewById(android.R.id.text2); final IrkksomeConnectionEB connection = getItem(position); nickname.setText(connection.getNickname()); hostname.setText(connection.toString()); lastAccessed.setText("Last synced " + DateFormatUtil.getTimeDay(connection.getLastUsed())); return convertView; } @Override public boolean hasStableIds() { return true; } }
bff68b89d3cb135b1727520c3191a3fcf0a9eef7
4777a0c394979a3786fb1d255ec4d815b2a1d2f3
/retail-goods-api/src/main/java/com/morning/star/retail/facade/dto/BrandCountDTO.java
adf975f57bdfac353b899bc5b7d1e5acb206a07b
[]
no_license
chaoren007/big-middle
0d98ea0ce7b2c892eb249dbbd116b4e0767686c5
29952ea01f0af89847286fa7d910640b1c83e3db
refs/heads/master
2022-12-15T13:29:44.555680
2019-07-29T08:47:03
2019-07-29T08:47:03
199,414,109
0
3
null
2022-12-10T03:18:29
2019-07-29T08:45:13
Java
UTF-8
Java
false
false
1,385
java
package com.morning.star.retail.facade.dto; import java.io.Serializable; import io.swagger.annotations.ApiModelProperty; public class BrandCountDTO implements Serializable { private static final long serialVersionUID = 6107323523250786926L; @ApiModelProperty(value = "品牌名称") private String brandName; @ApiModelProperty(value = "品牌编码") private Long brandId; private String groupCode; private String storeCode; @ApiModelProperty(required = true, value = "分页数据") private Integer pageNo; @ApiModelProperty(required = true, value = "分页数据") private Integer pageSize; public String getBrandName() { return brandName; } public void setBrandName(String brandName) { this.brandName = brandName; } public Integer getPageNo() { return pageNo; } public void setPageNo(Integer pageNo) { this.pageNo = pageNo; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public Long getBrandId() { return brandId; } public void setBrandId(Long brandId) { this.brandId = brandId; } public String getGroupCode() { return groupCode; } public void setGroupCode(String groupCode) { this.groupCode = groupCode; } public String getStoreCode() { return storeCode; } public void setStoreCode(String storeCode) { this.storeCode = storeCode; } }
f846d9ebf3082cb70edc053fc207b5b2dc20e4cc
17740108808030073ed08e4e148290a597edcb0f
/src/main/java/me/ddevil/mineme/gui/menus/MainMenu.java
cf625438573f5d1c5ec37a70e8c4a9bf49f30f62
[]
no_license
BrunoSilvaFreire/MineMe
5503bd4932cce2e59ea0185cc57b172a45e17d93
47405332605ff11a92a3f0f71cb824eea59cbf3e
refs/heads/master
2021-05-31T16:57:23.505286
2016-05-25T22:24:39
2016-05-25T22:24:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,826
java
/* * 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 me.ddevil.mineme.gui.menus; import java.util.HashMap; import java.util.List; import me.ddevil.core.events.inventory.InventoryObjectClickEvent; import me.ddevil.core.thread.ThreadFinishListener; import me.ddevil.mineme.gui.objects.MineDisplay; import me.ddevil.core.utils.inventory.BasicInventoryMenu; import me.ddevil.core.utils.inventory.InventoryUtils; import me.ddevil.core.utils.inventory.objects.BasicClickableInventoryObject; import me.ddevil.core.utils.inventory.objects.BasicInventoryContainer; import me.ddevil.core.utils.inventory.objects.BasicInventoryItem; import me.ddevil.core.utils.inventory.objects.interfaces.InventoryObjectClickListener; import me.ddevil.core.utils.items.ItemUtils; import me.ddevil.mineme.MineMe; import me.ddevil.mineme.MineMeConfiguration; import me.ddevil.mineme.gui.GUIResourcesUtils; import me.ddevil.mineme.messages.MineMeMessageManager; import me.ddevil.mineme.mines.Mine; import me.ddevil.mineme.mines.MineManager; import me.ddevil.mineme.mines.configs.MineConfig; import me.ddevil.mineme.thread.MineFilesFinder; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; /** * * @author Selma */ public class MainMenu extends BasicInventoryMenu { private static final int UNLOADED_MINE_LIST_SLOT = InventoryUtils.getFirstSlotInLane(4); public MainMenu(String name) { super(name, GUIResourcesUtils.INVENTORY_SIZE); this.mineList = new BasicInventoryContainer(this, 0, 24); this.unloadedMineList = new BasicInventoryContainer(this, UNLOADED_MINE_LIST_SLOT, UNLOADED_MINE_LIST_SLOT + 8); this.refreshButton = new BasicClickableInventoryObject(GUIResourcesUtils.REFRESH_MENU, new InventoryObjectClickListener() { @Override public void onInteract(InventoryObjectClickEvent e) { update(); } }, this); } protected ItemStack mainInventoryIcon; private final BasicClickableInventoryObject refreshButton; private final BasicInventoryContainer mineList; private final BasicInventoryContainer unloadedMineList; @Override public void update() { //Already loaded mines mineList.clearAndFill(GUIResourcesUtils.NO_MINE_TO_DISPLAY); for (Mine mine : MineManager.getMines()) { try { ItemStack is = new ItemStack(mine.getIcon()); mineList.addObject(new MineDisplay(mine, is, this)); } catch (Exception e) { MineMe.instance.printException("There was a problem while loading mine " + mine.getName() + "'s icon", e); } } unloadedMineList.clearAndFill(GUIResourcesUtils.NOT_LOADED_MINES); final MineFilesFinder mineFilesFinder = new MineFilesFinder(); mineFilesFinder.addListener(new ThreadFinishListener() { @Override public void onFinish() { unloadedMineList.setObject( 8, new BasicInventoryItem(MainMenu.this, mineFilesFinder.getNotLoadedItemStat()) ); List<MineConfig> mines = mineFilesFinder.getMines(); MineMe.instance.debug("Found " + mines.size() + " files in " + mineFilesFinder.getTotalTimeSeconds() + " seconds (" + mineFilesFinder.getTotalTime() + "ms)"); for (final MineConfig mine : mines) { ItemStack icon = generateItemStack(mine); icon = ItemUtils.addToLore(icon, new String[]{GUIResourcesUtils.CLICK_TO_LOAD}); unloadedMineList.addObject(new BasicClickableInventoryObject(icon, new InventoryObjectClickListener() { @Override public void onInteract(InventoryObjectClickEvent e) { Mine loadMine = MineManager.loadMine(mine); loadMine.setEnabled(true); loadMine.save(); Player player = e.getPlayer(); MineMe.chatManager.sendMessage(player, "Mine " + loadMine.getName() + " was loaded!"); update(); } }, MainMenu.this)); } } }); mineFilesFinder.start(); } @Override protected void setupItems() { this.mainInventoryIcon = MineMeMessageManager.getInstance().createIcon(MineMeConfiguration.guiConfig.getConfigurationSection("mainMenu.icons.main")); for (int i : InventoryUtils.getLane(mainInventory, InventoryUtils.getTotalLanes(mainInventory) - 1)) { setItem(GUIResourcesUtils.SPLITTER, i - 18); setItem(GUIResourcesUtils.SPLITTER, i); } setItem(mainInventoryIcon, InventoryUtils.getBottomMiddlePoint(mainInventory)); setItem(ItemUtils.NA, 8); setItem(ItemUtils.NA, 17); setItem(GUIResourcesUtils.SPLITTER, 7); setItem(GUIResourcesUtils.SPLITTER, 16); setItem(GUIResourcesUtils.SPLITTER, 25); registerInventoryObject(refreshButton, 26); registerInventoryObject(mineList, 0); registerInventoryObject(unloadedMineList, UNLOADED_MINE_LIST_SLOT); } private ItemStack generateItemStack(MineConfig config) { FileConfiguration xconfig = config.getConfig(); ItemStack createItem = ItemUtils.createItem( new ItemStack( Material.valueOf(xconfig.getString("icon.type")), 1, ((Integer) xconfig.getInt("icon.data")).shortValue() ), "§a" + config.getName() + ".yml" ); createItem = ItemUtils.addToLore(createItem, new String[]{ "§7Alias: " + MineMeMessageManager.getInstance().translateAll(config.getAlias()), "§7Type: §d" + config.getType(), "§7World: §e" + config.getWorld().getName() }); return createItem; } protected final HashMap<Mine, MineMenu> inventories = new HashMap(); public void openMineMenu(Mine m, Player p) { getMineInventory(m).open(p); } public MineMenu getMineInventory(Mine m) { if (inventories.containsKey(m)) { return inventories.get(m); } else { MineMe.instance.debug("Creating new MineMenu for mine " + m.getName(), 2); MineMenu inv = new MineMenu(m); inv.initialSetup(); inventories.put(m, inv); return inv; } } }
8c0aef29f00964f9a731a9b00c7fcdfbd80914a6
3d4756af9bc8125c9f891cf051980965c4616b49
/app/src/main/java/com/capstone/ridewithus/DisplayFeedActivity.java
5c70ec562746050cd42a0314be25216ad20c4f05
[]
no_license
umayr96/RideWithUs
af112f74ddce6c37f027e9a89b43107447472359
8a68a3983199feddfe3abcc9daaef65162a3ce7b
refs/heads/master
2021-05-08T06:27:40.951809
2018-01-10T19:44:07
2018-01-10T19:44:07
106,192,172
0
0
null
null
null
null
UTF-8
Java
false
false
2,759
java
package com.capstone.ridewithus; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; public class DisplayFeedActivity extends AppCompatActivity { private RecyclerView recyclerView; private DatabaseReference myRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_feed); myRef = FirebaseDatabase.getInstance().getReference().child("feed").child("/Davis"); recyclerView = (RecyclerView)findViewById(R.id.recyclerView); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); FirebaseRecyclerAdapter<PostFeed,PostFeedViewHolder> adapter = new FirebaseRecyclerAdapter<PostFeed, PostFeedViewHolder>( PostFeed.class, R.layout.individual_row, PostFeedViewHolder.class, myRef ) { @Override protected void populateViewHolder(PostFeedViewHolder viewHolder, PostFeed model, int position) { viewHolder.setTime(model.getTime()); viewHolder.setSeat(model.getSeat()); viewHolder.setCharge(model.getCharge()); viewHolder.setDriverName(model.getDriverName()); } }; recyclerView.setAdapter(adapter); } public static class PostFeedViewHolder extends RecyclerView.ViewHolder{ TextView timeText, seatText,chargeText,driverNameText; public PostFeedViewHolder(View itemView) { super(itemView); timeText = (TextView)itemView.findViewById(R.id.timeDisplay); seatText = (TextView)itemView.findViewById(R.id.seatDisplay); chargeText = (TextView)itemView.findViewById(R.id.chargeDisplay); driverNameText = (TextView)itemView.findViewById(R.id.driverNameDisplay); } public void setTime(String time) { timeText.setText(time); } public void setSeat(String seat) { seatText.setText(seat); } public void setCharge(String charge) { chargeText.setText(charge); } public void setDriverName(String driverName) { driverNameText.setText(driverName); } } }
9b3b3f5ef64e4d62f52048d665fe5b7dfdc0ff40
dbd8580e3fb26564b16a9dd8bc5749fff3a64870
/src/ooga/data/exceptions/ParserException.java
ac2e231bd3f009b8e11e9a861e6cf6b4d89e73c6
[ "MIT" ]
permissive
tyler-meier/Grid-Games
a6e6f2a6778f474e5cc84fed44e4e8aaadceefd6
fa270bbceaabed47e67d83897c8050957dbb0fe8
refs/heads/master
2022-12-02T22:59:23.332165
2020-08-20T04:01:41
2020-08-20T04:01:41
288,901,234
0
0
MIT
2020-08-20T04:01:42
2020-08-20T03:55:20
Java
UTF-8
Java
false
false
403
java
package ooga.data.exceptions; /** * Thrown when we can't read part of a data file */ public class ParserException extends RuntimeException { private String message = "Data file could not be read: %s"; public ParserException(Exception e, String fileName) { super(e); message = String.format(message, fileName); } @Override public String getMessage() { return message; } }
b7916462bc9eef45ab9e83fe18d14f33437c39b1
f793eaa91f4ad3d2ce48e73cacee1ab51db6ae40
/iotgp-common-msg/src/main/java/cn/inovance/iotgp/common/msg/server/AppDataTransferRsp.java
9be84195e60742f24029131dd68b688533601a5f
[]
no_license
scorp2010/iot
03575c0aca335bc8b3d78b85f070f017c3e1dc83
218b0a9e173e1637cd0d00abdf727352a2875700
refs/heads/master
2021-06-03T05:28:54.117982
2016-09-14T07:04:09
2016-09-14T07:04:09
68,065,562
1
0
null
null
null
null
UTF-8
Java
false
false
408
java
package cn.inovance.iotgp.common.msg.server; public class AppDataTransferRsp extends Response { public AppDataTransferRsp() { this.msgType = MsgType.APP_DATA_TRANSFER_RSP; } public AppDataTransferRsp(long msgSeq) { super(msgSeq); this.msgType = MsgType.APP_DATA_TRANSFER_RSP; } public AppDataTransferRsp(AppHeartbeatReq req) { super(req); this.msgType = MsgType.APP_DATA_TRANSFER_RSP; } }
3d652fd3e680bb41ffb63ec6eb4b2583f655b90b
4cbedb9840026c5648e8fb7abd72a5153170cb4f
/LinkListGFG/src/basiclinklist/RotateLinkedList.java
e05051b48856c5db6ddea1d78a601b0d4198878c
[]
no_license
rahulpyne/InterviewPrep
b49e1fe1f4e6bc009b76db7762993b0f5507c40d
8e7175421f6d47132d918dece9de2d44856c29f3
refs/heads/master
2020-12-26T02:22:36.110310
2017-01-23T05:08:52
2017-01-23T05:08:52
68,627,619
0
1
null
null
null
null
UTF-8
Java
false
false
1,243
java
package basiclinklist; public class RotateLinkedList { public static void main(String[] args) { LinkedList llist = new LinkedList(); llist.append(10); llist.append(20); llist.append(30); llist.append(40); RotateLinkedList rll= new RotateLinkedList(); Node head = rll.rotateLinkList(llist.getHead(), 4); if(head == null){ System.out.println("The linkedlist is empty or the position is invalid"); } else{ llist.setHead(head); llist.printList(); } } public Node rotateLinkList(Node head, int pos){ Node currhead= null; if(head != null){ if(pos >= 1 && head.getNext()!= null){ int count = 1; Node temphead = head; while(count!= pos && temphead!=null){ temphead = temphead.getNext(); count++; } if(count!=pos){ return null; } else{ Node currtail = temphead; currhead = temphead.getNext(); temphead = temphead.getNext(); currtail.setNext(null); if(temphead == null){ return head; } else{ while(temphead.getNext()!=null){ temphead = temphead.getNext(); } temphead.setNext(head); return currhead; } } } else{ return head; } } return null; } }
6e03b8c7876a9a4aaf9788353ab160219b5e99ac
9f134d87f866c256a6abc3342f9ff2490ebe22ec
/vertexium4-6/src/main/java/com/wxscistor/pojo/vertexium/VertexiumQuery.java
be831f675f03991ca34560b9ce6665ee1f206c49
[]
no_license
MrDLontheway/Graph
2dc6e83624c66836f5b0277009efbf0857a32428
f0249103a574013ee0785cc965db437e6098c4be
refs/heads/master
2022-08-27T05:00:36.275032
2019-10-09T08:18:41
2019-10-09T08:18:41
163,494,003
0
0
null
2022-08-11T21:16:07
2018-12-29T08:44:20
Java
UTF-8
Java
false
false
5,684
java
package com.wxscistor.pojo.vertexium; import org.elasticsearch.index.query.QueryBuilder; import org.vertexium.query.Compare; import org.vertexium.query.Predicate; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 图库基础查询 help * @Author: dl * @Date: 2018/12/6 14:54 * @Version 1.0 */ public class VertexiumQuery implements Serializable { public String keyword; public boolean isSimilar; public String[] similarFields; public boolean isSimilar() { return isSimilar; } public List<QueryBuilder> qbs = new ArrayList<>(); public List<QueryBuilder> sholdQueryBuilders = new ArrayList<>(); public void setSimilar(boolean similar) { isSimilar = similar; } public String[] getSimilarFields() { return similarFields; } public void setSimilarFields(String[] similarFields) { this.similarFields = similarFields; } public VertexiumQuery(String keyword,String... auths){ this.keyword = keyword; this.auths = auths; this.isSimilar = false; } public VertexiumQuery(String keyword,String[] similarFields,String... auths){ this.keyword = keyword; this.auths = auths; this.similarFields = similarFields; this.isSimilar = true; } public VertexiumQuery(String... auths){ this.auths = auths; } //属性 public Map<String,Object> properties = new HashMap<>(); public Map<String,Predicate> propertiesPrediacte = new HashMap<>(); //边标签包含 public List<String> labels = new ArrayList<>(); //ID 包含 public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public Map<String, Object> getProperties() { return properties; } public void setProperties(Map<String, Object> properties) { this.properties = properties; } public Map<String, Predicate> getPropertiesPrediacte() { return propertiesPrediacte; } public void setPropertiesPrediacte(Map<String, Predicate> propertiesPrediacte) { this.propertiesPrediacte = propertiesPrediacte; } public List<String> getLabels() { return labels; } public void setLabels(List<String> labels) { this.labels = labels; } public List<String> getVertexIds() { return VertexIds; } public void setVertexIds(List<String> vertexIds) { VertexIds = vertexIds; } public List<String> getEdgeIds() { return EdgeIds; } public void setEdgeIds(List<String> edgeIds) { EdgeIds = edgeIds; } public String[] getAuths() { return auths; } public void setAuths(String[] auths) { this.auths = auths; } public List<Range> getRanges() { return ranges; } public void setRanges(List<Range> ranges) { this.ranges = ranges; } public boolean isPage() { return isPage; } public void setPage(boolean page) { isPage = page; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getPageIndex() { return pageIndex; } public void setPageIndex(int pageIndex) { this.pageIndex = pageIndex; } public List<String> VertexIds = new ArrayList<>(); //ID 包含 public List<String> EdgeIds = new ArrayList<>(); public String[] auths = new String[]{}; public List<Range> ranges = new ArrayList(); public boolean isPage = false; public int pageSize = 10; public int pageIndex = 0; public VertexiumQuery has(String key,Object value){ has(key,value,Compare.EQUAL); return this; } public VertexiumQuery has(String key,Object value,Predicate predicate){ this.properties.put(key,value); this.propertiesPrediacte.put(key,predicate); return this; } public VertexiumQuery hasNot(String key,Object value){ this.properties.put(key,value); this.propertiesPrediacte.put(key,Compare.NOT_EQUAL); return this; } public VertexiumQuery hasVertexId(String... ids){ for (String id: ids) { VertexIds.add(id); } return this; } public VertexiumQuery hasEdgeId(String... ids){ for (String id: ids) { EdgeIds.add(id); } return this; } public VertexiumQuery range(String key,Object startValue,Object endValue,boolean includStart,boolean includEnd){ this.ranges.add(new Range(key,startValue,endValue,includStart,includEnd)); return this; } public VertexiumQuery range(String key,Object startValue,Object endValue){ this.ranges.add(new Range(key,startValue,endValue,true,true)); return this; } public VertexiumQuery page(int pageSize,int pageIndex){ this.isPage = true; this.pageSize = pageSize; this.pageIndex = pageIndex; return this; } public VertexiumQuery hasLabels(String... labs){ for (String id: labs) { labels.add(id); } return this; } public VertexiumQuery addQueryBuilder(QueryBuilder queryBuilder){ this.qbs.add(queryBuilder); return this; } public VertexiumQuery addSholdQueryBuilders(QueryBuilder queryBuilder){ this.sholdQueryBuilders.add(queryBuilder); return this; } }
4de1ae6d4bf68bed399cf3758bc38187791c2f7b
6d2fe29219cbdd28b64a3cff54c3de3050d6c7be
/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/AirConditioningDataHumidityScheduleEntry.java
e360e5c683b2cda60ff52c4ebe75007ad436fbcb
[ "Apache-2.0", "Unlicense" ]
permissive
siyka-au/plc4x
ca5e7b02702c8e59844bf45ba595052fcda24ac8
44e4ede3b4f54370553549946639a3af2c956bd1
refs/heads/develop
2023-05-12T12:28:09.037476
2023-04-27T22:55:23
2023-04-27T22:55:23
179,656,431
4
3
Apache-2.0
2023-03-02T21:19:18
2019-04-05T09:43:27
Java
UTF-8
Java
false
false
10,842
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.plc4x.java.cbus.readwrite; import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; import static org.apache.plc4x.java.spi.generation.StaticHelper.*; import java.time.*; import java.util.*; import org.apache.plc4x.java.api.exceptions.*; import org.apache.plc4x.java.api.value.*; import org.apache.plc4x.java.spi.codegen.*; import org.apache.plc4x.java.spi.codegen.fields.*; import org.apache.plc4x.java.spi.codegen.io.*; import org.apache.plc4x.java.spi.generation.*; // Code generated by code-generation. DO NOT EDIT. public class AirConditioningDataHumidityScheduleEntry extends AirConditioningData implements Message { // Accessors for discriminator values. // Properties. protected final byte zoneGroup; protected final HVACZoneList zoneList; protected final short entry; protected final byte format; protected final HVACHumidityModeAndFlags humidityModeAndFlags; protected final HVACStartTime startTime; protected final HVACHumidity level; protected final HVACRawLevels rawLevel; public AirConditioningDataHumidityScheduleEntry( AirConditioningCommandTypeContainer commandTypeContainer, byte zoneGroup, HVACZoneList zoneList, short entry, byte format, HVACHumidityModeAndFlags humidityModeAndFlags, HVACStartTime startTime, HVACHumidity level, HVACRawLevels rawLevel) { super(commandTypeContainer); this.zoneGroup = zoneGroup; this.zoneList = zoneList; this.entry = entry; this.format = format; this.humidityModeAndFlags = humidityModeAndFlags; this.startTime = startTime; this.level = level; this.rawLevel = rawLevel; } public byte getZoneGroup() { return zoneGroup; } public HVACZoneList getZoneList() { return zoneList; } public short getEntry() { return entry; } public byte getFormat() { return format; } public HVACHumidityModeAndFlags getHumidityModeAndFlags() { return humidityModeAndFlags; } public HVACStartTime getStartTime() { return startTime; } public HVACHumidity getLevel() { return level; } public HVACRawLevels getRawLevel() { return rawLevel; } @Override protected void serializeAirConditioningDataChild(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); int startPos = positionAware.getPos(); writeBuffer.pushContext("AirConditioningDataHumidityScheduleEntry"); // Simple Field (zoneGroup) writeSimpleField("zoneGroup", zoneGroup, writeByte(writeBuffer, 8)); // Simple Field (zoneList) writeSimpleField("zoneList", zoneList, new DataWriterComplexDefault<>(writeBuffer)); // Simple Field (entry) writeSimpleField("entry", entry, writeUnsignedShort(writeBuffer, 8)); // Simple Field (format) writeSimpleField("format", format, writeByte(writeBuffer, 8)); // Simple Field (humidityModeAndFlags) writeSimpleField( "humidityModeAndFlags", humidityModeAndFlags, new DataWriterComplexDefault<>(writeBuffer)); // Simple Field (startTime) writeSimpleField("startTime", startTime, new DataWriterComplexDefault<>(writeBuffer)); // Optional Field (level) (Can be skipped, if the value is null) writeOptionalField( "level", level, new DataWriterComplexDefault<>(writeBuffer), getHumidityModeAndFlags().getIsLevelHumidity()); // Optional Field (rawLevel) (Can be skipped, if the value is null) writeOptionalField( "rawLevel", rawLevel, new DataWriterComplexDefault<>(writeBuffer), getHumidityModeAndFlags().getIsLevelRaw()); writeBuffer.popContext("AirConditioningDataHumidityScheduleEntry"); } @Override public int getLengthInBytes() { return (int) Math.ceil((float) getLengthInBits() / 8.0); } @Override public int getLengthInBits() { int lengthInBits = super.getLengthInBits(); AirConditioningDataHumidityScheduleEntry _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); // Simple field (zoneGroup) lengthInBits += 8; // Simple field (zoneList) lengthInBits += zoneList.getLengthInBits(); // Simple field (entry) lengthInBits += 8; // Simple field (format) lengthInBits += 8; // Simple field (humidityModeAndFlags) lengthInBits += humidityModeAndFlags.getLengthInBits(); // Simple field (startTime) lengthInBits += startTime.getLengthInBits(); // Optional Field (level) if (level != null) { lengthInBits += level.getLengthInBits(); } // Optional Field (rawLevel) if (rawLevel != null) { lengthInBits += rawLevel.getLengthInBits(); } return lengthInBits; } public static AirConditioningDataBuilder staticParseAirConditioningDataBuilder( ReadBuffer readBuffer) throws ParseException { readBuffer.pullContext("AirConditioningDataHumidityScheduleEntry"); PositionAware positionAware = readBuffer; int startPos = positionAware.getPos(); int curPos; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); byte zoneGroup = readSimpleField("zoneGroup", readByte(readBuffer, 8)); HVACZoneList zoneList = readSimpleField( "zoneList", new DataReaderComplexDefault<>(() -> HVACZoneList.staticParse(readBuffer), readBuffer)); short entry = readSimpleField("entry", readUnsignedShort(readBuffer, 8)); byte format = readSimpleField("format", readByte(readBuffer, 8)); HVACHumidityModeAndFlags humidityModeAndFlags = readSimpleField( "humidityModeAndFlags", new DataReaderComplexDefault<>( () -> HVACHumidityModeAndFlags.staticParse(readBuffer), readBuffer)); HVACStartTime startTime = readSimpleField( "startTime", new DataReaderComplexDefault<>( () -> HVACStartTime.staticParse(readBuffer), readBuffer)); HVACHumidity level = readOptionalField( "level", new DataReaderComplexDefault<>(() -> HVACHumidity.staticParse(readBuffer), readBuffer), humidityModeAndFlags.getIsLevelHumidity()); HVACRawLevels rawLevel = readOptionalField( "rawLevel", new DataReaderComplexDefault<>(() -> HVACRawLevels.staticParse(readBuffer), readBuffer), humidityModeAndFlags.getIsLevelRaw()); readBuffer.closeContext("AirConditioningDataHumidityScheduleEntry"); // Create the instance return new AirConditioningDataHumidityScheduleEntryBuilderImpl( zoneGroup, zoneList, entry, format, humidityModeAndFlags, startTime, level, rawLevel); } public static class AirConditioningDataHumidityScheduleEntryBuilderImpl implements AirConditioningData.AirConditioningDataBuilder { private final byte zoneGroup; private final HVACZoneList zoneList; private final short entry; private final byte format; private final HVACHumidityModeAndFlags humidityModeAndFlags; private final HVACStartTime startTime; private final HVACHumidity level; private final HVACRawLevels rawLevel; public AirConditioningDataHumidityScheduleEntryBuilderImpl( byte zoneGroup, HVACZoneList zoneList, short entry, byte format, HVACHumidityModeAndFlags humidityModeAndFlags, HVACStartTime startTime, HVACHumidity level, HVACRawLevels rawLevel) { this.zoneGroup = zoneGroup; this.zoneList = zoneList; this.entry = entry; this.format = format; this.humidityModeAndFlags = humidityModeAndFlags; this.startTime = startTime; this.level = level; this.rawLevel = rawLevel; } public AirConditioningDataHumidityScheduleEntry build( AirConditioningCommandTypeContainer commandTypeContainer) { AirConditioningDataHumidityScheduleEntry airConditioningDataHumidityScheduleEntry = new AirConditioningDataHumidityScheduleEntry( commandTypeContainer, zoneGroup, zoneList, entry, format, humidityModeAndFlags, startTime, level, rawLevel); return airConditioningDataHumidityScheduleEntry; } } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AirConditioningDataHumidityScheduleEntry)) { return false; } AirConditioningDataHumidityScheduleEntry that = (AirConditioningDataHumidityScheduleEntry) o; return (getZoneGroup() == that.getZoneGroup()) && (getZoneList() == that.getZoneList()) && (getEntry() == that.getEntry()) && (getFormat() == that.getFormat()) && (getHumidityModeAndFlags() == that.getHumidityModeAndFlags()) && (getStartTime() == that.getStartTime()) && (getLevel() == that.getLevel()) && (getRawLevel() == that.getRawLevel()) && super.equals(that) && true; } @Override public int hashCode() { return Objects.hash( super.hashCode(), getZoneGroup(), getZoneList(), getEntry(), getFormat(), getHumidityModeAndFlags(), getStartTime(), getLevel(), getRawLevel()); } @Override public String toString() { WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); try { writeBufferBoxBased.writeSerializable(this); } catch (SerializationException e) { throw new RuntimeException(e); } return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; } }
4beccea154b95709bd40f83130fa43273249f703
44d8fdc8fbb85711a040ff3bb7d1414823c77f46
/src/lab/aikibo/manager/RealisasiSPPTManager.java
0d1f26931eeedb26902cabc0f389a4e98b59d00b
[]
no_license
tamami/PBB-Info-WS
e113f1d32a21d48f16c46af3852c26985c64a9b5
286521d3dc8842d9cf33c0af5f2098b2ff093e79
refs/heads/master
2016-09-02T02:09:20.457577
2013-10-18T01:10:18
2013-10-18T01:10:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,225
java
package lab.aikibo.manager; import java.math.BigInteger; import java.util.Date; import java.util.Iterator; import java.util.List; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import lab.aikibo.entity.PembayaranSPPT; import lab.aikibo.entity.RealisasiSPPT; import lab.aikibo.entity.RealisasiSPPTTahunan; import lab.aikibo.util.ConnectorUtil; import lab.aikibo.util.NumberParsing; public class RealisasiSPPTManager { public static long getRealisasiSPPT() { ConnectorUtil cu = new ConnectorUtil(); Session session = cu.getSessionFactory().openSession(); //session.beginTransaction(); Iterator iterator = session.createQuery("from RealisasiSPPT").iterate(); if(iterator.hasNext()) { RealisasiSPPT realisasi = (RealisasiSPPT) iterator.next(); return (long) realisasi.getJumlahPembayaran(); } return -1; } public static long getRealisasiSPPTTahunan(int tahun) { ConnectorUtil cu = new ConnectorUtil(); Session session = cu.getSessionFactory().openSession(); String sql = "select * from realisasi_sppt_tahunan where tahun = :tahun"; SQLQuery query = session.createSQLQuery(sql); query.setParameter("tahun", tahun); query.addEntity(RealisasiSPPTTahunan.class); List list = query.list(); if(!list.isEmpty()) { RealisasiSPPTTahunan realisasi = (RealisasiSPPTTahunan) list.get(0); session.close(); return realisasi.getNilai(); } session.close(); return 0; } public static String getRealisasiSPPT(Date tanggal) { ConnectorUtil cu = new ConnectorUtil(); Session session = cu.getSessionFactory().openSession(); String sql = "select sum(jumlahPembayaran) from RealisasiSPPT " + "where tanggalPembayaran >= to_date('01/01/" + (tanggal.getYear() + 1900) + "','DD/MM/YYYY') and tanggalPembayaran <= to_date('" + tanggal.getDate() + "/" + (tanggal.getMonth() + 1) + "/" + (tanggal.getYear() + 1900) + "','DD/MM/YYYY')"; Long nilai = ((Long) session.createQuery(sql).iterate().next()).longValue(); //Iterator iterator = query.iterate(); //Long nilai = ((Long) iterator.next()).longValue(); String nilaiStr = NumberParsing.getRupiahString(new BigInteger("" + nilai)); return nilaiStr; } }
1b4819d53fbe80de80dceb1b704a28769eafdacc
d548e8477702d20768cebed9b72774374db27d22
/src/main/java/model/dao/veiculoDao.java
9e252814c28f9da95d05150385ee8c2c96cf3a33
[]
no_license
PedroAugusto-sys/provao2
60941ecbd8de9b2cf9132ee41b89983f2b1d85cb
38a41654ea8ae750850357db2498edbc62d395d9
refs/heads/master
2023-05-05T08:30:37.781265
2021-05-28T01:07:27
2021-05-28T01:07:27
371,542,076
1
0
null
null
null
null
UTF-8
Java
false
false
3,176
java
package model.dao; import model.dao.util.ConnectionFactory; import model.veiculo.veiculo; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class veiculoDao { Connection con; private Statement statement; private PreparedStatement preparedStatement; public veiculoDao(){ ConnectionFactory connectionFactory = new ConnectionFactory(); con = connectionFactory.getConnection(); } public boolean inserirveiculo(veiculo veiculo){ boolean isSalvo = false; String query = "insert into veiculo (placa,ano)" + "values(?,?)"; try { con.setAutoCommit(false); preparedStatement = con.prepareStatement(query); preparedStatement.setInt(1, veiculo.getAno()); preparedStatement.setInt(2, veiculo.getPlaca()); preparedStatement.executeUpdate(); con.commit(); isSalvo = true; }catch (Exception e){ System.err.println("Erro ao inserir veiculo "+ e.getMessage()); isSalvo = false; } return isSalvo; } public List<veiculo> listarveiculo(){ List<veiculo> veiculos = new ArrayList(); ResultSet set; try{ statement = con.createStatement(); set = statement.executeQuery("select * from veiculos:"); while(set.next()){ veiculo veiculo = new veiculo() { @Override public String exibirdados() { return null; } }; veiculo.setPlaca(set.getString("placa")); veiculos.add(veiculo); } }catch (Exception e){ System.err.println("erro ao listar veículos: "+ e.getMessage()); } return veiculos; } public boolean atulaizarVeiculo(veiculo veiculo){ boolean isSalvo = false; String query = "update veiculos set placa = ?"; try { con.setAutoCommit(false); preparedStatement = con.prepareStatement(query); preparedStatement.setInt(1, veiculo.getPlaca()); preparedStatement.executeUpdate(); con.commit(); isSalvo = true; }catch (Exception e){ System.err.println("Erro ao atualizar veiculos "+ e.getMessage()); isSalvo = false; } return isSalvo; } public boolean deletarVeiculo(int placa){ boolean isSalvo = false; String query = "delete from veiculos where placa =?"; try { con.setAutoCommit(false); preparedStatement = con.prepareStatement(query); preparedStatement.setInt(1, placa); preparedStatement.executeUpdate(); con.commit(); isSalvo = true; }catch (Exception e){ System.err.println("Erro ao deletar veiculo "+ e.getMessage()); isSalvo = false; } return isSalvo; } }
fc5ff9715dcf99049cac24efdbcd0179a2e269e9
28d7e9318c799dcbb87bb3c26ad788fbde5e3f78
/KropachevShop/src/java/command/AllFaqCommand.java
5ff0bada51b91d32f7628f40de010b4d57f381ab
[]
no_license
keloma/KropachevShop
61a927a0c99bd28b2215a01bfcd088128f765d86
550374976dd2abb4967a460c9578397626c17cf8
refs/heads/master
2020-03-20T20:05:02.515354
2018-06-17T16:40:46
2018-06-17T16:40:46
137,669,346
0
0
null
null
null
null
UTF-8
Java
false
false
1,665
java
package command; import classes.Roles; import classes.UserService; import command.creater.RoutingManager; import entity.User; import interfaces.ActionCommand; import java.util.logging.Level; import java.util.logging.Logger; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import session.FaqFacade; public class AllFaqCommand implements ActionCommand { private FaqFacade faqFacade; public AllFaqCommand() { try { Context context; context = new InitialContext(); faqFacade = (FaqFacade) context.lookup("java:module/FaqFacade"); } catch (NamingException ex) { Logger.getLogger(AllFaqCommand.class.getName()).log(Level.SEVERE, "Не удалось найти бин", ex); } } @Override public String execute(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session == null){ return RoutingManager.getRoute("path.page.login"); } User regUser = (User) session.getAttribute("regUser"); if(regUser==null) { return RoutingManager.getRoute("path.page.login"); } UserService us = new UserService(); if(!us.userContainRole(Roles.SUPPORT.toString(), regUser)){ String page = RoutingManager.getRoute("path.page.login"); return page; } request.setAttribute("faq", faqFacade.findAll()); return RoutingManager.getRoute("path.page.allFaq"); } }
006d482503f326c07866584cad866ef5a7d04ebc
2f154e22ee4baf14f3de9e4ee6847141a48588f8
/eGram/app/src/main/java/asterios/eGram/app/Grades/GradesAdapter.java
aefcd81dac19ad93a50db8874b95c89f658facb3
[]
no_license
asterios2000/ionio-eGram
a8087a3553d710b2cc013169ec11dbe9db0b20c4
33339632c56ab7b9a166f5cb8de2d989ae8d5ac3
refs/heads/master
2020-04-16T07:48:46.182782
2015-08-16T18:26:42
2015-08-16T18:26:42
40,832,903
0
0
null
null
null
null
UTF-8
Java
false
false
5,663
java
package asterios.eGram.app.Grades; import android.app.Activity; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.CheckedTextView; import android.widget.TextView; import android.widget.Toast; import asterios.eGram.app.R; import asterios.eGram.app.eGramFunctions; public class GradesAdapter extends BaseExpandableListAdapter { private final SparseArray<Group> groups; public LayoutInflater inflater; public Activity activity; public GradesAdapter(Activity act, SparseArray<Group> groups) { activity = act; this.groups = groups; inflater = act.getLayoutInflater(); } @Override public Object getChild(int groupPosition, int childPosition) { return groups.get(groupPosition).subjects.get(childPosition); } public Object getGrade(int groupPosition, int childPosition) { return groups.get(groupPosition).grades.get(childPosition); } public Object getType(int groupPosition, int childPosition) { return groups.get(groupPosition).types.get(childPosition); } public Object getDM(int groupPosition, int childPosition) { return groups.get(groupPosition).DMs.get(childPosition); } public Object getECTS(int groupPosition, int childPosition) { return groups.get(groupPosition).ECTS.get(childPosition); } public Object getExaminationPeriod(int groupPosition, int childPosition) { return groups.get(groupPosition).Examinations.get(childPosition); } @Override public long getChildId(int groupPosition, int childPosition) { return 0; } @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { final String children = (String) getChild(groupPosition, childPosition); final String grades = (String) getGrade(groupPosition, childPosition); final String types = (String) getType(groupPosition, childPosition); final String DMs = (String) getDM(groupPosition, childPosition); final String ECTS = (String) getECTS(groupPosition, childPosition); final String Examinations = (String) getExaminationPeriod(groupPosition, childPosition); TextView text = null; if (convertView == null) { convertView = inflater.inflate(R.layout.explist_row_details, null); } text = (TextView) convertView.findViewById(R.id.subject); text.setText(children); TextView grade = null; grade = (TextView) convertView.findViewById(R.id.grade); grade.setText(grades); TextView DM = null; DM = (TextView) convertView.findViewById(R.id.DM); DM.setText(DMs); TextView Ects = null; Ects = (TextView) convertView.findViewById(R.id.ECTS); Ects.setText(ECTS); //------------------------------- Short Click Actions --------------------------------// convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { eGramFunctions.ShowOKDialog(activity,R.drawable.ic_grades,children, activity.getString(R.string.ExPeriodTitle)+Examinations+"\n"+ activity.getString(R.string.typeTitle)+types); } }); return convertView; } @Override public int getChildrenCount(int groupPosition) { return groups.get(groupPosition).subjects.size(); } @Override public Object getGroup(int groupPosition) { return groups.get(groupPosition); } public Object getGroupTotalSubjectsPassed(int groupPosition) { return groups.get(groupPosition); } @Override public int getGroupCount() { return groups.size(); } @Override public void onGroupCollapsed(int groupPosition) { super.onGroupCollapsed(groupPosition); } @Override public void onGroupExpanded(int groupPosition) { super.onGroupExpanded(groupPosition); } @Override public long getGroupId(int groupPosition) { return 0; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.explist_group_row, null); } Group group = (Group) getGroup(groupPosition); CheckedTextView sem = (CheckedTextView) convertView.findViewById(R.id.semester); sem.setText(group.string); TextView TotalSubjectsPassed = (TextView) convertView.findViewById(R.id.totalSubjectsPassed); TotalSubjectsPassed.setText(group.semesterSubjectsPassed); TextView TotalDM = (TextView) convertView.findViewById(R.id.totalDM); TotalDM.setText(group.semesterDM); TextView TotalECTS = (TextView) convertView.findViewById(R.id.totalECTS); TotalECTS.setText(group.semesterECTS); TextView mo = (TextView) convertView.findViewById(R.id.mo); mo.setText(group.semesterMO); /*((CheckedTextView) convertView).setText(group.string); ((CheckedTextView) convertView).setChecked(isExpanded);*/ return convertView; } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } }
bc9a1ceea17240c19fee4371657b658d2f356a69
9e7c81a25074a2ed3b826bfe4426b354ee4d5c8c
/src/main/java/com/findinpath/repository/SchemaMigrationRepository.java
d04d5738395aaf66db30a8c9fe95362ac3dd5dfd
[]
no_license
findinpath/cassandra-migration-spring-boot-demo
3d9d3650e120855b2a884bc45cfdd50ed645f29b
47a799a64449b85511e06acbfdb2a75496384d13
refs/heads/master
2020-09-10T06:59:20.759899
2019-11-14T11:12:58
2019-11-14T11:12:58
221,679,002
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.findinpath.repository; import com.findinpath.model.SchemaMigration; import com.findinpath.model.SchemaMigrationKey; import org.springframework.data.repository.CrudRepository; public interface SchemaMigrationRepository extends CrudRepository<SchemaMigration, SchemaMigrationKey> { }
a6a207a7ac976cb59b1d07f489adb19bb01dc394
e4debb01181c74bdf0affd0bac63173428ab32ec
/xnradmin-model/xnradmin-core/src/main/java/com/xnradmin/core/pay/upmp/util/UpmpCore.java
7386c15282c6c9f09c77634e12a198cebecc2ca4
[]
no_license
dingjianhui1013/xnr
a1e0ed783e9296f735419852ffbd6a3985b003ca
296cae74a2c6a876a3eef24f92ccdf6cbea6b7e3
refs/heads/master
2021-01-18T03:32:26.257508
2017-03-22T10:16:44
2017-03-22T10:16:44
82,752,226
0
0
null
2017-02-22T02:47:10
2017-02-22T02:40:20
null
UTF-8
Java
false
false
4,921
java
package com.xnradmin.core.pay.upmp.util; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import com.xnradmin.core.pay.upmp.conf.UpmpConfig; /** * 类名:交易服务类 * 功能:接口公用函数类 * 版本:1.0 * 日期:2012-10-11 * 作者:中国银联UPMP团队 * 版权:中国银联 * 说明:以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己的需要,按照技术文档编写,并非一定要使用该代码。该代码仅供参考。 * */ public class UpmpCore { /** = */ public static final String QSTRING_EQUAL = "="; /** & */ public static final String QSTRING_SPLIT = "&"; /** * 除去请求要素中的空值和签名参数 * @param para 请求要素 * @return 去掉空值与签名参数后的请求要素 */ public static Map<String, String> paraFilter(Map<String, String> para) { Map<String, String> result = new HashMap<String, String>(); if (para == null || para.size() <= 0) { return result; } for (String key : para.keySet()) { String value = para.get(key); if (value == null || value.equals("") || key.equalsIgnoreCase(UpmpConfig.SIGNATURE) || key.equalsIgnoreCase(UpmpConfig.SIGN_METHOD)) { continue; } result.put(key, value); } return result; } /** * 生成签名 * @param req 需要签名的要素 * @return 签名结果字符串 */ public static String buildSignature(Map<String, String> req) { String prestr = createLinkString(req, true, false); prestr = prestr + QSTRING_SPLIT + UpmpMd5Encrypt.md5(UpmpConfig.SECURITY_KEY); return UpmpMd5Encrypt.md5(prestr); } /** * 把请求要素按照“参数=参数值”的模式用“&”字符拼接成字符串 * @param para 请求要素 * @param sort 是否需要根据key值作升序排列 * @param encode 是否需要URL编码 * @return 拼接成的字符串 */ public static String createLinkString(Map<String, String> para, boolean sort, boolean encode) { List<String> keys = new ArrayList<String>(para.keySet()); if (sort) Collections.sort(keys); StringBuilder sb = new StringBuilder(); for (int i = 0; i < keys.size(); i++) { String key = keys.get(i); String value = para.get(key); if (encode) { try { value = URLEncoder.encode(value, UpmpConfig.CHARSET); } catch (UnsupportedEncodingException e) { } } if (i == keys.size() - 1) {//拼接时,不包括最后一个&字符 sb.append(key).append(QSTRING_EQUAL).append(value); } else { sb.append(key).append(QSTRING_EQUAL).append(value).append(QSTRING_SPLIT); } } return sb.toString(); } /** * 解析应答字符串,生成应答要素 * * @param str 需要解析的字符串 * @return 解析的结果map * @throws UnsupportedEncodingException */ public static Map<String, String> parseQString(String str) throws UnsupportedEncodingException { Map<String, String> map = new HashMap<String, String>(); int len = str.length(); StringBuilder temp = new StringBuilder(); char curChar; String key = null; boolean isKey = true; for (int i = 0; i < len; i++) {// 遍历整个带解析的字符串 curChar = str.charAt(i);// 取当前字符 if (curChar == '&') {// 如果读取到&分割符 putKeyValueToMap(temp, isKey, key, map); temp.setLength(0); isKey = true; } else { if (isKey) {// 如果当前生成的是key if (curChar == '=') {// 如果读取到=分隔符 key = temp.toString(); temp.setLength(0); isKey = false; } else { temp.append(curChar); } } else {// 如果当前生成的是value temp.append(curChar); } } } putKeyValueToMap(temp, isKey, key, map); return map; } private static void putKeyValueToMap(StringBuilder temp, boolean isKey, String key, Map<String, String> map) throws UnsupportedEncodingException { if (isKey) { key = temp.toString(); if (key.length() == 0) { throw new RuntimeException("QString format illegal"); } map.put(key, ""); } else { if (key.length() == 0) { throw new RuntimeException("QString format illegal"); } map.put(key, URLDecoder.decode(temp.toString(), UpmpConfig.CHARSET)); } } }
4e6118892533f11caca5ea4eaf168151b6ee0fc7
869fc964407c8859db9902c9074415a8c98fe968
/grocery-store-service/src/main/java/com/ibm/learning/exception/ProductNotFoundException.java
cf34b112b3f6f24d2c5f2c41e1f89d931cbb521c
[]
no_license
codereprab/microservice-reskill
c8ef9f238b140d26852b2b18dc58bcfcb8888d58
6496daa58d34a2e2bb0bb068b0226c17ebcc2fe2
refs/heads/main
2023-01-08T07:47:28.667766
2020-11-11T05:42:47
2020-11-11T05:42:47
311,319,347
0
0
null
null
null
null
UTF-8
Java
false
false
280
java
package com.ibm.learning.exception; public class ProductNotFoundException extends RuntimeException { /** * */ private static final long serialVersionUID = -1951008448950951896L; public ProductNotFoundException(String exception) { super(exception); } }
0e848e26bcc38b5acfb2b88c84da37b6a9df453a
813a20ff71928d1a63bec7036a2784e17d669f79
/Project1/src/main/java/com/revature/models/User.java
d8d4ea01cf0c1c69b8a0225aa865bd8d724e550b
[]
no_license
1909-blake-william/project-1-David-Quillen9826
fc1260267261b5d9426df25b8a803bf70c580db1
6cf03e43ff741adcdab185a301485386f04dabb8
refs/heads/master
2022-11-24T05:42:08.093373
2019-11-19T03:28:59
2019-11-19T03:28:59
220,029,185
0
0
null
2022-11-15T23:32:29
2019-11-06T15:29:34
Java
UTF-8
Java
false
false
3,345
java
package com.revature.models; public class User { private int id; private String username; private String password; private String firstName; private String lastName; private String email; private int role; public User() { super(); // TODO Auto-generated constructor stub } public User(int id, String username, String password, String firstName, String lastName, String email, int role) { super(); this.id = id; this.username = username; this.password = password; this.firstName = firstName; this.lastName = lastName; this.email = email; this.role = role; } public synchronized int getId() { return id; } public synchronized void setId(int id) { this.id = id; } public synchronized String getUsername() { return username; } public synchronized void setUsername(String username) { this.username = username; } public synchronized String getPassword() { return password; } public synchronized void setPassword(String password) { this.password = password; } public synchronized String getFirstName() { return firstName; } public synchronized void setFirstName(String firstName) { this.firstName = firstName; } public synchronized String getLastName() { return lastName; } public synchronized void setLastName(String lastName) { this.lastName = lastName; } public synchronized String getEmail() { return email; } public synchronized void setEmail(String email) { this.email = email; } public synchronized int getRole() { return role; } public synchronized void setRole(int role) { this.role = role; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + id; result = prime * result + ((lastName == null) ? 0 : lastName.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); result = prime * result + role; result = prime * result + ((username == null) ? 0 : username.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstName)) return false; if (id != other.id) return false; if (lastName == null) { if (other.lastName != null) return false; } else if (!lastName.equals(other.lastName)) return false; if (password == null) { if (other.password != null) return false; } else if (!password.equals(other.password)) return false; if (role != other.role) return false; if (username == null) { if (other.username != null) return false; } else if (!username.equals(other.username)) return false; return true; } @Override public String toString() { return "User [id=" + id + ", username=" + username + ", password=" + password + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email + ", role=" + role + "]"; } }
bd702161d1c62050ff10eec35cc0fa4e63a70fcc
95793b0688ceaa76cd34f442f38fe7f748aaa967
/src/utils/FXContextMenuHandlers.java
a56a965bc862e2419bef1031f772b8270d8ed9f3
[]
no_license
FabienAlz/BeWizUProjet_AL_M1
8277ecefa1223a6965a53c2cfaa01c5a123f3de4
16bff2b4726b0f8c175fc57f92c84f1e232c21ed
refs/heads/master
2022-10-02T14:10:03.250764
2020-05-24T14:43:24
2020-05-24T14:43:24
261,592,647
1
1
null
null
null
null
UTF-8
Java
false
false
3,224
java
package utils; import javafx.scene.Node; import javafx.scene.input.ContextMenuEvent; import javafx.scene.shape.Polygon; import javafx.scene.shape.Rectangle; import model.Canvas; import model.FXImplementor; import model.Shape; import java.sql.SQLOutput; /* * This class contains all the context menu handlers */ public class FXContextMenuHandlers { private final Shape shape; private final javafx.scene.shape.Shape FXShape; private final FXImplementor implementor; public FXContextMenuHandlers(Shape s, javafx.scene.shape.Shape FXShape) { this.shape = s; this.FXShape = FXShape; this.implementor = FXImplementor.getInstance(); } /** * Resets selection and shows the context menu */ public void manageContextMenu(ContextMenuEvent contextMenuEvent) { if (!shape.isSelected()) { // Makes the Shape selected and deselects the others for (Shape s : Canvas.getInstance().getShapes()) { if (s.isSelected()) { s.setSelected(false); } } shape.setSelected(true); implementor.setLastSelected(shape, FXShape); // Updates the Canvas implementor.getCanvas().getChildren().clear(); Canvas.getInstance().notifyAllShapes(); // Finds the new FXShape (with stroke) to bind with the ContextMenu since the last one was destroyed for (Node n : implementor.getCanvas().getChildren()) { if (n.getClass() == FXShape.getClass()) { if (n instanceof javafx.scene.shape.Rectangle) { // Compares the position and the size if (((Rectangle) n).getX() == ((Rectangle) FXShape).getX() && ((Rectangle) n).getY() == ((Rectangle) FXShape).getY() && ((Rectangle) n).getWidth() == ((Rectangle) FXShape).getWidth() && ((Rectangle) n).getHeight() == ((Rectangle) FXShape).getHeight()) { implementor.getContextMenu().show(n, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY()); break; } } else if (n instanceof javafx.scene.shape.Polygon) { boolean isEqual = true; // Compares the position of the points for (int i = 0; i < ((Polygon) n).getPoints().size(); i++) { if (!((Polygon) n).getPoints().get(i).equals(((Polygon) FXShape).getPoints().get(i))) { isEqual = false; break; } } if (isEqual) { implementor.getContextMenu().show(n, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY()); break; } } } } } else { implementor.getContextMenu().show(FXShape, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY()); implementor.setLastSelected(shape, FXShape); } } }
801ecc9c4a6169321f3930eb6744d27f6d321065
68c79ebb6ccbac64d91dfa3cba5924d7a7cf341d
/src/main/java/edu/mum/elibrary/ElibraryApplication.java
4f294e0876cd3803be423b1fc70f572de94470d5
[]
no_license
Betelehem/elibrary
9f879382e0635722c99a9504966689a88bb20b41
dc2ba920810b340c8a804bbfebf465101f6b1488
refs/heads/master
2020-06-26T19:01:58.062243
2019-08-07T22:35:30
2019-08-07T22:35:30
199,723,598
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package edu.mum.elibrary; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ElibraryApplication { public static void main(String[] args) { SpringApplication.run(ElibraryApplication.class, args); } }
24070dd990e01020515873575e3f342ce89ff62e
00b811429a48cb15a20be0920bd3a06bef01883b
/TileEntities/Weaponry/TileEntityTNTCannon.java
9d28571a2ff132d3dab3ade0876ed0306f26d21c
[]
no_license
rotarycraftfan/RotaryCraft
1fcedab9f2161486742e7f34931a36391c098490
c8088321e18e3f9c14a5fe1e863047238566b84d
refs/heads/master
2021-01-22T20:39:57.233469
2014-05-09T04:45:17
2014-05-09T04:45:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,530
java
/******************************************************************************* * @author Reika Kalseki * * Copyright 2014 * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. ******************************************************************************/ package Reika.RotaryCraft.TileEntities.Weaponry; import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import Reika.DragonAPI.Libraries.ReikaInventoryHelper; import Reika.DragonAPI.Libraries.IO.ReikaChatHelper; import Reika.DragonAPI.Libraries.MathSci.ReikaMathLibrary; import Reika.DragonAPI.Libraries.MathSci.ReikaPhysicsHelper; import Reika.RotaryCraft.Base.TileEntity.TileEntityLaunchCannon; import Reika.RotaryCraft.Entities.EntityCustomTNT; import Reika.RotaryCraft.Registry.ConfigRegistry; import Reika.RotaryCraft.Registry.MachineRegistry; public class TileEntityTNTCannon extends TileEntityLaunchCannon { public static final double gTNT = 7.5; //Calculated from EntityTNTPrimed; vy -= 0.04, *0.98, 20x a sec public static final double torquecap = 32768D; public boolean isCreative = false; public int selectedFuse; //private final ArrayList<EntityTNTPrimed> fired = new ArrayList(); //Make torque affect max incline angle, speed max distance @Override public int getMaxLaunchVelocity() { return (int)Math.sqrt(power/67.5D); } @Override public int getMaxTheta() { if (torque > torquecap) return 90; int ang = 2*(int)Math.ceil(Math.toDegrees(Math.asin(torque/torquecap))); if (ang > 90) return 90; return ang; } @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { return false; } @Override public double getMaxLaunchDistance() { double v = this.getMaxLaunchVelocity(); double vy = v*Math.sin(Math.toRadians(45)); double t = vy/9.81D; return t*vy; //vx = vy @ 45 } @Override public void updateEntity(World world, int x, int y, int z, int meta) { super.updateTileEntity(); this.getSummativeSidedPower(); if (power < MINPOWER) return; tickcount++; if (tickcount < this.getOperationTime()) return; tickcount = 0; if (targetMode) this.calcTarget(world, x, y, z); if (this.canFire()) this.fire(world, x, y, z); //this.syncTNTData(world, x, y, z); if (targetMode) { AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1).expand(256, 256, 256); List in = world.getEntitiesWithinAABB(EntityTNTPrimed.class, box); for (int i = 0; i < in.size(); i++) { EntityTNTPrimed tnt = (EntityTNTPrimed)in.get(i); if (!tnt.onGround) { //Nullify air resistance tnt.motionX /= 0.869800000190734863D; tnt.motionZ /= 0.869800000190734863D; if (!world.isRemote) tnt.velocityChanged = true; } else { tnt.motionX = 0; tnt.motionZ = 0; if (!world.isRemote) tnt.velocityChanged = true; } } } } /* private void syncTNTData(World world, int x, int y, int z) { if (!world.isRemote) return; Iterator<EntityTNTPrimed> it = fired.iterator(); while (it.hasNext()) { EntityTNTPrimed tnt = it.next(); if (tnt.ticksExisted < this.getMinFuse()) { //ReikaJavaLibrary.pConsole(tnt+":"+this.getSide()); tnt.fuse = this.getFuseTime(); } else { if (tnt.fuse < 0) tnt.setDead(); if (tnt.isDead) it.remove(); } } }*/ private int getMinFuse() { return 5; } private void calcTarget(World world, int x, int y, int z) { double dx = target[0]-x-0.5; double dy = target[1]-y-1; double dz = target[2]-z-0.5; double dl = ReikaMathLibrary.py3d(dx, 0, dz); //Horiz distance double g = 8.4695*ReikaMathLibrary.doubpow(dl, 0.2701); if (dy > 0) g *= (0.8951*ReikaMathLibrary.doubpow(dy, 0.0601)); velocity = 10; theta = 0; while (theta <= 0) { velocity++; double s = ReikaMathLibrary.intpow(velocity, 4)-g*(g*dl*dl+2*dy*velocity*velocity); double a = velocity*velocity+Math.sqrt(s); theta = (int)Math.toDegrees(Math.atan(a/(g*dl))); phi = (int)Math.toDegrees(Math.atan2(dz, dx)); } } private boolean canFire() { boolean hasTNT = ReikaInventoryHelper.checkForItem(Block.tnt.blockID, inv); return (hasTNT || isCreative); } @Override protected boolean fire(World world, int x, int y, int z) { if (ConfigRegistry.ALLOWTNTCANNON.getState()) { for (int i = 0; i < 1; i++) { ReikaInventoryHelper.findAndDecrStack(Block.tnt.blockID, -1, inv); world.playSoundEffect(x+0.5, y+0.5, z+0.5, "random.explode", 0.7F+0.3F*rand.nextFloat()*12, 0.1F*rand.nextFloat()); world.spawnParticle("hugeexplosion", x+0.5, y+0.5, z+0.5, 1.0D, 0.0D, 0.0D); EntityCustomTNT tnt = new EntityCustomTNT(world, x+0.5, y+1.5-0.0625, z+0.5, null, this.getFuseTime()); double[] xyz = ReikaPhysicsHelper.polarToCartesian(velocity/20D, theta, phi); tnt.motionX = xyz[0]; tnt.motionY = xyz[1]; tnt.motionZ = xyz[2]; if (!world.isRemote) { tnt.velocityChanged = true; world.spawnEntityInWorld(tnt); } //fired.add(tnt); } return true; } else { ReikaChatHelper.sendChatToAllOnServer(this+" cannot fire as the TNT cannon has been disabled."); return false; } } private int getFuseTime() { return targetMode ? 50 : Math.max(this.getMinFuse(), selectedFuse); } /** * Reads a tile entity from NBT. */ @Override protected void readSyncTag(NBTTagCompound NBT) { super.readSyncTag(NBT); isCreative = NBT.getBoolean("creative"); selectedFuse = NBT.getInteger("selfuse"); } /** * Writes a tile entity to NBT. */ @Override protected void writeSyncTag(NBTTagCompound NBT) { super.writeSyncTag(NBT); NBT.setBoolean("creative", isCreative); NBT.setInteger("selfuse", selectedFuse); } @Override public boolean hasModelTransparency() { return false; } @Override protected void animateWithTick(World world, int x, int y, int z) { } @Override public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } @Override public MachineRegistry getMachine() { return MachineRegistry.TNTCANNON; } @Override public boolean isItemValidForSlot(int slot, ItemStack is) { return is.itemID == Block.tnt.blockID; } @Override public int getRedstoneOverride() { if (!this.canFire()) return 15; return 0; } }
57ecb57819b02b5d189d2b2811ea75a9c4c43817
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project26/src/test/java/org/gradle/test/performance26_3/Test26_272.java
22a77f51a8e658fed8851b61a0124f1d71191178
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance26_3; import static org.junit.Assert.*; public class Test26_272 { private final Production26_272 production = new Production26_272("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
f2739378cfd55f78c02e3ecd5fe414c90dceaa69
80821cd4d15320cf74eb3c0ece2b7e695816fe8d
/leetcode-learn/src/main/java/destiny/leetcode/array/MoveZeroes.java
5952dd4a2762bb73c45d4380218982a31a40c99b
[]
no_license
wwm0104/leetcode-project
692dc29b99296cf871d725449f5a474b9a4b0113
aa0895ab7c3ebee2860d18e63315aadf814a5dba
refs/heads/master
2020-06-02T07:20:59.978224
2020-03-03T14:56:47
2020-03-03T14:56:47
191,081,721
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
package destiny.leetcode.array; /** * @Author: weiwanmin * @Date: 2019/9/26 10:18 * @Version 1.0 * 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 * * 示例: * * 输入: [0,1,0,3,12] * 输出: [1,3,12,0,0] * 说明: * */ public class MoveZeroes { /** * 思路 * 移动0到数组末尾,那么就可以换个描述,把不等于0的元素前移,空余的全部为0 * @param nums */ public void moveZeroesMethodOne(int[] nums){ int countNumber =0; for(int i=0;i<nums.length;i++){ if(nums[i] !=0){ nums[countNumber] = nums[i]; countNumber++; } } for(int i=countNumber;i<nums.length;i++){ nums[countNumber] =0; } } }
[ "" ]
a9b0e360f391910b0921a80281b10f591436521f
8ce0671d68f1427c8dfcd125c7fbd82d9dd3e028
/domain-web/jbb-system-web/src/main/java/org/jbb/system/web/logging/logic/FilterUtils.java
4e1cd91509e465883b2029aec7278257244f43ea
[ "Apache-2.0" ]
permissive
viviand2020/jbb
740cecc3ccc9a4a9b99510a4546caf4689e23630
fcfccadf55e5de9e65a13e6f4ef3f5b20453fbb7
refs/heads/master
2020-03-07T06:07:26.247758
2017-10-11T05:03:17
2017-10-11T05:03:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,537
java
/* * Copyright (C) 2017 the original author or authors. * * This file is part of jBB Application Project. * * Licensed under the Apache License, Version 2.0 (the "License"); * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 */ package org.jbb.system.web.logging.logic; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import java.util.List; import lombok.experimental.UtilityClass; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.jbb.system.api.logging.model.LogFilter; import org.jbb.system.api.logging.model.LogLevel; import org.jbb.system.api.logging.model.LogLevelFilter; import org.jbb.system.api.logging.model.LogThresholdFilter; @UtilityClass public final class FilterUtils { private static final List<String> ALL_FILTERS_LIST = Lists.newArrayList("None", "Level: all", "Level: trace", "Level: debug", "Level: info", "Level: warn", "Level: error", "Level: off", "Threshold: all", "Threshold: trace", "Threshold: debug", "Threshold: info", "Threshold: warn", "Threshold: error", "Threshold: off" ); public static String getFilterText(LogFilter filter) { if (filter == null) { return "None"; } else if (filter instanceof LogLevelFilter) { return "Level: " + ((LogLevelFilter) filter).getLogLevel().toString().toLowerCase(); } else if (filter instanceof LogThresholdFilter) { return "Threshold: " + ((LogThresholdFilter) filter).getLogLevel().toString().toLowerCase(); } else { return filter.toString(); } } public static LogFilter getFilterFromString(String logFilterString) { if (logFilterString == null) { return null; } if (StringUtils.isEmpty(logFilterString) || "None".equalsIgnoreCase(logFilterString)) { return null; } if (logFilterString.startsWith("Level: ")) { return new LogLevelFilter(EnumUtils.getEnum(LogLevel.class, logFilterString.substring(7).toUpperCase())); } else if (logFilterString.startsWith("Threshold: ")) { return new LogThresholdFilter(EnumUtils.getEnum(LogLevel.class, logFilterString.substring(11).toUpperCase())); } return null; } public static List<String> getAllFiltersList() { return ImmutableList.copyOf(ALL_FILTERS_LIST); } }
f3ef9727c6b754580e8bc00d329660aeaea0cfbe
59123b081c1b06521267a785bbc9a1b559c6a387
/src/web/CourseworkController.java
e1ff8a8746c09f7010fe072e96e1bd9873cdad37
[]
no_license
Boongati/schedulerapp
57527fce7cb66212c0fce8196d84be4f063f57c1
ef4ca7de7a6b50692e8ad3adf2e6066cba296970
refs/heads/master
2020-09-22T20:17:18.543262
2019-11-23T17:52:14
2019-11-23T17:52:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,207
java
package web; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.text.ParseException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import DAO.CourseworkProjectDAO; import DAOImpl.CourseworkProjectDAOImpl; import Model.CourseworkProject; import utilities.JDBCUtils; @WebServlet(name = "CourseworkController") public class CourseworkController extends HttpServlet { private static final long serialVersionUID = 1L; private CourseworkProjectDAO courseworkDAO; public void init() { courseworkDAO = new CourseworkProjectDAOImpl(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // doGet(request, response); String typeOfSubmission = request.getParameter("submit"); try { switch (typeOfSubmission) { case "Save Coursework": storeCoursework(request, response); break; case "Update Coursework": updateCoursework(request, response); break; case "/list": default: RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/login.jsp"); dispatcher.forward(request, response); break; } } catch (SQLException | ParseException ex) { throw new ServletException(ex); } } private void storeCoursework(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException, ParseException, ServletException { String courseworkTitle = request.getParameter("coursework-title"); String moduleTitle = request.getParameter("module-title"); int userID = 1; Calendar intendedDueDate = JDBCUtils.getDateCalendar(request.getParameter("intended-due-date")); Calendar actualCompletionDate = JDBCUtils.getDateCalendar(request.getParameter("actual-completion-date")); boolean isDone = false; CourseworkProject newCoursework = new CourseworkProject(courseworkTitle, moduleTitle, intendedDueDate, actualCompletionDate, userID, isDone); courseworkDAO.storeCoursework(newCoursework); List<CourseworkProject> listCoursework = courseworkDAO.selectAllCourseworks(); // System.out.println(listCoursework); request.setAttribute("listCoursework", listCoursework); request.setAttribute("sizeOfCoursework", listCoursework.size()); this.getServletContext().getRequestDispatcher("/WEB-INF/dashboard.jsp").forward(request, response); } private void updateCoursework(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException, ParseException, ServletException { int id = Integer.parseInt(request.getParameter("id")); String courseworkTitle = request.getParameter("coursework-title"); String moduleTitle = request.getParameter("module-title"); int userID = 1; Calendar intendedDueDate = JDBCUtils.getDateCalendar(request.getParameter("intended-due-date")); Calendar actualCompletionDate = JDBCUtils.getDateCalendar(request.getParameter("actual-completion-date")); boolean isDone = false; CourseworkProject updateCoursework = new CourseworkProject(courseworkTitle, moduleTitle, intendedDueDate, actualCompletionDate, userID, isDone); courseworkDAO.updateCoursework(updateCoursework); List<CourseworkProject> listCoursework = courseworkDAO.selectAllCourseworks(); request.setAttribute("listCoursework", listCoursework); request.setAttribute("sizeOfCoursework", listCoursework.size()); this.getServletContext().getRequestDispatcher("/WEB-INF/dashboard.jsp").forward(request, response); } }
caeae9faa9fc53cc44b8a351aad0d4dd68a13465
5c741f2a5eab44febdd9deb46b9269749202d89b
/src/com/yaliun/adapter/Adapter.java
6fa484c60d7adda0b7b18d797687749b8e62c2c0
[]
no_license
yaliun/DesignPatterns
00bd10482635106e7f8fbaf8a945e10d2a7db1b3
458bad5898c5163e247ad8a7d721d3f42427c04d
refs/heads/master
2020-03-08T21:41:19.344061
2018-04-06T15:42:25
2018-04-06T15:42:25
128,411,970
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package com.yaliun.adapter; public interface Adapter { public Float twiceOf(Float f); public Float haltOf(Float f); }
[ "yaliun@win10" ]
yaliun@win10
8bcf874e47c583825ab282ce175f7f1618b85b57
b8bd7cf43628b1e9b4e8c68863722fb0e2c87cdb
/src/main/java/com/zmj/jhipster/web/rest/UserJWTController.java
a99038fa01a81d9fa7ed74535268f040996bab5a
[]
no_license
jirito/BugTrackerJHipster
aedecb7e36ad0cda95a1e7ce212b92c1f47a14aa
5e93b42a2714b086478bbafb04a89cff33c3e749
refs/heads/master
2023-05-12T22:07:53.496346
2020-03-20T07:53:07
2020-03-20T07:53:07
248,697,648
0
0
null
2023-05-09T02:13:33
2020-03-20T07:51:57
Java
UTF-8
Java
false
false
2,554
java
package com.zmj.jhipster.web.rest; import com.zmj.jhipster.security.jwt.JWTFilter; import com.zmj.jhipster.security.jwt.TokenProvider; import com.zmj.jhipster.web.rest.vm.LoginVM; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; /** * Controller to authenticate users. */ @RestController @RequestMapping("/api") public class UserJWTController { private final TokenProvider tokenProvider; private final AuthenticationManagerBuilder authenticationManagerBuilder; public UserJWTController(TokenProvider tokenProvider, AuthenticationManagerBuilder authenticationManagerBuilder) { this.tokenProvider = tokenProvider; this.authenticationManagerBuilder = authenticationManagerBuilder; } @PostMapping("/authenticate") public ResponseEntity<JWTToken> authorize(@Valid @RequestBody LoginVM loginVM) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword()); Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); SecurityContextHolder.getContext().setAuthentication(authentication); boolean rememberMe = (loginVM.isRememberMe() == null) ? false : loginVM.isRememberMe(); String jwt = tokenProvider.createToken(authentication, rememberMe); HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK); } /** * Object to return as body in JWT Authentication. */ static class JWTToken { private String idToken; JWTToken(String idToken) { this.idToken = idToken; } @JsonProperty("id_token") String getIdToken() { return idToken; } void setIdToken(String idToken) { this.idToken = idToken; } } }
62132f7b189f00ed0d6141f2b6e119fc6b146976
e7fa6d9dd22fe6f1589d90883ce7520b168b68a0
/src/test/java/com/eivanov/centralserver/thesis/repository/UserRepositoryIT.java
188be4dd9f3dd72875d58c534f12ce048b8024f6
[ "Apache-2.0" ]
permissive
e-ivanov/central_server
b530534aa29cf62786edeb5c8a738506a56926a2
70802d04224953a919bafd48362d7b5742fb5588
refs/heads/master
2021-01-20T10:19:14.376903
2017-09-05T12:13:51
2017-09-05T12:13:51
101,627,470
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.eivanov.centralserver.thesis.repository; import org.junit.Test; import static org.junit.Assert.*; /** * * @author killer */ public class UserRepositoryIT { public UserRepositoryIT() { } @Test public void testSomeMethod() { } }
6ca372c34a42426d5ac29bd6fa87607d21fc7d25
3a38508eb940e18cb05e4850136b56a4fde0e38f
/src/main/java/cn/com/thtf/cms/report/dto/ResultDto.java
a748cdee73b11524fa5f11865e6107a7813998cf
[]
no_license
fairyhawk/thtf_05_report-Deprecated
55322258fe211950b64130391e71780350616210
bda520a2c1eae69b6903f0a3772561989ba1f437
refs/heads/master
2016-09-09T22:38:56.838567
2014-01-25T10:30:38
2014-01-25T10:30:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package cn.com.thtf.cms.report.dto; import java.util.List; import cn.com.thtf.cms.report.entity.UserEntity; import lombok.Getter; import lombok.Setter; public class ResultDto extends BaseDto { private static final long serialVersionUID = 1L; @Setter @Getter private List<String> list; @Setter @Getter private List<UserEntity> users; }
2af334611b2b4aaac6ccc3d44c05854377ebaef7
e0305f374096aab90fffa5795598506944862e0d
/issuer/src/main/java/com/ws/sep/issuer/repositories/IClientRepository.java
e5200440c819e6ae7dfa5f5a19b0a2f9ff7f90fc
[]
no_license
jovanjenjic/Electronic-payment-system
cc2fd4ddb7feca040660943be9a0e3b39e079881
48864501d3373fa761fe1fe21fa80821b119e143
refs/heads/main
2023-06-21T14:35:05.561596
2021-02-07T17:16:38
2021-02-07T17:16:38
392,363,681
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package com.ws.sep.issuer.repositories; import java.util.Optional; import com.ws.sep.issuer.models.Client; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface IClientRepository extends JpaRepository< Client, Long > { Optional< Client > findByPan( String pan ); Optional< Client > findByCardHolder( String cardHolder ); }
62142b9f31277661529bd477cd06ef56e61bf488
cd7dd26efd55ff6e2c2d39d97aac65fa42ef792b
/src/main/java/ru/lakidemon/store/unitpay/Result.java
1c1da1625148c6678262a6bec4c14b75290966c2
[]
no_license
lakidemon/gameserver-store
1a6dcf4665f2a58cf5e4a8343194b88b7b68f44d
b306f43c999cb44c46365e4cac8f2c66e831a5f3
refs/heads/master
2022-12-29T21:12:42.392816
2020-10-19T17:45:38
2020-10-19T17:45:38
295,101,419
0
0
null
2020-09-30T09:22:42
2020-09-13T07:33:55
Java
UTF-8
Java
false
false
1,386
java
package ru.lakidemon.store.unitpay; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.RequiredArgsConstructor; import lombok.Value; import ru.lakidemon.store.converter.ResultSerializer; @Value @JsonSerialize(using = ResultSerializer.class) public class Result { private Message message; private boolean error; public static Result error(Message message) { return new Result(message, true); } public static Result result(Message message) { return new Result(message, false); } @RequiredArgsConstructor public enum Message { OK("OK"), CHECK_OK("Всё отлично!"), CONFIRM_OK("Платёж обработан"), PAYMENT_NOTFOUND("Платёж не найден"), INCORRECT_SUM("Некорректная сумма платежа"), INCORRECT_CURRENCY("Некорректная валюта платежа"), REPEAT_HANDLING("Попытка обработки обработанного платежа"), DISPATCH_FAILED("Не удалось произвести выдачу товара"), SIGNATURE_MISMATCH("Подпись не совпала"), UNEXPECTED_METHOD("Неизвестный метод"); @JsonValue private final String text; } }
fd127e5e610e35c957875aee41903c2047774729
4d05866c45079bf85e6c8d036fb39e17b64e348d
/src/gameClient/Temp.java
b12348669cae61071efee3df4022810b0c0d1b85
[]
no_license
LIADN7/Pokemon-GAME
ab5f8fd6a82b6fd4d80a70886ecd66aa26f157bb
fe76cf7859a783191410ae705f5bfae46f4e6136
refs/heads/master
2023-07-04T21:53:58.375121
2021-08-07T16:09:01
2021-08-07T16:09:01
318,003,530
1
3
null
null
null
null
UTF-8
Java
false
false
3,552
java
package gameClient; import java.util.HashMap; import java.util.LinkedList; import Server.Game_Server_Ex2; import api.game_service; import api.node_data; public class Temp implements Runnable{ private static guiFrame frame; private static myGame game; private static HashMap<Integer, LinkedList<node_data>> map; /** * run the game - first ask which scenario to run , run the chosen scenario and finely ask if save the result. * if click on the yes then save the result on the server. */ @Override public void run() { startGame(); } public void startGame() { guiFrame frame1; frame1 = new guiFrame(0, null); //waiting for select level while(frame1.getFlag() && Ex2.ID.equals("")) { try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } frame1.dispose(); SimplePlayer player = new SimplePlayer("./img/music.mp3"); Thread playerThread = new Thread(player); playerThread.start(); int scenario_num = Ex2.scenario; game_service server = Game_Server_Ex2.getServer(scenario_num); init(server); locateAgent(); frame.setTitle("Pokemon game (created by liadn7 and avielc11) scenario_num is " + scenario_num); frame.addId(frame1); server.startGame(); int ind=0; long dt= checkScenario(scenario_num); int j = 0; server.startGame(); while(server.isRunning()) { server.move(); j++; moveAgants(server); try { if(ind%1==0) { frame.repaint(); } Thread.sleep(dt); ind++; } catch(Exception e) { e.printStackTrace(); } } int sum = 0; for(CL_Agent a : game.getAsh()) sum += a.getValue(); String score = ""+"scenario_num = " + scenario_num + " point = " + sum + " moves = " + j; System.out.println(score); frame.addScore(score); System.out.println("end game"); // playerThread.stop(); server.stopGame(); } /** * first step for the game * direct the agent to the nearest pokemon. */ public static void locateAgent() { map = new HashMap<Integer, LinkedList<node_data>>(); for(CL_Agent coach : game.getAsh()) { LinkedList<node_data> q = game.NearestPoke(coach); q.poll(); map.put(coach.getID(), q); } } /** * update the data about the pokemon and the agent. * f the agent does not move then move it towards the next node in the list towards the Pokemon * @param server - type game_service */ public static void moveAgants(game_service server) { game.setAgent(server); game.setPokemons(server); for(CL_Agent coach : game.getAsh()) { int id = coach.getID(); if(!coach.isMoving()) { if(map.get(id).isEmpty()) { LinkedList<node_data> l = game.NearestPoke(coach); while(!l.isEmpty()) map.get(id).add(l.poll()); } if(!map.get(id).isEmpty()) { node_data node = map.get(id).poll(); server.chooseNextEdge(id, node.getKey()); } } } } /** * create the panel with all the locatioon of the graph,the agent and the pokemon. * @param server - type game_srevice */ public void init(game_service server) { game = new myGame(server); frame = new guiFrame(1,server); guiPanel panel = new guiPanel(game, server); frame.add(panel); panel.update(game); } /** * check which scenario is chosen * @param num - the scenario number * @return - the miliseconds the game will wait */ public static long checkScenario(int num) { if(num == 0) { return 127; } if(num == 5 || num == 4) return 90; else return 100; } }
d91a24fc1a579bfd9225023f5f9fd42d57999797
32cf78bc5a93e44bff293af14aa16b350c8bcab0
/journal/src/main/java/io/zeebe/journal/file/record/CorruptedLogException.java
b9064b3c6e2a0da41beb377b72bfd8fdacc69d9c
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
anniyanvr/zeebe
53f86b88ab23ddb57853bef8317421801c75f2f5
bfa68603f76cd9e15a74bccdcc8ea3eaae440326
refs/heads/develop
2022-11-04T23:45:05.524364
2021-04-27T14:12:11
2021-04-27T14:12:11
160,585,274
0
0
null
2022-10-24T06:25:14
2018-12-05T22:13:51
Java
UTF-8
Java
false
false
878
java
/* * Copyright © 2017 camunda services GmbH ([email protected]) * * 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 io.zeebe.journal.file.record; import io.zeebe.util.exception.UnrecoverableException; public final class CorruptedLogException extends UnrecoverableException { public CorruptedLogException(final String message) { super(message); } }
3d7ed127c8ced3a5c8ae318d00e306e65d0150a0
8f3dcdb61b3d5d810b750ca8b7d451df3ec7260d
/app/src/main/java/sun/reflect/Reflection.java
4ed822077b93e72ee61d6b86de70763e88b08da2
[]
no_license
Doublemine/TerminalIDE
7453e47b9e0c5506b048d19e3fd776b1abc9efa7
ae40d0855c93785b3c129143d835652b6a90cbcf
refs/heads/master
2020-04-09T19:17:37.771138
2015-08-25T13:07:47
2015-08-25T13:07:47
41,362,667
5
1
null
null
null
null
UTF-8
Java
false
false
12,606
java
/* * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.reflect; import java.lang.reflect.*; import java.util.Collections; import java.util.HashMap; import java.util.Map; /** * Common utility routines used by both java.lang and * java.lang.reflect */ public class Reflection { /** * Used to filter out fields and methods from certain classes from public * view, where they are sensitive or they may contain VM-internal objects. * These Maps are updated very rarely. Rather than synchronize on * each access, we use copy-on-write */ private static volatile Map<Class, String[]> fieldFilterMap; private static volatile Map<Class, String[]> methodFilterMap; static { Map<Class, String[]> map = new HashMap<Class, String[]>(); map.put(Reflection.class, new String[]{"fieldFilterMap", "methodFilterMap"}); map.put(System.class, new String[]{"security"}); fieldFilterMap = map; methodFilterMap = new HashMap<Class, String[]>(); } /** * Returns the class of the method <code>realFramesToSkip</code> * frames up the stack (zero-based), ignoring frames associated * with java.lang.reflect.Method.invoke() and its implementation. * The first frame is that associated with this method, so * <code>getCallerClass(0)</code> returns the Class object for * sun.reflect.Reflection. Frames associated with * java.lang.reflect.Method.invoke() and its implementation are * completely ignored and do not count toward the number of "real" * frames skipped. */ public static native Class getCallerClass(int realFramesToSkip); /** * Retrieves the access flags written to the class file. For * inner classes these flags may differ from those returned by * Class.getModifiers(), which searches the InnerClasses * attribute to find the source-level access flags. This is used * instead of Class.getModifiers() for run-time access checks due * to compatibility reasons; see 4471811. Only the values of the * low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be * valid. */ private static native int getClassAccessFlags(Class c); /** * A quick "fast-path" check to try to avoid getCallerClass() * calls. */ public static boolean quickCheckMemberAccess(Class memberClass, int modifiers) { return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers); } public static void ensureMemberAccess(Class currentClass, Class memberClass, Object target, int modifiers) throws IllegalAccessException { if (currentClass == null || memberClass == null) { throw new InternalError(); } if (!verifyMemberAccess(currentClass, memberClass, target, modifiers)) { throw new IllegalAccessException("Class " + currentClass.getName() + " can not access a member of class " + memberClass.getName() + " with modifiers \"" + Modifier.toString(modifiers) + "\""); } } public static boolean verifyMemberAccess(Class currentClass, // Declaring class of field // or method Class memberClass, // May be NULL in case of statics Object target, int modifiers) { // Verify that currentClass can access a field, method, or // constructor of memberClass, where that member's access bits are // "modifiers". boolean gotIsSameClassPackage = false; boolean isSameClassPackage = false; if (currentClass == memberClass) { // Always succeeds return true; } if (!Modifier.isPublic(getClassAccessFlags(memberClass))) { isSameClassPackage = isSameClassPackage(currentClass, memberClass); gotIsSameClassPackage = true; if (!isSameClassPackage) { return false; } } // At this point we know that currentClass can access memberClass. if (Modifier.isPublic(modifiers)) { return true; } boolean successSoFar = false; if (Modifier.isProtected(modifiers)) { // See if currentClass is a subclass of memberClass if (isSubclassOf(currentClass, memberClass)) { successSoFar = true; } } if (!successSoFar && !Modifier.isPrivate(modifiers)) { if (!gotIsSameClassPackage) { isSameClassPackage = isSameClassPackage(currentClass, memberClass); gotIsSameClassPackage = true; } if (isSameClassPackage) { successSoFar = true; } } if (!successSoFar) { return false; } if (Modifier.isProtected(modifiers)) { // Additional test for protected members: JLS 6.6.2 Class targetClass = (target == null ? memberClass : target.getClass()); if (targetClass != currentClass) { if (!gotIsSameClassPackage) { isSameClassPackage = isSameClassPackage(currentClass, memberClass); gotIsSameClassPackage = true; } if (!isSameClassPackage) { if (!isSubclassOf(targetClass, currentClass)) { return false; } } } } return true; } private static boolean isSameClassPackage(Class c1, Class c2) { return isSameClassPackage(c1.getClassLoader(), c1.getName(), c2.getClassLoader(), c2.getName()); } /** * Returns true if two classes are in the same package; classloader * and classname information is enough to determine a class's package */ private static boolean isSameClassPackage(ClassLoader loader1, String name1, ClassLoader loader2, String name2) { if (loader1 != loader2) { return false; } else { int lastDot1 = name1.lastIndexOf('.'); int lastDot2 = name2.lastIndexOf('.'); if ((lastDot1 == -1) || (lastDot2 == -1)) { // One of the two doesn't have a package. Only return true // if the other one also doesn't have a package. return (lastDot1 == lastDot2); } else { int idx1 = 0; int idx2 = 0; // Skip over '['s if (name1.charAt(idx1) == '[') { do { idx1++; } while (name1.charAt(idx1) == '['); if (name1.charAt(idx1) != 'L') { // Something is terribly wrong. Shouldn't be here. throw new InternalError("Illegal class name " + name1); } } if (name2.charAt(idx2) == '[') { do { idx2++; } while (name2.charAt(idx2) == '['); if (name2.charAt(idx2) != 'L') { // Something is terribly wrong. Shouldn't be here. throw new InternalError("Illegal class name " + name2); } } // Check that package part is identical int length1 = lastDot1 - idx1; int length2 = lastDot2 - idx2; if (length1 != length2) { return false; } return name1.regionMatches(false, idx1, name2, idx2, length1); } } } static boolean isSubclassOf(Class queryClass, Class ofClass) { while (queryClass != null) { if (queryClass == ofClass) { return true; } queryClass = queryClass.getSuperclass(); } return false; } // fieldNames must contain only interned Strings public static synchronized void registerFieldsToFilter(Class containingClass, String... fieldNames) { fieldFilterMap = registerFilter(fieldFilterMap, containingClass, fieldNames); } // methodNames must contain only interned Strings public static synchronized void registerMethodsToFilter(Class containingClass, String... methodNames) { methodFilterMap = registerFilter(methodFilterMap, containingClass, methodNames); } private static Map<Class, String[]> registerFilter(Map<Class, String[]> map, Class containingClass, String... names) { if (map.get(containingClass) != null) { throw new IllegalArgumentException ("Filter already registered: " + containingClass); } map = new HashMap<Class, String[]>(map); map.put(containingClass, names); return map; } public static Field[] filterFields(Class containingClass, Field[] fields) { if (fieldFilterMap == null) { // Bootstrapping return fields; } return (Field[]) filter(fields, fieldFilterMap.get(containingClass)); } public static Method[] filterMethods(Class containingClass, Method[] methods) { if (methodFilterMap == null) { // Bootstrapping return methods; } return (Method[]) filter(methods, methodFilterMap.get(containingClass)); } private static Member[] filter(Member[] members, String[] filteredNames) { if ((filteredNames == null) || (members.length == 0)) { return members; } int numNewMembers = 0; for (Member member : members) { boolean shouldSkip = false; for (String filteredName : filteredNames) { if (member.getName() == filteredName) { shouldSkip = true; break; } } if (!shouldSkip) { ++numNewMembers; } } Member[] newMembers = (Member[]) Array.newInstance(members[0].getClass(), numNewMembers); int destIdx = 0; for (Member member : members) { boolean shouldSkip = false; for (String filteredName : filteredNames) { if (member.getName() == filteredName) { shouldSkip = true; break; } } if (!shouldSkip) { newMembers[destIdx++] = member; } } return newMembers; } }
018f5c04cf64bfca9a4f7fa86698660db4eb0fde
b44fa043faaf1bdd3bf287454fef1040e67cc23d
/src/app/java/cn/com/peddler/app/util/CnUpperCaser.java
edb300bb29845b3119362e6e307f683c0c6ff00e
[]
no_license
wjy0703/peddler
4bbb200467237c927e9a00f66881d1c8dd664b3f
1cf48b071529f8210704dd243ad8c3b3f0f7bbba
refs/heads/master
2021-09-03T13:11:06.389082
2018-01-09T08:19:58
2018-01-09T08:19:58
114,201,163
0
0
null
null
null
null
UTF-8
Java
false
false
5,647
java
package cn.com.peddler.app.util; import java.util.HashMap; /** * * 将10亿以内的阿拉伯数字转成汉字大写形式 * * * * @author xizhenyin * */ public class CnUpperCaser { // 整数部分 private String integerPart; // 小数部分 private String floatPart; // 将数字转化为汉字的数组,因为各个实例都要使用所以设为静态 private static final char[] cnNumbers = { '零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖' }; // 供分级转化的数组,因为各个实例都要使用所以设为静态 private static final char[] series = { '元', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿' }; private static final char[] part = { '分', '角' }; /** * * 构造函数,通过它将阿拉伯数字形式的字符串传入 * @param original * */ public CnUpperCaser(String original) { // 成员变量初始化 integerPart = ""; floatPart = ""; if (original.contains(".")) { // 如果包含小数点 int dotIndex = original.indexOf("."); integerPart = original.substring(0, dotIndex); floatPart = original.substring(dotIndex + 1); if (floatPart.length() == 1) { floatPart = floatPart + "0"; } } else { // 不包含小数点 integerPart = original; } } /** * * 取得大写形式的各位数字 * * * @return */ public HashMap getCnMap() { HashMap data = new HashMap(); // 因为是累加所以用StringBuffer StringBuffer sb = new StringBuffer(); // 整数部分处理 for (int i = 0; i < integerPart.length(); i++) { int number = getNumber(integerPart.charAt(i)); sb.append(cnNumbers[number]); char aa = series[integerPart.length() - 1 - i]; sb.append(series[integerPart.length() - 1 - i]); data.put(series[integerPart.length() - 1 - i], cnNumbers[number]); } // 小数部分处理 if (floatPart.length() > 0) { // sb.append("点"); for (int i = 0; i < floatPart.length(); i++) { int number = getNumber(floatPart.charAt(i)); sb.append(cnNumbers[number]); sb.append(part[floatPart.length() - 1 - i]); data.put(part[floatPart.length() - 1 - i], cnNumbers[number]); } } // 返回拼接好的字符串 return data; } /** * * 取得大写形式的各位数字 * * * @return */ public HashMap getintMap() { HashMap data = new HashMap(); // 整数部分处理 int number; for (int i = 0; i <integerPart.length() ; i++) { number = getNumber(integerPart.charAt(i)); data.put(integerPart.length()-i, number); } return data; } public HashMap getfloatMap() { // 小数部分处理 HashMap data = new HashMap(); if (floatPart.length() > 0) { // sb.append("点"); int number; for (int i = 0; i < floatPart.length(); i++) { number = getNumber(floatPart.charAt(i)); data.put(i+1, number); } } // 返回 return data; } /** * * 取得大写形式的字符串 * * * @return */ public String getCnString() { // 因为是累加所以用StringBuffer StringBuffer sb = new StringBuffer(); // 整数部分处理 for (int i = 0; i < integerPart.length(); i++) { int number = getNumber(integerPart.charAt(i)); sb.append(cnNumbers[number]); char aa = series[integerPart.length() - 1 - i]; sb.append(series[integerPart.length() - 1 - i]); } // 小数部分处理 if (floatPart.length() > 0) { // sb.append("点"); if (!floatPart.equals("00") && !floatPart.equals("0")) { for (int i = 0; i < floatPart.length(); i++) { int number = getNumber(floatPart.charAt(i)); sb.append(cnNumbers[number]); sb.append(part[floatPart.length() - 1 - i]); } } } // 返回拼接好的字符串 return sb.toString(); } /** * * 将字符形式的数字转化为整形数字 * 因为所有实例都要用到所以用静态修饰 * @param c * @return */ private static int getNumber(char c) { String str = String.valueOf(c); return Integer.parseInt(str); } /** * */ public CnUpperCaser() { super(); // TODO Auto-generated constructor stub } /** * @param args */ public static void main(String[] args) { // HashMap data = new CnUpperCaser("9876543.1").getCnMap(); // System.out.println(data.get('十')); // System.out.println(data.get('万')); // System.out.println(data.get('仟')); // System.out.println(data.get('百')); // System.out.println(data.get('拾')); // System.out.println(data.get('元')); // System.out.println(data.get('角')); // System.out.println(data.get('分')); HashMap data = new CnUpperCaser("9876543.1").getintMap(); HashMap data1 = new CnUpperCaser("9876543.1").getfloatMap(); System.out.println(new CnUpperCaser("1193000.2").getCnString()); // System.out.println(new CnUpperCaser(".123456789").getCnString()); // System.out.println(new CnUpperCaser("0.1234").getCnString()); // System.out.println(new CnUpperCaser("1").getCnString()); // System.out.println(new CnUpperCaser("12").getCnString()); // System.out.println(new CnUpperCaser("123").getCnString()); // System.out.println(new CnUpperCaser("1234").getCnString()); // System.out.println(new CnUpperCaser("12345").getCnString()); // System.out.println(new CnUpperCaser("123456").getCnString()); // System.out.println(new CnUpperCaser("1234567").getCnString()); // System.out.println(new CnUpperCaser("12345678").getCnString()); // System.out.println(new CnUpperCaser("123456789").getCnString()); } }
ccc103654576d57758684e5ff4acc0c0eaa330b6
2757288ac6107bc75e7e5a6a9d2518f50db1aaf5
/omniNG/src/main/java/com/infrasofttech/omning/action/HolidayAddAction.java
0fd6acd68a09eae4c2649e0bc3565c91d8bf67a1
[]
no_license
jswordfish/anotherpapa
30fbac41425090dfd12cc9efe9f913a32063d629
786510b3bd0f2cbf31212053cca47c8012441bd9
refs/heads/master
2020-03-26T17:26:27.159742
2015-03-25T17:14:26
2015-03-25T17:14:26
31,300,717
0
0
null
null
null
null
UTF-8
Java
false
false
2,951
java
/** * */ package com.infrasofttech.omning.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.apache.struts2.ServletActionContext; import org.apache.struts2.interceptor.ServletRequestAware; import com.infrasofttech.domain.entities.HolidayMst; import com.infrasofttech.utils.OmniConstants; import com.infrasofttech.utils.ErrorCodes; import com.infrasofttech.utils.OmniConstants; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; /** * @author mahesh.laddha * */ public class HolidayAddAction extends ActionSupport implements ModelDriven<HolidayMst>, ServletRequestAware { private static final long serialVersionUID = -5539422250920232971L; private static final Logger logger = Logger.getLogger(BranchListAction.class); HttpSession session = null; HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST); private String retVal = OmniConstants.LOGIN; private String tenantId=""; private String branchCode=""; private String loginId=""; private String vTokenReq = ""; private String vTokenSession = ""; private String errMsg = ""; HolidayMst holidayMst = new HolidayMst(); public String execute() throws Exception { try{ if (request.getSession(false) == null) { System.out.println("RoleMenuMapAddSaveAction.execute() SESSION EXPIRED"); //Session expired logger.info("Session Expired"); errMsg = ErrorCodes.SESSIONEXPIRE; session.invalidate(); retVal = OmniConstants.LOGIN; } else { session = request.getSession(false); tenantId = (String) session.getAttribute("tenantId"); branchCode = (String) session.getAttribute("branchCode"); loginId = (String) session.getAttribute("loginId"); vTokenSession = (String) session.getAttribute("vToken"); vTokenReq = (String)request.getParameter("vToken"); if(vTokenReq == null || vTokenSession == null){ errMsg=ErrorCodes.SESSIONEXPIRE; session.invalidate(); retVal = OmniConstants.LOGIN; }else{ if(!vTokenReq.equals(vTokenSession)){ // Both tokens are NOT matching. Logout!!! session.invalidate(); errMsg = ErrorCodes.INVALIDLOGIN; retVal = OmniConstants.LOGIN; }else{ //TODO Service reference here... // <T> obj =(<T>) SpringUtil.getSpringUtil().getService("..."); // TODO Action logic here... } // END OF ELSE :: ACTION LOGIC } // END OF ELSE :: NOT NULL TOKEN } // END OF ELSE :: SESSION NOT EXPIRE }catch(Exception e){ }finally{ } return retVal; } public HolidayMst getModel() { // TODO Auto-generated method stub return null; } public void setServletRequest(HttpServletRequest arg0) { // TODO Auto-generated method stub } }
fde0f19d0bf3328cc008d629b643890b93afd4cc
d65d7d2ed70177dbd804632aed3c9a252e3c8fe3
/src/main/java/id/jagokoding/EventListenerExample2.java
c9e6965b862e8bfc6733503caef8b158065a274b
[]
no_license
jago-koding/spring-event-standart-and-custom
b4159c8ce39e2be4478ad403967947ededd33d4b
8813a91df66f7da93cdde84030dcd48b27ac4bef
refs/heads/master
2022-12-17T23:41:24.630806
2020-09-22T03:27:52
2020-09-22T03:27:52
297,524,817
0
0
null
null
null
null
UTF-8
Java
false
false
2,103
java
package id.jagokoding; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.ContextStartedEvent; import org.springframework.context.event.ContextStoppedEvent; import org.springframework.context.event.EventListener; @Configuration public class EventListenerExample2 { @Bean AListenerBean listenerBean () { return new AListenerBean(); } public static void main (String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( EventListenerExample2.class); context.publishEvent(new MyEvent(1, "test message 1")); context.publishEvent(new MyEvent(5, "test message 5")); } private static class AListenerBean { @EventListener(condition = "#myEvent.code == 5") public void handleContextEvent (MyEvent myEvent) { System.out.println("event received: " + myEvent); } } private static class MyEvent { private String msg; private int code; public MyEvent (int code, String msg) { this.code = code; this.msg = msg; } public int getCode () { return code; } public void setCode (int code) { this.code = code; } public void setMsg (String msg) { this.msg = msg; } public String getMsg () { return msg; } @Override public String toString () { return "MyEvent{" + "msg='" + msg + '\'' + ", code=" + code + '}'; } } }
66a14300a0c6d1b2974a2fee27735a0fc9bc3df4
32206a10d19f5af3f933556bbb22b7d37b21e2b1
/Repository Software/src/it/unina/Attributo.java
09c155d1b772ba0e1b3a2ee787e34080c08fe110
[]
no_license
antov93/RepositorySoftware
b82216d9d178f8e130d50ae9b1856bf735df4592
a76de13f925cfe4364cd306fe207676e7e088b12
refs/heads/master
2022-11-29T15:41:02.571684
2020-08-06T10:00:18
2020-08-06T10:00:18
221,567,043
0
0
null
null
null
null
UTF-8
Java
false
false
5,461
java
package it.unina; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; public class Attributo extends Frame{ private JLabel label1; private JLabel label2; private JLabel label3; private JLabel label4; private JLabel label5; private JLabel label6; private JTextField nome; private JTextField tipo; private JTextField aggiunto; private JTextField modificato; private JTextField eliminato; private JTextField classe; private JScrollPane scrollPaneAttributo; private JTable attributo; public Attributo(){ super(); inizializzaComponentiGrafiche(); setFrameTable(attributo); setNomeTabella("ATTRIBUTO"); visualizzaTabella(); } private void inizializzaComponentiGrafiche(){ label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); label6 = new JLabel(); nome=new JTextField(); tipo=new JTextField(); aggiunto=new JTextField(); modificato=new JTextField(); eliminato=new JTextField(); classe=new JTextField(); scrollPaneAttributo= new JScrollPane(); attributo = new JTable(); label1.setText("Nome: "); label2.setText("Tipo di dato: "); label3.setText("Aggiunto: "); label4.setText("Modificato: "); label5.setText("Eliminato: "); label6.setText("Classe: "); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Attributi"); setLocation(new java.awt.Point(340, 280)); setResizable(true); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); add(label1); add(nome); add(label2); add(tipo); add(label3); add(aggiunto); add(label4); add(modificato); add(label5); add(eliminato); add(label6); add(classe); scrollPaneAttributo.setViewportView(attributo); add(scrollPaneAttributo); scrollPaneAttributo.setEnabled(true); attributo.setEnabled(true); getAccessibleContext().setAccessibleDescription(""); pack(); } private void visualizzaTabella(){ Connection conn; PreparedStatement ps; String query = "SELECT * FROM ATTRIBUTO"; try{ conn=ConnessioneDB.getConnection(); ps=conn.prepareStatement(query,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); rs=ps.executeQuery(); getModelloTabella().setRS(rs); }catch (SQLException e) { System.out.println(e.getMessage()); System.out.println("errore in creaSelectStatemet in visualiz tabella"); } } @Override protected PreparedStatement getComandoInserimento(Connection conn) throws SQLException { String comando; PreparedStatement ps; comando = "INSERT INTO ATTRIBUTO (idAttributo,nome,tipo,aggiunto,modificato,eliminato,classe) " + "VALUES(?,?,?,?,?,?,?)"; ps =conn.prepareStatement(comando); ps.setInt(1, Integer.decode(getIdTabella().getText())); ps.setString(2, nome.getText()); ps.setString(3, tipo.getText()); ps.setString(4, aggiunto.getText()); ps.setString(5, modificato.getText()); ps.setString(6, eliminato.getText()); ps.setString(7, classe.getText()); return ps; } @Override protected PreparedStatement getComandoModifica(Connection conn) throws SQLException { String comando; PreparedStatement ps; int colonna=0; if(nome.getText().length()==0){ if(tipo.getText().length()==0){ if(aggiunto.getText().length()==0){ if(modificato.getText().length()==0){ if(eliminato.getText().length()==0){ if(classe.getText().length()==0){ colonna=0; }else colonna=6; }else colonna=5; }else colonna=4; }else colonna =3; }else colonna=2; }else colonna=1; comando = "UPDATE "+ConnessioneDB.schema +"."+getNomeTabella()+" SET "+getModelloTabella().getColumnName(colonna) +" = ? WHERE "+getModelloTabella().getColumnName(0)+" =?"; System.out.println(comando); System.out.println(colonna); ps =conn.prepareStatement(comando); if(colonna==0) ps.setString(1, getIdTabella().getText()); if(colonna==1) ps.setString(1, nome.getText()); if(colonna==2) ps.setString(1, tipo.getText()); if(colonna==3) ps.setString(1, aggiunto.getText()); if(colonna==4) ps.setString(1, modificato.getText()); if(colonna==5) ps.setString(1, eliminato.getText()); if(colonna==6) ps.setString(1, classe.getText()); ps.setInt(2, Integer.decode(getIdTabella().getText())); return ps; } protected void pulisci() { super.pulisci(); nome.setText(""); tipo.setText(""); aggiunto.setText(""); modificato.setText(""); eliminato.setText(""); classe.setText(""); } }
d5027fa0dcd2c950e4ab9e9a91ea23b8b1ccbe29
c53d468b0b238407e3ff893de19bcf7e3a4d655f
/CoffeeMakerTest/src/edu/towson/cis/cosc442/project4/coffeemaker/InventoryTest.java
59fa03dcff004c75db62294cac4f44f281a35d41
[]
no_license
andrew-knickman/coffee-maker-test-project
1573d150567997e0b81a620abd0025b91022a1a0
f545d83ae69d5ad6a0e04fbcc01d1dcb7c113990
refs/heads/master
2022-02-20T14:50:58.242258
2020-01-16T19:09:50
2020-01-16T19:09:50
234,182,680
0
0
null
2022-02-01T01:00:59
2020-01-15T22:04:59
HTML
UTF-8
Java
false
false
6,673
java
package edu.towson.cis.cosc442.project4.coffeemaker; import org.junit.*; import static org.junit.Assert.*; /** * The class <code>InventoryTest</code> contains tests for the class <code>{@link Inventory}</code>. * * @generatedBy CodePro at 3/14/19 6:58 PM * @author Andrew Knickman * @version $Revision: 1.0 $ */ public class InventoryTest { /** * Run the Inventory() constructor test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testInventory_1() throws Exception { Inventory result = new Inventory(); // add additional test code here assertNotNull(result); assertEquals("Coffee: 15\r\nMilk: 15\r\nSugar: 15\r\nChocolate: 15\r\n", result.toString()); assertEquals(15, result.getCoffee()); assertEquals(15, result.getMilk()); assertEquals(15, result.getSugar()); assertEquals(15, result.getChocolate()); } /** * Run the boolean enoughIngredients(Recipe) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testEnoughIngredients_1() throws Exception { Inventory fixture = new Inventory(); Recipe r = new Recipe(); boolean result = fixture.enoughIngredients(r); // add additional test code here assertEquals(true, result); } /** * Run the boolean enoughIngredients(Recipe) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testEnoughIngredients_2() throws Exception { Inventory fixture = new Inventory(); Recipe r = new Recipe(); boolean result = fixture.enoughIngredients(r); // add additional test code here assertEquals(true, result); } /** * Run the int getChocolate() method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testGetChocolate_1() throws Exception { Inventory fixture = new Inventory(); int result = fixture.getChocolate(); // add additional test code here assertEquals(15, result); } /** * Run the int getCoffee() method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testGetCoffee_1() throws Exception { Inventory fixture = new Inventory(); int result = fixture.getCoffee(); // add additional test code here assertEquals(15, result); } /** * Run the int getMilk() method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testGetMilk_1() throws Exception { Inventory fixture = new Inventory(); int result = fixture.getMilk(); // add additional test code here assertEquals(15, result); } /** * Run the int getSugar() method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testGetSugar_1() throws Exception { Inventory fixture = new Inventory(); int result = fixture.getSugar(); // add additional test code here assertEquals(15, result); } /** * Run the void setChocolate(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetChocolate_1() throws Exception { Inventory fixture = new Inventory(); int chocolate = -1; fixture.setChocolate(chocolate); // add additional test code here } /** * Run the void setChocolate(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetChocolate_2() throws Exception { Inventory fixture = new Inventory(); int chocolate = 1; fixture.setChocolate(chocolate); // add additional test code here } /** * Run the void setCoffee(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetCoffee_1() throws Exception { Inventory fixture = new Inventory(); int coffee = -1; fixture.setCoffee(coffee); // add additional test code here } /** * Run the void setCoffee(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetCoffee_2() throws Exception { Inventory fixture = new Inventory(); int coffee = 1; fixture.setCoffee(coffee); // add additional test code here } /** * Run the void setMilk(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetMilk_1() throws Exception { Inventory fixture = new Inventory(); int milk = -1; fixture.setMilk(milk); // add additional test code here } /** * Run the void setMilk(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetMilk_2() throws Exception { Inventory fixture = new Inventory(); int milk = 1; fixture.setMilk(milk); // add additional test code here } /** * Run the void setSugar(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetSugar_1() throws Exception { Inventory fixture = new Inventory(); int sugar = -1; fixture.setSugar(sugar); // add additional test code here } /** * Run the void setSugar(int) method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testSetSugar_2() throws Exception { Inventory fixture = new Inventory(); int sugar = 1; fixture.setSugar(sugar); // add additional test code here } /** * Run the String toString() method test. * * @throws Exception * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Test public void testToString_1() throws Exception { Inventory fixture = new Inventory(); String result = fixture.toString(); // add additional test code here assertEquals("Coffee: 15\r\nMilk: 15\r\nSugar: 15\r\nChocolate: 15\r\n", result); } /** * Perform pre-test initialization. * * @throws Exception * if the initialization fails for some reason * * @generatedBy CodePro at 3/14/19 6:58 PM */ @Before public void setUp() throws Exception { // add additional set up code here } /** * Perform post-test clean-up. * * @throws Exception * if the clean-up fails for some reason * * @generatedBy CodePro at 3/14/19 6:58 PM */ @After public void tearDown() throws Exception { // Add additional tear down code here } /** * Launch the test. * * @param args the command line arguments * * @generatedBy CodePro at 3/14/19 6:58 PM */ public static void main(String[] args) { new org.junit.runner.JUnitCore().run(InventoryTest.class); } }
52b94f1d6e124fdf9197de726ccb7bb60a700855
72c456c65f1e9cf5ce15beb269bdc639033d0c82
/app/src/main/java/com/hfad/musicwizard/SearchPresenter.java
318228f73a29a3c762e75157827dca3f34db5d1f
[]
no_license
JennaN23/MusicWizard-new-master
1c8ec194748be6db1c7062c3bd7821f3f038886d
a176e71c04ba7414e901f1b91074c4c15dc685b5
refs/heads/master
2020-05-23T06:09:40.440866
2019-05-20T16:37:29
2019-05-20T16:37:29
186,661,915
0
0
null
null
null
null
UTF-8
Java
false
false
3,989
java
package com.hfad.musicwizard; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.ServiceConnection; import android.os.IBinder; import android.support.annotation.Nullable; import android.util.Log; import android.widget.Toast; import java.util.List; import kaaes.spotify.webapi.android.models.Track; public class SearchPresenter implements Search.ActionListener { private static final String TAG = "SearchPresenter"; private static final int PAGE_SIZE = 20; private final Context context; private final Search.View view; private String currentQuery; private SearchPager searchPager; private SearchPager.CompleteListener completeListener; private Player player; private ServiceConnection mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { player = ((PlayerService.PlayerBinder) service).getService(); } @Override public void onServiceDisconnected(ComponentName name) { player = null; } }; public SearchPresenter(Context context, Search.View view) { this.context = context; this.view = view; } @Override public void init(String accessToken) { logMessage("Api Client created"); SpotifyAPI spotifyAPI = new SpotifyAPI(); if (accessToken != null) { spotifyAPI.setToken(accessToken); } else { logError("No valid access token"); } searchPager = new SearchPager(spotifyAPI.getService()); context.bindService(PlayerService.getIntent(context), mServiceConnection, Activity.BIND_AUTO_CREATE); } @Override public void search(@Nullable String searchQuery) { if (searchQuery != null && !searchQuery.isEmpty() && !searchQuery.equals(currentQuery)) { logMessage("query text submit " + searchQuery); currentQuery = searchQuery; view.reset(); completeListener = new SearchPager.CompleteListener() { @Override public void onComplete(List<Track> items) { view.addData(items); } @Override public void onError(Throwable error) { logError(error.getMessage()); } }; searchPager.getFirstPage(searchQuery, PAGE_SIZE, completeListener); } } @Override public void destroy() { context.unbindService(mServiceConnection); } @Override @Nullable public String getCurrentQuery() { return currentQuery; } @Override public void resume() { context.stopService(PlayerService.getIntent(context)); } @Override public void pause() { context.startService(PlayerService.getIntent(context)); } @Override public void loadMoreResults() { Log.d(TAG, "Load more..."); searchPager.getNextPage(completeListener); } @Override public void selectTrack(Track item) { String previewUrl = item.preview_url; if (previewUrl == null) { logMessage("Track doesn't have a preview"); return; } if (player == null) return; String currentTrackUrl = player.getCurrentTrackURL(); if (currentTrackUrl == null || !currentTrackUrl.equals(previewUrl)) { player.play(previewUrl); } else if (player.isPlaying()) { player.pause(); } else { player.resume(); } } private void logError(String msg) { Toast.makeText(context, "Error: " + msg, Toast.LENGTH_SHORT).show(); Log.e(TAG, msg); } private void logMessage(String msg) { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); Log.d(TAG, msg); } //TODO: review }
257f43ec9d5d2d7720b587af254df54b30eea0aa
1b964c67e35e62d264336108d749844d628befcb
/CluedoApp/core/src/com/cluedo/game/Card.java
966e7d38bd7ac5508eb18ce6fe7c74cbf34c3759
[]
no_license
AronWedam/Cluedo
f30cfc860c05f5e1b7189dba8c25ba9e19949b3d
3c434614c771e9c70ebc38026c446d238c94d6fa
refs/heads/master
2023-06-04T15:44:46.240384
2021-06-24T14:18:04
2021-06-24T14:18:04
361,742,912
0
0
null
2021-06-24T14:18:05
2021-04-26T12:31:51
Java
UTF-8
Java
false
false
3,309
java
package com.cluedo.game; import java.util.ArrayList; public class Card { private int type; private int value; public static final int TYPE_SUSPECT = 0; public static final int TYPE_WEAPON = 1; public static final int TYPE_ROOM = 2; public static ArrayList<Card> roomsArrayList = new ArrayList<>(); public static ArrayList<Card> weaponsArrayList = new ArrayList<>(); public static ArrayList<Card> suspectsArrayList = new ArrayList<>(); private static final Card suspect0 = new Card(0, 0); private static final Card suspect1 = new Card(0, 1); private static final Card suspect2 = new Card(0, 2); private static final Card suspect3 = new Card(0,3); private static final Card suspect4 = new Card(0, 4); private static final Card suspect5 = new Card(0,5); private static final Card weapon0 = new Card(1,0); private static final Card weapon1 = new Card(1, 1); private static final Card weapon2 = new Card(1,2); private static final Card weapon3 = new Card(1,3); private static final Card weapon4 = new Card(1,4); private static final Card weapon5 = new Card(1,5); private static final Card room0 = new Card(2,0); private static final Card room1 = new Card(2, 1); private static final Card room2 = new Card(2,2); private static final Card room3 = new Card(2, 3); private static final Card room4 = new Card(2,4); private static final Card room5 = new Card(2, 5); private static final Card room6 = new Card(2,6); private static final Card room7 = new Card(2, 7); private static final Card room8 = new Card(2, 8); public Card(int type, int value) { this.type = type; this.value = value; } public static void setSuspectsArrayList() { suspectsArrayList.add(suspect0); suspectsArrayList.add(suspect1); suspectsArrayList.add(suspect2); suspectsArrayList.add(suspect3); suspectsArrayList.add(suspect4); suspectsArrayList.add(suspect5); } public static void setWeaponsArrayList(){ weaponsArrayList.add(weapon0); weaponsArrayList.add(weapon1); weaponsArrayList.add(weapon2); weaponsArrayList.add(weapon3); weaponsArrayList.add(weapon4); weaponsArrayList.add(weapon5); } public static void setRoomsArrayList() { roomsArrayList.add(room0); roomsArrayList.add(room1); roomsArrayList.add(room2); roomsArrayList.add(room3); roomsArrayList.add(room4); roomsArrayList.add(room5); roomsArrayList.add(room6); roomsArrayList.add(room7); roomsArrayList.add(room8); } public static ArrayList<Card> getSuspectsArrayList() { return suspectsArrayList; } public static ArrayList<Card> getWeaponsArrayList() { return weaponsArrayList; } public static ArrayList<Card> getRoomsArrayList() { return roomsArrayList; } public int getValue() { return value; } public int getType(){return type;} public boolean equals(Object obj) { if (obj instanceof Card) { Card c = (Card) obj; return (c.type == this.type && c.value == this.value); } else { return false; } } }
4489b7dd17bd2b49964d6270a9d987ed57f1f0e8
54687b59c362db22083a731c09d5d4ad24c2a56f
/src/main/java/com/github/sd4324530/fastweixin/api/QrcodeAPI.java
35e652833f51a08017890f0d1801b0a558a0c465
[ "Apache-2.0" ]
permissive
Morcal/fastweixin
1b8d2cd90641656a91d0b4635054d10e45892246
3b35dac89a21140d6b940499e220d57d5b362ad2
refs/heads/master
2021-01-12T22:17:09.100274
2015-01-28T08:50:25
2015-01-28T08:50:25
29,969,503
1
0
null
2015-01-28T13:51:22
2015-01-28T13:51:21
Java
UTF-8
Java
false
false
2,357
java
package com.github.sd4324530.fastweixin.api; import com.github.sd4324530.fastweixin.api.config.ApiConfig; import com.github.sd4324530.fastweixin.api.enums.QrcodeType; import com.github.sd4324530.fastweixin.api.response.BaseResponse; import com.github.sd4324530.fastweixin.api.response.QrcodeResponse; import com.github.sd4324530.fastweixin.util.BeanUtil; import com.github.sd4324530.fastweixin.util.JSONUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; /** * 二维码相关API * * @author peiyu * @since 1.2 */ public class QrcodeAPI extends BaseAPI { private static final Logger LOG = LoggerFactory.getLogger(QrcodeAPI.class); public QrcodeAPI(ApiConfig config) { super(config); } /** * 创建二维码 * * @param actionName 二维码类型,QR_SCENE为临时,QR_LIMIT_SCENE为永久 * @param sceneId 场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000) * @param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过1800 * @return 二维码对象 */ public QrcodeResponse createQrcode(QrcodeType actionName, String sceneId, Integer expireSeconds) { BeanUtil.requireNonNull(actionName, "actionName is null"); BeanUtil.requireNonNull(sceneId, "actionInfo is null"); LOG.debug("创建二维码信息....."); QrcodeResponse response = null; String url = BASE_API_URL + "cgi-bin/qrcode/create?access_token=#"; Map<String, Object> param = new HashMap<String, Object>(); param.put("action_name", actionName); Map<String, Object> actionInfo = new HashMap<String, Object>(); Map<String, Object> scene = new HashMap<String, Object>(); scene.put("scene_id", sceneId); actionInfo.put("scene", scene); param.put("action_info", actionInfo); if (BeanUtil.nonNull(expireSeconds) && 0 != expireSeconds) { param.put("expire_seconds", expireSeconds); } BaseResponse r = executePost(url, JSONUtil.toJson(param)); if (null == r.getErrcode() || "".equals(r.getErrcode())) { response = JSONUtil.toBean(r.getErrmsg(), QrcodeResponse.class); } return response; } }
ffe255d9829811aba0c8de97167c7a6f8dd9b216
90036c84dbbecb9963e50a3a6c5029b79fc637c9
/java/spring-boot-rest-service/src/test/java/antroy/restservice/GoodbyeControllerTest.java
d0718b64cfb32f1d8d9ca9982de20281bb1ddfcd
[]
no_license
antroy/walking_skeletons
9f0c6f808d151279ebc64c69b4f0d32138466909
46e7b62e89e43ecdcf412757139ce5902d3c26eb
refs/heads/master
2021-01-10T13:49:48.550399
2016-03-12T21:56:53
2016-03-12T21:56:53
51,246,340
0
0
null
null
null
null
UTF-8
Java
false
false
1,528
java
package antroy.restservice; import static org.hamcrest.Matchers.equalTo; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.http.MediaType; import org.springframework.mock.web.MockServletContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static org.junit.Assert.*; /** * Created by ant on 03/03/16. */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MockServletContext.class) @WebAppConfiguration public class GoodbyeControllerTest { private MockMvc mvc; @Before public void setUp() throws Exception { mvc = MockMvcBuilders.standaloneSetup(new GoodbyeController()).build(); } @Test public void testIndex() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/bye").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string(equalTo("Farewell from Spring Boot!"))); } }
0bfbcfb63efab700b26495056d0ae914ef46a9c9
53189efbfed5423821a84f631da404d07a80e404
/storage/app/Al-QuranIndonesia_com.andi.alquran.id_source_from_JADX/com/andi/alquran/BuildConfig.java
98c1c9168f0f45a6eb2f8366fb6bb94ebdbb1d76
[ "MIT" ]
permissive
dwijpr/islam
0c9b77028d34862b6d06858c5b0d6ffec91b5014
6077291a619ac2f5b30a77e284c0a7361e7c8ad4
refs/heads/master
2021-01-19T17:16:49.818251
2017-03-13T23:00:08
2017-03-13T23:00:08
82,430,213
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.andi.alquran; public final class BuildConfig { public static final String APPLICATION_ID = "com.andi.alquran.id"; public static final String BUILD_TYPE = "release"; public static final boolean DEBUG = false; public static final String FLAVOR = "indonesia"; public static final int VERSION_CODE = 94; public static final String VERSION_NAME = "2.5.94"; }
dc4265f1a41e9937e21fdb75dd4a7cfb041c20b3
babd8124e12ea7216dc092179935a3efd7e44a22
/src/main/java/com/linkedin/fullapplinkedinakka/actors/Poller.java
dd1894e3f3adbf8ff33419ff23b76607109acf2d
[]
no_license
ftoumHub/fullapp-linkedin-akka
f9ef903124a0e3149db6337c44d46451226211e0
46b08de35cfbdc0f2948e493da16e858ad2f04e0
refs/heads/master
2020-05-01T11:48:21.442390
2019-03-26T17:39:37
2019-03-26T17:39:37
177,452,276
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package com.linkedin.fullapplinkedinakka.actors; import akka.actor.AbstractActorWithTimers; import akka.actor.ActorRef; import akka.actor.Props; import java.time.Duration; public class Poller extends AbstractActorWithTimers { private static final Object TICK_KEY = "TickKey"; private final ActorRef requestorActor; private final String cryptoName; public Poller(ActorRef requestorActor, String cryptoName) { this.requestorActor = requestorActor; this.cryptoName = cryptoName; getTimers().startSingleTimer(TICK_KEY, new FirstTick(), Duration.ofMillis(3000)); } public static Props props(String cryptoName, ActorRef requestorActor) { return Props.create(Poller.class, () -> new Poller(requestorActor, cryptoName)); } @Override public Receive createReceive() { return receiveBuilder().match( FirstTick.class, message -> { getTimers() .startPeriodicTimer(TICK_KEY, new Tick(), Duration.ofSeconds(3)); }).match( Tick.class, message -> requestorActor.tell(new PriceRequestor.GetThisCryptoPrice(cryptoName),getSelf()) ).build(); } private static final class FirstTick { } private static final class Tick { } }
01c5a5e5324ef424867ccdadeb32319afaa39241
5c1591d3acbc9e51bf034e29b646343955c1a2a4
/app/build/generated/source/r/debug/android/support/fragment/R.java
66ae3a6d04c3c43c6b794e2cb433aedb8fe97836
[]
no_license
elizavetakarachinskayaa/techopark
aae65c8e12e87f20d51cf57679d70aa6cdf00150
bb5e806dcfc01b895f2b928204a80413bddae112
refs/heads/master
2020-03-23T15:04:11.854732
2018-07-27T13:37:18
2018-07-27T13:37:18
141,720,046
0
0
null
null
null
null
UTF-8
Java
false
false
10,533
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.fragment; public final class R { public static final class attr { public static final int coordinatorLayoutStyle = 0x7f0300a2; public static final int font = 0x7f0300d6; public static final int fontProviderAuthority = 0x7f0300d8; public static final int fontProviderCerts = 0x7f0300d9; public static final int fontProviderFetchStrategy = 0x7f0300da; public static final int fontProviderFetchTimeout = 0x7f0300db; public static final int fontProviderPackage = 0x7f0300dc; public static final int fontProviderQuery = 0x7f0300dd; public static final int fontStyle = 0x7f0300de; public static final int fontVariationSettings = 0x7f0300df; public static final int fontWeight = 0x7f0300e0; public static final int keylines = 0x7f03010a; public static final int layout_anchor = 0x7f03010f; public static final int layout_anchorGravity = 0x7f030110; public static final int layout_behavior = 0x7f030111; public static final int layout_dodgeInsetEdges = 0x7f03013d; public static final int layout_insetEdge = 0x7f030149; public static final int layout_keyline = 0x7f03014a; public static final int statusBarBackground = 0x7f0301aa; public static final int ttcIndex = 0x7f03020c; } public static final class color { public static final int notification_action_color_filter = 0x7f05006a; public static final int notification_icon_bg_color = 0x7f05006b; public static final int ripple_material_light = 0x7f050076; public static final int secondary_text_default_material_light = 0x7f050078; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f060050; public static final int compat_button_inset_vertical_material = 0x7f060051; public static final int compat_button_padding_horizontal_material = 0x7f060052; public static final int compat_button_padding_vertical_material = 0x7f060053; public static final int compat_control_corner_material = 0x7f060054; public static final int compat_notification_large_icon_max_height = 0x7f060055; public static final int compat_notification_large_icon_max_width = 0x7f060056; public static final int notification_action_icon_size = 0x7f0600c4; public static final int notification_action_text_size = 0x7f0600c5; public static final int notification_big_circle_margin = 0x7f0600c6; public static final int notification_content_margin_start = 0x7f0600c7; public static final int notification_large_icon_height = 0x7f0600c8; public static final int notification_large_icon_width = 0x7f0600c9; public static final int notification_main_column_padding_top = 0x7f0600ca; public static final int notification_media_narrow_margin = 0x7f0600cb; public static final int notification_right_icon_size = 0x7f0600cc; public static final int notification_right_side_padding_top = 0x7f0600cd; public static final int notification_small_icon_background_padding = 0x7f0600ce; public static final int notification_small_icon_size_as_large = 0x7f0600cf; public static final int notification_subtext_size = 0x7f0600d0; public static final int notification_top_pad = 0x7f0600d1; public static final int notification_top_pad_large_text = 0x7f0600d2; } public static final class drawable { public static final int notification_action_background = 0x7f07007c; public static final int notification_bg = 0x7f07007d; public static final int notification_bg_low = 0x7f07007e; public static final int notification_bg_low_normal = 0x7f07007f; public static final int notification_bg_low_pressed = 0x7f070080; public static final int notification_bg_normal = 0x7f070081; public static final int notification_bg_normal_pressed = 0x7f070082; public static final int notification_icon_background = 0x7f070083; public static final int notification_template_icon_bg = 0x7f070084; public static final int notification_template_icon_low_bg = 0x7f070085; public static final int notification_tile_bg = 0x7f070086; public static final int notify_panel_notification_icon_bg = 0x7f070087; } public static final class id { public static final int action_container = 0x7f08000f; public static final int action_divider = 0x7f080011; public static final int action_image = 0x7f080012; public static final int action_text = 0x7f080019; public static final int actions = 0x7f08001a; public static final int async = 0x7f080020; public static final int blocking = 0x7f080025; public static final int bottom = 0x7f080026; public static final int chronometer = 0x7f08002e; public static final int end = 0x7f080044; public static final int forever = 0x7f080054; public static final int icon = 0x7f08005b; public static final int icon_group = 0x7f08005c; public static final int info = 0x7f080060; public static final int italic = 0x7f080062; public static final int left = 0x7f080066; public static final int line1 = 0x7f080067; public static final int line3 = 0x7f080068; public static final int none = 0x7f080080; public static final int normal = 0x7f080081; public static final int notification_background = 0x7f080082; public static final int notification_main_column = 0x7f080083; public static final int notification_main_column_container = 0x7f080084; public static final int right = 0x7f080090; public static final int right_icon = 0x7f080091; public static final int right_side = 0x7f080092; public static final int start = 0x7f0800b9; public static final int tag_transition_group = 0x7f0800bf; public static final int tag_unhandled_key_event_manager = 0x7f0800c0; public static final int tag_unhandled_key_listeners = 0x7f0800c1; public static final int text = 0x7f0800c2; public static final int text2 = 0x7f0800c3; public static final int time = 0x7f0800cd; public static final int title = 0x7f0800ce; public static final int top = 0x7f0800d3; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f09000e; } public static final class layout { public static final int notification_action = 0x7f0b003a; public static final int notification_action_tombstone = 0x7f0b003b; public static final int notification_template_custom_big = 0x7f0b0042; public static final int notification_template_icon_group = 0x7f0b0043; public static final int notification_template_part_chronometer = 0x7f0b0047; public static final int notification_template_part_time = 0x7f0b0048; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0e003d; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0f0112; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0113; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0115; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0118; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f011a; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01c1; public static final int Widget_Compat_NotificationActionText = 0x7f0f01c2; public static final int Widget_Support_CoordinatorLayout = 0x7f0f01e9; } public static final class styleable { public static final int[] CoordinatorLayout = { 0x7f03010a, 0x7f0301aa }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x010100b3, 0x7f03010f, 0x7f030110, 0x7f030111, 0x7f03013d, 0x7f030149, 0x7f03014a }; public static final int CoordinatorLayout_Layout_android_layout_gravity = 0; public static final int CoordinatorLayout_Layout_layout_anchor = 1; public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static final int CoordinatorLayout_Layout_layout_behavior = 3; public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static final int CoordinatorLayout_Layout_layout_insetEdge = 5; public static final int CoordinatorLayout_Layout_layout_keyline = 6; public static final int[] FontFamily = { 0x7f0300d8, 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f0300d6, 0x7f0300de, 0x7f0300df, 0x7f0300e0, 0x7f03020c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; } }
a2ec78f738322df1575282e3bae2158d0b4c93d3
5b7f3dba125afb07be0de4985f20532611a2c882
/src/main/java/com/tts/TechTalentTwitter/model/Role.java
12d1da0df7040cb3382106702f3545bb344e346c
[]
no_license
lauraaleman3/SpringBootMockTwitter
77cd93cffaa8ad04cf42e8b956024f9a0043dff1
5f5839ea66a3126a10ca0dc4ec6e962a674adb34
refs/heads/main
2023-05-10T23:40:09.161015
2021-06-03T13:47:30
2021-06-03T13:47:30
372,924,767
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.tts.TechTalentTwitter.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; @Data @Builder @AllArgsConstructor @NoArgsConstructor @Entity public class Role { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "role_id") private Long id; private String role; }
80315e7e8404d3dd55fee90a31b59da0bda1ed2c
4f4ddc396fa1dfc874780895ca9b8ee4f7714222
/src/gdanol/gda/com/gensym/gda/dialogs/blocks/gdiSgFilters.java
b65ee10074cade7a6b72579b2ac4c103acc895b4
[]
no_license
UtsavChokshiCNU/GenSym-Test2
3214145186d032a6b5a7486003cef40787786ba0
a48c806df56297019cfcb22862dd64609fdd8711
refs/heads/master
2021-01-23T23:14:03.559378
2017-09-09T14:20:09
2017-09-09T14:20:09
102,960,203
3
5
null
null
null
null
UTF-8
Java
false
false
1,027
java
package com.gensym.gda.dialogs.blocks; import com.gensym.util.Symbol; import com.gensym.beansruntime.StringVector; import com.gensym.gda.controls.*; public class gdiSgFilters extends gdiQuantization { public gdiSgFilters() {} public gdiSgFilters(java.awt.Frame frame) { super(frame); sampleSize = new RadioBoxEditor(); sampleSize.setLabels(new StringVector()); sampleSize.setMembers(new StringVector(new String[]{"5", "7"})); sampleSize.setRowsAndColumns(1, 2); dpanel.placeAttributeEditor(sampleSize, SAMPLE_SIZE_, dpanel.integerFieldType, 5); eraseHistoryWhenReset = CheckBoxEditor.createYesNoCheckBox(); dpanel.placeAttributeEditor(eraseHistoryWhenReset, ERASE_HISTORY_WHEN_RESET_, dpanel.integerFieldType, 15); } protected RadioBoxEditor sampleSize; protected CheckBoxEditor eraseHistoryWhenReset; protected final static Symbol SAMPLE_SIZE_= Symbol.intern("SAMPLE-SIZE"); protected final static Symbol ERASE_HISTORY_WHEN_RESET_= Symbol.intern("ERASE-HISTORY-WHEN-RESET"); }
d0f4831d4466820fb86e264bb6f5ee419e83b6f9
a673c447fbfcc38ede71e6a3459fbd90784ff959
/order/server/src/main/java/com/csy/order/VO/ResultVO.java
64ca4659294f963c2b8c46dc9c31e8262642212a
[]
no_license
pyy55open/microService
98f1b8b2c7cd138893c23f25774639cc6f846f76
7b03cd9a3e75625286c94a32bdbeea242d71faaa
refs/heads/master
2020-03-31T12:36:54.300892
2018-10-29T03:35:06
2018-10-29T03:35:06
152,223,482
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package com.csy.order.VO; import lombok.Data; /** * Created by 廖师兄 * 2017-12-10 18:02 */ @Data public class ResultVO<T> { private Integer code; private String msg; private T data; }
bd5fe92159dc61543a69bce26c8ccaec2e973737
8e361e42603b16f023e560ec0178de713bceff26
/src/org/xpande/retail/model/I_Z_PreciosProvArchivo.java
8ef2642c5e674ff94fade02171e2c8c48e55bcc4
[]
no_license
gvilauy/XpandeRetail
597344d0f11c14bda7e1c4d6a3537c467b6f9cb5
c0a63958943e7d134f569b6c2d201dfd6b2eeb6c
refs/heads/master
2023-07-06T02:36:18.009495
2023-06-27T14:14:02
2023-06-27T14:14:02
94,263,234
0
0
null
null
null
null
UTF-8
Java
false
false
8,560
java
/****************************************************************************** * Product: ADempiere ERP & CRM Smart Business Solution * * Copyright (C) 2006-2017 ADempiere Foundation, All Rights Reserved. * * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * or (at your option) any later version. * * by the Free Software Foundation. This program is distributed in the hope * * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * or via [email protected] or http://www.adempiere.net/license.html * *****************************************************************************/ package org.xpande.retail.model; import java.math.BigDecimal; import java.sql.Timestamp; import org.compiere.model.*; import org.compiere.util.KeyNamePair; /** Generated Interface for Z_PreciosProvArchivo * @author Adempiere (generated) * @version Release 3.9.0 */ public interface I_Z_PreciosProvArchivo { /** TableName=Z_PreciosProvArchivo */ public static final String Table_Name = "Z_PreciosProvArchivo"; /** AD_Table_ID=1000043 */ public static final int Table_ID = MTable.getTable_ID(Table_Name); KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); /** AccessLevel = 3 - Client - Org */ BigDecimal accessLevel = BigDecimal.valueOf(3); /** Load Meta Data */ /** Column name AD_Client_ID */ public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; /** Get Client. * Client/Tenant for this installation. */ public int getAD_Client_ID(); /** Column name AD_Org_ID */ public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; /** Set Organization. * Organizational entity within client */ public void setAD_Org_ID(int AD_Org_ID); /** Get Organization. * Organizational entity within client */ public int getAD_Org_ID(); /** Column name Created */ public static final String COLUMNNAME_Created = "Created"; /** Get Created. * Date this record was created */ public Timestamp getCreated(); /** Column name CreatedBy */ public static final String COLUMNNAME_CreatedBy = "CreatedBy"; /** Get Created By. * User who created this records */ public int getCreatedBy(); /** Column name Description */ public static final String COLUMNNAME_Description = "Description"; /** Set Description. * Optional short description of the record */ public void setDescription(String Description); /** Get Description. * Optional short description of the record */ public String getDescription(); /** Column name ErrorMsg */ public static final String COLUMNNAME_ErrorMsg = "ErrorMsg"; /** Set Error Msg */ public void setErrorMsg(String ErrorMsg); /** Get Error Msg */ public String getErrorMsg(); /** Column name FileLineText */ public static final String COLUMNNAME_FileLineText = "FileLineText"; /** Set FileLineText */ public void setFileLineText(String FileLineText); /** Get FileLineText */ public String getFileLineText(); /** Column name I_IsImported */ public static final String COLUMNNAME_I_IsImported = "I_IsImported"; /** Set Imported. * Has this import been processed */ public void setI_IsImported(boolean I_IsImported); /** Get Imported. * Has this import been processed */ public boolean isI_IsImported(); /** Column name IsActive */ public static final String COLUMNNAME_IsActive = "IsActive"; /** Set Active. * The record is active in the system */ public void setIsActive(boolean IsActive); /** Get Active. * The record is active in the system */ public boolean isActive(); /** Column name IsConfirmed */ public static final String COLUMNNAME_IsConfirmed = "IsConfirmed"; /** Set Confirmed. * Assignment is confirmed */ public void setIsConfirmed(boolean IsConfirmed); /** Get Confirmed. * Assignment is confirmed */ public boolean isConfirmed(); /** Column name IsNew */ public static final String COLUMNNAME_IsNew = "IsNew"; /** Set IsNew */ public void setIsNew(boolean IsNew); /** Get IsNew */ public boolean isNew(); /** Column name IsOmitted */ public static final String COLUMNNAME_IsOmitted = "IsOmitted"; /** Set IsOmitted. * Omitida si o no */ public void setIsOmitted(boolean IsOmitted); /** Get IsOmitted. * Omitida si o no */ public boolean isOmitted(); /** Column name LineNumber */ public static final String COLUMNNAME_LineNumber = "LineNumber"; /** Set LineNumber */ public void setLineNumber(int LineNumber); /** Get LineNumber */ public int getLineNumber(); /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; /** Set Name. * Alphanumeric identifier of the entity */ public void setName(String Name); /** Get Name. * Alphanumeric identifier of the entity */ public String getName(); /** Column name PriceList */ public static final String COLUMNNAME_PriceList = "PriceList"; /** Set List Price. * List Price */ public void setPriceList(BigDecimal PriceList); /** Get List Price. * List Price */ public BigDecimal getPriceList(); /** Column name PriceSO */ public static final String COLUMNNAME_PriceSO = "PriceSO"; /** Set PriceSO. * PriceSO */ public void setPriceSO(BigDecimal PriceSO); /** Get PriceSO. * PriceSO */ public BigDecimal getPriceSO(); /** Column name Processed */ public static final String COLUMNNAME_Processed = "Processed"; /** Set Processed. * The document has been processed */ public void setProcessed(boolean Processed); /** Get Processed. * The document has been processed */ public boolean isProcessed(); /** Column name UPC */ public static final String COLUMNNAME_UPC = "UPC"; /** Set UPC/EAN. * Bar Code (Universal Product Code or its superset European Article Number) */ public void setUPC(String UPC); /** Get UPC/EAN. * Bar Code (Universal Product Code or its superset European Article Number) */ public String getUPC(); /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; /** Get Updated. * Date this record was updated */ public Timestamp getUpdated(); /** Column name UpdatedBy */ public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; /** Get Updated By. * User who updated this records */ public int getUpdatedBy(); /** Column name Value */ public static final String COLUMNNAME_Value = "Value"; /** Set Search Key. * Search key for the record in the format required - must be unique */ public void setValue(String Value); /** Get Search Key. * Search key for the record in the format required - must be unique */ public String getValue(); /** Column name VendorProductNo */ public static final String COLUMNNAME_VendorProductNo = "VendorProductNo"; /** Set Partner Product Key. * Product Key of the Business Partner */ public void setVendorProductNo(String VendorProductNo); /** Get Partner Product Key. * Product Key of the Business Partner */ public String getVendorProductNo(); /** Column name Z_PreciosProvArchivo_ID */ public static final String COLUMNNAME_Z_PreciosProvArchivo_ID = "Z_PreciosProvArchivo_ID"; /** Set Z_PreciosProvArchivo ID */ public void setZ_PreciosProvArchivo_ID(int Z_PreciosProvArchivo_ID); /** Get Z_PreciosProvArchivo ID */ public int getZ_PreciosProvArchivo_ID(); /** Column name Z_PreciosProvCab_ID */ public static final String COLUMNNAME_Z_PreciosProvCab_ID = "Z_PreciosProvCab_ID"; /** Set Z_PreciosProvCab ID */ public void setZ_PreciosProvCab_ID(int Z_PreciosProvCab_ID); /** Get Z_PreciosProvCab ID */ public int getZ_PreciosProvCab_ID(); public I_Z_PreciosProvCab getZ_PreciosProvCab() throws RuntimeException; }
7ee844d0b73666e53c7b6f14284b073e1650b611
11aa4c2f25fc2006c6580f3f22e8fe866c0dc7a1
/org.emona.model/src-gen/org/emona/model/base/attributes/impl/DisplayNameImpl.java
9e8a5e053df6523f5e60883433536f3b9219a120
[]
no_license
effrafax/emona
1accfb4d27b12f8c3d852dc5c0806f54928019b3
490836bf5e091ff13382deb6a0dbb423f639ff8e
refs/heads/master
2020-05-24T15:44:57.209739
2011-10-09T14:51:39
2011-10-09T14:51:39
1,941,858
0
0
null
null
null
null
UTF-8
Java
false
false
2,887
java
/** * Copyright (c) 2011 Martin Stockhammer <[email protected]> * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.emona.model.base.attributes.impl; import org.eclipse.emf.ecore.EClass; import org.emona.model.base.attributes.AttributesPackage; import org.emona.model.base.attributes.DisplayName; import org.emona.model.base.impl.ValueAttributeImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Display Name</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.emona.model.base.attributes.impl.DisplayNameImpl#getToken <em>Token</em>}</li> * </ul> * </p> * * @generated */ public class DisplayNameImpl extends ValueAttributeImpl implements DisplayName { /** * The default value of the '{@link #getToken() <em>Token</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getToken() * @generated * @ordered */ protected static final String TOKEN_EDEFAULT = "display_name"; /** * The cached value of the '{@link #getToken() <em>Token</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getToken() * @generated * @ordered */ protected String token = TOKEN_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DisplayNameImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AttributesPackage.Literals.DISPLAY_NAME; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getToken() { return token; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AttributesPackage.DISPLAY_NAME__TOKEN: return getToken(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AttributesPackage.DISPLAY_NAME__TOKEN: return TOKEN_EDEFAULT == null ? token != null : !TOKEN_EDEFAULT .equals(token); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (token: "); result.append(token); result.append(')'); return result.toString(); } } //DisplayNameImpl
2065ed88a3ee565f434312a3713d0ab63109a9b9
f3677f5c7c63ea81a1d5e4928c727ca6c9a8ac89
/app/src/main/java/com/electronicjunkies/sensorconnect/sensorconnect/MainActivity.java
174af465cc8f01aa63500714b53eb73540602fd5
[]
no_license
faraz117/SensorConnect
f8b2977df0db4d1cdaeb6fd1696ba6956d1530d6
c674e5abb4f862581c51adc56636b0773d9cf14f
refs/heads/master
2021-01-19T10:14:47.717961
2017-04-18T19:20:36
2017-04-18T19:20:36
87,843,536
0
0
null
null
null
null
UTF-8
Java
false
false
4,976
java
package com.electronicjunkies.sensorconnect.sensorconnect; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.v4.app.FragmentManager; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @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 true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); // Test //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); FragmentManager manager = getSupportFragmentManager(); if (id == R.id.nav_sensors) { SensorFragment sensorFragment = new SensorFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment, sensorFragment).commit(); } else if (id == R.id.nav_controller){ ControllerFragment controllerFragment = new ControllerFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment , controllerFragment).commit(); } else if (id == R.id.nav_medium) { MediumFragment mediumFragment = new MediumFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment , mediumFragment).commit(); } else if (id == R.id.nav_protocol) { // problem here ProtocolFragment protocolFragment = new ProtocolFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment , protocolFragment).commit(); } else if (id == R.id.nav_intelligence) { IntelligenceFragment intelligenceFragment = new IntelligenceFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment , intelligenceFragment).commit(); } else if (id == R.id.nav_share) { // problem ShareFragment shareFragment = new ShareFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment , shareFragment).commit(); } else if (id == R.id.nav_support) { // problem SupportFragment supportFragment = new SupportFragment(); manager.beginTransaction().replace(R.id.relative_layout_for_fragment , supportFragment).commit(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
6580a5874b3c6a590cd2d0430ad3ae0fbd8ae753
7cf95e5c0bfc05fbbbb47735913a72d16fe1d632
/procurement-service/src/main/java/edu/sjsu/cmpe/procurement/api/resources/ProcurementResource.java
d2de223801aeb28c9190e807f28e49982e34d851
[]
no_license
juivartak/Library-Management-System-UI
13cac900dd24b43e111ed91c114719496a17fcb0
71052efabd53faa2b06418ff5a900b5649494970
refs/heads/master
2016-09-05T10:36:40.948732
2013-11-13T23:10:51
2013-11-13T23:10:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,311
java
package edu.sjsu.cmpe.procurement.api.resources; import java.util.ArrayList; import javax.jms.Connection; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import org.fusesource.stomp.jms.StompJmsConnectionFactory; import org.fusesource.stomp.jms.StompJmsDestination; import org.fusesource.stomp.jms.message.StompJmsMessage; //import org.json.JSONObject; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import edu.sjsu.cmpe.procurement.domain.Jobs; public class ProcurementResource extends Jobs{ private static String user, password, host, queue, destination, ISBN; private static int port; //public static ArrayList<String> booksInQueue = new ArrayList <String>(); public static ArrayList<String> booksInQueue = new ArrayList <String>(); // public static ArrayList<String> topics = new ArrayList <String>(); public void doJob() throws JMSException, JSONException { user = "admin"; password = "password"; host = "54.215.210.214"; port = 61613; queue = "/queue/65880.book.orders"; destination = arg(0, queue); StompJmsConnectionFactory factory = new StompJmsConnectionFactory(); factory.setBrokerURI("tcp://" + host + ":" + port); System.out.println("" + host + " " +port); System.out.println("Inside checkForMessage loop"); Connection connection = factory.createConnection(user, password); System.out.println("Connection created"); connection.start(); System.out.println("Connected"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination dest = new StompJmsDestination(destination); MessageConsumer consumer = session.createConsumer(dest); System.out.println("Waiting for messages from " + queue + "..."); long waitUntil=5000; while(true) { Message msg = consumer.receive(waitUntil); if( msg instanceof TextMessage ) { String body = ((TextMessage) msg).getText(); //System.out.println(""+body); String []parts= body.split(":"); //System.out.println("" +parts.length); for(int i=1;i<parts.length;i++) { //libraryName=parts[i]; ISBN = parts[i]; i++; booksInQueue.add(ISBN); } //ISBN =parts[1]; //booksInQueue.add(ISBN); System.out.println("" + ISBN); System.out.println("Received message = " + body); if(booksInQueue.size()!=0) { sendPost(); //getMethod(); } } else if (msg instanceof StompJmsMessage) { StompJmsMessage smsg = ((StompJmsMessage) msg); String body = smsg.getFrame().contentAsString(); String[] parts= body.split(":"); //System.out.println("" +parts.length); //String ISBN = parts[1]; for(int i=1;i<=parts.length;i++) { //parts= body.split(":"); //libraryName=parts[i]; ISBN = parts[i]; i++; booksInQueue.add(ISBN); } //booksInQueue.add(ISBN); System.out.println("Received message = " + body); booksInQueue.add(msg.getStringProperty(body)); { sendPost(); //getMethod(); } } else if (msg ==null) { System.out.println("No new messages. Exiting due to timeout-" +waitUntil/1000+"sec"); getMethod(); break; } else { System.out.println("Unexpected message type: "+msg.getClass()); } } connection.close(); System.out.println("Done"); } private static String arg(int index, String defaultValue) { return defaultValue; } public void sendPost() throws JMSException, JSONException { //System.out.println("Queue size:" +booksInQueue.size()); Client client = Client.create(); WebResource webResource = client.resource("http://54.215.210.214:9000/orders"); // System.out.println("Inside sendPost"); ArrayList <Integer> bookISBN= new ArrayList <Integer>(); for (int i = 0; i < booksInQueue.size(); i++) { bookISBN.add(Integer.parseInt(booksInQueue.get(i))); } String input = "{\"id\":\"65880\",\"order_book_isbns\": ".concat("[" + bookISBN.toString() + "]" + "}"); System.out.println("" +input); ClientResponse response = webResource.type("application/json").post(ClientResponse.class, input); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code ***: " + response.getStatus()); } System.out.println("Output from Server .... \n"); String output = response.getEntity(String.class); System.out.println(output); getMethod(); //getMethod1(); } public void getMethod() throws JMSException, JSONException { Client client = Client.create(); WebResource webResource = client.resource("http://54.215.210.214:9000/orders/65880"); ClientResponse response = webResource.accept("application/json").get(ClientResponse.class); System.out.println("Got following books from Publisher..."); String output= response.getEntity(String.class); System.out.println("" +output); sendToTopic(output); } public void sendToTopic(String tempMsg) throws JMSException, JSONException { user = "admin"; password = "password"; host= "54.215.210.214"; int port = 61613; Topic topic; StompJmsConnectionFactory factory = new StompJmsConnectionFactory(); factory.setBrokerURI("tcp://" + host + ":" + port); //System.out.println("Inside sendToTopic loop. tempMsg is " +tempMsg); Connection connection = factory.createConnection(user, password); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); JSONObject jObj= new JSONObject(tempMsg); //JSONArray jsonArray = new JSONArray(jObj); JSONArray jsonArray = new JSONArray(); jsonArray= jObj.getJSONArray("shipped_books"); //System.out.println(""+jsonArray.getString(0)); for (int i=0;i<jsonArray.length();i++) { String category = jsonArray.getJSONObject(i).getString("category"); //System.out.println("Category is:" +category); topic = session.createTopic("65880.book."+category); //System.out.println(""+topic); String data = ""+jsonArray.getJSONObject(i).getString("isbn")+":"+jsonArray.getJSONObject(i).getString("title")+":"+jsonArray.getJSONObject(i).getString("category")+":"+jsonArray.getJSONObject(i).getString("coverimage"); MessageProducer producer = session.createProducer(topic); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); //TextMessage msg = session.createTextMessage(jObj.toString()); TextMessage msg = session.createTextMessage(data); msg.setLongProperty("id", System.currentTimeMillis()); producer.send(msg); System.out.println("Message is: "+msg); } connection.close(); } }
cc17092a7109ea084c56489c4fe5b553ab906db8
11bc2c26ba2c3e8cfb58e5dd7ab430ec0e16a375
/ACORD_PC_JAXB/src/org/acord/standards/pc_surety/acord1/xml/CommlUmbrellaPolicyUpdateAddRsType.java
357233ed7cb10d893a516e7ecc56852a248ac583
[]
no_license
TimothyDH/neanderthal
b295b3e3401ab403fb89950f354c83f3690fae38
1444b21035e3a846d85ea1bf32638a1e535bca67
refs/heads/master
2021-05-04T10:25:54.675556
2019-09-05T13:49:14
2019-09-05T13:49:14
45,859,747
0
0
null
null
null
null
UTF-8
Java
false
false
7,978
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2010.02.24 at 10:20:12 PM EST // package org.acord.standards.pc_surety.acord1.xml; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Java class for CommlUmbrellaPolicyUpdateAddRs_Type complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="CommlUmbrellaPolicyUpdateAddRs_Type"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;group ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}MSGRSINFO"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CommlUmbrellaPolicyUpdateAddRs_Type", propOrder = { "rqUID", "transactionResponseDt", "transactionEffectiveDt", "curCd", "codeList", "conversionRate", "msgStatus", "spxEditVersionApplied", "acordStandardVersionCd" }) public class CommlUmbrellaPolicyUpdateAddRsType { @XmlElement(name = "RqUID", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String rqUID; @XmlElement(name = "TransactionResponseDt", required = true) protected DateTime transactionResponseDt; @XmlElement(name = "TransactionEffectiveDt") protected DateTime transactionEffectiveDt; @XmlElement(name = "CurCd") protected OpenEnum curCd; @XmlElement(name = "CodeList") protected List<CodeListType> codeList; @XmlElement(name = "ConversionRate") protected List<ConversionRateType> conversionRate; @XmlElement(name = "MsgStatus", required = true) protected MsgStatusType msgStatus; @XmlElement(name = "SPXEditVersionApplied") protected AssignedIdentifier spxEditVersionApplied; @XmlElement(name = "ACORDStandardVersionCd") protected ACORDStandardVersion acordStandardVersionCd; /** * Gets the value of the rqUID property. * * @return * possible object is * {@link String } * */ public String getRqUID() { return rqUID; } /** * Sets the value of the rqUID property. * * @param value * allowed object is * {@link String } * */ public void setRqUID(String value) { this.rqUID = value; } /** * Gets the value of the transactionResponseDt property. * * @return * possible object is * {@link DateTime } * */ public DateTime getTransactionResponseDt() { return transactionResponseDt; } /** * Sets the value of the transactionResponseDt property. * * @param value * allowed object is * {@link DateTime } * */ public void setTransactionResponseDt(DateTime value) { this.transactionResponseDt = value; } /** * Gets the value of the transactionEffectiveDt property. * * @return * possible object is * {@link DateTime } * */ public DateTime getTransactionEffectiveDt() { return transactionEffectiveDt; } /** * Sets the value of the transactionEffectiveDt property. * * @param value * allowed object is * {@link DateTime } * */ public void setTransactionEffectiveDt(DateTime value) { this.transactionEffectiveDt = value; } /** * Gets the value of the curCd property. * * @return * possible object is * {@link OpenEnum } * */ public OpenEnum getCurCd() { return curCd; } /** * Sets the value of the curCd property. * * @param value * allowed object is * {@link OpenEnum } * */ public void setCurCd(OpenEnum value) { this.curCd = value; } /** * Gets the value of the codeList property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the codeList property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCodeList().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link CodeListType } * * */ public List<CodeListType> getCodeList() { if (codeList == null) { codeList = new ArrayList<CodeListType>(); } return this.codeList; } /** * Gets the value of the conversionRate property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the conversionRate property. * * <p> * For example, to add a new item, do as follows: * <pre> * getConversionRate().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ConversionRateType } * * */ public List<ConversionRateType> getConversionRate() { if (conversionRate == null) { conversionRate = new ArrayList<ConversionRateType>(); } return this.conversionRate; } /** * Gets the value of the msgStatus property. * * @return * possible object is * {@link MsgStatusType } * */ public MsgStatusType getMsgStatus() { return msgStatus; } /** * Sets the value of the msgStatus property. * * @param value * allowed object is * {@link MsgStatusType } * */ public void setMsgStatus(MsgStatusType value) { this.msgStatus = value; } /** * Gets the value of the spxEditVersionApplied property. * * @return * possible object is * {@link AssignedIdentifier } * */ public AssignedIdentifier getSPXEditVersionApplied() { return spxEditVersionApplied; } /** * Sets the value of the spxEditVersionApplied property. * * @param value * allowed object is * {@link AssignedIdentifier } * */ public void setSPXEditVersionApplied(AssignedIdentifier value) { this.spxEditVersionApplied = value; } /** * Gets the value of the acordStandardVersionCd property. * * @return * possible object is * {@link ACORDStandardVersion } * */ public ACORDStandardVersion getACORDStandardVersionCd() { return acordStandardVersionCd; } /** * Sets the value of the acordStandardVersionCd property. * * @param value * allowed object is * {@link ACORDStandardVersion } * */ public void setACORDStandardVersionCd(ACORDStandardVersion value) { this.acordStandardVersionCd = value; } }
[ "Bryan.Bringle@3f59fb54-24d0-11df-be41-57e7d1eefd51" ]
Bryan.Bringle@3f59fb54-24d0-11df-be41-57e7d1eefd51
5d87221ed01f08476d831d80c33d6ab85006af31
402d6effb65a4f1873eefdcf992396c224a2670a
/Java/console based/JavaApplication22/src/javaapplication22/JavaApplication22.java
c80b1296191deb9414e2b821ff2b78053a5fa1f1
[]
no_license
msgenesissoftware/portfolio
e86219f8a8798fad54ac3f7c42ffc68e8f448e9a
c730e4e3afa3830a54f10d21db3b8d69a238dafb
refs/heads/master
2023-01-20T17:15:46.900185
2019-08-28T06:51:20
2019-08-28T06:51:20
204,865,433
0
0
null
null
null
null
UTF-8
Java
false
false
554
java
/* * 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 javaapplication22; /** * * @author Shoaib */ public class JavaApplication22 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here char ch; for(int i=0 ; i<255; i++) { ch=(char)(i); System.out.println(ch); } } }
2ca25e9d6a191e958c9f4b464b96d3073d1d761e
32b76ba7781e998f787de5e25114dea111c5886d
/src/test/java/com/hector/entelgy/services/UserServiceTest.java
64a3257ae907085f2bf6cc543c28ae93f22ef301
[]
no_license
HectorWatanabe/Entelgy
7a9f7da15d847ef6432dd5e1a50b95b3bfc9496c
732379b3461363d9cb29374b9861bbf3cec364a8
refs/heads/master
2023-04-20T00:46:16.514471
2021-05-08T02:37:07
2021-05-08T02:37:07
365,364,572
0
0
null
null
null
null
UTF-8
Java
false
false
593
java
package com.hector.entelgy.services; import com.hector.entelgy.models.User; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.List; @SpringBootTest public class UserServiceTest { @Autowired private UserService userService; @Test public void test() { List<String> users = userService.getUsers(); Assertions.assertNotNull(users); System.out.println(">>> Users" + users); } }
98d88642c7bc64a74db408134548fc5e85d734d5
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_3/src/h/e/e/Calc_1_3_7441.java
dc65c2c51febdba993ad3e0ac2df992c06e458ec
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
package h.e.e; public class Calc_1_3_7441 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
af60fe564fe1aea23552476ec8210b21dfc3a80e
25685e5197d750c9c5bdf37b852f49be2346c399
/Jungle/app/src/main/java/com/hfad/jungleproblem/Tiger.java
7fbc33b108625fd5be3cedb0fd23ffa90c6dc4dd
[]
no_license
NathanBanavong/Week1_Exam
b049c0991389029832357cf0344872b74e4d9ab3
74f3d6abe5c8009c9512faacd50347fc4b8da40d
refs/heads/master
2020-04-02T22:58:35.458241
2018-10-26T20:40:21
2018-10-26T20:40:21
154,851,290
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
package com.hfad.jungleproblem; public class Tiger extends Animal { private static int numTiger; //count number of tigers private int tigerSleep = 15; public Tiger() { numTiger++; healthbar= 50; System.out.println("There are " + String.valueOf(numTiger) + " Tigers"); } public Tiger(int sounds, int eat, int sleep, String [] food, int healthbar) { super(sounds, eat, sleep, food, healthbar); numTiger++; this.sounds = sounds; this.eat = eat; this.sleep = eat; //get 10 (+5) extra for sleep this.healthbar = healthbar; } //animal functions public void animalEat() { healthbar += eat; } public void animalSound() { healthbar -= sounds; } public void animalSleep() { healthbar += tigerSleep; } public void SoundOff(boolean PerformSound){ System.out.println("Energy: " + String.valueOf(healthbar)); } }
95460cf65fbe743287ea27ca47a14c0c1772c9f9
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/neo4j/2017/4/LenientObjectInputStream.java
4a7f6bf5e89da42924fec711f843fa6ecaab5ba8
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
2,490
java
/* * Copyright (c) 2002-2017 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.cluster.protocol.atomicbroadcast; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; public class LenientObjectInputStream extends ObjectInputStream { private VersionMapper versionMapper; public LenientObjectInputStream( ByteArrayInputStream fis, VersionMapper versionMapper ) throws IOException { super( fis ); this.versionMapper = versionMapper; } @Override protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass wireClassDescriptor = super.readClassDescriptor(); if ( !versionMapper.hasMappingFor( wireClassDescriptor.getName() ) ) { versionMapper.addMappingFor( wireClassDescriptor.getName(), wireClassDescriptor.getSerialVersionUID() ); } Class localClass; // the class in the local JVM that this descriptor represents. try { localClass = Class.forName( wireClassDescriptor.getName() ); } catch ( ClassNotFoundException e ) { return wireClassDescriptor; } ObjectStreamClass localClassDescriptor = ObjectStreamClass.lookup( localClass ); if ( localClassDescriptor != null ) { final long localSUID = localClassDescriptor.getSerialVersionUID(); final long wireSUID = wireClassDescriptor.getSerialVersionUID(); if ( wireSUID != localSUID ) { wireClassDescriptor = localClassDescriptor; } } return wireClassDescriptor; } }
36e6c217e638f5f296f0661cde6b0691f8d7b139
33b9548859f746ae4ec9662001af2c6266469b20
/com/hotmail/AdrianSRJose/AnniPro/anniGame/NCPS/TeamNPC/versions/v1_13_R1/NPCEntity.java
72875f2e543850d4f40f7da96e7dece8c0fbc7fa
[]
no_license
Score2/Annihilation
8662dabb4d8ca505174d8b9a90688c824f636864
39a270662929734d3182929198d26d33928bb1c1
refs/heads/master
2023-01-04T00:03:01.521923
2020-11-03T01:12:23
2020-11-03T01:12:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,963
java
package com.hotmail.AdrianSRJose.AnniPro.anniGame.NCPS.TeamNPC.versions.v1_13_R1; import java.lang.reflect.Field; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.craftbukkit.v1_13_R1.CraftServer; import org.bukkit.craftbukkit.v1_13_R1.CraftWorld; import org.bukkit.craftbukkit.v1_13_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_13_R1.event.CraftEventFactory; import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.ThrownPotion; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import com.hotmail.AdrianSRJose.AnniPro.anniGame.AnniTeam; import com.hotmail.AdrianSRJose.AnniPro.anniGame.NCPS.EquipmentSlot; import com.hotmail.AdrianSRJose.AnniPro.anniGame.NCPS.NPC; import com.hotmail.AdrianSRJose.AnniPro.anniGame.NCPS.NPCAnimation; import com.hotmail.AdrianSRJose.AnniPro.anniGame.NCPS.NPCDamageEvent; import com.hotmail.AdrianSRJose.AnniPro.anniGame.NCPS.NPCInteractEvent; import net.minecraft.server.v1_13_R1.BlockPosition; import net.minecraft.server.v1_13_R1.DamageSource; import net.minecraft.server.v1_13_R1.Entity; import net.minecraft.server.v1_13_R1.EntityDamageSource; import net.minecraft.server.v1_13_R1.EntityDamageSourceIndirect; import net.minecraft.server.v1_13_R1.EntityHuman; import net.minecraft.server.v1_13_R1.EntityPlayer; import net.minecraft.server.v1_13_R1.EnumItemSlot; import net.minecraft.server.v1_13_R1.Packet; import net.minecraft.server.v1_13_R1.PacketPlayOutAnimation; import net.minecraft.server.v1_13_R1.PacketPlayOutBed; import net.minecraft.server.v1_13_R1.PacketPlayOutEntity.PacketPlayOutEntityLook; import net.minecraft.server.v1_13_R1.PacketPlayOutEntityEquipment; import net.minecraft.server.v1_13_R1.PacketPlayOutEntityHeadRotation; import net.minecraft.server.v1_13_R1.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_13_R1.Pathfinder; import net.minecraft.server.v1_13_R1.PathfinderNormal; import net.minecraft.server.v1_13_R1.PlayerInteractManager; import net.minecraft.server.v1_13_R1.WorldServer; public class NPCEntity extends EntityPlayer implements NPC { private boolean entityCollision = true; private boolean godmode = true; private boolean gravity = true; private boolean lying = false; private AnniTeam team = null; private final Pathfinder pathFinder; private org.bukkit.entity.Entity target; public Location otherLoc; public NPCEntity(World world, Location location, NPCProfile profile, NPCNetworkManager networkManager, final AnniTeam team) { // Super super(((CraftServer) Bukkit.getServer()).getServer(), ((CraftWorld) world).getHandle(), profile.getHandle(), new PlayerInteractManager(((CraftWorld) world).getHandle())); otherLoc = location; // Variables this.team = team; this.playerConnection = new NPCPlayerConnection(networkManager, this); this.fauxSleeping = true; this.bukkitEntity = new CraftPlayer((CraftServer) Bukkit.getServer(), this); PathfinderNormal normal = new PathfinderNormal(); normal.a(true); this.pathFinder = new Pathfinder(normal); WorldServer worldServer = ((CraftWorld) world).getHandle(); setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); worldServer.addEntity(this); worldServer.players.remove(this); } public void teleport(Player p, Location location) { PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport(); setValue(packet, "a", this.getId()); setValue(packet, "b", location.getX()); setValue(packet, "c", location.getY()); setValue(packet, "d", location.getZ()); setValue(packet, "e", getFixRotation(location.getYaw())); setValue(packet, "f", getFixRotation(location.getPitch())); setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); this.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); headRotation(location.getYaw(), location.getPitch(), p); sendPacket(packet, p); } public void sendPacket(Packet<?> packet, Player player) { ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); } public void headRotation(float yaw, float pitch, Player p) { PacketPlayOutEntityLook packet = new PacketPlayOutEntityLook(this.getId(), getFixRotation(yaw), getFixRotation(pitch), true); PacketPlayOutEntityHeadRotation packetHead = new PacketPlayOutEntityHeadRotation(); setValue(packetHead, "a", this.getId()); setValue(packetHead, "b", getFixRotation(yaw)); sendPacket(packet, p); sendPacket(packetHead, p); } public byte getFixRotation(float yawpitch) { return (byte) ((int) (yawpitch * 256.0F / 360.0F)); } public void setValue(Object obj, String name, Object value) { try { Field field = obj.getClass().getDeclaredField(name); field.setAccessible(true); field.set(obj, value); } catch (Exception e) { } } Pathfinder getPathfinder() { return pathFinder; } @Override public CraftPlayer getBukkitEntity() { return (CraftPlayer) bukkitEntity; } @Override public boolean isGravity() { return gravity; } @Override public void setGravity(boolean gravity) { this.gravity = gravity; } @Override public boolean isGodmode() { return godmode; } @Override public void setGodmode(boolean godmode) { this.godmode = godmode; } @Override public boolean isLying() { return lying; } /** * Pathfinding */ @Override public boolean pathfindTo(Location location) { return pathfindTo(location, 0.2); } @Override public boolean pathfindTo(Location location, double speed) { return pathfindTo(location, speed, 30.0); } @Override public boolean pathfindTo(Location location, double speed, double range) { NPCPath path = NPCPath.find(this, location, range, speed); return (path) != null; } /** * Look at functions */ @Override public void setTarget(org.bukkit.entity.Entity target) { this.target = target; lookAt(target.getLocation()); } @Override public org.bukkit.entity.Entity getTarget() { return target; } @Override public void lookAt(Location location) { setYaw(getLocalAngle(new Vector(locX, 0, locZ), location.toVector())); } @Override public void setYaw(float yaw) { this.yaw = yaw; } private final float getLocalAngle(Vector point1, Vector point2) { double dx = point2.getX() - point1.getX(); double dz = point2.getZ() - point1.getZ(); float angle = (float) Math.toDegrees(Math.atan2(dz, dx)) - 90; if (angle < 0) { angle += 360.0F; } return angle; } /** * Packet methods */ @Override public void setLying(double x, double y, double z) { if (!lying) { broadcastLocalPacket(new PacketPlayOutBed(this, new BlockPosition(this))); lying = true; } else if (((Double) x == null && (Double) y == null && (Double) z == null) && lying) { broadcastLocalPacket(new PacketPlayOutAnimation(this, 2)); lying = false; } } @Override public void playAnimation(NPCAnimation animation) { broadcastLocalPacket(new PacketPlayOutAnimation(this, animation.getId())); } @Override public void setEquipment(EquipmentSlot slot, ItemStack item) { broadcastLocalPacket(new PacketPlayOutEntityEquipment(getId(), EnumItemSlot.valueOf(slot.toEnumItemSlotString()), CraftItemStack.asNMSCopy(item))); } private final int RADIUS = Bukkit.getViewDistance() * 16; private final void broadcastLocalPacket(Packet<?> packet) { for (Player p : getBukkitEntity().getWorld().getPlayers()) { if (getBukkitEntity().getLocation().distanceSquared(p.getLocation()) <= RADIUS * RADIUS) { ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet); } } } /** * Internal methods */ // @SuppressWarnings("deprecation") // @Override // public void i() // { // super.i(); // this.getSpecatorTarget(); // // if (target != null && path == null) { // if (target.isDead() || (target instanceof Player && !((Player) // target).isOnline())) { // this.target = null; // } else if // (getBukkitEntity().getLocation().getWorld().equals(target.getWorld()) // && getBukkitEntity().getLocation().distanceSquared(target.getLocation()) <= // 32 * 32) { // lookAt(target.getLocation()); // } // } // if (path != null) { // if (!path.update()) { // this.path = null; // } // } // // IBlockData data = world.getType(new BlockPosition(this)); // Block block = data.getBlock(); // if (block.q(data) == Material.FIRE) { // setOnFire(15); // } // // // Apply velocity etc. // this.motY = onGround ? Math.max(0.0, motY) : motY; // move(EnumMoveType.SELF, motX, motY, motZ); // this.motX *= 0.800000011920929; // this.motY *= 0.800000011920929; // this.motZ *= 0.800000011920929; // if (gravity && !this.onGround) { // this.motY -= 0.1; // Most random value, don't judge. // } // } @Override public boolean a(EntityHuman entity) { NPCInteractEvent event = new NPCInteractEvent(this, getBukkitEntity()); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return false; } return super.a(entity); } @Override public boolean damageEntity(DamageSource source, float damage) { if (godmode || noDamageTicks > 0) { return false; } DamageCause cause = null; org.bukkit.entity.Entity bEntity = null; if (source instanceof EntityDamageSource) { Entity damager = source.getEntity(); cause = DamageCause.ENTITY_ATTACK; if (source instanceof EntityDamageSourceIndirect) { damager = ((EntityDamageSourceIndirect) source).getProximateDamageSource(); if (damager.getBukkitEntity() instanceof ThrownPotion) { cause = DamageCause.MAGIC; } else if (damager.getBukkitEntity() instanceof Projectile) { cause = DamageCause.PROJECTILE; } } bEntity = damager.getBukkitEntity(); } else if (source == DamageSource.FIRE) cause = DamageCause.FIRE; else if (source == DamageSource.STARVE) cause = DamageCause.STARVATION; else if (source == DamageSource.WITHER) cause = DamageCause.WITHER; else if (source == DamageSource.STUCK) cause = DamageCause.SUFFOCATION; else if (source == DamageSource.DROWN) cause = DamageCause.DROWNING; else if (source == DamageSource.BURN) cause = DamageCause.FIRE_TICK; else if (source == CraftEventFactory.MELTING) cause = DamageCause.MELTING; else if (source == CraftEventFactory.POISON) cause = DamageCause.POISON; else if (source == DamageSource.MAGIC) { cause = DamageCause.MAGIC; } else if (source == DamageSource.OUT_OF_WORLD) { cause = DamageCause.VOID; } if (cause != null) { NPCDamageEvent event = new NPCDamageEvent(this, bEntity, cause, damage); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { playAnimation(NPCAnimation.DAMAGE); return super.damageEntity(source, (float) event.getDamage()); } else { return false; } } if (super.damageEntity(source, damage)) { if (bEntity != null) { Entity e = ((CraftEntity) bEntity).getHandle(); double d0 = e.locX - this.locX; double d1; for (d1 = e.locZ - this.locZ; d0 * d0 + d1 * d1 < 0.0001D; d1 = (Math.random() - Math.random()) * 0.01D) { d0 = (Math.random() - Math.random()) * 0.01D; } a(e, damage, d0, d1); } return true; } else { return false; } } @Override public boolean getEntityCollision() { return this.entityCollision; } @Override public void setEntityCollision(boolean entityCollision) { this.entityCollision = entityCollision; } @Override public void f(double x, double y, double z) { if (getBukkitEntity() != null && getEntityCollision()) { super.f(x, y, z); return; } } @Override public AnniTeam getTeam() { return team; } }
363a798e76f3ae12327ea15475082cfdfab12c52
a1027fdfa4270454464650f5fb41bf27f36542fb
/src/com/bridgelabz/junittesting/TemperatureConversion.java
7dbf2863603444cda790d0321fa1a7c88115629e
[]
no_license
averrageCoder/JUnit-Testing
1c14eeac55b0644cad3de5937f898550c3b264ab
f93a3d3db51cf6bcb61f1e8dc7f12e817f420909
refs/heads/master
2023-07-24T10:39:20.949011
2021-08-24T13:28:02
2021-08-24T13:28:02
399,443,699
0
1
null
null
null
null
UTF-8
Java
false
false
988
java
package com.bridgelabz.junittesting; import java.util.Scanner; public class TemperatureConversion { static char covertedUnit = ' '; public static int temperaturConversion(int temperature, char t) { int converted; if (t == 'c' || t == 'C') { converted = (temperature * 9 / 5) + 32; covertedUnit = 'F'; } else if (t == 'f' || t == 'F') { converted = (temperature - 32) * 5 / 9; covertedUnit = 'C'; } else { System.out.println("Enter correct input"); return 0; } return converted; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter temperature with unit (c or f)"); int temperature = scan.nextInt(); char t = scan.next().charAt(0); if (t != 'f' && t != 'F' && t != 'c' && t != 'C') { System.out.println("Enter correct input!!"); } temperature = temperaturConversion(temperature, t); System.out.println("Coverted temperature is " + temperature+"° "+covertedUnit); } }
ab2c50283195a7226d2aa9214b3321836a2c561d
62b6b8769ae28dc8ef585e181c8eac8e67d29906
/src/test/java/com/smartcart/web/rest/AccountResourceTest.java
a32b79408267c7c5255c901467c779e36fbc0993
[]
no_license
istibekesi/smartcart
af8ca62e356bcae3bb849eb0d9889fed97a6baab
8e14258ad65142c755fb8b913d02137fee1572de
refs/heads/master
2021-01-10T19:41:10.595864
2015-08-12T08:07:35
2015-08-12T08:07:35
38,695,311
0
0
null
null
null
null
UTF-8
Java
false
false
11,762
java
package com.smartcart.web.rest; import com.smartcart.Application; import com.smartcart.domain.Authority; import com.smartcart.domain.User; import com.smartcart.repository.AuthorityRepository; import com.smartcart.repository.UserRepository; import com.smartcart.security.AuthoritiesConstants; import com.smartcart.service.MailService; import com.smartcart.service.UserService; import com.smartcart.web.rest.dto.UserDTO; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import javax.inject.Inject; import javax.transaction.Transactional; import java.util.Arrays; import java.util.HashSet; import java.util.Optional; import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the AccountResource REST controller. * * @see UserService */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @IntegrationTest public class AccountResourceTest { @Inject private UserRepository userRepository; @Inject private AuthorityRepository authorityRepository; @Inject private UserService userService; @Mock private UserService mockUserService; @Mock private MailService mockMailService; private MockMvc restUserMockMvc; private MockMvc restMvc; @Before public void setup() { MockitoAnnotations.initMocks(this); doNothing().when(mockMailService).sendActivationEmail(anyObject(), anyString()); AccountResource accountResource = new AccountResource(); ReflectionTestUtils.setField(accountResource, "userRepository", userRepository); ReflectionTestUtils.setField(accountResource, "userService", userService); ReflectionTestUtils.setField(accountResource, "mailService", mockMailService); AccountResource accountUserMockResource = new AccountResource(); ReflectionTestUtils.setField(accountUserMockResource, "userRepository", userRepository); ReflectionTestUtils.setField(accountUserMockResource, "userService", mockUserService); ReflectionTestUtils.setField(accountUserMockResource, "mailService", mockMailService); this.restMvc = MockMvcBuilders.standaloneSetup(accountResource).build(); this.restUserMockMvc = MockMvcBuilders.standaloneSetup(accountUserMockResource).build(); } @Test public void testNonAuthenticatedUser() throws Exception { restUserMockMvc.perform(get("/api/authenticate") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string("")); } @Test public void testAuthenticatedUser() throws Exception { restUserMockMvc.perform(get("/api/authenticate") .with(request -> { request.setRemoteUser("test"); return request; }) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string("test")); } @Test public void testGetExistingAccount() throws Exception { Set<Authority> authorities = new HashSet<>(); Authority authority = new Authority(); authority.setName(AuthoritiesConstants.ADMIN); authorities.add(authority); User user = new User(); user.setLogin("test"); user.setFirstName("john"); user.setLastName("doe"); user.setEmail("[email protected]"); user.setAuthorities(authorities); when(mockUserService.getUserWithAuthorities()).thenReturn(user); restUserMockMvc.perform(get("/api/account") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.login").value("test")) .andExpect(jsonPath("$.firstName").value("john")) .andExpect(jsonPath("$.lastName").value("doe")) .andExpect(jsonPath("$.email").value("[email protected]")) .andExpect(jsonPath("$.roles").value(AuthoritiesConstants.ADMIN)); } @Test public void testGetUnknownAccount() throws Exception { when(mockUserService.getUserWithAuthorities()).thenReturn(null); restUserMockMvc.perform(get("/api/account") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isInternalServerError()); } @Test @Transactional public void testRegisterValid() throws Exception { UserDTO u = new UserDTO( "joe", // login "password", // password "Joe", // firstName "Shmoe", // lastName "[email protected]", // e-mail "en", // langKey Arrays.asList(AuthoritiesConstants.USER) ); restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(u))) .andExpect(status().isCreated()); Optional<User> user = userRepository.findOneByLogin("joe"); assertThat(user.isPresent()).isTrue(); } @Test @Transactional public void testRegisterInvalidLogin() throws Exception { UserDTO u = new UserDTO( "funky-log!n", // login <-- invalid "password", // password "Funky", // firstName "One", // lastName "[email protected]", // e-mail "en", // langKey Arrays.asList(AuthoritiesConstants.USER) ); restUserMockMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(u))) .andExpect(status().isBadRequest()); Optional<User> user = userRepository.findOneByEmail("[email protected]"); assertThat(user.isPresent()).isFalse(); } @Test @Transactional public void testRegisterInvalidEmail() throws Exception { UserDTO u = new UserDTO( "bob", // login "password", // password "Bob", // firstName "Green", // lastName "invalid", // e-mail <-- invalid "en", // langKey Arrays.asList(AuthoritiesConstants.USER) ); restUserMockMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(u))) .andExpect(status().isBadRequest()); Optional<User> user = userRepository.findOneByLogin("bob"); assertThat(user.isPresent()).isFalse(); } @Test @Transactional public void testRegisterDuplicateLogin() throws Exception { // Good UserDTO u = new UserDTO( "alice", // login "password", // password "Alice", // firstName "Something", // lastName "[email protected]", // e-mail "en", // langKey Arrays.asList(AuthoritiesConstants.USER) ); // Duplicate login, different e-mail UserDTO dup = new UserDTO(u.getLogin(), u.getPassword(), u.getLogin(), u.getLastName(), "[email protected]", u.getLangKey(), u.getRoles()); // Good user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(u))) .andExpect(status().isCreated()); // Duplicate login restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(dup))) .andExpect(status().is4xxClientError()); Optional<User> userDup = userRepository.findOneByEmail("[email protected]"); assertThat(userDup.isPresent()).isFalse(); } @Test @Transactional public void testRegisterDuplicateEmail() throws Exception { // Good UserDTO u = new UserDTO( "john", // login "password", // password "John", // firstName "Doe", // lastName "[email protected]", // e-mail "en", // langKey Arrays.asList(AuthoritiesConstants.USER) ); // Duplicate e-mail, different login UserDTO dup = new UserDTO("johnjr", u.getPassword(), u.getLogin(), u.getLastName(), u.getEmail(), u.getLangKey(), u.getRoles()); // Good user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(u))) .andExpect(status().isCreated()); // Duplicate e-mail restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(dup))) .andExpect(status().is4xxClientError()); Optional<User> userDup = userRepository.findOneByLogin("johnjr"); assertThat(userDup.isPresent()).isFalse(); } @Test @Transactional public void testRegisterAdminIsIgnored() throws Exception { UserDTO u = new UserDTO( "badguy", // login "password", // password "Bad", // firstName "Guy", // lastName "[email protected]", // e-mail "en", // langKey Arrays.asList(AuthoritiesConstants.ADMIN) // <-- only admin should be able to do that ); restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(u))) .andExpect(status().isCreated()); Optional<User> userDup = userRepository.findOneByLogin("badguy"); assertThat(userDup.isPresent()).isTrue(); assertThat(userDup.get().getAuthorities()).hasSize(1) .containsExactly(authorityRepository.findOne(AuthoritiesConstants.USER)); } }
892367ba024d9ce3ca505727dcc1fec51fef6783
84abb0ef003747bfe3abf764604e4e9bb1a6f311
/src/main/java/io/thingcare/bootstrap/fe/ui/MainUI.java
0b3b2277899219c0f3a18a6e6036be0287cff9de
[]
no_license
rutkowskij/vaadin-boot-bootstrap
1c426d072061e2e23bc8c460a1d817417c493c38
f7dd4c508573a106bc8917eda7f83057d38dff05
refs/heads/master
2021-01-01T18:52:15.168422
2017-07-31T22:36:55
2017-07-31T22:36:55
98,455,642
3
0
null
null
null
null
UTF-8
Java
false
false
2,401
java
package io.thingcare.bootstrap.fe.ui; import com.vaadin.server.Responsive; import com.vaadin.server.VaadinRequest; import com.vaadin.spring.annotation.SpringUI; import com.vaadin.spring.navigator.SpringNavigator; import com.vaadin.spring.navigator.SpringViewProvider; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.themes.ValoTheme; import io.thingcare.bootstrap.fe.event.MainEventBus; import io.thingcare.bootstrap.fe.sidebar.VaadinSideBar; import io.thingcare.bootstrap.fe.ui.shared.BaseUI; import io.thingcare.bootstrap.fe.view.shared.AccessDeniedView; import io.thingcare.bootstrap.fe.view.shared.ErrorView; import io.thingcare.bootstrap.fe.view.shared.ViewContainer; import org.vaadin.spring.i18n.I18N; import javax.annotation.PostConstruct; @SpringUI(path = "/") public class MainUI extends BaseUI { private final SpringViewProvider springViewProvider; private final SpringNavigator springNavigator; private final VaadinSideBar vaadinSideBar; private final ViewContainer viewContainer; private final MainEventBus mainEventBus = new MainEventBus(); public MainUI(SpringViewProvider springViewProvider, SpringNavigator springNavigator, VaadinSideBar vaadinSideBar, ViewContainer viewContainer, I18N i18n) { super(i18n); this.springViewProvider = springViewProvider; this.springNavigator = springNavigator; this.vaadinSideBar = vaadinSideBar; this.viewContainer = viewContainer; } public static MainEventBus mainEventBus() { return ((MainUI) getCurrent()).mainEventBus; } @PostConstruct public void init() { viewContainer.setSizeFull(); viewContainer.addStyleName("view-content"); springNavigator.setErrorView(ErrorView.class); springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class); } @Override protected void init(VaadinRequest request) { addStyleName(ValoTheme.UI_WITH_MENU); Responsive.makeResponsive(this); final HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setSpacing(false); layout.addComponent(vaadinSideBar); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1.0f); setContent(layout); } @Override protected String titleCode() { return "Boostrap Project"; } }
dea9b435fe130feb084d27c15521f77ba49c8723
f5a608798f5d24fe18799caef3565e3f4a809da9
/src/main/java/com/bear/blogvillage/exception/CastExceptionHandler.java
92e4249bd29adf6eda6980eed3ce21daacc245b5
[]
no_license
xiongmaomao/blogvillage
fc980fd6c85053b590fb2e450f89de831445ce0a
7f4985f02f72489b96dff190c6ad8653302a68d6
refs/heads/master
2020-04-07T02:58:29.992062
2019-02-01T09:24:33
2019-02-01T09:24:33
157,997,506
0
0
null
null
null
null
UTF-8
Java
false
false
854
java
package com.bear.blogvillage.exception; import org.apache.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import java.util.HashMap; import java.util.Map; @ControllerAdvice public class CastExceptionHandler { @ExceptionHandler(UserNotFoundException.class) @ResponseBody @ResponseStatus(org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR) public Map<String,Object> handlerUserNotFoundExcetpion(UserNotFoundException ex){ Map<String,Object> result = new HashMap<String,Object>(); result.put("id", ex.getId()); result.put("message", ex.getMessage()); return result; } }
048e738c96764b6172a12d3975327088c4f30419
4c33b043293b6994d139d2d0be8b086585f4c6bf
/com/exercise/_3_SEARCHING/BST.java
726968aa76d0ef5c539e6c2175c1899416f6f4e8
[]
no_license
JungArthur/JavaAlgorithms
802ae2a797a9dcf26fdc1a5c9f4de72054359bcc
845b8c6d3813c8744fe18bd6d47cebaf11e6d431
refs/heads/main
2023-04-18T02:10:42.469512
2021-04-20T13:59:44
2021-04-20T13:59:44
359,832,493
0
0
null
null
null
null
UTF-8
Java
false
false
19,914
java
package com.exercise._3_SEARCHING; import com.io.STANDARD.*; import com.sample._1_FUNDAMENTALS.Queue; import com.sample._3_SEARCHING.LinearProbingHashST; import com.sample._3_SEARCHING.RedBlackBST; import com.sample._3_SEARCHING.ST; import com.sample._3_SEARCHING.SeparateChainingHashST; /****************************************************************************** * Compilation: javac BST.java * Execution: java BST * Dependencies: StdIn.java StdOut.java Queue.java * Data files: https://algs4.cs.princeton.edu/32bst/tinyST.txt * * A symbol table implemented with a binary search tree. * * % more tinyST.txt * S E A R C H E X A M P L E * * % java BST < tinyST.txt * A 8 * C 4 * E 12 * H 5 * L 11 * M 9 * P 10 * R 3 * S 0 * X 7 * ******************************************************************************/ import java.util.NoSuchElementException; /** * The {@code BST} class represents an ordered symbol table of generic * key-value pairs. * It supports the usual <em>put</em>, <em>get</em>, <em>contains</em>, * <em>delete</em>, <em>size</em>, and <em>is-empty</em> methods. * It also provides ordered methods for finding the <em>minimum</em>, * <em>maximum</em>, <em>floor</em>, <em>select</em>, <em>ceiling</em>. * It also provides a <em>keys</em> method for iterating over all of the keys. * A symbol table implements the <em>associative array</em> abstraction: * when associating a value with a key that is already in the symbol table, * the convention is to replace the old value with the new value. * Unlike {@link java.util.Map}, this class uses the convention that * values cannot be {@code null}—setting the * value associated with a key to {@code null} is equivalent to deleting the key * from the symbol table. * <p> * It requires that * the key type implements the {@code Comparable} interface and calls the * {@code compareTo()} and method to compare two keys. It does not call either * {@code equals()} or {@code hashCode()}. * <p> * This implementation uses an (unbalanced) <em>binary search tree</em>. * The <em>put</em>, <em>contains</em>, <em>remove</em>, <em>minimum</em>, * <em>maximum</em>, <em>ceiling</em>, <em>floor</em>, <em>select</em>, and * <em>rank</em> operations each take &Theta;(<em>n</em>) time in the worst * case, where <em>n</em> is the number of key-value pairs. * The <em>size</em> and <em>is-empty</em> operations take &Theta;(1) time. * The keys method takes &Theta;(<em>n</em>) time in the worst case. * Construction takes &Theta;(1) time. * <p> * For alternative implementations of the symbol table API, see {@link ST}, * {@link BinarySearchST}, {@link SequentialSearchST}, {@link RedBlackBST}, * {@link SeparateChainingHashST}, and {@link LinearProbingHashST}, * For additional documentation, see * <a href="https://algs4.cs.princeton.edu/32bst">Section 3.2</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class BST<Key extends Comparable<Key>, Value> { private Node root; // root of BST private class Node { private Key key; // sorted by key private Value val; // associated data private Node left, right; // left and right subtrees private int size; // number of nodes in subtree public Node(Key key, Value val, int size) { this.key = key; this.val = val; this.size = size; } } /** * Initializes an empty symbol table. */ public BST() { } /** * Returns true if this symbol table is empty. * @return {@code true} if this symbol table is empty; {@code false} otherwise */ public boolean isEmpty() { return size() == 0; } /** * Returns the number of key-value pairs in this symbol table. * @return the number of key-value pairs in this symbol table */ public int size() { return size(root); } // return number of key-value pairs in BST rooted at x private int size(Node x) { if (x == null) return 0; else return x.size; } /** * Does this symbol table contain the given key? * * @param key the key * @return {@code true} if this symbol table contains {@code key} and * {@code false} otherwise * @throws IllegalArgumentException if {@code key} is {@code null} */ public boolean contains(Key key) { if (key == null) throw new IllegalArgumentException("argument to contains() is null"); return get(key) != null; } /** * Returns the value associated with the given key. * * @param key the key * @return the value associated with the given key if the key is in the symbol table * and {@code null} if the key is not in the symbol table * @throws IllegalArgumentException if {@code key} is {@code null} */ public Value get(Key key) { return get(root, key); } private Value get(Node x, Key key) { if (key == null) throw new IllegalArgumentException("calls get() with a null key"); if (x == null) return null; int cmp = key.compareTo(x.key); if (cmp < 0) return get(x.left, key); else if (cmp > 0) return get(x.right, key); else return x.val; } /** * Inserts the specified key-value pair into the symbol table, overwriting the old * value with the new value if the symbol table already contains the specified key. * Deletes the specified key (and its associated value) from this symbol table * if the specified value is {@code null}. * * @param key the key * @param val the value * @throws IllegalArgumentException if {@code key} is {@code null} */ public void put(Key key, Value val) { if (key == null) throw new IllegalArgumentException("calls put() with a null key"); if (val == null) { delete(key); return; } root = put(root, key, val); assert check(); } private Node put(Node x, Key key, Value val) { if (x == null) return new Node(key, val, 1); int cmp = key.compareTo(x.key); if (cmp < 0) x.left = put(x.left, key, val); else if (cmp > 0) x.right = put(x.right, key, val); else x.val = val; x.size = 1 + size(x.left) + size(x.right); return x; } /** * Removes the smallest key and associated value from the symbol table. * * @throws NoSuchElementException if the symbol table is empty */ public void deleteMin() { if (isEmpty()) throw new NoSuchElementException("Symbol table underflow"); root = deleteMin(root); assert check(); } private Node deleteMin(Node x) { if (x.left == null) return x.right; x.left = deleteMin(x.left); x.size = size(x.left) + size(x.right) + 1; return x; } /** * Removes the largest key and associated value from the symbol table. * * @throws NoSuchElementException if the symbol table is empty */ public void deleteMax() { if (isEmpty()) throw new NoSuchElementException("Symbol table underflow"); root = deleteMax(root); assert check(); } private Node deleteMax(Node x) { if (x.right == null) return x.left; x.right = deleteMax(x.right); x.size = size(x.left) + size(x.right) + 1; return x; } /** * Removes the specified key and its associated value from this symbol table * (if the key is in this symbol table). * * @param key the key * @throws IllegalArgumentException if {@code key} is {@code null} */ public void delete(Key key) { if (key == null) throw new IllegalArgumentException("calls delete() with a null key"); root = delete(root, key); assert check(); } private Node delete(Node x, Key key) { if (x == null) return null; int cmp = key.compareTo(x.key); if (cmp < 0) x.left = delete(x.left, key); else if (cmp > 0) x.right = delete(x.right, key); else { if (x.right == null) return x.left; if (x.left == null) return x.right; Node t = x; x = min(t.right); x.right = deleteMin(t.right); x.left = t.left; } x.size = size(x.left) + size(x.right) + 1; return x; } /** * Returns the smallest key in the symbol table. * * @return the smallest key in the symbol table * @throws NoSuchElementException if the symbol table is empty */ public Key min() { if (isEmpty()) throw new NoSuchElementException("calls min() with empty symbol table"); return min(root).key; } private Node min(Node x) { if (x.left == null) return x; else return min(x.left); } /** * Returns the largest key in the symbol table. * * @return the largest key in the symbol table * @throws NoSuchElementException if the symbol table is empty */ public Key max() { if (isEmpty()) throw new NoSuchElementException("calls max() with empty symbol table"); return max(root).key; } private Node max(Node x) { if (x.right == null) return x; else return max(x.right); } /** * Returns the largest key in the symbol table less than or equal to {@code key}. * * @param key the key * @return the largest key in the symbol table less than or equal to {@code key} * @throws NoSuchElementException if there is no such key * @throws IllegalArgumentException if {@code key} is {@code null} */ public Key floor(Key key) { if (key == null) throw new IllegalArgumentException("argument to floor() is null"); if (isEmpty()) throw new NoSuchElementException("calls floor() with empty symbol table"); Node x = floor(root, key); if (x == null) throw new NoSuchElementException("argument to floor() is too small"); else return x.key; } private Node floor(Node x, Key key) { if (x == null) return null; int cmp = key.compareTo(x.key); if (cmp == 0) return x; if (cmp < 0) return floor(x.left, key); Node t = floor(x.right, key); if (t != null) return t; else return x; } public Key floor2(Key key) { Key x = floor2(root, key, null); if (x == null) throw new NoSuchElementException("argument to floor() is too small"); else return x; } private Key floor2(Node x, Key key, Key best) { if (x == null) return best; int cmp = key.compareTo(x.key); if (cmp < 0) return floor2(x.left, key, best); else if (cmp > 0) return floor2(x.right, key, x.key); else return x.key; } /** * Returns the smallest key in the symbol table greater than or equal to {@code key}. * * @param key the key * @return the smallest key in the symbol table greater than or equal to {@code key} * @throws NoSuchElementException if there is no such key * @throws IllegalArgumentException if {@code key} is {@code null} */ public Key ceiling(Key key) { if (key == null) throw new IllegalArgumentException("argument to ceiling() is null"); if (isEmpty()) throw new NoSuchElementException("calls ceiling() with empty symbol table"); Node x = ceiling(root, key); if (x == null) throw new NoSuchElementException("argument to floor() is too large"); else return x.key; } private Node ceiling(Node x, Key key) { if (x == null) return null; int cmp = key.compareTo(x.key); if (cmp == 0) return x; if (cmp < 0) { Node t = ceiling(x.left, key); if (t != null) return t; else return x; } return ceiling(x.right, key); } /** * Return the key in the symbol table of a given {@code rank}. * This key has the property that there are {@code rank} keys in * the symbol table that are smaller. In other words, this key is the * ({@code rank}+1)st smallest key in the symbol table. * * @param rank the order statistic * @return the key in the symbol table of given {@code rank} * @throws IllegalArgumentException unless {@code rank} is between 0 and * <em>n</em>–1 */ public Key select(int rank) { if (rank < 0 || rank >= size()) { throw new IllegalArgumentException("argument to select() is invalid: " + rank); } return select(root, rank); } // Return key in BST rooted at x of given rank. // Precondition: rank is in legal range. private Key select(Node x, int rank) { if (x == null) return null; int leftSize = size(x.left); if (leftSize > rank) return select(x.left, rank); else if (leftSize < rank) return select(x.right, rank - leftSize - 1); else return x.key; } /** * Return the number of keys in the symbol table strictly less than {@code key}. * * @param key the key * @return the number of keys in the symbol table strictly less than {@code key} * @throws IllegalArgumentException if {@code key} is {@code null} */ public int rank(Key key) { if (key == null) throw new IllegalArgumentException("argument to rank() is null"); return rank(key, root); } // Number of keys in the subtree less than key. private int rank(Key key, Node x) { if (x == null) return 0; int cmp = key.compareTo(x.key); if (cmp < 0) return rank(key, x.left); else if (cmp > 0) return 1 + size(x.left) + rank(key, x.right); else return size(x.left); } /** * Returns all keys in the symbol table as an {@code Iterable}. * To iterate over all of the keys in the symbol table named {@code st}, * use the foreach notation: {@code for (Key key : st.keys())}. * * @return all keys in the symbol table */ public Iterable<Key> keys() { if (isEmpty()) return new Queue<Key>(); return keys(min(), max()); } /** * Returns all keys in the symbol table in the given range, * as an {@code Iterable}. * * @param lo minimum endpoint * @param hi maximum endpoint * @return all keys in the symbol table between {@code lo} * (inclusive) and {@code hi} (inclusive) * @throws IllegalArgumentException if either {@code lo} or {@code hi} * is {@code null} */ public Iterable<Key> keys(Key lo, Key hi) { if (lo == null) throw new IllegalArgumentException("first argument to keys() is null"); if (hi == null) throw new IllegalArgumentException("second argument to keys() is null"); Queue<Key> queue = new Queue<Key>(); keys(root, queue, lo, hi); return queue; } private void keys(Node x, Queue<Key> queue, Key lo, Key hi) { if (x == null) return; int cmplo = lo.compareTo(x.key); int cmphi = hi.compareTo(x.key); if (cmplo < 0) keys(x.left, queue, lo, hi); if (cmplo <= 0 && cmphi >= 0) queue.enqueue(x.key); if (cmphi > 0) keys(x.right, queue, lo, hi); } /** * Returns the number of keys in the symbol table in the given range. * * @param lo minimum endpoint * @param hi maximum endpoint * @return the number of keys in the symbol table between {@code lo} * (inclusive) and {@code hi} (inclusive) * @throws IllegalArgumentException if either {@code lo} or {@code hi} * is {@code null} */ public int size(Key lo, Key hi) { if (lo == null) throw new IllegalArgumentException("first argument to size() is null"); if (hi == null) throw new IllegalArgumentException("second argument to size() is null"); if (lo.compareTo(hi) > 0) return 0; if (contains(hi)) return rank(hi) - rank(lo) + 1; else return rank(hi) - rank(lo); } /** * Returns the height of the BST (for debugging). * * @return the height of the BST (a 1-node tree has height 0) */ public int height() { return height(root); } private int height(Node x) { if (x == null) return -1; return 1 + Math.max(height(x.left), height(x.right)); } /** * Returns the keys in the BST in level order (for debugging). * * @return the keys in the BST in level order traversal */ public Iterable<Key> levelOrder() { Queue<Key> keys = new Queue<Key>(); Queue<Node> queue = new Queue<Node>(); queue.enqueue(root); while (!queue.isEmpty()) { Node x = queue.dequeue(); if (x == null) continue; keys.enqueue(x.key); queue.enqueue(x.left); queue.enqueue(x.right); } return keys; } /************************************************************************* * Check integrity of BST data structure. ***************************************************************************/ private boolean check() { if (!isBST()) StdOut.println("Not in symmetric order"); if (!isSizeConsistent()) StdOut.println("Subtree counts not consistent"); if (!isRankConsistent()) StdOut.println("Ranks not consistent"); return isBST() && isSizeConsistent() && isRankConsistent(); } // does this binary tree satisfy symmetric order? // Note: this test also ensures that data structure is a binary tree since order is strict private boolean isBST() { return isBST(root, null, null); } // is the tree rooted at x a BST with all keys strictly between min and max // (if min or max is null, treat as empty constraint) // Credit: Bob Dondero's elegant solution private boolean isBST(Node x, Key min, Key max) { if (x == null) return true; if (min != null && x.key.compareTo(min) <= 0) return false; if (max != null && x.key.compareTo(max) >= 0) return false; return isBST(x.left, min, x.key) && isBST(x.right, x.key, max); } // are the size fields correct? private boolean isSizeConsistent() { return isSizeConsistent(root); } private boolean isSizeConsistent(Node x) { if (x == null) return true; if (x.size != size(x.left) + size(x.right) + 1) return false; return isSizeConsistent(x.left) && isSizeConsistent(x.right); } // check that ranks are consistent private boolean isRankConsistent() { for (int i = 0; i < size(); i++) if (i != rank(select(i))) return false; for (Key key : keys()) if (key.compareTo(select(rank(key))) != 0) return false; return true; } /** * Unit tests the {@code BST} data type. * * @param args the command-line arguments */ public static void main(String[] args) { BST<String, Integer> st = new BST<String, Integer>(); for (int i = 0; !StdIn.isEmpty(); i++) { String key = StdIn.readString(); st.put(key, i); } for (String s : st.levelOrder()) StdOut.println(s + " " + st.get(s)); StdOut.println(); for (String s : st.keys()) StdOut.println(s + " " + st.get(s)); } }
ad534a6f1dc3563e945b386f59b43b323f0d9746
be7ec4991fe1b535f8a186e5e3996e4c6f54112b
/src/main/java/com/mannu/MainFrame.java
20d44dbe4051be61213e4378a0f46405402fa196
[]
no_license
Mannu2017/PranPAOmail
502a6a71bd1f1506cbf45ce0995fb9656ff68925
896305bee7c3683603de081428918a2f65eeaefe
refs/heads/master
2020-03-09T16:27:28.540520
2018-04-10T06:41:10
2018-04-10T06:41:10
128,885,350
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package com.mannu; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Calendar; import java.util.Date; import java.util.Timer; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import javax.swing.JFrame; public class MainFrame extends JFrame{ private String[] args; public MainFrame() { Timer timer=new Timer(); timer.schedule(new SendMail(), 0,1000*60*1440); } public void setArgs(String[] args) { this.args = args; } }
de22a82832ba928eda89cd4520abc60c1380a99f
bd040acd9edbed2b2f53c0de8c176fe781eb201f
/app/src/main/java/event/center/booking/FourthActivity.java
cd00b1c3a3608d24da4c4e805331ad603ef9ba2c
[]
no_license
Ayshatouh/Aysha
aa3db54f90f2a030a4ecb7f8c27dcd4a08d1f017
4ffae528a4fef8ff61df4c4949583af6f94f29af
refs/heads/master
2023-08-04T12:14:37.849438
2021-09-11T22:30:16
2021-09-11T22:30:16
405,290,672
1
1
null
null
null
null
UTF-8
Java
false
false
2,239
java
package event.center.booking; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.app.ActivityOptions; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Pair; import android.view.View; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; public class FourthActivity extends AppCompatActivity { ImageView third_back_arrow,third_arrow_up; TextView third_title,third_subtitle,third_rating_number,third_rating_number2,more_details2; RatingBar third_rating_bar; Animation anim_from_left,anim_from_right,anim_from_bottom; @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fourth); third_back_arrow = findViewById(R.id.third_back_arrow); third_arrow_up = findViewById(R.id.third_arrow_up); third_rating_number = findViewById(R.id.third_rating_number); third_rating_number2 = findViewById(R.id.third_rating_number2); third_title = findViewById(R.id.third_title); third_subtitle = findViewById(R.id.third_subtitle); third_rating_bar = findViewById(R.id.third_rating_bar); third_back_arrow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(FourthActivity.this, MainActivity.class); startActivity(intent); } }); third_arrow_up.setOnClickListener((view) -> { Intent intent = new Intent(FourthActivity.this, SixthActivity.class); Pair[] pairs= new Pair[1]; pairs[0] = new Pair<View, String>(third_arrow_up, "activity_third"); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(FourthActivity.this, pairs); startActivity(intent, options. toBundle()); }); } }
85f58cd1ea46618fe10ef86f34340b46a592d354
4bcbc46446511a07b751931797cceb234432c937
/src/ControlAsistencia.java
c43dd4ea3c774da16dd9935c6b39a5661c3e8fd9
[]
no_license
chaquen/FingerReader
e3a5ed8bd174639d361b4b0b418bafaf2c9b077f
842928be27bbd9e38572433b403aa0dbb3678848
refs/heads/master
2020-03-17T08:48:34.390726
2018-05-15T03:02:27
2018-05-15T03:02:27
133,450,591
0
0
null
null
null
null
UTF-8
Java
false
false
13,116
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Adrian */ public class ControlAsistencia extends javax.swing.JFrame { /** * Creates new form MainFrame */ public ControlAsistencia() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jMenuItem7 = new javax.swing.JMenuItem(); jMenuItem8 = new javax.swing.JMenuItem(); jLabeNombre = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox<>(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu2 = new javax.swing.JMenu(); btnConsultarEventos = new javax.swing.JMenuItem(); btnControlarRegistro = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); btnConsultarParticipantes = new javax.swing.JMenuItem(); btnRegistrarUsuario = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); btnEditarInformacion = new javax.swing.JMenuItem(); jMenuItem7.setText("jMenuItem7"); jMenuItem8.setText("jMenuItem8"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabeNombre.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N jLabeNombre.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabeNombre.setText("Bienvenido"); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Registre su huella dactilar para habilitar su acceso al evento"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 454, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(125, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(290, Short.MAX_VALUE)) ); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel1.setText("Selecciona el evento"); jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Evento 1", "Evento 2", "Evento 3", "Evento 4" })); jMenu2.setLabel("Eventos"); btnConsultarEventos.setText("Consultar"); btnConsultarEventos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConsultarEventosActionPerformed(evt); } }); jMenu2.add(btnConsultarEventos); btnControlarRegistro.setText("Control registro"); btnControlarRegistro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnControlarRegistroActionPerformed(evt); } }); jMenu2.add(btnControlarRegistro); jMenuBar1.add(jMenu2); jMenu1.setLabel("Participantes"); btnConsultarParticipantes.setText("Consultar"); btnConsultarParticipantes.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConsultarParticipantesActionPerformed(evt); } }); jMenu1.add(btnConsultarParticipantes); btnRegistrarUsuario.setText("Registrar"); btnRegistrarUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnRegistrarUsuarioActionPerformed(evt); } }); jMenu1.add(btnRegistrarUsuario); jMenuBar1.add(jMenu1); jMenu3.setLabel("Configuraciones"); btnEditarInformacion.setText("Editar Informacion"); btnEditarInformacion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnEditarInformacionActionPerformed(evt); } }); jMenu3.add(btnEditarInformacion); jMenuBar1.add(jMenu3); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(57, 57, 57) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabeNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 413, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jLabeNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(74, Short.MAX_VALUE)) ); jLabeNombre.getAccessibleContext().setAccessibleName("Bienvenido "); pack(); }// </editor-fold>//GEN-END:initComponents private void btnConsultarParticipantesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConsultarParticipantesActionPerformed // TODO add your handling code here: Usuarios jFrameUsuarios=new Usuarios(); jFrameUsuarios.setVisible(true); jFrameUsuarios.jLabeNombre.setText(""); jFrameUsuarios.jLabeNombre.setText(this.jLabeNombre.getText()); dispose(); }//GEN-LAST:event_btnConsultarParticipantesActionPerformed private void btnConsultarEventosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConsultarEventosActionPerformed // TODO add your handling code here: Eventos jFrameEventos=new Eventos(); jFrameEventos.setVisible(true); jFrameEventos.jLabeNombre.setText(""); jFrameEventos.jLabeNombre.setText(this.jLabeNombre.getText()); dispose(); }//GEN-LAST:event_btnConsultarEventosActionPerformed private void btnRegistrarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistrarUsuarioActionPerformed // TODO add your handling code here: RegistroUsuarios jFrameUsuarios=new RegistroUsuarios(); jFrameUsuarios.setVisible(true); jFrameUsuarios.jLabeNombre.setText(""); jFrameUsuarios.jLabeNombre.setText(this.jLabeNombre.getText()); dispose(); }//GEN-LAST:event_btnRegistrarUsuarioActionPerformed private void btnEditarInformacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarInformacionActionPerformed // TODO add your handling code here: Configuracion jFrameConfiguracion=new Configuracion(); jFrameConfiguracion.setVisible(true); jFrameConfiguracion.jLabeNombre.setText(""); jFrameConfiguracion.jLabeNombre.setText(this.jLabeNombre.getText()); dispose(); }//GEN-LAST:event_btnEditarInformacionActionPerformed private void btnControlarRegistroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnControlarRegistroActionPerformed // TODO add your handling code here: ControlAsistencia jFrameAsistencia=new ControlAsistencia(); jFrameAsistencia.setVisible(true); jFrameAsistencia.jLabeNombre.setText(""); jFrameAsistencia.jLabeNombre.setText(this.jLabeNombre.getText()); dispose(); }//GEN-LAST:event_btnControlarRegistroActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenuItem btnConsultarEventos; private javax.swing.JMenuItem btnConsultarParticipantes; private javax.swing.JMenuItem btnControlarRegistro; private javax.swing.JMenuItem btnEditarInformacion; private javax.swing.JMenuItem btnRegistrarUsuario; private javax.swing.JComboBox<String> jComboBox1; public javax.swing.JLabel jLabeNombre; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem7; private javax.swing.JMenuItem jMenuItem8; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }
c6025264787cd273b0816a5a6bc9d95725ec40b7
4a0b08f12e9cb8af4e7644511d38627200f81c8e
/zuihou-commons/zuihou-core/src/main/java/com/github/zuihou/mybatis/typehandler/BaseLikeTypeHandler.java
2ef3a198aae8529c0607c7d22332c538291b16f6
[ "Apache-2.0" ]
permissive
gzush/zuihou-admin-cloud
4db4ce73a5aa51d608e1788b689bcca963b66d51
67cf0688715ff59f984b221c3e8c9e4384e7fd43
refs/heads/master
2020-06-11T19:24:05.420709
2019-06-26T07:37:48
2019-06-26T07:37:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,750
java
package com.github.zuihou.mybatis.typehandler; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; /** * 仅仅用于like查询 * * @author Administrator */ public class BaseLikeTypeHandler extends BaseTypeHandler<CharSequence> { private static final String LIKE = "%"; private final boolean leftLike; private final boolean rightLike; public BaseLikeTypeHandler(boolean leftLike, boolean rightLike) { this.leftLike = leftLike; this.rightLike = rightLike; } /** * mybatis plus like查询转换 */ public static String likeConvert(String value) { if (StringUtils.isNotBlank(value)) { value = value.replaceAll("%", "\\\\%"); value = value.replaceAll("_", "\\\\_"); return value; } else { return ""; } } public static String likeConvertProcess(String value) { if (StringUtils.isNotBlank(value)) { value = value.replaceAll("%", "\\\\%"); value = value.replaceAll("_", "\\\\_"); return "%" + value + "%"; } else { return ""; } } public static String likeConvert(Object value) { if (value instanceof String) { return likeConvert(String.valueOf(value)); } return ""; } private String convert(String value) { value = value.replaceAll("\\%", "\\\\%"); value = value.replaceAll("\\_", "\\\\_"); return value; } @Override public void setNonNullParameter(PreparedStatement ps, int i, CharSequence parameter, JdbcType jdbcType) throws SQLException { if (parameter == null) { ps.setString(i, null); } else { ps.setString(i, like(parameter.toString())); } } private String like(String parameter) { String result = convert(parameter); if (this.leftLike) { result = LIKE + result; } if (this.rightLike) { result += LIKE; } return result; } @Override public String getNullableResult(ResultSet rs, String columnName) throws SQLException { return rs.getString(columnName); } @Override public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException { return rs.getString(columnIndex); } @Override public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { return cs.getString(columnIndex); } }
393a347e0e378ae30574eade46a7a99982caf349
1a4fdffda4011b10fbde608fe17da6a3eb30eff2
/TeamCode/src/main/java/org/timecrafters/PINKS_2018/Autonomous/States/OldDriveStates/V2States/V2States/CenterPath/Depot/DCPointToCrater.java
d20e63ae34db491e356dc743d6d71d14797eddd8
[ "BSD-3-Clause" ]
permissive
TimeCrafters/SkyStone
61cd033a5710a9c78128a3dd17272b9cec75c091
dcc31c1e9079c304641a7e7b2be9c4b2562bc787
refs/heads/master
2021-07-15T21:31:32.237325
2020-09-10T01:34:54
2020-09-10T01:34:54
205,562,998
0
0
null
2019-08-31T15:36:12
2019-08-31T15:36:11
null
UTF-8
Java
false
false
2,268
java
package org.timecrafters.PINKS_2018.Autonomous.States.OldDriveStates.V2States.V2States.CenterPath.Depot; import org.cyberarm.NeXT.StateConfiguration; import org.timecrafters.PINKS_2018.Autonomous.Support.PinksDrive; import org.timecrafters.PINKS_2018.Autonomous.Support.PinksHardwareConfig; import org.timecrafters.engine.Engine; import org.timecrafters.engine.State; /********************************************************************************************** * Name: DropRobot * Inputs: engine, ArchitectureControl * Outputs: none * Use: Opens drop latch to drop robot **********************************************************************************************/ public class DCPointToCrater extends State { private String StepID = "DCPointToCrater"; public StateConfiguration AppReader; public PinksHardwareConfig PinksHardwareConfig; private PinksDrive Drive; private double LeftPower; private double RightPower; private int LeftMM; private int RightMM; public DCPointToCrater(Engine engine, StateConfiguration appReader, PinksHardwareConfig pinksHardwareConfig) { this.engine = engine; this.AppReader = appReader; this.PinksHardwareConfig = pinksHardwareConfig; } public void init() { Drive = new PinksDrive(PinksHardwareConfig); LeftPower = AppReader.get(StepID).variable("LeftPower"); RightPower = AppReader.get(StepID).variable("RightPower"); LeftMM = AppReader.get(StepID).variable("LeftIN"); RightMM = AppReader.get(StepID).variable("RightIN"); } @Override public void exec() { //The FileReader reads the file we edit on the phones, allowing us to skip steps and edit // variables from the phone. "FileReader.allow" returns true or false depending on if we have a step // toggled on or off. if (AppReader.allow(StepID)) { engine.telemetry.addLine("Running Step"+StepID); Drive.go(LeftPower, RightPower, LeftMM, RightMM); setFinished(Drive.HasReachedTarget()); } else { engine.telemetry.addLine("Skipping Step"+StepID); sleep(1000); setFinished(true); } engine.telemetry.update(); } }