blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
listlengths
1
1
author_id
stringlengths
0
313
07dd7f30a811b98913b9f12d00a58ec28bfba03c
b8755f98c778964c2efe440edbc28389be80f907
/src/com/atguigu/web/dao/UserDaoImpl.java
490c5effc7880692c540d94a880f29034e3dda3a
[]
no_license
xiaoyangPu/MyGit2
fd5b4798e7d0a71f7f72e0794d8d51b4efd5f279
d8b0de5e68b35072cf9e3f39f68c19e8138cb462
refs/heads/master
2020-04-07T05:46:06.318400
2018-11-19T01:43:59
2018-11-19T01:43:59
158,109,085
0
0
null
null
null
null
UTF-8
Java
false
false
2,684
java
package com.atguigu.web.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.atguigu.web.bean.Employee; import com.atguigu.web.bean.User; import com.atguigu.web.utils.ConnectionUtils; public class UserDaoImpl implements UserDao { @Override public User findUserByUsernameAndPassword(String username, String password) { try { User user = null; Connection conn = ConnectionUtils.getConn(); String sql = "select * from tbl_user where username=? and password=?"; PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, username); ps.setString(2, password); ResultSet rs = ps.executeQuery(); while (rs.next()) { user=new User(); user.setUsername(rs.getString("username")); user.setPassword(rs.getString("password")); user.setId(rs.getInt("id")); } return user; } catch (SQLException e) { e.printStackTrace(); } finally { try { ConnectionUtils.closeConn(); } catch (SQLException e) { e.printStackTrace(); } } return null; } @Override public boolean validUserNameExist(String username) { try { Connection conn = ConnectionUtils.getConn(); String sql = "select * from tbl_user where username=?"; PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, username); ResultSet rs = ps.executeQuery(); if (rs.next()) { return true; } return false; } catch (SQLException e) { e.printStackTrace(); } finally { try { ConnectionUtils.closeConn(); } catch (SQLException e) { e.printStackTrace(); } } return false; } @Override public List<Employee> getAllEmps() { ArrayList<Employee> emps = new ArrayList<>(); try { Connection conn = ConnectionUtils.getConn(); String sql = "select * from tbl_employee"; PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs.next()) { Employee employee=new Employee(); employee.setId(rs.getInt("id")); employee.setLastName(rs.getString("last_name")); employee.setGender(rs.getString("gender")); employee.setEmail(rs.getString("email")); emps.add(employee); } return emps; } catch (SQLException e) { e.printStackTrace(); } finally { try { ConnectionUtils.closeConn(); } catch (SQLException e) { e.printStackTrace(); } } return null; } }
be19e1e43a6017b1d24174bced4d3fe921d2feee
f7fa0eb6a140490eff75e0ddd39b0a1201aa8a14
/core/src/main/java/com/hxy/core/magicindicator/buildins/commonnavigator/abs/IPagerTitleView.java
9a769081dca61eb459f82efa3adcccecbedad505
[]
no_license
huang7855196/News
f02fd2a01f6e7e88a9287957cf742558bb9c19b1
4ca8487c027a1e79cf843c4761347405efc179b5
refs/heads/master
2022-11-27T03:59:09.787996
2020-07-20T09:59:51
2020-07-20T09:59:51
262,951,148
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package com.hxy.core.magicindicator.buildins.commonnavigator.abs; /** * 抽象的指示器标题,适用于CommonNavigator * 博客: http://hackware.lucode.net * Created by hackware on 2016/6/26. */ public interface IPagerTitleView { /** * 被选中 */ void onSelected(int index, int totalCount); /** * 未被选中 */ void onDeselected(int index, int totalCount); /** * 离开 * * @param leavePercent 离开的百分比, 0.0f - 1.0f * @param leftToRight 从左至右离开 */ void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight); /** * 进入 * * @param enterPercent 进入的百分比, 0.0f - 1.0f * @param leftToRight 从左至右离开 */ void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight); }
a81d954ef6d4a721d78036ee28678735ebc5fdbe
35e1aee1685def4d303dbfd1ce62548d1aa000c2
/ServidorWeb/src/java/WebServices/UsuarioWS/DataJugador.java
701506eb80cf02f3dff0c0f71b0eefb983fdd77c
[]
no_license
sjcotto/java-swing-ws
d2479e1bedea0ba46e8182c1d9dd91955042e9b8
fd972634a3f58237bb2cfb07fde7113b80d15730
refs/heads/master
2016-09-06T07:43:45.963849
2013-08-15T01:19:17
2013-08-15T01:19:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,202
java
package WebServices.UsuarioWS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for dataJugador complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="dataJugador"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="altura" type="{http://www.w3.org/2001/XMLSchema}double"/> * &lt;element name="edad" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="fechaDeNacimiento" type="{http://WebServices/}dataFechaHora" minOccurs="0"/> * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="lugarNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="nombreCompleto" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="pathImage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="peso" type="{http://www.w3.org/2001/XMLSchema}double"/> * &lt;element name="posicion" type="{http://WebServices/}tipoPosicion" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "dataJugador", propOrder = { "altura", "edad", "fechaDeNacimiento", "id", "lugarNacimiento", "nombre", "nombreCompleto", "pathImage", "peso", "posicion" }) public class DataJugador { protected double altura; protected int edad; protected DataFechaHora fechaDeNacimiento; protected int id; protected String lugarNacimiento; protected String nombre; protected String nombreCompleto; protected String pathImage; protected double peso; protected TipoPosicion posicion; /** * Gets the value of the altura property. * */ public double getAltura() { return altura; } /** * Sets the value of the altura property. * */ public void setAltura(double value) { this.altura = value; } /** * Gets the value of the edad property. * */ public int getEdad() { return edad; } /** * Sets the value of the edad property. * */ public void setEdad(int value) { this.edad = value; } /** * Gets the value of the fechaDeNacimiento property. * * @return * possible object is * {@link DataFechaHora } * */ public DataFechaHora getFechaDeNacimiento() { return fechaDeNacimiento; } /** * Sets the value of the fechaDeNacimiento property. * * @param value * allowed object is * {@link DataFechaHora } * */ public void setFechaDeNacimiento(DataFechaHora value) { this.fechaDeNacimiento = value; } /** * Gets the value of the id property. * */ public int getId() { return id; } /** * Sets the value of the id property. * */ public void setId(int value) { this.id = value; } /** * Gets the value of the lugarNacimiento property. * * @return * possible object is * {@link String } * */ public String getLugarNacimiento() { return lugarNacimiento; } /** * Sets the value of the lugarNacimiento property. * * @param value * allowed object is * {@link String } * */ public void setLugarNacimiento(String value) { this.lugarNacimiento = value; } /** * Gets the value of the nombre property. * * @return * possible object is * {@link String } * */ public String getNombre() { return nombre; } /** * Sets the value of the nombre property. * * @param value * allowed object is * {@link String } * */ public void setNombre(String value) { this.nombre = value; } /** * Gets the value of the nombreCompleto property. * * @return * possible object is * {@link String } * */ public String getNombreCompleto() { return nombreCompleto; } /** * Sets the value of the nombreCompleto property. * * @param value * allowed object is * {@link String } * */ public void setNombreCompleto(String value) { this.nombreCompleto = value; } /** * Gets the value of the pathImage property. * * @return * possible object is * {@link String } * */ public String getPathImage() { return pathImage; } /** * Sets the value of the pathImage property. * * @param value * allowed object is * {@link String } * */ public void setPathImage(String value) { this.pathImage = value; } /** * Gets the value of the peso property. * */ public double getPeso() { return peso; } /** * Sets the value of the peso property. * */ public void setPeso(double value) { this.peso = value; } /** * Gets the value of the posicion property. * * @return * possible object is * {@link TipoPosicion } * */ public TipoPosicion getPosicion() { return posicion; } /** * Sets the value of the posicion property. * * @param value * allowed object is * {@link TipoPosicion } * */ public void setPosicion(TipoPosicion value) { this.posicion = value; } }
2ea160ec2d5f7af03ec22c95a4ff2733a4c884e4
aee793e49e37ec8f74b222281d0628ad8016d51d
/app/src/main/java/com/zt/picture/lib/adapter/PictureSimpleFragmentAdapter.java
2a3f67d95e62754926441fb69de5f3f6fe5cc874
[]
no_license
zt-code/picture_library
2f90df17d80b1c1c35c5acfcd4532c7f817d6013
2b5087899a762dcd628d1b5dc0fd2ef4043c35cc
refs/heads/master
2023-06-02T13:50:05.647204
2021-06-22T10:40:39
2021-06-22T10:40:39
379,176,845
0
0
null
null
null
null
UTF-8
Java
false
false
8,556
java
package com.zt.picture.lib.adapter; import android.content.Context; import android.content.Intent; import android.graphics.PointF; import android.net.Uri; import android.os.Bundle; import android.util.SparseArray; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.viewpager.widget.PagerAdapter; import com.zt.picture.R; import com.zt.picture.lib.config.PictureConfig; import com.zt.picture.lib.config.PictureMimeType; import com.zt.picture.lib.config.PictureSelectionConfig; import com.zt.picture.lib.entity.LocalMedia; import com.zt.picture.lib.photoview.PhotoView; import com.zt.picture.lib.tools.JumpUtils; import com.zt.picture.lib.tools.MediaUtils; import com.zt.picture.lib.tools.ScreenUtils; import com.zt.picture.lib.widget.longimage.ImageSource; import com.zt.picture.lib.widget.longimage.ImageViewState; import com.zt.picture.lib.widget.longimage.SubsamplingScaleImageView; import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.ArrayList; import java.util.List; /** * @author:luck * @data:2018/1/27 下午7:50 * @describe:PictureSimpleFragmentAdapter */ public class PictureSimpleFragmentAdapter extends PagerAdapter { private List<LocalMedia> data; private final OnCallBackActivity onBackPressed; private final PictureSelectionConfig config; private final int mScreenWidth, mScreenHeight; /** * Maximum number of cached images */ private static final int MAX_CACHE_SIZE = 20; /** * To cache the view */ private SparseArray<View> mCacheView; public void clear() { if (null != mCacheView) { mCacheView.clear(); mCacheView = null; } } public void removeCacheView(int position) { if (mCacheView != null && position < mCacheView.size()) { mCacheView.removeAt(position); } } public interface OnCallBackActivity { /** * Close Activity */ void onActivityBackPressed(); } public PictureSimpleFragmentAdapter(Context context, PictureSelectionConfig config, OnCallBackActivity onBackPressed) { super(); this.config = config; this.onBackPressed = onBackPressed; this.mCacheView = new SparseArray<>(); this.mScreenWidth = ScreenUtils.getScreenWidth(context); this.mScreenHeight = ScreenUtils.getScreenHeight(context); } /** * bind data * * @param data */ public void bindData(List<LocalMedia> data) { this.data = data; } /** * get data * * @return */ public List<LocalMedia> getData() { return data == null ? new ArrayList<>() : data; } public int getSize() { return data == null ? 0 : data.size(); } public void remove(int currentItem) { if (getSize() > currentItem) { data.remove(currentItem); } } public LocalMedia getItem(int position) { return getSize() > 0 && position < getSize() ? data.get(position) : null; } @Override public int getCount() { return data != null ? data.size() : 0; } @Override public void destroyItem(ViewGroup container, int position, Object object) { (container).removeView((View) object); if (mCacheView.size() > MAX_CACHE_SIZE) { mCacheView.remove(position); } } @Override public int getItemPosition(@NonNull Object object) { return POSITION_NONE; } @Override public boolean isViewFromObject(@NotNull View view, @NotNull Object object) { return view == object; } @NotNull @Override public Object instantiateItem(@NotNull ViewGroup container, int position) { View contentView = mCacheView.get(position); if (contentView == null) { contentView = LayoutInflater.from(container.getContext()) .inflate(R.layout.picture_image_preview, container, false); mCacheView.put(position, contentView); } PhotoView photoView = contentView.findViewById(R.id.preview_image); SubsamplingScaleImageView longImg = contentView.findViewById(R.id.longImg); ImageView ivPlay = contentView.findViewById(R.id.iv_play); LocalMedia media = getItem(position); if (config.isAutoScalePreviewImage) { float width = Math.min(media.getWidth(), media.getHeight()); float height = Math.max(media.getHeight(), media.getWidth()); if (width > 0 && height > 0) { // 只需让图片的宽是屏幕的宽,高乘以比例 int displayHeight = (int) Math.ceil(width * height / width); //最终让图片按照宽是屏幕 高是等比例缩放的大小 FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) photoView.getLayoutParams(); layoutParams.width = mScreenWidth; layoutParams.height = displayHeight < mScreenHeight ? displayHeight + mScreenHeight : displayHeight; layoutParams.gravity = Gravity.CENTER; } } final String mimeType = media.getMimeType(); final String path; if (media.isCut() && !media.isCompressed()) { path = media.getCutPath(); } else if (media.isCompressed() || (media.isCut() && media.isCompressed())) { path = media.getCompressPath(); } else { path = media.getPath(); } boolean isGif = PictureMimeType.isGif(mimeType); boolean isHasVideo = PictureMimeType.isHasVideo(mimeType); ivPlay.setVisibility(isHasVideo ? View.VISIBLE : View.GONE); ivPlay.setOnClickListener(v -> { if (PictureSelectionConfig.customVideoPlayCallback != null) { PictureSelectionConfig.customVideoPlayCallback.startPlayVideo(media); } else { Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putBoolean(PictureConfig.EXTRA_PREVIEW_VIDEO, true); bundle.putString(PictureConfig.EXTRA_VIDEO_PATH, path); intent.putExtras(bundle); JumpUtils.startPictureVideoPlayActivity(container.getContext(), bundle, PictureConfig.PREVIEW_VIDEO_CODE); } }); boolean eqLongImg = MediaUtils.isLongImg(media); photoView.setVisibility(eqLongImg && !isGif ? View.GONE : View.VISIBLE); photoView.setOnViewTapListener((view, x, y) -> { if (onBackPressed != null) { onBackPressed.onActivityBackPressed(); } }); longImg.setVisibility(eqLongImg && !isGif ? View.VISIBLE : View.GONE); longImg.setOnClickListener(v -> { if (onBackPressed != null) { onBackPressed.onActivityBackPressed(); } }); if (isGif && !media.isCompressed()) { if (config != null && PictureSelectionConfig.imageEngine != null) { PictureSelectionConfig.imageEngine.loadAsGifImage (contentView.getContext(), path, photoView); } } else { if (config != null && PictureSelectionConfig.imageEngine != null) { if (eqLongImg) { displayLongPic(PictureMimeType.isContent(path) ? Uri.parse(path) : Uri.fromFile(new File(path)), longImg); } else { PictureSelectionConfig.imageEngine.loadImage (contentView.getContext(), path, photoView); } } } (container).addView(contentView, 0); return contentView; } /** * load long image * * @param uri * @param longImg */ private void displayLongPic(Uri uri, SubsamplingScaleImageView longImg) { longImg.setQuickScaleEnabled(true); longImg.setZoomEnabled(true); longImg.setDoubleTapZoomDuration(100); longImg.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP); longImg.setDoubleTapZoomDpi(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER); longImg.setImage(ImageSource.uri(uri), new ImageViewState(0, new PointF(0, 0), 0)); } }
ec48f85a5aebc04f67397e92e436b34630c72668
b3fbdac8e29019cf87340a5494862f27d230f936
/app/src/main/java/com/example/jupa/Helpers/RaveHelper.java
7d4c2dbf3c536ec4cab1a67446845128ac00717f
[]
no_license
bronejeffries/jupaApp
431e03f8cc5574e1b2d4e37c1daf6ec18df9937f
16f190808951afc41bf4aff1efa9a3707957e9a8
refs/heads/master
2020-07-26T19:53:44.490304
2020-02-22T16:04:58
2020-02-22T16:04:58
208,750,490
0
0
null
null
null
null
UTF-8
Java
false
false
2,666
java
package com.example.jupa.Helpers; import android.app.Activity; import android.content.Context; import android.content.Intent; import com.example.jupa.R; import com.flutterwave.raveandroid.RaveConstants; import com.flutterwave.raveandroid.RavePayActivity; import com.flutterwave.raveandroid.RavePayManager; public class RaveHelper { final String publicKey = "FLWPUBK-09622c7a4b948dd3fb98aeb75e1aba50-X"; //Get your public key from your account final String encryptionKey = "95f1d0841a46b0cd049470db"; //Get your encryption key from your account String message; public void makePayment(Context context,PaymentDetails paymentDetails){ // email +" "+ /* Create instance of RavePayManager */ new RavePayManager((Activity) context).setAmount(paymentDetails.getAmount()) .setCountry(paymentDetails.getCountry()) .setCurrency(paymentDetails.getCurrency()) .setEmail(paymentDetails.getEmail()) .setfName(paymentDetails.getfName()) .setlName(paymentDetails.getlName()) .setNarration(paymentDetails.getNarration()) .setPublicKey(publicKey) .setEncryptionKey(encryptionKey) .setTxRef(paymentDetails.getTxRef()) .acceptAccountPayments(true) .acceptCardPayments(true) .acceptMpesaPayments(true) .acceptGHMobileMoneyPayments(false) .acceptUgMobileMoneyPayments(true) .acceptAccountPayments(true) .onStagingEnv(true) .allowSaveCardFeature(true) .withTheme(R.style.DefaultPayTheme) .initialize(); } public boolean resultHandler(int requestCode, int resultCode, Intent data){ Boolean validResult = false; if (requestCode == RaveConstants.RAVE_REQUEST_CODE && data != null) { String message = data.getStringExtra("response"); if (resultCode == RavePayActivity.RESULT_SUCCESS) { setMessage("SUCCESS "); validResult = true; } else if (resultCode == RavePayActivity.RESULT_ERROR) { setMessage("ERROR "); validResult = false; } else if (resultCode == RavePayActivity.RESULT_CANCELLED) { setMessage("CANCELLED "); validResult = false; } } return validResult; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
d2bea6dd99fba06c87838a81eda559928ff811d9
8ae6632b944e7b6ba8fa99dd4a3bb21f1f36d31b
/src/main/java/com/epam/lab/exceptionshw/task2/exception_classes/TypeException.java
e4de95869a78e0d77274242885f79f654b1d757c
[]
no_license
AnnaVolynets22/ta_lab_java
8ec0d9bca6f0aaa514e60eab898810417dcf72bb
f08ba094f3b943a32be09ae9facc8873497de5c4
refs/heads/master
2022-11-24T22:59:04.416042
2020-03-09T19:00:43
2020-03-09T19:00:43
233,810,536
0
0
null
2022-11-16T09:58:44
2020-01-14T09:58:37
Java
UTF-8
Java
false
false
203
java
package com.epam.lab.exceptionshw.task2.exception_classes; public class TypeException extends Exception { public TypeException(String msg){ super(msg); } public TypeException(){} }
a42e6a3dd5bb2cc94e532b472e4aebdf7eb54e1d
b1103f2ea693e01795490e116d751c57e574d324
/rabbitmq/src/main/java/cn/ting97/rabbitmq/sender/SimpleSender.java
8c8f968d96e373aecdca7dfb7433d2094838fcb6
[]
no_license
Ting97/SpringBoot-MQ
2017aadb9ad795e227ea1aa76eed896114f9b3db
eeaf19ec67b67d72458f68713320fbe8a03c1286
refs/heads/master
2023-03-12T09:33:02.821737
2021-02-25T03:48:30
2021-02-25T03:48:30
341,888,999
1
0
null
null
null
null
UTF-8
Java
false
false
947
java
package cn.ting97.rabbitmq.sender; import cn.ting97.rabbitmq.utils.MQConstants; import org.springframework.amqp.core.AmqpTemplate; import org.springframework.stereotype.Component; import java.util.Date; /** * @author Chen Liting * @version 1.0.0 * @className HelloSender * @Description * @date 2021-02-22 */ @Component public class SimpleSender { private final AmqpTemplate rabbitTemplate; public SimpleSender(AmqpTemplate rabbitTemplate) {this.rabbitTemplate = rabbitTemplate;} public void send() { String context = "hello " + new Date(); System.out.println("Sender : " + context); // 不填写交换机 this.rabbitTemplate.convertAndSend(MQConstants.HELLO_QUEUE, context); } public void send(int i) { String context = "hello " + i; System.out.println("Sender : " + context); this.rabbitTemplate.convertAndSend(MQConstants.HELLO123_QUEUE, context); } }
6be6f1d049d7d419cd686300555c23dc4a647958
a3cff9345a8cc3ffe2c0fa024471cfaf24a70f8a
/src/test/java/TestCase0001.java
74db4018c3a5f806f88dd4c65f1c725d2b6d70e4
[]
no_license
kskolpen/Day4Project
a16fc4486ee6d15add90bb217f2604c76924a757
bc8c548bbc1cad10c62137fe4d1114023488bbc6
refs/heads/master
2023-05-06T15:39:54.997987
2021-05-26T01:48:21
2021-05-26T01:48:21
370,851,557
0
0
null
2021-05-26T01:48:22
2021-05-25T23:21:02
Java
UTF-8
Java
false
false
141
java
public class TestCase0001 { //work 1 //work2 //finished test //ready to open pull request //discuss and merge the code }
3ef757b8e9b7ebe797babea934358c566d16edc5
953d607dadbb2eb2730b727a133d4a9e03dc67cc
/src/workerInfoSystem/DataSerial.java
cf55f47283ef625e462f012f1aa6a90a3b478153
[ "Apache-2.0" ]
permissive
wmy0601034/worker
91b950285671bda15a90f51c7dbb52f0526d5823
04c9a89b94393331aef6680104175d18b76459fb
refs/heads/master
2021-01-10T02:17:30.331143
2016-03-29T05:16:56
2016-03-29T05:16:56
54,945,731
0
0
null
null
null
null
GB18030
Java
false
false
2,665
java
package workerInfoSystem; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.List; public class DataSerial { /*public void Serial(List<Info> list){ //String serialPath="e:\\workerinfotest.txt"; try { ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("E:\\infotest.txt")); for (Info l : list){ try { oos.writeObject(list); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println("序列化完成"); oos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void readInformation(){ try { ObjectInputStream ois=new ObjectInputStream(new FileInputStream("E:\\infotest.txt")); List<Info> Information; try { Information=(List<Info>) ois.readObject(); System.out.println(); ois.close(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } */ public static void save(List<Info> workerInfoPut) { // TODO Auto-generated method stub try { ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("E:\\infotest.txt")); for (Info l : workerInfoPut){ try { oos.writeObject(workerInfoPut); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println("序列化完成"); oos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void readInformation(){ try { ObjectInputStream ois=new ObjectInputStream(new FileInputStream("E:\\infotest.txt")); List<Info> Information; try { Information=(List<Info>) ois.readObject(); System.out.println(); ois.close(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
5042edd83c359281d1fc4c902309eb6adee5ea90
412e86e0d8182204c7bfd6b3d43d30736c55068a
/src/main/java/com/kenny/openimgur/api/responses/TopicResponse.java
5ac0498e336b11f01ea56582b91cec3cf23cad34
[ "Apache-2.0" ]
permissive
duytruongit/Opengur
bf8c5d923e7b28bfc0738001c363284e6d9671d6
406bd4bce816ff591ffedf00ed333aa27a4cbe85
refs/heads/master
2021-01-18T05:48:56.520623
2016-06-02T12:41:05
2016-06-02T12:41:05
61,952,478
1
0
null
2016-06-25T16:44:33
2016-06-25T16:44:32
null
UTF-8
Java
false
false
351
java
package com.kenny.openimgur.api.responses; import android.support.annotation.NonNull; import com.kenny.openimgur.classes.ImgurTopic; import java.util.ArrayList; import java.util.List; /** * Created by kcampagna on 7/11/15. */ public class TopicResponse extends BaseResponse { @NonNull public List<ImgurTopic> data = new ArrayList<>(); }
12d0a5e91d8a83cdf7a539f4dbe7e75fbbfac9a6
f1517a2141da620a721d86bc775d3633d63a7965
/src/java/apoio/Formatacao.java
98b9b93809a42314d449c8694cb5db86ff8bbfb2
[]
no_license
douglasvargas1995/webChamados
74a54e0ba3aeddb8e8500959dc448f7c3b93bf08
0f21408d6719ee634a4602720c3e2ff3a6daa5c3
refs/heads/master
2023-06-02T16:57:34.762456
2021-06-20T23:53:14
2021-06-20T23:53:14
355,359,292
0
0
null
null
null
null
UTF-8
Java
false
false
5,061
java
package apoio; import java.text.*; import java.util.Date; import java.util.Locale; import javax.swing.*; import javax.swing.text.*; public class Formatacao { static DecimalFormat df = new DecimalFormat("#,##0.00", new DecimalFormatSymbols(new Locale("pt", "BR"))); public static JFormattedTextField getFormatado(String formato) { JFormattedTextField campoFormatado = null; MaskFormatter format = new MaskFormatter(); format.setPlaceholderCharacter(' '); format.setValueContainsLiteralCharacters(false); try { format.setMask(formato); campoFormatado = new JFormattedTextField(format); } catch (ParseException ex) { ex.printStackTrace(); } return campoFormatado; } public static void formatarDecimal(JTextField campo) { campo.setText(df.format(Double.parseDouble(campo.getText()))); } public static String formatarDecimal(double valor) { NumberFormat formatter = new DecimalFormat("###0.00"); return (formatter.format(valor)); } public static JFormattedTextField getTelefone() { return getFormatado("(##) ####-####"); } public static JFormattedTextField getCNPJ() { return getFormatado("##.###.###/####-##"); } public static JFormattedTextField getCPF() { return getFormatado("###.###.###-##"); } public static JFormattedTextField getData() { return getFormatado("##/##/####"); } public static JFormattedTextField getDataHora() { return getFormatado("##/##/#### ##:##"); } public void formatoDecimal(JTextField campo) { campo.setText(df.format(Double.parseDouble(campo.getText()))); } public static void formatarData(JFormattedTextField campo) { try { MaskFormatter m = new MaskFormatter(); m.setPlaceholderCharacter(' '); m.setMask("##/##/####"); campo.setFormatterFactory(null); campo.setFormatterFactory(new DefaultFormatterFactory(m)); campo.setValue(null); } catch (Exception e) { System.err.println(e); } } public static void formatarCpf(JFormattedTextField campo) { try { MaskFormatter m = new MaskFormatter(); m.setPlaceholderCharacter(' '); m.setMask("###.###.###-##"); campo.setFormatterFactory(null); campo.setFormatterFactory(new DefaultFormatterFactory(m)); campo.setValue(null); } catch (Exception e) { System.err.println(e); } } public static void formatarCnpj(JFormattedTextField campo) { try { MaskFormatter m = new MaskFormatter(); m.setPlaceholderCharacter(' '); m.setMask("##.###.###/####-##"); campo.setFormatterFactory(null); campo.setFormatterFactory(new DefaultFormatterFactory(m)); campo.setValue(null); } catch (Exception e) { System.err.println(e); } } public static void formatarTelefone(JFormattedTextField campo) { try { MaskFormatter m = new MaskFormatter(); m.setPlaceholderCharacter(' '); m.setMask("(##)####-####"); campo.setFormatterFactory(null); campo.setFormatterFactory(new DefaultFormatterFactory(m)); campo.setValue(null); } catch (Exception e) { System.err.println(e); } } public static String ajustaDataDMA(String data) { String dataFormatada = null; try { Date dataAMD = new SimpleDateFormat("yyyy-MM-dd").parse(data); dataFormatada = new SimpleDateFormat("dd/MM/yyyy").format(dataAMD); } catch (Exception e) { System.err.println(e); } return (dataFormatada); } public static String ajustaDataAMD(String data) { String dataFormatada = null; try { Date dataDMA = new SimpleDateFormat("dd/MM/yyyy").parse(data); dataFormatada = new SimpleDateFormat("yyyy-MM-dd").format(dataDMA); } catch (Exception e) { System.err.println(e); } return (dataFormatada); } public static String removerFormatacao(String dado) { String retorno = ""; for (int i = 0; i < dado.length(); i++) { if (dado.charAt(i) != '.' && dado.charAt(i) != '/' && dado.charAt(i) != '-') { retorno = retorno + dado.charAt(i); } } return (retorno); } public static String getDataAtual() { Date now = new Date(); DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dataHoje = df.format(now); return dataHoje; } public static String getDataHoraAtual() { Date now = new Date(); DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm"); String dataHoje = df.format(now); return dataHoje; } }
f36268e39a056d84107ff9ea7e462985758fc8af
e8c97437dfcacb531d7cec4f55a6cfed0522ea81
/src/main/java/vn/com/itzenk/shopping/repository/ProductRepository.java
2644a205a8f07e9d0ec0e31fc5d8210c796ec300
[ "CC-BY-3.0" ]
permissive
cusinh/shopping-salespoint
ab38e2211d92c9bdf448dde308f5fa6cb01ce8e7
55502cc04904799674e837779c8f55406e397088
refs/heads/master
2020-06-04T13:14:46.742587
2019-06-15T04:36:40
2019-06-15T04:36:40
192,036,698
0
0
null
null
null
null
UTF-8
Java
false
false
1,136
java
package vn.com.itzenk.shopping.repository; import java.util.List; import org.salespointframework.catalog.Catalog; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import vn.com.itzenk.shopping.entity.ProductEntity; import vn.com.itzenk.shopping.entity.ProductEntity.ProductType; @Repository public interface ProductRepository extends Catalog<ProductEntity> { static final Sort DEFAULT_SORT = Sort.by("productIdentifier").descending(); @Query("SELECT p FROM ProductEntity p ORDER BY p.id") List<ProductEntity> findNewProduct(Pageable pageable); @Query("SELECT COUNT(p) FROM ProductEntity p WHERE p.type=:type") long countByProductType(@Param("type") ProductType type); List<ProductEntity> findByType(ProductType type, Sort sort); @Query("SELECT p FROM ProductEntity p WHERE p.name LIKE '%' || :name || '%' ") List<ProductEntity> searchProductByProductName(@Param("name") String name); }
bb56b5527724007e76350ec7171afed21171c21a
1750f7af1e3058ac835ccf303f7c6fc414b0be05
/src/main/java/me/destro/intellij/plugins/qmaven/maven/MavenHelper.java
dd5748fad09c40c4e57d6ef369137eed0c090ef9
[ "MIT" ]
permissive
dexpota/maven-macros-toolbox
216aabaa6c5e54628be2fc5fe7a4debf9852cdd4
9499181cdd00470079debe5a8e8f9ef389bfe28a
refs/heads/master
2020-03-31T08:52:56.272986
2019-06-05T20:35:58
2019-06-05T20:35:58
152,075,465
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package me.destro.intellij.plugins.qmaven.maven; import me.destro.intellij.plugins.qmaven.maven.model.Metadata; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.simplexml.SimpleXmlConverterFactory; import retrofit2.http.Path; public class MavenHelper { MavenRepository repository; public MavenHelper(String root) { Retrofit retrofit = new Retrofit.Builder() .baseUrl(root) .addConverterFactory(SimpleXmlConverterFactory.create()) .build(); repository = retrofit.create(MavenRepository.class); } Call<Metadata> mavenMetadata(@Path("group") String group, @Path("artifact") String artifact) { return repository.mavenMetadata(group, artifact); } }
fbc534a6f2c67ed971ca7cbb69ea5772119d438f
dcb5e3fe902847027472d7a6ede3ef55fafb17d0
/src/main/java/com/business/auth/user/UserRepository.java
7ee7ac23ca914c2e69fe0fd467c29acc91799cd2
[]
no_license
Chonnisat/auth_service
2bb47ff75935e54bb2989c8998b34343ea5a749e
4cc930fec8176c29186f12cc5e059720c7682c13
refs/heads/master
2020-04-05T03:22:11.306925
2018-11-08T02:44:07
2018-11-08T02:44:07
156,511,617
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
package com.business.auth.user; import org.springframework.data.repository.CrudRepository; public interface UserRepository extends CrudRepository<User, Long> { }
59ee24aeeab2b6ef236d3705c35a77f108d74cb2
a23deb819d606bca6641b72e6a1bf4279f2e50d4
/app/src/main/java/example/emre/com/haberlerexample/Models/Emoji.java
771505ba47f4b1352dbcd388c8a081fbb455cfbf
[]
no_license
emresutuna/haberlerexample
df01dbab8b509f1c5c0d171960d5efa50696d8a2
cb6f8bff39f2aff7d083dbf0d12d9efee1815435
refs/heads/main
2023-01-06T23:33:19.866248
2020-10-30T16:45:46
2020-10-30T16:45:46
308,009,700
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package example.emre.com.haberlerexample.Models; public class Emoji { private long loved; private long clappingHand; private long thumbsDown; private long smiling; private long crying; private long angry; private long suprised; public long getLoved() { return loved; } public void setLoved(long value) { this.loved = value; } public long getClappingHand() { return clappingHand; } public void setClappingHand(long value) { this.clappingHand = value; } public long getThumbsDown() { return thumbsDown; } public void setThumbsDown(long value) { this.thumbsDown = value; } public long getSmiling() { return smiling; } public void setSmiling(long value) { this.smiling = value; } public long getCrying() { return crying; } public void setCrying(long value) { this.crying = value; } public long getAngry() { return angry; } public void setAngry(long value) { this.angry = value; } public long getSuprised() { return suprised; } public void setSuprised(long value) { this.suprised = value; } }
15db57e838c593daa6ad6431ecdfcdbdd6961358
89da9324c96b4f56bd5fd16fe0e68791d7e00a90
/LudwigCSE148 HW7 (old)/src/p1TextFileGenerators/Course.java
4a2f3708d377b6e374561f875b4517098a4a9e36
[]
no_license
jacksonludwig/CSE148
8d35fa1b5ff802232cd7789a5fb3301b3ef213c9
ae2595d1c3e9951e5742113b3f0e921d92a378d6
refs/heads/master
2022-01-09T19:11:09.152046
2019-04-29T23:00:07
2019-04-29T23:00:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,648
java
package p1TextFileGenerators; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Random; import java.util.Scanner; public class Course { private String courseNumber; private String courseTitle; private int numberOfCredits; private String courseDescription; private String facultyID; private String textbookISBN; private String classroom; private static final int DIGITS_IN_COURSE = 3; private static final int MAX_CREDITS = 4; private static final int MIN_CREDITS = 1; private static final int SIZE_OF_ISBN = 16; private static final int ELMS_OF_ROOM = 4; public Course() throws IOException { courseNumber = generateCourseNumber(); courseTitle = Textbook.generateTitle(); numberOfCredits = generateCredits(); courseDescription = generateDescription(); facultyID = generatefacultyID(); textbookISBN = getISBNFromFile(); classroom = getClassroomNumberFromFile(); } public String generateCourseNumber() { String major = Utilities.generateMajor(); Random rand = new Random(); for (int i = 0; i < DIGITS_IN_COURSE; i++) { major = major + (rand.nextInt(9) + 1); } return major; } public int generateCredits() { Random rand = new Random(); return rand.nextInt(MAX_CREDITS - MIN_CREDITS + 1) + MIN_CREDITS; } public String generateDescription() throws IOException { String description = ""; for (int i = 0; i < 50; i++) { description += Utilities.generateRandomWordFromFile("words.txt") + " "; } return description; } public String generatefacultyID() { String id = ""; Random rand = new Random(); for (int i = 0; i < 9; i++) { id += String.valueOf(rand.nextInt(10)); } return id; } public String getISBNFromFile() throws IOException { String randomLine = Utilities.generateRandomWordFromFile("Textbooks.txt"); String ISBN = ""; for (int i = 0; i < randomLine.length(); i++) { if (Character.isDigit(randomLine.charAt(i)) == true) { for (int j = i; j < i + SIZE_OF_ISBN; j++) { ISBN += randomLine.charAt(j); } break; } } return ISBN; } public String getClassroomNumberFromFile() throws IOException{ String randomLine = Utilities.generateRandomWordFromFile("Classrooms.txt"); String classroom = ""; try { for (int i = 0; i < ELMS_OF_ROOM; i++) { classroom += randomLine.charAt(i); } } catch (Exception e) { e.printStackTrace(); } return classroom; } @Override public String toString() { return courseNumber + "; " + courseTitle + "; " + numberOfCredits + "; " + courseDescription + "; " + facultyID + "; " + textbookISBN + "; " + classroom; } }
6126fd4c91acb08eae0378cedb377941f47d4c88
dede6aaca13e69cb944986fa3f9485f894444cf0
/media-soa/media-soa-provider/src/main/java/com/dangdang/digital/listener/OtherAddBoughtListener.java
3ebea1e90e2ce17866dc90d41b142a6c38294edb
[]
no_license
summerxhf/dang
c0d1e7c2c9436a7c7e7f9c8ef4e547279ec5d441
f1b459937d235637000fb433919a7859dcd77aba
refs/heads/master
2020-03-27T08:32:33.743260
2015-06-03T08:12:45
2015-06-03T08:12:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
949
java
package com.dangdang.digital.listener; import javax.annotation.Resource; import org.apache.log4j.Logger; import com.dangdang.digital.service.IBoughtService; import com.dangdang.digital.vo.AddBoughtMessage; /** * * Description: 除订单外其它情况添加已购信息 * All Rights Reserved. * @version 1.0 2015年1月7日 上午11:23:32 by 许文轩([email protected])创建 */ public class OtherAddBoughtListener { private static final Logger logger = Logger.getLogger(OtherAddBoughtListener.class); @Resource private IBoughtService boughtService; public void handleMessage(AddBoughtMessage addBoughtMessage) { try { logger.info("接收除订单外其它情况添加已购信息消息:" + addBoughtMessage.toString()); // 添加已购信息 boughtService.addBought(addBoughtMessage); } catch (Exception e) { logger.error("除订单外其它情况添加已购信息消息处理异常", e); } } }
cf130dfeec17ef66b5fde045f695fc6fa6cbf5db
81487bc458540a2765212842efbf88c1086b2df1
/src/geekforgeeks/PrintAllCombination.java
acc83df6a3dcd9cbb7454b0153465153a4039a03
[]
no_license
geekamit/sample-spring-cloud
8942d6411bf616cf290ac3050ab453fcab69e7f4
4573e2c1e9e9b65e42eb0301c029bfa3e619d3a2
refs/heads/master
2020-04-29T02:43:48.858632
2019-03-15T08:42:09
2019-03-15T08:42:09
175,781,443
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package geekforgeeks; import java.util.List; class PrintAllCombination { public static void main(String[] args) { new PrintAllCombination().run(); } int N = 5; int[] arr = {2, 3, 5, 7}; int[] vals = new int[N]; void run(){ printCombinations(N, 0, 0); } // from : consider numbers in arr from index "from" // index: add new number in array vals at index "index" void printCombinations(int target, int from, int index){ //System.out.println(target); if(target==0){ for(int i=0; i<index; i++){ System.out.print(vals[i] + " "); } System.out.println(); }else if(target<0 || from>=arr.length){ return; }else { vals[index] = arr[from]; // take arr[from] in set printCombinations(target-arr[from], from, index+1); // dont take arr[from] in set printCombinations(target, from+1, index); } } }
d187371d83be47d6aed5218560d49cd0ea863342
2606c8051b614e8f87cdef65a2d15052a45cfbc8
/walle-core/src/main/java/com/ngnis/walle/core/auth/CheckSign.java
0b4f5b7aa7244fa33ba993f28a0e32d27657daf6
[ "Apache-2.0" ]
permissive
all4you/walle
e6ec33f40d2300939626fdb15c78a3d99b06ae42
c9e20d568bc737325f1b93e4fefac53cbb46f62f
refs/heads/master
2021-06-30T10:05:10.037979
2020-05-14T12:52:04
2020-05-14T12:52:04
247,987,012
24
9
Apache-2.0
2020-10-13T20:43:48
2020-03-17T14:12:19
Java
UTF-8
Java
false
false
371
java
package com.ngnis.walle.core.auth; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * 需要进行sign的校验 * * @author houyi */ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface CheckSign { }
6050b0ade310da1ded284ec83fda287dfc9c3bfa
d615dfabd695f98f01473cb1ddd27ad0715c25c6
/src/test/java/uitesting/upb/org/managepage/personalwallet/TransferPage.java
c260a03cc4a16eac18c790d05aed204e94d6242f
[]
no_license
isadef/auto-GA-v06
4e0a166a2588ffdc5f327dc839c7815095137272
56d96a9b625f1043ec04409bcf609b7e72391ede
refs/heads/develop
2020-05-31T04:45:33.792791
2019-06-27T22:25:44
2019-06-27T22:25:44
190,103,453
0
0
null
2019-06-27T22:25:45
2019-06-04T00:51:56
Java
UTF-8
Java
false
false
1,930
java
package uitesting.upb.org.managepage.personalwallet; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import uitesting.upb.org.manageevents.Events; import uitesting.upb.org.managepage.BasePage; public class TransferPage extends BasePage { @FindBy(id = "amount") protected WebElement amountTransferTextField; @FindBy(id = "btn-transfer") protected WebElement transferButton; @FindBy(id = "msg-error") protected WebElement transferErrorMessage; @FindBy(id = "destinationAccount") protected WebElement destinationAccountSelector; @FindBy(id = "msg-successful") protected WebElement transferSuccessMessage; @FindBy(id = "app") protected WebElement transferTitle; @FindBy(id = "budgetAvailable") protected WebElement budgetFieldDisplay; public TransferPage fillAmountTransferTextField(String amount) { Events.fillField(amountTransferTextField, amount); return this; } public TransferPage clickTransferButton(){ Events.click(transferButton); return this; } public TransferPage selectAccountDestination(String selectorAccountName){ Events.fillField(destinationAccountSelector, selectorAccountName ); return this; } public boolean isTransferErrorMessageVisible() { return Events.isWebElementVisible(transferErrorMessage); } public boolean isTransferSuccessMessageVisible() { return Events.isWebElementVisible(transferSuccessMessage); } public boolean isTransferTitleVisible(){return Events.isWebElementVisible(transferTitle);} public boolean isTransferButtonVisible() {return Events.isWebElementVisible(transferButton);} public boolean isBudgetAvailableFieldVisible() {return Events.isWebElementVisible(budgetFieldDisplay);} public String getBudgetAvailableField() {return Events.getText(budgetFieldDisplay);} }
d75997703e9dd9ff37bfba0a4bbc0478869d6825
0fd49233bf4a132a50342b50bd8cee69bd3061cb
/sell/src/test/java/com/lgx/service/impl/ProductInfoServiceImplTest.java
1b90a4cd955534cc58c48b6ff26a219556c1e925
[]
no_license
1075440322/sell
fc0f964b1599ebbca165559476e08e6715b61d10
bd83ba01550fe3a040314c47f994f7bc91f942ab
refs/heads/master
2020-06-14T04:01:58.654853
2019-07-02T16:01:05
2019-07-02T16:01:05
194,891,460
0
0
null
null
null
null
UTF-8
Java
false
false
2,294
java
package com.lgx.service.impl; import com.lgx.dataobject.ProductInfo; import com.lgx.service.ProductInfoService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.test.context.junit4.SpringRunner; import java.math.BigDecimal; import java.util.List; /** * Created by Administrator on 2019/3/24. */ @RunWith(SpringRunner.class) @SpringBootTest public class ProductInfoServiceImplTest { @Autowired private ProductInfoService productInfoService; @Test public void findOne() throws Exception { ProductInfo productInfo = productInfoService.findOne("66"); System.out.println(productInfo); } @Test public void findUpAll() throws Exception { List<ProductInfo> list = productInfoService.findUpAll(); for (ProductInfo productInfo:list) { System.out.println(productInfo); } } @Test public void findAll() throws Exception { PageRequest pageRequest = PageRequest.of(0,1); Page<ProductInfo> page = productInfoService.findAll(pageRequest); System.out.println(page.getTotalElements()); } @Test public void save() throws Exception { ProductInfo productInfo = new ProductInfo(); productInfo.setProductId("77"); productInfo.setProductName("黄金刷头"); productInfo.setCategoryType(10); productInfo.setProductDescription("非常好用的牙刷头"); productInfo.setProductStatus(Byte.valueOf("1")); productInfo.setProductPrice(new BigDecimal(200)); productInfo.setProductStock(20); productInfoService.save(productInfo); } @Test public void onSale()throws Exception { ProductInfo productInfo = productInfoService.onSale("1"); //Assert.assertTrue("上架成功能",productInfo.getProductStatus()==0); } @Test public void offSale()throws Exception { ProductInfo productInfo = productInfoService.offSale("66"); //Assert.assertTrue("下架成功",productInfo.getProductStatus()==1); } }
170a24e19bcdd569a07ae00b8d5efd6014edb43b
580ddbc2faec587dc95b0b8d56d2f2fef26fa22a
/src/StacksAndQueues/LinkedListQueue.java
4073e17d5e11b83107100ad3f7ef5f37b216cfe9
[]
no_license
peterlulu666/AlgorithmsSedgewickJava
c01fb9bb2f82bbe36a90df25338eb839944753e7
af13f2463e8c734c87805fd4d5925dfe1b93545b
refs/heads/master
2021-02-19T10:24:44.147238
2020-03-11T01:10:47
2020-03-11T01:10:47
245,303,658
0
0
null
null
null
null
UTF-8
Java
false
false
2,974
java
package StacksAndQueues; public class LinkedListQueue<AnyType> { class Node<AnyType> { AnyType data; Node next; //Constructor public Node(AnyType data) { this.data = data; this.next = null; } } Node head; Node tail; int currentSize; //Constructor public LinkedListQueue() { this.head = null; this.tail = null; this.currentSize = 0; } // Add last void enQueue(AnyType data) { // Create a new node var newNode = new Node<AnyType>(data); // If the queue is empty if (currentSize == 0) { // Let the head pointer point to the newNode this.head = newNode; // Let the tail pointer point to the newNode this.tail = newNode; // Increment currentSize this.currentSize++; return; } // If the queue is not empty // Let tail.next point to the newNode this.tail.next = newNode; // Move the tail pointer this.tail = newNode; // Increment the currentSize this.currentSize++; } // Remove first AnyType deQueue() { // If the queue is empty if (this.currentSize == 0) { return null; } // If the queue is not empty // If the queue has one node // Declare removedData and store the data to the removedData var removedData = this.head.data; if (this.currentSize == 1) { // // Let the head pointer point to null // this.head = null; // Let the tail pointer point to null this.tail = null; // // Decrement the currentSize // this.currentSize--; // // Return the removedData // return (AnyType) removedData; } // If the queue has more than one node // Move the head pointer this.head = this.head.next; // Decrement the currentSize this.currentSize--; // Return the removedData return (AnyType) removedData; } void show() { // Declare the tmpPointer and store the head pointer address to the tmpPointer var tmpPointer = this.head; // Declare queueStr var queueStr = ""; for (int i = 0; i < this.currentSize; i++) { // Print the data queueStr = queueStr + tmpPointer.data + " -> "; // Move the tmpPointer tmpPointer = tmpPointer.next; } System.out.println(queueStr + "null"); } public static void main(String[] args) { var linkedListQueue = new LinkedListQueue<Integer>(); linkedListQueue.enQueue(100); linkedListQueue.enQueue(200); System.out.println(linkedListQueue.deQueue()); System.out.println(linkedListQueue.deQueue()); linkedListQueue.show(); } }
a65a87b20c1ff4a4913347d7ce24000d77a22808
fc8e6ec6c61ea6917c3767e3e6f5eab8071af503
/team_project_spring/src/main/java/web/service/LocationService.java
e3c950571d5c0a0c94c559ec6ed2540892da7771
[]
no_license
sokhoda/proff291
3b9fab20351346ff42aee9982f2c9b4bb1840c1b
ca5f640d51378c84d29706d7c194585a63b91aa7
refs/heads/master
2020-04-19T10:48:26.311138
2016-09-10T20:10:37
2016-09-10T20:10:37
67,597,607
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package web.service; import web.domain.Location; import java.util.List; /** * Created by erede on 06.03.2016. */ public interface LocationService { List<Location> findAll(); List showLocationByPortion(int portionSize); }
c3df224ce4a975f8699bd882c2221c4443a5bd46
7de08fd07345abd7e48776e06c1a4827c8b74108
/Eclipse_Examples/Polymorphism/src/com/methodoverloading/task/Axis.java
0cb6f9e2f0c5326ceffff46167d99ece65df3ed5
[]
no_license
desaihp/Java
f6672d6ee37ff15e25952345195a5e40b9097bbc
de6bf04322eabf0fdfbe5cf33078535b1764d96a
refs/heads/master
2021-07-23T18:15:51.746359
2017-11-02T05:25:25
2017-11-02T05:25:25
109,219,284
0
0
null
null
null
null
UTF-8
Java
false
false
60
java
package com.methodoverloading.task; public class Axis { }
fd223b2037be2b4c4b2546f75681247245c91b2a
aea62609830a2198bfe220ca93337f91d309ed54
/src/main/java/com/my/blog/website/controller/common/IndexController.java
0eac30a2719ce417a34d569e925dcac5273bf5fe
[]
no_license
shuchang01/my-blog
0d16d67a78b99649033a500668063023037a213e
c0fb028af66b3008ccb92ba0347d32497db0821a
refs/heads/master
2021-01-21T07:20:17.541414
2017-05-22T03:34:06
2017-05-22T03:34:06
91,610,583
1
1
null
null
null
null
UTF-8
Java
false
false
14,725
java
package com.my.blog.website.controller.common; import java.net.URLEncoder; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageInfo; import com.my.blog.website.constant.WebConst; import com.my.blog.website.dto.ErrorCode; import com.my.blog.website.dto.MetaDto; import com.my.blog.website.enums.TypeEnum; import com.my.blog.website.exception.TipException; import com.my.blog.website.modal.Bo.ArchiveBo; import com.my.blog.website.modal.Bo.CommentBo; import com.my.blog.website.modal.Bo.RestResponseBo; import com.my.blog.website.modal.Vo.CommentVo; import com.my.blog.website.modal.Vo.ContentVo; import com.my.blog.website.modal.Vo.MetaVo; import com.my.blog.website.service.ICommentService; import com.my.blog.website.service.IContentService; import com.my.blog.website.service.IMetaService; import com.my.blog.website.service.ISiteService; import com.my.blog.website.utils.IPKit; import com.my.blog.website.utils.PatternKit; import com.my.blog.website.utils.TaleUtils; import com.vdurmont.emoji.EmojiParser; /** * 首页 * Created by Administrator on 2017/3/8 008. */ @Controller public class IndexController extends AbstractBaseController { private static final Logger LOGGER = LoggerFactory.getLogger(IndexController.class); @Resource private IContentService contentService; @Resource private ICommentService commentService; @Resource private IMetaService metaService; @Resource private ISiteService siteService; /** * 首页 * * @return */ @GetMapping(value = "/") public String index(HttpServletRequest request, @RequestParam(value = "limit", defaultValue = "12") int limit) { return this.index(request, 1, limit); } /** * 首页分页 * * @param request request * @param p 第几页 * @param limit 每页大小 * @return 主页 */ @GetMapping(value = "page/{p}") public String index(HttpServletRequest request, @PathVariable int p, @RequestParam(value = "limit", defaultValue = "12") int limit) { p = p < 0 || p > WebConst.MAX_PAGE ? 1 : p; PageInfo<ContentVo> articles = contentService.getContents(p, limit); request.setAttribute("articles", articles); if (p > 1) { this.title(request, "第" + p + "页"); } return this.render("index"); } /** * 文章页 * * @param request 请求 * @param cid 文章主键 * @return */ @GetMapping(value = {"article/{cid}", "article/{cid}.html"}) public String getArticle(HttpServletRequest request, @PathVariable String cid) { ContentVo contents = contentService.getContents(cid); if (null == contents || "draft".equals(contents.getStatus())) { return this.render_404(); } request.setAttribute("article", contents); request.setAttribute("is_post", true); completeArticle(request, contents); updateArticleHit(contents.getCid(), contents.getHits()); return this.render("post"); } /** * 文章页(预览) * * @param request 请求 * @param cid 文章主键 * @return */ @GetMapping(value = {"article/{cid}/preview", "article/{cid}.html"}) public String articlePreview(HttpServletRequest request, @PathVariable String cid) { ContentVo contents = contentService.getContents(cid); if (null == contents) { return this.render_404(); } request.setAttribute("article", contents); request.setAttribute("is_post", true); completeArticle(request, contents); updateArticleHit(contents.getCid(), contents.getHits()); return this.render("post"); } /** * 抽取公共方法 * * @param request * @param contents */ private void completeArticle(HttpServletRequest request, ContentVo contents) { if (contents.getAllowComment()) { String cp = request.getParameter("cp"); if (StringUtils.isBlank(cp)) { cp = "1"; } request.setAttribute("cp", cp); PageInfo<CommentBo> commentsPaginator = commentService.getComments(contents.getCid(), Integer.parseInt(cp), 6); request.setAttribute("comments", commentsPaginator); } } /** * 注销 * * @param session * @param response */ @RequestMapping("logout") public void logout(HttpSession session, HttpServletResponse response) { TaleUtils.logout(session, response); } /** * 评论操作 */ @SuppressWarnings("rawtypes") @PostMapping(value = "comment") @ResponseBody @Transactional(rollbackFor = TipException.class) public RestResponseBo comment(HttpServletRequest request, HttpServletResponse response, @RequestParam Integer cid, @RequestParam Integer coid, @RequestParam String author, @RequestParam String mail, @RequestParam String url, @RequestParam String text, @RequestParam String _csrf_token) { String ref = request.getHeader("Referer"); if (StringUtils.isBlank(ref) || StringUtils.isBlank(_csrf_token)) { return RestResponseBo.fail(ErrorCode.BAD_REQUEST); } String token = cache.hget(TypeEnum.CSRF_TOKEN.getType(), _csrf_token); if (StringUtils.isBlank(token)) { return RestResponseBo.fail(ErrorCode.BAD_REQUEST); } if (null == cid || StringUtils.isBlank(text)) { return RestResponseBo.fail("请输入完整后评论"); } if (StringUtils.isNotBlank(author) && author.length() > 50) { return RestResponseBo.fail("姓名过长"); } if (StringUtils.isNotBlank(mail) && !TaleUtils.isEmail(mail)) { return RestResponseBo.fail("请输入正确的邮箱格式"); } if (StringUtils.isNotBlank(url) && !PatternKit.isURL(url)) { return RestResponseBo.fail("请输入正确的URL格式"); } if (text.length() > 200) { return RestResponseBo.fail("请输入200个字符以内的评论"); } String val = IPKit.getIpAddrByRequest(request) + ":" + cid; Integer count = cache.hget(TypeEnum.COMMENTS_FREQUENCY.getType(), val); if (null != count && count > 0) { return RestResponseBo.fail("您发表评论太快了,请过会再试"); } author = TaleUtils.cleanXSS(author); text = TaleUtils.cleanXSS(text); author = EmojiParser.parseToAliases(author); text = EmojiParser.parseToAliases(text); CommentVo comments = new CommentVo(); comments.setAuthor(author); comments.setCid(cid); comments.setIp(request.getRemoteAddr()); comments.setUrl(url); comments.setContent(text); comments.setMail(mail); comments.setParent(coid); try { commentService.insertComment(comments); cookie("tale_remember_author", URLEncoder.encode(author, "UTF-8"), 7 * 24 * 60 * 60, response); cookie("tale_remember_mail", URLEncoder.encode(mail, "UTF-8"), 7 * 24 * 60 * 60, response); if (StringUtils.isNotBlank(url)) { cookie("tale_remember_url", URLEncoder.encode(url, "UTF-8"), 7 * 24 * 60 * 60, response); } // 设置对每个文章1分钟可以评论一次 cache.hset(TypeEnum.COMMENTS_FREQUENCY.getType(), val, 1, 60); return RestResponseBo.ok(); } catch (Exception e) { String msg = "评论发布失败"; if (e instanceof TipException) { msg = e.getMessage(); } else { LOGGER.error(msg, e); } return RestResponseBo.fail(msg); } } /** * 分类页 * * @return */ @GetMapping(value = "category/{keyword}") public String categories(HttpServletRequest request, @PathVariable String keyword, @RequestParam(value = "limit", defaultValue = "12") int limit) { return this.categories(request, keyword, 1, limit); } @GetMapping(value = "category/{keyword}/{page}") public String categories(HttpServletRequest request, @PathVariable String keyword, @PathVariable int page, @RequestParam(value = "limit", defaultValue = "12") int limit) { page = page < 0 || page > WebConst.MAX_PAGE ? 1 : page; MetaDto metaDto = metaService.getMeta(TypeEnum.CATEGORY.getType(), keyword); if (null == metaDto) { return this.render_404(); } PageInfo<ContentVo> contentsPaginator = contentService.getArticles(metaDto.getMid(), page, limit); request.setAttribute("articles", contentsPaginator); request.setAttribute("meta", metaDto); request.setAttribute("type", "分类"); request.setAttribute("keyword", keyword); return this.render("page-category"); } /** * 归档页 * * @return */ @GetMapping(value = "archives") public String archives(HttpServletRequest request) { List<ArchiveBo> archives = siteService.getArchives(); request.setAttribute("archives", archives); return this.render("archives"); } /** * 友链页 * * @return */ @GetMapping(value = "links") public String links(HttpServletRequest request) { List<MetaVo> links = metaService.getMetas(TypeEnum.LINK.getType()); request.setAttribute("links", links); return this.render("links"); } /** * 自定义页面,如关于的页面 */ @GetMapping(value = "/{pagename}") public String page(@PathVariable String pagename, HttpServletRequest request) { ContentVo contents = contentService.getContents(pagename); if (null == contents) { return this.render_404(); } if (contents.getAllowComment()) { String cp = request.getParameter("cp"); if (StringUtils.isBlank(cp)) { cp = "1"; } PageInfo<CommentBo> commentsPaginator = commentService.getComments(contents.getCid(), Integer.parseInt(cp), 6); request.setAttribute("comments", commentsPaginator); } request.setAttribute("article", contents); updateArticleHit(contents.getCid(), contents.getHits()); return this.render("page"); } /** * 搜索页 * * @param keyword * @return */ @GetMapping(value = "search/{keyword}") public String search(HttpServletRequest request, @PathVariable String keyword, @RequestParam(value = "limit", defaultValue = "12") int limit) { return this.search(request, keyword, 1, limit); } @GetMapping(value = "search/{keyword}/{page}") public String search(HttpServletRequest request, @PathVariable String keyword, @PathVariable int page, @RequestParam(value = "limit", defaultValue = "12") int limit) { page = page < 0 || page > WebConst.MAX_PAGE ? 1 : page; PageInfo<ContentVo> articles = contentService.getArticles(keyword, page, limit); request.setAttribute("articles", articles); request.setAttribute("type", "搜索"); request.setAttribute("keyword", keyword); return this.render("page-category"); } /** * 更新文章的点击率 * * @param cid * @param chits */ @Transactional(rollbackFor = TipException.class) private void updateArticleHit(Integer cid, Integer chits) { Integer hits = cache.hget("article", "hits"); if (chits == null) { chits = 0; } hits = null == hits ? 1 : hits + 1; if (hits >= WebConst.HIT_EXCEED) { ContentVo temp = new ContentVo(); temp.setCid(cid); temp.setHits(chits + hits); contentService.updateContentByCid(temp); cache.hset("article", "hits", 1); } else { cache.hset("article", "hits", hits); } } /** * 标签页 * * @param name * @return */ @GetMapping(value = "tag/{name}") public String tags(HttpServletRequest request, @PathVariable String name, @RequestParam(value = "limit", defaultValue = "12") int limit) { return this.tags(request, name, 1, limit); } /** * 标签分页 * * @param request * @param name * @param page * @param limit * @return */ @GetMapping(value = "tag/{name}/{page}") public String tags(HttpServletRequest request, @PathVariable String name, @PathVariable int page, @RequestParam(value = "limit", defaultValue = "12") int limit) { page = page < 0 || page > WebConst.MAX_PAGE ? 1 : page; // 对于空格的特殊处理 name = name.replaceAll("\\+", " "); MetaDto metaDto = metaService.getMeta(TypeEnum.TAG.getType(), name); if (null == metaDto) { return this.render_404(); } PageInfo<ContentVo> contentsPaginator = contentService.getArticles(metaDto.getMid(), page, limit); request.setAttribute("articles", contentsPaginator); request.setAttribute("meta", metaDto); request.setAttribute("type", "标签"); request.setAttribute("keyword", name); return this.render("page-category"); } /** * 设置cookie * * @param name * @param value * @param maxAge * @param response */ private void cookie(String name, String value, int maxAge, HttpServletResponse response) { Cookie cookie = new Cookie(name, value); cookie.setMaxAge(maxAge); cookie.setSecure(false); response.addCookie(cookie); } }
b446d7c7b74892e1165a44208fd03b9fc4351963
690469d2fb9c188fd4b0d765413f4f4da7d1cee9
/app/src/androidTest/java/com/geektech/homeworkdesing/ExampleInstrumentedTest.java
927459b1090b81aed2e33b778188dfc3b025d95b
[]
no_license
adiiq535/AdiletKubatbekUULU
be6ae4a6499a462f56dcdbb66c4980fd3167ac6d
fd4a1a579c0bb4c3f1cbd939fdca6eb01a050e9d
refs/heads/master
2022-11-26T17:22:28.278000
2020-08-09T13:35:20
2020-08-09T13:35:20
286,246,332
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.geektech.homeworkdesing; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.geektech.homeworkdesing", appContext.getPackageName()); } }
01285961631c7aff54947113befcf1043d235e69
72a5a0e1800b154fe0af0b3e3e35a99e2a717dfa
/app/src/main/java/com/inc/kobbigal/meores/adapters/EventAdapter.java
b53bca668017768263d35fc3f1ada2d5b2310cc7
[]
no_license
kbbgl/MeoRes
e38d19aa6556804c5921566c5722eeaa62dab825
35525093a1b402c7be29076e170ea5aa4f8ce7e0
refs/heads/master
2021-08-10T17:51:05.165250
2017-11-12T21:25:22
2017-11-12T21:25:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,782
java
package com.inc.kobbigal.meores.adapters; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.inc.kobbigal.meores.Event; import com.inc.kobbigal.meores.R; import java.util.List; public class EventAdapter extends RecyclerView.Adapter<EventAdapter.EventViewHolder> { private List<Event> events; private OnEventClickListener callback; public EventAdapter(List<Event> events) { this.events = events; } @Override public EventViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View rootView = LayoutInflater.from(parent.getContext()).inflate(R.layout.event_list_row, parent, false); return new EventViewHolder(rootView); } @Override public void onBindViewHolder(EventViewHolder holder, int position) { Event event = events.get(position); holder.title.setText(event.getName()); holder.location.setText(event.getLocation()); holder.date.setText(event.getDate()); holder.time.setText(event.getTime()); } @Override public int getItemCount() { return events.size(); } @Override public int getItemViewType(int position) { return super.getItemViewType(position); } public void setCallback(OnEventClickListener callback) { this.callback = callback; } public interface OnEventClickListener { void onEventClick(int position, View view); void oneEventLongClick(int position, View view); } class EventViewHolder extends RecyclerView.ViewHolder { View statusBar; TextView title; TextView location; TextView date; TextView time; EventViewHolder(View itemView) { super(itemView); this.statusBar = itemView.findViewById(R.id.status_bar); this.title = itemView.findViewById(R.id.event_title); this.location = itemView.findViewById(R.id.event_location); this.date = itemView.findViewById(R.id.event_date); this.time = itemView.findViewById(R.id.event_time); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { callback.onEventClick(getAdapterPosition(), view); } }); itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { callback.oneEventLongClick(getAdapterPosition(), view); return true; } }); } } }
7f6282babbf6b0c6bd5ffb6b8d8fe4468c587247
6d5f9b8c702e97d7e93fcc071aa7f723bc6b5557
/lab3/src/game/view/AttackModePanel.java
0ea7d212d984b417847c2827bf3579947746c5ce
[]
no_license
Duxat/oop_java
26344f73e661104ee716a980b0a18de77df21ccf
bcd3f64ccb60d5f894e9116cbb6046bd965d75b3
refs/heads/master
2021-05-17T05:38:55.271673
2020-10-20T13:19:52
2020-10-20T13:19:52
250,653,840
0
0
null
null
null
null
UTF-8
Java
false
false
4,189
java
package game.view; import game.control.reactor.AfterTurnReactor; import game.view.field.AttackFieldPanel; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class AttackModePanel extends JPanel { private GUI gui; private ScoreTablePanel scoreTable; private AttackFieldPanel currPanel; private AttackFieldPanel nextPanel; private String shootState = " SHOOTS"; private String winState = " WINS!"; private AfterTurnReactor reactor; private JLabel label = new JLabel(); private JButton finish = new JButton("FINISH"); private JPanel twoFields = new JPanel(new GridLayout(1, 0, 25, 0)); private GridBagConstraints constraints = new GridBagConstraints(); Timer timer; private ActionListener timerListener1 = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { label.setText(currPanel.getOwnerName() + shootState); currPanel.changeBorderColor(0); nextPanel.changeBorderColor(1); revalidate(); repaint(); if (reactor != null) { reactor.react(); } } }; private ActionListener timerListener2 = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { currPanel.unlockField(); label.setText(currPanel.getOwnerName() + winState); ((Timer) e.getSource()).removeActionListener(this); ((Timer) e.getSource()).removeActionListener(timerListener1); } }; private ActionListener listener1 = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(gui, "Are you sure?", "Finish is pressed", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { if (reactor != null) { reactor.shutDown(); } gui.run(); } } }; private ActionListener listener2 = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((JButton)e.getSource()).removeActionListener(this); ((JButton)e.getSource()).addActionListener(listener1); gui.run(); } }; public AttackModePanel(GUI gui, ScoreTablePanel scoreTable) { this.gui = gui; this.scoreTable = scoreTable; setLayout(new GridBagLayout()); finish.addActionListener(listener1); add(label, constraints); constraints.gridy = 1; constraints.insets.top = 40; add(twoFields, constraints); constraints.gridy = 2; add(finish, constraints); } public void prepare(AttackFieldPanel player1, AttackFieldPanel player2, AfterTurnReactor reactor) { this.reactor = reactor; currPanel = player1; nextPanel = player2; nextPanel.changeBorderColor(1); currPanel.setEnabled(false); label.setText(currPanel.getOwnerName() + shootState); twoFields.removeAll(); twoFields.add(player1); twoFields.add(player2); timer = new Timer(500, timerListener1); timer.setRepeats(false); if (reactor != null) { reactor.react(); } } public void changeActivePlayer() { currPanel.setEnabled(true); nextPanel.setEnabled(false); AttackFieldPanel tempPanel = currPanel; currPanel = nextPanel; nextPanel = tempPanel; timer.start(); } public void winAlert() { nextPanel.setEnabled(false); finish.removeActionListener(listener1); finish.addActionListener(listener2); scoreTable.update(currPanel.getOwnerName()); timer.removeActionListener(timerListener1); timer.addActionListener(timerListener2); timer.start(); } }
5e39267878d7188a469a30398320f958be2fd7c4
e633da0ea501f99e0c5545a33d0d8a2f8aea71ac
/app/src/main/java/com/dennistjahyadigotama/soaya/activities/CalendarActivity/adapter/CalendarListAdapter.java
d8a9e4665d2a12570ba8e9e75a539ca7dbf58682
[]
no_license
dennistjahyadi/Soaya
71c83757630c16ced778d19c37fc458f4b6aaaa9
46bb1bfb4ed46797e0b2a770540de9b87d22e8a6
refs/heads/master
2023-03-10T16:33:19.548924
2023-03-01T03:26:49
2023-03-01T03:26:49
113,689,100
0
0
null
null
null
null
UTF-8
Java
false
false
4,252
java
package com.dennistjahyadigotama.soaya.activities.CalendarActivity.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.dennistjahyadigotama.soaya.R; import com.dennistjahyadigotama.soaya.activities.CalendarActivity.CalendarActivity; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; /** * Created by Denn on 9/2/2016. */ public class CalendarListAdapter extends RecyclerView.Adapter<CalendarListAdapter.MyViewHolder>{ List<CalenderGetter> calenderGetterList; CalendarActivity calendarActivity; Context context; class MyViewHolder extends RecyclerView.ViewHolder { TextView tvEvent,tvTanggal; LinearLayout lin; public MyViewHolder(View itemView) { super(itemView); context = itemView.getContext(); tvEvent = (TextView)itemView.findViewById(R.id.textViewEvent); tvTanggal = (TextView)itemView.findViewById(R.id.textViewTanggal); lin = (LinearLayout) itemView.findViewById(R.id.lin); } } public CalendarListAdapter(List<CalenderGetter> calenderGetters,CalendarActivity calendarActivity) { this.calenderGetterList = calenderGetters; this.calendarActivity = calendarActivity; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.calenderlist_view,parent,false); return new MyViewHolder(view); } @Override public void onBindViewHolder(MyViewHolder holder, int position) { final CalenderGetter calenderGetter = calenderGetterList.get(position); holder.tvEvent.setText(calenderGetter.getEvent()); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyy-MM-dd"); try { Date date1 = simpleDateFormat.parse(calenderGetter.getTanggal1()); Date date2 = simpleDateFormat.parse(calenderGetter.getTanggal2()); final String dayOfTheWeek1 = (String) android.text.format.DateFormat.format("EEEE", date1);//Thursday final String stringMonth1 = (String) android.text.format.DateFormat.format("MMM", date1); //Jun final String intMonth1 = (String) android.text.format.DateFormat.format("MM", date1); //06 final String year1 = (String) android.text.format.DateFormat.format("yyyy", date1); //2013 final String day1 = (String) android.text.format.DateFormat.format("dd", date1); final String dayOfTheWeek2 = (String) android.text.format.DateFormat.format("EEEE", date2);//Thursday final String stringMonth2 = (String) android.text.format.DateFormat.format("MMM", date2); //Jun final String intMonth2 = (String) android.text.format.DateFormat.format("MM", date2); //06 final String year2 = (String) android.text.format.DateFormat.format("yyyy", date2); //2013 final String day2 = (String) android.text.format.DateFormat.format("dd", date2); if(calenderGetter.getTanggal1().equals(calenderGetter.getTanggal2())) { holder.tvTanggal.setText(day1+" "+stringMonth1+" "+year1); }else { holder.tvTanggal.setText(day1+" "+stringMonth1+" "+year1+" s.d. "+day2+" "+stringMonth2+" "+year2); } } catch (ParseException e) { e.printStackTrace(); } holder.lin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Date date1; try { date1 = simpleDateFormat.parse(calenderGetter.getTanggal1()); calendarActivity.caldroidFragment.moveToDate(date1); } catch (ParseException e) { e.printStackTrace(); } } }); } @Override public int getItemCount() { return calenderGetterList.size(); } }
d812c82dbbc8b7ac762efbffd70ab1da48308b02
2e590ef886718e01d7ec58beff00a28d7aa9a366
/source-code/java/systest/src/gov/nasa/kepler/aft/pdq/PdqThirdContactTest.java
6427b7c1669b0c14d08402cfd6fb6b2d286afbde
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
adam-sweet/kepler-pipeline
95a6cbc03dd39a8289b090fb85cdfc1eb5011fd9
f58b21df2c82969d8bd3e26a269bd7f5b9a770e1
refs/heads/master
2022-06-07T21:22:33.110291
2020-05-06T01:12:08
2020-05-06T01:12:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,480
java
/* * Copyright 2017 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * * This file is available under the terms of the NASA Open Source Agreement * (NOSA). You should have received a copy of this agreement with the * Kepler source code; see the file NASA-OPEN-SOURCE-AGREEMENT.doc. * * No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY * WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, * INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE * WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM * INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR * FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM * TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, * CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT * OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY * OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. * FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES * REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, * AND DISTRIBUTES IT "AS IS." * * Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS * AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND * SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF * THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, * EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM * PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT * SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED * STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY * PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE * REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL * TERMINATION OF THIS AGREEMENT. */ package gov.nasa.kepler.aft.pdq; /** * PDQ AFT for processing all the reference pixel files received in the third * contact for the relevant reference pixel target table. * * @author Forrest Girouard */ public class PdqThirdContactTest extends PdqMultiContactTest { public PdqThirdContactTest() { super("ThirdContact"); } @Override protected int getContactCount() { return 3; } }
9cf96fdcd53d29dc6aa48e5765f421e72e2c61b9
931ae35cd1ac2fa338defbc373fdf4478da607b8
/src/main/java/it/hqsolutions/lastminute/exercise/logging/LoggingWithAspect.java
d44eac484de4d37cee408d9c0b56d90617d85a4b
[]
no_license
HQSoftware-J/lastminute-exercise-prj
b459f0c5ebec970bc617fff2b2cea7d439d51408
e3cbbfcba6a51554d3fd4ec1ad112118574060f9
refs/heads/master
2021-01-20T20:35:59.541287
2016-06-21T06:46:50
2016-06-21T06:46:50
61,149,952
0
0
null
null
null
null
UTF-8
Java
false
false
6,584
java
package it.hqsolutions.lastminute.exercise.logging; import java.text.SimpleDateFormat; import java.util.Date; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import ch.qos.logback.classic.Level; @Configurable @Component @Aspect public class LoggingWithAspect { private static Logger logger = LoggerFactory.getLogger("HQSLogProfiler"); private static final int logLevel = ((ch.qos.logback.classic.Logger) logger).getEffectiveLevel().toInt(); private static ObjectMapper mapper = null; @Value("${logging.dao.public.meth}") private String logDaoPubMeth; @Value("${logging.dao.public.meth.io}") private String logDaoPubMethIO; @Value("${logging.dao.protected.meth}") private String logDaoProtMeth; @Value("${logging.dao.protected.meth.io}") private String logDaoProtMethIO; @Value("${logging.dao.private.meth}") private String logDaoPrivMeth; @Value("${logging.dao.private.meth.io}") private String logDaoPrivMethIO; @Value("${logging.bl.public.meth}") private String logBlPubMeth; @Value("${logging.bl.public.meth.io}") private String logBlPubMethIO; @Value("${logging.bl.protected.meth}") private String logBlProtMeth; @Value("${logging.bl.protected.meth.io}") private String logBlProtMethIO; @Value("${logging.bl.private.meth}") private String logBlPrivMeth; @Value("${logging.bl.private.meth.io}") private String logBlPrivMethIO; @Value("${logging.systemout}") private String logSystemOut; private ObjectMapper getMapper() { if (mapper == null) { mapper = new ObjectMapper(); mapper.setSerializationInclusion(Include.NON_EMPTY); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } return mapper; } @Around("within(*..persistence.dao.implementation..*) && execution(public * * (..))") public Object perfAndIODAOPublicMeth(ProceedingJoinPoint joinPoint) throws Throwable { return checkPerfAndIO(joinPoint, logDaoPubMeth, logDaoPubMethIO); } @Around("within(*..persistence.dao.implementation..*) && execution(protected * * (..))") public Object perfAndIODAOProtMeth(ProceedingJoinPoint joinPoint) throws Throwable { return checkPerfAndIO(joinPoint, logDaoProtMeth, logDaoProtMethIO); } @Around("within(*..persistence.dao.implementation..*) && execution(private * * (..))") public Object perfAndIODAOPrivMeth(ProceedingJoinPoint joinPoint) throws Throwable { return checkPerfAndIO(joinPoint, logDaoPrivMeth, logDaoPrivMethIO); } @Around("within(*..bl.bo.implementation..*) && execution(public * * (..))") public Object perfAndIOBusSvcPublicMeth(ProceedingJoinPoint joinPoint) throws Throwable { return checkPerfAndIO(joinPoint, logBlPubMeth, logBlPubMethIO); } @Around("within(*..bl.bo.implementation..*) && execution(protected * * (..))") public Object perfAndIOBusSvcProtMeth(ProceedingJoinPoint joinPoint) throws Throwable { return checkPerfAndIO(joinPoint, logBlProtMeth, logBlProtMethIO); } @Around("within(*..bl.bo.implementation..*) && execution(private * * (..))") public Object perfAndIOBusSvcPrivMeth(ProceedingJoinPoint joinPoint) throws Throwable { return checkPerfAndIO(joinPoint, logBlPrivMeth, logBlPrivMethIO); } public Object checkPerfAndIO(ProceedingJoinPoint joinPoint, String logMethLevel, String logIOLevel) throws Throwable { boolean traceIO = false; // NOOP if (logLevel > Level.toLevel(logMethLevel).toInt()) { return joinPoint.proceed(); } traceIO = logLevel <= Level.toLevel(logIOLevel).toInt(); return perfAndIO(joinPoint, traceIO, logMethLevel); } public Object perfAndIO(ProceedingJoinPoint joinPoint, boolean traceIO, String logMethLevel) throws Throwable { String meth = retrieveFQNMethod(joinPoint); String income = traceIO ? retrieveInputArgs(joinPoint.getArgs()) : "(..)"; String message = meth + income; logAtlevel(logMethLevel, message); long start = System.currentTimeMillis(); Object outcomeObj = joinPoint.proceed(); long elapsedTime = System.currentTimeMillis() - start; String outcome = "(N/A)"; try { outcome = traceIO ? outcomeObj == null ? "" : getMapper().writeValueAsString(outcomeObj) : "(..)"; message = meth + ":" + outcome + "(" + elapsedTime + "ms)"; } catch (Throwable t) { if (logger.isErrorEnabled()) { logger.error("Error logging: ", t.getMessage()); } } logAtlevel(logMethLevel, message); return outcomeObj; } private void logAtlevel(String logMethLevel, String message) { switch (Level.toLevel(logMethLevel).toInt()) { case Level.TRACE_INT: logger.trace(message); break; case Level.DEBUG_INT: logger.debug(message); break; case Level.INFO_INT: logger.info(message); break; // Sounds weird if you configure a level higher than INFO but... case Level.WARN_INT: logger.warn(message); break; case Level.ERROR_INT: logger.error(message); break; } if (logLevel <= Level.toLevel(logSystemOut).toInt()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); String date = sdf.format(new Date()); long threadId = Thread.currentThread().getId(); System.out.println(message); } } private String retrieveInputArgs(Object[] args) { StringBuffer buffer = new StringBuffer(); buffer.append("("); for (int i = 0; i < args.length; i++) { Object arg = args[i]; try { String argToWrite = getMapper().writeValueAsString(arg); buffer.append(argToWrite); } catch (JsonProcessingException e) { StackTraceElement[] elements = e.getStackTrace(); logger.error("AspectLoggingException:" + elements[0] + "\n" + elements[1]); } if (i != args.length - 1) { buffer.append(","); } } buffer.append(")"); return buffer.toString(); } private String retrieveFQNMethod(ProceedingJoinPoint joinPoint) { String className = joinPoint.getSignature().getDeclaringTypeName(); String method = joinPoint.getSignature().getName(); return className + "." + method; } }
a94410fbae6e937c8075b2df38ff6a6b2b5d6ba8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/29/29_48effa8d2d0f1db28d59f8275641468923259357/AMQ2584Test/29_48effa8d2d0f1db28d59f8275641468923259357_AMQ2584Test_t.java
6ac447eefe906adbc90cfe68572f966311deeeee
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,449
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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.bugs; import java.util.Properties; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.MessageProducer; import javax.jms.Session; import junit.framework.Test; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.jmx.BrokerView; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.store.PersistenceAdapter; import org.apache.activemq.util.IntrospectionSupport; import org.apache.activemq.util.Wait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class AMQ2584Test extends org.apache.activemq.TestSupport { static final Logger LOG = LoggerFactory.getLogger(AMQ2584Test.class); BrokerService broker = null; ActiveMQTopic topic; ActiveMQConnection consumerConnection = null, producerConnection = null; Session producerSession; MessageProducer producer; final int minPercentUsageForStore = 10; String data; public static Test suite() { return suite(AMQ2584Test.class); } public void initCombosForTestSize() throws Exception { this.addCombinationValues("defaultPersistenceAdapter", new Object[]{ PersistenceAdapterChoice.LevelDB, PersistenceAdapterChoice.KahaDB }); } public void testSize() throws Exception { CountDownLatch redeliveryConsumerLatch = new CountDownLatch(15000 -1); openConsumer(redeliveryConsumerLatch); assertEquals(0, broker.getAdminView().getStorePercentUsage()); for (int i = 0; i < 5000; i++) { sendMessage(false); } final BrokerView brokerView = broker.getAdminView(); broker.getSystemUsage().getStoreUsage().isFull(); LOG.info("store percent usage: "+brokerView.getStorePercentUsage()); assertTrue("some store in use", broker.getAdminView().getStorePercentUsage() > minPercentUsageForStore); assertTrue("redelivery consumer got all it needs", redeliveryConsumerLatch.await(60, TimeUnit.SECONDS)); closeConsumer(); // consume from DLQ final CountDownLatch received = new CountDownLatch(5000 -1); consumerConnection = (ActiveMQConnection) createConnection(); Session dlqSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer dlqConsumer = dlqSession.createConsumer(new ActiveMQQueue("ActiveMQ.DLQ")); dlqConsumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { if (received.getCount() % 500 == 0) { LOG.info("remaining on DLQ: " + received.getCount()); } received.countDown(); } }); consumerConnection.start(); assertTrue("Not all messages reached the DLQ", received.await(60, TimeUnit.SECONDS)); assertTrue("Store usage exceeds expected usage", Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisified() throws Exception { broker.getSystemUsage().getStoreUsage().isFull(); LOG.info("store precent usage: "+brokerView.getStorePercentUsage()); return broker.getAdminView().getStorePercentUsage() < minPercentUsageForStore; } })); closeConsumer(); } private void openConsumer(final CountDownLatch latch) throws Exception { consumerConnection = (ActiveMQConnection) createConnection(); consumerConnection.setClientID("cliID"); consumerConnection.start(); final Session session = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageListener listener = new MessageListener() { @Override public void onMessage(Message message) { latch.countDown(); try { session.recover(); } catch (Exception ignored) { ignored.printStackTrace(); } } }; session.createDurableSubscriber(topic, "subName1").setMessageListener(listener); session.createDurableSubscriber(topic, "subName2").setMessageListener(listener); session.createDurableSubscriber(topic, "subName3").setMessageListener(listener); } private void closeConsumer() throws JMSException { if (consumerConnection != null) consumerConnection.close(); consumerConnection = null; } private void sendMessage(boolean filter) throws Exception { if (producerConnection == null) { producerConnection = (ActiveMQConnection) createConnection(); producerConnection.start(); producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); producer = producerSession.createProducer(topic); } Message message = producerSession.createMessage(); message.setStringProperty("data", data); producer.send(message); } private void startBroker(boolean deleteMessages) throws Exception { broker = new BrokerService(); broker.setAdvisorySupport(false); broker.setBrokerName("testStoreSize"); if (deleteMessages) { broker.setDeleteAllMessagesOnStartup(true); } setDefaultPersistenceAdapter(broker); configurePersistenceAdapter(broker.getPersistenceAdapter()); broker.getSystemUsage().getStoreUsage().setLimit(200 * 1000 * 1000); broker.start(); } private void configurePersistenceAdapter(PersistenceAdapter persistenceAdapter) { Properties properties = new Properties(); String maxFileLengthVal = String.valueOf(1 * 1024 * 1024); properties.put("journalMaxFileLength", maxFileLengthVal); properties.put("maxFileLength", maxFileLengthVal); properties.put("cleanupInterval", "2000"); properties.put("checkpointInterval", "2000"); IntrospectionSupport.setProperties(persistenceAdapter, properties); } private void stopBroker() throws Exception { if (broker != null) broker.stop(); broker = null; } @Override protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { return new ActiveMQConnectionFactory("vm://testStoreSize?jms.watchTopicAdvisories=false&jms.redeliveryPolicy.maximumRedeliveries=0&jms.closeTimeout=60000&waitForStart=5000&create=false"); } @Override protected void setUp() throws Exception { super.setUp(); StringBuilder sb = new StringBuilder(5000); for (int i = 0; i < 5000; i++) { sb.append('a'); } data = sb.toString(); startBroker(true); topic = (ActiveMQTopic) createDestination(); } @Override protected void tearDown() throws Exception { stopBroker(); super.tearDown(); } }
a06560e5c3419567b39cd38d6939a27ef75b8ec8
32b643f7b552396b49c88e3d04064a25d5edb36b
/app/src/main/java/com/inz/bean/CameraItemBean.java
1a444c5ede196af6904eed8eda1f68ece035e5dd
[]
no_license
Bjelijah/INZ4G
a6831bda3d5c9b3be50a71c549b619ed98f8852c
0405cb2e5467e9357f0ead699f6163b2c181afd0
refs/heads/master
2020-06-25T10:08:44.002123
2018-02-01T05:00:13
2018-02-01T05:00:13
96,971,762
0
0
null
null
null
null
UTF-8
Java
false
false
3,326
java
package com.inz.bean; import java.io.Serializable; /** * Created by howell on 2016/11/18. */ public class CameraItemBean implements Serializable { private PlayType type; private String cameraName; private String cameraDescription; private String deviceId; private int channelNo; private boolean isOnline; private boolean isPtz; private boolean isStore; private String deVer; private String model; private int indensity; private String picturePath; private String upnpIP; // for ap private int upnpPort; private int methodType; public int getMethodType() { return methodType; } public CameraItemBean setMethodType(int methodType) { this.methodType = methodType; return this; } public String getCameraDescription() { return cameraDescription; } public CameraItemBean setCameraDescription(String cameraDescription) { this.cameraDescription = cameraDescription; return this; } public PlayType getType() { return type; } public String getUpnpIP() { return upnpIP; } public CameraItemBean setUpnpIP(String upnpIP) { this.upnpIP = upnpIP; return this; } public int getUpnpPort() { return upnpPort; } public CameraItemBean setUpnpPort(int upnpPort) { this.upnpPort = upnpPort; return this; } public CameraItemBean setType(PlayType type) { this.type = type; return this; } public String getPicturePath() { return picturePath; } public CameraItemBean setPicturePath(String picturePath) { this.picturePath = picturePath; return this; } public String getCameraName() { return cameraName; } public CameraItemBean setCameraName(String cameraName) { this.cameraName = cameraName; return this; } public String getDeviceId() { return deviceId; } public CameraItemBean setDeviceId(String deviceId) { this.deviceId = deviceId; return this; } public int getChannelNo() { return channelNo; } public CameraItemBean setChannelNo(int channelNo) { this.channelNo = channelNo; return this; } public boolean isOnline() { return isOnline; } public CameraItemBean setOnline(boolean online) { isOnline = online; return this; } public boolean isPtz() { return isPtz; } public CameraItemBean setPtz(boolean ptz) { isPtz = ptz; return this; } public boolean isStore() { return isStore; } public CameraItemBean setStore(boolean store) { isStore = store; return this; } public String getDeVer() { return deVer; } public CameraItemBean setDeVer(String deVer) { this.deVer = deVer; return this; } public String getModel() { return model; } public CameraItemBean setModel(String model) { this.model = model; return this; } public int getIndensity() { return indensity; } public CameraItemBean setIndensity(int indensity) { this.indensity = indensity; return this; } }
f36c5bee57c1424d3919a6fcd9b8b86cc3c4a1dc
195589a371c2121b06fee77eff163bb08b1ec239
/src/com/company/StringWoker.java
52ad18299c8c5361f317d5216db9fabe09d95f90
[]
no_license
irena-java/JavaElementaryHW02
8a0618ff257cacaeab089ebc54574ba056feea89
8f2659a84938e74b1579c582e5aa8a47ce833323
refs/heads/main
2023-05-05T12:20:55.749487
2021-05-24T12:11:24
2021-05-24T12:11:24
370,021,612
0
0
null
null
null
null
UTF-8
Java
false
false
101
java
package com.company; public interface StringWoker { int execute(String sentence,String word); }
0ef1c78fa85f1cf119aeda172b7a91de7faf2afd
43662d2dfd02cc2558bd6f26b50c14b0ca69cfca
/app/src/main/java/com/example/tatevabgaryan/graphprocessing/model/Edge.java
faa6db87c18b0a4f95f91863b4d4135d1c150c75
[]
no_license
TatevAbgaryan/GraphProcessing
47e9a4e77239bb47b8cb784b8811b42e048f3387
8dc735bc2a6ebd6b22fcf67ba9fbe86a50736186
refs/heads/master
2018-09-21T23:06:56.872861
2018-05-26T16:40:04
2018-05-26T16:40:04
119,258,073
0
0
null
null
null
null
UTF-8
Java
false
false
1,634
java
package com.example.tatevabgaryan.graphprocessing.model; import java.util.TreeSet; /** * Created by Tatev.Abgaryan on 1/29/2018. */ public class Edge { private int startNode; private int endNode; private Island numberIsland; public Edge(int startNode, int endNode) { this.startNode = startNode; this.endNode = endNode; } public int getStartNode() { return startNode; } public void setStartNode(int startNode) { this.startNode = startNode; } public int getEndNode() { return endNode; } public void setEndNode(int endNode) { this.endNode = endNode; } public Island getNumberIsland() { return numberIsland; } public void setNumberIsland(Island numberIsland) { this.numberIsland = numberIsland; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Edge edge = (Edge) o; if (startNode != edge.startNode) return false; if (endNode != edge.endNode) return false; return true; } @Override public int hashCode() { int result = startNode; result = 31 * result + endNode; result = 31 * result + (numberIsland != null ? numberIsland.hashCode() : 0); return result; } @Override public String toString() { return "Edge{" + "startNode=" + startNode + ", endNode=" + endNode + ", numberIsland=" + numberIsland.getValue() + '}'; } }
43ba357d34f54dcb17e6447165146ff4a8ba2982
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/org/glassfish/jersey/tests/e2e/oauth/OAuth2Test.java
d0d388fdf0df0787345bad93b9cc04c51e9a64cc
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
7,256
java
/** * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can * obtain a copy of the License at * https://oss.oracle.com/licenses/CDDL+GPL-1.1 * or LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" * exception as provided by Oracle in the GPL Version 2 section of the License * file that accompanied this code. * * Modifications: * If applicable, add the following below the License Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyright [year] [name of copyright owner]" * * Contributor(s): * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package org.glassfish.jersey.tests.e2e.oauth; import javax.ws.rs.DefaultValue; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import org.glassfish.jersey.test.JerseyTest; import org.junit.Assert; import org.junit.Test; /** * Tests OAuth 2 client. * * @author Miroslav Fuksa */ public class OAuth2Test extends JerseyTest { private static final String STATE = "4564dsf54654fsda654af"; private static final String CODE = "code-xyz"; private static final String CLIENT_PUBLIC = "clientPublic"; private static final String CLIENT_SECRET = "clientSecret"; @Path("oauth") public static class AuthorizationResource { @POST @Path("access-token") @Produces(MediaType.APPLICATION_JSON) public OAuth2Test.MyTokenResult getAccessToken(@FormParam("grant_type") String grantType, @FormParam("code") String code, @FormParam("redirect_uri") String redirectUri, @FormParam("client_id") String clientId) { try { Assert.assertEquals("authorization_code", grantType); Assert.assertEquals("urn:ietf:wg:oauth:2.0:oob", redirectUri); Assert.assertEquals(OAuth2Test.CODE, code); Assert.assertEquals(OAuth2Test.CLIENT_PUBLIC, clientId); } catch (AssertionError e) { e.printStackTrace(); throw new javax.ws.rs.BadRequestException(Response.status(400).entity(e.getMessage()).build()); } final OAuth2Test.MyTokenResult myTokenResult = new OAuth2Test.MyTokenResult(); myTokenResult.setAccessToken("access-token-aab999f"); myTokenResult.setExpiresIn("3600"); myTokenResult.setTokenType("access-token"); myTokenResult.setRefreshToken("refresh-xyz"); return myTokenResult; } @GET @Path("authorization") public String authorization(@QueryParam("state") String state, @QueryParam("response_type") String responseType, @QueryParam("scope") String scope, @QueryParam("readOnly") String readOnly, @QueryParam("redirect_uri") String redirectUri) { try { Assert.assertEquals("code", responseType); Assert.assertEquals(OAuth2Test.STATE, state); Assert.assertEquals("urn:ietf:wg:oauth:2.0:oob", redirectUri); Assert.assertEquals("contact", scope); Assert.assertEquals("true", readOnly); } catch (AssertionError e) { e.printStackTrace(); throw new javax.ws.rs.BadRequestException(Response.status(400).entity(e.getMessage()).build()); } return OAuth2Test.CODE; } @POST @Path("refresh-token") @Produces(MediaType.APPLICATION_JSON) public String refreshToken(@FormParam("grant_type") String grantType, @FormParam("refresh_token") String refreshToken, @HeaderParam("isArray") @DefaultValue("false") boolean isArray) { try { Assert.assertEquals("refresh_token", grantType); Assert.assertEquals("refresh-xyz", refreshToken); } catch (AssertionError e) { e.printStackTrace(); throw new javax.ws.rs.BadRequestException(Response.status(400).entity(e.getMessage()).build()); } return isArray ? "{\"access_token\":[\"access-token-new\"],\"expires_in\":\"3600\",\"token_type\":\"access-token\"}" : "{\"access_token\":\"access-token-new\",\"expires_in\":\"3600\",\"token_type\":\"access-token\"}"; } } @Test public void testFlow() { testFlow(false); } @Test public void testFlowWithArrayInResponse() { testFlow(true); } @XmlRootElement public static class MyTokenResult { @XmlAttribute(name = "access_token") private String accessToken; @XmlAttribute(name = "expires_in") private String expiresIn; @XmlAttribute(name = "token_type") private String tokenType; public String getRefreshToken() { return refreshToken; } public void setRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } @XmlAttribute(name = "refresh_token") private String refreshToken; public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getExpiresIn() { return expiresIn; } public void setExpiresIn(String expiresIn) { this.expiresIn = expiresIn; } public String getTokenType() { return tokenType; } public void setTokenType(String tokenType) { this.tokenType = tokenType; } } }
0c01e1aa77fd84ff8dc245d9747f36cadee38b7a
3d09ea3ca1048a9157c900dcda4ce70785428c32
/src/main/java/de/taskmanager/config/SecurityConfig.java
b0598707fc9b70769db24248eb1f51f718014dd6
[]
no_license
danii385/TaskManager
a534b2fb147e755745017a62acc3c1e3b192a7d8
e4763456f34d1de3705ba5123075114656b8b094
refs/heads/main
2023-05-30T13:26:20.638698
2021-06-19T19:14:54
2021-06-19T19:14:54
378,487,534
0
0
null
null
null
null
UTF-8
Java
false
false
2,019
java
package de.taskmanager.config; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private DataSource dataSource; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication().dataSource(dataSource) .usersByUsernameQuery("select email as principal, password as credentails, true from user where email=?") .authoritiesByUsernameQuery("select user_email as principal, role_name as role from user_roles where user_email=?") .passwordEncoder(passwordEncoder()).rolePrefix("ROLE_"); } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } //set the pages you can visit from another page //set that only admin can go to /users, /addTask, / taskList @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/register", "/", "/about", "/login", "/css/**", "/webjars/**").permitAll() .antMatchers("/profile").hasAnyRole("USER,ADMIN") .antMatchers("/users","/addTask", "/taskList").hasRole("ADMIN") .and().formLogin().loginPage("/login").permitAll() .defaultSuccessUrl("/profile").and().logout().logoutSuccessUrl("/login"); } }
e5e59b00a047b949235e1c1f5be655a1ee6baade
ed0bca19bd801fbea5c0c984af1411dbacc0c3cd
/src/main/java/com/minhaapi/repository/UserRepository.java
dad5dc95cdb4583e2285acaee5edbf44c0e1a4df
[]
no_license
godah/SpringBoot-Data-MySQL-Tutorial
6436ed3b95ee7fb65d773b958b973d61ccc4d01f
77cbe44fd9f4d824d3bbca8aa7cc84bd846d6603
refs/heads/master
2020-03-08T16:45:13.060864
2018-04-05T18:41:34
2018-04-05T18:41:34
128,248,757
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package com.minhaapi.repository; import org.springframework.data.repository.CrudRepository; import com.minhaapi.domain.User; // CRUD refere a Create, Read, Update, Delete public interface UserRepository extends CrudRepository<User, Long> { }
222a3e53fcda3697f1c49d7fde653d06140854f4
073154cce78533d548e95d258f47fdcc16466dc6
/src/com/review11/Q18.java
dc381abc60659b4a9915f04225d1b53150aaadd5
[]
no_license
FatmanaK/OCA_Studies_V14_V18
9a9019292881bf0bcbef71243b98e51c94968f51
d12b2009d5c0b786e767d947fd2526658d28df9f
refs/heads/master
2022-11-20T14:12:18.082848
2020-07-15T23:26:32
2020-07-15T23:26:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
284
java
package com.review11; public class Q18 { class Vehicle{ String type="4W"; int maxSpeed=100; Vehicle(String type ,int maxSpeed){ this.type=type; this.maxSpeed=maxSpeed; } Vehicle(){} } class Car extends Vehicle{ String trans; // this. trans=trans;) } }
ba8ceb63c5b92ff4332dd924bb2e65edfeaf4f46
008620a6cecd20f324569a57ac3fd02bbce1a1bd
/DondeEsHoy - Entrega Final - 28 de abril/src/com/example/dondeeshoy/Controlador_Mapa.java
af6ccb61ad9ae9cd337986e07c6115e1e90348c7
[]
no_license
dhcarmona/sistema-eventos-movil
5614a4a016c107fabfa9f09fbb5d5003a6e788ed
ed637908f0336dd35c3f74c1b08048f19981e00a
refs/heads/master
2020-05-16T03:41:53.557955
2014-04-28T07:01:54
2014-04-28T07:01:54
null
0
0
null
null
null
null
ISO-8859-2
Java
false
false
1,703
java
package com.example.dondeeshoy; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; public class Controlador_Mapa extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mapa); GoogleMap mMap; MapFragment mMapFragment; mMapFragment = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)); mMap = mMapFragment.getMap(); double latitud = getIntent().getDoubleExtra("latitud", 0.0); double longitud = getIntent().getDoubleExtra("longitud", 0.0); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitud, longitud),30)); mMap.setMyLocationEnabled(true); Marker myMaker = mMap.addMarker(new MarkerOptions() .position(new LatLng(latitud, longitud)) .title("Su lugar") //Agrega un titulo al marcador .snippet("Debe llegar aca")); //Agrega información detalle relacionada con el marcador } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.mapa, container, false); return rootView; } }
0c2bac6df117372ae5c2db914c924e38f599a7f2
5734f85fa7d93302f9bb774f8a152d563c6c2f04
/src/com/own/settings/javas/ActionPickerDialogActivity.java
7112b1bb840f9fafd04160f89935b666a3412b70
[]
no_license
OwnROM/android_packages_apps_OwnSettings
0ae69f9dc3fa1409bc57cc3493b89af0ec4c2141
8d9b82d7c78283abddc9b8a5085cd8f4d19f5218
refs/heads/own-n
2021-01-19T08:13:50.486624
2017-07-25T19:30:35
2017-07-25T19:30:35
87,614,572
1
5
null
2017-09-04T20:17:49
2017-04-08T06:52:05
Java
UTF-8
Java
false
false
6,852
java
/* * Copyright (C) 2015-2016 DirtyUnicorns Project * (C) 2015-2017 The OwnROM Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Dialog allowing to pick a system action or a intent compatible with * ActionHandler framework */ package com.own.settings.javas; import com.android.internal.utils.du.Config.ActionConfig; import com.android.settings.R; import com.own.settings.javas.CustomActionListAdapter; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.UserHandle; public class ActionPickerDialogActivity extends Activity implements ShortcutPickHelper.OnPickListener { private static final int DIALOG_ROOT = 1; private static final int DIALOG_SYSTEM = 2; private ShortcutPickHelper mPicker; private CustomActionListAdapter mCustomActionListAdapter; private boolean mHasDefault; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPicker = new ShortcutPickHelper(this, this); mCustomActionListAdapter = new CustomActionListAdapter(this); mHasDefault = getIntent().getBooleanExtra("has_defaults", false); String[] excludedActions = getIntent().getStringArrayExtra("excluded_actions"); if (excludedActions != null) { for (int i = 0; i < excludedActions.length; i ++) { mCustomActionListAdapter.removeAction(excludedActions[i]); } } createDialog(this, DIALOG_ROOT).show(); } public Dialog createDialog(final Context context, final int id) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); final Dialog dialog; final DialogInterface.OnClickListener l = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { switch (id) { case DIALOG_ROOT: onTargetChange(getResources().getStringArray( mHasDefault ? R.array.action_dialog_values : R.array.action_dialog_no_default_values)[item]); break; case DIALOG_SYSTEM: sendResultAndFinish(mCustomActionListAdapter.getItem(item).getAction()); finish(); break; default: throw new IllegalArgumentException("Invalid dialog type " + id + " in ActionPicker dialog."); } } }; final DialogInterface.OnCancelListener cancel = new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { dialog.dismiss(); onTargetChange(null); } }; final DialogInterface.OnClickListener cancelClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { cancel.onCancel(dialog); } }; switch (id) { case DIALOG_ROOT: dialog = builder .setTitle(R.string.choose_action_title) .setItems( getResources().getStringArray( mHasDefault ? R.array.action_dialog_entries : R.array.action_dialog_no_default_entries), l) .setOnCancelListener(cancel) .setNegativeButton(getString(android.R.string.cancel), cancelClickListener) .create(); break; case DIALOG_SYSTEM: dialog = builder.setTitle(getString(R.string.action_entry_custom_action)) .setAdapter(mCustomActionListAdapter, l) .setOnCancelListener(cancel) .setNegativeButton(getString(android.R.string.cancel), cancelClickListener) .create(); break; default: throw new IllegalArgumentException("Invalid dialog type " + id + " in ActionPicker dialog."); } return dialog; } private void sendResultAndFinish(String result) { Intent intent = new Intent("intent_action_action_picker"); intent.putExtra("result", Activity.RESULT_OK); intent.putExtra("action_string", result); ActionConfig actionConfig = new ActionConfig(this, result); intent.putExtra("action_config", actionConfig); sendBroadcastAsUser(intent, UserHandle.CURRENT); setResult(Activity.RESULT_OK, intent); finish(); } private void sendCancelResultAndFinish() { Intent intent = new Intent("intent_action_action_picker"); intent.putExtra("result", Activity.RESULT_CANCELED); sendBroadcastAsUser(intent, UserHandle.CURRENT); setResult(Activity.RESULT_CANCELED); finish(); } @Override public void shortcutPicked(String uri, String friendlyName, boolean isApplication) { if (uri == null) { sendCancelResultAndFinish(); } else { sendResultAndFinish(uri); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { mPicker.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data); } private void onTargetChange(String uri) { if (uri == null) { sendCancelResultAndFinish(); } else if (uri.equals(getString(R.string.action_value_default_action))) { sendResultAndFinish("default"); } else if (uri.equals(getString(R.string.action_value_select_app))) { mPicker.pickShortcut(null, null, 0); } else if (uri.equals(getString(R.string.action_value_custom_action))) { createDialog(this, DIALOG_SYSTEM).show(); } } }
71139cbe64a46c95dd15a0c6fb2fd0e314ee1b31
413a584d7123872cc04b2d1bb1141310cefa7b48
/blog/api-impl/src/java/uk/ac/lancs/e_science/sakaiproject/impl/blogger/searcher/SearchException.java
3c4ebfb9c4221df047177bc75f058c40ba2417ae
[ "ECL-1.0", "Apache-2.0" ]
permissive
etudes-inc/etudes-lms
31bc2b187cafc629c8b2b61be92aa16bb78aca99
38a938e2c74d86fc3013642b05914068a3a67af3
refs/heads/master
2020-06-03T13:49:45.997041
2017-10-25T21:25:58
2017-10-25T21:25:58
94,132,665
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
/************************************************************************************* Copyright (c) 2006. Centre for e-Science. Lancaster University. United Kingdom. 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 uk.ac.lancs.e_science.sakaiproject.impl.blogger.searcher; public class SearchException extends Exception{ }
6977e312bdc8b50c8131f8dcca842bc8aea653d0
09f82565e3490b0ff1185fd9e6faef6adf80aba4
/suite/spdz/src/test/java/dk/alexandra/fresco/suite/spdz/TestSpdzSInt.java
81e3017a6e6d685c87e742de9091771f03a97aaf
[ "MIT" ]
permissive
Charterhouse/fresco
8a91070cbaae7e65a42e34d456819a08203f21a0
872788239cb90493c1ecc4f83e00a18597bdd19e
refs/heads/master
2021-10-11T03:00:48.161275
2018-12-06T12:31:28
2018-12-06T12:31:28
78,760,876
0
0
null
null
null
null
UTF-8
Java
false
false
2,903
java
package dk.alexandra.fresco.suite.spdz; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import dk.alexandra.fresco.suite.spdz.datatypes.SpdzSInt; import java.math.BigInteger; import org.junit.Test; public class TestSpdzSInt { @Test public void testEquals() { SpdzSInt element = new SpdzSInt(BigInteger.valueOf(25), BigInteger.valueOf(15), BigInteger.valueOf(251)); assertTrue(element.equals(element)); assertFalse(element.equals("This is a String")); assertFalse(element.equals(null)); SpdzSInt element2 = new SpdzSInt(BigInteger.valueOf(25), null, BigInteger.valueOf(251)); assertFalse(element.equals(element2)); element2 = new SpdzSInt(BigInteger.valueOf(25), BigInteger.valueOf(11), BigInteger.valueOf(251)); assertFalse(element.equals(element2)); element = new SpdzSInt(BigInteger.valueOf(25), null, BigInteger.valueOf(251)); assertFalse(element.equals(element2)); element2 = new SpdzSInt(BigInteger.valueOf(25), null, BigInteger.valueOf(251)); assertTrue(element.equals(element2)); element2 = new SpdzSInt(BigInteger.valueOf(25), null, null); assertFalse(element.equals(element2)); element2 = new SpdzSInt(BigInteger.valueOf(25), null, BigInteger.valueOf(23)); assertFalse(element.equals(element2)); element = new SpdzSInt(BigInteger.valueOf(25), null, null); assertFalse(element.equals(element2)); element2 = new SpdzSInt(BigInteger.valueOf(25), null, null); assertTrue(element.equals(element2)); element = new SpdzSInt(null, BigInteger.valueOf(11), BigInteger.valueOf(13)); element2 = new SpdzSInt(BigInteger.valueOf(25), BigInteger.valueOf(11), BigInteger.valueOf(13)); assertFalse(element.equals(element2)); element2 = new SpdzSInt(null, BigInteger.valueOf(11), BigInteger.valueOf(13)); assertTrue(element.equals(element2)); element = new SpdzSInt(BigInteger.valueOf(25), BigInteger.valueOf(11), BigInteger.valueOf(13)); assertFalse(element.equals(element2)); } @Test public void testHashCode() { SpdzSInt e1 = new SpdzSInt(BigInteger.valueOf(25), BigInteger.valueOf(15), BigInteger.valueOf(251)); SpdzSInt e2 = new SpdzSInt(null, BigInteger.valueOf(15), BigInteger.valueOf(251)); SpdzSInt e3 = new SpdzSInt(BigInteger.valueOf(25), null, BigInteger.valueOf(251)); SpdzSInt e4 = new SpdzSInt(BigInteger.valueOf(25), BigInteger.valueOf(15), null); assertAllDifferent(new int[]{ e1.hashCode(), e2.hashCode(), e3.hashCode(), e4.hashCode() }); } private void assertAllDifferent(int[] elements) { for (int i = 0; i < elements.length; i++) { for (int j = 0; j < elements.length; j++) { if (i != j) { assertNotEquals(elements[i], elements[j]); } } } } }
1cc22235f2f29dfa48bd7422784141912c6a5052
b40a556ecf1369223946b73a6edaad893cda47c0
/app/src/test/java/com/scrappers/notepadpp/ExampleUnitTest.java
3f62f96fe3a82a15991f0ac10d2214ee9fb2b0ee
[]
no_license
Pavljava/Public_CozySnippets
63f77d3514b4b697a1bd5fbb207519abfe8f8064
32df2e1590e714d19b46e9f99e258acd09ae4268
refs/heads/master
2020-12-19T17:44:06.492732
2020-01-23T10:30:07
2020-01-23T10:30:07
235,803,737
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.scrappers.notepadpp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
c534b14b42f2b22a6c444754ba3667dad5db410e
67791aac4d0e6ec1569c08c95923a2afd9e9f13f
/LMS-feature/src/main/java/com/hcl/loan/controller/StatusController.java
3a31f8145789cf0d5b805bb9e8a2c691d633ac9e
[]
no_license
sridharreddych/TechHck
59c574a7c70a5f22a4196867b1d6013f3f33fce6
d0c82d4421007b88906d4ee8357bef6cd8fafc8c
refs/heads/master
2020-03-24T03:23:17.069524
2018-07-26T09:13:50
2018-07-26T09:13:50
142,417,310
0
0
null
null
null
null
UTF-8
Java
false
false
1,799
java
package com.hcl.loan.controller; import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.hcl.loan.constants.LoanApprovalConstants; import com.hcl.loan.model.Loan; import com.hcl.loan.model.exception.InvalidURLParameterException; import com.hcl.loan.service.StatusService; @RestController @CrossOrigin @RequestMapping(value = LoanApprovalConstants.STATUS_MAPPING) public class StatusController { private static final Logger logger = Logger.getLogger(EMICalculatorController.class); @Autowired StatusService statusService; /** * * @param statustype * @return List of Loan object */ @RequestMapping(value = LoanApprovalConstants.STATUS_MAPPING + LoanApprovalConstants.STATUS_TYPE_VARIABLE, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List<Loan> fetchApplicationStatus(@PathVariable("statustype") String statustype, @PathVariable("userId") Integer userId) { logger.debug("start fetchApplicationStatus statustype:" + statustype + " userId:" + userId); List<Loan> loanList = null; if (statustype != null && !statustype.isEmpty() && userId != null) { if ("dispatched".equals(statustype) || "pending".equals(statustype)) { loanList = statusService.fetchStatus(userId, statustype); } else { throw new InvalidURLParameterException("Invalid iput parameter"); } } return loanList; } }
f79e6199baa388efa8ed4052ab5ceffadb39da68
0803b931fb6c14de5bddaab5b47b2375d90c2b39
/src/main/java/me/sunny/demo/algos/lc/medium/ZigzagLevelOrderBinTree.java
35149253f67d01e58dc908713310ab621cee0bd4
[]
no_license
SunnnyChan/algorithms-collection
fd2270c7b630aaad52e34fd6d6a4a2e13b430997
79fa16a2fc7b201b9084af2f3c3c4d2ed3095f96
refs/heads/master
2023-06-02T00:15:30.393663
2021-06-26T04:47:32
2021-06-26T04:47:32
272,990,242
1
1
null
null
null
null
UTF-8
Java
false
false
606
java
package me.sunny.demo.algos.lc.medium; /** * 描述 * 给定一个二叉树,返回该二叉树的之字形层序遍历,(第一层从左向右,下一层从右向左,一直这样交替) * 例如: * 给定的二叉树是{3,9,20,#,#,15,7}, * * 该二叉树之字形层序遍历的结果是 * [ * [3], * [20,9], * [15,7] * ] * 示例1 * 输入: * {1,#,2} * 复制 * 返回值: * [[1],[2]] */ /** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ public class ZigzagLevelOrderBinTree { public void zigzagLevelOrder() { } }
5b3e2498ae58eff55d8fe47a053ccd7adfc9d5f3
84edaee1c5b001ee7829c9fc993fe9915f863ab4
/app/src/main/java/com/alittriutari/phonecontact/FavoriteDatabase.java
de76708ba2e56210d7aff02d5ab3147c3c92489c
[]
no_license
alittriutari/PhoneContact
4c1d175b76e40437bd43d37de3170dd72ce0d7b8
b0f585fbe0008bdf4deb9f6f820590780dbbd495
refs/heads/master
2020-07-02T05:52:46.985558
2019-08-15T13:46:52
2019-08-15T13:46:52
201,432,376
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.alittriutari.phonecontact; import androidx.room.Database; import androidx.room.RoomDatabase; @Database(entities = {Contact.class}, version = 1) public abstract class FavoriteDatabase extends RoomDatabase { public abstract ContactDao contactDao(); }
8e50d0fdd8321d426fab094a062c0aec7310adf4
62c76a1df341e9d79f3c81dd71c94113b1f9fc14
/WEBFDMSWeb/src/fdms/ui/struts/form/ObitAsimasForm.java
f23f5ce293940b53d02e17936924d8ff7bc8d0bc
[]
no_license
mahendrakawde/FDMS-Source-Code
3b6c0b5b463180d17e649c44a3a03063fa9c9e28
ce27537b661fca0446f57da40c016e099d82cb34
refs/heads/master
2021-01-10T07:48:40.811038
2015-10-30T07:57:28
2015-10-30T07:57:28
45,235,253
0
0
null
null
null
null
UTF-8
Java
false
false
3,773
java
package fdms.ui.struts.form; import org.apache.struts.action.ActionForm; import org.apache.struts.upload.FormFile; import com.aldorsolutions.webfdms.beans.DbServices; import com.aldorsolutions.webfdms.beans.DbVisitations; public class ObitAsimasForm extends ActionForm{ public ObitAsimasForm(){ } private DbServices srv = new DbServices(); private DbVisitations visitation1 = new DbVisitations(); private DbVisitations visitation2 = new DbVisitations(); private DbVisitations visitation3 = new DbVisitations(); private String firstName=""; private String lastName=""; private String dateOfBirth=""; private String dateOfDeath=""; private String serviceDate=""; private String obituaryText=""; // private String imageFile;. private String url=""; private long asimasId ; private FormFile fileName; /** * @return the dateOfBirth */ public String getDateOfBirth() { return dateOfBirth; } /** * @param dateOfBirth the dateOfBirth to set */ public void setDateOfBirth(String dateOfBirth) { this.dateOfBirth = dateOfBirth; } /** * @return the dateOfDeath */ public String getDateOfDeath() { return dateOfDeath; } /** * @param dateOfDeath the dateOfDeath to set */ public void setDateOfDeath(String dateOfDeath) { this.dateOfDeath = dateOfDeath; } /** * @return the firstName */ public String getFirstName() { return firstName; } /** * @param firstName the firstName to set */ public void setFirstName(String firstName) { this.firstName = firstName; } /** * @return the lastName */ public String getLastName() { return lastName; } /** * @param lastName the lastName to set */ public void setLastName(String lastName) { this.lastName = lastName; } /** * @return the obituaryText */ public String getObituaryText() { return obituaryText; } /** * @param obituaryText the obituaryText to set */ public void setObituaryText(String obituaryText) { this.obituaryText = obituaryText; } /** * @return the url */ public String getUrl() { return url; } /** * @param url the url to set */ public void setUrl(String url) { this.url = url; } /** * @return the serviceDate */ public String getServiceDate() { return serviceDate; } /** * @param serviceDate the serviceDate to set */ public void setServiceDate(String serviceDate) { this.serviceDate = serviceDate; } /** * @return the srv */ public DbServices getSrv() { return srv; } /** * @param srv the srv to set */ public void setSrv(DbServices srv) { this.srv = srv; } /** * @return the visitation1 */ public DbVisitations getVisitation1() { return visitation1; } /** * @param visitation1 the visitation1 to set */ public void setVisitation1(DbVisitations visitation1) { this.visitation1 = visitation1; } /** * @return the visitation2 */ public DbVisitations getVisitation2() { return visitation2; } /** * @param visitation2 the visitation2 to set */ public void setVisitation2(DbVisitations visitation2) { this.visitation2 = visitation2; } /** * @return the visitation3 */ public DbVisitations getVisitation3() { return visitation3; } /** * @param visitation3 the visitation3 to set */ public void setVisitation3(DbVisitations visitation3) { this.visitation3 = visitation3; } /** * @return the asimasId */ public long getAsimasId() { return asimasId; } /** * @param asimasId the asimasId to set */ public void setAsimasId(long asimasId) { this.asimasId = asimasId; } /** * @return the fileName */ public FormFile getFileName() { return fileName; } /** * @param fileName the fileName to set */ public void setFileName(FormFile fileName) { this.fileName = fileName; } }
de0adac75960b92ef91d9cc7eead4f79da3449c8
484c516f9cff6232310f7b7da86793e1b4a86030
/app/src/main/java/com/application/innove/obex/ObexModel/LoginResponseModel.java
8e9b8cda202ada603d9cb5f0f9b4067e76aa4298
[]
no_license
AbhishekSharmalearning/OBEX
a225684e2024b738b52fe1b98b605b5f5b97c39f
d97f3090f2130ab875016a181afd06a3b51aa6e0
refs/heads/master
2021-06-30T06:51:42.682782
2017-09-20T15:03:52
2017-09-20T15:03:52
104,217,983
0
0
null
null
null
null
UTF-8
Java
false
false
479
java
package com.application.innove.obex.ObexModel; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by abhisheksharma on 08-Aug-2017. */ public class LoginResponseModel { @SerializedName("Glst") @Expose private List<Glst> glst = null; public List<Glst> getGlst() { return glst; } // public void setGlst(List<Glst> glst) { // this.glst = glst; // } }
c570d6c13e7b1f164650c0d375916cdd1e169e87
bc749e5a0ba185314ea0a64db02a9c08967c7b69
/src/main/java/org/sysu/xf/crawler01/URLQueue.java
482696af8009d31967a230da920f7c3d8df0cd10
[]
no_license
jinhang/scrawler01
bd7c9843c6bb9565c9399c9284e8edf621a045da
45a2ff0c3c81efca57e33cbb5d13b6f187b33aea
refs/heads/master
2020-12-24T19:17:56.627032
2015-09-06T14:59:39
2015-09-06T14:59:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
513
java
package org.sysu.xf.crawler01; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; public class URLQueue { private Queue<String> queue = new ConcurrentLinkedQueue<String>(); public void enQueue(String url) { queue.add(url); } public String deQueue() { return queue.poll(); } public boolean isEmpty() { return queue.isEmpty(); } public boolean contains(String url) { return queue.contains(url); } }
afeede5009b57a87bdfe3f56bd636603de4b7308
3e880083319968247a119204a1991d7a5f083a8c
/ShowPresidents/app/src/main/java/com/example/showpresidents/service/view/PresidentViewModelFactory.java
3713a62d6e7ea8cfb67d8b9b1586a37f94383858
[]
no_license
surendp/AndroidApplications
b3579163d4f638f79cdffbd7f746b85d85972eb5
b130a7da65cbe42b252ac11d55f5b1db56e393b2
refs/heads/master
2020-03-12T11:49:41.783260
2018-05-06T13:52:30
2018-05-06T13:52:30
130,604,766
0
0
null
null
null
null
UTF-8
Java
false
false
975
java
package com.example.showpresidents.service.view; import android.arch.lifecycle.ViewModel; import android.arch.lifecycle.ViewModelProvider; import android.support.annotation.NonNull; import com.example.showpresidents.service.Controller.PresidentRepository; import javax.inject.Inject; /** * Created by suren on 22/04/2018. */ public class PresidentViewModelFactory implements ViewModelProvider.Factory{ private PresidentRepository presidentRepository; @Inject public PresidentViewModelFactory(PresidentRepository presidentRepository){ this.presidentRepository = presidentRepository; } @NonNull @Override public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { if (modelClass.isAssignableFrom(PresidentViewModel.class)) { return (T) new PresidentViewModel(this.presidentRepository); } else{ throw new IllegalArgumentException("View Model not found"); } } }
b96055bacb3e88ff8437821f32bb3f620b195038
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-serverlessapplicationrepository/src/main/java/com/amazonaws/services/serverlessapplicationrepository/model/transform/ParameterValueJsonUnmarshaller.java
c031cd4840c3835a26dffbb74b597ceace0b36a7
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
2,995
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.serverlessapplicationrepository.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.serverlessapplicationrepository.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * ParameterValue JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ParameterValueJsonUnmarshaller implements Unmarshaller<ParameterValue, JsonUnmarshallerContext> { public ParameterValue unmarshall(JsonUnmarshallerContext context) throws Exception { ParameterValue parameterValue = new ParameterValue(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("name", targetDepth)) { context.nextToken(); parameterValue.setName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("value", targetDepth)) { context.nextToken(); parameterValue.setValue(context.getUnmarshaller(String.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return parameterValue; } private static ParameterValueJsonUnmarshaller instance; public static ParameterValueJsonUnmarshaller getInstance() { if (instance == null) instance = new ParameterValueJsonUnmarshaller(); return instance; } }
[ "" ]
f5b17375eb9e9141ef02c191bc1b95a90ab7ef03
74befc1b34db34d41a6c22fe17994bd5223c3003
/B180093CS_2/Q2.java
68dec5718a0025b79172906dc2811953c35c9e8b
[]
no_license
patichandana/OOPS-lab
587f1c24367c18d8edbe9c6e99cf6aa2ae845b16
3831f911a66acc77976324680d3ee51c1f84d0cc
refs/heads/main
2023-09-01T06:00:42.372681
2021-10-10T18:45:27
2021-10-10T18:45:27
393,109,327
0
0
null
null
null
null
UTF-8
Java
false
false
516
java
import java.util.*; class Q2 { public static void main(String[] args) { String S; Scanner scan = new Scanner(System.in); S = scan.nextLine(); ArrayList<String> list = new ArrayList<String>(Arrays.asList(S.split("\\s", -1))); list.removeAll(Collections.singleton("")); System.out.println("Words count is " + list.size()); for(int i = 0;i<S.length();++i) { System.out.println("'" + S.charAt(i) + "'" + " " + (int)S.charAt(i)); } } }
160742156ab39203f8f1c32d11f3e70f788e9a5d
1c3f88e52ef6482f50ce4612778b0fc6329665bc
/proinmanApp-servicio/src/main/java/proinman/gestion/solicitud/servicio/SolicitudService.java
4ed5ada7b5b1038cad67592c1a6c63c66519734a
[]
no_license
AndTinuviel/proinmanApp
34d2f4d409ef1c7935fca4d2898931cbeced5d56
7dfeda9a51378f363cfbfdb445b22423260bb1b1
refs/heads/master
2020-03-29T14:51:45.754972
2018-09-23T23:50:50
2018-09-23T23:50:50
150,035,478
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package proinman.gestion.solicitud.servicio; import javax.ejb.EJB; import javax.ejb.Stateless; import proinman.gestion.solicitud.dao.SolicitudDao; import proinman.gestion.solicitud.entity.Solicitud; import proinman.gestion.solicitud.entity.Usuario; import proinman.gestion.solicitud.util.exception.EntidadNoGuardadaException; @Stateless public class SolicitudService { @EJB private SolicitudDao solicitudDao; @EJB private MotorTareaService motorTareaService; public Solicitud consultarSolicitud(int codigoSolicitud) { Solicitud solicitud = solicitudDao.obtenerPorCodigo(Integer.valueOf(codigoSolicitud)); return solicitud; } public Solicitud crearSolicitud(Solicitud nuevaSolicitud, Usuario usuario) throws EntidadNoGuardadaException { solicitudDao.guardar(nuevaSolicitud); if (nuevaSolicitud.getRequiereCotizacion().equals("SI")) { motorTareaService.crearTareaCotizarSolicitud(nuevaSolicitud, usuario); } return nuevaSolicitud; } }
71dc9d11d43af047597f114bedadabe102821b33
d543c0f1c80c8dd70e501ac9fc5bf7fe54aeb9a8
/app/src/main/java/com/example/u772/testapp/dashes/WeatherModel.java
4cfa3222ad83640694614b4cb7459dd7957003d0
[]
no_license
mgelios/MgApp
cd1c32c97d2e5378e1a7be94600230c7c62de695
37e887df9aaded337a978f1b2d93b5fcd92b44fc
refs/heads/master
2020-03-07T00:09:56.981818
2018-05-16T14:27:36
2018-05-16T14:27:36
127,151,238
0
0
null
null
null
null
UTF-8
Java
false
false
5,800
java
package com.example.u772.testapp.dashes; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.Temporal; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; /** * Created by U772 on 06.04.2018. */ public class WeatherModel { private String info = ""; private String description = ""; private String icon = ""; private String cityName = ""; private String requestedCity = ""; private int temperature = 0; private int humidity = 0; private int pressure = 0; private int visibility = 0; private int minTemperature = 0; private int maxTemperature = 0; private double windSpeed = 0.0; private double windDeg = 0.0; private Date sunrise = null; private Date sunset = null; private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:sszzzzzz"); private List<ForecastModel> forecasts = new ArrayList<>(); public WeatherModel(){ } public WeatherModel(JSONObject jsonResponse){ try { JSONObject rawWeather = (JSONObject) jsonResponse.get("weather"); info = rawWeather.getString("main_info"); description = rawWeather.getString("description"); icon = rawWeather.getString("icon_name"); cityName = rawWeather.getString("city_name"); requestedCity = rawWeather.getString("requested_city"); temperature = rawWeather.getInt("temperature"); humidity = rawWeather.getInt("humidity"); pressure = rawWeather.getInt("pressure"); visibility = rawWeather.getInt("visibility"); minTemperature = rawWeather.getInt("temperature_min"); maxTemperature = rawWeather.getInt("temperature_max"); windSpeed = rawWeather.getDouble("wind_speed"); windDeg = rawWeather.getDouble("wind_deg"); sunrise = dateFormat.parse(rawWeather.getString("sunrise")); sunset = dateFormat.parse(rawWeather.getString("sunset")); initForecasts((JSONArray) jsonResponse.getJSONArray("forecast")); } catch (JSONException e){ System.out.println(e.getMessage()); } catch (ParseException e){ System.out.println(e.getMessage()); } } private void initForecasts(JSONArray rawForecasts){ Set<String> dates = new TreeSet<String>(); SimpleDateFormat forecastDate = new SimpleDateFormat("E dd"); SimpleDateFormat forecastComparisonDate = new SimpleDateFormat("DDD"); try { for (int i = 0; i < rawForecasts.length(); i++) { JSONObject rawForecast = (JSONObject) rawForecasts.get(i); Date tmpDate = dateFormat.parse(rawForecast.getString("date_time")); String strTmpDate = forecastComparisonDate.format(tmpDate); dates.add(strTmpDate); } for (String date : dates){ ForecastModel forecast = new ForecastModel(); for (int i = 0; i < rawForecasts.length(); i++){ JSONObject rawForecast = (JSONObject) rawForecasts.get(i); Date tmpDate = dateFormat.parse(rawForecast.getString("date_time")); String strTmpDate = forecastComparisonDate.format(tmpDate); if (date.equals(strTmpDate)){ forecast.setDate(forecastDate.format(tmpDate)); int forecastTemperature = rawForecast.getInt("temperature"); int forecastPressure = rawForecast.getInt("pressure"); int forecastWindSpeed = rawForecast.getInt("wind_speed"); if (forecast.getMaxTemp() < forecastTemperature){ forecast.setMaxTemp(forecastTemperature); } if (forecast.getMinTemp() > forecastTemperature){ forecast.setMinTemp(forecastTemperature); } forecast.setPressure(forecastPressure); forecast.setWindSpeed(forecastWindSpeed); } } forecasts.add(forecast); } } catch (JSONException e){ System.out.println(e.getMessage()); } catch (ParseException e){ System.out.println(e.getMessage()); } } public String getInfo() { return info; } public String getDescription() { return description; } public String getIcon() { return icon; } public String getCityName() { return cityName; } public String getRequestedCity() { return requestedCity; } public int getTemperature() { return temperature; } public int getHumidity() { return humidity; } public int getPressure() { return pressure; } public int getVisibility() { return visibility; } public int getMinTemperature() { return minTemperature; } public int getMaxTemperature() { return maxTemperature; } public double getWindSpeed() { return windSpeed; } public double getWindDeg() { return windDeg; } public Date getSunrise() { return sunrise; } public Date getSunset() { return sunset; } public List<ForecastModel> getForecasts() { return forecasts; } }
6b6a53b87fe07d39bb352f35af6e4adcb97245bc
6daf69d5a40570d9444dc78b83bc0c547762fade
/app/src/main/java/uo/sdm/mapintegrationapp/infrastructure/services/imp/SoundService.java
3f2675490edaac5810f34ddc75cf63a1f47ac0a2
[ "Apache-2.0" ]
permissive
AdrianBueno/MapIntegration
5668296ed3030e61d78012eb816d7630d84605b9
e7206240371986360f57bd442231ff6408a90a27
refs/heads/master
2020-12-30T12:24:19.499298
2017-05-15T21:12:07
2017-05-15T21:12:07
91,385,005
0
0
null
null
null
null
UTF-8
Java
false
false
2,997
java
package uo.sdm.mapintegrationapp.infrastructure.services.imp; import android.content.Context; import android.media.MediaPlayer; import android.provider.MediaStore; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import uo.sdm.mapintegrationapp.R; import uo.sdm.mapintegrationapp.infrastructure.services.ISoundService; /** * Created by Adrian on 28/06/2015. */ public class SoundService implements ISoundService { private Map<String,PlayerThread> soundMap = new HashMap<>(); @Override public void start(Context context, Integer uri,Boolean loop, String key){ if(loop == false) { createNewThread(context, uri, loop).run(); }else { if(soundMap.containsKey(key) && soundMap.get(key) != null){ if(!soundMap.get(key).getMp().isPlaying()) soundMap.get(key).getMp().start(); }else{ soundMap.put(key,createNewThread(context, uri, loop)); soundMap.get(key).run(); } /*if(soundMap.containsKey(key) && soundMap.get(key) != null){ if(soundMap.get(key).getState() == Thread.State.WAITING) { soundMap.get(key).notify(); } if(soundMap.get(key).getState() == Thread.State.TERMINATED){ soundMap.put(key,createNewThread(context, uri, loop)); soundMap.get(key).run(); } }else{ soundMap.put(key,createNewThread(context, uri, loop)); soundMap.get(key).run(); }*/ } } @Override public void restart(String key){ soundMap.get(key).getMp().seekTo(0); } @Override public void stop(String key){ if(soundMap.get(key)!= null){ soundMap.get(key).getMp().pause(); } } @Override public void remove(String key){ soundMap.get(key).interrupt(); soundMap.remove(key); } @Override public boolean isWait(String key){ return soundMap.get(key).getState() == Thread.State.WAITING; } @Override public boolean isExists(String key){ return soundMap.containsKey(key); } private PlayerThread createNewThread(final Context context, final Integer uri,final boolean loop){ return new PlayerThread(context, uri, loop); } public class PlayerThread extends Thread{ MediaPlayer mp; Integer pos = 0; Context context; Integer uri; boolean loop; public PlayerThread(final Context context, final Integer uri,final boolean loop){ this.context = context; this.uri = uri; this.loop = loop; mp = MediaPlayer.create(context,uri); } @Override public void run() { super.run(); mp.start(); } public MediaPlayer getMp(){ return mp; } } }
63d528534eb848e184671c78c9fdf3420fb66a7d
daccbcf6e94c2cecf34a616a46d1ea1c54429576
/bookkeeping/src/main/java/com/yjz/bookkeeping/ui/fragment/BookkeepingEditOutFragment.java
0036b0f6f58d3bc01b30fab958ba9a89c7e203c9
[]
no_license
AndroidAndYang/AndroidNotepad
945bc3301f0405366eb474ac8e03b0888c95720e
33511b36d819119403dee2afc2a3e5348e93beb0
refs/heads/master
2020-03-31T16:38:38.805507
2019-02-25T10:15:33
2019-02-25T10:15:33
152,383,857
0
0
null
null
null
null
UTF-8
Java
false
false
9,089
java
package com.yjz.bookkeeping.ui.fragment; import android.app.Activity; import android.app.DatePickerDialog; import android.support.v4.content.ContextCompat; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import com.seabig.common.base.BaseRecyclerAdapter; import com.seabig.common.base.DelayLoadFragment; import com.seabig.common.datamgr.AppConstant; import com.seabig.common.util.MoneyTextWatcher; import com.seabig.common.util.ResourceUtils; import com.seabig.common.util.SPUtils; import com.yjz.bookkeeping.BookkeepingApplication; import com.yjz.bookkeeping.R; import com.yjz.bookkeeping.adapter.BookkeepingEditAdapter; import com.yjz.bookkeeping.bean.BookkeepingAllBean; import com.yjz.bookkeeping.bean.BookkeepingBean; import com.yjz.bookkeeping.datamgr.BookkeepingType; import com.yjz.bookkeeping.db.Type; import com.yjz.bookkeeping.db.TypeDao; import com.yjz.bookkeeping.event.BookkeepingEditEvent; import com.yjz.bookkeeping.presenter.BookkeepingCommitPresenter; import com.yjz.bookkeeping.presenter.contract.BookkeepingCommitContract; import org.greenrobot.eventbus.EventBus; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; /** * author: YJZ * date: 2018/12/17 * des: 账目编辑页 */ public class BookkeepingEditOutFragment extends DelayLoadFragment implements BookkeepingCommitContract.View, View.OnClickListener { private RecyclerView mRecyclerView; private TextView mTypeNameTv; private ImageView mTypeImg; private EditText mMoneyEdt; private int clickPosition; private EditText mNoteEdt; private TextView mTimeTv; private BookkeepingCommitPresenter commitPresenter; private DatePickerDialog datePickerDialog; @Override protected int onSettingUpContentViewResourceID() { return R.layout.bookkeeping_fragment_edit_out; } @Override protected void onSettingUpView() { mTypeNameTv = findViewById(R.id.type_name); mTypeImg = findViewById(R.id.type_img); mMoneyEdt = findViewById(R.id.money_tv); mNoteEdt = findViewById(R.id.edt_note); mRecyclerView = findViewById(R.id.recycler_view); mTimeTv = findViewById(R.id.time); mTimeTv.setOnClickListener(this); //默认两位小数 mMoneyEdt.addTextChangedListener(new MoneyTextWatcher(mMoneyEdt)); } @Override protected void onSettingUpData() { final TypeDao typeDao = BookkeepingApplication.getInstance().getSession().getTypeDao(); Long userId = (Long) SPUtils.get(getActivity(), AppConstant.USER_ID, 0L); //获取系统的日期 Calendar calendar = Calendar.getInstance(); // 月 int month = calendar.get(Calendar.MONTH)+1; // 日 int day = calendar.get(Calendar.DAY_OF_MONTH); mTimeTv.setText(String.format(Locale.CHINA,"%s月%s日",month,day)); List<Type> typeList = typeDao.queryBuilder() .where(TypeDao.Properties.Uid.eq(userId), TypeDao.Properties.Type.eq(BookkeepingType.TYPE_OUT)) .orderAsc(TypeDao.Properties.Index) .list(); final BookkeepingEditAdapter adapter = new BookkeepingEditAdapter(getActivity(), typeList,"bookkeeping_out_type_select_"); mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 4)); mRecyclerView.setNestedScrollingEnabled(false); adapter.setOnRecyclerViewItemClickListen(new BaseRecyclerAdapter.OnRecyclerViewItemClickListen() { @Override public void onItemClickListen(View view, int position) { clickPosition = position; adapter.setClickPosition(position); adapter.notifyDataSetChanged(); mTypeImg.setImageDrawable(ContextCompat.getDrawable(getActivity(), ResourceUtils.getImageResIdByName(getActivity(), "bookkeeping_out_type_select_" + position, "drawable"))); mTypeNameTv.setText(adapter.getItem(position).getName()); } }); mRecyclerView.setAdapter(adapter); } public void post() { String typeNameStr = mTypeNameTv.getText().toString(); String moneyStr = mMoneyEdt.getText().toString(); String noteStr = mNoteEdt.getText().toString(); if (TextUtils.isEmpty(moneyStr)){ showToast("请输入金额"); return; } if (commitPresenter == null) { commitPresenter = new BookkeepingCommitPresenter(getActivity(), this); } BookkeepingBean bookkeepingBean = new BookkeepingBean(); Calendar calendar = Calendar.getInstance(); int yearStr = calendar.get(Calendar.YEAR);//获取年份 int month = calendar.get(Calendar.MONTH) + 1;//获取月份 bookkeepingBean.setUserId((Long) SPUtils.get(getActivity(), AppConstant.USER_ID, 0L)); bookkeepingBean.setBookTypeId(1L); // 18 为支出type的内容长度 bookkeepingBean.setClassificationId((long) (clickPosition + 1)); bookkeepingBean.setMoneyType(0L); bookkeepingBean.setContent(TextUtils.isEmpty(noteStr) ? typeNameStr : noteStr); bookkeepingBean.setMoney(Float.parseFloat(moneyStr)); bookkeepingBean.setAddTime(String.format(Locale.CHINA, "%s-%s", yearStr, month)); SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); bookkeepingBean.setExactAddTime(formatDate.format(new Date())); commitPresenter.commit(bookkeepingBean); } @Override public void onSuccess(BookkeepingBean bookkeepingBean, boolean isSuccess) { showToast(isSuccess ? "新增成功" : "新增失败"); if (isSuccess){ BookkeepingAllBean.DayDataBean.UserBookkeepingBeansBean userBookkeepingBeansBean = new BookkeepingAllBean.DayDataBean.UserBookkeepingBeansBean(); userBookkeepingBeansBean.setMoney(bookkeepingBean.getMoney()); userBookkeepingBeansBean.setContent(bookkeepingBean.getContent()); userBookkeepingBeansBean.setExactTime(bookkeepingBean.getExactAddTime()); userBookkeepingBeansBean.setMoneyType(0); userBookkeepingBeansBean.setClassificationId(clickPosition + 1); userBookkeepingBeansBean.setName("日常记账本"); EventBus.getDefault().post(new BookkeepingEditEvent(userBookkeepingBeansBean)); commitPresenter = null; (getActivity()).finish(); } } @Override public void onClick(View v) { int i = v.getId(); //获取当前月最后一天 if (i == R.id.time) { showDatePickerDialog(getActivity()); } } /** * 显示时间日历 * @param activity 当前界面 */ public void showDatePickerDialog(Activity activity) { Calendar calendar = Calendar.getInstance(); // 直接创建一个DatePickerDialog对话框实例,并将它显示出来 // 绑定监听器(How the parent is notified that the date is set.) datePickerDialog = new DatePickerDialog(activity, // 绑定监听器(How the parent is notified that the date is set.) new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mTimeTv.setText(String.format(Locale.CHINA, "%s月%s日", monthOfYear, dayOfMonth)); } } // 设置初始日期 , calendar.get(Calendar.YEAR) , calendar.get(Calendar.MONTH) , calendar.get(Calendar.DAY_OF_MONTH)); DatePicker datePicker = datePickerDialog.getDatePicker(); // 当前月的第一天 Calendar minCal = Calendar.getInstance(); minCal.add(Calendar.MONTH, 0); //设置为1号,当前日期既为本月第一天 minCal.set(Calendar.DAY_OF_MONTH,1); // 当前月的最后一天 Calendar maxCal = Calendar.getInstance(); maxCal.set(Calendar.DAY_OF_MONTH, maxCal.getActualMaximum(Calendar.DAY_OF_MONTH)); // 设置最小时间 -1000是为了防止设置的最小日期大于等于当前日期 // 时间相等会出现 java.lang.IllegalArgumentException: fromDate:xxx does not precede toDate: xxx 异常 datePicker.setMinDate(minCal.getTimeInMillis() - 1000); // 设置最大时间 datePicker.setMaxDate(maxCal.getTimeInMillis()); datePickerDialog.show(); } @Override public void onDestroy() { super.onDestroy(); if (datePickerDialog != null){ datePickerDialog.dismiss(); } } }
7e3c212a41f7130757ba5e5d0ea99228fe74e91e
e0f214d50d5c98513cb4d6c77946f84161334289
/ProfileServer/src/nl/knokko/bo/server/profile/ProfileConsole.java
fe2a83e95f8569e69da317e7e0fb2c6442a127a6
[ "MIT" ]
permissive
knokko/Bug-Outbreak-Server
c35f1c4f1d63ecde0d1c0243d5e46d163344f88b
a1512a7d023c51882fb196690ec514726a90d659
refs/heads/master
2020-03-28T17:46:07.860678
2019-02-02T13:15:53
2019-02-02T13:15:53
148,820,544
0
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
/******************************************************************************* * The MIT License * * Copyright (c) 2018 knokko * * 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 nl.knokko.bo.server.profile; import java.net.InetAddress; import java.net.UnknownHostException; import nl.knokko.util.console.Console; public class ProfileConsole extends Console { @Override protected void stop() { ProfileServer.stop(); } @Override protected void executeCommand(String[] command) { if (command[0].equals("start")) { if (ProfileServer.getWebServer() == null) { if (command.length == 4) { try { int ownWebPort = Integer.parseInt(command[1]); try { int authTCPPort = Integer.parseInt(command[3]); try { String host = InetAddress.getLocalHost().getHostAddress(); ProfileServer.startConnection(host, ownWebPort, command[2], authTCPPort); } catch (UnknownHostException uhe) { println("Can't find own host name"); } } catch (NumberFormatException nfe) { println("Can't parse auth tcp port number"); } } catch (NumberFormatException nfe) { println("Can't parse own web port number"); } } else { println("Use start <web port> <auth host> <auth tcp port>"); } } else { println("The connection has already started"); } } else if (command[0].equals("stop") || command[0].equals("exit")) { stop(); } else if (command[0].equals("terminate")) { System.exit(0); } } void setStopping() { stopping = true; } }
cfe84618d7a89cbb858a5fcf988c7904dbfd1478
98a15bb6b79086d17a1f74f92e09d54530efec52
/Pre-Exam-Coding/src/experiments/Conversions.java
8106d0a01a12f9ee62b34eec1f24a57b1d120c83
[]
no_license
christopher-clark/Pre-Exam-Coding
9db60395a7eff63392292b81867a1c31408b9d05
28337701e3fd8cddb78ea1c863464abed4a2d953
refs/heads/master
2020-12-21T19:44:52.625157
2016-08-11T07:55:07
2016-08-11T07:55:07
58,253,486
0
0
null
null
null
null
UTF-8
Java
false
false
685
java
package experiments; public class Conversions { public static void main(String[] args) { // Primitive from Wrapper Character ch = 'C'; Integer i = 1024; char c = ch.charValue(); System.out.println("char from Character = " + c + " int = " + i.floatValue()); // Wrapper from String Integer integer = Integer.valueOf("1234"); System.out.println("Integer from String = " + integer); Byte byt = Byte.valueOf("101",8); System.out.println("Byte from String = " + byt); // primitive from String Float f = Float.parseFloat("102.0012"); if (f instanceof Float){ System.out.println("Float instance from String = " + f); } } }
bc551b194f8e21173a2f9c5fb3017419cc22a164
2ebcf265598f2c363523125f722ba3609b31362c
/FirstCodeForAndroid/app/src/main/java/com/example/administrator/firstcodeforandroid/MainActivity.java
79e0533850694f196fa4453370633719833b740c
[]
no_license
AlenPan/AndroidStudioTestProject
d36563c684dad4509d00f4637416981842d7e75d
03f9625324696c68ee5e8b26f99720f49422c5ce
refs/heads/master
2021-01-20T06:13:05.241432
2017-06-09T14:25:42
2017-06-09T14:25:42
89,857,563
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
package com.example.administrator.firstcodeforandroid; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.d("Hello World", "onCreate execute"); } }
e1ecf7d7825c597ca9ea81dd12ceb2c525088687
0082dcc8b2f6036382720badd578020ff8959530
/AST/FunctionParameter.java
f9a7c47e00119bc136ad4a575e362559657a3eb9
[]
no_license
therafatm/unnamed-language
fde5128e2dd8326d86f57e84eee59207b1828694
9dc3e0f62766023f5356fe68d091fc4e632821ed
refs/heads/master
2020-03-11T16:20:07.476193
2019-02-19T18:31:55
2019-02-19T18:31:55
130,113,811
1
0
null
null
null
null
UTF-8
Java
false
false
329
java
package AST; import MyTypes.MyType; import Semantic.*; public class FunctionParameter { public MyType ctype; public Identifier id; public FunctionParameter(MyType ct, Identifier i) { ctype = ct; id = i; } public void accept (Visitor v) { v.visit(this); } }
c4e6f4433aef456fad6df73a986b3d4b15520f57
92b09f1d97f43229498ce0c7146e3ccf655647de
/trunk/pinacotheca/src/de/berlios/pinacotheca/http/HTTPLineReader.java
cf1edd149bb9e0c160319cd40e546c9c049eaa2f
[]
no_license
BackupTheBerlios/pinacotheca-svn
63ed64568e912ca37699bf0041585b81a6b283a8
e2ffbd88b492510fa164fbb6c32d36c43c4a87c3
refs/heads/master
2020-04-12T07:09:10.510822
2007-06-20T10:17:54
2007-06-20T10:17:54
40,804,629
0
0
null
null
null
null
UTF-8
Java
false
false
1,099
java
package de.berlios.pinacotheca.http; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; import de.berlios.pinacotheca.http.exceptions.HTTPRequestEntityTooLargeException; public class HTTPLineReader { private DataInputStream stream; private int bytesRead = 0; public HTTPLineReader(DataInputStream stream) { this.stream = stream; } public String readLine() throws IOException, HTTPRequestEntityTooLargeException { ArrayList<Byte> strBytes = new ArrayList<Byte>(1024); byte cChar, pChar = '\0'; for (;;) { if (strBytes.size() == 1024) throw new HTTPRequestEntityTooLargeException(); cChar = stream.readByte(); strBytes.add(cChar); if (pChar == '\r' && cChar == '\n') break; pChar = cChar; } bytesRead = strBytes.size(); return getString(strBytes); } private static String getString(ArrayList<Byte> strBytes) { byte[] buf = new byte[strBytes.size()]; for (int i = 0; i < buf.length; i++) buf[i] = strBytes.get(i); return new String(buf); } public int getLastBytesRead() { return bytesRead; } }
[ "sasv@2308440a-7130-0410-8cce-f38679fcd22b" ]
sasv@2308440a-7130-0410-8cce-f38679fcd22b
c5239dad1b6dcec3983e938495aac1f9c534e5a6
61d88c35e29a6236018e5db801003eed0b0a1ea2
/src/main/java/ch05/spittr/web/HomeController.java
af02b6437a0f8c1564dd46a6f6331fcd99f8d4e9
[]
no_license
codetaro/spring-in-action
fb41c25fdac47bae715ae645e7ebc5d3c43781ed
a551a64018c6f433dc1509942138ba2ecdcdb52c
refs/heads/master
2023-05-27T14:22:24.411585
2021-06-17T06:23:04
2021-06-17T06:23:04
377,727,164
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package ch05.spittr.web; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import static org.springframework.web.bind.annotation.RequestMethod.*; @Controller @RequestMapping({"/", "/homepage"}) public class HomeController { @RequestMapping(method = GET) public String home(Model model) { return "home"; } }
287e51a90e7f147010627a3dfe6950391c8df8f9
5a4d28e8348e3e4a248e7f80bc464f5410b03e09
/rest/java-brains/advance-jax-rs-06/src/main/java/com/javamultiplex/rest/client/RestClientGET.java
f2de5fa569c766fdeb513e1a4a7eb951d1defa5e
[]
no_license
javamultiplex/java-webservices
931bf120324095d352bc1898407793c6be5c5b20
c540af2238fddc04cafabe8656780bc7fd275246
refs/heads/master
2021-09-04T01:09:37.463106
2018-01-13T18:44:32
2018-01-13T18:44:32
117,375,645
0
0
null
null
null
null
UTF-8
Java
false
false
957
java
package com.javamultiplex.rest.client; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import com.javamultiplex.messanger.model.Message; public class RestClientGET { public static void main(String[] args) { Client client=ClientBuilder.newClient(); /*String response = client .target("http://localhost:8050/advance-jax-rs-01/webapi/messages/2") .request() .get(String.class);*/ WebTarget baseTarget = client.target("http://localhost:8050/advance-jax-rs-01/webapi"); WebTarget messageTarget = baseTarget.path("messages"); WebTarget singleMessageTarget = messageTarget.path("{messageId}"); Message message = singleMessageTarget.resolveTemplate("messageId", "2").request().get(Message.class); //Message message = response.readEntity(Message.class); //System.out.println(message.getMessage()); System.out.println(message.getMessage()); } }
d00e596ec4d8cea0ae3b3a8a6dc3b8d523ac982d
0532b41c0a433874b20a751d079a39c4254b9d33
/pa-rserve/src/test/java/org/ow2/parserve/tests/TestResultMap.java
437c8dd5f2b407e1296f995376f9ecbb0bd0ad49
[]
no_license
ow2-proactive/connector-r
0f7a0d9f5d34beaa68b0b327b67d1617fbf42473
a7c70a08e0f76d48fdb3dfbdde23359c40ba1b92
refs/heads/master
2023-06-01T13:36:48.174747
2023-05-23T12:54:26
2023-05-23T12:54:26
35,725,082
0
11
null
2023-09-09T23:22:53
2015-05-16T13:38:56
Java
UTF-8
Java
false
false
1,449
java
/* * ProActive Parallel Suite(TM): * The Open Source library for parallel and distributed * Workflows & Scheduling, Orchestration, Cloud Automation * and Big Data Analysis on Enterprise Grids & Clouds. * * Copyright (c) 2007 - 2017 ActiveEon * Contact: [email protected] * * This library 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: version 3 of * the License. * * 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/>. * * If needed, contact us to obtain a release under GPL Version 2 or 3 * or a different license than the AGPL. */ package org.ow2.parserve.tests; import org.junit.Test; import org.ow2.parserve.PARServeFactory; public class TestResultMap extends testabstract.TestResultMap { @Test public void testEmptyResultMap() throws Exception { super.testEmptyResultMap(PARServeFactory.ENGINE_NAME); } @Test public void testResultMap() throws Exception { super.testResultMap(PARServeFactory.ENGINE_NAME); } }
71c81dbe2c6cc51d49a9effd248f37dbfd426b39
b6c5eafc36b195374b45ef4577e548c6b12a8d3f
/app/src/main/java/com/worksdelight/phonecure/ReviewActivity.java
671fe515af6bbf5309b3f8d78e4374bd6f48f533
[]
no_license
porasdhiman/PhonecureApp
b209f72b057041383f30005f4b0f485d60be4c88
d35d251809332f98f4198c88c42c2e4d7b93f932
refs/heads/master
2021-07-16T19:17:35.865169
2017-10-17T13:38:32
2017-10-17T13:38:32
106,670,602
0
0
null
null
null
null
UTF-8
Java
false
false
1,825
java
package com.worksdelight.phonecure; import android.app.Activity; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.BaseAdapter; import android.widget.ListView; /** * Created by worksdelight on 06/03/17. */ public class ReviewActivity extends Activity { ListView review_listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.review_layout); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(getResources().getColor(R.color.black)); } review_listView=(ListView)findViewById(R.id.review_listView); //img.setColorFilter(img.getContext().getResources().getColor(R.color.fb_back), PorterDuff.Mode.SRC_ATOP); review_listView.setAdapter(new ReviewAdapter(this)); } class ReviewAdapter extends BaseAdapter{ Context c; LayoutInflater inflatore; ReviewAdapter(Context c){ this.c=c; inflatore=(LayoutInflater.from(c)); } @Override public int getCount() { return 20; } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } @Override public View getView(int i, View view, ViewGroup viewGroup) { view=inflatore.inflate(R.layout.review_list_item,null); return view; } } }
2b71276e23bdf9f714287bbfd8b680a213ac4180
76855ee7c590b56e43476954476bff3627cdd367
/src/main/java/frc/robot/subsystems/CargoIntake.java
c10791a4d514dc3220dc13e110c75c200464d594
[ "BSD-3-Clause" ]
permissive
Semiahmoo-Robotics/FIRSTDeepSpace2019-Public
2ee80ba0c8c726713e2b5b00cf99121bb736696d
5a4b3fcd2285636bedb88a392e2c9f21a81804a8
refs/heads/master
2020-04-14T22:19:31.555186
2019-02-27T06:39:38
2019-02-27T06:39:38
164,158,261
0
0
null
null
null
null
UTF-8
Java
false
false
1,386
java
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.subsystems; import edu.wpi.first.wpilibj.Spark; import edu.wpi.first.wpilibj.command.Subsystem; import frc.robot.RobotMap; /** * This subsystem controls the intake motors for the cargo intake. * Connected to a SPARK motor controller. */ public class CargoIntake extends Subsystem { private final Spark m_lIntake; private final Spark m_rIntake; public CargoIntake() { m_lIntake = new Spark(RobotMap.L_INTAKE); m_lIntake.setInverted(true); m_rIntake = new Spark(RobotMap.R_INTAKE); m_rIntake.setInverted(true); } public void SetIntake(double set) { m_lIntake.set(set); m_rIntake.set(set); } public void ReverseSetIntake(double set) { m_lIntake.set(set); m_rIntake.set(set); } public void StopIntake() { m_lIntake.set(0); m_rIntake.set(0); } @Override public void initDefaultCommand() { //none } }
9efb40143031b1fbdea0953ceef8b8a0a0f91e70
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/82/150.java
1d06b3ca359c8d0fae229b655be4470d2b768209
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
873
java
package <missing>; public class GlobalMembers { public static int Main() { int a; int b; int c = 0; int e; int n; int i; int k; int[] sz = new int[100]; String tempVar = ConsoleInput.scanfRead(); if (tempVar != null) { n = Integer.parseInt(tempVar); } for (i = 0;i < n;i++) { String tempVar2 = ConsoleInput.scanfRead(); if (tempVar2 != null) { a = Integer.parseInt(tempVar2); } String tempVar3 = ConsoleInput.scanfRead(); if (tempVar3 != null) { b = Integer.parseInt(tempVar3); } if (a >= 90 && a <= 140 && b >= 60 && b <= 90) { sz[c]++; } else { c++; } } for (i = 0;i < 99;i++) { for (k = 0;k < 99 - i;k++) { if (sz[k] > sz[k + 1]) { e = sz[k]; sz[k] = sz[k + 1]; sz[k + 1] = e; } } } System.out.printf("%d",sz[99]); return 0; } }
e4b53453433f5bea22aeac5059ea6264d7cc375f
c6fd99db51eced971cf31fb791f84be51c1f6242
/makeploy-web-home/src/main/java/com/onway/web/controller/result/MsgResult.java
b641e7963d348f7cb29a1c10f43667776b56b634
[]
no_license
zhongmingshen/gaosu
4baeabcb6e1029a9f1082795e0d8c18a423e2ebd
3e6b0223f195882d1784a07702688d4e54667b95
refs/heads/master
2022-09-10T06:55:30.588600
2017-11-10T08:18:09
2017-11-10T08:18:09
null
0
0
null
null
null
null
GB18030
Java
false
false
2,111
java
package com.onway.web.controller.result; /** * onway.com Inc. * Copyright (c) 2016-2016 All Rights Reserved. */ import com.onway.common.lang.DateUtils; import java.io.Serializable; import java.util.Date; /** * json调用默认结果 * * @author guangdong.li * @version $Id: JsonResult.java, v 0.1 2013-10-30 下午5:38:55 Exp $ */ public class MsgResult implements Serializable { /** * serialVersionUID */ private static final long serialVersionUID = 1475348231900998033L; private String time = DateUtils.format(new Date(), DateUtils.newFormat); // 业务操作结果 private boolean bizSucc = true; // 是否强制下线,账号已在另一设备登录 //private boolean isForceLogOut = false; private String errMsg = ""; // 错误码 private String errCode = ""; // private String status; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public MsgResult(boolean bizSucc) { this.bizSucc = bizSucc; } public MsgResult(boolean bizSucc, String errCode, String message) { this.bizSucc = bizSucc; this.errMsg = message; this.errCode = errCode; } public void markResult(boolean bizSucc, String errCode, String message) { this.bizSucc = bizSucc; this.errMsg = message; this.errCode = errCode; } public boolean isBizSucc() { return bizSucc; } public void setBizSucc(boolean bizSucc) { this.bizSucc = bizSucc; } public String getErrMsg() { return errMsg; } public void setErrMsg(String errMsg) { this.errMsg = errMsg; } public String getErrCode() { return errCode; } public void setErrCode(String errCode) { this.errCode = errCode; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } }
ab53ec041396e35dfa91d97def13606791883eea
b9c4ecc88aa5a63f553086632b1ff9ab9194b29a
/Chapter14/App13/src/main/java/net/homenet/configuration/FrontDeskConfiguration.java
2b16d23fb96a8dcd9e6e6fa8d6c3cf1b6a2e7b2c
[]
no_license
mousesd/Spring5Recipe
69c2fcf719274fb1f53de59289684734fff0225e
fa3cbcb83de41ab02150443c14068954fa0ab9f0
refs/heads/master
2020-03-31T01:59:05.007582
2019-02-13T15:33:42
2019-02-13T15:33:42
151,796,669
0
0
null
null
null
null
UTF-8
Java
false
false
1,983
java
package net.homenet.configuration; import net.homenet.FrontDesk; import net.homenet.FrontDeskImpl; import net.homenet.MailMessageConverter; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQQueue; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jms.connection.JmsTransactionManager; import org.springframework.jms.core.JmsTemplate; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.jms.ConnectionFactory; import javax.jms.Destination; @SuppressWarnings("Duplicates") @Configuration @EnableTransactionManagement public class FrontDeskConfiguration { @Bean public ConnectionFactory connectionFactory() { return new ActiveMQConnectionFactory("tcp://192.168.222.128:61616"); } @Bean public PlatformTransactionManager transactionManager(ConnectionFactory connectionFactory) { return new JmsTransactionManager(connectionFactory); } @Bean public Destination destination() { return new ActiveMQQueue("mail.queue"); } @Bean public MailMessageConverter mailMessageConverter() { return new MailMessageConverter(); } @Bean public JmsTemplate jmsTemplate(ConnectionFactory connectionFactory , Destination destination , MailMessageConverter mailMessageConverter) { JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setConnectionFactory(connectionFactory); jmsTemplate.setDefaultDestination(destination); jmsTemplate.setMessageConverter(mailMessageConverter); return jmsTemplate; } @Bean public FrontDesk frontDesk(JmsTemplate jmsTemplate) { FrontDeskImpl frontDesk = new FrontDeskImpl(); frontDesk.setJmsTemplate(jmsTemplate); return frontDesk; } }
4d5dd74145d77a67f78b4efbdd31dbf7a7aa6e88
ec3b8019ced299957595ed2ef95607a88d6880c5
/src/hw2/Human.java
ee784c1032e65c7d08fecc605deee83c87d03445
[]
no_license
crangoren/lvl2_hw2_21-12-20
ec21e5f383e0748ed31fd6ef09ce305398378e50
d9a6f3b7e4083e32840b43e960d409e4ceb88d52
refs/heads/master
2023-02-08T22:12:12.811854
2020-12-21T17:57:47
2020-12-21T17:57:47
323,410,483
0
0
null
2020-12-21T18:00:14
2020-12-21T17:57:32
Java
UTF-8
Java
false
false
1,040
java
package hw2; public class Human implements Move { private int runDistance; private int jumpHeight; private String name; @Override public void run() { System.out.println("human run"); } @Override public void jump() { System.out.println("human jump"); } @Override public void jumpOver(int height) { if (height <= jumpHeight) { Wall.jump(height, name); } else { System.out.println(name + " не перепрыгнул стену высотой " + height + "м."); } } @Override public void runAround(int distance) { if (distance <= runDistance) { Road.run(distance, name); } else { System.out.println(name + " не пробежал дистанцию " + distance + "м."); } } public Human(int runDistance, int jumpHeight, String name) { this.runDistance = runDistance; this.jumpHeight = jumpHeight; this.name = name; } }
36654d6a794a33585daa64cd29e9cf84d1e85605
f92a708d57d3a226b46a9b6d42f17ac6001590df
/app/src/main/java/com/kimyoung/zoom/ImageZoomView.java
22befcf4b4b875bdc0ed77ac47d37fa989798b30
[]
no_license
KiAlexander/Wifi_Indoor_Positioning
2395a522b844d9bef38c43e4a778af0931dc9a5e
a274feb10e0ff547d75f72e922f59d2e902d9551
refs/heads/master
2020-03-10T00:56:23.494314
2018-06-04T02:44:09
2018-06-04T02:44:09
128,932,010
0
0
null
null
null
null
UTF-8
Java
false
false
10,030
java
/* * AirPlace: The Airplace Project is an OpenSource Indoor and Outdoor * Localization solution using WiFi RSS (Receive Signal Strength). * The AirPlace Project consists of three parts: * * 1) The AirPlace Logger (Ideal for collecting RSS Logs) * 2) The AirPlace Server (Ideal for transforming the collected RSS logs * to meaningful RadioMap files) * 3) The AirPlace Tracker (Ideal for using the RadioMap files for * indoor localization) * * It is ideal for spaces where GPS signal is not sufficient. * * Authors: * C. Laoudias, G.Larkou, G. Constantinou, M. Constantinides, S. Nicolaou, * * Supervisors: * D. Zeinalipour-Yazti and C. G. Panayiotou * * Copyright (c) 2011, KIOS Research Center and Data Management Systems Lab (DMSL), * University of Cyprus. All rights reserved. * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * Υou should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (c) 2010, Sony Ericsson Mobile Communication AB. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the Sony Ericsson Mobile Communication AB nor the names * of its contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.kimyoung.zoom; import java.util.ArrayList; import java.util.Observable; import java.util.Observer; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PointF; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.widget.Toast; /** * View capable of drawing an image at different zoom state levels */ public class ImageZoomView extends View implements Observer { /** Paint object used when drawing bitmap. */ private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG); /** Rectangle used (and re-used) for cropping source image. */ private final Rect mRectSrc = new Rect(); /** Rectangle used (and re-used) for specifying drawing area on canvas. */ private final Rect mRectDst = new Rect(); /** Object holding aspect quotient */ private final AspectQuotient mAspectQuotient = new AspectQuotient(); /** The bitmap that we're zooming in, and drawing on the screen. */ private Bitmap mBitmap; /** State of the zoom. */ private ZoomState mState; // Public methods private ClickPoint curClick; private final PointF prevClick = new PointF(0, 0); private final ClickPoint clickPoint = new ClickPoint(-1, -1); private ArrayList<PointF> points = new ArrayList<PointF>(); private Context c = null; /** * Constructor */ public ImageZoomView(Context context, AttributeSet attrs) { super(context, attrs); } public void setCurClick(ClickPoint click) { if (curClick != null) { curClick.deleteObserver(this); } curClick = click; curClick.addObserver(this); invalidate(); } public void setContext(Context c) { this.c = c; } /** * Set image bitmap * * @param bitmap * The bitmap to view and zoom into */ public void setImage(Bitmap bitmap) { mBitmap = bitmap; mAspectQuotient.updateAspectQuotient(getWidth(), getHeight(), mBitmap.getWidth(), mBitmap.getHeight()); mAspectQuotient.notifyObservers(); points.clear(); invalidate(); } /** * Set object holding the zoom state that should be used * * @param state * The zoom state */ public void setZoomState(ZoomState state) { if (mState != null) { mState.deleteObserver(this); } mState = state; mState.addObserver(this); invalidate(); } /** * Gets reference to object holding aspect quotient * * @return Object holding aspect quotient */ public AspectQuotient getAspectQuotient() { return mAspectQuotient; } // Superclass overrides @Override protected void onDraw(Canvas canvas) { if (mBitmap != null && mState != null) { final float aspectQuotient = mAspectQuotient.get(); final int viewWidth = getWidth(); final int viewHeight = getHeight(); final int bitmapWidth = mBitmap.getWidth(); final int bitmapHeight = mBitmap.getHeight(); final float panX = mState.getPanX(); final float panY = mState.getPanY(); final float zoomX = mState.getZoomX(aspectQuotient) * viewWidth / bitmapWidth; final float zoomY = mState.getZoomY(aspectQuotient) * viewHeight / bitmapHeight; // Setup source and destination rectangles mRectSrc.left = (int) (panX * bitmapWidth - viewWidth / (zoomX * 2)); mRectSrc.top = (int) (panY * bitmapHeight - viewHeight / (zoomY * 2)); mRectSrc.right = (int) (mRectSrc.left + viewWidth / zoomX); mRectSrc.bottom = (int) (mRectSrc.top + viewHeight / zoomY); mRectDst.left = getLeft(); mRectDst.top = getTop(); mRectDst.right = getRight(); mRectDst.bottom = getBottom(); // Adjust source rectangle so that it fits within the source image. if (mRectSrc.left < 0) { mRectDst.left += -mRectSrc.left * zoomX; mRectSrc.left = 0; } if (mRectSrc.right > bitmapWidth) { mRectDst.right -= (mRectSrc.right - bitmapWidth) * zoomX; mRectSrc.right = bitmapWidth; } if (mRectSrc.top < 0) { mRectDst.top += -mRectSrc.top * zoomY; mRectSrc.top = 0; } if (mRectSrc.bottom > bitmapHeight) { mRectDst.bottom -= (mRectSrc.bottom - bitmapHeight) * zoomY; mRectSrc.bottom = bitmapHeight; } float Xana = (float) (mRectSrc.right - mRectSrc.left) / (float) (mRectDst.right - mRectDst.left); float Yana = (float) (mRectSrc.bottom - mRectSrc.top) / (float) (mRectDst.bottom - mRectDst.top); canvas.drawBitmap(mBitmap, mRectSrc, mRectDst, mPaint); Paint p = new Paint(); p.setColor(Color.RED); float clickPixelsX = (float) mRectSrc.left + (curClick.get().x - mRectDst.left) * Xana; float clickPixelsY = (float) mRectSrc.top + (curClick.get().y - mRectDst.top) * Yana; if (clickPixelsX >= 0 && clickPixelsX <= bitmapWidth && clickPixelsY >= 0 && clickPixelsY <= bitmapHeight) { if (!curClick.get().equals(prevClick.x, prevClick.y)) { prevClick.x = curClick.get().x; prevClick.y = curClick.get().y; clickPoint.setClickPoint(clickPixelsX, clickPixelsY); clickPoint.notifyObservers(); } } else if (!curClick.get().equals(prevClick.x, prevClick.y)) { Toast.makeText(c, "Click a point on the floorplan image!", Toast.LENGTH_SHORT).show(); } for (int i = 0; i < points.size(); ++i) { PointF temp = points.get(i); if (temp.x != -1 && temp.y != -1 && temp.x >= mRectSrc.left - 5 && temp.x <= mRectSrc.right + 5 && temp.y >= mRectSrc.top - 5 && temp.y <= mRectSrc.bottom + 5) { canvas.drawCircle((temp.x - mRectSrc.left) / Xana + mRectDst.left, (temp.y - mRectSrc.top) / Yana + mRectDst.top, 5, p); } } p.setColor(Color.GREEN); if (clickPoint.get().x != -1 && clickPoint.get().y != -1 && clickPoint.get().x >= mRectSrc.left - 5 && clickPoint.get().x <= mRectSrc.right + 5 && clickPoint.get().y >= mRectSrc.top - 5 && clickPoint.get().y <= mRectSrc.bottom + 5) { canvas.drawCircle((clickPoint.get().x - mRectSrc.left) / Xana + mRectDst.left, (clickPoint.get().y - mRectSrc.top) / Yana + mRectDst.top, 5, p); } } } public void setPoint() { points.add(new PointF(clickPoint.get().x, clickPoint.get().y)); } public ClickPoint getClickPoint() { return clickPoint; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mBitmap != null) { mAspectQuotient.updateAspectQuotient(right - left, bottom - top, mBitmap.getWidth(), mBitmap.getHeight()); mAspectQuotient.notifyObservers(); } } // implements Observer public void update(Observable observable, Object data) { invalidate(); } }
3475691d6fd7df5b14ecf66e96b00272bd98771b
a2ee20dea321660032e980a840cf58eed9cc0204
/app/src/test/java/com/example/jinkup/myapplication/ExampleUnitTest.java
e3205efa4367fd75d2bba2bac94cd4d5dd43165c
[]
no_license
yasinlove1/testgit2
d758f271f32bea5d07e8077b932b29aeb8cae725
7ef4d75f70bd05b7d69bb420def619f37e62b1d7
refs/heads/master
2020-06-29T12:03:57.323631
2016-09-05T07:29:50
2016-09-05T07:29:50
67,398,024
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.example.jinkup.myapplication; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
df0d49111cba2809d7872209c511801de2e8a88b
329307375d5308bed2311c178b5c245233ac6ff1
/src/com/tencent/mm/model/v.java
0708972c5bb6238c96c0f39305801aa3b5db66d7
[]
no_license
ZoneMo/com.tencent.mm
6529ac4c31b14efa84c2877824fa3a1f72185c20
dc4f28aadc4afc27be8b099e08a7a06cee1960fe
refs/heads/master
2021-01-18T12:12:12.843406
2015-07-05T03:21:46
2015-07-05T03:21:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,575
java
package com.tencent.mm.model; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import com.tencent.mm.a.c; import com.tencent.mm.a.l; import com.tencent.mm.h.a; import com.tencent.mm.sdk.platformtools.bn; import com.tencent.mm.sdk.platformtools.t; import com.tencent.mm.storage.aw; import com.tencent.mm.storage.h; import com.tencent.mm.storage.k; import com.tencent.mm.storage.q; import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public final class v { public static void a(int paramInt, Map paramMap) { StringBuilder localStringBuilder = new StringBuilder(); paramMap = paramMap.entrySet().iterator(); while (paramMap.hasNext()) { Map.Entry localEntry = (Map.Entry)paramMap.next(); localStringBuilder.append(String.format(Locale.US, "%s\n%s\n", new Object[] { localEntry.getKey(), localEntry.getValue() })); } if ((ax.tl() != null) && (ax.tl().rf() != null)) { ax.tl().rf().set(327682, localStringBuilder.toString()); } } public static void b(int paramInt, Map paramMap) { paramMap.clear(); if ((ax.tl() == null) || (ax.tl().rf() == null)) { t.d("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "acc stg is null"); } for (;;) { return; Object localObject = (String)ax.tl().rf().get(327682, null); if (localObject != null) { localObject = ((String)localObject).split("\n"); if (localObject.length % 2 != 0) { t.e("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "key and value not match, len: " + String.valueOf(localObject.length)); return; } paramInt = 0; while (paramInt < localObject.length) { paramMap.put(localObject[paramInt], localObject[(paramInt + 1)]); paramInt += 2; } } } } public static boolean b(String paramString1, String paramString2, boolean paramBoolean) { if ((paramString1 == null) || (paramString1.length() == 0)) { t.e("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "canSendRawImage, invalid argument"); } do { do { return false; } while ((paramString2 != null) && (paramString2.length() > 0) && ((k.yt(paramString2)) || (k.yv(paramString2)))); if (dG(paramString1)) { t.i("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "canSendRawImage : true. isSmallImg"); return true; } paramString2 = new BitmapFactory.Options(); inJustDecodeBounds = true; BitmapFactory.decodeFile(paramString1, paramString2); double d1 = outWidth; double d2 = outHeight; if ((d1 / d2 >= 2.5D) || (d2 / d1 >= 2.5D)) { t.i("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "canSendRawImage : true, width height ratio > 2.5"); return true; } } while (paramBoolean); return true; } public static boolean cv(int paramInt) { return (paramInt & 0x2000) != 0; } public static boolean dF(String paramString) { if ((paramString == null) || (paramString.length() <= 0)) { return false; } String str = rS(); if ((str == null) || (str.length() <= 0)) { t.e("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "get userinfo fail"); return false; } return str.equals(paramString); } public static boolean dG(String paramString) { boolean bool = true; if ((paramString == null) || (paramString.length() == 0)) { t.e("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "isSmallImg, invalid argument"); bool = false; } while (c.ay(paramString) < 65536) { return bool; } BitmapFactory.Options localOptions = new BitmapFactory.Options(); inJustDecodeBounds = true; BitmapFactory.decodeFile(paramString, localOptions); double d1 = outWidth; double d2 = outHeight; if ((d1 < 100.0D) && (d2 < 100.0D)) { t.i("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "isSmallImg : true, width = " + d1 + ", height = " + d2); return true; } return false; } public static String getUserBindEmail() { return bn.iV((String)ax.tl().rf().get(5, null)); } public static int rR() { Integer localInteger = (Integer)ax.tl().rf().get(9, null); if (localInteger == null) { return 0; } return localInteger.intValue(); } public static String rS() { return (String)ax.tl().rf().get(2, null); } public static String rT() { return (String)ax.tl().rf().get(42, null); } public static String rU() { return (String)ax.tl().rf().get(4, null); } public static String rV() { String str = rT(); if (!bn.iW(str)) { return str; } return rS(); } public static int rW() { Integer localInteger = (Integer)ax.tl().rf().get(7, null); if (localInteger == null) { return 0; } return localInteger.intValue(); } public static int rX() { Integer localInteger = (Integer)ax.tl().rf().get(40, null); if (localInteger == null) { return 0; } return localInteger.intValue(); } private static int rY() { Integer localInteger = (Integer)ax.tl().rf().get(339975, null); if (localInteger == null) { return 0; } return localInteger.intValue(); } public static boolean rZ() { return (rX() & 0x4000) != 0; } public static boolean sa() { return (rX() & 0x8000) != 0; } public static int sb() { Integer localInteger = (Integer)ax.tl().rf().get(34, null); if (localInteger == null) { return 0; } return localInteger.intValue(); } public static boolean sc() { return (rW() & 0x40) != 0; } public static boolean sd() { if ((rW() & 0x40000) != 0) {} for (boolean bool = true;; bool = false) { t.d("!44@/B4Tb64lLpIASzWhbQWz2YUPL7bBfwfOEGvq4vvm/NU=", "isGooglePay: %s", new Object[] { Boolean.valueOf(bool) }); return bool; } } public static boolean se() { ax.tl().rf().eN(true); return rY() == 1; } public static boolean sf() { ax.tl().rf().eN(true); return rY() == 2; } public static boolean sg() { return (sb() & 0x20) == 0; } public static boolean sh() { return (rW() & 0x1000) != 0; } public static boolean si() { aw localaw = ax.tl().rn().Ae("@t.qq.com"); return (localaw != null) && (localaw.aIf()); } public static boolean sj() { return (sb() & 0x2) == 0; } public static boolean sk() { return (sb() & 0x10) == 0; } public static boolean sl() { return (sb() & 0x80) == 0; } public static boolean sm() { return bn.c((Boolean)ax.tl().rf().get(8200, null)); } public static boolean sn() { return (sb() & 0x80000) == 0; } public static boolean so() { return (sb() & 0x40000) == 0; } public static boolean sp() { return (sb() & 0x2000) == 0; } public static boolean sq() { return (sb() & 0x10000) == 0; } public static boolean sr() { String str = (String)ax.tl().rf().get(65825, null); if (bn.iW(str)) { return false; } if (str.equals("0")) { return false; } try { long l = bn.b(Long.valueOf(Long.parseLong(str))); if (l == 0L) { return false; } } catch (Exception localException) { return false; } return true; } public static boolean ss() { return (sb() & 0x1) == 0; } public static boolean st() { return (rW() & 0x20000) == 0; } public static int su() { return bn.b((Integer)ax.tl().rf().get(8201, null), 22); } public static int sv() { return bn.b((Integer)ax.tl().rf().get(8208, null), 8); } public static k sw() { k localk = ax.tl().ri().yM(rS()); if ((localk != null) && ((int)bkE > 0)) { return localk; } localk = new k(); String str1 = (String)ax.tl().rf().get(2, null); String str2 = (String)ax.tl().rf().get(4, null); localk.setUsername(str1); localk.bG(str2); ax.tl().ri().H(localk); return ax.tl().ri().yM(str1); } public static boolean sx() { return new l(bn.c((Integer)ax.tl().rf().get(9, null))).longValue() != 0L; } } /* Location: * Qualified Name: com.tencent.mm.model.v * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
c1e7dbe0f7b58f3f4f7cd1be2574b8abdf11de9c
cc7a4612a79b6cb2e581f786c49543e18053ffc0
/2021/02/도영이가 만든 맛있는 음식.java
4e2a6024341e21f29c36fda3737b3fa7f74e5e16
[]
no_license
seongpyoHong/algorithm
9412667ebadfa6598b854dfd9da9aab8843f177a
c62e60e0e2b1e510e596a7b27ccee80936ca1c70
refs/heads/master
2023-06-27T22:42:51.018941
2021-07-25T09:07:05
2021-07-25T09:07:05
173,254,310
0
0
null
null
null
null
UTF-8
Java
false
false
1,296
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Solution2961 { static class Pair { int x; int y; Pair(int x, int y) { this.x = x; this.y = y; } } static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static Pair[] input; static boolean[] check; static long min = 10000000001L; static int N; public static void main(String[] args) throws NumberFormatException, IOException { N = Integer.parseInt(br.readLine()); input = new Pair[N]; check = new boolean[N]; for (int i = 0; i < N; i++) { String[] line = br.readLine().split(" "); input[i] = new Pair(Integer.parseInt(line[0]), Integer.parseInt(line[1])); } getSubset(0); System.out.println(min); } static void getSubset(int idx) { if (idx == N) { min = Math.min(min, getDiff()); return; } check[idx] = true; getSubset(idx + 1); check[idx] = false; getSubset(idx + 1); } static long getDiff() { long totalX = 1; long totalY = 0; int cnt = 0; for (int i = 0; i < N; i++) { if (!check[i]) continue; totalX *= (long)input[i].x; totalY += (long)input[i].y; cnt += 1; } if (cnt == 0) return 10000000001L; return Math.abs(totalX - totalY); } }
340c970305830e2dfb1c9e0d217ef2477f13ecc3
343f71563c849f9732982f86a5e826d4c68b17e1
/src/com/design/strategy/behavior/quack/impl/Mute.java
d2a67de41fb63d62925d791c7efffdbb83513a21
[]
no_license
bgee0915/design-pattern
859983481f017b8fb231846297642e92aac8c170
7e7f709e943037edf2bb85b088eca3267495c4f5
refs/heads/master
2021-01-02T09:35:33.033249
2018-01-08T16:29:15
2018-01-08T16:29:15
99,253,814
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.design.strategy.behavior.quack.impl; import com.design.strategy.behavior.quack.QuackBehavior; public class Mute implements QuackBehavior{ @Override public void quack() { System.out.println("mute | quack | 吱吱吱吱吱吱吱"); } }
9ca5e92c2fa1c5e2c533fb9b5b071dd0a29865ea
d51e9da2524d9cb44aa5a39dcc79106eeebd71e9
/src/main/java/cn/jc/dao/RepairCardMapper.java
ad4dae0bc5ec73bb3e7c93b19886109f95125402
[]
no_license
EquationPro/clocking-in
f2fa17f8ef2499bacb5f72ed31f060f8ddfcc1f0
8a8b2a5e29b21f0296b98178e907f4f07d6ba83a
refs/heads/master
2022-12-22T10:09:59.194629
2019-10-09T01:05:20
2019-10-09T01:05:20
213,788,491
0
0
null
2022-12-16T09:43:35
2019-10-09T01:04:27
HTML
UTF-8
Java
false
false
1,059
java
package cn.jc.dao; import cn.jc.entity.RepairCard; import org.apache.ibatis.annotations.Param; import java.util.List; public interface RepairCardMapper { //分页查 List<RepairCard> list(@Param("currentPage") Integer currentPage, @Param("limit") Integer limit); //分页总条数 Integer getCountTotal(); //增 Integer insertRepairCard(RepairCard repairCard); //删 Integer deleteRepairCard(Integer repId); //查找对象 RepairCard loadRepairCard(Integer repId); //改 Integer updateRepairCard(RepairCard repairCard); //查询一个区间内的记录分页显示 List<RepairCard> listLimitTimeForPage(@Param("repTimeBegin") String repTimeBegin, @Param("repTimeEnd") String repTimeEnd,@Param("repEmp") String repEmp,@Param("currentPage") Integer currentPage, @Param("limit") Integer limit); //查询一个区间内的记录分页总条数 Integer getCountTotalLimitForPage(@Param("repTimeBegin") String repTimeBegin, @Param("repTimeEnd") String repTimeEnd,@Param("repEmp") String repEmp); }
6204f1a760ec01357faf63735606e47f23abb279
b6173660847b36ec523bc0d2e354d7e7e00812cb
/android-project/app/src/main/java/deliverytrack/vss/com/deliverytrack/interfaces/AreasCallbacks.java
0a7976bd177d94cb953b214899855c1b45514aac
[]
no_license
RosaProg/codes
dac30b983f1b488f9c3d5eaf8ba07cffc83d8036
e0ccaeacd0fa5bac21eeb04273df114f8511ac07
refs/heads/master
2022-12-17T02:26:31.386724
2019-06-11T21:51:08
2019-06-11T21:51:08
190,406,065
1
0
null
2022-12-07T23:24:28
2019-06-05T14:03:40
PHP
UTF-8
Java
false
false
427
java
package deliverytrack.vss.com.deliverytrack.interfaces; import com.parse.ParseObject; import deliverytrack.vss.com.deliverytrack.models.Area; import java.util.List; import deliverytrack.vss.com.deliverytrack.models.Order; /** * Created by Johnn Charles on 3/25/2016. */ public interface AreasCallbacks { public void getAreas(List<ParseObject> parseObjects, int tableId); public void onAreaAccepted(Area area); }
3125566f7d7eef578f01b5708bd80bab23d6e72a
f4ec0de8af1dec2d90c3452447d9da464a9cc4ac
/src/org/netbeans/module/sandbox/ui/CodeFlowReviewTopComponent.java
239321ce19d4a00fd1b1931cbb1390774c742b3b
[]
no_license
skrymets/nb-algorithm-viewer
d79d16c275e0dca59f6b0e2d4d282698f730ae22
41057a25ba85e3b16adccf18d601cb482fe27bdd
refs/heads/master
2021-01-13T04:20:56.230756
2016-12-29T17:32:08
2016-12-29T17:32:08
77,457,560
0
0
null
null
null
null
UTF-8
Java
false
false
5,155
java
package org.netbeans.module.sandbox.ui; import java.awt.Color; import javax.swing.GroupLayout; import org.apache.batik.swing.JSVGCanvas; import org.apache.batik.swing.JSVGScrollPane; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.NbBundle.Messages; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; import org.w3c.dom.svg.SVGDocument; /** * Top component which displays something. */ @ConvertAsProperties( dtd = "-//org.netbeans.module.sandbox.ui//CodeFlowReview//EN", autostore = false ) @TopComponent.Description( preferredID = "CodeFlowReviewTopComponent", iconBase = "org/netbeans/module/sandbox/ui/arrows-split.png", persistenceType = TopComponent.PERSISTENCE_ALWAYS ) @TopComponent.Registration(mode = "rightSlidingSide", openAtStartup = true) @ActionID(category = "Window", id = "org.netbeans.module.sandbox.ui.CodeFlowReviewTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistration( displayName = "#CTL_CodeFlowReviewAction", preferredID = "CodeFlowReviewTopComponent" ) @Messages({ "CTL_CodeFlowReviewAction=CodeFlowReview", "CTL_CodeFlowReviewTopComponent=CodeFlowReview Window", "HINT_CodeFlowReviewTopComponent=This is a CodeFlowReview window" }) public final class CodeFlowReviewTopComponent extends TopComponent { private static final long serialVersionUID = 5219299625668111931L; public static final String TOP_COMPONENT_ID = "CodeFlowReviewTopComponent"; private static CodeFlowReviewTopComponent instance; private final JSVGCanvas canvas; public CodeFlowReviewTopComponent() { canvas = new JSVGCanvas(); canvas.setDocumentState(JSVGCanvas.ALWAYS_INTERACTIVE); initComponents(); setName(Bundle.CTL_CodeFlowReviewTopComponent()); setToolTipText(Bundle.HINT_CodeFlowReviewTopComponent()); initAdditionalComponents(); } public static synchronized CodeFlowReviewTopComponent getInstance() { TopComponent window = WindowManager.getDefault().findTopComponent(TOP_COMPONENT_ID); if (window == null) { return getDefault(); } if (window instanceof CodeFlowReviewTopComponent) { return (CodeFlowReviewTopComponent) window; } return getDefault(); } public static synchronized CodeFlowReviewTopComponent getDefault() { if (instance == null) { instance = new CodeFlowReviewTopComponent(); } return instance; } /** * 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. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables @Override public void componentOpened() { // TODO add custom code on component opening } @Override public void componentClosed() { // TODO add custom code on component closing } void writeProperties(java.util.Properties p) { // better to version settings since initial version as advocated at // http://wiki.apidesign.org/wiki/PropertyFiles p.setProperty("version", "1.0"); // TODO store your settings } void readProperties(java.util.Properties p) { String version = p.getProperty("version"); // TODO read your settings according to their version } private void initAdditionalComponents() { JSVGScrollPane canvasScrollPane = new JSVGScrollPane(canvas); canvasScrollPane.setBackground(Color.BLUE); GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(canvasScrollPane, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(canvasScrollPane, GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) ); this.add(canvasScrollPane); } public void setDocument(SVGDocument document) { canvas.setDocument(document); } }
00011ba31e0052d8e51df1929e4ad0b82e5347a4
593a82eab25505e5f1a4b76e5608c4b3fccf8412
/src/main/java/com/famessoft/oplus/jat/web/rest/errors/CustomParameterizedException.java
49d0f141e04baf94bee2da5be17854df23dcb390
[]
no_license
coding99/oplusJat
6484a03e44e27379cce0ca22faf1643771b414af
b0b41f92fc6bc7f4fd018039813b98677c89f789
refs/heads/master
2021-08-15T00:37:42.553246
2017-11-17T02:45:31
2017-11-17T02:45:31
111,040,742
0
0
null
null
null
null
UTF-8
Java
false
false
1,741
java
package com.famessoft.oplus.jat.web.rest.errors; import org.zalando.problem.AbstractThrowableProblem; import java.util.HashMap; import java.util.Map; import static org.zalando.problem.Status.BAD_REQUEST; /** * Custom, parameterized exception, which can be translated on the client side. * For example: * * <pre> * throw new CustomParameterizedException(&quot;myCustomError&quot;, &quot;hello&quot;, &quot;world&quot;); * </pre> * * Can be translated with: * * <pre> * "error.myCustomError" : "The server says {{param0}} to {{param1}}" * </pre> */ public class CustomParameterizedException extends AbstractThrowableProblem { private static final long serialVersionUID = 1L; private static final String PARAM = "param"; public CustomParameterizedException(String message, String... params) { this(message, toParamMap(params)); } public CustomParameterizedException(String message, Map<String, Object> paramMap) { super(ErrorConstants.PARAMETERIZED_TYPE, "Parameterized Exception", BAD_REQUEST, null, null, null, toProblemParameters(message, paramMap)); } public static Map<String, Object> toParamMap(String... params) { Map<String, Object> paramMap = new HashMap<>(); if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { paramMap.put(PARAM + i, params[i]); } } return paramMap; } public static Map<String, Object> toProblemParameters(String message, Map<String, Object> paramMap) { Map<String, Object> parameters = new HashMap<>(); parameters.put("message", message); parameters.put("params", paramMap); return parameters; } }
2142f8ee32ea336909bf52ce35bd128ffbffaab3
0d3b137f74ae72b42348a898d1d7ce272d80a73b
/src/main/java/com/dingtalk/api/response/OapiAlitripBtripAddressGetResponse.java
4bd0756c1c3b5905f09f1078e2f48572334b65d9
[]
no_license
devezhao/dingtalk-sdk
946eaadd7b266a0952fb7a9bf22b38529ee746f9
267ff4a7569d24465d741e6332a512244246d814
refs/heads/main
2022-07-29T22:58:51.460531
2021-08-31T15:51:20
2021-08-31T15:51:20
401,749,078
0
0
null
null
null
null
UTF-8
Java
false
false
1,770
java
package com.dingtalk.api.response; import com.taobao.api.internal.mapping.ApiField; import com.taobao.api.TaobaoObject; import com.taobao.api.TaobaoResponse; /** * TOP DingTalk-API: dingtalk.oapi.alitrip.btrip.address.get response. * * @author top auto create * @since 1.0, null */ public class OapiAlitripBtripAddressGetResponse extends TaobaoResponse { private static final long serialVersionUID = 1578935652654813547L; /** * 错误码 */ @ApiField("errcode") private Long errcode; /** * 错误信息 */ @ApiField("errmsg") private String errmsg; /** * 结果对象 */ @ApiField("result") private OpenApiJumpInfoRs result; /** * 成功标识 */ @ApiField("success") private Boolean success; public void setErrcode(Long errcode) { this.errcode = errcode; } public Long getErrcode( ) { return this.errcode; } public void setErrmsg(String errmsg) { this.errmsg = errmsg; } public String getErrmsg( ) { return this.errmsg; } public void setResult(OpenApiJumpInfoRs result) { this.result = result; } public OpenApiJumpInfoRs getResult( ) { return this.result; } public void setSuccess(Boolean success) { this.success = success; } public Boolean getSuccess( ) { return this.success; } public boolean isSuccess() { return getErrcode() == null || getErrcode().equals(0L); } /** * 结果对象 * * @author top auto create * @since 1.0, null */ public static class OpenApiJumpInfoRs extends TaobaoObject { private static final long serialVersionUID = 6475518241749648976L; /** * 访问地址 */ @ApiField("url") private String url; public String getUrl() { return this.url; } public void setUrl(String url) { this.url = url; } } }
4d0aa2d95ce615ea73b79b3a6e01a67427566b13
9aa285c357ab7fc0c64f0d9d67a4ef527301c672
/app/src/main/java/com/example/nicholaspark/moviemvp/Data/MovieDataSource.java
9ff24f717dce81be8bff64cf01f0182daee33fcc
[]
no_license
nicholaspark09/MovieMVP
b6c17d00ffdf2f942d29c64ec714acfac8c4567b
ebade036801e083d8463f510763a204a50235c04
refs/heads/master
2021-01-11T17:02:47.144009
2016-09-28T23:04:37
2016-09-28T23:04:37
69,506,254
0
0
null
null
null
null
UTF-8
Java
false
false
926
java
package com.example.nicholaspark.moviemvp.Data; import android.support.annotation.NonNull; import com.example.nicholaspark.moviemvp.Models.Movie; import java.util.List; import java.util.Map; /** * Created by nicholaspark on 9/28/16. * * Whether it's local SQLite or RESTFUL API, * * The classes that implement this interface must have the methods inside */ public interface MovieDataSource { interface LoadMoviesCallback{ void onMoviesLoaded(List<Movie> movies); void onDataNotAvailable(); } interface GetMovieCallback{ void onMovieLoaded(Movie movie); void onDataNotAvailable(); } void getMovies(Map<String,String> params,@NonNull LoadMoviesCallback callback); void getMovie(@NonNull int id, @NonNull GetMovieCallback callback); void saveMovie(@NonNull Movie movie); void deleteAllMovies(); void deleteMovie(@NonNull int movieId); }
8374115c5e270d796374ce999fb8dcd3cc48d486
8d9b25d52dc83764a40e704e8e5cc1734f70f8e1
/app/src/main/java/in/grappes/ecommerce/ui/activities/ProductDetailActivity.java
3e135c8ea831e2051e0071b64ff386344a98eac4
[]
no_license
lavv31/Capstone2---Ecommerce-App
a9df0f8fb445962bbbb1d261bb69980b50bf97b6
d002262e9465534da4563b4674f9481aa00f2229
refs/heads/master
2021-06-19T08:08:45.270601
2017-05-25T17:13:29
2017-05-25T17:13:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,108
java
package in.grappes.ecommerce.ui.activities; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import cn.trinea.android.view.autoscrollviewpager.AutoScrollViewPager; import in.grappes.ecommerce.R; import in.grappes.ecommerce.model.Cart; import in.grappes.ecommerce.model.Product; import in.grappes.ecommerce.ui.adapter.ProductDetailPagerAdapter; import in.grappes.ecommerce.utils.AppUtils; import in.grappes.ecommerce.utils.SharedPrefUtils; import in.grappes.ecommerce.utils.ToolbarUtils; import me.relex.circleindicator.CircleIndicator; public class ProductDetailActivity extends AppCompatActivity implements Cart.CartUpdateListener{ TextView productName; TextView productShortDesc; TextView productLongDesc; TextView productPrice; TextView productOriginalPrice; TextView addToCartBtn; TextView buyNowBtn; AutoScrollViewPager customViewPager; CircleIndicator indicator; ArrayList<String> pagerList; Product product; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_detail); getIntentData(); ToolbarUtils.setToolbar((ViewGroup) ((ViewGroup) this .findViewById(android.R.id.content)), ProductDetailActivity.this, getResources().getString(R.string.prduct_det)); setViews(); setupImageBanners(); initViews(); } private void getIntentData() { if(getIntent().getExtras()!=null) { product = getIntent().getExtras().getParcelable("product"); pagerList = product.imageLinkArray; pagerList.add(0, product.productImageLink); } } private void initViews() { productName.setText(product.productName); productShortDesc.setText(product.shortDescription); productLongDesc.setText(product.productDescription); productOriginalPrice.setText(""+product.originalPrice); productPrice.setText(""+product.sellingPrice); if(product.sellingPrice==product.originalPrice) { productOriginalPrice.setVisibility(View.GONE); } else { productOriginalPrice.setVisibility(View.VISIBLE); } addToCartBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(ProductDetailActivity.this, getResources().getString(R.string.added_to_cart), Toast.LENGTH_SHORT).show(); Cart.getInstance(ProductDetailActivity.this).addProductToCart(product); } }); buyNowBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Cart.getInstance(ProductDetailActivity.this).addProductToCart(product); proceedToNextActivity(); } }); } private void proceedToNextActivity() { if(SharedPrefUtils.getCurrentUser(ProductDetailActivity.this)!=null) { Intent i = new Intent(ProductDetailActivity.this, AddressActivity.class); startActivity(i); } else { Intent i = new Intent(ProductDetailActivity.this, LoginActivity.class); i.putExtra("destination", "checkout"); startActivity(i); } } private void setViews() { productName = (TextView) findViewById(R.id.product_name); productShortDesc = (TextView) findViewById(R.id.product_short_description); productLongDesc = (TextView) findViewById(R.id.product_long_description); productPrice = (TextView) findViewById(R.id.product_price); productOriginalPrice = (TextView) findViewById(R.id.product_original_price); addToCartBtn = (TextView) findViewById(R.id.add_to_cart_btn); buyNowBtn = (TextView) findViewById(R.id.buy_now_btn); customViewPager = (AutoScrollViewPager) findViewById(R.id.product_detail_pager); indicator = (CircleIndicator) findViewById(R.id.indicator); } private void setupImageBanners() { ProductDetailPagerAdapter viewPagerAdapter = new ProductDetailPagerAdapter(ProductDetailActivity.this, pagerList); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(AppUtils.getDeviceDimensions(this).x, AppUtils.getDeviceDimensions(this).x/2); customViewPager.setLayoutParams(layoutParams); customViewPager.startAutoScroll(); customViewPager.setInterval(5000); customViewPager.setCycle(true); customViewPager.setOffscreenPageLimit(2); customViewPager.setAdapter(viewPagerAdapter); indicator.setViewPager(customViewPager); customViewPager.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { try { customViewPager.stopAutoScroll(); new Handler().postDelayed(new Runnable() { @Override public void run() { customViewPager.startAutoScroll(); } }, 5000); } catch (Exception e) { e.printStackTrace(); } return false; } }); if(pagerList==null || pagerList.size()<1) { RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) customViewPager.getLayoutParams(); params.height = 0; } } @Override public void OnCartUpdated() { } }
c18525d93082415209ebe891e580ec4638772788
fe5312d5979c7ae836b2c33148c772d1560c2796
/view/map/PanelMainShips.java
96bda91f318de928b935b6ae88bfa7fa0552f871
[]
no_license
SilverHitman/WarshipRampage
a8b4e8f87ada03633cad983cccfa8372753ee5ca
95a23e20a606b631becdc8e8ce7ccfc43bad12c1
refs/heads/master
2020-06-01T15:43:10.161879
2019-06-08T02:57:30
2019-06-08T02:57:30
190,838,044
0
0
null
null
null
null
UTF-8
Java
false
false
2,295
java
package view.map; import com.sun.glass.ui.Size; import controller.Constants; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import static java.awt.Frame.MAXIMIZED_BOTH; import java.awt.event.ActionListener; import java.awt.event.MouseListener; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JLabel; import javax.swing.JPanel; import view.map.PanelMap; import view.map.TopPanel; public class PanelMainShips extends JPanel{ private static final long serialVersionUID = 1L; private PanelMap mapUser; private PanelInfoShips panelInfo; private PanelAttacks panelattacks; private JPanel panelCenter; private TopPanel topPanel; public PanelMainShips(ActionListener action) { setBackground(Color.decode(Constants.ColorWood)); //setMinimumSize(new Dimension(1000, 600)); setLayout(new BorderLayout()); panelInfo = new PanelInfoShips(action); add(panelInfo, BorderLayout.WEST); panelCenter = new JPanel(); panelCenter.setLayout(new BorderLayout()); mapUser = new PanelMap(0,0, null, action ); panelCenter.add(mapUser, BorderLayout.CENTER); add(panelCenter, BorderLayout.CENTER); topPanel = new TopPanel(action); topPanel.setOpaque(true); panelCenter.add(topPanel, BorderLayout.NORTH); setOpaque(true); } public TopPanel getTopPanel() { return topPanel; } public void createMapPlayer(int we, int hei, MouseListener mouse, ActionListener action){ panelCenter.remove(mapUser); mapUser = new PanelMap(we,hei, mouse, action ); panelCenter.add(mapUser, BorderLayout.CENTER); } public PanelMap getMapUser() { return mapUser; } public PanelInfoShips getPanelInfo() { return panelInfo; } public void setnewShipsPlayer(ArrayList listShips) { mapUser.setShips(listShips); } public void setMarkPlayer(ArrayList listmark){ mapUser.setListMarks(listmark); } }
c749c713dc7ee4fec5db7910a43b258a464c3cf3
df33a8244b81113a19c7e132f5c971208d2e8777
/src/model/Game.java
77a35a92a1f4913883a7c5fada017e6a766fffb4
[]
no_license
idkwhattoputkk/SnakeGame
c72854d047f8d7cea0ceaf95b205b71a46cc8af4
24f6d9e177b4d8ea19ef2155c16fa048b16dc7ee
refs/heads/master
2020-05-27T12:28:13.291611
2019-05-26T22:30:44
2019-05-26T22:30:44
188,618,110
0
0
null
null
null
null
UTF-8
Java
false
false
1,141
java
package model; import javax.sound.sampled.Clip; public class Game { private int Score; private Player rootPlayer; private Food bocaditos; private Clip songAmbiente; private int level; private Player player; public Game() { super(); level =1; player = new Player(null); rootPlayer = null; } public void startGame() { //TODO initialize the game; } public int getScore() { return Score; } public void setScore(int score) { Score = score; } public Player getRootPlayer() { return rootPlayer; } public void setRootPlayer(Player rootPlayer) { this.rootPlayer = rootPlayer; } public Food getBocaditos() { return bocaditos; } public void setBocaditos(Food bocaditos) { this.bocaditos = bocaditos; } public Clip getSongAmbiente() { return songAmbiente; } public void setSongAmbiente(Clip songAmbiente) { this.songAmbiente = songAmbiente; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public Player getPlayer() { return player; } public void setPlayer(Player player) { this.player = player; } }
238cc4332563fc83462e24ec76fc827244f88928
67cfadc6663f1068f4992180df098c048b08fc61
/TemperatureConverter1/src/via/sdj2/thread/Main.java
2fd50014f308f71c4d4194d2f4e5166b5a7e27a3
[]
no_license
LosCrimson/University-projects
355e71d83e3864c8d8e49212a1d96768b35421ef
2a2771c83bc30959e12266f7e7d2cda65a23bdbb
refs/heads/master
2022-11-16T21:22:15.343300
2020-07-02T09:20:44
2020-07-02T09:20:44
276,311,570
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package via.sdj2.thread; import javafx.application.Application; public class Main { public static void main(String[] args) { Application.launch(MyApplication.class); } }
7df24b2ed9aba8ef1d0f98c0dd08cda7343df5dd
ea12f04fe195aa89bf12c7a4099a37dadc3f7c93
/src/main/java/spinnerClass/SpinnerClass.java
daa2a0f5e9499356c95755a2fbb24240f77e5e02
[ "Apache-2.0" ]
permissive
roid1973/Spinner-Production
65d1feb3c1dda63c537f987609fb99109caf38ab
ef109778005bbf78cc2d920129018ad40dfabf09
refs/heads/master
2020-03-18T07:33:34.131405
2018-05-22T22:55:26
2018-05-22T22:55:26
134,460,390
0
0
Apache-2.0
2018-05-22T22:55:27
2018-05-22T18:42:28
Java
UTF-8
Java
false
false
9,591
java
package spinnerClass; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import spinnerCalendar.SpinnerCalendar; import spinnerCalendar.SpinnerEvent; import spinnerCalendar.Status; import spinnerCalendar.StudentSpinnerEvent; import charcters.CharcterType; import charcters.Person; import charcters.PersonSpinnerClass; import charcters.Persons; import db.spinner.DBspinner; public class SpinnerClass { private String spinnerClassName = null; private int classId; private String hyperLink = null; private SpinnerCalendar classCalendar = null; private HashMap<Integer, PersonSpinnerClass> students = null; private HashMap<Integer, PersonSpinnerClass> instructors = null; private HashMap<Integer, PersonSpinnerClass> admins = null; private String openForRegistrationMode; private int lockForRegistration; public SpinnerClass(String className, String openForRegistrationMode, int lockForRegistration, String hyperLink) { spinnerClassName = className; this.openForRegistrationMode = openForRegistrationMode; this.lockForRegistration = lockForRegistration; this.hyperLink = hyperLink; } public SpinnerClass(int classId) throws Exception { this.classId = classId; // classCalendar = new SpinnerCalendar(classId); initStudetsList(); initInstructorsList(); initAdminsList(); } public void setId(int id) throws Exception { classId = id; // initClassCalendar(); initStudetsList(); initInstructorsList(); initAdminsList(); } private void initInstructorsList() throws Exception { instructors = DBspinner.getClassPersonsListFromDB(classId, CharcterType.INSTRUCTOR); } private void initStudetsList() throws Exception { students = DBspinner.getClassPersonsListFromDB(classId, CharcterType.STUDENT); } private void initAdminsList() throws Exception { admins = DBspinner.getClassPersonsListFromDB(classId, CharcterType.ADMIN); } private void initClassCalendar() throws Exception { if (classCalendar == null) { classCalendar = new SpinnerCalendar(classId); } } public String getSpinnerClassName() { return spinnerClassName; } public int getId() { return classId; } public String getOpenForRegistrationMode() { return openForRegistrationMode; } public int getLockForRegistration() { return lockForRegistration; } public String getHyperLink() { return hyperLink; } public PersonSpinnerClass getStudent(int personId) { return students.get(personId); } public PersonSpinnerClass getInstructor(int personId) { return instructors.get(personId); } protected PersonSpinnerClass assignStudentToClass(Person p, int numberOfValidRegistrations) throws Exception { PersonSpinnerClass psc = students.get(p.getId()); if (students.get(p.getId()) == null) { psc = new PersonSpinnerClass(classId, p.getId(), CharcterType.STUDENT, numberOfValidRegistrations); p.assignPersonToClass(this); DBspinner.assignPersonToClass(this, psc); students.put(psc.getPerson().getId(), psc); } return psc; } protected void unAssignStudentFromClass(Person p) throws Exception { PersonSpinnerClass psc = students.get(p.getId()); if (psc != null) { psc.deleteStudentRegisterationFromClassEvents(); p.unAssignPersonFromClass(classId); DBspinner.unAssignPersonFromClass(this, psc); students.remove(psc.getPerson().getId()); } } protected void deletePerson(int personId) throws Exception { deleteStudent(personId); deleteInstructor(personId); } private void deleteStudent(int personId) throws Exception { PersonSpinnerClass psc = students.get(personId); if (psc != null) { psc.deleteStudentRegisterationFromClassEvents(); DBspinner.unAssignPersonFromClass(this, psc); students.remove(personId); } } private void deleteInstructor(int personId) throws Exception { PersonSpinnerClass psc = instructors.get(personId); if (psc != null) { deleteInstructorsFromClassEvents(personId); DBspinner.unAssignPersonFromClass(this, psc); instructors.remove(personId); } } private void deleteInstructorsFromClassEvents(int personId) throws Exception { Iterator it = classCalendar.getSpinnerCalendarEventsHashMap().entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); SpinnerEvent se = (SpinnerEvent) pair.getValue(); if (se.getInstructorId() == personId) { se.updateInstructor(-1); } } } protected void assignInstructorToClass(Person p) throws Exception { PersonSpinnerClass psc = instructors.get(p.getId()); if (instructors.get(p.getId()) == null) { psc = new PersonSpinnerClass(classId, p.getId(), CharcterType.INSTRUCTOR, -999); p.assignPersonToClass(this); DBspinner.assignPersonToClass(this, psc); instructors.put(psc.getPerson().getId(), psc); } } protected void unAssignInstructorFromClass(Person p) throws Exception { PersonSpinnerClass psc = instructors.get(p.getId()); if (psc != null) { // psc.deleteStudentRegisterationFromClassEvents(); TODO: need to // delete instructor from all events p.unAssignPersonFromClass(classId); DBspinner.unAssignPersonFromClass(this, psc); instructors.remove(psc.getPerson().getId()); } } protected void assignAdminToClass(Person p) throws Exception { PersonSpinnerClass psc = admins.get(p.getId()); if (admins.get(p.getId()) == null) { psc = new PersonSpinnerClass(classId, p.getId(), CharcterType.ADMIN, -999); p.assignPersonToClass(this); DBspinner.assignPersonToClass(this, psc); admins.put(psc.getPerson().getId(), psc); } } protected void unAssignAdminFromClass(Person p) throws Exception { PersonSpinnerClass psc = admins.get(p.getId()); if (psc != null) { p.unAssignPersonFromClass(classId); DBspinner.unAssignPersonFromClass(this, psc); admins.remove(psc.getPerson().getId()); } } protected SpinnerEvent addSpinnerEventToClassCalendar(SpinnerEvent se) throws Exception { initClassCalendar(); return classCalendar.addSpinnerEventToSpinnerCalendar(se); } protected SpinnerEvent updateSpinnerEventToClassCalendar(int eventId, SpinnerEvent newEvent) throws Exception { initClassCalendar(); return classCalendar.updateSpinnerEventDetails(eventId, newEvent); } protected SpinnerEvent deleteSpinnerEventFromClassCalendar(int eventId) throws Exception { initClassCalendar(); return classCalendar.deleteSpinnerEventFromSpinnerCalendar(eventId); } protected StudentSpinnerEvent registerToSpinnerEvent(int eventId, int studentId) throws Exception { StudentSpinnerEvent studentEvent = null; SpinnerEvent se = getClassEvent(eventId); PersonSpinnerClass s = getStudent(studentId); if (s.getNumberOfValidRegistrations() == 0) { studentEvent = new StudentSpinnerEvent(se, Status.NO_VALID_CREDIT, s.getNumberOfValidRegistrations()); } else { String sts = se.registerToSpinnerEvent(s); studentEvent = new StudentSpinnerEvent(se, sts, s.getNumberOfValidRegistrations()); } // TODO: do we need to return SpinnerEvent? return studentEvent; } protected StudentSpinnerEvent unRegisterFromSpinnerEvent(int eventId, int studentId) throws Exception { SpinnerEvent se = getClassEvent(eventId); PersonSpinnerClass s = getStudent(studentId); String sts = se.unRegisterFromSpinnerEvent(s); StudentSpinnerEvent studentEvent = new StudentSpinnerEvent(se, sts, s.getNumberOfValidRegistrations()); // TODO: do we need to return SpinnerEvent? return studentEvent; } public SpinnerEvent getClassEvent(int eventId) throws Exception { initClassCalendar(); SpinnerEvent se = classCalendar.getSpinnerEvent(eventId); return se; } public SpinnerCalendar getClassEvents() throws Exception { initClassCalendar(); return classCalendar; } public void deleteClassEvents() throws Exception { DBspinner.deleteClassEvents(classId); } public void unAssignPersonsFromClass() throws Exception { unAssignPersonsFromClass(students); unAssignPersonsFromClass(instructors); } private void unAssignPersonsFromClass(HashMap<Integer, PersonSpinnerClass> persons) throws Exception { Iterator it = persons.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); int personId = (Integer) pair.getKey(); Person p = Persons.getPersonsInstance().getPerson(personId); p.unAssignPersonFromClass(classId); } DBspinner.unAssignPersonsFromClass(classId); } public List<PersonSpinnerClass> studentsList() { List<PersonSpinnerClass> pscList = new ArrayList<PersonSpinnerClass>(); Iterator it = students.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); PersonSpinnerClass psc = (PersonSpinnerClass) pair.getValue(); pscList.add(psc); } return pscList; } public List<Person> instructorList() throws Exception { List<Person> pList = new ArrayList<Person>(); Iterator it = instructors.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); PersonSpinnerClass psc = (PersonSpinnerClass) pair.getValue(); pList.add(psc.getPerson()); } return pList; } public boolean isAdmin(int personId) { boolean admin = false; if (admins.containsKey(personId)) { admin = true; } return admin; } public boolean isInstructor(int personId) { boolean instructor = false; if (instructors.containsKey(personId)) { instructor = true; } return instructor; } public boolean isStudent(int personId) { boolean student = false; if (students.containsKey(personId)) { student = true; } return student; } }
5f45c78a607989b450c02e9d5891ec05a65f4f01
4a6098918edf24e1212b7b02849872da990ae364
/src/DBT/IngredFeeinfoMc1.java
dd0f18b1530e13906e3bf83aa53e037c0ddae8ee
[]
no_license
kocmoc1985/MCReplicator
a6189919fdc30396d3b1b9e50fd5ce6a5749e9eb
f1fb88a6aeb60c3cc347ff84c786964a131b2e72
refs/heads/master
2021-01-20T10:50:44.689473
2018-05-31T10:12:43
2018-05-31T10:12:43
101,651,104
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package DBT; /** * * @author KOCMOC */ public class IngredFeeinfoMc1 { public static final String tableName = "IngredFeeinfoMc1"; public static final String freeinfo = "FREEINFO1"; public static final String value = "Value"; public static final String itemCode = "CodeID"; }
111bc12ce733467f12c14537ee64622ae621e366
921b061683f2be3a3ad95f6204738e7f4eaa9bad
/LibraryManagement/src/main/java/com/revature/project/controller/LibraryController.java
06dc21c616ceb7412bfd9043a106692177155a32
[]
no_license
Babysruthi/MyProjects
4153be79f559b64af50ded7815505297957e2440
35b195872e36422275fda990f10467b461c853e2
refs/heads/main
2023-07-04T16:36:40.031209
2021-08-24T11:17:19
2021-08-24T11:17:19
390,383,656
0
7
null
null
null
null
UTF-8
Java
false
false
3,042
java
package com.revature.project.controller; import com.revature.project.model.LibraryManagement.Users; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.revature.product.service.LibraryService; import com.revature.product.service.LibraryServiceImp; import com.revature.project.exceptions.InvalidException; import com.revature.project.model.LibraryManagement.Library; import com.revature.project.model.LibraryManagement.Users; public class LibraryController { Logger logger=Logger.getLogger("LibraryController.class"); LibraryService libraryServiceImp=new LibraryServiceImp(); public void addBook(Library library) throws Exception { logger.info("In LibraryController----addBook method"); libraryServiceImp.addBook(library); } public void checkAdmin(String user,String pass) throws Exception { logger.info("In LibraryController----checkAdmin method"); libraryServiceImp.checkAdmin(user, pass); } public void addUser() throws Exception { logger.info("In LibraryController----addUser method"); libraryServiceImp.addUser(); } public void deleteUser() throws InvalidException,Exception { logger.info("In LibraryController----deleteUser method"); libraryServiceImp.deleteUser(); } public void updateUser() throws Exception { logger.info("In LibraryController----updateUser method"); libraryServiceImp.updateUser(); } public List<Users> listAll() throws Exception { logger.info("In LibraryController----ListallUsers method"); List<Users>listUsers=new ArrayList<Users>(); listUsers=libraryServiceImp.listAll(); return listUsers; } public Library listBookByIsbn(List listofIsbn) throws Exception { logger.info("In LibraryController----ListBookByIsbn method"); Library book=new Library(); book=libraryServiceImp.listBookByIsbn(listofIsbn); return book; } public void bkDetails() throws Exception { logger.info("In LibraryController----Details of books method"); libraryServiceImp.bkDetails(); } public void delBook() throws Exception { logger.info("In LibraryController----delBook method"); libraryServiceImp.delBook(); } public Users listByUserId(List listofId) throws Exception { logger.info("In LibraryController----listByUserId method"); Users user=new Users(); user=libraryServiceImp.listByUserId(listofId); return user; } public List<Library> listBooks() throws Exception { logger.info("In libraryServiceImp-----listBooks method"); List<Library>listBooks=new ArrayList<Library>(); listBooks=libraryServiceImp.listBooks(); return listBooks; } public void issueBook() throws Exception { logger.info("In LibraryController----issueBook method"); libraryServiceImp.issueBook(); } public void updateBook() throws Exception { logger.info("In LibraryController----updateBook method"); libraryServiceImp.updateBook(); } }
c3e8932e465d9ec3c4ad5fc8ed9cabb513335aa3
3a3d02a5ea656daff722270a3466572f5fa18c72
/Merge_Two_Sorted_Lists.java
cc2531de29d712b3638914915bbd6019391aa9e8
[]
no_license
AndoneKwon/SP_Problems
29f582bcc731f5757e75b882fb99e4d4d4c3a899
d78f30b675feef1ec8af05dd79fdd44ca4ee4cda
refs/heads/master
2021-05-26T01:45:42.578972
2021-03-18T15:47:48
2021-03-18T15:47:48
254,004,777
0
0
null
null
null
null
UTF-8
Java
false
false
1,137
java
//빈 head 객체를 만들고 그 헤드에 다음노드를 새로 만들어서 생성해준다. //그러면서 그 다음 노드를 계속적으로 연결시켜준다. //단 시작의 빈 head의 val에는 0이 들어가기 때문에 head.next를 리턴해준다. class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1==null||l2==null) return l1==null ? l2 : l1; ListNode head = new ListNode(); ListNode nextNode; if(l1.val>l2.val){ head.next = new ListNode(l2.val); nextNode = head.next; l2=l2.next; }else{ head.next = new ListNode(l1.val); nextNode = head.next; l1=l1.next; } while(l1!=null&&l2!=null){ if(l1.val>l2.val){ nextNode.next = l2; l2=l2.next; }else{ nextNode.next = l1; l1=l1.next; } nextNode = nextNode.next; } if(l1 == null || l2 == null) nextNode.next = (l1 == null ? l2 : l1); return head.next; } }
f373e41d360ad585735b94ab31523757dbcb23cb
a102b987bc36a5cfa15c92df6e879c0b3a677443
/WordLadder.java
21ade6668d05dc20d8cb52d741d25d28d3e0840a
[]
no_license
zqin1096/Leetcode
95e91ae0633a70dc714fd0873767396ea46385a7
8cf2644b53c2cfc4014bf36ca4c6866cab4ef105
refs/heads/master
2020-12-14T06:01:51.210704
2020-01-18T01:24:03
2020-01-18T01:24:03
234,664,481
0
0
null
null
null
null
UTF-8
Java
false
false
3,397
java
import java.util.*; /* Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be changed at a time. Each transformed word must exist in the word list. Note that beginWord is not a transformed word. Return 0 if there is no such transformation sequence. All words have the same length. All words contain only lowercase alphabetic characters. You may assume no duplicates in the word list. You may assume beginWord and endWord are non-empty and are not the same. */ public class WordLadder { // TLE. // private class Pair { // String word; // int length; // // Pair(String word, int length) { // this.word = word; // this.length = length; // } // } // // public int ladderLength(String beginWord, String endWord, List<String> wordList) { // if (!wordList.contains(endWord)) { // return 0; // } //// Set<String> visited = new HashSet<>(); // Queue<Pair> queue = new LinkedList<>(); // queue.add(new Pair(beginWord, 1)); // while (!queue.isEmpty()) { // Pair pair = queue.remove(); // if (pair.word.equals(endWord)) { // return pair.length; // } //// visited.add(pair.word); // wordList.remove(pair.word); // for (int i = 0; i < wordList.size(); i++) { // String s = wordList.get(i); //// if (!visited.contains(s)) { // int count = 0; // for (int j = 0; j < s.length(); j++) { // if (s.charAt(j) != pair.word.charAt(j)) { // count++; // } // } // if (count == 1) { // queue.add(new Pair(s, pair.length + 1)); // } //// } // } // } // return 0; // } public int ladderLength(String beginWord, String endWord, List<String> wordList) { if (!wordList.contains(endWord)) { return 0; } // The length from beginWord to this word. // If a string is in the map, it means that the string has already // been searched and does not need to explore again. Map<String, Integer> map = new HashMap<>(); Queue<String> queue = new LinkedList<>(); map.put(beginWord, 1); queue.add(beginWord); while (!queue.isEmpty()) { String word = queue.remove(); if (word.equals(endWord)) { return map.get(word); } for (int i = 0; i < wordList.size(); i++) { String s = wordList.get(i); int count = 0; for (int j = 0; j < s.length(); j++) { if (s.charAt(j) != word.charAt(j)) { count++; } } if (count == 1) { // If the word has been explored, it means the shortest // distance to this word has been found. if (!map.containsKey(s)) { map.put(s, map.get(word) + 1); queue.add(s); } } } } return 0; } }
9c7cb6e20858426d2b9d480ef063c3ac15af353a
92a799ed7d8cf96c62d2c0875624e12cc45d2c02
/src/com/kh/MasterPiece/common/MyFileRenamePolicy.java
f3f56b3346aa580931ec66579610f50fa1453ad8
[]
no_license
kovd2/MasterPiece
94d19cf3a5075bf2b6082bff9b84304cb460ba89
e4a2222ab39206a0ad4a5b7af23e17b5349fee13
refs/heads/master
2020-03-28T17:06:44.111073
2018-10-05T01:32:44
2018-10-05T01:32:44
148,748,539
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package com.kh.MasterPiece.common; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import com.oreilly.servlet.multipart.FileRenamePolicy; public class MyFileRenamePolicy implements FileRenamePolicy{ @Override public File rename(File oldFile) { long currentTime = System.currentTimeMillis(); SimpleDateFormat ft = new SimpleDateFormat("yyyyMMddHHmmss"); int randomNumber = (int)(Math.random() * 100000); //확장자명 가져오기 String name = oldFile.getName(); String body = null; String ext = null; int dot = name.lastIndexOf("."); if(dot != -1){ //확장자가 있는 경우 body = name.substring(0, dot); ext = name.substring(dot); }else{ //확장자가 없는 경우 body = name; ext = ""; } String fileName = ft.format(new Date(currentTime)) + randomNumber + ext; File newFile = new File(oldFile.getParent(), fileName); return newFile; } }
[ "user2@KH_A" ]
user2@KH_A
573acb281147c320679c682d4e18a2df2dd0bd66
71ec189256469591510a3d5486546047f1707ba3
/Boletin11/src/boletin11/Ejercicio2.java
25fdb429c11d61954349e88bc91f496a4e2dbab1
[]
no_license
bmartinezparedes/ProgramacionNina
a1bbbf77231fc3a92fe982dbac352c9dea5e15ef
bb922ddcdbd5b1b2a3c959c723aed0e252e0de3c
refs/heads/master
2023-01-22T13:04:57.273263
2020-12-06T14:39:22
2020-12-06T14:39:22
305,664,687
0
0
null
null
null
null
UTF-8
Java
false
false
1,045
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 boletin11; import javax.swing.JOptionPane; /** * * @author Usuario */ public class Ejercicio2 { public void juego(){ int numero,dis,aleatorio=(int)(Math.random()*50+1); //System.out.println(aleatorio); //Para probar los resultados do{ numero=Integer.parseInt(JOptionPane.showInputDialog("Acierta el numero comprendido entre 1 y 50")); dis=Math.abs(aleatorio-numero); if(dis>20){ System.out.println("Moi lonxe"); }else if(dis<=20&&dis>=10){ System.out.println("Lonxe"); }else if(dis<10&&dis>5){ System.out.println("Preto"); }else System.out.println("Moi preto"); }while(aleatorio!=numero); System.out.println("Acertaste el numero!!!! \nFelicidades"); } }
cef5d2faa72b93850ba376912517d3f67328a594
093f50c2435a12f52dbe70c080c8b7add843d01a
/src/main/java/com/gail/validation/model/GailResponse.java
49879ba9bd1fbd1f98c743e072a6a05f4bcee0ab
[]
no_license
vikramshekhawat/Data_g_a_i_l
6b695db25f4460a38e80158997e4b8349efe79d9
a0a3f5d302182c01270b1a23048d74fa46a85f54
refs/heads/master
2020-04-07T11:32:13.902977
2018-11-20T04:25:11
2018-11-20T04:25:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package com.gail.validation.model; public class GailResponse { private ResponseStatus responseStatus; private Object responseData; public GailResponse() { } public GailResponse(ResponseStatus responseStatus, Object responseData) { this.responseStatus = responseStatus; this.responseData = responseData; } public ResponseStatus getResponseStatus() { return responseStatus; } public void setResponseStatus(ResponseStatus responseStatus) { this.responseStatus = responseStatus; } public Object getResponseData() { return responseData; } public void setResponseData(Object responseData) { this.responseData = responseData; } }
05dbed1262171241330e3dfca661b976dbb68108
d9d7dc275a706454d2c27cfd33516f4ba21c85e6
/android/src/com/mygdx/game/android/TriangleEdges1TTL.java
eba5ebf875726053865c3cc21e665a8b68a0872c
[]
no_license
Dian-Yordanov/FinalYearProject
ff4dfb090324038b127f0fef600ac4948ad9368a
acc486c6c1fa9fb45e591ddf72168d4016e7a79a
refs/heads/master
2022-02-18T10:22:07.814578
2015-04-27T05:52:17
2015-04-27T05:52:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
472
java
package com.mygdx.game.android; import com.mygdx.game.MyGdxGame; /** * Created by XelnectMobileUser on 2/23/2015. */ public class TriangleEdges1TTL extends AIOLauncherNoOptions { public TriangleEdges1TTL(){ AIOLauncherNoOptions.imageNameToBeSaved = "data/ii_truchet_tilling_triangle_edges.png"; MyGdxGame.intToBeReduced1=1; MyGdxGame.intToBeReduced2=1; MyGdxGame.doneOnce=false; //MyGdxGame.evolvingTilling = false; } }
21f65d6b10a278d776666289168bfc7c1a25c4d8
ebd7e550aa4536d5e0dfb1b56ce4854d065dbbc2
/app/src/main/java/portfolio/adx2099/com/myportfolio/MainActivity.java
6f6516b9eaa1d47b9349160783ee8f62852abbbe
[]
no_license
ADX2099/my-app-portfolio
dfcfa4855d0826ac77b57193aab266c198119a2e
205f3b2aa55bf525b4bd62657b3168398c72a53b
refs/heads/master
2020-05-30T14:28:15.909015
2015-06-09T18:54:58
2015-06-09T18:54:58
37,151,798
0
0
null
null
null
null
UTF-8
Java
false
false
3,417
java
package portfolio.adx2099.com.myportfolio; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button spotifyButton = (Button) findViewById(R.id.button); spotifyButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText(getApplicationContext(), "This button will launch my spotify App", Toast.LENGTH_SHORT); toast.show(); } }); final Button scoreButton = (Button) findViewById(R.id.button2); scoreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText(getApplicationContext(),"This button will launch my Score App",Toast.LENGTH_SHORT); toast.show(); } }); final Button libraryButton = (Button) findViewById(R.id.button3); libraryButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText(getApplicationContext(),"This button will launch my library App",Toast.LENGTH_SHORT); toast.show(); } }); final Button buildButton = (Button) findViewById(R.id.button4); buildButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText(getApplicationContext(),"This button will launch my Build App",Toast.LENGTH_SHORT); toast.show(); } }); final Button xyzButton = (Button) findViewById(R.id.button5); xyzButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText(getApplicationContext(),"This button will launch my XYZ App",Toast.LENGTH_SHORT); toast.show(); } }); final Button capstoneButton = (Button) findViewById(R.id.button6); capstoneButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText(getApplicationContext(),"This button will launch my Capstone App",Toast.LENGTH_SHORT); toast.show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.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(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
558428fe44c9a4fe6bddd837c0347c1b7d0a272c
eda1d41734af460973537f8601ae19124e383a95
/app/src/main/java/kakina/woranas/myweigh/registerMain2Activity.java
3de72529053396f9ef2cf4bd7c2b7c57d90bd3c9
[]
no_license
Woranas/CheckWeight
c1b960e9e883f8e3e6b5f2def9a216a1b24853dc
0c26ea2a907622b6b542aa9fbdce8bdb6eb9364c
refs/heads/master
2016-08-12T09:44:16.440330
2016-02-17T09:37:32
2016-02-17T09:37:32
51,421,548
0
0
null
null
null
null
UTF-8
Java
false
false
1,736
java
package kakina.woranas.myweigh; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class registerMain2Activity extends AppCompatActivity { //Explinct private EditText userEditText, passEditText, nameEditText; private String userString, passString, nameString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register_main2); // Bind Widget bindWidget(); }//Main Menhod private void bindWidget() { userEditText = (EditText) findViewById(R.id.editText2); passEditText = (EditText) findViewById(R.id.editText3); nameEditText = (EditText) findViewById(R.id.editText4); } public void clickRegit(View view) { userString = userEditText.getText().toString().trim(); passString = passEditText.getText().toString().trim(); nameString = nameEditText.getText().toString().trim(); if (userString.equals("")|| passString.equals("") || nameString.equals("")) { //Have Space Toast.makeText(registerMain2Activity.this,getResources().getString(R.string.have_space), Toast.LENGTH_LONG).show(); } else { //no space MyManage objMyManage = new MyManage(this); objMyManage.addUserTable(userString, passString, nameString); Toast.makeText(registerMain2Activity.this,getResources().getString(R.string.Success_regis),Toast.LENGTH_SHORT).show(); finish(); } } }
ba063921a7a7f8354d696fc495317e81119efe46
f1d567b5664ba4db93b9527dbc645b76babb5501
/src/com/javarush/test/level22/lesson18/big01/KeyboardObserver.java
e3a0f24b3eaa62e2a9d9686b49434e4ebb67df66
[]
no_license
zenonwch/JavaRushEducation
8b619676ba7f527497b5a657b060697925cf0d8c
73388fd058bdd01f1673f87ab309f89f98e38fb4
refs/heads/master
2020-05-21T20:31:07.794128
2016-11-12T16:28:22
2016-11-12T16:28:22
65,132,378
8
4
null
null
null
null
UTF-8
Java
false
false
1,424
java
package com.javarush.test.level22.lesson18.big01; import javax.swing.*; import java.awt.*; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; public class KeyboardObserver extends Thread { private Queue<KeyEvent> keyEvents = new ArrayBlockingQueue<KeyEvent>(100); private JFrame frame; @Override public void run() { frame = new JFrame("KeyPress Tester"); frame.setTitle("Transparent JFrame Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setUndecorated(true); frame.setSize(400, 400); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setLayout(new GridBagLayout()); frame.setOpacity(0.0f); frame.setVisible(true); frame.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { //do nothing } @Override public void focusLost(FocusEvent e) { System.exit(0); } }); frame.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { //do nothing } public void keyReleased(KeyEvent e) { //do nothing } public void keyPressed(KeyEvent e) { keyEvents.add(e); } }); } public boolean hasKeyEvents() { return !keyEvents.isEmpty(); } public KeyEvent getEventFromTop() { return keyEvents.poll(); } }
647dba436f880b8371c8c9524da759d09ccd849f
e85cc56bcaf0ecee28bc03fc194ea22c974317e6
/Swing/app/src/main/java/com/kidsdynamic/swing/presenter/DashboardProgressFragment_UI.java
8246c9298e2774f9c4cd57437fa2ea3dea3950ab
[]
no_license
zsfenggy/AndroidSwing
30b1eef6db654d35a7263cfc6defca3c92b2d8fd
8df93e58528d2409d6ad0bb1e1e3995009af5cc7
refs/heads/master
2021-05-06T21:22:38.372213
2017-11-28T16:02:07
2017-11-28T16:02:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,686
java
package com.kidsdynamic.swing.presenter; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.kidsdynamic.swing.R; import com.kidsdynamic.swing.view.ViewCircle; import java.util.Random; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * DashboardProgressFragment_UI * <p> * Created by Stefan on 2017/11/7. */ public class DashboardProgressFragment_UI extends DashboardBaseFragment { @BindView(R.id.tv_message) TextView tvMessage; @BindView(R.id.dashboard_progress_circle) ViewCircle progressCircle; @BindView(R.id.dashboard_progress_button_first) TextView tvFirst; @BindView(R.id.dashboard_progress_button_second) TextView tvSecond; public static DashboardProgressFragment_UI newInstance() { Bundle args = new Bundle(); DashboardProgressFragment_UI fragment = new DashboardProgressFragment_UI(); fragment.setArguments(args); return fragment; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.fragment_dashboard_progress, container, false); ButterKnife.bind(this, layout); return layout; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); tv_title.setTextColor(getResources().getColor(R.color.colorAccent)); tv_title.setText(R.string.title_dashboard); view_left_action.setImageResource(R.drawable.icon_left); progressCircle.setStrokeBeginEnd(0, 10); progressCircle.setOnProgressListener(new OnCircleProgressListener(progressCircle.getStrokeCount())); } @Override public void onResume() { super.onResume(); progressCircle.startProgress(30, -1, -1); } @Override public void onPause() { super.onPause(); progressCircle.stopProgress(); } @Override public void onStop() { super.onStop(); progressCircle.stopProgress(); } @OnClick(R.id.main_toolbar_action1) public void back() { getFragmentManager().popBackStack(); } @OnClick(R.id.dashboard_progress_button_first) public void onClickFirst() { } @OnClick(R.id.dashboard_progress_button_second) public void onClickSecond() { } private class OnCircleProgressListener implements ViewCircle.OnProgressListener { private int bound, random, count; private OnCircleProgressListener(int bound) { this.bound = bound; random = new Random().nextInt(bound); } @Override public void onProgress(ViewCircle view, int begin, int end) { if (begin == bound - 1) count += 1; if (count == 1 && end == random) { // Syncing if (end % 2 == 0) { tvMessage.setText(R.string.dashboard_progress_syncing); } else { // We can't find your watch progressCircle.stopProgress(); progressCircle.setStrokeBegin(-1); progressCircle.setStrokeEnd(0); tvMessage.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL); tvMessage.setPadding(0, 0, 0, 0); tvMessage.setText(R.string.dashboard_progress_not_found); tvMessage.setCompoundDrawablesWithIntrinsicBounds( 0, 0, 0, R.drawable.monster_green); tvFirst.setVisibility(View.VISIBLE); tvFirst.setText(R.string.dashboard_progress_again); tvSecond.setVisibility(View.VISIBLE); } } else if (count == 2 && end == random) { // completed progressCircle.stopProgress(); progressCircle.setStrokeBegin(0); progressCircle.setStrokeEnd(100); tvMessage.setGravity(Gravity.CENTER); tvMessage.setText(R.string.dashboard_progress_completed); tvMessage.setCompoundDrawablesWithIntrinsicBounds( 0, 0, 0, R.drawable.monster_yellow); tvFirst.setVisibility(View.VISIBLE); tvFirst.setText(R.string.dashboard_progress_dashboard); } } } }
178096faf73d025eae280262d364dadba62df77e
a627d588db5778b76ddba97aeb74ba1a5ef92de6
/src/controller/Controller.java
d67c81c8d36f17f7546a7b6dcc821818018f0dae
[]
no_license
BohdanMorhun/Task1Insurance
afd3570b9b894e27bc140190c14f79d5ab16abe3
4077e141f569563fcca5a7f80f34598c1c101337
refs/heads/master
2020-04-29T12:11:17.631688
2019-03-14T10:14:05
2019-03-14T10:14:05
175,597,018
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package controller; import service.Derivative; import service.DerivRecepies; import service.InsuranceCompany; import view.View; public class Controller { private View view = new View(); public void processUser() { InsuranceCompany insuranceCompany = new InsuranceCompany(); Derivative derivative = insuranceCompany.createDerivative(DerivRecepies.TOM); view.printMessage("Derivative cost is " + derivative.getCost() + "."); view.printMessage(derivative.policiesSortedByRisks()); view.printMessage("InsurancePoliciesInCostRange: " +derivative.getInsurancePoliciesInCostRange(0,2000)); } }