text stringlengths 10 2.72M |
|---|
package com.zhao.leetcode;
//68 剑指offer
public class LowestParentNode2 {
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
}
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
TreeNode x= root;
while (true){
if (p.val<x.val&&q.val<x.val){
x=x.left;
}else if (p.val>x.val&&q.val>x.val){
x=x.right;
}else {
break;
}
}
return x;
}
}
|
package com.tencent.mm.pluginsdk.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.tencent.mm.R;
import com.tencent.mm.bp.a;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.ab;
import com.tencent.mm.ui.base.k;
public class ProfileMobilePhoneView extends ProfileItemView {
public TextView gsY;
private Context mContext;
public String qGi;
public String qGj;
public String[] qGk;
public LinearLayout qGr;
public boolean qGs;
static /* synthetic */ void a(ProfileMobilePhoneView profileMobilePhoneView, String str) {
k kVar = new k(profileMobilePhoneView.mContext);
kVar.hAv = new a(profileMobilePhoneView.mContext, bi.F(!profileMobilePhoneView.qGs ? new String[]{profileMobilePhoneView.mContext.getResources().getString(R.l.chatting_phone_use)} : new String[]{profileMobilePhoneView.mContext.getResources().getString(R.l.chatting_phone_use), profileMobilePhoneView.mContext.getResources().getString(R.l.chatting_phone_use_by_ipcall)}));
kVar.qRL = new 2(profileMobilePhoneView, kVar, str);
kVar.setCancelable(true);
kVar.show();
}
public ProfileMobilePhoneView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public ProfileMobilePhoneView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.qGs = false;
this.mContext = context;
}
public int getLayout() {
return R.i.profile_mobile_phone_layout;
}
public final void init() {
this.gsY = (TextView) findViewById(R.h.phone_list_title);
this.qGr = (LinearLayout) findViewById(R.h.phone_list);
for (int i = 0; i < 5; i++) {
this.qGr.getChildAt(i).setOnClickListener(new 1(this));
}
}
@Deprecated
public final boolean N(ab abVar) {
return false;
}
public final boolean bnH() {
if (this.gsY != null) {
LayoutParams layoutParams = this.gsY.getLayoutParams();
layoutParams.width = a.ad(getContext(), R.f.FixedTitleWidth);
this.gsY.setLayoutParams(layoutParams);
}
if (this.qGr != null) {
int i;
int i2;
View childAt;
int i3;
if (bi.oW(this.qGi) || !bi.Xd(this.qGi).booleanValue()) {
if (!(this.qGi == null || bi.Xd(this.qGi).booleanValue())) {
x.e("MicroMsg.ProfileMobilePhoneView", "mobile format is error----%s", new Object[]{this.qGi});
}
i = 0;
i2 = 0;
} else {
childAt = this.qGr.getChildAt(0);
if (childAt != null) {
childAt.setVisibility(0);
((TextView) childAt).setText(this.qGi);
}
i = 1;
i2 = 1;
}
if (!bi.oW(this.qGj)) {
this.qGk = this.qGj.split(",");
setVisibility(0);
while (true) {
i3 = i2;
if (i3 >= this.qGk.length + i) {
break;
}
childAt = this.qGr.getChildAt(i3);
if (childAt != null) {
childAt.setVisibility(0);
((TextView) childAt).setText(this.qGk[i3 - i]);
}
i2 = i3 + 1;
}
} else {
i3 = i2;
}
while (i3 < 5) {
this.qGr.getChildAt(i3).setVisibility(8);
i3++;
}
if (i != 1 && bi.oW(this.qGj)) {
setVisibility(8);
}
}
return false;
}
}
|
/*******************************************************************************
* Copyright 2012
* Ubiquitous Knowledge Processing (UKP) Lab
* Technische Universität Darmstadt
*
* 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.dkpro.similarity.algorithms.lsr.uima.aggregate;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import org.apache.uima.fit.descriptor.ConfigurationParameter;
import org.apache.uima.fit.descriptor.ExternalResource;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.ResourceSpecifier;
import org.dkpro.similarity.algorithms.api.TextSimilarityMeasure;
import org.dkpro.similarity.algorithms.lsr.aggregate.MCS06AggregateComparator;
import org.dkpro.similarity.uima.resource.TextSimilarityResourceBase;
public class MCS06AggregateResource
extends TextSimilarityResourceBase
{
public static final String PARAM_TERM_SIMILARITY_RESOURCE = "TermSimilarityMeasure";
@ExternalResource(key=PARAM_TERM_SIMILARITY_RESOURCE)
private TextSimilarityMeasure termSimilarityMeasure;
public static final String PARAM_IDF_VALUES_FILE = "IdfValuesFile";
@ConfigurationParameter(name=PARAM_IDF_VALUES_FILE, mandatory=true)
private File idfValuesFile;
@Override
public boolean initialize(ResourceSpecifier aSpecifier,
Map<String, Object> aAdditionalParams)
throws ResourceInitializationException
{
if (!super.initialize(aSpecifier, aAdditionalParams)) {
return false;
}
this.mode = TextSimilarityResourceMode.list;
return true;
}
@Override
public void afterResourcesInitialized()
throws ResourceInitializationException
{
super.afterResourcesInitialized();
try {
measure = new MCS06AggregateComparator(termSimilarityMeasure, idfValuesFile);
}
catch (IOException e) {
System.err.println("Term similarity measure could not be initialized!");
e.printStackTrace();
}
}
}
|
package woc.assignment.one;
import java.util.Scanner;
public class Prime20 {
public static void main(String[] args) {
print20Prime(20);
}
private static void print20Prime(int num1 ) {
if(num1 > 0 ){
System.out.println("2");
}
boolean flag = true;
int opNum = 3;
int counter = 1;
while (counter < num1) {
for (int i = 2; i <= Math.sqrt(opNum); i++) {
if (opNum % i == 0) {
flag = false;
break;
}
}
if(flag == false){
flag = true;
}else{
counter++;
System.out.println(opNum);
}
opNum++;
}
}
}
|
package com.atgem.googleplay;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.model.LatLng;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.widget.Toast;
public class BaiduMapActivity extends Activity {
MapView mMapView = null;
private BaiduMap mBaiduMap;
//定位相关
private LocationClient mLocationClient;
private MyLocationListener mLocationListener;
private boolean isFirstIn= true;
Context context;
private double mLatitude;
private double mLongtitude;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//在使用SDK各组件之前初始化context信息,传入ApplicationContext
//注意该方法要再setContentView方法之前实现
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_baidu_map);
//获取地图控件引用
// mMapView = (MapView) findViewById(R.id.bmapView);
this.context=this;
initView();
initLocation();
}
private void initView()
{
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f);
mBaiduMap.setMapStatus(msu);
}
private void initLocation(){
mLocationClient=new LocationClient(this);
mLocationListener=new MyLocationListener();
mLocationClient.registerLocationListener(mLocationListener);
LocationClientOption option=new LocationClientOption();
option.setCoorType("bd09ll");
option.setIsNeedAddress(true);
option.setOpenGps(true);
option.setScanSpan(1000);
mLocationClient.setLocOption(option);
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
mBaiduMap.setMyLocationEnabled(true);
if(!mLocationClient.isStarted())
mLocationClient.start();
}
@Override
protected void onDestroy() {
super.onDestroy();
//在activity执行onDestroy时执行mMapView.onDestroy(),实现地图生命周期管理
mMapView.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
//在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理
mMapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
//在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理
mMapView.onPause();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
//停止定位
mBaiduMap.setMyLocationEnabled(false);
mLocationClient.stop();
}
class MyLocationListener implements BDLocationListener{
@Override
public void onReceiveLocation(BDLocation location) {
// TODO Auto-generated method stub
MyLocationData data=new MyLocationData.Builder()//
.accuracy(location.getRadius())//
.latitude(location.getLatitude() )//
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(data);
if(isFirstIn){
LatLng latLng=new LatLng(location.getLatitude(),location.getLatitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
mBaiduMap.animateMapStatus(msu);
isFirstIn=false;
Toast.makeText(context, location.getAddrStr(),Toast.LENGTH_LONG).show();
}
}
}
}
|
package files.executors;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.*;
import java.util.stream.IntStream;
import static java.util.stream.Collectors.toList;
public class MultiFileContentWriters {
// yes I'm lazy with exception handling
public static void main(String[] args) throws InterruptedException, IOException {
final int NUM_CPU = Runtime.getRuntime().availableProcessors();
final int NUM_LINES = new Random().nextInt(2000) + 0;
final int EVEN_WORK_COUNT = NUM_LINES / NUM_CPU;
final CountDownLatch gate = new CountDownLatch(EVEN_WORK_COUNT > 0 ? NUM_CPU : 0);
final ConcurrentMap<Integer, List<String>> map = new ConcurrentSkipListMap<>();
final ExecutorService executorService = Executors.newFixedThreadPool(NUM_CPU);
for (int i = 0; i < NUM_CPU && EVEN_WORK_COUNT > 0; i++) {
final int finalI = i * EVEN_WORK_COUNT;
executorService.execute(() -> {
map.put(finalI, IntStream.range(finalI, finalI + EVEN_WORK_COUNT)
.mapToObj(num -> {
try {
// some heavy computation to get contents to write to file...
Thread.sleep(10);
} catch (InterruptedException consumer) {
}
return num + "";
})
.collect(toList()));
gate.countDown();
});
}
final List<String> leftOver = new ArrayList<>();
for (int i = NUM_LINES - EVEN_WORK_COUNT * NUM_CPU; i > 0; i--) {
leftOver.add(NUM_LINES - i + "");
}
map.put(Integer.MAX_VALUE, leftOver);
gate.await();
executorService.shutdown();
Files.write(Paths.get("result.txt"),
map.entrySet().stream().map(entry -> entry.getValue()).collect(toList()).stream().flatMap(list -> list.stream()).collect(toList()),
Charset.defaultCharset());
final List<String> lines = Files.lines(Paths.get("result.txt")).collect(toList());
if (lines.size() != NUM_LINES) {
System.out.println(lines.size() + " " + NUM_LINES);
throw new AssertionError("result.txt is incorrect1");
}
for (int i = 1; i < lines.size(); i++) {
if (Integer.valueOf(lines.get(i)) <= Integer.valueOf(lines.get(i - 1))) {
throw new AssertionError("result.txt is incorrect2");
}
}
Files.delete(Paths.get("result.txt"));
}
}
|
/*
* 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.clerezza;
import java.io.Serializable;
/**
* Represents an RDF URI Reference
* <p>
* RDF URI References are defined in section 6.4 RDF URI References of
* http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-Graph-URIref
* <p>
* Note that an RDF URI Reference is not the same as defined by RFC3986,
* RDF URI References support most unicode characters
*
* @author reto
*/
public class IRI implements BlankNodeOrIRI, Serializable {
private String unicodeString;
public IRI(String unicodeString) {
this.unicodeString = unicodeString;
}
/**
* @return the unicode string that produces the URI
*/
public String getUnicodeString() {
return unicodeString;
}
/**
* Returns true iff <code>obj</code> == <code>UriRef</code>
*
* @param obj
* @return true if obj is an instanceof UriRef with
* the same unicode-string, false otherwise
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof IRI)) {
return false;
}
return unicodeString.equals(((IRI) obj).getUnicodeString());
}
/**
* @return 5 + the hashcode of the string
*/
@Override
public int hashCode() {
int hash = 5 + unicodeString.hashCode();
return hash;
}
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append('<');
buffer.append(unicodeString);
buffer.append('>');
return buffer.toString();
}
} |
package orgvictoryaxon.photofeed.lib.di;
import javax.inject.Singleton;
import dagger.Component;
import orgvictoryaxon.photofeed.PhotoFeedAppModule;
/**
* Created by VictorYaxon.
*/
@Singleton
@Component(modules = {LibsModule.class, PhotoFeedAppModule.class})
public interface LibsComponent {
}
|
package gardenapplication;
import javax.xml.namespace.QName;
public class Tree extends Plant{
//The Tree
//needs water if its current water amount is less then 10
//when watering it the tree can only absorb the 40% of the water
//eg. watering with 10 the tree's amount of water should only increase with 4
public Tree (String color, String type){
super.color = color;
super.type = type;
waterLevel = 0;
}
public double statusTree(double water){
maxWaterLevel = 10;
waterLevel = water * 0.4;
if (waterLevel < maxWaterLevel){
System.out.println("The "+color+" "+ type + " needs water.");
}else
System.out.println("The "+color+" "+ type + " doesnt need water.");
return water;
}
}
|
package com.example.lixiaolin.userfuldemo.compatibility;
import android.os.Build;
/**
* Created by lixiaolin on 15/11/14.
* util for backward compatibility
*
*/
public class CompatibilityUtil {
//forbid to new
private CompatibilityUtil() {
}
/**
* get the current sdk version
* @return
*/
public static int getSDKVersion() {
return Build.VERSION.SDK_INT;
}
/**
*
* @return whether is version 20 or later
*/
public static boolean isLollipop() {
return getSDKVersion()>=Build.VERSION_CODES.LOLLIPOP;
}
}
|
package br.com.allerp.allbanks.view;
import org.apache.wicket.RestartResponseAtInterceptPageException;
import org.apache.wicket.markup.html.WebPage;
import br.com.allerp.allbanks.AllbanksSession;
public class SecuredBasePage extends WebPage {
private static final long serialVersionUID = 9071207182185957571L;
private String title;
public SecuredBasePage() {
super();
verifyAccess();
}
protected void verifyAccess() {
// Redirect to Login page on invalid access.
if (!isLogedIn()) {
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
}
protected boolean isLogedIn() {
return getSessao().isLogedIn();
}
public AllbanksSession getSessao() {
return ((AllbanksSession) super.getSession());
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
|
package android.com.provider.models;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ExpandableListDataPump {
public static HashMap<String, List<String>> getData() {
HashMap<String, List<String>> expandableListDetail = new HashMap<String, List<String>>();
List<String> cricket = new ArrayList<String>();
cricket.add("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");
// cricket.add("India");
List<String> name = new ArrayList<String>();
name.add("Mohammad Shah bin Ashfaq");
List<String> football = new ArrayList<String>();
football.add("\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"");
List<String> basketball = new ArrayList<String>();
basketball.add("Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32");
expandableListDetail.put("Some dummy text here", cricket);
expandableListDetail.put("What is your name", name);
expandableListDetail.put("Which organization are you working on", football);
expandableListDetail.put("What is your proffession", basketball);
return expandableListDetail;
}
}
|
package com.tencent.mm.ui.widget.sortlist;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.Checkable;
import android.widget.ListAdapter;
class DragSortListView$a extends BaseAdapter {
ListAdapter Do;
final /* synthetic */ DragSortListView uOr;
/* synthetic */ DragSortListView$a(DragSortListView dragSortListView, ListAdapter listAdapter, byte b) {
this(dragSortListView, listAdapter);
}
private DragSortListView$a(final DragSortListView dragSortListView, ListAdapter listAdapter) {
this.uOr = dragSortListView;
this.Do = listAdapter;
this.Do.registerDataSetObserver(new DataSetObserver() {
public final void onChanged() {
DragSortListView$a.this.notifyDataSetChanged();
}
public final void onInvalidated() {
DragSortListView$a.this.notifyDataSetInvalidated();
}
});
}
public final long getItemId(int i) {
return this.Do.getItemId(i);
}
public final Object getItem(int i) {
return this.Do.getItem(i);
}
public final int getCount() {
return this.Do.getCount();
}
public final boolean areAllItemsEnabled() {
return this.Do.areAllItemsEnabled();
}
public final boolean isEnabled(int i) {
return this.Do.isEnabled(i);
}
public final int getItemViewType(int i) {
return this.Do.getItemViewType(i);
}
public final int getViewTypeCount() {
return this.Do.getViewTypeCount();
}
public final boolean hasStableIds() {
return this.Do.hasStableIds();
}
public final boolean isEmpty() {
return this.Do.isEmpty();
}
public final View getView(int i, View view, ViewGroup viewGroup) {
View view2;
if (view == null || !(view instanceof b)) {
b cVar;
view2 = this.Do.getView(i, null, this.uOr);
if (view2 instanceof Checkable) {
cVar = new c(this.uOr.getContext());
} else {
cVar = new b(this.uOr.getContext());
}
cVar.setLayoutParams(new LayoutParams(-1, -2));
cVar.addView(view2);
view = cVar;
} else {
view = (b) view;
View childAt = view.getChildAt(0);
view2 = this.Do.getView(i, childAt, this.uOr);
if (view2 != childAt) {
if (childAt != null) {
view.removeViewAt(0);
}
view.addView(view2);
}
}
DragSortListView.a(this.uOr, this.uOr.getHeaderViewsCount() + i, view);
return view;
}
}
|
package jna.extra;
import com.sun.jna.Native;
import com.sun.jna.platform.win32.GDI32;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HDC;
import com.sun.jna.platform.win32.WinGDI;
import com.sun.jna.win32.W32APIOptions;
public interface WinGDIExtra extends WinGDI {
public DWORD SRCCOPY = new DWORD(0x00CC0020);
} |
package com.example.amitrai.qrscanner;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.Toast;
import me.dm7.barcodescanner.zbar.Result;
import me.dm7.barcodescanner.zbar.ZBarScannerView;
/**
* Created by amit.rai on 9/4/2015.
*/
public class ScannerActivity extends ActionBarActivity implements ZBarScannerView.ResultHandler{
private ZBarScannerView mScannerView;
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
mScannerView = new ZBarScannerView(this);
setContentView(mScannerView);
}
@Override
public void onResume() {
super.onResume();
mScannerView.setResultHandler(this);
mScannerView.startCamera();
}
@Override
public void onPause() {
super.onPause();
mScannerView.stopCamera();
}
@Override
public void handleResult(Result rawResult) {
String data = rawResult.getContents();
if(data == null){
mScannerView.startCamera();
return;
}
// Toast.makeText(this, "Contents = " + rawResult.getContents() +
// ", Format = " + rawResult.getBarcodeFormat().getName(), Toast.LENGTH_SHORT).show();
if(data!= null && !data.isEmpty()){
Intent i = new Intent(ScannerActivity.this, WebActivity.class);
i.putExtra(WebActivity.DATA,data);
startActivity(i);
finish();
}
}
}
|
package com.takshine.wxcrm.service;
import com.takshine.wxcrm.base.services.EntityService;
import com.takshine.wxcrm.domain.Attachment;
import com.takshine.wxcrm.message.sugar.AttachmentResp;
/**
* 附件 业务处理接口
*
* @author liulin
*/
public interface Attachment2CrmService extends EntityService {
/**
* 查询 附件 数据列表
* @return
*/
public AttachmentResp getAttachmentList(Attachment sche, String source);
}
|
package com.example.testo.Notifications;
public class MyResponce {
public int sucess;
}
|
package com.example.chinide.petapplication;
/**
* Created by chinide on 11/29/16.
*/
public class Dog extends Pet {
public Dog(String name, int age, double weight) {
super(name, age, weight);
}
}
|
package com.anexa.livechat.service.impl.odoo;
import org.apache.xmlrpc.XmlRpcException;
public class SessionDeletedException extends RuntimeException {
public SessionDeletedException(XmlRpcException e) {
super(e);
}
private static final long serialVersionUID = 1L;
}
|
package note.controller;
import java.util.HashMap;
import java.util.List;
import note.model.Corigent;
import note.model.Elev;
import note.repository.*;
import note.utils.ClasaException;
import note.model.Medie;
import note.model.Nota;
import note.utils.Constants;
//import note.utils.ClasaException;
public class NoteController {
private NoteRepository noteRepo;
private ClasaRepository clasaRepo;
private EleviRepository eleviRepo;
public NoteController() {
noteRepo = new NoteRepositoryImplementation();
clasaRepo = new ClasaRepositoryImplementation();
eleviRepo = new EleviRepositoryImplementation();
}
public NoteController(NoteRepository noteRepo, ClasaRepository clasaRepo, EleviRepository eleviRepo) {
this.noteRepo = noteRepo;
this.clasaRepo = clasaRepo;
this.eleviRepo = eleviRepo;
}
public void addNota(Nota nota) throws ClasaException {
Elev e=eleviRepo.getElev(nota.getNrmatricol());
if(e==null)
throw new ClasaException(Constants.invalidNrmatricol);
noteRepo.addNota(nota);
clasaRepo.adaugaNota(e,nota);
}
public void addNotaToFile(Nota nota, String fisier){
noteRepo.writeNote(nota,fisier);
}
public void addElev(Elev elev) {
eleviRepo.addElev(elev);
}
public void creeazaClasa(List<Elev> elevi, List<Nota> note) {
clasaRepo.creazaClasa(elevi, note);
}
public List<Medie> calculeazaMedii() throws ClasaException {
return clasaRepo.calculeazaMedii();
}
public List<Nota> getNote() {
return noteRepo.getNote();
}
public List<Elev> getElevi() {
return eleviRepo.getElevi();
}
public HashMap<Elev, HashMap<String, List<Double>>> getClasa() {
return clasaRepo.getClasa();
}
public void afiseazaClasa() {
clasaRepo.afiseazaClasa();
}
public void readElevi(String fisier) {
eleviRepo.readElevi(fisier);
}
public void readNote(String fisier) {
noteRepo.readNote(fisier);
}
public List<Corigent> getCorigenti() {
return clasaRepo.getCorigenti();
}
}
|
package com.test.model;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
public class MemberAction implements Action {
@Override
public String process(HttpServletRequest request) {
String id = request.getParameter("id");
String pw = request.getParameter("pw");
String name = request.getParameter("name");
String email = request.getParameter("email");
String agree = request.getParameter("agree");
HttpSession session = request.getSession();
session.setAttribute("id", id);
session.setAttribute("pw", pw);
session.setAttribute("name", name);
session.setAttribute("email", email);
session.setAttribute("agree", agree);
return "join/joinResult.jsp";
}
}
|
package br.edu.ifam.saf.dao;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import br.edu.ifam.saf.modelo.Aluguel;
@Stateless
public class AluguelDAO {
@PersistenceContext
private EntityManager em;
private GenericDAO<Aluguel> dao;
@PostConstruct
private void init() {
dao = new GenericDAO<>(em, Aluguel.class);
}
public void inserir(Aluguel entidade) {
dao.inserir(entidade);
}
public Aluguel atualizar(Aluguel entidade) {
return dao.atualizar(entidade);
}
public List<Aluguel> listarTodos() {
return dao.listarTodos();
}
public Aluguel consultar(Integer id) {
return dao.consultar(id);
}
public void remover(Aluguel entidade) {
dao.remover(entidade);
}
}
|
package com.semantyca.nb.core.service;
import com.semantyca.nb.core.page.XMLPage;
import com.semantyca.nb.logger.Lg;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.servlet.ServletContext;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@Path("pages")
@RequestScoped
public class PagesResource {
@Context
ServletContext servletContext;
@Inject
PageProvider provider;
@GET
@Produces({MediaType.TEXT_HTML})
public Response getDefault() {
return getPage("index");
}
@GET
@Path("{id}")
@Produces(MediaType.TEXT_HTML)
public Response getPage(@PathParam("id") String id) {
StringWriter writer = new StringWriter();
try {
XMLPage xmlPage = provider.getPage(id);
if (xmlPage != null) {
Source source = new StreamSource(new StringReader(xmlPage.getXML()));
StreamSource xsltFile = new StreamSource();
xsltFile.setInputStream(xmlPage.getXsltPath(servletContext).openStream());
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xsltFile);
transformer.transform(source, new StreamResult(writer));
}else{
throw new WebApplicationException(Status.NOT_FOUND);
}
} catch (TransformerConfigurationException e) {
Lg.error(e);
return Response.status(Status.BAD_REQUEST).type("application/json").build();
} catch (TransformerException var10) {
return Response.status(Status.BAD_REQUEST).type("application/json").build();
} catch (IOException e) {
e.printStackTrace();
throw new WebApplicationException(e);
}
return Response.status(200).entity(writer.toString()).build();
}
@GET
@Path("xml/{id}")
@Produces(MediaType.APPLICATION_XML)
public Response getXML(@PathParam("id") String id) {
return Response.status(200).entity(provider.getPage(id).getXML()).build();
}
}
|
import java.io.*;
import java.util.*;
/**
* 127. Word Ladder
* 有点难,就没想到逐个字符进行BFS
*/
class Solution {
// BFS
public int ladderLength(String beginWord, String endWord, List<String> wordList) {
Set<String> words = new HashSet<>(wordList);
Queue<String> queue = new LinkedList<>();
queue.offer(beginWord);
int len = 1;
while (!queue.isEmpty()) {
int n = queue.size();
for (int i = 0; i < n; i++) {
StringBuilder cur = new StringBuilder(queue.poll());
for (int j = 0; j < cur.length(); j++) {
char old = cur.charAt(j);
for (char k = 'a'; k <= 'z'; k++) { // 检查当前词的当前字符修改为任意字符在wordList中是否存在
cur.setCharAt(j, k);
if (words.contains(cur.toString())) {
String t = cur.toString();
if (t.equals(endWord))
return len + 1;
words.remove(t);
queue.offer(t);
}
}
cur.setCharAt(j, old);
}
}
len++;
}
return 0;
}
public static void main(String[] args) throws IOException {
Solution s = new Solution();
File f = new File("input.txt");
Scanner scan = new Scanner(f);
while (scan.hasNext()) {
String beginWord = scan.next();
String endWord = scan.next();
String[] words = scan.next().split(",");
System.out.println(s.ladderLength(beginWord, endWord, Arrays.asList(words)));
}
scan.close();
}
} |
package com.abraham.dj.service;
public interface IDepartmentService extends IBaseService{
}
|
/* First created by JCasGen Sat Oct 06 20:30:32 EDT 2012 */
package edu.cmu.lti.bio.zeyuanl.types;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Updated by JCasGen Sat Oct 06 22:40:37 EDT 2012
* XML source: /Users/lzy/Code/hw1-zeyuanl/src/main/resources/descriptors/SourceDocInfoTypeSystem.xml
* @generated */
public class SourceDocInfo extends Annotation {
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int typeIndexID = JCasRegistry.register(SourceDocInfo.class);
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int type = typeIndexID;
/** @generated */
@Override
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected SourceDocInfo() {/* intentionally empty block */}
/** Internal - constructor used by generator
* @generated */
public SourceDocInfo(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated */
public SourceDocInfo(JCas jcas) {
super(jcas);
readObject();
}
/** @generated */
public SourceDocInfo(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/** <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
@generated modifiable */
private void readObject() {/*default - does nothing empty block */}
//*--------------*
//* Feature: uri
/** getter for uri - gets
* @generated */
public String getUri() {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_uri == null)
jcasType.jcas.throwFeatMissing("uri", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
return jcasType.ll_cas.ll_getStringValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_uri);}
/** setter for uri - sets
* @generated */
public void setUri(String v) {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_uri == null)
jcasType.jcas.throwFeatMissing("uri", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
jcasType.ll_cas.ll_setStringValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_uri, v);}
//*--------------*
//* Feature: offsetInSource
/** getter for offsetInSource - gets
* @generated */
public int getOffsetInSource() {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_offsetInSource == null)
jcasType.jcas.throwFeatMissing("offsetInSource", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
return jcasType.ll_cas.ll_getIntValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_offsetInSource);}
/** setter for offsetInSource - sets
* @generated */
public void setOffsetInSource(int v) {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_offsetInSource == null)
jcasType.jcas.throwFeatMissing("offsetInSource", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
jcasType.ll_cas.ll_setIntValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_offsetInSource, v);}
//*--------------*
//* Feature: documentSize
/** getter for documentSize - gets
* @generated */
public int getDocumentSize() {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_documentSize == null)
jcasType.jcas.throwFeatMissing("documentSize", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
return jcasType.ll_cas.ll_getIntValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_documentSize);}
/** setter for documentSize - sets
* @generated */
public void setDocumentSize(int v) {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_documentSize == null)
jcasType.jcas.throwFeatMissing("documentSize", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
jcasType.ll_cas.ll_setIntValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_documentSize, v);}
//*--------------*
//* Feature: lastSegment
/** getter for lastSegment - gets
* @generated */
public boolean getLastSegment() {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_lastSegment == null)
jcasType.jcas.throwFeatMissing("lastSegment", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
return jcasType.ll_cas.ll_getBooleanValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_lastSegment);}
/** setter for lastSegment - sets
* @generated */
public void setLastSegment(boolean v) {
if (SourceDocInfo_Type.featOkTst && ((SourceDocInfo_Type)jcasType).casFeat_lastSegment == null)
jcasType.jcas.throwFeatMissing("lastSegment", "edu.lti.cmu.hw1.typesys.SourceDocInfo");
jcasType.ll_cas.ll_setBooleanValue(addr, ((SourceDocInfo_Type)jcasType).casFeatCode_lastSegment, v);}
}
|
/*
* FileName: SimpleDownloadQueryController.java
* Description:
* Company: ����������Ϣ��������˾
* Copyright: ChaoChuang (c) 2006
* History: 2006-1-23 (guig) 1.0 Create
*/
package com.spower.basesystem.common.controller;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import com.spower.basesystem.common.Constants;
/**
* @author guig
* @version 1.0 2006-1-23
*/
public class SimpleDownloadQueryController extends SimpleFormQueryController {
private String filePrefix;
private String fileExtension;
public SimpleDownloadQueryController() {
super.setCacheSeconds(-1);
}
/** ��non Javadoc��
* @see com.spower.basesystem.common.controller.SimpleFormQueryController#onSubmit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException)
*/
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
ModelAndView result = super.onSubmit(request, response, command, errors);
String d = Constants.DATE_FORMAT.format(new Date());
String fileName = this.getFilePrefix() + d.substring(0, 4) + d.substring(5, 7) + d.substring(8, 10) + this.getFileExtension();
response.setHeader("Content-Disposition", String.valueOf(
new StringBuffer("attachment; filename=\"").append(new String(fileName.getBytes("UTF-8"), "ISO-8859-1")).append("\"")));
response.setContentType("application/octet-stream");
return result;
}
/**
* @return ���� filePrefix��
*/
public String getFilePrefix() {
return filePrefix;
}
/**
* @param filePrefix Ҫ���õ� filePrefix��
*/
public void setFilePrefix(String filePrefix) {
this.filePrefix = filePrefix;
}
/**
* @return ���� fileExtension��
*/
public String getFileExtension() {
return fileExtension;
}
/**
* @param fileExtension Ҫ���õ� fileExtension��
*/
public void setFileExtension(String fileExtension) {
this.fileExtension = fileExtension;
}
}
|
package com.tencent.mm.plugin.expt.b;
import com.tencent.mm.g.a.lw;
import com.tencent.mm.sdk.b.b;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.x;
class a$1 extends c<lw> {
final /* synthetic */ a iHY;
a$1(a aVar) {
this.iHY = aVar;
super(0);
this.sFo = lw.class.getName().hashCode();
}
public final /* synthetic */ boolean a(b bVar) {
a.a(this.iHY);
x.d("MicroMsg.ExptService", "got post sync event [%d]", new Object[]{Integer.valueOf(a.b(this.iHY))});
a.c(this.iHY);
return false;
}
}
|
package com.abraham.dj.model;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
import javax.persistence.Column;
//@Entity(name="Lanmu")
public class Lanmu {
@Id
@Column(name="id")
private int id;
@Column(name="name")
private String name;
@Column(name="parentLanmuId")
private int parentLanmuId;
@Column(name="nickName")
private String nickName;
@Column(name="order")
private int order;
@Column(name="img")
private String imgPath;
@Column(name="website")
private String website;
@Column(name="inNav")
private boolean inNav;
@Column(name="inPageMune")
private boolean inPageMune;
@Column(name="adminId")
private int adminId;
@Column(name="addTime")
private Date addTime;
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 int getParentLanmuId() {
return parentLanmuId;
}
public void setParentLanmuId(int parentLanmuId) {
this.parentLanmuId = parentLanmuId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public String getImgPath() {
return imgPath;
}
public void setImgPath(String imgPath) {
this.imgPath = imgPath;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
public boolean isInNav() {
return inNav;
}
public void setInNav(boolean inNav) {
this.inNav = inNav;
}
public boolean isInPageMune() {
return inPageMune;
}
public void setInPageMune(boolean inPageMune) {
this.inPageMune = inPageMune;
}
public int getAdminId() {
return adminId;
}
public void setAdminId(int adminId) {
this.adminId = adminId;
}
public Date getAddTime() {
return addTime;
}
public void setAddTime(Date addTime) {
this.addTime = addTime;
}
} |
package com.example.nikkolasedip.fortnite;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.ImageButton;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.doubleclick.PublisherAdRequest;
import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd;
public class MainMenu extends AppCompatActivity {
PublisherInterstitialAd mPublisherInterstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);
//Creating Buttons
Button btnBackblings = (Button) findViewById(R.id.btnBackblings);
Button btnGliders = (Button) findViewById(R.id.btnGliders);
Button btnLoadingScreens = (Button) findViewById(R.id.btnLoadingScreens);
Button btnPickaxes = (Button) findViewById(R.id.btnPickaxes);
Button btnSkins = (Button) findViewById(R.id.btnSkins);
Button donate = (Button) findViewById(R.id.donate);
//Creating OnclickListener in Ads
//Ads calling
mPublisherInterstitialAd = new PublisherInterstitialAd(this);
mPublisherInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
mPublisherInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
requestNewInterstitial();
}
});
requestNewInterstitial();
btnBackblings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPublisherInterstitialAd.isLoaded()) {
mPublisherInterstitialAd.show();
openAnotherActivity("Backblings");
} else {
openAnotherActivity("Backblings");
}
}
});
btnGliders.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPublisherInterstitialAd.isLoaded()) {
mPublisherInterstitialAd.show();
openAnotherActivity("Gliders");
} else {
openAnotherActivity("Gliders");
}
}
});
btnPickaxes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPublisherInterstitialAd.isLoaded()) {
mPublisherInterstitialAd.show();
openAnotherActivity("Pickaxes");
} else {
openAnotherActivity("Pickaxes");
}
}
});
btnLoadingScreens.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPublisherInterstitialAd.isLoaded()) {
mPublisherInterstitialAd.show();
openAnotherActivity("LoadingScreens");
} else {
openAnotherActivity("LoadingScreens");
}
}
});
btnSkins.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPublisherInterstitialAd.isLoaded()) {
mPublisherInterstitialAd.show();
openAnotherActivity("Skins");
} else {
openAnotherActivity("Skins");
}
}
});
donate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openAnotherActivity("PaypalDonate");
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_scrolling, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void openAnotherActivity(String activityName){
try {
Class<?> activityClass = Class.forName("com.example.nikkolasedip.fortnite."+activityName);
Intent intent = new Intent(this, activityClass);
startActivity(intent);
} catch (ClassNotFoundException e ) {
e.printStackTrace();
}
}
private void requestNewInterstitial() {
PublisherAdRequest adRequest = new PublisherAdRequest.Builder()
.addTestDevice("33BE2250B43518CCDA7DE426D04EE231")
.build();
mPublisherInterstitialAd.loadAd(adRequest);
}
}
|
package cn.sp.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import cn.sp.dao.AdminDAO;
import cn.sp.dao.StaffDAO;
import cn.sp.model.Admin;
import cn.sp.model.Staff;
import cn.sp.model.Work;
@WebServlet("/StaffServlet")
public class StaffServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String met = request.getParameter("met");
if("stalogin".equals(met)){
stalogin(request, response);
}else if("alterspwd".equals(met)){
alterspwd(request, response);
}else if("selsta".equals(met)){
selsta(request, response);
} else if("addWork".equals(met)) {
addWork(request,response);//增加报表
} else if("selWork".equals(met)) {
selWork(request,response);//工作报表列表
} else if("sta_selWork".equals(met)) {
sta_selWork(request,response);//查看某个报表
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
//员工登录
protected void stalogin(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
// 创建session对象,保存信息至session域,防止刷新页面时数据丢失
HttpSession session = request.getSession();
//创建out对象
PrintWriter out = response.getWriter();
//获取表单提交的数据
String name = request.getParameter("name");
String pwd = request.getParameter("pwd");
//将获取的数据传回staff
Staff s = new Staff();
s.setSname(name);
s.setSpwd(pwd);
//判断是否登录成功
StaffDAO sta = new StaffDAO();
boolean isok = sta.login(s);
if(isok){
Cookie cookie = new Cookie("LoginStat","success");
cookie.setMaxAge(10);
response.addCookie(cookie);
request.setAttribute("name", name);
session.setAttribute("name", name);//注:此行代码的作用:在Staff.jsp中取值:${sessionScope.name},这样防止点击“首页”后,再点击“个人信息”,数据就没了。但是目前这行代码没用上,因为实验了数次后,数据没有丢失了。
//跳转到员工界面
request.getRequestDispatcher("StaffIndex.jsp").forward(request, response);
}else{
//登录失败 返回当前界面
out.println("<Script>alert('登陆失败,请检查用户或密码');history.go(-1);</Script>");
}
}
//员工修改密码
protected void alterspwd(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();//创建out对象
String name = request.getParameter("name");
String pwd1 = request.getParameter("spwd1");
String pwd2 = request.getParameter("spwd2");
if(pwd1.equals(pwd2)&&pwd1!=""){
Staff s = new Staff();
s.setSpwd(pwd1);
StaffDAO sta = new StaffDAO();
boolean isok = sta.alterspwd(s,name);
if(isok){
out.println("<Script>alert('修改成功'); location.href='skip.html';</Script>");
}else{
//修改失败 返回当前界面
out.println("<Script>alert('修改失败');history.go(-1);</Script>");
}
} else if(pwd1.equals("")&&pwd2.equals("")){
out.println("<Script>alert('密码不能为空!');history.go(-1);</Script>");
} else {
out.println("<Script>alert('两次输入密码不一致');history.go(-1);</Script>");
}
}
//员工查询个人信息
protected void selsta(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name = request.getParameter("name");
Staff s = new Staff();
StaffDAO sta = new StaffDAO();
s = sta.selsta(name);
request.setAttribute("s", s);
request.getRequestDispatcher("Staff.jsp").forward(request, response);
}
//添加报表
protected void addWork(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
String buyName = request.getParameter("buyName");
if(buyName == "") {
buyName = "无";
}
// int buyPrice = Integer.parseInt(request.getParameter("buyPrice"));
String sellName = request.getParameter("sellName");
if(sellName == "") {
sellName = "无";
}
// int sellPrice = Integer.parseInt(request.getParameter("sellPrice"));
String sname = request.getParameter("sname");
System.out.println("name值为:"+sname);
Work w = new Work();
w.setEditor(sname);
w.setBuyName(buyName);
if(request.getParameter("buyPrice") == "") {
// w.setBuyPrice(0);
} else {
w.setBuyPrice(Integer.parseInt(request.getParameter("buyPrice")));
}
w.setSellName(sellName);
// w.setSellPrice(sellPrice);
if(request.getParameter("sellPrice") == "") {
// w.setSellPrice(0);
} else {
w.setSellPrice(Integer.parseInt(request.getParameter("sellPrice")));
}
StaffDAO sdao = new StaffDAO();
boolean isok = sdao.addWork(w);
if(isok) {
request.setAttribute("workFormStat", "success");//添加报表成功,返回给报表界面成功信息
selWork(request,response);
//request.getRequestDispatcher("work.jsp").forward(request, response);
} else {
out.println("<Script src='js/toast.js'></Script>");
out.println("<Script>Toast('发生未知错误,保存失败:addWork');</Script>");
}
}
//查询当前员工已创建的报表
protected void selWork(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List<Work> list = new ArrayList<>();
int currentPage = 1;
String page = request.getParameter("currentPage");
if(page != null){
currentPage = Integer.parseInt(page);
}
int datePage = new StaffDAO().datePage("work");
int totalPage = 0;
if(datePage % 5 == 0){
totalPage = datePage / 5;
}else{
totalPage = datePage / 5 + 1;
}
if(currentPage <= 0){
currentPage = 1;
}else if(currentPage >= totalPage){
currentPage = totalPage;
}
String sname = null;
if(request.getParameter("sname") == null){
System.out.println("1..sname为:"+request.getAttribute("name"));
} else {
sname = request.getParameter("sname");
}
//String sname = request.getParameter("sname");
System.out.println("得到的sname为:"+sname);//delete this sentence.
list = new StaffDAO().selWork(currentPage,sname);
request.setAttribute("wlist", list);
request.setAttribute("totalPage", totalPage);
request.setAttribute("currentPage", currentPage);
request.getRequestDispatcher("work.jsp").forward(request, response);
}
//查询某个指定的报表
protected void sta_selWork(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int id = Integer.parseInt(request.getParameter("id"));//按id查询添加的报表
Work w = new Work();
StaffDAO sdao = new StaffDAO();
w = sdao.sta_selWork(id);
request.setAttribute("w", w);
String who = request.getParameter("sname");/*为了不让数据丢失,再接收一下是谁查看,也即是谁添加的 这是为了下
面调用selWork()方法进行的存值操作,因为selWork()里不能得到当前员工的姓名*/
request.getSession().setAttribute("who", who);
request.setAttribute("type", "sta_selWork");//设置标志给work.jsp,判断动作为查看某个报表
selWork(request,response);
//request.getRequestDispatcher("work.jsp").forward(request, response);
}
}
|
package com.openkm.module.db;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import com.openkm.bean.Note;
import com.openkm.core.AccessDeniedException;
import com.openkm.core.Config;
import com.openkm.core.DatabaseException;
import com.openkm.core.LockException;
import com.openkm.core.PathNotFoundException;
import com.openkm.core.RepositoryException;
import com.openkm.dao.NodeBaseDAO;
import com.openkm.dao.NodeNoteDAO;
import com.openkm.dao.bean.NodeBase;
import com.openkm.dao.bean.NodeNote;
import com.openkm.module.NoteModule;
import com.openkm.module.db.base.BaseNoteModule;
import com.openkm.module.db.base.BaseNotificationModule;
import com.openkm.spring.PrincipalUtils;
import com.openkm.util.FormatUtil;
import com.openkm.util.PathUtils;
import com.openkm.util.UserActivity;
public class DbNoteModule implements NoteModule {
private static Logger log = LoggerFactory.getLogger(DbNoteModule.class);
@Override
public Note add(String token, String nodeId, String text) throws LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException {
log.debug("add({}, {}, {})", new Object[] { token, nodeId, text });
Note newNote = null;
Authentication auth = null, oldAuth = null;
String nodePath = null;
String nodeUuid = null;
if (Config.SYSTEM_READONLY) {
throw new AccessDeniedException("System is in read-only mode");
}
try {
if (token == null) {
auth = PrincipalUtils.getAuthentication();
} else {
oldAuth = PrincipalUtils.getAuthentication();
auth = PrincipalUtils.getAuthenticationByToken(token);
}
if (PathUtils.isPath(nodeId)) {
nodePath = nodeId;
nodeUuid = NodeBaseDAO.getInstance().getUuidFromPath(nodeId);
} else {
nodePath = NodeBaseDAO.getInstance().getPathFromUuid(nodeId);
nodeUuid = nodeId;
}
NodeBase node = NodeBaseDAO.getInstance().findByPk(nodeUuid);
text = FormatUtil.sanitizeInput(text);
NodeNote nNote = BaseNoteModule.create(nodeUuid, auth.getName(), text);
newNote = BaseNoteModule.getProperties(nNote, nNote.getUuid());
// Check subscriptions
BaseNotificationModule.checkSubscriptions(node, auth.getName(), "ADD_NOTE", text);
// Activity log
UserActivity.log(auth.getName(), "ADD_NOTE", nodeUuid, nodePath, text);
} catch (DatabaseException e) {
throw e;
} finally {
if (token != null) {
PrincipalUtils.setAuthentication(oldAuth);
}
}
log.debug("add: {}", newNote);
return newNote;
}
@Override
public void delete(String token, String noteId) throws LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException {
log.debug("delete({}, {})", token, noteId );
Authentication auth = null, oldAuth = null;
String notePath = null;
String noteUuid = null;
if (Config.SYSTEM_READONLY) {
throw new AccessDeniedException("System is in read-only mode");
}
try {
if (token == null) {
auth = PrincipalUtils.getAuthentication();
} else {
oldAuth = PrincipalUtils.getAuthentication();
auth = PrincipalUtils.getAuthenticationByToken(token);
}
NodeBase nBase = NodeNoteDAO.getInstance().getParentNode(noteId);
notePath = NodeBaseDAO.getInstance().getPathFromUuid(nBase.getUuid()) + "/" + noteId;
noteUuid = noteId;
NodeNote nNote = NodeNoteDAO.getInstance().findByPk(noteUuid);
if (auth.getName().equals(nNote.getAuthor()) || PrincipalUtils.hasRole(Config.DEFAULT_ADMIN_ROLE)) {
NodeNoteDAO.getInstance().delete(noteUuid);
} else {
throw new AccessDeniedException("Note can only be removed by its creator or " + Config.ADMIN_USER);
}
// Activity log
UserActivity.log(auth.getName(), "DELETE_NOTE", noteUuid, notePath, null);
} catch (DatabaseException e) {
throw e;
} finally {
if (token != null) {
PrincipalUtils.setAuthentication(oldAuth);
}
}
log.debug("delete: void");
}
@Override
public Note get(String token, String noteId) throws LockException, PathNotFoundException, AccessDeniedException,
RepositoryException, DatabaseException {
log.debug("get({}, {})", token, noteId);
Note note = null;
Authentication auth = null, oldAuth = null;
String notePath = null;
String noteUuid = null;
if (Config.SYSTEM_READONLY) {
throw new AccessDeniedException("System is in read-only mode");
}
try {
if (token == null) {
auth = PrincipalUtils.getAuthentication();
} else {
oldAuth = PrincipalUtils.getAuthentication();
auth = PrincipalUtils.getAuthenticationByToken(token);
}
NodeBase nBase = NodeNoteDAO.getInstance().getParentNode(noteId);
notePath = NodeBaseDAO.getInstance().getPathFromUuid(nBase.getUuid()) + "/" + noteId;
noteUuid = noteId;
NodeNote nNote = NodeNoteDAO.getInstance().findByPk(noteUuid);
note = BaseNoteModule.getProperties(nNote, nNote.getUuid());
// Activity log
UserActivity.log(auth.getName(), "GET_NOTE", noteUuid, notePath, null);
} catch (DatabaseException e) {
throw e;
} finally {
if (token != null) {
PrincipalUtils.setAuthentication(oldAuth);
}
}
log.debug("get: {}", note);
return note;
}
@Override
public String set(String token, String noteId, String text) throws LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException {
log.debug("set({}, {})", token, noteId );
Authentication auth = null, oldAuth = null;
String notePath = null;
String noteUuid = null;
if (Config.SYSTEM_READONLY) {
throw new AccessDeniedException("System is in read-only mode");
}
try {
if (token == null) {
auth = PrincipalUtils.getAuthentication();
} else {
oldAuth = PrincipalUtils.getAuthentication();
auth = PrincipalUtils.getAuthenticationByToken(token);
}
NodeBase nBase = NodeNoteDAO.getInstance().getParentNode(noteId);
notePath = NodeBaseDAO.getInstance().getPathFromUuid(nBase.getUuid()) + "/" + noteId;
noteUuid = noteId;
NodeNote nNote = NodeNoteDAO.getInstance().findByPk(noteUuid);
NodeBase node = NodeNoteDAO.getInstance().getParentNode(noteUuid);
if (auth.getName().equals(nNote.getAuthor())) {
text = FormatUtil.sanitizeInput(text);
nNote.setText(text);
NodeNoteDAO.getInstance().update(nNote);
} else {
throw new AccessDeniedException("Note can only be modified by its creator");
}
// Check subscriptions
BaseNotificationModule.checkSubscriptions(node, auth.getName(), "SET_NOTE", text);
// Activity log
UserActivity.log(auth.getName(), "SET_NOTE", node.getUuid(), notePath, text);
} catch (DatabaseException e) {
throw e;
} finally {
if (token != null) {
PrincipalUtils.setAuthentication(oldAuth);
}
}
log.debug("set: {}", text);
return text;
}
@Override
public List<Note> list(String token, String nodeId) throws AccessDeniedException, PathNotFoundException, RepositoryException,
DatabaseException {
log.debug("list({}, {})", token, nodeId);
List<Note> childs = new ArrayList<Note>();
Authentication auth = null, oldAuth = null;
String nodePath = null;
String nodeUuid = null;
try {
if (token == null) {
auth = PrincipalUtils.getAuthentication();
} else {
oldAuth = PrincipalUtils.getAuthentication();
auth = PrincipalUtils.getAuthenticationByToken(token);
}
if (PathUtils.isPath(nodeId)) {
nodePath = nodeId;
nodeUuid = NodeBaseDAO.getInstance().getUuidFromPath(nodeId);
} else {
nodePath = NodeBaseDAO.getInstance().getPathFromUuid(nodeId);
nodeUuid = nodeId;
}
for (NodeNote nNote : NodeNoteDAO.getInstance().findByParent(nodeUuid)) {
childs.add(BaseNoteModule.getProperties(nNote, nNote.getUuid()));
}
// Activity log
UserActivity.log(auth.getName(), "LIST_NOTES", nodeUuid, nodePath, null);
} catch (DatabaseException e) {
throw e;
} finally {
if (token != null) {
PrincipalUtils.setAuthentication(oldAuth);
}
}
log.debug("list: {}", childs);
return childs;
}
}
|
package FirstDay;
class Pattern4
{
public String match4(int n)
{
int ch=65;
String str="";
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
str+=(char)ch;
ch=ch+1;
str+="\n";
}
return str;
}
} |
/*
* 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 ejb.session.stateless;
import entity.AircraftConfiguration;
import entity.CabinClass;
import entity.Flight;
import entity.FlightRoute;
import entity.FlightSchedule;
import entity.FlightSchedulePlan;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import util.exception.AircraftConfigurationNotFoundException;
import util.exception.DeleteFlightException;
import util.exception.FlightExistException;
import util.exception.FlightNotFoundException;
import util.exception.FlightRouteDisabledException;
import util.exception.FlightRouteNotFoundException;
import util.exception.GeneralException;
/**
*
* @author Administrator
*/
@Stateless
public class FlightSessionBean implements FlightSessionBeanRemote, FlightSessionBeanLocal {
@EJB
private AircraftConfigurationSessionBeanLocal aircraftConfigurationSessionBeanLocal;
@EJB
private FlightRouteSessionBeanLocal flightRouteSessionBeanLocal;
@PersistenceContext(unitName = "FlightReservationSystem-ejbPU")
private EntityManager em;
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
@Override
public Long createNewFlight(Flight newFlight, String originAirportIATACode, String destinationAirportIATACode, String aircraftConfigurationName)
throws FlightExistException, GeneralException, FlightRouteNotFoundException, AircraftConfigurationNotFoundException, FlightRouteDisabledException {
try {
FlightRoute flightRoute = flightRouteSessionBeanLocal.retrieveFlightRouteByOdPair(originAirportIATACode, destinationAirportIATACode);
if(flightRoute.getDisabled() == true) {
throw new FlightRouteDisabledException("The flight route from " + originAirportIATACode + " to " + destinationAirportIATACode + " is disabled!");
} else {
AircraftConfiguration aircraftConfiguration = aircraftConfigurationSessionBeanLocal.retrieveAircraftConfigurationByName(aircraftConfigurationName);
em.persist(newFlight);
flightRoute.getFlights().add(newFlight);
newFlight.setFlightRoute(flightRoute);
newFlight.setAircraftConfiguration(aircraftConfiguration);
aircraftConfiguration.getFlights().add(newFlight);
em.flush();
return newFlight.getFlightId();
}
} catch (PersistenceException ex) {
if (ex.getCause() != null
&& ex.getCause().getCause() != null
&& ex.getCause().getCause().getClass().getSimpleName().equals("SQLIntegrityConstraintViolationException")) {
throw new FlightExistException("The flight already exists!");
} else {
throw new GeneralException("An unexpected error has occurred: " + ex.getMessage());
}
}
}
@Override
public void associateComplementaryFlight(Long flightId, Long complementaryFlightId) {
Flight flight = em.find(Flight.class, flightId);
Flight complementaryFlight = em.find(Flight.class, complementaryFlightId);
flight.setComplementaryReturnFlight(complementaryFlight);
complementaryFlight.setComplementaryReturnFlight(flight);
}
@Override
public List<Flight> retrieveAllFlights() {
Query query = em.createQuery("SELECT f FROM Flight f ORDER BY f.flightNumber ASC");
List<Flight> flights = query.getResultList();
for(Flight flight: flights) {
flight.getComplementaryReturnFlight();
}
return flights;
}
@Override
public Flight retrieveFlightById(Long flightId) throws FlightNotFoundException
{
Flight flight = em.find(Flight.class, flightId);
if(flight != null)
{
flight.getFlightSchedulePlans().size();
return flight;
}
else
{
throw new FlightNotFoundException("Flight ID " + flightId + " does not exist");
}
}
@Override
public Flight retrieveFlightByFlightNumber(String flightNumber) throws FlightNotFoundException {
Query query = em.createQuery("SELECT f FROM Flight f WHERE f.flightNumber = :inFlightNumber");
query.setParameter("inFlightNumber", flightNumber);
Flight flight = (Flight) query.getSingleResult();
if (flight != null) {
flight.getFlightRoute();
flight.getComplementaryReturnFlight();
for (CabinClass cabinClass: flight.getAircraftConfiguration().getCabinClasses()) {
cabinClass.getCabinClassType();
cabinClass.getCabinClassConfiguration().getCabinClassCapacity();
}
return flight;
} else {
throw new FlightNotFoundException("Flight number " + flightNumber + " is not found!");
}
}
@Override
public void deleteFlight(Flight flight) throws FlightNotFoundException, DeleteFlightException {
if (flight.getFlightSchedulePlans().isEmpty()) {
flight.getFlightRoute().getFlights().remove(flight);
flight.getAircraftConfiguration().getFlights().remove(flight);
if (flight.getComplementaryReturnFlight() != null) {
flight.getComplementaryReturnFlight().setComplementaryReturnFlight(null);
flight.setComplementaryReturnFlight(null);
}
if (!em.contains(flight)) {
flight = em.merge(flight);
}
em.remove(flight);
} else {
flight.setDisabled(true);
throw new DeleteFlightException("Flight no. " + flight.getFlightNumber() + " is in use and cannot be deleted! Instaed, it is set as diabled. ");
}
}
@Override
public List<FlightSchedule> retrieveFlightSchedulesByFlightNumber(String flightNumber) throws FlightNotFoundException {
Flight flight = retrieveFlightByFlightNumber(flightNumber);
List<FlightSchedule> list = new ArrayList<>();
List<FlightSchedulePlan> flightSchedulePlans = flight.getFlightSchedulePlans();
flightSchedulePlans.size();
for (FlightSchedulePlan flightSchedulePlan : flightSchedulePlans) {
if (flightSchedulePlan.getDisabled() == false) {
List<FlightSchedule> flightSchedules = flightSchedulePlan.getFlightSchedules();
flightSchedules.size();
for (FlightSchedule flightSchedule : flightSchedules) {
list.add(flightSchedule);
}
}
}
return list;
}
@Override
public void updateFlight(Flight flight, String newAircraftConfigurationName) throws AircraftConfigurationNotFoundException {
AircraftConfiguration newAircraftConfiguration = aircraftConfigurationSessionBeanLocal.retrieveAircraftConfigurationByName(newAircraftConfigurationName);
flight.getAircraftConfiguration().getFlights().remove(flight);
flight.setAircraftConfiguration(newAircraftConfiguration);
em.merge(flight);
Flight complementaryFlight = flight.getComplementaryReturnFlight();
complementaryFlight.getAircraftConfiguration().getFlights().remove(complementaryFlight);
complementaryFlight.setAircraftConfiguration(newAircraftConfiguration);
}
}
|
package com.herokuapp.apimotooto.service;
import com.herokuapp.apimotooto.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class UserDetailsServiceImpl implements UserDetailsService {
private final UserRepository userRepository;
@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
return userRepository.findUserByEmail(email)
.orElseThrow(() -> new UsernameNotFoundException(
"Username with email " + email + " does not exist"));
}
}
|
package edu.sjsu.fly5.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;
import edu.sjsu.fly5.pojos.FlightInstance;
import edu.sjsu.fly5.pojos.FlightSearchAttributes;
import edu.sjsu.fly5.services.FlightServiceProxy;
/**
* Servlet implementation class FlightSearchServlet
*/
public class FlightSearchServlet extends HttpServlet {
private static final String DATE_SEPARATOR = "-";
private static final long serialVersionUID = 1L;
private FlightServiceProxy flightProxy = new FlightServiceProxy();
/**
* @see HttpServlet#HttpServlet()
*/
public FlightSearchServlet() {
super();
// TODO Auto-generated constructor stub
}
public void init()
{
flightProxy.setEndpoint("http://localhost:8080/fly5/services/FlightService");
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String source = request.getParameter("source");
String destination = request.getParameter("destination");
String departureDate = request.getParameter("departureDate");
String[] departureDateArray = departureDate.split("/");
String month = departureDateArray[0];
String day = departureDateArray[1];
String year = departureDateArray[2];
String formattedDepartureDate = year + DATE_SEPARATOR + month + DATE_SEPARATOR + day;
//System.out.println(formattedDepartureDate);
String travelClass = request.getParameter("class");
int adults = Integer.parseInt(request.getParameter("adult"));
int children = Integer.parseInt(request.getParameter("child"));
int infants = Integer.parseInt(request.getParameter("infant"));
FlightSearchAttributes fsa = new FlightSearchAttributes();
fsa.setAdults(adults);
fsa.setChildren(children);
fsa.setInfants(infants);
fsa.setTravelClass(travelClass.toLowerCase());
fsa.setDepartureDate(formattedDepartureDate);
fsa.setSource(source);
fsa.setDestination(destination);
FlightInstance[] searchResults = flightProxy.searchFlight(fsa);
if (searchResults != null && searchResults.length > 0){
HttpSession session = request.getSession();
session.setAttribute("adults", fsa.getAdults());
session.setAttribute("children", fsa.getChildren());
session.setAttribute("infants", fsa.getInfants());
session.setAttribute("noOfPassenger", fsa.getAdults() + fsa.getChildren() + fsa.getInfants());
session.setAttribute("searchResults", searchResults);
}
request.setAttribute("search-results", searchResults);
request.getRequestDispatcher("search-results.jsp").forward(request, response);
}
}
|
package com.spark.action;
import java.util.Arrays;
import java.util.Map;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
public class CountByValueAction {
public static void main(String[] args) {
SparkConf conf = new SparkConf();
conf.setMaster("local");
conf.setAppName("MapAbout");
JavaSparkContext js = new JavaSparkContext(conf);
JavaRDD<String> lineRDD = js.parallelize(Arrays.asList("apple", "hadoop", "hadoop"));
/**
* value并不是代表k,v格式的v, 而是代表整体v,即并不一定作用在k,v格式的rdd上
* {hadoop=2, apple=1}
*/
Map<String, Long> countByValueMap = lineRDD.countByValue();
System.out.println(countByValueMap.toString());
js.close();
}
}
|
package com.example.assignment4_client;
import java.io.File;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.util.EntityUtils;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends ActionBarActivity implements OnClickListener {
private String srcPath = "/storage/emulated/0/Download/subj-1.pdf";
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.as);
b1=(Button)findViewById(R.id.button1);
b1.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(arg0==b1){
System.out.println("Clicked" );
try{
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
HttpPost httppost = new HttpPost("http://192.168.0.3:8080/Assignment4_2011080/upload");
File file = new File("/storage/emulated/0/Download/lecture.pdf");
MultipartEntity mpEntity = new MultipartEntity();
ContentBody cbFile = new FileBody(file, "multipart/form-data");
mpEntity.addPart("file", cbFile);
httppost.setEntity(mpEntity);
System.out.println("executing request " + httppost.getRequestLine());
HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();
System.out.println(response.getStatusLine());
if (resEntity != null) {
System.out.println(EntityUtils.toString(resEntity));
}
if (resEntity != null) {
resEntity.consumeContent();
}
httpclient.getConnectionManager().shutdown();
}
catch (Exception ex)
{
ex.printStackTrace() ;
}
}
}
}
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.subsystems;
import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants.ShooterConstants;
public class Shooter extends SubsystemBase {
private final TalonSRX shootMotor = new TalonSRX(ShooterConstants.talonPort);
/**
* Creates a new Shooter.
*/
public Shooter() {
shootMotor.configFactoryDefault();
shootMotor.setInverted(true);
shootMotor.setSensorPhase(false);
shootMotor.enableVoltageCompensation(true);
shootMotor.configVoltageCompSaturation(ShooterConstants.shooterVoltage);
shootMotor.configNominalOutputForward(0, ShooterConstants.kTimeoutMs);
shootMotor.configNominalOutputReverse(0, ShooterConstants.kTimeoutMs);
shootMotor.configPeakOutputForward(1, ShooterConstants.kTimeoutMs);
shootMotor.configPeakOutputReverse(-1, ShooterConstants.kTimeoutMs);
shootMotor.config_kF(ShooterConstants.kPIDLoopIdx, ShooterConstants.kF, ShooterConstants.kTimeoutMs);
shootMotor.config_kP(ShooterConstants.kPIDLoopIdx, ShooterConstants.kP, ShooterConstants.kTimeoutMs);
shootMotor.config_kI(ShooterConstants.kPIDLoopIdx, ShooterConstants.kI, ShooterConstants.kTimeoutMs);
shootMotor.config_kD(ShooterConstants.kPIDLoopIdx, ShooterConstants.kD, ShooterConstants.kTimeoutMs);
}
public void startMotor() {
shootMotor.set(ControlMode.Velocity, 25000);
}
public int getVelocity() {
return shootMotor.getSelectedSensorVelocity();
}
public void periodic() {
SmartDashboard.putNumber("Flywheel", getVelocity());
}
public boolean isShootable() {
return getVelocity() > 25000;
}
public void stop() {
shootMotor.set(ControlMode.PercentOutput, 0);
}
}
|
package ohtu;
import javax.swing.JTextField;
public class Summa implements Komento {
private Sovelluslogiikka sovelluslogiikka;
private JTextField syotekentta;
private JTextField tuloskentta;
private int edellinen;
public Summa(Sovelluslogiikka sovellus, JTextField tuloskentta, JTextField syotekentta) {
this.sovelluslogiikka = sovellus;
this.tuloskentta = tuloskentta;
this.syotekentta = syotekentta;
this.edellinen = 0;
}
@Override
public void suorita() {
int luku = Integer.parseInt(syotekentta.getText());
sovelluslogiikka.plus(luku);
edellinen = luku;
tuloskentta.setText("" + sovelluslogiikka.tulos());
}
@Override
public void peru() {
sovelluslogiikka.miinus(edellinen);
tuloskentta.setText("" + sovelluslogiikka.tulos());
}
}
|
package com.microsilver.mrcard.basicservice.model;
import lombok.Data;
@Data
public class FxSdUserDeliverinfo {
private Long id;
private String mobile;
private String pwd;
private String salt;
private String realname;
private String avatar;
private Short gender;
private String address;
private String alipayAccount;
private String identityCardNo;
private String identityCardFront;
private String identityCardBack;
private String identityCardGroup;
private Integer createTime;
private Short checkStatus;
private String remark;
private Integer province;
private Integer city;
private Integer county;
private String otherphoneno;
private String occupation;
private String identifier;
private Long referee;
private Long financeId;
private String imToken;
private String imAccout;
private Long agentId;
private Byte states;
private Double serviceScore;
private Double levelSocre;
private byte[] token;
} |
package com.douane.dpworld.entities;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name="SortiePhysique")
public class SortiePhysique {
@Id
private int id;
@Column(name="num_cts")
private String containerNumber;
@Column(name="num_bl")
private String blNumber;
@Column(name="numero_vi")
private String internationalVoyageNumber;
@Column(name="numero_escale")
private String escalNumber;
@Column(name="num_gors")
private String grossNumber;
@Column(name="numero_dp")
private String dpNumber;
@Temporal(TemporalType.TIMESTAMP)
@Column(name="date_dp")
private Date dpDate;
@Temporal(TemporalType.TIMESTAMP)
@Column(name="date_sortie")
private Date pulloutDate;
@Column(name="numero_camion")
private String truckLicencePlateNumber;
@Column(name="num_article")
private String articleNumber;
@Column(name="desc_mission")
private String missionTypeDesc;
@Column(name="type_cts")
private String containerType;
@Temporal(TemporalType.TIMESTAMP)
private Date Ajoute;
}
|
package com.utils;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class DateUtil {
//获取当天的开始时间
public static java.util.Date getDayBegin() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
//获取当天的结束时间
public static java.util.Date getDayEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}
public static Date getBeginDayOfYesterday() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
//获取昨天的结束时间
public static Date getEndDayOfYesterDay() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayEnd());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
//获取昨天的结束时间
public static Date getLastWeekStart() {
Calendar cal = new GregorianCalendar();
cal.add(Calendar.WEEK_OF_MONTH, -1);
cal.set(Calendar.DAY_OF_WEEK, 2);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
public static Date getLastWeekEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.DAY_OF_WEEK, 1);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.set(Calendar.MILLISECOND, 999);
return cal.getTime();
}
}
|
package com.coalesce.command.base;
import com.coalesce.plugin.CoPlugin;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
public abstract class AbstractCommandContext implements ICommandContext {
private CommandSender sender;
private List<String> args;
private CoPlugin plugin;
public AbstractCommandContext(CommandSender sender, String[] args, CoPlugin plugin) {
this.sender = sender;
this.plugin = plugin;
List<String> list = new ArrayList<>();
list.addAll(Arrays.asList(args));
this.args = list;
}
@Override
public CoPlugin getPlugin() {
return plugin;
}
@Override
public void pluginMessage(String message) {
send(plugin.getFormatter().format(message));
}
@Override
public boolean isPlayer() {
return sender instanceof Player;
}
@Override
public Player asPlayer() {
return (Player)sender;
}
@Override
public boolean isConsole() {
return sender instanceof ConsoleCommandSender;
}
@Override
public ConsoleCommandSender asConsole() {
return (ConsoleCommandSender)sender;
}
@Override
public CommandSender getSender() {
return sender;
}
@Override
public List<String> getArgs() {
return args;
}
@Override
public boolean hasArgs() {
return !args.isEmpty();
}
@Override
public String argAt(int index) {
if (index < 0 || index >= args.size()) {
return null;
}
return args.get(index);
}
@Override
public String joinArgs(int start, int finish) {
if (args.isEmpty()) {
return "";
}
return String.join(" ", args.subList(start, finish));
}
@Override
public String joinArgs(int start) {
return joinArgs(start, args.size());
}
@Override
public String joinArgs() {
return joinArgs(0);
}
@Override
public void send(String message) {
sender.sendMessage(message);
}
}
|
package com.pkjiao.friends.mm.activity;
import com.pkjiao.friends.mm.R;
import com.pkjiao.friends.mm.common.CommonDataStructure;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
public class EditUserInfoItemActivity extends Activity implements
OnClickListener {
private static final String TAG = "EditUserInfoItemActivity";
private static final String TITLE = "title";
private static final String DESCRIPTION = "description";
private static final String EDITINFO = "editinfo";
private RelativeLayout mReturnBtn;
private Button mFinishBtn;
private TextView mTitle;
private TextView mDescription;
private EditText mEditInfoItem;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.edit_contacts_info_item_layout);
mTitle = (TextView) findViewById(R.id.edit_info_item_title);
mDescription = (TextView) findViewById(R.id.edit_info_item_description);
mEditInfoItem = (EditText) findViewById(R.id.edit_info_item_input);
Intent data = getIntent();
mTitle.setText(data.getStringExtra(TITLE));
mDescription.setText(data.getStringExtra(DESCRIPTION));
String editinfo = data.getStringExtra(EDITINFO);
mEditInfoItem.setText(editinfo);
mEditInfoItem.setSelection(editinfo.length());
mReturnBtn = (RelativeLayout) findViewById(R.id.edit_info_item_return);
mFinishBtn = (Button) findViewById(R.id.edit_info_item_finish);
mReturnBtn.setOnClickListener(this);
mFinishBtn.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.edit_info_item_return: {
String title = mEditInfoItem.getText().toString();
if (title == null || title.length() == 0) {
Toast.makeText(this, "信息不能为空", Toast.LENGTH_SHORT).show();
break;
}
finishActivity(title);
break;
}
case R.id.edit_info_item_finish: {
String title = mEditInfoItem.getText().toString();
if (title == null || title.length() == 0) {
Toast.makeText(this, "信息不能为空", Toast.LENGTH_SHORT).show();
break;
}
finishActivity(title);
break;
}
default:
break;
}
}
private void finishActivity(String title) {
Intent data = new Intent();
data.putExtra(CommonDataStructure.UPDATE_USER_INFO, title);
setResult(RESULT_OK, data);
this.finish();
}
}
|
package pooproject.exception;
//Usuário já cadastrado
public class UJCException extends Exception{
public UJCException(){
super("Usuário já cadastrado");
}
//Mensagem de retorno para o usuário.
public String UJCeMensage(){
return("Usuário já cadastrado");
}
} |
package se.gareth.swm;
public class SwingBehavior extends Behavior {
private float mRotation;
private float mRotationSpeed;
private float mRotationLimit;
private boolean mDirectionLeft;
private boolean mLimitRotation;
public SwingBehavior(GameBase gameBase, float rotationLimit) {
super(gameBase);
mRotationLimit = rotationLimit;
mLimitRotation = true;
}
public void limitRotation(boolean doLimit) {
mLimitRotation = doLimit;
}
@Override
public void wasAdded(ActiveObject activeObject) {
mRotation = 0;
mRotationSpeed = 0;
mDirectionLeft = true;
}
@Override
public void update(ActiveObject activeObject, final TimeStep timeStep) {
if (activeObject.movementIsDisabled() == true) {
}
else {
if (mLimitRotation) {
mRotationSpeed = 7 * (mRotationLimit - Math.abs(mRotation)) + 20;
if (mDirectionLeft) {
mRotation += mRotationSpeed * timeStep.get();
if (mRotation > mRotationLimit) {
mDirectionLeft = false;
mRotation = mRotationLimit;
}
}
else {
mRotation -= mRotationSpeed * timeStep.get();
if (mRotation < -mRotationLimit) {
mDirectionLeft = true;
mRotation = -mRotationLimit;
}
}
}
else {
if (mDirectionLeft) {
mRotation += mRotationSpeed * timeStep.get();
}
else {
mRotation -= mRotationSpeed * timeStep.get();
}
}
activeObject.setRotation(mRotation);
}
}
}
|
package parse.response.other;
import api.longpoll.bots.model.events.VkEvent;
import api.longpoll.bots.model.events.EventObject;
import api.longpoll.bots.model.events.EventType;
import api.longpoll.bots.model.events.other.GroupChangeSettingsEvent;
import org.junit.jupiter.api.Test;
import parse.response.ParseUtil;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
public class GroupChangeSettingsParseTest {
@Test
void likeAdd() {
VkEvent event = ParseUtil.getFirstEvent("json/response/group_change_settings/group_change_settings_sample_5_110.json");
assertEquals(EventType.GROUP_CHANGE_SETTINGS, event.getType());
assertEquals(222, event.getGroupId());
assertEquals("aaa", event.getEventId());
EventObject eventObject = event.getObject();
assertNotNull(eventObject);
assertTrue(eventObject instanceof GroupChangeSettingsEvent);
GroupChangeSettingsEvent groupChangeSettingsUpdate = (GroupChangeSettingsEvent) eventObject;
assertEquals(111, groupChangeSettingsUpdate.getUserId());
Map<String, GroupChangeSettingsEvent.Change> changes = groupChangeSettingsUpdate.getChanges();
assertNotNull(changes);
assertFalse(changes.isEmpty());
assertTrue(changes.containsKey("description"));
GroupChangeSettingsEvent.Change change = changes.get("description");
assertNotNull(change);
assertEquals("test", change.getOldValue());
assertEquals("test1", change.getNewValue());
}
}
|
package com.spintech.testtask.repository;
import java.util.Set;
import org.springframework.data.repository.CrudRepository;
import com.spintech.testtask.entity.Show;
import com.spintech.testtask.entity.User;
public interface ShowRepository extends CrudRepository<Show, Long> {
Set<Show> findByUsersUnwatchedThisShow(User user);
}
|
package Sort;
public class quick {
//定义一个数组
static int[] nums = {6,1,2,7,9,3,4,5,10,8};
static int n = nums.length - 1;
/**
* 递归的数据结构就是栈
* left right代表该段数组的起点和终点
*/
public void quick(int left, int right) {
//已经不满足条件就可以不用递归了
if (left > right) {
return;
}
//定义俩指针 用于移动
int start = left;//起点下标
int end = right;//终点下标
int temp = nums[left];//把第一个数作为基准点
pri(left, right);//打印此时的结果,不用在意
while (start != end) { //如果左右指针还没有走到一起,代表还有位置没有遍历
while (start < end && nums[end] >= temp) { //右指针先走,找到小于基准数的停止
end--; //这是往左在移动指针
}
while (start < end && nums[start] <= temp) { //左指针后走,找到大于基准数的停止
start++; //这是往右在移动指针
}
if (start < end) { //不能少了这个if条件!!!如果左右指针在未相遇时都找到了目标,则交换位置
int i = nums[start];
nums[start] = nums[end];
nums[end] = i;
}
}
//此时的left和right走到了一起,一定是退出循环
//把基准数与该点交换位置
nums[left] = nums[start];
nums[start] = temp;
prin(start);//打印输出,不用在意
//以上代码的作用就是把小于基准数的移到左边,把大于基准数的移到右边
quick(left, start - 1); //继续处理左边的,这里是一个递归的过程
quick(start + 1, right); //继续处理右边的 ,这里是一个递归的过程
}
//另外一种方法 https://www.cnblogs.com/sunriseblogs/p/10009890.html
public int split(int[]nums,int low,int high){
int i=low;
int x=nums[low];//数组第一个元素为比较元素
//i 前面都是比x小的, i和j之间都是比x大的
for (int j = low+1; j <=high ; j++) {
if(nums[j]<=x){//j向前移动,找到了小于比较元素的,则与前面较大的元素(即i指向的元素)
i++;//注意这个i先要走一步
if(i!=j){
swap(nums,i,j);
}
}
}
swap(nums,low,i);
return i;
}
public void swap(int[]nums,int i,int j){
int temp=nums[j];
nums[j]=nums[i];
nums[i]=temp;
}
/**
* 主程序入口
*/
public static void main(String[] args) {
new quick().quick(0, n);
}
/**
* 以下代码忽略即可,用于打印输出
*/
private void pri(int start, int end) {
StringBuffer s = new StringBuffer();
s.append("对数组 [");
while (start <= end) {
s.append(nums[start] + " ");
start++;
}
s.append("]");
s.append(" 排序");
System.out.print(s);
}
private void prin(int j) {
StringBuffer s = new StringBuffer();
s.append(", 排序后 [");
int start = 0;
while (start <= n) {
if (start == j) {
s.append("(" + nums[start] + ") ");
} else {
s.append(nums[start] + " ");
}
start++;
}
s.append("]");
s.append(" ");
System.out.println(s);
}
}
|
package com.douane.entities;
import java.io.Serializable;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
/**
* The persistent class for the deficit database table.
*
*/
@Entity
@NamedQuery(name="Deficit.findAll", query="SELECT d FROM Deficit d")
public class Deficit implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id ;
@Column(name="an_manif")
private Timestamp anManif;
@Column(name="code_bur")
private short codeBur;
@Column(name="date_accostage")
private Timestamp dateAccostage;
@Column(name="nb_tcs")
private short nbTcs;
@Column(name="num_manif")
private int numManif;
@Column(name="numero_vi")
private String numeroVi;
private boolean flag ;
@Column(name = "date_markage")
@Temporal(TemporalType.DATE)
private Date dateMarkage ;
public Deficit() {
}
public Timestamp getAnManif() {
return this.anManif;
}
public void setAnManif(Timestamp anManif) {
this.anManif = anManif;
}
public short getCodeBur() {
return this.codeBur;
}
public void setCodeBur(short codeBur) {
this.codeBur = codeBur;
}
public Timestamp getDateAccostage() {
return this.dateAccostage;
}
public void setDateAccostage(Timestamp dateAccostage) {
this.dateAccostage = dateAccostage;
}
public short getNbTcs() {
return this.nbTcs;
}
public void setNbTcs(short nbTcs) {
this.nbTcs = nbTcs;
}
public int getNumManif() {
return this.numManif;
}
public void setNumManif(int numManif) {
this.numManif = numManif;
}
public String getNumeroVi() {
return this.numeroVi;
}
public void setNumeroVi(String numeroVi) {
this.numeroVi = numeroVi;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public Date getDateMarkage() {
return dateMarkage;
}
public void setDateMarkage(Date dateMarkage) {
this.dateMarkage = dateMarkage;
}
} |
package proj.dir;
import java.util.Scanner;
public class Brain {
private Scanner scanner = new Scanner(System.in);
public void startGame() {
Board board = new Board();
board.setCurrentPlayerMark('X');
board.initializingBoard();
System.out.println("----Tic Tac Toe----");
while (board.isBoardFull() == false) {
if (board.checkWin() == true) {
board.printBoard();
System.out.println("\n");
board.changeCurrentPlayer();
System.out.println("The great win of " + board.getCurrentPlayerMark());
return;
}
board.printBoard();
int x, y;
System.out.println("\n");
System.out.println("Please enter the coordinate you have chosen ");
x = scanner.nextByte();
y = scanner.nextByte();
if (x - 1 >= board.getWidth() || y-1>=board.getHeight()){
System.out.println("Sorry, you cant put it here ");
System.out.println("Try again");
continue;
}
if (board.getBoard()[x - 1][y - 1] == '0' || board.getBoard()[x - 1][y - 1] == 'X') {
System.out.println("Sorry,this place has already taken");
System.out.println("Try again.");
continue;
} else {
putMark(board,x,y);
}
}
System.out.println("Sorry,you cant play any more because the board is full");
}
private void putMark(Board board,int x,int y){
board.getBoard()[x-1][y-1] = board.getCurrentPlayerMark();
board.changeCurrentPlayer();
}
}
|
package com.mitelcel.pack.bean.api.request;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.mitelcel.pack.bean.GenericBean;
/**
* Created by sudhanshut on 11/3/15.
*/
public class BeanSubmitAppInfo extends BeanGenericApi {
public static final String NAME = "submit_app_info";
@Expose
private Params params;
public BeanSubmitAppInfo(Context context) {
this.id = System.currentTimeMillis();
this.method = NAME;
this.params = new Params(context);
}
@Override
public String toString() {
return new Gson().toJson(this);
}
public class Params extends GenericBean {
@SerializedName("app_info")
@Expose
private BeanAppInfo appInfo;
public Params(Context context) {
this.appInfo = new BeanAppInfo(context);
}
}
}
|
package com.ryit.entity;
import java.util.Date;
//费用单价
public class Cost extends AdstractEntity{
private Integer id;//费用编号
private Double ele_unit_price;//电费单价
private Double cold_unit_price;//冷水单价
private Double hot_unit_price;//热水单价
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Double getEle_unit_price() {
return ele_unit_price;
}
public void setEle_unit_price(Double ele_unit_price) {
this.ele_unit_price = ele_unit_price;
}
public Double getCold_unit_price() {
return cold_unit_price;
}
public void setCold_unit_price(Double cold_unit_price) {
this.cold_unit_price = cold_unit_price;
}
public Double getHot_unit_price() {
return hot_unit_price;
}
public void setHot_unit_price(Double hot_unit_price) {
this.hot_unit_price = hot_unit_price;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((cold_unit_price == null) ? 0 : cold_unit_price.hashCode());
result = prime * result + ((ele_unit_price == null) ? 0 : ele_unit_price.hashCode());
result = prime * result + ((hot_unit_price == null) ? 0 : hot_unit_price.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
Cost other = (Cost) obj;
if (cold_unit_price == null) {
if (other.cold_unit_price != null)
return false;
} else if (!cold_unit_price.equals(other.cold_unit_price))
return false;
if (ele_unit_price == null) {
if (other.ele_unit_price != null)
return false;
} else if (!ele_unit_price.equals(other.ele_unit_price))
return false;
if (hot_unit_price == null) {
if (other.hot_unit_price != null)
return false;
} else if (!hot_unit_price.equals(other.hot_unit_price))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
@Override
public String toString() {
return "Cost [id=" + id + ", ele_unit_price=" + ele_unit_price + ", cold_unit_price=" + cold_unit_price
+ ", hot_unit_price=" + hot_unit_price + "]";
}
public Cost(String created_user, Date created_datetime, String updated_user, Date updated_datetime, Integer id,
Double ele_unit_price, Double cold_unit_price, Double hot_unit_price) {
super(created_user, created_datetime, updated_user, updated_datetime);
this.id = id;
this.ele_unit_price = ele_unit_price;
this.cold_unit_price = cold_unit_price;
this.hot_unit_price = hot_unit_price;
}
public Cost() {
super();
// TODO Auto-generated constructor stub
}
public Cost(String created_user, Date created_datetime, String updated_user, Date updated_datetime) {
super(created_user, created_datetime, updated_user, updated_datetime);
// TODO Auto-generated constructor stub
}
public Cost(Double ele_unit_price, Double cold_unit_price, Double hot_unit_price) {
super();
this.ele_unit_price = ele_unit_price;
this.cold_unit_price = cold_unit_price;
this.hot_unit_price = hot_unit_price;
}
}
|
package com.hjtech.base.app;
import android.text.TextUtils;
import com.hjtech.base.utils.SharePreUtils;
public class AppData {
private String memberId = "";
private String requestCode = "";
private String phone = "";
private String avatar = "";
private volatile static AppData instance;
public static AppData getInstance() {
if (instance == null) {
synchronized (AppData.class) {
if (instance == null) {
instance = new AppData();
}
}
}
return instance;
}
private AppData() {
}
public String getAvatar() {
if (TextUtils.isEmpty(avatar)) {
avatar = SharePreUtils.getString(MyApp.getApplication(), "avatar", "");
}
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getPhone() {
if (phone.equals("")) {
phone = SharePreUtils.getString(MyApp.getApplication(), "phone", "");
}
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMemberId() {
if (TextUtils.isEmpty(memberId)) {
memberId = SharePreUtils.getString(MyApp.getApplication(), "memberId", "");
}
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getRequestCode() {
if (TextUtils.isEmpty(requestCode)) {
requestCode = SharePreUtils.getString(MyApp.getApplication(), "requestCode", "");
}
return requestCode;
}
public void setRequestCode(String requestCode) {
this.requestCode = requestCode;
}
}
|
package list;
public class LockDList extends DList{
@Override
protected DListNode newNode(Object item, DListNode prev, DListNode next) {
LockDListNode pNode = new LockDListNode(item, prev, next);
lockNode(pNode);
return pNode;
}
public LockDList(){
super();
}
public void lockNode(DListNode node){
((LockDListNode)node).status = true;
}
@Override
public void remove(DListNode node) {
if(((LockDListNode)node).status)
return;
else
super.remove(node);
}
} |
package leetcode;
/**
* @Author: Mr.M
* @Date: 2019-03-22 19:59
* @Description: https://leetcode-cn.com/problems/partition-equal-subset-sum/
**/
public class T416分割等和子集 {
// 递归解决,但是会超时
public boolean canPartition_rec(int[] nums) {
int sum = 0;
for (int x : nums) {
sum += x;
}
if ((sum & 1) == 1) {
return false;
}
return dfs(0, nums, 0, sum / 2);
}
private boolean dfs(int index, int[] nums, int cur, int target) {
if (index >= nums.length) {
return false;
}
if (cur == target) {
return true;
} else if (cur > target) {
return false;
} else {
return dfs(index + 1, nums, cur + nums[index], target) || dfs(index + 1, nums, cur, target);
}
}
//https://leetcode.com/problems/partition-equal-subset-sum/discuss/90592/01-knapsack-detailed-explanation
public boolean canPartition_dp(int[] nums) {
int sum = 0;
for (int x : nums) {
sum += x;
}
if ((sum & 1) == 1) {
return false;
}
int target = sum / 2;
boolean[][] dp = new boolean[nums.length + 1][target + 1];
dp[0][0] = true;
for (int i = 1; i < dp.length; i++) {
for (int j = 1; j < dp[0].length; j++) {
dp[i][j] = dp[i - 1][j];
if (j - nums[i - 1] >= 0) {
dp[i][j] = dp[i - 1][j] || dp[i - 1][j - nums[i - 1]]; // 在数组的这里已经要注意是否越界
}
}
}
return dp[dp.length - 1][dp[0].length - 1];
}
}
|
package Logica;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.joone.engine.*;
import org.joone.engine.learning.*;
import org.joone.io.*;
import org.joone.net.NeuralNet;
public class RNA implements NeuralNetListener {
private NeuralNet nnet;//Red Artificial
private int cantidadLineas;//cantidad de patrones del archivo
private String dirEntradas;//archivo que contiene las entradas
private int ciclos;//cantidad de iteraciones a realizar en el entrenamiento
private int tipo;//Tipo de red artificial 0-perceptron multicapa; 1-SOM
private double factorAprendizaje;//Factor de aprendizaje
private double momentum;//Factor de momentum
/***
*
* @param opc
*/
public RNA(int opc) {
tipo = opc;
LinearLayer entradas = new LinearLayer();
nnet = new NeuralNet();
cantidadLineas = -1;
ciclos = -1;
dirEntradas = null;
factorAprendizaje = -1;
momentum = -1;
switch (opc) {
case 0://en caso de ser un perceptron multicapa
SigmoidLayer capa1 = new SigmoidLayer();
SigmoidLayer capa2 = new SigmoidLayer();
SigmoidLayer capa3 = new SigmoidLayer();
SigmoidLayer capa4 = new SigmoidLayer();
entradas.setLayerName("Entradas");
capa1.setLayerName("Capa 1");
capa2.setLayerName("Capa 2");
capa3.setLayerName("Capa 3");
capa4.setLayerName("Capa 4");
entradas.setRows(9);
capa1.setRows(9);
capa2.setRows(6);
capa3.setRows(4);
capa4.setRows(3);
FullSynapse synapse_IH1 = new FullSynapse();
FullSynapse synapse_H1H2 = new FullSynapse();
FullSynapse synapse_H2H3 = new FullSynapse();
FullSynapse synapse_H3O = new FullSynapse();
synapse_IH1.setName("IH1");
synapse_H1H2.setName("H1H2");
synapse_H2H3.setName("H2H3");
synapse_H3O.setName("H3O");
entradas.addOutputSynapse(synapse_IH1);
capa1.addInputSynapse(synapse_IH1);
capa1.addOutputSynapse(synapse_H1H2);
capa2.addInputSynapse(synapse_H1H2);
capa2.addOutputSynapse(synapse_H2H3);
capa3.addInputSynapse(synapse_H2H3);
capa3.addOutputSynapse(synapse_H3O);
capa4.addInputSynapse(synapse_H3O);
nnet.addLayer(entradas, NeuralNet.INPUT_LAYER);
nnet.addLayer(capa1, NeuralNet.HIDDEN_LAYER);
nnet.addLayer(capa2, NeuralNet.HIDDEN_LAYER);
nnet.addLayer(capa3, NeuralNet.HIDDEN_LAYER);
nnet.addLayer(capa4, NeuralNet.OUTPUT_LAYER);
break;
case 1://en caso de ser una red SOM
GaussianLayer capaG = new GaussianLayer();
entradas.setLayerName("Entradas");
capaG.setLayerName("Capa 1");
entradas.setRows(9);
capaG.setInitialGaussianSize(5);
capaG.setLayerHeight(5);
capaG.setLayerWidth(5);
capaG.setOrderingPhase(ciclos);
capaG.setTimeConstant(200);
KohonenSynapse synapse_IG1 = new KohonenSynapse();
synapse_IG1.setName("IG1");
entradas.addOutputSynapse(synapse_IG1);
capaG.addInputSynapse(synapse_IG1);
nnet.addLayer(entradas, NeuralNet.INPUT_LAYER);
nnet.addLayer(capaG, NeuralNet.OUTPUT_LAYER);
break;
default://Cargar la Red desde un archivo
nnet = null;
try {
FileInputStream stream = new FileInputStream("bckup_red");
ObjectInput input = new ObjectInputStream(stream);
nnet = (NeuralNet) input.readObject();
if(nnet.getOutputLayer().getLayerName().compareTo("Capa 4")==0) {
tipo = 0;
stream = new FileInputStream("redMulticapa.ser");
input = new ObjectInputStream(stream);
nnet = (NeuralNet) input.readObject();
}else{
tipo = 1;
stream = new FileInputStream("redSOM.ser");
input = new ObjectInputStream(stream);
nnet = (NeuralNet) input.readObject();
}
setMomentum(nnet.getMonitor().getMomentum());
setFactorAprendizaje(nnet.getMonitor().getLearningRate());
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
public int getTipo() {
return tipo;
}
public double getFactorAprendizaje() {
return factorAprendizaje;
}
public double getMomentum() {
return momentum;
}
public void setFactorAprendizaje(double factorAprendizaje) {
this.factorAprendizaje = factorAprendizaje;
}
public void setMomentum(double momentum) {
this.momentum = momentum;
}
public void setCiclos(int ciclos) {
this.ciclos = ciclos;
}
public int getCiclos() {
return ciclos;
}
public void setDirEntradas(String dirEntradas) {
this.dirEntradas = dirEntradas;
}
public void setCantidadLineas(int cantidadLineas) {
this.cantidadLineas = cantidadLineas;
}
public int getCantidadLineas() {
return cantidadLineas;
}
public String getDirEntradas() {
return dirEntradas;
}
/***
*
* @param dirError
* @return
* @throws Exception
*/
public String training(String dirError) throws Exception {
if (cantidadLineas == -1) {
throw new Exception("Archivo Sin Cargar");
}
if (ciclos == -1) {
throw new Exception("Sin Configurar");
}
switch (tipo) {
case 0://Entrenamiento Para RED con perceptron multicapa
if (dirEntradas == null) {
throw new Exception("Sin Iniciar");
}
FileInputSynapse entradas = new FileInputSynapse();
entradas.setAdvancedColumnSelector("1-9");
entradas.setInputFile(new File(dirEntradas));
Layer input = nnet.getInputLayer();
input.addInputSynapse(entradas);
FileInputSynapse salidaDeseada = new FileInputSynapse();
salidaDeseada.setInputFile(new File(dirEntradas));
salidaDeseada.setAdvancedColumnSelector("10-12");
TeachingSynapse trainer = new TeachingSynapse();
trainer.setDesired(salidaDeseada);
FileOutputSynapse error = new FileOutputSynapse();
error.setFileName(dirError);
trainer.addResultSynapse(error);
Layer output = nnet.getOutputLayer();
output.addOutputSynapse(trainer);
nnet.setTeacher(trainer);
break;
case 1://Entrenamiento Para RED SOM
if (dirEntradas == null) {
throw new Exception("Sin Iniciar");
}
FileInputSynapse entradasSOM = new FileInputSynapse();
entradasSOM.setAdvancedColumnSelector("1-9");
entradasSOM.setInputFile(new File(dirEntradas));
Layer inputSOM = nnet.getInputLayer();
inputSOM.addInputSynapse(entradasSOM);
break;
}
Monitor monitor = nnet.getMonitor();
monitor.setLearningRate(factorAprendizaje);
monitor.setMomentum(momentum);
monitor.isSingleThreadMode();
monitor.removeAllListeners();
monitor.addNeuralNetListener(this);
monitor.setTrainingPatterns(cantidadLineas);
monitor.setTotCicles(ciclos);
monitor.setLearning(true);
nnet.go();
nnet.join();
if (tipo == 0) {//si la red es multicapa, retorna el error cuadratico medio
return monitor.getGlobalError() + "";
} else {//sino, retorna null
return null;
}
}
/***
*
* @param dirSalidas
* @throws Exception
*/
public void generate(String dirSalidas) throws Exception {
if (dirEntradas == null) {
throw new Exception("Sin Iniciar");
}
Layer input = nnet.getInputLayer();
input.removeAllInputs();
Layer output = nnet.getOutputLayer();
output.removeAllOutputs();
FileInputSynapse inputStream = new FileInputSynapse();
inputStream.setAdvancedColumnSelector("1-9");
inputStream.setInputFile(new File(dirEntradas));
input.addInputSynapse(inputStream);
FileOutputSynapse outputStream = new FileOutputSynapse();
outputStream.setFileName(dirSalidas);
output.addOutputSynapse(outputStream);
Monitor monitor = nnet.getMonitor();
monitor.isSingleThreadMode();
monitor.removeAllListeners();
monitor.addNeuralNetListener(this);
monitor.setTrainingPatterns(cantidadLineas);
monitor.setTotCicles(1);
monitor.setLearning(false);
nnet.go();
nnet.join();
}
/***
*
* @param e
*/
@Override
public void netStopped(NeuralNetEvent e) {
try {
FileOutputStream stream = new FileOutputStream("bckup_red");
FileOutputStream bckup = new FileOutputStream("bckup_red");
if(tipo==0)
stream = new FileOutputStream("redMulticapa.ser");
if(tipo==1)
stream = new FileOutputStream("redSOM.ser");
ObjectOutputStream out = new ObjectOutputStream(stream);
ObjectOutputStream sbck = new ObjectOutputStream(bckup);
out.writeObject(nnet);
sbck.writeObject(nnet);
sbck.close();
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
/***
*
* @param e
*/
@Override
public void cicleTerminated(NeuralNetEvent e) {
}
/***
*
* @param e
*/
@Override
public void netStarted(NeuralNetEvent e) {
}
/***
*
* @param e
*/
@Override
public void errorChanged(NeuralNetEvent e) {
}
/***
*
* @param e
* @param error
*/
@Override
public void netStoppedError(NeuralNetEvent e, String error) {
}
}
|
package com.kewenc.clipping;
import android.graphics.Outline;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv_rect = findViewById(R.id.tv_rect);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
view.setClipToOutline(true);
outline.setRoundRect(0,0,view.getWidth(),view.getHeight(),30);
}
}
};
tv_rect.setOutlineProvider(viewOutlineProvider);
}
}
}
|
package com.smclaughlin.tps.service;
import com.smclaughlin.tps.dao.IAccountDetailsDao;
import com.smclaughlin.tps.entities.AccountDetails;
import com.smclaughlin.tps.service.security.IPasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by sineadmclaughlin on 25/11/2016.
*/
@Service
public class AccountDetailsService implements IAccountDetailsService {
@Autowired
IAccountDetailsDao accountDetailsDao;
@Autowired
IPasswordService passwordService;
@Override
public AccountDetails getAccountDetailsByUUID(String uuid) {
return accountDetailsDao.getAccountDetailsByUUID(uuid);
}
@Override
public List<AccountDetails> returnListOfAccountDetails() {
return accountDetailsDao.getListOfAccountDetails();
}
@Override
public AccountDetails saveAccountDetails(AccountDetails accountDetails) {
securePasswordDetails(accountDetails);
return accountDetailsDao.saveAccountDetails(accountDetails);
}
@Override
public AccountDetails createNewAccountDetails(AccountDetails accountDetails) {
securePasswordDetails(accountDetails);
return accountDetailsDao.createNewAccountDetails(accountDetails);
}
private AccountDetails securePasswordDetails(AccountDetails ad){
String salt = passwordService.generatePasswordSalt();
String hash = passwordService.generateHash(salt, ad.getPasswordHash());
ad.setPasswordSalt(salt);
ad.setPasswordHash(hash);
return ad;
}
}
|
package com.example.copa_america.entidadesBD;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.RoomDatabase;
@Database(entities = {MatchBD.class}, version = 1)
public abstract class CopaAmericaDatabase extends RoomDatabase {
public abstract MatchDAO matchDAO();
}
|
/**
* Provides classes for representing application's domain.
*/
package pwr.chrzescijanek.filip.gifa.model; |
package com.app.config;
/**
* Custom exception for the application
*
*/
public class AppException extends Exception {
private static final long serialVersionUID = 1085850970625175580L;
private String errorCode;
private String errorMessage;
private Throwable error;
/**
* Constructor with code and message
*
* @param errorCode
* @param errorMessage
*/
public AppException(String errorCode, String errorMessage) {
super();
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}
/**
* Constructor with code, message and exception object
*
* @param errorCode
* @param errorMessage
* @param error
*/
public AppException(String errorCode, String errorMessage, Throwable error) {
super();
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.error = error;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public Throwable getError() {
return error;
}
public void setError(Throwable error) {
this.error = error;
}
} |
package leetcode;
import java.util.ArrayList;
import java.util.List;
// 给定一个 没有重复 数字的序列,返回其所有可能的全排列。
//
//示例:
//
//输入: [1,2,3]
//输出:
//[
// [1,2,3],
// [1,3,2],
// [2,1,3],
// [2,3,1],
// [3,1,2],
// [3,2,1]
//]
public class 全排列 {
public static void main(String[] args) {
int[] nums = {1,2,3};
List<List<Integer>> ls = permute(nums);
System.out.println(ls);
}
// 回溯算法,,,决策路径,选择列表,结果(符合条件的决策路径)
public static List<List<Integer>> permute(int[] nums) {
List<List<Integer>> ls = new ArrayList<List<Integer>>();
if(nums == null || nums.length == 0) return ls;
List<Integer> track = new ArrayList<>();
helper(nums,track,ls);
return ls;
}
private static void helper(int[] nums, List<Integer> track, List<List<Integer>> ls) {
if(track.size() == nums.length) {
ls.add(new ArrayList<>(track));
// ls.add(track);
}else {
for (int num : nums) {
// choose
if(track.contains(num))
continue;
track.add(num);
helper(nums,track,ls);
// unchoose
track.remove(track.size()-1);
}
}
}
}
|
package io.summer.dto;
// dto - data transfer object (model)
public class User {
String userName;
String fullName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
} |
package geekbrains.android_home_work_notes.ui.edit;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.Calendar;
import java.util.UUID;
import geekbrains.android_home_work_notes.R;
import geekbrains.android_home_work_notes.domain.Note;
import geekbrains.android_home_work_notes.domain.NotesRepository;
//public class AddNoteFragment extends Fragment {
public class AddNoteFragment extends BottomSheetDialogFragment {
public static final String KEY_NOTE_RESULT_ADD = "KEY_NOTE_RESULT_ADD";
public static final String ARG_NOTE_ADD = "ARG_NOTE_ADD";
private Calendar date = Calendar.getInstance();
public AddNoteFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_add_note, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
EditText addName = view.findViewById(R.id.add_note_name);
EditText addText = view.findViewById(R.id.add_note_text);
view.findViewById(R.id.add_btn_save).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Note note = new Note(UUID.randomUUID().toString(),addName.getText().toString(), DateUtils.formatDateTime(getContext(), date.getTimeInMillis(),
DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR), addText.getText().toString());
Bundle bundle = new Bundle();
bundle.putParcelable(ARG_NOTE_ADD, note);
getParentFragmentManager()
.setFragmentResult(KEY_NOTE_RESULT_ADD, bundle);
getParentFragmentManager().popBackStack();
dismiss();
}
});
}
}
|
package sort;
import java.util.Arrays;
public class BucketSort {
public static void bucketSort(int[] arr){
if(arr == null || arr.length < 2){
return;
}
int max = Integer.MIN_VALUE;
for (int i = 0; i < arr.length; i++) {
max = Math.max(max,arr[i]);
}
int[] bucket = new int[max+1];
for (int i = 0; i < arr.length; i++) {
bucket[arr[i]]++;
}
int j = 0;
for (int i = 0; i < bucket.length; i++) {
while(bucket[i]-->0){
arr[j++] = i;
}
}
}
public static void main(String[] args) {
int[] arr = new int[]{7,2,9,3,5,8,8,5,1,6,6,4};
bucketSort(arr);
System.out.println(Arrays.toString(arr));
}
}
|
/**
*
*/
package ch.ubx.startlist.client.ui;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.SuggestBox;
import com.google.gwt.user.client.ui.SuggestOracle;
public class SuggestBox2 extends SuggestBox {
public SuggestBox2(SuggestOracle oracle) {
super(oracle);
}
@Override
public void setEnabled(boolean enabled) {
getFocusWidget().setEnabled(enabled);
}
public FocusWidget getFocusWidget() {
return (FocusWidget) getWidget();
}
} |
package com.tencent.mm.plugin.sns.ui;
import com.tencent.mm.ui.base.MMPullDownView.g;
class bb$10 implements g {
final /* synthetic */ bb ogl;
bb$10(bb bbVar) {
this.ogl = bbVar;
}
public final boolean aCj() {
bb.c(this.ogl).bEe();
return true;
}
}
|
package enum_test;
/**
* Description:
*
* @author Baltan
* @date 2017/12/28 14:46
*/
enum Size implements Color {
EXTRA_SMALL("XS"), SMALL("S"), MEDIUM("M"), LARGE("L"), EXTRA_LARGE("XL");
private String size;
Size(String size) {
this.size = size;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
@Override
public void setColor() {
}
}
|
package A_0345636;
import java.util.Arrays;
/* 0345636_부권남
* 이진트리를 구성하고 삽입,삭제,검색을 구현합니다.
*
*
*/
public class Review_0213_A_1 {
private static Node root; // 최상위 부모
public static class Node{ // 노드 생성
int v;
Node l,r; // 왼쪽, 오른쪽
Node p; // delete를 위해 부모 노드 정보 추가
public Node(int v) {
super();
this.v = v;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("(").append(v).append(",")
.append(p == null ? "n" :p.v).append(",")
.append(l == null ? "n" :l.v).append(",")
.append(r == null ? "n" :r.v).append(")");
return sb.toString();
}
}
public static void addNode(int v) { // 노드를 트리에 추가합니다
Node newNode = new Node(v);
if(root ==null) { // 아직 만들어진 최상위 루트가 없으면 생성
root = newNode;
return;
}
Node current = root; // 처음부터 시작
while(true) { // 계속 탐색을 돌린다
if(current.v ==v) { // 만약 이진트리에서 같은 값이 나왔다? --> error
System.out.printf("error: same num %d is in ",v);
return;
}else if(current.v > v) { // 현재 노드보다 작은수라면 왼쪽으로 가므로 왼쪽 노드를 확인할 필요가 있다.
if(current.l ==null) { // 근데 왼쪽이 비어있다면? 그자리는 내꺼
newNode.p =current; // 추가할 노드에 부모노드 정보를 넣어준다.
current.l = newNode; // 그 노드를 자식노드로 넣어준다
return;
}else { // 안비었다면?
current =current.l; // 다음 탐색을 위해 현재 노드를 왼쪽로 옮겨준다
}
}else {
if(current.r ==null) { // 오른쪽도 같은 과정
newNode.p =current;
current.r =newNode;
return;
}else {
current = current.r;
}
}
}
}
public static Node search(int v) { // 트리 탐색
if(root == null) {
return new Node(-1); // 그냥 없는거라면 -1
}
Node current = root;
while(true) {
if(current.v == v) {
return current;
}else if(current.v > v) {
if(current.l == null) { // 없다면 -1
return new Node(-1);
}else {
current= current.l; // 있으면 해당 노드 return;
}
}else {
if(current.r == null) {
return new Node(-1);
}else {
current= current.r;
}
}
}
}
public static boolean deleteNode(int v) { // 해당 노드를 삭제 -- 자식이 없고, 있고(자식 수)에 따라 다르다.
Node tar = search(v); // 해당 노드 확인
if(tar.v == -1) {
System.out.print("Node is not exsist "); // 없으면 끝!
return false;
}
else if(tar.l == null && tar.r == null) { // 자식이 둘다 없으면
if(tar.p.l == tar) { // 부모에서 해당 노드를 찾아 지운다.
tar.p.l =null;
}
else{
tar.p.r =null;
}
}else if(tar.l == null || tar.r == null) { // 자식이 하나만 있다면
Node child = tar.l == null ? tar.r : tar.l; // 해당 자식과 부모를 이어주면 끝
if(tar.p.l == tar) {
tar.p.l = child;
child.p =tar.p;
}
else{
tar.p.r = child;
child.p =tar.p;
}
}else { // 자식이 둘 다 있다면
Node maxC = tar.l;
while(maxC.r != null) { // 왼쪽 자식중 가장 오른쪽 ( 현재값보다 작지만 제일 큰 값을 찾는다)
maxC= maxC.r;
}
int changev = maxC.v; // 해당 값을 삭제할 노드로 바꿔주고
deleteNode(maxC.v); // 바꿔준 노드를 없앤다.
tar.v = changev;
}
return true;
}
public static void preOrder(Node start) { // 전위 순회
if(start!=null) {
System.out.print(start.v + " ");
preOrder(start.l);
preOrder(start.r);
}
}
public static void inOrder(Node start) { // 중위 순회
if(start!=null) {
inOrder(start.l);
System.out.print(start.v + " ");
inOrder(start.r);
}
}
public static void postOrder(Node start) { // 후위 순회
if(start!=null) {
postOrder(start.l);
postOrder(start.r);
System.out.print(start.v + " ");
}
}
public static void main(String[] args) {
int[] nums = {9,4,3,6,12,15,13,17,12};
for (int i = 0; i < nums.length; i++) {
addNode(nums[i]);
System.out.printf("삽입 연산:%d %n", nums[i]); // 12가 두번 나온다 : error 확인 가능
}
System.out.println();
System.out.printf("%d노드: %s%n",9,search(9));
System.out.printf("%d노드: %s%n",4,search(4));
System.out.printf("%d노드: %s%n",3,search(3));
System.out.printf("%d노드: %s%n",6,search(6));
System.out.printf("%d노드: %s%n",12,search(12));
System.out.printf("%d노드: %s%n",15,search(15));
System.out.printf("%d노드: %s%n",13,search(13));
System.out.printf("%d노드: %s%n",17,search(17));
System.out.printf("%d노드: %s%n",8,search(8)); // search 안됨 -1
System.out.println();
System.out.print("전위: ");
preOrder(root);
System.out.println();
System.out.print("중위: ");
inOrder(root);
System.out.println();
System.out.print("후위: ");
postOrder(root);
System.out.println();
System.out.println();
System.out.printf("%d노드 삭제 %b%n",5, deleteNode(5)); // 어
System.out.printf("%d노드 삭제 %b%n",4, deleteNode(4)); // 자식이 두 개인 경우 삭제
System.out.printf("%d노드 삭제 %b%n",12, deleteNode(12)); // 자식이 한개인 경우 삭제
System.out.println();
System.out.printf("%d노드: %s%n",9,search(9));
System.out.printf("%d노드: %s%n",4,search(4));
System.out.printf("%d노드: %s%n",3,search(3)); // 4가 삭제되어 3이 대체 되었다
System.out.printf("%d노드: %s%n",6,search(6));
System.out.printf("%d노드: %s%n",12,search(12));
System.out.printf("%d노드: %s%n",15,search(15)); // 12의 자식인 15가 12의 부모와 이어진다
System.out.printf("%d노드: %s%n",13,search(13));
System.out.printf("%d노드: %s%n",17,search(17));
System.out.println();
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("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 Hybris.
*/
package com.cnk.travelogix.operations.order.converters.populator;
import de.hybris.platform.commercefacades.order.data.OrderData;
import de.hybris.platform.converters.Populator;
import de.hybris.platform.core.model.order.OrderModel;
import de.hybris.platform.servicelayer.dto.converter.ConversionException;
import org.apache.log4j.Logger;
import com.cnk.travelogix.operations.data.GroupCompanyData;
/**
* This class is for Converting GroupCompany details
*/
public class GroupCompanyPopulator implements Populator<OrderModel, OrderData>
{
@SuppressWarnings("unused")
private static final Logger LOG = Logger.getLogger(GroupCompanyPopulator.class);
@Override
public void populate(final OrderModel source, final OrderData target) throws ConversionException
{
if (null != source)
{
if (null != source.getCompany() && null != source.getCompany().getGroupCompany())
{
final GroupCompanyData groupCompanyData = new GroupCompanyData();
groupCompanyData.setUid(source.getCompany().getGroupCompany().getUid());
groupCompanyData.setName(source.getCompany().getGroupCompany().getName());
target.setGroupCompany(groupCompanyData);
}
}
}
}
|
package com.nadberezny.spelinteractive.parser;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
public class Parser {
SpelExpressionParser parser = new SpelExpressionParser();
public SpelExpression parseRaw(String str) {
// parser.parseExpression("");
return parser.parseRaw(str);
}
public Expression parse(String str) {
return parser.parseExpression(str);
}
}
|
package de.peterkossek.s10;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
public class FinishRoundDialog extends JDialog implements ActionListener {
private static final String OK = "OK";
private static final long serialVersionUID = 1L;
private final JPanel contentPanel = new JPanel();
private ArrayList<ResultPanel> resultPanels = new ArrayList<ResultPanel>();
private RoundResult roundResult = null;
/**
* Create the dialog.
*/
public FinishRoundDialog(Component parent, ArrayList<Player> players) {
setModal(true);
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new GridLayout(2, 3, 5, 5));
ButtonGroup buttonGroup = new ButtonGroup();
for (int i = 0; i < players.size(); i++) {
ResultPanel panel = new ResultPanel(players.get(i));
panel.setWinnerButtonGroup(buttonGroup);
contentPanel.add(panel);
resultPanels.add(panel);
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton(OK);
okButton.setActionCommand(OK);
okButton.addActionListener(this);
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(this);
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
setLocationRelativeTo(parent);
setTitle("Durchgang beendet");
pack();
}
public RoundResult getResult() {
this.setVisible(true);
return roundResult;
}
@Override
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command.equals(OK)) {
roundResult = new RoundResult();
for (ResultPanel panel : resultPanels) {
Player player = panel.getPlayer();
PlayerResult result = panel.getPlayerResult();
roundResult.addPlayerResult(player, result);
}
}
this.setVisible(false);
}
}
|
/**
* CommonFramework
*
* Copyright (C) 2017 Black Duck Software, Inc.
* http://www.blackducksoftware.com/
*
* 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 com.blackducksoftware.tools.commonframework.standard.datatable;
import java.util.Iterator;
import java.util.List;
public class RecordDef implements Iterable<FieldDef> {
private final List<FieldDef> fieldDefs;
public RecordDef(List<FieldDef> fields) {
fieldDefs = fields;
}
public FieldDef getFieldDef(int index) {
return fieldDefs.get(index);
}
public FieldDef getFieldDef(String fieldName) throws Exception {
for (FieldDef fieldDef : fieldDefs) {
if (fieldDef.getName().equals(fieldName)) {
return fieldDef;
}
}
int fieldIndex = fieldDefs.indexOf(fieldName);
if (fieldIndex < 0) {
throw new Exception("Field " + fieldName + " is not defined");
}
return fieldDefs.get(fieldIndex);
}
public int size() {
return fieldDefs.size();
}
@Override
public Iterator<FieldDef> iterator() {
return new RecordDefIterator(this);
}
}
|
package cn.ehanmy.hospital.mvp.presenter;
import android.app.Application;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.OnLifecycleEvent;
import android.support.v7.widget.RecyclerView;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.List;
import javax.inject.Inject;
import cn.ehanmy.hospital.mvp.contract.MemberListContract;
import cn.ehanmy.hospital.mvp.model.entity.UserBean;
import cn.ehanmy.hospital.mvp.model.entity.member_info.GetMemberListRequest;
import cn.ehanmy.hospital.mvp.model.entity.member_info.GetMemberListResponse;
import cn.ehanmy.hospital.mvp.model.entity.member_info.MemberMiniInfoBean;
import cn.ehanmy.hospital.util.CacheUtil;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import me.jessyan.rxerrorhandler.handler.RetryWithDelay;
@ActivityScope
public class MemberListPresenter extends BasePresenter<MemberListContract.Model, MemberListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
RecyclerView.Adapter mAdapter;
@Inject
List<MemberMiniInfoBean> orderBeanList;
private int nextPageIndex = 1;
@Inject
public MemberListPresenter(MemberListContract.Model model, MemberListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
public void requestOrderList(){
requestOrderList(1,true);
}
public void nextPage(){
requestOrderList(nextPageIndex,false);
}
private void requestOrderList(int pageIndex,final boolean clear) {
GetMemberListRequest request = new GetMemberListRequest();
request.setPageIndex(pageIndex);
request.setPageSize(10);
UserBean userBean = CacheUtil.getConstant(CacheUtil.CACHE_KEY_USER);
request.setToken(userBean.getToken());
mModel.getMemberList(request)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
if (clear) {
// mRootView.showLoading();//显示下拉刷新的进度条
}else
mRootView.startLoadMore();//显示上拉加载更多的进度条
})
.observeOn(AndroidSchedulers.mainThread())
.doFinally(() -> {
if (clear)
mRootView.hideLoading();//隐藏下拉刷新的进度条
else
mRootView.endLoadMore();//隐藏上拉加载更多的进度条
})
.retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.subscribe(new ErrorHandleSubscriber<GetMemberListResponse>(mErrorHandler) {
@Override
public void onNext(GetMemberListResponse response) {
if (response.isSuccess()) {
if(clear){
orderBeanList.clear();
}
nextPageIndex = response.getNextPageIndex();
mRootView.setEnd(nextPageIndex == -1);
mRootView.showError(response.getMemberList().size() > 0);
orderBeanList.addAll(response.getMemberList());
mAdapter.notifyDataSetChanged();
mRootView.hideLoading();
} else {
mRootView.showMessage(response.getRetDesc());
}
}
});
}
}
|
package com.tencent.mm.plugin.appbrand;
public final class s$g {
public static final int ANTI_CLOCKWISE = 2131755206;
public static final int ab_back_btn = 2131755327;
public static final int ab_back_container = 2131755326;
public static final int action0 = 2131759619;
public static final int action_bar = 2131755294;
public static final int action_bar_activity_content = 2131755008;
public static final int action_bar_container = 2131755293;
public static final int action_bar_root = 2131755289;
public static final int action_bar_single_title = 2131755335;
public static final int action_bar_spinner = 2131755009;
public static final int action_bar_subtitle = 2131755264;
public static final int action_bar_title = 2131755263;
public static final int action_context_bar = 2131755295;
public static final int action_divider = 2131759623;
public static final int action_menu_divider = 2131755010;
public static final int action_menu_presenter = 2131755011;
public static final int action_mode_bar = 2131755291;
public static final int action_mode_bar_stub = 2131755290;
public static final int action_mode_close_button = 2131755265;
public static final int action_option_icon = 2131755311;
public static final int action_option_text = 2131755310;
public static final int action_search_icon = 2131755309;
public static final int actionbar_capsule_area = 2131755438;
public static final int actionbar_capsule_divider = 2131755440;
public static final int actionbar_capsule_home_btn = 2131755441;
public static final int actionbar_capsule_option_btn = 2131755439;
public static final int actionbar_home_btn = 2131755437;
public static final int actionbar_loading_icon = 2131755436;
public static final int actionbar_nav_area = 2131755430;
public static final int actionbar_nav_btn = 2131755431;
public static final int actionbar_title_area = 2131755432;
public static final int actionbar_title_container = 2131755433;
public static final int actionbar_title_launcher_container = 2131755333;
public static final int actionbar_title_main = 2131755434;
public static final int actionbar_title_sub = 2131755435;
public static final int actionbar_up_indicator = 2131755322;
public static final int actionbar_up_indicator_btn = 2131755323;
public static final int activity_chooser_view_content = 2131755266;
public static final int add_my_qrcode = 2131759325;
public static final int address_contactlist = 2131755394;
public static final int adjust_content = 2131755604;
public static final int adjust_icon = 2131755603;
public static final int adjust_info_layout = 2131755602;
public static final int adjust_percent_indicator = 2131755605;
public static final int advice_layout = 2131755345;
public static final int advice_tv = 2131755346;
public static final int album_title = 2131759284;
public static final int alertTitle = 2131755277;
public static final int alert_content_ll = 2131755443;
public static final int always = 2131755212;
public static final int app1_iv = 2131757916;
public static final int app2_iv = 2131757917;
public static final int app3_iv = 2131757918;
public static final int app4_iv = 2131757919;
public static final int app_auth_desc = 2131755706;
public static final int app_auth_state = 2131755705;
public static final int app_brand_auth_auto_fill_data_content = 2131755453;
public static final int app_brand_auth_auto_fill_data_know_detail = 2131755455;
public static final int app_brand_auth_auto_fill_data_list = 2131755454;
public static final int app_brand_auth_auto_fill_data_list_item = 2131755442;
public static final int app_brand_debug_view = 2131755012;
public static final int app_brand_error_page_index = 2131755463;
public static final int app_brand_error_page_iv = 2131755428;
public static final int app_brand_error_page_reason = 2131755429;
public static final int app_brand_error_page_tips = 2131755462;
public static final int app_brand_game_input_panel = 2131755013;
public static final int app_brand_game_loading_ab_container = 2131755572;
public static final int app_brand_game_loading_antiaddiction = 2131755576;
public static final int app_brand_game_loading_avatar = 2131755575;
public static final int app_brand_game_loading_name = 2131755573;
public static final int app_brand_game_loading_view = 2131755574;
public static final int app_brand_game_wagame_name = 2131755577;
public static final int app_brand_get_phone_number_brand_name = 2131755474;
public static final int app_brand_get_phone_number_desc = 2131755476;
public static final int app_brand_get_phone_number_expose_url = 2131755472;
public static final int app_brand_get_phone_number_logo = 2131755473;
public static final int app_brand_get_phone_number_phone = 2131755477;
public static final int app_brand_get_phone_number_question = 2131755475;
public static final int app_brand_idcard_container = 2131755014;
public static final int app_brand_idcard_show_bottom_layout = 2131755478;
public static final int app_brand_idcard_show_busi_desc = 2131755486;
public static final int app_brand_idcard_show_checkbox = 2131755487;
public static final int app_brand_idcard_show_confirm = 2131755489;
public static final int app_brand_idcard_show_desc = 2131755483;
public static final int app_brand_idcard_show_icon = 2131755482;
public static final int app_brand_idcard_show_item_name = 2131755479;
public static final int app_brand_idcard_show_item_value = 2131755480;
public static final int app_brand_idcard_show_layout = 2131755481;
public static final int app_brand_idcard_show_line = 2131755484;
public static final int app_brand_idcard_show_list = 2131755485;
public static final int app_brand_idcard_show_url_1 = 2131755490;
public static final int app_brand_idcard_show_url_2 = 2131755492;
public static final int app_brand_idcard_show_url_line = 2131755491;
public static final int app_brand_idcard_verify_sms_desc = 2131755494;
public static final int app_brand_idcard_verify_sms_edit = 2131755497;
public static final int app_brand_idcard_verify_sms_input = 2131755498;
public static final int app_brand_idcard_verify_sms_layout = 2131755493;
public static final int app_brand_idcard_verify_sms_phone_number = 2131755495;
public static final int app_brand_idcard_verify_sms_switch_phone = 2131755496;
public static final int app_brand_keyboard_input_view_tag = 2131755015;
public static final int app_brand_keyboard_linear_layout = 2131755016;
public static final int app_brand_keyboard_number = 2131755017;
public static final int app_brand_keyboard_smiley = 2131755018;
public static final int app_brand_launcher_ui_page_container = 2131755019;
public static final int app_brand_loading_avatar = 2131755581;
public static final int app_brand_loading_dots = 2131758757;
public static final int app_brand_loading_fake_ab_container = 2131755579;
public static final int app_brand_loading_icon_layout = 2131755665;
public static final int app_brand_loading_icon_view = 2131755666;
public static final int app_brand_loading_name = 2131755582;
public static final int app_brand_loading_root = 2131755578;
public static final int app_brand_loading_top_area = 2131755580;
public static final int app_brand_loading_view = 2131755583;
public static final int app_brand_multi_options_picker_view_index_tag = 2131755021;
public static final int app_brand_page_content = 2131755022;
public static final int app_brand_page_input_container = 2131755023;
public static final int app_brand_pageview_html_webview = 2131755024;
public static final int app_brand_picker_panel = 2131755025;
public static final int app_brand_picker_panel_internal_picker = 2131755026;
public static final int app_brand_pulldown_background = 2131755538;
public static final int app_brand_pulldown_background_loading = 2131755540;
public static final int app_brand_pulldown_background_loading0 = 2131755541;
public static final int app_brand_pulldown_background_loading1 = 2131755542;
public static final int app_brand_pulldown_background_loading2 = 2131755543;
public static final int app_brand_pulldown_background_text = 2131755539;
public static final int app_brand_remote_debug_collapse_tv = 2131755564;
public static final int app_brand_remote_debug_connect_dot = 2131755553;
public static final int app_brand_remote_debug_connect_tv = 2131755554;
public static final int app_brand_remote_debug_detail_layout = 2131755556;
public static final int app_brand_remote_debug_error_tv = 2131755561;
public static final int app_brand_remote_debug_expand_tv = 2131755555;
public static final int app_brand_remote_debug_info_tv = 2131755560;
public static final int app_brand_remote_debug_op_layout = 2131755562;
public static final int app_brand_remote_debug_quit_tv = 2131755563;
public static final int app_brand_remote_debug_server_dot = 2131755558;
public static final int app_brand_remote_debug_server_layout = 2131755557;
public static final int app_brand_remote_debug_server_tv = 2131755559;
public static final int app_brand_repeat_send = 2131755594;
public static final int app_brand_show_protocal = 2131755488;
public static final int app_brand_ui_root = 2131755027;
public static final int app_brand_verify_code_view = 2131755593;
public static final int app_brand_verify_mobile = 2131755592;
public static final int app_icon_iv = 2131755446;
public static final int app_info_ll = 2131755704;
public static final int app_name_tv = 2131755447;
public static final int appbrand_action_header_hscrollview = 2131755650;
public static final int appbrand_action_header_multiple_layout = 2131755651;
public static final int appbrand_action_header_single_layout = 2131755648;
public static final int appbrand_action_header_status = 2131755656;
public static final int appbrand_action_multiple_header_image = 2131755657;
public static final int appbrand_action_multiple_header_text = 2131755658;
public static final int appbrand_action_multiple_header_view1 = 2131755652;
public static final int appbrand_action_multiple_header_view2 = 2131755653;
public static final int appbrand_action_multiple_header_view3 = 2131755654;
public static final int appbrand_action_multiple_header_view4 = 2131755655;
public static final int appbrand_action_single_header_image = 2131755659;
public static final int appbrand_action_single_header_text = 2131755660;
public static final int appbrand_action_single_header_view = 2131755649;
public static final int arrow_area = 2131755314;
public static final int arrow_area_btn = 2131755315;
public static final int art_emoji_icon_delete = 2131760606;
public static final int art_emoji_icon_iv = 2131755674;
public static final int art_emoji_icon_origin = 2131760607;
public static final int art_emoji_icon_text = 2131760609;
public static final int art_emoji_new_tv = 2131760610;
public static final int art_emoji_root = 2131760608;
public static final int artist_name = 2131759285;
public static final int asyn_re_use_view_key = 2131755028;
public static final int auth_content_list = 2131755449;
public static final int auth_scope_list_layout = 2131755448;
public static final int authcode_change_btn = 2131760354;
public static final int authcode_et = 2131760355;
public static final int authcode_iv = 2131760352;
public static final int auto_fill_container = 2131755499;
public static final int avatar_1_iv = 2131757878;
public static final int avatar_2_iv = 2131757881;
public static final int avatar_iv = 2131755465;
public static final int badge = 2131755589;
public static final int beginning = 2131755202;
public static final int bg_layout = 2131757871;
public static final int body_layout = 2131756364;
public static final int bottom = 2131755146;
public static final int bottomLeftTips = 2131761007;
public static final int bottomRightTips = 2131761008;
public static final int bottom_layout = 2131760141;
public static final int bottom_sheet_footer = 2131759268;
public static final int bottom_sheet_ll = 2131759264;
public static final int bottom_sheet_menu_reccycleview = 2131759267;
public static final int bottom_sheet_title = 2131759265;
public static final int btn_delete = 2131755584;
public static final int button = 2131755331;
public static final int buttonPanel = 2131755272;
public static final int button_ll = 2131757528;
public static final int calendar = 2131755165;
public static final int calendar_view = 2131757108;
public static final int camera_container = 2131755456;
public static final int camera_view = 2131760950;
public static final int cancel_action = 2131759620;
public static final int cancel_btn = 2131756811;
public static final int capsule_bar_root = 2131755457;
public static final int capsulebar_capsule_area = 2131755458;
public static final int capsulebar_capsule_divider = 2131755460;
public static final int capsulebar_capsule_home_btn = 2131755461;
public static final int capsulebar_capsule_option_btn = 2131755459;
public static final int center = 2131755147;
public static final int center_horizontal = 2131755148;
public static final int center_vertical = 2131755149;
public static final int chatroom_avatar_detail = 2131757193;
public static final int chatroom_member_avatar = 2131756432;
public static final int chatroom_member_name = 2131756433;
public static final int chatting_load_progress = 2131756648;
public static final int check = 2131759322;
public static final int checkbox = 2131755286;
public static final int checkbox_group = 2131757195;
public static final int checkbox_item = 2131757194;
public static final int checkbox_one = 2131755039;
public static final int checkbox_three = 2131755040;
public static final int checkbox_two = 2131755041;
public static final int chronometer = 2131759625;
public static final int clear_btn = 2131755325;
public static final int clear_log_btn = 2131756931;
public static final int clickRemove = 2131755179;
public static final int clip_horizontal = 2131755161;
public static final int clip_vertical = 2131755162;
public static final int close = 2131755500;
public static final int close_debugger_btn = 2131760444;
public static final int code_img_1 = 2131757244;
public static final int code_img_2 = 2131757246;
public static final int code_img_3 = 2131757248;
public static final int code_img_4 = 2131757250;
public static final int code_img_5 = 2131757252;
public static final int code_img_6 = 2131757254;
public static final int code_text_1 = 2131757243;
public static final int code_text_2 = 2131757245;
public static final int code_text_3 = 2131757247;
public static final int code_text_4 = 2131757249;
public static final int code_text_5 = 2131757251;
public static final int code_text_6 = 2131757253;
public static final int collapseActionView = 2131755213;
public static final int collect_draw_canvas_cost_time_btn = 2131759696;
public static final int collect_widget_fps_btn = 2131759698;
public static final int collect_widget_launch_cost_time_btn = 2131759697;
public static final int confirm_dialog_btn1 = 2131756889;
public static final int confirm_dialog_btn2 = 2131756888;
public static final int confirm_dialog_checkbox = 2131759259;
public static final int confirm_dialog_checkbox_ll = 2131756904;
public static final int confirm_dialog_container_ll = 2131756900;
public static final int confirm_dialog_content_desc_tv = 2131756899;
public static final int confirm_dialog_count_tv = 2131756908;
public static final int confirm_dialog_imageview = 2131756894;
public static final int confirm_dialog_maintitle_tv = 2131756901;
public static final int confirm_dialog_message_tv = 2131756898;
public static final int confirm_dialog_text_et = 2131756896;
public static final int confirm_dialog_thumb_iv = 2131756897;
public static final int confirm_dialog_title_tv = 2131756903;
public static final int console_btn = 2131757066;
public static final int console_dt = 2131756929;
public static final int console_panel = 2131757070;
public static final int console_widget = 2131761796;
public static final int contact_avatar_iv = 2131757861;
public static final int contact_biz_merge_layout = 2131757858;
public static final int contact_click_layout = 2131757860;
public static final int contact_desc_tv = 2131757863;
public static final int contact_error_tv = 2131757865;
public static final int contact_info_avatar_iv = 2131755645;
public static final int contact_info_helper_hing_tv = 2131755647;
public static final int contact_info_nickname_tv = 2131755646;
public static final int contact_info_status_tv = 2131756974;
public static final int contact_list_content_layout = 2131759289;
public static final int contact_title_tv = 2131757862;
public static final int container = 2131755403;
public static final int containerV = 2131755534;
public static final int content = 2131755369;
public static final int contentPanel = 2131755278;
public static final int content_area = 2131757535;
public static final int content_desc_text = 2131759256;
public static final int content_ll = 2131755943;
public static final int content_message = 2131755508;
public static final int content_root = 2131755547;
public static final int content_title = 2131755507;
public static final int content_tv = 2131756928;
public static final int content_vg = 2131757069;
public static final int conversation_item_line2_ll = 2131757927;
public static final int countTv = 2131755536;
public static final int count_text = 2131755503;
public static final int country_code = 2131755850;
public static final int cover = 2131755597;
public static final int cover_area = 2131755596;
public static final int cover_iv = 2131755946;
public static final int cover_play_btn = 2131755599;
public static final int cover_play_btn_area = 2131755598;
public static final int cover_total_time = 2131755600;
public static final int cropimage_filter_gallery = 2131757091;
public static final int cropimage_filter_operator = 2131757088;
public static final int cropimage_filter_select = 2131757086;
public static final int cropimage_filter_show_iv = 2131757087;
public static final int cropimage_frame = 2131757089;
public static final int cropimage_iv = 2131757090;
public static final int current_process_number = 2131757531;
public static final int custom = 2131755284;
public static final int customPanel = 2131755283;
public static final int custom_action_bar_content = 2131755313;
public static final int danmaku_btn = 2131755615;
public static final int danmaku_view = 2131755601;
public static final int dataLv = 2131755913;
public static final int data_rv = 2131755567;
public static final int date_picker = 2131757110;
public static final int day = 2131757106;
public static final int day_btn = 2131756814;
public static final int db_path = 2131761136;
public static final int decor_content_parent = 2131755292;
public static final int default_activity_button = 2131755268;
public static final int del_view = 2131755825;
public static final int desc = 2131756417;
public static final int desc_layout = 2131755341;
public static final int desc_op_tv = 2131756805;
public static final int desc_tv = 2131755342;
public static final int design_bottom_sheet = 2131757153;
public static final int design_menu_item_action_area = 2131757160;
public static final int design_menu_item_action_area_stub = 2131757159;
public static final int design_menu_item_text = 2131757158;
public static final int design_navigation_view = 2131757157;
public static final int detail_layout = 2131755343;
public static final int detail_tv = 2131755344;
public static final int deviderline = 2131759266;
public static final int diagnosis_level_tv = 2131755340;
public static final int disableHome = 2131755124;
public static final int divider = 2131755501;
public static final int divider_1 = 2131757909;
public static final int divider_2 = 2131757911;
public static final int diviler = 2131759356;
public static final int do_filter_btn = 2131756930;
public static final int dot_iv = 2131755312;
public static final int downtoup = 2131755237;
public static final int drawable_view_mode_btn = 2131760443;
public static final int drawable_view_mode_item = 2131760442;
public static final int edit_query = 2131755296;
public static final int edit_verify_code_layout = 2131757242;
public static final int edittext = 2131755329;
public static final int edittext_container = 2131759321;
public static final int education_tab_title_tv = 2131757906;
public static final int emoji_header_vp_id = 2131755043;
public static final int emoji_store_tab_container = 2131755044;
public static final int emoji_store_tab_shape = 2131755045;
public static final int empty_msg_tip_tv = 2131755923;
public static final int enable_release_debug_btn = 2131760439;
public static final int enable_release_debug_item = 2131760438;
public static final int end = 2131755150;
public static final int end_padder = 2131759629;
public static final int end_tip = 2131755545;
public static final int enterAlways = 2131755135;
public static final int enterAlwaysCollapsed = 2131755136;
public static final int err_msg_tv = 2131757547;
public static final int error_icon_iv = 2131756580;
public static final int exitUntilCollapsed = 2131755137;
public static final int expand_activities_button = 2131755267;
public static final int expanded_menu = 2131755285;
public static final int ext_info_layout = 2131755347;
public static final int ext_info_tv = 2131755348;
public static final int face_center_hint = 2131757558;
public static final int face_complain = 2131757521;
public static final int face_confirm_header_tips = 2131757517;
public static final int face_confirm_protocol_checkbox = 2131757518;
public static final int face_confirm_protocol_checkbox_text = 2131757519;
public static final int face_detect_cover = 2131757542;
public static final int face_detect_scan_line = 2131757549;
public static final int face_detect_view = 2131757543;
public static final int face_fixed_rect = 2131757546;
public static final int face_hold_area = 2131757544;
public static final int face_icon_iv = 2131757516;
public static final int face_normal_confirm_btn = 2131757523;
public static final int face_prefix_area = 2131757530;
public static final int face_print_sucesss_icon = 2131757526;
public static final int face_print_title = 2131757527;
public static final int face_progress_area = 2131757532;
public static final int face_progress_bar = 2131757533;
public static final int face_rect_bottom_left = 2131757552;
public static final int face_rect_bottom_right = 2131757553;
public static final int face_rect_left_bottom = 2131757555;
public static final int face_rect_left_top = 2131757554;
public static final int face_rect_right_bottom = 2131757557;
public static final int face_rect_right_top = 2131757556;
public static final int face_rect_top_left = 2131757550;
public static final int face_rect_top_right = 2131757551;
public static final int face_scan_rect_parent = 2131757548;
public static final int face_text_number = 2131757524;
public static final int face_tt_confirm_btn = 2131757567;
public static final int face_tt_hint_1 = 2131757563;
public static final int face_tt_hint_2 = 2131757566;
public static final int face_tt_how_to_title = 2131757561;
public static final int face_tt_step1_log = 2131757564;
public static final int face_tt_step_img_1 = 2131757562;
public static final int face_tt_step_img_2 = 2131757565;
public static final int face_tutorial_root = 2131757559;
public static final int feedback_tv = 2131757540;
public static final int file_selector_tab_container = 2131755066;
public static final int file_selector_tab_shape = 2131755067;
public static final int fill = 2131755163;
public static final int fill_horizontal = 2131755164;
public static final int fill_vertical = 2131755151;
public static final int filter_item = 2131757712;
public static final int filter_selecter_img = 2131757713;
public static final int filter_selecter_tv = 2131757714;
public static final int firstItemV = 2131755531;
public static final int fixed = 2131755232;
public static final int flingRemove = 2131755180;
public static final int footer_content = 2131759274;
public static final int footer_layout = 2131757903;
public static final int footer_progress_bar = 2131757904;
public static final int footer_tips = 2131759276;
public static final int footer_top_divider = 2131755546;
public static final int foucs_area = 2131755328;
public static final int frameLayout1 = 2131756906;
public static final int free_wifi_progress_dialog_bar = 2131755617;
public static final int fts_edittext = 2131757857;
public static final int fts_on_search_network_tv = 2131757902;
public static final int full_screen_btn = 2131755616;
public static final int game_edit_send = 2131755471;
public static final int game_edit_text = 2131755470;
public static final int gauss_blur_view = 2131760951;
public static final int gird_title_view = 2131757884;
public static final int gridpaper_display_view = 2131759281;
public static final int gridpaper_dot = 2131759283;
public static final int gridpaper_flipper = 2131759282;
public static final int gridpaper_gridview = 2131759273;
public static final int group = 2131759297;
public static final int has_contact_layout = 2131757859;
public static final int hd_avatar_iv = 2131761137;
public static final int hd_avatar_laoding_pb = 2131761139;
public static final int hd_avatar_mask_view = 2131761138;
public static final int header_1_tv = 2131757879;
public static final int header_2_tv = 2131757882;
public static final int header_area = 2131759280;
public static final int header_ll = 2131759405;
public static final int header_title = 2131759406;
public static final int header_tv = 2131756757;
public static final int helper_view = 2131760952;
public static final int hide_panel_btn = 2131760615;
public static final int hint_msg_tv = 2131757522;
public static final int hint_tv = 2131759720;
public static final int home = 2131755072;
public static final int homeAsUp = 2131755125;
public static final int hotword_tv = 2131757914;
public static final int icon = 2131755270;
public static final int iconIv = 2131755532;
public static final int icon_bg = 2131755672;
public static final int icon_iv = 2131757397;
public static final int icon_preference_imageview = 2131759305;
public static final int icontext = 2131755588;
public static final int ifRoom = 2131755214;
public static final int image = 2131755073;
public static final int image_gallery_download_success = 2131755074;
public static final int image_iv = 2131756271;
public static final int image_right_iv = 2131756420;
public static final int image_status_icon = 2131756893;
public static final int image_title_detail_icon = 2131756914;
public static final int imageview_1 = 2131757923;
public static final int imageview_2 = 2131757926;
public static final int indicator = 2131755591;
public static final int info = 2131759628;
public static final int info_tv = 2131757880;
public static final int info_txt = 2131761751;
public static final int info_wv = 2131761733;
public static final int inject_debug_btn = 2131761807;
public static final int inspect_guide_tv = 2131761804;
public static final int itemContainerV = 2131755530;
public static final int item_check = 2131759404;
public static final int item_desc = 2131759403;
public static final int item_desc_tv = 2131757877;
public static final int item_ll = 2131759402;
public static final int item_title = 2131757340;
public static final int item_touch_helper_previous_elevation = 2131755076;
public static final int iv = 2131760849;
public static final int iv_icon = 2131755571;
public static final int json_parser_btn = 2131760441;
public static final int json_parser_item = 2131760440;
public static final int jumper_left_btn = 2131757541;
public static final int jumper_root = 2131757534;
public static final int last_msg_tv = 2131757077;
public static final int layout = 2131757907;
public static final int left = 2131755152;
public static final int left_btn = 2131757545;
public static final int level_tv = 2131756927;
public static final int line1 = 2131759624;
public static final int line3 = 2131759627;
public static final int list = 2131755337;
public static final int listMode = 2131755121;
public static final int list_item = 2131755269;
public static final int list_view = 2131755566;
public static final int listen_model_notify_btn = 2131758772;
public static final int listen_model_notify_imageview = 2131758770;
public static final int listen_model_notify_text = 2131758771;
public static final int live_tips_tv = 2131755607;
public static final int loading_dot0 = 2131758758;
public static final int loading_dot1 = 2131758759;
public static final int loading_dot2 = 2131758760;
public static final int loading_pb = 2131756895;
public static final int loading_progress_bar = 2131760967;
public static final int loading_tips_area = 2131760966;
public static final int loading_view = 2131755544;
public static final int log_all_btn = 2131756933;
public static final int log_error_btn = 2131756937;
public static final int log_info_btn = 2131756935;
public static final int log_log_btn = 2131756934;
public static final int log_rv = 2131756938;
public static final int log_warn_btn = 2131756936;
public static final int login_accept = 2131755452;
public static final int login_bottom_buttons = 2131755450;
public static final int login_reject = 2131755451;
public static final int login_title = 2131755444;
public static final int main_sight_view_close = 2131755334;
public static final int mainframe_banner_icon = 2131759096;
public static final int mainframe_banner_text = 2131759097;
public static final int marker_icon = 2131755506;
public static final int marker_layout = 2131755505;
public static final int media_actions = 2131759622;
public static final int menu_btn = 2131761119;
public static final int menu_search = 2131755084;
public static final int menu_sheet_bottom_container = 2131758141;
public static final int menu_sheet_right_container = 2131758142;
public static final int merge_layout_divider = 2131757866;
public static final int message = 2131755516;
public static final int middle = 2131755203;
public static final int mini = 2131755199;
public static final int mm_alert_bottom_view = 2131759260;
public static final int mm_alert_btn_divider = 2131756907;
public static final int mm_alert_btn_first = 2131756909;
public static final int mm_alert_btn_second = 2131756910;
public static final int mm_alert_btn_third = 2131756911;
public static final int mm_alert_button_view = 2131759261;
public static final int mm_alert_cancel_btn = 2131756886;
public static final int mm_alert_content_view = 2131759251;
public static final int mm_alert_custom_area = 2131759258;
public static final int mm_alert_dialog_cb = 2131759249;
public static final int mm_alert_dialog_cb_txt = 2131759250;
public static final int mm_alert_dialog_info = 2131759248;
public static final int mm_alert_msg = 2131759257;
public static final int mm_alert_msg_area = 2131758106;
public static final int mm_alert_msg_icon = 2131756890;
public static final int mm_alert_msg_subdesc = 2131756892;
public static final int mm_alert_msg_subtitle = 2131756891;
public static final int mm_alert_ok_btn = 2131756887;
public static final int mm_alert_title = 2131759253;
public static final int mm_alert_title_area = 2131759252;
public static final int mm_content_fl = 2131759234;
public static final int mm_datepicker = 2131759272;
public static final int mm_preference_list_content = 2131759328;
public static final int mm_preference_ll_id = 2131756414;
public static final int mm_progress_bar_progress = 2131759342;
public static final int mm_progress_bar_tips = 2131759341;
public static final int mm_progress_dialog_icon = 2131755918;
public static final int mm_progress_dialog_msg = 2131755919;
public static final int mm_trans_layer = 2131759235;
public static final int mmpage_control_img = 2131759360;
public static final int mobile_number = 2131759279;
public static final int month = 2131757105;
public static final int month_btn = 2131756813;
public static final int moreIv = 2131755537;
public static final int moreV = 2131755535;
public static final int more_arrow = 2131757876;
public static final int more_iv = 2131757920;
public static final int more_tv = 2131757875;
public static final int msg = 2131758145;
public static final int msg_panel = 2131759700;
public static final int msg_tv = 2131757928;
public static final int multi_listview = 2131759407;
public static final int multiply = 2131755156;
public static final int mute_icon = 2131755318;
public static final int name = 2131755132;
public static final int navigation_header_container = 2131757156;
public static final int nearbyV = 2131755565;
public static final int nearby_icon_showcase = 2131755549;
public static final int nearby_loading_view = 2131755551;
public static final int nearby_refresh_view = 2131755552;
public static final int nearby_showcase_container = 2131755548;
public static final int never = 2131755215;
public static final int new_dot = 2131758590;
public static final int new_tips = 2131757325;
public static final int next_btn = 2131756838;
public static final int next_progress = 2131759275;
public static final int nickname_tv = 2131757075;
public static final int no_contact_layout = 2131757864;
public static final int no_result_view = 2131755258;
public static final int none = 2131755126;
public static final int normal = 2131755122;
public static final int normal_image = 2131761140;
public static final int notice_text = 2131755550;
public static final int notify_btn = 2131759359;
public static final int notify_text = 2131757198;
public static final int notify_view = 2131759358;
public static final int ok_btn = 2131757109;
public static final int onDown = 2131755181;
public static final int onLongPress = 2131755182;
public static final int onMove = 2131755183;
public static final int open_ban_btn = 2131761806;
public static final int open_collect_btn = 2131759695;
public static final int open_console_btn = 2131760437;
public static final int open_debug_btn = 2131761803;
public static final int open_we_run_avatar_iv = 2131755509;
public static final int open_we_run_nickname_tv = 2131755510;
public static final int open_we_run_open = 2131755514;
public static final int open_we_run_status_tv = 2131755511;
public static final int open_we_run_tips = 2131755513;
public static final int open_we_run_title = 2131755512;
public static final int openim_contact_desc = 2131755412;
public static final int option_picker = 2131759631;
public static final int option_second_picker = 2131759632;
public static final int padding_view = 2131755251;
public static final int pager = 2131757560;
public static final int parallax = 2131755144;
public static final int parentPanel = 2131755274;
public static final int performance_btn = 2131757068;
public static final int performance_panel = 2131757072;
public static final int phone_icon = 2131755319;
public static final int pic_tpye = 2131756902;
public static final int pickers = 2131757104;
public static final int pin = 2131755145;
public static final int play_btn = 2131755606;
public static final int play_close_btn = 2131761118;
public static final int play_current_time_tv = 2131755608;
public static final int play_total_time_tv = 2131755614;
public static final int player_progress_bar_background = 2131755610;
public static final int player_progress_bar_front = 2131755612;
public static final int player_progress_bar_middle = 2131755611;
public static final int player_progress_point = 2131755613;
public static final int player_progress_root = 2131755609;
public static final int preference_bottom = 2131759332;
public static final int preference_tips_banner_close = 2131759330;
public static final int preference_tips_banner_tv = 2131759331;
public static final int preference_tips_banner_view = 2131759329;
public static final int primary_text = 2131755086;
public static final int profile_bind_biz_info_item = 2131755529;
public static final int profile_biz_item = 2131755528;
public static final int profile_description = 2131755521;
public static final int profile_enter_app = 2131755517;
public static final int profile_enter_wxa_entity = 2131755526;
public static final int profile_enter_wxa_entity_content = 2131755527;
public static final int profile_icon = 2131755519;
public static final int profile_name = 2131755520;
public static final int profile_service_scope_container = 2131755523;
public static final int profile_service_scope_content = 2131755525;
public static final int profile_service_scope_title = 2131755524;
public static final int profile_share_app = 2131755518;
public static final int profile_tl = 2131755522;
public static final int progress = 2131755570;
public static final int progress_circular = 2131755087;
public static final int progress_dialog_icon = 2131759837;
public static final int progress_dialog_msg = 2131759838;
public static final int progress_horizontal = 2131755088;
public static final int progressbar = 2131759997;
public static final int property_anim = 2131755089;
public static final int qmsg_icon = 2131755320;
public static final int radio = 2131755288;
public static final int radio_group = 2131757196;
public static final int reddot = 2131755590;
public static final int refresh_btn = 2131759699;
public static final int refresh_mini_pb = 2131760353;
public static final int reject_icon = 2131755321;
public static final int relevant_serach_query = 2131757870;
public static final int restart_support_process_btn = 2131760436;
public static final int result_tv = 2131760953;
public static final int right = 2131755153;
public static final int right_arrow = 2131759740;
public static final int right_btn = 2131757529;
public static final int right_center_prospect = 2131756422;
public static final int right_prospect = 2131756421;
public static final int right_rl = 2131756419;
public static final int right_stoe_btn_container = 2131760613;
public static final int right_store_btn = 2131760616;
public static final int right_store_btn_new = 2131760617;
public static final int right_summary = 2131759304;
public static final int room_info_contact_del = 2131760260;
public static final int room_info_contact_owner = 2131756746;
public static final int room_info_contact_status = 2131760261;
public static final int roominfo_contact_name = 2131760262;
public static final int roominfo_contact_name_for_span = 2131760263;
public static final int roominfo_img = 2131760259;
public static final int root = 2131755338;
public static final int root_header = 2131757525;
public static final int save_log_btn = 2131756932;
public static final int screen = 2131755157;
public static final int scroll = 2131755138;
public static final int scrollIndicatorDown = 2131755282;
public static final int scrollIndicatorUp = 2131755279;
public static final int scrollView = 2131755280;
public static final int scrollable = 2131755233;
public static final int sdcard_toast_text = 2131760323;
public static final int search_badge = 2131755298;
public static final int search_bar = 2131755297;
public static final int search_button = 2131755299;
public static final int search_close_btn = 2131755304;
public static final int search_contact_divider = 2131757896;
public static final int search_contact_layout = 2131757897;
public static final int search_contact_tv = 2131757898;
public static final int search_content_layout = 2131757867;
public static final int search_desc_tv = 2131757869;
public static final int search_edit = 2131755324;
public static final int search_edit_frame = 2131755300;
public static final int search_education_layout = 2131757905;
public static final int search_go_btn = 2131755306;
public static final int search_item_content_layout = 2131755464;
public static final int search_loading_view = 2131757874;
public static final int search_mag_icon = 2131755301;
public static final int search_network_divider = 2131757899;
public static final int search_network_layout = 2131757900;
public static final int search_network_tv = 2131757901;
public static final int search_plate = 2131755302;
public static final int search_record_layout = 2131757883;
public static final int search_result_lv = 2131757872;
public static final int search_src_text = 2131755303;
public static final int search_title_tv = 2131757868;
public static final int search_voice_btn = 2131755307;
public static final int secondary_text = 2131755468;
public static final int select_cb = 2131755735;
public static final int select_dialog_listview = 2131755308;
public static final int select_item_content_layout = 2131759408;
public static final int select_single_mark = 2131760385;
public static final int send_btn = 2131759457;
public static final int send_verify_code_btn = 2131759277;
public static final int sendrequest_content = 2131760400;
public static final int sendrequest_tip = 2131760399;
public static final int settings_btn = 2131757067;
public static final int settings_confirm_dialog_cb = 2131756905;
public static final int settings_panel = 2131757071;
public static final int shortcut = 2131755287;
public static final int showCustom = 2131755127;
public static final int showHome = 2131755128;
public static final int showTitle = 2131755129;
public static final int show_ad_sight = 2131760604;
public static final int show_head_toast_text = 2131760584;
public static final int show_toast_view = 2131755568;
public static final int show_toast_view_container = 2131755569;
public static final int sight_downloading_pb = 2131760577;
public static final int sight_image = 2131760576;
public static final int slide_del_del_view = 2131755826;
public static final int slide_del_view_del_word = 2131755827;
public static final int smile_panel_whole_layout = 2131755675;
public static final int smiley_list_view = 2131760614;
public static final int smiley_list_view_layout = 2131760612;
public static final int smiley_listview_item_view = 2131760611;
public static final int smiley_panel_divider = 2131760619;
public static final int smiley_panel_dot = 2131755676;
public static final int smiley_panel_grid = 2131755678;
public static final int smiley_panel_id = 2131755097;
public static final int smiley_panel_view_pager = 2131755677;
public static final int smiley_recent_hint = 2131760618;
public static final int smiley_toolbar_container = 2131755679;
public static final int smiley_toolbar_done = 2131755680;
public static final int smiley_toolbar_switcher_image = 2131755681;
public static final int snackBar = 2131760621;
public static final int snackButton = 2131760623;
public static final int snackContainer = 2131760620;
public static final int snackMessage = 2131760622;
public static final int snackbar_action = 2131757155;
public static final int snackbar_text = 2131757154;
public static final int snap = 2131755139;
public static final int spacer = 2131755273;
public static final int spinner = 2131755166;
public static final int split_action_bar = 2131755098;
public static final int src_atop = 2131755158;
public static final int src_in = 2131755159;
public static final int src_over = 2131755160;
public static final int star_icon = 2131755502;
public static final int star_list_footer = 2131755586;
public static final int star_list_full_size_tip_text = 2131755587;
public static final int star_list_recycler_view = 2131755585;
public static final int start = 2131755154;
public static final int start_face_detect_button = 2131757520;
public static final int state_iv = 2131761015;
public static final int state_tv = 2131757612;
public static final int status_bar_latest_event_content = 2131759621;
public static final int status_btn = 2131755330;
public static final int status_tv = 2131757895;
public static final int stub_tile = 2131761142;
public static final int sub_title_area = 2131755317;
public static final int subbutton = 2131757539;
public static final int submit_area = 2131755305;
public static final int suggest_emoticon_iv = 2131756509;
public static final int suggest_list_view = 2131756508;
public static final int summary = 2131755945;
public static final int summary_container = 2131759306;
public static final int swipe = 2131760965;
public static final int switcher_container = 2131759263;
public static final int tabMode = 2131755123;
public static final int tab_menu_more = 2131755101;
public static final int tag_1 = 2131757886;
public static final int tag_2 = 2131757887;
public static final int tag_3 = 2131757888;
public static final int tag_panel = 2131757885;
public static final int tag_text = 2131755469;
public static final int test_mask = 2131755673;
public static final int text = 2131755134;
public static final int text2 = 2131759626;
public static final int textSpacerNoButtons = 2131755281;
public static final int text_container = 2131755466;
public static final int text_edit = 2131757239;
public static final int text_prospect = 2131756416;
public static final int text_tv = 2131755684;
public static final int text_tv_one = 2131756415;
public static final int text_tv_right = 2131759323;
public static final int text_tv_two = 2131756418;
public static final int textview_1 = 2131757908;
public static final int textview_2 = 2131757910;
public static final int textview_3 = 2131757912;
public static final int textview_all = 2131757913;
public static final int textview_container_1 = 2131757922;
public static final int textview_container_2 = 2131757925;
public static final int textview_container_container_1 = 2131757921;
public static final int textview_container_container_2 = 2131757924;
public static final int tile_image = 2131761141;
public static final int time = 2131756562;
public static final int time_picker = 2131761003;
public static final int time_tv = 2131755339;
public static final int timer = 2131759278;
public static final int tip_container = 2131760204;
public static final int tip_tv = 2131755391;
public static final int tipcnt_tv = 2131755406;
public static final int tipicon = 2131759339;
public static final int tips = 2131755336;
public static final int tips_icon = 2131757536;
public static final int tips_tv = 2131757537;
public static final int tipsbar_item = 2131761011;
public static final int tipsbar_left_icon = 2131761012;
public static final int tipsbar_right_icon = 2131761014;
public static final int tipsbar_text = 2131761013;
public static final int title = 2131755271;
public static final int titleTv = 2131755533;
public static final int title_area = 2131755316;
public static final int title_image = 2131756912;
public static final int title_image_0 = 2131756915;
public static final int title_image_1 = 2131756916;
public static final int title_image_2 = 2131756917;
public static final int title_image_3 = 2131756918;
public static final int title_image_4 = 2131756919;
public static final int title_image_5 = 2131756920;
public static final int title_image_6 = 2131756921;
public static final int title_image_7 = 2131756922;
public static final int title_image_8 = 2131756923;
public static final int title_image_detail_area = 2131759255;
public static final int title_image_ll = 2131759254;
public static final int title_ll = 2131755332;
public static final int title_template = 2131755276;
public static final int title_text = 2131756913;
public static final int title_tv = 2131755467;
public static final int tmessage_lv = 2131757394;
public static final int toast_text = 2131761016;
public static final int toast_view_text = 2131761017;
public static final int toolbar = 2131755368;
public static final int top = 2131755155;
public static final int topLeftTips = 2131761005;
public static final int topPanel = 2131755275;
public static final int topRightTips = 2131761006;
public static final int top_bar = 2131761117;
public static final int touch_loc = 2131755102;
public static final int touch_outside = 2131757152;
public static final int tp_location_point = 2131755504;
public static final int tv_message = 2131760245;
public static final int tweeky_Tv = 2131757538;
public static final int unread_count = 2131759355;
public static final int up = 2131755103;
public static final int update_time_tv = 2131757076;
public static final int uptodown = 2131755238;
public static final int useLogo = 2131755130;
public static final int verify_code_edittext = 2131757255;
public static final int video_container = 2131757689;
public static final int video_duration = 2131756249;
public static final int video_footer_root = 2131756884;
public static final int video_loading = 2131756252;
public static final int video_player_seek_bar = 2131756885;
public static final int video_progress = 2131756250;
public static final int video_root = 2131756248;
public static final int video_thumb = 2131756247;
public static final int video_tips = 2131756253;
public static final int video_view = 2131755595;
public static final int videoplayer_icon = 2131760578;
public static final int videoplayer_maskview = 2131757690;
public static final int view_offset_helper = 2131755104;
public static final int voice_print_sucesss_icon = 2131761161;
public static final int voice_print_title_tip = 2131761164;
public static final int voice_search_bg_ll = 2131761177;
public static final int voice_search_field = 2131761178;
public static final int voice_search_start_btn = 2131761146;
public static final int voice_search_view = 2131757873;
public static final int warn = 2131755515;
public static final int wechat_auth = 2131755445;
public static final int widget_pv = 2131761802;
public static final int widget_settings_btn = 2131761805;
public static final int withText = 2131755216;
public static final int wordcount = 2131757055;
public static final int wrap_content = 2131755140;
public static final int wxapp_layout = 2131757915;
public static final int x5_logo = 2131761748;
public static final int x5_logo_img = 2131761750;
public static final int x5_logo_url = 2131761749;
public static final int year = 2131757107;
public static final int year_btn = 2131756812;
}
|
package EleMe;
import EleMe.domain.Admin;
import EleMe.view.AdminView;
import EleMe.view.BusinessView;
import EleMe.view.impl.AdminViewImpl;
import EleMe.view.impl.BusinessViewImpl;
import java.util.Scanner;
public class ElmAdmin {
public static void main(String[] args) {
work();
}
public static void work(){
Scanner input = new Scanner(System.in);
System.out.println("-----------------------------------------------------------");
System.out.println("|\t\t\t\t饿了么控制台版后台管理系统 V1.0\t\t\t\t|");
System.out.println("-----------------------------------------------------------");
// 登录
AdminView adminView = new AdminViewImpl();
Admin admin = adminView.login();
BusinessView businessView = new BusinessViewImpl();
if(admin != null){
System.out.println("欢迎来到饿了么商家系统");
int menu;
while (true){
System.out.println("========= 1.所有商家列表=2.搜索商家=3.新建商家=4.删除商家=5.退出系统 =========");
System.out.println("请选择相应的编号");
menu = input.nextInt();
switch(menu){
case 1:
businessView.businessViewFindAll();
break;
case 2:
businessView.businessViewSelect();
break;
case 3:
businessView.businessViewAdd();
break;
case 4:
businessView.businessViewDelete();
break;
case 5:
System.out.println("退出系统,欢迎下次光临");
return;
default:
System.out.println("编号输入错误");
break;
}
}
}
}
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package scenariogui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JButton;
/**
*
* @author Jon
*/
class JonLabel extends JButton {
private String text;
private Color accentColor = new Color(200);
private Color textColor = new Color(15, 15, 15);
private float offset = 1;
public JonLabel(String s) {
super(s);
}
@Override
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
float x = 2;
float y = getHeight() - ((getHeight() - g2.getFontMetrics().getHeight()) / 2) + offset;
g2.drawRect((int)x - 3, (int)y - 3, this.getWidth() + 6, this.getHeight() + 4);
g2.setColor(accentColor);
g2.drawString(text, x, y);
y -= offset;
g2.setColor(textColor);
g2.drawString(text, x, y);
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
repaint();
}
@Override
public Dimension getMinimumSize() {
return new Dimension(super.getMinimumSize().width, 60);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 200);
}
}
|
/**
* Copyright (c) 2016, 润柒 All Rights Reserved.
*
*/
package com.richer.jsms.thread.base.sync004;
/**
*
* 脏读:
* 对于对象的同步和异步方法,我们在设计自己的程序时候,一定要考虑问题的整体
* 不然就会出现数据不一致的错误,例如脏读
*
* @author <a href="mailto:sunline360@sina.com">润柒</a>
* @since JDK 1.7
* @version 0.0.1
*/
public class DirtyRead {
private String username = "username";
private String password = "password";
public synchronized void setValue(String username, String password) {
this.username = username;
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
this.password = password;
System.out.println("setValue最终结果:username = " + username + " , password = " + password);
}
/**synchronized*/
public void getValue() {
System.out.println("getValue方法得到:username = " + this.username + " , password = " + this.password);
}
public static void main(String[] args) throws Exception {
/**
* 在我们对一个对象的方法加锁时,需要考虑业务的整体性,及为setValue/getValue方法加锁synchronized同步
* 关键字,保证业务的原子性,不然会出现业务的不一致性。
*/
final DirtyRead dr = new DirtyRead();
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
dr.setValue("z3", "456");
}
});
t1.start();
Thread.sleep(1000);
dr.getValue();
}
}
|
package br.com.pcmaker.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.pcmaker.common.util.DigestUtils;
import br.com.pcmaker.common.util.StringUtils;
import br.com.pcmaker.dao.CrudDAO;
import br.com.pcmaker.dao.UsuarioDAO;
import br.com.pcmaker.entity.Usuario;
import br.com.pcmaker.entity.UsuarioPerfil;
import br.com.pcmaker.service.UsuarioService;
@Service
public class UsuarioServiceImpl extends CrudServiceImpl<Usuario> implements UsuarioService {
@Autowired
UsuarioDAO usuarioDao;
@Override
public CrudDAO<Usuario> getDAO() {
return usuarioDao;
}
@Override
public Usuario get(String login) {
if("admin".equals(login)){
return new Usuario("admin", "Admin");
}
return usuarioDao.get(login);
}
@Override
public List<Usuario> query(String nome, String login) {
return usuarioDao.query(nome, login);
}
@Override
public Usuario salvar(Usuario entity) {
tratarSenha(entity);
tratarRelacionamento(entity);
return super.salvar(entity);
}
private void tratarRelacionamento(Usuario entity) {
for(UsuarioPerfil usuarioPerfil : entity.getUsuarioPerfil()){
usuarioPerfil.setUsuario(entity);
}
}
private void tratarSenha(Usuario entity) {
if(StringUtils.isNotBlank(entity.getSenha())){
entity.setSenha(DigestUtils.sha1Hex(entity.getSenha()));
}else{
Usuario usuarioTmp = get(entity.getId());
entity.setSenha(usuarioTmp.getSenha());
}
}
}
|
package com.company;
public class Medic extends Hero{
int HeroHealth;
public int getHeroHealth() {
return HeroHealth;
}
public Medic setHeroHealth(int heroHealth) {
HeroHealth = heroHealth;
return this;
}
@Override
public void applySuperAbility() {
if (HeroHealth >= 100){
health = health + strike;
}
}
}
|
package com.github.harmonie.mylittletwitter.web;
import com.github.harmonie.mylittletwitter.db.TweetRepository;
import org.springframework.stereotype.Controller;
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.servlet.ModelAndView;
import javax.inject.Inject;
@Controller
public class MyLittleTwitterController {
private TweetRepository tweetRepository;
@Inject
public MyLittleTwitterController(TweetRepository tweetRepository) {
this.tweetRepository = tweetRepository;
}
@RequestMapping(path = "/", method = RequestMethod.GET)
public ModelAndView index(@RequestParam(name = "page", defaultValue = "0") int page) {
ModelAndView modelAndView = new ModelAndView("index");
modelAndView.addObject("page", page);
return modelAndView;
}
@RequestMapping(path = "/tweet.html", method = RequestMethod.GET)
public ModelAndView tweet() {
return new ModelAndView("tweet");
}
@RequestMapping(path = "/tweet.html", method = RequestMethod.POST)
public String postTweet() {
return "redirect:/";
}
}
|
package com.example.hereapi_example;
import com.here.android.mapping.FragmentInitListener;
import com.here.android.mapping.InitError;
import com.here.android.mapping.Map;
import com.here.android.mapping.Map.MapTransformListener;
import com.here.android.mapping.MapEventListener;
import com.here.android.mapping.MapFragment;
import com.here.android.mapping.MapState;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.Toast;
public class SnapshotDemoActivity extends Activity implements MapTransformListener {
/**
* Note that this may be null if the Google Play services APK is not available.
*/
private Map mMap;
private boolean mTakingShot = false;
private CheckBox mWaitForMapLoadCheckBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.snapshot_demo);
mWaitForMapLoadCheckBox = (CheckBox) findViewById(R.id.wait_for_map_load);
createMapIfReady();
}
@Override
protected void onResume() {
super.onResume();
createMapIfReady();
}
private void createMapIfReady() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
final SnapshotDemoActivity that = this;
final MapFragment mapFragment = (MapFragment)getFragmentManager().findFragmentById(R.id.map);
// initialize the Map Fragment to create a map and
// attached to the fragment
mapFragment.init(new FragmentInitListener() {
@Override
public void onFragmentInitializationCompleted(InitError error) {
if (error == InitError.NONE) {
mMap = (Map) mapFragment.getMap();
mMap.addMapTransformListener(that);
};
}
});
}
}
/**
* Called when the snapshot button is clicked.
*/
public void onScreenshot(View view) {
takeSnapshot();
}
private void takeSnapshot() {
if (mMap == null) {
return;
}
final ImageView snapshotHolder = (ImageView) findViewById(R.id.snapshot_holder);
// here maps does not have this functionality
/* final SnapshotReadyCallback callback = new SnapshotReadyCallback() {
@Override
public void onSnapshotReady(Bitmap snapshot) {
// Callback is called from the main thread, so we can modify the ImageView safely.
snapshotHolder.setImageBitmap(snapshot);
}
};
*/
if (mWaitForMapLoadCheckBox.isChecked()) {
mTakingShot = true;
} else {
Toast.makeText(this, R.string.not_implemented_with_here, Toast.LENGTH_SHORT).show();
//mMap.snapshot(callback);
}
}
/**
* Called when the clear button is clicked.
*/
public void onClearScreenshot(View view) {
ImageView snapshotHolder = (ImageView) findViewById(R.id.snapshot_holder);
snapshotHolder.setImageDrawable(null);
}
@Override
public void onMapTransformEnd(MapState mapState) {
if(mTakingShot){
Toast.makeText(this, R.string.not_implemented_with_here, Toast.LENGTH_SHORT).show();
mTakingShot = false;
//mMap.snapshot(callback);
}
}
@Override
public void onMapTransformStart() {}
}
|
package com.tencent.mm.ui.chatting.b;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
class ad$5 implements OnTouchListener {
final /* synthetic */ ad tRG;
ad$5(ad adVar) {
this.tRG = adVar;
}
public final boolean onTouch(View view, MotionEvent motionEvent) {
this.tRG.bAG.YC();
return false;
}
}
|
package com.stem.entity;
public class TigerPay {
private Integer id;
private String openid;
private String tradeId;
private Integer payStatus;
private Integer payMoney;
private String payTime;
private String productName;
private String orderId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getTradeId() {
return tradeId;
}
public void setTradeId(String tradeId) {
this.tradeId = tradeId;
}
public Integer getPayStatus() {
return payStatus;
}
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
public Integer getPayMoney() {
return payMoney;
}
public void setPayMoney(Integer payMoney) {
this.payMoney = payMoney;
}
public String getPayTime() {
return payTime;
}
public void setPayTime(String payTime) {
this.payTime = payTime;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
} |
package com.mastercom.ps.connector.service;
import com.mastercard.api.core.exception.ApiException;
import com.mastercard.api.core.model.RequestMap;
import com.mastercom.ps.connector.config.ServiceConfiguration;
@SuppressWarnings("unused")
public abstract class RetrievalsService<T extends com.mastercard.api.mastercom.Retrievals> {
/**
*
*/
private static final long serialVersionUID = 5491726962257905630L;
private final ServiceConfiguration config;
public RetrievalsService(ServiceConfiguration config) {
this.config = config;
}
abstract public T create(RequestMap map) throws ApiException;
abstract public T acquirerFulfillARequest(RequestMap map) throws ApiException;
abstract public T issuerRespondToFulfillment(RequestMap map) throws ApiException;
abstract public T getPossibleValueListsForCreate(RequestMap map) throws ApiException;
abstract public T getDocumentation(RequestMap map) throws ApiException;
abstract public T retrievalFullfilmentStatus(RequestMap map) throws ApiException;
}
|
package org.ah.minecraft.machines.selection;
import java.util.ArrayList;
import java.util.List;
import org.ah.minecraft.machines.MachineType;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.ChatColor;
public class MachineItem extends ItemStack {
private List<ItemStack> ingredients;
private MachineType type;
public MachineItem(MachineType type) {
super(Material.COMMAND);
this.type = type;
ingredients = new ArrayList<ItemStack>();
if (type == MachineType.BREAK) {
ingredients.add(new ItemStack(Material.IRON_PICKAXE));
ingredients.add(new ItemStack(Material.COBBLESTONE, 8));
setType(Material.IRON_PICKAXE);
ItemMeta meta = getItemMeta();
meta.setDisplayName(ChatColor.WHITE + "Block Breaker");
setItemMeta(meta);
}
if (type == MachineType.PLACE) {
ingredients.add(new ItemStack(Material.REDSTONE));
ingredients.add(new ItemStack(Material.STONE, 8));
setType(Material.COBBLESTONE);
ItemMeta meta = getItemMeta();
meta.setDisplayName(ChatColor.WHITE + "Block Placer");
setItemMeta(meta);
}
if (type == MachineType.FARM) {
ingredients.add(new ItemStack(Material.IRON_HOE));
ingredients.add(new ItemStack(Material.COBBLESTONE, 8));
ingredients.add(new ItemStack(Material.WATER_BUCKET));
setType(Material.WOOD_HOE);
ItemMeta meta = getItemMeta();
meta.setDisplayName(ChatColor.WHITE + "Mini Farmer");
setItemMeta(meta);
}
listIngredients();
}
public List<ItemStack> getIngredients() {
return ingredients;
}
public void setIngredients(List<ItemStack> ingredients) {
this.ingredients = ingredients;
}
public MachineType getMachineType() {
return type;
}
public void setMachineType(MachineType type) {
this.type = type;
}
public void listIngredients() {
List<String> l = new ArrayList<String>();
l.add(ChatColor.BLUE + "Requires:");
for (ItemStack i : ingredients) {
String e = ChatColor.WHITE + "" + i.getAmount() + " " + i.getType().toString().replace("_", " ").toLowerCase();
l.add(e);
System.out.println(e);
}
ItemMeta itemMeta = getItemMeta();
itemMeta.setLore(l);
setItemMeta(itemMeta);
}
}
|
package com.tencent.mm.plugin.sns.g;
import android.util.Base64;
import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever;
import com.tencent.mm.protocal.c.ate;
import com.tencent.mm.protocal.c.bqu;
import com.tencent.mm.protocal.c.bqw;
import com.tencent.mm.protocal.c.bsu;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.bl;
import com.tencent.mm.sdk.platformtools.x;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public final class j {
public static String gVK = "]]>";
public static String gVL = "<TimelineObject>";
public static String gVM = "</TimelineObject>";
static class a {
StringBuffer gVP = new StringBuffer();
a() {
}
public final void wA(String str) {
this.gVP.append("<" + str + ">");
}
public final void wB(String str) {
this.gVP.append("</" + str + ">");
}
public final void setText(String str) {
if (!bi.oW(str)) {
if (str.contains(j.gVK)) {
this.gVP.append("<![CDATA[" + bi.WS(str) + "]]>");
} else {
this.gVP.append("<![CDATA[" + str + "]]>");
}
}
}
public final void wI(int i) {
this.gVP.append(i);
}
public final void i(String str, Map<String, String> map) {
this.gVP.append("<" + str);
for (String str2 : map.keySet()) {
this.gVP.append(" " + str2 + "=\"" + ((String) map.get(str2)) + "\" ");
}
this.gVP.append(">");
map.clear();
}
}
private static String MQ(String str) {
if (str == null) {
return "";
}
return str;
}
private static String MR(String str) {
if (bi.oW(str)) {
return "";
}
return (str.matches("\\d*") ? 1 : null) == null ? "" : str;
}
public static String b(bsu bsu) {
String str;
a aVar = new a();
Map hashMap = new HashMap();
aVar.wA("TimelineObject");
aVar.wA("id");
if (bsu.ksA == null || bsu.ksA.equals("")) {
aVar.setText("0");
} else {
aVar.setText(bsu.ksA);
}
aVar.wB("id");
if (bsu.hbL != null) {
aVar.wA("username");
aVar.setText(bsu.hbL);
aVar.wB("username");
}
aVar.wA("createTime");
aVar.setText(bsu.lOH);
aVar.wB("createTime");
aVar.wA("contentDescShowType");
aVar.wI(bsu.sqe);
aVar.wB("contentDescShowType");
aVar.wA("contentDescScene");
aVar.wI(bsu.sqf);
aVar.wB("contentDescScene");
aVar.wA("private");
aVar.setText(bsu.rVG);
aVar.wB("private");
if (!(bsu.sqb == null || bi.oW(bsu.sqb.ksA))) {
aVar.wA("appInfo");
aVar.wA("id");
aVar.setText(MQ(bsu.sqb.ksA));
aVar.wB("id");
aVar.wA("version");
aVar.setText(MQ(bsu.sqb.hcr));
aVar.wB("version");
aVar.wA("appName");
aVar.setText(MQ(bsu.sqb.jSv));
aVar.wB("appName");
aVar.wA("installUrl");
aVar.setText(MQ(bsu.sqb.rdf));
aVar.wB("installUrl");
aVar.wA("fromUrl");
aVar.setText(MQ(bsu.sqb.rdg));
aVar.wB("fromUrl");
aVar.wB("appInfo");
}
if (!(bsu.sqh == null || bi.oW(bsu.sqh.dyJ))) {
aVar.wA("streamvideo");
aVar.wA("streamvideourl");
aVar.setText(MQ(bsu.sqh.dyJ));
aVar.wB("streamvideourl");
aVar.wA("streamvideototaltime");
aVar.wI(bsu.sqh.dyK);
aVar.wB("streamvideototaltime");
aVar.wA("streamvideotitle");
aVar.setText(MQ(bsu.sqh.dyL));
aVar.wB("streamvideotitle");
aVar.wA("streamvideowording");
aVar.setText(MQ(bsu.sqh.dyM));
aVar.wB("streamvideowording");
aVar.wA("streamvideoweburl");
aVar.setText(MQ(bsu.sqh.dyN));
aVar.wB("streamvideoweburl");
aVar.wA("streamvideothumburl");
aVar.setText(MQ(bsu.sqh.dyO));
aVar.wB("streamvideothumburl");
aVar.wA("streamvideoaduxinfo");
aVar.setText(MQ(bsu.sqh.dyP));
aVar.wB("streamvideoaduxinfo");
aVar.wA("streamvideopublishid");
aVar.setText(MQ(bsu.sqh.dyQ));
aVar.wB("streamvideopublishid");
aVar.wB("streamvideo");
}
if (!(bsu.nsD == null || bi.oW(bsu.nsD.pLr))) {
aVar.wA("websearch");
aVar.wA("relevant_vid");
aVar.setText(MQ(bsu.nsD.pLr));
aVar.wB("relevant_vid");
aVar.wA("relevant_expand");
aVar.setText(MQ(bsu.nsD.pLs));
aVar.wB("relevant_expand");
aVar.wA("relevant_pre_searchid");
aVar.setText(MQ(bsu.nsD.pLt));
aVar.wB("relevant_pre_searchid");
aVar.wA("relevant_shared_openid");
aVar.setText(MQ(bsu.nsD.pLu));
aVar.wB("relevant_shared_openid");
aVar.wA("rec_category");
aVar.setText(MQ(bsu.nsD.pLv));
aVar.wB("rec_category");
aVar.wA("shareUrl");
aVar.setText(MQ(bsu.nsD.ixy));
aVar.wB("shareUrl");
aVar.wA("shareTitle");
aVar.setText(MQ(bsu.nsD.ixz));
aVar.wB("shareTitle");
aVar.wA("shareDesc");
aVar.setText(MQ(bsu.nsD.nzH));
aVar.wB("shareDesc");
aVar.wA("shareImgUrl");
aVar.setText(MQ(bsu.nsD.pLw));
aVar.wB("shareImgUrl");
aVar.wA("shareString");
aVar.setText(MQ(bsu.nsD.pLx));
aVar.wB("shareString");
aVar.wA("shareStringUrl");
aVar.setText(MQ(bsu.nsD.pLy));
aVar.wB("shareStringUrl");
aVar.wA("source");
aVar.setText(MQ(bsu.nsD.bhd));
aVar.wB("source");
aVar.wA("strPlayCount");
aVar.setText(MQ(bsu.nsD.pLz));
aVar.wB("strPlayCount");
aVar.wA("titleUrl");
aVar.setText(MQ(bsu.nsD.pLA));
aVar.wB("titleUrl");
aVar.wA("tagList");
aVar.setText(MQ(bsu.nsD.pLC));
aVar.wB("tagList");
aVar.wB("websearch");
}
aVar.wA("contentDesc");
aVar.setText(MQ(bsu.spZ));
aVar.wB("contentDesc");
aVar.wA("contentattr");
aVar.setText(bsu.dwt);
aVar.wB("contentattr");
aVar.wA("sourceUserName");
aVar.setText(MQ(bsu.qIb));
aVar.wB("sourceUserName");
aVar.wA("sourceNickName");
aVar.setText(MQ(bsu.qIc));
aVar.wB("sourceNickName");
aVar.wA("statisticsData");
aVar.setText(MQ(bsu.sqg));
aVar.wB("statisticsData");
aVar.wA("weappInfo");
aVar.wA("appUserName");
aVar.setText(MQ(bsu.sqi.username));
aVar.wB("appUserName");
aVar.wA("pagePath");
aVar.setText(MQ(bsu.sqi.path));
aVar.wB("pagePath");
aVar.wB("weappInfo");
aVar.wA("canvasInfoXml");
aVar.setText(MQ(bsu.ogR));
aVar.wB("canvasInfoXml");
if (bsu.sqa != null) {
float f = bsu.sqa.rmr;
float f2 = bsu.sqa.rms;
if (!(f == -1000.0f || f2 == -1000.0f)) {
hashMap.clear();
hashMap.put("longitude", bsu.sqa.rmr);
hashMap.put("latitude", bsu.sqa.rms);
hashMap.put("city", bi.WS(MQ(bsu.sqa.eJJ)));
hashMap.put("poiName", bi.WS(MQ(bsu.sqa.kFa)));
hashMap.put("poiAddress", bi.WS(MQ(bsu.sqa.nOz)));
hashMap.put("poiScale", bsu.sqa.rTI);
hashMap.put("poiClassifyId", MQ(bsu.sqa.rTG));
hashMap.put("poiClassifyType", bsu.sqa.nOB);
hashMap.put("poiClickableStatus", bsu.sqa.rTJ);
aVar.i("location", hashMap);
aVar.wB("location");
}
}
aVar.wA("ContentObject");
aVar.wA("contentStyle");
aVar.setText(bsu.sqc.ruz);
aVar.wB("contentStyle");
aVar.wA("contentSubStyle");
aVar.setText(bsu.sqc.ruB);
aVar.wB("contentSubStyle");
aVar.wA(FFmpegMetadataRetriever.METADATA_KEY_TITLE);
aVar.setText(MQ(bsu.sqc.bHD));
aVar.wB(FFmpegMetadataRetriever.METADATA_KEY_TITLE);
aVar.wA("description");
aVar.setText(MQ(bsu.sqc.jOS));
aVar.wB("description");
aVar.wA("contentUrl");
aVar.setText(MQ(bsu.sqc.jPK));
aVar.wB("contentUrl");
if (bsu.sqc.ruA.size() > 0) {
aVar.wA("mediaList");
Iterator it = bsu.sqc.ruA.iterator();
while (it.hasNext()) {
ate ate = (ate) it.next();
aVar.wA("media");
aVar.wA("id");
if (MR(ate.ksA).equals("")) {
aVar.setText("0");
} else {
aVar.setText(MR(ate.ksA));
}
aVar.wB("id");
aVar.wA("type");
aVar.setText(ate.hcE);
aVar.wB("type");
aVar.wA(FFmpegMetadataRetriever.METADATA_KEY_TITLE);
aVar.setText(MQ(ate.bHD));
aVar.wB(FFmpegMetadataRetriever.METADATA_KEY_TITLE);
aVar.wA("description");
aVar.setText(MQ(ate.jOS));
aVar.wB("description");
aVar.wA("private");
aVar.setText(ate.rVG);
aVar.wB("private");
hashMap.clear();
hashMap.put("type", ate.rVD);
if (!bi.oW(ate.bKg)) {
hashMap.put("md5", ate.bKg);
}
if (!bi.oW(ate.rVZ)) {
hashMap.put("videomd5", ate.rVZ);
}
aVar.i("url", hashMap);
aVar.setText(MQ(ate.jPK));
aVar.wB("url");
if (!(ate.rVE == null || ate.rVE.equals(""))) {
hashMap.clear();
hashMap.put("type", ate.rVF);
aVar.i("thumb", hashMap);
aVar.setText(MQ(ate.rVE));
aVar.wB("thumb");
}
if (ate.bID > 0) {
aVar.wA("subType");
aVar.setText(ate.bID);
aVar.wB("subType");
}
if (!bi.oW(ate.nME)) {
aVar.wA("userData");
aVar.setText(ate.nME);
aVar.wB("userData");
}
if (!(ate.rVI == null || ate.rVI.equals(""))) {
hashMap.clear();
hashMap.put("type", ate.rVJ);
aVar.i("lowBandUrl", hashMap);
aVar.setText(MQ(ate.rVI));
aVar.wB("lowBandUrl");
}
if (ate.rVH != null) {
hashMap.clear();
if (ate.rVH.rWu > 0.0f) {
hashMap.put("width", ate.rVH.rWu);
}
if (ate.rVH.rWv > 0.0f) {
hashMap.put("height", ate.rVH.rWv);
}
if (ate.rVH.rWw > 0.0f) {
hashMap.put("totalSize", ate.rVH.rWw);
}
aVar.i("size", hashMap);
aVar.wB("size");
}
aVar.wB("media");
}
aVar.wB("mediaList");
}
aVar.gVP.append(MQ(bsu.sqc.ruC));
aVar.wB("ContentObject");
if (bsu.nsB != null) {
aVar.wA("actionInfo");
if (bsu.nsB.raS != null) {
aVar.wA("appMsg");
aVar.wA("mediaTagName");
aVar.setText(bsu.nsB.raS.raM);
aVar.wB("mediaTagName");
aVar.wA("messageExt");
aVar.setText(bsu.nsB.raS.raN);
aVar.wB("messageExt");
aVar.wA("messageAction");
aVar.setText(bsu.nsB.raS.raO);
aVar.wB("messageAction");
aVar.wB("appMsg");
}
aVar.wB("actionInfo");
}
if (!(bsu.sqb == null || bi.oW(bsu.sqb.ksA))) {
str = bsu.nNV;
bqw bqw = new bqw();
if (str != null) {
try {
bqw.aG(Base64.decode(str, 0));
} catch (Exception e) {
}
}
bqw.soY = new bqu();
bqw.soY.jLY = bsu.sqb.ksA;
try {
str = Base64.encodeToString(bqw.toByteArray(), 0).replace("\n", "");
} catch (Throwable e2) {
x.printErrStackTrace("MicroMsg.TimelineConvert", e2, "", new Object[0]);
}
bsu.nNV = str;
}
if (bsu.nNV != null) {
aVar.wA("statExtStr");
aVar.setText(bsu.nNV);
aVar.wB("statExtStr");
}
aVar.wB("TimelineObject");
str = aVar.gVP.toString();
x.d("MicroMsg.TimelineConvert", "xmlContent: " + str);
if (bl.z(str, "TimelineObject") != null) {
return str;
}
x.e("MicroMsg.TimelineConvert", "xml is error");
return "";
}
}
|
package day06;
import java.util.Arrays;
import java.util.Scanner;
public class ArrayDelete {
public static void main(String[] args) {
/*
int[] arr = {1,2,3,4,5,6,7,8,9,10};//길이10
//4번쨰 인덱스의 삭제를 표현
for (int i = 4; i < arr.length-1; i++) {
arr[i] = arr[i+1];
}
System.out.println(Arrays.toString(arr));*/
String[] arr = {"강타","문희준","토니안","이재원","장우혁"};
Scanner scan = new Scanner(System.in);
System.out.print("삭제할 학생의 별명을 입력하세요> ");
String name = scan.next();
int count = arr.length; //사람수
boolean chk = true;
for (int i = 0; i < count; i++) {
if (name.equals(arr[i])) {//삭제할 항목을 찾은 경우
System.out.println(arr[i] + " 을 삭제 합니다");
for (int j = i; j < count-1; j++) {
arr[j]=arr[j+1];
}count--;
chk = false;
}
}
if(chk) {
System.out.println("삭제 할 이름이 없습니다");
}else {
System.out.println("------------ 삭제 후 정보 ------------");
for (int i = 0; i < count; i++) {
System.out.print(arr[i]+ " ");
}
}
}
}
|
package com.multi.rabbitmq.mq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
/**
* @author vector
* @date: 2019/4/11 0011 10:59
*/
@Slf4j
public class RabbitMqConsumer {
@RabbitListener(queues = {"tbd_resume_id_dev_0"}, containerFactory = "jmsQueue4TalentIdContainer0")
public void firstMq0(String msg) {
log.info("dev0 receive msg: {}", msg);
}
@RabbitListener(queues = {"tbd_resume_id_dev_1"}, containerFactory = "jmsQueue4TalentIdContainer1")
public void firstMq1(String msg) {
log.info("dev1 receive msg: {}", msg);
}
@RabbitListener(queues = {"tbd_resume_id_dev_2"}, containerFactory = "jmsQueue4TalentIdContainer2")
public void firstMq2(String msg) {
log.info("dev2 receive msg: {}", msg);
}
@RabbitListener(queues = {"tbd_resume_id_dev_3"}, containerFactory = "jmsQueue4TalentIdContainer3")
public void firstMq3(String msg) {
log.info("dev3 receive msg: {}", msg);
}
@RabbitListener(queues = {"tbd_resume_id_dev_4"}, containerFactory = "jmsQueue4TalentIdContainer4")
public void firstMq4(String msg) {
log.info("dev4 receive msg: {}", msg);
}
@RabbitListener(queues = {"tbd_resume_id_dev_5"}, containerFactory = "jmsQueue4TalentIdContainer5")
public void firstMq5(String msg) {
log.info("dev5 receive msg: {}", msg);
}
// @RabbitListener(queues = {"tbd_resume_id_rc_5"}, containerFactory = "secondContainerFactory")
// public void secondMq(String msg) {
// log.info("rc receive msg: {}", msg);
// }
}
|
package com.example.producercancelacompra;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.http.HttpStatus;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
@RestController
@EnableBinding(Source.class)
public class CancelaCompraController {
private Source source;
@Autowired
public CancelaCompraController(Source source){
this.source = source;
}
@PostMapping("/cancela-compra")
@ResponseStatus(HttpStatus.CREATED)
public void processa(@RequestBody CancelaCompraInput input){
System.out.println(input);
Message<CancelaCompraInput> message = MessageBuilder
.withPayload(input)
.setHeader(KafkaHeaders.MESSAGE_KEY, input.getUserId() + "#" + input.getProductId())
.build();
source.output().send(message);
}
}
|
package com.atn.app.webservices;
import java.util.ArrayList;
import com.atn.app.datamodels.AtnRegisteredVenueData;
public interface MyDealsWebServiceListener {
public void onSuccess(ArrayList<AtnRegisteredVenueData> atnVenueData);
public void onFailed(int errorCode, String errorMessage);
}
|
/**
*
*/
package dynamicProgramming;
import java.util.ArrayList;
import java.util.List;
/**
* The Longest Increasing Subsequence (LIS) problem is to find the length of the
* longest subsequence of a given sequence such that all elements of the
* subsequence are sorted in increasing order. For example, the length of LIS
* for {10, 22, 9, 33, 21, 50, 41, 60, 80} is 6 and LIS is {10, 22, 33, 50, 60,
* 80}.
*
*/
public class LongestIncreasingSubsequence {
/*
* Accepts an int array arr[]. Let lis[i] = length of LIS ending at arr[i]
* lis[i] = max of (lis[j] for all j<i and arr[i] > arr[j]) + arr[i]
*/
public static int findLIS(int[] arr) {
int arrLength = arr.length;
int[] lis = new int[arrLength];
lis[0] = 1;
int maxLength = lis[0];
List<Integer> longestIncreasingSub = new ArrayList<Integer>();
for (int i = 1; i < arrLength; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] > arr[j] && lis[i] < lis[j] + 1) {
lis[i] = lis[j] + 1;
if (lis[i] > maxLength) {
maxLength = lis[i];
if (longestIncreasingSub.isEmpty()) {
longestIncreasingSub.add(j);
}
longestIncreasingSub.add(i);
break;
}
}
}
}
System.out.println("\nmaxLength: " + maxLength);
for (int x : longestIncreasingSub) {
System.out.print(arr[x] + "\t");
}
return maxLength;
}
public static void main(String[] args) {
int[] arr = new int[] { 10, 22, 9, 33, 21, 50, 41, 60, 80 };
LongestIncreasingSubsequence.findLIS(arr);
arr = new int[] { 10, 22, 9, 33, 21, 50, 39, 2, 80 };
LongestIncreasingSubsequence.findLIS(arr);
}
}
|
package net.minecraft.client.renderer.entity;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class RenderPotion extends RenderSnowball<EntityPotion> {
public RenderPotion(RenderManager renderManagerIn, RenderItem itemRendererIn) {
super(renderManagerIn, (Item)Items.POTIONITEM, itemRendererIn);
}
public ItemStack getStackToRender(EntityPotion entityIn) {
return entityIn.getPotion();
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\client\renderer\entity\RenderPotion.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package backjoon.backtracking;
import java.util.*;
import java.io.*;
public class Backjoon10974 {
static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
static int N;
public static void main(String[] args) throws NumberFormatException, IOException{
N = Integer.parseInt(br.readLine());
solve();
br.close();
bw.close();
}
public static void solve() throws IOException{
boolean[] check = new boolean[N + 1];
int[] arr = new int[N + 1];
combination1ToN(1, check, arr);
}
public static void combination1ToN(int curIndex, boolean[] check, int[] arr) throws IOException{
if(curIndex > N){
for(int i = 1; i <= N; i++) bw.write(arr[i] + " ");
bw.write("\n");
return;
}
for(int i = 1; i <= N; i++){
if(check[i] == true) continue;
check[i] = true;
arr[curIndex] = i;
combination1ToN(curIndex + 1, check, arr);
check[i] = false;
}
}
}
|
package com.erpambudi.favoriteapp;
import android.net.Uri;
public class Item {
public static final String TABLE_NAME = "movies";
public static final String AUTHORITY = "com.erpambudi.moviecatalogue.provider";
public static final Uri CONTENT_URI = new Uri.Builder().scheme("content")
.authority(AUTHORITY)
.appendPath(TABLE_NAME)
.build();
public static final String COLUMN_TITLE = "title";
public static final String COLUMN_DESCRIPTION = "overview";
public static final String COLUMN_POSTER = "poster";
public static final String COLUMN_RATING = "vote_average";
public static final String POSTER_BASE_URL = "https://image.tmdb.org/t/p/w185";
}
|
package com.timesheet.web.controller;
import com.timesheet.domain.Timesheet;
import com.timesheet.service.TimesheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by Vitaliy, Yan on 5/17/15.
*/
@RestController
public class TimesheetController {
@Autowired
private TimesheetService timesheetService;
@RequestMapping("/timesheets/{pageNumber}")
public Page<Timesheet> showTimesheets(@PathVariable Integer pageNumber) {
return timesheetService.findAll(new PageRequest(pageNumber -1, 2, Sort.Direction.DESC, "id"));
}
@RequestMapping("/timesheet/{id}")
public Timesheet showTaskById(@PathVariable Long id) {
return timesheetService.findById(id);
}
}
|
package org.sbbs.app.gen.model;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.sbbs.base.model.BaseObject;
@Entity
@Table(name = "t_master", uniqueConstraints = {
@UniqueConstraint(columnNames = {"code"}),
@UniqueConstraint(columnNames = {"name"})})
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class MasterEntity extends BaseObject implements Serializable {
private Long dictionaryId;
private String name;
private String code;
private Set<DetailEntity> detailEntities = new HashSet<DetailEntity>(0);
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getDictionaryId() {
return this.dictionaryId;
}
public void setDictionaryId(Long dictionaryId) {
this.dictionaryId = dictionaryId;
}
@Column(name = "name", nullable = false, length = 45)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "code", nullable = false, length = 45)
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "masterEntity")
public Set<DetailEntity> getDetailEntities() {
return this.detailEntities;
}
public void setDetailEntities(Set<DetailEntity> TDictionaryItemses) {
this.detailEntities = TDictionaryItemses;
}
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MasterEntity pojo = (MasterEntity) o;
if (name != null ? !name.equals(pojo.name) : pojo.name != null)
return false;
if (code != null ? !code.equals(pojo.code) : pojo.code != null)
return false;
return true;
}
public int hashCode() {
int result = 0;
result = (name != null ? name.hashCode() : 0);
result = 31 * result + (code != null ? code.hashCode() : 0);
return result;
}
public String toString() {
StringBuffer sb = new StringBuffer(getClass().getSimpleName());
sb.append(" [");
sb.append("dictionaryId").append("='").append(getDictionaryId())
.append("', ");
sb.append("name").append("='").append(getName()).append("', ");
sb.append("code").append("='").append(getCode()).append("', ");
sb.append("]");
return sb.toString();
}
}
|
package com.smxknife.java2.thread.demo.matrixmultiplier.parallel1;
import java.util.ArrayList;
import java.util.List;
/**
* @author smxknife
* 2019-08-02
*/
public class ParallelIndividualMultiplier {
public static void multiply(double[][] matrixA, double[][] matrixB, double[][] result) {
List<Thread> threads = new ArrayList<>();
int rowA = matrixA.length;
int columnB = matrixB[0].length;
for (int i = 0; i < rowA; i++) {
for (int j = 0; j < columnB; j++) {
IndividualMultiplierTask task = new IndividualMultiplierTask(matrixA, matrixB, result, i, j);
Thread thread = new Thread(task, "thread-row:" + i + "|column:" + j);
thread.start();
threads.add(thread);
if (threads.size() % 10 == 0) {
waiteForThreads(threads);
}
}
}
}
private static void waiteForThreads(List<Thread> threads) {
threads.forEach(thread -> {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
threads.clear();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.