text stringlengths 10 2.72M |
|---|
package com.ai.lovejoy777.ant;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import android.app.ActivityOptions;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SwitchCompat;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import android.widget.Toast;
public class TimerEditActivity extends AppCompatActivity {
// Dialog Constants
private static final int DATE_PICKER_DIALOG = 0;
private static final int TIME_PICKER_DIALOG = 1;
Toolbar toolBar;
// Date Format
private static final String DATE_FORMAT = "yyyy-MM-dd";
private static final String TIME_FORMAT = "kk:mm";
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd kk:mm:ss";
public final static String KEY_TIMER_REPEAT = "KEY_TIMER_REPEAT";
private EditText mETName;
private EditText mETSWName;
private EditText mETAddress;
private EditText mETCode;
private EditText mETLocalIP;
private EditText mETPort;
private EditText mETDate;
private EditText mETTime;
private EditText mETRepeat;
private Button mDateButton;
private Button mTimeButton;
private SwitchCompat mDaySwitch;
private SwitchCompat mWeekSwitch;
private Button mConfirmButton;
private Long mRowId;
private TimerDbAdapter mDbHelper;
private Calendar mCalendar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = new TimerDbAdapter(this);
setContentView(R.layout.main_timer_edit);
toolBar = (Toolbar) findViewById(R.id.toolbar);
mCalendar = Calendar.getInstance();
mETName = (EditText) findViewById(R.id.etname);
mETSWName = (EditText) findViewById(R.id.etswname);
mETAddress = (EditText) findViewById(R.id.etaddress);
mETCode = (EditText) findViewById(R.id.etcode);
mETLocalIP = (EditText) findViewById(R.id.etlocalip);
mETPort = (EditText) findViewById(R.id.etport);
mETDate = (EditText) findViewById(R.id.etdate);
mETTime = (EditText) findViewById(R.id.ettime);
mETRepeat = (EditText) findViewById(R.id.etrepeat);
mDateButton = (Button) findViewById(R.id.reminder_date);
mTimeButton = (Button) findViewById(R.id.reminder_time);
mDaySwitch = (SwitchCompat) findViewById(R.id.dayswitch);
mWeekSwitch = (SwitchCompat) findViewById(R.id.weekswitch);
mConfirmButton = (Button) findViewById(R.id.confirm);
mRowId = savedInstanceState != null ? savedInstanceState.getLong(TimerDbAdapter.KEY_ROWID)
: null;
registerButtonListenersAndSetDefaultText();
}
private void setRowIdFromIntent() {
if (mRowId == null) {
Bundle extras = getIntent().getExtras();
mRowId = extras != null ? extras.getLong(TimerDbAdapter.KEY_ROWID)
: null;
}
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_PICKER_DIALOG:
return showDatePicker();
case TIME_PICKER_DIALOG:
return showTimePicker();
}
return super.onCreateDialog(id);
}
private DatePickerDialog showDatePicker() {
DatePickerDialog datePicker = new DatePickerDialog(TimerEditActivity.this, R.style.DialogTheme, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
mCalendar.set(Calendar.YEAR, year);
mCalendar.set(Calendar.MONTH, monthOfYear);
mCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateDateETText();
}
}, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH));
return datePicker;
}
private TimePickerDialog showTimePicker() {
TimePickerDialog timePicker = new TimePickerDialog(this, R.style.DialogTheme, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
mCalendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
mCalendar.set(Calendar.MINUTE, minute);
updateTimeETText();
}
}, mCalendar.get(Calendar.HOUR_OF_DAY), mCalendar.get(Calendar.MINUTE), true);
return timePicker;
}
private void registerButtonListenersAndSetDefaultText() {
final String dayOn = "Daily";
final String weekOn = "Weekly";
mDateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialog(DATE_PICKER_DIALOG);
}
});
mTimeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialog(TIME_PICKER_DIALOG);
}
});
//set the switch to Off
mDaySwitch.setChecked(false);
mWeekSwitch.setChecked(false);
//attach a listener to check for changes in state
mDaySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
mETRepeat.setText(dayOn);
mWeekSwitch.setChecked(false);
}
}
});
mWeekSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
mETRepeat.setText(weekOn);
mDaySwitch.setChecked(false);
}
}
});
mConfirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
saveState();
setResult(RESULT_OK);
Toast.makeText(TimerEditActivity.this, getString(R.string.task_saved_message), Toast.LENGTH_SHORT).show();
finish();
}
});
updateDateETText();
updateTimeETText();
}
private void populateFields() {
// Only populate the text boxes and change the calendar date
// if the row is not null from the database.
if (mRowId != null) {
Cursor reminder = mDbHelper.fetchTimer(mRowId);
startManagingCursor(reminder);
mETName.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_NAME)));
mETSWName.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_SWNAME)));
mETAddress.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_ADDRESS)));
mETCode.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_CODE)));
mETLocalIP.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_LOCALIP)));
mETPort.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_PORT)));
mETRepeat.setText(reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_REPEAT)));
String repeatText = (reminder.getString(
reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_REPEAT)));
if (!reminder.isClosed()) {
reminder.close();
}
// set switches
if (repeatText.equals("Daily")) {
mDaySwitch.setChecked(true);
mWeekSwitch.setChecked(false);
}
if (repeatText.equals("Weeklk")) {
mDaySwitch.setChecked(false);
mWeekSwitch.setChecked(true);
}
// Get the date from the database and format it for our use.
SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
Date date = null;
try {
String dateString = reminder.getString(reminder.getColumnIndexOrThrow(TimerDbAdapter.KEY_DATE_TIME));
date = dateTimeFormat.parse(dateString);
mCalendar.setTime(date);
} catch (ParseException e) {
Log.e("TimerEditActivity", e.getMessage(), e);
}
} else {
// This is a new task - add defaults from preferences if set.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String defaultTimeKey = getString(R.string.pref_default_time_from_now_key);
String defaultTime = prefs.getString(defaultTimeKey, null);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String name = sp.getString("NAME", null);
String swname = sp.getString("SWNAME", null);
String address = sp.getString("ADDRESS", null);
String swCode = sp.getString("SWCODE", null);
String localip = sp.getString("LOCALIP", null);
String port = sp.getString("PORT", null);
if (address != null)
mETName.setText(name);
mETSWName.setText(swname);
mETAddress.setText(address);
mETCode.setText(swCode);
mETLocalIP.setText(localip);
mETPort.setText(port);
if (defaultTime != null)
mCalendar.add(Calendar.MINUTE, Integer.parseInt(defaultTime));
}
updateDateETText();
updateTimeETText();
}
private void updateTimeETText() {
// Set the time edit text based upon the value from the database
SimpleDateFormat timeFormat = new SimpleDateFormat(TIME_FORMAT);
String timeForETTime = timeFormat.format(mCalendar.getTime());
mETTime.setText(timeForETTime);
}
private void updateDateETText() {
// Set the date edit text based upon the value from the database
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
String dateForETDate = dateFormat.format(mCalendar.getTime());
mETDate.setText(dateForETDate);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putLong(TimerDbAdapter.KEY_ROWID, mRowId);
}
private void saveState() {
String name = mETName.getText().toString();
String swname = mETSWName.getText().toString();
String address = mETAddress.getText().toString();
String code = mETCode.getText().toString();
String localip = mETLocalIP.getText().toString();
String port = mETPort.getText().toString();
String repeat = mETRepeat.getText().toString();
SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
String timerDateTime = dateTimeFormat.format(mCalendar.getTime());
if (mRowId == null) {
long id = mDbHelper.createTimer(name, swname, address, code, localip, port, timerDateTime, repeat);
if (id > 0) {
mRowId = id;
}
} else {
mDbHelper.updateTimer(mRowId, name, swname, address, code, localip, port, timerDateTime, repeat);
}
new TimerManager(this).setTimer(mRowId, name, swname, mCalendar, repeat);
}
@Override
protected void onPause() {
super.onPause();
mDbHelper.close();
}
@Override
protected void onResume() {
super.onResume();
mDbHelper.open();
setRowIdFromIntent();
populateFields();
}
@Override
public void onBackPressed() {
mDbHelper.close();
super.onBackPressed();
overridePendingTransition(R.anim.back2, R.anim.back1);
}
} |
package com.tencent.mm.booter;
import com.tencent.mm.sdk.platformtools.ar.a;
import com.tencent.mm.sdk.platformtools.x;
class a$1 implements a {
final /* synthetic */ a cWA;
a$1(a aVar) {
this.cWA = aVar;
}
public final void fn(int i) {
switch (i) {
case 0:
x.v("MicroMsg.BackgroundPlayer", "call end");
this.cWA.xu();
return;
case 1:
case 2:
x.v("MicroMsg.BackgroundPlayer", "call start");
this.cWA.xv();
return;
default:
return;
}
}
}
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.mapreduce;
import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.mapreduce.InputFormat;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.RecordReader;
/**
* <code>InputSplit</code> represents the data to be processed by an
* individual {@link Mapper}.
*
* <p>Typically, it presents a byte-oriented view on the input and is the
* responsibility of {@link RecordReader} of the job to process this and present
* a record-oriented view.
*
* @see InputFormat
* @see RecordReader
*/
@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class InputSplit {
/**
* Get the size of the split, so that the input splits can be sorted by size.
* @return the number of bytes in the split
* @throws IOException
* @throws InterruptedException
*/
public abstract long getLength() throws IOException, InterruptedException;
/**
* Get the list of nodes by name where the data for the split would be local.
* The locations do not need to be serialized.
* @return a new array of the node nodes.
* @throws IOException
* @throws InterruptedException
*/
public abstract
String[] getLocations() throws IOException, InterruptedException;
} |
package sistema;
import java.util.*;
/**
* GestoreCinema.java
* <p>
* A representation of a AmministratoreSistema Cinema; it extends
* the Persona.java class.
* An AmministratoreSistema has in addition the following attributes:
* username, password, email, autenticato.
*
* @author Sara Martino
*/
public class AmministratoreSistema extends Persona {
private String username;
private String password;
private String email;
private boolean autenticato;
/**
* Constructs an object of type AmministratoreSistema using the input
* parameters.
* <p>
* It calls the constructor of the base class Persona.java with the
* correct input parameters.
*
* @param nome The name of this AmministratoreSistema
* @param cognome The surname of this AmministratoreSistema
* @param codiceFiscale The fiscal code of this
* AmministratoreSistema
* @param dataNascita The date of birth of this
* AmministratoreSistema
* @param username The username
* @param password The password
* @param email The email of this AmministratoreSistema
*/
public AmministratoreSistema(String nome, String cognome, String codiceFiscale,
Calendar dataNascita, String username, String password, String email) {
super(nome, cognome, codiceFiscale, dataNascita);
this.username = username;
this.password = password;
this.email = email;
this.autenticato = false;
}
/**
* Returns username.
*
* @return the username
*/
public String getUsername() {
return username;
}
/**
* Returns password.
*
* @return the password
*/
public String getPassword() {
return password;
}
/**
* Returns email.
*
* @return the email
*/
public String getEmail() {
return email;
}
/**
* Returns true if the Amministratore Sistema is logged, false otherwise.
*
* @return true if the user is logged, false otherwise
*/
public boolean isLogged() {
return autenticato;
}
/**
* Sets autenticato.
*
* @param autenticato The new value of autenticato
*/
public void setAutenticato(boolean autenticato) {
this.autenticato = autenticato;
}
/**
* Sets username.
*
* @param username The new username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Sets password.
*
* @param password The new password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Sets email.
*
* @param email The new email
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Prints the attributes of the class AmministratoreSistema (profilo).
* <p>
* It calls the print() method of the base class Persona.java.
*/
public void printProfilo() {
super.print();
System.out.println("Username: " + this.username);
System.out.println("Password: " + this.password);
System.out.println("Email: " + this.email);
}
}
|
package BigData;
/**
* @author admin
* @version 1.0.0
* @ClassName is4Or2Power.java
* @Description 判断一个32位正数是不是2的幂、4的幂
* @createTime 2021年03月26日 22:21:00
*/
public class is4Or2Power {
public static boolean is2Power(int n) {//2进制中只能有一个数是1就是2的幂 比如8421 1000 = 8 0100 =4
//一个思路是:先拿出一个数最右侧的1,和原来数相等,代表只有1个1 就是2的幂
return (n & (n - 1)) == 0;//还有一个思路是:假设一个数2进制只有一个1 如果-1,则会把这个唯一的1打散 ,比如1000 -1 = 0111
//这时候再与原数& 1000&0111 = 0000 必须为0
}
public static boolean is4Power(int n) {//是4的幂的前提得是2的幂(二进制只有一个1 )00100 ,10000都得是奇数位上
return (n & (n - 1)) == 0 && (n & 0x55555555) != 0; //0x55555555 = 01..10101 一旦&且结果不为0说明奇数位都是1
}
public static void main(String[] args) {
System.out.println(is2Power(8));
System.out.println(is4Power(16));
}
}
|
package org.ecsoya.yamail.preferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.ecsoya.yamail.YamailCore;
public class YamailPreferences {
public static final String YAMAIL_GOLBALE_DATA_PATH = "yamail.global.data.path";
public static final String YAMAIL_GLOBALE_CLOSE_OPTION = "yamail.global.close.option";
public static IEclipsePreferences getPreferences() {
return InstanceScope.INSTANCE.getNode(YamailCore.PLUGIN_ID);
}
}
|
package org.zxd.spring.boot.mybatis;
import java.util.List;
import java.util.stream.IntStream;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.zxd.spring.boot.mybatis.entity.User;
import org.zxd.spring.boot.mybatis.mapper.UserMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
/**
* create by zhuxudong @ 2018年5月29日T上午9:49:30
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class MybatisTest {
@Autowired
private UserMapper userMapper;
@SuppressWarnings({ "static-access", "unused" })
@Test
public void test() {
IntStream.rangeClosed(1, 20).parallel().forEach(val -> {
User user = User.builder().name(RandomStringUtils.randomAlphabetic(3))
.password(RandomStringUtils.randomAlphanumeric(8)).build();
int insert = this.userMapper.insert(user);
});
// 指定页码和也大小,页码必须从 1 开始
PageHelper.startPage(2, 3);
List<User> byName = this.userMapper.byName("z");
PageInfo<User> pageInfo = new PageInfo<>(byName);
// 获取总记录数
long total = pageInfo.getTotal();
// 获取页码
int pageNum = pageInfo.getPageNum();
// 获取页大小
int pageSize = pageInfo.getPageSize();
// 获取总页数
int pages = pageInfo.getPages();
// 获取实体列表
List<User> data = pageInfo.getList();
}
}
|
package 笔试代码.array;
public class 无序数组找中位数_lin80 {
public static int patition(int start,int end,int[]arr){
int left=start;
int temp=arr[start];
while (start!=end){
while (start<end&&arr[end]>=temp){
end--;
}
while (start<end&&arr[start]<=temp){
start++;
}
if(start<end){
int i=arr[start];
arr[start]=arr[end];
arr[end]=i;
}
}
int j=arr[start];
arr[start]=temp;
arr[left]=j;
return start;
}
public static int median(int[] nums) {
int k=patition(0,nums.length-1,nums);
int mid=(nums.length-1)/2;
while (k!=mid){
if(k>mid){
k=patition(0,k-1,nums);
}else {
k=patition(k+1, nums.length-1,nums);
}
}
return nums[mid];
}
public static void main(String[] args) {
int[] num = {4, 5, 1, 2, 3};
System.out.println(median(num));
}
}
|
package programmers;
import java.util.Arrays;
import java.util.Comparator;
public class RetryBoxerSorting {
public static void main(String[] args) {
// System.out.println(Arrays.toString(solution(new int[] {50,82,75,120}, new String[] {"NLWL", "WNLL", "LWNW", "WWLN"})));
// System.out.println(Arrays.toString(solution(new int[] {60,70,60}, new String[] {"NNN", "NNN", "NNN"})));
System.out.println("1");
System.out.println(Arrays.toString(solution2(new int[] {50,82,75,120}, new String[] {"NLWL", "WNLL", "LWNW", "WWLN"})));
System.out.println("2");
System.out.println(Arrays.toString(solution2(new int[] {145,92,86}, new String[] {"NLW", "WNL", "LWN"})));
System.out.println("3");
System.out.println(Arrays.toString(solution2(new int[] {60,70,60}, new String[] {"NNN", "NNN", "NNN"})));
}
public static int[] solution2(int[] weights, String[] head2head) {
int[] answer = new int[weights.length];
Boxers[] boxer = new Boxers[weights.length];
for(int i = 0; i<head2head.length; i++){
boxer[i] = new Boxers(i, head2head[i].split(""), weights);
}
Arrays.sort(boxer,new Comparator<Boxers>(){
@Override
public int compare(Boxers o1, Boxers o2) {
// TODO Auto-generated method stub
if(o1.winRate!=o2.winRate){
return (int) (o2.winRate-o1.winRate);
}
if(o1.winBigger!=o2.winBigger){
return o2.winBigger-o1.winBigger;
}
if(o1.weight!=o2.weight){
return o2.weight-o1.weight;
}
return o1.idx-o2.idx;
}
});
for(int i = 0; i<answer.length; i++){
answer[i] = (boxer[i].idx+1);
System.out.println( boxer[i] );
}
return answer;
}
}
class Boxers{
int weight = 0;
int idx = 0;
int winCount = 0;
int winBigger = 0;
double winRate = 0;
String[] history= {};
public Boxers(int idx, String[] history, int[] weigths){
this.idx= idx;
this.weight = weigths[idx];
this.history = history;
int nCounter = 0;
for(int i =0; i<history.length; i++){
if(idx!=i && weight<weigths[i] && history[i].equals("W")){
winBigger++;
}
if(history[i].equals("W")){
winCount++;
}
if(history[i].equals("N")){
nCounter++;
}
}
if(nCounter!=history.length){
winRate = ((double)winCount/(history.length-nCounter))*1000000 ;
} else {
winRate = 0;
}
}
}
|
package com.example.israel.readinglist;
public class Book {
public Book(String title, String reasonToRead, boolean bRead, String id) {
this.title = title;
this.reasonToRead = reasonToRead;
this.bRead = bRead;
this.id = id;
}
/** @param csvStr must be a single csv row */
public Book(String csvStr) {
// @WARNING assumes that we only pass a csv row
String[] columns = csvStr.split(",");
if (columns.length > 3) { // should be at least 4 columns
title = columns[0];
reasonToRead = columns[1];
bRead = columns[2].equals("1");
id = columns[3];
}
}
private String title;
private String reasonToRead;
private boolean bRead;
private String id;
public String getTitle() {
return title;
}
public String getReasonToRead() {
return reasonToRead;
}
public void setReasonToRead(String reasonToRead) {
this.reasonToRead = reasonToRead;
}
public boolean isRead() {
return bRead;
}
public void setRead(boolean bRead) {
this.bRead = bRead;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String toCSVString() {
return title + "," + reasonToRead + "," + (bRead ? "1" : "0") + "," + id;
}
public void update(Book book) {
this.title = book.title;
this.reasonToRead = book.reasonToRead;
this.bRead = book.bRead;
}
}
|
package kr.co.sist.mgr.room.vo;
public class MgrMemberVO {
private String id,email, fNameKor, lNameKor, fNameEng, lNameEng, birthYear, birthMonth, birthDay, pType, pCountry, pNum, gender;
public MgrMemberVO() {
}
public MgrMemberVO(String id, String email, String fNameKor, String lNameKor, String fNameEng, String lNameEng,
String birthYear, String birthMonth, String birthDay, String pType, String pCountry, String pNum,
String gender) {
super();
this.id = id;
this.email = email;
this.fNameKor = fNameKor;
this.lNameKor = lNameKor;
this.fNameEng = fNameEng;
this.lNameEng = lNameEng;
this.birthYear = birthYear;
this.birthMonth = birthMonth;
this.birthDay = birthDay;
this.pType = pType;
this.pCountry = pCountry;
this.pNum = pNum;
this.gender = gender;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getfNameKor() {
return fNameKor;
}
public void setfNameKor(String fNameKor) {
this.fNameKor = fNameKor;
}
public String getlNameKor() {
return lNameKor;
}
public void setlNameKor(String lNameKor) {
this.lNameKor = lNameKor;
}
public String getfNameEng() {
return fNameEng;
}
public void setfNameEng(String fNameEng) {
this.fNameEng = fNameEng;
}
public String getlNameEng() {
return lNameEng;
}
public void setlNameEng(String lNameEng) {
this.lNameEng = lNameEng;
}
public String getBirthYear() {
return birthYear;
}
public void setBirthYear(String birthYear) {
this.birthYear = birthYear;
}
public String getBirthMonth() {
return birthMonth;
}
public void setBirthMonth(String birthMonth) {
this.birthMonth = birthMonth;
}
public String getBirthDay() {
return birthDay;
}
public void setBirthDay(String birthDay) {
this.birthDay = birthDay;
}
public String getpType() {
return pType;
}
public void setpType(String pType) {
this.pType = pType;
}
public String getpCountry() {
return pCountry;
}
public void setpCountry(String pCountry) {
this.pCountry = pCountry;
}
public String getpNum() {
return pNum;
}
public void setpNum(String pNum) {
this.pNum = pNum;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
}//class
|
package elements;
class HtmlTableWithHead extends HtmlTable {
HtmlTableWithHead(int rows, int cols) {
for (int index = 0; index < rows; index++) {
if(index == 0) {
this.addRowHead(HtmlFactory.createTableRowHead(cols));
}
else {
this.addRow(HtmlFactory.createTableRow(cols));
}
}
}
}
|
package com.tencent.mm.g.a;
import com.tencent.mm.sdk.b.b;
public final class ij extends b {
public a bRR;
public static final class a {
public byte[] bRS;
}
public ij() {
this((byte) 0);
}
private ij(byte b) {
this.bRR = new a();
this.sFm = false;
this.bJX = null;
}
}
|
import java.util.LinkedList;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Piotrek
*/
public abstract class Kolejka {
LinkedList<Proces> kolejka;
private int totalDistance;
public Kolejka(){
totalDistance = 0;
kolejka = new LinkedList<Proces>();
}
public void add(Proces proc){};
public Proces remove(){
return kolejka.remove();
}
public Proces get(){
return kolejka.getFirst();
}
public boolean isEmpty(){
return kolejka.isEmpty();
}
public void increaseTotal(int dist){
totalDistance+= dist;
}
public int getTotal(){
return totalDistance;
}
}
|
package questions.FlattenBinaryTreeToLinkedList_0114;
import java.util.ArrayList;
import java.util.List;
import questions.common.TreeNode;
/*
* @lc app=leetcode.cn id=114 lang=java
*
* [114] 二叉树展开为链表
*
* https://leetcode-cn.com/problems/flatten-binary-tree-to-linked-list/description/
*
* algorithms
* Medium (69.12%)
* Likes: 383
* Dislikes: 0
* Total Accepted: 46.2K
* Total Submissions: 66.7K
* Testcase Example: '[1,2,5,3,4,null,6]'
*
* 给定一个二叉树,原地将它展开为一个单链表。
*
*
*
* 例如,给定二叉树
*
* 1
* / \
* 2 5
* / \ \
* 3 4 6
*
* 将其展开为:
*
* 1
* \
* 2
* \
* 3
* \
* 4
* \
* 5
* \
* 6
*
*/
// @lc code=start
/**
* Definition for a binary tree node. public class TreeNode { int val; TreeNode
* left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left
* = left; this.right = right; } }
*/
class Solution {
public void flatten1(TreeNode root) {
if (root == null) return;
List<TreeNode> list = new ArrayList<>();
helper1(root, list);
root.left = null;
root.right = null;
TreeNode node = root;
for (TreeNode n : list.subList(1, list.size())) {
node.right = n;
node = node.right;
}
}
// 1. 笨办法, 把树变成链表再,转换成树, 题目的意思应该是原地对树进行修改
private void helper1(TreeNode node, List<TreeNode> list) {
if (node == null) return;
list.add(node);
helper1(node.left, list);
helper1(node.right, list);
node.left = null;
node.right = null;
}
public void flatten2(TreeNode root) {
if (root == null)
return;
helper2(root);
}
// 2. 每次都返回子树处理后的头和尾组成的数组
private TreeNode[] helper2(TreeNode node) {
if (node == null) {
return new TreeNode[] {};
}
if (node.left == null && node.right == null) {
// 叶子节点, 头尾相同
return new TreeNode[] { node, node };
}
TreeNode temp = node.right;
TreeNode[] leftArr = helper2(node.left);
if (leftArr.length != 0) {
// 处理左子树
node.left = null;
node.right = leftArr[0];
TreeNode[] rightArr = helper2(temp);
if (rightArr.length != 0) {
leftArr[1].right = rightArr[0];
return new TreeNode[] { node, rightArr[1] };
}
// 右子树为空, 直接返回左子树
return new TreeNode[] { node, leftArr[1] };
} else {
// 没有左子树,返回右子树的结果
TreeNode[] rightArr = helper2(node.right);
node.right = rightArr[0];
return new TreeNode[] { node, rightArr[1] };
}
}
public void flatten(TreeNode root) {
if (root == null)
return;
helper3(root);
}
// 3. 根据题解, 每次都把左子树换成右子树, 然后找到新右子树最右下的节点,把老的右子树连接上去,然后找到下一个right节点,带入递归式,继续这个操作下去
// 递归的终止条件是,left 和 right节点为null
private void helper3(TreeNode node) {
TreeNode left = node.left;
TreeNode right = node.right;
if (node.left != null) {
node.right = left; // 左子树 => 右子树
node.left = null;
TreeNode rightNode = findRightTreeNode(node); // 找到右下角的节点
rightNode.right = right; // 旧的右子树接上去
} else if (right == null) {
// 到叶子节点了
return;
}
helper3(node.right);
}
private TreeNode findRightTreeNode(TreeNode node) {
while (node.right != null) {
node = node.right;
}
return node;
}
public static void main(String[] args) {
/* TreeNode t1 = new TreeNode(1);
TreeNode t2 = new TreeNode(2);
TreeNode t3 = new TreeNode(3);
TreeNode t4 = new TreeNode(4);
TreeNode t5 = new TreeNode(5);
TreeNode t6 = new TreeNode(6);
t1.left = t2;
t1.right= t5;
t2.left = t3;
t2.right = t4;
t5.right = t6; */
TreeNode t1 = new TreeNode(1);
TreeNode t2 = new TreeNode(2);
TreeNode t3 = new TreeNode(3);
t1.left = t2;
t2.left = t3;
new Solution().flatten(t1);
}
}
// @lc code=end
|
import java.awt.*;
import java.applet.*;
/*
<applet code = "Sample Applet" width = 500 height = 200>
</applet>
*/
public class SA extends Applet{
String message;
public void init(){
setBackground(Color.cyan);
SetForeground(Color.red);
msg+ = "Inside the init() method -----";
}
public void start(){
msg+="Inside the Start() method -----";
}
//Displays the message in a window
public void paint(Graphics g){
msg+ = "Inside the start() method -----";
g.drawString(msg, 10, 30);
}
} |
package com.train.ioc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component("knight")
public class Knight {
private String username;
private Weapon weapon;
public Knight() {
System.out.println("enter const...");
}
public Knight(String username,Weapon weapon) {
this.username = username;
this.weapon = weapon;
}
public String getUsername() {
return username;
}
@Autowired
@Value("Leon")
public void setUsername(String username) {
this.username = username;
}
public Weapon getWeapon() {
return weapon;
}
@Autowired
@Qualifier("axe")
public void setWeapon(Weapon weapon) {
this.weapon = weapon;
}
public void fight() {
System.out.println(username);
weapon.attack();
}
}
|
package com.founder.casserver;
import org.apereo.cas.authentication.AuthenticationEventExecutionPlan;
import org.apereo.cas.authentication.AuthenticationEventExecutionPlanConfigurer;
import org.apereo.cas.authentication.AuthenticationHandler;
import org.apereo.cas.authentication.principal.DefaultPrincipalFactory;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.services.ServicesManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 注册验证器配置
* @author yuanjizne
*
* 2019年5月16日
*/
@Configuration("loginAuthHandlerConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class LoginAuthHandlerConfiguration implements AuthenticationEventExecutionPlanConfigurer {
@Autowired
@Qualifier("servicesManager")
private ServicesManager servicesManager;
/**
* 将自定义验证器注册为bean
* @return
*
*/
@Bean
public AuthenticationHandler loginAuthenticationHandler() {
final LoginAuthenticationHandler handler = new LoginAuthenticationHandler(LoginAuthenticationHandler.class.getSimpleName(), servicesManager, new DefaultPrincipalFactory(),
1);
return handler;
}
/**
* 注册验证器
*/
public void configureAuthenticationExecutionPlan(AuthenticationEventExecutionPlan plan) {
plan.registerAuthenticationHandler(loginAuthenticationHandler());
}
}
|
/**
*
*/
/**
* @author Personal
*
*/
public class onesBits {
public Integer count(Integer u) {
Integer uCount = 0;
uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111);
return ((uCount + (uCount >> 3)) & 030707070707) % 63;
}
public Integer anotherMethod(Integer u) {
Integer uCount=u;
do
{
u=u>>1;
uCount -= u;
}
while(u != 0);
return uCount;
}
}
|
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package LanguageWorkbenchCompetition.impl;
import LanguageWorkbenchCompetition.LWCModelElement;
import LanguageWorkbenchCompetition.LWCSourceExhaustEnd;
import LanguageWorkbenchCompetition.LWCSystemEnd;
import LanguageWorkbenchCompetition.LanguageWorkbenchCompetitionPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>LWC Source Exhaust End</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link LanguageWorkbenchCompetition.impl.LWCSourceExhaustEndImpl#getFromElement <em>From Element</em>}</li>
* <li>{@link LanguageWorkbenchCompetition.impl.LWCSourceExhaustEndImpl#getToElement <em>To Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LWCSourceExhaustEndImpl extends LWCModelElementImpl implements LWCSourceExhaustEnd {
/**
* The cached value of the '{@link #getFromElement() <em>From Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFromElement()
* @generated
* @ordered
*/
protected LWCModelElement fromElement;
/**
* The cached value of the '{@link #getToElement() <em>To Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getToElement()
* @generated
* @ordered
*/
protected LWCSystemEnd toElement;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LWCSourceExhaustEndImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return LanguageWorkbenchCompetitionPackage.Literals.LWC_SOURCE_EXHAUST_END;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LWCModelElement getFromElement() {
if (fromElement != null && fromElement.eIsProxy()) {
InternalEObject oldFromElement = (InternalEObject)fromElement;
fromElement = (LWCModelElement)eResolveProxy(oldFromElement);
if (fromElement != oldFromElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__FROM_ELEMENT, oldFromElement, fromElement));
}
}
return fromElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LWCModelElement basicGetFromElement() {
return fromElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFromElement(LWCModelElement newFromElement) {
LWCModelElement oldFromElement = fromElement;
fromElement = newFromElement;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__FROM_ELEMENT, oldFromElement, fromElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LWCSystemEnd getToElement() {
if (toElement != null && toElement.eIsProxy()) {
InternalEObject oldToElement = (InternalEObject)toElement;
toElement = (LWCSystemEnd)eResolveProxy(oldToElement);
if (toElement != oldToElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__TO_ELEMENT, oldToElement, toElement));
}
}
return toElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LWCSystemEnd basicGetToElement() {
return toElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setToElement(LWCSystemEnd newToElement) {
LWCSystemEnd oldToElement = toElement;
toElement = newToElement;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__TO_ELEMENT, oldToElement, toElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__FROM_ELEMENT:
if (resolve) return getFromElement();
return basicGetFromElement();
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__TO_ELEMENT:
if (resolve) return getToElement();
return basicGetToElement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__FROM_ELEMENT:
setFromElement((LWCModelElement)newValue);
return;
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__TO_ELEMENT:
setToElement((LWCSystemEnd)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__FROM_ELEMENT:
setFromElement((LWCModelElement)null);
return;
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__TO_ELEMENT:
setToElement((LWCSystemEnd)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__FROM_ELEMENT:
return fromElement != null;
case LanguageWorkbenchCompetitionPackage.LWC_SOURCE_EXHAUST_END__TO_ELEMENT:
return toElement != null;
}
return super.eIsSet(featureID);
}
} //LWCSourceExhaustEndImpl
|
package com.smartbear.field;
import com.smartbear.objects.Bomb;
import java.util.Random;
/**
* Created by druger on 26.09.2016.
*/
public class Field {
private Cell[][] cells;
private int width;
private int height;
public static int openedCells;
private int bombs;
public Field(int width, int height, int bombs) {
this.width = width;
this.height = height;
cells = new Cell[width][height];
this.bombs = bombs;
}
public Cell[][] getCells() {
return cells;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public int getBombs() {
return bombs;
}
public void initField() {
initCells();
initBombs();
initNearBombs();
}
private void initNearBombs() {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (cells[i][j].getBomb() == null) {
int count = 0;
for (int dx = -1; dx < 2; dx++) {
for (int dy = -1; dy < 2; dy++) {
int nX = i + dx;
int nY = j + dy;
if (nX < 0 || nY < 0 || nX > width - 1 || nY > height - 1) {
nX = i;
nY = j;
}
count += (cells[nX][nY].getBomb() != null) ? 1 : 0;
}
}
cells[i][j].setNearBomb(count);
}
}
}
}
private void initBombs() {
int x;
int y;
int countBombs = 0;
Random random = new Random();
while (countBombs < bombs) {
do {
x = random.nextInt(width);
y = random.nextInt(height);
} while (cells[x][y].getBomb() != null);
cells[x][y].setBomb(new Bomb(x, y));
countBombs++;
}
}
private void initCells() {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
cells[i][j] = new Cell();
}
}
}
public void openCells(int x, int y) {
if (x < 0 || x > width - 1 || y < 0 || y > height - 1) return;
if (cells[x][y].isOpen()) return;
cells[x][y].open();
if (cells[x][y].getNearBomb() > 0 ||
(cells[x][y].getBomb() != null && cells[x][y].getBomb().isExploded())) return;
for (int dx = -1; dx < 2; dx++) {
for (int dy = -1; dy < 2; dy++) {
openCells(x + dx, y + dy);
}
}
}
}
|
package com.msa_sample01.svc.member.client;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import com.msa_sample01.svc.member.domain.Member;
@Component
public class OrderServiceClientFallback implements OrderServiceClient {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderServiceClientFallback.class);
// @Override
// public ResponseEntity<Member> order(Member member) {
// LOGGER.error("Error during order for member: {}", member.getName());
//
// return new ResponseEntity<Member>(member, HttpStatus.BAD_GATEWAY);
//
// }
@Override
public ResponseEntity<Member> order(String member) {
LOGGER.error("Error during call order for member: {}", member);
return new ResponseEntity<Member>(new Member(), HttpStatus.BAD_GATEWAY);
}
} |
package ru.krasview.kvlib.widget.lists;
import ru.krasview.secret.ApiConst;
import android.content.Context;
public class SearchAnimeList extends SearchShowList {
public SearchAnimeList(Context context) {
super(context);
}
@Override
protected String getApiAddress() {
return ApiConst.ANIME;
}
}
|
/** ****************************************************************************
* Copyright (c) The Spray Project.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Spray Dev Team - initial API and implementation
**************************************************************************** */
package org.eclipselabs.spray.xtext.tests;
import javax.inject.Inject;
import org.eclipse.xtext.formatting.INodeModelFormatter;
import org.eclipse.xtext.formatting.INodeModelFormatter.IFormattedRegion;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.resource.XtextResource;
import org.junit.runner.RunWith;
import org.xpect.expectation.IStringExpectation;
import org.xpect.expectation.StringExpectation;
import org.xpect.parameter.ParameterParser;
import org.xpect.runner.Xpect;
import org.xpect.runner.XpectRunner;
import org.xpect.runner.XpectTestFiles;
import org.xpect.runner.XpectTestFiles.FileRoot;
import org.xpect.setup.XpectSetup;
import org.xpect.xtext.lib.setup.ThisOffset;
import org.xpect.xtext.lib.setup.ThisResource;
import org.xpect.xtext.lib.setup.XtextStandaloneSetup;
@RunWith(XpectRunner.class)
@XpectTestFiles(relativeTo = FileRoot.PROJECT, baseDir = "model/testcases/formatter", fileExtensions = "spray")
@XpectSetup({ XtextStandaloneSetup.class })
public class SprayFormatterTest {
@Inject
protected INodeModelFormatter formatter;
@ParameterParser(syntax = "('from' offset=OFFSET 'to' to=OFFSET)?")
@Xpect
public void formatted(
@StringExpectation(whitespaceSensitive = true) IStringExpectation expectation,
@ThisResource XtextResource resource, @ThisOffset int offset,
@ThisOffset int to) {
ICompositeNode rootNode = resource.getParseResult().getRootNode();
IFormattedRegion r = null;
if (offset >= 0 && to > offset) {
r = formatter.format(rootNode, offset, to - offset);
} else {
r = formatter.format(rootNode, rootNode.getOffset(),
rootNode.getTotalLength());
}
String formatted = r.getFormattedText();
if (isUnixEnding()) {
formatted = formatted.replaceAll("\r\n", "\n");
} else if (isWindowsEnding()) {
if(!rootNode.getText().contains("\r\n")) {
formatted = formatted.replaceAll("\r\n", "\n");
} else {
formatted = formatted.replaceAll("(!\r)\n", "\r\n");
}
}
expectation.assertEquals(formatted);
}
private static boolean isWindowsEnding() {
String ls = System.getProperty("line.separator");
return "\r\n".equals(ls);
}
private static boolean isUnixEnding() {
String ls = System.getProperty("line.separator");
return "\n".equals(ls);
}
}
|
package DBI;
public class User {
public String username; // user's username
public Integer played; // number of games they've played
public Integer won; // number of games they've won
public Float correct; // percentage of submitted sets that are correct
}
|
import java.util.*;
/**
* 242. Valid Anagram
* Easy
* javac -encoding utf-8
*/
public class Solution {
public boolean isAnagram(String s, String t) {
if (s.length() != t.length()) {
return false;
}
Map<Character, Integer> counter = new HashMap<>();
for (int i = 0; i < s.length(); i++) {
Character c = s.charAt(i);
counter.put(c, counter.getOrDefault(c, 0) + 1);
}
for (int i = 0; i < t.length(); i++) {
Character c = t.charAt(i);
if (counter.getOrDefault(c, 0) == 0) {
return false;
} else {
counter.put(c, counter.get(c) - 1);
}
}
return true;
}
public static void main(String[] args) {
String[][] strs = { { "测试", "试测" }, { "测试", "参数测试" } };
Solution sol = new Solution();
for (String[] st : strs) {
System.out.println(sol.isAnagram(st[0], st[1]));
}
}
}
|
package src.Exceptions;
import src.Enums.EAttribute;
/**
* Created with IntelliJ IDEA.
* User: B. Seelbinder
* UID: ga25wul
* Date: 10.07.2014
* Time: 21:00
* *
*/
public class EXInvalidAttributeValueException extends RuntimeException {
private final EAttribute ATTRIBUTE;
public EXInvalidAttributeValueException( final EAttribute ATT ) {
this.ATTRIBUTE = ATT;
}
@Override
public String toString() {
return super.toString() + " attribute: " + ATTRIBUTE;
}
}
|
package org.fhcrc.honeycomb.metapop.fitness.fitnesscalculator;
/**
* Calculates the fitness based on the Monod equation.
*
* Created on 22 Apr, 2013
* @author Adam Waite
* @version $Id: MonodCalculator.java 1961 2013-04-23 17:11:40Z ajwaite $
*/
public class MonodCalculator implements FitnessCalculator {
private double Vmax;
private double Km;
private double d;
MonodCalculator(double Vmax, double Km, double d) {
this.Vmax = Vmax;
this.Km = Km;
this.d = d;
}
@Override
public double calculate(Population pop) {
return (((Vmax+d)*nutrient_conc / (nutrient_conc + Km)) - d);
}
}
|
package br.com.professorisidro.assessment.ui;
import java.util.ArrayList;
import java.util.Collections;
import br.com.professorisidro.assessment.core.Prova;
import br.com.professorisidro.assessment.core.Questao;
import javax.swing.JOptionPane;
public class MainClass {
public static void main(String args[]) {
//Scanner teclado = new Scanner(System.in);
ArrayList<Questao> lista;
lista = new ArrayList<Questao>();
lista.add(new Questao("Quem descobriu o Brasa?", "PA Cabral"));
lista.add(new Questao("Qual a formula da água?", "H2O"));
lista.add(new Questao("Quanto é 2+2","4"));
lista.add(new Questao("Qual a linguagem do nosso curso?", "JAVA"));
lista.add(new Questao("Qual o proximo feriado?", "Nao sei"));
String resp;
Prova p1 = new Prova("Zezinho", lista);
//System.out.println("Prova do "+p1.getAluno());
JOptionPane.showMessageDialog(null, "Prova do "+p1.getAluno());
while (p1.temQuestoes()) {
Questao q = p1.buscarQuestaoAtual();
//System.out.println("Q: "+q.aplicarQuestao());
//resp = teclado.nextLine();
resp = JOptionPane.showInputDialog(q.aplicarQuestao());
p1.corrigir(resp);
p1.proximaQuestao();
}
Collections.shuffle(lista);
Prova p2 = new Prova("Pedrinho", lista);
//System.out.println("Prova do "+p2.getAluno());
JOptionPane.showMessageDialog(null, "Prova do "+p2.getAluno());
while (p2.temQuestoes()) {
Questao q = p2.buscarQuestaoAtual();
//System.out.println("Q: "+q.aplicarQuestao());
//resp = teclado.nextLine();
resp = JOptionPane.showInputDialog(q.aplicarQuestao());
p2.corrigir(resp);
p2.proximaQuestao();
}
JOptionPane.showMessageDialog(null, p1.getAluno()+" "+p1.getNota());
JOptionPane.showMessageDialog(null, p2.getAluno()+" "+p2.getNota());
//System.out.println(p1.getAluno()+ " "+p1.getNota());
//System.out.println(p2.getAluno()+ " "+p2.getNota());
}
}
|
/*
* Copyright 2022 Amazon.com, Inc. or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at:
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.partiql.examples;
import com.amazon.ion.IonDatagram;
import com.amazon.ion.IonReader;
import com.amazon.ion.IonSystem;
import com.amazon.ion.IonWriter;
import com.amazon.ion.system.IonReaderBuilder;
import com.amazon.ion.system.IonSystemBuilder;
import com.amazon.ion.system.IonTextWriterBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import org.jetbrains.annotations.NotNull;
import org.partiql.examples.util.Example;
import org.partiql.lang.CompilerPipeline;
import org.partiql.lang.eval.Bindings;
import org.partiql.lang.eval.EvaluationSession;
import org.partiql.lang.eval.ExprValue;
import org.partiql.lang.eval.ExprValueExtensionsKt;
import org.partiql.lang.eval.Expression;
import java.io.IOException;
import java.io.PrintStream;
/**
* This example executes a PartiQL query against ION data stored as an object in S3.
*/
public class S3JavaExample extends Example {
public S3JavaExample(@NotNull PrintStream out) {
super(out);
}
@Override
public void run() {
// Setup this variables before running the example:
final String bucket_name = "";
final String key_name = "";
final String region = "";
/*
Upload the data below to your S3 bucket
{"id": "1", "name": "person_1", "age": 32, "address": "555 1st street, Seattle", "tags": []}
{"id": "2", "name": "person_2", "age": 24}
{"id": "3", "name": "person_3", "age": 25, "address": {"number": 555, "street": "1st street", "city": "Seattle"}, "tags": ["premium_user"]}
*/
final AmazonS3 s3 = AmazonS3Client.builder().withRegion(region).build();
// Initializes the ion system used by PartiQL
final IonSystem ion = IonSystemBuilder.standard().build();
// CompilerPipeline is the main entry point for the PartiQL lib giving you access to the compiler
// and value factories
final CompilerPipeline pipeline = CompilerPipeline.standard();
// Compiles the query, the resulting expression can be re-used to query multiple data sets
final Expression selectAndFilter = pipeline.compile(
"SELECT doc.name, doc.address FROM myS3Document doc WHERE doc.age < 30");
try (
final S3Object s3Object = s3.getObject(bucket_name, key_name);
final S3ObjectInputStream s3InputStream = s3Object.getObjectContent();
// We are using ion-java to parse the JSON data as PartiQL comes with an embedded value factory for
// Ion data and Ion being a superset of JSON any JSON data is also Ion data
// http://amzn.github.io/ion-docs/
// https://github.com/amzn/ion-java
final IonReader ionReader = IonReaderBuilder.standard().build(s3InputStream);
// We are using ion-java again to dump the PartiQL query result as JSON
final IonWriter resultWriter = IonTextWriterBuilder.json().build((Appendable) System.out);
) {
// Parses all data from the S3 bucket into the Ion DOM
final IonDatagram values = ion.getLoader().load(ionReader);
// Evaluation session encapsulates all information to evaluate a PartiQL expression, including the
// global bindings
final EvaluationSession session = EvaluationSession.builder()
// We implement the Bindings interface using a lambda. Bindings are used to map names into values,
// in this case we are binding the data from the S3 bucket into the "myS3Document" name
.globals(
Bindings.<ExprValue>lazyBindingsBuilder()
.addBinding("myS3Document", () -> ExprValue.of(values))
.build()
)
.build();
// Executes the query in the session that's encapsulating the JSON data
final ExprValue selectAndFilterResult = selectAndFilter.eval(session);
// Uses ion-java to dump the result as JSON. It's possible to build your own writer and dump the ExprValue
// as any format you want.
ExprValueExtensionsKt.toIonValue(selectAndFilterResult, ion).writeTo(resultWriter);
// result as JSON below
// [{"name":"person_2"},{"name":"person_3","address":{"number":555,"street":"1st street","city":"Seattle"}}]
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
|
package com.dishcuss.foodie.hub.Models;
/**
* Created by Naeem Ibrahim on 7/30/2016.
*/
public class MyFeeds {
int id;
String name;
String username;
String avatarPic;
String location;
boolean following;
int followers;
public MyFeeds() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAvatarPic() {
return avatarPic;
}
public void setAvatarPic(String avatarPic) {
this.avatarPic = avatarPic;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public boolean isFollowing() {
return following;
}
public void setFollowing(boolean following) {
this.following = following;
}
public int getFollowers() {
return followers;
}
public void setFollowers(int followers) {
this.followers = followers;
}
}
|
package replicatorg.drivers.gen3;
/**
* Enum for VendorID and ProductId comparison,
* @author farmckon
*
*/
public enum VidPid {
UNKNOWN (0X0000, 0X000),
MIGHTY_BOARD (0x23C1, 0xB404), //Board 404!
THE_REPLICATOR(0x23C1, 0xD314), //Dean 314
REPLICATOR_2(0x23C1, 0xB015), // BOTS as leet
SAILFISH_G34(0x23C1, 0xACDC); // Sailfish Gen 3 and Gen 4 Motherboard (Cupcake/Thingomatic)
final int pid; //productId (same as USB product id)
final int vid; //vendorId (same as USB vendor id)
private VidPid(int pid, int vid)
{
this.pid = pid;
this.vid = vid;
}
/** Create a PID/VID if we know how to,
* otherwise return unknown.
* @param bytes 4 byte array of PID/VID
* @return
*/
public static VidPid getPidVid(byte[] bytes)
{
if (bytes != null && bytes.length >= 4){
int vid = ((int) bytes[0]) & 0xff;
vid += (((int) bytes[1]) & 0xff) << 8;
int pid = ((int) bytes[2]) & 0xff;
pid += (((int) bytes[3]) & 0xff) << 8;
for (VidPid known : VidPid.values())
{
if(known.equals(vid,pid)) return known;
}
}
return VidPid.UNKNOWN;
}
public boolean equals(VidPid VidPid){
if (VidPid.vid == this.vid &&
VidPid.pid == this.pid)
return true;
return false;
}
public boolean equals(int pid, int vid){
if (vid == this.vid &&
pid == this.pid)
return true;
return false;
}
}
|
package com.cyriii.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
/**
* 出库信息
*/
@Data
@Accessors(chain = true)
public class OutStoreInfo {
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 商品ID
*/
private String goodId;
/**
* 出货数量
*/
private BigDecimal demandNum;
/**
* 出货单价
*/
private BigDecimal demandUnivalence;
/**
* 出货日期
*/
private Date demandDate;
/**
* 所属用户id
*/
private String userId;
/**
* 创建时间
*/
private Date createDate;
}
|
package command;
public class TurnOnCommand implements ICommand {
private Receiver receiver;
public TurnOnCommand(Receiver receiver) {
this.receiver = receiver;
}
@Override
public void execute() {
this.receiver.onAction();
}
}
|
package datastructure.greedy;
import java.util.ArrayList;
import java.util.List;
/**
* @Author weimin
* @Date 2020/10/26 0026 14:05
* 贪心算法
*/
public class GreedyTest {
public static void main(String[] args) {
}
}
|
package com.tencent.mm.pluginsdk.model;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.ao;
import com.tencent.mm.sdk.platformtools.e;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.xweb.WebView;
import com.tencent.xweb.r;
import com.tencent.xweb.x5.sdk.d;
import com.tencent.xweb.x5.sdk.f;
public final class u$a {
private static boolean qzz = false;
static {
x.i("TBSDownloadChecker", "TRACE_ORDER:TBSHelper.java");
r.a(ad.getContext(), new 1(), null, null);
}
public static void eP(Context context) {
long j;
long currentTimeMillis;
x.i("MicroMsg.TBSDownloadChecker", "webview start check tbs");
SharedPreferences sharedPreferences = context.getSharedPreferences("com.tencent.mm_webview_x5_preferences", 4);
if (sharedPreferences != null) {
j = sharedPreferences.getLong("last_check_xwalk", 0);
currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - j >= 1800000) {
Editor edit = sharedPreferences.edit();
edit.putLong("last_check_xwalk", currentTimeMillis);
edit.apply();
T(context, 4);
}
}
int i = 1;
x.i("MicroMsg.TBSDownloadChecker", "user hasDownloadOverSea = %b", new Object[]{Boolean.valueOf(sharedPreferences.getBoolean("tbs_download_oversea", false))});
if (sharedPreferences.getBoolean("tbs_download_oversea", false)) {
i = 2;
} else if (e.chv()) {
x.i("MicroMsg.TBSDownloadChecker", "isGPVersion, ignore this request");
return;
}
if ("1".equals(sharedPreferences.getString("tbs_download", null))) {
x.i("MicroMsg.TBSDownloadChecker", "check, tbsDownload = %s, isWifi = %b", new Object[]{r2, Boolean.valueOf(ao.isWifi(context))});
if (ao.isWifi(context)) {
Object obj;
Intent intent;
if (sharedPreferences == null) {
x.e("MicroMsg.TBSDownloadChecker", "sp is null");
} else {
j = sharedPreferences.getLong("last_check_ts", 0);
currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - j > 7200000) {
Editor edit2 = sharedPreferences.edit();
edit2.putLong("last_check_ts", currentTimeMillis);
edit2.apply();
obj = 1;
if (obj == null) {
x.i("MicroMsg.TBSDownloadChecker", "check expired false, tbsCoreVersion = %d", new Object[]{Integer.valueOf(WebView.getInstalledTbsCoreVersion(context))});
if (WebView.getInstalledTbsCoreVersion(context) > 0) {
return;
}
}
intent = new Intent();
intent.setClassName(ad.getPackageName(), "com.tencent.mm.sandbox.updater.UpdaterService");
intent.putExtra("intent_extra_download_type", i);
context.startService(intent);
x.i("MicroMsg.TBSDownloadChecker", "start UpdaterService to download tbs");
return;
}
}
obj = null;
if (obj == null) {
x.i("MicroMsg.TBSDownloadChecker", "check expired false, tbsCoreVersion = %d", new Object[]{Integer.valueOf(WebView.getInstalledTbsCoreVersion(context))});
if (WebView.getInstalledTbsCoreVersion(context) > 0) {
return;
}
}
intent = new Intent();
intent.setClassName(ad.getPackageName(), "com.tencent.mm.sandbox.updater.UpdaterService");
intent.putExtra("intent_extra_download_type", i);
context.startService(intent);
x.i("MicroMsg.TBSDownloadChecker", "start UpdaterService to download tbs");
return;
}
x.i("MicroMsg.TBSDownloadChecker", "check, net type is not wifi");
return;
}
x.i("MicroMsg.TBSDownloadChecker", "tbsDownload switch is off, value = %s", new Object[]{sharedPreferences.getString("tbs_download", null)});
}
public static void T(Context context, int i) {
if (!e.chv()) {
Intent intent = new Intent();
intent.setClassName(ad.getPackageName(), "com.tencent.mm.sandbox.updater.UpdaterService");
intent.putExtra("intent_extra_download_type", i);
context.startService(intent);
x.i("MicroMsg.TBSDownloadChecker", "start UpdaterService to download xwalk now");
}
}
public static void cbB() {
if (e.chv()) {
x.d("MicroMsg.TBSDownloadChecker", "preCheck isGPVersion, ignore this request");
} else if (f.il(ad.getContext()) && WebView.getInstalledTbsCoreVersion(ad.getContext()) <= 0) {
Intent intent = new Intent();
intent.setClassName(ad.getPackageName(), "com.tencent.mm.sandbox.updater.UpdaterService");
intent.putExtra("intent_extra_download_type", 1);
ad.getContext().startService(intent);
x.i("MicroMsg.TBSDownloadChecker", "start UpdaterService to download tbs");
}
}
public static boolean cbC() {
return f.isDownloading() || d.getTBSInstalling() || qzz;
}
public static void kB(boolean z) {
qzz = z;
}
public static int cbD() {
if (!e.chv()) {
if (d.getTbsVersion(ad.getContext()) < 36824) {
x.i("MicroMsg.TBSDownloadChecker", "tbsCoreVersion %d should download", new Object[]{Integer.valueOf(d.getTbsVersion(ad.getContext()))});
return 1;
} else if (d.canOpenWebPlus(ad.getContext())) {
x.i("MicroMsg.TBSDownloadChecker", "tbsCoreVersion %d can load x5", new Object[]{Integer.valueOf(r2)});
return 0;
} else {
x.i("MicroMsg.TBSDownloadChecker", "tbsCoreVersion %d can not load x5", new Object[]{Integer.valueOf(r2)});
return 1;
}
} else if (com.tencent.mm.compatible.util.d.fS(17)) {
x.i("MicroMsg.TBSDownloadChecker", "is GP version can not download");
return 2;
} else {
x.i("MicroMsg.TBSDownloadChecker", "is GP version no need download");
return 0;
}
}
public static int cbE() {
if (com.tencent.mm.compatible.util.d.fR(19) || com.tencent.mm.compatible.util.d.fS(16)) {
return 1;
}
if (WebView.getInstalledTbsCoreVersion(ad.getContext()) > 0) {
return 4;
}
if (f.isDownloading()) {
return 2;
}
if (d.getTBSInstalling()) {
return 3;
}
x.i("MicroMsg.TBSDownloadChecker", "oversea = %b", new Object[]{Boolean.valueOf(ad.getContext().getSharedPreferences("com.tencent.mm_webview_x5_preferences", 4).getBoolean("tbs_download_oversea", false))});
if (ad.getContext().getSharedPreferences("com.tencent.mm_webview_x5_preferences", 4).getBoolean("tbs_download_oversea", false)) {
return 2;
}
x.e("MicroMsg.TBSDownloadChecker", "WTF, how could it be?");
return 0;
}
public static void eQ(Context context) {
Intent intent = new Intent();
intent.setClassName(ad.getPackageName(), "com.tencent.mm.sandbox.updater.UpdaterService");
intent.putExtra("intent_extra_download_type", 2);
intent.putExtra("intent_extra_download_ignore_network_type", true);
context.startService(intent);
x.i("MicroMsg.TBSDownloadChecker", "start UpdaterService to download tbs");
SharedPreferences sharedPreferences = ad.getContext().getSharedPreferences("com.tencent.mm_webview_x5_preferences", 4);
if (sharedPreferences != null) {
sharedPreferences.edit().putBoolean("tbs_download_oversea", true).apply();
}
}
}
|
package com.tencent.mm.plugin.appbrand.jsapi.bio.soter;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandMainProcessService;
import com.tencent.mm.plugin.appbrand.jsapi.a;
import com.tencent.mm.plugin.appbrand.l;
import com.tencent.mm.plugin.appbrand.r.c;
import com.tencent.mm.sdk.platformtools.x;
import org.json.JSONObject;
public final class JsApiCheckBioEnrollment extends a {
public static final int CTRL_INDEX = 344;
public static final String NAME = "checkIsSoterEnrolledInDevice";
private GetIsEnrolledTask fKR = null;
public final void a(l lVar, JSONObject jSONObject, int i) {
x.i("MicroMsg.JsApiCheckBioEnrollment", "hy: subapp start do check is enrolled");
this.fKR = new GetIsEnrolledTask(lVar, i, a.tq(jSONObject.optString("checkAuthMode")), this);
c.br(this.fKR);
AppBrandMainProcessService.a(this.fKR);
}
}
|
package com.aprendoz_test.data;
/**
* aprendoz_test.InscipcionesVistaAsignaturas
* 01/19/2015 07:58:52
*
*/
public class InscipcionesVistaAsignaturas {
private InscipcionesVistaAsignaturasId id;
public InscipcionesVistaAsignaturasId getId() {
return id;
}
public void setId(InscipcionesVistaAsignaturasId id) {
this.id = id;
}
}
|
/*
* Copyright (c) 2016, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package uk.ac.man.cs.llvm.ir.model;
import java.util.ArrayList;
import java.util.List;
import uk.ac.man.cs.llvm.ir.InstructionGenerator;
import uk.ac.man.cs.llvm.ir.model.elements.AllocateInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.BinaryOperationInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.BranchInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.Call;
import uk.ac.man.cs.llvm.ir.model.elements.CallInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.CastInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.CompareInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.ConditionalBranchInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.ExtractElementInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.ExtractValueInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.GetElementPointerInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.IndirectBranchInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.InsertElementInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.InsertValueInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.Instruction;
import uk.ac.man.cs.llvm.ir.model.elements.LoadInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.PhiInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.ReturnInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.SelectInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.ShuffleVectorInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.StoreInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.SwitchInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.SwitchOldInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.UnreachableInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.ValueInstruction;
import uk.ac.man.cs.llvm.ir.model.elements.VoidCallInstruction;
import uk.ac.man.cs.llvm.ir.model.enums.BinaryOperator;
import uk.ac.man.cs.llvm.ir.model.enums.CastOperator;
import uk.ac.man.cs.llvm.ir.model.enums.CompareOperator;
import uk.ac.man.cs.llvm.ir.model.enums.Flag;
import uk.ac.man.cs.llvm.ir.types.FloatingPointType;
import uk.ac.man.cs.llvm.ir.types.MetaType;
import uk.ac.man.cs.llvm.ir.types.Type;
import uk.ac.man.cs.llvm.ir.types.VectorType;
public final class InstructionBlock implements InstructionGenerator, ValueSymbol {
private final FunctionDefinition method;
private final int blockIndex;
private final List<Instruction> instructions = new ArrayList<>();
private String name = ValueSymbol.UNKNOWN;
public InstructionBlock(FunctionDefinition method, int index) {
this.method = method;
this.blockIndex = index;
}
public void accept(InstructionVisitor visitor) {
for (Instruction instruction : instructions) {
instruction.accept(visitor);
}
}
private void addInstruction(Instruction element) {
if (element instanceof ValueInstruction) {
method.getSymbols().addSymbol(element);
}
instructions.add(element);
}
@Override
public void createAllocation(Type type, int count, int align) {
addInstruction(new AllocateInstruction(
type,
method.getSymbols().getSymbol(count),
align));
}
@Override
public void createBinaryOperation(Type type, int opcode, int flags, int lhs, int rhs) {
boolean isFloatingPoint = type instanceof FloatingPointType || (type instanceof VectorType && ((VectorType) type).getElementType() instanceof FloatingPointType);
BinaryOperator operator = BinaryOperator.decode(opcode, isFloatingPoint);
BinaryOperationInstruction operation = new BinaryOperationInstruction(type, operator, Flag.decode(operator, flags));
operation.setLHS(method.getSymbols().getSymbol(lhs, operation));
operation.setRHS(method.getSymbols().getSymbol(rhs, operation));
addInstruction(operation);
}
@Override
public void createBranch(int block) {
addInstruction(new BranchInstruction(
method.getBlock(block)));
}
@Override
public void createBranch(int condition, int blockTrue, int blockFalse) {
addInstruction(new ConditionalBranchInstruction(
method.getSymbols().getSymbol(condition),
method.getBlock(blockTrue),
method.getBlock(blockFalse)));
}
@Override
public void createCall(Type type, int target, int[] arguments) {
Call call;
if (type == MetaType.VOID) {
call = new VoidCallInstruction(method.getSymbols().getSymbol(target));
} else {
call = new CallInstruction(type, method.getSymbols().getSymbol(target));
}
for (int i = 0; i < arguments.length; i++) {
call.addArgument(method.getSymbols().getSymbol(arguments[i], call));
}
addInstruction(call);
}
@Override
public void createCast(Type type, int opcode, int value) {
CastInstruction cast = new CastInstruction(type, CastOperator.decode(opcode));
cast.setValue(method.getSymbols().getSymbol(value, cast));
addInstruction(cast);
}
@Override
public void createCompare(Type type, int opcode, int lhs, int rhs) {
CompareInstruction compare = new CompareInstruction(type, CompareOperator.decode(opcode));
compare.setLHS(method.getSymbols().getSymbol(lhs, compare));
compare.setRHS(method.getSymbols().getSymbol(rhs, compare));
addInstruction(compare);
}
@Override
public void createExtractElement(Type type, int vector, int index) {
addInstruction(new ExtractElementInstruction(
type,
method.getSymbols().getSymbol(vector),
method.getSymbols().getSymbol(index)));
}
@Override
public void createExtractValue(Type type, int aggregate, int index) {
addInstruction(new ExtractValueInstruction(
type,
method.getSymbols().getSymbol(aggregate),
index));
}
@Override
public void createGetElementPointer(Type type, int pointer, int[] indices, boolean isInbounds) {
GetElementPointerInstruction gep = new GetElementPointerInstruction(type, isInbounds);
gep.setBasePointer(method.getSymbols().getSymbol(pointer, gep));
for (int i = 0; i < indices.length; i++) {
gep.addIndex(method.getSymbols().getSymbol(indices[i], gep));
}
addInstruction(gep);
}
@Override
public void createIndirectBranch(int address, int[] successors) {
InstructionBlock[] blocks = new InstructionBlock[successors.length];
for (int i = 0; i < successors.length; i++) {
blocks[i] = method.getBlock(successors[i]);
}
addInstruction(new IndirectBranchInstruction(
method.getSymbols().getSymbol(address),
blocks));
}
@Override
public void createInsertElement(Type type, int vector, int index, int value) {
addInstruction(new InsertElementInstruction(
type,
method.getSymbols().getSymbol(vector),
method.getSymbols().getSymbol(index),
method.getSymbols().getSymbol(value)));
}
@Override
public void createInsertValue(Type type, int aggregate, int index, int value) {
addInstruction(new InsertValueInstruction(
type,
method.getSymbols().getSymbol(aggregate),
index,
method.getSymbols().getSymbol(value)));
}
@Override
public void createLoad(Type type, int source, int align, boolean isVolatile) {
LoadInstruction load = new LoadInstruction(type, align, isVolatile);
load.setSource(method.getSymbols().getSymbol(source, load));
addInstruction(load);
}
@Override
public void createPhi(Type type, int[] values, int[] blocks) {
PhiInstruction phi = new PhiInstruction(type);
for (int i = 0; i < values.length; i++) {
phi.addCase(
method.getSymbols().getSymbol(values[i], phi),
method.getBlock(blocks[i]));
}
addInstruction(phi);
}
@Override
public void createReturn() {
addInstruction(new ReturnInstruction());
}
@Override
public void createReturn(int value) {
ReturnInstruction ret = new ReturnInstruction();
ret.setValue(method.getSymbols().getSymbol(value, ret));
addInstruction(ret);
}
@Override
public void createSelect(Type type, int condition, int trueValue, int falseValue) {
SelectInstruction select = new SelectInstruction(type);
select.setCondition(method.getSymbols().getSymbol(condition, select));
select.setTrueValue(method.getSymbols().getSymbol(trueValue, select));
select.setFalseValue(method.getSymbols().getSymbol(falseValue, select));
addInstruction(select);
}
@Override
public void createShuffleVector(Type type, int vector1, int vector2, int mask) {
addInstruction(new ShuffleVectorInstruction(type,
method.getSymbols().getSymbol(vector1),
method.getSymbols().getSymbol(vector2),
method.getSymbols().getSymbol(mask)));
}
@Override
public void createStore(int destination, int source, int align, boolean isVolatile) {
StoreInstruction store = new StoreInstruction(align, isVolatile);
store.setDestination(method.getSymbols().getSymbol(destination, store));
store.setSource(method.getSymbols().getSymbol(source, store));
addInstruction(store);
}
@Override
public void createSwitch(int condition, int defaultBlock, int[] caseValues, int[] caseBlocks) {
Symbol[] values = new Symbol[caseValues.length];
InstructionBlock[] blocks = new InstructionBlock[caseBlocks.length];
for (int i = 0; i < values.length; i++) {
values[i] = method.getSymbols().getSymbol(caseValues[i]);
blocks[i] = method.getBlock(caseBlocks[i]);
}
addInstruction(new SwitchInstruction(
method.getSymbols().getSymbol(condition),
method.getBlock(defaultBlock),
values,
blocks));
}
@Override
public void createSwitchOld(int condition, int defaultBlock, long[] caseConstants, int[] caseBlocks) {
InstructionBlock[] blocks = new InstructionBlock[caseBlocks.length];
for (int i = 0; i < blocks.length; i++) {
blocks[i] = method.getBlock(caseBlocks[i]);
}
addInstruction(new SwitchOldInstruction(
method.getSymbols().getSymbol(condition),
method.getBlock(defaultBlock),
caseConstants,
blocks));
}
@Override
public void createUnreachable() {
addInstruction(new UnreachableInstruction());
}
@Override
public void enterBlock(long id) {
}
@Override
public void exitBlock() {
}
public int getBlockIndex() {
return blockIndex;
}
@Override
public String getName() {
return name;
}
public Instruction getInstruction(int index) {
return instructions.get(index);
}
public int getInstructionCount() {
return instructions.size();
}
@Override
public Type getType() {
return MetaType.VOID;
}
@Override
public void setName(String name) {
this.name = name;
}
}
|
/*
* 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 echange;
import java.util.Scanner;
/**
*
* @author Doudou
*/
public class Echange {
public static void main(String[] args) {
int nX ;
int nY ;
Scanner lectureClavier = new Scanner(System.in);
System.out.println("Entrez nombre X");
nX = lectureClavier.nextInt();
System.out.println("Entrez nombre Y");
nY = lectureClavier.nextInt();
System.out.println("++++++++++++++++++");
System.out.println("Valeurs");
System.out.print("X = ");
System.out.println(nX);
System.out.print("Y = ");
System.out.println(nY);
nY = nX - nY ;
nX = nX - nY ;
nY = nY + nX ;
System.out.println("++++++++++++++++++");
System.out.println("Résultat");
System.out.print("X = ");
System.out.println(nX);
System.out.print("Y = ");
System.out.println(nY);
}
}
|
package swm11.jdk.jobtreaming.back.config.web;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import swm11.jdk.jobtreaming.back.config.security.JwtInterceptor;
import java.util.Arrays;
@Configuration
public class WebConfig implements WebMvcConfigurer {
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {"classpath:/static/", "classpath:/public/", "classpath:/",
"classpath:/resources/", "classpath:/META-INF/resources/", "classpath:/META-INF/resources/webjars/"};
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST")
.maxAge(3000);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(jwtInterceptor())
.addPathPatterns(Arrays.asList("/expert/register", "/expert/list", "/expert/register", "/expert/delete"))
.addPathPatterns(Arrays.asList("/evaluation/listAll", "/evaluation/add", "/evaluation/modify", "/evaluation/delete"))
.addPathPatterns(Arrays.asList("/answer/listAll", "/answer/myList", "/answer/add", "/answer/modify", "/answer/delete"))
.addPathPatterns(Arrays.asList("/question/listAll", "/question/myList", "/question/add", "/question/modify", "/question/delete"))
.addPathPatterns(Arrays.asList("/review/listAll", "/review/myList", "/review/add", "/review/modify", "/review/delete"))
.addPathPatterns(Arrays.asList("/petition/add", "/petition/modify", "/petition/delete"))
.addPathPatterns(Arrays.asList("/lecture/add", "/lecture/modify", "/lecture/join", "/lecture/myList"))
.addPathPatterns(Arrays.asList("/user/modify", "/user/delete"));
}
@Bean
public JwtInterceptor jwtInterceptor() {
return new JwtInterceptor();
}
}
|
package com.fleet.atomikos.service;
import com.fleet.atomikos.entity.User;
import org.springframework.stereotype.Component;
/**
* @author April Han
*/
@Component
public interface UserService {
User get(Integer id);
/**
* 支付
*
* @param id
* @param money
* @return
*/
boolean pay(Integer id, Integer money);
}
|
package com.sye.kupps.calendarapp.login;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.sye.kupps.calendarapp.AppActivity;
import com.sye.kupps.calendarapp.R;
import com.sye.kupps.calendarapp.containers.MockDataMaker;
import com.sye.kupps.calendarapp.containers.User;
public class RegisterFragment extends Fragment {
// Hacky way of avoiding a bug on rotation during an async task
private boolean isActivityCreated;
// Tags
private static final String LOG_TAG = RegisterFragment.class.getName();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_sign_up, container, false);
isActivityCreated = false;
final EditText usernameInput = (EditText) root.findViewById(R.id.register_username_text_field);
final EditText passwordInput = (EditText) root.findViewById(R.id.register_password_text_field);
final EditText passwordRepeat = (EditText) root.findViewById(R.id.register_repeat_password_text_field);
final RegisterFragment fragment = this;
Button registerButton = (Button) root.findViewById(R.id.register_button);
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String username = usernameInput.getText().toString();
String password = passwordInput.getText().toString();
String repeat = passwordRepeat.getText().toString();
// Displays various toasts based on failed register attempts
String message;
if (username.isEmpty()) {
message = "Must have a username";
Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
} else if (password.isEmpty()) {
message = "Cannot have empty password";
Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
} else if (!password.equals(repeat)) {
message = "Passwords must match";
Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
} else {
Log.i(LOG_TAG, "RegistrationTask initialized");
((LoginActivity) getActivity()).onRegistrationAttempt();
new RegisterTask(fragment).execute(username, password);
}
}
});
Button backToSignInButton = (Button) root.findViewById(R.id.back_to_sign_in_button);
backToSignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i(LOG_TAG, "Sent to login fragment");
((LoginActivity) getActivity()).goToLogin(true);
}
});
Button bypass = (Button) root.findViewById(R.id.bypass);
bypass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i(LOG_TAG, "Bypass used");
Intent app = new Intent(getContext(), AppActivity.class);
app.putExtra(LoginActivity.USER_OBJECT, MockDataMaker.createUser());
startActivity(app);
}
});
return root;
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
isActivityCreated = true;
}
/**
* Task used to register new users in the database.
* Currently this is mocked until more of the app's functionality is available.
*
* TODO Actually contact the database
*/
private static class RegisterTask extends AsyncTask<String, Void, User> {
RegisterFragment registerFragment;
RegisterTask(RegisterFragment fragment) {
this.registerFragment = fragment;
}
@Override
protected User doInBackground(String... params) {
try {
Thread.sleep(1500L);
return MockDataMaker.createUser();
} catch (InterruptedException e) {
Log.i(LOG_TAG, "Register task interrupted");
}
return null;
}
@Override
protected void onPostExecute(User user) {
if (registerFragment.isActivityCreated) {
LoginActivity activity = (LoginActivity) registerFragment.getActivity();
activity.onRegistrationAttemptCompleted(user);
}
}
}
}
|
package com.example.onul_app;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import android.widget.ViewSwitcher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class MypageFragment extends Fragment {
MainActivity mainActivity;
private Context context;
private Button modify_button;
private Button withdrawal_button;
private Button sign_out_button;
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
mainActivity=(MainActivity)getActivity();
}
@Override
public void onDetach() {
super.onDetach();
mainActivity=null;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
ViewGroup pageView=(ViewGroup)inflater.inflate(R.layout.fragment_mypage,container,false);
context=container.getContext();
modify_button = pageView.findViewById(R.id.modify_button); //수정하기 버튼
withdrawal_button = pageView.findViewById(R.id.withdrawal_button); //탈퇴하기 버튼
sign_out_button = pageView.findViewById(R.id.sign_out_button); //로그아웃 버튼
modify_button.setOnClickListener(onClickListener);
withdrawal_button.setOnClickListener(onClickListener);
sign_out_button.setOnClickListener(onClickListener);
return pageView;
}
View.OnClickListener onClickListener = new View.OnClickListener(){
@Override
public void onClick(View v){
switch(v.getId()){
case R.id.modify_button:
modify();
break;
case R.id.withdrawal_button:
withdrawal();
break;
case R.id.sign_out_button:
signOut();
gotoLoginActivity();
break;
}
}
};
private void modify(){
}
private void withdrawal(){
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
user.delete()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
startToast("회원탈퇴 완료");
//회원 탈퇴했으니 처음 페이지로 이동이 필요함. 스택 고려하여 설계할 것
gotoLoginActivity();
}
}
});
}
private void signOut(){
FirebaseAuth.getInstance().signOut();
startToast("로그아웃 완료");
mainActivity.finish();
}
private void gotoLoginActivity(){
Intent intent= new Intent(mainActivity, LoginActivity.class);
startActivity(intent);
mainActivity.finish();
}
private void startToast(String msg) {
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
}
}
|
package com.etar.purifier.modules.firmwaretask.jpa;
import entity.firmwaretask.FirmwareTask;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* jpa 接口
*
* @author hzh
* @since 2019-07-17
*/
@Transactional(rollbackFor = Exception.class)
public interface FirmwareTaskRepository extends JpaRepository<FirmwareTask, Integer> {
/**
* 按条件查询方案
*
* @param spec spec
* @param pageable 分页
* @return page
*/
Page<FirmwareTask> findAll(Specification<FirmwareTask> spec, Pageable pageable);
/**
* 通过固件id查询
*
* @param fmId 固件id
* @return 查询结果
*/
FirmwareTask findByFmId(Integer fmId);
/**
* 通过固件ids查询
*
* @param fmIds 固件ids
* @return 查询list
*/
List<FirmwareTask> findByFmIdIn(List<Integer> fmIds);
} |
package io.github.jamesdonoh.halfpricesushi;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.RatingBar;
import android.widget.TextView;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import org.joda.time.DateTime;
import org.joda.time.DateTimeConstants;
import org.joda.time.LocalDate;
import io.github.jamesdonoh.halfpricesushi.model.Outlet;
import io.github.jamesdonoh.halfpricesushi.model.OutletCache;
public class OutletDetailsFragment extends Fragment implements OnMapReadyCallback {
// See https://developer.android.com/reference/android/content/Intent.html#putExtras%28android.os.Bundle%29
public final static String ARG_OUTLET_ID = "io.github.jamesdonoh.halfpricesushi.outletId";
private Outlet mOutlet;
/**
* Convenience static constructor for specifying which outlet ID to display.
*/
static OutletDetailsFragment newInstance(int outletId) {
OutletDetailsFragment fragment = new OutletDetailsFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARG_OUTLET_ID, outletId);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args != null) {
int outletId = args.getInt(ARG_OUTLET_ID);
mOutlet = OutletCache.getOutletById(getContext(), outletId);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_outlet_details, container, false);
TextView name = (TextView) view.findViewById(R.id.name);
name.setText(mOutlet.getName());
GridLayout gridLayout = (GridLayout) view.findViewById(R.id.opening_times_grid);
for (int day = DateTimeConstants.MONDAY; day <= DateTimeConstants.SUNDAY; day++) {
TextView dayNameView = new TextView(getContext());
String dayName = new LocalDate().withDayOfWeek(day).dayOfWeek().getAsText();
dayNameView.setText(dayName);
dayNameView.setPadding(0, 0, 40, 0);
TextView openingTimes = new TextView(getContext());
String timesStr = mOutlet.getOpeningTimesAsString(day);
if (timesStr == null)
timesStr = "(closed)";
openingTimes.setText(timesStr);
gridLayout.addView(dayNameView);
gridLayout.addView(openingTimes);
}
RatingBar ratingBar = (RatingBar) view.findViewById(R.id.rating_bar);
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
if (fromUser && rating != mOutlet.getRating()) {
mOutlet.setRating((int) rating); // NB discard any fractional part
OutletCache.storeOutletRating(getContext(), mOutlet);
}
}
});
if (mOutlet.isRated()) {
ratingBar.setRating((float) mOutlet.getRating());
}
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
public int getShownOutletId() {
return mOutlet.getId();
}
@Override
public void onMapReady(GoogleMap googleMap) {
Log.d("OutletDetailsFragment", "onMapReady");
LatLng position = getPosition();
String title = mOutlet.getName();
// TODO DRY this up with OutletMapFragment?
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher);
googleMap.addMarker(new MarkerOptions()
.position(position)
.title(title)
.icon(bitmapDescriptor));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(position));
}
private LatLng getPosition() {
return new LatLng(mOutlet.getLatitude(), mOutlet.getLongitude());
}
private String getTodayString() {
DateTime now = new DateTime();
return now.dayOfWeek().getAsText();
}
} |
package com.kalbenutritionals.xteamnative;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import com.daimajia.slider.library.Animations.DescriptionAnimation;
import com.daimajia.slider.library.SliderLayout;
import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.daimajia.slider.library.SliderTypes.TextSliderView;
import com.daimajia.slider.library.Tricks.ViewPagerEx;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import bl.clsMainBL;
import bl.mBannerBL;
import bl.tUserCheckinBL;
import bl.tUserLoginBL;
import library.common.mBannerData;
import library.common.tUserCheckinData;
import library.common.tUserLoginData;
import library.dal.clsHardCode;
import static com.kalbenutritionals.xteamnative.R.id.slider;
/**
* Created by ASUS ZE on 21/10/2016.
*/
public class FragmentHistoryCheckin extends Fragment implements ViewPagerEx.OnPageChangeListener, BaseSliderView.OnSliderClickListener{
View v;
private SliderLayout mDemoSlider;
Spinner spnMonth, spnYears;
Button btnView;
String selectedMonth, selectedYears;
RecyclerView recyclerView;
AllHistoryAdapter allUsersAdapter;
List <String> arrMonths, arrYears;
List<UserDataCheckin> dtListUserDataCheckin;
private tUserLoginData userActive;
List<mBannerData> dtListdataBanner;
List<tUserCheckinData> _tUserCheckinData;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
v = inflater.inflate(R.layout.fragment_history_checkin, container, false);
NavigationView nv = (NavigationView) getActivity().findViewById(R.id.navigation_view);
nv.setCheckedItem(R.id.historyCheckin);
mDemoSlider = (SliderLayout) v.findViewById(slider);
spnMonth = (Spinner) v.findViewById(R.id.spnMonth);
spnYears = (Spinner) v.findViewById(R.id.spnYears);
btnView = (Button) v.findViewById(R.id.btnView);
recyclerView = (RecyclerView) v.findViewById(R.id.rvAllHistoryUsers);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setNestedScrollingEnabled(false);
userActive = new tUserLoginBL().getUserActive();
arrMonths = new ArrayList<>();
arrMonths = new clsMainActivity().getArrayMonth();
arrYears = new ArrayList<>();
arrYears = new clsMainActivity().getArrayYears();
spnMonth.setAdapter(new MyAdapterMonth(getContext(), R.layout.custom_spinner, arrMonths));
spnMonth.setSelection(new clsMainActivity().getSelectedMoth(arrMonths));
spnYears.setAdapter(new MyAdapterYear(getContext(), R.layout.custom_spinner, arrYears));
btnView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
recyclerView.setAdapter(null);
AsyncGetDataCheckInWithPeriode task = new AsyncGetDataCheckInWithPeriode();
task.execute();
}
});
spnMonth.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
i=i+1;
if (String.valueOf(i).length()<2){
selectedMonth = "0"+String.valueOf(i);
} else {
selectedMonth = String.valueOf(i);
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
spnYears.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
selectedYears = spnYears.getSelectedItem().toString();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
_tUserCheckinData = new ArrayList<>();
_tUserCheckinData = new tUserCheckinBL().GetAllData();
dtListUserDataCheckin = new ArrayList<>();
loadDataHistory(_tUserCheckinData);
initBanner(getContext());
return v;
}
private void initBanner(Context context) {
mDemoSlider = (SliderLayout) v.findViewById(R.id.slider);
final HashMap<String,String> url_maps = new HashMap<String, String>();
dtListdataBanner = new mBannerBL().GetAllData();
for( mBannerData dt : dtListdataBanner){
url_maps.put(dt.get_txtDesc(), dt.get_TxtPathActual());
}
for(final String name : url_maps.keySet()){
TextSliderView textSliderView = new TextSliderView(getContext());
// initialize a SliderLayout
textSliderView
.description(name)
.image(url_maps.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit)
.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
@Override
public void onSliderClick(BaseSliderView slider) {
Bitmap mBitmap = new clsMainActivity().getBitmapFromURL(String.valueOf(url_maps.get(name)));
if(mBitmap!=null){
new clsMainActivity().zoomImage(mBitmap, getContext());
} else {
new clsMainActivity().showCustomToast(getContext(), "Image not found : " + name, false);
}
}
});
//add your extra information
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra",name);
mDemoSlider.addSlider(textSliderView);
}
mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Default);
mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
mDemoSlider.setCustomAnimation(new DescriptionAnimation());
mDemoSlider.setDuration(4000);
mDemoSlider.addOnPageChangeListener(this);
}
private void loadDataHistory(List<tUserCheckinData> _tUserCheckinData) {
// _tUserCheckinData = new ArrayList<>();
// _tUserCheckinData = new tUserCheckinBL().GetAllData();
// dtListUserDataCheckin = new ArrayList<>();
if(_tUserCheckinData.size()>0){
allUsersAdapter = new AllHistoryAdapter(_tUserCheckinData, getContext(), getActivity());
recyclerView.setAdapter(allUsersAdapter);
} else {
new clsMainActivity().showCustomToast(getContext(), new clsHardCode().txtMessDataNotFound, false);
}
}
@Override
public void onSliderClick(BaseSliderView slider) {
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
public class MyAdapterMonth extends ArrayAdapter<String> {
public MyAdapterMonth(Context context, int textViewResourceId, List<String> objects) {
super(context, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
public View getCustomView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View row = inflater.inflate(R.layout.custom_spinner, parent, false);
TextView label = (TextView) row.findViewById(R.id.tvTitle);
label.setText(arrMonths.get(position));
TextView sub = (TextView) row.findViewById(R.id.tvDesc);
sub.setVisibility(View.INVISIBLE);
sub.setVisibility(View.GONE);
//sub.setText(mydata2[position]);
//label.setTextColor(new Color().parseColor("#FFFFF"));
row.setBackgroundColor(new Color().TRANSPARENT);
return row;
}
}
public class MyAdapterYear extends ArrayAdapter<String> {
public MyAdapterYear(Context context, int textViewResourceId, List<String> objects) {
super(context, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
public View getCustomView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View row = inflater.inflate(R.layout.custom_spinner, parent, false);
TextView label = (TextView) row.findViewById(R.id.tvTitle);
label.setText(arrYears.get(position));
TextView sub = (TextView) row.findViewById(R.id.tvDesc);
sub.setVisibility(View.INVISIBLE);
sub.setVisibility(View.GONE);
//sub.setText(mydata2[position]);
//label.setTextColor(new Color().parseColor("#FFFFF"));
row.setBackgroundColor(new Color().TRANSPARENT);
return row;
}
}
private class AsyncGetDataCheckInWithPeriode extends AsyncTask<JSONArray, Void, JSONArray>{
@Override
protected JSONArray doInBackground(JSONArray... jsonArrays) {
// android.os.Debug.waitForDebugger();
JSONArray Json = null;
try {
Json = new clsMainBL().getDataCheckInWithPeriode(userActive.get_txtUserId(), selectedYears+selectedMonth);
// _tUserCheckinData.get_txtRegionName().toString();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Json;
}
private ProgressDialog Dialog = new ProgressDialog(getContext());
@Override
protected void onCancelled() {
Dialog.dismiss();
new clsMainActivity().showCustomToast(getContext(), new clsHardCode().txtMessCancelRequest, false);
}
@Override
protected void onPostExecute(JSONArray array) {
if(array!=null){
if (array.size() > 0) {
Iterator i = array.iterator();
dtListUserDataCheckin = new ArrayList<>();
_tUserCheckinData = new ArrayList<>();
while (i.hasNext()) {
// _tUserCheckinData = new ArrayList<>();
org.json.simple.JSONObject innerObj = (org.json.simple.JSONObject) i.next();
Long IntResult = (Long) innerObj.get("_pboolValid");
String _txtSumberDataID = (String) innerObj.get("TxtSumberDataId").toString();
if (IntResult == 1) {
JSONObject JsonArray_header = (JSONObject) innerObj.get("VwGetDatadSumberDataforWebDashboard");
if (JsonArray_header != null) {
tUserCheckinData data = new tUserCheckinData();
data.set_txtOutletName(String.valueOf(JsonArray_header.get("TxtNamaInstitusi")));
data.set_TxtAlamat(String.valueOf(JsonArray_header.get("TxtAlamat")));
data.set_TxtNamaPropinsi(String.valueOf(JsonArray_header.get("TxtNamaPropinsi")));
data.set_TxtNamaKabKota(String.valueOf(JsonArray_header.get("TxtNamaKabKota")));
data.setDtCheckin(String.valueOf(innerObj.get("DtInsert")));
data.set_txtLong(String.valueOf(innerObj.get("TxtLongitude")));
data.set_txtLat(String.valueOf(innerObj.get("TxtLatitude")));
data.set_intSubmit("1");
data.set_intSync("1");
_tUserCheckinData.add(data);
} else {
new clsMainActivity().showCustomToast(getContext(), new clsHardCode().txtMessDataNotFound, false);
}
}
}
// allUsersAdapter = new AllHistoryAdapter(_tUserCheckinData, getContext(), getActivity());
// recyclerView.setAdapter(allUsersAdapter);
loadDataHistory(_tUserCheckinData);
} else {
new clsMainActivity().showCustomToast(getContext(), new clsHardCode().txtMessDataNotFound, false);
}
} else {
new clsMainActivity().showCustomToast(getContext(), new clsHardCode().txtMessDataNotFound, false);
}
Dialog.dismiss();
}
@Override
protected void onPreExecute() {
Dialog.setMessage("Getting Data History Checkin");
Dialog.setCancelable(false);
Dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
Dialog.show();
}
@Override
protected void onProgressUpdate(Void... values) {
Dialog.dismiss();
}
}
public class UserDataCheckin {
private String TxtSumberDataId;
private String txtNamaInstitusi;
private String txtAlamat;
private String txtNamaPropinsi;
private String txtNamaKabKota;
private String DtInsert;
private String ranking;
public String getImageResourceId() {
return TxtSumberDataId;
}
public String getProfileName() {
return txtNamaInstitusi;
}
public String getJabatan(){
return txtAlamat;
}
public String getRegion(){
return txtNamaPropinsi;
}
public String getCabang(){
return txtNamaKabKota;
}
public String getPoints(){
return DtInsert;
}
// public String getRanking(){
// return ranking;
// }
public UserDataCheckin(String TxtSumberDataId, String txtNamaInstitusi, String txtAlamat, String txtNamaPropinsi, String txtNamaKabKota, String DtInsert) {
this.TxtSumberDataId = TxtSumberDataId;
this.txtNamaInstitusi = txtNamaInstitusi;
this.txtAlamat = txtAlamat;
this.txtNamaPropinsi = txtNamaPropinsi;
this.txtNamaKabKota = txtNamaKabKota;
this.DtInsert = DtInsert;
}
}
}
|
package com.tencent.mm.plugin.card.ui;
import android.widget.PopupWindow.OnDismissListener;
class j$3 implements OnDismissListener {
final /* synthetic */ j hGo;
j$3(j jVar) {
this.hGo = jVar;
}
public final void onDismiss() {
}
}
|
package com.orca.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;
import com.orca.domain.Survey;
import com.orca.domain.Velocity;
import com.orca.service.SurveyService;
@SessionAttributes({ "velocity" })
@Controller
public class VelocityController {
@Autowired
private SurveyService surveyService;
@RequestMapping(value = "velocity.html")
public ModelAndView velocity(@RequestParam("surveyId") Integer surveyId) {
Survey survey = surveyService.getSurvey(surveyId);
if (!surveyService.authorizedUser(survey)){
return new ModelAndView("notAuthorized");
}
ModelAndView mav = new ModelAndView("velocity");
mav.addObject("velocity", survey.getVelocity());
mav.addObject("survey", survey);
return mav;
}
@RequestMapping(value = "saveVelocity.html")
public String saveVelocity(@ModelAttribute("velocity") Velocity velocity,
@RequestParam("surveyId") Integer surveyId, @RequestParam("submit") String submit) {
Survey survey = surveyService.getSurvey(surveyId);
if (!surveyService.authorizedUser(survey)){
return "redirect:notAuthorized.html";
}
survey.setVelocity(velocity);
surveyService.saveSurvey(survey);
if (submit.equals("Next Metric")) {
return "redirect:functionality.html?surveyId=" + survey.getId();
} else {
return "redirect:evaluationSummary.html?evaluationId=" + survey.getEvaluation().getId();
}
}
}
|
package collection.visualizer.layout;
import java.util.ArrayList;
import java.util.List;
import bus.uigen.shapes.ALineModel;
import bus.uigen.shapes.ARectangleModel;
import bus.uigen.shapes.Shape;
public class AHorizontalBar extends ACompositeShape implements Shape{
private List<Shape> shapes = new ArrayList<Shape>();
public AHorizontalBar(int x, int y, int height, int width){
ARectangleModel base = new ARectangleModel(10, 10, 40, 10);
ALineModel l1 = new ALineModel(10,10,4,-4);
ALineModel l2 = new ALineModel(50,10,4,-4);
ALineModel l3 = new ALineModel(14,6,40,0);
ALineModel l4 = new ALineModel(50,20,4,-4);
ALineModel l5 = new ALineModel(54, 16,0,-10);
shapes.add(base);
shapes.add(l1);
shapes.add(l2);
shapes.add(l3);
shapes.add(l4);
shapes.add(l5);
super.setShapes(shapes);
// super.setX(x);
// super.setY(y);
// super.setWidth(width);
// super.setHeight(height);
}
}
|
// Copyright (c) 2014 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.xwalk.embedding.test;
import org.chromium.base.test.util.Feature;
import org.xwalk.embedding.MainActivity;
import org.xwalk.embedding.base.ExtensionEcho;
import org.xwalk.embedding.base.XWalkViewTestBase;
import android.annotation.SuppressLint;
import android.test.suitebuilder.annotation.SmallTest;
@SuppressLint("NewApi")
public class ExtensionEchoTest extends XWalkViewTestBase {
private final static String PASS_STRING = "Pass";
@SmallTest
@Feature({"ExtensionEcho"})
public void testOnMessage() throws Throwable {
ExtensionEcho echo = new ExtensionEcho();
loadAssetFileAndWaitForTitle("echo.html");
assertEquals(PASS_STRING, getTitleOnUiThread());
}
@SmallTest
@Feature({"ExtensionEcho"})
public void testOnSyncMessage() throws Throwable {
ExtensionEcho echo = new ExtensionEcho();
loadAssetFile("echoSync.html");
assertEquals(PASS_STRING, getTitleOnUiThread());
}
@SmallTest
@Feature({"ExtensionEcho"})
public void testMultiFrames() throws Throwable {
ExtensionEcho echo = new ExtensionEcho();
loadAssetFileAndWaitForTitle("framesEcho.html");
assertEquals(PASS_STRING, getTitleOnUiThread());
}
}
|
package candrun.controller;
import java.io.IOException;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import candrun.exception.PasswordMismatchException;
import candrun.exception.UserNotFoundException;
import candrun.user.User;
@RequestMapping("/auth")
@RestController
public class AuthController {
public static final String SESSION_email = "email";
private static final Logger LOGGER = LoggerFactory.getLogger(AuthController.class);
@RequestMapping(method = RequestMethod.POST)
public String signIn(@RequestParam("email") String email, @RequestParam("password") String password, HttpSession session, Model model) {
try {
User.login(email, password);
session.setAttribute("email", email);
return "redirect: home";
} catch (UserNotFoundException e) {
LOGGER.debug("존재하지 않는 사용자 입니다. 다시 로그인하세요.");
model.addAttribute("errorMessage", "존재하지 않는 사용자 입니다. 다시 로그인하세요.");
//request.setAttribute("errorMessage", "존재하지 않는 사용자 입니다. 다시 로그인하세요.");
return "signIn";
} catch (PasswordMismatchException e) {
LOGGER.debug("비밀번호가 틀립니다. 다시 로그인하세요.");
model.addAttribute("errorMessage", "비밀번호가 틀립니다. 다시 로그인하세요.");
//request.setAttribute("errorMessage", "비밀번호가 틀립니다. 다시 로그인하세요.");
return "signIn";
}
}
@RequestMapping(method = RequestMethod.DELETE)
public String signOut(HttpSession session) throws IOException {
session.removeAttribute("email");
// response.sendRedirect("/signIn.jsp");
return "redirect: signIn";
}
} |
package com.fleet.nacos.consumer.controller;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List;
@RestController
public class HelloController {
@Resource
private LoadBalancerClient loadBalancer;
@Resource
private DiscoveryClient discoveryClient;
/**
* 获取所有服务
*/
@RequestMapping("/services")
public List<ServiceInstance> services() {
return discoveryClient.getInstances("nacos-provider");
}
/**
* 从所有服务中选择一个服务(轮询)
*/
@RequestMapping("/choose")
public String choose() {
return loadBalancer.choose("nacos-provider").getUri().toString();
}
@Resource
RestTemplate restTemplate;
@RequestMapping("/hello")
public String hello() {
return restTemplate.getForObject("http://nacos-provider/hello", String.class);
}
}
|
/**
* This package contains the implementation of the management of CSARInstances
* and History of PublicPlans of CSARInstnaces.
*
* Copyright 2013 Christian Endres
*
* @author endrescn@fachschaft.informatik.uni-stuttgart.de
*
*/
package org.opentosca.csarinstancemanagement.service.impl; |
/*
* 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 berlin.iconn.rbm.settings;
import berlin.iconn.rbm.enhancement.RBMEnhancer;
import berlin.iconn.rbm.views.ErrorViewController;
import berlin.iconn.rbm.main.AController;
import berlin.iconn.rbm.views.WeightsVisualizationController;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
/**
* FXML Controller class
*
* @author moritz
*/
public class RBMSettingsVisualizationsController extends AController {
private RBMSettingsVisualizationsModel model;
@FXML
private TextField txt_errorInterval;
@FXML
private AnchorPane view;
@FXML
private CheckBox cbx_showErrorGraph;
@FXML
private Label lbl_errorInterval;
/**
* Initializes the controller class.
* @param url
* @param rb
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
ErrorViewController errorViewController = null;
try {
errorViewController = (ErrorViewController) loadController("fxml/ErrorView.fxml");
} catch (IOException ex) {
Logger.getLogger(RBMSettingsVisualizationsController.class.getName()).log(Level.SEVERE, null, ex);
}
lbl_errorInterval.setText("x " + RBMEnhancer.BASE_INTERVAL);
this.model = new RBMSettingsVisualizationsModel(this, errorViewController);
this.update();
}
@FXML
private void cbx_showErrorGraphAction(ActionEvent event) {
this.model.setShowErrorGraph(cbx_showErrorGraph.isSelected());
if(cbx_showErrorGraph.isSelected()) {
this.model.getErrorViewController().show();
}
else {
this.model.getErrorViewController().hide();
}
}
@Override
public Node getView() {
return view;
}
public RBMSettingsVisualizationsModel getModel(){
return this.model;
}
@Override
public void update() {
this.cbx_showErrorGraph.setSelected(this.model.isShowErrorGraph());
this.txt_errorInterval.setText(new Integer(this.model.getErrorInterval()).toString());
}
@FXML
private void txt_errorIntervalKey(KeyEvent event) {
try {
this.model.setErrorInterval(Integer.parseInt(this.txt_errorInterval.getText()));
} catch (NumberFormatException e) {
}
}
}
|
package com.data.rhis2;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.location.Location;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.SimpleAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.TimePicker;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import Common.Connection;
import Common.Global;
public class Household extends Activity {
boolean netwoekAvailable = false;
Location currentLocation;
double currentLatitude, currentLongitude;
Location currentLocationNet;
double currentLatitudeNet, currentLongitudeNet;
//Disabled Back/Home key
//--------------------------------------------------------------------------------------------------
@Override
public boolean onKeyDown(int iKeyCode, KeyEvent event) {
if (iKeyCode == KeyEvent.KEYCODE_BACK || iKeyCode == KeyEvent.KEYCODE_HOME) {
return false;
} else {
return true;
}
}
//Top menu
//--------------------------------------------------------------------------------------------------
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mnuclose, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
AlertDialog.Builder adb = new AlertDialog.Builder(Household.this);
switch (item.getItemId()) {
case R.id.menuClose:
adb.setTitle("Close");
adb.setMessage("আপনি কি এই ফর্ম থেকে বের হতে চান[Yes/No]?");
adb.setNegativeButton("No", null);
adb.setPositiveButton("Yes", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
Intent f1 = new Intent(getApplicationContext(), HouseholdIndex.class);
startActivity(f1);
}
});
adb.show();
return true;
}
return false;
}
String VariableID;
private int hour;
private int minute;
private int mDay;
private int mMonth;
private int mYear;
static final int DATE_DIALOG = 1;
static final int TIME_DIALOG = 2;
Connection C;
Global g;
SimpleAdapter dataAdapter;
ArrayList<HashMap<String, String>> dataList = new ArrayList<HashMap<String, String>>();
private String TableName;
LinearLayout seclblHH;
LinearLayout secwardNew;
TextView VlblwardNew;
Spinner spnwardNew;
LinearLayout secwardOld;
TextView VlblwardOld;
Spinner spnwardOld;
LinearLayout secMouza;
TextView VlblMouza;
Spinner spnMouza;
LinearLayout secFWAUnit;
TextView VlblFWAUnit;
Spinner spnFWAUnit;
LinearLayout secVill;
TextView VlblVill;
Spinner spnVill;
LinearLayout secEPIBlock;
TextView VlblEPIBlock;
Spinner spnEPIBlock;
LinearLayout secPAddr;
TextView VlblPAddr;
RadioGroup rdogrpPAddr;
RadioButton rdoPAddr1;
RadioButton rdoPAddr2;
LinearLayout secPermaAddress;
TextView VlblPermaAddress;
EditText txtPermaAddress;
LinearLayout secHHNo;
TextView VlblHHNo;
TextView txtHHNo;
LinearLayout secReligion;
TextView VlblReligion;
Spinner spnReligion;
LinearLayout secVGFCard;
TextView VlblVGFCard;
//CheckBox chkVGFCard;
RadioGroup rdogrpVGFCard;
RadioButton rdoVGFCard1;
RadioButton rdoVGFCard2;
String StartTime;
String Div;
String Dist;
String Upz;
String UN;
String Vill;
String HHNo;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.household);
C = new Connection(this);
g = Global.getInstance();
StartTime = g.CurrentTime24();
TableName = "Household";
TextView lblVillage = (TextView) findViewById(R.id.lblVillageName);
lblVillage.setText("গ্রামঃ " + g.getMouza() + "-" + g.getVillage() + ", " + g.getVillageName());
txtHHNo = (TextView) findViewById(R.id.txtHHNo);
if (g.getHouseholdNo().length() == 0)
txtHHNo.setText(HouseholdNumber());
else
txtHHNo.setText(g.getHouseholdNo());
secwardNew = (LinearLayout) findViewById(R.id.secwardNew);
VlblwardNew = (TextView) findViewById(R.id.VlblwardNew);
spnwardNew = (Spinner) findViewById(R.id.spnwardNew);
List<String> listwardNew = new ArrayList<String>();
listwardNew.add("");
listwardNew.add("01-Ward-1");
listwardNew.add("02-Ward-2");
listwardNew.add("03-Ward-3");
listwardNew.add("04-Ward-4");
listwardNew.add("05-Ward-5");
listwardNew.add("06-Ward-6");
listwardNew.add("07-Ward-7");
listwardNew.add("08-Ward-8");
listwardNew.add("09-Ward-9");
ArrayAdapter<String> adptrwardNew = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listwardNew);
spnwardNew.setAdapter(adptrwardNew);
spnwardOld = (Spinner) findViewById(R.id.spnwardOld);
List<String> listwardOld = new ArrayList<String>();
listwardOld.add("");
listwardOld.add("01-Ward-1");
listwardOld.add("02-Ward-2");
listwardOld.add("03-Ward-3");
ArrayAdapter<String> adptrwardOld = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listwardOld);
spnwardOld.setAdapter(adptrwardOld);
secFWAUnit = (LinearLayout) findViewById(R.id.secFWAUnit);
VlblFWAUnit = (TextView) findViewById(R.id.VlblFWAUnit);
spnFWAUnit = (Spinner) findViewById(R.id.spnFWAUnit);
List<String> listFWAUnit = new ArrayList<String>();
listFWAUnit.add("");
listFWAUnit.add("11-1KA");
listFWAUnit.add("12-1KHA");
listFWAUnit.add("13-1GA");
listFWAUnit.add("14-1GHA");
listFWAUnit.add("21-2KA");
listFWAUnit.add("22-2KHA");
listFWAUnit.add("23-2GA");
listFWAUnit.add("24-2GHA");
listFWAUnit.add("31-3KA");
listFWAUnit.add("32-3KHA");
listFWAUnit.add("33-3GA");
listFWAUnit.add("34-3GHA");
ArrayAdapter<String> adptrFWAUnit = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listFWAUnit);
spnFWAUnit.setAdapter(adptrFWAUnit);
secEPIBlock = (LinearLayout) findViewById(R.id.secEPIBlock);
VlblEPIBlock = (TextView) findViewById(R.id.VlblEPIBlock);
spnEPIBlock = (Spinner) findViewById(R.id.spnEPIBlock);
List<String> listEPIBlock = new ArrayList<String>();
listEPIBlock.add("");
listEPIBlock.add("01-ক-১");
listEPIBlock.add("02-ক-২");
listEPIBlock.add("03-খ-১");
listEPIBlock.add("04-খ-২");
listEPIBlock.add("05-গ-১");
listEPIBlock.add("06-গ-২");
listEPIBlock.add("07-ঘ-১");
listEPIBlock.add("08-ঘ-২");
ArrayAdapter<String> adptrEPIBlock = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listEPIBlock);
spnEPIBlock.setAdapter(adptrEPIBlock);
secPAddr = (LinearLayout) findViewById(R.id.secPAddr);
VlblPAddr = (TextView) findViewById(R.id.VlblPAddr);
rdogrpPAddr = (RadioGroup) findViewById(R.id.rdogrpPAddr);
rdoPAddr1 = (RadioButton) findViewById(R.id.rdoPAddr1);
rdoPAddr2 = (RadioButton) findViewById(R.id.rdoPAddr2);
secPermaAddress = (LinearLayout) findViewById(R.id.secPermaAddress);
VlblPermaAddress = (TextView) findViewById(R.id.VlblPermaAddress);
txtPermaAddress = (EditText) findViewById(R.id.txtPermaAddress);
rdogrpPAddr.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int radioButtonID) {
RadioButton rb = (RadioButton) findViewById(rdogrpPAddr.getCheckedRadioButtonId());
if (rb == null) return;
String rbData = Global.Left(rb.getText().toString(), 1);
if (rbData.equalsIgnoreCase("2")) {
secPermaAddress.setVisibility(View.VISIBLE);
} else {
secPermaAddress.setVisibility(View.GONE);
txtPermaAddress.setText("");
}
}
public void onNothingSelected(AdapterView<?> adapterView) {
return;
}
});
VlblHHNo = (TextView) findViewById(R.id.VlblHHNo);
secReligion = (LinearLayout) findViewById(R.id.secReligion);
VlblReligion = (TextView) findViewById(R.id.VlblReligion);
spnReligion = (Spinner) findViewById(R.id.spnReligion);
List<String> listReligion = new ArrayList<String>();
listReligion.add("");
listReligion.add("1-মুসলমান");
listReligion.add("2-হিন্দু");
listReligion.add("3-বৌদ্ধ");
listReligion.add("4-খ্রীস্টান");
listReligion.add("8-Refuse to disclose");
listReligion.add("9-Not a believer");
listReligion.add("0-অন্যান্য");
ArrayAdapter<String> adptrReligion = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listReligion);
spnReligion.setAdapter(adptrReligion);
secVGFCard = (LinearLayout) findViewById(R.id.secVGFCard);
VlblVGFCard = (TextView) findViewById(R.id.VlblVGFCard);
//chkVGFCard=(CheckBox) findViewById(R.id.chkVGFCard);
rdogrpVGFCard = (RadioGroup) findViewById(R.id.rdogrpVGFCard);
rdoVGFCard1 = (RadioButton) findViewById(R.id.rdoVGFCard1);
rdoVGFCard2 = (RadioButton) findViewById(R.id.rdoVGFCard2);
secPermaAddress.setVisibility(View.GONE);
DataSearch(g.getDistrict(), g.getUpazila(), g.getUnion(), g.getMouza(), g.getVillage(), txtHHNo.getText().toString());
Button cmdSave = (Button) findViewById(R.id.cmdSave);
if (g.getCallFrom().equals("oldh")) {
//cmdSave.setText("তথ্য সংরক্ষণ -> সদস্যের তালিকা");
}
cmdSave.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DataSave();
}
});
} catch (Exception e) {
Connection.MessageBox(Household.this, e.getMessage());
return;
}
}
private String HouseholdNumber() {
String SQL = "";
SQL = "Select (ifnull(max(cast(HHNo as int)),10000)+1)MaxHH from Household";
SQL += " where";
SQL += " dist='" + g.getDistrict() + "' and upz='" + g.getUpazila() + "' and un='" + g.getUnion() + "' and Mouza='" + g.getMouza() + "' and vill='" + g.getVillage() + "'";
String HHNo = C.ReturnSingleValue(SQL);
return HHNo;
}
private void DataSave() {
try {
String DV = "";
/*
if(spnwardNew.getSelectedItemPosition()==0 & secwardNew.isShown())
{
Connection.MessageBox(Household.this, "Required field:ওয়ার্ড(নতুন).");
spnwardNew.requestFocus();
return;
}
else if(spnwardOld.getSelectedItemPosition()==0 & secwardOld.isShown())
{
Connection.MessageBox(Household.this, "Required field:ওয়ার্ড(পুরাতন).");
spnwardOld.requestFocus();
return;
}
else if(spnMouza.getSelectedItemPosition()==0 & secMouza.isShown())
{
Connection.MessageBox(Household.this, "Required field:মওজা/মহল্লা.");
spnMouza.requestFocus();
return;
}*/
if (spnFWAUnit.getSelectedItemPosition() == 0 & secFWAUnit.isShown()) {
Connection.MessageBox(Household.this, "তালিকা থেকে সঠিক FWA ইউনিট সিলেক্ট করুন.");
spnFWAUnit.requestFocus();
return;
} else if (!rdoPAddr1.isChecked() & !rdoPAddr2.isChecked() & secPAddr.isShown()) {
Connection.MessageBox(Household.this, "এটা কি আপনার স্থায়ী ঠিকানা কিনা এ তথ্য সিলেক্ট করতে হবে");
rdoPAddr1.requestFocus();
return;
} else if (txtPermaAddress.getText().toString().length() == 0 & secPermaAddress.isShown()) {
Connection.MessageBox(Household.this, "সঠিক স্থায়ী ঠিকানা লিপিবদ্ধ করুন।");
txtPermaAddress.requestFocus();
return;
} else if (spnReligion.getSelectedItemPosition() == 0 & secReligion.isShown()) {
Connection.MessageBox(Household.this, "তালিকা থেকে সঠিক ধর্ম সিলেক্ট করুন.");
spnReligion.requestFocus();
return;
} else if (!rdoVGFCard1.isChecked() & !rdoVGFCard2.isChecked()) {
Connection.MessageBox(Household.this, "ভি জি এফ কার্ড আছে কি, এ তথ্য সিলেক্ট করতে হবে");
rdoVGFCard1.requestFocus();
return;
}
String SQL = "";
if (!C.Existence("Select Div,Dist,Upz,UN,Mouza,Vill,HHNo from " + TableName + " Where Dist='" + g.getDistrict() + "' and Upz='" + g.getUpazila() + "' and UN='" + g.getUnion() + "' and Mouza='" + g.getMouza() + "' and Vill='" + g.getVillage() + "' and HHNo='" + txtHHNo.getText().toString() + "'")) {
SQL = "Insert into " + TableName + "(Div,Dist,Upz,UN,Mouza,Vill,HHNo,StartTime,EndTime,UserId,EnDt,Upload)Values('" + g.getDivision() + "','" + g.getDistrict() + "','" + g.getUpazila() + "','" + g.getUnion() + "','" + g.getMouza() + "','" + g.getVillage() + "','" + txtHHNo.getText() + "','" + StartTime + "','" + g.CurrentTime24() + "','" + g.getUserID() + "','" + Global.DateTimeNowYMDHMS() + "','2')";
C.Save(SQL);
}
SQL = "Update " + TableName + " Set ";
SQL += "wardNew = '" + (spnwardNew.getSelectedItemPosition() == 0 ? "" : Global.Left(spnwardNew.getSelectedItem().toString(), 2)) + "',";
SQL += "wardOld = '" + (spnwardOld.getSelectedItemPosition() == 0 ? "" : Global.Left(spnwardOld.getSelectedItem().toString(), 2)) + "',";
SQL += "FWAUnit = '" + (spnFWAUnit.getSelectedItemPosition() == 0 ? "" : Global.Left(spnFWAUnit.getSelectedItem().toString(), 2)) + "',";
SQL += "EPIBlock = '" + (spnEPIBlock.getSelectedItemPosition() == 0 ? "" : Global.Left(spnEPIBlock.getSelectedItem().toString(), 2)) + "',";
RadioButton rbPAddr = (RadioButton) findViewById(rdogrpPAddr.getCheckedRadioButtonId());
SQL += "PAddr = '" + (rbPAddr == null ? "" : (Global.Left(rbPAddr.getText().toString(), 1))) + "',";
SQL += "PermaAddress = '" + txtPermaAddress.getText().toString() + "',";
SQL += "Religion = '" + (spnReligion.getSelectedItemPosition() == 0 ? "" : Global.Left(spnReligion.getSelectedItem().toString(), 1)) + "',";
RadioButton rbVGFCard = (RadioButton) findViewById(rdogrpVGFCard.getCheckedRadioButtonId());
SQL += "VGFCard = '" + (rbVGFCard == null ? "" : (Global.Left(rbVGFCard.getText().toString(), 1))) + "'";
SQL += " Where Dist='" + g.getDistrict() + "' and Upz='" + g.getUpazila() + "' and UN='" + g.getUnion() + "' and Mouza='" + g.getMouza() + "' and Vill='" + g.getVillage() + "' and HHNo='" + txtHHNo.getText().toString() + "'";
C.Save(SQL);
Connection.MessageBox(Household.this, "তথ্য সফলভাবে সংরক্ষণ হয়েছে।");
g.setHouseholdNo(txtHHNo.getText().toString());
finish();
g.setSerialNo("");
if (g.getCallFrom().equals("newh")) {
Intent f1 = new Intent(getApplicationContext(), MemberForm.class);
startActivity(f1);
} else if (g.getCallFrom().equals("oldh")) {
Intent f2 = new Intent(getApplicationContext(), MemberList.class);
startActivity(f2);
}
} catch (Exception e) {
Connection.MessageBox(Household.this, e.getMessage());
return;
}
}
private void DataSearch(String Dist, String Upz, String UN, String Mouza, String Vill, String HHNo) {
try {
RadioButton rb;
Cursor cur = C.ReadData("Select * from " + TableName + " Where Dist='" + Dist + "' and Upz='" + Upz + "' and UN='" + UN + "' and Mouza='" + Mouza + "' and Vill='" + Vill + "' and HHNo='" + HHNo + "'");
cur.moveToFirst();
while (!cur.isAfterLast()) {
spnwardNew.setSelection(Global.SpinnerItemPosition(spnwardNew, 2, cur.getString(cur.getColumnIndex("wardNew"))));
spnwardOld.setSelection(Global.SpinnerItemPosition(spnwardOld, 2, cur.getString(cur.getColumnIndex("wardOld"))));
spnFWAUnit.setSelection(Global.SpinnerItemPosition(spnFWAUnit, 2, cur.getString(cur.getColumnIndex("FWAUnit"))));
spnEPIBlock.setSelection(Global.SpinnerItemPosition(spnEPIBlock, 2, cur.getString(cur.getColumnIndex("EPIBlock"))));
for (int i = 0; i < rdogrpPAddr.getChildCount(); i++) {
rb = (RadioButton) rdogrpPAddr.getChildAt(i);
if (Global.Left(rb.getText().toString(), 1).equalsIgnoreCase(cur.getString(cur.getColumnIndex("PAddr"))))
rb.setChecked(true);
else
rb.setChecked(false);
}
txtPermaAddress.setText(cur.getString(cur.getColumnIndex("PermaAddress")));
spnReligion.setSelection(Global.SpinnerItemPosition(spnReligion, 1, cur.getString(cur.getColumnIndex("Religion"))));
for (int i = 0; i < rdogrpVGFCard.getChildCount(); i++) {
rb = (RadioButton) rdogrpVGFCard.getChildAt(i);
if (Global.Left(rb.getText().toString(), 1).equalsIgnoreCase(cur.getString(cur.getColumnIndex("VGFCard"))))
rb.setChecked(true);
else
rb.setChecked(false);
}
cur.moveToNext();
}
cur.close();
} catch (Exception e) {
Connection.MessageBox(Household.this, e.getMessage());
return;
}
}
protected Dialog onCreateDialog(int id) {
final Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
switch (id) {
case DATE_DIALOG:
return new DatePickerDialog(this, mDateSetListener, g.mYear, g.mMonth - 1, g.mDay);
case TIME_DIALOG:
return new TimePickerDialog(this, timePickerListener, hour, minute, false);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
mYear = year;
mMonth = monthOfYear + 1;
mDay = dayOfMonth;
EditText dtpDate;
/*dtpDate.setText(new StringBuilder()
.append(Global.Right("00"+mDay,2)).append("/")
.append(Global.Right("00"+mMonth,2)).append("/")
.append(mYear));*/
}
};
private TimePickerDialog.OnTimeSetListener timePickerListener = new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int selectedHour, int selectedMinute) {
hour = selectedHour;
minute = selectedMinute;
EditText tpTime;
//tpTime.setText(new StringBuilder().append(Global.Right("00"+hour,2)).append(":").append(Global.Right("00"+minute,2)));
}
};
} |
package ariska.submission1;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements MovieAdapter.OnClickListener {
private RecyclerView rvMovies;
private ArrayList<Movie> movies = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rvMovies = findViewById(R.id.rv_listMovie);
rvMovies.setHasFixedSize(true);
movies.addAll(MovieData.getMovies());
showRecyclerList();
}
private void showRecyclerList() {
rvMovies.setLayoutManager(new LinearLayoutManager(this));
MovieAdapter movieAdapter = new MovieAdapter(movies, this);
rvMovies.setAdapter(movieAdapter);
}
@Override
public void onClick(Movie movie) {
Intent intent = new Intent(MainActivity.this, DetailMovieActivity.class);
intent.putExtra(DetailMovieActivity.EXTRA_MOVIE, movie);
startActivity(intent);
}
}
|
package com.dlc.morepet;
import android.app.Application;
import android.content.Context;
import com.tencent.bugly.Bugly;
/**
* Auther by winds on 2016/12/28
* Email heardown@163.com
*/
public class AppConfig extends Application {
private static Context sContext;
@Override
public void onCreate() {
super.onCreate();
sContext = getApplicationContext();
Bugly.init(this, "f6b900decf", false);
// CrashHandler.getInstance().init(this);
}
public static Context getContext() {
return sContext;
}
}
|
package com.company;
import java.util.Scanner;
public class CheckKthBit {
public static void main(String[] args) {
Scanner inputReader = new Scanner(System.in);
System.out.println("Enter the Number:");
int inputValue = inputReader.nextInt();
System.out.println("Enter the Bit to be checked:");
int kbit = inputReader.nextInt();
if (0 != (inputValue & (1 << kbit + 1)))
System.out.println("yes");
else
System.out.println("No");
}
}
|
/**
* DNet eBusiness Suite
* Copyright: 2010-2013 Nan21 Electronics SRL. All rights reserved.
* Use is subject to license terms.
*/
package net.nan21.dnet.module.bd.domain.impl.elem;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import net.nan21.dnet.core.domain.impl.AbstractAuditable;
import net.nan21.dnet.module.bd.domain.impl.elem.Element;
import org.hibernate.validator.constraints.NotBlank;
/**
*
*/
@Entity
@Table(name = ElementInput.TABLE_NAME)
public class ElementInput extends AbstractAuditable {
public static final String TABLE_NAME = "BD_ELEM_IN";
private static final long serialVersionUID = -8865917134914502125L;
@NotBlank
@Column(name = "ALIAS", nullable = false, length = 32)
private String alias;
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Element.class)
@JoinColumn(name = "ELEMENT_ID", referencedColumnName = "ID")
private Element element;
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Element.class)
@JoinColumn(name = "CROSSREFERENCE_ID", referencedColumnName = "ID")
private Element crossReference;
public String getAlias() {
return this.alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public Element getElement() {
return this.element;
}
public void setElement(Element element) {
if (element != null) {
this.__validate_client_context__(element.getClientId());
}
this.element = element;
}
public Element getCrossReference() {
return this.crossReference;
}
public void setCrossReference(Element crossReference) {
if (crossReference != null) {
this.__validate_client_context__(crossReference.getClientId());
}
this.crossReference = crossReference;
}
@PrePersist
public void prePersist() {
super.prePersist();
}
}
|
package com.rc.portal.service;
import java.sql.SQLException;
import java.util.List;
import com.rc.portal.vo.TCoupon;
import com.rc.portal.vo.TCouponExample;
import com.rc.portal.vo.TMember;
public interface TCouponManager {
int countByExample(TCouponExample example) throws SQLException;
int deleteByExample(TCouponExample example) throws SQLException;
int deleteByPrimaryKey(Long id) throws SQLException;
Long insert(TCoupon record) throws SQLException;
Long insertSelective(TCoupon record) throws SQLException;
List selectByExample(TCouponExample example) throws SQLException;
TCoupon selectByPrimaryKey(Long id) throws SQLException;
int updateByExampleSelective(TCoupon record, TCouponExample example) throws SQLException;
int updateByExample(TCoupon record, TCouponExample example) throws SQLException;
int updateByPrimaryKeySelective(TCoupon record) throws SQLException;
int updateByPrimaryKey(TCoupon record) throws SQLException;
/**
* 生成优惠券
* @param record
* @param member(选填)
* @param count(选填)
*/
void createCouponCard(TCoupon record ,TMember member,Integer count) throws SQLException;
}
|
package com.tencent.mm.plugin.account.ui;
import com.tencent.mm.ui.widget.a.d.a;
class MobileInputUI$2 implements a {
final /* synthetic */ MobileInputUI eTe;
MobileInputUI$2(MobileInputUI mobileInputUI) {
this.eTe = mobileInputUI;
}
public final void onDismiss() {
MobileInputUI.e(this.eTe).bzW();
}
}
|
public class helloworld{
public static void main(String[] args){
System.out.print("Hola Juana!");
}
}
|
package com.tt.miniapp.view.webcore.scroller;
import android.content.Context;
import com.tt.miniapp.util.ConcaveScreenUtils;
public class WebViewScrollerFactory {
public static WebViewScroller createScrollerSimple(Context paramContext) {
return (WebViewScroller)(ConcaveScreenUtils.isVivoConcaveScreen() ? new VivoConcaveWebViewScroller(paramContext) : new CommonWebViewScroller(paramContext));
}
}
/* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniapp\view\webcore\scroller\WebViewScrollerFactory.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ |
package com.test.nonembedded.one2many;
import com.gigaspaces.annotation.pojo.SpaceClass;
import com.gigaspaces.annotation.pojo.SpaceId;
import com.gigaspaces.annotation.pojo.SpaceIndex;
@SpaceClass
public class Book {
Integer id;
Integer authorId;
String title;
@SpaceId (autoGenerate=false)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@SpaceIndex
public Integer getAuthorId() {
return authorId;
}
public void setAuthorId(Integer authorId) {
this.authorId = authorId;
}
@SpaceIndex
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Book [id=" + id + ", authorId=" + authorId + "]";
}
}
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.01.28 at 02:11:12 PM CST
//
package org.mesa.xml.b2mml;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for TransSenderType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="TransSenderType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="LogicalID" type="{http://www.mesa.org/xml/B2MML-V0600}IdentifierType" minOccurs="0"/>
* <element name="ComponentID" type="{http://www.mesa.org/xml/B2MML-V0600}IdentifierType" minOccurs="0"/>
* <element name="TaskID" type="{http://www.mesa.org/xml/B2MML-V0600}IdentifierType" minOccurs="0"/>
* <element name="ReferenceID" type="{http://www.mesa.org/xml/B2MML-V0600}IdentifierType" minOccurs="0"/>
* <element name="ConfirmationCode" type="{http://www.mesa.org/xml/B2MML-V0600}TransConfirmationCodeType" minOccurs="0"/>
* <element name="AuthorizationID" type="{http://www.mesa.org/xml/B2MML-V0600}IdentifierType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransSenderType", propOrder = {
"logicalID",
"componentID",
"taskID",
"referenceID",
"confirmationCode",
"authorizationID"
})
public class TransSenderType {
@XmlElement(name = "LogicalID")
protected IdentifierType logicalID;
@XmlElement(name = "ComponentID")
protected IdentifierType componentID;
@XmlElement(name = "TaskID")
protected IdentifierType taskID;
@XmlElement(name = "ReferenceID")
protected IdentifierType referenceID;
@XmlElement(name = "ConfirmationCode")
protected TransConfirmationCodeType confirmationCode;
@XmlElement(name = "AuthorizationID")
protected IdentifierType authorizationID;
/**
* Gets the value of the logicalID property.
*
* @return
* possible object is
* {@link IdentifierType }
*
*/
public IdentifierType getLogicalID() {
return logicalID;
}
/**
* Sets the value of the logicalID property.
*
* @param value
* allowed object is
* {@link IdentifierType }
*
*/
public void setLogicalID(IdentifierType value) {
this.logicalID = value;
}
/**
* Gets the value of the componentID property.
*
* @return
* possible object is
* {@link IdentifierType }
*
*/
public IdentifierType getComponentID() {
return componentID;
}
/**
* Sets the value of the componentID property.
*
* @param value
* allowed object is
* {@link IdentifierType }
*
*/
public void setComponentID(IdentifierType value) {
this.componentID = value;
}
/**
* Gets the value of the taskID property.
*
* @return
* possible object is
* {@link IdentifierType }
*
*/
public IdentifierType getTaskID() {
return taskID;
}
/**
* Sets the value of the taskID property.
*
* @param value
* allowed object is
* {@link IdentifierType }
*
*/
public void setTaskID(IdentifierType value) {
this.taskID = value;
}
/**
* Gets the value of the referenceID property.
*
* @return
* possible object is
* {@link IdentifierType }
*
*/
public IdentifierType getReferenceID() {
return referenceID;
}
/**
* Sets the value of the referenceID property.
*
* @param value
* allowed object is
* {@link IdentifierType }
*
*/
public void setReferenceID(IdentifierType value) {
this.referenceID = value;
}
/**
* Gets the value of the confirmationCode property.
*
* @return
* possible object is
* {@link TransConfirmationCodeType }
*
*/
public TransConfirmationCodeType getConfirmationCode() {
return confirmationCode;
}
/**
* Sets the value of the confirmationCode property.
*
* @param value
* allowed object is
* {@link TransConfirmationCodeType }
*
*/
public void setConfirmationCode(TransConfirmationCodeType value) {
this.confirmationCode = value;
}
/**
* Gets the value of the authorizationID property.
*
* @return
* possible object is
* {@link IdentifierType }
*
*/
public IdentifierType getAuthorizationID() {
return authorizationID;
}
/**
* Sets the value of the authorizationID property.
*
* @param value
* allowed object is
* {@link IdentifierType }
*
*/
public void setAuthorizationID(IdentifierType value) {
this.authorizationID = value;
}
}
|
package task328;
/**
* @author igor
*/
public class Main328 {
public static void main(String[] args) {
}
}
|
package model;
import java.time.LocalDateTime;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class Pedido {
private IntegerProperty idpedido;
private Requisicion requisicion;
private Producto producto;
private DoubleProperty cantidadsolicitada;
private DoubleProperty precioinicial;
private StringProperty observaciones;
private ObjectProperty<LocalDateTime> fechaRegistro;
private OrdenDeCompra oc;
private BooleanProperty selected;
public Pedido() {
}
public final int getIdpedido() {
return idpedido.get();
}
public final void setIdpedido(int value) {
idpedido = new SimpleIntegerProperty(value);
}
public IntegerProperty idpedidoProperty() {
return idpedido;
}
public final double getCantidadsolicitada() {
return cantidadsolicitada.get();
}
public final void setCantidadsolicitada(double value) {
cantidadsolicitada = new SimpleDoubleProperty(value);
}
public DoubleProperty cantidadsolicitadaProperty() {
return cantidadsolicitada;
}
public final double getPrecioinicial() {
return precioinicial.get();
}
public final void setPrecioinicial(double value) {
precioinicial = new SimpleDoubleProperty(value);
}
public DoubleProperty precioinicialProperty() {
return precioinicial;
}
public final String getObservaciones() {
return observaciones.get();
}
public final void setObservaciones(String value) {
observaciones = new SimpleStringProperty(value);
}
public StringProperty observacionesProperty() {
return observaciones;
}
public final LocalDateTime getFechaRegistro() {
return fechaRegistro.get();
}
public final void setFechaRegistro(LocalDateTime value) {
fechaRegistro = new SimpleObjectProperty<>(value);
}
public ObjectProperty<LocalDateTime> fechaRegistroProperty() {
return fechaRegistro;
}
public Producto getProducto() {
return producto;
}
public void setProducto(Producto producto) {
this.producto = producto;
}
public Requisicion getRequisicion() {
return requisicion;
}
public void setRequisicion(Requisicion requisicion) {
this.requisicion = requisicion;
}
public OrdenDeCompra getOc() {
return oc;
}
public void setOc(OrdenDeCompra oc) {
this.oc = oc;
}
public final boolean isSelected() {
return selected.get();
}
public final void setSelected(boolean value) {
selected = new SimpleBooleanProperty(value);
}
public BooleanProperty selectedProperty() {
return selected;
}
@Override
public String toString() {
return "Pedido{" + "idpedido=" + idpedido + ", cantidadsolicitada=" + cantidadsolicitada + ", precioinicial=" + precioinicial + ", observaciones=" + observaciones + '}';
}
}
|
package com.example.user.displaycountries;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.user.displaycountries.Model.User;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class SignUp extends AppCompatActivity {
private EditText userEmail, userPassowrd, confirmPass;
private Button signUpBtn, login;
private ProgressDialog progressDialog;
private FirebaseAuth firebaseAuth;
private DatabaseReference reference;
private FirebaseUser currentUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
firebaseAuth = FirebaseAuth.getInstance();
reference = FirebaseDatabase.getInstance().getReference();
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("Please wait...");
currentUser = firebaseAuth.getCurrentUser();
userEmail = (EditText) findViewById(R.id.email);
userPassowrd = (EditText) findViewById(R.id.password);
confirmPass = (EditText) findViewById(R.id.confirm_pass);
signUpBtn = (Button) findViewById(R.id.sign_up_btn);
login = (Button) findViewById(R.id.login_in_btn);
signUpBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checkValidData();
}
});
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(SignUp.this, Login.class);
startActivity(intent);
finish();
}
});
}
//Check if user data that entered is valid (not empty) then called function addUserData
private void checkValidData() {
String userEmailStr = "", userPasswordStr = "", confirmPassStr = "";
View foucsView = null;
Boolean cancel = false;
userEmailStr = userEmail.getText().toString();
userPasswordStr = userPassowrd.getText().toString();
confirmPassStr = confirmPass.getText().toString();
if(TextUtils.isEmpty(userEmailStr)){
foucsView = userEmail;
cancel = true;
userEmail.setError(getString(R.string.error_for_empty_field));
}
else if (!isEmailValid(userEmailStr)) {
userEmail.setError(getString(R.string.error_invalid_email));
foucsView = userEmail;
cancel = true;
}
if(TextUtils.isEmpty(userPasswordStr)){
foucsView = userPassowrd;
cancel = true;
userPassowrd.setError(getString(R.string.error_for_empty_field));
}
if(TextUtils.isEmpty(confirmPassStr)){
foucsView = confirmPass;
cancel = true;
confirmPass.setError(getString(R.string.error_for_empty_field));
}
else if(!userPasswordStr.equals(confirmPassStr)){
confirmPass.setError(getString(R.string.error_confirm_password));
foucsView = confirmPass;
cancel = true;
}
else if(!isPasswordValid(userPasswordStr)){
foucsView = userPassowrd;
cancel = true;
}
if(cancel){
foucsView.requestFocus();
}
else
addUserData(userEmailStr, userPasswordStr, confirmPassStr);
}
//This function to add new user on database to sign up and try our app
private void addUserData(final String email, final String pass, String confirmPass){
progressDialog.show();
firebaseAuth.createUserWithEmailAndPassword(email, pass)
.addOnCompleteListener(SignUp.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
currentUser = firebaseAuth.getCurrentUser();
User newUser = new User();
newUser.setEmail(email);
newUser.setPassword(pass);
reference.child("users").child(currentUser.getUid()).setValue(newUser)
.addOnCompleteListener(SignUp.this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
progressDialog.dismiss();
Toast.makeText(SignUp.this, "Successful sign-up", Toast.LENGTH_LONG).show();
sendVerficationEmail();
SharedPreferences sharedPreferences = getApplicationContext().
getSharedPreferences("MyPref", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("isLogin", true);
editor.commit();
Intent intent = new Intent(getApplicationContext(), Home.class);
startActivity(intent);
finish();
}
else{
progressDialog.dismiss();
Toast.makeText(SignUp.this, "Failed sign up", Toast.LENGTH_SHORT).show();
}
}
});
}
else{
progressDialog.dismiss();
Toast.makeText(SignUp.this, "Authentication failed",
Toast.LENGTH_SHORT).show();
}
}
});
}
//This function to send verfication email to user to confirm the account
private void sendVerficationEmail() {
FirebaseUser user = firebaseAuth.getCurrentUser();
user.sendEmailVerification()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(SignUp.this, Login.class));
finish();
}
else
{
overridePendingTransition(0, 0);
finish();
overridePendingTransition(0, 0);
startActivity(getIntent());
}
}
});
}
//Check if email is valid or not
private boolean isEmailValid(String email) {
return email.contains("@");
}
//Check if password is valid or not must have 1 lower and upper case and 1 number to be secure
private boolean isPasswordValid(String pass) {
if (pass.length() < 8) {
userPassowrd.setError(getString(R.string.error_short_password));
return false;
} else if (pass.equals(pass.toLowerCase()) || pass.equals(pass.toUpperCase())
|| !pass.matches(".*\\d+.*")) {
userPassowrd.setError(getString(R.string.error_invalid_password));
return false;
}
return true;
}
//to return to login form
@Override
public void onBackPressed() {
super.onBackPressed();
Intent intent = new Intent(SignUp.this, Login.class);
startActivity(intent);
finish();
}
}
|
package com.cse308.sbuify.label;
import com.cse308.sbuify.common.Address;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import static org.hibernate.search.annotations.IndexedEmbedded.DEFAULT_NULL_TOKEN;
@Entity
@Indexed
public class Label {
@Id
@GeneratedValue
private Integer id;
@NotNull
@Column(unique = true)
private String mbid;
@NotNull
@NotEmpty
@Field
private String name;
@NotNull
@OneToOne
private Address address;
public Integer getId() {
return id;
}
@OneToOne
@IndexedEmbedded(indexNullAs = DEFAULT_NULL_TOKEN)
@JsonIgnore
private LabelOwner owner;
public String getMBID() {
return mbid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public LabelOwner getOwner() {
return owner;
}
public void setOwner(LabelOwner owner) {
this.owner = owner;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Label label = (Label) o;
return id.equals(label.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
}
|
package com.wqt.service.impl;
import com.wqt.controller.FilmController;
import com.wqt.dto.Film;
import com.wqt.dto.Language;
import com.wqt.mapper.IFilmMapper;
import com.wqt.mapper.LanguageMapper;
import com.wqt.service.IFilmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FilmServiceImpl implements IFilmService{
@Autowired
IFilmMapper mapper;
@Autowired
LanguageMapper languageMapper;
private List<Film> list;
@Override
public List<Film> selectAll() {
List<Film> list=null;
try{
list= mapper.selectAll();
for (int i = 0; i <list.size() ; i++) {
Language language=languageMapper.findById(list.get(i).getLanguageId());
System.out.println(language.getName()+"erer====");
list.get(i).setName(language.getName());
}
}catch (Exception e){
throw new RuntimeException(e);
}
return list;
}
@Override
public String insert(Film film) {
return mapper.insert();
}
}
|
package view;
final public class Constants {
// the strings
public static final String WINDOW_TITLE = "Network Requestor";
public static final String POST = "Post";
public static final String GET = "Get";
public static final String URL = "url:";
public static final String METHOD = "Method";
public static final String SEND = "Send";
public static final String HEADERS = "headers";
public static final String PARAMS = "parameters";
public static final String RESPONSE = "Response";
// the dimensions
public static final int FRAME_WIDTH = 800;
public static final int FRAME_HEIGHT = 650;
} |
package com.hcl.dmu.reg.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hcl.dmu.config.EmailService;
import com.hcl.dmu.email.service.EmailConfigurationService;
import com.hcl.dmu.email.vo.EmailLogVo;
import com.hcl.dmu.reg.vo.ResponseVO;
@Controller
public class EmailTemplateController {
private static final Logger log = LoggerFactory.getLogger(CandiadteDetController.class);
@Autowired
private EmailConfigurationService emailConfigurationService;
@Autowired
private EmailService emailService;
@GetMapping(value = "/getEmailTemplateDetails")
@ResponseBody
public ResponseVO getEmailTemplateDetails() {
ResponseVO responseVO = new ResponseVO();
EmailLogVo EmailLogVo = null;
try {
EmailLogVo = emailConfigurationService.getEmailTemplateDetails();
if (EmailLogVo != null ) {
responseVO.setCode("200");
responseVO.setMessage(EmailLogVo);
} else {
responseVO.setCode("200");
responseVO.setMessage("Details are empty");
}
} catch (Exception e) {
responseVO.setCode("404");
responseVO.setMessage("Response not found");
e.printStackTrace();
}
return responseVO;
}
@PostMapping("/insertEmailTemplateDetails")
@ResponseBody
public ResponseVO insertEmailTemplateDetails(@RequestBody EmailLogVo templateVO) {
ResponseVO responseVO = new ResponseVO();
try {
String EmailLogVo = emailConfigurationService.insertEmailTemplateDetails(templateVO);
if(EmailLogVo != null) {
responseVO.setCode("200");
responseVO.setMessage(EmailLogVo+"Record (s) posted successfully");
}else {
responseVO.setCode("200");
responseVO.setMessage(EmailLogVo+"Record (s) posted");
}
} catch (Exception e) {
responseVO.setCode("404");
responseVO.setMessage("Response not found");
e.printStackTrace();
}
return responseVO;
}
@PostMapping("/updateEmailTemplateDetails")
@ResponseBody
public ResponseVO updateEmailTemplateDetails(@RequestBody EmailLogVo templateVO) {
ResponseVO responseVO = new ResponseVO();
EmailLogVo emailLogVo = null;
try {
String EmailLogVo1 = emailConfigurationService.updateEmailTemplateDetails(templateVO);
if (EmailLogVo1 != null) {
responseVO.setCode("200");
responseVO.setMessage("Data Updated Successfully");
} else {
responseVO.setCode("200");
responseVO.setMessage("Details are not updated");
}
} catch (Exception e) {
responseVO.setCode("404");
responseVO.setMessage("Response not found");
e.printStackTrace();
}
return responseVO;
}
}
|
public class SayBye
{
public void sayBye(String str)
{
System.out.println(str);
}
public void sayBye()
{
System.out.println("Bye-bye!");
}
}
|
package com.tencent.mm.plugin.emoji.a;
import android.content.Context;
import android.view.View;
import com.tencent.mm.R;
import com.tencent.mm.bp.a;
public class f$a extends a {
final /* synthetic */ f idL;
public f$a(f fVar, Context context, View view) {
this.idL = fVar;
super(context, view);
}
protected final void aDj() {
this.idb.setVisibility(8);
aDo();
this.ide.setVisibility(8);
this.idi.setVisibility(8);
this.idj.setVisibility(8);
this.ida.setVisibility(0);
this.gsY.setVisibility(0);
this.idg.setVisibility(0);
this.idf.setVisibility(0);
this.idh.setVisibility(0);
}
protected final int[] aDk() {
int ad = a.ad(this.mContext, R.f.emoji_item_store_image_size);
return new int[]{ad, ad};
}
protected final int aDl() {
return a.ad(this.mContext, R.f.emoji_item_store_height);
}
protected final boolean aDr() {
return f.a(this.idL);
}
}
|
package com.tencent.mm.plugin.appbrand.page;
class n$5 implements Runnable {
final /* synthetic */ n gmP;
final /* synthetic */ l gmV;
n$5(n nVar, l lVar) {
this.gmP = nVar;
this.gmV = lVar;
}
public final void run() {
this.gmV.alJ();
}
}
|
package com.tencent.mm.plugin.mmsight.api;
public interface b$a {
b ZP();
}
|
package com.gzeinnumer.module_1.di.module;
import android.content.Context;
import com.gzeinnumer.module_1.ui.Module_1_VM;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
public class Module_1_Module {
@Provides
@Singleton
Module_1_VM sumUseCaseForModule1(Context context){
return new Module_1_VM(context);
}
@Provides
@Singleton
@Named("Module1")
String corePlusModule1(String string){
return string+" Plus Module_1_Module";
}
}
|
package com.project.hadar.AcadeMovie.Model;
import java.io.Serializable;
public class Review implements Serializable {
private String m_textReview;
private int m_rating;
private String m_userEmail;
public Review() {}
public Review(String i_textReview, int i_rating, String i_userName)
{
this.m_textReview = i_textReview;
this.m_rating = i_rating;
this.m_userEmail = i_userName;
}
public String getM_textReview() {
return m_textReview;
}
public int getM_rating() {
return m_rating;
}
public String getM_userEmail() {
return m_userEmail;
}
/*
public String getTextReview()
{
return m_textReview;
}
public int getRating()
{
return m_rating;
}
public String getUserEmail()
{
return m_userEmail;
}
public void setTextReview(String i_textReview)
{
this.m_textReview = i_textReview;
}
public void setRating(byte i_rating)
{
this.m_rating = i_rating;
}
public void setUserEmail(String i_userEmail)
{
this.m_userEmail = i_userEmail;
}
*/
}
|
package com.company;
public class ToDoListItem {
private String description;
private String complete;
public ToDoListItem() {
}
public ToDoListItem(String description, String complete) {
this.description = description;
this.complete = complete;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getComplete() {
return complete;
}
public void setComplete(String complete) {
this.complete = complete;
}
public void printTask(){
System.out.println( "Your task : " + description + ". Status : "+ complete);
}
@Override
public String toString() {
return "Description : " + description +
". Status of task : " + complete;
}
}
|
package com.example.event.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;
import com.example.event.util.Utils;
@SuppressLint("ClickableViewAccessibility")
public class CropImageView extends ImageView {
private Bitmap mOrigBitmap = null; // 声明一个原始的位图对象
private Bitmap mCropBitmap = null; // 声明一个裁剪后的位图对象
private Rect mRect = new Rect(0, 0, 0, 0); // 矩形边界
private int mInterval; // 与边缘线的间距阈值
private float mOriginX, mOriginY; // 按下时候落点的横纵坐标
private Rect mOriginRect; // 原始的矩形边界
public CropImageView(Context context) {
this(context, null);
}
public CropImageView(Context context, AttributeSet attrs) {
super(context, attrs);
mInterval = Utils.dip2px(context, 10);
}
// 设置原始的位图对象
public void setOrigBitmap(Bitmap orig) {
mOrigBitmap = orig;
}
// 获得裁剪后的位图对象
public Bitmap getCropBitmap() {
return mCropBitmap;
}
// 设置位图的矩形边界
public boolean setBitmapRect(Rect rect) {
if (mOrigBitmap == null) { // 原始位图为空
return false;
} else if (rect.left < 0 || rect.left > mOrigBitmap.getWidth()) { // 左侧边界非法
return false;
} else if (rect.top < 0 || rect.top > mOrigBitmap.getHeight()) { // 上方边界非法
return false;
} else if (rect.right <= 0 || rect.left + rect.right > mOrigBitmap.getWidth()) { // 右侧边界非法
return false;
} else if (rect.bottom <= 0 || rect.top + rect.bottom > mOrigBitmap.getHeight()) { // 下方边界非法
return false;
}
mRect = rect;
// 设置视图的四周间隔
setPadding(mRect.left, mRect.top, 0, 0);
// 根据指定的四周边界,裁剪相应尺寸的位图对象
mCropBitmap = Bitmap.createBitmap(mOrigBitmap,
mRect.left, mRect.top, mRect.right, mRect.bottom);
// 设置图像视图的位图内容
setImageBitmap(mCropBitmap);
postInvalidate(); // 立即刷新视图
return true;
}
// 在发生触摸事件时触发
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: // 手指按下
mOriginX = event.getX();
mOriginY = event.getY();
mOriginRect = mRect;
// 根据落点坐标与矩形边界的相对位置,决定本次拖曳动作的类型
mDragMode = getDragMode(mOriginX, mOriginY);
break;
case MotionEvent.ACTION_MOVE: // 手指移动
int offsetX = (int) (event.getX() - mOriginX);
int offsetY = (int) (event.getY() - mOriginY);
Rect rect = null;
if (mDragMode == DRAG_NONE) { // 无拖曳动作
return true;
} else if (mDragMode == DRAG_WHOLE) { // 拖动整个矩形边界框
rect = new Rect(mOriginRect.left + offsetX, mOriginRect.top + offsetY, mOriginRect.right, mOriginRect.bottom);
} else if (mDragMode == DRAG_LEFT) { // 拖动矩形边界的左边缘
rect = new Rect(mOriginRect.left + offsetX, mOriginRect.top, mOriginRect.right - offsetX, mOriginRect.bottom);
} else if (mDragMode == DRAG_RIGHT) { // 拖动矩形边界的右边缘
rect = new Rect(mOriginRect.left, mOriginRect.top, mOriginRect.right + offsetX, mOriginRect.bottom);
} else if (mDragMode == DRAG_TOP) { // 拖动矩形边界的上边缘
rect = new Rect(mOriginRect.left, mOriginRect.top + offsetY, mOriginRect.right, mOriginRect.bottom - offsetY);
} else if (mDragMode == DRAG_BOTTOM) { // 拖动矩形边界的下边缘
rect = new Rect(mOriginRect.left, mOriginRect.top, mOriginRect.right, mOriginRect.bottom + offsetY);
} else if (mDragMode == DRAG_LEFT_TOP) { // 拖动矩形边界的左上角
rect = new Rect(mOriginRect.left + offsetX, mOriginRect.top + offsetY, mOriginRect.right - offsetX, mOriginRect.bottom - offsetY);
} else if (mDragMode == DRAG_RIGHT_TOP) { // 拖动矩形边界的右上角
rect = new Rect(mOriginRect.left, mOriginRect.top + offsetY, mOriginRect.right + offsetX, mOriginRect.bottom - offsetY);
} else if (mDragMode == DRAG_LEFT_BOTTOM) { // 拖动矩形边界的左下角
rect = new Rect(mOriginRect.left + offsetX, mOriginRect.top, mOriginRect.right - offsetX, mOriginRect.bottom + offsetY);
} else if (mDragMode == DRAG_RIGHT_BOTTOM) { // 拖动矩形边界的右下角
rect = new Rect(mOriginRect.left, mOriginRect.top, mOriginRect.right + offsetX, mOriginRect.bottom + offsetY);
}
setBitmapRect(rect); // 设置位图的矩形边界
break;
case MotionEvent.ACTION_UP: // 手指提起
break;
default:
break;
}
return true;
}
private int DRAG_NONE = 0; // 无拖曳动作
private int DRAG_WHOLE = 1; // 拖动整个矩形边界框
private int DRAG_LEFT = 2; // 拖动矩形边界的左边缘
private int DRAG_RIGHT = 3; // 拖动矩形边界的右边缘
private int DRAG_TOP = 4; // 拖动矩形边界的上边缘
private int DRAG_BOTTOM = 5; // 拖动矩形边界的下边缘
private int DRAG_LEFT_TOP = 6; // 拖动矩形边界的左上角
private int DRAG_RIGHT_TOP = 7; // 拖动矩形边界的右上角
private int DRAG_LEFT_BOTTOM = 8; // 拖动矩形边界的左下角
private int DRAG_RIGHT_BOTTOM = 9; // 拖动矩形边界的右下角
private int mDragMode = DRAG_NONE; // 拖曳动作的类型
// 根据落点坐标与矩形边界的相对位置,决定本次拖曳动作的类型
private int getDragMode(float f, float g) {
int left = mRect.left;
int top = mRect.top;
int right = mRect.left + mRect.right;
int bottom = mRect.top + mRect.bottom;
if (Math.abs(f - left) <= mInterval && Math.abs(g - top) <= mInterval) {
return DRAG_LEFT_TOP; // 拖动矩形边界的左上角
} else if (Math.abs(f - right) <= mInterval && Math.abs(g - top) <= mInterval) {
return DRAG_RIGHT_TOP; // 拖动矩形边界的右上角
} else if (Math.abs(f - left) <= mInterval && Math.abs(g - bottom) <= mInterval) {
return DRAG_LEFT_BOTTOM; // 拖动矩形边界的左下角
} else if (Math.abs(f - right) <= mInterval && Math.abs(g - bottom) <= mInterval) {
return DRAG_RIGHT_BOTTOM; // 拖动矩形边界的右下角
} else if (Math.abs(f - left) <= mInterval && g > top + mInterval && g < bottom - mInterval) {
return DRAG_LEFT; // 拖动矩形边界的左边缘
} else if (Math.abs(f - right) <= mInterval && g > top + mInterval && g < bottom - mInterval) {
return DRAG_RIGHT; // 拖动矩形边界的右边缘
} else if (Math.abs(g - top) <= mInterval && f > left + mInterval && f < right - mInterval) {
return DRAG_TOP; // 拖动矩形边界的上边缘
} else if (Math.abs(g - bottom) <= mInterval && f > left + mInterval && f < right - mInterval) {
return DRAG_BOTTOM; // 拖动矩形边界的下边缘
} else if (f > left + mInterval && f < right - mInterval
&& g > top + mInterval && g < bottom - mInterval) {
return DRAG_WHOLE; // 拖动整个矩形边界框
} else {
return DRAG_NONE; // 无拖曳动作
}
}
}
|
package com.pangpang6.hadoop.storm.bolt;
import org.apache.commons.io.FileUtils;
import org.apache.storm.topology.BasicOutputCollector;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.topology.base.BaseBasicBolt;
import org.apache.storm.tuple.Tuple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
public class HelloBolt02 extends BaseBasicBolt {
private static final Logger logger = LoggerFactory.getLogger(HelloBolt02.class);
@Override
public void execute(Tuple input, BasicOutputCollector collector) {
String hello02 = input.getStringByField("hello01");
logger.info("hello02: " + hello02);
try {
FileUtils.write(new File("/opt/apps/storm/data/" + this), hello02, "urf-8");
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
}
}
|
package com.koreait.mvc10.command;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.ui.Model;
import com.koreait.mvc10.dao.BoardDao;
public class BoardDeleteCommand implements BoardCommand {
@Override
public void execute(Model model) {
Map<String, Object> map = model.asMap();
HttpServletRequest request = (HttpServletRequest) map.get("request");
String strbIdx = request.getParameter("bIdx");
BoardDao bDao = new BoardDao();
bDao.delete(strbIdx);
}
}
|
/**
* @Title: BattleDetail.java
* @Package org.alvissreimu.toolkit
* @Description: TODO
* @author Minghao Li
* @date Jul 24, 2018 2:47:32 PM
* @version V1.0
*/
package org.alvissreimu.data;
/**
* @ClassName: BattleDetail
* @Description: Battle detail data structure
* @author Minghao Li
* @date Jul 24, 2018 2:47:32 PM
*/
public class BattleDetail {
private Long timestamp;
private String map;
private String node;
private String description;
private String grade;
public BattleDetail(Long timestamp, String map, String node, String description, String grade) {
this.timestamp = timestamp;
this.map = map;
this.node = node;
this.description = description;
this.grade = grade;
}
public Long getTimestamp() {
return timestamp;
}
/*
* <p>Title: toString</p>
* <p>Description: </p>
* @return
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(timestamp);
sb.append(",");
sb.append(timestamp);
sb.append(",");
sb.append(map);
sb.append(",");
sb.append(node);
sb.append(",");
sb.append(description);
sb.append(",");
sb.append(grade);
return sb.toString();
}
}
|
/*
* Copyright 2018 Ameer Antar.
*
* 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.antfarmer.ejce.test.stream;
import static org.junit.Assert.assertArrayEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import javax.crypto.Cipher;
import org.antfarmer.common.util.IoUtil;
import org.antfarmer.ejce.Encryptor;
import org.antfarmer.ejce.parameter.AesParameters;
import org.antfarmer.ejce.parameter.AlgorithmParameters;
import org.antfarmer.ejce.parameter.salt.SaltGenerator;
import org.antfarmer.ejce.stream.EncryptInputStream;
import org.antfarmer.ejce.test.AbstractTest;
import org.junit.Test;
/**
* @author Ameer Antar
*/
public class CipherStreamTest extends AbstractTest {
private static final String TEXT = "TEST";
@Test
public void testEnc() throws GeneralSecurityException, IOException {
final AesParameters params = new AesParameters().setBlockMode(AesParameters.BLOCK_MODE_ECB);
final ByteArrayInputStream bais = new ByteArrayInputStream(TEXT.getBytes(UTF8));
final EncryptInputStream cs = createCipherStream(bais, params);
final byte[] streamBytes = IoUtil.readBytes(cs);
final Cipher cipher = Cipher.getInstance(params.getTransformation());
cipher.init(Cipher.ENCRYPT_MODE, params.getKey());
final byte[] cipherBytes = cipher.doFinal(TEXT.getBytes(UTF8));
assertArrayEquals(streamBytes, cipherBytes);
}
@Test
public void testSmallRead() throws GeneralSecurityException, IOException {
final AesParameters params = new AesParameters().setSaltGenerator(new SaltGenerator() {
@Override
public void generateSalt(final byte[] saltData) {
Arrays.fill(saltData, (byte)5);
}
});
final int size = params.getParameterSpecSize();
final byte[] buff = new byte[size >> 1];
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ByteArrayInputStream bais = new ByteArrayInputStream(TEXT.getBytes(UTF8));
final EncryptInputStream cs = createCipherStream(bais, params);
int read;
while ((read = cs.read(buff)) >= 0) {
baos.write(buff, 0, read);
}
final Encryptor enc = new Encryptor().setAlgorithmParameters(params);
enc.initialize();
final byte[] streamResult = baos.toByteArray();
final byte[] encResult = enc.encrypt(TEXT.getBytes(UTF8));
// System.out.println(Arrays.toString(Arrays.copyOfRange(streamResult, 0, size)));
// System.out.println(Arrays.toString(Arrays.copyOfRange(encResult, encResult.length - size, encResult.length)));
assertArrayEquals(Arrays.copyOfRange(encResult, encResult.length - size, encResult.length), Arrays.copyOfRange(streamResult, 0, size));
// System.out.println(Arrays.toString(Arrays.copyOfRange(streamResult, size, streamResult.length)));
// System.out.println(Arrays.toString(Arrays.copyOfRange(encResult, 0, encResult.length - size)));
assertArrayEquals(Arrays.copyOfRange(encResult, 0, encResult.length - size), Arrays.copyOfRange(streamResult, size, streamResult.length));
}
@Test
public void testReset() throws GeneralSecurityException, IOException {
final AesParameters params = new AesParameters();
final int size = params.getParameterSpecSize();
final byte[] buff1 = new byte[size];
final byte[] buff2 = new byte[size];
final ByteArrayInputStream bais = new ByteArrayInputStream(TEXT.getBytes(UTF8));
final EncryptInputStream cs = createCipherStream(bais, params);
cs.read(buff1);
cs.reset();
cs.read(buff2);
assertArrayEquals(buff1, buff2);
}
@Test(expected = UnsupportedOperationException.class)
public void testReadByte() throws GeneralSecurityException, IOException {
final ByteArrayInputStream bais = new ByteArrayInputStream(TEXT.getBytes(UTF8));
final EncryptInputStream cs = createCipherStream(bais, new AesParameters());
cs.read();
}
private EncryptInputStream createCipherStream(final InputStream in, final AlgorithmParameters<?> parameters) throws GeneralSecurityException {
final Cipher cipher = Cipher.getInstance(parameters.getTransformation());
final byte[] specData = parameters.generateParameterSpecData();
cipher.init(Cipher.ENCRYPT_MODE, parameters.getEncryptionKey(), specData == null ? null : parameters.createParameterSpec(specData));
return new EncryptInputStream(in, cipher);
}
}
|
package com.jacobwysko.teacherquotes;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import com.github.paolorotolo.appintro.AppIntro2;
import com.github.paolorotolo.appintro.AppIntroFragment;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class WelcomeActivity extends AppIntro2{
@SuppressWarnings("deprecation")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setZoomAnimation();
showSkipButton(false);
setWizardMode(true);
addSlide(AppIntroFragment.newInstance("Teacher Quotes", "Quote your favorite teachers on what they say", R.drawable.noback, getResources().getColor(R.color.primaryDarkColor)));
addSlide(AppIntroFragment.newInstance("Advanced Tools", "Advanced tools for bulk quoting and complex quotations", R.drawable.baseline_tune_white_48, getResources().getColor(R.color.primaryAccent)));
addSlide(AppIntroFragment.newInstance("Analytics","Detailed quotation database with extensive statistical analyses", R.drawable.baseline_bar_chart_white_48, getResources().getColor(R.color.primaryColor)));
addSlide(AppIntroFragment.newInstance("Community", "Discord server with a community of quoters", R.drawable.baseline_people_white_48,getResources().getColor(R.color.primaryDarkColor)));
addSlide(AppIntroFragment.newInstance("Bot","Utilizes analytics from the database to provide members of the Discord Server with statistics", R.drawable.baseline_memory_white_48, getResources().getColor(R.color.primaryColor)));
}
@Override
public void onDonePressed(Fragment currentFragment) {
super.onDonePressed(currentFragment);
BufferedReader input;
File file;
String readData = null;
try {
file = new File(getFilesDir(), "teacherList");
input = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
readData = input.readLine();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception ignored){}
try {
if ("".equals(readData) || readData == null) {
startTeacherImport();
}
} catch (Exception e){
startTeacherImport();
}
finish();
}
@Override
public void onBackPressed(){
// Do nothing. (Prevents from going back to main screen)
}
private void startTeacherImport(){
Intent myIntent = new Intent(WelcomeActivity.this, ImportTeachersActivity.class);
WelcomeActivity.this.startActivity(myIntent);
}
}
|
package kr.ko.nexmain.server.MissingU.theshop.model;
public class TStoreProduct {
/**
* 구매이력 시간
*/
String log_time;
/**
* 구매상품id(모상품id)
*/
String appid;
/**
* 구매상품부분id
*/
String product_id;
/**
* 구매상품금액
*/
int charge_amount;
/**
* 구매요청시 app 개발사에서 발급한 아이디(missingu 에서 발급함)
*/
String tid;
/**
* 상품 상세정보(구매요청시 넘겨준값)
*/
String detail_pname;
/**
* BP사 정보(판매회원 개발 서버가 구매정보 수신시에 전달 받고자 하는 값
*/
String bp_info;
public String getLog_time() {
return log_time;
}
public void setLog_time(String log_time) {
this.log_time = log_time;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getProduct_id() {
return product_id;
}
public void setProduct_id(String product_id) {
this.product_id = product_id;
}
public int getCharge_amount() {
return charge_amount;
}
public void setCharge_amount(int charge_amount) {
this.charge_amount = charge_amount;
}
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getDetail_pname() {
return detail_pname;
}
public void setDetail_pname(String detail_pname) {
this.detail_pname = detail_pname;
}
public String getBp_info() {
return bp_info;
}
public void setBp_info(String bp_info) {
this.bp_info = bp_info;
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.products.service;
import de.hybris.platform.catalog.model.CatalogVersionModel;
import de.hybris.platform.cms2.data.PageableData;
import de.hybris.platform.core.model.product.ProductModel;
import de.hybris.platform.servicelayer.search.SearchResult;
/**
* Service Interface for Searching Products
*/
public interface ProductSearchService
{
/**
* Method to find products using a free-text form. It also supports pagination.
*
* @param text The free-text string to be used on the product search
* @param pageableData the pagination object
* @param catalogVersion the catalog version used in the search
* @return the search result object containing the resulting list and the pagination object.
* @throws InvalidNamedQueryException when the named query is invalid in the application context
* @Throws SearchExecutionNamedQueryException when there was a problem in the execution of the named query.
*/
SearchResult<ProductModel> findProducts(final String text, final PageableData pageableData, final CatalogVersionModel catalogVersion);
}
|
package com.Banks;
import com.Jsoup.BankFinancialProducts;
import com.Jsoup.BankFinancialProductsDao;
import com.Jsoup.util.GsonBuilderUtil;
import com.Jsoup.util.MyBatisUtil;
import com.alibaba.fastjson.JSON;
import com.demo.other.BankInfo1;
import com.google.gson.Gson;
import net.sf.json.JSONArray;
import org.apache.ibatis.session.SqlSession;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @Desc
* @Author 刘慧斌
* @CreateTime 2019-04-25 23:32
**/
//建设银行-------数据完整
public class CCB {
public static void main(String[] args) {
String url="http://finance.ccb.com/cc_webtran/queryFinanceProdList.gsp";
Document document=null;
SqlSession sqlSession=MyBatisUtil.createSqlSession();
try {
document=Jsoup.connect(url).userAgent("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)")
.get();
//System.out.println(document);//输出结果带几个HTML标签,用.text()提取出来
String json=document.text();
/*JSONObject obj = JSONObject.parseObject(json);
com.alibaba.fastjson.JSONArray jsonArray2= (com.alibaba.fastjson.JSONArray) obj.get("ProdList");*/
System.out.println(json);
Gson gson=GsonBuilderUtil.create();;
BankInfo1 bankProduct=gson.fromJson(json,BankInfo1.class);
JSONArray jsonArray=JSONArray.fromObject(bankProduct.getProdList());
BankInfo1.Product product=null;
BankFinancialProducts products=null;
for (int i=0;i<jsonArray.size();i++){
Object o=jsonArray.get(i);
String json2 = JSON.toJSONString(o);
product=gson.fromJson(json2,BankInfo1.Product.class);
String time1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(product.getCollBgnDate());
String time2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(product.getCollEndDate());
products=new BankFinancialProducts("中国建设银行",product.getName().toString(),product.getYieldRate().toString()+"%",time1+"--"+time2,product.getInvestPeriod().toString()+"天",product.getPurFloorAmt().toString(),product.getRiskLevel().toString(),product.getInstructionUrl().toString());
sqlSession.getMapper(BankFinancialProductsDao.class).insertSelective(products);
sqlSession.commit();
/*System.out.println("银行名称:"+"\t\t"+products.getBankName()+"\n"
+"产品名:" + "\t\t\t"+products.getProductName()+"\n"
+"链接:" + "\t\t\t"+products.getUrl()+"\n"
+"风险:" + "\t\t\t"+products.getRisk()+"\n"
+"收益:"+"\t\t\t"+products.getYieldRate()+"%"+"\n"
+"生效时间:"+"\t\t"+products.getTimeLimit()+"\n"
+"购买日期:"+"\t\t"+products.getDuring()+"\n"
+"起购金额:"+"\t\t"+products.getPurchaseAmount()+"\n");*/
}
} catch (IOException e) {
e.printStackTrace();
}finally{
MyBatisUtil.closeSqlSession(sqlSession);
}
}
}
|
package com.espendwise.manta.util.validation.resolvers;
import com.espendwise.manta.util.alert.ArgumentedMessage;
import com.espendwise.manta.spi.ValidationResolver;
import com.espendwise.manta.util.validation.ValidationCode;
import com.espendwise.manta.util.validation.ValidationException;
import java.util.List;
public interface ValidationCodeResolver extends ValidationResolver<ValidationCode[]> {
@Override
List<? extends ArgumentedMessage> resolve(ValidationCode[] code) throws ValidationException;
}
|
package uk.gov.gchq.palisade.example.rule;
import org.junit.BeforeClass;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import uk.gov.gchq.palisade.Context;
import uk.gov.gchq.palisade.User;
import uk.gov.gchq.palisade.example.common.ExampleUsers;
import uk.gov.gchq.palisade.example.common.Purpose;
import uk.gov.gchq.palisade.example.hrdatagenerator.types.Employee;
import uk.gov.gchq.palisade.example.hrdatagenerator.types.Manager;
import uk.gov.gchq.palisade.rule.Rule;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
public abstract class TestCommonRuleTheories {
// Implements a set of common tests applicable to any rule
// Mostly, this covers behaviour of passing null to everything
// An extending class must provide its Rule as a @DataPoint
private static final Random random = new Random(1);
private static final Context profileAccessContext = new Context().purpose(Purpose.PROFILE_ACCESS.name());
@DataPoints
public static final Employee[] records = new Employee[] {
Employee.generate(random),
Employee.generate(random),
};
@DataPoints
public static final User[] users = new User[] {
ExampleUsers.getUser("reggie mint"),
ExampleUsers.getUser("tom tally")
};
@DataPoints
public static final Context[] contexts = new Context[] {
new Context().purpose(Purpose.COMPANY_DIRECTORY.name()),
new Context().purpose(Purpose.PROFILE_ACCESS.name()),
new Context().purpose(Purpose.HEALTH_SCREENING.name()),
new Context().purpose(Purpose.SALARY_ANALYSIS.name()),
new Context().purpose("")
};
@org.junit.Rule
public ExpectedException thrown = ExpectedException.none();
private static HashSet<Manager> traverseManagers(Manager[] managers) {
HashSet<Manager> traversal = new HashSet<Manager>();
if (managers != null) {
for (Manager manager : managers) {
traversal.add(manager);
traversal.addAll(traverseManagers(manager.getManager()));
}
}
return traversal;
}
@BeforeClass
public static void setUp() {
// At least one Employee has a Uid matching for at least one User
records[0].setUid(users[0].getUserId());
// At least one Employee has managers containing at least one User
Iterator<Manager> allManagers = traverseManagers(records[1].getManager()).iterator();
assertTrue(allManagers.hasNext());
allManagers.next().setUid(users[1].getUserId());
}
@Theory
public void testNullEmployee(Rule<Employee> rule, final User user, final Context context) {
// Given
// When
Employee redactedRecord = rule.apply(null, user, context);
// Then
assertThat(redactedRecord, is(nullValue()));
}
@Theory
public void testNullUser(Rule<Employee> rule, final Employee record, final Context context) throws NullPointerException {
// Given - Context profileViewContext
// Then (expected)
thrown.expect(NullPointerException.class);
// When
rule.apply(new Employee(record), null, context);
}
@Theory
public void testContextWithoutPurpose(Rule<Employee> rule, final Employee record, final User user) throws NullPointerException {
// Given - Employee record, User user
Context purposelessContext = new Context(); // .purpose() assignment never called
// Then (expected)
thrown.expect(NullPointerException.class);
// When
rule.apply(new Employee(record), user, purposelessContext);
}
@Theory
public void testNullContext(Rule<Employee> rule, final Employee record, final User user) throws NullPointerException {
// Given - Employee record, User user
// Then (expected)
thrown.expect(NullPointerException.class);
// When
rule.apply(new Employee(record), user, null);
}
}
|
package com.navin.melalwallet.webservice;
import io.reactivex.android.plugins.RxAndroidPlugins;
import retrofit2.CallAdapter;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
static Retrofit retrofit = null;
public static final String BASE_URL="http://androidsupport.ir/market/";
public static final String IMAGE_URL=BASE_URL+"images/";
public static Retrofit getRetrofit() {
if (retrofit == null) {
retrofit = new Retrofit.Builder().baseUrl(BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create()).build();
}
return retrofit;
}
}
|
package org.opentosca.settings;
import java.io.File;
import java.util.Properties;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* Global OpenTOSCA Settings.
*
*/
public class Settings implements BundleActivator {
public final static String CONTAINER_API = "http://localhost:1337/containerapi";
// TODO: Use public static final variables instead, as in
// StaticTOSCANamespaces. The problems with the current approach is: (i)
// Full-text search to find usage instead of Java Reference Search. (ii) It
// is possible to references non-existing settings, which is not possible
// with static variables which are checked on compile time.
private static Properties settings = new Properties();
private static BundleContext context;
// Container Capabilities
private final static String containerCapabilities = "http://opentosca/planportabilityapi/rest, http://opentosca/containerapi";
static BundleContext getContext() {
return Settings.context;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
@Override
public void start(BundleContext bundleContext) throws Exception {
Settings.context = bundleContext;
// /////////////////// PATHS ///////////////////
// contains data of OpenTOSCA that should be stored permanently
String openTOSCAPath = System.getProperty("java.io.tmpdir") + File.separator + "openTOSCA";
// contains data of OpenTOSCA that should be stored temporarily
Settings.setSetting("temp", openTOSCAPath + File.separator + "Temp");
// Derby database location
Settings.setSetting("databaseLocation", openTOSCAPath + File.separator + "DB");
// relative path where CSARs will be stored locally; used by the
// Filesystem storage provider
Settings.setSetting("csarStorePath", openTOSCAPath + File.separator + "CSARs");
// /////////////////// URLS ///////////////////
// URI of the ContainerAPI
Settings.setSetting("containerUri", CONTAINER_API);
// URI of the DataInstanceAPI
Settings.setSetting("datainstanceUri", "http://localhost:1337/datainstance");
// /////////////////// CSAR ///////////////////
// extension of a CSAR file
Settings.setSetting("csarExtension", "csar");
// relative path of IMPORTS directory in a CSAR file
Settings.setSetting("csarImportsRelPath", "IMPORTS");
// relative path of Definitions directory in a CSAR file
Settings.setSetting("csarDefinitionsRelPath", "Definitions");
// relative path where the TOSCA meta file is located in a CSAR file
Settings.setSetting("toscaMetaFileRelPath", "TOSCA-Metadata" + File.separator + "TOSCA.meta");
// possible file extensions of a TOSCA file, separated by character ";"
Settings.setSetting("toscaFileExtensions", "xml;tosca;ste");
// /////////////////// OTHERS ///////////////////
// Container Capabilities
Settings.setSetting("containerCapabilities", Settings.containerCapabilities);
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext bundleContext) throws Exception {
Settings.context = null;
}
/**
* @param setting - name of the setting
* @return the value of setting with name <code>setting</code>
*/
public static String getSetting(String setting) {
return Settings.settings.getProperty(setting);
}
/**
* Stores a setting.
*
* @param setting - name of the setting
* @param value - value of the setting
*/
public static void setSetting(String setting, String value) {
Settings.settings.setProperty(setting, value);
}
}
|
package com.example.weatherforecastapp.location;
import android.annotation.SuppressLint;
import android.arch.lifecycle.LiveData;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.annotation.MainThread;
/**
* Created by Erkut Demirhan on 15/10/17.
*/
public class LocationLiveData extends LiveData<Location> implements LocationListener {
private static final long LOCATION_UPDATE_PERIOD = 5 * 1000;
private static final long LOCATION_MIN_DISTANCE = 10;
private static LocationLiveData instance;
private LocationManager locationManager;
private Location latestLocation;
@MainThread
public static LocationLiveData getInstance(Context context) {
if(instance == null) {
instance = new LocationLiveData(context);
}
return instance;
}
private LocationLiveData(Context context) {
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
}
@Override
@SuppressLint("MissingPermission")
protected void onActive() {
super.onActive();
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
LOCATION_UPDATE_PERIOD,
LOCATION_MIN_DISTANCE,
LocationLiveData.this);
}
@Override
@SuppressLint("MissingPermission")
protected void onInactive() {
super.onInactive();
locationManager.removeUpdates(LocationLiveData.this);
}
@Override
public void onLocationChanged(Location location) {
if(latestLocation == null) {
latestLocation = location;
setValue(latestLocation);
} else {
if(latestLocation.distanceTo(location) >= LOCATION_MIN_DISTANCE) {
latestLocation = location;
setValue(latestLocation);
}
}
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {}
@Override
public void onProviderEnabled(String s) {}
@Override
public void onProviderDisabled(String s) {}
}
|
package com.wukker.sb.eventconnectionfortopmobile.brains;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.wukker.sb.eventconnectionfortopmobile.model.Questionnaire;
import com.wukker.sb.eventconnectionfortopmobile.model.Rating;
import com.wukker.sb.eventconnectionfortopmobile.model.User;
import com.wukker.sb.eventconnectionfortopmobile.model.VisitorType;
import com.wukker.sb.eventconnectionfortopmobile.model.methods.Constants;
import com.wukker.sb.eventconnectionfortopmobile.model.methods.HTTPMethod;
import com.wukker.sb.eventconnectionfortopmobile.model.methods.HelperParams;
import com.wukker.sb.eventconnectionfortopmobile.model.methods.URLHelper;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.ExecutionException;
/**
* Created by sb on 07.11.15.
*/
public class JSONSerializationBrain {
public static String postUser(User user)
{
URL url = null;
JSONObject userAsJson = null;
try {
Gson gson = new GsonBuilder().create();
String userAsString = gson.toJson(user);
userAsJson = new JSONObject(userAsString);
System.out.println(userAsJson);
} catch (JSONException e)
{
e.printStackTrace();
//TODO
}
String response = null;
URLHelper urlHelper = new URLHelper();
try {
url = new URL(Constants.globalURL+Constants.userPointer);
} catch (MalformedURLException e){
e.printStackTrace();
}
HelperParams helperParams = new HelperParams(url, HTTPMethod.POST, userAsJson);
try {
response = urlHelper.execute(helperParams).get();
} catch (ExecutionException e)
{
e.printStackTrace();
} catch (InterruptedException e)
{
e.printStackTrace();
}
return response;
}
public static void postStatus(String selected, User user)
{
URL url = null;
HelperParams helperParams;
try {
url = new URL(Constants.globalURL+Constants.userPointer + user.getOauthToken() + Constants.visitPointer + Constants.conferceID);
} catch (MalformedURLException e)
{
e.printStackTrace();
//TODO
}
helperParams = new HelperParams(url, HTTPMethod.POSTFORM, "type="+ VisitorType.getFromString(selected).toString());
try {
URLHelper urlHelper = new URLHelper();
String response = urlHelper.execute(helperParams).get();
} catch (InterruptedException e)
{
e.printStackTrace();
} catch (ExecutionException e)
{
e.printStackTrace();
}
}
public static String putRating (Rating rating, long eventID, long staffID)
{
URL url = null;
JSONObject ratingAsJson = null;
try {
Gson gson = new GsonBuilder().create();
String ratingAsString = gson.toJson(rating);
ratingAsJson = new JSONObject(ratingAsString);
} catch (JSONException e)
{
e.printStackTrace();
//TODO
}
String response = null;
URLHelper urlHelper = new URLHelper();
if (staffID == Constants.enough)
{
try {url = new URL(Constants.globalURL+Constants.eventPointer + eventID + Constants.ratePointer);} catch (MalformedURLException e){ e.printStackTrace();}
} else {
try {url = new URL(Constants.globalURL+Constants.eventPointer + eventID + Constants.staffPointer + staffID + Constants.ratePointer);} catch (MalformedURLException e){ e.printStackTrace();}
}
HelperParams helperParams = new HelperParams(url, HTTPMethod.PUT, ratingAsJson);
try {
urlHelper.execute(helperParams);
response = urlHelper.get();
} catch (ExecutionException e)
{
e.printStackTrace();
} catch (InterruptedException e)
{
e.printStackTrace();
}
return response;
}
public static String putQuest (Questionnaire questionnaire, User user)
{
URL url = null;
JSONObject questAsJson = null;
try {
Gson gson = new GsonBuilder().create();
String ratingAsString = gson.toJson(questionnaire);
questAsJson = new JSONObject(ratingAsString);
} catch (JSONException e)
{
e.printStackTrace();
//TODO
}
String response = null;
URLHelper urlHelper = new URLHelper();
try {url = new URL(Constants.globalURL+Constants.userPointer + user.getOauthToken() + Constants.questPointer);} catch (MalformedURLException e){ e.printStackTrace();}
HelperParams helperParams = new HelperParams(url, HTTPMethod.PUT, questAsJson);
try {
urlHelper.execute(helperParams);
response = urlHelper.get();
} catch (ExecutionException e)
{
e.printStackTrace();
} catch (InterruptedException e)
{
e.printStackTrace();
}
return response;
}
} |
package com.tencent.mm.ac;
import com.tencent.mm.ab.b;
import com.tencent.mm.ab.b.a;
import com.tencent.mm.ab.e;
import com.tencent.mm.ab.l;
import com.tencent.mm.network.k;
import com.tencent.mm.network.q;
import com.tencent.mm.protocal.c.hp;
import com.tencent.mm.protocal.c.hq;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
public final class p extends l implements k {
private String cYO;
private a<p> dMC;
b diG;
private e diJ;
public p(String str, String str2, a<p> aVar) {
this(str, str2);
this.dMC = aVar;
}
private p(String str, String str2) {
this.cYO = str;
x.i("MicroMsg.NetSceneBizAttrSync", "[BizAttr] NetSceneBizAttrSync (%s)", new Object[]{str});
a aVar = new a();
aVar.dIF = 1075;
aVar.uri = "/cgi-bin/mmbiz-bin/bizattr/bizattrsync";
aVar.dIG = new hp();
aVar.dIH = new hq();
aVar.dII = 0;
aVar.dIJ = 0;
this.diG = aVar.KT();
hp hpVar = (hp) this.diG.dID.dIL;
hpVar.riA = this.cYO;
hpVar.riB = new com.tencent.mm.bk.b(bi.WP(bi.oV(str2)));
}
public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) {
x.i("MicroMsg.NetSceneBizAttrSync", "[BizAttr] onGYNetEnd netId %d, errType %d, errCode %d, errMsg %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), str});
if (this.diJ != null) {
this.diJ.a(i2, i3, str, this);
}
if (this.dMC != null) {
this.dMC.b(i2, i3, str, this);
}
}
public final int getType() {
return 1075;
}
public final int a(com.tencent.mm.network.e eVar, e eVar2) {
this.diJ = eVar2;
return a(eVar, this.diG, this);
}
}
|
/*
* 版权声明 .
* 此文档的版权归通联支付网络服务有限公司所有
* Powered By [Allinpay-Boss-framework]
*/
package com.allinpay.its.boss.system.permission.action;
import com.allinpay.its.boss.framework.utils.Page;
import com.allinpay.its.boss.system.BaseAction;
import com.allinpay.its.boss.system.permission.model.FrameworkActionLog;
import com.allinpay.its.boss.system.permission.service.FrameworkActionLogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.ui.Model;
@Controller
@RequestMapping("/aclog")
public class FrameworkActionLogAction extends BaseAction{
//private static final long serialVersionUID = 13352179L;
@Autowired
private FrameworkActionLogServiceImpl frameworkActionLogService;
/**
* 列表信息查询
*
* @return String
* @author code gen
*/
@RequestMapping("")
public String findFrameworkActionLogs(Model springModel,FrameworkActionLog model) {
Page page = frameworkActionLogService.findFrameworkActionLogs(model, model.getPageNum(), model.getNumPerPage());
springModel.addAttribute(page);
return "system/permission/FrameworkActionLog/FrameworkActionLogsQuery";
}
/**
* 新增页面
*
* @return String
* @author by code generator
*/
@RequestMapping("/addFrameworkActionLogToPage")
public String addFrameworkActionLog(Model model) {
return "system/permission/FrameworkActionLog/FrameworkActionLogAdd";
}
/**
* 新增保存
*
* @return String
* @author by code generator
*/
@RequestMapping(value="/saveFrameworkActionLogAction",method = RequestMethod.POST)
public ModelAndView saveFrameworkActionLog(FrameworkActionLog model) {
frameworkActionLogService.add(model);
return ajaxDoneSuccess("成功");
}
/**
* 删除
*
* @return String
* @author by code generator
*/
@RequestMapping("/delete/{pk_Id}")
public ModelAndView deleteFrameworkActionLog(@PathVariable("pk_Id") int pk_Id) {
frameworkActionLogService.delete(pk_Id);
return ajaxDoneSuccess("成功");
}
/**
* 修改初始化
*
* @return String
* @author by code generator
*/
@RequestMapping("/modify/{pk_Id}")
public String initModifyFrameworkActionLog(@PathVariable("pk_Id") int pk_Id,Model springModel) {
FrameworkActionLog frameworkActionLog = frameworkActionLogService.getFrameworkActionLogByPk(pk_Id);
springModel.addAttribute("infos",frameworkActionLog);
return "system/permission/FrameworkActionLog/FrameworkActionLogModify";
}
/**
* 修改
*
* @return String
* @author code gen
*/
@RequestMapping(value="/modifyFrameworkActionLogAction",method = RequestMethod.POST)
public ModelAndView modifyFrameworkActionLog(FrameworkActionLog model) {
frameworkActionLogService.update(model);
return ajaxDoneSuccess("成功");
}
/**
* 明细信息查找
*
* @return String
* @author code gen
*/
@RequestMapping("/showinfo/{pk_Id}")
public String findFrameworkActionLog(@PathVariable("pk_Id") int pk_Id,Model springModel) {
FrameworkActionLog frameworkActionLog = frameworkActionLogService.getFrameworkActionLogByPk(pk_Id);
springModel.addAttribute("infos",frameworkActionLog);
return "system/permission/FrameworkActionLog/FrameworkActionLogDetail";
}
/**
* 将对象属性信息赋值给表单对象
*
* @param FrameworkActionLog POJO对象
* @return FrameworkActionLogForm 表单信息POJO对象
* @author code gen
*/
// private void changeToFrameworkActionLogForm(FrameworkActionLog frameworkActionLog) {
//
//
// frameworkActionLog.setId(frameworkActionLog.getId());
//
// frameworkActionLog.setLogTime(frameworkActionLog.getLogTime());
//
// frameworkActionLog.setLogUser(frameworkActionLog.getLogUser());
//
// frameworkActionLog.setLogOperate(frameworkActionLog.getLogOperate());
//
// frameworkActionLog.setLogContent(frameworkActionLog.getLogContent());
//
// frameworkActionLog.setRemark(frameworkActionLog.getRemark());
//
// frameworkActionLog.setVersion(frameworkActionLog.getVersion());
//
// frameworkActionLog.setLogOperateClass(frameworkActionLog.getLogOperateClass());
//
// frameworkActionLog.setLogOperateMethod(frameworkActionLog.getLogOperateMethod());
//
// frameworkActionLog.setLogOperateResult(frameworkActionLog.getLogOperateResult());
//
// frameworkActionLog.setLogType(frameworkActionLog.getLogType());
//
// frameworkActionLog.setIsAuthed(frameworkActionLog.getIsAuthed());
//
// frameworkActionLog.setLogOperateActionName(frameworkActionLog.getLogOperateActionName());
//
// frameworkActionLog.setChangeTableInfo(frameworkActionLog.getChangeTableInfo());
//
// }
}
|
package BillApplication;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
public class BillCenter extends VBox{
private BillItemsList itemsList;
private Text billTotalHtTxt, billTotalTvaTxt, billTotalTtcTxt;
// constructor
public BillCenter() {
// Children nodes
//items list
itemsList = new BillItemsList();
//bill total ht
billTotalHtTxt = new Text("Total HT");
// bill total tva
billTotalTvaTxt = new Text("Taux TVA");
// bill Total ttc
billTotalTtcTxt = new Text("Net à payer TTC");
// Container
HBox totalContainer = new HBox(billTotalHtTxt, billTotalTvaTxt, billTotalTtcTxt);
//Style
totalContainer.setSpacing(10);
totalContainer.setAlignment(Pos.CENTER);
// Adding children to layout
getChildren().addAll(itemsList, totalContainer);
// Styling layout
setAlignment(Pos.TOP_CENTER);
setPadding(new Insets(20));
setSpacing(30);
}
}
|
package com.example.subramanyam.recipeapp.userinterface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.subramanyam.recipeapp.Adapters.RecipeShortDescription;
import com.example.subramanyam.recipeapp.R;
import com.example.subramanyam.recipeapp.data.IngredientItems;
import com.example.subramanyam.recipeapp.data.RecipeItem;
import com.example.subramanyam.recipeapp.widget.UpdateBakingService;
import java.util.ArrayList;
import java.util.List;
import static com.example.subramanyam.recipeapp.userinterface.RecipeDescriptionActivity.SELECTED_RECIPES;
public class RecipeIngrediantDetail extends Fragment {
ArrayList<RecipeItem> recipe;
String recipeName;
public RecipeIngrediantDetail() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
RecyclerView recyclerView;
TextView textView;
recipe = new ArrayList<>();
if(savedInstanceState != null) {
recipe = savedInstanceState.getParcelableArrayList(SELECTED_RECIPES);
}
else {
recipe =getArguments().getParcelableArrayList(SELECTED_RECIPES);
}
List<IngredientItems> ingredients = recipe.get(0).getIngredients();
recipeName=recipe.get(0).getName();
View view = inflater.inflate(R.layout.fragment_recipe_ingrediant_detail, container, false);
textView = view.findViewById(R.id.detailRecipe);
ArrayList<String> recipeIngredientsForWidgets= new ArrayList<>();
ingredients.forEach((a) ->
{
textView.append("\u2022 "+ a.getIngredient()+"\n");
textView.append("\t\t\t Quantity: "+a.getQuantity().toString()+"\n");
textView.append("\t\t\t Measure: "+a.getMeasure()+"\n\n");
recipeIngredientsForWidgets.add(a.getIngredient()+"\n"+
"Quantity: "+a.getQuantity().toString()+"\n"+
"Measure: "+a.getMeasure()+"\n");
});
recyclerView=view.findViewById(R.id.ingrediantsRecipe);
LinearLayoutManager mLayoutManager=new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(mLayoutManager);
RecipeShortDescription mRecipeDetailAdapter =new RecipeShortDescription((RecipeDescriptionActivity)getActivity());
recyclerView.setAdapter(mRecipeDetailAdapter);
mRecipeDetailAdapter.RecipeIngrediantsData(recipe,getContext());
//update widget
UpdateBakingService.startBakingService(getContext(),recipeIngredientsForWidgets);
return view;
}
// TODO: Rename method, update argument and hook method into UI event
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
@Override
public void onSaveInstanceState(Bundle currentState) {
super.onSaveInstanceState(currentState);
currentState.putParcelableArrayList(SELECTED_RECIPES, recipe);
currentState.putString("Title",recipeName);
}
}
|
package com.projekt.app.appprojekt;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class StandortSHA extends AppCompatActivity implements View.OnClickListener {
Button ZuruckSHA;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_standort_sh);
ZuruckSHA = (Button) findViewById(R.id.ZuruckSHA);
ZuruckSHA.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Intent Standortauswahl = new Intent(this, Standortauswahl.class);
startActivity(Standortauswahl);
this.finish();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.