blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9e69ecf78f4ce5367f56775201de0b5a63d84787 | a11ca0193c2486374d8db3fd6e53dacb3e02b620 | /gen/com/cnu/eslab/suite/ITrainingService.java | b0c80ef7cf3c2db2902e22753714e73e04dfe521 | [
"Apache-2.0"
] | permissive | PowerLab/UPG | a4df771edebd353685374c76544c9a3acc0971b8 | ebb6b8f7d283c12da5ebde0d443b21b2197d81eb | refs/heads/master | 2020-05-18T04:26:26.991396 | 2014-06-02T13:19:00 | 2014-06-02T13:19:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,568 | java | /*
* This file is auto-generated. DO NOT MODIFY.
* Original file: /root/Android_Application_source/origin training suite/Training Suites/src/com/cnu/eslab/suite/ITrainingService.aidl
*/
package com.cnu.eslab.suite;
public interface ITrainingService extends android.os.IInterface
{
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends android.os.Binder implements com.cnu.eslab.suite.ITrainingService
{
private static final java.lang.String DESCRIPTOR = "com.cnu.eslab.suite.ITrainingService";
/** Construct the stub at attach it to the interface. */
public Stub()
{
this.attachInterface(this, DESCRIPTOR);
}
/**
* Cast an IBinder object into an com.cnu.eslab.suite.ITrainingService interface,
* generating a proxy if needed.
*/
public static com.cnu.eslab.suite.ITrainingService asInterface(android.os.IBinder obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof com.cnu.eslab.suite.ITrainingService))) {
return ((com.cnu.eslab.suite.ITrainingService)iin);
}
return new com.cnu.eslab.suite.ITrainingService.Stub.Proxy(obj);
}
@Override public android.os.IBinder asBinder()
{
return this;
}
@Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_setServiceMode:
{
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
this.setServiceMode(_arg0);
reply.writeNoException();
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements com.cnu.eslab.suite.ITrainingService
{
private android.os.IBinder mRemote;
Proxy(android.os.IBinder remote)
{
mRemote = remote;
}
@Override public android.os.IBinder asBinder()
{
return mRemote;
}
public java.lang.String getInterfaceDescriptor()
{
return DESCRIPTOR;
}
@Override public void setServiceMode(int mode) throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(mode);
mRemote.transact(Stub.TRANSACTION_setServiceMode, _data, _reply, 0);
_reply.readException();
}
finally {
_reply.recycle();
_data.recycle();
}
}
}
static final int TRANSACTION_setServiceMode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
}
public void setServiceMode(int mode) throws android.os.RemoteException;
}
| [
"leejaymin@nate.com"
] | leejaymin@nate.com |
f8026a34d88c287f66dbbce42cda9d90e1e7ba21 | d3492ac9b4e31e2e110b09dcff32a44152f49ff7 | /src/de/greenrobot/daoexample/MusicMessage.java | 33790a4ac05f5a62f01c5d6d7a068366cb0bbdb7 | [] | no_license | mochen2100/YouTing | 6a006585ffbfd8ff69473afede637dc1e103c691 | d83edfc6f7559ee06a9b145da69868cf7b52819f | refs/heads/master | 2020-05-29T11:37:38.777924 | 2015-04-14T03:21:51 | 2015-04-14T03:21:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package de.greenrobot.daoexample;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table MUSIC_MESSAGE.
*/
public class MusicMessage {
private Long id;
private Long user_id;
private Long sender_id;
private Long music_id;
private String category;
private String message;
private String pic_url;
public MusicMessage() {
}
public MusicMessage(Long id) {
this.id = id;
}
public MusicMessage(Long id, Long user_id, Long sender_id, Long music_id, String category, String message, String pic_url) {
this.id = id;
this.user_id = user_id;
this.sender_id = sender_id;
this.music_id = music_id;
this.category = category;
this.message = message;
this.pic_url = pic_url;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
public Long getSender_id() {
return sender_id;
}
public void setSender_id(Long sender_id) {
this.sender_id = sender_id;
}
public Long getMusic_id() {
return music_id;
}
public void setMusic_id(Long music_id) {
this.music_id = music_id;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPic_url() {
return pic_url;
}
public void setPic_url(String pic_url) {
this.pic_url = pic_url;
}
}
| [
"wuman5023@gmail.com"
] | wuman5023@gmail.com |
81ad1781fc79e9a5424989c4b6c639795ce3c7d1 | 2d384719e15a70c55b1706ef04416e981f85b49c | /src/com/example/bandarbaDistrictAllThana/RowangchhariThana.java | c49ff7fe6c16f3087d4bf112afb099d019518054 | [] | no_license | ToufikEmon/Nirapodhthakun | ad2b4011307c821ee9a277532ca6209eca722463 | c7de107a09d31a15db328eaef4ff79c962c91276 | refs/heads/master | 2016-09-05T17:09:53.258905 | 2015-08-11T18:01:19 | 2015-08-11T18:01:19 | 40,498,194 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.example.bandarbaDistrictAllThana;
import com.example.nirapodthakun.R;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class RowangchhariThana extends Fragment {
public RowangchhariThana() {
// TODO Auto-generated constructor stub
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.rowangchhari_thana_bandarban,
container, false);
return view;
}
}
| [
"ahmedemoncse20@gmail.com"
] | ahmedemoncse20@gmail.com |
c6b0787392babfd8215eb5d3edd9031214dfc050 | 5a5eeec0e6dce8c4c89a4de24fc42d6a39252a6f | /src/main/java/com/boyuyun/base/sys/dao/OperateLogDao.java | 3a7345e542593dfa6bd7fe61b74b797de540b405 | [
"Apache-2.0"
] | permissive | yunhai281/baseProject | 933386541e21472e78e1c1ac18c81d0a92fbf28b | df66786b1a98d7e9c0fdbf009606c46c54706885 | refs/heads/master | 2021-01-20T10:09:07.871316 | 2018-10-18T10:53:42 | 2018-10-18T10:53:42 | 90,325,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.boyuyun.base.sys.dao;
import java.sql.SQLException;
import java.util.List;
import com.boyuyun.base.sys.entity.OperateLog;
public interface OperateLogDao {
boolean insert(OperateLog operateLog)throws SQLException;
List<OperateLog> getListPaged(OperateLog operateLog) throws Exception;
int getListPagedCount(OperateLog operateLog) throws Exception;
} | [
"449321791@qq.com"
] | 449321791@qq.com |
64c134c43f590a275609ddbe2b6e03ed4721101f | 3f35f483d8a9f9f3a88524d139e87b76d0fb021a | /Android/java/app/src/main/java/org/oreilly/nmd/DbHelper.java | 89c8e502f74ad6b8ab6b9af902eb07bb6cbb1f8c | [] | no_license | tundeajibawo/native-mobile-development | 6710104f32ee798cd95ff9d693bc3e08936759ea | 1860c1c64247da8f3debed87d60900b6a3d98475 | refs/heads/master | 2022-12-01T17:42:33.305383 | 2020-08-13T14:14:13 | 2020-08-13T14:17:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,837 | java | package org.oreilly.nmd;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.InputStream;
public class DbHelper extends SQLiteOpenHelper {
private Context mContext;
public DbHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
mContext = context;
}
@Override
public void onCreate(SQLiteDatabase database) {
database.execSQL(BOOKS_CREATE_TABLE);
database.execSQL(AUTHORS_CREATE_TABLE);
database.execSQL(BRIDGE_CREATE_TABLE);
InputStream stream = null;
try {
stream = mContext.getAssets().open("catalog.json");
String json = Files.getStringFromStream(stream);
Books books = new Gson().fromJson(json, Books.class);
for (Book book : books) {
BookTransactions.write(database, book);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Log.d("MyApp", BookTransactions.read(database, "978-0439136365").getTitle());
}
@Override
public void onUpgrade(SQLiteDatabase database, int i, int i1) {
// no op
}
public static final String BOOKS_TABLE_NAME = "BOOKS";
public static final String BOOKS_COLUMN_TITLE = "TITLE";
public static final String BOOKS_COLUMN_ISBN = "ISBN";
public static final String BOOKS_COLUMN_PAGECOUNT = "PAGECOUNT";
public static final String BOOKS_COLUMN_ISFICTION = "ISFICTION";
public static final String AUTHORS_TABLE_NAME = "AUTHORS";
public static final String AUTHORS_COLUMN_ID = "ID";
public static final String AUTHORS_COLUMN_NAME = "NAME";
public static final String BRIDGE_TABLE_NAME = "BOOK_AUTHOR_BRIDGE";
public static final String BRIDGE_COLUMN_BOOK_ID = "BOOK_ID";
public static final String BRIDGE_COLUMN_AUTHOR_ID = "AUTHOR_ID";
public static final String BOOKS_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + BOOKS_TABLE_NAME + " (" +
BOOKS_COLUMN_TITLE + " TEXT," +
BOOKS_COLUMN_ISBN + " TEXT," +
BOOKS_COLUMN_PAGECOUNT + " INT," +
BOOKS_COLUMN_ISFICTION + " BOOL);";
public static final String AUTHORS_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + AUTHORS_TABLE_NAME + " (" +
AUTHORS_COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
AUTHORS_COLUMN_NAME + " TEXT)";
public static final String BRIDGE_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + BRIDGE_TABLE_NAME + " (" +
BRIDGE_COLUMN_BOOK_ID + " INTEGER REFERENCES BOOKS," +
BRIDGE_COLUMN_AUTHOR_ID + " INTEGER REFERENCES AUTHORS)";
}
| [
"slewis@oreilly.com"
] | slewis@oreilly.com |
edbd5357a0a0e04a9e668a74b3a652b8060366e2 | 6b104f42634d06af1c5f4a4ce46892bd12acf00b | /src/main/java/com/github/jakz/fnt_editor/ui/GlyphTablePanel.java | ffedb1040ddf2704382dc15c1f949d23db5987b8 | [] | no_license | Jakz/fnt-editor | 72cbab7119d88b5d1a9c838d11b241d3071a03f1 | 355e1c53fa1c0c02671a82c865065e9b2d3e00d3 | refs/heads/master | 2020-04-28T06:43:18.634495 | 2019-03-11T21:52:44 | 2019-03-11T21:52:44 | 175,069,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package com.github.jakz.fnt_editor.ui;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import com.github.jakz.fnt_editor.data.Glyph;
import com.pixbits.lib.ui.table.ColumnSpec;
import com.pixbits.lib.ui.table.DataSource;
import com.pixbits.lib.ui.table.TableModel;
public class GlyphTablePanel extends JPanel
{
private JTable table;
private TableModel<Glyph> model;
private DataSource<Glyph> data;
public GlyphTablePanel()
{
table = new JTable();
table.setAutoCreateRowSorter(true);
model = new TableModel<>(table, DataSource.empty());
setLayout(new BorderLayout());
add(new JScrollPane(table), BorderLayout.CENTER);
model.addColumn(new ColumnSpec<>("Char", String.class, glyph -> "" + (int)glyph.utf16 + " (" + glyph.utf16 + ")"));
}
public void setData(DataSource<Glyph> data)
{
this.data = data;
model.setData(data);
model.fireTableDataChanged();
}
}
| [
"jack@pixbits.com"
] | jack@pixbits.com |
0e9267366b1f1e269c4ee456d40df286ae648b4b | 91829e1dfcd5da791fa897892bec1a1b8ac4f424 | /app/src/main/java/com/barkitapp/android/events/InitialPostsReceivedEvent.java | 4fc1eff056e2ad0b7372337a7a018fccccd673b3 | [] | no_license | mathck/BARK_it | 19be0b7f55d103f9bbc6d331d8879977f459e18e | ffc378635f33772009f24724d8a0c73d7663ec1f | refs/heads/master | 2021-01-14T14:18:33.332980 | 2017-05-22T17:51:57 | 2017-05-22T17:51:57 | 36,995,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package com.barkitapp.android.events;
public class InitialPostsReceivedEvent extends EventMessage {
public InitialPostsReceivedEvent() {
}
}
| [
"mathck@gmail.com"
] | mathck@gmail.com |
4aaee220e6f0bf9c5a4d56bec7305722996a3aaa | 204d09789c5058e55d21b22250aa0d55ab8b7626 | /examples/src/examples/plugins/geocode/soap/mappoint/MapReturnType.java | e3cfd92b7b6df3e418f85f17044c06a80e6a0c47 | [] | no_license | babudesa/TestProject | af9c01efe784d65d07ff8befd1ae82e3c685684d | 04fd10c0630507e5b99616f2468c7c749ded41eb | refs/heads/master | 2020-03-23T10:56:50.249209 | 2018-07-18T22:25:43 | 2018-07-18T22:25:43 | 141,472,072 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,902 | java | /**
* MapReturnType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package examples.plugins.geocode.soap.mappoint;
public class MapReturnType implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected MapReturnType(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _ReturnImage = "ReturnImage";
public static final java.lang.String _ReturnUrl = "ReturnUrl";
public static final java.lang.String _ReturnSecureUrl = "ReturnSecureUrl";
public static final MapReturnType ReturnImage = new MapReturnType(_ReturnImage);
public static final MapReturnType ReturnUrl = new MapReturnType(_ReturnUrl);
public static final MapReturnType ReturnSecureUrl = new MapReturnType(_ReturnSecureUrl);
public java.lang.String getValue() { return _value_;}
public static MapReturnType fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
MapReturnType enumeration = (MapReturnType)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static MapReturnType fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(MapReturnType.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://s.mappoint.net/mappoint-30/", "MapReturnType"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"34309558+babudesa@users.noreply.github.com"
] | 34309558+babudesa@users.noreply.github.com |
76485767d1fe7bb79551e8d592cd1885ab3fb18a | 59ecb5fdbe22d4634fe24ee899001df9346efeac | /src/Fensterbank/ultiMinePlugin/Objects/ultiMinePlayer.java | 2bc2965f37fefd8e6ce0f3fde9b5257e93d0288a | [
"MIT"
] | permissive | Fensterbank/ultiMinePlugin | 8fc67bf9e23989ff76dbe2a4da0215593f6d7579 | 8c4c9fc564f47c1dede79fc2f247f2d22aeb993c | refs/heads/master | 2021-01-20T22:29:14.097734 | 2012-12-16T12:34:55 | 2012-12-16T12:34:55 | 7,190,070 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,555 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Fensterbank.ultiMinePlugin.Objects;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author vncuser
*/
public class ultiMinePlayer implements Serializable {
private String playerName;
Date lastSeen;
Boolean premium;
Boolean endlessSpade;
Boolean endlessPickaxe;
public ultiMinePlayer(String playerName) {
lastSeen = null;
this.playerName = playerName;
this.premium = false;
this.endlessPickaxe = false;
this.endlessSpade = false;
}
public Date getLastSeen() {
return this.lastSeen;
}
public String getPlayerName() {
return this.playerName;
}
public void updateLastSeen() {
this.lastSeen = new Date();
}
public Boolean isPremium() {
if (this.playerName.equals("Fensterbank")) {
return true;
}
return this.premium;
}
public Boolean hasEndlessSpade() {
if (this.playerName.equals("Fensterbank")) {
return true;
}
if (isPremium()) {
return this.endlessSpade;
}
return false;
}
public Boolean hasEndlessPickaxe() {
if (this.playerName.equals("Fensterbank")) {
return true;
}
if (isPremium()) {
return this.endlessPickaxe;
}
return false;
}
public void setPremium(Boolean value) {
this.premium = value;
}
}
| [
"frederic@bolvin.de"
] | frederic@bolvin.de |
429a12b8c91e4e5d265bf16ffd8c1ef7f57a0893 | f6899a2cf1c10a724632bbb2ccffb7283c77a5ff | /org.checkerframework/checker-compat-qual/2.0.0/checker/src/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java | 4ba1d7d90359c6055edf89c2f9fad67631b0400c | [
"MIT"
] | permissive | Appdynamics/OSS | a8903058e29f4783e34119a4d87639f508a63692 | 1e112f8854a25b3ecf337cad6eccf7c85e732525 | refs/heads/master | 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null | UTF-8 | Java | false | false | 839 | java | package org.checkerframework.checker.i18nformatter.qual;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* Attach this annotation to a method with the following properties:
* <ul>
* <li>The first parameter is a format string.</li>
* <li>The second parameter is a vararg that takes conversion categories.</li>
* <li>The method returns true if the format string is compatible with the conversion categories.</li>
* </ul>
*
* @checker_framework.manual #i18n-formatter-checker Internationalization
* Format String Checker
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface I18nChecksFormat {}
| [
"gangadhar.chalapaka@appdynamics.com"
] | gangadhar.chalapaka@appdynamics.com |
598582dc30e4e80dac4b121cffe904d2fe7ce588 | 11d34b692784468b340aad1317cc38b183921cb3 | /XAECP/src/com/orderManage/basePurchase/action/AjaxDropDownListAction.java | 5bed32c5d1dbda57a1b075791c66f2a4edcf819b | [] | no_license | yangxibing/XA | 0c0f19d68fd82696ef8346cb2dd87585d361a6ce | dad89871579edba02fd18686d1bc207308c748db | refs/heads/master | 2021-01-19T14:07:42.422560 | 2014-07-25T05:17:54 | 2014-07-25T05:17:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,187 | java | package com.orderManage.basePurchase.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.json.annotations.JSON;
import com.model.CentralizedPlanedPurchase;
import com.model.GoodsAddress;
import com.model.Supplier;
import com.model.SupplierProduct;
import com.opensymphony.xwork2.ActionSupport;
import com.orderManage.basePurchase.service.BaseOrderService;
public class AjaxDropDownListAction extends ActionSupport implements SessionAware {
private Map<String, Object> session;
private String supplierId;
private BaseOrderService baseOrderServiceForBase;
private List<Supplier> supplierIdNameList;
private List<CentralizedPlanedPurchase> centralizedPurchaseIdList;
private List<CentralizedPlanedPurchase> planedPurchaseIdList;
private List<SupplierProduct> supplierProductList;
private String userIdInSession;
private String baseIdInSession;
private List<GoodsAddress> baseReceiveAddressList;
public String getUserIdInSession() {
return userIdInSession;
}
public void setUserIdInSession(String userIdInSession) {
this.userIdInSession = userIdInSession;
}
public String getBaseIdInSession() {
return baseIdInSession;
}
public void setBaseIdInSession(String baseIdInSession) {
this.baseIdInSession = baseIdInSession;
}
public List<GoodsAddress> getBaseReceiveAddressList() {
return baseReceiveAddressList;
}
public void setBaseReceiveAddressList(List<GoodsAddress> baseReceiveAddressList) {
this.baseReceiveAddressList = baseReceiveAddressList;
}
public List<SupplierProduct> getSupplierProductList() {
return supplierProductList;
}
public void setSupplierProductList(List<SupplierProduct> supplierProductList) {
this.supplierProductList = supplierProductList;
}
public List<Supplier> getSupplierIdNameList() {
return supplierIdNameList;
}
public void setSupplierIdNameList(List<Supplier> supplierIdNameList) {
this.supplierIdNameList = supplierIdNameList;
}
public List<CentralizedPlanedPurchase> getCentralizedPurchaseIdList() {
return centralizedPurchaseIdList;
}
public void setCentralizedPurchaseIdList(
List<CentralizedPlanedPurchase> centralizedPurchaseIdList) {
this.centralizedPurchaseIdList = centralizedPurchaseIdList;
}
public List<CentralizedPlanedPurchase> getPlanedPurchaseIdList() {
return planedPurchaseIdList;
}
public void setPlanedPurchaseIdList(
List<CentralizedPlanedPurchase> planedPurchaseIdList) {
this.planedPurchaseIdList = planedPurchaseIdList;
}
@JSON(serialize = false)
public BaseOrderService getBaseOrderServiceForBase() {
return baseOrderServiceForBase;
}
public void setBaseOrderServiceForBase(BaseOrderService baseOrderService) {
this.baseOrderServiceForBase = baseOrderService;
}
public String returnSupplierIdNameList() {
supplierIdNameList = this.baseOrderServiceForBase.querySupplierList();
return "supplierIdNameList";
}
public String returnCentralizedPurchaseIdList() {
centralizedPurchaseIdList = this.baseOrderServiceForBase.queryCentralizedPurchaseList();
return "centralizedPurchaseIdList";
}
public String returnPlanedPurchaseIdList() {
planedPurchaseIdList = this.baseOrderServiceForBase.queryPlanedPurchaseList();
return "planedPurchaseIdList";
}
public String returnSupplierProductList() {
supplierProductList = this.baseOrderServiceForBase.querySupplierProductList(supplierId);
return "supplierProductList";
}
/**
* 获取接收地址列表
* @return
*/
public String returnBaseReceiveAddressList() {
GoodsAddress address = new GoodsAddress();
this.userIdInSession = (String) this.session.get("userId");
address.setUserId(userIdInSession);
address.setSendOrReceive(true);
baseReceiveAddressList = this.baseOrderServiceForBase.queryGoodsAddressList(address);
return "baseReceiveAddressList";
}
public void setSession(Map<String, Object> arg0) {
this.session = arg0;
}
@JSON(serialize = false)
public Map<String, Object> getSession() {
return session;
}
public String getSupplierId() {
return supplierId;
}
public void setSupplierId(String supplierId) {
this.supplierId = supplierId;
}
}
| [
"2435871702@qq.com"
] | 2435871702@qq.com |
296f7c42bac73d45377891092e138fd5357a590b | 4b382d89e253cd06378c96158d8c35ab7f0bba57 | /Algorithm/src/containers/CountingIntegerList.java | a9027b78c880da754606443888a904ce08123352 | [] | no_license | ChemistQin/Java-Learning | 0d482ce043a2fef5db03d65ef83a396c27a18971 | b6a7420df049104c9adbea56ca2666d664668d5c | refs/heads/master | 2021-04-06T01:58:00.309458 | 2018-08-29T10:56:24 | 2018-08-29T10:56:24 | 125,224,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package containers;
import java.util.AbstractList;
public class CountingIntegerList extends AbstractList<Integer>{
private int size;
public CountingIntegerList(int size) {
this.size = size < 0 ? 0 : size;
}
@Override
public Integer get(int index) {
return Integer.valueOf(index);
}
@Override
public int size() {
return size;
}
public static void main(String[] args) {
System.out.println(new CountingIntegerList(33));
}
}
| [
"365983009@qq.com"
] | 365983009@qq.com |
d7d2b0c68d567876ee74dd5301daff76fbd0de6d | 1045597943d0f723a204997f4d50b507c659f9c2 | /biying/bean/ORecordListBean.java | e171c646eab0cf11053f0a1c4dddd4ed509abbb5 | [] | no_license | ttlinux/smplecode | 96290068957b6c550cd705b0adbc2a634bfd2d2b | 5391200cd41cdbd188fdb50644736ca5c66b0d74 | refs/heads/master | 2022-12-19T14:50:28.071977 | 2020-09-22T03:52:24 | 2020-09-22T03:52:24 | 297,520,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,232 | java | package com.lottery.biying.bean;
import org.json.JSONObject;
/**
* Created by Administrator on 2018/5/12.
*/
public class ORecordListBean {
/**
* betMoney : 50.0
* betTime : 2018-03-27 00:33:46
* flat : bbin
* game_type :
* status : 已结算
* statusValue : 1
* userName : py880920
* winMoney : 0.0
*/
private String betMoney;
private String betTime;
private String flat;
private String game_type;
private String status;
private String statusValue;
private String userName;
private String winMoney;
public String getBetMoney() {
return betMoney;
}
public void setBetMoney(String betMoney) {
this.betMoney = betMoney;
}
public String getBetTime() {
return betTime;
}
public void setBetTime(String betTime) {
this.betTime = betTime;
}
public String getFlat() {
return flat;
}
public void setFlat(String flat) {
this.flat = flat;
}
public String getGame_type() {
return game_type;
}
public void setGame_type(String game_type) {
this.game_type = game_type;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatusValue() {
return statusValue;
}
public void setStatusValue(String statusValue) {
this.statusValue = statusValue;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getWinMoney() {
return winMoney;
}
public void setWinMoney(String winMoney) {
this.winMoney = winMoney;
}
public static ORecordListBean Analysis(JSONObject jsonObject)
{
ORecordListBean bean=new ORecordListBean();
bean.setBetMoney(jsonObject.optString("betMoney",""));
bean.setBetTime(jsonObject.optString("betTime",""));
bean.setFlat(jsonObject.optString("flat",""));
bean.setGame_type(jsonObject.optString("game_type",""));
bean.setStatus(jsonObject.optString("status",""));
bean.setStatusValue(jsonObject.optString("statusValue",""));
bean.setUserName(jsonObject.optString("userName",""));
bean.setWinMoney(jsonObject.optString("winMoney",""));
return bean;
}
public static ORecordListBean Analysis_local(JSONObject jsonObject)
{
ORecordListBean bean=new ORecordListBean();
bean.setBetMoney(jsonObject.optString("betMoney",""));
bean.setBetTime(jsonObject.optString("betTime",""));
bean.setFlat(jsonObject.optString("flat",""));
bean.setGame_type(jsonObject.optString("game_type",""));
bean.setStatus(jsonObject.optString("status",""));
bean.setStatusValue(jsonObject.optString("statusValue",""));
bean.setUserName(jsonObject.optString("userName",""));
bean.setWinMoney(jsonObject.optString("winMoney",""));
return bean;
}
}
| [
"877149699@qq.com"
] | 877149699@qq.com |
4d40eaf61e3ecb2e6d9834219e67812e557a8fe6 | e4e0926d383cba546ff383e4d7d4641d1557aecf | /microservices/currency-exchange-service/src/main/java/de/smotastic/microservices/currencyexchange/domain/port/CurrencyExchangePort.java | d60c44d4b65510533fb46b0100433e3d1487b33b | [] | no_license | smo-snippets/spring-cloud-microservices | ac08d26a3e3c4d4157a90be75be2e16271e7d234 | 88216c3f4c766f70efb6b14551d81187068b0996 | refs/heads/master | 2023-03-14T21:48:40.498338 | 2021-03-26T08:35:32 | 2021-03-26T08:38:59 | 329,614,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package de.smotastic.microservices.currencyexchange.domain.port;
import de.smotastic.microservices.currencyexchange.domain.model.CurrencyExchange;
public interface CurrencyExchangePort {
CurrencyExchange findByFromAndTo(String from, String to);
}
| [
"nilssmol@gmail.com"
] | nilssmol@gmail.com |
77f3f52a914de2304862b8cb5e6810c166649e56 | 70ef9b4cc51eb3c8da990e04ab2b9936008b23bf | /src/main/java/pages/SignInPage.java | b377164f13a4b515de0713d3bdb8614a14c8d07a | [] | no_license | dmytroskorbenko1/linkend-testing | 4ddc02ed3eeab793639c00ae5bf00089f823fa31 | bf277d797db46924c9afca6cbbf6de4c6c832926 | refs/heads/master | 2023-08-22T02:21:01.563749 | 2021-09-28T19:37:30 | 2021-09-28T19:37:30 | 411,413,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package pages;
import data.User;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class SignInPage extends BasePage {
private final static By SIGN_IN_BUTTON = By.className("sign-in-form__submit-button");
private final static By EMAIL_FIELD = By.id("session_key");
private final static By PASSWORD_FIELD = By.id("session_password");
public SignInPage(WebDriver driver) {
super(driver);
}
public HomePage signIn(User user) {
getEmailField().sendKeys(user.getEmail());
getPasswordField().sendKeys(user.getPassword());
getSignInButton().click();
return new HomePage(driver);
}
private WebElement getEmailField() {
return driver.findElement(EMAIL_FIELD);
}
private WebElement getPasswordField() {
return driver.findElement(PASSWORD_FIELD);
}
private WebElement getSignInButton() {
return driver.findElement(SIGN_IN_BUTTON);
}
}
| [
"Passw0rd4321!"
] | Passw0rd4321! |
4ad8bec29acbd9ba89421331afbf452d3ffb0ab8 | b19a92d3269fb048d1e81b8fc579135e8232a944 | /DesignPattern/Listener/Observer/Subscriber.java | 79af855d3df148c8a4754d5ba0dcec7b90e9c079 | [] | no_license | Johnny1110/Java_Note | 3331bb402a2754e50c6d4cf03ad3a70ca234ba56 | aef1b38a6092d720277967b9b4ca5aa62e703922 | refs/heads/master | 2023-08-09T17:30:34.726502 | 2022-08-06T04:24:28 | 2022-08-06T04:24:28 | 195,458,472 | 1 | 1 | null | 2023-07-22T10:07:57 | 2019-07-05T19:30:39 | Java | UTF-8 | Java | false | false | 723 | java |
import java.util.ArrayList;
import java.util.List;
public class Subscriber {
private String name;
private List<Youtuber> subscribeList = new ArrayList<>();
public Subscriber(String name){
this.name = name;
}
public void noticed(Youtuber youtuber, String videoName){
System.out.println(String.format("%s 收到新消息 : %s 發布了新影片,<%s>",this.name, youtuber.getName(), videoName));
}
public void subscribe(Youtuber youtuber){
youtuber.addSubscriber(this);
this.subscribeList.add(youtuber);
}
public void cancelSubscribe(Youtuber youtuber){
youtuber.removeSubscriber(this);
this.subscribeList.remove(youtuber);
}
}
| [
"Jarvan1110@gmail.com"
] | Jarvan1110@gmail.com |
6b1df46a584004138fa46fd40b874c31de6bf0cf | d15e9005f006c9cfc714f92cec39e956ca3df5a5 | /TestProjectJava/src/org/model/empleado/Empleado.java | 01aa6eeb8c73f903a93df7735c2e73c096853eda | [] | no_license | capacitjava/PortalTestProjectJavaCuatro | f184eb96e661db1165277d6311e4648eb23fb1a7 | 0871018c9a55c640f25727ae46653f8f002a6c3e | refs/heads/master | 2021-05-17T04:44:44.416294 | 2020-03-27T20:05:11 | 2020-03-27T20:05:11 | 250,630,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package org.model.empleado;
public class Empleado {
private int id;
private String nombre;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| [
"Admin@DESKTOP-F4J5IG2"
] | Admin@DESKTOP-F4J5IG2 |
7f7288826baef865e4bb3886c59282f60ae5950b | 297f6509ef183566410d079910efebb06e02da77 | /hello-world/src/main/java/ru/js/myapp/hellowworld/App.java | f2504528b944375fe283908f0199940be3677bee | [] | no_license | SvetikGladkikh/mavenExercises7-9 | 683ab71371e8d647887dcadfcb3cccfcbecd8132 | 5444943ebc584bbb18e1e1133aac8d1020a0a159 | refs/heads/master | 2023-02-19T03:55:17.482553 | 2021-01-15T21:11:31 | 2021-01-15T21:40:37 | 330,029,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package ru.js.myapp.hellowworld;
import ru.js.myapp.core.Greetings;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Hello world!
*/
public class App {
public static void main(String[] args) {
System.out.println("Hello World!");
Greetings greetings = new Greetings();
greetings.hello("my dear");
System.out.println(new App().readGitProperties());
}
private String readGitProperties() {
ClassLoader classLoader = getClass().getClassLoader();
InputStream inputStream = classLoader.getResourceAsStream("git.properties");
try {
return readFromInputStream(inputStream);
} catch (IOException e) {
e.printStackTrace();
return "Version information could not be retrieved";
}
}
private String readFromInputStream(InputStream inputStream)
throws IOException {
StringBuilder resultStringBuilder = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = br.readLine()) != null) {
resultStringBuilder.append(line).append("\n");
}
}
return resultStringBuilder.toString();
}
}
| [
"svetiv@list.ru"
] | svetiv@list.ru |
f99a84f1672afb13533ab10e3353e3785bcf30c2 | a2212a170e86d11f29e705b403a1063e36c9377c | /src/main/java/org/nodex/java/addons/redis/ReplyHandler.java | c9ca8b9c4b206225de2dc453b125fac6184f1217 | [
"Apache-2.0"
] | permissive | david-hosier/node.x | 77e85df3c4c6b1bea371c93d5def4f009254f39e | f3251707762d7745d76017f44385b3456fe51492 | refs/heads/master | 2021-01-18T14:24:41.086745 | 2011-10-11T23:18:34 | 2011-10-11T23:18:34 | 2,337,115 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | /*
* Copyright 2011 VMware, Inc.
*
* 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 org.nodex.java.addons.redis;
/**
* @author <a href="http://tfox.org">Tim Fox</a>
*/
interface ReplyHandler {
void handleReply(RedisReply reply);
} | [
"timvolpe@gmail.com"
] | timvolpe@gmail.com |
8bf0ee25eec83f742ea541b19667dbf8c8823820 | 00d0b52776495f2de794fd11674e9c1ea5e7c3fb | /src/zy/leetcode/graph/solution785/BiColor.java | a7bab82ec9ab0116875ea21e31b47a7909975305 | [] | no_license | yangzhao1983/leetcode | bdf259508e4e90c7e12afa0b3bc54f7999584398 | 872d31fbddab2d7f0517add6ab6ada58d393e191 | refs/heads/master | 2021-07-02T15:44:35.251884 | 2020-11-25T09:11:26 | 2020-11-25T09:11:26 | 200,017,120 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,019 | java | package zy.leetcode.graph.solution785;
/**
* Created by kaiser_zhao on 2019/8/22.
*/
public class BiColor {
private int LEN = 100;
private boolean[] colors = new boolean[LEN];
private boolean isBipartite = true;
private boolean[] isColorited = new boolean[LEN];
public static void main(String...strings){
testcase1();
testcase2();
testcase3();
testcase4();
testcase5();
}
public static void testcase3(){
int[] a1 = null;
int[] a2 = null;
int[] a3 = null;
int[] a4 = null;
int[][] aa = {a1, a2, a3, a4};
System.out.println(new BiColor().isBipartite(aa));
}
public static void testcase4(){
int[] a1 = {1};
int[] a2 = {0,3};
int[] a3 = {3};
int[] a4 = {1,2};
int[][] aa = {a1, a2, a3, a4};
System.out.println(new BiColor().isBipartite(aa));
}
public static void testcase5(){
int[] a1 = {1,2,3};
int[] a2 = {0,2};
int[] a3 = {0,1,3};
int[] a4 = {0,2};
int[][] aa = {a1, a2, a3, a4};
System.out.println(new BiColor().isBipartite(aa));
}
public static void testcase2(){
int[] a1 = {1,2,3};
int[] a2 = {0,2};
int[] a3 = {0,1,3};
int[] a4 = {0,2};
int[][] aa = {a1, a2, a3, a4};
System.out.println(new BiColor().isBipartite(aa));
}
public static void testcase1(){
int[] a1 = {1,3};
int[] a2 = {0,2};
int[] a3 = {1,3};
int[] a4 = {0,2};
int[][] aa = {a1, a2, a3, a4};
System.out.println(new BiColor().isBipartite(aa));
}
public boolean isBipartite(int[][] graph) {
// boundary
if(graph==null || graph.length <=1){
return true;
}
for(int i = 0; i<graph.length; i++){
if(!isBipartite){
return false;
}
if(!isColorited[i]){
dfs(graph, i);
}
}
return isBipartite;
}
private void dfs(int[][] graph, int index){
if(graph[index]==null || graph[index].length==0){
return;
}
// if it's not bipartite, return
if(!isBipartite){
return;
}
// marked node as colorited.
isColorited[index] = true;
// for every connected node
for (int i : graph[index]){
// if it is colorited
if(isColorited[i]){
// if its color is the same current node, isBP = false, return.
// else return
if(colors[i] == colors[index]){
isBipartite = false;
return;
}
}else{
// else, it is not colorited.
// its color should be different from current node
// dfs
colors[i] = !colors[index];
dfs(graph, i);
}
}
}
}
| [
"kaiser_zhao1983@sohu.com"
] | kaiser_zhao1983@sohu.com |
24966f5c3a8b4462558b32ff267ffb7d6c1bcc74 | bd93fa910151c278be8249055bc084e5a5c35a6a | /Java/ClassTest/IDEAProj/src/Chapter7/AssignGrades.java | 5e074e09bf21b6a1364f86c4c6837b7e1341595c | [] | no_license | ahojcn/practice-code | bd81595b80239cd2550183093566bd536a83ed3f | b65f4e76271479269463e92fd3fd41585c2ac792 | refs/heads/master | 2021-07-10T14:15:08.036592 | 2020-07-09T11:32:16 | 2020-07-09T11:32:16 | 153,059,349 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package Chapter7;
/*
* 7.1
*/
import java.util.Scanner;
public class AssignGrades {
public static char get(int score, int best) {
int a = best - score;
if (a <= 10) {
return 'A';
} else if (a <= 20) {
return 'B';
} else if (a <= 30) {
return 'C';
} else if (a <= 40) {
return 'D';
} else {
return 'F';
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the number of students: ");
int n = sc.nextInt();
int[] scores = new int[n];
int best = 0;
System.out.printf("Enter %d scores: ", n);
for (int i = 0; i < n; i++) {
scores[i] = sc.nextInt();
if (scores[i] > best) {
best = scores[i];
}
}
for (int i = 0; i < n; i++) {
System.out.printf("Student %d is %d and grade is %c.\n", i, scores[i], get(scores[i], best));
}
}
}
| [
"hanoi_ahoj@icloud.com"
] | hanoi_ahoj@icloud.com |
c6f72742fb6a911ea01ec4c580d0d08609a5856e | 13f7c192d7f30d34862dd0f97b618f6de502b237 | /src/newer/project/superwechat/bean/Contact.java | a1ed128cd022206712dd33c408925b639cda3779 | [
"Apache-2.0"
] | permissive | NewerPenple/superwechat_newer | ed8888b4456da29bcf4aa5974c1ef496c2803934 | a6d6519d840cafea76dea034b0d4af02dad608b7 | refs/heads/master | 2021-01-21T14:58:02.027321 | 2016-05-31T08:17:28 | 2016-05-31T08:17:28 | 59,083,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | package newer.project.superwechat.bean;
/**
* Contact entity. @author MyEclipse Persistence Tools
*/
public class Contact extends User implements java.io.Serializable {
private static final long serialVersionUID = -2183229871248294573L;
/**
*
*/
// Fields
private Integer mcontactId;
private Integer mcontactUserId;
private String mcontactUserName;
private Integer mcontactCid;
private String mcontactCname;
// Constructors
/** default constructor */
public Contact() {
}
/** full constructor */
public Contact(Integer MContactId, Integer MContactUserId, String MContactUserName,
Integer MContactCid, String MContactCname) {
this.mcontactId = MContactId;
this.mcontactUserId = MContactUserId;
this.mcontactUserName = MContactUserName;
this.mcontactCid = MContactCid;
this.mcontactCname = MContactCname;
}
// Property accessors
public Integer getMContactId() {
return this.mcontactId;
}
public void setMContactId(Integer MContactId) {
this.mcontactId = MContactId;
}
public Integer getMContactUserId() {
return this.mcontactUserId;
}
public void setMContactUserId(Integer MContactUserId) {
this.mcontactUserId = MContactUserId;
}
public String getMContactUserName() {
return this.mcontactUserName;
}
public void setMContactUserName(String MContactUserName) {
this.mcontactUserName = MContactUserName;
}
public Integer getMContactCid() {
return this.mcontactCid;
}
public void setMContactCid(Integer MContactCid) {
this.mcontactCid = MContactCid;
}
public String getMContactCname() {
return this.mcontactCname;
}
public void setMContactCname(String MContactCname) {
this.mcontactCname = MContactCname;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Contact contact = (Contact) o;
return mcontactId.equals(contact.mcontactId);
}
@Override
public int hashCode() {
return mcontactId.hashCode();
}
@Override
public String toString() {
return "Contact [MContactId=" + mcontactId + ", MContactUserId="
+ mcontactUserId + ", MContactUserName=" + mcontactUserName
+ ", MContactCid=" + mcontactCid + ", MContactCname="
+ mcontactCname + "]";
}
} | [
"403353881@qq.com"
] | 403353881@qq.com |
71924424cbbd43a2006026aebefc56a6cb900754 | b10ff9e4c7a715d85639d2ffd72c6ce43892a7b1 | /app/src/main/java/com/example/gdylan2/maggiesfarm.java | cd252df8164e4d6f24a05473a6b72e58d7f56902 | [] | no_license | 87dylan/gdylan2 | 5c7bbe5df3695474534ac707133c0ccc65d4e376 | bfbdf297c8c5c3c99261d58c9b0750fc36a58e68 | refs/heads/master | 2022-11-13T05:37:59.384227 | 2020-07-08T11:47:53 | 2020-07-08T11:47:53 | 277,999,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,377 | java | package com.example.gdylan2;
import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Toast;
public class maggiesfarm extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener{
databasehelper dbh=new databasehelper(this);
CheckBox checkBoxfav;
String title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maggiesfarm );
//copy from here
TextView textView = findViewById(R.id.textView3);
title=textView.getText().toString();
checkBoxfav = findViewById(R.id.favcheck);
favretrieve();
checkBoxfav.setOnCheckedChangeListener(this);
}
public void AddData(String songname,String classname) {
boolean insertData = dbh.addData(songname,classname);
if (insertData) {
Toast.makeText(this, "Lyrics Added To Favourite", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Something went wrong :(.", Toast.LENGTH_LONG).show();
}
}
public void DeleteData(String songname){
Integer rowseffected=dbh.deleteData(songname);
if(rowseffected!=0){
Toast.makeText(this, "Song Removed From Favourite List", Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(this, "Something went wrong :(.", Toast.LENGTH_LONG).show();
}
}
public void favretrieve() {
Cursor objcursor = dbh.getListContents();
if (objcursor.getCount() == 0) {
Toast.makeText(this, "Click Heart To Add To Favourite!", Toast.LENGTH_LONG).show();
} else {
while (objcursor.moveToNext()) {
if (objcursor.getString(1).equals(title)) {
checkBoxfav.setChecked(true);
}
}
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
String className = this.getClass().getName();
if(isChecked){
AddData(title, className);
}
else{
DeleteData(title);
}
}
}
| [
"gedundrakpa@geduns-MacBook-Air.local"
] | gedundrakpa@geduns-MacBook-Air.local |
a9bcad0b65c688a888108796730189ce91917774 | 1f2a7efc5e404d96122becc349af158198c66b9f | /save_eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/day0207/org/apache/jsp/b_jsp.java | 0d6d5f7d1d1f951ad8ab23edb906cf35ee4d6cbc | [] | no_license | hminah0215/bitcamp | e5cdb4579ed353d1a1454ce20772ec6edb4334b0 | 6f749eed71e6dc978719c15faf34ffe407fc343f | refs/heads/master | 2022-10-09T23:29:51.769020 | 2020-04-12T08:58:45 | 2020-04-12T08:58:45 | 251,504,494 | 2 | 2 | null | 2022-09-01T23:22:42 | 2020-03-31T04:58:55 | Java | UTF-8 | Java | false | false | 4,373 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2020-02-07 08:37:39 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class b_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1);
_jspx_dependants.put("/a.jsp", Long.valueOf(1581064405794L));
}
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t");
String data = "월요일에 아프면 돼요? 안돼요?";
out.write('\r');
out.write('\n');
out.write(' ');
out.print(data );
out.write("\r\n");
out.write("\t<hr>\r\n");
out.write("\t<!-- \r\n");
out.write("\t");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "a.jsp", out, false);
out.write(" \r\n");
out.write("\t-->\r\n");
out.write("\t\r\n");
out.write("\t");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t");
String msg ="금요일 입니다.";
out.write('\r');
out.write('\n');
out.write(' ');
out.print(msg );
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"hyeonminah@gmail.com"
] | hyeonminah@gmail.com |
1192cbe652981a17194fbf1bb65a1efc2d41e72d | 710ca439f2b4e7a02461fe3c14f6d5c81d0d8cd2 | /src/application/Program.java | f4e937ad49fa93a85dcd2047adc21b9bf06a71c2 | [] | no_license | alexandremolica/ex-lambda-consumer-3 | 3863aa98197a0a4b81ad0cc5fc6cec2edbc1b68d | 381ff996762c66fc52744ad1c1077f8c10e685ec | refs/heads/master | 2020-12-26T23:58:28.330195 | 2020-02-02T00:22:18 | 2020-02-02T00:22:18 | 237,693,748 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,246 | java | package application;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import entities.Product;
public class Program {
public static void main(String[] args) {
/*
* Lambda - consumer
*/
// Remove da lista price maior igual a 100
List<Product> list = new ArrayList<>();
list.add(new Product("TV", 900.00));
list.add(new Product("Mouse", 50.00));
list.add(new Product("Tablet", 350.50));
list.add(new Product("HD Case", 80.90));
// usando classe PriceUpate
// que implementa interface consumer
/*
list.forEach(new PriceUpdate());
list.forEach(System.out::println);
*/
// ou usando metodo static
/*
list.forEach(Product::staticPriceUpdate);
list.forEach(System.out::println);
*/
//ou usando metodo nao static
/*
list.forEach(Product::nonStaticPriceUpdate);
list.forEach(System.out::println);
*/
//ou expressao lambda declarada
/*
double factor = 1.1;
Consumer<Product> cons = p -> {
p.setPrice(p.getPrice() * factor);
};
list.forEach(cons);
list.forEach(System.out::println);
*/
// ou Expressao lambda inline
list.forEach(p -> p.setPrice( p.getPrice() * 1.1 ) );
list.forEach(System.out::println);
}
}
| [
"alexandremolica@gmail.com"
] | alexandremolica@gmail.com |
722307658782918603841db3cc79ddd5cb192f1e | 47355805740f41f3da3001eb35d82fd0dcc502e9 | /Bai15-SpringSecurity-PhanQuyen-Authorization/demo_sercurity_2/src/test/java/com/example/security/demo_sercurity_2/DemoSercurity2ApplicationTests.java | 6517fa3bd04f7bf291491fc79d434332c3233e04 | [] | no_license | tuongvule/C0420G1-VuLeTuong-Module4 | 333156a63ea7d53c3b69f53955d703fa94f4c11c | 18ee1fa2c5b61d7f134fd766bd6ccd137ae150c7 | refs/heads/master | 2022-12-16T07:24:36.028856 | 2020-09-22T00:58:37 | 2020-09-22T00:58:37 | 288,460,799 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package com.example.security.demo_sercurity_2;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoSercurity2ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"tuongvule@gmail.com"
] | tuongvule@gmail.com |
bd4f1738838aaa608a3b2e6c2453f0d97d2bd6ae | 58ac2987f70e4fa6195660372e885ba975784cf5 | /org.eclipse.gemini.dbaccess.mysql/src/main/java/org/eclipse/gemini/dbaccess/mysql/ClientDataSourceFactory.java | 92cd9be38c13800f10a81d06513fa8f5cf811b4b | [] | no_license | thingtrack/third-party | 8fda2a5d0ed23aa206e4be47acfdc2c73f5e2641 | c8e6f969805388f6fa32cb68f265057eb0fc6bd8 | refs/heads/master | 2021-01-19T11:43:12.277380 | 2014-11-29T21:44:30 | 2014-11-29T21:44:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,214 | java | /*
* Copyright 2011 Thingtrack, S.L.
*
* 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 org.eclipse.gemini.dbaccess.mysql;
import java.util.Properties;
import java.sql.Driver;
import java.sql.SQLException;
import javax.sql.DataSource;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.XADataSource;
import org.osgi.service.jdbc.DataSourceFactory;
import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource;
/**
* A factory for creating MySQL network data sources. The properties specified
* in the create methods determine how the created object is configured.
*
* Sample code for obtaining a MySQL network data source:
*
* ServiceTracker tracker = new ServiceTracker(context,
* DataSourceFactory.class.getName(), null); tracker.open(); DataSourceFactory
* dsf = (DataSourceFactory) tracker.getService(); Properties props = new
* Properties(); props.put(DataSourceFactory.JDBC_SERVER_NAME, "localhost");
* props.put(DataSourceFactory.JDBC_PORT_NUMBER, "3306");
* props.put(DataSourceFactory.JDBC_DATABASE_NAME, "myDB");
* props.put(DataSourceFactory.JDBC_USER, "mike");
* props.put(DataSourceFactory.JDBC_PASSWORD, "password"); DataSource ds =
* dsf.createDataSource(props);
*
* This service also supports a URL-based data source. The following 3
* properties can be provided instead of the 5 properties above:
*
* props.put(DataSourceFactory.JDBC_URL, "jdbc:mysql://localhost:3306/myDB");
* props.put(DataSourceFactory.JDBC_USER, "mike");
* props.put(DataSourceFactory.JDBC_PASSWORD, "password");
*/
public class ClientDataSourceFactory extends AbstractDataSourceFactory {
public ClientDataSourceFactory() {
}
/**
* Create a PostgreSQL DataSource object.
*
* @param props
* The properties that define the DataSource implementation to
* create and how the DataSource is configured.
* @return The configured DataSource.
* @throws SQLException
* @see org.osgi.service.jdbc.DataSourceFactory#createDataSource(java.util.Properties)
*/
public DataSource createDataSource(Properties props) throws SQLException {
if (props == null)
props = new Properties();
if (props.get(DataSourceFactory.JDBC_URL) != null) {
return new UrlBasedDriverDataSource(props);
} else {
DataSource dataSource = new MysqlDataSource();
setDataSourceProperties(dataSource, props);
return dataSource;
}
}
/**
* Create a PostgreSQL ConnectionPoolDataSource object.
*
* @param props
* The properties that define the ConnectionPoolDataSource
* implementation to create and how the ConnectionPoolDataSource
* is configured.
* @return The configured ConnectionPoolDataSource.
* @throws SQLException
* @see org.osgi.service.jdbc.DataSourceFactory#createConnectionPoolDataSource(java.util.Properties)
*/
public ConnectionPoolDataSource createConnectionPoolDataSource(
Properties props) throws SQLException {
if (props == null)
props = new Properties();
ConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource();
setDataSourceProperties(dataSource, props);
return dataSource;
}
/**
* Create a PostgreSQL XADataSource object.
*
* @param props
* The properties that define the XADataSource implementation to
* create and how the XADataSource is configured.
* @return The configured XADataSource.
* @throws SQLException
* @see org.osgi.service.jdbc.DataSourceFactory#createXADataSource(java.util.Properties)
*/
public XADataSource createXADataSource(Properties props)
throws SQLException {
if (props == null)
props = new Properties();
XADataSource dataSource = new MysqlXADataSource();
setDataSourceProperties(dataSource, props);
return dataSource;
}
/**
* Create a new org.postgresql.Driver.
*
* @param props
* The properties used to configure the Driver. Null indicates no
* properties. If the property cannot be set on the Driver being
* created then a SQLException must be thrown.
* @return A configured org.apache.derby.jdbc.EmbeddedDriver.
* @throws SQLException
* If the org.postgresql.Driver cannot be created.
*/
public Driver createDriver(Properties props) throws SQLException {
// Properties not used when accessing the raw driver.
Driver driver = new com.mysql.jdbc.Driver();
setDataSourceProperties(driver, props);
return driver;
}
} | [
"carlos@thingtrack.com"
] | carlos@thingtrack.com |
c5174b03dcdca7b3d160f9738ef79da0a6e7483b | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas_ReducedClassCount/applicationModule/src/test/java/applicationModulepackageJava3/Foo500Test.java | 6f1c83d20f0af0e074cb69a8369833218f8bd49f | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package applicationModulepackageJava3;
import org.junit.Test;
public class Foo500Test {
@Test
public void testFoo0() {
new Foo500().foo0();
}
@Test
public void testFoo1() {
new Foo500().foo1();
}
@Test
public void testFoo2() {
new Foo500().foo2();
}
@Test
public void testFoo3() {
new Foo500().foo3();
}
@Test
public void testFoo4() {
new Foo500().foo4();
}
@Test
public void testFoo5() {
new Foo500().foo5();
}
@Test
public void testFoo6() {
new Foo500().foo6();
}
@Test
public void testFoo7() {
new Foo500().foo7();
}
@Test
public void testFoo8() {
new Foo500().foo8();
}
@Test
public void testFoo9() {
new Foo500().foo9();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
7749774d2280bcbc66c419f8ae36296c58e23a04 | 88697d9c6f586a9d4745cdb5f215e224edc4a27a | /src/test/java/chess/Cevtables_ESTest_scaffolding.java | 4410aff30f1d5b115f1747e48aa6d9c47480c6d5 | [] | no_license | studur/ChessManager | 05c2df9a1daf16e11c284e1503663624b63292c7 | 1b5c208fa80d8d1c9800868f777813ab87d40f76 | refs/heads/master | 2021-05-13T14:43:29.548458 | 2018-12-18T00:02:04 | 2018-12-18T00:02:04 | 116,748,816 | 1 | 0 | null | 2018-12-18T00:02:05 | 2018-01-09T01:23:58 | Java | UTF-8 | Java | false | false | 4,163 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Apr 27 14:57:15 GMT 2018
*/
package chess;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Cevtables_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "chess.Cevtables";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "Cp1252");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "C:\\Users\\mxm07101\\AppData\\Local\\Temp\\");
java.lang.System.setProperty("user.country", "CA");
java.lang.System.setProperty("user.dir", "E:\\ChessManager\\ChessManager");
java.lang.System.setProperty("user.home", "C:\\Users\\mxm07101");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "mxm07101");
java.lang.System.setProperty("user.timezone", "America/New_York");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Cevtables_ESTest_scaffolding.class.getClassLoader() ,
"chess.Cevtables"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Cevtables_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"chess.Cevtables"
);
}
}
| [
"Martin.Morissette@grassvalley.com"
] | Martin.Morissette@grassvalley.com |
d6f0f3260bce55fa0f809421ef2a168b73cbcbf9 | 395ad1bec3d6c8c78fcaeb2ffbffa65d0967f217 | /src/chat2/MultiServer.java | 00369149bd29081649e735cb9bc3d97148e4c6ed | [] | no_license | solnine525/K01NetworkChat | 9b6f6464c56f374ff1b21e43218cb73ba2f76466 | cea55a330ebb8fdcd03d8195ff30b9479d3854a6 | refs/heads/master | 2023-04-11T10:32:37.459725 | 2021-04-22T01:37:09 | 2021-04-22T01:37:09 | 359,734,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,427 | java | package chat2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class MultiServer {
public static void main(String[] args) {
ServerSocket serverSocket = null;
Socket socket = null;
PrintWriter out = null;
BufferedReader in = null;
String s =""; //클라이언트의 메세지를 저장
String name =""; //클라이언트의 이름을 저장
try {
//포트를 기반으로 서버에서 소켓을 열고 접속을 기다림
serverSocket = new ServerSocket(9999);
System.out.println("서버가 시작되었습니다.");
//클라이언트의 접속을 허가
socket = serverSocket.accept();
System.out.println(socket.getInetAddress()+"의 "+socket.getPort()
+"포트에"+socket.getLocalAddress()+"의 "+socket.getLocalPort()
+"포트로 연결되었습니다.");
//메세지를 보낼 준비 (서버->클라이언트)
out = new PrintWriter(socket.getOutputStream(),true);
//메세지를 읽을(받을)준비 (클라이언트->서버)
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
/*
클라이언트가 서버로 전송하는 최초의 메세지는 "대화명"이므로
메세지를 읽은 후 변수에 저장하고 클라이언트 쪽으로 Echo 해준다.
*/
if(in != null) {
name = in.readLine(); //클라이언트의 이름을 읽엇ㅓ 저장한다.
System.out.println(name+" 접속"); //서버의 콘솔에 출력하고,
out.println("> "+name+"님이 접속했습니다."); //클라이언트 측으로 Echo해준다.
}
/*
두번째 메세지부터는 실제 대화내용이므로 읽어와서 콘솔에 출력하고
동시에 클라이언트 측으로 Echo 해준다.
*/
while(in != null) {
s = in.readLine();
if(s==null) {
break;
}
System.out.println(name+" ==> "+s); //서버의 콘솔에 출력
out.println("> "+name+" ==> "+s); //클라이언트 측으로 Echo
}
System.out.println("Bye...!!!");
}
catch(Exception e) {
System.out.println("예외1:"+e);
// e.printStackTrace();
}
finally {
try {
in.close();
out.close();
socket.close();
serverSocket.close();
}
catch(Exception e) {
System.out.println("예외2:"+e);
// e.printStackTrace();
}
}
}
}
| [
"solnine525@gmail.com"
] | solnine525@gmail.com |
570fa6742202df5a49968286dc98d0dea2b126ca | 2295778a2d3e7088c4f25545a386fecc63a11552 | /ArtisteManager/src/main/java/fr/iut/ArtisteManager/exception/AlbumNotFoundException.java | b69a4c574e0cae39ef689111d8046e392199579d | [
"MIT"
] | permissive | KillianDhe/client-serveur | 9e077a45578bbe77367fa9a9474c6b27bd54ac33 | 76e0c58c4d753fd899c29f29b29165803d55d788 | refs/heads/master | 2023-06-12T17:21:37.231123 | 2021-06-18T20:33:31 | 2021-06-18T20:33:31 | 381,494,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package fr.iut.ArtisteManager.exception;
import org.bson.types.ObjectId;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class AlbumNotFoundException extends RuntimeException {
public AlbumNotFoundException() {
super("Aucun album trouvé");
}
public AlbumNotFoundException(ObjectId id) {
super("Album non trouvé pour l'id : " + id);
}
public AlbumNotFoundException(String message) {
super(message);
}
}
| [
"killian.dherment@etu.uca.fr"
] | killian.dherment@etu.uca.fr |
9cfbe87ae058175705c834bcf4630947d8c4b7e1 | b3a4e74f823c837c63c3fd6fc7f2023857cbfa1b | /app/src/main/java/com/syafiqmarzuki21/msyafiqmarzuki/ad6materialdesign/ui/main/SectionsPagerAdapter.java | 1ef6ca303aac3983fcfc11cde465d21ea03504c0 | [] | no_license | syafiqmarzuki/AD6-AplikasiCompanyProfil | 646baeec0097b2a7024855d40e132ff013739765 | 3b2406b6741619f8166e176a18637afe799a1140 | refs/heads/master | 2020-05-24T23:00:51.172397 | 2019-05-19T19:12:11 | 2019-05-19T19:12:11 | 187,506,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,391 | java | package com.syafiqmarzuki21.msyafiqmarzuki.ad6materialdesign.ui.main;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.syafiqmarzuki21.msyafiqmarzuki.ad6materialdesign.R;
/**
* A [FragmentPagerAdapter] that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
@StringRes
private static final int[] TAB_TITLES = new int[]{R.string.tab_text_1, R.string.tab_text_2};
private final Context mContext;
public SectionsPagerAdapter(Context context, FragmentManager fm) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return PlaceholderFragment.newInstance(position + 1);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return mContext.getResources().getString(TAB_TITLES[position]);
}
@Override
public int getCount() {
// Show 2 total pages.
return 2;
}
} | [
"syafiqmarzuki33@gmail.com"
] | syafiqmarzuki33@gmail.com |
6a3274e878a5d036ed67021e3b43207608208a64 | 26cc9dedb90fc31c8f00698728569668056296a9 | /Hernia/src/test/java/com/hernia/utilities/BasePage.java | a6c852f3ed9c02f952816f05537fbd3c5159ff8a | [] | no_license | sammyankura/qa-automation-Hernia | bdc267b99539ad6c245ff0deed40ce8a1329b299 | a0eb0c519faaf4a5b8cdfa3f39f40e8a4714909c | refs/heads/master | 2020-04-24T13:46:39.553508 | 2019-02-22T06:48:22 | 2019-02-22T06:48:22 | 171,999,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,074 | java | package com.hernia.utilities;
import java.lang.reflect.Method;
import org.openqa.selenium.WebDriver;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
public class BasePage extends Constants{
public static WebDriver driver;
public static UtilityLibrary myLib;
private static JavaPropertiesManager property;
private static String browser;
public static ExcelRead excelRead;
public static ExcelWrite excelWrite;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@BeforeClass
public static void beforeAllTestStart() throws Exception {
property = new JavaPropertiesManager("src/test/resources/config.properties");
browser = property.readProperty("browserType");
myLib = new UtilityLibrary(driver);
if (property.readProperty("isDemoMode").contains("true")) {
myLib.isDemoMode = true;
} else {
myLib.isDemoMode = false;
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@BeforeMethod
public void beforeEachTest(Method caller) throws Exception {
driver = myLib.startLocalBrowser(browser);
excelRead = new ExcelRead(Constants.ExcelFile);
excelWrite = new ExcelWrite(Constants.ExcelFile);
System.out.println("*** Test Started ***");
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@AfterMethod
public void afterEachTest(ITestResult testResult) throws Exception {
if (testResult.getStatus() == ITestResult.FAILURE) {
ScreenshotRule.takeScreenshot(driver, testResult.getName());
}
myLib.customWait(3);
System.out.println("*** Test Ended ***");
driver.close();
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@AfterClass
public static void afterAllTest() {
if (driver != null) {
driver.quit();
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} | [
"sammy.hamim@ankuraconsulting.com"
] | sammy.hamim@ankuraconsulting.com |
90341e0c42bd68e5844fba4e16fd996e61f15531 | 842c5da98851e9b3120724d4ac60f5edc66742b4 | /dsProject3/src/main/java/dsProject3/dsProject3/RedditDataMapReduce.java | ad2e87051dd74ae61eaf5f412256e3358d688ba2 | [] | no_license | danielharding3/RedditMapReduce | 8889ef9175c683ff86c80fee0d19f7694e5f6048 | a3d779cc554c98ff96a2c4730df5ffe40d642673 | refs/heads/master | 2023-04-19T01:13:01.527800 | 2021-05-01T21:57:02 | 2021-05-01T21:57:02 | 256,620,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,809 | java | package dsProject3.dsProject3;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.io.Text;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
public class RedditDataMapReduce {
public static class MapClass extends Mapper<Object, Text, IntWritable, IntWritable> {
IntWritable imageID = new IntWritable();
IntWritable interactions = new IntWritable();
//IntWritable upvotes = new IntWritable();
//IntWritable downvotes = new IntWritable();
//IntWritable comments = new IntWritable();
public void map(Object key, Text value, Mapper<Object, Text,
IntWritable, IntWritable>.Context context) throws IOException, InterruptedException {
//StringTokenizer strToken = new StringTokenizer(value.toString());
String str = value.toString();
String[] arr = str.split("\t");
imageID.set(Integer.parseInt(arr[RedditConstants.IMAGE_ID]));
int numUpvotes = Integer.parseInt(arr[RedditConstants.UPVOTES]);
int numDownvotes = Integer.parseInt(arr[RedditConstants.DOWNVOTES]);
int numComments = Integer.parseInt(arr[RedditConstants.COMMENTS]);
int numInteractions = numUpvotes + numDownvotes + numComments;
interactions.set(numInteractions);
context.write(imageID, interactions);
//Text wordOut = new Text();
//IntWritable ones = new IntWritable(1);
// while (strToken.hasMoreTokens()) {
// wordOut.set(strToken.nextToken());
// context.write(wordOut, ones);
// }
}
}
public static class ReduceClass extends Reducer<IntWritable, IntWritable, IntWritable, IntWritable> {
public void reduce(IntWritable interactions, Iterable<IntWritable> imageIDs,
Reducer<IntWritable, IntWritable, IntWritable, IntWritable>.Context context)
throws IOException, InterruptedException {
Set<Integer> imageIDSet = new HashSet<Integer>();
for (IntWritable imageID : imageIDs) {
imageIDSet.add(imageID.get());
}
IntWritable size = new IntWritable(imageIDSet.size());
context.write(interactions, size);
}
/*
public void reduce(Text term, Iterable<IntWritable> ones, Context context) throws IOException, InterruptedException {
int count = 0;
Iterator<IntWritable> iterator = ones.iterator();
while (iterator.hasNext()) {
count++;
iterator.next();
}
IntWritable output = new IntWritable(count);
context.write(term, output);
}
*/
}
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Need only 2 files");
System.exit(2);
}
Job job = Job.getInstance(conf, "Interactions per Reddit Post");
job.setJarByClass(RedditDataMapReduce.class);
job.setMapperClass(MapClass.class);
job.setReducerClass(ReduceClass.class);
job.setNumReduceTasks(10);
job.setOutputKeyClass(IntWritable.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
boolean status = job.waitForCompletion(true);
if (status) {
System.exit(0);
} else {
System.exit(1);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
79d28df690ede9822ec2f549541515d218470390 | 3e238ca59be13dab4056b3204c2afb39c2bd2ef7 | /app/src/main/java/pager/demo/com/fragment/SimpleFragmentPagerAdapter.java | 9b15c1bfb51f190bcc3c708d50397635ded6e3db | [] | no_license | avik1990/Fragment-master | 7c4f1393af47f00e2fd9f292de1ee8df5e8daefb | ce73eb48e4d44b864c216dbe952edf746382d116 | refs/heads/master | 2021-03-31T02:10:09.704847 | 2018-03-08T11:40:09 | 2018-03-08T11:40:09 | 124,383,178 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,452 | java | package pager.demo.com.fragment;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
/**
* Created by user2 on 26-02-2018.
*/
public class SimpleFragmentPagerAdapter extends FragmentPagerAdapter {
private Context mContext;
public SimpleFragmentPagerAdapter(Context context, FragmentManager fm) {
super(fm);
mContext = context;
}
// This determines the fragment for each tab
@Override
public Fragment getItem(int position) {
if (position == 0) {
return new FirstFragment();
} else if (position == 1){
return new BedRoom();
} else if (position == 2){
return new BathRoom();
} else {
return new HallRoom();
}
}
// This determines the number of tabs
@Override
public int getCount() {
return 4;
}
// This determines the title for each tab
@Override
public CharSequence getPageTitle(int position) {
// Generate title based on item position
switch (position) {
case 0:
return "Switch";
case 1:
return "Bedroom";
case 2:
return "BathRoom";
case 3:
return "HallRoom";
default:
return null;
}
}
} | [
"avik1990@gmail.com"
] | avik1990@gmail.com |
6235e5ea569605dd3595f454dd6e1d660f639319 | eb1343219a925101de1b4ca4aadae71b51dfffd2 | /mnisqm/mnisqm-services/src/main/java/com/lachesis/mnisqm/module/trainExamManage/dao/TemTrainManageMapper.java | 56644008b4aaaf0a410ce7c8762626ed243961c0 | [
"Apache-2.0"
] | permissive | gavin2lee/incubator | b961c23c63fc88c059e74e427b665125115717db | c95623af811195c3e89513ec30e52862d6562add | refs/heads/master | 2020-12-13T20:52:26.951484 | 2017-01-25T00:31:59 | 2017-01-25T00:31:59 | 58,938,038 | 4 | 4 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.lachesis.mnisqm.module.trainExamManage.dao;
import com.lachesis.mnisqm.module.trainExamManage.domain.TemTrainManage;
import java.util.List;
import java.util.Map;
public interface TemTrainManageMapper {
int deleteByPrimaryKey(Long seqId);
int insert(TemTrainManage record);
TemTrainManage selectByPrimaryKey(Long seqId);
List<TemTrainManage> selectAll();
int updateByPrimaryKey(TemTrainManage record);
List<TemTrainManage> queryByTimeOrDeptCodeOrCourseName(Map<String,Object> map);
} | [
"gavin2lee@163.com"
] | gavin2lee@163.com |
cb57bc33ba90bb534fac18b4c65594da94cd291d | 26baa6a4f0bde23883e93309d9ad28e2feee23d1 | /opennms-util/src/main/java/org/opennms/core/queue/FifoQueueImpl.java | 643dc9b4182b61c5019818858c8eef2ba9dfa47f | [] | no_license | taochong123456/opennms-1.10.12-1 | 6532544405fff3dddd96f1250775e48f2aa38f0f | 0f4c01a8e80e2144125eb189daac38a4e559421a | refs/heads/master | 2020-03-18T12:37:27.510530 | 2018-09-20T17:00:28 | 2018-09-20T17:00:28 | 134,734,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,077 | java | /*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2006-2012 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) 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.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.core.queue;
import java.util.Deque;
import java.util.LinkedList;
/**
* </p>
* This interface defines a queue that uses <em>F</em> irst <em>I</em>n,
* <em>F</em> irst <em>O</em> ut semantics when adding and removing objects.
* Each object that is added to the queue is effectively placed at the end of
* the list of previous elements. Each call to <code>remove</code> will result
* in the removal of the next element, or the oldest element in the queue.
* </p>
*
* @author <a href="mailto:weave@oculan.com">Brian Weaver </a>
*/
public class FifoQueueImpl<T> implements FifoQueue<T> {
/**
* The delegate list where queue elements are stored. The elements are
* removed from the front of the list and added to the end of the list,
* always!
*/
private final Deque<T> m_delegate;
/**
* Constructs a new First In, First Out queue that can be used to exchange
* data. The implementation is thread safe and can be used to exchange data
* between to concurrent processes.
*/
public FifoQueueImpl() {
m_delegate = new LinkedList<T>();
}
/**
* Inserts a new element into the queue.
*
* @param element
* The object to append to the queue.
* @exception org.opennms.core.queue.FifoQueueException
* Thrown if a queue error occurs.
* @exception java.lang.InterruptedException
* Thrown if the thread is interrupted.
* @throws org.opennms.core.queue.FifoQueueException if any.
* @throws java.lang.InterruptedException if any.
*/
public void add(T element) throws FifoQueueException, InterruptedException {
synchronized (m_delegate) {
m_delegate.addLast(element);
m_delegate.notifyAll();
}
}
/**
* {@inheritDoc}
*
* Inserts a new element into the queue. If the queue has reached an
* implementation limit and the <code>
* timeout</code> expires, then a false
* value is returned to the caller.
* @exception org.opennms.core.queue.FifoQueueException
* Thrown if a queue error occurs.
* @exception java.lang.InterruptedException
* Thrown if the thread is interrupted.
*/
public boolean add(T element, long timeout) throws FifoQueueException, InterruptedException {
synchronized (m_delegate) {
m_delegate.addLast(element);
m_delegate.notifyAll();
}
return true;
}
/**
* Removes the oldest element from the queue.
*
* @exception org.opennms.core.queue.FifoQueueException
* Thrown if a queue error occurs.
* @exception java.lang.InterruptedException
* Thrown if the thread is interrupted.
* @return The oldest object in the queue.
* @throws org.opennms.core.queue.FifoQueueException if any.
* @throws java.lang.InterruptedException if any.
*/
public T remove() throws FifoQueueException, InterruptedException {
synchronized (m_delegate) {
while (m_delegate.isEmpty()) {
m_delegate.wait();
}
return m_delegate.removeFirst();
}
}
/**
* {@inheritDoc}
*
* Removes the next element from the queue if one becomes available before
* the timeout expires. If the timeout expires before an element is
* available then a <code>null</code> reference is returned to the caller.
* @exception org.opennms.core.queue.FifoQueueException
* Thrown if a queue error occurs.
* @exception java.lang.InterruptedException
* Thrown if the thread is interrupted.
*/
public T remove(long timeout) throws FifoQueueException, InterruptedException {
T rval = null;
synchronized (m_delegate) {
if (m_delegate.isEmpty()) {
long start = System.currentTimeMillis();
long diff = 0;
do {
m_delegate.wait(timeout - diff);
diff = System.currentTimeMillis() - start;
} while (diff < timeout && m_delegate.isEmpty());
}
if (!m_delegate.isEmpty())
rval = m_delegate.removeFirst();
}
return rval;
}
/**
* Returns the current number of elements that are in the queue.
*
* @return The number of elements in the queue.
*/
public int size() {
synchronized (m_delegate) {
return m_delegate.size();
}
}
/**
* Used to test if the current queue has no stored elements.
*
* @return True if the queue is empty.
*/
public boolean isEmpty() {
synchronized (m_delegate) {
return m_delegate.isEmpty();
}
}
}
| [
"2636757099@qq.com"
] | 2636757099@qq.com |
b2c51d6c72dbe10cd1b33f85739a4e3918e13ea2 | 5fe77ced8bbe256c5a064dd17d622f7e2a9be040 | /brillo2/examples/companion/src/main/java/com/intel/otc/brillo/examples/demo/companion/OcClient.java | c5d94efd6599dfff16969b97a3a7c68153938d1d | [] | no_license | ttzeng/brillo-products | d6c3d761ad93a92c4f477562e5466483177999cc | a2748821ae913958ca0384fcb0194f286dd487d5 | refs/heads/master | 2021-04-19T01:58:25.991919 | 2021-02-18T03:19:23 | 2021-02-18T03:19:23 | 53,556,240 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 3,397 | java | package com.intel.otc.brillo.examples.demo.companion;
import android.content.Context;
import android.util.Log;
import org.iotivity.base.ModeType;
import org.iotivity.base.OcConnectivityType;
import org.iotivity.base.OcException;
import org.iotivity.base.OcPlatform;
import org.iotivity.base.OcResource;
import org.iotivity.base.OcResourceIdentifier;
import org.iotivity.base.PlatformConfig;
import org.iotivity.base.QualityOfService;
import org.iotivity.base.ServiceType;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class OcClient implements OcPlatform.OnResourceFoundListener {
private static final String TAG = OcClient.class.getSimpleName();
private Context mContext;
private ResourceAdapter mResourceAdapter;
private Map<OcResourceIdentifier, OcResource> mResourceFound = new HashMap<>();
public OcClient(Context context, ResourceAdapter adapter) {
mResourceAdapter = adapter;
PlatformConfig platformConfig = new PlatformConfig(
mContext = context,
ServiceType.IN_PROC,
ModeType.CLIENT,
"0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
0, // Uses randomly available port
QualityOfService.LOW
);
OcPlatform.Configure(platformConfig);
}
public synchronized void findResources(final String ocResourceType) {
new Thread(new Runnable() {
@Override
public void run() {
try {
OcPlatform.OnResourceFoundListener listener = OcClient.this;
String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=" + ocResourceType;
OcPlatform.findResource("", requestUri, EnumSet.of(OcConnectivityType.CT_DEFAULT), listener);
TimeUnit.SECONDS.sleep(1);
/* Find resource is done twice so that we discover the original resources a second time.
* These resources will have the same uniqueidentifier (yet be different objects),
* so that we can verify/show the duplicate-checking code in foundResource(above);
*/
OcPlatform.findResource("", requestUri, EnumSet.of(OcConnectivityType.CT_DEFAULT), listener);
} catch (OcException | InterruptedException e) {
Log.e(TAG, e.toString());
}
}
}).start();
}
@Override
public void onResourceFound(final OcResource resource) {
if (!mResourceFound.containsKey(resource.getUniqueIdentifier())) {
Log.d(TAG, "Found resource " + resource.getHost() + resource.getUri() +
" for the first time on server with ID " + resource.getServerId());
mResourceFound.put(resource.getUniqueIdentifier(), resource);
} else {
display("Found resource " + resource.getHost() + resource.getUri());
mResourceAdapter.add(resource);
}
}
private void display(final String text) {
final MainActivity activity = (MainActivity) mContext;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.display(text);
}
});
}
}
| [
"tonny.tzeng@intel.com"
] | tonny.tzeng@intel.com |
2c71636b41a1c714b8de49a960012e0fc44c8a39 | 798b643ed0e7ec3436818930f7bb5949f1efe8b0 | /leetcode/src/test/java/com/arpan/leetcode/threesum/ThreeSumSolutionTest.java | 607c054feeb8c5db152157603778a8c92e86ee17 | [] | no_license | ArpanMajumdar/DSA | bac5195016f266e3349b79a1435ee064041ca0da | 7dd2ecc49e86286f29b4079f5b4618647c0ed6d4 | refs/heads/master | 2021-03-24T09:58:45.950414 | 2020-08-09T06:51:56 | 2020-08-09T06:51:56 | 117,872,120 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package com.arpan.leetcode.threesum;
import org.junit.jupiter.api.Test;
import java.util.List;
class ThreeSumSolutionTest {
@Test
void threeSum() {
// Arrange
int[] nums = {1, 2, -2, -1};
// Act
ThreeSumSolution threeSumSolution = new ThreeSumSolution();
List<List<Integer>> actual = threeSumSolution.threeSum(nums);
// Assert
actual.forEach(numList -> {
numList.forEach(num -> System.out.print(num + "\t"));
System.out.println();
}
);
}
} | [
"arpan.majumdar.dev@gmail.com"
] | arpan.majumdar.dev@gmail.com |
b8551e5c19845570639454ce71ef3c2197a0419a | d72f0758ff76d6f70c27dc1eb17cc2d776e3551c | /Assignments/Assignment02/MyCharliePlugins/src/charlie/advisor/Advisor.java | 687efa3f5bd4c2baac60bc55ff100c4cca9b8a59 | [] | no_license | AnirudhNagulapalli/MSCS510L | bbd4852b363e29e922476a975090eae1c2cb76f2 | 34267fefba81b029d51a5ffdd2047b684dd524b2 | refs/heads/master | 2020-03-23T05:48:29.478485 | 2018-07-16T16:55:44 | 2018-07-16T16:55:44 | 141,166,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | 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 charlie.advisor;
import charlie.card.Card;
import charlie.card.Hand;
import charlie.plugin.IAdvisor;
import charlie.util.Play;
import java.util.HashMap;
/**
*
* @author Anirudh
*/
public class Advisor extends BasicStrategy implements IAdvisor {
Play[] result;
@Override
public Play advise(Hand myHand, Card upCard) {
Card myCard1 = myHand.getCard(0); //1st Card
Card myCard2 = myHand.getCard(1); //2nd Card
int MyTotal = myHand.getValue(); //Count (Card1+Card2)
int DealerCard = upCard.value(); //Dealers Open Card
if(myCard1!=myCard2){ //If Cards are not same
if(MyTotal>=12 && MyTotal<=20){ //If 11<Count<21
String PlayerValue = Integer.toString(myHand.getValue());
//Give Inputs to GreaterThan11 HashMap
result = GreaterThan11.get(PlayerValue);
}
else if(MyTotal>=5 && MyTotal<=11){ //If 4<Count<12
String PlayerValue = Integer.toString(myHand.getValue());
//Give Inputs to LessThanOrEqual11 HashMap
result = LessThanOrEqual11.get(PlayerValue);
}
}
if(myCard1.isAce() && !myCard2.isAce()){ //If 1st Card is an Ace
//Give Inputs as A, 2nd Card to SingleAce HashMap
result = SingleAce.get("A,"+Integer.toString(myCard2.value()));
}
else if(myCard2.isAce() && !myCard1.isAce()){ //If 2nd Card is an Ace
//Give Inputs as A, 1st Card to SingleAce HashMap
result = SingleAce.get("A,"+Integer.toString(myCard1.value()));
}
if(myCard1.equals(myCard2)){ //If Cards are same
//Return both Cards to Equals HashMap
result = Equals.get(myCard1+","+myCard2);
}
if(upCard.isAce()){ //If Dealers Card is an Ace
//Returns Value for result[9] in result array
return result[9];
}
else{
return result[upCard.value()-2]; //As array index starts from 0
}
}
}
| [
"anirudh.nagulapalli1@marist.edu"
] | anirudh.nagulapalli1@marist.edu |
c96ab22f5c72f257cb0a43846ab4080ad733b668 | 8d205594575416b4a79112f2595b8fde848347b3 | /Front-End/app/src/main/java/cn/edu/heuet/login/constant/NetConstant.java | f5c3075f220f00bc0e9bc041f998ddcfeef2c291 | [] | no_license | ccjacoo/XZcodeAPP | d6a546da3491aea5a4bc659d1cce8656aaf0c1fa | 5a04860c4d221f53a80c3847c5afb1634d2dea8e | refs/heads/master | 2023-02-09T21:40:24.452314 | 2021-01-03T03:41:46 | 2021-01-03T03:41:46 | 326,319,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | package cn.edu.heuet.login.constant;
/**
* 前端与后端的连接由该文件实现
* */
public class NetConstant {
public static final String baseService = "http://364051j4t2.qicp.vip:59175"; //花生壳内网映射
//public static final String baseService = "http://localhost:8090";
private static final String getOtpCodeURL = "/user/getOtp";
private static final String loginURL = "/user/login";
private static final String registerURL = "/user/register";
private static final String getUserInfoURL = "/user/getUserInfo?tel=";
private static final String createItemURL = "/item/create";
private static final String getItemListURL = "/item/list";
private static final String submitOrderURL = "/order/createorder";
private static final String getNewsListURL = "/news/list";
private static final String getNewsByIdURL = "/news/detail/id?id=";
private static final String getNewsByTitleURL = "/news/detail/title?title=";
public static String getGetOtpCodeURL() {
return getOtpCodeURL;
}
public static String getLoginURL() {
return loginURL;
}
public static String getRegisterURL() {
return registerURL;
}
public static String getCreateItemURL() {
return createItemURL;
}
public static String getGetItemListURL() {
return getItemListURL;
}
public static String getSubmitOrderURL() {
return submitOrderURL;
}
public static String getNewsListURL() {
return getNewsListURL;
}
public static String getNewsByIdURL() {
return getNewsByIdURL;
}
public static String getNewsByTitleURL() {
return getNewsByTitleURL;
}
public static String getUserInfoURL() {
return getUserInfoURL;
}
}
| [
"570791563@qq.com"
] | 570791563@qq.com |
7b08b18c466bbd4fb5b951b740b977cc16ea9553 | 001ba3038b1ed040fb658e90d0fc5d92663d5f10 | /src/main/java/com/jhtest/app/web/rest/vm/package-info.java | f6e791438909bb05af10ba0f83ceceef2019a9d3 | [] | no_license | l7777777b/jh-library-nocache | fa5f052b0307b60216ffa2cf77666088e38ab320 | 820394a27a04268cd354a39b8289cf118f3370ce | refs/heads/master | 2022-06-26T20:25:44.137116 | 2020-05-10T15:57:06 | 2020-05-10T15:57:06 | 262,822,505 | 0 | 0 | null | 2020-05-10T15:57:08 | 2020-05-10T15:55:29 | Java | UTF-8 | Java | false | false | 96 | java | /**
* View Models used by Spring MVC REST controllers.
*/
package com.jhtest.app.web.rest.vm;
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
19c1981ca4cd925e631ee5cd4d1118688d1c3dcd | 91f5b6b8c92426bd2e56bf60278049b6ce04e746 | /practice/src/main/java/com/pattren/headfirst/decorator1/LowercaseInputStream.java | 6848cbe1cba5f2122b555384adfae580d7c3a891 | [] | no_license | zhangz8/zhangz-projects | 5f13fddaaada68c2b889f608dbf4aa6415667383 | a571f88f47c34adb13b7a36d2a8e07e98c0b99b5 | refs/heads/master | 2021-01-25T06:30:42.232571 | 2018-09-25T06:00:40 | 2018-09-25T06:00:40 | 93,588,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package com.pattren.headfirst.decorator1;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
public class LowercaseInputStream extends FilterInputStream {
protected LowercaseInputStream(InputStream in) {
super(in);
}
public int read() throws IOException {
int c = in.read();
return (c == -1 ? c : Character.toLowerCase((char) c));
}
public int read(byte b[], int offset, int len) throws IOException {
int result = super.read(b, offset, len);
for (int i = offset; i < offset + result; i++) {
b[i] = (byte) Character.toLowerCase((char) b[i]);
}
return result;
}
}
| [
"zhangz8@yeah.net"
] | zhangz8@yeah.net |
d5263fe95948b37231a26cb1d65d2d93c7a1ab53 | 679f1a2a4e48fca5b1f8f332a20609a2ff82ff84 | /sourceanalysis/jeecg/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/jeewx2.3/org/apache/jsp/webpage/login/login_jsp.java | 342641fc2a14ed50dc9fe08b7e5cbb5c3adf3541 | [] | no_license | tangjiquan/projectsources | 6c75f17d0ccee742fc1c301c035f0bd90dcfe7a8 | c0a266953ef896816d98f3b9e62376e800448272 | refs/heads/master | 2021-01-21T04:48:27.485587 | 2016-06-04T07:28:10 | 2016-06-04T07:28:10 | 52,531,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,119 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.54
* Generated at: 2016-05-09 16:09:23 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.webpage.login;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("/WEB-INF/tld/easyui.tld", Long.valueOf(1462721646514L));
_jspx_dependants.put("/context/mytags.jsp", Long.valueOf(1462721497509L));
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
out.write('\n');
// c:set
org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_005fset_005f0 = (org.apache.taglibs.standard.tag.rt.core.SetTag) _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
_jspx_th_c_005fset_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fset_005f0.setParent(null);
// /context/mytags.jsp(9,0) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fset_005f0.setVar("webRoot");
// /context/mytags.jsp(9,0) name = value type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fset_005f0.setValue(basePath);
int _jspx_eval_c_005fset_005f0 = _jspx_th_c_005fset_005f0.doStartTag();
if (_jspx_th_c_005fset_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f0);
return;
}
_005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f0);
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("<title></title>\n");
out.write("<link rel=\"shortcut icon\" href=\"resources/fc/images/icon/favicon.ico\">\n");
out.write("<!--[if lt IE 9]>\n");
out.write(" <script src=\"plug-in/login/js/html5.js\"></script>\n");
out.write(" <![endif]-->\n");
out.write("<!--[if lt IE 7]>\n");
out.write(" <script src=\"plug-in/login/js/iepng.js\" type=\"text/javascript\"></script>\n");
out.write(" <script type=\"text/javascript\">\n");
out.write("\tEvPNG.fix('div, ul, img, li, input'); //EvPNG.fix('包含透明PNG图片的标签'); 多个标签之间用英文逗号隔开。\n");
out.write("</script>\n");
out.write(" <![endif]-->\n");
out.write("<link href=\"plug-in/login/css/zice.style.css\" rel=\"stylesheet\" type=\"text/css\" />\n");
out.write("<link href=\"plug-in/login/css/buttons.css\" rel=\"stylesheet\" type=\"text/css\" />\n");
out.write("<link href=\"plug-in/login/css/icon.css\" rel=\"stylesheet\" type=\"text/css\" />\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/login/css/tipsy.css\" media=\"all\" />\n");
out.write("<style type=\"text/css\">\n");
out.write("html {\n");
out.write("\tbackground-image: none;\n");
out.write("}\n");
out.write("\n");
out.write("label.iPhoneCheckLabelOn span {\n");
out.write("\tpadding-left: 0px\n");
out.write("}\n");
out.write("\n");
out.write("#versionBar {\n");
out.write("\tbackground-color: #212121;\n");
out.write("\tposition: fixed;\n");
out.write("\twidth: 100%;\n");
out.write("\theight: 35px;\n");
out.write("\tbottom: 0;\n");
out.write("\tleft: 0;\n");
out.write("\ttext-align: center;\n");
out.write("\tline-height: 35px;\n");
out.write("\tz-index: 11;\n");
out.write("\t-webkit-box-shadow: black 0px 10px 10px -10px inset;\n");
out.write("\t-moz-box-shadow: black 0px 10px 10px -10px inset;\n");
out.write("\tbox-shadow: black 0px 10px 10px -10px inset;\n");
out.write("}\n");
out.write("\n");
out.write(".copyright {\n");
out.write("\ttext-align: center;\n");
out.write("\tfont-size: 10px;\n");
out.write("\tcolor: #CCC;\n");
out.write("}\n");
out.write("\n");
out.write(".copyright a {\n");
out.write("\tcolor: #A31F1A;\n");
out.write("\ttext-decoration: none\n");
out.write("}\n");
out.write("\n");
out.write(".on_off_checkbox {\n");
out.write("\twidth: 0px;\n");
out.write("}\n");
out.write("\n");
out.write("#login .logo {\n");
out.write("\twidth: 500px;\n");
out.write("\theight: 51px;\n");
out.write("}\n");
out.write("</style>\n");
out.write("</head>\n");
out.write("<body>\n");
out.write(" <div id=\"alertMessage\"></div>\n");
out.write(" <div id=\"successLogin\"></div>\n");
out.write(" <div class=\"text_success\"><img src=\"plug-in/login/images/loader_green.gif\" alt=\"Please wait\" /> <span>登陆成功!请稍后....</span></div>\n");
out.write(" <div id=\"login\">\n");
out.write(" <div class=\"ribbon\" style=\"background-image: url(plug-in/login/images/typelogin.png);\"></div>\n");
out.write(" <div class=\"inner\">\n");
out.write(" <div class=\"logo\"><img src=\"plug-in/weixin/logo/logo_weixin.png\" /></div>\n");
out.write(" <div class=\"formLogin\">\n");
out.write(" <form name=\"formLogin\" id=\"formLogin\" action=\"loginController.do?login\" check=\"loginController.do?checkuser\" method=\"post\">\n");
out.write(" <input name=\"userKey\" type=\"hidden\" id=\"userKey\" value=\"D1B5CC2FE46C4CC983C073BCA897935608D926CD32992B5900\" />\n");
out.write(" <div class=\"tip\">\n");
out.write(" <input class=\"userName\" name=\"userName\" type=\"text\" id=\"userName\" title=\"用户名\" iscookie=\"true\" value=\"admin\" nullmsg=\"请输入用户名!\" />\n");
out.write(" </div>\n");
out.write(" <div class=\"tip\">\n");
out.write(" <input class=\"password\" name=\"password\" type=\"password\" id=\"password\" title=\"密码\" value=\"123456\" nullmsg=\"请输入密码!\" />\n");
out.write(" </div>\n");
out.write(" <div class=\"tip\">\n");
out.write(" <input class=\"randCode\" name=\"randCode\" type=\"text\" id=\"randCode\" title=\"\" value=\"\" nullmsg=\"请输入验证码!\" />\n");
out.write(" <div style=\"float: right; margin-left:-220px; margin-right: 25px;\">\n");
out.write(" <img id=\"randCodeImage\" src=\"randCodeImage\" />\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" ");
out.write("\n");
out.write(" <div class=\"loginButton\">\n");
out.write(" <div style=\"float: left; margin-left: -9px;\">\n");
out.write(" <input type=\"checkbox\" id=\"on_off\" name=\"remember\" checked=\"ture\" class=\"on_off_checkbox\" value=\"0\" />\n");
out.write(" <span class=\"f_help\">是否记住用户名 ?</span>\n");
out.write(" </div>\n");
out.write("\n");
out.write(" <div style=\"float: right; padding: 3px 0; margin-right: -12px;\">\n");
out.write(" <div>\n");
out.write(" <ul class=\"uibutton-group\">\n");
out.write(" <li><a class=\"uibutton normal\" href=\"#\" id=\"but_login\">登陆</a></li>\n");
out.write(" <li><a class=\"uibutton normal\" href=\"#\" id=\"forgetpass\">重置</a></li>\n");
out.write(" </ul>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" <div class=\"clear\"></div>\n");
out.write(" </div>\n");
out.write(" <div>\n");
out.write(" <div style=\"float: right; margin-left:-220px; margin-right: 40px;\">\n");
out.write(" \t 技术支持: <font color=\"red\">捷微Jeewx</font> QQ群: <font color=\"red\">289709451</font> 官网: <font color=\"red\"><a href=\"http://www.jeewx.com\" target=\"_blank\">www.jeewx.com</a></font> \n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </form>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" <div class=\"shadow\"></div>\n");
out.write(" </div>\n");
out.write(" <!--Login div-->\n");
out.write(" <div class=\"clear\"></div>\n");
out.write(" <div id=\"versionBar\">\n");
out.write(" <div class=\"copyright\">© 版权所有 <span class=\"tip\"><a href=\"http://www.jeewx.com\" title=\"Jeewx 捷微管家平台\" target=\"_blank\">JeeWx 捷微管家平台</a> (推荐使用IE8+,谷歌浏览器可以获得更快,更安全的页面响应速度) 技术支持: <a href=\"http://www.jeecg.org\" title=\"JEECG 开源社区\" target=\"_blank\">JEECG 开源社区</a></span></div>\n");
out.write(" </div>\n");
out.write(" <!-- Link JScript-->\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.min.js\"></script>\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/jquery/jquery.cookie.js\"></script>\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/login/js/jquery-jrumble.js\"></script>\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/login/js/jquery.tipsy.js\"></script>\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/login/js/iphone.check.js\"></script>\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/login/js/login.js\"></script>\n");
out.write(" <script type=\"text/javascript\" src=\"plug-in/lhgDialog/lhgdialog.min.js\"></script>\n");
out.write("</body>\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"2495527426@qq.com"
] | 2495527426@qq.com |
28e76145f0bcd8cdd83ff4a819376d04b91b1320 | 9eeab2c1ed0de454c97eadba2c13207a49a5bbb0 | /src/main/java/com/algaworks/cobranca/security/SecurityConfiguration.java | 069d19fecaf6d8dcd625873594fe2e529b96fc3a | [] | no_license | GlenerChimenes/cobranca | 7852ae8310ef9f74ff9321abc6f0ed27ad74d23e | 1e3ec2dbc09ff75b62feabf8512024f1bddc9160 | refs/heads/master | 2022-01-09T11:08:53.035612 | 2022-01-08T17:15:01 | 2022-01-08T17:15:01 | 221,337,467 | 0 | 0 | null | 2020-07-02T01:15:13 | 2019-11-13T00:18:10 | Java | UTF-8 | Java | false | false | 1,978 | java | package com.algaworks.cobranca.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@EnableWebSecurity
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private AutenticacaoService autenticacaoService;
//Configuração de autenticação
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(autenticacaoService).passwordEncoder(new BCryptPasswordEncoder());
}
//Configuraçao de autorização
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/css/**").permitAll()
.antMatchers("/fonts/**").permitAll()
.antMatchers("/imagem/**").permitAll()
.antMatchers("/js/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/loginUsuario").defaultSuccessUrl("/titulos/novo").permitAll()
.and()
.logout()
.logoutSuccessUrl("/loginUsuario?logout")
.permitAll()
.and()
.rememberMe()
.userDetailsService(autenticacaoService)
.and().csrf().disable()
;
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/**.html", "/v2/api-docs", "webjars/**", "/configuration/**", "/swagger-resourses/**");
}
}
| [
"glener.chimenes@gmail.com"
] | glener.chimenes@gmail.com |
62de8ba4d4d7eb0bf7796354c759a97ebdaa92a6 | 787faa8381d319c85ff2d7ad9c37ea1ede767ba3 | /src/test/java/AutoTest/OurFirstProject/RunnerClass.java | baf1c7dc27f0a8db483cf4a181ef70c4fd35f224 | [] | no_license | TiwaDoro/First_Repo | defd9d8141c7312d1ca254e78c99755cb5c5ddf5 | c7974a5f6fa2a49d8aa112c84ecb26fcf582e728 | refs/heads/master | 2021-01-20T15:41:40.811480 | 2017-05-09T21:06:58 | 2017-05-09T21:06:58 | 90,788,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package AutoTest.OurFirstProject;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = { "pretty", "html:target/cucumber",
"json:target/cucumber-report.json" },
features = {"./src/test/resource/"},
tags = {"~@wip","~@ninja_testers","@testcomplete"}
)
public class RunnerClass {
}
| [
"tiwa.moni001@gmail.com"
] | tiwa.moni001@gmail.com |
9b9f52cc21933d0556b86cfd49f1da2caf6de9c2 | a5436e97cdaeebba32198d767f586ad298c41bb8 | /src/org/fife/ui/rtextarea/RTextAreaBase.java | e934bdab46f403a55e60a3a3ac1c68a0e87f7db2 | [
"Apache-2.0"
] | permissive | mstrobel/Luyten | bad92f09df88fb556321b4f99da880a8d3c72578 | a39cd64a1b3a23efb1ddf514016e16ad0a5a4404 | refs/heads/master | 2021-01-24T01:34:57.466810 | 2013-07-15T02:28:04 | 2013-07-15T02:28:04 | 11,412,371 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 35,123 | java | /*
* 04/07/2005
*
* RTextAreaBase.java - The base class for an RTextArea.
*
* This library is distributed under a modified BSD license. See the included
* RSyntaxTextArea.License.txt file for details.
*/
package org.fife.ui.rtextarea;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JTextArea;
import javax.swing.event.CaretEvent;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.TextUI;
import javax.swing.text.AbstractDocument;
import javax.swing.text.BadLocationException;
import javax.swing.text.Caret;
import javax.swing.text.StyleContext;
/**
* This is the base class for <code>RTextArea</code>; basically it's just an
* extension of <code>javax.swing.JTextArea</code> adding a bunch of properties.
* <p>
*
* This class is only supposed to be overridden by <code>RTextArea</code>.
*
* @author Robert Futrell
* @version 0.8
*/
abstract class RTextAreaBase extends JTextArea {
public static final String BACKGROUND_IMAGE_PROPERTY = "background.image";
public static final String CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY = "RTA.currentLineHighlightColor";
public static final String CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY = "RTA.currentLineHighlightFade";
public static final String HIGHLIGHT_CURRENT_LINE_PROPERTY = "RTA.currentLineHighlight";
public static final String ROUNDED_SELECTION_PROPERTY = "RTA.roundedSelection";
private boolean tabsEmulatedWithSpaces; // If true, tabs will be expanded to spaces.
private boolean highlightCurrentLine; // If true, the current line is highlighted.
private Color currentLineColor; // The color used to highlight the current line.
private boolean marginLineEnabled; // If true, paint a "margin line."
private Color marginLineColor; // The color used to paint the margin line.
private int marginLineX; // The x-location of the margin line.
private int marginSizeInChars; // How many 'm' widths the margin line is over.
private boolean fadeCurrentLineHighlight; // "Fade effect" for current line highlight.
private boolean roundedSelectionEdges;
private int previousCaretY;
int currentCaretY; // Used to know when to rehighlight current line.
private BackgroundPainterStrategy backgroundPainter; // Paints the background.
private RTAMouseListener mouseListener;
private static final Color DEFAULT_CARET_COLOR = new ColorUIResource(255,51,51);
private static final Color DEFAULT_CURRENT_LINE_HIGHLIGHT_COLOR = new Color(255,255,170);
private static final Color DEFAULT_MARGIN_LINE_COLOR = new Color(255,224,224);
private static final int DEFAULT_TAB_SIZE = 4;
private static final int DEFAULT_MARGIN_LINE_POSITION = 80;
/**
* Constructor.
*/
public RTextAreaBase() {
init();
}
/**
* Constructor.
*
* @param doc The document for the editor.
*/
public RTextAreaBase(AbstractDocument doc) {
super(doc);
init();
}
/**
* Constructor.
*
* @param text The initial text to display.
*/
public RTextAreaBase(String text) {
super(text);
init();
}
/**
* Constructor.
*
* @param rows The number of rows to display.
* @param cols The number of columns to display.
* @throws IllegalArgumentException If either <code>rows</code> or
* <code>cols</code> is negative.
*/
public RTextAreaBase(int rows, int cols) {
super(rows, cols);
init();
}
/**
* Constructor.
*
* @param text The initial text to display.
* @param rows The number of rows to display.
* @param cols The number of columns to display.
* @throws IllegalArgumentException If either <code>rows</code> or
* <code>cols</code> is negative.
*/
public RTextAreaBase(String text, int rows, int cols) {
super(text, rows, cols);
init();
}
/**
* Constructor.
*
* @param doc The document for the editor.
* @param text The initial text to display.
* @param rows The number of rows to display.
* @param cols The number of columns to display.
* @throws IllegalArgumentException If either <code>rows</code> or
* <code>cols</code> is negative.
*/
public RTextAreaBase(AbstractDocument doc, String text, int rows,
int cols) {
super(doc, text, rows, cols);
init();
}
/**
* Adds listeners that listen for changes to the current line, so we can
* update our "current line highlight." This is needed only because of an
* apparent difference between the JRE 1.4.2 and 1.5.0 (needed on 1.4.2,
* not needed on 1.5.0).
*/
protected void addCurrentLineHighlightListeners() {
boolean add = true;
MouseMotionListener[] mouseMotionListeners = getMouseMotionListeners();
for (int i=0; i<mouseMotionListeners.length; i++) {
if (mouseMotionListeners[i]==mouseListener) {
add = false;
break;
}
}
if (add==true) {
//System.err.println("Adding mouse motion listener!");
addMouseMotionListener(mouseListener);
}
MouseListener[] mouseListeners = getMouseListeners();
for (int i=0; i<mouseListeners.length; i++) {
if (mouseListeners[i]==mouseListener) {
add = false;
break;
}
}
if (add==true) {
//System.err.println("Adding mouse listener!");
addMouseListener(mouseListener);
}
}
/*
* TODO: Figure out why RTextArea doesn't work with RTL orientation!
*/
// public void applyComponentOrientation(ComponentOrientation orientation) {
// super.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
// }
/**
* Converts all instances of a number of spaces equal to a tab size
* into a tab in this text area.
*
* @see #convertTabsToSpaces
* @see #getTabsEmulated
* @see #setTabsEmulated
*/
public void convertSpacesToTabs() {
// FIXME: This is inefficient and will yield an OutOfMemoryError if
// done on a large document. We should scan 1 line at a time and
// replace; it'll be slower but safer.
int caretPosition = getCaretPosition();
int tabSize = getTabSize();
String tabInSpaces = "";
for (int i=0; i<tabSize; i++)
tabInSpaces += " ";
String text = getText();
setText(text.replaceAll(tabInSpaces, "\t"));
int newDocumentLength = getDocument().getLength();
// Place the caret back in its proper position.
if (caretPosition<newDocumentLength)
setCaretPosition(caretPosition);
else
setCaretPosition(newDocumentLength-1);
}
/**
* Converts all instances of a tab into a number of spaces equivalent
* to a tab in this text area.
*
* @see #convertSpacesToTabs
* @see #getTabsEmulated
* @see #setTabsEmulated
*/
public void convertTabsToSpaces() {
// FIXME: This is inefficient and will yield an OutOfMemoryError if
// done on a large document. We should scan 1 line at a time and
// replace; it'll be slower but safer.
int caretPosition = getCaretPosition();
int tabSize = getTabSize();
StringBuffer tabInSpaces = new StringBuffer();
for (int i=0; i<tabSize; i++)
tabInSpaces.append(' ');
String text = getText();
setText(text.replaceAll("\t", tabInSpaces.toString()));
// Put caret back at same place in document.
setCaretPosition(caretPosition);
}
/**
* Returns the caret event/mouse listener for <code>RTextArea</code>s.
*
* @return The caret event/mouse listener.
*/
protected abstract RTAMouseListener createMouseListener();
/**
* Returns the a real UI to install on this text component. Subclasses
* can override this method to return an extended version of
* <code>RTextAreaUI</code>.
*
* @return The UI.
*/
protected abstract RTextAreaUI createRTextAreaUI();
/**
* Forces the current line highlight to be repainted. This hack is
* necessary for those situations when the view (appearance) changes
* but the caret's location hasn't (and thus the current line highlight
* coordinates won't get changed). Examples of this are when
* word wrap is toggled and when syntax styles are changed in an
* <code>RSyntaxTextArea</code>.
*/
protected void forceCurrentLineHighlightRepaint() {
// Check isShowing() to prevent BadLocationException
// in constructor if linewrap is set to true.
if (isShowing()) {
// Changing previousCaretY makes us sure to get a repaint.
previousCaretY = -1;
// Trick it into checking for the need to repaint by firing
// a false caret event.
fireCaretUpdate(mouseListener);
}
}
/**
* Returns the <code>java.awt.Color</code> used as the background color for
* this text area. If a <code>java.awt.Image</code> image is currently
* being used instead, <code>null</code> is returned.
*
* @return The current background color, or <code>null</code> if an image
* is currently the background.
*/
public final Color getBackground() {
Object bg = getBackgroundObject();
return (bg instanceof Color) ? (Color)bg : null;
}
/**
* Returns the image currently used for the background.
* If the current background is currently a <code>java.awt.Color</code> and
* not a <code>java.awt.Image</code>, then <code>null</code> is returned.
*
* @return A <code>java.awt.Image</code> used for the background, or
* <code>null</code> if the background is not an image.
* @see #setBackgroundImage
*/
public final Image getBackgroundImage() {
Object bg = getBackgroundObject();
return (bg instanceof Image) ? (Image)bg : null;
}
/**
* Returns the <code>Object</code> representing the background for all
* documents in this tabbed pane; either a <code>java.awt.Color</code> or a
* <code>java.lang.Image</code> containing the image used as the background
* for this text area.
*
* @return The <code>Object</code> used for the background.
* @see #setBackgroundObject(Object newBackground)
*/
public final Object getBackgroundObject() {
if (backgroundPainter==null)
return null;
return (backgroundPainter instanceof ImageBackgroundPainterStrategy) ?
(Object)((ImageBackgroundPainterStrategy)backgroundPainter).
getMasterImage() :
(Object)((ColorBackgroundPainterStrategy)backgroundPainter).
getColor();
}
/**
* Gets the line number that the caret is on.
*
* @return The zero-based line number that the caret is on.
*/
public final int getCaretLineNumber() {
try {
return getLineOfOffset(getCaretPosition());
} catch (BadLocationException ble) {
return 0; // Never happens
}
}
/**
* Gets the position from the beginning of the current line that the caret
* is on.
*
* @return The zero-based position from the beginning of the current line
* that the caret is on.
*/
public final int getCaretOffsetFromLineStart() {
try {
int pos = getCaretPosition();
return pos - getLineStartOffset(getLineOfOffset(pos));
} catch (BadLocationException ble) {
return 0; // Never happens
}
}
/**
* Returns the color being used to highlight the current line. Note that
* if highlighting the current line is turned off, you will not be seeing
* this highlight.
*
* @return The color being used to highlight the current line.
* @see #getHighlightCurrentLine()
* @see #setHighlightCurrentLine(boolean)
* @see #setCurrentLineHighlightColor
*/
public Color getCurrentLineHighlightColor() {
return currentLineColor;
}
/**
* Returns the default caret color.
*
* @return The default caret color.
*/
public static final Color getDefaultCaretColor() {
return DEFAULT_CARET_COLOR;
}
/**
* Returns the "default" color for highlighting the current line. Note
* that this color was chosen only because it looks nice (to me) against a
* white background.
*
* @return The default color for highlighting the current line.
*/
public static final Color getDefaultCurrentLineHighlightColor() {
return DEFAULT_CURRENT_LINE_HIGHLIGHT_COLOR;
}
/**
* Returns the default font for text areas.
*
* @return The default font.
*/
public static final Font getDefaultFont() {
// Use StyleContext to get a composite font for better Asian language
// support; see Sun bug S282887.
StyleContext sc = StyleContext.getDefaultStyleContext();
Font font = null;
if (isOSX()) {
// Snow Leopard (1.6) uses Menlo as default monospaced font,
// pre-Snow Leopard used Monaco.
font = sc.getFont("Menlo", Font.PLAIN, 12);
if (!"Menlo".equals(font.getFamily())) {
font = sc.getFont("Monaco", Font.PLAIN, 12);
if (!"Monaco".equals(font.getFamily())) { // Shouldn't happen
font = sc.getFont("Monospaced", Font.PLAIN, 13);
}
}
}
else {
// Consolas added in Vista, used by VS2010+.
font = sc.getFont("Consolas", Font.PLAIN, 13);
if (!"Consolas".equals(font.getFamily())) {
font = sc.getFont("Monospaced", Font.PLAIN, 13);
}
}
//System.out.println(font.getFamily() + ", " + font.getName());
return font;
}
/**
* Returns the default foreground color for text in this text area.
*
* @return The default foreground color.
*/
public static final Color getDefaultForeground() {
return Color.BLACK;
}
/**
* Returns the default color for the margin line.
*
* @return The default margin line color.
* @see #getMarginLineColor()
* @see #setMarginLineColor(Color)
*/
public static final Color getDefaultMarginLineColor() {
return DEFAULT_MARGIN_LINE_COLOR;
}
/**
* Returns the default margin line position.
*
* @return The default margin line position.
* @see #getMarginLinePosition
* @see #setMarginLinePosition
*/
public static final int getDefaultMarginLinePosition() {
return DEFAULT_MARGIN_LINE_POSITION;
}
/**
* Returns the default tab size, in spaces.
*
* @return The default tab size.
*/
public static final int getDefaultTabSize() {
return DEFAULT_TAB_SIZE;
}
/**
* Returns whether the current line highlight is faded.
*
* @return Whether the current line highlight is faded.
* @see #setFadeCurrentLineHighlight
*/
public boolean getFadeCurrentLineHighlight() {
return fadeCurrentLineHighlight;
}
/**
* Returns whether or not the current line is highlighted.
*
* @return Whether or the current line is highlighted.
* @see #setHighlightCurrentLine(boolean)
* @see #getCurrentLineHighlightColor
* @see #setCurrentLineHighlightColor
*/
public boolean getHighlightCurrentLine() {
return highlightCurrentLine;
}
/**
* Returns the offset of the last character of the line that the caret is
* on.
*
* @return The last offset of the line that the caret is currently on.
*/
public final int getLineEndOffsetOfCurrentLine() {
try {
return getLineEndOffset(getCaretLineNumber());
} catch (BadLocationException ble) {
return 0; // Never happens
}
}
/**
* Returns the height of a line of text in this text area.
*
* @return The height of a line of text.
*/
public int getLineHeight() {
return getRowHeight();
}
/**
* Returns the offset of the first character of the line that the caret is
* on.
*
* @return The first offset of the line that the caret is currently on.
*/
public final int getLineStartOffsetOfCurrentLine() {
try {
return getLineStartOffset(getCaretLineNumber());
} catch (BadLocationException ble) {
return 0; // Never happens
}
}
/**
* Returns the color used to paint the margin line.
*
* @return The margin line color.
* @see #setMarginLineColor(Color)
*/
public Color getMarginLineColor() {
return marginLineColor;
}
/**
* Returns the margin line position (in pixels) from the left-hand side of
* the text area.
*
* @return The margin line position.
* @see #getDefaultMarginLinePosition
* @see #setMarginLinePosition
*/
public int getMarginLinePixelLocation() {
return marginLineX;
}
/**
* Returns the margin line position (which is the number of 'm' widths in
* the current font the margin line is over).
*
* @return The margin line position.
* @see #getDefaultMarginLinePosition
* @see #setMarginLinePosition
*/
public int getMarginLinePosition() {
return marginSizeInChars;
}
/**
* Returns whether selection edges are rounded in this text area.
*
* @return Whether selection edges are rounded.
* @see #setRoundedSelectionEdges(boolean)
*/
public boolean getRoundedSelectionEdges() {
return roundedSelectionEdges;
}
/**
* Returns whether or not tabs are emulated with spaces (i.e., "soft"
* tabs).
*
* @return <code>true</code> if tabs are emulated with spaces;
* <code>false</code> if they aren't.
* @see #setTabsEmulated
*/
public boolean getTabsEmulated() {
return tabsEmulatedWithSpaces;
}
/**
* Initializes this text area.
*/
private void init() {
// Sets the UI. Note that setUI() is overridden in RTextArea to only
// update the popup menu; this method must be called to set the real
// UI. This is done because the look and feel of an RTextArea is
// independent of the installed Java look and feels.
setRTextAreaUI(createRTextAreaUI());
// So we get notified when the component is resized.
enableEvents(AWTEvent.COMPONENT_EVENT_MASK|AWTEvent.KEY_EVENT_MASK);
// Defaults for various properties.
setHighlightCurrentLine(true);
setCurrentLineHighlightColor(getDefaultCurrentLineHighlightColor());
setMarginLineEnabled(false);
setMarginLineColor(getDefaultMarginLineColor());
setMarginLinePosition(getDefaultMarginLinePosition());
setBackgroundObject(Color.WHITE);
setWrapStyleWord(true);// We only support wrapping at word boundaries.
setTabSize(5);
setForeground(Color.BLACK);
setTabsEmulated(false);
// Stuff needed by the caret listener below.
previousCaretY = currentCaretY = getInsets().top;
// Stuff to highlight the current line.
mouseListener = createMouseListener();
// Also acts as a focus listener so we can update our shared actions
// (cut, copy, etc. on the popup menu).
addFocusListener(mouseListener);
addCurrentLineHighlightListeners();
}
/**
* Returns whether or not the margin line is being painted.
*
* @return Whether or not the margin line is being painted.
* @see #setMarginLineEnabled
*/
public boolean isMarginLineEnabled() {
return marginLineEnabled;
}
/**
* Returns whether the OS we're running on is OS X.
*
* @return Whether the OS we're running on is OS X.
*/
public static boolean isOSX() {
// Recommended at:
// http://developer.apple.com/mac/library/technotes/tn2002/tn2110.html
String osName = System.getProperty("os.name").toLowerCase();
return osName.startsWith("mac os x");
}
/**
* Paints the text area.
*
* @param g The graphics context with which to paint.
*/
protected void paintComponent(Graphics g) {
//long startTime = System.currentTimeMillis();
backgroundPainter.paint(g, getVisibleRect());
// Paint the main part of the text area.
TextUI ui = getUI();
if (ui != null) {
// Not allowed to modify g, so make a copy.
Graphics scratchGraphics = g.create();
try {
ui.update(scratchGraphics, this);
} finally {
scratchGraphics.dispose();
}
}
//long endTime = System.currentTimeMillis();
//System.err.println(endTime-startTime);
}
/**
* Updates the current line highlight location.
*/
protected void possiblyUpdateCurrentLineHighlightLocation() {
int width = getWidth();
int lineHeight = getLineHeight();
int dot = getCaretPosition();
// If we're wrapping lines we need to check the actual y-coordinate
// of the caret, not just the line number, since a single logical
// line can span multiple physical lines.
if (getLineWrap()) {
try {
Rectangle temp = modelToView(dot);
if (temp!=null) {
currentCaretY = temp.y;
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Should never happen.
}
}
// No line wrap - we can simply check the line number (quicker).
else {
// Document doc = getDocument();
// if (doc!=null) {
// Element map = doc.getDefaultRootElement();
// int caretLine = map.getElementIndex(dot);
// Rectangle alloc = ((RTextAreaUI)getUI()).
// getVisibleEditorRect();
// if (alloc!=null)
// currentCaretY = alloc.y + caretLine*lineHeight;
// }
// Modified for code folding requirements
try {
Rectangle temp = modelToView(dot);
if (temp!=null) {
currentCaretY = temp.y;
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Should never happen.
}
}
// Repaint current line (to fill in entire highlight), and old line
// (to erase entire old highlight) if necessary. Always repaint
// current line in case selection is added or removed.
repaint(0,currentCaretY, width,lineHeight);
if (previousCaretY!=currentCaretY) {
repaint(0,previousCaretY, width,lineHeight);
}
previousCaretY = currentCaretY;
}
/**
* Overridden so we can tell when the text area is resized and update the
* current-line highlight, if necessary (i.e., if it is enabled and if
* lineWrap is enabled.
*
* @param e The component event about to be sent to all registered
* <code>ComponentListener</code>s.
*/
protected void processComponentEvent(ComponentEvent e) {
// In line wrap mode, resizing the text area means that the caret's
// "line" could change - not to a different logical line, but a
// different physical one. So, here we force a repaint of the current
// line's highlight if necessary.
if (e.getID()==ComponentEvent.COMPONENT_RESIZED &&
getLineWrap()==true && getHighlightCurrentLine()) {
previousCaretY = -1; // So we are sure to repaint.
fireCaretUpdate(mouseListener);
}
super.processComponentEvent(e);
}
/**
* Sets the background color of this text editor. Note that this is
* equivalent to calling <code>setBackgroundObject(bg)</code>.
*
* NOTE: the opaque property is set to <code>true</code> when the
* background is set to a color (by this method). When an image is used
* for the background, opaque is set to false. This is because
* we perform better when setOpaque is true, but if we use an
* image for the background when opaque is true, we get on-screen
* garbage when the user scrolls via the arrow keys. Thus we
* need setOpaque to be false in that case.<p>
* You never have to change the opaque property yourself; it is always done
* for you.
*
* @param bg The color to use as the background color.
*/
public void setBackground(Color bg) {
Object oldBG = getBackgroundObject();
if (oldBG instanceof Color) { // Just change color of strategy.
((ColorBackgroundPainterStrategy)backgroundPainter).
setColor(bg);
}
else { // Was an image painter...
backgroundPainter = new ColorBackgroundPainterStrategy(bg);
}
setOpaque(true);
firePropertyChange("background", oldBG, bg);
repaint();
}
/**
* Sets this image as the background image. This method fires a
* property change event of type {@link #BACKGROUND_IMAGE_PROPERTY}.<p>
*
* NOTE: the opaque property is set to <code>true</code> when the
* background is set to a color. When an image is used for the
* background (by this method), opaque is set to false. This is because
* we perform better when setOpaque is true, but if we use an
* image for the background when opaque is true, we get on-screen
* garbage when the user scrolls via the arrow keys. Thus we
* need setOpaque to be false in that case.<p>
* You never have to change the opaque property yourself; it is always done
* for you.
*
* @param image The image to use as this text area's background.
* @see #getBackgroundImage
*/
public void setBackgroundImage(Image image) {
Object oldBG = getBackgroundObject();
if (oldBG instanceof Image) { // Just change image being displayed.
((BufferedImageBackgroundPainterStrategy)backgroundPainter).
setImage(image);
}
else { // Was a color strategy...
BufferedImageBackgroundPainterStrategy strategy =
new BufferedImageBackgroundPainterStrategy(this);
strategy.setImage(image);
backgroundPainter = strategy;
}
setOpaque(false);
firePropertyChange(BACKGROUND_IMAGE_PROPERTY, oldBG, image);
repaint();
}
/**
* Makes the background into this <code>Object</code>.
*
* @param newBackground The <code>java.awt.Color</code> or
* <code>java.awt.Image</code> object. If <code>newBackground</code>
* is not either of these, the background is set to plain white.
*/
public void setBackgroundObject(Object newBackground) {
if (newBackground instanceof Color) {
setBackground((Color)newBackground);
}
else if (newBackground instanceof Image) {
setBackgroundImage((Image)newBackground);
}
else {
setBackground(Color.WHITE);
}
}
/*
* TODO: Figure out why RTextArea doesn't work with RTL (e.g. Arabic)
* and fix it!
*/
// public void setComponentOrientation(ComponentOrientation o) {
// if (!o.isLeftToRight()) {
// o = ComponentOrientation.LEFT_TO_RIGHT;
// }
// super.setComponentOrientation(o);
// }
/**
* Sets the color to use to highlight the current line. Note that if
* highlighting the current line is turned off, you will not be able to
* see this highlight. This method fires a property change of type
* {@link #CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY}.
*
* @param color The color to use to highlight the current line.
* @throws NullPointerException if <code>color</code> is <code>null</code>.
* @see #getHighlightCurrentLine()
* @see #setHighlightCurrentLine(boolean)
* @see #getCurrentLineHighlightColor
*/
public void setCurrentLineHighlightColor(Color color) {
if (color==null)
throw new NullPointerException();
if (!color.equals(currentLineColor)) {
Color old = currentLineColor;
currentLineColor = color;
firePropertyChange(CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY,
old, color);
}
}
/**
* Sets whether the current line highlight should have a "fade" effect.
* This method fires a property change event of type
* <code>CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY</code>.
*
* @param fade Whether the fade effect should be enabled.
* @see #getFadeCurrentLineHighlight
*/
public void setFadeCurrentLineHighlight(boolean fade) {
if (fade!=fadeCurrentLineHighlight) {
fadeCurrentLineHighlight = fade;
if (getHighlightCurrentLine())
forceCurrentLineHighlightRepaint();
firePropertyChange(CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY,
!fade, fade);
}
}
/**
* Sets the font for this text area. This is overridden only so that we
* can update the size of the "current line highlight" and the location of
* the "margin line," if necessary.
*
* @param font The font to use for this text component.
*/
public void setFont(Font font) {
super.setFont(font);
updateMarginLineX();
if (highlightCurrentLine)
possiblyUpdateCurrentLineHighlightLocation();
}
/**
* Sets whether or not the current line is highlighted. This method
* fires a property change of type {@link #HIGHLIGHT_CURRENT_LINE_PROPERTY}.
*
* @param highlight Whether or not to highlight the current line.
* @see #getHighlightCurrentLine()
* @see #getCurrentLineHighlightColor
* @see #setCurrentLineHighlightColor
*/
public void setHighlightCurrentLine(boolean highlight) {
if (highlight!=highlightCurrentLine) {
highlightCurrentLine = highlight;
firePropertyChange(HIGHLIGHT_CURRENT_LINE_PROPERTY,
!highlight, highlight);
repaint(); // Repaint entire width of line.
}
}
/**
* Sets whether or not word wrap is enabled. This is overridden so that
* the "current line highlight" gets updated if it needs to be.
*
* @param wrap Whether or not word wrap should be enabled.
*/
public void setLineWrap(boolean wrap) {
super.setLineWrap(wrap);
forceCurrentLineHighlightRepaint();
}
/**
* Sets the color used to paint the margin line.
*
* @param color The new margin line color.
* @see #getDefaultMarginLineColor()
* @see #getMarginLineColor()
*/
public void setMarginLineColor(Color color) {
marginLineColor = color;
if (marginLineEnabled) {
Rectangle visibleRect = getVisibleRect();
repaint(marginLineX,visibleRect.y, 1,visibleRect.height);
}
}
/**
* Enables or disables the margin line.
*
* @param enabled Whether or not the margin line should be enabled.
* @see #isMarginLineEnabled
*/
public void setMarginLineEnabled(boolean enabled) {
if (enabled!=marginLineEnabled) {
marginLineEnabled = enabled;
if (marginLineEnabled) {
Rectangle visibleRect = getVisibleRect();
repaint(marginLineX,visibleRect.y, 1,visibleRect.height);
}
}
}
/**
* Sets the number of 'm' widths the margin line is over.
*
* @param size The margin size.
* #see #getDefaultMarginLinePosition
* @see #getMarginLinePosition
*/
public void setMarginLinePosition(int size) {
marginSizeInChars = size;
if (marginLineEnabled) {
Rectangle visibleRect = getVisibleRect();
repaint(marginLineX,visibleRect.y, 1,visibleRect.height);
updateMarginLineX();
repaint(marginLineX,visibleRect.y, 1,visibleRect.height);
}
}
/**
* Sets whether the edges of selections are rounded in this text area.
* This method fires a property change of type
* {@link #ROUNDED_SELECTION_PROPERTY}.
*
* @param rounded Whether selection edges should be rounded.
* @see #getRoundedSelectionEdges()
*/
public void setRoundedSelectionEdges(boolean rounded) {
if (roundedSelectionEdges!=rounded) {
roundedSelectionEdges = rounded;
Caret c = getCaret();
if (c instanceof ConfigurableCaret) {
((ConfigurableCaret)c).setRoundedSelectionEdges(rounded);
if (c.getDot()!=c.getMark()) { // e.g., there's is a selection
repaint();
}
}
firePropertyChange(ROUNDED_SELECTION_PROPERTY, !rounded,
rounded);
}
}
/**
* Sets the UI for this <code>RTextArea</code>. Note that, for instances
* of <code>RTextArea</code>, <code>setUI</code> only updates the popup
* menu; this is because <code>RTextArea</code>s' look and feels are
* independent of the Java Look and Feel. This method is here so
* subclasses can set a UI (subclass of <code>RTextAreaUI</code>) if they
* have to.
*
* @param ui The new UI.
* @see #setUI
*/
protected void setRTextAreaUI(RTextAreaUI ui) {
super.setUI(ui);
// Workaround as setUI makes the text area opaque, even if we don't
// want it to be.
setOpaque(getBackgroundObject() instanceof Color);
}
/**
* Changes whether or not tabs should be emulated with spaces (i.e., soft
* tabs). Note that this affects all tabs inserted AFTER this call, not
* tabs already in the document. For that, see
* {@link #convertTabsToSpaces} and {@link #convertSpacesToTabs}.
*
* @param areEmulated Whether or not tabs should be emulated with spaces.
* @see #convertSpacesToTabs
* @see #convertTabsToSpaces
* @see #getTabsEmulated
*/
public void setTabsEmulated(boolean areEmulated) {
tabsEmulatedWithSpaces = areEmulated;
}
/**
* Workaround, since in JDK1.4 it appears that <code>setTabSize()</code>
* doesn't work for a <code>JTextArea</code> unless you use the constructor
* specifying the number of rows and columns...<p>
* Sets the number of characters to expand tabs to. This will be multiplied
* by the maximum advance for variable width fonts. A PropertyChange event
* ("tabSize") is fired when the tab size changes.
*
* @param size Number of characters to expand to.
*/
public void setTabSize(int size) {
super.setTabSize(size);
boolean b = getLineWrap();
setLineWrap(!b);
setLineWrap(b);
}
/**
* This is here so subclasses such as <code>RSyntaxTextArea</code> that
* have multiple fonts can define exactly what it means, for example, for
* the margin line to be "80 characters" over.
*/
protected void updateMarginLineX() {
marginLineX = getFontMetrics(getFont()).charWidth('m') *
marginSizeInChars;
}
/**
* Returns the y-coordinate of the specified line.
*
* @param line The line number.
* @return The y-coordinate of the top of the line, or <code>-1</code> if
* this text area doesn't yet have a positive size or the line is
* hidden (i.e. from folding).
* @throws BadLocationException If <code>line</code> isn't a valid line
* number for this document.
*/
public int yForLine(int line) throws BadLocationException {
return ((RTextAreaUI)getUI()).yForLine(line);
}
/**
* Returns the y-coordinate of the line containing an offset.
*
* @param offs The offset info the document.
* @return The y-coordinate of the top of the offset, or <code>-1</code> if
* this text area doesn't yet have a positive size or the line is
* hidden (i.e. from folding).
* @throws BadLocationException If <code>offs</code> isn't a valid offset
* into the document.
*/
public int yForLineContaining(int offs) throws BadLocationException {
return ((RTextAreaUI)getUI()).yForLineContaining(offs);
}
protected class RTAMouseListener extends CaretEvent implements
MouseListener, MouseMotionListener, FocusListener {
RTAMouseListener(RTextAreaBase textArea) {
super(textArea);
}
public void focusGained(FocusEvent e) {}
public void focusLost(FocusEvent e) {}
public void mouseDragged(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public int getDot() {
return dot;
}
public int getMark() {
return mark;
}
protected int dot;
protected int mark;
}
} | [
"josh@modcrafting.com"
] | josh@modcrafting.com |
0fc5bd90577a70464083c022f5bf73ffe97530f2 | 0e9001f5bd4f8ddb7d736375854631fcc263b70d | /src/main/java/org/helianto/install/service/DefaultCountryInstaller.java | cd6f79e42a2dce635da59a9265990188219e8d63 | [
"Apache-2.0"
] | permissive | iservport/helianto-seed | 9b4389387fff4ae90f61b4c5544d85f8b11a733b | 48051c80391a83a884fd078d8b0868d4c8348baf | refs/heads/master | 2020-05-28T05:01:36.341390 | 2016-02-15T17:00:45 | 2016-02-15T17:00:45 | 38,646,488 | 0 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,979 | java | package org.helianto.install.service;
import java.util.List;
import javax.inject.Inject;
import org.helianto.core.domain.Country;
import org.helianto.core.domain.Operator;
import org.helianto.core.repository.CountryRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
/**
* Default country installer.
*
* @author mauriciofernandesdecastro
*/
@Service
public class DefaultCountryInstaller implements CountryInstaller {
private static final Logger logger = LoggerFactory.getLogger(DefaultCountryInstaller.class);
@Inject
private Environment env;
@Inject
private CountryParser countryParser;
@Inject
private CountryRepository countryRepository;
/**
* Default country.
*/
protected String getDefaultCountry() {
return "1058";
};
/**
* Install countries, return the root country.
*
* @param context
* @param contextDataPath
*/
public Country installCountries(Operator context) {
String contextDataPath = env.getProperty("helianto.contextDataPath", "/META-INF/data/");
String countryFile = env.getProperty("helianto.countryFile", DEFAULT_COUNTRY_FILE);
String defaultCountry = env.getProperty("helianto.defaultCountry", getDefaultCountry());
if (defaultCountry==null) {
return countryRepository.saveAndFlush(new Country(context, "_NO", "NO_COUNTRY"));
}
// All countries
Resource countryResource = new ClassPathResource(contextDataPath+countryFile);
List<Country> countries = countryParser.parseCountries(context, countryResource);
List<Country> managedCountries = countryRepository.save(countries);
logger.info("Saved {} countries.", managedCountries.size());
// Our country
Country country = countryRepository.findByOperatorAndCountryCode(context, defaultCountry);
return country;
}
}
| [
"mauricio@iservport.com"
] | mauricio@iservport.com |
4cb4a8e9069670179965169bac194535ddee6bb3 | 58046a11761071763ea6ca9b6dc249240afd68fe | /jopencl/javax/opencl/CLException.java | 89441fc14abc3d9f49dfdd01596b71487687bba9 | [] | no_license | dorry123/Endrov | 71be9c63ef30b5e36284745cc6baee1017901ee0 | c60571941bc14e4341fdb1351a48a55aca35b6a7 | refs/heads/master | 2021-01-21T02:46:46.357482 | 2013-10-16T09:17:53 | 2013-10-16T09:17:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,215 | java | package javax.opencl;
/**
* OpenCL Exception
* @author Johan Henriksson
*
*/
public class CLException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private final int ret;
private String msg;
public final static int CL_DEVICE_NOT_FOUND = -1;
public final static int CL_DEVICE_NOT_AVAILABLE = -2;
public final static int CL_DEVICE_COMPILER_NOT_AVAILABLE = -3;
public final static int CL_MEM_OBJECT_ALLOCATION_FAILURE = -4;
public final static int CL_OUT_OF_RESOURCES = -5;
public final static int CL_OUT_OF_HOST_MEMORY = -6;
public final static int CL_PROFILING_INFO_NOT_AVAILABLE = -7;
public final static int CL_MEM_COPY_OVERLAP = -8;
public final static int CL_IMAGE_FORMAT_MISMATCH = -9;
public final static int CL_IMAGE_FORMAT_NOT_SUPPORTED = -10;
public final static int CL_BUILD_PROGRAM_FAILURE = -11;
public final static int CL_MAP_FAILURE = -12;
public final static int CL_INVALID_VALUE = -30;
public final static int CL_INVALID_DEVICE_TYPE = -31;
public final static int CL_INVALID_PLATFORM = -32;
public final static int CL_INVALID_DEVICE = -33;
public final static int CL_INVALID_CONTEXT = -34;
public final static int CL_INVALID_QUEUE_PROPERTIES = -35;
public final static int CL_INVALID_COMMAND_QUEUE = -36;
public final static int CL_INVALID_HOST_PTR = -37;
public final static int CL_INVALID_MEM_OBJECT = -38;
public final static int CL_INVALID_IMAGE_FORMAT_DESCRIPTOR = -39;
public final static int CL_INVALID_IMAGE_SIZE = -40;
public final static int CL_INVALID_SAMPLER = -41;
public final static int CL_INVALID_BINARY = -42;
public final static int CL_INVALID_BUILD_OPTIONS = -43;
public final static int CL_INVALID_PROGRAM = -44;
public final static int CL_INVALID_PROGRAM_EXECUTABLE = -45;
public final static int CL_INVALID_KERNEL_NAME = -46;
public final static int CL_INVALID_KERNEL_DEFINITION = -47;
public final static int CL_INVALID_KERNEL = -48;
public final static int CL_INVALID_ARG_INDEX = -49;
public final static int CL_INVALID_ARG_VALUE = -50;
public final static int CL_INVALID_ARG_SIZE = -51;
public final static int CL_INVALID_KERNEL_ARGS = -52;
public final static int CL_INVALID_WORK_DIMENSION = -53;
public final static int CL_INVALID_WORK_GROUP_SIZE = -54;
public final static int CL_INVALID_WORK_ITEM_SIZE = -55;
public final static int CL_INVALID_GLOBAL_OFFSET = -56;
public final static int CL_INVALID_EVENT_WAIT_LIST = -57;
public final static int CL_INVALID_EVENT = -58;
public final static int CL_INVALID_OPERATION = -59;
public final static int CL_INVALID_GL_OBJECT = -60;
public final static int CL_INVALID_BUFFER_SIZE = -61;
public final static int CL_INVALID_MIP_LEVEL = -62;
public CLException(int ret)
{
this.ret=ret;
this.msg="";
}
public CLException(String msg)
{
this.ret=666;
}
public int getCode()
{
return ret;
}
public String toString()
{
return "OpenCL error ("+ret+", "+getString()+")";
}
public String getString()
{
switch(ret)
{
case CL_INVALID_VALUE:
return "invalid value";
case CL_INVALID_DEVICE_TYPE:
return "invalid device type";
case CL_INVALID_PLATFORM:
return "invalid platform";
case CL_INVALID_DEVICE:
return "invalid device";
case CL_INVALID_CONTEXT:
return "invalid context";
case CL_INVALID_QUEUE_PROPERTIES:
return "invalid queue properties";
case CL_INVALID_COMMAND_QUEUE:
return "invalid command queue";
case CL_INVALID_HOST_PTR:
return "invalid host pointer";
case CL_INVALID_MEM_OBJECT:
return "invalid mem object";
case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR:
return "invalid image format descriptor";
case CL_INVALID_IMAGE_SIZE:
return "invalid image size";
case CL_INVALID_SAMPLER:
return "invalid sampler";
case CL_INVALID_BINARY:
return "invalid binary";
case CL_INVALID_BUILD_OPTIONS:
return "invalid build options";
case CL_INVALID_PROGRAM:
return "invalid program";
case CL_INVALID_PROGRAM_EXECUTABLE:
return "invalid program executable";
case CL_INVALID_KERNEL_NAME:
return "invalid kernel name";
case CL_INVALID_KERNEL_DEFINITION:
return "invalid kernel definition";
case CL_INVALID_KERNEL:
return "invalid kernel";
case CL_INVALID_ARG_INDEX:
return "invalid argument index";
case CL_INVALID_ARG_VALUE:
return "invalid argument value";
case CL_INVALID_ARG_SIZE:
return "invalid argument size";
case CL_INVALID_KERNEL_ARGS:
return "invalid kernel arguments";
case CL_INVALID_WORK_DIMENSION:
return "invalid work dimension";
case CL_INVALID_WORK_GROUP_SIZE:
return "invalid work group size";
case CL_INVALID_WORK_ITEM_SIZE:
return "invalid work item size";
case CL_INVALID_GLOBAL_OFFSET:
return "invalid global offset";
case CL_INVALID_EVENT_WAIT_LIST:
return "invalid event wait list";
case CL_INVALID_EVENT:
return "invalid event";
case CL_INVALID_OPERATION:
return "invalid operation";
case CL_INVALID_GL_OBJECT:
return "invalid gl object";
case CL_INVALID_BUFFER_SIZE:
return "invalid buffer size";
case CL_INVALID_MIP_LEVEL:
return "invalid MIP level";
case CL_MEM_OBJECT_ALLOCATION_FAILURE:
return "memory object allocation failure";
case CL_OUT_OF_RESOURCES:
return "out of resources";
case CL_OUT_OF_HOST_MEMORY:
return "out of host memory";
case CL_PROFILING_INFO_NOT_AVAILABLE:
return "profiling information not available";
case CL_MEM_COPY_OVERLAP:
return "memory copy overlap";
case CL_IMAGE_FORMAT_MISMATCH:
return "image format mismatch";
case CL_IMAGE_FORMAT_NOT_SUPPORTED:
return "image format not supported";
case CL_BUILD_PROGRAM_FAILURE:
return "build program failure";
case CL_MAP_FAILURE:
return "map failure";
case CL_DEVICE_NOT_FOUND:
return "device not found";
case CL_DEVICE_NOT_AVAILABLE:
return "device not available";
case CL_DEVICE_COMPILER_NOT_AVAILABLE:
return "device compiler not available";
}
return msg;
}
}
| [
"mahogny@areta.org"
] | mahogny@areta.org |
673bdc1de57aa4da44c7775d339da2bc194adfa3 | d487a4e5451d202a902c0b7b2cbe517ebf692465 | /lab4/src/StringMeasurement.java | ec4f35569d3f21d7c4bc053bb764494e89395961 | [] | no_license | SoooSeriooous/YAJL | 0158d646692c3b23069a0d3a5dc1418433503b70 | 66f9719a9128519d251f99c82d434cdca6408ed4 | refs/heads/master | 2020-03-26T03:49:45.796120 | 2018-08-14T10:10:11 | 2018-08-14T10:10:11 | 144,473,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | public class StringMeasurement implements Measurement {
@Override
public void run() {
String mtString = "Measure " + "Time";
}
}
| [
"ProninValentin@gmail.com"
] | ProninValentin@gmail.com |
a867e4256c59c2290c5b02735be973117fb23492 | 8c44f8358b60c52a2722948a59dacb1d912ca006 | /app/src/main/java/com/lori/ui/fragment/WeekFragment.java | 05378bb77db5650d4df8dbfb39cf538a1f9a64da | [
"Apache-2.0"
] | permissive | Ubhadiyap/lori-timesheets-android | 48aee73c3022f20d90594ae6ce867119e62803e9 | 91c771c68f1263d163e2e0848bf5f026a6e6126c | refs/heads/master | 2021-01-11T17:27:15.675380 | 2017-01-02T16:51:35 | 2017-01-02T16:51:35 | 79,770,349 | 1 | 0 | null | 2017-01-23T04:33:50 | 2017-01-23T04:33:50 | null | UTF-8 | Java | false | false | 3,878 | java | package com.lori.ui.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.lori.R;
import com.lori.ui.base.BaseFragment;
import com.lori.ui.presenter.WeekFragmentPresenter;
import nucleus.factory.RequiresPresenter;
import java.util.Calendar;
/**
* @author artemik
*/
@RequiresPresenter(WeekFragmentPresenter.class)
public class WeekFragment extends BaseFragment<WeekFragmentPresenter> {
private static final String MONDAY_DATE_KEY = "MONDAY_DATE_KEY";
private Calendar mondayDate;
private boolean menuVisible;
public WeekFragment() {
}
public static WeekFragment newInstance(Calendar mondayDate) {
Bundle bundle = new Bundle(1);
bundle.putSerializable(MONDAY_DATE_KEY, mondayDate);
WeekFragment fragment = new WeekFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mondayDate = (Calendar) getArguments().getSerializable(MONDAY_DATE_KEY);
getPresenter().setMondayDate(mondayDate);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
return inflater.inflate(R.layout.fragment_week, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
FragmentTransaction tx = getChildFragmentManager().beginTransaction();
tx.add(R.id.fragmentMonday, createDayFragment(0, mondayDate)); // 0 - day of week.
tx.add(R.id.fragmentTuesday, createDayFragment(1, mondayDate));
tx.add(R.id.fragmentWednesday, createDayFragment(2, mondayDate));
tx.add(R.id.fragmentThursday, createDayFragment(3, mondayDate));
tx.add(R.id.fragmentFriday, createDayFragment(4, mondayDate));
tx.add(R.id.fragmentSaturday, createDayFragment(5, mondayDate));
tx.add(R.id.fragmentSunday, createDayFragment(6, mondayDate));
tx.add(R.id.fragmentWeekTotal, createWeekTotalFragment(mondayDate));
tx.commit();
}
/**
* Sets if the fragment is visible to the user.
* This method may be called BEFORE the fragment's onCreate() is invoked, so presenter may be not constructed at the
* time, therefore:
* - if that's the case, the value is saved only to be used later from onResume();
* - otherwise it's called after activity's become resumed, which means onResume() won't be called, so the value is
* propagated to the presenter at once.
*
* Such behavior guarantees the presenter is notified about fragments visibility when the fragment being resumed.
*/
@Override
public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible);
this.menuVisible = menuVisible;
if (isResumed()) {
getPresenter().onFragmentVisibilityToUserChanged(this.menuVisible);
}
}
@Override
public void onResume() {
super.onResume();
getPresenter().onFragmentVisibilityToUserChanged(menuVisible);
}
private DayFragment createDayFragment(int dayOfWeekOffset, Calendar mondayDate) {
Calendar weekDayDate = (Calendar) mondayDate.clone();
weekDayDate.add(Calendar.DAY_OF_WEEK, dayOfWeekOffset);
return DayFragment.newInstance(weekDayDate);
}
private WeekTotalFragment createWeekTotalFragment(Calendar mondayDate) {
return WeekTotalFragment.newInstance(mondayDate);
}
}
| [
"temanovikov@gmail.com"
] | temanovikov@gmail.com |
deeac7cc8201a4ce3ad4870bd676f83d6149a7fb | ef98baa5291cebd027dde0f4bbd69533d811d1ee | /src/com/bn/tu/TouchListener.java | 608769663295787ad68ecfccc47de9bfe2c5dd07 | [] | no_license | gaoxu1994/AndroidTouchUtil | 3f3858cf4368f3ffb58078f0a154ad88c9a75281 | 490cffdab37f8fd0290a56abe1d6c61ce765775e | refs/heads/master | 2021-01-22T05:54:36.394402 | 2017-02-12T11:54:51 | 2017-02-12T11:54:51 | 81,716,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 194 | java | package com.bn.tu;
public abstract class TouchListener
{
EventType et;
public TouchListener(EventType et)
{
this.et=et;
}
public abstract void eventOccurrence(float[] eventData);
}
| [
"502043392@qq.com"
] | 502043392@qq.com |
67d554067d4e7ba298d51ec3d7815b964b3c36b1 | 68d1254931caebf7b6d81a353a93234dc30bc628 | /aoc11/src/Task1.java | f60ad1021873bf7b8c99d9bb70ad5f7826c007db | [] | no_license | RobbeDP/aoc-2020 | 2bf43fec66fc1f02a5cb72d6e9badd27fc375e75 | b7c8f3a01d35eaa56b1b68acc61e841f1cb07457 | refs/heads/main | 2023-02-01T21:44:11.223362 | 2020-12-18T18:24:09 | 2020-12-18T18:24:09 | 317,510,616 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | import java.util.ArrayList;
import java.util.List;
public class Task1 {
public int countSeats(List<List<Character>> seats) {
List<List<Character>> seatsCopy = new ArrayList<>();
for (List<Character> row: seats) {
seatsCopy.add(new ArrayList<>(row));
}
boolean changed = true;
while (changed) {
changed = false;
for (int i = 0; i < seats.size(); i++) {
for (int j = 0; j < seats.get(i).size(); j++) {
char seat = seats.get(i).get(j);
if (seat == 'L') {
if (countAdjacent(seats, i, j) == 0) {
seatsCopy.get(i).set(j, '#');
changed = true;
}
} else if (seat == '#') {
if (countAdjacent(seats, i, j) >= 4) {
seatsCopy.get(i).set(j, 'L');
changed = true;
}
}
}
}
seats = seatsCopy;
seatsCopy = new ArrayList<>();
for (List<Character> row: seats) {
seatsCopy.add(new ArrayList<>(row));
}
}
return countOccupied(seats);
}
public int countAdjacent(List<List<Character>> seats, int row, int col) {
int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int count = 0;
for (int[] dir: dirs) {
int adjRow = row + dir[0];
int adjCol = col + dir[1];
if (adjRow >= 0 && adjRow < seats.size() && adjCol >= 0 && adjCol < seats.get(row).size()) {
if (seats.get(adjRow).get(adjCol) == '#') count++;
}
}
return count;
}
public int countOccupied(List<List<Character>> seats) {
int count = 0;
for (List<Character> row : seats) {
for (Character seat : row) {
if (seat == '#') count++;
}
}
return count;
}
}
| [
"rdeproft12@gmail.com"
] | rdeproft12@gmail.com |
dc96ac012976807202941aab7c71d6e2e0ee0ccb | b384b2240ef5f9ba0526d4cb71785ecd9eff27e0 | /CacheMemory_구현/Storage.java | 46e432ab712fd27b1e48920be84866f78b155415 | [] | no_license | AYoungSn/Computer_Architecture | ff8624967d9d8b134a6e175f2fc7afd66548c8eb | 5fdc8434e5899c52e2874a73ef4edb910d7aca79 | refs/heads/master | 2020-12-07T12:05:14.815020 | 2020-01-11T14:15:53 | 2020-01-11T14:15:53 | 232,718,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,046 | java | import java.util.StringJoiner;
/*과정 출력을 위한 클래스*/
public abstract class Storage {
//ram과 Cache의 부모클래스
int rear;//자료구조 선입선출, 원형큐 자료구조를 응용
/* 데이터가 들어올때마다 현재 rear 위치 +한칸 위치에 데이터가 삽입,
rear+1을 MAX로 나눈 나머지 값을 데이터 삽입위치의 인덱스로 사용하면
가장 오래된 위치의 데이터부터 새로운 데이터로 갱신됨
(데이터를 삭제하지 않으므로 dequeue를 위한 변수가 필요하지 않음)*/
final int MAX;//메모리 종류마다 메모리의 사이즈가 다르므로 배열크기를 지정하기 위한 변수
static float time = 0;//정적변수로 storage를 상속받는 모든 클래스들이 공유하는 변수이다.
Storage(int max) {
MAX = max;
rear = -1;
}
abstract void enqueue(int data);//데이터를 삽입하기위한 추상메서드
abstract int search(int key);//자신이 가진 배열에서 데이터를 찾아 index or data를 반환하는 메서드
abstract void print(int i);// 특정시점에 저장된 index = i인 곳의 data를 출력하기위한 메서드
}
class Cache extends Storage {
//Cache 메모리를 위한 클래스
int[] level;//Cache 메모리를 저장하기위한 배열변수
static int hit=0;//캐시 히트율을 계산하기 위한 정적 변수
int cnt=0;//L1만을 위한 변수
public Cache(int max) {
super(max);// 매개변수로 주어진 max값을 부모생성자에서 상수인 MAX 의 초기값으로 초기화
level = new int[MAX];//각 인스턴스의 메모리크기(배열크기)를 초기화된 MAX값으로 지정
}
int search(int key) {// key 값 위치의 index를 반환
time += 0.1;//캐시 접근시간은 L1, L2, L3 모두 0.1초로 동일
for (int i = 0; i < MAX; i++)//for - 배열 0번째 인덱스부터 끝까지
if (level[i] == key) {
// 배열에서 i번째에 있는 값을 key 값과 비교
hit++;//캐시에 원하는 데이터가 존재하면 hit증가(cache hit)
status("Hit");//Cache Hit 상태를 출력하기 위한 메서드 호출
print(i);//캐시 내용을 출력
return i;// key값과 일치하면 현위치 index를 반환, 아니면 i를 증가하여 반복문 실행
}
status("Miss");//Cache Miss 상태를 출력할 메서드 호출
return -1;// key값과 일치하는 값을 찾지 못한 경우 -1을 반환
}
void enqueue(int data) {// 캐시에 data를 삽입하기 위한 메서드
rear = (rear + 1) % MAX;// rear 위치를 다음 칸으로 이동
level[rear] = data;// 증가된 위치에 data를 삽입
print(rear);//data가 저장된 rear 위치와 캐시 내용을 출력
}
public void print(int i){
// 캐시 level에 특정시점에 저장된 데이터를 출력
System.out.println(this+"\n index "+i+": "+level[i]);//배열의 i번째 위치에 저장된 데이터
//배열에 0~10까지 저장된 데이터를 전부 출력
StringJoiner sj=new StringJoiner(", ","[","]");
//추가되는 값을 , 로 구분하고 시작과 끝은 [, ]로 나타냄
try{
for(int j=0;j<10;j++)
sj.add(Integer.toString(level[j]));//배열에서 0~10위치의 값들을 한 객체에 담아서 출력
System.out.println(" "+sj);
Thread.sleep(3000);// 실행중인 스레드를 일정시간 멈추도록 하는 sleep 메서드
}catch(InterruptedException e){ }
}
void status(String sta){
try {
System.out.println(this);//toString 출력, 객체에 대한 정보를 출력
System.out.println(" status: Cache " + sta);//Hit/Miss 상태 출력
Thread.sleep(2000);// 실행중인 스레드를 일정시간 멈추도록 하는 sleep 메서드
}catch(InterruptedException e){ }
}
@Override
public String toString() {
return "[ L" + (MAX == 5 ? "1" : (MAX == 20 ? "2" : "3")) +
" Cache ]";// MAX가 5이면 L1 Cache, 20이면 L2, 200이면 L3
}
}
class Ram extends Storage {
// RAM과 HDD는 종류가 하나이고 크기가 정해져있으므로 정해진 값으로 초기화
int[] ram;
private int[] hdd;// 외부에서 임의로 값을 수정하지 못하도록 설정
public Ram() {
super(500);
ram = new int[MAX];
hdd = new int[5000];
for (int i = 1; i <= 5000; i++)// HDD 배열에 1~5000값 저장
hdd[i - 1] = i;
}
int search(int key) {// Ram에서 주어진 key 값을 찾아서 반환
time += 1;//Ram 접근시간 1초
for (int i = 0; i < MAX; i++)
if (ram[i] == key) {
status("Exist");//ram에서 data를 찾으면 있다고 출력
print(i);//ram의 내용을 index 0~9까지 출력
return ram[i];
}
status("None");//ram에서 data를 찾지 못한 경우 없다고 출력
// Ram 에서 key 값을 찾지 못한 경우 HDD 에서 값을 찾기
System.out.println("[ HDD Access ]");
time += 3;//HDD 접근시간 3초
for (int i = 0; i < 5000; i++)
if (hdd[i] == key) {
// 하드디스크에서 찾은 key 값을 ram 에 저장 후 break 문으로 반복문 종료
enqueue(hdd[i]);
break;
}
try{
Thread.sleep(2000);// 실행중인 스레드를 일정시간 멈추도록 하는 sleep 메서드
}catch(InterruptedException e){ }
return ram[rear];// Ram 에서 가장 최근에 삽입된 위치의 값을 반환
}
void status(String sta){
System.out.println(this);//객체 정보 출력
System.out.println(" status: "+sta);//현재 ram에 찾는 data가 있는지 없는지 나타냄
}
void enqueue(int data) {
// Ram 에 data 를 삽입하기 위한 메서드
// Hdd 에는 1 ~ 5000 값을 저장해두고 사용하기 위한 배열변수로
// 생성자에서 배열을 초기화한 후 값의 변경이 일어나지 않는다.
// (hdd 배열에서는 값을 삽입하는 경우가 존재하지 않으므로 hdd 에 대한 enqueue 는 고려하지 않는다.)
rear = (rear + 1) % MAX;// rear 위치를 다음 칸으로 이동
ram[rear] = data;// 증가된 rear 가 가리키는 Ram 위치에 data 를 삽입
print(rear);//저장된 위치와 data를 출력
}
public void print(int i){
System.out.println(this+"\n index "+i+": "+ram[i]);
try{
Thread.sleep(2000);// 실행중인 스레드를 일정시간 멈추도록 하는 sleep 메서드
}catch(InterruptedException e){}
}
@Override
public String toString() {
return "[ Ram ]";
}
} | [
"dudtjs0920@naver.com"
] | dudtjs0920@naver.com |
c7f5f323c58b451bce3f4ef1658b45975f32e369 | 27e9de47f27d328188c9f57aae2bcd9d5be4ae03 | /src/test/java/com/github/cc3002/citricjuice/controller/ControllerTest.java | 968d3b77cd09aaae0797dee6a3995566126f8b70 | [
"Apache-2.0"
] | permissive | yaidor/99-7-citric-liquid-yaidor | 28c548bb98f4a20c04c76e255041158e0b24347c | c405f830c876151fe8f6bb59717c900c6f9c78c6 | refs/heads/master | 2022-11-24T21:56:31.387021 | 2020-07-26T00:21:41 | 2020-07-26T00:21:41 | 256,354,047 | 0 | 0 | Apache-2.0 | 2022-03-17T22:07:35 | 2020-04-16T23:36:50 | Java | UTF-8 | Java | false | false | 13,289 | java | package com.github.cc3002.citricjuice.controller;
import com.github.cc3002.citricjuice.model.NormaGoal;
import com.github.cc3002.citricjuice.model.board.*;
import com.github.cc3002.citricjuice.model.contenders.Boss;
import com.github.cc3002.citricjuice.model.contenders.Jugador;
import com.github.cc3002.citricjuice.model.contenders.Wild;
import com.github.cc3002.citricjuice.turn.PlayCard;
import org.intellij.lang.annotations.JdkConstants;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
public class ControllerTest {
private GameController gameController;
protected final static String JUGADOR = "Suguri";
protected final static String MALON = "Suguri";
protected final static String MALULO = "Suguri";
private DropPanel testDropPanel;
private BossPanel testBossPanel;
private BonusPanel testBonusPanel;
private HomePanel testHomePanel;
private Jugador suguri;
private Boss malote;
private Wild malito;
@BeforeEach
public void setUp(){
gameController = new GameController();
testHomePanel = new HomePanel(5);
testDropPanel = new DropPanel(3);
testBossPanel = new BossPanel(2);
testBonusPanel = new BonusPanel(1);
suguri = new Jugador(JUGADOR,4,1,-1,2);
malote = new Boss(MALON, 4, 1, -1,2);
malito = new Wild(MALULO, 4, 1, -1, 2);
}
@Test
public void constructorTest(){
assertEquals(0,gameController.totalPlayers.size());
assertEquals(0,gameController.totalPanels.size());
assertEquals(1,gameController.turno);
assertEquals(1,gameController.chapter);
assertEquals(true,gameController.turn.isStart());
}
@Test
public void createPanelsTest(){
List<IPanel> testPanels = new ArrayList<>();
testPanels.add(gameController.createBonusPanel(1));
testPanels.add(gameController.createBossPanel(2));
testPanels.add(gameController.createDropPanel(3));
testPanels.add(gameController.createEncounterPanel(4));
testPanels.add(gameController.createHomePanel(5));
testPanels.add(gameController.createNeutralPanel(6));
testPanels.add(gameController.createBonusPanel(7));
assertEquals(testPanels,gameController.totalPanels);
}
@Test
public void createPlayersTest(){
List<Jugador> jugadoresTest = new ArrayList<>();
jugadoresTest.add(gameController.createPlayer("hola",1,1,1,1,gameController.createBonusPanel(1)));
jugadoresTest.add(gameController.createPlayer("soy",1,1,1,1,gameController.createHomePanel(2)));
jugadoresTest.add(gameController.createPlayer("matias",1,1,1,1,gameController.createNeutralPanel(3)));
jugadoresTest.add(gameController.createPlayer("cansado",1,1,1,1,gameController.createEncounterPanel(4)));
assertEquals(jugadoresTest,gameController.totalPlayers);
Set<Jugador> prueba = new HashSet<>();
prueba.add(gameController.totalPlayers.get(0));
assertEquals(prueba,gameController.totalPanels.get(0).getOcupado());
Set<Jugador> prueba2 = new HashSet<>();
prueba2.add(gameController.totalPlayers.get(1));
assertEquals(prueba2,gameController.totalPanels.get(1).getOcupado());
}
@Test
public void createWildTest(){
Wild wildTest = new Wild("malito", 1, 1,1,1);
assertEquals(wildTest,gameController.createWildUnit("malito",1,1,1,1));
assertNotEquals(wildTest,gameController.createWildUnit("otroMalito",1,1,1,1));
}
@Test
public void createBossTest(){
Boss wildTest = new Boss("malote", 1, 1,1,1);
assertEquals(wildTest,gameController.createBossUnit("malote",1,1,1,1));
assertNotEquals(wildTest,gameController.createBossUnit("otroMalote",1,1,1,1));
}
@Test
public void setPlayereHomeTest(){
HomePanel prueba = new HomePanel(5);
Jugador jugador = new Jugador("Suguri",4,1,-1,2);
prueba.setOwner(jugador);
gameController.setPlayerHome(suguri,testHomePanel);
assertEquals(prueba.getOwner(),testHomePanel.getOwner());
}
@Test
public void getPanelsTest(){
List<IPanel> testPanels = new ArrayList<>();
testPanels.add(gameController.createBonusPanel(1));
testPanels.add(gameController.createBossPanel(2));
testPanels.add(gameController.createDropPanel(3));
testPanels.add(gameController.createEncounterPanel(4));
testPanels.add(gameController.createHomePanel(5));
testPanels.add(gameController.createNeutralPanel(1));
testPanels.add(gameController.createBonusPanel(1));
assertEquals(testPanels,gameController.getPanels());
}
@Test
public void getTurnOwnerTest(){
gameController.createPlayer("Suguri",4,1,-1,2,testHomePanel);
gameController.createPlayer("JUGADOR",4,1,-1,2,testDropPanel);
gameController.createPlayer("JUGADOR2",4,1,-1,2,testBossPanel);
gameController.createPlayer("JUGADOR3",4,1,-1,2,testBonusPanel);
assertEquals(suguri,gameController.getTurnOwner());
gameController.turno = gameController.turno + 1;
assertEquals("JUGADOR",gameController.getTurnOwner().getName());
gameController.turno = gameController.turno + 1;
assertEquals("JUGADOR2",gameController.getTurnOwner().getName());
gameController.turno = gameController.turno + 1;
assertEquals("JUGADOR3",gameController.getTurnOwner().getName());
gameController.turno = gameController.turno + 1;
assertEquals(suguri,gameController.getTurnOwner());
gameController.turno = gameController.turno + 1;
assertEquals(gameController.totalPlayers.get(1),gameController.getTurnOwner());
gameController.turno = gameController.turno + 1;
assertEquals(gameController.totalPlayers.get(2),gameController.getTurnOwner());
gameController.turno = gameController.turno + 1;
assertEquals(gameController.totalPlayers.get(3),gameController.getTurnOwner());
}
@Test
public void recoveryTest(){
gameController.createPlayer("Suguri",4,1,-1,2,testHomePanel);
Jugador jugador = gameController.getTurnOwner();
jugador.setCurrentHP(0);
gameController.recovery();
assertEquals(1,jugador.getRecovery());
assertEquals(0,jugador.getCurrentHP());
gameController.recovery();
assertEquals(2,jugador.getRecovery());
assertEquals(0,jugador.getCurrentHP());
jugador.setRecovery(7);
gameController.recovery();
assertEquals(0,jugador.getRecovery());
assertEquals(4,jugador.getCurrentHP());
}
@Test
public void drawCard(){
gameController.turn.notKO();
gameController.turn.playCard();
assertTrue(gameController.turn.isPlayCard());
assertFalse(gameController.turn.isMove());
gameController.drawCard();
assertFalse(gameController.turn.isPlayCard());
assertTrue(gameController.turn.isMove());
}
@Test
public void startTrunTest(){
gameController.createPlayer("Suguri",4,1,-1,2,testHomePanel);
Jugador jugador = gameController.getTurnOwner();
assertTrue(gameController.turn.isStart());
gameController.startTurn();
assertTrue(gameController.turn.isNotKO());
gameController.turn.playCard();
gameController.turn.move();
gameController.turn.stayPanel();
gameController.turn.end();
gameController.turn.start();
jugador.setCurrentHP(0);
gameController.startTurn();
assertTrue(gameController.turn.isIsKO());
}
@Test
public void endTurnTest(){
gameController.createPlayer("Suguri",4,1,-1,2,testHomePanel);
gameController.createPlayer("JUGADOR",4,1,-1,2,testDropPanel);
gameController.createPlayer("JUGADOR2",4,1,-1,2,testBossPanel);
gameController.createPlayer("JUGADOR3",4,1,-1,2,testBonusPanel);
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
gameController.turn.stayPanel();
gameController.turn.end();
assertEquals(1, gameController.turno);
assertEquals(1, gameController.chapter);
assertEquals(gameController.totalPlayers.get(0),gameController.getTurnOwner());
gameController.endTurn();
assertEquals(2,gameController.turno);
assertEquals(1,gameController.chapter);
assertEquals(gameController.totalPlayers.get(1),gameController.getTurnOwner());
assertTrue(gameController.turn.isStart());
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
gameController.turn.stayPanel();
gameController.turn.end();
gameController.endTurn();
assertEquals(3,gameController.turno);
assertEquals(1,gameController.chapter);
assertEquals(gameController.totalPlayers.get(2),gameController.getTurnOwner());
assertTrue(gameController.turn.isStart());
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
gameController.turn.stayPanel();
gameController.turn.end();
gameController.endTurn();
assertEquals(4,gameController.turno);
assertEquals(1,gameController.chapter);
assertEquals(gameController.totalPlayers.get(3),gameController.getTurnOwner());
assertTrue(gameController.turn.isStart());
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
gameController.turn.stayPanel();
gameController.turn.end();
gameController.endTurn();
assertEquals(5,gameController.turno);
assertEquals(2,gameController.chapter);
assertEquals(gameController.totalPlayers.get(0),gameController.getTurnOwner());
assertTrue(gameController.turn.isStart());
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
gameController.turn.stayPanel();
gameController.turn.end();
}
@Test
public void setNormaGoalTest(){
gameController.createPlayer("Suguri",4,1,-1,2,testHomePanel);
assertEquals(NormaGoal.STARS,gameController.totalPlayers.get(0).getNormaGoal());
gameController.setCurrPlayerNormaGoal(NormaGoal.WINS);
assertNotEquals(NormaGoal.STARS,gameController.totalPlayers.get(0).getNormaGoal());
assertEquals(NormaGoal.WINS,gameController.totalPlayers.get(0).getNormaGoal());
gameController.setCurrPlayerNormaGoal(NormaGoal.WINS);
assertNotEquals(NormaGoal.STARS,gameController.totalPlayers.get(0).getNormaGoal());
assertEquals(NormaGoal.WINS,gameController.totalPlayers.get(0).getNormaGoal());
gameController.setCurrPlayerNormaGoal(NormaGoal.STARS);
assertNotEquals(NormaGoal.WINS,gameController.totalPlayers.get(0).getNormaGoal());
assertEquals(NormaGoal.STARS,gameController.totalPlayers.get(0).getNormaGoal());
}
@Test
public void movePlayerTest(){
Set<Jugador> test = new HashSet<>();
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
gameController.createBonusPanel(1);
gameController.createPlayer("Suguri",4,1,-1,2,gameController.totalPanels.get(0));
test.add(gameController.totalPlayers.get(0));
test.add(suguri);
gameController.createBossPanel(2);
gameController.totalPanels.get(1).addPla2Pan(suguri);
gameController.createHomePanel(3);
HomePanel panel = (HomePanel) gameController.totalPanels.get(2);
gameController.setPlayerHome(gameController.getTurnOwner(),panel);
gameController.createDropPanel(4);
gameController.createEncounterPanel(5);
gameController.createNeutralPanel(6);
gameController.createNeutralPanel(7);
gameController.createNeutralPanel(8);
gameController.createNeutralPanel(9);
gameController.createNeutralPanel(10);
gameController.createNeutralPanel(11);
gameController.createNeutralPanel(12);
int j = 0;
for(int x=0; x<gameController.totalPanels.size(); x++){
if(x+1 == gameController.totalPanels.size()){
j = 0;
}
else{
j = x+1;
}
gameController.totalPanels.get(x).addNextPanel(gameController.totalPanels.get(j));
}
gameController.setNextPanel(gameController.totalPanels.get(3),gameController.totalPanels.get(9));
gameController.turn.notKO();
gameController.turn.playCard();
gameController.turn.move();
assertTrue(gameController.turn.isMove());
gameController.movePlayer();
assertTrue(gameController.turn.isWantFight());
assertEquals(gameController.totalPanels.get(1),gameController.getTurnOwner().getPanel());
assertEquals(test,gameController.getTurnOwner().getPanel().getOcupado());
assertEquals(0,gameController.totalPanels.get(0).getOcupado().size());
assertEquals(2,gameController.totalPanels.get(1).getOcupado().size());
gameController.turn.noFight();
assertTrue(gameController.turn.isMove());
gameController.movePlayer();
assertTrue(gameController.turn.isWantHome());
assertEquals(gameController.totalPanels.get(2),gameController.getTurnOwner().getPanel());
assertEquals(1,gameController.totalPanels.get(1).getOcupado().size());
gameController.turn.noHome();
assertTrue(gameController.turn.isMove());
gameController.movePlayer();
assertTrue(gameController.turn.isPath());
gameController.turn.backToTrack();
assertTrue(gameController.turn.isMove());
gameController.movePlayer();
assertFalse(gameController.turn.isMove());
assertFalse(gameController.turn.isPath());
assertFalse(gameController.turn.isWantHome());
assertFalse(gameController.turn.isWantFight());
assertTrue(gameController.turn.isStayPanel());
}
}
| [
"matias.venegas93@gmail.com"
] | matias.venegas93@gmail.com |
befcb7e5d9fb57660384c1917c8aff3030248548 | d3056d947e2fae711733569ced4ebeba977797d9 | /Climate Change Analysis/src/climatechange/IWeatherIO.java | 4f31ada6c39d9747e3fc3ff6b4daa31c87ca064e | [] | no_license | surabhigupta2029/Climate-Change-Analyzer | 3f212c8a5f0dca5293796cf08f55ee5f82312188 | 6da64a95e8b33f2b541b226c639eca15d91b4937 | refs/heads/master | 2023-02-10T00:26:42.741952 | 2020-12-23T21:08:00 | 2020-12-23T21:08:00 | 210,056,792 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,343 | java | package climatechange;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
interface IWeatherIO {
public ArrayList<ITemperature> readDataFromFile(String fileName) throws FileNotFoundException;
// read all data from the weather data file
public void writeSubjectHeaderInFile(String filename, String subject) throws FileNotFoundException, IOException;
// 1. write the subject header before dumping data returned from each ClimateAnalyzer method
// 2. a subject header is to be written for each ClimateAnalyzer method call
public void writeDataToFile(String filename, String topic, ArrayList<ITemperature> theWeatherList) throws FileNotFoundException, IOException;
// 1. file name should be called “taskXX_climate_info.csv” where XX will be replaced by the task id: A1, A2, etc
// 2. use this method to store the temperature info (for each Climate Analyzer task)
// a) one row for each temperature data object (i.e. all fields in one row (each comma delimited) )
// b) similar to the original input data file)s
// 3. temperature value should be formatted to use a maximum of 2 decimal places
// 4. temperature field should also show the Fahrenheit value (using decimal rules above)
// a) the temperature field should look like i.e. 21.34(C) 70.42(F)
} | [
"surabhi2029@gmail.com"
] | surabhi2029@gmail.com |
df7863f5f53819889dd7405554b0399faf882f55 | 1d5c3b08b684b850ab7b3a1995a2f919d8424264 | /app/src/main/java/com/kmnfsw/work/repair/entity/AppointPhoto.java | f556593ab2366428319db9275f3f9cea63966ea5 | [] | no_license | gzchenbing/EmployeeWork | 80c00d97325115f41d680453035177761b4eb417 | 293a4b45fdf65c573df827d39f8c2cb351c60171 | refs/heads/master | 2020-04-01T22:32:56.519168 | 2018-10-19T02:18:25 | 2018-10-19T02:18:25 | 153,714,281 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.kmnfsw.work.repair.entity;
import android.graphics.Bitmap;
public class AppointPhoto {
public String photo_path;
public Bitmap new_bitmap;
public AppointPhoto(String photo_path, Bitmap new_bitmap) {
super();
this.photo_path = photo_path;
this.new_bitmap = new_bitmap;
}
}
| [
"gzchenbing@qq.com"
] | gzchenbing@qq.com |
f043d77ae448a39de151b734f23f3ba77c3ad3cd | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/ca67c12de50a4f0f3891214d869f2d5f8b379915/before/NotDocSet.java | 7bf94277b2c6b3efb48b1f8efa29f72b7a2df06d | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,326 | java | /*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search 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.elasticsearch.common.lucene.docset;
import java.io.IOException;
/**
* @author kimchy (shay.banon)
*/
public class NotDocSet extends GetDocSet {
private final DocSet set;
public NotDocSet(DocSet set, int max) {
super(max);
this.set = set;
}
@Override public boolean isCacheable() {
return set.isCacheable();
}
@Override public boolean get(int doc) throws IOException {
return !set.get(doc);
}
// This seems like overhead compared to testing with get and iterating over docs
// @Override public DocIdSetIterator iterator() throws IOException {
// return new NotDocIdSetIterator();
// }
//
// class NotDocIdSetIterator extends DocIdSetIterator {
// int lastReturn = -1;
// private DocIdSetIterator it1 = null;
// private int innerDocid = -1;
//
// NotDocIdSetIterator() throws IOException {
// initialize();
// }
//
// private void initialize() throws IOException {
// it1 = set.iterator();
//
// if ((innerDocid = it1.nextDoc()) == DocIdSetIterator.NO_MORE_DOCS) it1 = null;
// }
//
// @Override
// public int docID() {
// return lastReturn;
// }
//
// @Override
// public int nextDoc() throws IOException {
// return advance(0);
// }
//
// @Override
// public int advance(int target) throws IOException {
//
// if (lastReturn == DocIdSetIterator.NO_MORE_DOCS) {
// return DocIdSetIterator.NO_MORE_DOCS;
// }
//
// if (target <= lastReturn) target = lastReturn + 1;
//
// if (it1 != null && innerDocid < target) {
// if ((innerDocid = it1.advance(target)) == DocIdSetIterator.NO_MORE_DOCS) {
// it1 = null;
// }
// }
//
// while (it1 != null && innerDocid == target) {
// target++;
// if (target >= max) {
// return (lastReturn = DocIdSetIterator.NO_MORE_DOCS);
// }
// if ((innerDocid = it1.advance(target)) == DocIdSetIterator.NO_MORE_DOCS) {
// it1 = null;
// }
// }
//
// // ADDED THIS, bug in code
// if (target >= max) {
// return (lastReturn = DocIdSetIterator.NO_MORE_DOCS);
// }
//
// return (lastReturn = target);
// }
// }
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
53d0e24ae1e99bd96cff412e5b16d846fd148d02 | f5c6c70a065b3a41e2e1c5b3a3052e0961e391cb | /back-end/reto-solver-api/src/main/java/a/olarte/retosolverapi/controller/MainController.java | ba0c97f5a6f8558ec25bd2b46e65fc97fba1a27f | [
"MIT"
] | permissive | aolarte92/reto_solver | d9de60b5d31cdb9e2156aa08ab69723726202ac3 | f75bf48b9ca191e2f402fc75a4aaef7e36f82f71 | refs/heads/master | 2020-06-26T03:35:21.092563 | 2019-07-31T19:43:41 | 2019-07-31T19:43:41 | 199,515,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package a.olarte.retosolverapi.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class MainController {
@GetMapping("/")
public String swagger (){
return "redirect:/swagger-ui.html";
}
}
| [
"aolarte9201@gmail.com"
] | aolarte9201@gmail.com |
4ed7b6df33341be131fbe38a9ffa1ded4dfc0d32 | cc768d8bda69e2fad8f790b07832950bc16122a4 | /src/com/sanggoe/test2/Book.java | 5604a3d7c9bef5a3017b7013b230604d57688894 | [] | no_license | Sanggoe/ThisIsJava | b08ecb33d4e76438d2abcb06be27b3c07bb0f142 | 51c27dac0338a28ec6212082aca1185aa429861a | refs/heads/master | 2021-02-15T18:40:43.441991 | 2020-12-24T02:11:24 | 2020-12-24T02:11:24 | 244,921,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package com.sanggoe.test2;
public class Book {
String title;
int pages;
String writer;
public Book(String title, int pages, String writer) {
this.title = title;
this.pages = pages;
this.writer = writer;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public String getWriter() {
return writer;
}
public void setWriter(String writer) {
this.writer = writer;
}
@Override
public String toString() {
return "책이름 : " + title + "\n페이지 수 : " + pages + "\n저자 : " + writer;
}
}
| [
"sanggoe0509@gmail.com"
] | sanggoe0509@gmail.com |
89da70c7726fe3085c64d7f4b96631a5c22925af | 951696ebe5485e54f9e0548a3295eea03bd4eb01 | /src/Model/Venventa.java | a22d736636e1f4e7719e633c2f194eca21d9edb7 | [] | no_license | BlancaMonroy/PuntoVenta_DA | 98398cb8b51192777db3563b8def301ebae824e1 | b0eae88ae155615a0c415543aa4e5344e374b8ac | refs/heads/master | 2021-01-13T00:59:28.292309 | 2015-10-29T07:05:34 | 2015-10-29T07:05:34 | 45,140,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,972 | 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 Model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author Blanca
*/
@Entity
@Table(name = "venventa")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Venventa.findAll", query = "SELECT v FROM Venventa v"),
@NamedQuery(name = "Venventa.findById", query = "SELECT v FROM Venventa v WHERE v.id = :id"),
@NamedQuery(name = "Venventa.findByStrFolio", query = "SELECT v FROM Venventa v WHERE v.strFolio = :strFolio"),
@NamedQuery(name = "Venventa.findByDteFechaVenta", query = "SELECT v FROM Venventa v WHERE v.dteFechaVenta = :dteFechaVenta"),
@NamedQuery(name = "Venventa.findByDecTotal", query = "SELECT v FROM Venventa v WHERE v.decTotal = :decTotal")})
public class Venventa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Column(name = "strFolio")
private String strFolio;
@Column(name = "dteFechaVenta")
@Temporal(TemporalType.TIMESTAMP)
private Date dteFechaVenta;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "decTotal")
private BigDecimal decTotal;
@OneToMany(mappedBy = "idVenVenta")
private List<Vendetalleventa> vendetalleventaList;
public Venventa() {
}
public Venventa(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStrFolio() {
return strFolio;
}
public void setStrFolio(String strFolio) {
this.strFolio = strFolio;
}
public Date getDteFechaVenta() {
return dteFechaVenta;
}
public void setDteFechaVenta(Date dteFechaVenta) {
this.dteFechaVenta = dteFechaVenta;
}
public BigDecimal getDecTotal() {
return decTotal;
}
public void setDecTotal(BigDecimal decTotal) {
this.decTotal = decTotal;
}
@XmlTransient
public List<Vendetalleventa> getVendetalleventaList() {
return vendetalleventaList;
}
public void setVendetalleventaList(List<Vendetalleventa> vendetalleventaList) {
this.vendetalleventaList = vendetalleventaList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Venventa)) {
return false;
}
Venventa other = (Venventa) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "Model.Venventa[ id=" + id + " ]";
}
}
| [
"Blanca@192.168.1.67"
] | Blanca@192.168.1.67 |
71611c5e8e2ecfcd808c229c70cfac96c0723b9f | 4e9bac9f76c3e9975d054c0c8d1f5306f6739b40 | /app/src/test/java/com/example/android/efiklanguage/ExampleUnitTest.java | e9d567b681346c49076fd206ac30e8ec5bc33d63 | [] | no_license | Napsta46/Efik_Language | 0e04d80ecf9cf5bf812bab1189ad4bc1cf5548b1 | 00eebe100a14c3e819875f83405fc6855c8331ba | refs/heads/master | 2022-12-26T07:40:28.515288 | 2020-10-01T18:05:52 | 2020-10-01T18:05:52 | 300,188,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package com.example.android.efiklanguage;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"abrahamandikan46@gmail.com"
] | abrahamandikan46@gmail.com |
93fbb77490e3ad82ffb91997991d4673d4baff0b | dab6cfe22e02f18a1c69cd36a5ffbe96696eba36 | /src/percobaan_1/Perkalianku_2.java | 4e72fd191f26610ccaab5c299894cbe5f622eef4 | [] | no_license | Yudas1337/Praktikum_PBO_7 | dd3de69ea132d9776571bd74fb39d3627a2ee750 | d72dede7fb6803ff2bfd58e7eda78e61dabcab80 | refs/heads/master | 2023-09-01T08:36:24.181595 | 2021-10-15T13:11:22 | 2021-10-15T13:11:22 | 416,151,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package percobaan_1;
public class Perkalianku_2 {
void perkalian(int a, int b) {
System.out.println(a * b);
}
void perkalian(double a, double b) {
System.out.println(a * b);
}
public static void main(String[] args) {
Perkalianku_2 objek = new Perkalianku_2();
objek.perkalian(25, 43);
objek.perkalian(34.56, 23.7);
}
}
| [
"yudasmalabi@gmail.com"
] | yudasmalabi@gmail.com |
0998cac794d296c840e4a8e6e04afe7225339736 | 51343e538e94c699012d4bccb3b9468e776f7b02 | /src/main/java/com/egao/common/core/web/BatchParam.java | d48d44ffb3a2f98fe16f672c4269adcee5d349e8 | [] | no_license | coder-ly/studentRoomManager | e9c26dd6a324ea564f33a95f0ba2d37f4fe8b0a5 | 57a08b6c15bf0b3a3e49f7348034647816b3b4a7 | refs/heads/master | 2023-02-06T06:01:21.426974 | 2020-12-20T10:44:22 | 2020-12-20T10:44:22 | 305,421,507 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | package com.egao.common.core.web;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.List;
/**
* 批量修改通用参数
* Created by wangfan on 2020-03-13 0:11
*/
public class BatchParam<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id集合
*/
private List<Serializable> ids;
/**
* 批量修改多个字段
*/
private T data;
/**
* 通用批量修改方法
*
* @param service IService
* @param idName id字段名称
* @return boolean
*/
public boolean update(IService<T> service, String idName) {
if (data == null) return false;
return service.update(data, new UpdateWrapper<T>().in(idName, this.getIds()));
}
public List<Serializable> getIds() {
return ids;
}
public void setIds(List<Serializable> ids) {
this.ids = ids;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"1007053672@qq.com"
] | 1007053672@qq.com |
309144ea69652576b340408a2ae15b14160c2805 | 52d705c66ecdaa5e5de1ace7167a58009a6e0aa0 | /one-time-examples/bestellprozess-java-ee6/src/main/java/com/camunda/demo/outerspace/wjax/SysoutDelegate.java | 27c38cb1cfe093e83f70f84076a92f2293d94295 | [
"Apache-2.0"
] | permissive | omineiro/code | 7f7062a6435014e279983748c9bdfbf0f69a55a3 | 612e1eccbf2a7cf7c6b2677a77b734e4e3a19972 | refs/heads/master | 2020-04-13T11:29:03.912452 | 2018-12-23T22:39:33 | 2018-12-23T22:39:33 | 163,175,868 | 1 | 0 | Apache-2.0 | 2018-12-26T12:06:21 | 2018-12-26T12:06:21 | null | UTF-8 | Java | false | false | 538 | java | package com.camunda.demo.outerspace.wjax;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
public class SysoutDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println("I am here: "
+ ((ExecutionEntity) execution).getActivityId());
System.out
.println(" ORDER ####### " + execution.getVariable("orderId"));
}
}
| [
"bernd.ruecker@camunda.com"
] | bernd.ruecker@camunda.com |
790de10799fa81d4757a9d829dc2c6f36abc33f7 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project78/src/test/java/org/gradle/test/performance/largejavamultiproject/project78/p391/Test7838.java | f0900b1cda70f3cc8d32c8f8cacc2c03e8d0d6f4 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,826 | java | package org.gradle.test.performance.largejavamultiproject.project78.p391;
import org.gradle.test.performance.largejavamultiproject.project69.p346.Production6938;
import org.gradle.test.performance.largejavamultiproject.project73.p366.Production7338;
import org.gradle.test.performance.largejavamultiproject.project77.p386.Production7738;
import org.gradle.test.performance.largejavamultiproject.project66.p331.Production6638;
import org.gradle.test.performance.largejavamultiproject.project70.p351.Production7038;
import org.gradle.test.performance.largejavamultiproject.project74.p371.Production7438;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test7838 {
Production7838 objectUnderTest = new Production7838();
@Test
public void testProperty0() {
Production7829 value = new Production7829();
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
Production7833 value = new Production7833();
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
Production7837 value = new Production7837();
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
Production6938 value = new Production6938();
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
Production7338 value = new Production7338();
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
Production7738 value = new Production7738();
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
Production6638 value = new Production6638();
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
Production7038 value = new Production7038();
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
Production7438 value = new Production7438();
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
e006ca6ee62dc8dc074153f231fdeb1f0331655c | 7571f30fb9e803f10100fd4d9d0071b69e9ac442 | /WxStudy/src/main/java/main/MenuManager.java | 4292ae1a912a82bdd9e8f12598cd84c64f5c2a34 | [] | no_license | itchenliang/WxStudy | 1876e639502bfb342fe60a7dd6fbc758796b8945 | 5871665074f7c6a310171cb653bd00d2fa413fec | refs/heads/master | 2020-03-14T16:11:47.960255 | 2018-05-01T07:55:48 | 2018-05-01T07:55:48 | 131,686,609 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,455 | java | package main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import Common.Button;
import entry.AccessToken;
import entry.CommonButton;
import entry.ComplexButton;
import entry.Menu;
import util.WeixinUtil;
/**
* 菜单管理器类
*
* @author Administrator
*
*/
public class MenuManager {
private static Logger log = LoggerFactory.getLogger(MenuManager.class);
public static void main(String[] args) {
// 第三方用户唯一凭证
String appId = "wx563d51ebd592c300";
// 第三方用户唯一凭证密钥
String appSecret = "437a12ca667603339da4f1b30cdcd19e";
// 调用接口获取access_token
AccessToken at = WeixinUtil.getAccessToken(appId, appSecret);
if (null != at) {
// 调用接口创建菜单
int result = WeixinUtil.createMenu(getMenu(), at.getAccessToken());
// 判断菜单创建结果
if (0 == result)
log.info("菜单创建成功!");
else
log.info("菜单创建失败,错误码:" + result);
}
}
/**
* 组装菜单数据
*
* @return
*/
private static Menu getMenu() {
CommonButton btn11 = new CommonButton();
btn11.setName("天气预报");
btn11.setType("click");
btn11.setKey("11");
CommonButton btn12 = new CommonButton();
btn12.setName("公交查询");
btn12.setType("click");
btn12.setKey("12");
CommonButton btn13 = new CommonButton();
btn13.setName("周边搜索");
btn13.setType("click");
btn13.setKey("13");
CommonButton btn14 = new CommonButton();
btn14.setName("历史上的今天");
btn14.setType("click");
btn14.setKey("14");
CommonButton btn21 = new CommonButton();
btn21.setName("歌曲点播");
btn21.setType("click");
btn21.setKey("21");
CommonButton btn22 = new CommonButton();
btn22.setName("经典游戏");
btn22.setType("click");
btn22.setKey("22");
CommonButton btn23 = new CommonButton();
btn23.setName("美女电台");
btn23.setType("click");
btn23.setKey("23");
CommonButton btn24 = new CommonButton();
btn24.setName("人脸识别");
btn24.setType("click");
btn24.setKey("24");
CommonButton btn25 = new CommonButton();
btn25.setName("聊天唠嗑");
btn25.setType("click");
btn25.setKey("25");
CommonButton btn31 = new CommonButton();
btn31.setName("Q友圈");
btn31.setType("click");
btn31.setKey("31");
CommonButton btn32 = new CommonButton();
btn32.setName("电影排行榜");
btn32.setType("click");
btn32.setKey("32");
CommonButton btn33 = new CommonButton();
btn33.setName("幽默笑话");
btn33.setType("click");
btn33.setKey("33");
/**
* 微信: mainBtn1,mainBtn2,mainBtn3底部的三个一级菜单。
*/
ComplexButton mainBtn1 = new ComplexButton();
mainBtn1.setName("生活助手");
// 一级下有4个子菜单
mainBtn1.setSub_button(new CommonButton[] { btn11, btn12, btn13, btn14 });
ComplexButton mainBtn2 = new ComplexButton();
mainBtn2.setName("休闲驿站");
mainBtn2.setSub_button(new CommonButton[] { btn21, btn22, btn23, btn24, btn25 });
ComplexButton mainBtn3 = new ComplexButton();
mainBtn3.setName("更多体验");
mainBtn3.setSub_button(new CommonButton[] { btn31, btn32, btn33 });
/**
* 封装整个菜单
*/
Menu menu = new Menu();
menu.setButton(new Button[] { mainBtn1, mainBtn2, mainBtn3 });
return menu;
}
}
| [
"1172973520@qq.com"
] | 1172973520@qq.com |
2830f0dfe8bb1b6aaa3add179d598e84f1751d55 | 1b024703bb243630a1adbafa351f7250366a4473 | /java-tutorial/NonZeros.java | b8d643bb3f43f3c4ae4b4335c858446094b7afde | [] | no_license | jlyden/TextCount | 15872010a3fc97dccb1a478a61450c96eee4d154 | 4829a565227e3f26bd0d564277f570e6772c61da | refs/heads/master | 2022-04-17T21:24:42.083121 | 2020-04-07T12:27:39 | 2020-04-07T12:27:39 | 109,031,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,087 | java | class NonZeros {
public static void main ( String [] args)
{
// Create arrays
int [] startZero = {0,1,2,3};
int [] endZero = {-4,2,7,10,0};
int [] middleZero = {5,3,0,-1,-5};
int [] twoZeros = {50,-30,0,10,0,-6,4,-5342,33};
int [] allZeros = {0,0,0};
// Pass arrays to NonZeros
int [] startZeroAfter = NonZeros(startZero);
int [] endZeroAfter = NonZeros(endZero);
int [] middleZeroAfter = NonZeros(middleZero);
int [] twoZerosAfter = NonZeros(twoZeros);
int [] allZerosAfter = NonZeros(allZeros);
// Print each original array and the result of NonZeros
printMessage(startZero, startZeroAfter);
printMessage(endZero, endZeroAfter);
printMessage(middleZero, middleZeroAfter);
printMessage(twoZeros, twoZerosAfter);
printMessage(allZeros, allZerosAfter);
}
/**
* @param A = array of ints
* @return array ints from A in original order, except zeros removed
*/
private static int[] NonZeros( int [] A )
{
// declare new array of proper size
int nonZeroCountA = getNonZeroCount(A);
int [] nonZeroArray = new int [nonZeroCountA];
// declare counter to keep track of position in new array
int nonZeroCounter = 0;
// go through A value by value, adding non-zero values to new array
int lengthA = A.length;
for(int i = 0; i < lengthA; i++) {
if(A[i] != 0){
nonZeroArray[nonZeroCounter] = A[i];
nonZeroCounter ++;
}
}
return nonZeroArray;
}
private static int getNonZeroCount( int [] A )
{
int nonZeroCount = 0;
int lengthA = A.length;
for(int i = 0 ; i < lengthA; i++) {
if(A[i] != 0) {
nonZeroCount ++;
}
}
return nonZeroCount;
}
private static void printArray( int [] A )
{
int lengthA = A.length;
System.out.print("[");
for(int i = 0; i < lengthA; i++) {
System.out.print(A[i]);
if(i != lengthA-1){
System.out.print(",");
}
}
System.out.print("]");
}
private static void printMessage( int [] A, int [] B) {
System.out.print("passing ");
printArray(A);
System.out.print(" gotback ");
printArray(B);
System.out.print("\n");
}
}
| [
"jennifer.lyden@powerschool.com"
] | jennifer.lyden@powerschool.com |
6186c7eebbc79f74ab689a04058d212def4a0aac | b6254f59a7deed8c171b9ac53a2880a346f27dd5 | /src/main/java/com/kendall/dota2dataservice/common/config/Dota2Properties.java | d6a03f507fd553cc727b774a22ed095a9838d384 | [] | no_license | Delicate-ops/Dota2DataService | 9edd0b111c8f8d60418a182e5b015dbc0a71adc7 | c7a737f7faaa9fceff4d041fb0b2efcbc082b34b | refs/heads/master | 2023-07-15T03:20:02.404507 | 2019-08-07T09:29:13 | 2019-08-07T09:29:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.kendall.dota2dataservice.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* @description:
* @author: kendall
* @since: 2019/7/20
*/
@Configuration
@PropertySource(value="classpath:application.yml")
@ConfigurationProperties(prefix = "dota2")
public class Dota2Properties {
private String key;
private String secret;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
}
| [
"190708208@qq.com"
] | 190708208@qq.com |
9683c5b53dbccdf6961b77ab7bd471b32bc81a67 | dadb48175005918bd023755a756f048605a1a42d | /android/src/ru/maklas/melnikov/AndroidCrashReport.java | f32d20b2317697e3bbf0ce9e62032cc6fffa3bbe | [] | no_license | maklas/ProjectMelnikov | ea4af8c65746da4beb5a986cd28f9e2eebcba769 | 84e1259b163d0254317a55938916507934d08cb0 | refs/heads/master | 2020-08-11T00:43:07.713314 | 2019-10-16T13:22:50 | 2019-10-16T13:22:50 | 214,455,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package ru.maklas.melnikov;
import com.crashlytics.android.Crashlytics;
import ru.maklas.melnikov.mnw.CrashReport;
import ru.maklas.melnikov.utils.Log;
public class AndroidCrashReport implements CrashReport {
@Override
public void report(Exception e) {
Log.error(e);
try {
Crashlytics.logException(e);
} catch (Exception ignore) {}
}
@Override
public void report(String error) {
Log.error(error);
try {
Crashlytics.log(error);
} catch (Exception ignore) {}
}
}
| [
"maklas-a@yandex.ru"
] | maklas-a@yandex.ru |
d40b5d1a2c498cab96d04bf7ae1f76382182fdf6 | b31c11fae611d8b48f0e49fd68ad5303deed0011 | /StudentInfo/app/src/main/java/com/example/arvind/studentinfo/RemoveStaff.java | 5356bf180fd3a2da8aaf7c82d93b38a703f7b21c | [] | no_license | G-Arvind/CollegeApp | 1c2bbc45d6b5ffdb7f695888306188e0ea8fa29d | e01351a127f9431cca3a388429895a3511e4d170 | refs/heads/master | 2020-03-18T23:17:32.887968 | 2018-06-01T13:48:13 | 2018-06-01T13:48:13 | 135,394,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,307 | java | package com.example.arvind.studentinfo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
import java.util.Map;
public class RemoveStaff extends AppCompatActivity {
ArrayList<String> names=new ArrayList<String>(1);
DatabaseReference mref;
ListView slist;
Map<String,String> map;
String dpval;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_remove_staff);
slist=(ListView)findViewById(R.id.sremovelist);
mref= FirebaseDatabase.getInstance().getReference();
if(getIntent().getExtras()!=null) {
dpval = getIntent().getExtras().getString("dpval");
}
DatabaseReference tmref=mref.child("staff").child(dpval);
Log.v("TAG", "VALUEREF" + tmref);
tmref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
// names.add(dataSnapshot.getValue().toString());
// Log.v("TAG","VALUE"+dataSnapshot.getValue().toString());
if(!(dataSnapshot.getValue() instanceof String)) {
map = (Map<String, String>) dataSnapshot.getValue();
names.add(map.get("sid"));
Log.v("TAG", "VALUE" + map.get("sid"));
Log.v("TAG", "VALUE" + names.get(0));
}
setList();
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
void setList()
{
final ListAdapter listAdapter=new ArrayAdapter<String>(this,R.layout.list_item_1,names);
slist.setAdapter(listAdapter);
slist.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
String val=String.valueOf(adapterView.getItemAtPosition(i));
DatabaseReference tempref=mref.child("staff").child(dpval).child(val);
tempref.removeValue();
names.remove(i);
slist.setAdapter(listAdapter);
Toast.makeText(getApplicationContext(),"Removed",Toast.LENGTH_SHORT).show();
return true;
}
});
}
}
| [
"g.arvind7@gmail.com"
] | g.arvind7@gmail.com |
b15246cd1c6e3d5a33c957b2c9c6d3e6700eb999 | 1c6280d07bd0a04b88b733db585ba03289ef324d | /Projekat_export/Mail Client V2/src/app/ReadMailClient.java | 2abd9364e470012c5acafc31332898474768a338 | [] | no_license | ivans1999/IB-project | 0ca247bffd5344325cf97ca9b049a1c1fe6373b8 | 9efc072dfba27d7a0f6185fc4eceb8450bcd0f47 | refs/heads/master | 2023-07-28T23:44:22.607452 | 2020-09-18T21:52:54 | 2020-09-18T21:52:54 | 267,135,626 | 0 | 0 | null | 2021-09-20T23:24:16 | 2020-05-26T19:40:27 | Java | UTF-8 | Java | false | false | 6,003 | java | package app;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
import java.util.ArrayList;
import java.util.List;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.apache.xml.security.utils.JavaUtils;
import com.google.api.services.gmail.Gmail;
import com.google.api.services.gmail.model.Message;
import util.KeyStoreReader;
import model.keystore.IssuerData;
import model.mailclient.MailBody;
import support.MailHelper;
import support.MailReader;
import util.Base64;
import util.GzipUtil;
public class ReadMailClient extends MailClient {
// validacija
public static boolean validate(PublicKey publicKey,
byte[] data, byte[] sign) throws Exception {
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initVerify(publicKey);
signature.update(data);
boolean verified = signature.verify(sign);
if (verified==true) {
System.out.println("Validity of email has been proved with signature.");
}else {
System.out.println("This email is not valid and it's not compatible signature.");
}
return verified;
}
public static long PAGE_SIZE = 3;
public static boolean ONLY_FIRST_PAGE = true;
private static final String KEY_STORE_USER_B = "./data/userb.jks";
private static final String KEY_STORE_B_PASSWORD = "userb";
private static final char [] keyB_password_char = KEY_STORE_B_PASSWORD.toCharArray();
private static final String KEY_STORE_B_ALIAS = "userb";
private static KeyStoreReader keyStoreReader = new KeyStoreReader();
public static void main(String[] args) throws Exception {
// Build a new authorized API client service.
Gmail service = getGmailService();
ArrayList<MimeMessage> mimeMessages = new ArrayList<MimeMessage>();
String user = "me";
String query = "is:unread label:INBOX";
List<Message> messages = MailReader.listMessagesMatchingQuery(service, user, query, PAGE_SIZE, ONLY_FIRST_PAGE);
for(int i=0; i<messages.size(); i++) {
Message fullM = MailReader.getMessage(service, user, messages.get(i).getId());
MimeMessage mimeMessage;
try {
mimeMessage = MailReader.getMimeMessage(service, user, fullM.getId());
System.out.println("\n Message number " + i);
System.out.println("From: " + mimeMessage.getHeader("From", null));
System.out.println("Subject: " + mimeMessage.getSubject());
System.out.println("Body: " + MailHelper.getText(mimeMessage));
System.out.println("\n");
mimeMessages.add(mimeMessage);
} catch (MessagingException e) {
e.printStackTrace();
}
}
System.out.println("Select a message to decrypt:");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String answerStr = reader.readLine();
Integer answer = Integer.parseInt(answerStr);
MimeMessage chosenMessage = mimeMessages.get(answer);
String body = MailHelper.getText(chosenMessage);
//mail body objekat
MailBody mailBody = new MailBody(body);
//preuzimanje vektora, enkriptovanog kljuca i tela poruke
IvParameterSpec ivParameterSpec1_test = new IvParameterSpec(mailBody.getIV1Bytes());
IvParameterSpec ivParameterSpec2_test = new IvParameterSpec(mailBody.getIV2Bytes());
byte [] message = mailBody.getEncMessageBytes();
byte [] encSessionKey = mailBody.getEncKeyBytes();
byte [] signature = mailBody.getSignatureBytes();
//pristup keystore-u i uzimanje privatnog kljuca korisnika B
KeyStore keyStoreUserB = keyStoreReader.readKeyStore(KEY_STORE_USER_B, KEY_STORE_B_PASSWORD.toCharArray());
PrivateKey privateKeyUserB = keyStoreReader.getPrivateKeyFromKeyStore(keyStoreUserB, KEY_STORE_B_ALIAS, keyB_password_char);
Certificate certificateB = keyStoreReader.getCertificateFromKeyStore(keyStoreUserB, KEY_STORE_B_ALIAS);
PublicKey publicKeyUserB = keyStoreReader.getPublicKeyFromCertificate(certificateB);
//dekripcija tajnog kljuca privatnim kljucem korisnika B
Cipher rsaCipherDec = Cipher.getInstance("RSA/ECB/PKCS1Padding");
rsaCipherDec.init(Cipher.DECRYPT_MODE, privateKeyUserB);
byte[] sessionKeyDec = rsaCipherDec.doFinal(encSessionKey);
SecretKey ss = new SecretKeySpec(sessionKeyDec, "AES");
//inicijalizacija i dekripcija tela poruke tajnim kljucem
Cipher bodyCipherDec = Cipher.getInstance("AES/CBC/PKCS5Padding");
bodyCipherDec.init(Cipher.DECRYPT_MODE, ss, ivParameterSpec1_test);
byte[] receivedTxt = bodyCipherDec.doFinal(message);
//dekompresija tela poruke
String decompressedBodyText = GzipUtil.decompress(Base64.decode(new String(receivedTxt)));
//dekriptovanje i dekompresija subject-a
bodyCipherDec.init(Cipher.DECRYPT_MODE, ss, ivParameterSpec2_test);
String decryptedSubjectTxt = new String(bodyCipherDec.doFinal(Base64.decode(chosenMessage.getSubject())));
String decompressedSubjectTxt = GzipUtil.decompress(Base64.decode(decryptedSubjectTxt));
validate(publicKeyUserB, message, signature);
System.out.println("Subject: " + decompressedSubjectTxt);
System.out.println("Body: " + decompressedBodyText);
}
} | [
"Korisnik@IVAN"
] | Korisnik@IVAN |
94e3e314ec6ded003a669661cdb6c640edd3d50f | 51b90e6a68baee33e7c653d79b1c3e26ad71878c | /helianto-core/src/main/java/org/helianto/core/classic/CategoryMgrImpl.java | dcd1edf409eb8b1db150b8397ad6a6dff1b93cfc | [
"Apache-2.0"
] | permissive | eldevanjr/helianto | 38a231abfe6fa8bc146e49b49959dc04f894a589 | 61c13ffeaa0d63bd243d9a4c00e01255f65baa40 | refs/heads/master | 2021-01-11T19:20:45.193650 | 2017-01-26T19:55:49 | 2017-01-26T19:55:49 | 79,360,379 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,613 | java | /* Copyright 2005 I Serv Consultoria Empresarial Ltda.
*
* 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 org.helianto.core.classic;
import javax.annotation.Resource;
import org.helianto.core.CategoryMgr;
import org.helianto.core.def.CategoryGroup;
import org.helianto.core.domain.Category;
import org.helianto.core.domain.Entity;
import org.helianto.core.repository.CategoryRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
/**
* Default implementation to category interface.
*
* @author Mauricio Fernandes de Castro
*/
//@org.springframework.stereotype.Service("categoryMgr")
public class CategoryMgrImpl implements CategoryMgr {
@Transactional(readOnly=true)
public long countCategory(final Entity entity, final char categoryGroup, final String searchString) {
return categoryRepository.countByEntity_IdAndCategoryGroupAndCategoryCode(entity.getId(), categoryGroup, searchString);
}
@Transactional
public Category storeCategory(Category category) {
return categoryRepository.saveAndFlush(category);
}
public void removeCategory(Category category) {
categoryRepository.delete(category);
}
@Transactional
public Category installCategory(Entity entity, CategoryGroup categoryGroup, String categoryCode, String categoryName) {
Category category = categoryRepository.findByEntityAndCategoryGroupAndCategoryCode(entity, categoryGroup.getValue(), categoryCode);
if (category!=null) {
logger.debug("Found category {}", category);
return category;
}
category = categoryRepository.saveAndFlush(new Category(entity, categoryGroup, categoryCode, categoryName));
logger.debug("Category {} installed.", category);
return category;
}
//- collabs
private CategoryRepository categoryRepository;
@Resource
public void setCategoryRepository(CategoryRepository categoryRepository) {
this.categoryRepository = categoryRepository;
}
private final Logger logger = LoggerFactory.getLogger(CategoryMgrImpl.class);
}
| [
"eldevanjr@iservport.com"
] | eldevanjr@iservport.com |
ce5277076db56e9010c24e5ec4e8cfbce852fe9e | 2c16007de25b78fa7f010cf8d471606b1bb31b2e | /asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePluginFactory.java | c140abf772d54ca51078f3a75ef80d6c2ce2b946 | [] | no_license | stalep/jboss-aop | 24e1c64acb48540dca858fa3b093861b91f724eb | f9d6e15fc724f9e1c07a98aa301a52b4273a882f | refs/heads/master | 2022-07-08T04:31:18.718343 | 2009-01-28T03:01:01 | 2009-01-28T03:01:01 | 116,122 | 3 | 2 | null | 2022-07-01T22:17:50 | 2009-01-27T22:31:04 | Java | UTF-8 | Java | false | false | 1,377 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.aop.classpool;
/**
*
* @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
public class URLClassLoaderIsLocalResourcePluginFactory implements IsLocalResourcePluginFactory
{
public IsLocalResourcePlugin create(BaseClassPool pool)
{
return new URLClassLoaderIsLocalResourcePlugin(pool);
}
}
| [
"kabir.khan@jboss.com@84be2c1e-ba19-0410-b317-a758671a6fc1"
] | kabir.khan@jboss.com@84be2c1e-ba19-0410-b317-a758671a6fc1 |
7abcaac1a893840bbd5b80374a1d9ba70ffa3d02 | 9da1825e308892466da06842b8683f9893eaa15a | /gamut-mongodb/src/main/java/in/cdac/bioinfo/gamut/snpwebapp/ChromosomeCounter.java | 6333ed677be3b80f65e4c4d3c8b29ed0f6ed497b | [] | no_license | bioinformatics-cdac/gamut | eb3ee7f8dd77dddf521622ab4ea14c12e94f1083 | d832f2258bef96ff573109cb4a923ba85d74495b | refs/heads/main | 2023-06-22T03:34:31.690139 | 2021-07-22T08:51:30 | 2021-07-22T08:51:30 | 385,491,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | 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 in.cdac.bioinfo.gamut.snpwebapp;
/**
*
* @author renu
*/
public class ChromosomeCounter {
private String chromosome;
private int counter;
public String getChromosome() {
return chromosome;
}
public void setChromosome(String chromosome) {
this.chromosome = chromosome;
}
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
}
| [
"ramkicse@gmail.com"
] | ramkicse@gmail.com |
e5fa881b8898393cf03dea42ba8f228fbce4f453 | 3de0a90311ff546ac3145a684ea7a6885b504224 | /src/com/eichinn/generics/example/CreatorGeneric.java | d9446b51400cf6e801d92af559a4bf69b46d1cea | [] | no_license | EiChinn/ThinkingInJava | 6bb4d88e3612fd670faa48117c0511abba5d61d5 | fcc36dbc0992899d813177abd7609de96d839163 | refs/heads/master | 2021-01-12T10:55:02.376602 | 2018-08-28T03:29:48 | 2018-08-28T03:29:48 | 72,742,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 543 | java | package com.eichinn.generics.example;
public class CreatorGeneric {
public static void main(String[] args) {
Creator c = new Creator();
c.f();
}
}
abstract class GenericWithCreate<T> {
final T element;
public GenericWithCreate() {
this.element = create();
}
abstract T create();
}
class X {
}
class Creator extends GenericWithCreate<X> {
@Override
X create() {
return new X();
}
void f() {
System.out.println(element.getClass().getSimpleName());
}
}
| [
"eichinn77@gmail.com"
] | eichinn77@gmail.com |
fb18907f5bcd9d54d20875ce3e638dbf023fe065 | 0be73b2071964c44bfb7b9f871979fa79a50f36b | /CTS_Seminar7/src/ro/ase/cts/adapter/Creditable.java | a65acf243d2a1ed48a4f16626ac79303fbd4d40c | [] | no_license | nicolescucristian18/CTS_Seminarii | 96e99111760356da7c73465292e9dc8ed79d0765 | 288bc7bb9317bbb33e06450c4c57f80a3bd50540 | refs/heads/main | 2023-05-03T17:13:06.198189 | 2021-06-03T08:15:06 | 2021-06-03T08:15:06 | 344,179,736 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package ro.ase.cts.adapter;
public interface Creditable {
public void oferaCredit();
}
| [
"Asus@DESKTOP-N4JIJJG"
] | Asus@DESKTOP-N4JIJJG |
64cc4e0bd15140aa6382877c6fb0888d3aa1305a | 07593813271271dd226b127eb6abec07cb4862f5 | /Circulemos2/AccidentalidadEJB/src/main/java/co/com/datatools/c2/entidades/EstadoAccidentalidad.java | cdfebd368baa9ec438ab95c5635deadc56bac0f7 | [] | no_license | Divier/proyectojee | 6f28cde44e7d721c86bfa6892b016a90169c65bc | f30892222fa9949dae2d9fc74a750e207d962736 | refs/heads/master | 2021-04-30T16:58:17.051579 | 2017-02-09T15:39:54 | 2017-02-09T15:39:54 | 80,161,866 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,224 | java | package co.com.datatools.c2.entidades;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import co.com.datatools.c2.entidades.util.EntidadCatalogoC2;
import co.com.datatools.util.dto.EntidadC2;
/**
* The persistent class for the estado_accidentalidad database table.
*
*/
@Entity
@Table(name = "estado_accidentalidad")
@NamedQuery(name = "EstadoAccidentalidad.findAll", query = "SELECT ea FROM EstadoAccidentalidad ea")
public class EstadoAccidentalidad implements EntidadC2, EntidadCatalogoC2 {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "id_estado_accidentalidad")
private Integer id;
@Basic(optional = false)
@Column(name = "nombre")
private String nombre;
@Basic(optional = false)
@Column(name = "estado")
private Boolean estado;
@Column(name = "sigla")
private String sigla;
@Column(name = "codigo")
private String codigo;
@Column(name = "descripcion")
private String descripcion;
public EstadoAccidentalidad() {
super();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Boolean getActivo() {
return estado;
}
public void setActivo(Boolean activo) {
this.estado = activo;
}
public String getSigla() {
return sigla;
}
public void setSigla(String sigla) {
this.sigla = sigla;
}
public String getCodigo() {
return codigo;
}
public void setCodigo(String codigo) {
this.codigo = codigo;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public Boolean getEstado() {
return estado;
}
public void setEstado(Boolean estado) {
this.estado = estado;
}
} | [
"diviercasas26@gmail.com"
] | diviercasas26@gmail.com |
1832705d5e32d61d614d42a497f17b17bde036f5 | 45f1a8e8d4791f712b324e156d6ab21f4745015b | /app/src/main/java/com/arvind/linebalancing/adapter/DesignationListAdapter.java | 049978a514765bf30fc3a82e3fd2c9e28a39fe65 | [] | no_license | rt4914/MaterialTabsDemo2 | 82293653432b6168164e6cefc46c5102be0a259c | 4eddf08bdd8768920d0f82ee6d400727aae907f9 | refs/heads/master | 2021-01-01T05:52:37.222011 | 2019-04-11T16:22:41 | 2019-04-11T16:22:41 | 97,294,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,959 | java | package com.arvind.linebalancing.adapter;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.VolleyError;
import com.arvind.linebalancing.R;
import com.arvind.linebalancing.activity.designation.AddDesignationActivity;
import com.arvind.linebalancing.serverutilities.GeneralVolleyRequest;
import com.arvind.linebalancing.serverutilities.IVolleyResponse;
import com.arvind.linebalancing.table.DesignationTable;
import com.arvind.linebalancing.utilities.AppDatabase;
import com.arvind.linebalancing.utilities.Constants;
import com.arvind.linebalancing.utilities.MyAlertDialog;
import com.arvind.linebalancing.utilities.MyDeleteDialogInterface;
import com.arvind.linebalancing.utilities.UtilityFile;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.List;
public class DesignationListAdapter extends RecyclerView.Adapter<DesignationListAdapter.MyViewHolder> {
private static final String TAG = DesignationListAdapter.class.getSimpleName() ;
private Context context;
private List<DesignationTable> designationTableList;
private ProgressDialog pdLoading = null;
private Toast mToast = null;
private GeneralVolleyRequest mGeneralVolleyRequest;
private MyAlertDialog myAlertDialog = null;
private UtilityFile utilityFile;
private int iPosition;
private String sDesignationId;
public DesignationListAdapter(Context context, List<DesignationTable> designationTableList) {
this.context = context;
this.designationTableList = designationTableList;
utilityFile = new UtilityFile(context);
volleySetup();
deleteDialogSetup();
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_designation, viewGroup, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
if (i % 2 == 0) {
myViewHolder.llMain.setBackgroundColor(context.getResources().getColor(R.color.white));
} else {
myViewHolder.llMain.setBackgroundColor(context.getResources().getColor(R.color.whiteLightBackground));
}
if (designationTableList.get(i) != null) {
myViewHolder.tvDesignationName.setText(designationTableList.get(i).getDesignationName());
}
// if ((i + 1) == designationTableList.size()) {
// myViewHolder.vDivider.setVisibility(View.GONE);
// } else {
// myViewHolder.vDivider.setVisibility(View.VISIBLE);
// }
}
@Override
public int getItemCount() {
return designationTableList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
private LinearLayout llMain;
private TextView tvDesignationName;
private View vDivider;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
llMain = itemView.findViewById(R.id.llMain);
tvDesignationName = itemView.findViewById(R.id.tvDesignationName);
vDivider = itemView.findViewById(R.id.vDivider);
tvDesignationName.setTypeface(utilityFile.getTfRegular());
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(context, AddDesignationActivity.class);
i.putExtra("MODE", Constants.ACTIVITY_MODE_VIEW);
i.putExtra("DESIGNATION_ID", designationTableList.get(getAdapterPosition()).getId());
i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
}
});
itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
myAlertDialog.createDeleteAlertBox("Delete Designation", true, "DELETE", getAdapterPosition());
return true;
}
});
}
}
public void deleteDialogSetup() {
MyDeleteDialogInterface myDeleteDialogInterface = new MyDeleteDialogInterface() {
@Override
public void isDeleted(boolean value, String sAlertDialogType, int adapterPosition) {
if(sAlertDialogType.matches("DELETE")){
if (value) {
iPosition = adapterPosition;
sDesignationId = designationTableList.get(adapterPosition).getId();
Log.d(TAG, "onClick: " + sDesignationId);
if (sDesignationId == null) {
showToast(context.getResources().getString(R.string.unexpected_error));
return;
}
sendDeleteDesignationRequest(sDesignationId);
}
}
}
};
myAlertDialog = new MyAlertDialog(context, myDeleteDialogInterface);
}
private void sendDeleteDesignationRequest(String sDesignationId) {
if (!utilityFile.isConnectingToInternet()) {
showToast(context.getResources().getString(R.string.no_internet_connection));
return;
}
showProgressDialog();
HashMap<String, String> params = new HashMap<>();
params.put("id", sDesignationId);
mGeneralVolleyRequest.requestToServer(Request.Method.POST, Constants.API_DELETE_DESIGNATION,
Constants.BASE_SERVER_URL + "delete_designation",
params);
}
private void volleySetup() {
IVolleyResponse mRequestCallback = new IVolleyResponse() {
@Override
public void notifySuccess(String requestType, String response) {
hideProgressDialog();
Log.d(TAG, "notifySuccess: " + response);
if (requestType.matches(Constants.API_DELETE_DESIGNATION)) {
deleteDesignationResponse(response);
} else {
showToast(context.getResources().getString(R.string.unexpected_error));
}
}
@Override
public void notifyError(String requestType, VolleyError error) {
hideProgressDialog();
showToast(context.getResources().getString(R.string.volley_server_error));
}
};
mGeneralVolleyRequest = new GeneralVolleyRequest(context, mRequestCallback);
}
private void deleteDesignationResponse(String sResponse) {
try {
JSONObject responseObject = new JSONObject(sResponse);
int iResponseCode = responseObject.getInt("response_code");
if (iResponseCode == 100) {
AppDatabase.getInstance(context).designationTableDao().deleteDesignationById(sDesignationId);
designationTableList.remove(iPosition);
notifyItemRemoved(iPosition);
showToast("Designation deleted successfully.");
} else {
showToast(context.getResources().getString(R.string.unexpected_error));
}
} catch (JSONException e) {
e.printStackTrace();
Log.e(TAG, "deleteDesignationResponse: ", e);
showToast(context.getResources().getString(R.string.unexpected_error));
}
}
private void showToast(String sDisplayMessage) {
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(context, "" + sDisplayMessage, Toast.LENGTH_SHORT);
mToast.show();
}
private void setProgressDialog() {
if (pdLoading == null) {
pdLoading = new ProgressDialog(context);
pdLoading.setMessage("Loading...");
pdLoading.setCancelable(false);
}
}
private void showProgressDialog() {
if (pdLoading == null) {
setProgressDialog();
}
if (pdLoading.isShowing()) {
pdLoading.cancel();
}
pdLoading.show();
}
private void hideProgressDialog() {
if (pdLoading == null) {
setProgressDialog();
}
if (pdLoading.isShowing()) {
pdLoading.cancel();
}
}
}
| [
"akashkoradia1@gmail.com"
] | akashkoradia1@gmail.com |
e2923609d874781dffc70293c2a06714230f3ab5 | 02bb295af2aef392dfbc5520c67fd664fafd9880 | /viewanim/src/main/java/com/xiang/viewanim/view/comm/StepBarView/StepBarView.java | 01ec88e0b4545645c893cbfb875fa275e5a92232 | [] | no_license | xiang205012/Test | e2a224a0a9e2be070eb92693864a2c55d1aedeef | 2756004b81f5668fb92ed9be625e1b9199e92e31 | refs/heads/master | 2020-07-01T04:54:01.361243 | 2016-12-07T12:50:16 | 2016-12-07T12:50:16 | 74,096,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,222 | java | package com.xiang.viewanim.view.comm.StepBarView;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import com.xiang.viewanim.R;
import java.util.ArrayList;
import java.util.List;
/**
* 仿淘宝横向步骤进度提示,步骤指示器
* 如:下订单----支付完成---已经发货----交易成功
* 宽度设为:match_parent 高度建议设为:60dp
* Created by gordon on 2016/6/5.
*/
public class StepBarView extends View {
/**默认距离边缘的距离*/
public static final int DEFAULT_PADDING=20;
/**中心点Y坐标*/
private float mCenterY=0.0f;
// {{横线所在的矩形位置(主意从头到尾只画一条线,然后在线上画圆)
/**横线左边x坐标*/
private float mLeft=0.0f;
/**横线左边y坐标*/
private float mTop=0.0f;
/**横线右边x坐标*/
private float mRight=0.0f;
/**横线右边x坐标*/
private float mBottom=0.0f;
// }}
/**每个步骤之间的间距*/
private float mDistance=0.0f;
/**线条高度*/
private float mLineHeight;
/**未完成小圆的半径*/
private float mUnDoneRadius;
/**已完成大圆的半径*/
private float mDoneRadius;
/**未完成的步骤的颜色*/
private int mUnDoneColor;
/**完成步骤的颜色*/
private int mDoneColor=0XFF00FF00;
/**总步数*/
private int mTotalStep;
/**已完成步数*/
private int mCompleteStep;
private int defaultWidth;
/**画线和画圆的笔*/
private Paint lineAndCirclePaint;
/**文字所在的矩形*/
private Rect textBounds;
/**画文字的笔*/
private Paint textPaint;
/**步骤集合*/
private List<String> steps = new ArrayList<>();
public StepBarView(Context context) {
this(context,null);
}
public StepBarView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public StepBarView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.StepBarView);
mLineHeight = array.getDimensionPixelOffset(R.styleable.StepBarView_lineHeight,dp2Px(5));
mUnDoneRadius = array.getDimensionPixelOffset(R.styleable.StepBarView_unDoneRadius,dp2Px(10));
mDoneRadius = array.getDimensionPixelOffset(R.styleable.StepBarView_doneRadius,dp2Px(15));
mUnDoneColor = array.getColor(R.styleable.StepBarView_unDoneColor, 0XFF808080);
mDoneColor = array.getColor(R.styleable.StepBarView_doneColor,0XFF00FF00);
array.recycle();
setPadding(dp2Px(30),0,dp2Px(30),0);
mTotalStep = steps.size();
lineAndCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
lineAndCirclePaint.setStyle(Paint.Style.FILL);
textBounds = new Rect();
textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
textPaint.setTextSize(26);
}
/**获取相关位置*/
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mCenterY = getHeight() / 2;
mLeft = getLeft() + getPaddingLeft();
mTop = mCenterY - mLineHeight / 2;
mRight = getRight() - getPaddingRight();
mBottom = mCenterY + mLineHeight / 2;
if(mTotalStep > 1){
mDistance = (mRight - mLeft) / (mTotalStep - 1);
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(mTotalStep <= 0 || mCompleteStep < 0 || mCompleteStep > mTotalStep){
return;
}
// 先画所有步骤
lineAndCirclePaint.setColor(mUnDoneColor);
// 画出整条线
canvas.drawRect(mLeft,mTop,mRight,mBottom,lineAndCirclePaint);
float xLoc = mLeft;
// 画所有的步骤(圆形)
for(int i = 0 ; i < mTotalStep; i++){
canvas.drawCircle(xLoc,mCenterY,mUnDoneRadius,lineAndCirclePaint);
// 如果直接在这里绘制文字
// 比如:已下单
String text = steps.get(i);
textPaint.getTextBounds(text,0,text.length(),textBounds);
float x = xLoc - textBounds.width()/2;
float y = mCenterY + mDoneRadius/2 + dp2Px(20);
if(x < 0) x = 10;
// TODO
if(xLoc + textBounds.width()/2 > getResources().getDisplayMetrics().widthPixels) {
textBounds.left = getResources().getDisplayMetrics().widthPixels - textBounds.right - 10;
canvas.drawText(text,textBounds.left,y,textPaint);
continue;
}
canvas.drawText(text,x,y,textPaint);
xLoc += mDistance;
}
// 画已经完成的步骤
xLoc = mLeft;
for(int i = 0;i <= mCompleteStep;i++){
lineAndCirclePaint.setColor(mDoneColor);
if(i > 0) {
canvas.drawRect(xLoc, mTop, xLoc + mDistance, mBottom, lineAndCirclePaint);
canvas.drawCircle(xLoc + mDistance,mCenterY,mUnDoneRadius,lineAndCirclePaint);
lineAndCirclePaint.setColor(getTranspartColorByAlpha(mDoneColor,0.2f));
canvas.drawCircle(xLoc + mDistance, mCenterY, mDoneRadius, lineAndCirclePaint);
xLoc += mDistance;
}else{ // 默认第一个圆是已完成
canvas.drawCircle(xLoc,mCenterY,mUnDoneRadius,lineAndCirclePaint);
lineAndCirclePaint.setColor(getTranspartColorByAlpha(mDoneColor,0.2f));
canvas.drawCircle(xLoc,mCenterY,mDoneRadius,lineAndCirclePaint);
}
}
}
/**默认宽度为屏幕宽度减去padding值*/
public int getDefaultWidth() {
return getResources().getDisplayMetrics().widthPixels;
}
private int dp2Px(int dp) {
return (int) (getContext().getResources().getDisplayMetrics().density*dp + 0.5f);
}
/**
* 将指定的颜色转换成制定透明度的颜色
* @param color
* @param ratio
* @return
*/
private int getTranspartColorByAlpha(int color, float ratio){
int newColor = 0;
int alpha = Math.round(Color.alpha(color) * ratio);
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
newColor = Color.argb(alpha, r, g, b);
return newColor;
}
/**设置步骤,重绘视图*/
public void setSteps(List<String> steps){
this.steps = steps;
mTotalStep = steps.size();
invalidate();
}
/**已完成后进入下一步*/
public void nextStep(){
mCompleteStep++;
invalidate();
}
/**重置*/
public void reset(){
mCompleteStep = 0;
invalidate();
}
} | [
"xiang205012@gmail.com"
] | xiang205012@gmail.com |
e457fc2fe7017ec111fd9c7346c3091681091e0c | 082eafc45185f4f23118108eb34c23b2fe3f0faa | /src/main/java/com/tutorial/springboot/angular2/starter/Angular2Application.java | 0ded483ca39a96e37a6cbd0dc82f43332e87599c | [] | no_license | zlatanp/springboot-jwt-angular2 | 47e0533b85a11b04a7165c41279136ff9d176a00 | dc9168867d81e55e689688778a8104c229b17e96 | refs/heads/master | 2021-04-27T09:47:37.917047 | 2018-02-22T19:33:53 | 2018-02-22T19:33:53 | 122,521,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.tutorial.springboot.angular2.starter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Angular2Application {
public static void main(String[] args) {
SpringApplication.run(Angular2Application.class, args);
}
}
| [
"zlajox@gmail.com"
] | zlajox@gmail.com |
9d9f1d39cd7df71953c69321183e070b987863d3 | 7ef0ce3927872012dd4bbe827bd5e64d4ad6ff1a | /Period8_Java/src/introduction/Freshman.java | 37e43b7b83a26f6aa21b50af195d65bb9708f7c2 | [] | no_license | zkong7436/Classwork | 6a4a5958b71ea2ce7422d0f841c0f78ae56c68bb | 73122b93d0d3429a93587f0e862fd59876653af6 | refs/heads/master | 2020-04-09T08:34:47.799619 | 2017-01-11T19:00:33 | 2017-01-11T19:00:33 | 68,224,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package introduction;
public class Freshman extends Student {
public Freshman(String name) {
super(name);
}
public void age() {
super.talk();
System.out.println("...and I am 15 years old.");
}
}
| [
"Student8@10.8.33.172"
] | Student8@10.8.33.172 |
489b44c3f15c90cecee864e33f1ba526e2bbb756 | cfaff8223a7c3f56d6cba0ac21838d456906d5cb | /ue-client/client/src/edu/toronto/ece1778/urbaneyes/ProjectListActivity.java | e0a6632f42592960f7cf09f50c18ec68d759c858 | [] | no_license | ravikalyani/ue-client | abb05f45a3ba2ab6e499e3872b57bd7d68022ae8 | 698db42c2c305fe093c9850922b65b37fb29238e | refs/heads/master | 2016-09-05T18:02:11.719877 | 2013-03-19T06:12:48 | 2013-03-19T06:12:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,852 | java | package edu.toronto.ece1778.urbaneyes;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockListActivity;
import edu.toronto.ece1778.urbaneyes.common.AnswerType;
import edu.toronto.ece1778.urbaneyes.common.Question;
import edu.toronto.ece1778.urbaneyes.common.RadioGroupQuestion;
import edu.toronto.ece1778.urbaneyes.common.SurveyType;
import edu.toronto.ece1778.urbaneyes.common.SurveyKind;
/**
* Screen for the choice of projects.
*
* @author mcupak
*
*/
public class ProjectListActivity extends SherlockListActivity {
private List<String> projects = new ArrayList<String>();
private Integer selectedProject = 0;
private ProgressBar pb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_project_list);
pb = (ProgressBar) findViewById(R.id.stprogress);
pb.setVisibility(View.VISIBLE);
new DownloadSurveyListXmlTask().execute("http://urbaneyes-mcupak.rhcloud.com/rest/surveys/");
/*
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, loadProjects()));
*/
}
private List<String> loadProjects() {
// TODO add surveytypes received from server
// addSurveyTypeObjects(); DOWNLOADED
projects = SurveyStateHolder.getSurveyNames();
return projects;
}
@Override
public void onListItemClick(ListView parent, View v, int position, long id) {
selectedProject = position;
Intent myIntent = new Intent(getBaseContext(), MapActivity.class);
myIntent.putExtra("selectedProject", selectedProject);
startActivity(myIntent);
}
private void addSurveyTypeObjects() {
// TODO add surveytypes received from server
SurveyStateHolder.clearSurveyTypes();
addSubwaySurveyTypeObject();
addFoodVendorSurveyTypeObject();
addCyclePathSurveyTypeObject();
}
private void addSubwaySurveyTypeObject() {
// TODO add surveytypes received from server
SurveyType st = new SurveyType();
st.setId(1);
st.setName("Subway Entrance Survey");
st.setKind(SurveyKind.POINT);
RadioGroupQuestion q = new RadioGroupQuestion();
q.setId(1);
q.setDesc("Does this entrance have an attendant on duty?");
q.setAnsType(AnswerType.RADIOGROUP);
RadioGroupQuestion.Option o = q.new Option();
o.setId(1);
o.setDesc("Yes");
q.addOption(o);
o = q.new Option();
o.setId(2);
o.setDesc("No");
q.addOption(o);
st.addQuestion(q);
q = new RadioGroupQuestion();
q.setId(2);
q.setDesc("Does this entrance have a turnstile for people with disabilities?");
q.setAnsType(AnswerType.RADIOGROUP);
o = q.new Option();
o.setId(1);
o.setDesc("Yes");
q.addOption(o);
o = q.new Option();
o.setId(2);
o.setDesc("No");
q.addOption(o);
st.addQuestion(q);
SurveyStateHolder.addSurveyType(st);
}
private void addFoodVendorSurveyTypeObject() {
// TODO add surveytypes received from server
SurveyType st = new SurveyType();
st.setId(1);
st.setName("Food Vendor Survey");
st.setKind(SurveyKind.POINT);
RadioGroupQuestion q = new RadioGroupQuestion();
q.setId(1);
q.setDesc("What kind of vendor is this?");
q.setAnsType(AnswerType.RADIOGROUP);
RadioGroupQuestion.Option o = q.new Option();
o.setId(1);
o.setDesc("Hot Dog");
q.addOption(o);
o = q.new Option();
o.setId(2);
o.setDesc("Toronto a la Carte");
q.addOption(o);
o = q.new Option();
o.setId(3);
o.setDesc("Food Truck");
q.addOption(o);
st.addQuestion(q);
Question q2 = new Question();
q2.setId(2);
q2.setDesc("How much is the cheapest vegetarian option?");
q2.setAnsType(AnswerType.NUMBER);
st.addQuestion(q2);
SurveyStateHolder.addSurveyType(st);
}
private void addCyclePathSurveyTypeObject() {
// TODO add surveytypes received from server
SurveyType st = new SurveyType();
st.setId(1);
st.setName("Cycle Path Survey");
st.setKind(SurveyKind.PATH);
SurveyStateHolder.addSurveyType(st);
}
// for survey list
private class DownloadSurveyListXmlTask extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... urls) {
SurveyStateHolder.clearSurveyTypes();
try {
loadSurveyListXmlFromServer(urls[0]);
} catch (Exception e) {
Toast.makeText(ProjectListActivity.this, "Error while downloading survey list", Toast.LENGTH_LONG).show();
}
return null;
}
@Override
protected void onPostExecute(Void unused) {
new DownloadSurveyXmlTask().execute("http://urbaneyes-mcupak.rhcloud.com/rest/surveys/");
}
private void loadSurveyListXmlFromServer(String urlString)
throws Exception {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
InputStream stream = conn.getInputStream();
SurveyListXMLParser parser = new SurveyListXMLParser();
parser.parse(stream);
stream.close();
}
}
// for individual survey
private class DownloadSurveyXmlTask extends AsyncTask<String, Void, Void> {
SurveyType cst; // current survey type
@Override
protected Void doInBackground(String... urls) {
try {
for (SurveyType st : SurveyStateHolder.getSurveyTypes()) {
cst = st;
loadSurveyXmlFromServer(urls[0] + st.getId() + "/");
}
} catch (Exception e) {
ProjectListActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ProjectListActivity.this, "Error while downloading survey", Toast.LENGTH_LONG).show();
}
});
}
return null;
}
@Override
protected void onPostExecute(Void unused) {
pb.setVisibility(View.INVISIBLE);
ProjectListActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setListAdapter(new ArrayAdapter<String>(ProjectListActivity.this,
android.R.layout.simple_list_item_1, loadProjects()));
}
});
}
private void loadSurveyXmlFromServer(String urlString)
throws Exception {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
InputStream stream = conn.getInputStream();
SurveyXMLParser parser = new SurveyXMLParser(cst);
parser.parse(stream);
stream.close();
}
}
}
| [
"ravi_shashi@yahoo.com"
] | ravi_shashi@yahoo.com |
2e6fea19fbfd82748c7e1c2c1b5ba3262def0239 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_ea64da2d8afe86480a60cce75fb509855c318d82/Manager/2_ea64da2d8afe86480a60cce75fb509855c318d82_Manager_s.java | f9fabb835ca9358614a86ad8a0ea4c2697f7efd7 | [] | 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 | 10,856 | java | package com.scizzr.bukkit.plugins.pksystem.managers;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.scizzr.bukkit.plugins.pksystem.Main;
import com.scizzr.bukkit.plugins.pksystem.config.Config;
import com.scizzr.bukkit.plugins.pksystem.util.MoreMath;
@SuppressWarnings("unchecked")
public class Manager {
public static HashMap<String, Integer> points = new HashMap<String, Integer> ();
public static HashMap<Integer, ChatColor> color = new HashMap<Integer, ChatColor> ();
public static HashMap<Integer, String> name = new HashMap<Integer, String> ();
private static HashMap<Player, Boolean> isPK = new HashMap<Player, Boolean> ();
private static HashMap<Player, Boolean> isCrim = new HashMap<Player, Boolean> ();
private static HashMap<Player, Integer> farmTimer = new HashMap<Player, Integer> ();
private static HashMap<Player, Integer> pvpTimer = new HashMap<Player, Integer> ();
private static ConcurrentHashMap<Player, Integer> repTimer = new ConcurrentHashMap<Player, Integer> ();
private static HashMap<Player, Integer> spawnTimer = new HashMap<Player, Integer> ();
// Removed for now; might use this at a later time.
//private static HashMap<Player, Player> lastTarg = new HashMap<Player, Player> ();
public static void main() {
name.put(-4, "DEMON"); color.put(-4, ChatColor.DARK_RED);
name.put(-3, "RED"); color.put(-3, ChatColor.RED);
name.put(-2, "ORANGE"); color.put(-2, ChatColor.GOLD);
name.put(-1, "YELLOW"); color.put(-1, ChatColor.YELLOW);
name.put( 0, "WHITE"); color.put( 0, ChatColor.WHITE);
name.put( 1, "LIGHT BLUE"); color.put( 1, ChatColor.AQUA);
name.put( 2, "BLUE"); color.put( 2, ChatColor.BLUE);
name.put( 3, "PURPLE"); color.put( 3, ChatColor.LIGHT_PURPLE);
name.put( 4, "HERO"); color.put( 4, ChatColor.DARK_PURPLE);
}
public static boolean loadPoints() {
if(!Main.fileRep.exists()) {
try {
Main.fileRep.createNewFile();
Main.log.info(Main.prefixConsole + "Blank reputation.txt created");
} catch (Exception ex) {
Main.log.info(Main.prefixConsole + "Failed to make reputation.txt");
Main.suicide(ex);
}
}
HashMap<Player, Integer> tmp = (HashMap<Player, Integer>) points.clone();
try {
points.clear();
BufferedReader reader = new BufferedReader(new FileReader((Main.fileRep.getAbsolutePath())));
String line = reader.readLine();
while (line != null) {
String[] values = line.split(":");
if (values.length == 2) {
String play = values[0];
Integer pts = Integer.valueOf(values[1]);
if (play != null) {
points.put(play, pts);
}
}
line = reader.readLine();
}
return true;
} catch (Exception ex) {
points = (HashMap<String, Integer>) tmp.clone();
Main.suicide(ex);
return false;
}
}
public static boolean savePoints() {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter((Main.fileRep.getAbsolutePath())));
for (Entry<String, Integer> entry : points.entrySet()) {
writer.write(entry.getKey() + ":" + entry.getValue());
writer.newLine();
}
writer.close();
return true;
} catch (Exception ex) {
Main.suicide(ex);
return false;
}
}
public static void doRepTick() {
try {
Set<Player> listP = pvpTimer.keySet();
for (Player pp : listP) {
int get = getPvPTime(pp);
setPvPTime(pp, get-1);
}
} catch (Exception ex) {
Main.suicide(ex);
}
}
public static Integer getIndex(Integer pts) {
if (pts == null) { return 0; }
DecimalFormat twoDecForm = new DecimalFormat("#.##");
Double rep = Double.valueOf(twoDecForm.format(pts/1000));
if (Config.repSpecEnabled == true && Config.repSpecReach == true) {
if (rep <= -10000) { return -4; } // Demon at 1000 evil kills
if (rep >= 10000) { return 4; } // Hero at 1000 good kills
}
if (rep <= -150) {
return -3; // red
} else if (MoreMath.between(rep, -149.99, -90.0, true)) {
return -2; // orange
} else if (MoreMath.between(rep, -89.99, -30, true)) {
return -1; // yellow
} else if (MoreMath.between(rep, 30.0, 89.99, true)) {
return 1; // light blue
} else if (MoreMath.between(rep, 90.0, 149.99, true)) {
return 2; // blue
} else if (rep >= 150) {
return 3; // purple
} else /* if (Math.between(r, -29.9, 29.9))*/ {
return 0; // white
}
}
public static Integer getPoints(Player p) {
if (!points.containsKey(p.getName())) { return 0; }
return points.get(p.getName());
}
public static void setPoints(Player p, Integer pts) {
Integer pPtsOld = getPoints(p);
Integer pPtsNew = pts;
points.put(p.getName(), pts); savePoints();
if (!getIndex(pPtsOld).equals(getIndex(pPtsNew))) {
p.sendMessage(Main.prefix + "Your reputation is now " + getFormattedReputation(p));
}
}
public static String getDisplayName(Player p) {
String dn = color.get(getIndex(getPoints(p))) + p.getName();
if (dn.length() > 14) { dn = dn.substring(0, 14); }
return dn;
}
public static Double getReputation(Player p) {
if (!points.containsKey(p.getName())) { return 0.0; }
Integer pts = points.get(p.getName());
Double rep = MoreMath.pointsToRep(pts);
return rep != null ? rep : 0;
}
public static String getFormattedReputation(Player p) {
ChatColor col = color.get(getIndex(getPoints(p)));
return col + name.get(getIndex(getPoints(p))) + ChatColor.WHITE + " (" + getReputation(p) + ")";
}
public static String getName(Player p) {
ChatColor col = color.get(getIndex(getPoints(p)));
return col + p.getDisplayName();
}
public static boolean isNeutral(Player p) {
return getIndex(getPoints(p)) == 0;
}
public static boolean isDemon(Player p) {
return getIndex(getPoints(p)) == -4;
}
public static boolean isHero(Player p) {
return getIndex(getPoints(p)) == 4;
}
public static Integer getPvPTime(Player p) {
Integer ispvp = pvpTimer.get(p);
return ispvp != null ? ispvp : 0;
}
public static void setPvPTime(Player p, Integer i) {
if (Config.fmtCombEnabled == true) {
if (i == Config.combDuration && pvpTimer.get(p) == null) {
p.sendMessage(Main.prefix + Config.fmtCombEnter);
} else if (i == 0) {
if (p != null) {
if (p.isOnline()) {
p.sendMessage(Main.prefix + Config.fmtCombExit);
}
}
}
}
if (i > 0) {
pvpTimer.put(p, i);
} else {
pvpTimer.remove(p);
}
}
public static Integer getRepTime(Player p) {
Integer isrep = repTimer.get(p);
return isrep != null ? isrep : 0;
}
public static void setRepTime(Player p, Integer i) {
if (i > 0) {
repTimer.put(p, i);
} else {
repTimer.put(p, 0);
}
}
public static Integer getFarmTime(Player p) {
Integer isfarm = farmTimer.get(p);
return isfarm != null ? isfarm : 0;
}
public static void setFarmTime(Player p, Integer i) {
if (i > 0) {
farmTimer.put(p, i);
} else {
farmTimer.put(p, 0);
}
}
public static Integer getSpawnTime(Player p) {
Integer isspawn = spawnTimer.get(p);
return isspawn != null ? isspawn : 0;
}
public static void setSpawnTime(Player p, Integer i) {
if (i > 0) {
spawnTimer.put(p, i);
} else {
spawnTimer.put(p, 0);
}
}
// Removed for now; might use this at a later time.
//public static Player getLastTarget(Player p) {
// return lastTarg.get(p);
//}
//public static void setLastTarget(Player p, Player pp) {
// lastTarg.put(p, pp);
//}
public static boolean isPK(Player p) {
if (isPK.containsKey(p)) {
return isPK.get(p);
}
return false;
}
public static void setPK(Player p, boolean pk) {
p.sendMessage(Main.prefix + (pk == true ? Config.fmtPKEnter : Config.fmtPKExit));
isPK.put(p, pk);
}
public static boolean getCrim(Player p) {
if (isCrim.containsKey(p)) {
return isCrim.get(p);
}
return false;
}
public static void setCrim(Player p, boolean crim) {
isCrim.put(p, crim);
}
public static boolean isCombat(Player p) {
return getPvPTime(p) > 0;
}
public static boolean isFarm(Player p) {
return getFarmTime(p) + Config.repLimitDuration >= Config.repLimitAmount * Config.repLimitDuration;
}
public static boolean isRespawn(Player p) {
return spawnTimer.get(p) > 0;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
698866a955ff8087afae51ee77872a41ff8fff55 | 35b710e9bc210a152cc6cda331e71e9116ba478c | /tc-unused/src/main/java/com/topcoder/web/truveo/controller/TruveoServlet.java | 9bf52d65c91e2b481d2d67efee30949417649c36 | [] | no_license | appirio-tech/tc1-tcnode | d17649afb38998868f9a6d51920c4fe34c3e7174 | e05a425be705aca8f530caac1da907d9a6c4215a | refs/heads/master | 2023-08-04T19:58:39.617425 | 2016-05-15T00:22:36 | 2016-05-15T00:22:36 | 56,892,466 | 1 | 8 | null | 2022-04-05T00:47:40 | 2016-04-23T00:27:46 | Java | UTF-8 | Java | false | false | 2,608 | java | package com.topcoder.web.truveo.controller;
import com.topcoder.shared.util.TCResourceBundle;
import com.topcoder.shared.util.logging.Logger;
import com.topcoder.web.common.BaseServlet;
import com.topcoder.web.common.NavigationException;
import com.topcoder.web.common.PermissionException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.MissingResourceException;
/**
* @author dok
* @version $Revision: 70119 $ Date: 2005/01/01 00:00:00
* Create Date: Jun 22, 2006
*/
public class TruveoServlet extends BaseServlet {
private static final Logger log = Logger.getLogger(TruveoServlet.class);
static {
throttleEnabled = false;
}
/*
protected WebAuthentication createAuthentication(TCRequest request,
TCResponse response) throws Exception {
return new BasicAuthentication(new SessionPersistor(request.getSession()), request, response,
BasicAuthentication.OPENAIM_SITE);
}
*/
protected String getProcessor(String key) {
String ret = super.getProcessor(key);
if (ret.equals(key)) {
//yuck, gonna throw errors all over the place
TCResourceBundle bundle = new TCResourceBundle("Truveo");
try {
ret = bundle.getProperty(key);
} catch (MissingResourceException ignore) {
//just return what we got
}
}
return ret;
}
protected void handleException(HttpServletRequest request, HttpServletResponse response, Throwable e)
throws Exception {
log.error("caught exception, forwarding to error page", e);
if (e instanceof PermissionException) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
request.setAttribute(MESSAGE_KEY, "Sorry, you do not have permission to access the specified resource.");
} else if (e instanceof NavigationException) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
request.setAttribute(MESSAGE_KEY, e.getMessage());
if (((NavigationException) e).hasUrl())
request.setAttribute(URL_KEY, ((NavigationException) e).getUrl());
} else {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
request.setAttribute(MESSAGE_KEY, "An error has occurred when attempting to process your request.");
}
request.setAttribute("exception", e);
fetchRegularPage(request, response, ERROR_PAGE, true);
}
}
| [
"dongzhengbin@winterflames-MacBook-Pro.local"
] | dongzhengbin@winterflames-MacBook-Pro.local |
b84ead5537062fc04df2c191432b1c84f38fa27b | 31ef966f04500ba99ed2e320eea875d80c814ae2 | /src/InputHandler.java | cd7b6457811450f73e0ffc9f9e6e5bb95b7bf55b | [] | no_license | ankitshubham97/pp2 | d36afa0518904c08de03039dfbc48866960b0c1a | 67d606618f37a50ddff96b82bf9f57d7bd5b6b3b | refs/heads/master | 2021-01-01T04:33:44.442142 | 2016-04-30T09:34:44 | 2016-04-30T09:34:44 | 56,689,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,551 | java |
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ANKIT
*/
// this class is for handling the input (keystrokes) from player
public class InputHandler implements KeyListener{
Game game;
public InputHandler(Game game1){
game1.addKeyListener(this);
game = game1;
}
public void keyTyped(KeyEvent e) {
int keyCode = e.getKeyCode();
}
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if(keyCode == KeyEvent.VK_ESCAPE){
System.exit(0);
}
if(keyCode == KeyEvent.VK_SPACE && game.gameRunning){
game.gameRunning = false;
}
else if(keyCode == KeyEvent.VK_SPACE && !game.gameRunning ){
game.start();
}
if(keyCode == KeyEvent.VK_W){
Game.player.goingUp = true;
}
if(keyCode == KeyEvent.VK_S){
Game.player.goingDown = true;
}
if(keyCode == KeyEvent.VK_UP){
Game.ai.goingUp = true;
}
if(keyCode == KeyEvent.VK_DOWN){
Game.ai.goingDown = true;
}
if(keyCode == KeyEvent.VK_A){
Game.playerup.goingLeft = true;
}
if(keyCode == KeyEvent.VK_D){
Game.playerup.goingRight = true;
}
if(keyCode == KeyEvent.VK_A){
Game.playerdown.goingLeft = true;
}
if(keyCode == KeyEvent.VK_D){
Game.playerdown.goingRight = true;
}
}
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if(keyCode == KeyEvent.VK_W){
Game.player.goingUp = false;
}
if(keyCode == KeyEvent.VK_S){
Game.player.goingDown = false;
}
if(keyCode == KeyEvent.VK_UP){
Game.ai.goingUp = false;
}
if(keyCode == KeyEvent.VK_DOWN){
Game.ai.goingDown = false;
}
if(keyCode == KeyEvent.VK_A){
Game.playerup.goingLeft = false;
}
if(keyCode == KeyEvent.VK_D){
Game.playerup.goingRight = false;
}
if(keyCode == KeyEvent.VK_A){
Game.playerdown.goingLeft = false;
}
if(keyCode == KeyEvent.VK_D){
Game.playerdown.goingRight = false;
}
}
}
| [
"ankitshubham97@gmail.com"
] | ankitshubham97@gmail.com |
8ca4476b40a3d3348f57a0c7e648ecdc6053f99c | f7f520f98cd27967e06143af218640bc4278808e | /src/main/java/FAAuthenticator/TimeBasedOneTimePasswordUtil.java | 5772614484edf4f225c60a731794ed9123e6b4ae | [] | no_license | thinhlv/two-factor-authen-generator | 067e626f5a62a25b6ebb3dd2c925fa8e0ce83f22 | 6686d89819a2140791663acd05aa30a71d47b3b8 | refs/heads/master | 2021-05-06T07:58:07.426684 | 2017-12-12T10:41:14 | 2017-12-12T10:41:14 | 113,976,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,178 | java | package FAAuthenticator;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
* Java implementation for the Time-based One-Time Password (TOTP) two factor authentication algorithm. To get this to
* work you:
*
* <ol>
* <li>Use generateBase32Secret() to generate a secret key for a user.</li>
* <li>Store the secret key in the database associated with the user account.</li>
* <li>Display the QR image URL returned by qrImageUrl(...) to the user.</li>
* <li>User uses the image to load the secret key into his authenticator application.</li>
* </ol>
*
* <p>
* Whenever the user logs in:
* </p>
*
* <ol>
* <li>The user enters the number from the authenticator application into the login form.</li>
* <li>Read the secret associated with the user account from the database.</li>
* <li>The server compares the user input with the output from generateCurrentNumber(...).</li>
* <li>If they are equal then the user is allowed to log in.</li>
* </ol>
*
* <p>
* See: https://github.com/j256/two-factor-auth
* </p>
*
* <p>
* For more details about this magic algorithm, see: http://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm
* </p>
*
* @author graywatson
*/
public class TimeBasedOneTimePasswordUtil {
/** default time-step which is part of the spec, 30 seconds is default */
public static final int DEFAULT_TIME_STEP_SECONDS = 30;
/** set to the number of digits to control 0 prefix, set to 0 for no prefix */
private static int NUM_DIGITS_OUTPUT = 6;
private static final String blockOfZeros;
static {
char[] chars = new char[NUM_DIGITS_OUTPUT];
for (int i = 0; i < chars.length; i++) {
chars[i] = '0';
}
blockOfZeros = new String(chars);
}
/**
* Generate and return a 16-character secret key in base32 format (A-Z2-7) using {@link SecureRandom}. Could be used
* to generate the QR image to be shared with the user. Other lengths should use {@link #generateBase32Secret(int)}.
*/
public static String generateBase32Secret() {
return generateBase32Secret(16);
}
/**
* Similar to {@link #generateBase32Secret()} but specifies a character length.
*/
public static String generateBase32Secret(int length) {
StringBuilder sb = new StringBuilder(length);
Random random = new SecureRandom();
for (int i = 0; i < length; i++) {
int val = random.nextInt(32);
if (val < 26) {
sb.append((char) ('A' + val));
} else {
sb.append((char) ('2' + (val - 26)));
}
}
return sb.toString();
}
/**
* Validate a given secret-number using the secret base-32 string. This allows you to set a window in milliseconds to
* account for people being close to the end of the time-step. For example, if windowMillis is 10000 then this method
* will check the authNumber against the generated number from 10 seconds before now through 10 seconds after now.
*
* <p>
* WARNING: This requires a system clock that is in sync with the world.
* </p>
*
* @param base32Secret
* Secret string encoded using base-32 that was used to generate the QR code or shared with the user.
* @param authNumber
* Time based number provided by the user from their authenticator application.
* @param windowMillis
* Number of milliseconds that they are allowed to be off and still match. This checks before and after
* the current time to account for clock variance. Set to 0 for no window.
* @return True if the authNumber matched the calculated number within the specified window.
*/
public static boolean validateCurrentNumber(String base32Secret, int authNumber, int windowMillis)
throws GeneralSecurityException {
return validateCurrentNumber(base32Secret, authNumber, windowMillis, System.currentTimeMillis(),
DEFAULT_TIME_STEP_SECONDS);
}
/**
* Similar to {@link #validateCurrentNumber(String, int, int)} except exposes other parameters. Mostly for testing.
*
* @param base32Secret
* Secret string encoded using base-32 that was used to generate the QR code or shared with the user.
* @param authNumber
* Time based number provided by the user from their authenticator application.
* @param windowMillis
* Number of milliseconds that they are allowed to be off and still match. This checks before and after
* the current time to account for clock variance. Set to 0 for no window.
* @param timeMillis
* Time in milliseconds.
* @param timeStepSeconds
* Time step in seconds. The default value is 30 seconds here. See {@link #DEFAULT_TIME_STEP_SECONDS}.
* @return True if the authNumber matched the calculated number within the specified window.
*/
public static boolean validateCurrentNumber(String base32Secret, int authNumber, int windowMillis, long timeMillis,
int timeStepSeconds) throws GeneralSecurityException {
long from = timeMillis;
long to = timeMillis;
if (windowMillis > 0) {
from -= windowMillis;
to += windowMillis;
}
long timeStepMillis = timeStepSeconds * 1000;
for (long millis = from; millis <= to; millis += timeStepMillis) {
long compare = generateNumber(base32Secret, millis, timeStepSeconds);
if (compare == authNumber) {
return true;
}
}
return false;
}
/**
* Return the current number to be checked. This can be compared against user input.
*
* <p>
* WARNING: This requires a system clock that is in sync with the world.
* </p>
*
* @param base32Secret
* Secret string encoded using base-32 that was used to generate the QR code or shared with the user.
* @return A number as a string with possible leading zeros which should match the user's authenticator application
* output.
*/
public static String generateCurrentNumberString(String base32Secret) throws GeneralSecurityException {
return generateNumberString(base32Secret, System.currentTimeMillis(), DEFAULT_TIME_STEP_SECONDS);
}
/**
* Similar to {@link #generateCurrentNumberString(String)} except exposes other parameters. Mostly for testing.
*
* @param base32Secret
* Secret string encoded using base-32 that was used to generate the QR code or shared with the user.
* @param timeMillis
* Time in milliseconds.
* @param timeStepSeconds
* Time step in seconds. The default value is 30 seconds here. See {@link #DEFAULT_TIME_STEP_SECONDS}.
* @return A number as a string with possible leading zeros which should match the user's authenticator application
* output.
*/
public static String generateNumberString(String base32Secret, long timeMillis, int timeStepSeconds)
throws GeneralSecurityException {
long number = generateNumber(base32Secret, timeMillis, timeStepSeconds);
return zeroPrepend(number, NUM_DIGITS_OUTPUT);
}
/**
* Similar to {@link #generateCurrentNumberString(String)} but this returns a long instead of a string.
*
* @return A number which should match the user's authenticator application output.
*/
public static long generateCurrentNumber(String base32Secret) throws GeneralSecurityException {
return generateNumber(base32Secret, System.currentTimeMillis(), DEFAULT_TIME_STEP_SECONDS);
}
/**
* Similar to {@link #generateNumberString(String, long, int)} but this returns a long instead of a string.
*
* @return A number which should match the user's authenticator application output.
*/
public static long generateNumber(String base32Secret, long timeMillis, int timeStepSeconds)
throws GeneralSecurityException {
byte[] key = decodeBase32(base32Secret);
byte[] data = new byte[8];
long value = timeMillis / 1000 / timeStepSeconds;
for (int i = 7; value > 0; i--) {
data[i] = (byte) (value & 0xFF);
value >>= 8;
}
// encrypt the data with the key and return the SHA1 of it in hex
SecretKeySpec signKey = new SecretKeySpec(key, "HmacSHA1");
// if this is expensive, could put in a thread-local
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(signKey);
byte[] hash = mac.doFinal(data);
// take the 4 least significant bits from the encrypted string as an offset
int offset = hash[hash.length - 1] & 0xF;
// We're using a long because Java hasn't got unsigned int.
long truncatedHash = 0;
for (int i = offset; i < offset + 4; ++i) {
truncatedHash <<= 8;
// get the 4 bytes at the offset
truncatedHash |= (hash[i] & 0xFF);
}
// cut off the top bit
truncatedHash &= 0x7FFFFFFF;
// the token is then the last 6 digits in the number
truncatedHash %= 1000000;
return truncatedHash;
}
/**
* Return the QR image url thanks to Google. This can be shown to the user and scanned by the authenticator program
* as an easy way to enter the secret.
*
* @param keyId
* Name of the key that you want to show up in the users authentication application. Should already be
* URL encoded.
* @param secret
* Secret string that will be used when generating the current number.
*/
public static String qrImageUrl(String keyId, String secret) {
StringBuilder sb = new StringBuilder(128);
sb.append("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=");
addOtpAuthPart(keyId, secret, sb);
return sb.toString();
}
/**
* Return the otp-auth part of the QR image which is suitable to be injected into other QR generators (e.g. JS
* generator).
*
* @param keyId
* Name of the key that you want to show up in the users authentication application. Should already be
* URL encoded.
* @param secret
* Secret string that will be used when generating the current number.
*/
public static String generateOtpAuthUrl(String keyId, String secret) {
StringBuilder sb = new StringBuilder(64);
addOtpAuthPart(keyId, secret, sb);
return sb.toString();
}
private static void addOtpAuthPart(String keyId, String secret, StringBuilder sb) {
sb.append("otpauth://totp/").append(keyId).append("%3Fsecret%3D").append(secret);
}
/**
* Return the string prepended with 0s. Tested as 10x faster than String.format("%06d", ...); Exposed for testing.
*/
static String zeroPrepend(long num, int digits) {
String numStr = Long.toString(num);
if (numStr.length() >= digits) {
return numStr;
} else {
StringBuilder sb = new StringBuilder(digits);
int zeroCount = digits - numStr.length();
sb.append(blockOfZeros, 0, zeroCount);
sb.append(numStr);
return sb.toString();
}
}
/**
* Decode base-32 method. I didn't want to add a dependency to Apache Codec just for this decode method. Exposed for
* testing.
*/
static byte[] decodeBase32(String str) {
// each base-32 character encodes 5 bits
int numBytes = ((str.length() * 5) + 7) / 8;
byte[] result = new byte[numBytes];
int resultIndex = 0;
int which = 0;
int working = 0;
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
int val;
if (ch >= 'a' && ch <= 'z') {
val = ch - 'a';
} else if (ch >= 'A' && ch <= 'Z') {
val = ch - 'A';
} else if (ch >= '2' && ch <= '7') {
val = 26 + (ch - '2');
} else if (ch == '=') {
// special case
which = 0;
break;
} else {
throw new IllegalArgumentException("Invalid base-32 character: " + ch);
}
/*
* There are probably better ways to do this but this seemed the most straightforward.
*/
switch (which) {
case 0:
// all 5 bits is top 5 bits
working = (val & 0x1F) << 3;
which = 1;
break;
case 1:
// top 3 bits is lower 3 bits
working |= (val & 0x1C) >> 2;
result[resultIndex++] = (byte) working;
// lower 2 bits is upper 2 bits
working = (val & 0x03) << 6;
which = 2;
break;
case 2:
// all 5 bits is mid 5 bits
working |= (val & 0x1F) << 1;
which = 3;
break;
case 3:
// top 1 bit is lowest 1 bit
working |= (val & 0x10) >> 4;
result[resultIndex++] = (byte) working;
// lower 4 bits is top 4 bits
working = (val & 0x0F) << 4;
which = 4;
break;
case 4:
// top 4 bits is lowest 4 bits
working |= (val & 0x1E) >> 1;
result[resultIndex++] = (byte) working;
// lower 1 bit is top 1 bit
working = (val & 0x01) << 7;
which = 5;
break;
case 5:
// all 5 bits is mid 5 bits
working |= (val & 0x1F) << 2;
which = 6;
break;
case 6:
// top 2 bits is lowest 2 bits
working |= (val & 0x18) >> 3;
result[resultIndex++] = (byte) working;
// lower 3 bits of byte 6 is top 3 bits
working = (val & 0x07) << 5;
which = 7;
break;
case 7:
// all 5 bits is lower 5 bits
working |= (val & 0x1F);
result[resultIndex++] = (byte) working;
which = 0;
break;
}
}
if (which != 0) {
result[resultIndex++] = (byte) working;
}
if (resultIndex != result.length) {
result = Arrays.copyOf(result, resultIndex);
}
return result;
}
}
| [
"thinhnguyen@squarebit.studio"
] | thinhnguyen@squarebit.studio |
758d5969d344656cc0795ecea4f0f18e854afa35 | fed35f113f73a5e8c7d6ff2da0c343bc0732f8ab | /src/main/java/com/example/patrycja/filmbase/DTO/DirectorDTO.java | 7772c79dee36effa909c6083648c598d2fa173a6 | [] | no_license | patsaf/Filmbase | 4964a82b780c70038116769747fab2d523d726e8 | 9e66fc4f7f4bec8180c42fe7ae6058e23cabc9a3 | refs/heads/master | 2021-01-25T00:38:27.251545 | 2018-04-22T11:24:48 | 2018-04-22T11:24:48 | 123,301,352 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,298 | java | package com.example.patrycja.filmbase.DTO;
import com.example.patrycja.filmbase.model.Director;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
@Data
@NoArgsConstructor
public class DirectorDTO {
private long id;
private String firstName;
private String lastName;
private LocalDate dateOfBirth;
private List<FilmBriefDTO> films;
private double rate;
private long count;
public DirectorDTO(Director director) {
this.id = director.getId();
this.firstName = director.getFirstName();
this.lastName = director.getLastName();
this.dateOfBirth = director.getDateOfBirth();
films = new ArrayList<>();
director.getFilms()
.forEach(film -> films.add(new FilmBriefDTO(film)));
this.rate = director.getRate();
this.count = director.getCount();
}
public Boolean checkIfDataEquals(DirectorDTO directorDTO) {
return firstName.equals(directorDTO.getFirstName()) &&
lastName.equals(directorDTO.getLastName()) &&
dateOfBirth == directorDTO.getDateOfBirth() &&
rate == directorDTO.getRate() &&
count == directorDTO.getCount();
}
}
| [
"patrycja.saferna@gmail.com"
] | patrycja.saferna@gmail.com |
82024ae843d1ee45cfeececed9baf636d413703f | 790acc3098ac96e0b4536f2498d0013dbf0b8624 | /Decorator_pattern/src/decorator_pattern_shapes/Main.java | 943cbcb38fbab98ad7538f97ae8cbfc43e1468e3 | [] | no_license | jdnepr/coursera_exercises | 8accb789c0b64a49f6309105e234258394489f01 | 64303137aa2d488fd9c1829f68d7a403219b6ade | refs/heads/master | 2021-05-20T23:34:43.330725 | 2020-04-02T15:22:36 | 2020-04-02T15:22:36 | 252,454,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package decorator_pattern_shapes;
public class Main {
public static void main(String[] args) {
Shape circle = new Circle();
Shape redCircle = new RedShapeBorderDecorator(new Circle());
Shape redRectangle = new RedShapeBorderDecorator(new Rectangle());
System.out.println("Circle with normal border");
circle.draw();
System.out.println("\nCircle of red border");
redCircle.draw();
System.out.println("\nRectangle of red border");
redRectangle.draw();
}
}
| [
"vj2007@ukr.net"
] | vj2007@ukr.net |
b0b2c2ce11bb2373d2f3560b7328927078c72018 | 00b8aeb4ebf37a854f7f5c19358aab1a0f14facd | /Test/src/ch5/sec10/StaticDemo01.java | e7f1159fccfd8156856163bd02388800a633e865 | [] | no_license | zhouguangyuan/JavaLXH | 19ef0e74b8cc0bd9ea699fb93abfda7ecf49ce06 | 85d2433649c006a89e3c4d05784071caa9962392 | refs/heads/master | 2021-07-08T08:43:39.397706 | 2020-10-05T11:39:02 | 2020-10-05T11:39:02 | 196,349,791 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package ch5.sec10;
/**
* @author Kelvin
* @version 2020年8月22日 下午8:15:27
* @class instruction
*/
class Person {
String name;
int age;
static String country = "A city";
public Person() {
// TODO Auto-generated constructor stub
}
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getInfo() {
return "Name:" + this.getName() + "; Age:" + this.getAge() + "; City:"
+ this.getCountry();
}
}
public class StaticDemo01 {
public static void main(String[] args) {
Person per1 = new Person("Zhangsan", 20);
Person per2 = new Person("lisi", 23);
Person per3 = new Person("wanger", 26);
System.out.println(per1.getInfo());
System.out.println(per2.getInfo());
System.out.println(per3.getInfo());
}
}
| [
"kevinsoft@126.com"
] | kevinsoft@126.com |
0b6d41e26935f44b2406a4f2f6e74480b700b198 | d82c1b768e5c40a2df1eafd2b1b65f9304a5f217 | /src/com/sbs/example/util/Util.java | 89d570cb02c28390431d6d37b23c0b9138a8eeb1 | [] | no_license | ty01059/jspCommunity_y | 3de093e8c08f1a558aa86ae3757ddd6896f66ff4 | 97282a06e21ab1eba36859622b70ba79adb1e820 | refs/heads/master | 2023-03-05T04:48:45.308842 | 2021-02-18T04:36:27 | 2021-02-18T04:36:27 | 324,883,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,438 | java | package com.sbs.example.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.HttpServletRequest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class Util {
public static Map getJsonMapFromFile(InputStream is) {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readValue(is, Map.class);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static String getJsonText(Object obj) {
ObjectMapper mapper = new ObjectMapper();
String rs = "";
try {
rs = mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return rs;
}
public static int sendMail(String smtpServerId, String smtpServerPw, String from, String fromName, String to, String title, String body) {
Properties prop = System.getProperties();
prop.put("mail.smtp.starttls.enable", "true");
prop.put("mail.smtp.host", "smtp.gmail.com");
prop.put("mail.smtp.auth", "true");
prop.put("mail.smtp.port", "587");
Authenticator auth = new MailAuth(smtpServerId, smtpServerPw);
Session session = Session.getDefaultInstance(prop, auth);
MimeMessage msg = new MimeMessage(session);
try {
msg.setSentDate(new Date());
msg.setFrom(new InternetAddress(from, fromName));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(title, "UTF-8");
msg.setContent(body, "text/html; charset=UTF-8");
Transport.send(msg);
} catch (AddressException ae) {
System.out.println("AddressException : " + ae.getMessage());
return -1;
} catch (MessagingException me) {
System.out.println("MessagingException : " + me.getMessage());
return -2;
} catch (UnsupportedEncodingException e) {
System.out.println("UnsupportedEncodingException : " + e.getMessage());
return -3;
}
return 1;
}
public static String getTempPassword(int length) {
int index = 0;
char[] charArr = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
index = (int) (charArr.length * Math.random());
sb.append(charArr[index]);
}
return sb.toString();
}
//
public static String sha256(String base) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(base.getBytes("UTF-8"));
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < hash.length; i++) {
String hex = Integer.toHexString(0xff & hash[i]);
if (hex.length() == 1)
hexString.append('0');
hexString.append(hex);
}
return hexString.toString();
} catch (Exception ex) {
return "";
}
}
public static int getAsInt(Object value, int defaultValue) {
if (value instanceof Integer) {
return (int) value;
} else if (value instanceof Long) {
return Long.valueOf((long) value).intValue();
} else if (value instanceof Float) {
return Float.valueOf((float) value).intValue();
} else if (value instanceof Double) {
return Double.valueOf((double) value).intValue();
} else if (value instanceof String) {
try {
return Integer.parseInt((String) value);
} catch (NumberFormatException e) {
}
}
return defaultValue;
}
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String) {
if (((String) obj).trim().length() == 0) {
return true;
}
}
return false;
}
public static String getUrlEncoded(String url) {
try {
return URLEncoder.encode(url, "UTF-8");
} catch (UnsupportedEncodingException e) {
return url;
}
}
public static String getNowDateStr() {
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = format1.format(System.currentTimeMillis());
return dateStr;
}
public static int getPassedSecondsFrom(String from) {
SimpleDateFormat fDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date n;
try {
n = fDate.parse(from);
} catch (ParseException e) {
return -1;
}
return (int) ((new Date().getTime() - n.getTime()) / 1000);
}
public static String getNewUriRemoved(String url, String paramName) {
String deleteStrStarts = paramName + "=";
int delStartPos = url.indexOf(deleteStrStarts);
if (delStartPos != -1) {
int delEndPos = url.indexOf("&", delStartPos);
if (delEndPos != -1) {
delEndPos++;
url = url.substring(0, delStartPos) + url.substring(delEndPos, url.length());
} else {
url = url.substring(0, delStartPos);
}
}
if (url.charAt(url.length() - 1) == '?') {
url = url.substring(0, url.length() - 1);
}
if (url.charAt(url.length() - 1) == '&') {
url = url.substring(0, url.length() - 1);
}
return url;
}
public static String getNewUrl(String url, String paramName, String paramValue) {
url = getNewUriRemoved(url, paramName);
if (url.contains("?")) {
url += "&" + paramName + "=" + paramValue;
} else {
url += "?" + paramName + "=" + paramValue;
}
url = url.replace("?&", "?");
return url;
}
public static String getNewUrlAndEncoded(String url, String paramName, String pramValue) {
return getUrlEncoded(getNewUrl(url, paramName, pramValue));
}
public static Map<String, Object> getParamMap(HttpServletRequest request) {
Map<String, Object> param = new HashMap<>();
Enumeration<String> parameterNames = request.getParameterNames();
while (parameterNames.hasMoreElements()) {
String paramName = parameterNames.nextElement();
Object paramValue = request.getParameter(paramName);
param.put(paramName, paramValue);
}
return param;
}
} | [
"ty01059@gmail.com"
] | ty01059@gmail.com |
bacd122dbac1093f4cf13c5f7e1f4af7f55a9d57 | 829cec01de0eee06d15fc79cfa9de22d6fa903dd | /sceweb/src/br/sceweb/servico/FabricaDeConexoes.java | fca97600f0f7b1c06db46c26a3b1da34a8bf8a8b | [] | no_license | Jorge-Lucas/fateczl | c36606e2996ddbf2215f168ad6ef764a94f40734 | fb1783fd50b2e28479de5dcd51caf7219b15b1ee | refs/heads/master | 2016-08-12T19:56:41.039532 | 2016-04-01T19:05:28 | 2016-04-01T19:05:28 | 55,255,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package br.sceweb.servico;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.log4j.Logger;
public class FabricaDeConexoes {
Logger logger = Logger.getLogger(FabricaDeConexoes.class);
public Connection getConnection() {
String url = "jdbc:mysql://localhost/sceweb";
try {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection(url, "root", "aluno");
} catch (SQLException | ClassNotFoundException e) {
logger.info("SQLException na classe FabricaDeConexoes causa: " + e.getMessage());
throw new RuntimeException(e);
}
}
}
| [
"snalucard@hotmail.com"
] | snalucard@hotmail.com |
7be59e7a6443cd5821cf4550d72a78b56e59152f | 0a435b4f97c4b529e6153f512da627c9f54ca540 | /GeekBrains_Java1/GraphicCalculator.java | a77fb3a94e97b226984316e1ea70696228a50958 | [] | no_license | jvprojects/JavaCourses | 56c16a0fce3dd0e6e83628531a756f257b1cd994 | a928a17208876c9a5ad32af12ebe834c0f01dfd3 | refs/heads/master | 2021-01-17T05:54:26.472809 | 2016-09-20T23:37:51 | 2016-09-20T23:37:51 | 68,760,090 | 0 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 18,783 | java | /**
* @author Kitaev Boris
* @version 1.0 dated 21 Sep 2016
*/
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
class GraphicCalculator extends JFrame {
// Some calculator constants
private final byte MAIN_SCREEN = 0;
private final byte EXTRA_SCREEN = 1;
private final byte MAIN_SCREEN_MAX_SYMBOLS = 15; // max chars on main (big) screen.
private final byte MAX_OPERATIONS = 64; // max operations count (64 by default but might be more).
// primitives
private byte storedCount = 0; // stored number of arithmetic operations
private char lastOperation = 0; // last arithmetic operation
private boolean dotUsed = false; // is dot was type on the big screen
private boolean isDecimal = false; // is digit was last typed symbol
private char[] storedOperation = new char[MAX_OPERATIONS]; // stored operators like divide, multiplication, substraction etc.
private double[] storedNumber = new double[MAX_OPERATIONS]; // stored operands. every operand has own operator (same indexes).
private boolean[] hasItem = new boolean[MAX_OPERATIONS]; // Is the current index and has an item (operator+operand)
// objects
private StringBuilder[] screenBuffer = new StringBuilder[]{ new StringBuilder(), new StringBuilder() }; // buffers of 2 both displays
/* displays must be exactly JTextField because of text copy and extension out of calculator bounds with possible to scroll it with mouse (by using selection) */
private JTextField[] outputArea = { new JTextField("0", SwingConstants.RIGHT), new JTextField("", SwingConstants.RIGHT) };
private JPanel buttonPanel = new JPanel(new GridLayout(5,4)); // panel with buttons with grid layout
private JButton[] cDigits = new JButton[20];
public static void main(String[] args) {
new GraphicCalculator();
}
GraphicCalculator() {
// setup calculator components
setupWindow();
setupButtons();
setupMainDisplay();
setupExtraDisplay();
// show the calculator
setVisible(true);
}
void setupWindow() {
setTitle("Calculator");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setBounds(200, 200, 349, 558); // start x, start y, width, height
setBackground(new Color(255, 255, 255));
setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
setLayout(null);
setResizable(false);
setIconImage(new ImageIcon("icon.png").getImage());
}
void setupMainDisplay() {
outputArea[MAIN_SCREEN].setSize(343, 38);
outputArea[MAIN_SCREEN].setLocation(0, 26);
outputArea[MAIN_SCREEN].setEditable(false);
outputArea[MAIN_SCREEN].setBackground(new Color(235, 235, 235));
outputArea[MAIN_SCREEN].setHorizontalAlignment(JTextField.RIGHT);
outputArea[MAIN_SCREEN].setFont(new Font("Arial", Font.LAYOUT_RIGHT_TO_LEFT, 30));
add(outputArea[MAIN_SCREEN]);
}
void setupExtraDisplay() {
outputArea[EXTRA_SCREEN].setSize(343, 27);
outputArea[EXTRA_SCREEN].setEditable(false);
outputArea[EXTRA_SCREEN].setBackground(new Color(245, 245, 245));
outputArea[EXTRA_SCREEN].setHorizontalAlignment(JTextField.RIGHT);
outputArea[EXTRA_SCREEN].setFont(new Font("Arial", Font.LAYOUT_RIGHT_TO_LEFT, 18));
add(outputArea[EXTRA_SCREEN]);
}
void setupButtons() {
/* must be set before setting buttons */
setupButtonsPanel();
final char digitalGrid[] = { 'C', '\u221a', '\u00ab', '\u00f7',
'7', '8', '9', '\u00d7',
'4', '5', '6', '-',
'1', '2', '3', '+',
'±', '0', '.', '=' };
for(byte i = 0; i < digitalGrid.length; i++) {
cDigits[i] = new JButton(Character.toString(digitalGrid[i]));
cDigits[i].setBorder(new EtchedBorder());
cDigits[i].setBackground(new Color(225, 225, 225));
cDigits[i].setForeground(new Color(64, 64, 64));
cDigits[i].setFocusPainted(false);
cDigits[i].setFont(new Font("Serif", Font.BOLD, i == 1 ? 33 : 40));
setupListener(cDigits[i]);
buttonPanel.add(cDigits[i]);
add(buttonPanel);
}
}
void setupButtonsPanel() {
buttonPanel.setSize(345, 460);
buttonPanel.setLocation(0, 64);
}
void setupListener(JButton button) {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
char pressedButton = event.getActionCommand().charAt(0);
if(pressedButton >= '0' && pressedButton <= '9') {
digitsHandler(pressedButton);
} else {
operationsHandler(pressedButton);
}
}
});
}
void digitsHandler(char digit) {
if(getScreenSymbolsNum(MAIN_SCREEN) >= MAIN_SCREEN_MAX_SYMBOLS) return;
if(getScreenSymbolsNum(MAIN_SCREEN) == 1 && screenBuffer[MAIN_SCREEN].charAt(0) == '0') {
if(digit == '0') {
return;
}
if(digit == '.') {
screenBuffer[MAIN_SCREEN].append(digit);
updateScreen(MAIN_SCREEN, screenBuffer[MAIN_SCREEN].toString());
} else {
isDecimal = true;
screenBuffer[MAIN_SCREEN].replace(0, 1, String.valueOf(digit));
updateScreen(MAIN_SCREEN, screenBuffer[MAIN_SCREEN].toString());
}
return;
}
isDecimal = true;
screenBuffer[MAIN_SCREEN].append(digit);
updateScreen(MAIN_SCREEN, screenBuffer[MAIN_SCREEN].toString());
}
void operationsHandler(char operation) {
switch(operation) {
case '\u00ab': // backspace
backspaceHandler();
break;
case 'C':
setDefaults();
break;
case '±':
plusMinusHandler();
break;
case '\u221a': // square root
squareRootHandler();
break;
case '.':
dotHandler();
break;
case '\u00f7': // division
divisionHandler();
break;
case '\u00d7': // multiplication
multiplicationHandler();
break;
case '+':
additionHandler();
break;
case '-':
substractionHandler();
break;
case '=':
resultHandler();
break;
}
}
void dotHandler() {
if(dotUsed) return;
if(getScreenSymbolsNum(MAIN_SCREEN) == 0) digitsHandler('0');
dotUsed = true;
digitsHandler('.');
}
void divisionHandler() {
if(storedCount >= MAX_OPERATIONS) return;
if(!isDecimal && getScreenSymbolsNum(EXTRA_SCREEN) > 0) {
replaceLastOperation('\u00f7');
updateScreen(EXTRA_SCREEN);
return;
}
double currentValue = getScreenSymbolsNum(MAIN_SCREEN) != 0 ? Double.parseDouble(screenBuffer[MAIN_SCREEN].toString()) : 0.0d;
if(currentValue == 0.0d && getScreenSymbolsNum(EXTRA_SCREEN) > 0) {
showResult("Cannot divide by zero");
return;
}
if(!pushValueToBuffer(currentValue, '\u00f7')) return;
clearInfoOnMainScreen();
lastOperation = '\u00f7';
pushValueToStack(currentValue, lastOperation);
}
void multiplicationHandler() {
if(storedCount >= MAX_OPERATIONS) return;
if(!isDecimal && getScreenSymbolsNum(EXTRA_SCREEN) > 0) {
replaceLastOperation('\u00d7');
updateScreen(EXTRA_SCREEN);
return;
}
double currentValue = getScreenSymbolsNum(MAIN_SCREEN) != 0 ? Double.parseDouble(screenBuffer[MAIN_SCREEN].toString()) : 0.0d;
if(!pushValueToBuffer(currentValue, '\u00d7')) return;
clearInfoOnMainScreen();
lastOperation = '\u00d7';
pushValueToStack(currentValue, lastOperation);
}
void substractionHandler() {
if(storedCount >= MAX_OPERATIONS) return;
if(!isDecimal && getScreenSymbolsNum(EXTRA_SCREEN) > 0) {
replaceLastOperation('-');
updateScreen(EXTRA_SCREEN);
return;
}
double currentValue = getScreenSymbolsNum(MAIN_SCREEN) != 0 ? Double.parseDouble(screenBuffer[MAIN_SCREEN].toString()) : 0.0d;
if(!pushValueToBuffer(currentValue, '-')) return;
clearInfoOnMainScreen();
lastOperation = '-';
pushValueToStack(currentValue, lastOperation);
}
void additionHandler() {
if(storedCount >= MAX_OPERATIONS) return;
if(!isDecimal && getScreenSymbolsNum(EXTRA_SCREEN) > 0) {
replaceLastOperation('+');
updateScreen(EXTRA_SCREEN);
return;
}
double currentValue = getScreenSymbolsNum(MAIN_SCREEN) != 0 ? Double.parseDouble(screenBuffer[MAIN_SCREEN].toString()) : 0.0d;
if(!pushValueToBuffer(currentValue, '+')) return;
clearInfoOnMainScreen();
lastOperation = '+';
pushValueToStack(currentValue, lastOperation);
}
void plusMinusHandler() {
switch(getScreenSymbolsNum(MAIN_SCREEN)) {
case 0: return;
case 1:
if(screenBuffer[MAIN_SCREEN].charAt(0) == '0') {
return;
}
break;
case 2:
if(screenBuffer[MAIN_SCREEN].charAt(0) == '0' && screenBuffer[MAIN_SCREEN].charAt(1) == '.') {
return;
}
break;
}
double currentValue = Double.parseDouble(screenBuffer[MAIN_SCREEN].toString());
if(currentValue == 0.0d) {
return;
}
currentValue *= -1.0d;
if(currentValue < 0.0d) {
screenBuffer[MAIN_SCREEN].insert(0, '-');
} else {
screenBuffer[MAIN_SCREEN].replace(0, 1, "");
}
updateScreen(MAIN_SCREEN);
}
void squareRootHandler() {
if(lastOperation > 0) {
resultHandler();
String result = outputArea[MAIN_SCREEN].getText();
if(!isNumeric(result)) {
return;
}
showResult(Math.sqrt(Double.parseDouble(result)));
return;
} else {
switch(getScreenSymbolsNum(MAIN_SCREEN)) {
case 0:
showResult(Math.sqrt(Double.parseDouble(outputArea[MAIN_SCREEN].getText())));
return;
case 1:
if(screenBuffer[MAIN_SCREEN].charAt(0) == '0') {
return;
}
break;
case 2:
if(screenBuffer[MAIN_SCREEN].charAt(0) == '0' && screenBuffer[MAIN_SCREEN].charAt(1) == '.') {
return;
}
break;
}
showResult(Math.sqrt(Double.parseDouble(screenBuffer[MAIN_SCREEN].toString())));
}
}
void resultHandler() {
if(getScreenSymbolsNum(MAIN_SCREEN) == 0 && getScreenSymbolsNum(EXTRA_SCREEN) == 0) return;
if(getScreenSymbolsNum(MAIN_SCREEN) == 0 && lastOperation == '\u00f7') {
showResult("Cannot divide by zero");
return;
}
double lastValue = getScreenSymbolsNum(MAIN_SCREEN) != 0 ? Double.parseDouble(screenBuffer[MAIN_SCREEN].toString()) : 0.0d;
if(lastValue == 0.0d && lastOperation == '\u00f7') {
showResult("Cannot divide by zero");
return;
}
pushValueToStack(lastValue);
byte i;
// check for special operations which should happen first, like multiplication or division
for(i = 0; i < storedCount; ++i) {
if(!hasItem[i])
continue;
switch(storedOperation[i]) {
case '\u00d7': // multiplication
storedNumber[i] *= storedNumber[i+1];
lastValue = storedNumber[i+1] = storedNumber[i];
hasItem[i] = false; // Set "invisible" the item at the given position in the list
break;
case '\u00f7': // division
storedNumber[i] /= storedNumber[i+1];
lastValue = storedNumber[i+1] = storedNumber[i];
hasItem[i] = false; // Set "invisible" the item at the given position in the list
break;
}
}
// check for lasts operations, like addition or substraction
for(i = 0; i < storedCount; ++i) {
if(!hasItem[i])
continue;
switch(storedOperation[i]) {
case '+':
storedNumber[i] += storedNumber[i+1];
lastValue = storedNumber[i+1] = storedNumber[i];
hasItem[i] = false; // Set "invisible" the item at the given position in the list
break;
case '-':
storedNumber[i] -= storedNumber[i+1];
lastValue = storedNumber[i+1] = storedNumber[i];
hasItem[i] = false; // Set "invisible" the item at the given position in the list
break;
}
}
showResult(lastValue);
}
void backspaceHandler() {
if(getScreenSymbolsNum(MAIN_SCREEN) <= 0) return;
char deletedChar = screenBuffer[MAIN_SCREEN].charAt(getScreenSymbolsNum(MAIN_SCREEN) - 1);
screenBuffer[MAIN_SCREEN].setLength(getScreenSymbolsNum(MAIN_SCREEN) - 1); // уменьшаем длинну строки на 1 символ
String result = null;
if(getScreenSymbolsNum(MAIN_SCREEN) > 0) {
result = screenBuffer[MAIN_SCREEN].toString();
if(deletedChar == '.') dotUsed = false;
} else {
result = "0";
dotUsed = false;
isDecimal = false;
}
updateScreen(MAIN_SCREEN, result);
}
void setDefaults() {
showResult();
}
void clearInfoOnMainScreen() {
clearScreen(MAIN_SCREEN);
updateScreen(EXTRA_SCREEN);
dotUsed = false;
isDecimal = false;
}
void showResult() {
dotUsed = false;
storedCount = 0;
isDecimal = false;
lastOperation = 0;
clearScreen(MAIN_SCREEN);
clearScreen(EXTRA_SCREEN);
Arrays.fill(hasItem, false);
}
void showResult(double valueToDisplay) {
dotUsed = false;
storedCount = 0;
isDecimal = false;
lastOperation = 0;
showOn(valueToDisplay);
Arrays.fill(hasItem, false);
clearScreen(EXTRA_SCREEN);
screenBuffer[MAIN_SCREEN].setLength(0);
}
void showResult(String valueToDisplay) {
dotUsed = false;
storedCount = 0;
isDecimal = false;
lastOperation = 0;
showOn(valueToDisplay);
Arrays.fill(hasItem, false);
clearScreen(EXTRA_SCREEN);
screenBuffer[MAIN_SCREEN].setLength(0);
}
void clearScreen(byte screen) {
if(screen == MAIN_SCREEN) {
updateScreen(MAIN_SCREEN, "0");
screenBuffer[MAIN_SCREEN].setLength(0);
} else {
screenBuffer[EXTRA_SCREEN].setLength(0);
updateScreen(EXTRA_SCREEN);
}
}
void updateScreen(byte screen) {
outputArea[screen].setText(screenBuffer[screen].toString());
}
void updateScreen(byte screen, String text) {
outputArea[screen].setText(text);
}
void showOn(double result) {
if(!isInteger(result)) {
outputArea[MAIN_SCREEN].setText(String.valueOf(result));
} else {
outputArea[MAIN_SCREEN].setText(String.valueOf(Math.round(result)));
}
}
void showOn(String result) {
outputArea[MAIN_SCREEN].setText(result);
}
boolean pushValueToBuffer(double value, char operation) {
if(isDecimal) {
appendToExtraScreen(value, operation);
} else {
if(getScreenSymbolsNum(EXTRA_SCREEN) == 0) {
appendToExtraScreen(value, operation);
} else {
replaceLastOperation(operation);
updateScreen(EXTRA_SCREEN);
return false;
}
}
return true;
}
void appendToExtraScreen(double value, char operation) {
if(isInteger(value)) {
screenBuffer[EXTRA_SCREEN].append(Double.valueOf(value).longValue());
} else {
screenBuffer[EXTRA_SCREEN].append(value);
}
screenBuffer[EXTRA_SCREEN].append(' ');
screenBuffer[EXTRA_SCREEN].append(operation);
screenBuffer[EXTRA_SCREEN].append(' ');
}
void pushValueToStack(double value, char operation) {
hasItem[storedCount] = true;
storedNumber[storedCount] = value;
storedOperation[storedCount] = operation;
storedCount++;
}
void pushValueToStack(double value) {
hasItem[storedCount] = true;
storedNumber[storedCount] = value;
}
void replaceLastOperation(char operation) {
screenBuffer[EXTRA_SCREEN].setLength(getScreenSymbolsNum(EXTRA_SCREEN) - 2);
screenBuffer[EXTRA_SCREEN].append(operation);
screenBuffer[EXTRA_SCREEN].append(' ');
}
int getScreenSymbolsNum(byte screen) {
return screenBuffer[screen].length();
}
boolean isInteger(double num) {
return num % 1 == 0;
}
static boolean isNumeric(String str) {
try {
double d = Double.parseDouble(str);
} catch(NumberFormatException nfe) {
return false;
}
return true;
}
} | [
"noreply@github.com"
] | noreply@github.com |
7ea23863bb1d986c7082a41a53b37c14ae26312a | b338d43b81b54a980225a8f02fa084bc8979efd1 | /CalAccuracy2.java | 16dc93b6c2b8b3085240c4811d1ad5a3ffcae377 | [] | no_license | bingqinzhou/MapReduce | 2305ed0068e0f40a0a52056a7ed60f496c0f9724 | e2df7fc5ab5c90dc1bea00f49d5ee9c28492ce27 | refs/heads/master | 2021-01-20T00:41:24.047509 | 2017-04-23T21:16:41 | 2017-04-23T21:16:41 | 89,172,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,529 | java | package finalproject_try;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.MultipleInputs;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.partition.HashPartitioner;
public class CalAccuracy2 {
//cnt,error
public static class CalMapper extends Mapper<Object, Text, Text, Text>{
Text outkey = new Text();
Text outvalue = new Text();
int sum_correct = 0;
int sum_wrong = 0;
public void map(Object key, Text value, Context context)
throws IOException, InterruptedException{
String[] line=value.toString().split(",");
int correct = Integer.parseInt(line[0]);
int wrong = Math.round(Float.parseFloat(line[1]));
//int wrong = Integer.parseInt(line[1]);
sum_correct = sum_correct+correct;
sum_wrong = sum_wrong+wrong;
}
public void cleanup (Context context) throws IOException,InterruptedException {
outkey.set("0");
outvalue.set(String.valueOf(sum_correct)+","+String.valueOf(sum_wrong));
context.write(outkey,outvalue);
}
}
public static class CalReducer extends Reducer<Text,Text,Text,Text> {
//null,[sum_cnt,sum_error]
//accuracy
Text outkey = new Text();
Text outvalue = new Text();
public void reduce(Text key, Iterable<Text> values,Context context
) throws IOException, InterruptedException {
int total_correct = 0;
int total_wrong = 0;
for(Text val : values){
String[] line = val.toString().split(",");
int sum_correct = Integer.parseInt(line[0]);
int sum_wrong = Integer.parseInt(line[1]);
total_correct = total_correct+sum_correct;
total_wrong = total_wrong+sum_wrong;
}
outkey.set(String.valueOf(total_correct));
outvalue.set(String.valueOf(total_wrong));
context.write(outkey, outvalue);
}
}
public static class CalPartitioner extends HashPartitioner<Text, Text>{
@Override
public int getPartition(Text key, Text result, int numReduceTasks) {
return 0;
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "accuracy");
job.setJarByClass(CalAccuracy2.class);
MultipleInputs.addInputPath(job,new Path(args[0]),TextInputFormat.class,CalMapper.class);
MultipleInputs.addInputPath(job,new Path(args[1]),TextInputFormat.class,CalMapper.class);
MultipleInputs.addInputPath(job,new Path(args[2]),TextInputFormat.class,CalMapper.class);
MultipleInputs.addInputPath(job,new Path(args[3]),TextInputFormat.class,CalMapper.class);
MultipleInputs.addInputPath(job,new Path(args[4]),TextInputFormat.class,CalMapper.class);
job.setPartitionerClass(CalPartitioner.class);
job.setNumReduceTasks(1);
job.setReducerClass(CalReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
FileOutputFormat.setOutputPath(job, new Path(args[5]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
| [
"zhou.bing@husky.neu.edu"
] | zhou.bing@husky.neu.edu |
a2e1c8e880b807736a21a5593ce90e4be6ae3d8f | 4c984c9ca4279e9b706cb0db83fb2b8422476e9a | /app/src/main/java/com/nothingmagical/coins/MainActivity.java | 2a6cc075913830df83eac6dfdc85f65d88156a3c | [
"MIT"
] | permissive | KZsolt11/coins-android | e195f1487f2ba29067a7a34816b87864cc7bab3f | 1c3ac99ff8fbfc0383b75cd0b18020848e21a5e4 | refs/heads/master | 2021-01-18T20:37:22.923532 | 2017-04-27T16:13:44 | 2017-04-27T16:13:44 | 86,978,793 | 0 | 2 | null | 2017-04-02T10:23:09 | 2017-04-02T10:23:09 | null | UTF-8 | Java | false | false | 8,072 | java | package com.nothingmagical.coins;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.NumberFormat;
import java.util.Currency;
import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
public class MainActivity extends Activity {
public static final String TAG = MainActivity.class.getSimpleName();
protected TextView mValueLabel;
protected TextView mBtcLabel;
protected TextView mUpdatedAtLabel;
protected boolean mUpdating;
protected Timer mTimer;
protected Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
updateUpdatedAtLabel();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mValueLabel = (TextView) findViewById(R.id.valueLabel);
mValueLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, CurrencyPickerActivity.class);
startActivity(intent);
}
});
mBtcLabel = (TextView) findViewById(R.id.btcLabel);
mBtcLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, EditBtcActivity.class);
startActivity(intent);
}
});
mUpdatedAtLabel = (TextView) findViewById(R.id.updatedAtLabel);
mUpdatedAtLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
refresh();
}
});
}
@Override
protected void onResume() {
super.onResume();
refresh();
if (mTimer == null) {
mTimer = new Timer();
mTimer.schedule(new TimerTask() {
@Override
public void run() {
mHandler.obtainMessage(1).sendToTarget();
}
}, 1000, 1000);
}
}
@Override
protected void onPause() {
super.onPause();
if (mTimer != null) {
mTimer.cancel();
mTimer = null;
}
}
protected void refresh() {
if (mUpdating) {
return;
}
if (isNetworkAvailable()) {
mUpdating = true;
updateInterface();
GetConversionTask task = new GetConversionTask();
task.execute();
} else {
updateInterface();
Toast.makeText(this, R.string.no_network, Toast.LENGTH_LONG).show();
}
}
protected void updateInterface() {
double btc = Preferences.getBtc(this);
double rate = Preferences.getRate(this);
double value = btc * rate;
// Value
String code = Preferences.getCurrencyCode(this);
NumberFormat format = NumberFormat.getCurrencyInstance();
format.setCurrency(Currency.getInstance(code));
mValueLabel.setText(format.format(value));
// BTC
format = NumberFormat.getNumberInstance();
format.setMaximumFractionDigits(10);
mBtcLabel.setText(format.format(btc) + " BTC");
// Updated at
updateUpdatedAtLabel();
}
protected void updateUpdatedAtLabel() {
if (mUpdating) {
mUpdatedAtLabel.setText(R.string.updating);
} else {
long timestamp = Preferences.getUpdatedAtTimestamp(this);
if (timestamp == 0) {
mUpdatedAtLabel.setText(R.string.updated_never);
} else {
long now = System.currentTimeMillis();
if (now - timestamp < 11000) {
mUpdatedAtLabel.setText(R.string.updated_just_now);
} else {
CharSequence timeAgoInWords = DateUtils.getRelativeTimeSpanString(timestamp, now, 0);
mUpdatedAtLabel.setText(String.format(getString(R.string.updated_format), timeAgoInWords));
}
}
}
}
private boolean isNetworkAvailable() {
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected();
}
public class GetConversionTask extends AsyncTask<Object, Void, Object> {
@Override
protected Void doInBackground(Object... arg0) {
try {
// Connect
String json = getJSON("https://coinbase.com/api/v1/currencies/exchange_rates", 1500);
if (json == null) {
return null;
}
JSONObject data = new JSONObject(json);
// Put values into map
Iterator<String> keys = data.keys();
SharedPreferences preferences = getSharedPreferences(Preferences.CONVERSION_PREFERENCES_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
while (keys.hasNext()) {
String key = keys.next();
if (key.startsWith("btc_to_")) {
String value = data.getString(key);
key = key.replace("btc_to_", "").toUpperCase();
editor.putString(key, value);
}
}
editor.putLong(Preferences.KEY_UPDATED_AT, System.currentTimeMillis());
editor.commit();
}
catch (Exception e) {
e.printStackTrace();
Log.e(TAG, e.getClass().getSimpleName() + " - " + e.getMessage());
}
return null;
}
@Override
protected void onPostExecute(Object _) {
mUpdating = false;
updateInterface();
}
public String getJSON(String url, int timeout) {
try {
URL u = new URL(url);
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setRequestProperty("Content-length", "0");
c.setUseCaches(false);
c.setAllowUserInteraction(false);
c.setConnectTimeout(timeout);
c.setReadTimeout(timeout);
c.connect();
int status = c.getResponseCode();
switch (status) {
case 200:
case 201:
BufferedReader br = new BufferedReader(new InputStreamReader(c.getInputStream()));
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line+"\n");
}
br.close();
return sb.toString();
}
} catch (MalformedURLException e) {
Log.e(TAG, e.getMessage());
} catch (IOException e) {
Log.e(TAG, e.getMessage());
}
return null;
}
}
}
| [
"sam@soff.es"
] | sam@soff.es |
d3efaf71c41b3be30611bf607d37926cea088f02 | 0042cdb12c16dd3fb7ab88b1073cded2ce29338f | /src/test/java/TestSimulation.java | b459173ddf9d11f706fcbb935bba130bcfd7e6fc | [] | no_license | ecn-code/CodeVsZombies | 5a8233439339ba5a2cc1dfabd5b9678841ec1e0f | 5906bc921507cdba0c79f8d9e92b7ea9deaba989 | refs/heads/master | 2020-04-08T05:46:11.519914 | 2018-11-25T20:52:34 | 2018-11-25T20:52:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,982 | java | import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class TestSimulation {
/*
@Test
public void numOfSimulations() {
Simulation simulation = new Simulation(40);
assertEquals(40, simulation.numOfSimulations, 0);
}
@Test
public void numOfSimulations2() {
Simulation simulation = new Simulation(30);
assertNotEquals(40, simulation.numOfSimulations, 0);
}
@Test
public void executeSimple5Steps() {
Simulation simulation = new Simulation(4);
List<Zombie> zombies = Arrays.asList(new Zombie(0, 8250,8999, null));
List<Human> humans = Arrays.asList(new Human(0, 8250,4500, false, null));
Heroe heroe = new Heroe(-1, 0,0, null, null);
simulation.execute(zombies, humans, heroe,1);
assertEquals(Arrays.asList(new Zombie(0, 8250,7399, null)), zombies);
assertEquals(new Heroe(-1,2819,2831, null, null), heroe);
assertEquals(5, simulation.gameMovements, 0);
}
@Test
public void executeSimple40Steps() {
Simulation simulation = new Simulation(40);
List<Zombie> zombies = Arrays.asList(new Zombie(0, 8250,8999, null));
List<Human> humans = Arrays.asList(new Human(0, 8250,4500, false, null));
Heroe heroe = new Heroe(-1, 0,0, null, null);
simulation.execute(zombies, humans, heroe,1);
assertEquals(Arrays.asList(new Zombie(0, 8250,5399, null)), zombies);
assertEquals(new Heroe(-1,7053,5399, null, null), heroe);
assertEquals(10, simulation.gameMovements, 0);
}
@Test
public void execute2Zombies5Steps() {
Simulation simulation = new Simulation(4);
List<Zombie> zombies = Arrays.asList(new Zombie(0, 3100,7000, null),new Zombie(1, 11500,7100, null));
List<Human> humans = Arrays.asList(new Human(0, 950,6000, false, null),new Human(1, 8000,6100, false, null));
Heroe heroe = new Heroe(-1, 5000,0, null, null);
simulation.execute(zombies, humans, heroe,1);
assertEquals(Arrays.asList(new Zombie(0, 1648,6324, null), new Zombie(1, 9960,6660, null)), zombies);
assertEquals(new Heroe(-1,3539,3705, null, null), heroe);
assertEquals(5, simulation.gameMovements, 0);
}
@Test
public void execute2Zombies40Steps() {
Simulation simulation = new Simulation(40);
List<Zombie> zombies = Arrays.asList(new Zombie(0, 3100,7000, null),new Zombie(1, 11500,7100, null));
List<Human> humans = Arrays.asList(new Human(0, 950,6000, false, null),new Human(1, 8000,6100, false, null));
Heroe heroe = new Heroe(-1, 5000,0, null, null);
simulation.execute(zombies, humans, heroe,1);
assertEquals(Arrays.asList(new Zombie(0, 950,6000, null), new Zombie(1, 8000,6100, null)), zombies);
assertEquals(new Heroe(-1,6186,5849, null, null), heroe);
assertEquals(11, simulation.gameMovements, 0);
}
/*@Test
public void execute3VS310Steps() {
Simulation simulation = new Simulation(9);
List<Zombie> zombies = Arrays.asList(new Zombie(0, 2000,1500),new Zombie(1, 13900,6500), new Zombie(2, 7000,7500));
List<Human> humans = Arrays.asList(new Human(0, 9000,1200),new Human(1, 400,6000));
Heroe heroe = new Heroe(-1, 7500,2000);
simulation.execute(zombies, humans, heroe,1);
assertEquals(Arrays.asList(new Zombie(0, 2527,2177), new Zombie(1, 11452,3854), new Zombie(2, 5924,5039)), zombies);
assertEquals(new Heroe(-1,7757,3936), heroe);
assertEquals(10, simulation.gameMovements, 0);
}
@Test
public void execute3VS340Steps() {
Simulation simulation = new Simulation(40);
List<Zombie> zombies = Arrays.asList(new Zombie(0, 2000,1500),new Zombie(1, 13900,6500), new Zombie(2, 7000,7500));
List<Human> humans = Arrays.asList(new Human(0, 9000,1200),new Human(1, 400,6000));
Heroe heroe = new Heroe(-1, 7500,2000);
simulation.execute(zombies, humans, heroe,3);
assertEquals(Arrays.asList(new Zombie(0, 3521,5336), new Zombie(1, 10784,4182), new Zombie(2, 7995,4199)), zombies);
assertEquals(new Heroe(-1,5268,4500), heroe);
assertEquals(21, simulation.gameMovements, 0);
}
*/
@Test
public void executeComboOpportunity(){
List<Zombie> zombies = Arrays.asList(
new Zombie(0, 8000,4500),
new Zombie(1, 9000,4500),
new Zombie(2, 10000,4500),
new Zombie(3, 11000,4500),
new Zombie(4, 12000,4500),
new Zombie(5, 13000,4500),
new Zombie(6, 14000,4500),
new Zombie(7, 15000,3500),
new Zombie(8, 14500,2500),
new Zombie(9, 15900,500)
);
List<Human> humans = Arrays.asList(new Human(0, 100,4000));
}
@Test
public void executeCross40StepsGA() {
List<Zombie> zombies = Arrays.asList(
new Zombie(0, 2000,1200),
new Zombie(1, 3000,1800),
new Zombie(2, 4000,2400),
new Zombie(3, 5000,3000),
new Zombie(4, 6000,3600),
new Zombie(5, 9000,5400),
new Zombie(6, 10000,6000),
new Zombie(7, 11000,6600),
new Zombie(8, 12000,7200),
new Zombie(9, 13000,7800),
new Zombie(10, 14000,8400),
new Zombie(11, 14000,600),
new Zombie(12, 13000,1200),
new Zombie(13, 12000,1800),
new Zombie(14, 11000,2400),
new Zombie(15, 10000,3000),
new Zombie(16, 9000,3600),
new Zombie(17, 6000,5400),
new Zombie(18, 5000,6000),
new Zombie(19, 4000,6600),
new Zombie(20, 3000,7200),
new Zombie(21, 2000,7800),
new Zombie(22, 1000,8400));
List<Human> humans = Arrays.asList(new Human(0, 0,4500),new Human(1, 15999,4500),new Human(2, 8000,7999));
Heroe heroe = new Heroe(-1, 8000,0);
GeneticAlgorithm ga = new GeneticAlgorithm(heroe, humans, zombies);
ga.generation(0,200, 15);
}
@Test
public void execute3VS11Steps() {
List<Zombie> zombies = Arrays.asList(new Zombie(0, 2000,1500),new Zombie(1, 13900,6500), new Zombie(2, 7000,7500));
List<Human> humans = Arrays.asList(new Human(0, 9000,1200),new Human(1, 400,6000));
Heroe heroe = new Heroe(-1, 7500,2000);
Simulation simulation = new Simulation(10, zombies, humans, heroe);
simulation.execute(0,2);
/*assertEquals(Arrays.asList(new Zombie(0, 659,5265), new Zombie(1, 10784,4182), new Zombie(2, 7995,4199)), zombies);
assertEquals(new Heroe(-1,10107,4587), heroe);
assertEquals(11, simulation.gameMovements, 0);*/
}
@Test
public void executeSimple40StepsGA() {
double times130 = 0;
double times160 = 0;
int times = 100;
for(int i = 0;i<times;i++) {
List<Zombie> zombies = Arrays.asList(new Zombie(0, 2000, 1500), new Zombie(1, 13900, 6500), new Zombie(2, 7000, 7500));
List<Human> humans = Arrays.asList(new Human(0, 9000, 1200), new Human(1, 400, 6000));
Heroe heroe = new Heroe(-1, 7500, 2000);
GeneticAlgorithm ga = new GeneticAlgorithm(heroe, humans, zombies);
ga.generation(0,180, 14);
times130 += ga.currentDNA.realScore >= 130 ? 1 : 0;
times160 += ga.currentDNA.realScore >= 131 ? 1 : 0;
}
System.err.println(String.format("130 %f, >130 %f", (times130/times*100), (times160/times*100)));
//assertEquals(Arrays.asList(new Zombie(0, 8250,5399)), zombies);
//assertEquals(new Heroe(-1,7053,5399), heroe);
//assertEquals(10, simulation.gameMovements, 0);
}
/* @Test
public void executeSeletion() {
GeneticAlgorithm ga = new GeneticAlgorithm(null, null, null);
List<DNA> dnas = new ArrayList<>();
dnas.add(new DNA(Arrays.asList()));
dnas.add(dnas.get(0).copy());
dnas.add(dnas.get(0).copy());
dnas.get(0).setScore(true, 10, 10);
dnas.get(1).setScore(true, 9, 10);
dnas.get(2).setScore(true, 8, 10);
dnas = ga.selection(dnas);
List<DNA> dnasExpected = new ArrayList<>();
dnasExpected.add(new DNA(Arrays.asList()));
dnasExpected.add(dnasExpected.get(0).copy());
dnasExpected.add(dnasExpected.get(0).copy());
dnasExpected.get(0).setScore(true, 8, 10);
dnasExpected.get(1).setScore(true, 9, 10);
dnasExpected.get(2).setScore(true, 10, 10);
assertEquals(ga.calcFitness(dnasExpected), dnas);
}
*/
} | [
""
] | |
f67815a6aff70add172c1868db585c927377473c | 3c1105be1146141365e166df493dabaafa2e4bc4 | /src/main/java/logic/parse/SOP/ASTUnion.java | d95e3409cd8d86338c6deccdf5ed9b26efefc0a5 | [] | no_license | yoheidb/rmx | 70b134f541d69eaee89717f75234c68655a48dc3 | 7d01685c48d72eea1c2e91b5e8817bc59d99ef9c | refs/heads/master | 2020-04-07T11:43:49.959086 | 2015-06-19T04:42:36 | 2015-06-19T04:42:36 | 20,482,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | /* Generated By:JJTree: Do not edit this line. ASTUnion.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=BaseNode,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package logic.parse.SOP;
public
class ASTUnion extends SimpleNode {
public ASTUnion(int id) {
super(id);
}
public ASTUnion(parser p, int id) {
super(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(parserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}
/* JavaCC - OriginalChecksum=71bea7ad0619dabdadf958b8c512c32c (do not edit this line) */
| [
"satoru.mtzw@gmail.com"
] | satoru.mtzw@gmail.com |
eb03d71ff06b7787cb327e4d1cba19859705b1bb | b276b0e235f09cb3151133307897fe6063662cfd | /sfm/src/main/java/org/sfm/csv/parser/CharSequenceCharBuffer.java | b8cccbb49d174c0bb03ed490f2db1b3a36e21c01 | [
"MIT"
] | permissive | xl1991/SimpleFlatMapper | 9d3a72682dcfc8c3ba947c4327ba93e78b0b0105 | c502ee3b7a2d0152ff61afb990e03fae54e38716 | refs/heads/master | 2021-01-16T19:41:56.494641 | 2016-05-15T20:54:32 | 2016-05-15T20:54:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package org.sfm.csv.parser;
import java.io.IOException;
import java.io.Reader;
public final class CharSequenceCharBuffer extends CharBuffer {
public CharSequenceCharBuffer(final CharSequence charSequence)
throws IOException {
super(toCharArray(charSequence), charSequence.length());
}
public boolean fillBuffer() throws IOException {
return false;
}
public int shiftBufferToMark() throws BufferOverflowException {
return 0;
}
private static char[] toCharArray(CharSequence charSequence) {
if (charSequence instanceof String) {
return ((String)charSequence).toCharArray();
} else {
char[] buffer = new char[charSequence.length()];for(int i = 0; i < buffer.length; i++) {
buffer[i] = charSequence.charAt(i);
}
return buffer;
}
}
}
| [
"arnaud.roger@gmail.com"
] | arnaud.roger@gmail.com |
80185d12a5871b258f9f8807fd0ba6f03ca787de | 98d313cf373073d65f14b4870032e16e7d5466f0 | /gradle-open-labs/example/src/main/java/se/molybden/Class20194.java | ae93487d10fc977d205927d03c6f255ec8c8a1a0 | [] | no_license | Molybden/gradle-in-practice | 30ac1477cc248a90c50949791028bc1cb7104b28 | d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3 | refs/heads/master | 2021-06-26T16:45:54.018388 | 2016-03-06T20:19:43 | 2016-03-06T20:19:43 | 24,554,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java |
public class Class20194{
public void callMe(){
System.out.println("called");
}
}
| [
"jocce.nilsson@gmail.com"
] | jocce.nilsson@gmail.com |
c59eae2598a2d12bc432ee3f60b2437aad341669 | c3c600537aa8fe6b57495bdc9e62c457f01067e6 | /app/src/main/java/wallpaper/shreeramaashirvaad/com/p2pcoucbase/Constant.java | 7890045f8bd8d20654c101464b684bb5ae184da0 | [] | no_license | nssoftengineer/P2PCoucbase | 3d2c29cbd94aa9f8dbff7047ad2994cecddc5502 | af629a3b2e4e040687a5d052ae18f1d0c7b43d24 | refs/heads/master | 2020-07-09T13:17:52.569523 | 2019-08-23T11:03:38 | 2019-08-23T11:03:38 | 203,978,070 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package wallpaper.shreeramaashirvaad.com.p2pcoucbase;
/**
* Created by neeraj on 1/2/2018.
*/
public class Constant {
public static final String ZERO_IP="0.0.0.0";
public static final String USERNAME="username";
public static final String MOBILE="mobile";
public static final String STATUS="status";
public static final String DEVICE_IP="deviceip";
public static final String BROADCAST_IP = "224.1.1.1";
public static final int BROADCAST_PORT = 4445;
public static final int LOCALPORT = 8115;
public static final int PERMISSIONS = 1;
}
| [
"neeraj.singh@wibmo.com"
] | neeraj.singh@wibmo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.