text
stringlengths 10
2.72M
|
|---|
package com.lxn.job.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import com.lxn.job.R;
/**
* Created by liuningning on 3/26/16.
* http://blog.csdn.net/lmj623565791/article/details/40162163
*/
public class CardView extends View {
private Paint mTextPaint;
//SP
private int mTextSize = 22;
private String mText = "谢谢光监";
private Rect mTextRect;
private Paint mOuterPaint;
private Path mPath;
private Canvas mCanvas;
private Bitmap mOutBitmap;
private Bitmap mCardFrontBitmap;
private float mLastX;
private float mLastY;
private int mTouchSlop;
private volatile boolean isComplete = false;
private Runnable mCheckComplete;
public CardView(Context context) {
this(context, null);
}
public CardView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CardView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
mTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTextSize, displayMetrics);
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
mTouchSlop = viewConfiguration.getScaledTouchSlop();
TypedArray ta = null;
try {
// ta = context.getTheme().obtainStyledAttributes(attrs,,defStyleAttr,0);
} finally {
if (ta != null) {
ta.recycle();
}
}
init();
}
private void init() {
setUpTextPaint();
setUpOuterPaint();
initPath();
initFrontBitmap();
}
private void setUpTextPaint() {
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setColor(Color.RED);
mTextPaint.setDither(true);
mTextPaint.setTextSize(mTextSize);
}
private void setUpOuterPaint() {
mOuterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mOuterPaint.setColor(Color.parseColor("#c0c0c0"));
mOuterPaint.setDither(true);
mOuterPaint.setStrokeCap(Paint.Cap.ROUND);
mOuterPaint.setStrokeJoin(Paint.Join.ROUND);
mOuterPaint.setStyle(Paint.Style.FILL);
mOuterPaint.setStrokeWidth(5);
}
private void initPath() {
mPath = new Path();
}
private void initFrontBitmap() {
mCardFrontBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.fg_guaguaka);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
mTextRect = new Rect();
mTextPaint.getTextBounds(mText, 0, mText.length(), mTextRect);
mOutBitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mOutBitmap);
mOuterPaint.setXfermode(null);
mOuterPaint.setStyle(Paint.Style.FILL);
mCanvas.drawRoundRect(new RectF(0, 0, measuredWidth, measuredHeight), 30, 30, mOuterPaint);
mCanvas.drawBitmap(mCardFrontBitmap, null, new RectF(0, 0, measuredWidth, measuredHeight), null);
}
@Override
protected void onDraw(Canvas canvas) {
drawText(canvas);
if (isComplete) {
return;
}
drawPath();
canvas.drawBitmap(mOutBitmap, 0, 0, null);
}
private void drawText(Canvas canvas) {
canvas.drawText(mText, getWidth() / 2 - mTextRect.centerX(), getHeight() / 2 + mTextRect.height() / 2, mTextPaint);
}
private void drawPath() {
mOuterPaint.setStyle(Paint.Style.STROKE);
mOuterPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mCanvas.drawPath(mPath, mOuterPaint);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int action = event.getAction();
float x = event.getX();
float y = event.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
mPath.moveTo(x, y);
mLastX = x;
mLastY = y;
break;
case MotionEvent.ACTION_MOVE:
int dx = (int) Math.abs(x - mLastX);
int dy = (int) Math.abs(y - mLastY);
if (dx > mTouchSlop || dy > mTouchSlop) {
mPath.lineTo(x, y);
mLastX = x;
mLastY = y;
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
checkComplete();
break;
}
if (!isComplete) {
invalidate();
}
return true;
}
private void checkComplete() {
if (mCheckComplete == null) {
mCheckComplete = new CompleteRunnable();
}
post(mCheckComplete);
}
private class CompleteRunnable implements Runnable {
@Override
public void run() {
int width = getWidth();
int height = getHeight();
int total = width * height;
int area = 0;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int pixels = mOutBitmap.getPixel(i, j);
if (pixels == 0) {
area++;
}
}
}
if (area > 0 && total > 0) {
int percent = (area * 100 / total);
if (percent >= 45) {
isComplete = true;
postInvalidate();
}
}
}
}
}
|
/**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2015 Paco Avila & Josep Llort
*
* No bytes were intentionally harmed during the development of this application.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.openkm.frontend.client.extension.comunicator;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
import com.openkm.frontend.client.Main;
import com.openkm.frontend.client.bean.GWTDocument;
import com.openkm.frontend.client.bean.GWTFolder;
import com.openkm.frontend.client.bean.GWTWorkspace;
import com.openkm.frontend.client.bean.ToolBarOption;
import com.openkm.frontend.client.service.OKMRepositoryService;
import com.openkm.frontend.client.service.OKMRepositoryServiceAsync;
import com.openkm.frontend.client.util.CommonUI;
import com.openkm.frontend.client.util.Util;
/**
* GeneralComunicator
*
* @author jllort
*
*/
public class GeneralComunicator {
private static final OKMRepositoryServiceAsync repositoryService = (OKMRepositoryServiceAsync) GWT.create(OKMRepositoryService.class);
/**
* refreshUI
*/
public static void refreshUI() {
Main.get().mainPanel.topPanel.toolBar.executeRefresh();
}
/**
* getToolBarOption
*/
public static ToolBarOption getToolBarOption() {
return Main.get().mainPanel.topPanel.toolBar.getToolBarOption();
}
/**
* getLang
*/
public static String getLang() {
return Main.get().getLang();
}
/**
* i18nExtension
*/
public static String i18nExtension(String property) {
return Main.get().i18nExtension(property);
}
/**
* i18n
*/
public static String i18n(String property) {
return Main.i18n(property);
}
/**
* Download Document
*/
public static void downloadDocument(boolean checkout) {
if (Main.get().mainPanel.desktop.browser.fileBrowser.isDocumentSelected()) {
String docUuid = Main.get().mainPanel.desktop.browser.fileBrowser.getDocument().getUuid();
Util.downloadFileByUUID(docUuid, (checkout?"checkout":""));
}
}
/**
* Download document as PDF
*/
public static void downloadDocumentPdf() {
if (Main.get().mainPanel.desktop.browser.fileBrowser.isDocumentSelected()) {
Util.downloadFilePdf(Main.get().mainPanel.desktop.browser.fileBrowser.getDocument().getUuid());
}
}
/**
* extensionCallOwnDownload
*/
public static void extensionCallOwnDownload(String url) {
final Element downloadIframe = RootPanel.get("__download").getElement();
DOM.setElementAttribute(downloadIframe, "src", url);
}
/**
* download file by uuid
*/
public static void downloadFileByUUID(String uuid, String params) {
Util.downloadFileByUUID(uuid, params);
}
/**
* download file by path
*/
@Deprecated
public static void downloadFile(String path, final String params) {
repositoryService.getUUIDByPath(path, new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
Util.downloadFileByUUID(result, params);
}
@Override
public void onFailure(Throwable caught) {
Main.get().showError("getUUIDByPath", caught);
}
});
}
/**
* Sets the status
*/
public static void setStatus(String msg) {
Main.get().mainPanel.bottomPanel.setStatus(msg);
}
/**
* Sets the status
*
*/
public static void resetStatus() {
Main.get().mainPanel.bottomPanel.resetStatus();
}
/**
* showError
*/
public static void showError(String callback, Throwable caught) {
Main.get().showError(callback, caught);
}
/**
* logout
*/
public static void logout() {
Main.get().logoutPopup.logout();
}
/**
* refreshUserDocumentsSize
*/
public static void refreshUserDocumentsSize() {
Main.get().workspaceUserProperties.getUserDocumentsSize();
}
/**
* getUserRoleList
*/
public static List<String> getUserRoleList() {
return Main.get().workspaceUserProperties.getWorkspace().getRoleList();
}
/**
* getUser
*/
public static String getUser() {
return Main.get().workspaceUserProperties.getUser().getId();
}
/**
* openAllFolderPath
*/
public static void openPath(String path, String docPath) {
CommonUI.openPath(path, docPath);
}
/**
* openAllFolderPath
*/
public static void openAllFolderPath(String path, String docPath) {
CommonUI.openPath(path, docPath);
}
/**
* getAppContext
*/
public static String getAppContext() {
return Main.CONTEXT;
}
/**
* showNextWizard
*/
public static void showNextWizard() {
Main.get().wizardPopup.showNextWizard();
}
/**
* getDocumentToSign
*/
public static GWTDocument getDocumentToSign() {
return Main.get().wizardPopup.getDocumentToSign();
}
/**
* getSessionId
*/
public static String getSessionId() {
return Main.get().workspaceUserProperties.getWorkspace().getSessionId();
}
/**
* getWorkspace
*/
public static GWTWorkspace getWorkspace() {
return Main.get().workspaceUserProperties.getWorkspace();
}
/**
* enableKeyShorcuts
*/
public static void enableKeyShorcuts() {
Main.get().mainPanel.enableKeyShorcuts();
}
/**
* disableKeyShorcuts
*/
public static void disableKeyShorcuts() {
Main.get().mainPanel.disableKeyShorcuts();
}
/**
* openPathByUuid
*/
public static void openPathByUuid(String uuid) {
CommonUI.openPathByUuid(uuid);
}
/**
* getFolderIcon
*/
public static String getFolderIcon(GWTFolder fld) {
return CommonUI.getFolderIcon(fld);
}
/**
* get
*
* @return
*/
public static Main get() {
return Main.get();
}
}
|
package pl.rogalik.environ1.game_map.map_objects.tiles;
public class GroundTile extends Tile{
private static final long serialVersionUID = 1L;
public GroundTile(){
super();
this.type = Type.GROUND;
}
@Override
public String toString() {
if (this.getEntity().isPresent()) {
if (this.getEntity().get().getType().isCharacterType())
return "C";
else if (this.getEntity().get().getType().isItemType())
return "I";
}
return ".";
}
}
|
package am.main.data.jaxb.log4jData;
/**
* Created by ahmed.motair on 11/17/2017.
*/
import javax.xml.bind.annotation.*;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute name="pattern" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"value"
})
public class PatternLayout implements Cloneable{
@XmlValue
protected String value;
@XmlAttribute(name = "pattern")
protected String pattern;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the pattern property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPattern() {
return pattern;
}
/**
* Sets the value of the pattern property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPattern(String value) {
this.pattern = value;
}
@Override
protected PatternLayout clone() throws CloneNotSupportedException {
PatternLayout clone = new PatternLayout();
clone.setPattern(this.pattern);
clone.setValue(this.value);
return clone;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PatternLayout)) return false;
PatternLayout that = (PatternLayout) o;
if (getValue() != null ? !getValue().equals(that.getValue()) : that.getValue() != null) return false;
return getPattern() != null ? getPattern().equals(that.getPattern()) : that.getPattern() == null;
}
@Override
public int hashCode() {
int result = getValue() != null ? getValue().hashCode() : 0;
result = 31 * result + (getPattern() != null ? getPattern().hashCode() : 0);
return result;
}
@Override
public String toString() {
return "PatternLayout{" +
"value = " + value +
", pattern = " + pattern +
"}\n";
}
}
|
package Inerfaces;
public class Person implements Student, Youtuber {
public static void main(String[] args) {
Person p = new Person();
p.study();
p.makevideos();
}
@Override
public void study()
{
System.out.println("student is studying");
}
@Override
public void makevideos()
{
System.out.println("youtuber is making videos");
}
@Override
public void editVideo() {
// TODO Auto-generated method stub
}
}
|
package com.wq.newcommunitygovern.mvp.ui.activity.main;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.ObjectUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.weique.commonres.core.RouterHub;
import com.wq.newcommunitygovern.R;
import com.wq.newcommunitygovern.di.component.DaggerMainComponent;
import com.wq.newcommunitygovern.mvp.contract.MainContract;
import com.wq.newcommunitygovern.mvp.presenter.MainPresenter;
import com.wq.newcommunitygovern.mvp.ui.fragment.HomeFragment;
import com.wq.newcommunitygovern.mvp.ui.fragment.MyFragment;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description: 主界面
* <p>
* ================================================
*
* @author Administrator
*/
@Route(path = RouterHub.APP_MAIN_ACTIVITY, name = "主界面")
public class MainActivity extends BaseActivity<MainPresenter> implements MainContract.View {
@BindView(R.id.bottom_navigation)
BottomNavigationView bottomNavigation;
private FragmentManager fragmentManager;
private FragmentTransaction transition;
private List<BaseFragment> fragments;
private HomeFragment homeFragment;
private MyFragment myFragment;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerMainComponent
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.app_activity_main;
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
fragmentManager = getSupportFragmentManager();
bottomNavigation.setItemIconTintList(null);
fragments = new ArrayList<>();
homeFragment = HomeFragment.newInstance();
fragments.add(homeFragment);
hideOthersFragment(homeFragment, true);
bottomNavigation.setOnNavigationItemSelectedListener(menuItem -> {
try {
switch (menuItem.getItemId()) {
case R.id.agenda:
hideOthersFragment(homeFragment, false);
// messageImg.setImageResource(R.drawable.icon_news_);
// scanImg.setImageResource(R.drawable.icon_scan);
// scanText.setTextColor(ArmsUtils.getColor(MainActivity.this, R.color.white));
// messageText.setTextColor(ArmsUtils.getColor(MainActivity.this, R.color.white));
// title.setTextColor(ArmsUtils.getColor(MainActivity.this, R.color.white));
break;
case R.id.my:
if (ObjectUtils.isEmpty(myFragment)) {
myFragment = MyFragment.newInstance();
fragments.add(myFragment);
hideOthersFragment(myFragment, true);
} else {
hideOthersFragment(myFragment, false);
}
// messageImg.setImageResource(R.drawable.icon_news_b);
// scanImg.setImageResource(R.drawable.icon_scan_bb);
// scanText.setTextColor(ArmsUtils.getColor(MainActivity.this, R.color.black_333));
// messageText.setTextColor(ArmsUtils.getColor(MainActivity.this, R.color.black_333));
// title.setTextColor(ArmsUtils.getColor(MainActivity.this, R.color.black_333));
break;
default:
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
});
}
@Override
public void showLoading(boolean showLoading) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.snackbarText(message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
/**
* 动态显示Fragment
*
* @param showFragment 要增加的fragment
* @param add true:增加fragment;false:切换fragment
*/
private void hideOthersFragment(Fragment showFragment, boolean add) {
transition = fragmentManager.beginTransaction();
transition.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
if (add) {
transition.add(R.id.content, showFragment);
}
for (Fragment fragment : fragments) {
if (showFragment.equals(fragment)) {
transition.show(fragment);
} else {
transition.hide(fragment);
}
}
transition.commit();
}
}
|
package com.tencent.mm.ui;
import android.view.View;
import android.view.View.OnClickListener;
class HomeUI$24 implements OnClickListener {
final /* synthetic */ HomeUI tjS;
final /* synthetic */ boolean tjW;
HomeUI$24(HomeUI homeUI, boolean z) {
this.tjS = homeUI;
this.tjW = z;
}
public final void onClick(View view) {
HomeUI.e(this.tjS).dZ();
if (this.tjW) {
HomeUI.a(this.tjS, Boolean.valueOf(true), Boolean.valueOf(true));
} else {
HomeUI.a(this.tjS, Boolean.valueOf(true), Boolean.valueOf(false));
}
}
}
|
package services.repository;
import model.domain.Attachment;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface AttachmentRepository extends CrudRepository<Attachment, Long> {
List<Attachment> findAllByIsDirectoryAndParent(Integer isDirectory, Integer parent);
Attachment findByPathEquals(String path);
}
|
package com.wlc.ds.tree;
public class GetNearestAncestor {
/*
* 返回两个节点的最低公共祖先 解法1:如果一个在左子树,一个在右子树,那么node就是公共结点 如果都在左(右)子树,那么递归到左(右)子树
* 解法2:从根节点分别遍历到n1和n2,使用list来保存两条路径,再依次逆序比较两条路径, 第一个相同的结点就是最近的公共结点
*/
public static TreeNode getNearestAncestorHelper(TreeNode node,
TreeNode n1, TreeNode n2) {
if (node == null || n1 == null || n2 == null)
return null;
boolean isN1InLeft = findNode(node.leftChild, n1);
boolean isN2InLeft = findNode(node.leftChild, n2);
if (isN1InLeft != isN2InLeft)
return node;
TreeNode childSide = isN1InLeft ? node.leftChild:node.rightChild;
return getNearestAncestorHelper(childSide, n1, n2);
}
/*
* 在node子树中查找toFind结点,找到返回true,否则返回false
*/
public static boolean findNode(TreeNode node, TreeNode toFind) {
if (node == null || toFind == null) {
return false;
}
if (node == toFind)
return true;
return findNode(node.leftChild, toFind) || findNode(node.rightChild, toFind);
}
public static TreeNode getNearestAncestor(TreeNode root,TreeNode p,TreeNode q){
if(! findNode(root, p) || !findNode(root, q)){
return null;
}
return getNearestAncestorHelper(root, p, q);
}
}
|
package com.abraham.dj.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import com.abraham.dj.dao.UserDao;
import com.abraham.dj.model.User;
import com.abraham.dj.service.IUserService;
@Service(value="userService")
@Repository(value="userService")
public class UserService extends BaseService implements IUserService {
private static final Logger logger = LoggerFactory.getLogger(UserService.class);
private UserDao userDao;
public UserDao getAdminDao() {
return userDao;
}
@Resource
public void setAdminDao(UserDao userDao) {
this.userDao = userDao;
}
@Override
public Object get(Object object) {
return userDao.get((User)object);
}
@Override
public List<User> getAll() {
return userDao.getAllUser();
}
@Override
public int checkUser(User user) {
return userDao.checkUser(user);
}
}
|
package pharmacy_java;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import net.proteanit.sql.DbUtils;
public class Company extends javax.swing.JFrame {
public Company() {
initComponents();
SelectMed();
}
Connection Con = null;
Statement St = null;
ResultSet Rs = null;
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
CompId = new javax.swing.JTextField();
compphone = new javax.swing.JTextField();
Compadd = new javax.swing.JTextField();
Compname = new javax.swing.JTextField();
Addbtn = new javax.swing.JButton();
UpdateBtn = new javax.swing.JButton();
DeleteBtn = new javax.swing.JButton();
Clearbtn = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
CompTable = new javax.swing.JTable();
compexp = new javax.swing.JTextField();
AgentLbl = new javax.swing.JLabel();
MedLbl = new javax.swing.JLabel();
SellingLbl = new javax.swing.JLabel();
CloseAppBtn = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBackground(new java.awt.Color(23, 68, 13));
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 25)); // NOI18N
jLabel10.setForeground(new java.awt.Color(23, 68, 13));
jLabel10.setText("Компании");
jLabel11.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel11.setText("Код");
jLabel12.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel12.setText("Адрес");
jLabel13.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel13.setText("Наименование");
jLabel14.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel14.setText("Стаж");
jLabel15.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel15.setText("Телефон");
CompId.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N
compphone.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N
compphone.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
compphoneActionPerformed(evt);
}
});
Compadd.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N
Compname.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N
Addbtn.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
Addbtn.setForeground(new java.awt.Color(23, 68, 13));
Addbtn.setText("Сохранить");
Addbtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
AddbtnMouseClicked(evt);
}
});
UpdateBtn.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
UpdateBtn.setForeground(new java.awt.Color(23, 68, 13));
UpdateBtn.setText("Изменить");
UpdateBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
UpdateBtnMouseClicked(evt);
}
});
DeleteBtn.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
DeleteBtn.setForeground(new java.awt.Color(23, 68, 13));
DeleteBtn.setText("Удалить");
DeleteBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
DeleteBtnMouseClicked(evt);
}
});
Clearbtn.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
Clearbtn.setForeground(new java.awt.Color(23, 68, 13));
Clearbtn.setText("Очистить");
Clearbtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ClearbtnMouseClicked(evt);
}
});
CompTable.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
CompTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null}
},
new String [] {
"Код", "Наименование", "Адрес", "Стаж", "Телефон"
}
));
CompTable.setIntercellSpacing(new java.awt.Dimension(0, 0));
CompTable.setRowHeight(25);
CompTable.setSelectionBackground(new java.awt.Color(0, 102, 0));
CompTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
CompTableMouseClicked(evt);
}
});
jScrollPane1.setViewportView(CompTable);
compexp.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N
compexp.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
compexpActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(53, 53, 53)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 747, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(Compadd, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Compname, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(CompId, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel15)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(compexp, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(compphone, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(56, 56, 56))))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(154, 154, 154)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(198, 198, 198)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(Addbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(UpdateBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(DeleteBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Clearbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(43, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel10)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel11))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(compexp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(compphone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Compname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(28, 28, 28)
.addComponent(jLabel12))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(CompId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(74, 74, 74)
.addComponent(Compadd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(31, 31, 31)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Addbtn)
.addComponent(UpdateBtn)
.addComponent(DeleteBtn)
.addComponent(Clearbtn))
.addGap(35, 35, 35)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))
);
AgentLbl.setFont(new java.awt.Font("Sylfaen", 2, 20)); // NOI18N
AgentLbl.setForeground(new java.awt.Color(255, 255, 255));
AgentLbl.setText("Сотрудники");
AgentLbl.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
AgentLblMouseClicked(evt);
}
});
MedLbl.setFont(new java.awt.Font("Sylfaen", 2, 20)); // NOI18N
MedLbl.setForeground(new java.awt.Color(255, 255, 255));
MedLbl.setText("Лекарства");
MedLbl.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
MedLblMouseClicked(evt);
}
});
SellingLbl.setFont(new java.awt.Font("Sylfaen", 2, 20)); // NOI18N
SellingLbl.setForeground(new java.awt.Color(255, 255, 255));
SellingLbl.setText("Продажи");
SellingLbl.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
SellingLblMouseClicked(evt);
}
});
CloseAppBtn.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
CloseAppBtn.setForeground(new java.awt.Color(255, 255, 255));
CloseAppBtn.setText("x");
CloseAppBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
CloseAppBtnMouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(CloseAppBtn)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(MedLbl, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(SellingLbl, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(44, 44, 44))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(AgentLbl, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)))
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(93, 93, 93))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(CloseAppBtn)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(82, 82, 82)
.addComponent(AgentLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(MedLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(SellingLbl)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 1012, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
public void SelectMed()
{
try{
Con = DriverManager.getConnection("Parmacydb; User1; 1234");
St = Con.createStatement();
Rs = St.executeQuery("Select * from User1.COMPANYTBL");
CompTable.setModel(DbUtils.resultSetToTableModel(Rs));
} catch (SQLException e){
e.printStackTrace();
}
}
private void compphoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compphoneActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_compphoneActionPerformed
private void compexpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compexpActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_compexpActionPerformed
private void AddbtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_AddbtnMouseClicked
try{
Con = DriverManager.getConnection("Parmacydb; User1; 1234");
PreparedStatement add = Con.prepareStatement("insert into COMPANYTBL values(?,?,?,?,?)");
add.setInt(1, Integer.valueOf(CompId.getText()));
add.setString(2, Compname.getText());
add.setString(3, Compadd.getText());
add.setInt(4, Integer.valueOf(compexp.getText()));
add.setString(5, compphone.getText());
int row = add.executeUpdate();
JOptionPane.showMessageDialog(this, "Company successfully added ");
Con.close();
SelectMed();
}
catch (SQLException e){
e.printStackTrace();
} // TODO add your handling code here:
}//GEN-LAST:event_AddbtnMouseClicked
private void DeleteBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DeleteBtnMouseClicked
if (CompId.getText().isEmpty())
{
JOptionPane.showMessageDialog(this, "Enter the agent to be deleted");
}
else {
try{
Con = DriverManager.getConnection("Parmacydb; User1; 1234");
String Id = CompId.getText();
String Query = "Delete from User1.COMPANYTBL value COMPID="+Id;
Statement Add = Con.createStatement();
Add.executeUpdate(Query);
SelectMed();
JOptionPane.showMessageDialog(this, "Company deleted succesfully");
}catch(SQLException e){
e.printStackTrace();
}
}
}//GEN-LAST:event_DeleteBtnMouseClicked
private void CompTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CompTableMouseClicked
DefaultTableModel model = (DefaultTableModel)CompTable.getModel();
int Myindex = CompTable.getSelectedRow();
CompId.setText(model.getValueAt(Myindex, 0).toString());
Compname.setText(model.getValueAt(Myindex, 1).toString());
Compadd.setText(model.getValueAt(Myindex, 2).toString());
compexp.setText(model.getValueAt(Myindex, 3).toString());
compphone.setText(model.getValueAt(Myindex, 3).toString());
}//GEN-LAST:event_CompTableMouseClicked
private void ClearbtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ClearbtnMouseClicked
CompId.setText("");
Compname.setText("");
Compadd.setText("");
compexp.setText("");
compphone.setText("");
}//GEN-LAST:event_ClearbtnMouseClicked
private void UpdateBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_UpdateBtnMouseClicked
if(CompId.getText().isEmpty() || Compname.getText().isEmpty() || Compadd.getText().isEmpty() || compexp.getText().isEmpty()|| compphone.getText().isEmpty())
{
JOptionPane.showMessageDialog(this, "Missing information");
}
else {
try{
Con = DriverManager.getConnection("Parmacydb; User1; 1234");
String UpdateQuery = "Update User1.COMPANYTBL set COMPNAME = '" + Compname.getText()+ "'" +", COMPAD= " + Compadd.getText()+""+",COMPPHONE = " + compphone.getText()+""+", COMPEXP = '" + compexp.getText()+"'"+"where COMPID = "+ CompId.getText();
Statement Add = Con.createStatement();
Add.executeUpdate(UpdateQuery);
JOptionPane.showMessageDialog(this, "Company update successfully");
}catch(SQLException e){
e.printStackTrace();
}
SelectMed();
}
}//GEN-LAST:event_UpdateBtnMouseClicked
private void AgentLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_AgentLblMouseClicked
new Agents().setVisible(true);
this.dispose();
}//GEN-LAST:event_AgentLblMouseClicked
private void MedLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MedLblMouseClicked
new Medicine().setVisible(true);
this.dispose();
}//GEN-LAST:event_MedLblMouseClicked
private void CloseAppBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CloseAppBtnMouseClicked
System.exit(0);
}//GEN-LAST:event_CloseAppBtnMouseClicked
private void SellingLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SellingLblMouseClicked
new Selling().setVisible(true);
this.dispose();
}//GEN-LAST:event_SellingLblMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Company.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Company.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Company.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Company.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Company().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Addbtn;
private javax.swing.JLabel AgentLbl;
private javax.swing.JButton Clearbtn;
private javax.swing.JLabel CloseAppBtn;
private javax.swing.JTextField CompId;
private javax.swing.JTable CompTable;
private javax.swing.JTextField Compadd;
private javax.swing.JTextField Compname;
private javax.swing.JButton DeleteBtn;
private javax.swing.JLabel MedLbl;
private javax.swing.JLabel SellingLbl;
private javax.swing.JButton UpdateBtn;
private javax.swing.JTextField compexp;
private javax.swing.JTextField compphone;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
|
/**
* Common Package. <br>
*/
package com.conn.request;
/**
* <p>Wrapping Request Data formmed Byte Array.</p>
*
* @since 1.00
*/
public class RequestData
{
private boolean asyncMode;
private boolean printImmediate;
private byte[] requestData;
private boolean encryptMode;
public RequestData(byte [] requestData)
{
this.requestData = requestData;
this.asyncMode = false;
this.printImmediate = false;
this.encryptMode = false;
}
public RequestData(byte [] requestData, boolean encryptMode)
{
this.requestData = requestData;
this.encryptMode = encryptMode;
this.asyncMode = false;
this.printImmediate = false;
}
public RequestData(byte[] requestData, boolean encryptMode, boolean asyncMode)
{
this.requestData = requestData;
this.encryptMode = encryptMode;
this.asyncMode = asyncMode;
this.printImmediate = false;
}
public RequestData(byte [] requestData, boolean encryptMode, boolean asyncMode, boolean printImmediate)
{
this.requestData = requestData;
this.encryptMode = encryptMode;
this.asyncMode = asyncMode;
this.printImmediate = printImmediate;
}
public boolean isPrintImmediate()
{
return printImmediate;
}
public byte[] getRequestData()
{
return requestData;
}
public boolean getAsyncMode()
{
return asyncMode;
}
public boolean getEncryptMode()
{
return encryptMode;
}
}
|
package tachyon.master;
import java.io.DataOutputStream;
import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.google.common.base.Throwables;
/**
* Class implemented this interface will be able to write image file.
*/
public abstract class ImageWriter {
/**
* Write image to the specified DataOutputStream. Use the specified ObjectWriter.
*
* @param objWriter The used object writer
* @param dos The target data output stream
* @throws IOException
*/
abstract void writeImage(ObjectWriter objWriter, DataOutputStream dos) throws IOException;
/**
* Write an ImageElement to the specified DataOutputStream. Use the specified ObjectWriter.
*
* @param objWriter The used object writer
* @param dos The target data output stream
* @param ele The image element to be written
*/
protected void writeElement(ObjectWriter objWriter, DataOutputStream dos, ImageElement ele) {
try {
objWriter.writeValue(dos, ele);
dos.writeByte('\n');
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
}
|
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package ad.joyplus.com.myapplication.compoment;
import android.content.Context;
import android.util.AttributeSet;
import ad.joyplus.com.myapplication.entity.ImageViewModel;
import ad.joyplus.com.myapplication.managers.AppADSDKManager;
public class CornerImageView extends BaseComponent implements IComponent {
private ImageViewModel cornerModel;
public CornerImageView(Context context) {
super(context);
this.disPlay();
}
public CornerImageView(Context context, AttributeSet attrs) {
super(context, attrs);
this.disPlay();
}
public CornerImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.disPlay();
}
public void disPlay() {
this.cornerModel = AppADSDKManager.getInstance(this.mContext).getCornerImgModel();
if(!cornerModel.getImpressionurl().isEmpty()) {
reportInfo(cornerModel.getImpressionurl(), cornerModel);
}
if(this.cornerModel.getImageurl() != null) {
this.request.getImgFromGlide(this, this.cornerModel.getImageurl(), this.mContext);
}
}
public void removeclick() {
this.setOnClickListener((OnClickListener)null);
}
}
|
package persistence;
// Code partly taken from JsonSerializationDemo
import org.json.JSONObject;
//Represents interface return this as a Json Object
public interface Writable {
// EFFECTS: returns this as JSON object
JSONObject toJson();
}
|
package com.jtmelton.testme;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TestmeApplication {
public static void main(String[] args) {
SpringApplication.run(TestmeApplication.class, args);
}
}
|
package de.zarncke.lib.util;
import java.util.Locale;
/**
* Declare the Locale of an Object.
*
* @author Gunnar Zarncke
*/
public interface HasLocale {
Locale getLocale();
}
|
public class Main {
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.addFirst(3);
list.addLast(2);
list.insert(5, 1);
list.insert(1, 1);
list.removeFirst();
list.remove(2);
list.insert(3,2);
list.addLast(44);
list.addFirst(0);
list.remove(3);
list.removeFirst();
list.insert(33333,3);
list.insert(22, 4);
System.out.println("size of the linked list : " + list.size());
System.out.println(list.toString());
}
}
|
package formulaio_mercadinho;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JScrollBar;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.JTextArea;
public class Principal extends JPanel{
public static Object vetorProdutos;
private JTextField textNome;
private JTextField txtQuantidade;
private JTextField txtValor;
/**
* Create the panel.
*/
public Principal() {
setLayout(null);
JLabel lblProduto = new JLabel("Produto:");
lblProduto.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
lblProduto.setBounds(42, 42, 88, 28);
add(lblProduto);
textNome = new JTextField();
textNome.setFont(new Font("Comic Sans MS", Font.PLAIN, 20));
textNome.setBounds(145, 46, 274, 28);
add(textNome);
textNome.setColumns(10);
JLabel lblQuantidade = new JLabel("Quantidade:");
lblQuantidade.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
lblQuantidade.setBounds(10, 81, 120, 28);
add(lblQuantidade);
txtQuantidade = new JTextField();
txtQuantidade.setFont(new Font("Comic Sans MS", Font.PLAIN, 20));
txtQuantidade.setBounds(145, 81, 274, 28);
add(txtQuantidade);
txtQuantidade.setColumns(10);
txtValor = new JTextField();
txtValor.setFont(new Font("Comic Sans MS", Font.PLAIN, 20));
txtValor.setBounds(145, 120, 274, 28);
add(txtValor);
txtValor.setColumns(10);
JLabel lblValor = new JLabel("Valor:");
lblValor.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
lblValor.setBounds(70, 120, 60, 28);
add(lblValor);
}
}
|
package org.springframework.boot.autoconfigure.bootswaggermvc;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import(LightAdminAutoConfig.class)
public @interface EnableLightAdmin {
}
|
package gil.action;
import bol.BOLObject;
import gil.MainFrame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ButGeneration implements ActionListener {
private BOLObject obj;
private MainFrame frame;
public ButGeneration(BOLObject obj, MainFrame mainFrame) {
this.obj = obj;
this.frame = mainFrame;
}
@Override
public void actionPerformed(ActionEvent event) {
if (obj.getStep().getRemainingTime() != 0) {
if (obj.getStep().getActualStepNumber() != 0) {
obj.getStep().setRemainingTime(obj.getStep().getRemainingTime() - 1);
}
if (!(obj.getTab().getX() > 49 && obj.getTab().getY() > 49)) {
frame.getPanPara().getButGeneration().setVisible(false);
}
this.obj.getStep().start(obj, frame);
if (!(obj.getTab().getX() > 49 && obj.getTab().getY() > 49)) {
frame.getPanPara().getButPause().setVisible(true);
}
}
}
}
|
package com.filiereticsa.arc.augmentepf.adapters;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import com.filiereticsa.arc.augmentepf.R;
import com.filiereticsa.arc.augmentepf.activities.HomePageActivity;
import com.filiereticsa.arc.augmentepf.fragments.CameraFragment;
import com.filiereticsa.arc.augmentepf.localization.LocalizationFragment;
import com.filiereticsa.arc.augmentepf.models.Place;
import java.util.ArrayList;
/**
* Created by ARC© Team for AugmentEPF project on 21/05/2017.
*/
public class SearchListAdapter extends ArrayAdapter<Place> implements SharedPreferences.OnSharedPreferenceChangeListener {
public SearchListAdapter(Context context, ArrayList<Place> list) {
super(context, 0, list);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
notifyDataSetChanged();
}
public View getView(int position, View view, ViewGroup parent) {
if (view == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.item_search_list, parent, false);
}
final Place place = getItem(position);
TextView name = (TextView) view.findViewById(R.id.room_name);
if (place != null) {
name.setText(place.getName());
Button button = (Button) view.findViewById(R.id.place_button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HomePageActivity.destinationSelectedInterface.onDestinationSelected(place);
LocalizationFragment.destinationSelectedInterface.onDestinationSelected(place);
CameraFragment.destinationSelectedInterface.onDestinationSelected(place);
}
});
}
return view;
}
}
|
package com.quizcore.quizapp.util;
public enum UserAction {
START_QUIZ,
SUBMIT_QUIZ,
UPLOAD_VIDEO,
PAYMENT_DONE
}
|
package com.ddt.bean;
import java.util.HashSet;
import java.util.Set;
/**
* Course entity. @author MyEclipse Persistence Tools
*/
public class Course implements java.io.Serializable {
// Fields
private Integer eid;
private String ename;
private String tname;
private Integer zyid;
private Set scores = new HashSet(0);
// Constructors
/** default constructor */
public Course() {
}
/** minimal constructor */
public Course(Integer eid, Integer zyid) {
this.eid = eid;
this.zyid = zyid;
}
/** full constructor */
public Course(Integer eid, String ename, String tname, Integer zyid,
Set scores) {
this.eid = eid;
this.ename = ename;
this.tname = tname;
this.zyid = zyid;
this.scores = scores;
}
// Property accessors
public Integer getEid() {
return this.eid;
}
public void setEid(Integer eid) {
this.eid = eid;
}
public String getEname() {
return this.ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public String getTname() {
return this.tname;
}
public void setTname(String tname) {
this.tname = tname;
}
public Integer getZyid() {
return this.zyid;
}
public void setZyid(Integer zyid) {
this.zyid = zyid;
}
public Set getScores() {
return this.scores;
}
public void setScores(Set scores) {
this.scores = scores;
}
}
|
package Lesson8;
class Wall implements Obstacles {
int height;
public Wall(int height) {
this.height = height;
}
public int getHeight() {
return height;
}
@Override
public boolean toRun(int maxLength) {
return false;
}
@Override
public boolean toJump(int maxJump) {
return (maxJump >= getHeight());
}
public String toString() {
return ("стену высотой " + getHeight() + "м.");
}
}
|
package ar.edu.ucc.arqSoft.rentService.test.dao;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import ar.edu.ArqSoft.rentService.Service.dao.AlquilerDao;
import ar.edu.ArqSoft.rentService.Service.dao.SocioDao;
import ar.edu.ArqSoft.rentService.Service.model.Alquiler;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.junit.Assert;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:test-context.xml", "classpath:/spring/applicationContext.xml" })
@Transactional
public class AlquilerDaoTest{
private static final Logger logger = LogManager.getLogger(AlquilerDaoTest.class);
@Autowired
private AlquilerDao alquilerDao;
@Test
public void testRegister() {
logger.info("Test de Registro de State");
Alquiler alquiler = new Alquiler();
alquiler.setPelicula("Juego de gemelas"); // como hago aca?
alquilerDao.insert(alquiler);
// Assert.assertEquals());// y aca?
return;
}
}
|
package so.ego.space.domains.project.application;
import lombok.RequiredArgsConstructor;
import org.apache.tomcat.jni.Local;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import so.ego.space.domains.project.application.dto.ProjectRegisterRequest;
import so.ego.space.domains.project.application.dto.ProjectRegisterResponse;
import so.ego.space.domains.project.domain.*;
import so.ego.space.domains.user.domain.User;
import so.ego.space.domains.user.domain.UserRepository;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Optional;
@RequiredArgsConstructor
@Service
public class ProjectRegisterService {
private final ProjectRepository projectRepository;
private final MemberRepository memberRepository;
private final UserRepository userRepository;
@Transactional
public ProjectRegisterResponse addProject(ProjectRegisterRequest projectRegisterRequest){
System.out.println(projectRegisterRequest.getUser_id());
// 프로젝트 생성
Project project = projectRepository.save(
Project.builder()
.name(projectRegisterRequest.getName())
.content(projectRegisterRequest.getContent())
.start_date(LocalDate.parse(projectRegisterRequest.getStart_date(), DateTimeFormatter.ISO_DATE))
.end_date(LocalDate.parse(projectRegisterRequest.getEnd_date(), DateTimeFormatter.ISO_DATE))
.build()
);
// 멤버 추가
addMember(project, projectRegisterRequest.getUser_id());
return ProjectRegisterResponse.builder()
.id(project.getId())
.name(project.getName())
.content(project.getContent())
.start_date(project.getStart_date())
.end_date(project.getEnd_date())
.user_id(projectRegisterRequest.getUser_id())
.build();
}
private void addMember(Project project, Long user_id){
User user = userRepository.findById(user_id).orElseThrow(
() -> new IllegalArgumentException("invalid user_id."));
memberRepository.save(
Member.builder()
.project(project)
.user(user)
.level(MemberLevel.LEADER)
.build()
);
}
}
|
/*
* 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 Vista;
import Modelo.Grupo;
import Negocio.ControladorGrupo;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumnModel;
/**
*
* @author mingo
*/
public class FrmPrincipal extends javax.swing.JFrame {
DefaultTableModel dtm;
List<Grupo> lstGrupo;
/**
* Creates new form FrmPrincipal
*/
public FrmPrincipal() {
initComponents();
llenarTablaGrupos();
}
private void llenarTablaGrupos()
{
ControladorGrupo cg = new ControladorGrupo();
lstGrupo = cg.obtGrupos();
String[] cols = new String[]
{
"ID Alumno", "Nombre", "Grupo", "Promedio"
};
dtm = new DefaultTableModel(){
public boolean isCellEditable(int row, int column) {
return false;
}
};
dtm.setColumnIdentifiers(cols);
dtm.setRowCount(lstGrupo.size());
for (int i = 0; i < lstGrupo.size(); i++)
{
dtm.setValueAt(lstGrupo.get(i).getIdAlumno(), i, 0);
dtm.setValueAt(lstGrupo.get(i).getNombre(), i, 1);
dtm.setValueAt(lstGrupo.get(i).getGrupo(), i, 2);
dtm.setValueAt(lstGrupo.get(i).getPromedio(), i, 3);
}
tblGrupo.setModel(dtm);
tblGrupo.getTableHeader().setReorderingAllowed(false);
}
public void obtenerAlumno()
{
ControladorGrupo cg = new ControladorGrupo();
Grupo g = new Grupo();
g = cg.obtAlumno(Integer.parseInt(txtID.getText()));
txtNombre.setText(g.getNombre());
txtGrupo.setText(g.getGrupo());
txtPromedio.setText(String.valueOf(g.getPromedio()));
}
private void validarNumerosEnteros(java.awt.event.KeyEvent evt, String textoCaja)
{
try {
char c = evt.getKeyChar();
if (c<'0' || c>'9')
{
evt.consume();
}
} catch (Exception ex) {
Logger.getLogger(FrmPrincipal.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void validarNumeros(java.awt.event.KeyEvent evt, String textoCaja)
{
try {
char c;
c=evt.getKeyChar();
int punto=textoCaja.indexOf(".")+1;
if (punto==0)
{
if (!Character.isDigit(c) && c!=KeyEvent.VK_BACK_SPACE && c!=KeyEvent.VK_PERIOD)
{
getToolkit().beep();
evt.consume();
}
}
else
{
if (!Character.isDigit(c) && c!=KeyEvent.VK_BACK_SPACE)
{
getToolkit().beep();
evt.consume();
}
}
} catch (Exception ex) {
Logger.getLogger(FrmPrincipal.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
btnAgregar = new javax.swing.JButton();
btnEditar = new javax.swing.JButton();
btnLimpiar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tblGrupo = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txtPromedio = new javax.swing.JTextField();
txtGrupo = new javax.swing.JTextField();
txtNombre = new javax.swing.JTextField();
txtID = new javax.swing.JTextField();
btnBuscar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
btnAgregar.setText("Agregar");
btnAgregar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAgregarActionPerformed(evt);
}
});
btnEditar.setText("Editar");
btnLimpiar.setText("Limpiar");
btnLimpiar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLimpiarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(btnAgregar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnEditar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnLimpiar)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnAgregar)
.addComponent(btnEditar)
.addComponent(btnLimpiar))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
tblGrupo.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tblGrupo);
jLabel1.setText("ID:");
jLabel2.setText("Grupo");
jLabel3.setText("Nombre");
jLabel4.setText("Promedio");
txtPromedio.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtPromedioKeyTyped(evt);
}
});
txtID.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtIDKeyTyped(evt);
}
});
btnBuscar.setText("Buscar");
btnBuscar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBuscarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtPromedio, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtGrupo, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(txtID, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnBuscar)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(txtID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtGrupo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtPromedio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
obtenerAlumno();
}//GEN-LAST:event_btnBuscarActionPerformed
private void btnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimpiarActionPerformed
txtID.setText("");
txtNombre.setText("");
txtGrupo.setText("");
txtPromedio.setText("");
}//GEN-LAST:event_btnLimpiarActionPerformed
private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
try
{
Grupo g = new Grupo();
ControladorGrupo cg = new ControladorGrupo();
g.setNombre(txtNombre.getText());
g.setGrupo(txtGrupo.getText());
g.setPromedio(Double.parseDouble(txtPromedio.getText()));
cg.insertarAlumno(g);
JOptionPane.showMessageDialog(null,"Alumno insertado correctamente","Mensaje",JOptionPane.INFORMATION_MESSAGE);
llenarTablaGrupos();
} catch (Exception e) {
e.printStackTrace();
}
}//GEN-LAST:event_btnAgregarActionPerformed
private void txtPromedioKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPromedioKeyTyped
validarNumeros(evt, txtPromedio.getText());
}//GEN-LAST:event_txtPromedioKeyTyped
private void txtIDKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtIDKeyTyped
validarNumerosEnteros(evt, txtID.getText());
}//GEN-LAST:event_txtIDKeyTyped
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmPrincipal().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAgregar;
private javax.swing.JButton btnBuscar;
private javax.swing.JButton btnEditar;
private javax.swing.JButton btnLimpiar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblGrupo;
private javax.swing.JTextField txtGrupo;
private javax.swing.JTextField txtID;
private javax.swing.JTextField txtNombre;
private javax.swing.JTextField txtPromedio;
// End of variables declaration//GEN-END:variables
}
|
package com.koreait.bbs.model;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class GoInsertBBSPage implements Action {
@Override
public String command(HttpServletRequest request, HttpServletResponse response) {
return "bbs/insert_page.jsp";
}
}
|
package cr.ulacit.dao;
import org.appfuse.dao.BaseDaoTestCase;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
public class DishDaoTest extends BaseDaoTestCase {
//mvn test -Dtest=PersonDaoTest
@Autowired
private DishDao dishdao;
@Test
public void testCreateDish() throws Exception{
System.out.println("testing create Dish...");
dishdao.createDish("Arroz con pollo", "mediano", "arroz con pollo y verduras");
}
@Test
public void testGetDish() throws Exception{
System.out.println("testing get Dish...");
dishdao.getDish(1);
}
@Test
public void testUpdateDish() throws Exception{
System.out.println("Testing update Dish...");
dishdao.updateDish(3, "Pasta", "Pequeño", "pasta con atún");
}
@Test
public void testDeleteDish() throws Exception{
System.out.println("Testing delete Dish...");
dishdao.deleteDish(3);
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.commerceservices.customer.impl;
import static de.hybris.platform.servicelayer.util.ServicesUtil.validateParameterNotNullStandardMessage;
import de.hybris.platform.commerceservices.customer.CustomerListService;
import de.hybris.platform.commerceservices.model.CustomerListModel;
import de.hybris.platform.servicelayer.user.UserService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Required;
/**
*
* Concrete implementation for the customer list service interface
*
*/
public class DefaultCustomerListService implements CustomerListService
{
private UserService userService;
@Override
public List<CustomerListModel> getCustomerListsForEmployee(final String employeeUid)
{
validateParameterNotNullStandardMessage("employeeUid", employeeUid);
final List<CustomerListModel> customerLists = new ArrayList<CustomerListModel>();
customerLists.addAll(
getUserService().getAllUserGroupsForUser(getUserService().getUserForUID(employeeUid), CustomerListModel.class));
Collections.sort(customerLists,
(customerList1, customerList2) -> customerList2.getPriority().compareTo(customerList1.getPriority()));
return customerLists;
}
@Override
public CustomerListModel getCustomerListForEmployee(final String customerListUid, final String employeeUid)
{
validateParameterNotNullStandardMessage("customerListUid", customerListUid);
validateParameterNotNullStandardMessage("employeeUid", employeeUid);
final CustomerListModel customerListModel = getUserService().getUserGroupForUID(customerListUid, CustomerListModel.class);
if (!getUserService().isMemberOfGroup(userService.getUserForUID(employeeUid), customerListModel))
{
return null;
}
return customerListModel;
}
protected UserService getUserService()
{
return userService;
}
@Required
public void setUserService(final UserService userService)
{
this.userService = userService;
}
}
|
package testSel.testSelVal;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class callIEBrowser {
public static void main(String[] args) {
WebDriver driver;
System.setProperty("webdriver.ie.driver","D:\\workspace\\Drivers\\IEDriverServer.exe");
// DesiredCapabilities capabilities = new DesiredCapabilities();
/* capabilities = DesiredCapabilities.firefox();
capabilities.setBrowserName("firefox");
capabilities.setVersion("47.0.2");
capabilities.setPlatform(Platform.WINDOWS);
capabilities.setCapability("marionette", false);*/
driver=new InternetExplorerDriver();
String baseURL="https://www.google.com/";
driver.get(baseURL);
/* DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
caps.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
caps.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, false);
caps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
caps.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
System.setProperty("webdriver.ie.driver",
"\\workspace\\SeleniumWD2Tutorial\\libs\\IEDriverServer.exe");
driver = new InternetExplorerDriver(caps);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get(baseURL);*/
}
}
|
package com.minipg.fanster.armoury.fragment;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.ShareActionProvider;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.minipg.fanster.armoury.R;
import com.minipg.fanster.armoury.dao.TopicItemDao;
import com.minipg.fanster.armoury.dao.UserDao;
import com.minipg.fanster.armoury.manager.HttpManager;
import com.minipg.fanster.armoury.manager.bus.Contextor;
import com.minipg.fanster.armoury.object.User;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Created by nuuneoi on 11/16/2014.
*/
@SuppressWarnings("unused")
public class TopicFragment extends Fragment {
private View mView;
private TextView tvTitle;
private TextView tvAuthor;
private TextView tvDate;
private TextView tvDescribtion;
private TextView tvLike;
private Bundle topic;
private TextView tvLink;
final String KEY_HEAD = "head";
final String KEY_DESC = "desc";
final String KEY_LINK = "link";
final String KEY_LIKE = "like";
final String KEY_POSTER = "author";
final String KEY_DATE = "date";
final String KEY_ID = "topicId";
private TopicItemDao dao;
private SwipeRefreshLayout swipeRefreshLayout;
private FloatingActionButton fabLike;
private String strId;
public TopicFragment() {
super();
}
@SuppressWarnings("unused")
public static TopicFragment newInstance(Bundle topicBundle) {
TopicFragment fragment = new TopicFragment();
Bundle args = new Bundle();
if (topicBundle != null)
args.putBundle("topic", topicBundle);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(savedInstanceState);
Bundle bundle = getArguments();
topic = new Bundle();
if (bundle != null)
topic = bundle.getBundle("topic");
if (savedInstanceState != null)
onRestoreInstanceState(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_topic, container, false);
return rootView;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initInstances(view, savedInstanceState);
}
private void init(Bundle savedInstanceState) {
// Init Fragment level's variable(s) here
setHasOptionsMenu(true);
}
@Override
public void onResume() {
super.onResume();
loadData();
}
@SuppressWarnings("UnusedParameters")
private void initInstances(View rootView, Bundle savedInstanceState) {
// Init 'View' instance(s) with rootView.findViewById here
mView = rootView;
tvTitle = (TextView) rootView.findViewById(R.id.tvTitle);
tvAuthor = (TextView) rootView.findViewById(R.id.tvAuthor);
tvDate = (TextView) rootView.findViewById(R.id.tvDate);
tvDescribtion = (TextView) rootView.findViewById(R.id.tvStory);
tvLike = (TextView) rootView.findViewById(R.id.tvLiked);
tvLink = (TextView) rootView.findViewById(R.id.tvLink);
fabLike = (FloatingActionButton) rootView.findViewById(R.id.fabLike);
SharedPreferences sharedPref = getActivity().getSharedPreferences("sharedUserID", getActivity().MODE_PRIVATE);
strId = sharedPref.getString("userID", "");
if (topic != null) {
initView(topic.getString(KEY_HEAD),
topic.getString(KEY_POSTER),
topic.getLong(KEY_DATE),
topic.getString(KEY_DESC),
topic.getString(KEY_LINK),
topic.getInt(KEY_LIKE));
}
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeRefreshTopic);
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
loadData();
showToast("Refreshed");
}
});
addView(topic.getString(KEY_ID));
loadData();
fabLike.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
like();
}
});
//if (savedInstanceState == null)
}
private void addView(String id) {
if (id != null) {
Call<String> call = HttpManager.getInstance().getService().addView(id);
call.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()) {
if (response.body().equals("Viewed")) {
//Success
}
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
}
});
}
}
private void like() {
if (dao != null) {
if (dao.getId() != null) {
swipeRefreshLayout.setRefreshing(true);
Call<Boolean> call = HttpManager.getInstance().getService().likeTopic(strId, dao.getId());
call.enqueue(new Callback<Boolean>() {
@Override
public void onResponse(Call<Boolean> call, Response<Boolean> response) {
swipeRefreshLayout.setRefreshing(false);
if (response.isSuccessful()) {
if (response.body()) {
fabLike.setBackgroundTintList(ColorStateList.valueOf(Color
.parseColor("#ffaaaa")));
showToast("Liked");
} else {
fabLike.setBackgroundTintList(ColorStateList.valueOf(Color
.parseColor("#424242")));
showToast("Disliked");
}
loadData();
} else {
try {
showToast(response.errorBody().string());
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void onFailure(Call<Boolean> call, Throwable t) {
swipeRefreshLayout.setRefreshing(false);
showToast("Try again");
}
});
}
}
}
private void initView(String title, String poster, long date, String desc, String link, int score) {
tvTitle.setText(title);
tvAuthor.setText("by " + poster);
tvDate.setText("Posted on " + convertUnixToDate(date));
tvDescribtion.setText(desc);
String html = "Link => <a href =\"" + link + "\">" + link + "</a>";
// String html = "<a href =\"http://www.apple.com\">Test</a>";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
tvLink.setText(Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY));
else
tvLink.setText(Html.fromHtml(html));
tvLink.setMovementMethod(LinkMovementMethod.getInstance());
tvLike.setText(score + " Liked");
}
private void loadData() {
if (topic != null) {
Call<TopicItemDao> call = HttpManager.getInstance().getService().loadTopicById(topic.getString(KEY_ID));
call.enqueue(new Callback<TopicItemDao>() {
@Override
public void onResponse(Call<TopicItemDao> call, Response<TopicItemDao> response) {
swipeRefreshLayout.setRefreshing(false);
if (response.isSuccessful()) {
dao = response.body();
if (dao != null) {
initView(dao.getTitle(), dao.getPoster(), dao.getCreateDate(), dao.getDescription(), dao.getLink(), dao.getScore());
checkLikeState(dao.getUserLike());
}
} else {
try {
showToast(response.errorBody().string());
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void onFailure(Call<TopicItemDao> call, Throwable t) {
swipeRefreshLayout.setRefreshing(false);
showToast("Load Fail");
}
});
}
}
private void checkLikeState(List<String> listUser) {
if (listUser != null) {
for (String user : listUser) {
if (strId.equals(user)) {
fabLike.setBackgroundTintList(ColorStateList.valueOf(Color
.parseColor("#ffaaaa")));
break;
} else {
fabLike.setBackgroundTintList(ColorStateList.valueOf(Color
.parseColor("#424242")));
}
}
}
}
public String convertUnixToDate(Long date) {
Date dateT = new Date();
dateT.setTime(date * 1000L);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm a dd/MM/yyyy");
sdf.setTimeZone(java.util.TimeZone.getTimeZone("GMT-7"));
String formattedDate = sdf.format(dateT);
return formattedDate;
}
@Override
public void onStart() {
super.onStart();
loadData();
}
@Override
public void onStop() {
super.onStop();
}
/*
* Save Instance State Here
*/
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// Save Instance State here
}
/*
* Restore Instance State Here
*/
@SuppressWarnings("UnusedParameters")
private void onRestoreInstanceState(Bundle savedInstanceState) {
// Restore Instance State here
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_topic, menu);
MenuItem menuItem = (MenuItem) menu.findItem(R.id.action_share);
ShareActionProvider shareActionProvider = (ShareActionProvider)
MenuItemCompat.getActionProvider(menuItem);
shareActionProvider.setShareIntent(getSharIntent());
}
private Intent getSharIntent() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
String textTitle = tvTitle.getText() + " " + tvAuthor.getText();
intent.putExtra(Intent.EXTRA_SUBJECT, textTitle);
intent.putExtra(Intent.EXTRA_TITLE, textTitle);
intent.putExtra(Intent.EXTRA_TEXT, tvDescribtion.getText() + "\n" + tvLink.getText());
return intent;
}
private void showToast(String text) {
Toast.makeText(Contextor.getInstance().getContext(),
text,
Toast.LENGTH_SHORT).show();
}
}
|
package jp.personal.server.web.form.user;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import jp.personal.server.data.BaseVisitor;
import jp.personal.server.utils.Msg;
import jp.personal.server.utils.Regex;
public class UserForm extends BaseVisitor {
private static final long serialVersionUID = 1L;
@NotNull(message = Msg.NOT_NULL)
@Pattern(regexp = Regex.EMAIL_AND_TEL, message = Msg.ONLY_TEL_OR_EMAIL)
private String loginId;
@Size(min = 3, max = 30, message = Msg.INPUT_3TO30)
@NotNull(message = Msg.NOT_NULL)
private String name;
@NotNull(message = Msg.NOT_NULL)
@Size(min = 6, max = 30, message = Msg.INPUT_6TO30)
@Pattern(regexp = Regex.PASSWORD, message = Msg.ONLY_EN_OR_NUM)
private String password;
@NotNull(message = Msg.NOT_NULL)
@Size(min = 6, max = 30, message = Msg.INPUT_6TO30)
@Pattern(regexp = Regex.PASSWORD, message = Msg.ONLY_EN_OR_NUM)
private String confirmedPassword;
@Size(min = 0, max = 200, message = Msg.INPUT_TO200)
private String description;
public String getLoginId() {
return loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getConfirmedPassword() {
return confirmedPassword;
}
public void setConfirmedPassword(String confirmedPassword) {
this.confirmedPassword = confirmedPassword;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
package com.choosedormitory;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.dd.CircularProgressButton;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* Created by amoshua on 23/11/2017.
*/
public class LoginActivity extends AppCompatActivity implements NetWorkCallBack{
/**
* Id to identity READ_CONTACTS permission request.
*/
private static final int REQUEST_READ_CONTACTS = 0;
// UI references.
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
private View mLoginFormView;
private CircularProgressButton mEmailSignInButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// Set up the login form.
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
mPasswordView = (EditText) findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
mEmailSignInButton = (CircularProgressButton) findViewById(R.id.email_sign_in_button);
mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
view.setEnabled(false);
attemptLogin();
}
});
mLoginFormView = findViewById(R.id.login_form);
}
private void attemptLogin() {
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
String username = mEmailView.getText().toString();
String password = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
mPasswordView.setError(getString(R.string.error_invalid_password));
focusView = mPasswordView;
cancel = true;
mEmailSignInButton.setProgress(-1);
}
// Check for a valid email address.
if (TextUtils.isEmpty(username)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
mEmailSignInButton.setProgress(-1);
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
Map<String,String> params = new HashMap<>();
params.put("username",username);
params.put("password",password);
NetUtil.GetRequest(NetUtil.URL_LOGIN+"?username="+username+"&password="+password,this);
}
}
private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic
return password.length() > 4;
}
/**
* Shows the progress UI and hides the login form.
*/
@Override
public void Success(JSONObject response) {
mEmailSignInButton.setEnabled(true);
Intent i = new Intent();
int errcode = -1;
try {
errcode = response.getInt("errcode");
if(errcode==0){
if(response.getJSONObject("data").has("errmsg")){
mEmailSignInButton.setProgress(50);
NetUtil.GetRequest(NetUtil.URL_GetDetail+"?stuid="+mEmailView.getText().toString(),this);
}else {
mEmailSignInButton.setProgress(100);
Util.student = Student.getStudent(response.toString());
if(Util.student.getData().getRoom()==null){
i.setClass(this,InfoActivity.class);
}else{
i.setClass(this,FinishActivity.class);
}
startActivity(i);
}
}else{
mEmailSignInButton.setProgress(-1);
// mPasswordView.setError(String.valueOf(errcode));
}
} catch (JSONException e) {
e.printStackTrace();
}
// mPasswordView.setError(getString(R.string.error_incorrect_password));
}
@Override
public void Failure(String response) {
mEmailSignInButton.setEnabled(true);
Toast.makeText(this,response,Toast.LENGTH_SHORT).show();
}
}
|
package com.buildbooster.inventory.transformer;
|
package my;
public class Company {
private String companyName;
private String type;
private Worker[] workers;
private double sumSalaryOfWorkersInThatCompanyIs;
private double arithmeticalMeanOfSalaryOfWorkersInThatCompanyIs;
public void changeMinAndMax() {
int iMax = 0, iMin = 0;
for (int j = 0; j < workers.length; j++) {
if (workers[iMax].getSalary() < workers[j].getSalary()) {
iMax = j;
}
if (workers[iMin].getSalary() > workers[j].getSalary()) {
iMin = j;
}
}
long tmp = workers[iMax].getSalary();
workers[iMax].setSalary(workers[iMin].getSalary());
workers[iMin].setSalary(tmp);
}
}
|
package com.infotec.ses;
import java.util.List;
import java.util.Properties;
import java.util.ArrayList;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
public class RolRepositorio {
Connection con = null;
public RolRepositorio(){
Properties prop= new Properties();
String propFilename="config.properties";
String urldb="";
String usrname="";
String paswd="";
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFilename);
if (inputStream != null) {
try {
prop.load(inputStream);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
urldb= prop.getProperty("db");
usrname= prop.getProperty("usr");
paswd= prop.getProperty("pwd");
try {
Class.forName("org.mariadb.jdbc.Driver");
con = DriverManager.getConnection(urldb, usrname, paswd);
System.out.println("Conexion exitosa");
} catch (SQLException | ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
}
public List<Rol> getRoles() {
List<Rol> roles = new ArrayList<>();
String sql="Select * from infotec.rol";
try {
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(sql);
while (rs.next()) {
Rol r = new Rol();
r.setIdRol(rs.getInt("idRol"));
r.setNombreRol(rs.getString("nombreRol"));
r.setDescripcionRol(rs.getString("descripcionRol"));
roles.add(r);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
return roles;
}
public List<Rol> getRolesName(String nombreRol) {
List<Rol> roles = new ArrayList<>();
String sql="Select * from infotec.rol where nombreRol like '"+nombreRol+"%'";
try {
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(sql);
while (rs.next()) {
Rol r = new Rol();
r.setIdRol(rs.getInt("idRol"));
r.setNombreRol(rs.getString("nombreRol"));
r.setDescripcionRol(rs.getString("descripcionRol"));
roles.add(r);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
return roles;
}
public List<Rol> getRolFuncion(int idFuncion, String aob) {
List<Rol> roles = new ArrayList<>();
String sql;
if ( aob.contains("a") ) {
sql="SELECT rol.* FROM rol WHERE rol.idRol not in (SELECT rolxfun.idRol FROM rolxfun WHERE rolxfun.idFuncion="+Integer.toString(idFuncion)+")";
}
else {
sql="SELECT rol.* FROM rol WHERE rol.idRol in (SELECT rolxfun.idRol FROM rolxfun WHERE rolxfun.idFuncion="+Integer.toString(idFuncion)+")";
}
try {
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(sql);
while (rs.next()) {
Rol r = new Rol();
r.setIdRol(rs.getInt("idRol"));
r.setNombreRol(rs.getString("nombreRol"));
r.setDescripcionRol(rs.getString("descripcionRol"));
// u.setUsr(rs.getString("usr"));
roles.add(r);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
return roles;
}
public Rol getRol(int idRol) {
String sql="Select * from infotec.rol where idRol="+idRol;
Rol r = new Rol();
try {
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(sql);
if (rs.next()) {
r.setIdRol(rs.getInt("idRol"));
r.setNombreRol(rs.getString("nombreRol"));
r.setDescripcionRol(rs.getString("descripcionRol"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
return r;
}
public void create(Rol rol) {
Sesion ses=new Sesion();
String status_ses;
SesionRepositorio reposes= new SesionRepositorio();
ses=reposes.updateSesion(rol.getId());
status_ses=ses.getStatus_ses();
if (status_ses.equals("a")) {
String sql="insert into infotec.rol (nombreRol, descripcionRol) values (?,?)";
try {
PreparedStatement st=con.prepareStatement(sql);
st.setString(1, rol.getNombreRol());
st.setString(2, rol.getDescripcionRol());
st.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
}
else {
rol.setId(0);
}
}
public void update(Rol rol) {
Sesion ses=new Sesion();
String status_ses;
SesionRepositorio reposes= new SesionRepositorio();
ses=reposes.updateSesion(rol.getId());
status_ses=ses.getStatus_ses();
if (status_ses.equals("a")) {
String sql="update infotec.rol set nombreRol=?, descripcionRol=? where idRol=?";
try {
PreparedStatement st=con.prepareStatement(sql);
st.setInt(3, rol.getIdRol());
st.setString(1, rol.getNombreRol());
st.setString(2, rol.getDescripcionRol());
st.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
}
else {
rol.setId(0);
}
}
public void delete(Rol r) {
Sesion ses=new Sesion();
String status_ses;
SesionRepositorio reposes= new SesionRepositorio();
ses=reposes.updateSesion( r.getId());
status_ses=ses.getStatus_ses();
if (status_ses.equals("a")) {
String sql="delete from infotec.rol where idRol=?";
try {
PreparedStatement st=con.prepareStatement(sql);
st.setInt(1, r.getIdRol());
st.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
}
else {
r.setId(0);
r.setIdRol(0);
}
}
}
|
package com.ajay.TIAA;
import java.util.Arrays;
public class ShiftingOfArray {
public static void main(String[] args) {
int[] arr = { 1, 2, 3, 4, 5 };
int n = 2;
shiftToRight(arr, n);
}
private static void shiftToRight(int[] arr, int n) {
int rot = 0;
while (rot != n) {
int element = arr[0];
for (int i = 0; i < arr.length - 1; i++) {
arr[i] = arr[i + 1];
}
arr[arr.length - 1] = element;
rot++;
}
System.out.println(Arrays.toString(arr));
}
}
|
package com.tencent.mm.ui.chatting.viewitems;
import android.support.design.a$i;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import com.tencent.mm.R;
import com.tencent.mm.ak.a.a.c;
import com.tencent.mm.bg.d;
import com.tencent.mm.g.a.dj;
import com.tencent.mm.g.a.mw;
import com.tencent.mm.model.bf;
import com.tencent.mm.pluginsdk.model.app.b;
import com.tencent.mm.pluginsdk.model.app.f;
import com.tencent.mm.pluginsdk.model.app.l;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.storage.bd;
import com.tencent.mm.ui.chatting.am;
import com.tencent.mm.ui.chatting.c.a;
import com.tencent.mm.ui.chatting.j;
import com.tencent.mm.ui.chatting.t.h;
import com.tencent.mm.ui.chatting.t.i;
import com.tencent.mm.ui.chatting.t.k;
import com.tencent.mm.y.g;
public class c$d extends b {
private boolean qpi;
private a tKy;
private c tXU;
protected i uaA;
protected h uay;
protected k uaz;
public final boolean bba() {
return false;
}
public c$d() {
c.a aVar = new c.a();
aVar.dXN = R.k.app_brand_app_default_icon_for_tail;
aVar.bg(com.tencent.mm.bp.a.fromDPToPix(ad.getContext(), 20), com.tencent.mm.bp.a.fromDPToPix(ad.getContext(), 20)).dXw = true;
this.tXU = aVar.Pt();
}
public final boolean aq(int i, boolean z) {
if ((!z && i == 49) || i == 335544369 || i == 402653233 || i == 369098801) {
return true;
}
return false;
}
public final View a(LayoutInflater layoutInflater, View view) {
if (view != null && view.getTag() != null) {
return view;
}
view = new r(layoutInflater, R.i.chatting_item_from_appmsg);
view.setTag(new c.c().p(view, true));
return view;
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
public final void a(com.tencent.mm.ui.chatting.viewitems.b.a r26, int r27, com.tencent.mm.ui.chatting.c.a r28, com.tencent.mm.storage.bd r29, java.lang.String r30) {
/*
r25 = this;
r20 = r26;
r20 = (com.tencent.mm.ui.chatting.viewitems.c.c) r20;
r0 = r28;
r1 = r25;
r1.tKy = r0;
r20.reset();
r0 = r29;
r7 = r0.field_content;
r6 = com.tencent.mm.ui.chatting.b.b.i.class;
r0 = r28;
r6 = r0.O(r6);
r6 = (com.tencent.mm.ui.chatting.b.b.i) r6;
r0 = r29;
r6.aV(r0);
r0 = r29;
r6.aW(r0);
r0 = r29;
r6.aX(r0);
r0 = r25;
r6 = r0.qpi;
if (r6 == 0) goto L_0x143f;
L_0x0030:
r0 = r29;
r6 = r0.field_content;
r8 = 58;
r6 = r6.indexOf(r8);
r8 = -1;
if (r6 == r8) goto L_0x143f;
L_0x003d:
r0 = r29;
r7 = r0.field_content;
r6 = r6 + 1;
r6 = r7.substring(r6);
r16 = r6;
L_0x0049:
r7 = 0;
r6 = 0;
if (r16 == 0) goto L_0x0437;
L_0x004d:
r0 = r29;
r6 = r0.field_reserved;
r0 = r16;
r7 = com.tencent.mm.y.g.a.J(r0, r6);
r6 = com.tencent.mm.y.k.gv(r16);
r14 = r6;
r21 = r7;
L_0x005e:
r6 = new com.tencent.mm.ui.chatting.viewitems.au;
r8 = r28.cwr();
r10 = 0;
r11 = 0;
r7 = r29;
r9 = r27;
r6.<init>(r7, r8, r9, r10, r11);
r15 = 0;
if (r21 == 0) goto L_0x03f4;
L_0x0070:
r0 = r20;
r7 = r0.eCm;
r8 = r21.getTitle();
r7.setText(r8);
r0 = r20;
r7 = r0.eCn;
r8 = r21.getDescription();
r7.setText(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 1;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.eCm;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = r8.getResources();
r9 = com.tencent.mm.R.e.normal_text_color;
r8 = r8.getColor(r9);
r7.setTextColor(r8);
r0 = r20;
r7 = r0.eCn;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = r8.getResources();
r9 = com.tencent.mm.R.e.hint_text_color;
r8 = r8.getColor(r9);
r7.setTextColor(r8);
r0 = r20;
r7 = r0.uad;
r8 = com.tencent.mm.R.g.chat_from_content_bg_mask;
r7.setBackgroundResource(r8);
r0 = r20;
r7 = r0.uad;
r8 = 0;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = r9.getResources();
r10 = com.tencent.mm.R.f.MiddlePadding;
r9 = r9.getDimensionPixelSize(r10);
r10 = 0;
r11 = 0;
r7.setPadding(r8, r9, r10, r11);
r0 = r20;
r7 = r0.tZI;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uab;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCn;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZP;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZS;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZR;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uaf;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uag;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZK;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZL;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uaq;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uaj;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uad;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uac;
r0 = r20;
r8 = r0.uau;
com.tencent.mm.ui.chatting.viewitems.c.c.P(r7, r8);
r7 = com.tencent.mm.y.e.class;
r0 = r21;
r7 = r0.u(r7);
r7 = (com.tencent.mm.y.e) r7;
r0 = r20;
r8 = r0.tZV;
if (r7 != 0) goto L_0x0456;
L_0x0171:
r7 = 0;
L_0x0172:
r0 = r29;
r9 = r0.field_talker;
r7 = r8.l(r7, r9);
if (r7 == 0) goto L_0x045a;
L_0x017c:
r0 = r20;
r7 = r0.uac;
r8 = com.tencent.mm.R.g.chatfrom_bg_apptop;
r7.setBackgroundResource(r8);
L_0x0185:
r0 = r21;
r7 = r0.appId;
r0 = r21;
r8 = r0.cbu;
r24 = com.tencent.mm.pluginsdk.model.app.g.cP(r7, r8);
if (r24 == 0) goto L_0x01a2;
L_0x0193:
r7 = r24.aaq();
if (r7 == 0) goto L_0x01a2;
L_0x0199:
r0 = r28;
r1 = r21;
r2 = r29;
b(r0, r1, r2);
L_0x01a2:
if (r24 == 0) goto L_0x01b8;
L_0x01a4:
r0 = r24;
r7 = r0.field_appName;
if (r7 == 0) goto L_0x01b8;
L_0x01aa:
r0 = r24;
r7 = r0.field_appName;
r7 = r7.trim();
r7 = r7.length();
if (r7 > 0) goto L_0x0465;
L_0x01b8:
r0 = r21;
r7 = r0.appName;
L_0x01bc:
r8 = 1;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r10 = 12;
com.tencent.mm.bp.a.fromDPToPix(r9, r10);
r0 = r21;
r9 = r0.type;
r10 = 20;
if (r9 == r10) goto L_0x01df;
L_0x01d2:
r9 = "wxaf060266bfa9a35c";
r0 = r21;
r10 = r0.appId;
r9 = r9.equals(r10);
if (r9 == 0) goto L_0x01e7;
L_0x01df:
r8 = com.tencent.mm.pluginsdk.o.a.cbj();
r8 = r8.buA();
L_0x01e7:
if (r8 == 0) goto L_0x047a;
L_0x01e9:
r0 = r21;
r8 = r0.appId;
if (r8 == 0) goto L_0x047a;
L_0x01ef:
r0 = r21;
r8 = r0.appId;
r8 = r8.length();
if (r8 <= 0) goto L_0x047a;
L_0x01f9:
r8 = com.tencent.mm.pluginsdk.model.app.g.cT(r7);
if (r8 == 0) goto L_0x047a;
L_0x01ff:
r0 = r20;
r8 = r0.jet;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r0 = r24;
r7 = com.tencent.mm.pluginsdk.model.app.g.b(r9, r0, r7);
r8.setText(r7);
r0 = r20;
r7 = r0.jet;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.jet;
r8 = 0;
r9 = 0;
r10 = 0;
r11 = 0;
r7.setCompoundDrawables(r8, r9, r10, r11);
r0 = r20;
r7 = r0.tZM;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZJ;
r8 = 0;
r7.setVisibility(r8);
if (r24 == 0) goto L_0x046b;
L_0x0239:
r7 = r24.aaq();
if (r7 == 0) goto L_0x046b;
L_0x023f:
r0 = r20;
r8 = r0.jet;
r0 = r24;
r11 = r0.field_packageName;
r0 = r29;
r12 = r0.field_msgSvrId;
r7 = r28;
r9 = r29;
r10 = r21;
a(r7, r8, r9, r10, r11, r12);
L_0x0254:
r0 = r20;
r7 = r0.tZJ;
r0 = r21;
r8 = r0.appId;
r0 = r28;
a(r0, r7, r8);
L_0x0261:
r0 = r21;
r7 = r0.dwl;
if (r7 == 0) goto L_0x050f;
L_0x0267:
r0 = r21;
r7 = r0.dwl;
r7 = r7.dzn;
if (r7 == 0) goto L_0x050f;
L_0x026f:
r7 = 1;
L_0x0270:
if (r7 == 0) goto L_0x027b;
L_0x0272:
r0 = r20;
r7 = r0.tZM;
r8 = 8;
r7.setVisibility(r8);
L_0x027b:
r7 = 0;
r0 = r20;
r8 = r0.tZI;
r9 = 0;
r8.setVisibility(r9);
r0 = r21;
r8 = r0.dwl;
if (r8 == 0) goto L_0x0512;
L_0x028a:
r0 = r21;
r8 = r0.dwl;
r8 = r8.dzk;
r9 = 1;
if (r8 != r9) goto L_0x0512;
L_0x0293:
r8 = 1;
L_0x0294:
if (r8 != 0) goto L_0x0518;
L_0x0296:
r0 = r25;
r8 = r0.qUB;
if (r8 == 0) goto L_0x0518;
L_0x029c:
r8 = 0;
r0 = r21;
r9 = r0.type;
r10 = 33;
if (r9 == r10) goto L_0x02c6;
L_0x02a5:
r0 = r21;
r9 = r0.type;
r10 = 36;
if (r9 == r10) goto L_0x02c6;
L_0x02ad:
r8 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r9 = r0.field_imgPath;
r0 = r28;
r10 = r0.tTq;
r10 = r10.getContext();
r10 = com.tencent.mm.bp.a.getDensity(r10);
r11 = 0;
r8 = r8.a(r9, r10, r11);
L_0x02c6:
if (r8 == 0) goto L_0x0515;
L_0x02c8:
r9 = r8.isRecycled();
if (r9 != 0) goto L_0x0515;
L_0x02ce:
r0 = r20;
r9 = r0.tZI;
r9.setImageBitmap(r8);
L_0x02d5:
r0 = r21;
r9 = r0.type;
r10 = 3;
if (r9 != r10) goto L_0x02f2;
L_0x02dc:
r0 = r20;
r9 = r0.uad;
r9 = r9.getViewTreeObserver();
r10 = new com.tencent.mm.ui.chatting.viewitems.c$d$1;
r0 = r25;
r1 = r20;
r2 = r28;
r10.<init>(r1, r2, r8);
r9.addOnPreDrawListener(r10);
L_0x02f2:
r22 = r7;
L_0x02f4:
r0 = r21;
r7 = r0.cGB;
if (r7 == 0) goto L_0x0304;
L_0x02fa:
r0 = r21;
r7 = r0.cGB;
r7 = r7.length();
if (r7 != 0) goto L_0x0531;
L_0x0304:
r0 = r20;
r7 = r0.tZU;
r8 = 8;
r7.setVisibility(r8);
L_0x030d:
r0 = r20;
r7 = r0.tZT;
r8 = 0;
r7.setOnClickListener(r8);
r0 = r20;
r7 = r0.tZX;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uaa;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZY;
r8 = 8;
r7.setVisibility(r8);
r23 = 0;
r0 = r21;
r7 = r0.type;
switch(r7) {
case 0: goto L_0x0d28;
case 1: goto L_0x0340;
case 2: goto L_0x0340;
case 3: goto L_0x054e;
case 4: goto L_0x0713;
case 5: goto L_0x07a5;
case 6: goto L_0x0662;
case 7: goto L_0x0ae1;
case 8: goto L_0x0340;
case 9: goto L_0x0340;
case 10: goto L_0x0b6d;
case 11: goto L_0x0340;
case 12: goto L_0x0340;
case 13: goto L_0x0c2c;
case 14: goto L_0x0340;
case 15: goto L_0x0dad;
case 16: goto L_0x109e;
case 17: goto L_0x0340;
case 18: goto L_0x0340;
case 19: goto L_0x11e2;
case 20: goto L_0x0ca6;
case 21: goto L_0x0340;
case 22: goto L_0x0340;
case 23: goto L_0x0340;
case 24: goto L_0x1139;
case 25: goto L_0x0e78;
case 26: goto L_0x0f52;
case 27: goto L_0x0f52;
case 28: goto L_0x0340;
case 29: goto L_0x0340;
case 30: goto L_0x0340;
case 31: goto L_0x0340;
case 32: goto L_0x0340;
case 33: goto L_0x095d;
case 34: goto L_0x11f2;
case 35: goto L_0x0340;
case 36: goto L_0x087c;
case 37: goto L_0x0340;
case 38: goto L_0x0340;
case 39: goto L_0x0340;
case 40: goto L_0x13a8;
default: goto L_0x0340;
};
L_0x0340:
r7 = 1;
r12 = r6;
L_0x0342:
if (r7 == 0) goto L_0x03ce;
L_0x0344:
r0 = r21;
r6 = r0.title;
if (r6 == 0) goto L_0x13be;
L_0x034a:
r0 = r21;
r6 = r0.title;
r6 = r6.length();
if (r6 <= 0) goto L_0x13be;
L_0x0354:
r0 = r20;
r6 = r0.tZN;
r7 = 0;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZN;
r7 = 2;
r6.setMaxLines(r7);
r0 = r20;
r6 = r0.tZN;
r0 = r21;
r7 = r0.title;
r6.setText(r7);
L_0x036f:
r0 = r20;
r6 = r0.eCm;
r7 = 8;
r6.setVisibility(r7);
if (r22 == 0) goto L_0x03ce;
L_0x037a:
r0 = r21;
r6 = r0.type;
r7 = 33;
if (r6 == r7) goto L_0x038a;
L_0x0382:
r0 = r21;
r6 = r0.type;
r7 = 36;
if (r6 != r7) goto L_0x13c9;
L_0x038a:
r6 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r7 = r0.field_imgPath;
r8 = 0;
r9 = 1;
r8 = r6.d(r7, r8, r9);
r0 = r20;
r6 = r0.tZI;
r7 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r6.setImageResource(r7);
r6 = com.tencent.mm.modelappbrand.b.b.Ka();
r0 = r20;
r7 = r0.tZI;
r9 = new java.lang.StringBuilder;
r10 = "file://";
r9.<init>(r10);
r8 = r9.append(r8);
r8 = r8.toString();
r9 = 0;
r10 = 0;
r11 = com.tencent.mm.modelappbrand.g.class;
r11 = com.tencent.mm.kernel.g.l(r11);
r11 = (com.tencent.mm.modelappbrand.g) r11;
r13 = 50;
r14 = 50;
r11 = r11.bc(r13, r14);
r6.a(r7, r8, r9, r10, r11);
L_0x03ce:
r6 = r28.cwr();
if (r6 != 0) goto L_0x142b;
L_0x03d4:
r6 = com.tencent.mm.pluginsdk.model.app.g.g(r24);
if (r6 == 0) goto L_0x141f;
L_0x03da:
r0 = r20;
r6 = r0.tZW;
r7 = 0;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZW;
r0 = r21;
r1 = r29;
r7 = com.tencent.mm.ui.chatting.viewitems.au.a(r0, r1);
r0 = r28;
c(r0, r6, r7);
r6 = r12;
L_0x03f4:
if (r15 != 0) goto L_0x040c;
L_0x03f6:
r0 = r20;
r7 = r0.uac;
r7.setTag(r6);
r0 = r20;
r6 = r0.uac;
r0 = r25;
r1 = r28;
r7 = r0.d(r1);
r6.setOnClickListener(r7);
L_0x040c:
r0 = r25;
r6 = r0.qUB;
if (r6 == 0) goto L_0x0436;
L_0x0412:
r0 = r20;
r6 = r0.uac;
r0 = r25;
r1 = r28;
r7 = r0.c(r1);
r6.setOnLongClickListener(r7);
r0 = r20;
r7 = r0.uac;
r6 = com.tencent.mm.ui.chatting.b.b.g.class;
r0 = r28;
r6 = r0.O(r6);
r6 = (com.tencent.mm.ui.chatting.b.b.g) r6;
r6 = r6.ctw();
r7.setOnTouchListener(r6);
L_0x0436:
return;
L_0x0437:
r8 = "MicroMsg.ChattingItemAppMsgFrom";
r9 = "amessage, msgid:%s, user:%s";
r10 = 2;
r10 = new java.lang.Object[r10];
r11 = 0;
r0 = r29;
r12 = r0.field_msgId;
r12 = java.lang.Long.valueOf(r12);
r10[r11] = r12;
r11 = 1;
r10[r11] = r30;
com.tencent.mm.sdk.platformtools.x.e(r8, r9, r10);
r14 = r6;
r21 = r7;
goto L_0x005e;
L_0x0456:
r7 = r7.dwk;
goto L_0x0172;
L_0x045a:
r0 = r20;
r7 = r0.uac;
r8 = com.tencent.mm.R.g.chatfrom_bg_app;
r7.setBackgroundResource(r8);
goto L_0x0185;
L_0x0465:
r0 = r24;
r7 = r0.field_appName;
goto L_0x01bc;
L_0x046b:
r0 = r20;
r7 = r0.jet;
r0 = r21;
r8 = r0.appId;
r0 = r28;
a(r0, r7, r8);
goto L_0x0254;
L_0x047a:
r0 = r21;
r7 = r0.type;
r8 = 24;
if (r7 != r8) goto L_0x04ae;
L_0x0482:
r0 = r20;
r7 = r0.jet;
r8 = com.tencent.mm.sdk.platformtools.ad.getContext();
r9 = com.tencent.mm.R.l.favorite;
r8 = r8.getString(r9);
r7.setText(r8);
r0 = r20;
r7 = r0.tZM;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.jet;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZJ;
r8 = 8;
r7.setVisibility(r8);
goto L_0x0261;
L_0x04ae:
r0 = r21;
r7 = r0.type;
r8 = 19;
if (r7 == r8) goto L_0x04bc;
L_0x04b6:
r7 = r14.dzv;
r8 = 19;
if (r7 != r8) goto L_0x04e8;
L_0x04bc:
r0 = r20;
r7 = r0.jet;
r8 = com.tencent.mm.sdk.platformtools.ad.getContext();
r9 = com.tencent.mm.R.l.chatting_item_record;
r8 = r8.getString(r9);
r7.setText(r8);
r0 = r20;
r7 = r0.tZM;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.jet;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZJ;
r8 = 8;
r7.setVisibility(r8);
goto L_0x0261;
L_0x04e8:
r0 = r21;
r1 = r20;
r7 = com.tencent.mm.ui.chatting.viewitems.c.a(r0, r1);
if (r7 != 0) goto L_0x0261;
L_0x04f2:
r0 = r20;
r7 = r0.tZM;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.jet;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZJ;
r8 = 8;
r7.setVisibility(r8);
goto L_0x0261;
L_0x050f:
r7 = 0;
goto L_0x0270;
L_0x0512:
r8 = 0;
goto L_0x0294;
L_0x0515:
r7 = 1;
goto L_0x02d5;
L_0x0518:
r0 = r20;
r8 = r0.tZI;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getMMResources();
r10 = com.tencent.mm.R.g.nosdcard_app;
r9 = android.graphics.BitmapFactory.decodeResource(r9, r10);
r8.setImageBitmap(r9);
r22 = r7;
goto L_0x02f4;
L_0x0531:
r0 = r20;
r7 = r0.tZU;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZU;
r0 = r21;
r8 = r0.cGB;
r8 = com.tencent.mm.ui.chatting.viewitems.au.aaI(r8);
r0 = r25;
r1 = r28;
r0.b(r1, r7, r8);
goto L_0x030d;
L_0x054e:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x0645;
L_0x0554:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x0645;
L_0x055e:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCm;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = r8.getResources();
r9 = com.tencent.mm.R.e.white;
r8 = r8.getColor(r9);
r7.setTextColor(r8);
L_0x057f:
r0 = r20;
r7 = r0.eCn;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCn;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = r8.getResources();
r9 = com.tencent.mm.R.e.white;
r8 = r8.getColor(r9);
r7.setTextColor(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 0;
r7.setVisibility(r8);
r7 = new java.lang.StringBuilder;
r7.<init>();
r0 = r29;
r8 = r0.field_msgId;
r7 = r7.append(r8);
r7 = r7.toString();
r0 = r26;
r8 = r0.tZw;
r7 = r7.equals(r8);
if (r7 == 0) goto L_0x0650;
L_0x05d4:
r0 = r20;
r7 = r0.tZT;
r8 = com.tencent.mm.R.g.music_pauseicon;
r7.setImageResource(r8);
L_0x05dd:
r0 = r20;
r7 = r0.eCn;
r8 = 2;
r7.setMaxLines(r8);
if (r22 == 0) goto L_0x060d;
L_0x05e7:
r0 = r21;
r7 = r0.appId;
r8 = 1;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r7 = com.tencent.mm.pluginsdk.model.app.g.b(r7, r8, r9);
if (r7 == 0) goto L_0x0604;
L_0x05fe:
r8 = r7.isRecycled();
if (r8 == 0) goto L_0x065a;
L_0x0604:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_music;
r7.setImageResource(r8);
L_0x060d:
r7 = new com.tencent.mm.ui.chatting.viewitems.c$f;
r7.<init>();
r0 = r29;
r8 = r0.field_msgId;
r7.bJC = r8;
r0 = r29;
r8 = r0.field_content;
r7.bVv = r8;
r0 = r29;
r8 = r0.field_imgPath;
r7.bSw = r8;
r0 = r20;
r8 = r0.tZT;
r8.setTag(r7);
r0 = r20;
r8 = r0.tZT;
r7 = com.tencent.mm.ui.chatting.b.b.g.class;
r0 = r28;
r7 = r0.O(r7);
r7 = (com.tencent.mm.ui.chatting.b.b.g) r7;
r7 = r7.ctx();
r8.setOnClickListener(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0645:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
goto L_0x057f;
L_0x0650:
r0 = r20;
r7 = r0.tZT;
r8 = com.tencent.mm.R.g.music_playicon;
r7.setImageResource(r8);
goto L_0x05dd;
L_0x065a:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
goto L_0x060d;
L_0x0662:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x06f5;
L_0x0668:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x06f5;
L_0x0672:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCm;
r8 = 2;
r7.setMaxLines(r8);
L_0x0682:
r0 = r20;
r7 = r0.eCn;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCn;
r8 = 2;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.eCn;
r0 = r21;
r8 = r0.dwo;
r8 = (long) r8;
r8 = com.tencent.mm.sdk.platformtools.bi.bF(r8);
r7.setText(r8);
r0 = r21;
r7 = r0.dwo;
r0 = r20;
r1 = r16;
com.tencent.mm.ui.chatting.viewitems.c.c.a(r0, r1, r7);
r7 = 1;
r7 = java.lang.Boolean.valueOf(r7);
r0 = r21;
r8 = r0.bGP;
r0 = r21;
r9 = r0.title;
r0 = r20;
r1 = r29;
com.tencent.mm.ui.chatting.viewitems.c.c.a(r0, r7, r1, r8, r9);
if (r22 == 0) goto L_0x1437;
L_0x06dd:
r0 = r21;
r7 = r0.dwp;
r7 = com.tencent.mm.sdk.platformtools.bi.Xi(r7);
if (r7 == 0) goto L_0x06ff;
L_0x06e7:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.g.appshareimage_icon;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x06f5:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
goto L_0x0682;
L_0x06ff:
r0 = r20;
r7 = r0.tZI;
r0 = r21;
r8 = r0.dwp;
r8 = com.tencent.mm.pluginsdk.model.o.SQ(r8);
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0713:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x0793;
L_0x0719:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x0793;
L_0x0723:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
L_0x072b:
r0 = r20;
r7 = r0.eCn;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = com.tencent.mm.R.g.video_download_btn;
r7.setImageResource(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCn;
r8 = 2;
r7.setMaxLines(r8);
if (r22 == 0) goto L_0x1437;
L_0x075f:
r0 = r21;
r7 = r0.appId;
r8 = 1;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r7 = com.tencent.mm.pluginsdk.model.app.g.b(r7, r8, r9);
if (r7 == 0) goto L_0x077c;
L_0x0776:
r8 = r7.isRecycled();
if (r8 == 0) goto L_0x079d;
L_0x077c:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_video;
r7.setImageResource(r8);
L_0x0785:
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0793:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
goto L_0x072b;
L_0x079d:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
goto L_0x0785;
L_0x07a5:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x085b;
L_0x07b4:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x085b;
L_0x07be:
r0 = r20;
r7 = r0.tZN;
r8 = 2;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = r21.getTitle();
r7.setText(r8);
L_0x07d9:
r0 = r20;
r7 = r0.eCn;
r8 = 3;
r7.setMaxLines(r8);
r7 = com.tencent.mm.ui.chatting.viewitems.c.h(r21);
if (r7 == 0) goto L_0x0866;
L_0x07e7:
r0 = r20;
r7 = r0.tZT;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = com.tencent.mm.R.g.video_download_btn;
r7.setImageResource(r8);
L_0x07f8:
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x1437;
L_0x0802:
r0 = r21;
r7 = r0.appId;
r8 = 1;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r7 = com.tencent.mm.pluginsdk.model.app.g.b(r7, r8, r9);
if (r7 == 0) goto L_0x081f;
L_0x0819:
r8 = r7.isRecycled();
if (r8 == 0) goto L_0x0870;
L_0x081f:
r7 = new com.tencent.mm.ak.a.a.c$a;
r7.<init>();
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.dXN = r8;
r8 = com.tencent.mm.sdk.platformtools.ad.getContext();
r9 = 50;
r8 = com.tencent.mm.bp.a.fromDPToPix(r8, r9);
r9 = com.tencent.mm.sdk.platformtools.ad.getContext();
r10 = 50;
r9 = com.tencent.mm.bp.a.fromDPToPix(r9, r10);
r8 = r7.bg(r8, r9);
r9 = 1;
r8.dXw = r9;
r8 = com.tencent.mm.ak.o.Pj();
r0 = r21;
r9 = r0.thumburl;
r0 = r20;
r10 = r0.tZI;
r7 = r7.Pt();
r8.a(r9, r10, r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x085b:
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
goto L_0x07d9;
L_0x0866:
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
goto L_0x07f8;
L_0x0870:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x087c:
r7 = com.tencent.mm.plugin.appbrand.n.c.class;
r7 = com.tencent.mm.kernel.g.l(r7);
r7 = (com.tencent.mm.plugin.appbrand.n.c) r7;
r0 = r21;
r8 = r0.dyS;
r9 = r7.rR(r8);
if (r9 == 0) goto L_0x093c;
L_0x088e:
r7 = r9.field_nickname;
r8 = r7;
L_0x0891:
if (r9 == 0) goto L_0x0943;
L_0x0893:
r7 = r9.field_brandIconURL;
L_0x0895:
r0 = r20;
r9 = r0.uad;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uaq;
r10 = 0;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uaj;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uam;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uat;
r0 = r21;
r10 = r0.title;
r9.setText(r10);
r0 = r20;
r9 = r0.uam;
r0 = r21;
r10 = r0.description;
r9.setText(r10);
r0 = r20;
r9 = r0.uao;
r9.setText(r8);
r0 = r21;
r8 = r0.dyZ;
switch(r8) {
case 1: goto L_0x0949;
case 2: goto L_0x0953;
default: goto L_0x08dc;
};
L_0x08dc:
r0 = r20;
r8 = r0.uap;
r9 = com.tencent.mm.R.l.app_brand_entrance;
r8.setText(r9);
L_0x08e5:
r8 = com.tencent.mm.ak.o.Pj();
r0 = r20;
r9 = r0.uan;
r0 = r25;
r10 = r0.tXU;
r8.a(r7, r9, r10);
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r9 = 0;
r10 = 1;
r9 = r7.d(r8, r9, r10);
r0 = r20;
r7 = r0.uar;
r8 = 0;
r7.setImageBitmap(r8);
r7 = com.tencent.mm.modelappbrand.b.b.Ka();
r0 = r20;
r8 = r0.uar;
r10 = new java.lang.StringBuilder;
r11 = "file://";
r10.<init>(r11);
r9 = r10.append(r9);
r9 = r9.toString();
r10 = 0;
r11 = 0;
r12 = com.tencent.mm.modelappbrand.g.class;
r12 = com.tencent.mm.kernel.g.l(r12);
r12 = (com.tencent.mm.modelappbrand.g) r12;
r13 = 240; // 0xf0 float:3.36E-43 double:1.186E-321;
r14 = 192; // 0xc0 float:2.69E-43 double:9.5E-322;
r12 = r12.bc(r13, r14);
r7.a(r8, r9, r10, r11, r12);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x093c:
r0 = r21;
r7 = r0.bZH;
r8 = r7;
goto L_0x0891;
L_0x0943:
r0 = r21;
r7 = r0.dzb;
goto L_0x0895;
L_0x0949:
r0 = r20;
r8 = r0.uap;
r9 = com.tencent.mm.R.l.app_brand_share_wxa_testing_tag;
r8.setText(r9);
goto L_0x08e5;
L_0x0953:
r0 = r20;
r8 = r0.uap;
r9 = com.tencent.mm.R.l.app_brand_share_wxa_preview_tag;
r8.setText(r9);
goto L_0x08e5;
L_0x095d:
r7 = com.tencent.mm.plugin.appbrand.n.c.class;
r7 = com.tencent.mm.kernel.g.l(r7);
r7 = (com.tencent.mm.plugin.appbrand.n.c) r7;
r0 = r21;
r8 = r0.dyS;
r9 = r7.rR(r8);
r0 = r21;
r7 = r0.dyU;
switch(r7) {
case 1: goto L_0x0a5f;
case 2: goto L_0x0978;
case 3: goto L_0x0978;
default: goto L_0x0974;
};
L_0x0974:
r7 = 1;
r12 = r6;
goto L_0x0342;
L_0x0978:
if (r9 == 0) goto L_0x0a3c;
L_0x097a:
r7 = r9.field_nickname;
r8 = r7;
L_0x097d:
if (r9 == 0) goto L_0x0a43;
L_0x097f:
r7 = r9.field_brandIconURL;
L_0x0981:
r0 = r20;
r9 = r0.uad;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uaq;
r10 = 0;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uaj;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uam;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uat;
r0 = r21;
r10 = r0.title;
r9.setText(r10);
r0 = r20;
r9 = r0.uam;
r0 = r21;
r10 = r0.description;
r9.setText(r10);
r0 = r20;
r9 = r0.uao;
r9.setText(r8);
r0 = r21;
r8 = r0.dyZ;
switch(r8) {
case 1: goto L_0x0a49;
case 2: goto L_0x0a54;
default: goto L_0x09c8;
};
L_0x09c8:
r0 = r20;
r8 = r0.uap;
r9 = com.tencent.mm.R.l.app_brand_entrance;
r8.setText(r9);
L_0x09d1:
r8 = com.tencent.mm.ak.o.Pj();
r0 = r20;
r9 = r0.uan;
r0 = r25;
r10 = r0.tXU;
r8.a(r7, r9, r10);
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r9 = 0;
r10 = 1;
r7 = r7.d(r8, r9, r10);
r0 = r20;
r8 = r0.uar;
r9 = 0;
r8.setImageBitmap(r9);
r0 = r20;
r8 = r0.uar;
r9 = 4;
r8.setVisibility(r9);
r0 = r20;
r8 = r0.uas;
r9 = 0;
r8.setVisibility(r9);
r8 = com.tencent.mm.modelappbrand.b.b.Ka();
r9 = new com.tencent.mm.ui.chatting.viewitems.c$d$2;
r0 = r25;
r1 = r20;
r9.<init>(r0, r1);
r10 = new java.lang.StringBuilder;
r11 = "file://";
r10.<init>(r11);
r7 = r10.append(r7);
r10 = r7.toString();
r11 = 0;
r7 = com.tencent.mm.modelappbrand.g.class;
r7 = com.tencent.mm.kernel.g.l(r7);
r7 = (com.tencent.mm.modelappbrand.g) r7;
r12 = 240; // 0xf0 float:3.36E-43 double:1.186E-321;
r13 = 192; // 0xc0 float:2.69E-43 double:9.5E-322;
r7 = r7.bc(r12, r13);
r8.a(r9, r10, r11, r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0a3c:
r0 = r21;
r7 = r0.bZH;
r8 = r7;
goto L_0x097d;
L_0x0a43:
r0 = r21;
r7 = r0.dzb;
goto L_0x0981;
L_0x0a49:
r0 = r20;
r8 = r0.uap;
r9 = com.tencent.mm.R.l.app_brand_share_wxa_testing_tag;
r8.setText(r9);
goto L_0x09d1;
L_0x0a54:
r0 = r20;
r8 = r0.uap;
r9 = com.tencent.mm.R.l.app_brand_share_wxa_preview_tag;
r8.setText(r9);
goto L_0x09d1;
L_0x0a5f:
if (r9 == 0) goto L_0x0ac3;
L_0x0a61:
r7 = r9.field_nickname;
r8 = r7;
L_0x0a64:
if (r9 == 0) goto L_0x0ac9;
L_0x0a66:
r7 = r9.field_brandIconURL;
L_0x0a68:
r0 = r20;
r9 = r0.uad;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uaq;
r10 = 8;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.uaj;
r10 = 0;
r9.setVisibility(r10);
r0 = r20;
r9 = r0.ual;
r9.setText(r8);
r8 = com.tencent.mm.sdk.platformtools.bi.oW(r7);
if (r8 == 0) goto L_0x0acb;
L_0x0a8f:
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r9 = 0;
r10 = 1;
r7 = r7.d(r8, r9, r10);
r8 = com.tencent.mm.modelappbrand.b.b.Ka();
r0 = r20;
r9 = r0.uak;
r10 = new java.lang.StringBuilder;
r11 = "file://";
r10.<init>(r11);
r7 = r10.append(r7);
r7 = r7.toString();
r10 = com.tencent.mm.modelappbrand.b.a.JZ();
r11 = com.tencent.mm.modelappbrand.b.f.dGr;
r8.a(r9, r7, r10, r11);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0ac3:
r0 = r21;
r7 = r0.title;
r8 = r7;
goto L_0x0a64;
L_0x0ac9:
r7 = 0;
goto L_0x0a68;
L_0x0acb:
r8 = com.tencent.mm.modelappbrand.b.b.Ka();
r0 = r20;
r9 = r0.uak;
r10 = com.tencent.mm.modelappbrand.b.a.JZ();
r11 = com.tencent.mm.modelappbrand.b.f.dGr;
r8.a(r9, r7, r10, r11);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0ae1:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x0b57;
L_0x0af0:
r0 = r21;
r7 = r0.title;
r7 = r7.trim();
r7 = r7.length();
if (r7 <= 0) goto L_0x0b57;
L_0x0afe:
r0 = r20;
r7 = r0.tZN;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = r21.getTitle();
r7.setText(r8);
L_0x0b11:
r0 = r20;
r7 = r0.eCn;
r8 = 3;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 0;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x1437;
L_0x0b2c:
r0 = r21;
r7 = r0.appId;
r8 = 1;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r7 = com.tencent.mm.pluginsdk.model.app.g.b(r7, r8, r9);
if (r7 == 0) goto L_0x0b49;
L_0x0b43:
r8 = r7.isRecycled();
if (r8 == 0) goto L_0x0b61;
L_0x0b49:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0b57:
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
goto L_0x0b11;
L_0x0b61:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0b6d:
r0 = r20;
r7 = r0.tZN;
r8 = 0;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.dwR;
r8 = 1;
if (r7 != r8) goto L_0x0bf0;
L_0x0b7c:
r0 = r20;
r7 = r0.tZN;
r8 = com.tencent.mm.R.l.scan_product_appmsg_top_title_book;
r7.setText(r8);
L_0x0b85:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x0ba8;
L_0x0b8b:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x0ba8;
L_0x0b95:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCm;
r8 = r21.getTitle();
r7.setText(r8);
L_0x0ba8:
r0 = r20;
r7 = r0.eCn;
r8 = 4;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x1437;
L_0x0bc3:
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r10 = 0;
r7 = r7.b(r8, r9, r10);
if (r7 == 0) goto L_0x0c1e;
L_0x0bde:
r8 = r7.isRecycled();
if (r8 != 0) goto L_0x0c1e;
L_0x0be4:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0bf0:
r0 = r21;
r7 = r0.dwR;
r8 = 2;
if (r7 != r8) goto L_0x0c01;
L_0x0bf7:
r0 = r20;
r7 = r0.tZN;
r8 = com.tencent.mm.R.l.scan_product_appmsg_top_title_movie;
r7.setText(r8);
goto L_0x0b85;
L_0x0c01:
r0 = r21;
r7 = r0.dwR;
r8 = 3;
if (r7 != r8) goto L_0x0c13;
L_0x0c08:
r0 = r20;
r7 = r0.tZN;
r8 = com.tencent.mm.R.l.scan_product_appmsg_top_title_cd;
r7.setText(r8);
goto L_0x0b85;
L_0x0c13:
r0 = r20;
r7 = r0.tZN;
r8 = com.tencent.mm.R.l.scan_product_appmsg_top_title_product;
r7.setText(r8);
goto L_0x0b85;
L_0x0c1e:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0c2c:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCm;
r8 = r21.getTitle();
r7.setText(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = com.tencent.mm.R.l.chatting_mall_product_msg_title;
r7.setText(r8);
r0 = r20;
r7 = r0.eCn;
r8 = 4;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x1437;
L_0x0c6b:
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r10 = 0;
r7 = r7.b(r8, r9, r10);
if (r7 == 0) goto L_0x0c98;
L_0x0c86:
r8 = r7.isRecycled();
if (r8 != 0) goto L_0x0c98;
L_0x0c8c:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0c98:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0ca6:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x0cd2;
L_0x0cac:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x0cd2;
L_0x0cb6:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCm;
r8 = r21.getTitle();
r7.setText(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
L_0x0cd2:
r0 = r20;
r7 = r0.eCn;
r8 = 4;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x1437;
L_0x0ced:
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r10 = 0;
r7 = r7.b(r8, r9, r10);
if (r7 == 0) goto L_0x0d1a;
L_0x0d08:
r8 = r7.isRecycled();
if (r8 != 0) goto L_0x0d1a;
L_0x0d0e:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0d1a:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0d28:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x0d97;
L_0x0d2e:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x0d97;
L_0x0d38:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
L_0x0d40:
r0 = r20;
r7 = r0.eCn;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCn;
r8 = 2;
r7.setMaxLines(r8);
if (r22 == 0) goto L_0x1437;
L_0x0d6c:
r0 = r21;
r7 = r0.appId;
r8 = 1;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r7 = com.tencent.mm.pluginsdk.model.app.g.b(r7, r8, r9);
if (r7 == 0) goto L_0x0d89;
L_0x0d83:
r8 = r7.isRecycled();
if (r8 == 0) goto L_0x0da1;
L_0x0d89:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0d97:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
goto L_0x0d40;
L_0x0da1:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0dad:
r0 = r21;
r6 = r0.title;
if (r6 == 0) goto L_0x0e65;
L_0x0db3:
r0 = r21;
r6 = r0.title;
r6 = r6.length();
if (r6 <= 0) goto L_0x0e65;
L_0x0dbd:
r0 = r20;
r6 = r0.eCm;
r7 = 0;
r6.setVisibility(r7);
L_0x0dc5:
r0 = r20;
r6 = r0.eCn;
r7 = 0;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZN;
r7 = 8;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZT;
r7 = 8;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZO;
r7 = 4;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.eCn;
r7 = 2;
r6.setMaxLines(r7);
if (r22 == 0) goto L_0x0e1b;
L_0x0df1:
r6 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r7 = r0.field_imgPath;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = com.tencent.mm.bp.a.getDensity(r8);
r9 = 0;
r6 = r6.b(r7, r8, r9);
if (r6 == 0) goto L_0x0e12;
L_0x0e0c:
r7 = r6.isRecycled();
if (r7 == 0) goto L_0x0e70;
L_0x0e12:
r0 = r20;
r6 = r0.tZI;
r7 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r6.setImageResource(r7);
L_0x0e1b:
r6 = new com.tencent.mm.ui.chatting.viewitems.au;
r8 = 0;
r10 = "";
r11 = 0;
r0 = r21;
r12 = r0.title;
r0 = r21;
r13 = r0.bZG;
r0 = r21;
r14 = r0.bZH;
r0 = r21;
r15 = r0.title;
r0 = r21;
r0 = r0.dwZ;
r16 = r0;
r0 = r21;
r0 = r0.url;
r17 = r0;
r18 = 0;
r19 = 0;
r7 = r29;
r9 = r27;
r6.<init>(r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19);
r0 = r20;
r7 = r0.uac;
r7.setTag(r6);
r0 = r20;
r7 = r0.uac;
r0 = r25;
r1 = r28;
r8 = r0.h(r1);
r7.setOnClickListener(r8);
r15 = 1;
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0e65:
r0 = r20;
r6 = r0.eCm;
r7 = 8;
r6.setVisibility(r7);
goto L_0x0dc5;
L_0x0e70:
r0 = r20;
r7 = r0.tZI;
r7.setImageBitmap(r6);
goto L_0x0e1b;
L_0x0e78:
r0 = r21;
r6 = r0.title;
if (r6 == 0) goto L_0x0f3f;
L_0x0e7e:
r0 = r21;
r6 = r0.title;
r6 = r6.length();
if (r6 <= 0) goto L_0x0f3f;
L_0x0e88:
r0 = r20;
r6 = r0.eCm;
r7 = 0;
r6.setVisibility(r7);
L_0x0e90:
r0 = r20;
r6 = r0.eCn;
r7 = 0;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZN;
r7 = 8;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZT;
r7 = 8;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZO;
r7 = 4;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.eCn;
r7 = 2;
r6.setMaxLines(r7);
if (r22 == 0) goto L_0x0ee6;
L_0x0ebc:
r6 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r7 = r0.field_imgPath;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = com.tencent.mm.bp.a.getDensity(r8);
r9 = 0;
r6 = r6.b(r7, r8, r9);
if (r6 == 0) goto L_0x0edd;
L_0x0ed7:
r7 = r6.isRecycled();
if (r7 == 0) goto L_0x0f4a;
L_0x0edd:
r0 = r20;
r6 = r0.tZI;
r7 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r6.setImageResource(r7);
L_0x0ee6:
r6 = new com.tencent.mm.ui.chatting.viewitems.au;
r9 = "";
r10 = r28.cuz();
r0 = r21;
r11 = r0.bZG;
r0 = r21;
r12 = r0.bZH;
r0 = r21;
r13 = r0.title;
r0 = r21;
r14 = r0.dyG;
r0 = r21;
r15 = r0.designerName;
r0 = r21;
r0 = r0.designerRediretctUrl;
r16 = r0;
r0 = r21;
r0 = r0.url;
r17 = r0;
r7 = r29;
r8 = r27;
r6.<init>(r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17);
r0 = r20;
r7 = r0.uac;
r7.setTag(r6);
r0 = r20;
r7 = r0.uac;
r0 = r25;
r8 = r0.uay;
if (r8 != 0) goto L_0x0f32;
L_0x0f27:
r8 = new com.tencent.mm.ui.chatting.t$h;
r0 = r28;
r8.<init>(r0);
r0 = r25;
r0.uay = r8;
L_0x0f32:
r0 = r25;
r8 = r0.uay;
r7.setOnClickListener(r8);
r15 = 1;
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x0f3f:
r0 = r20;
r6 = r0.eCm;
r7 = 8;
r6.setVisibility(r7);
goto L_0x0e90;
L_0x0f4a:
r0 = r20;
r7 = r0.tZI;
r7.setImageBitmap(r6);
goto L_0x0ee6;
L_0x0f52:
r0 = r21;
r6 = r0.title;
if (r6 == 0) goto L_0x1040;
L_0x0f58:
r0 = r21;
r6 = r0.title;
r6 = r6.length();
if (r6 <= 0) goto L_0x1040;
L_0x0f62:
r0 = r20;
r6 = r0.eCm;
r7 = 0;
r6.setVisibility(r7);
L_0x0f6a:
r0 = r20;
r6 = r0.eCn;
r7 = 0;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZN;
r7 = 8;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZT;
r7 = 8;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.tZO;
r7 = 4;
r6.setVisibility(r7);
r0 = r20;
r6 = r0.eCn;
r7 = 2;
r6.setMaxLines(r7);
if (r22 == 0) goto L_0x0fc0;
L_0x0f96:
r6 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r7 = r0.field_imgPath;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = com.tencent.mm.bp.a.getDensity(r8);
r9 = 0;
r6 = r6.b(r7, r8, r9);
if (r6 == 0) goto L_0x0fb7;
L_0x0fb1:
r7 = r6.isRecycled();
if (r7 == 0) goto L_0x104b;
L_0x0fb7:
r0 = r20;
r6 = r0.tZI;
r7 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r6.setImageResource(r7);
L_0x0fc0:
r12 = new com.tencent.mm.ui.chatting.viewitems.au;
r12.<init>();
r0 = r29;
r12.bXQ = r0;
r6 = 0;
r12.tGg = r6;
r0 = r27;
r12.position = r0;
r6 = 0;
r12.ufx = r6;
r6 = r28.cuz();
r12.title = r6;
r0 = r21;
r6 = r0.bZG;
r12.bZG = r6;
r0 = r21;
r6 = r0.bZH;
r12.bZH = r6;
r0 = r21;
r6 = r0.title;
r12.ufy = r6;
r0 = r21;
r6 = r0.type;
r7 = 26;
if (r6 != r7) goto L_0x1054;
L_0x0ff3:
r0 = r21;
r6 = r0.tid;
r12.tid = r6;
r0 = r21;
r6 = r0.dyH;
r12.dyH = r6;
r0 = r21;
r6 = r0.desc;
r12.desc = r6;
r0 = r21;
r6 = r0.iconUrl;
r12.iconUrl = r6;
r0 = r21;
r6 = r0.secondUrl;
r12.secondUrl = r6;
r0 = r21;
r6 = r0.pageType;
r12.pageType = r6;
r0 = r20;
r6 = r0.uac;
r0 = r25;
r7 = r0.uaz;
if (r7 != 0) goto L_0x102c;
L_0x1021:
r7 = new com.tencent.mm.ui.chatting.t$k;
r0 = r28;
r7.<init>(r0);
r0 = r25;
r0.uaz = r7;
L_0x102c:
r0 = r25;
r7 = r0.uaz;
r6.setOnClickListener(r7);
r6 = 1;
L_0x1034:
r0 = r20;
r7 = r0.uac;
r7.setTag(r12);
r7 = r23;
r15 = r6;
goto L_0x0342;
L_0x1040:
r0 = r20;
r6 = r0.eCm;
r7 = 8;
r6.setVisibility(r7);
goto L_0x0f6a;
L_0x104b:
r0 = r20;
r7 = r0.tZI;
r7.setImageBitmap(r6);
goto L_0x0fc0;
L_0x1054:
r0 = r21;
r6 = r0.type;
r7 = 27;
if (r6 != r7) goto L_0x143c;
L_0x105c:
r0 = r21;
r6 = r0.tid;
r12.tid = r6;
r0 = r21;
r6 = r0.dyH;
r12.dyH = r6;
r0 = r21;
r6 = r0.desc;
r12.desc = r6;
r0 = r21;
r6 = r0.iconUrl;
r12.iconUrl = r6;
r0 = r21;
r6 = r0.secondUrl;
r12.secondUrl = r6;
r0 = r21;
r6 = r0.pageType;
r12.pageType = r6;
r0 = r20;
r6 = r0.uac;
r0 = r25;
r7 = r0.uaA;
if (r7 != 0) goto L_0x1095;
L_0x108a:
r7 = new com.tencent.mm.ui.chatting.t$i;
r0 = r28;
r7.<init>(r0);
r0 = r25;
r0.uaA = r7;
L_0x1095:
r0 = r25;
r7 = r0.uaA;
r6.setOnClickListener(r7);
r6 = 1;
goto L_0x1034;
L_0x109e:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.eCm;
r0 = r21;
r8 = r0.description;
r7.setText(r8);
r0 = r20;
r7 = r0.eCn;
r0 = r21;
r8 = r0.dxF;
r7.setText(r8);
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x1121;
L_0x10c2:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x1121;
L_0x10cc:
r0 = r20;
r7 = r0.tZN;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r0 = r21;
r8 = r0.title;
r7.setText(r8);
L_0x10df:
r0 = r20;
r7 = r0.eCn;
r8 = 4;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x1437;
L_0x10fa:
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r10 = 0;
r7 = r7.b(r8, r9, r10);
if (r7 == 0) goto L_0x112b;
L_0x1115:
r0 = r20;
r8 = r0.tZI;
r8.setImageBitmap(r7);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x1121:
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
goto L_0x10df;
L_0x112b:
r0 = r20;
r7 = r0.tZI;
r8 = com.tencent.mm.R.k.app_attach_file_icon_webpage;
r7.setImageResource(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x1139:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZN;
r8 = 0;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x11bc;
L_0x1150:
r0 = r21;
r7 = r0.title;
r7 = r7.trim();
r7 = r7.length();
if (r7 <= 0) goto L_0x11bc;
L_0x115e:
r0 = r20;
r7 = r0.tZN;
r0 = r20;
r8 = r0.tZN;
r8 = r8.getContext();
r0 = r21;
r9 = r0.title;
r0 = r20;
r10 = r0.tZN;
r10 = r10.getTextSize();
r8 = com.tencent.mm.pluginsdk.ui.d.j.a(r8, r9, r10);
r7.setText(r8);
L_0x117d:
r0 = r20;
r7 = r0.eCn;
r8 = 3;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
if (r22 == 0) goto L_0x11aa;
L_0x1198:
r0 = r20;
r7 = r0.tZI;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.uab;
r8 = 8;
r7.setVisibility(r8);
L_0x11aa:
r0 = r28;
r1 = r20;
r2 = r21;
r3 = r29;
r4 = r22;
com.tencent.mm.ui.chatting.viewitems.c.c.a(r0, r1, r2, r3, r4);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x11bc:
r0 = r20;
r7 = r0.tZN;
r0 = r20;
r8 = r0.tZN;
r8 = r8.getContext();
r9 = com.tencent.mm.sdk.platformtools.ad.getContext();
r10 = com.tencent.mm.R.l.favorite_wenote;
r9 = r9.getString(r10);
r0 = r20;
r10 = r0.tZN;
r10 = r10.getTextSize();
r8 = com.tencent.mm.pluginsdk.ui.d.j.a(r8, r9, r10);
r7.setText(r8);
goto L_0x117d;
L_0x11e2:
r0 = r28;
r1 = r20;
r2 = r21;
r3 = r22;
com.tencent.mm.ui.chatting.viewitems.c.c.a(r0, r1, r2, r3);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x11f2:
r0 = r21;
r7 = r0.title;
if (r7 == 0) goto L_0x1342;
L_0x11f8:
r0 = r21;
r7 = r0.title;
r7 = r7.length();
if (r7 <= 0) goto L_0x1342;
L_0x1202:
r0 = r20;
r7 = r0.eCm;
r8 = 0;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.dxO;
r7 = com.tencent.mm.sdk.platformtools.bi.oW(r7);
if (r7 != 0) goto L_0x1327;
L_0x1214:
r0 = r20;
r7 = r0.eCm;
r0 = r21;
r8 = r0.dxO;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = r9.getResources();
r10 = com.tencent.mm.R.e.black;
r9 = r9.getColor(r10);
r8 = com.tencent.mm.sdk.platformtools.bi.bc(r8, r9);
r7.setTextColor(r8);
L_0x1235:
r0 = r20;
r7 = r0.eCn;
r8 = 2;
r7.setMaxLines(r8);
r0 = r20;
r7 = r0.eCn;
r8 = 0;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.dxP;
r7 = com.tencent.mm.sdk.platformtools.bi.oW(r7);
if (r7 != 0) goto L_0x134d;
L_0x124f:
r0 = r20;
r7 = r0.eCn;
r0 = r21;
r8 = r0.dxP;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = r9.getResources();
r10 = com.tencent.mm.R.e.grey_background_text_color;
r9 = r9.getColor(r10);
r8 = com.tencent.mm.sdk.platformtools.bi.bc(r8, r9);
r7.setTextColor(r8);
L_0x1270:
r0 = r20;
r7 = r0.tZN;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZO;
r8 = 4;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZT;
r8 = 8;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.tZM;
r8 = 0;
r7.setVisibility(r8);
r0 = r20;
r7 = r0.jet;
r8 = 0;
r7.setVisibility(r8);
r0 = r21;
r7 = r0.dxK;
r7 = com.tencent.mm.sdk.platformtools.bi.oW(r7);
if (r7 != 0) goto L_0x1368;
L_0x12a4:
r0 = r20;
r7 = r0.jet;
r0 = r21;
r8 = r0.dxK;
r7.setText(r8);
L_0x12af:
r0 = r25;
r7 = r0.qUB;
if (r7 == 0) goto L_0x138e;
L_0x12b5:
r7 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r8 = r0.field_imgPath;
r0 = r28;
r9 = r0.tTq;
r9 = r9.getContext();
r9 = com.tencent.mm.bp.a.getDensity(r9);
r10 = 0;
r7 = r7.a(r8, r9, r10);
if (r7 == 0) goto L_0x12e9;
L_0x12d0:
r8 = r7.isRecycled();
if (r8 != 0) goto L_0x12e9;
L_0x12d6:
r8 = 0;
r9 = r7.getWidth();
r9 = r9 / 2;
r9 = (float) r9;
r8 = com.tencent.mm.sdk.platformtools.c.a(r7, r8, r9);
r0 = r20;
r9 = r0.tZI;
r9.setImageBitmap(r8);
L_0x12e9:
r0 = r21;
r8 = r0.dxN;
r8 = com.tencent.mm.sdk.platformtools.bi.oW(r8);
if (r8 != 0) goto L_0x1373;
L_0x12f3:
r7 = com.tencent.mm.ak.o.Pj();
r0 = r21;
r8 = r0.dxN;
r9 = new android.widget.ImageView;
r0 = r28;
r10 = r0.tTq;
r10 = r10.getContext();
r9.<init>(r10);
r10 = new com.tencent.mm.ak.a.a.c$a;
r10.<init>();
r11 = 1;
r10.dXy = r11;
r10 = r10.Pt();
r11 = new com.tencent.mm.ui.chatting.viewitems.c$d$3;
r0 = r25;
r1 = r20;
r2 = r28;
r11.<init>(r0, r1, r2);
r7.a(r8, r9, r10, r11);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x1327:
r0 = r20;
r7 = r0.eCm;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = r8.getResources();
r9 = com.tencent.mm.R.e.black;
r8 = r8.getColor(r9);
r7.setTextColor(r8);
goto L_0x1235;
L_0x1342:
r0 = r20;
r7 = r0.eCm;
r8 = 8;
r7.setVisibility(r8);
goto L_0x1235;
L_0x134d:
r0 = r20;
r7 = r0.eCn;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = r8.getResources();
r9 = com.tencent.mm.R.e.grey_background_text_color;
r8 = r8.getColor(r9);
r7.setTextColor(r8);
goto L_0x1270;
L_0x1368:
r0 = r20;
r7 = r0.jet;
r8 = com.tencent.mm.R.l.chatting_item_coupon_card;
r7.setText(r8);
goto L_0x12af;
L_0x1373:
r0 = r20;
r8 = r0.uad;
r8 = r8.getViewTreeObserver();
r9 = new com.tencent.mm.ui.chatting.viewitems.c$d$4;
r0 = r25;
r1 = r20;
r2 = r28;
r9.<init>(r0, r1, r2, r7);
r8.addOnPreDrawListener(r9);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x138e:
r0 = r20;
r7 = r0.tZI;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getMMResources();
r9 = com.tencent.mm.R.g.nosdcard_app;
r8 = android.graphics.BitmapFactory.decodeResource(r8, r9);
r7.setImageBitmap(r8);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x13a8:
r7 = r14.dzv;
r8 = 19;
if (r7 != r8) goto L_0x1437;
L_0x13ae:
r0 = r28;
r1 = r20;
r2 = r21;
r3 = r22;
com.tencent.mm.ui.chatting.viewitems.c.c.a(r0, r1, r2, r3);
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x13be:
r0 = r20;
r6 = r0.tZN;
r7 = 8;
r6.setVisibility(r7);
goto L_0x036f;
L_0x13c9:
r6 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r7 = r0.field_imgPath;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = com.tencent.mm.bp.a.getDensity(r8);
r9 = 0;
r6 = r6.b(r7, r8, r9);
if (r6 == 0) goto L_0x13ea;
L_0x13e4:
r7 = r6.isRecycled();
if (r7 == 0) goto L_0x1403;
L_0x13ea:
r6 = com.tencent.mm.ak.o.Pf();
r0 = r29;
r7 = r0.field_imgPath;
r0 = r28;
r8 = r0.tTq;
r8 = r8.getContext();
r8 = com.tencent.mm.bp.a.getDensity(r8);
r9 = 0;
r6 = r6.a(r7, r8, r9);
L_0x1403:
if (r6 == 0) goto L_0x1414;
L_0x1405:
r7 = r6.isRecycled();
if (r7 != 0) goto L_0x1414;
L_0x140b:
r0 = r20;
r7 = r0.tZI;
r7.setImageBitmap(r6);
goto L_0x03ce;
L_0x1414:
r0 = r20;
r6 = r0.tZI;
r7 = com.tencent.mm.R.g.appshareimage_icon;
r6.setImageResource(r7);
goto L_0x03ce;
L_0x141f:
r0 = r20;
r6 = r0.tZW;
r7 = 8;
r6.setVisibility(r7);
r6 = r12;
goto L_0x03f4;
L_0x142b:
r0 = r20;
r6 = r0.tZW;
r7 = 8;
r6.setVisibility(r7);
r6 = r12;
goto L_0x03f4;
L_0x1437:
r7 = r23;
r12 = r6;
goto L_0x0342;
L_0x143c:
r6 = r15;
goto L_0x1034;
L_0x143f:
r16 = r7;
goto L_0x0049;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.ui.chatting.viewitems.c$d.a(com.tencent.mm.ui.chatting.viewitems.b$a, int, com.tencent.mm.ui.chatting.c.a, com.tencent.mm.storage.bd, java.lang.String):void");
}
public final boolean a(ContextMenu contextMenu, View view, bd bdVar) {
int i = ((au) view.getTag()).position;
int SY = l.SY(com.tencent.mm.model.bd.b(this.tKy.cwr(), bdVar.field_content, bdVar.field_isSend));
g.a gp = g.a.gp(com.tencent.mm.model.bd.b(this.tKy.cwr(), bdVar.field_content, bdVar.field_isSend));
f bl = com.tencent.mm.pluginsdk.model.app.g.bl(gp.appId, false);
if (com.tencent.mm.pluginsdk.model.app.g.h(bl) && !j.au(bdVar)) {
if (gp.type == 6) {
b SZ = l.SZ(gp.bGP);
if ((SZ == null || !c.b.e(bdVar, SZ.field_fileFullPath)) && !bdVar.cmu()) {
contextMenu.add(i, 111, 0, this.tKy.tTq.getMMResources().getString(R.l.retransmit));
}
} else {
contextMenu.add(i, 111, 0, this.tKy.tTq.getMMResources().getString(R.l.retransmit));
}
}
if (gp.dwo <= 0 || (gp.dwo > 0 && SY >= 100)) {
boolean MH;
switch (gp.type) {
case 1:
MH = com.tencent.mm.ac.f.MH();
break;
case 2:
MH = com.tencent.mm.ac.f.MI();
break;
case 3:
MH = com.tencent.mm.ac.f.MP();
break;
case 4:
MH = com.tencent.mm.ac.f.MJ();
break;
case 5:
MH = com.tencent.mm.ac.f.MN();
break;
case 6:
MH = com.tencent.mm.ac.f.MO();
break;
case 8:
MH = com.tencent.mm.ac.f.ML();
break;
case 16:
if (gp.dxG != 5 && gp.dxG != 6 && gp.dxG != 2) {
MH = false;
break;
}
if (gp.dxG != 2 || bf.l(bdVar)) {
contextMenu.clear();
}
contextMenu.add(i, 100, 0, this.tKy.tTq.getMMResources().getString(R.l.chatting_long_click_menu_delete_msg));
return false;
break;
case a$i.AppCompatTheme_actionModePasteDrawable /*34*/:
contextMenu.clear();
contextMenu.add(i, 100, 0, this.tKy.tTq.getMMResources().getString(R.l.chatting_long_click_menu_delete_msg));
return false;
default:
MH = false;
break;
}
if (MH && !this.tKy.cws()) {
contextMenu.add(i, 114, 0, view.getContext().getString(R.l.chatting_long_click_brand_service));
}
}
if (d.QS("favorite") && (bl == null || !bl.aaq())) {
switch (gp.type) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 10:
case 13:
case 19:
case 20:
case 24:
contextMenu.add(i, 116, 0, view.getContext().getString(R.l.plugin_favorite_opt));
break;
}
}
dj djVar = new dj();
djVar.bLf.bJC = bdVar.field_msgId;
com.tencent.mm.sdk.b.a.sFg.m(djVar);
if (djVar.bLg.bKE || c.b.a(this.tKy.tTq.getContext(), gp)) {
contextMenu.add(i, 129, 0, view.getContext().getString(R.l.chatting_long_click_menu_open));
}
if (bf.l(bdVar)) {
contextMenu.clear();
}
if (!this.tKy.cws()) {
contextMenu.add(i, 100, 0, this.tKy.tTq.getMMResources().getString(R.l.chatting_long_click_menu_delete_msg));
}
return true;
}
public final boolean a(MenuItem menuItem, a aVar, bd bdVar) {
g.a aVar2;
switch (menuItem.getItemId()) {
case a$i.AppCompatTheme_buttonStyle /*100*/:
String str = bdVar.field_content;
aVar2 = null;
if (str != null) {
aVar2 = g.a.gp(str);
}
if (aVar2 != null) {
l.fJ(bdVar.field_msgId);
if (19 == aVar2.type) {
mw mwVar = new mw();
mwVar.bXL.type = 3;
mwVar.bXL.bJC = bdVar.field_msgId;
com.tencent.mm.sdk.b.a.sFg.m(mwVar);
}
com.tencent.mm.model.bd.aU(bdVar.field_msgId);
f bl = com.tencent.mm.pluginsdk.model.app.g.bl(aVar2.appId, false);
if (bl != null && bl.aaq()) {
a(aVar, aVar2, bdVar, bl);
}
if (aVar2.type == 3) {
c.f(bdVar, aVar.getTalkerUserName());
break;
}
}
break;
case 111:
c.b.a(aVar, bdVar, b(aVar, bdVar));
break;
case 114:
String str2 = bdVar.field_content;
if (str2 != null) {
aVar2 = g.a.gp(str2);
if (aVar2 != null) {
switch (aVar2.type) {
case 1:
am.l(com.tencent.mm.model.bd.b(aVar.cwr(), bdVar.field_content, bdVar.field_isSend), aVar.tTq.getContext());
break;
case 2:
am.a(bdVar, aVar.tTq.getContext(), b(aVar, bdVar), aVar.cwr());
break;
case 3:
am.a(bdVar, com.tencent.mm.model.bd.b(aVar.cwr(), bdVar.field_content, bdVar.field_isSend), aVar.tTq.getContext());
break;
case 4:
am.c(bdVar, aVar.tTq.getContext());
break;
case 5:
am.c(bdVar, com.tencent.mm.model.bd.b(aVar.cwr(), bdVar.field_content, bdVar.field_isSend), aVar.tTq.getContext());
break;
case 6:
am.b(bdVar, com.tencent.mm.model.bd.b(aVar.cwr(), bdVar.field_content, bdVar.field_isSend), aVar.tTq.getContext());
break;
case 8:
am.d(bdVar, aVar.tTq.getContext());
break;
}
}
}
break;
}
return false;
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
public final boolean b(android.view.View r16, com.tencent.mm.ui.chatting.c.a r17, com.tencent.mm.storage.bd r18) {
/*
r15 = this;
r2 = com.tencent.mm.modelstat.a.a.ehI;
r0 = r18;
com.tencent.mm.modelstat.a.a(r0, r2);
r0 = r18;
r4 = r0.field_content;
r2 = 0;
r2 = java.lang.Boolean.valueOf(r2);
if (r4 != 0) goto L_0x0014;
L_0x0012:
r2 = 0;
L_0x0013:
return r2;
L_0x0014:
r3 = r17.cwr();
r0 = r18;
r5 = r0.field_content;
r0 = r18;
r6 = r0.field_isSend;
r3 = com.tencent.mm.model.bd.b(r3, r5, r6);
r3 = com.tencent.mm.y.g.a.gp(r3);
r4 = com.tencent.mm.y.k.gv(r4);
if (r3 != 0) goto L_0x0030;
L_0x002e:
r2 = 0;
goto L_0x0013;
L_0x0030:
r5 = r4.dzv;
if (r5 == 0) goto L_0x003d;
L_0x0034:
r2 = 1;
r2 = java.lang.Boolean.valueOf(r2);
r4 = r4.dzv;
r3.type = r4;
L_0x003d:
r8 = r2;
r2 = r3.appId;
r4 = 0;
r5 = com.tencent.mm.pluginsdk.model.app.g.bl(r2, r4);
if (r5 == 0) goto L_0x005a;
L_0x0047:
r2 = r5.aaq();
if (r2 == 0) goto L_0x005a;
L_0x004d:
r4 = d(r17, r18);
r0 = r18;
r6 = r0.field_msgSvrId;
r2 = r17;
a(r2, r3, r4, r5, r6);
L_0x005a:
r7 = 0;
r2 = r3.type;
switch(r2) {
case 3: goto L_0x00b8;
case 4: goto L_0x00d4;
case 6: goto L_0x014b;
case 7: goto L_0x0182;
case 10: goto L_0x01ec;
case 13: goto L_0x027c;
case 16: goto L_0x02ec;
case 19: goto L_0x02b4;
case 20: goto L_0x0234;
case 24: goto L_0x0546;
case 33: goto L_0x0325;
case 34: goto L_0x057a;
case 36: goto L_0x0475;
default: goto L_0x0060;
};
L_0x0060:
r2 = r3.url;
if (r2 == 0) goto L_0x082c;
L_0x0064:
r2 = r3.url;
r4 = "";
r2 = r2.equals(r4);
if (r2 != 0) goto L_0x082c;
L_0x006f:
r2 = r3.canvasPageXml;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 != 0) goto L_0x05db;
L_0x0077:
r2 = new android.content.Intent;
r2.<init>();
r4 = "sns_landig_pages_from_source";
r5 = 5;
r2.putExtra(r4, r5);
r4 = "msg_id";
r0 = r18;
r6 = r0.field_msgId;
r2.putExtra(r4, r6);
r4 = "sns_landing_pages_xml";
r3 = r3.canvasPageXml;
r2.putExtra(r4, r3);
r3 = "sns_landing_pages_share_thumb_url";
r0 = r18;
r4 = r0.field_imgPath;
r2.putExtra(r3, r4);
r3 = 268435456; // 0x10000000 float:2.5243549E-29 double:1.32624737E-315;
r2.addFlags(r3);
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "sns";
r5 = ".ui.SnsAdNativeLandingPagesPreviewUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x00b8:
r2 = com.tencent.mm.plugin.report.service.h.mEJ;
r4 = 13043; // 0x32f3 float:1.8277E-41 double:6.444E-320;
r5 = 3;
r5 = new java.lang.Object[r5];
r6 = 0;
r7 = 2;
r7 = java.lang.Integer.valueOf(r7);
r5[r6] = r7;
r6 = 1;
r7 = r3.description;
r5[r6] = r7;
r6 = 2;
r7 = r3.appId;
r5[r6] = r7;
r2.h(r4, r5);
L_0x00d4:
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
r2 = com.tencent.mm.p.a.by(r2);
if (r2 != 0) goto L_0x00f0;
L_0x00e2:
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
r2 = com.tencent.mm.p.a.bw(r2);
if (r2 == 0) goto L_0x00fc;
L_0x00f0:
r2 = "MicroMsg.ChattingItemAppMsgFrom";
r3 = "Voip is running, can't do this";
com.tencent.mm.sdk.platformtools.x.i(r2, r3);
r2 = 1;
goto L_0x0013;
L_0x00fc:
r0 = r17;
r1 = r18;
r2 = r15.a(r0, r3, r1);
if (r2 == 0) goto L_0x0109;
L_0x0106:
r2 = 1;
goto L_0x0013;
L_0x0109:
r2 = r3.url;
r4 = "message";
r4 = com.tencent.mm.pluginsdk.model.app.p.B(r2, r4);
r2 = r3.dwn;
r5 = "message";
r5 = com.tencent.mm.pluginsdk.model.app.p.B(r2, r5);
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
r6 = r3.appId;
r2 = getPackageInfo(r2, r6);
if (r2 != 0) goto L_0x0145;
L_0x012b:
r6 = 0;
L_0x012c:
if (r2 != 0) goto L_0x0148;
L_0x012e:
r7 = 0;
L_0x012f:
r8 = r3.appId;
r9 = 1;
r0 = r18;
r10 = r0.field_msgId;
r0 = r18;
r12 = r0.field_msgSvrId;
r2 = r15;
r3 = r17;
r14 = r18;
r2.a(r3, r4, r5, r6, r7, r8, r9, r10, r12, r14);
r2 = 1;
goto L_0x0013;
L_0x0145:
r6 = r2.versionName;
goto L_0x012c;
L_0x0148:
r7 = r2.versionCode;
goto L_0x012f;
L_0x014b:
r2 = r15.qUB;
if (r2 != 0) goto L_0x015d;
L_0x014f:
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
com.tencent.mm.ui.base.s.gH(r2);
r2 = 1;
goto L_0x0013;
L_0x015d:
r2 = new android.content.Intent;
r2.<init>();
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "com.tencent.mm.ui.chatting.AppAttachDownloadUI";
r2.setClassName(r3, r4);
r3 = "app_msg_id";
r0 = r18;
r4 = r0.field_msgId;
r2.putExtra(r3, r4);
r0 = r17;
r0.startActivity(r2);
r2 = 1;
goto L_0x0013;
L_0x0182:
if (r5 == 0) goto L_0x0195;
L_0x0184:
r2 = r5.aaq();
if (r2 == 0) goto L_0x0195;
L_0x018a:
r0 = r17;
r2 = a(r0, r5);
if (r2 == 0) goto L_0x0195;
L_0x0192:
r2 = 1;
goto L_0x0013;
L_0x0195:
r2 = r3.bGP;
if (r2 == 0) goto L_0x01a1;
L_0x0199:
r2 = r3.bGP;
r2 = r2.length();
if (r2 != 0) goto L_0x01b3;
L_0x01a1:
r2 = com.tencent.mm.ui.chatting.b.b.a.class;
r0 = r17;
r2 = r0.O(r2);
r2 = (com.tencent.mm.ui.chatting.b.b.a) r2;
r0 = r18;
r2.aR(r0);
L_0x01b0:
r2 = 1;
goto L_0x0013;
L_0x01b3:
r2 = r15.qUB;
if (r2 != 0) goto L_0x01c5;
L_0x01b7:
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
com.tencent.mm.ui.base.s.gH(r2);
r2 = 1;
goto L_0x0013;
L_0x01c5:
r2 = new android.content.Intent;
r2.<init>();
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "com.tencent.mm.ui.chatting.AppAttachDownloadUI";
r2.setClassName(r3, r4);
r3 = "app_msg_id";
r0 = r18;
r4 = r0.field_msgId;
r2.putExtra(r3, r4);
r0 = r17;
r3 = r0.tTq;
r4 = 210; // 0xd2 float:2.94E-43 double:1.04E-321;
r3.startActivityForResult(r2, r4);
goto L_0x01b0;
L_0x01ec:
r2 = r3.dwS;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 == 0) goto L_0x01f7;
L_0x01f4:
r2 = 0;
goto L_0x0013;
L_0x01f7:
r2 = new android.content.Intent;
r2.<init>();
r4 = 65536; // 0x10000 float:9.18355E-41 double:3.2379E-319;
r2.setFlags(r4);
r4 = "key_Product_xml";
r3 = r3.dwS;
r2.putExtra(r4, r3);
r3 = "key_ProductUI_getProductInfoScene";
r4 = 1;
r2.putExtra(r3, r4);
r0 = r18;
r3 = r0.field_imgPath;
if (r3 != 0) goto L_0x0220;
L_0x0216:
r3 = "key_ProductUI_chatting_msgId";
r0 = r18;
r4 = r0.field_msgId;
r2.putExtra(r3, r4);
L_0x0220:
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "scanner";
r5 = ".ui.ProductUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x0234:
r2 = r3.dwV;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 == 0) goto L_0x023f;
L_0x023c:
r2 = 0;
goto L_0x0013;
L_0x023f:
r2 = new android.content.Intent;
r2.<init>();
r4 = 65536; // 0x10000 float:9.18355E-41 double:3.2379E-319;
r2.setFlags(r4);
r4 = "key_TV_xml";
r3 = r3.dwV;
r2.putExtra(r4, r3);
r3 = "key_TV_getProductInfoScene";
r4 = 1;
r2.putExtra(r3, r4);
r0 = r18;
r3 = r0.field_imgPath;
if (r3 != 0) goto L_0x0268;
L_0x025e:
r3 = "key_TVInfoUI_chatting_msgId";
r0 = r18;
r4 = r0.field_msgId;
r2.putExtra(r3, r4);
L_0x0268:
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "shake";
r5 = ".ui.TVInfoUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x027c:
r2 = r3.dwY;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 == 0) goto L_0x0287;
L_0x0284:
r2 = 0;
goto L_0x0013;
L_0x0287:
r2 = new android.content.Intent;
r2.<init>();
r4 = 65536; // 0x10000 float:9.18355E-41 double:3.2379E-319;
r2.setFlags(r4);
r4 = "key_product_info";
r3 = r3.dwY;
r2.putExtra(r4, r3);
r3 = "key_product_scene";
r4 = 1;
r2.putExtra(r3, r4);
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "product";
r5 = ".ui.MallProductUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x02b4:
r2 = new android.content.Intent;
r2.<init>();
r4 = "message_id";
r0 = r18;
r6 = r0.field_msgId;
r2.putExtra(r4, r6);
r4 = "record_xml";
r3 = r3.dwW;
r2.putExtra(r4, r3);
r3 = "big_appmsg";
r2.putExtra(r3, r8);
r0 = r17;
r1 = r18;
com.tencent.mm.ui.chatting.viewitems.c$a.a(r2, r0, r1, r15);
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "record";
r5 = ".ui.RecordMsgDetailUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x02ec:
r2 = r3.bRw;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 == 0) goto L_0x02f7;
L_0x02f4:
r2 = 0;
goto L_0x0013;
L_0x02f7:
r2 = new android.content.Intent;
r2.<init>();
r4 = 65536; // 0x10000 float:9.18355E-41 double:3.2379E-319;
r2.setFlags(r4);
r4 = "key_card_app_msg";
r5 = r3.bRw;
r2.putExtra(r4, r5);
r4 = "key_from_scene";
r3 = r3.dxG;
r2.putExtra(r4, r3);
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "card";
r5 = ".ui.CardDetailUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x0325:
r2 = "MicroMsg.ChattingItemAppMsgFrom";
r4 = "username: %s , path: %s ,appid %s ,url : %s, pkgType : %s, md5 : %s";
r5 = 6;
r5 = new java.lang.Object[r5];
r6 = 0;
r8 = r3.dyS;
r5[r6] = r8;
r6 = 1;
r8 = r3.dyR;
r5[r6] = r8;
r6 = 2;
r8 = r3.dyT;
r5[r6] = r8;
r6 = 3;
r8 = r3.url;
r5[r6] = r8;
r6 = 4;
r8 = r3.dyZ;
r8 = java.lang.Integer.valueOf(r8);
r5[r6] = r8;
r6 = 5;
r8 = r3.dyV;
r5[r6] = r8;
com.tencent.mm.sdk.platformtools.x.i(r2, r4, r5);
r8 = r17.getTalkerUserName();
r0 = r17;
r1 = r18;
r9 = r15.b(r0, r1);
r6 = new android.os.Bundle;
r6.<init>();
r0 = r17;
r2 = r0.tTq;
r2 = r2 instanceof com.tencent.mm.ui.chatting.AppBrandServiceChattingUI.a;
if (r2 == 0) goto L_0x03aa;
L_0x036c:
r4 = "stat_scene";
r2 = 10;
r5 = r6;
L_0x0372:
r5.putInt(r4, r2);
r2 = "stat_msg_id";
r4 = new java.lang.StringBuilder;
r5 = "msg_";
r4.<init>(r5);
r0 = r18;
r10 = r0.field_msgSvrId;
r5 = java.lang.Long.toString(r10);
r4 = r4.append(r5);
r4 = r4.toString();
r6.putString(r2, r4);
r2 = "stat_chat_talker_username";
r6.putString(r2, r8);
r2 = "stat_send_msg_user";
r6.putString(r2, r9);
r2 = r3.dyU;
switch(r2) {
case 1: goto L_0x03c5;
case 2: goto L_0x0443;
case 3: goto L_0x046b;
default: goto L_0x03a4;
};
L_0x03a4:
r2 = 1;
L_0x03a5:
if (r2 != 0) goto L_0x0060;
L_0x03a7:
r2 = 1;
goto L_0x0013;
L_0x03aa:
r2 = r17.cwr();
if (r2 == 0) goto L_0x03b6;
L_0x03b0:
r4 = "stat_scene";
r2 = 2;
r5 = r6;
goto L_0x0372;
L_0x03b6:
r4 = "stat_scene";
r2 = com.tencent.mm.model.s.hf(r8);
if (r2 == 0) goto L_0x03c2;
L_0x03bf:
r2 = 7;
r5 = r6;
goto L_0x0372;
L_0x03c2:
r2 = 1;
r5 = r6;
goto L_0x0372;
L_0x03c5:
r2 = new android.content.Intent;
r2.<init>();
r4 = "key_username";
r5 = r3.dyS;
r2.putExtra(r4, r5);
r4 = r17.cwr();
if (r4 == 0) goto L_0x0435;
L_0x03d8:
r4 = "key_from_scene";
r5 = 1;
r2.putExtra(r4, r5);
r4 = "key_scene_note";
r5 = new java.lang.StringBuilder;
r5.<init>();
r5 = r5.append(r8);
r8 = ":";
r5 = r5.append(r8);
r5 = r5.append(r9);
r5 = r5.toString();
r2.putExtra(r4, r5);
L_0x03fd:
r4 = new com.tencent.mm.plugin.appbrand.config.WxaExposedParams$a;
r4.<init>();
r5 = r3.dyT;
r4.appId = r5;
r5 = 6;
r4.bJu = r5;
r5 = r3.dyZ;
r4.fih = r5;
r5 = r3.dyW;
r4.fii = r5;
r5 = "key_scene_exposed_params";
r4 = r4.aeo();
r2.putExtra(r5, r4);
r4 = "_stat_obj";
r2.putExtra(r4, r6);
r0 = r17;
r4 = r0.tTq;
r4 = r4.getContext();
r5 = "appbrand";
r6 = ".ui.AppBrandProfileUI";
com.tencent.mm.bg.d.b(r4, r5, r6, r2);
r2 = r7;
goto L_0x03a5;
L_0x0435:
r4 = "key_from_scene";
r5 = 2;
r2.putExtra(r4, r5);
r4 = "key_scene_note";
r2.putExtra(r4, r8);
goto L_0x03fd;
L_0x0443:
r0 = r17;
r2 = r0.tTq;
r2 = r2 instanceof com.tencent.mm.ui.chatting.AppBrandServiceChattingUI.a;
if (r2 == 0) goto L_0x0453;
L_0x044b:
r2 = 1073; // 0x431 float:1.504E-42 double:5.3E-321;
com.tencent.mm.modelappbrand.a.a(r8, r2, r3, r6);
r2 = r7;
goto L_0x03a5;
L_0x0453:
r2 = com.tencent.mm.model.s.hf(r8);
if (r2 == 0) goto L_0x0461;
L_0x0459:
r2 = 1074; // 0x432 float:1.505E-42 double:5.306E-321;
com.tencent.mm.modelappbrand.a.a(r8, r2, r3, r6);
r2 = r7;
goto L_0x03a5;
L_0x0461:
r2 = r17.cwr();
com.tencent.mm.modelappbrand.a.a(r8, r9, r2, r3, r6);
r2 = r7;
goto L_0x03a5;
L_0x046b:
r2 = r17.cwr();
com.tencent.mm.modelappbrand.a.b(r8, r9, r2, r3, r6);
r2 = r7;
goto L_0x03a5;
L_0x0475:
r2 = r3.dyT;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 == 0) goto L_0x04c7;
L_0x047d:
r2 = r3.dyS;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 == 0) goto L_0x04c7;
L_0x0485:
r4 = r3.url;
r2 = r17.cwr();
if (r2 == 0) goto L_0x04c3;
L_0x048d:
r2 = "groupmessage";
L_0x0490:
r2 = com.tencent.mm.pluginsdk.model.app.p.B(r4, r2);
r4 = new android.content.Intent;
r4.<init>();
r5 = "rawUrl";
r4.putExtra(r5, r2);
r2 = "webpageTitle";
r5 = r3.title;
r4.putExtra(r2, r5);
r2 = "shortUrl";
r3 = r3.url;
r4.putExtra(r2, r3);
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
r3 = "webview";
r5 = ".ui.tools.WebViewUI";
com.tencent.mm.bg.d.b(r2, r3, r5, r4);
r2 = 1;
goto L_0x0013;
L_0x04c3:
r2 = "singlemessage";
goto L_0x0490;
L_0x04c7:
r7 = r17.getTalkerUserName();
r0 = r17;
r1 = r18;
r8 = r15.b(r0, r1);
r6 = new android.os.Bundle;
r6.<init>();
r2 = r17.cwr();
if (r2 == 0) goto L_0x0537;
L_0x04de:
r4 = "stat_scene";
r2 = 2;
r5 = r6;
L_0x04e3:
r5.putInt(r4, r2);
r2 = "stat_msg_id";
r4 = new java.lang.StringBuilder;
r5 = "msg_";
r4.<init>(r5);
r0 = r18;
r10 = r0.field_msgSvrId;
r5 = java.lang.Long.toString(r10);
r4 = r4.append(r5);
r4 = r4.toString();
r6.putString(r2, r4);
r2 = "stat_chat_talker_username";
r6.putString(r2, r7);
r2 = "stat_send_msg_user";
r6.putString(r2, r8);
r2 = com.tencent.mm.plugin.appbrand.n.d.class;
r4 = com.tencent.mm.kernel.g.l(r2);
r4 = (com.tencent.mm.plugin.appbrand.n.d) r4;
r0 = r17;
r2 = r0.tTq;
r5 = r2.getContext();
r6 = r17.getTalkerUserName();
r0 = r17;
r1 = r18;
r7 = r15.b(r0, r1);
r8 = r17.cwr();
r9 = r3;
r4.a(r5, r6, r7, r8, r9);
r2 = 1;
goto L_0x0013;
L_0x0537:
r4 = "stat_scene";
r2 = com.tencent.mm.model.s.hf(r7);
if (r2 == 0) goto L_0x0543;
L_0x0540:
r2 = 7;
r5 = r6;
goto L_0x04e3;
L_0x0543:
r2 = 1;
r5 = r6;
goto L_0x04e3;
L_0x0546:
r2 = new com.tencent.mm.g.a.lj;
r2.<init>();
r4 = r2.bVI;
r0 = r17;
r5 = r0.tTq;
r5 = r5.getContext();
r4.context = r5;
r4 = r2.bVI;
r0 = r18;
r6 = r0.field_msgId;
r4.bJC = r6;
r4 = r2.bVI;
r5 = r17.cwr();
r4.bUY = r5;
r4 = r2.bVI;
r3 = r3.dwW;
r4.bVJ = r3;
r3 = r2.bVI;
r4 = 6;
r3.scene = r4;
r3 = com.tencent.mm.sdk.b.a.sFg;
r3.m(r2);
r2 = 1;
goto L_0x0013;
L_0x057a:
r2 = new android.content.Intent;
r2.<init>();
r4 = "key_from_user_name";
r0 = r17;
r1 = r18;
r5 = r15.b(r0, r1);
r2.putExtra(r4, r5);
r4 = "key_biz_uin";
r5 = r3.dxI;
r2.putExtra(r4, r5);
r4 = "key_order_id";
r3 = r3.dxJ;
r2.putExtra(r4, r3);
r0 = r18;
r3 = r0.field_talker;
if (r3 == 0) goto L_0x05c7;
L_0x05a3:
r0 = r18;
r3 = r0.field_talker;
r4 = "";
r3 = r3.equals(r4);
if (r3 != 0) goto L_0x05c7;
L_0x05b0:
r0 = r18;
r3 = r0.field_talker;
r4 = "@chatroom";
r3 = r3.endsWith(r4);
if (r3 == 0) goto L_0x05c7;
L_0x05bd:
r3 = "key_chatroom_name";
r0 = r18;
r4 = r0.field_talker;
r2.putExtra(r3, r4);
L_0x05c7:
r0 = r17;
r3 = r0.tTq;
r3 = r3.getContext();
r4 = "card";
r5 = ".ui.CardGiftAcceptUI";
com.tencent.mm.bg.d.b(r3, r4, r5, r2);
r2 = 1;
goto L_0x0013;
L_0x05db:
r2 = com.tencent.mm.plugin.websearch.api.q.class;
r2 = r3.u(r2);
r2 = (com.tencent.mm.plugin.websearch.api.q) r2;
if (r2 == 0) goto L_0x066b;
L_0x05e5:
r4 = r2.pLr;
r4 = com.tencent.mm.sdk.platformtools.bi.oW(r4);
if (r4 != 0) goto L_0x066b;
L_0x05ed:
r3 = new android.content.Intent;
r3.<init>();
r4 = new com.tencent.mm.protocal.c.cfn;
r4.<init>();
r5 = r2.pLr;
r4.pLr = r5;
r5 = r2.pLs;
r4.pLs = r5;
r5 = r2.pLt;
r4.pLt = r5;
r5 = r2.pLu;
r4.pLu = r5;
r6 = r2.pLv;
r4.pLv = r6;
r5 = r2.pLz;
r4.pLz = r5;
r5 = r2.ixy;
r4.ixy = r5;
r5 = r2.ixz;
r4.ixz = r5;
r5 = r2.nzH;
r4.nzH = r5;
r5 = r2.pLw;
r4.pLw = r5;
r5 = r2.pLx;
r4.pLx = r5;
r5 = r2.pLy;
r4.pLy = r5;
r5 = r2.bhd;
r4.bhd = r5;
r5 = r2.lRt;
r4.lRt = r5;
r5 = r2.pLA;
r4.pLA = r5;
r2 = r2.pLC;
r4.pLC = r2;
r2 = 32;
r0 = r17;
r5 = r0.tTq;
r5 = r5.getContext();
r6 = com.tencent.mm.R.l.fts_recommend_search_keyword;
r5 = r5.getString(r6);
r2 = com.tencent.mm.plugin.topstory.a.g.a(r4, r2, r5);
r5 = "key_context";
r2 = r2.toByteArray(); Catch:{ IOException -> 0x082f }
r3.putExtra(r5, r2); Catch:{ IOException -> 0x082f }
L_0x0655:
r0 = r18;
com.tencent.mm.plugin.topstory.a.h.a(r4, r0);
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
r4 = ".ui.video.TopStoryVideoStreamUI";
com.tencent.mm.plugin.websearch.api.p.c(r2, r4, r3);
r2 = 1;
goto L_0x0013;
L_0x066b:
r4 = r3.url;
r2 = r17.cwr();
if (r2 == 0) goto L_0x080f;
L_0x0673:
r2 = "groupmessage";
L_0x0676:
r2 = com.tencent.mm.pluginsdk.model.app.p.B(r4, r2);
r4 = r3.url;
r0 = r17;
r5 = r0.tTq;
r5 = r5.getContext();
r6 = r3.appId;
r5 = getPackageInfo(r5, r6);
r6 = new android.content.Intent;
r6.<init>();
r7 = "rawUrl";
r6.putExtra(r7, r2);
r2 = "webpageTitle";
r7 = r3.title;
r6.putExtra(r2, r7);
r2 = r3.appId;
if (r2 == 0) goto L_0x06d5;
L_0x06a1:
r2 = "wx751a1acca5688ba3";
r7 = r3.appId;
r2 = r2.equals(r7);
if (r2 != 0) goto L_0x06c2;
L_0x06ac:
r2 = "wxfbc915ff7c30e335";
r7 = r3.appId;
r2 = r2.equals(r7);
if (r2 != 0) goto L_0x06c2;
L_0x06b7:
r2 = "wx482a4001c37e2b74";
r7 = r3.appId;
r2 = r2.equals(r7);
if (r2 == 0) goto L_0x06d5;
L_0x06c2:
r2 = new android.os.Bundle;
r2.<init>();
r7 = "jsapi_args_appid";
r8 = r3.appId;
r2.putString(r7, r8);
r7 = "jsapiargs";
r6.putExtra(r7, r2);
L_0x06d5:
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r4);
if (r2 != 0) goto L_0x0814;
L_0x06db:
r2 = "shortUrl";
r6.putExtra(r2, r4);
L_0x06e1:
r4 = "version_name";
if (r5 != 0) goto L_0x081e;
L_0x06e6:
r2 = 0;
L_0x06e7:
r6.putExtra(r4, r2);
r4 = "version_code";
if (r5 != 0) goto L_0x0822;
L_0x06ef:
r2 = 0;
L_0x06f0:
r6.putExtra(r4, r2);
r2 = r3.bZG;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 != 0) goto L_0x070b;
L_0x06fb:
r2 = "srcUsername";
r4 = r3.bZG;
r6.putExtra(r2, r4);
r2 = "srcDisplayname";
r4 = r3.bZH;
r6.putExtra(r2, r4);
L_0x070b:
r2 = "msg_id";
r0 = r18;
r4 = r0.field_msgId;
r6.putExtra(r2, r4);
r2 = "KPublisherId";
r4 = new java.lang.StringBuilder;
r5 = "msg_";
r4.<init>(r5);
r0 = r18;
r8 = r0.field_msgSvrId;
r5 = java.lang.Long.toString(r8);
r4 = r4.append(r5);
r4 = r4.toString();
r6.putExtra(r2, r4);
r2 = "KAppId";
r4 = r3.appId;
r6.putExtra(r2, r4);
r2 = "geta8key_username";
r4 = r17.getTalkerUserName();
r6.putExtra(r2, r4);
r2 = "pre_username";
r0 = r17;
r1 = r18;
r4 = r15.b(r0, r1);
r6.putExtra(r2, r4);
r2 = "from_scence";
r4 = 2;
r6.putExtra(r2, r4);
r2 = "expid_str";
r0 = r18;
r4 = r0.cGK;
r6.putExtra(r2, r4);
r0 = r17;
r1 = r18;
r2 = r15.b(r0, r1);
r4 = r17.getTalkerUserName();
r2 = com.tencent.mm.model.t.N(r2, r4);
r4 = "prePublishId";
r5 = new java.lang.StringBuilder;
r7 = "msg_";
r5.<init>(r7);
r0 = r18;
r8 = r0.field_msgSvrId;
r7 = java.lang.Long.toString(r8);
r5 = r5.append(r7);
r5 = r5.toString();
r6.putExtra(r4, r5);
r4 = "preUsername";
r0 = r17;
r1 = r18;
r5 = r15.b(r0, r1);
r6.putExtra(r4, r5);
r4 = "preChatName";
r5 = r17.getTalkerUserName();
r6.putExtra(r4, r5);
r4 = "preChatTYPE";
r6.putExtra(r4, r2);
r4 = "preMsgIndex";
r5 = 0;
r6.putExtra(r4, r5);
switch(r2) {
case 1: goto L_0x0828;
case 2: goto L_0x0826;
case 3: goto L_0x07ba;
case 4: goto L_0x07ba;
case 5: goto L_0x07ba;
case 6: goto L_0x082a;
case 7: goto L_0x082a;
default: goto L_0x07ba;
};
L_0x07ba:
r2 = 0;
L_0x07bb:
r4 = "share_report_pre_msg_url";
r5 = r3.url;
r6.putExtra(r4, r5);
r4 = "share_report_pre_msg_title";
r5 = r3.title;
r6.putExtra(r4, r5);
r4 = "share_report_pre_msg_desc";
r5 = r3.description;
r6.putExtra(r4, r5);
r4 = "share_report_pre_msg_icon_url";
r5 = r3.thumburl;
r6.putExtra(r4, r5);
r4 = "share_report_pre_msg_appid";
r3 = r3.appId;
r6.putExtra(r4, r3);
r3 = "share_report_from_scene";
r6.putExtra(r3, r2);
r3 = 5;
if (r2 != r3) goto L_0x07f6;
L_0x07ec:
r2 = "share_report_biz_username";
r3 = r17.getTalkerUserName();
r6.putExtra(r2, r3);
L_0x07f6:
r2 = 536870912; // 0x20000000 float:1.0842022E-19 double:2.652494739E-315;
r6.addFlags(r2);
r0 = r17;
r2 = r0.tTq;
r2 = r2.getContext();
r3 = "webview";
r4 = ".ui.tools.WebViewUI";
com.tencent.mm.bg.d.b(r2, r3, r4, r6);
r2 = 1;
goto L_0x0013;
L_0x080f:
r2 = "singlemessage";
goto L_0x0676;
L_0x0814:
r2 = "shortUrl";
r4 = r3.url;
r6.putExtra(r2, r4);
goto L_0x06e1;
L_0x081e:
r2 = r5.versionName;
goto L_0x06e7;
L_0x0822:
r2 = r5.versionCode;
goto L_0x06f0;
L_0x0826:
r2 = 2;
goto L_0x07bb;
L_0x0828:
r2 = 3;
goto L_0x07bb;
L_0x082a:
r2 = 5;
goto L_0x07bb;
L_0x082c:
r2 = 0;
goto L_0x0013;
L_0x082f:
r2 = move-exception;
goto L_0x0655;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.ui.chatting.viewitems.c$d.b(android.view.View, com.tencent.mm.ui.chatting.c.a, com.tencent.mm.storage.bd):boolean");
}
}
|
package com.moneymanager.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Document(collection = "customer")
public class Customer {
@Id
private String id;
private String name;
private String username;
private String password;
//Customer Accounts
private Account account;
//Customer Credit Score
private CreditScore creditScore;
// List Categories
private List<Category> categories;
public Customer(String id, String name, String username, String password, Account account
, CreditScore creditScore, List<Category> categories) {
this.id = id;
this.name = name;
this.username = username;
this.password = password;
this.account = account;
this.creditScore = creditScore;
this.categories = categories;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public CreditScore getCreditScore() {
return creditScore;
}
public void setCreditScore(CreditScore creditScore) {
this.creditScore = creditScore;
}
public List<Category> getCategories() {
return categories;
}
public void setCategories(List<Category> categories) {
this.categories = categories;
}
}
|
package instructable.server.dal;
import instructable.server.ccg.CcgUtils;
import instructable.server.ccg.ParserSettings;
import instructable.server.hirarchy.EmailInfo;
import instructable.server.senseffect.IIncomingEmailControlling;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
/**
* Created by Amos Azaria on 20-May-15.
*/
public class CreateParserFromFiles
{
public static ParserSettings createParser(Optional<String> userId) {
return createParser(userId, "data/lexiconEntries.txt", "data/lexiconSyn.txt", "data/examples.csv");
}
public static ParserSettings createParser(Optional<String> userId, String lexicon, String lexiconSyn, String trainingExamples)
{
List<String> lexiconEntries = null;
List<String> synonyms = null;
try
{
lexiconEntries = Files.readAllLines(Paths.get(lexicon));
synonyms = Files.readAllLines(Paths.get(lexiconSyn));
} catch (IOException e)
{
e.printStackTrace();
}
String[] unaryRules = new String[]{
"Field{0} FieldVal{0},(lambda x (evalField x))",
"FieldVal{0} S{0},(lambda x x)",
"FieldName{0} Field{0},(lambda x (getProbFieldByFieldName x))",
"FieldName{0} FieldVal{0},(lambda x (evalField (getProbFieldByFieldName x)))", //this one just combines the two above (and below).
//"MutableField{0} FieldVal{0},(lambda x (evalField x))", //no need to evaluate a mutable field, if needs mutable, why will it try to evaluate?
"FieldName{0} MutableField{0},(lambda x (getProbMutableFieldByFieldName x))",
"Field{0} S{0},(lambda x (evalField x))",
"MutableField{0} S{0},(lambda x (evalField x))",
"InstanceName{0} Instance{0},(lambda x (getProbInstanceByName x))",
"ConceptName{0} ExactInstance{0}/InstanceName{0}, (lambda x (lambda y (getInstance x y)))",
"InstanceName{0} MutableField{0}/FieldName{0}, (lambda x y (getProbMutableFieldByInstanceNameAndFieldName x y))",
"InstanceName{0} Field{0}/FieldName{0}, (lambda x (lambda y (getProbFieldByInstanceNameAndFieldName x y)))",
"EmailAmbiguous{0} InstanceName{0}, (lambda x x)", //only if the parser doesn't manage to identify which kind of email the user means, will this be used.
"EmailAmbiguous{0} Instance{0},(lambda x (getProbInstanceByName x))",
"ExactInstance{0} Instance{0},(lambda x x)"//, //exact instance is also an instance (that can be read).
//"StringV{0} StringV{0}/StringV{0}, (lambda x (lambda y (concat x y)))"
//"ScriptName{0} S{0},(lambda x (runScript x))" //run a script (e.g. "order coffee") //no need: each script is an example translated to (runScript "...")
//"PP_StringV{1} (S{0}\\(S{0}/PP_StringV{1}){0}){0}, (lambda x x)", //these two are for handling sentences like: "set body to hello and subject to see you"
//"MutableField{1} ((S{0}/PP_StringV{2}){0}\\(S{0}/PP_StringV{2}){0}/MutableField{1}){0}){0}, (lambda x y x y)"
};
ParserKnowledgeSeeder parserKnowledgeSeeder = new ParserKnowledgeSeeder(userId, lexiconEntries, synonyms, unaryRules, CcgUtils.loadExamples(Paths.get(trainingExamples)));
return new ParserSettings(parserKnowledgeSeeder);
}
public static void addInboxEmails(IIncomingEmailControlling incomingEmailControlling)
{
incomingEmailControlling.addEmailMessageToInbox(new EmailInfo("bob7@myjob.com",
"department party",
Arrays.asList(new String[]{"you@myjob.com"}),
new LinkedList<String>(),
"We will have our department party next Wednesday at 4:00pm. Please forward this email to your spouse."
));
incomingEmailControlling.addEmailMessageToInbox(new EmailInfo("dan@myjob.com",
"another email",
Arrays.asList(new String[]{"you@myjob.com"}),
new LinkedList<String>(),
"sending another email."
));
}
private CreateParserFromFiles()
{
//static class
}
}
|
package LeetCode.ArraysAndStrings;
import java.util.HashMap;
public class ConfusingNumber {
HashMap<Integer, Integer> map = new HashMap<>();
int res;
public int confusingNumberII(int N){
res = 0;
map.put(0, 0);
map.put(1, 1);
map.put(6, 9);
map.put(8, 8);
map.put(9, 6);
helper(N, 0);
return res;
}
public void helper(int N, long cur){
if(isConfusing(cur)){
res++;
}
for(Integer n : map.keySet()){
long val = cur * 10 + n;
if(val <= N && val != 0)
helper(N, val);
}
}
public boolean isConfusing(long n){
long cur = n;
long num = 0;
while(n > 0){
num = num*10 + map.get((int)n%10);
n = n/10;
}
return cur != num;
}
public static void main(String[] args){
ConfusingNumber c = new ConfusingNumber();
System.out.print(c.confusingNumberII(100));
}
}
|
package com.wxapp.bean;
import java.util.List;
/**
* 朋友圈对象
* * {
* * "type": 0,
* * "blackList": [
* * "string"
* * ],
* * "withUserList": [
* * "string"
* * ],
* * "mediaInfos": [
* * {
* * "url": "string",
* * "imageUrl": "string",
* * "width": 0,
* * "height": 0,
* * "totalSize": 0
* * }
* * ],
* * "title": "string",
* * "contentUrl": "string",
* * "description": "string",
* * "content": "string",
* * "wxId": "string"
* * }
*/
public class FriendCircle {
private String type;
private List<String> blackList;
private List<String> withUserList;
private List<MediaInfo> mediaInfos;
private String title;
private String contentUrl;
private String description;
private String content;
private String wxId;
public FriendCircle( ) {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<String> getBlackList() {
return blackList;
}
public void setBlackList(List<String> blackList) {
this.blackList = blackList;
}
public List<String> getWithUserList() {
return withUserList;
}
public void setWithUserList(List<String> withUserList) {
this.withUserList = withUserList;
}
public List<MediaInfo> getMediaInfos() {
return mediaInfos;
}
public void setMediaInfos(List<MediaInfo> mediaInfos) {
this.mediaInfos = mediaInfos;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContentUrl() {
return contentUrl;
}
public void setContentUrl(String contentUrl) {
this.contentUrl = contentUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getWxId() {
return wxId;
}
public void setWxId(String wxId) {
this.wxId = wxId;
}
}
|
//import org.junit.Before;
//import org.junit.Test;
//import servlet.HelloServlet;
//
//import javax.servlet.ServletException;
//import java.io.IOException;
//
///**
// * Created by employee on 11/14/16.
// */
//public class MainTest {
// @Test
// public void main() throws Exception {
//
// }
// private MyServlet servlet;
// private MockHttpServletRequest request;
// private MockHttpServletResponse response;
//
// @Before
// public void setUp() {
// servlet = new MyServlet();
// request = new MockHttpServletRequest();
// response = new MockHttpServletResponse();
// }
//
// @Test
// public void correctUsernameInRequest() throws ServletException, IOException {
// request.addParameter("username", "scott");
// request.addParameter("password", "tiger");
//
// servlet.doPost(request, response);
//
// assertEquals("text/html", response.getContentType());
//
//
// }
//}
|
package com.ds.weatherapp.bean;
import com.ds.json.JsonModel;
public class Weather {
private JsonModel data=null;
public Weather(String json) {
data =new JsonModel(json);
}
}
|
package boj;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BOJ_2869_달팽이는_올라가고_싶다 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
double A =Integer.parseInt(st.nextToken());
double B =Integer.parseInt(st.nextToken());
double V =Integer.parseInt(st.nextToken());
double ans = 0;
double len = A-B;
ans = Math.ceil(((V - A) / len)) + 1;
System.out.println((int) ans);
}
}
|
package sarong;
import sarong.util.CrossHash;
import java.io.Serializable;
import java.util.*;
import static sarong.NumberTools.intBitsToFloat;
/**
* A wrapper class for working with random number generators in a more friendly way.
* Implements {@link IRNG}, which covers most of the API surface, but RNG implements
* a decent amount of additional methods. You should consider if your code needs
* these additional methods, and if not you should use IRNG as the type for when you
* need some random number generator.
* <p>
* Includes methods for getting values between two numbers and for getting
* random elements from a collection or array. There are methods to shuffle
* a collection and to get a random ordering that can be applied as one shuffle
* across multiple collections, if those collections support it. You can construct
* an RNG with all sorts of RandomnessSource implementations, and choosing them
* is usually not a big concern because the default works very well. If you target
* GWT, then it is suggested that you use {@link GWTRNG} instead of RNG; both
* implement {@link IRNG}, which is enough for most usage across SquidLib, but
* GWTRNG is optimized heavily for better performance on GWT, even returning long
* values faster than implementations that natively do their math on longs. It has
* worse performance on 64-bit PCs and mobile devices, but should also have better
* performance on 32-bit PCs and mobile devices.
* <br>
* But if you do want advice on what RandomnessSource to use... {@link DiverRNG}
* is the default, and is the fastest generator that passes most tests and can
* produce all 64-bit values, and though relative to many of the others it has a
* significantly shorter period (the amount of random numbers it will go through
* before repeating the sequence), this almost never matters in games, and is
* primarily relevant for massively-parallel scientific programs. DiverRNG has a
* period of {@code pow(2, 64)} as opposed to {@link XoRoRNG}'s
* {@code pow(2, 128) - 1}, or {@link LongPeriodRNG}'s {@code pow(2, 1024) - 1}.
* {@link LightRNG} is a solid choice and a former default RandomnessSource;
* additional features of LightRNG are exposed in {@link MoonwalkRNG} and using
* MoonwalkRNG is recommended if you need unusual features like skipping backwards
* in a random number sequence, taking a result of a nextLong() call and reversing
* it to get the state that produced it, or calculating the distance in number of
* nextLong() calls between two results of nextLong() calls. LightRNG is a
* StatefulRandomness, which lets it be used in {@link StatefulRNG}, and so is
* DiverRNG, but LightRNG is also a {@link SkippingRandomness}, which means you can
* leap forward or backwards in its sequence very efficiently (DiverRNG is not a
* SkippingRandomness). {@link ThrustAltRNG} provides similar qualities to LightRNG,
* and is one of the fastest generators here, but can't produce all possible 64-bit
* values (possibly some 32-bit values as well); it was the default at one point so
* you may want to keep compatibility with some versions by specifying ThrustAltRNG.
* The defaults have changed in the past as issues are found in various generators;
* LightRNG has high quality all-around but is slower than the other defaults,
* ThrustAltRNG can't produce all results, LinnormRNG passed tests in an earlier
* version of the PractRand test suite but now fails in the current version, and now
* the default is DiverRNG, which shares the known issue of LightRNG and LinnormRNG
* that it can't produce the same result twice from {@link #nextLong()} until the
* generator exhausts its period and repeats its output from the beginning.
* For most cases, you should decide between DiverRNG, ThrustAltRNG, LightRNG,
* LongPeriodRNG, MiniMover64RNG, and XoshiroStarPhi32RNG based on your priorities.
* Some tasks are better solved by using a different class, usually {@link GWTRNG},
* which can always be serialized on GWT to save its state easily and is usually the
* fastest substitute for RNG on that platform. DiverRNG is the best if you want high
* speed, very good quality of randomness, and expect to generate a reasonable quantity
* of numbers for a game (less than 18446744073709551616 numbers) without any single
* results being impossible. LightRNG is the second-best at the above criteria, but is
* the best option if you need an RNG that can skip backwards or jump forwards without
* incurring speed penalties. LongPeriodRNG is best if you for some reason need a massive
* amount of random numbers (as in, ten quintillion would be far too little) or want to
* split up such a large generator into unrelated subsequences. XoshiroStarPhi32RNG is
* best if GWT is a possible target but you either need to generate more than
* 18446744073709551616 numbers (but less than 340282366920938463463374607431768211455
* numbers) or you need to ensure that each 128-bit chunk of output is unique; if GWT is
* a target but those specific needs don't matter, use GWTRNG. ThrustAltRNG and
* MiniMover64RNG are both faster than DiverRNG usually (MiniMover64RNG is the fastest),
* but because they are unable to generate some outputs, that may make them a poor choice
* for some usage (ThrustAltRNG also has some bias toward specific numbers and produces
* them more frequently, but not frequently enough to make it fail statistical tests, and
* ThrustAltRNG can skip around in its output sequence like LightRNG). {@link GearRNG} is
* high-quality and surprisingly one of the fastest generators here.
* <br>
* There are many more RandomnessSource implementations! You might want significantly less
* predictable random results, which {@link IsaacRNG} can provide, along with a
* large period. The quality of {@link PermutedRNG} is also good, usually, and it
* has a sound basis in PCG-Random, an involved library with many variants on its
* RNGs.
* <br>
* There may be reasons why you would want a random number generator that uses 32-bit
* math instead of the more common 64-bit math, but using a 32-bit int on desktop and
* Android won't act the same as that same 32-bit int on GWT. Since GWT is stuck with
* JavaScript's implementation of ints with doubles, overflow (which is needed for an
* RNG) doesn't work with ints as expected, but does with GWT's implementation of longs.
* If targeting GWT, {@link Lathe32RNG} is significantly faster at producing int values
* than any long-based generator, and will produce the same results on GWT as on desktop
* or Android (not all 32-bit generators do this). {@link Starfish32RNG} goes one step
* further than Lathe32RNG at an even distribution, and has better quality, but is
* slightly slower. While Lathe32RNG can produce all ints over the course of its period,
* it will produce some pairs of ints, or longs, more often than others and will never
* produce some longs. Starfish32RNG will produce all longs but one. {@link Orbit32RNG}
* can have better speed than Lathe32RNG or Starfish32RNG under some conditions, and is
* two-dimensionally equidistributed (between Lathe and Starfish).
* {@link Zag32RNG} and {@link Oriole32RNG} are also GWT-safe. Most other generators
* use longs, and so will be slower than the recommended Starfish32RNG or Lathe32RNG on GWT,
* but much faster on 64-bit JREs.
* @author Eben Howard - http://squidpony.com - howard@squidpony.com
* @author Tommy Ettinger
* @author smelC
*/
public class RNG implements Serializable, IRNG {
protected RandomnessSource random;
protected Random ran = null;
private static final long serialVersionUID = 2352426757973945105L;
/**
* Default constructor; uses {@link DiverRNG}, which is of high quality, but low period (which rarely matters
* for games), and has excellent speed, tiny state size, and natively generates 64-bit numbers.
* <br>
* Previous versions of SquidLib used different implementations, including {@link LightRNG}, {@link ThrustAltRNG},
* {@link LinnormRNG}, and {@link MersenneTwister}. You can still use one of these by instantiating one of those
* classes and passing it to {@link #RNG(RandomnessSource)}, which may be the best way to ensure the same results
* across versions.
*/
public RNG() {
this(new DiverRNG());
}
/**
* Default constructor; uses {@link DiverRNG}, which is of high quality, but low period (which rarely matters
* for games), and has excellent speed, tiny state size, and natively generates 64-bit numbers. The seed can be
* any long, including 0.
* @param seed any long
*/
public RNG(long seed) {
this(new DiverRNG(seed));
}
/**
* String-seeded constructor; uses a platform-independent hash of the String (it does not use String.hashCode,
* instead using {@link CrossHash#hash64(CharSequence)}) as a seed for {@link DiverRNG}, which is of high quality,
* but low period (which rarely matters for games), and has excellent speed, tiny state size, and natively generates
* 64-bit numbers.
*/
public RNG(CharSequence seedString) {
this(new DiverRNG(CrossHash.hash64(seedString)));
}
/**
* Uses the provided source of randomness for all calculations. This constructor should be used if an alternate
* RandomnessSource other than DiverRNG is desirable, such as to keep compatibility with earlier SquidLib
* versions that defaulted to MersenneTwister, LightRNG, ThrustAltRNG, or LinnormRNG.
* <br>
* If the parameter is null, this is equivalent to using {@link #RNG()} as the constructor.
* @param random the source of pseudo-randomness, such as a LightRNG or LongPeriodRNG object
*/
public RNG(RandomnessSource random) {
this.random = (random == null) ? new DiverRNG() : random;
}
/**
* A subclass of java.util.Random that uses a RandomnessSource supplied by the user instead of the default.
*
* @author Tommy Ettinger
*/
public static class CustomRandom extends Random {
private static final long serialVersionUID = 8211985716129281944L;
private final RandomnessSource randomnessSource;
/**
* Creates a new random number generator. This constructor uses
* a DiverRNG with a random seed.
*/
public CustomRandom() {
randomnessSource = new DiverRNG();
}
/**
* Creates a new random number generator. This constructor uses
* the seed of the given RandomnessSource if it has been seeded.
*
* @param randomnessSource a way to get random bits, supplied by RNG
*/
public CustomRandom(RandomnessSource randomnessSource) {
this.randomnessSource = randomnessSource;
}
/**
* Generates the next pseudorandom number. Subclasses should
* override this, as this is used by all other methods.
* <p>
* <p>The general contract of {@code next} is that it returns an
* {@code int} value and if the argument {@code bits} is between
* {@code 1} and {@code 32} (inclusive), then that many low-order
* bits of the returned value will be (approximately) independently
* chosen bit values, each of which is (approximately) equally
* likely to be {@code 0} or {@code 1}. The method {@code next} is
* implemented by class {@code Random} by atomically updating the seed to
* <pre>{@code (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1)}</pre>
* and returning
* <pre>{@code (int)(seed >>> (48 - bits))}.</pre>
*
* This is a linear congruential pseudorandom number generator, as
* defined by D. H. Lehmer and described by Donald E. Knuth in
* <i>The Art of Computer Programming,</i> Volume 3:
* <i>Seminumerical Algorithms</i>, section 3.2.1.
*
* @param bits random bits
* @return the next pseudorandom value from this random number
* generator's sequence
* @since 1.1
*/
@Override
protected int next(int bits) {
return randomnessSource.next(bits);
}
/**
* Returns the next pseudorandom, uniformly distributed {@code long}
* value from this random number generator's sequence. The general
* contract of {@code nextLong} is that one {@code long} value is
* pseudorandomly generated and returned.
*
* @return the next pseudorandom, uniformly distributed {@code long}
* value from this random number generator's sequence
*/
@Override
public long nextLong() {
return randomnessSource.nextLong();
}
}
/**
* @return a Random instance that can be used for legacy compatibility
*/
public Random asRandom() {
if (ran == null) {
ran = new CustomRandom(random);
}
return ran;
}
/**
* Returns a value from an even distribution from min (inclusive) to max
* (exclusive).
*
* @param min the minimum bound on the return value (inclusive)
* @param max the maximum bound on the return value (exclusive)
* @return the found value
*/
@Override
public double between(double min, double max) {
return min + (max - min) * nextDouble();
}
/**
* Returns a value between min (inclusive) and max (exclusive).
* <br>
* The inclusive and exclusive behavior is to match the behavior of the similar
* method that deals with floating point values.
* <br>
* If {@code min} and {@code max} happen to be the same, {@code min} is returned
* (breaking the exclusive behavior, but it's convenient to do so).
*
* @param min the minimum bound on the return value (inclusive)
* @param max the maximum bound on the return value (exclusive)
* @return the found value
*/
@Override
public int between(int min, int max) {
return nextInt(max - min) + min;
}
/**
* Returns a value between min (inclusive) and max (exclusive).
* <p>
* The inclusive and exclusive behavior is to match the behavior of the
* similar method that deals with floating point values.
*
* @param min the minimum bound on the return value (inclusive)
* @param max the maximum bound on the return value (exclusive)
* @return the found value
*/
@Override
public long between(long min, long max) {
return nextLong(max - min) + min;
}
/**
* Returns the average of a number of randomly selected numbers from the
* provided range, with min being inclusive and max being exclusive. It will
* sample the number of times passed in as the third parameter.
* <p>
* The inclusive and exclusive behavior is to match the behavior of the
* similar method that deals with floating point values.
* <p>
* This can be used to weight RNG calls to the average between min and max.
*
* @param min the minimum bound on the return value (inclusive)
* @param max the maximum bound on the return value (exclusive)
* @param samples the number of samples to take
* @return the found value
*/
public int betweenWeighted(int min, int max, int samples) {
int sum = 0;
for (int i = 0; i < samples; i++) {
sum += between(min, max);
}
return Math.round((float) sum / samples);
}
/**
* Returns a random element from the provided array and maintains object
* type.
*
* @param <T> the type of the returned object
* @param array the array to get an element from
* @return the randomly selected element
*/
@Override
public <T> T getRandomElement(T[] array) {
if (array.length < 1) {
return null;
}
return array[nextInt(array.length)];
}
/**
* Returns a random element from the provided list. If the list is empty
* then null is returned.
*
* @param <T> the type of the returned object
* @param list the list to get an element from
* @return the randomly selected element
*/
@Override
public <T> T getRandomElement(List<T> list) {
if (list.isEmpty()) {
return null;
}
return list.get(nextInt(list.size()));
}
/**
* Returns a random element from the provided Collection, which should have predictable iteration order if you want
* predictable behavior for identical RNG seeds, though it will get a random element just fine for any Collection
* (just not predictably in all cases). If you give this a Set, it should be a LinkedHashSet or some form of sorted
* Set like TreeSet if you want predictable results. Any List or Queue should be fine. Map does not implement
* Collection, thank you very much Java library designers, so you can't actually pass a Map to this, though you can
* pass the keys or values. If coll is empty, returns null.
* <p>
* <p>
* Requires iterating through a random amount of coll's elements, so performance depends on the size of coll but is
* likely to be decent, as long as iteration isn't unusually slow. This replaces {@code getRandomElement(Queue)},
* since Queue implements Collection and the older Queue-using implementation was probably less efficient.
* </p>
*
* @param <T> the type of the returned object
* @param coll the Collection to get an element from; remember, Map does not implement Collection
* @return the randomly selected element
*/
@Override
public <T> T getRandomElement(Collection<T> coll) {
int n;
if ((n = coll.size()) <= 0) {
return null;
}
n = nextInt(n);
T t = null;
Iterator<T> it = coll.iterator();
while (n-- >= 0 && it.hasNext())
t = it.next();
return t;
}
/*
* Returns a random elements from the provided queue. If the queue is empty
* then null is returned.
*
* <p>
* Requires iterating through a random amount of the elements in set, so
* performance depends on the size of set but is likely to be decent. This
* is mostly meant for internal use, the same as ShortSet.
* </p>
*
* @param <T> the type of the returned object
* @param list the list to get an element from
* @return the randomly selected element
*/
/*
public <T> T getRandomElement(Queue<T> list) {
if (list.isEmpty()) {
return null;
}
return new ArrayList<>(list).get(nextInt(list.size()));
}*/
/**
* Given a {@link List} l, this selects a random element of l to be the first value in the returned list l2. It
* retains the order of elements in l after that random element and makes them follow the first element in l2, and
* loops around to use elements from the start of l after it has placed the last element of l into l2.
* <br>
* Essentially, it does what it says on the tin. It randomly rotates the List l.
* <br>
* If you only need to iterate through a collection starting at a random point, the method getRandomStartIterable()
* should have better performance. This was GWT incompatible before GWT 2.8.0 became the version SquidLib uses; now
* this method works fine with GWT.
*
* @param l A {@link List} that will not be modified by this method. All elements of this parameter will be
* shared with the returned List.
* @param <T> No restrictions on type. Changes to elements of the returned List will be reflected in the parameter.
* @return A shallow copy of {@code l} that has been rotated so its first element has been randomly chosen
* from all possible elements but order is retained. Will "loop around" to contain element 0 of l after the last
* element of l, then element 1, etc.
*/
public <T> List<T> randomRotation(final List<T> l) {
final int sz = l.size();
if (sz == 0)
return Collections.<T>emptyList();
/*
* Collections.rotate should prefer the best-performing way to rotate l,
* which would be an in-place modification for ArrayLists and an append
* to a sublist for Lists that don't support efficient random access.
*/
List<T> l2 = new ArrayList<>(l);
Collections.rotate(l2, nextInt(sz));
return l2;
}
/**
* Get an Iterable that starts at a random location in list and continues on through list in its current order.
* Loops around to the beginning after it gets to the end, stops when it returns to the starting location.
* <br>
* You should not modify {@code list} while you use the returned reference. And there'll be no
* ConcurrentModificationException to detect such erroneous uses.
*
* @param list A list <b>with a constant-time {@link List#get(int)} method</b> (otherwise performance degrades).
* @return An {@link Iterable} that iterates over {@code list} but start at
* a random index. If the chosen index is {@code i}, the iterator
* will return:
* {@code list[i]; list[i+1]; ...; list[list.length() - 1]; list[0]; list[i-1]}
*/
public <T> Iterable<T> getRandomStartIterable(final List<T> list) {
final int sz = list.size();
if (sz == 0)
return Collections.<T>emptyList();
/*
* Here's a tricky bit: Defining 'start' here means that every Iterator
* returned by the returned Iterable will have the same iteration order.
* In other words, if you use more than once the returned Iterable,
* you'll will see elements in the same order every time, which is
* desirable.
*/
final int start = nextInt(sz);
return new Iterable<T>() {
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
int next = -1;
@Override
public boolean hasNext() {
return next != start;
}
@Override
public T next() {
if (next == start)
throw new NoSuchElementException("Iteration terminated; check hasNext() before next()");
if (next == -1)
/* First call */
next = start;
final T result = list.get(next);
if (next == sz - 1)
/*
* Reached the list's end, let's continue from the list's
* left.
*/
next = 0;
else
next++;
return result;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Remove is not supported from a randomStartIterable");
}
@Override
public String toString() {
return "RandomStartIterator at index " + next;
}
};
}
};
}
/**
* Mutates the array arr by switching the contents at pos1 and pos2.
* @param arr an array of T; must not be null
* @param pos1 an index into arr; must be at least 0 and no greater than arr.length
* @param pos2 an index into arr; must be at least 0 and no greater than arr.length
*/
private static <T> void swap(T[] arr, int pos1, int pos2) {
final T tmp = arr[pos1];
arr[pos1] = arr[pos2];
arr[pos2] = tmp;
}
/**
* Shuffle an array using the Fisher-Yates algorithm and returns a shuffled copy.
* GWT-compatible since GWT 2.8.0, which is the default if you use libGDX 1.9.5 or higher.
* <br>
* <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Wikipedia has more on this algorithm</a>.
*
* @param elements an array of T; will not be modified
* @param <T> can be any non-primitive type.
* @return a shuffled copy of elements
*/
@Override
public <T> T[] shuffle(final T[] elements) {
final int size = elements.length;
final T[] array = Arrays.copyOf(elements, size);
for (int i = size; i > 1; i--) {
swap(array, i - 1, nextIntHasty(i));
}
return array;
}
/**
* Shuffles an array in-place using the Fisher-Yates algorithm.
* If you don't want the array modified, use {@link #shuffle(Object[], Object[])}.
* <br>
* <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Wikipedia has more on this algorithm</a>.
*
* @param elements an array of T; <b>will</b> be modified
* @param <T> can be any non-primitive type.
* @return elements after shuffling it in-place
*/
@Override
public <T> T[] shuffleInPlace(T[] elements) {
final int size = elements.length;
for (int i = size; i > 1; i--) {
swap(elements, i - 1, nextIntHasty(i));
}
return elements;
}
/**
* Shuffle an array using the Fisher-Yates algorithm. If possible, create a new array or reuse an existing array
* with the same length as elements and pass it in as dest; the dest array will contain the shuffled contents of
* elements and will also be returned as-is.
* <br>
* <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Wikipedia has more on this algorithm</a>.
*
* @param elements an array of T; will not be modified
* @param <T> can be any non-primitive type.
* @param dest Where to put the shuffle. If it does not have the same length as {@code elements}, this will use the
* randomPortion method of this class to fill the smaller dest.
* @return {@code dest} after modifications
*/
@Override
public <T> T[] shuffle(T[] elements, T[] dest) {
if (dest.length != elements.length)
return randomPortion(elements, dest);
System.arraycopy(elements, 0, dest, 0, elements.length);
shuffleInPlace(dest);
return dest;
}
/**
* Shuffles a {@link Collection} of T using the Fisher-Yates algorithm and returns an ArrayList of T.
* <br>
* <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Wikipedia has more on this algorithm</a>.
* @param elements a Collection of T; will not be modified
* @param <T> can be any non-primitive type.
* @return a shuffled ArrayList containing the whole of elements in pseudo-random order.
*/
@Override
public <T> ArrayList<T> shuffle(Collection<T> elements) {
return shuffle(elements, null);
}
/**
* Shuffles a {@link Collection} of T using the Fisher-Yates algorithm. The result
* is allocated if {@code buf} is null or if {@code buf} isn't empty,
* otherwise {@code elements} is poured into {@code buf}.
* <br>
* <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Wikipedia has more on this algorithm</a>.
* @param elements a Collection of T; will not be modified
* @param <T> can be any non-primitive type.
* @param buf a buffer as an ArrayList that will be filled with the shuffled contents of elements;
* if null or non-empty, a new ArrayList will be allocated and returned
* @return a shuffled ArrayList containing the whole of elements in pseudo-random order.
*/
@Override
public <T> ArrayList<T> shuffle(Collection<T> elements, /*@Nullable*/ ArrayList<T> buf) {
final ArrayList<T> al;
if (buf == null || !buf.isEmpty())
al = new ArrayList<>(elements);
else {
al = buf;
al.addAll(elements);
}
final int n = al.size();
for (int i = n; i > 1; i--) {
Collections.swap(al, nextInt(i), i - 1);
}
return al;
}
/**
* Shuffles a Collection of T items in-place using the Fisher-Yates algorithm.
* This only shuffles List data structures.
* If you don't want the array modified, use {@link #shuffle(Collection)}, which returns a List as well.
* <br>
* <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Wikipedia has more on this algorithm</a>.
*
* @param elements a Collection of T; <b>will</b> be modified
* @param <T> can be any non-primitive type.
* @return elements after shuffling it in-place
*/
@Override
public <T> List<T> shuffleInPlace(List<T> elements) {
final int n = elements.size();
for (int i = n; i > 1; i--) {
Collections.swap(elements, nextInt(i), i - 1);
}
return elements;
}
/**
* Generates a random permutation of the range from 0 (inclusive) to length (exclusive).
* Useful for passing to OrderedMap or OrderedSet's reorder() methods.
*
* @param length the size of the ordering to produce
* @return a random ordering containing all ints from 0 to length (exclusive)
*/
@Override
public int[] randomOrdering(int length) {
if (length <= 0)
return new int[0];
return randomOrdering(length, new int[length]);
}
/**
* Generates a random permutation of the range from 0 (inclusive) to length (exclusive) and stores it in
* the dest parameter, avoiding allocations.
* Useful for passing to OrderedMap or OrderedSet's reorder() methods.
*
* @param length the size of the ordering to produce
* @param dest the destination array; will be modified
* @return dest, filled with a random ordering containing all ints from 0 to length (exclusive)
*/
@Override
public int[] randomOrdering(int length, int[] dest) {
if (dest == null) return null;
final int n = Math.min(length, dest.length);
for (int i = 0; i < n; i++) {
dest[i] = i;
}
for (int i = n - 1; i > 0; i--) {
final int r = nextIntHasty(i+1),
t = dest[r];
dest[r] = dest[i];
dest[i] = t;
}
return dest;
}
/**
* Gets a random portion of a Collection and returns it as a new List. Will only use a given position in the given
* Collection at most once; does this by shuffling a copy of the Collection and getting a section of it.
*
* @param data a Collection of T; will not be modified.
* @param count the non-negative number of elements to randomly take from data
* @param <T> can be any non-primitive type
* @return a List of T that has length equal to the smaller of count or data.length
*/
public <T> List<T> randomPortion(Collection<T> data, int count) {
return shuffle(data).subList(0, Math.min(count, data.size()));
}
/**
* Gets a random subrange of the non-negative ints from start (inclusive) to end (exclusive), using count elements.
* May return an empty array if the parameters are invalid (end is less than/equal to start, or start is negative).
*
* @param start the start of the range of numbers to potentially use (inclusive)
* @param end the end of the range of numbers to potentially use (exclusive)
* @param count the total number of elements to use; will be less if the range is smaller than count
* @return an int array that contains at most one of each number in the range
*/
public int[] randomRange(int start, int end, int count) {
if (end <= start || start < 0)
return new int[0];
int n = end - start;
final int[] data = new int[n];
for (int e = start, i = 0; e < end; e++) {
data[i++] = e;
}
for (int i = 0; i < n - 1; i++) {
final int r = i + nextInt(n - i), t = data[r];
data[r] = data[i];
data[i] = t;
}
final int[] array = new int[Math.min(count, n)];
System.arraycopy(data, 0, array, 0, Math.min(count, n));
return array;
}
/**
* Generates a random float with a curved distribution that centers on 0 (where it has a bias) and can (rarely)
* approach -1f and 1f, but not go beyond those bounds. This is similar to {@link Random#nextGaussian()} in that it
* uses a curved distribution, but it is not the same. The distribution for the values is similar to Irwin-Hall, and
* is frequently near 0 but not too-rarely near -1f or 1f. It cannot produce values greater than or equal to 1f, or
* less than -1f, but it can produce -1f.
* @return a deterministic float between -1f (inclusive) and 1f (exclusive), that is very likely to be close to 0f
*/
public float nextCurvedFloat() {
final long start = random.nextLong();
return (intBitsToFloat((int)start >>> 9 | 0x3F000000)
+ intBitsToFloat((int) (start >>> 41) | 0x3F000000)
+ intBitsToFloat(((int)(start ^ ~start >>> 20) & 0x007FFFFF) | 0x3F000000)
+ intBitsToFloat(((int) (~start ^ start >>> 30) & 0x007FFFFF) | 0x3F000000)
- 3f);
}
/**
* Gets a random double between 0.0 inclusive and 1.0 exclusive.
* This returns a maximum of 0.9999999999999999 because that is the largest double value that is less than 1.0 .
*
* @return a double between 0.0 (inclusive) and 0.9999999999999999 (inclusive)
*/
@Override
public double nextDouble() {
return (random.nextLong() & 0x1fffffffffffffL) * 0x1p-53;
//this is here for a record of another possibility; it can't generate quite a lot of possible values though
//return Double.longBitsToDouble(0x3FF0000000000000L | random.nextLong() >>> 12) - 1.0;
}
/**
* This returns a random double between 0.0 (inclusive) and outer (exclusive). The value for outer can be positive
* or negative. Because of how math on doubles works, there are at most 2 to the 53 values this can return for any
* given outer bound, and very large values for outer will not necessarily produce all numbers you might expect.
*
* @param outer the outer exclusive bound as a double; can be negative or positive
* @return a double between 0.0 (inclusive) and outer (exclusive)
*/
@Override
public double nextDouble(final double outer) {
return (random.nextLong() & 0x1fffffffffffffL) * 0x1p-53 * outer;
}
/**
* Gets a random float between 0.0f inclusive and 1.0f exclusive.
* This returns a maximum of 0.99999994 because that is the largest float value that is less than 1.0f .
*
* @return a float between 0f (inclusive) and 0.99999994f (inclusive)
*/
@Override
public float nextFloat() {
return random.next(24) * 0x1p-24f;
}
/**
* This returns a random float between 0.0f (inclusive) and outer (exclusive). The value for outer can be positive
* or negative. Because of how math on floats works, there are at most 2 to the 24 values this can return for any
* given outer bound, and very large values for outer will not necessarily produce all numbers you might expect.
*
* @param outer the outer exclusive bound as a float; can be negative or positive
* @return a float between 0f (inclusive) and outer (exclusive)
*/
@Override
public float nextFloat(final float outer) {
return random.next(24) * 0x1p-24f * outer;
}
/**
* Get a random bit of state, interpreted as true or false with approximately equal likelihood.
* This may have better behavior than {@code rng.next(1)}, depending on the RandomnessSource implementation; the
* default DiverRNG will behave fine, as will LightRNG and ThrustAltRNG (these all use similar algorithms), but
* the normally-high-quality XoRoRNG will produce very predictable output with {@code rng.next(1)} and very good
* output with {@code rng.nextBoolean()}. This is a known and considered flaw of Xoroshiro128+, the algorithm used
* by XoRoRNG, and a large number of generators have lower quality on the least-significant bit than the most-
* significant bit, where this method only checks the most-significant bit.
* @return a random boolean.
*/
@Override
public boolean nextBoolean() {
return nextLong() < 0L;
}
/**
* Get a random long between Long.MIN_VALUE to Long.MAX_VALUE (both inclusive).
*
* @return a 64-bit random long.
*/
@Override
public long nextLong() {
return random.nextLong();
}
/**
* Exclusive on bound (which must be positive), with an inner bound of 0.
* If bound is negative or 0 this always returns 0.
* <br>
* Credit for this method goes to <a href="https://oroboro.com/large-random-in-range/">Rafael Baptista's blog</a>,
* with some adaptation for signed long values and a 64-bit generator. This method is drastically faster than the
* previous implementation when the bound varies often (roughly 4x faster, possibly more). It also always gets
* exactly one random number, so it advances the state as much as {@link #nextInt(int)}.
* @param bound the outer exclusive bound; should be positive, otherwise this always returns 0L
* @return a random long between 0 (inclusive) and bound (exclusive)
*/
public long nextLong(long bound) {
long rand = random.nextLong();
if (bound <= 0) return 0;
final long randLow = rand & 0xFFFFFFFFL;
final long boundLow = bound & 0xFFFFFFFFL;
rand >>>= 32;
bound >>= 32;
final long z = (randLow * boundLow >> 32);
final long t = rand * boundLow + z;
return rand * bound + (t >> 32) + ((t & 0xFFFFFFFFL) + randLow * bound >> 32) - (z >> 63);
}
/**
* Exclusive on bound (which may be positive or negative), with an inner bound of 0.
* If bound is negative this returns a negative long; if bound is positive this returns a positive long. The bound
* can even be 0, which will cause this to return 0L every time. This uses a biased technique to get numbers from
* large ranges, but the amount of bias is incredibly small (expected to be under 1/1000 if enough random ranged
* numbers are requested, which is about the same as an unbiased method that was also considered).It may have
* noticeable bias if the generator's period is exhausted by only calls to this method. Unlike all unbiased methods,
* this advances the state by an equivalent to exactly one call to {@link #nextLong()}, where rejection sampling
* would sometimes advance by one call, but other times by arbitrarily many more.
* <br>
* Credit for this method goes to <a href="https://oroboro.com/large-random-in-range/">Rafael Baptista's blog</a>,
* with some adaptation for signed long values and a 64-bit generator. This method is drastically faster than the
* previous implementation when the bound varies often (roughly 4x faster, possibly more). It also always gets at
* most one random number, so it advances the state as much as {@link #nextInt(int)} or {@link #nextLong()}.
* @param bound the outer exclusive bound; can be positive or negative
* @return a random long between 0 (inclusive) and bound (exclusive)
*/
public long nextSignedLong(long bound) {
long rand = random.nextLong();
final long randLow = rand & 0xFFFFFFFFL;
final long boundLow = bound & 0xFFFFFFFFL;
rand >>>= 32;
bound >>= 32;
final long z = (randLow * boundLow >> 32);
final long t = rand * boundLow + z;
return rand * bound + (t >> 32) + ((t & 0xFFFFFFFFL) + randLow * bound >> 32) - (z >> 63);
}
/**
* Returns a random non-negative integer between 0 (inclusive) and the given bound (exclusive),
* or 0 if the bound is 0. The bound can be negative, which will produce 0 or a negative result.
* This is almost identical to the earlier {@link #nextIntHasty(int)} except that it will perform better when the
* RandomnessSource this uses natively produces 32-bit output. It was added to the existing nextIntHasty() so
* existing code using nextIntHasty would produce the same results, but new code matches the API with
* {@link #nextSignedLong(long)}. This is implemented slightly differently in {@link AbstractRNG}, and different
* results should be expected when using code based on that abstract class.
* <br>
* Credit goes to Daniel Lemire, http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
*
* @param bound the outer bound (exclusive), can be negative or positive
* @return the found number
*/
public int nextSignedInt(final int bound) {
return (int) ((bound * (long)random.next(31)) >> 31);
}
/**
* Returns a random non-negative integer below the given bound, or 0 if the bound is 0 or
* negative. Always makes one call to the {@link RandomnessSource#next(int)} method of the RandomnessSource that
* would be returned by {@link #getRandomness()}, even if bound is 0 or negative, to avoid branching and also to
* ensure consistent advancement rates for the RandomnessSource (this can be important if you use a
* {@link SkippingRandomness} and want to go back before a result was produced).
* <br>
* This method changed a fair amount on April 5, 2018 to better support RandomnessSource implementations with a
* slower nextLong() method, such as {@link Lathe32RNG}, and to avoid branching/irregular state advancement/modulus
* operations. It is now almost identical to {@link #nextIntHasty(int)}, but won't return negative results if bound
* is negative (matching its previous behavior). This may have statistical issues (small ones) if bound is very
* large (the estimate is still at least a bound of a billion or more before issues are observable). Consider
* {@link #nextSignedInt(int)} if the bound should be allowed to be negative; {@link #nextIntHasty(int)} is here for
* compatibility with earlier versions, but the two methods are very similar.
* <br>
* Credit goes to Daniel Lemire, http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
*
* @param bound the upper bound (exclusive)
* @return the found number
*/
@Override
public int nextInt(final int bound) {
return (int) ((bound * ((long)random.next(31))) >>> 31) & ~(bound >> 31);
// int threshold = (0x7fffffff - bound + 1) % bound;
// for (; ; ) {
// int bits = random.next(31);
// if (bits >= threshold)
// return bits % bound;
// }
}
/**
* Returns a random non-negative integer between 0 (inclusive) and the given bound (exclusive),
* or 0 if the bound is 0. The bound can be negative, which will produce 0 or a negative result.
* Uses an aggressively optimized technique that has some bias, but mostly for values of
* bound over 1 billion. This method is no more "hasty" than {@link #nextInt(int)}, but it is a little
* faster than that method because this avoids special behavior for when bound is negative.
* <br>
* Credit goes to Daniel Lemire, http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
*
* @param bound the outer bound (exclusive), can be negative or positive
* @return the found number
*/
public int nextIntHasty(final int bound) {
return (int) ((bound * (random.nextLong() & 0x7FFFFFFFL)) >> 31);
}
/**
* Generates random bytes and places them into the given byte array, modifying it in-place.
* The number of random bytes produced is equal to the length of the byte array. Unlike the
* method in java.util.Random, this generates 8 bytes at a time, which can be more efficient
* with many RandomnessSource types than the JDK's method that generates 4 bytes at a time.
* <br>
* Adapted from code in the JavaDocs of {@link Random#nextBytes(byte[])}.
* <br>
* @param bytes the byte array to fill with random bytes; cannot be null, will be modified
* @throws NullPointerException if the byte array is null
*/
public void nextBytes(final byte[] bytes) {
for (int i = 0; i < bytes.length; )
for (long r = random.nextLong(), n = Math.min(bytes.length - i, 8); n-- > 0; r >>>= 8)
bytes[i++] = (byte) r;
}
/**
* Get a random integer between Integer.MIN_VALUE to Integer.MAX_VALUE (both inclusive).
*
* @return a 32-bit random int.
*/
@Override
public int nextInt() {
return random.next(32);
}
/**
* Get up to 32 bits (inclusive) of random output; the int this produces
* will not require more than {@code bits} bits to represent.
*
* @param bits an int between 1 and 32, both inclusive
* @return a random number that fits in the specified number of bits
*/
@Override
public int next(int bits) {
return random.next(bits);
}
public RandomnessSource getRandomness() {
return random;
}
public void setRandomness(RandomnessSource random) {
this.random = random;
}
/**
* Creates a copy of this RNG; it will generate the same random numbers, given the same calls in order, as this RNG
* at the point copy() is called. The copy will not share references with this RNG.
*
* @return a copy of this RNG
*/
@Override
public RNG copy() {
return new RNG(random.copy());
}
/**
* Gets the minimum random long between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias toward zero, but all possible values are between 0, inclusive,
* and bound, exclusive.
* @param bound the outer exclusive bound; may be negative or positive
* @param trials how many numbers to generate and get the minimum of
* @return the minimum generated long between 0 and bound out of the specified amount of trials
*/
public long minLongOf(final long bound, final int trials)
{
long value = nextSignedLong(bound);
for (int i = 1; i < trials; i++) {
value = Math.min(value, nextSignedLong(bound));
}
return value;
}
/**
* Gets the maximum random long between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias away from zero, but all possible values are between 0,
* inclusive, and bound, exclusive.
* @param bound the outer exclusive bound; may be negative or positive
* @param trials how many numbers to generate and get the maximum of
* @return the maximum generated long between 0 and bound out of the specified amount of trials
*/
public long maxLongOf(final long bound, final int trials)
{
long value = nextSignedLong(bound);
for (int i = 1; i < trials; i++) {
value = Math.max(value, nextSignedLong(bound));
}
return value;
}
/**
* Gets the minimum random int between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias toward zero, but all possible values are between 0, inclusive,
* and bound, exclusive.
* @param bound the outer exclusive bound; may be negative or positive
* @param trials how many numbers to generate and get the minimum of
* @return the minimum generated int between 0 and bound out of the specified amount of trials
*/
public int minIntOf(final int bound, final int trials)
{
int value = nextSignedInt(bound);
for (int i = 1; i < trials; i++) {
value = Math.min(value, nextSignedInt(bound));
}
return value;
}
/**
* Gets the maximum random int between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias away from zero, but all possible values are between 0,
* inclusive, and bound, exclusive.
* @param bound the outer exclusive bound; may be negative or positive
* @param trials how many numbers to generate and get the maximum of
* @return the maximum generated int between 0 and bound out of the specified amount of trials
*/
public int maxIntOf(final int bound, final int trials)
{
int value = nextSignedInt(bound);
for (int i = 1; i < trials; i++) {
value = Math.max(value, nextSignedInt(bound));
}
return value;
}
/**
* Gets the minimum random double between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias toward zero, but all possible values are between 0, inclusive,
* and bound, exclusive.
* @param bound the outer exclusive bound
* @param trials how many numbers to generate and get the minimum of
* @return the minimum generated double between 0 and bound out of the specified amount of trials
*/
public double minDoubleOf(final double bound, final int trials)
{
double value = nextDouble(bound);
for (int i = 1; i < trials; i++) {
value = Math.min(value, nextDouble(bound));
}
return value;
}
/**
* Gets the maximum random double between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias away from zero, but all possible values are between 0,
* inclusive, and bound, exclusive.
* @param bound the outer exclusive bound
* @param trials how many numbers to generate and get the maximum of
* @return the maximum generated double between 0 and bound out of the specified amount of trials
*/
public double maxDoubleOf(final double bound, final int trials)
{
double value = nextDouble(bound);
for (int i = 1; i < trials; i++) {
value = Math.max(value, nextDouble(bound));
}
return value;
}
/**
* Gets the minimum random float between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias toward zero, but all possible values are between 0, inclusive,
* and bound, exclusive.
* @param bound the outer exclusive bound
* @param trials how many numbers to generate and get the minimum of
* @return the minimum generated float between 0 and bound out of the specified amount of trials
*/
public float minFloatOf(final float bound, final int trials)
{
float value = nextFloat(bound);
for (int i = 1; i < trials; i++) {
value = Math.min(value, nextFloat(bound));
}
return value;
}
/**
* Gets the maximum random float between 0 and {@code bound} generated out of {@code trials} generated numbers.
* Useful for when numbers should have a strong bias away from zero, but all possible values are between 0,
* inclusive, and bound, exclusive.
* @param bound the outer exclusive bound
* @param trials how many numbers to generate and get the maximum of
* @return the maximum generated float between 0 and bound out of the specified amount of trials
*/
public float maxFloatOf(final float bound, final int trials)
{
float value = nextFloat(bound);
for (int i = 1; i < trials; i++) {
value = Math.max(value, nextFloat(bound));
}
return value;
}
@Override
public String toString() {
return "RNG with Randomness Source " + random;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RNG)) return false;
RNG rng = (RNG) o;
return random.equals(rng.random);
}
@Override
public int hashCode() {
return 31 * random.hashCode();
}
/**
* Gets a random portion of data (an array), assigns that portion to output (an array) so that it fills as much as
* it can, and then returns output. Will only use a given position in the given data at most once; uses the
* Swap-Or-Not Shuffle to accomplish this without allocations. Internally, makes 1 call to {@link #nextInt()} and
* 6 calls to {@link #nextSignedInt(int)}, regardless of the data being randomized. It will get progressively less
* random as output gets larger.
* <br>
* Uses approximately the same code as the Swap-or-Not Shuffle, but without any object or array allocations.
*
* @param data an array of T; will not be modified.
* @param output an array of T that will be overwritten; should always be instantiated with the portion length
* @param <T> can be any non-primitive type.
* @return output, after {@code Math.min(output.length, data.length)} unique items have been put into it from data
*/
public <T> T[] randomPortion(T[] data, T[] output) {
final int length = data.length, n = Math.min(length, output.length),
func = nextInt(),
a = nextSignedInt(length), b = nextSignedInt(length), c = nextSignedInt(length),
d = nextSignedInt(length), e = nextSignedInt(length), f = nextSignedInt(length);
int key, index;
for (int i = 0; i < n; i++) {
index = i;
key = a - index;
key += (key >> 31 & length);
if(((func) + Math.max(index, key) & 1) == 0) index = key;
key = b - index;
key += (key >> 31 & length);
if(((func >>> 1) + Math.max(index, key) & 1) == 0) index = key;
key = c - index;
key += (key >> 31 & length);
if(((func >>> 2) + Math.max(index, key) & 1) == 0) index = key;
key = d - index;
key += (key >> 31 & length);
if(((func >>> 3) + Math.max(index, key) & 1) == 0) index = key;
key = e - index;
key += (key >> 31 & length);
if(((func >>> 4) + Math.max(index, key) & 1) == 0) index = key;
key = f - index;
key += (key >> 31 & length);
if(((func >>> 5) + Math.max(index, key) & 1) == 0) index = key;
output[i] = data[index];
}
return output;
}
/**
* Gets a random double between 0.0 inclusive and 1.0 inclusive.
*
* @return a double between 0.0 (inclusive) and 1.0 (inclusive)
*/
public double nextDoubleInclusive()
{
return (random.nextLong() & 0x1fffffffffffffL) * 0x1.0000000000001p-53;
}
/**
* This returns a random double between 0.0 (inclusive) and outer (inclusive). The value for outer can be positive
* or negative. Because of how math on doubles works, there are at most 2 to the 53 values this can return for any
* given outer bound, and very large values for outer will not necessarily produce all numbers you might expect.
*
* @param outer the outer inclusive bound as a double; can be negative or positive
* @return a double between 0.0 (inclusive) and outer (inclusive)
*/
public double nextDoubleInclusive(final double outer) {
return (random.nextLong() & 0x1fffffffffffffL) * 0x1.0000000000001p-53 * outer;
}
/**
* Gets a random float between 0.0f inclusive and 1.0f inclusive.
*
* @return a float between 0f (inclusive) and 1f (inclusive)
*/
public float nextFloatInclusive() {
return random.next(24) * 0x1.000002p-24f;
}
/**
* This returns a random float between 0.0f (inclusive) and outer (inclusive). The value for outer can be positive
* or negative. Because of how math on floats works, there are at most 2 to the 24 values this can return for any
* given outer bound, and very large values for outer will not necessarily produce all numbers you might expect.
*
* @param outer the outer inclusive bound as a float; can be negative or positive
* @return a float between 0f (inclusive) and outer (inclusive)
*/
public float nextFloatInclusive(final float outer) {
return random.next(24) * 0x1.000002p-24f * outer;
}
/**
* Returns this RNG in a way that can be deserialized even if only {@link IRNG}'s methods can be called.
* @return a {@link Serializable} view of this RNG; always {@code this}
*/
@Override
public Serializable toSerializable() {
return this;
}
}
|
package info.pablogiraldo.servicio;
import java.util.List;
import info.pablogiraldo.modelo.Bebida;
public interface BebidaServicio {
public List<Bebida> getLista();
public Bebida getBebida(int i);
}
|
/*
* Copyright 2009 Kjetil Valstadsve
*
* 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 vanadis.lang.piji.loading;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import vanadis.core.collections.Generic;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public final class ClassResolver {
private final Logger log = LoggerFactory.getLogger(getClass());
private final ClassLoader loader;
private final Map<String, Class<?>> cache = Generic.map();
private final Map<String, Class<?>> shortNameCache = Generic.map();
private final Map<String, Package> packagesMap = Generic.map();
private final List<Package> packages = Generic.list();
private final Object packagesLock = new Object();
private void initCache() {
cache.put("int", Integer.TYPE);
cache.put("long", Long.TYPE);
cache.put("float", Float.TYPE);
cache.put("double", Double.TYPE);
cache.put("byte", Byte.TYPE);
cache.put("short", Short.TYPE);
cache.put("boolean", Boolean.TYPE);
cache.put("char", Character.TYPE);
}
private void initPackages() {
rememberPackage(Object.class.getPackage());
rememberPackage(List.class.getPackage());
rememberPackage(IOException.class.getPackage());
getPackages();
}
public ClassResolver(ClassLoader loader) {
if (loader == null) {
throw new IllegalArgumentException(this + " cannot live without a classLoader!");
}
this.loader = loader;
initCache();
initPackages();
log.debug(this + " was created");
}
private List<Package> getPackages() {
synchronized (packagesLock) {
if (packages.isEmpty()) {
Package[] ps = Package.getPackages();
for (Package p : ps) {
rememberPackage(p);
}
log.info(this + " learned of " + ps.length + " packages");
}
return Generic.list(packages);
}
}
private void rememberPackage(Package p) {
synchronized (packagesLock) {
if (p == null) {
return;
}
String key = p.getName();
boolean known = packagesMap.containsKey(key);
if (!known) {
packagesMap.put(key, p);
packages.add(p);
}
}
}
public ClassLoader getClassLoader() {
return this.loader;
}
public String getQualifiedName(String name) throws ClassNotFoundException {
return getQualifiedName(name, true);
}
String getQualifiedName(String name, boolean fail) throws ClassNotFoundException {
findClass(name, fail);
return (shortNameCache.get(name)).getName();
}
public final Class<?> findClass(String name) throws ClassNotFoundException {
return this.findClass(name, true);
}
public final Class<?> findClass(String name, boolean fail) throws ClassNotFoundException {
if (name == null || name.trim().length() == 0) {
throw new NullPointerException("Null or empty string given (" + name + ")");
}
if (name.endsWith("[]")) {
throw new UnsupportedOperationException(this + " cannot talk about array classes yet: " + name);
}
ClassNotFoundException exception = null;
Class<?> found = checkCaches(name);
if (found == null) {
try {
found = checkSimpleName(name);
}
catch (ClassNotFoundException e) {
log.debug(this + " found no " + name + " in " + loader + ": " + e);
exception = e;
}
}
if (found == null) {
found = probePackages(name);
}
if (found == null) {
log.warn(this + " could not resolve \"" + name + "\", " +
(fail ? "throwing" : "ignoring") + " " + exception);
if (fail) {
throw exception;
}
return null;
} else {
updateCaches(found);
return found;
}
}
private Class<?> checkSimpleName(String name) throws ClassNotFoundException {
Class<?> found = this.loader.loadClass(name);
if (found != null) {
rememberPackage(found.getPackage());
}
return found;
}
private Class<?> checkCaches(String name) {
return this.cache.containsKey(name) ? this.cache.get(name)
: this.shortNameCache.containsKey(name) ? this.shortNameCache.get(name)
: null;
}
private void updateCaches(Class<?> foundClass) {
this.cache.put(foundClass.getName(), foundClass);
this.shortNameCache.put(shortName(foundClass), foundClass);
}
private Class<?> probePackages(String name) {
List<Package> packages = getPackages();
log.debug(this + " looks for \"" + name + "\" in " +
packages.size() + " packages ..." +
(packages.size() < 10 ? packagesMap.keySet().toString() : ""));
for (Package packidch : packages) {
Class<?> found = probeClass(packidch, name);
if (found != null) {
log.debug(this + " found " + found);
return found;
}
}
// Could it be... a package-less class!
return probeClass(null, name);
}
private Class<?> probeClass(Package pack, String name) {
try {
String fullName = fullName(pack, name);
return this.loader.loadClass(fullName);
}
catch (ClassNotFoundException ignore) {
return null;
}
}
private static String fullName(Package p, String name) {
return p == null ? name : p.getName() + "." + name;
}
private static String shortName(Class<?> type) {
Package p = type.getPackage();
return p == null
? type.getName()
: type.getName().substring(1 + p.getName().length());
}
@Override
public String toString() {
return "ClassResolver[" + loader +
" packages:" + packages.size() +
" cached:" + this.cache.size() + "]";
}
}
|
package com.project.homes.app.user.feedback.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import com.project.homes.app.common.image.dto.ImageDto;
import com.project.homes.app.common.info.dto.InfoDto;
import com.project.homes.app.common.member.dto.MemberDto;
import com.project.homes.app.user.feedback.dto.FeedbackDto;
import com.project.homes.app.user.mainpage.dto.MainPageDto;
@Repository
@Mapper
public interface FeedbackMapper {
List<FeedbackDto> getFeedbackList(int limit);
boolean addFeedback(FeedbackDto feedbackDto);
}
|
package com.tencent.mm.plugin.profile.ui;
import com.tencent.mm.R;
import com.tencent.mm.model.s;
import com.tencent.mm.ui.base.l;
import com.tencent.mm.ui.base.n.c;
class c$19 implements c {
final /* synthetic */ c lVT;
c$19(c cVar) {
this.lVT = cVar;
}
public final void a(l lVar) {
if (this.lVT.lUs != null && this.lVT.lUs.LY()) {
lVar.eR(1, R.l.contact_info_send_card_biz);
lVar.eR(3, R.l.biz_report_text);
lVar.eR(4, R.l.contact_info_biz_remove);
lVar.eR(5, R.l.contact_info_add_shortcut);
} else if (this.lVT.lUs == null || !this.lVT.lUs.LZ()) {
lVar.eR(1, R.l.contact_info_send_card_biz);
lVar.eR(2, R.l.contact_info_biz_clear_msg);
if (!s.hW(this.lVT.guS.field_username)) {
lVar.eR(3, R.l.biz_report_text);
lVar.eR(4, R.l.contact_info_biz_remove);
}
lVar.eR(5, R.l.contact_info_add_shortcut);
} else {
lVar.eR(5, R.l.contact_info_add_shortcut);
}
}
}
|
package com.passing.struts.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.passing.spring.service.impl.AutoCompleteServiceBean;
public class AutoCompleteAction extends BaseAction {
private AutoCompleteServiceBean autoCompleteServiceBean;
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String searchStr = request.getParameter("searchStr");
List<String> searchRst = autoCompleteServiceBean.searchForAutoComplete(searchStr);
super.makeJSONObject(response, "matchedWords", searchRst);
return mapping.findForward(null);
}
public AutoCompleteServiceBean getAutoCompleteServiceBean() {
return autoCompleteServiceBean;
}
public void setAutoCompleteServiceBean(
AutoCompleteServiceBean autoCompleteServiceBean) {
this.autoCompleteServiceBean = autoCompleteServiceBean;
}
}
|
package com.janfranco.datifysongbasedmatchapplication;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Typeface;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class ChatListRecyclerAdapter extends RecyclerView.Adapter<ChatListRecyclerAdapter.PostHolder> {
private ArrayList<Chat> chats;
private String currentUsername;
private static Typeface metropolisLight;
private static Typeface metropolisExtraLightItalic;
ChatListRecyclerAdapter(Context context, ArrayList<Chat> chats, String currentUsername) {
metropolisLight = Typeface.createFromAsset(context.getAssets(), "fonts/Metropolis-Light.otf");
metropolisExtraLightItalic = Typeface.createFromAsset(context.getAssets(), "fonts/Metropolis-ExtraLightItalic.otf");
this.chats = chats;
this.currentUsername = currentUsername;
}
@NonNull
@Override
public PostHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view = layoutInflater.inflate(R.layout.chatlist_row, parent, false);
return new PostHolder(view);
}
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(@NonNull PostHolder holder, int position) {
Chat chat = chats.get(position);
if (chat.getUsername1().equals(currentUsername)) {
if (chat.getAvatar2().equals("default")) {
holder.avatar.setImageResource(R.drawable.defaultavatar);
}
else if (!chat.getAvatar2Local().matches(""))
Picasso.get().load(chat.getAvatar2Local()).into(holder.avatar, new Callback() {
@Override
public void onSuccess() { }
@Override
public void onError(Exception e) {
chat.setAvatar2Local("");
Picasso.get().load(chat.getAvatar2()).into(holder.avatar);
chat.setAvatar2("emp");
HomeActivity.writeToLocalDb(chat);
}
});
else if (!chat.getAvatar2().matches("default"))
Picasso.get().load(chat.getAvatar2()).into(holder.avatar);
holder.username.setText(chat.getUsername2());
} else {
if (chat.getAvatar1().matches("default")) {
holder.avatar.setImageResource(R.drawable.defaultavatar);
}
else if (!chat.getAvatar1Local().matches(""))
Picasso.get().load(chat.getAvatar1Local()).into(holder.avatar, new Callback() {
@Override
public void onSuccess() { }
@Override
public void onError(Exception e) {
chat.setAvatar1Local("");
Picasso.get().load(chat.getAvatar1()).into(holder.avatar);
chat.setAvatar1("emp");
HomeActivity.writeToLocalDb(chat);
}
});
else if (!chat.getAvatar1().matches("default"))
Picasso.get().load(chat.getAvatar1()).into(holder.avatar);
holder.username.setText(chat.getUsername1());
}
holder.message.setText(chat.getLastMessage());
holder.date.setText(DateFormat.format(
Constants.DATE_MESSAGE,
chat.getLastMessageDate() * 1000L
).toString());
}
@Override
public int getItemCount() {
return chats.size();
}
static class PostHolder extends RecyclerView.ViewHolder {
ImageView avatar;
TextView username, message, date;
PostHolder(@NonNull View itemView) {
super(itemView);
avatar = itemView.findViewById(R.id.userSelectListAvatar);
username = itemView.findViewById(R.id.userSelectListUsername);
message = itemView.findViewById(R.id.userSelectListBio);
date = itemView.findViewById(R.id.chatListDate);
message.setTypeface(metropolisLight);
username.setTypeface(metropolisLight);
date.setTypeface(metropolisExtraLightItalic);
}
}
}
|
package com.nvilla.house.entities;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.ForeignKey;
public class Room {
@SuppressWarnings("deprecation")
@Id
@ForeignKey(name = "id_house")
private int houseId;
@Id
@GeneratedValue( strategy = GenerationType.AUTO)
private int roomId;
@ManyToOne(fetch=FetchType.LAZY , optional=false)
@JoinColumn(name="id_house", insertable=false, updatable=false)
private House house;
private String idRoom ;
private String nameRoom;
private String position ;
private boolean is_principal ;
private boolean has_access ;
private boolean has_adjacent_room ;
/**
* @return the houseId
*/
public int getHouseId() {
return houseId;
}
/**
* @param houseId the houseId to set
*/
public void setHouseId(int houseId) {
this.houseId = houseId;
}
/**
* @return the roomId
*/
public int getRoomId() {
return roomId;
}
/**
* @param roomId the roomId to set
*/
public void setRoomId(int roomId) {
this.roomId = roomId;
}
/**
* @return the house
*/
public House getHouse() {
return house;
}
/**
* @param house the house to set
*/
public void setHouse(House house) {
this.house = house;
}
/**
* @return the idRoom
*/
public String getIdRoom() {
return idRoom;
}
/**
* @param idRoom the idRoom to set
*/
public void setIdRoom(String idRoom) {
this.idRoom = idRoom;
}
/**
* @return the nameRoom
*/
public String getNameRoom() {
return nameRoom;
}
/**
* @param nameRoom the nameRoom to set
*/
public void setNameRoom(String nameRoom) {
this.nameRoom = nameRoom;
}
/**
* @return the position
*/
public String getPosition() {
return position;
}
/**
* @param position the position to set
*/
public void setPosition(String position) {
this.position = position;
}
/**
* @return the is_principal
*/
public boolean isIs_principal() {
return is_principal;
}
/**
* @param is_principal the is_principal to set
*/
public void setIs_principal(boolean is_principal) {
this.is_principal = is_principal;
}
/**
* @return the has_access
*/
public boolean isHas_access() {
return has_access;
}
/**
* @param has_access the has_access to set
*/
public void setHas_access(boolean has_access) {
this.has_access = has_access;
}
/**
* @return the has_adjacent_room
*/
public boolean isHas_adjacent_room() {
return has_adjacent_room;
}
/**
* @param has_adjacent_room the has_adjacent_room to set
*/
public void setHas_adjacent_room(boolean has_adjacent_room) {
this.has_adjacent_room = has_adjacent_room;
}
@Override
public String toString() {
return "Room [houseId=" + houseId + ", roomId=" + roomId + ", house=" + house + ", idRoom=" + idRoom
+ ", nameRoom=" + nameRoom + ", position=" + position + ", is_principal=" + is_principal
+ ", has_access=" + has_access + ", has_adjacent_room=" + has_adjacent_room + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (has_access ? 1231 : 1237);
result = prime * result + (has_adjacent_room ? 1231 : 1237);
result = prime * result + ((house == null) ? 0 : house.hashCode());
result = prime * result + houseId;
result = prime * result + ((idRoom == null) ? 0 : idRoom.hashCode());
result = prime * result + (is_principal ? 1231 : 1237);
result = prime * result + ((nameRoom == null) ? 0 : nameRoom.hashCode());
result = prime * result + ((position == null) ? 0 : position.hashCode());
result = prime * result + roomId;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Room other = (Room) obj;
if (has_access != other.has_access) {
return false;
}
if (has_adjacent_room != other.has_adjacent_room) {
return false;
}
if (house == null) {
if (other.house != null) {
return false;
}
} else if (!house.equals(other.house)) {
return false;
}
if (houseId != other.houseId) {
return false;
}
if (idRoom == null) {
if (other.idRoom != null) {
return false;
}
} else if (!idRoom.equals(other.idRoom)) {
return false;
}
if (is_principal != other.is_principal) {
return false;
}
if (nameRoom == null) {
if (other.nameRoom != null) {
return false;
}
} else if (!nameRoom.equals(other.nameRoom)) {
return false;
}
if (position == null) {
if (other.position != null) {
return false;
}
} else if (!position.equals(other.position)) {
return false;
}
if (roomId != other.roomId) {
return false;
}
return true;
}
/**
*
*/
public Room() {
super();
// TODO Auto-generated constructor stub
}
/**
* @param houseId
* @param roomId
* @param house
* @param idRoom
* @param nameRoom
* @param position
* @param is_principal
* @param has_access
* @param has_adjacent_room
*/
public Room(int houseId, int roomId, House house, String idRoom, String nameRoom, String position,
boolean is_principal, boolean has_access, boolean has_adjacent_room) {
super();
this.houseId = houseId;
this.roomId = roomId;
this.house = house;
this.idRoom = idRoom;
this.nameRoom = nameRoom;
this.position = position;
this.is_principal = is_principal;
this.has_access = has_access;
this.has_adjacent_room = has_adjacent_room;
}
}
|
package com.mrice.txl.appthree.bean;
import android.text.TextUtils;
import com.mrice.txl.appthree.http.ParamNames;
import java.io.Serializable;
/**
* Created by company on 2017/8/8.
*/
public class AoMenBean implements Serializable {
/**
* appInfo : {"id":"10","appname":"测试游戏hhh","version":"1.0","jumplink":"www.baidu.com","updateflag":"1","updatelink":"士大夫大师傅","navflag":"0","navtitle1":"首页","navlink1":"www.baidu.coms","navtitle2":"个人中心","navlink2":"www.baidu.com","appmall":null,"state":"1"}
* code : 0
*/
@ParamNames("appInfo")
private AppInfoBean appInfo;
@ParamNames("code")
private String code;
public AppInfoBean getAppInfo() {
return appInfo;
}
public void setAppInfo(AppInfoBean appInfo) {
this.appInfo = appInfo;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static class AppInfoBean {
/**
* id : 10
* appname : 测试游戏hhh
* version : 1.0
* jumplink : www.baidu.com
* updateflag : 1
* updatelink : 士大夫大师傅
* navflag : 0
* navtitle1 : 首页
* navlink1 : www.baidu.coms
* navtitle2 : 个人中心
* navlink2 : www.baidu.com
* appmall : null
* state : 1
*/
@ParamNames("id")
private String id;
@ParamNames("appname")
private String appname;
@ParamNames("version")
private String version;
@ParamNames("jumplink")
private String jumplink;
@ParamNames("updateflag")
private String updateflag;
@ParamNames("updatelink")
private String updatelink;
@ParamNames("navflag")
private String navflag;
@ParamNames("navtitle1")
private String navtitle1;
@ParamNames("navlink1")
private String navlink1;
@ParamNames("navtitle2")
private String navtitle2;
@ParamNames("navlink2")
private String navlink2;
@ParamNames("appmall")
private Object appmall;
@ParamNames("state")
private String state;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAppname() {
return appname;
}
public void setAppname(String appname) {
this.appname = appname;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getJumplink() {
return jumplink;
}
public void setJumplink(String jumplink) {
this.jumplink = jumplink;
}
public String getUpdateflag() {
return updateflag;
}
public void setUpdateflag(String updateflag) {
this.updateflag = updateflag;
}
public String getUpdatelink() {
return updatelink;
}
public void setUpdatelink(String updatelink) {
this.updatelink = updatelink;
}
public String getNavflag() {
return navflag;
}
public void setNavflag(String navflag) {
this.navflag = navflag;
}
public String getNavtitle1() {
return navtitle1;
}
public void setNavtitle1(String navtitle1) {
this.navtitle1 = navtitle1;
}
public String getNavlink1() {
return navlink1;
}
public void setNavlink1(String navlink1) {
this.navlink1 = navlink1;
}
public String getNavtitle2() {
return navtitle2;
}
public void setNavtitle2(String navtitle2) {
this.navtitle2 = navtitle2;
}
public String getNavlink2() {
return navlink2;
}
public void setNavlink2(String navlink2) {
this.navlink2 = navlink2;
}
public Object getAppmall() {
return appmall;
}
public void setAppmall(Object appmall) {
this.appmall = appmall;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public boolean getStatus() {
return TextUtils.equals(state, "0");
}
@Override
public String toString() {
return "AppInfoBean{" +
"id='" + id + '\'' +
", appname='" + appname + '\'' +
", version='" + version + '\'' +
", jumplink='" + jumplink + '\'' +
", updateflag='" + updateflag + '\'' +
", updatelink='" + updatelink + '\'' +
", navflag='" + navflag + '\'' +
", navtitle1='" + navtitle1 + '\'' +
", navlink1='" + navlink1 + '\'' +
", navtitle2='" + navtitle2 + '\'' +
", navlink2='" + navlink2 + '\'' +
", appmall=" + appmall +
", state='" + state + '\'' +
'}';
}
}
}
|
package com.yixin.dsc.dto.query;
/**
* @author YixinCapital -- chenjiacheng
* 2018年08月23日 16:35
**/
public class DscPaymentErrorDto {
/**
* 申请编号
*/
private String applyNo;
/**
* 所属资方
*/
private String financialCode;
/**
* 发起请款时间
*/
private String createTime;
/**
* 银行返回信息
*/
private String desc;
public String getApplyNo() {
return applyNo;
}
public void setApplyNo(String applyNo) {
this.applyNo = applyNo;
}
public String getFinancialCode() {
return financialCode;
}
public void setFinancialCode(String financialCode) {
this.financialCode = financialCode;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
|
package com.rc.portal.payplugin.pay99billplugin;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import com.rc.commons.util.InfoUtil;
import com.rc.portal.payplugin.PaymentPlugin;
import com.rc.portal.service.OpenSqlManage;
import com.rc.portal.util.NetworkUtil;
import com.rc.portal.vo.TOrder;
/**
* 快钱支付
* @author user3
*
*/
public class Pay99billPlugin extends PaymentPlugin {
/**
* 快钱生成请求信息
* @param order
* @param description
* @param request
* @return
*/
public Map<String, Object> getParameterMap(OpenSqlManage opensqlmanage,TOrder order, String description, HttpServletRequest request) {
Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
parameterMap.put("inputCharset", "1");
parameterMap.put("pageUrl", InfoUtil.getInstance().getInfo("config","pay_return_url"));//页面通知地址
parameterMap.put("bgUrl", InfoUtil.getInstance().getInfo("config","pay.payServiceUri")+InfoUtil.getInstance().getInfo("config","pay99billNotifyUri"));//异步通知地址
parameterMap.put("version", "v2.0");
parameterMap.put("language", "1");
parameterMap.put("signType", "4");
parameterMap.put("merchantAcctId", "1008062687101");//人民币账号
String payerContactType = request.getParameter("payerContactType");//支付人联系类型,1 代表电子邮件方式;2 代表手机联系方式。可以为空。
String payerContact = request.getParameter("payerEmail");//支付人联系方式,与payerContactType设置对应,payerContactType为1,则填写邮箱地址;payerContactType为2,则填写手机号码。可以为空。
parameterMap.put("payerContactType", payerContactType);
parameterMap.put("payerContact", payerContact);
parameterMap.put("payerIP", NetworkUtil.getIpAddress(request));//
parameterMap.put("orderId", order.getOrderSn());
parameterMap.put("orderAmount", order.getPayableAmount().multiply(new BigDecimal(100)).setScale(0).toString());
parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));//
parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));//
parameterMap.put("ext1", "dst");
parameterMap.put("payType", "10");//修改为直连银行
parameterMap.put("bankId",request.getParameter("bankId"));//直连银行编号
parameterMap.put("redoFlag", "0");// 固定选择值: 1、0 1 代表同一订单号只允许提交1 次;0 表示同一订单 号在没有支付成功的前提下可重复提交多次。
parameterMap.put("signMsg", new Pkipair().signMsg(parameterMap));
return parameterMap;
}
public String getName() {
return "快钱支付";
}
public String getRequestUrl() {
return "https://www.99bill.com/gateway/recvMerchantInfoAction.htm";
}
public String getRequestMethod() {
return "post";
}
public String getRequestCharset() {
return "UTF-8";
}
@Override
public boolean verifyNotify(TOrder order, HttpServletRequest request) {
Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
parameterMap.put("merchantAcctId", request.getParameter("merchantAcctId"));
parameterMap.put("version", request.getParameter("version"));
parameterMap.put("language", request.getParameter("language"));
parameterMap.put("signType", request.getParameter("signType"));
parameterMap.put("payType", request.getParameter("payType"));
parameterMap.put("bankId", request.getParameter("bankId"));
parameterMap.put("orderId", request.getParameter("orderId"));
parameterMap.put("orderTime", request.getParameter("orderTime"));
parameterMap.put("orderAmount", request.getParameter("orderAmount"));
parameterMap.put("bindCard", request.getParameter("bindCard"));
parameterMap.put("bindMobile", request.getParameter("bindMobile"));
parameterMap.put("dealId", request.getParameter("dealId"));
parameterMap.put("bankDealId", request.getParameter("bankDealId"));
parameterMap.put("dealTime", request.getParameter("dealTime"));
parameterMap.put("payAmount", request.getParameter("payAmount"));
parameterMap.put("fee", request.getParameter("fee"));
parameterMap.put("ext1", request.getParameter("ext1"));
parameterMap.put("ext2", request.getParameter("ext2"));
parameterMap.put("payResult", request.getParameter("payResult"));
parameterMap.put("errCode", request.getParameter("errCode"));
parameterMap.put("signMsg", request.getParameter("signMsg"));
Pkipair pkipair = new Pkipair();
//把获取的参数以逗号拼接
String merchantSignMsgVal = pkipair.joinKeyValue(request);
boolean vitifyFlag = pkipair.enCodeByCer(merchantSignMsgVal, request.getParameter("signMsg"));
if (vitifyFlag && "1008062687101".equals(request.getParameter("merchantAcctId")) && order.getOrderSn().equals(request.getParameter("orderId")) && "10".equals(request.getParameter("payResult")) && order.getPayableAmount().multiply(new BigDecimal(100)).compareTo(new BigDecimal(request.getParameter("payAmount"))) == 0) {
return true;
}
return false;
}
}
|
package laioffer.June23th;
import java.util.LinkedList;
import java.util.List;
/**
* Created by mengzhou on 6/24/17.
*/
public class CombinationOfCoins {
public List<List<Integer>> combinations(int target, int[] coins) {
List<List<Integer>> res = new LinkedList<>();
if(target < 0 || coins.length == 0) return res;
List<Integer> list = new LinkedList<>();
for (int i = 0; i < coins.length; i++) list.add(0);
helper(res, target, coins, 0, list);
return res;
}
public void helper(List<List<Integer>> res, int target, int[] coins, int pos, List<Integer> temp) {
if(target == 0) {
res.add(new LinkedList<>(temp));
return;
}
if(pos >= coins.length || target < 0) return;
for(int i = 0; i * coins[pos] <= target; i++) {
temp.set(pos, i);
helper(res, target - coins[pos] * i, coins, pos + 1, temp);
temp.set(pos, 0);
}
}
public static void main(String[] args) {
CombinationOfCoins app = new CombinationOfCoins();
List<List<Integer>> res = app.combinations(0, new int[]{10, 5, 2,1});
for (List<Integer> list : res) {
for (Integer i : list) {
System.out.print(i + ", ");
}
System.out.println();
}
}
}
|
package task345;
import common.Utils;
import common.Watch;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
* @author Igor
*/
public class Main345 {
private static final HashMap<Key, Integer> cache = new HashMap<>();
// --------------------------- main() method ---------------------------
public static void main(String[] args) throws IOException {
List<String> lines = Utils.readFile("../300_349/src/task345/matrix1.txt");
int[][] matrix = getMatrix(lines);
Watch.start();
System.out.println(findMaxSum(matrix));
Watch.stop();
}
private static int[][] getMatrix(List<String> lines) {
int[][] matrix = new int[lines.size()][];
for (int i = 0; i < lines.size(); i++) {
String[] elements = lines.get(i).split(" +");
int[] row = new int[elements.length];
for (int j = 0; j < elements.length; j++) {
row[j] = Integer.parseInt(elements[j]);
}
matrix[i] = row;
}
return matrix;
}
private static int findMaxSum(int[][] matrix) {
Key key = new Key(matrix);
if (cache.get(key) != null) {
return cache.get(key);
} else {
int length = matrix.length;
int maxSum = 0;
if (length == 2)
maxSum = Math.max(matrix[0][0] + matrix[1][1], matrix[0][1] + matrix[1][0]);
else
for (int i = 0; i < length; i++) {
int sum = matrix[0][i] + findMaxSum(reduceMatrix(i, matrix));
if (sum > maxSum) {
maxSum = sum;
}
}
cache.put(new Key(matrix), maxSum);
return maxSum;
}
}
private static int[][] reduceMatrix(int column, int[][] matrix) {
int length = matrix.length - 1;
int[][] reducedMatrix = new int[length][];
for (int i = 0; i < length; i++) {
int[] row = new int[length];
for (int j = 0, k = 0; j < length; j++, k++) {
if (k == column) k++;
row[j] = matrix[i + 1][k];
}
reducedMatrix[i] = row;
}
return reducedMatrix;
}
// -------------------------- Inner Classes --------------------------
private static class Key {
int[] a;
private Key(int[][] matrix) {
int length = matrix.length;
a = new int[length * length];
int k = 0;
for (int i = 0; i < length; i++) {
for (int j = 0; j < length; j++) {
a[k++] = matrix[i][j];
}
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Key key = (Key) o;
if (!Arrays.equals(a, key.a)) return false;
return true;
}
@Override
public int hashCode() {
return a != null ? Arrays.hashCode(a) : 0;
}
}
}
|
package com.meridal.example.twitter.domain.api;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.meridal.example.twitter.domain.UserProfile;
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class User extends com.meridal.example.twitter.domain.User {
public User() {
super();
}
private Metrics publicMetrics;
public User(final String id, final String name, final String username, final String description,
final String location, final Metrics publicMetrics) {
super(username, name);
this.setId(id);
this.setDescription(description);
this.setPublicMetrics(publicMetrics);
this.setLocation(location);
}
public Metrics getPublicMetrics() {
return publicMetrics;
}
public void setPublicMetrics(Metrics publicMetrics) {
this.publicMetrics = publicMetrics;
}
public UserProfile getUserProfile() {
final UserProfile profile = new UserProfile(this.getUsername(), this.getName());
profile.setId(this.getId());
profile.setDescription(this.getDescription());
profile.setLocation(this.getLocation());
if (this.publicMetrics != null) {
profile.setFollowerCount(this.publicMetrics.getFollowersCount());
profile.setFollowingCount(this.publicMetrics.getFollowingCount());
profile.setListed(this.publicMetrics.getListedCount());
profile.setTweets(this.publicMetrics.getTweetCount());
}
return profile;
}
}
|
package com.sm.report.rpc.scan;
import com.sm.report.rpc.param.Scan;
import com.sm.report.rpc.pojo.Player;
import com.sm.report.rpc.rpc.RpcBean;
import org.junit.Test;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
/**
* @author likangning
* @since 2018/5/30 上午8:52
*/
public class ScanTest {
public List<Player> queryAllPlayer(Long id) {return null;}
public List<Map<Player, Player>> queryAllPlayerMap(Long id) {return null;}
@Test
public void DFS() throws Exception {
Method method = ScanTest.class.getDeclaredMethod("queryAllPlayer", Long.class);
RpcBean rpcBean = new RpcBean(method);
Scan.DFS(rpcBean.getOutParam(), currParam ->
System.out.println(currParam.getName() + " : " + currParam.getClassType() + " : " + currParam.getLevel())
);
}
@Test
public void BFS() throws Exception {
Method method = ScanTest.class.getDeclaredMethod("queryAllPlayer", Long.class);
RpcBean rpcBean = new RpcBean(method);
Scan.BFS(rpcBean.getOutParam(), currParam ->
System.out.println(currParam.getName() + " : " + currParam.getClassType() + " : " + currParam.getLevel())
);
}
@Test
public void DFSMap() throws Exception {
Method method = ScanTest.class.getDeclaredMethod("queryAllPlayerMap", Long.class);
RpcBean rpcBean = new RpcBean(method);
Scan.DFS(rpcBean.getOutParam(), currParam ->
System.out.println(currParam.getName() + " : " + currParam.getClassType() + " : " + currParam.getLevel())
);
}
@Test
public void BFSMap() throws Exception {
Method method = ScanTest.class.getDeclaredMethod("queryAllPlayerMap", Long.class);
RpcBean rpcBean = new RpcBean(method);
Scan.BFS(rpcBean.getOutParam(), currParam ->
System.out.println(currParam.getName() + " : " + currParam.getClassType() + " : " + currParam.getLevel())
);
}
}
|
package com.bespinglobal.alertnow.client;
import com.bespinglobal.alertnow.config.Options;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.UnaryOperator;
public class ClientFactory {
private static final AtomicReference<Client> client = new AtomicReference();
private final Options options;
public ClientFactory(Options options) {
this.options = options;
}
public Client get() {
return client.updateAndGet(this.asSingleton());
}
private UnaryOperator<Client> asSingleton() {
return (ref) -> (Client) (ref != null ? ref : new ClientImpl(options));
}
}
|
/**
*
*/
package com.goodhealth.thread.Thead;
/**
* @author 24663
* @date 2018年11月17日
* @Description
*/
public class MyThreadLocal {
private static final ThreadLocal<String> classmate=new ThreadLocal<>();
public void set(String name){
classmate.set(name);
}
public String get(){
return classmate.get();
}
/**
* @param args
* @Description
*/
public static void main(String[] args) {
Thread t1=new Thread(){
public void run() {
Thread t2=new Thread(){
public void run() {
classmate.set("李四");
System.out.println(classmate.get());
};
};
try {
classmate.set("张三");
t2.start();
t2.join();
System.out.println(classmate.get());
} catch (InterruptedException e) {
e.printStackTrace();
}
};
};
t1.start();
}
}
|
package com.gtfs.service.interfaces;
import java.io.Serializable;
import java.util.List;
import com.gtfs.bean.BranchMst;
public interface BranchMstService extends Serializable{
List<BranchMst> findAll();
BranchMst findById(Long id);
}
|
package br.com.ecommerce.config;
import static br.com.ecommerce.config.DriverFactory.getDriver;
import static br.com.ecommerce.config.DriverFactory.resetDriver;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.rules.TestName;
import br.com.ecommerce.pages.retaguarda.dashboard.PageHomeRetaguarda;
import br.com.ecommerce.pages.retaguarda.login.PageLoginRetaguarda;
import br.com.ecommerce.tests.suites.AllTests;
import br.com.ecommerce.util.Log;
public class BaseTest {
PageHomeRetaguarda pageHomeRetaguarda = new PageHomeRetaguarda();
PageLoginRetaguarda pageLoginRetaguarda = new PageLoginRetaguarda();
@Rule
public TestName nameTest = new TestName();
@Before
public void before(){
Log.msgInicioTeste(nameTest.getMethodName());
pageLoginRetaguarda.realizarLoginRetaguarda();
pageHomeRetaguarda.verificaAutenticidadeUsuario();
}
@After
public void after(){
pageHomeRetaguarda.sairDoRetaguarda();
Log.msgFimTeste(nameTest.getMethodName());
}
@BeforeClass
public static void beforeClass(){
if(!AllTests.isAllTestsExecution){
getDriver().navigate().to(Property.URL_RETAGUARDA);
}
}
@AfterClass
public static void afterClass(){
if(!AllTests.isAllTestsExecution){
resetDriver();
}
}
}
|
package structure;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import communication.RepositoryInterface;
public class Project implements StructureComponent {
private String name;
private List<Package> packages;
public Project(String name) {
this.name = name;
packages = new ArrayList<Package>();
}
public void addPackage(Package newPackage) {
packages.add(newPackage);
}
public List<Package> getPackages() {
return packages;
}
public void setPackages(List<Package> packages) {
this.packages = packages;
}
public String getName() {
return name;
}
public int getNumPackages() {
return packages.size();
}
public boolean hasPackage(String name) {
for(Package pkg : packages) {
if(pkg.getName().equals(name))
return true;
}
return false;
}
@Override
public JSONObject toJson() {
JSONObject obj = constructJSONCore();
obj.put("packages", new JSONArray());
for(Package pkg : packages) {
obj.append("packages", pkg.toJson());
}
obj.append("packages", (new Package("src", true, "src")).toJsonRoot());
return obj;
}
public void toRepository() {
JSONObject obj = constructJSONCore();
// Send request to add project to repository and retrieve ID
try {
JSONObject result = RepositoryInterface.getInstance().post("projects", obj.toString());
// If request succeeded, process projects packages
if(result != null) {
for(Package pkg : packages) {
pkg.toRepository((int)result.get("id"));
}
// Insert src package as root for all packages
Package root = new Package("src", true);
JSONObject rootObj = root.constructJSONCoreRoot();
rootObj.put("projectId", (int)result.get("id"));
try {
JSONObject rootResult = RepositoryInterface.getInstance().post("packages", rootObj.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public JSONObject constructJSONCore() {
JSONObject obj = new JSONObject();
obj.put("projectName", name);
obj.put("numPackages", packages.size());
return obj;
}
public void toRepositoryDeep() {
JSONObject obj = toJson();
try {
JSONObject result = RepositoryInterface.getInstance().post("projects", obj.toString());
System.out.println(result);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.bookshelf.implementations.BooksDAOImpl;
import com.bookshelf.model.Books;
@WebServlet("/RemoveBook")
public class RemoveBook extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Books b1=new Books();
BooksDAOImpl bi=new BooksDAOImpl();
b1.setBookId(Integer.parseInt(request.getParameter("bookId")));
try {
System.out.println(b1);
bi.deleteBook(b1);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
package com.slort.model;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Data access object (DAO) for domain model class Hotel.
*
* @see com.slort.model.Hotel
* @author MyEclipse Persistence Tools
*/
public class HotelDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(HotelDAO.class);
// property constants
public static final String NOMBRE = "nombre";
protected void initDao() {
// do nothing
}
public void save(Hotel transientInstance) {
log.debug("saving Hotel instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Hotel persistentInstance) {
log.debug("deleting Hotel instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Hotel findById(java.lang.Integer id) {
log.debug("getting Hotel instance with id: " + id);
try {
Hotel instance = (Hotel) getHibernateTemplate().get(
"com.slort.model.Hotel", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Hotel instance) {
log.debug("finding Hotel instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Hotel instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Hotel as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByNombre(Object nombre) {
return findByProperty(NOMBRE, nombre);
}
public List findAll() {
log.debug("finding all Hotel instances");
try {
String queryString = "from Hotel";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Hotel merge(Hotel detachedInstance) {
log.debug("merging Hotel instance");
try {
Hotel result = (Hotel) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Hotel instance) {
log.debug("attaching dirty Hotel instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Hotel instance) {
log.debug("attaching clean Hotel instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static HotelDAO getFromApplicationContext(ApplicationContext ctx) {
return (HotelDAO) ctx.getBean("HotelDAO");
}
}
|
package com.landofoz.commonland.navigation;
import com.landofoz.commonland.domain.GraphNode;
import com.landofoz.commonland.domain.Location;
import com.landofoz.commonland.persistence.GraphNodeDAO;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by ericm on 10/17/2015.
*/
public class Navigator {
GraphNode graph;
public Navigator() {
graph = new GraphNodeDAO().getGraph();
}
public Navigator(GraphNode graph) {
this.graph = graph;
}
public List<Location> getBestPath(Location origin, Location destination, int type) {
GraphNode nodeOrigin = graph.getNodeByLocation(origin);
GraphNode nodeDestination = graph.getNodeByLocation(destination);
return getBestPathAux(nodeOrigin, nodeDestination, type);
}
private List<Location> getBestPathAux(GraphNode origin, GraphNode destination, int type) {
List<Location> path = null;
if (origin.equals(destination)) {
path = new ArrayList<Location>();
path.add(origin.getLocation());
} else {
for (GraphNode neighbor : origin.getNeighbors()) {
if (neighbor.getLocation().getType() == type) {
path = getBestPathAux(neighbor, destination, type);
if (path!=null) {
path.add(neighbor.getLocation());
break;
}
}
}
}
if(path!=null) Collections.reverse(path);
return path;
}
}
|
package largestsubmatrixsum;
public class Solution {
public int largest(int[][] matrix) {
// Write your solution here.
int N = matrix.length;
int M = matrix[0].length;
int result = getsumNumber(matrix, N, M);
return result;
}
private int getsumNumber(int [][] matrix, int n, int m){
int [][] sum = new int [n][m];
int result = Integer.MIN_VALUE;
sum [0][0] = matrix[0][0];
if(n==1 && m == 1){
result = sum[0][0];
}
else if(n == 1){
for(int j = 1; j < m; j++){
sum [0][j] = sum[0][j-1] + matrix[0][j];
result = Math.max(sum[0][j], result);
}
}
else if(m == 1){
for(int i = 1; i < n; i++){
sum [i][0] = sum[i-1][0] + matrix[i][0];
result = Math.max(sum[i][0], result);
}
}
else{
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(i==0 && j == 0){
sum[0][0] = matrix[0][0];
}
else if( i == 0 ){
sum [0][j] = sum[0][j-1] + matrix[0][j];
}
else if (j == 0){
sum [i][0] = sum[i-1][0] + matrix[i][0];
}
else{
sum[i][j] = sum[i][j-1] + sum[i-1][j] - sum[i-1][j-1] + matrix[i][j];
}
result = Math.max(result , sum[i][j]);
}
}
}
return result;
}
public static void main(String [] args){
Solution s = new Solution();
int [][] matrix = {{-1,-2,-3},{-4,-3,-2},{-3,0,-1}};
System.out.println(s.getsumNumber(matrix, 3, 3));
}
}
|
package ru.otus.atmdepartment.atm.storage;
import ru.otus.atmdepartment.atm.FaceValue;
import ru.otus.atmdepartment.atm.MoneyCell;
import ru.otus.atmdepartment.atm.MoneyCellImpl;
import java.util.*;
public class CellStoreImpl implements CellStore {
private final Map<Integer, MoneyCell> cellStore = new LinkedHashMap<>();
public CellStoreImpl(AtmOriginator originator) {
init();
saveState(originator);
}
public CellStoreImpl(AtmOriginator originator, Map<Integer, MoneyCell> initCellStore) {
cellStore.putAll(initCellStore);
saveState(originator);
}
/**Сохранить первоначальное состояние.**/
private void saveState(AtmOriginator originator) {
originator.saveState(new AtmState(cellStore));
}
/**Начальная инициализация. Создаем все ячейки.*/
private void init() {
if (cellStore.isEmpty()) {
for (FaceValue value: FaceValue.values()) {
int faceValue = value.faceValue();
cellStore.put(faceValue, new MoneyCellImpl(0, faceValue));
}
}
}
/**Функция проверяет доступность купюр в АТМ.**/
private boolean isAvailableMoneyInAtm(List<FaceValue> listFaceValues,
int faceValue,
int cash) {
int totalAmount = getTotalCash(listFaceValues.indexOf(faceValue));
return (cash > totalAmount);
}
private int clearCell(MoneyCell moneyCell) {
int faceValue = moneyCell.getFaceValue();
cellStore.put(faceValue, new MoneyCellImpl(0, faceValue));
return 0;
}
@Override
public void setBanknotes(int faceValue, MoneyCell moneyCell) {
cellStore.put(faceValue, moneyCell);
}
@Override
public void addBanknotes(MoneyCell moneyCell){
int faceValue = moneyCell.getFaceValue();
int banknotes = moneyCell.getBanknotesCount();
int newBanknotesCount = banknotes + getCell(faceValue).getBanknotesCount();
setBanknotes(faceValue, new MoneyCellImpl(newBanknotesCount, faceValue));
}
@Override
public Map<Integer, MoneyCell> getBanknotes(int cash) {
Map<Integer, MoneyCell> resultCell = new HashMap<>();
List<FaceValue> listFaceValues = Arrays.asList(FaceValue.values());
Collections.reverse(listFaceValues);
for (FaceValue value: listFaceValues){
int faceValue = value.faceValue();
MoneyCell moneyCell = getCell(faceValue);
if (moneyCell == null || moneyCell.getTotalAmount() == 0) continue;
if (isAvailableMoneyInAtm(listFaceValues, faceValue, cash)) {
throw new IllegalAccessError("Unable to issue the indicated amount!");
}
//Выполняем арифметические операци.
int atmBanknotes = moneyCell.getBanknotesCount();
int remainder = (cash % faceValue);
int remainderCash = (cash - remainder);
int customerBanknotes = (remainderCash / faceValue);
int remainderBanknotes = atmBanknotes - customerBanknotes;
//Если остаток от деления входящего знчения равен 0 - изменяем значение объекта.
if (remainder == 0) {
resultCell.put(faceValue, new MoneyCellImpl(customerBanknotes, faceValue));
setBanknotes(faceValue, new MoneyCellImpl(remainderBanknotes, faceValue));
System.out.println(remainderBanknotes);
break;
} else {
//Выполняем, если кол-во необходимых купюр меньше чем в ячейке.
if (remainderBanknotes < 0) {
resultCell.put(faceValue, new MoneyCellImpl(atmBanknotes, faceValue));
clearCell(moneyCell); //addMoneyCell(new MoneyCellImpl(0, faceValue));
cash = remainder + (remainderBanknotes * faceValue *(-1));
} else {
setBanknotes(faceValue, new MoneyCellImpl(remainderBanknotes, faceValue));
resultCell.put(faceValue, new MoneyCellImpl(customerBanknotes, faceValue));
cash = remainder;
}
}
}
return resultCell;
}
public MoneyCell getCell(int faceValue) {
return cellStore.get(faceValue);
}
public int getTotalCash(int var) {
if (var > 0) {
return cellStore.values().stream()
.limit(var)
.mapToInt(k -> k.getTotalAmount())
.sum();
}
int result = cellStore.values().stream()
.mapToInt(k -> k.getTotalAmount())
.sum();
return result;
}
public int getTotalBanknotes() {
return cellStore.values().stream().mapToInt(k -> k.getBanknotesCount()).sum();
}
}
|
package cn.canlnac.onlinecourse.presentation.internal.di.modules;
import cn.canlnac.onlinecourse.domain.executor.PostExecutionThread;
import cn.canlnac.onlinecourse.domain.executor.ThreadExecutor;
import cn.canlnac.onlinecourse.domain.interactor.GetDocumentsInCourseUseCase;
import cn.canlnac.onlinecourse.domain.interactor.UseCase;
import cn.canlnac.onlinecourse.domain.repository.CourseRepository;
import cn.canlnac.onlinecourse.presentation.internal.di.PerActivity;
import dagger.Module;
import dagger.Provides;
/**
* 注入模块.
*/
@Module
public class GetDocumentsInCourseModule {
private final int courseId;
private final Integer start;
private final Integer count;
private final String sort;
public GetDocumentsInCourseModule(
int courseId,
Integer start,
Integer count,
String sort
) {
this.courseId = courseId;
this.start = start;
this.count = count;
this.sort = sort;
}
@Provides
@PerActivity
UseCase provideGetDocumentsInCourseUseCase(CourseRepository courseRepository, ThreadExecutor threadExecutor,
PostExecutionThread postExecutionThread){
return new GetDocumentsInCourseUseCase(courseId, start,count,sort, courseRepository, threadExecutor, postExecutionThread);
}
}
|
package com.ibeiliao.trade.impl.mq;
import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;
import com.ibeiliao.pay.common.utils.cfg.AesPropertiesEncoder;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* 功能:阿里云MQ的配置
* 详细:使用disconf的配置
*
* 注:因disconf缓存的原因,对于有解密的属性,不能直接使用 bean 注入的方式,
* 调用方必须使用 ConsumerMqConfig.instance.getXxxx() 获取属性。
* @author linyi 2016/8/25
*/
@Component
@Scope("singleton")
@DisconfFile(filename = "pay_mq.properties")
public class ConsumerMqConfig {
/**
* accessKey
*/
private String accessKey;
/**
* 密钥
*/
private String accessSecret;
/**
* 生产者ID
*/
private String producerId;
/**
* 消费者ID
*/
private String consumerId;
/**
* topic
*/
private String topic;
/**
* 发出通知的tag
*/
private String notification;
private AesPropertiesEncoder encoder = new AesPropertiesEncoder();
static ConsumerMqConfig instance;
@PostConstruct
public void init() {
instance = this;
}
@DisconfFileItem(name = "aliyun.mq.accessKey.encryption", associateField = "accessKey")
public String getAccessKey() {
return accessKey;
}
public void setAccessKey(String accessKey) {
this.accessKey = encoder.decode(accessKey);
}
@DisconfFileItem(name = "aliyun.mq.accessSecret.encryption", associateField = "accessSecret")
public String getAccessSecret() {
return accessSecret;
}
public void setAccessSecret(String accessSecret) {
this.accessSecret = encoder.decode(accessSecret);
}
@DisconfFileItem(name = "aliyun.mq.pay.producerId", associateField = "producerId")
public String getProducerId() {
return producerId;
}
public void setProducerId(String producerId) {
this.producerId = producerId;
}
@DisconfFileItem(name = "aliyun.mq.pay.consumerId", associateField = "consumerId")
public String getConsumerId() {
return consumerId;
}
public void setConsumerId(String consumerId) {
this.consumerId = consumerId;
}
@DisconfFileItem(name = "aliyun.mq.pay.topic", associateField = "topic")
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
@DisconfFileItem(name = "aliyun.mq.pay.tag.notification", associateField = "notification")
public String getNotification() {
return notification;
}
public void setNotification(String notification) {
this.notification = notification;
}
}
|
package models;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import play.db.jpa.Model;
@Entity
public class Company extends Model {
@Column(length = 30, nullable = false)
public String name;
@Column(length = 8, nullable = false)
public int PIB;
@Column(length = 50)
public String address;
@Column(length = 30)
public String mobile;
@Column(length = 8, nullable = false)
public String JMBG;
@OneToMany(mappedBy = "company")
public List<BusinessYear> businessYear;
@OneToMany(mappedBy = "company")
public List<BusinessPartner> businessPartner;
@OneToMany(mappedBy = "company")
public List<Invoice> invoices;
public Company(String naziv, int pib, String adresa,
String mobile, String jmbg)
{
super();
this.name = naziv;
PIB = pib;
this.address = adresa;
this.mobile = mobile;
JMBG = jmbg;
}
}
|
package com.authenticationservice.cache.configuration;
import lombok.Data;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import redis.clients.jedis.JedisPoolConfig;
import java.util.Arrays;
import java.util.List;
/**
* <p>
* <p>
* <p>
* <p>
*
* @author cjrequena
* @version 1.0
* @see
* @since JDK1.8
*/
@Data
@Log4j2
@Configuration
@EnableRedisRepositories
public class RedisConfiguration {
// Database index used by the connection factory.
@Value("${spring.redis.database}")
int database;
// Connection URL, will override host, port and password (user will be ignored), e.g. redis://user:password@example.com:6379
@Value("${spring.redis.url}")
String url;
// Redis server host.
@Value("${spring.redis.host}")
String host;
// Redis server port.
@Value("${spring.redis.port}")
int port;
// Login password of the redis server.Redis server password.
@Value("${spring.redis.password}")
String password;
// Enable SSL support.
@Value("${spring.redis.ssl}")
boolean ssl;
// Connection timeout in milliseconds.
@Value("${spring.redis.timeout}")
int timeout;
// Max number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
@Value("${spring.redis.pool.max-active}")
int poolMaxActive;
// Max number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
@Value("${spring.redis.pool.max-idle}")
int poolMaxIdle;
// Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
@Value("${spring.redis.pool.max-wait}")
int poolMaxWait;
// Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
@Value("${spring.redis.pool.min-idle}")
int poolMinIdle;
// Maximum number of redirects to follow when executing commands across the cluster.
@Value("${spring.redis.cluster.max-redirects}")
int clusterMaxRedirects;
// Comma-separated list of "host:port" pairs to bootstrap from.
@Value("${spring.redis.cluster.nodes}")
List<String> clusterNodes;
// Name of Redis server.
@Value("${spring.redis.sentinel.master}")
String sentinelMaster;
// Comma-separated list of host:port pairs.
@Value("${spring.redis.sentinel.nodes}")
List<String> sentinelNodes;
//
@Value("${spring.redis.pool.enabled}")
private Boolean poolEnabled;
//
@Value("${spring.redis.cluster.enabled}")
private Boolean clusterEnabled;
//
@Value("${spring.redis.sentinel.enabled}")
private Boolean sentinelEnabled;
/**
* Connection factory
*
* @return
*/
@Bean
public RedisConnectionFactory redisConnectionFactory() {
if (sentinelEnabled) {
RedisSentinelConfiguration redisSentinelConfiguration = new RedisSentinelConfiguration();
redisSentinelConfiguration.setMaster(sentinelMaster);
for (String sentinelNode : sentinelNodes) {
String sentinelHost = sentinelNode.split(":")[0];
Integer sentinelPort = Integer.parseInt(sentinelNode.split(":")[1]);
redisSentinelConfiguration.sentinel(sentinelHost, sentinelPort);
}
return new JedisConnectionFactory(redisSentinelConfiguration);
} else if (clusterEnabled) {
RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration(clusterNodes);
redisClusterConfiguration.setMaxRedirects(clusterMaxRedirects);
return new JedisConnectionFactory(redisClusterConfiguration);
} else {
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
jedisConnectionFactory.setDatabase(database);
jedisConnectionFactory.setHostName(host);
jedisConnectionFactory.setPassword(password);
jedisConnectionFactory.setUseSsl(ssl);
jedisConnectionFactory.setTimeout(timeout);
jedisConnectionFactory.setUsePool(poolEnabled);
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxIdle(poolMaxIdle);
jedisPoolConfig.setMinIdle(poolMinIdle);
jedisPoolConfig.setMaxWaitMillis(poolMaxWait);
jedisConnectionFactory.setPoolConfig(jedisPoolConfig);
return jedisConnectionFactory;
}
}
/**
* @return
*/
@Bean
public StringRedisTemplate stringRedisTemplate() {
return new StringRedisTemplate(redisConnectionFactory());
}
/**
* RedisTemplate is necessary for Redis repositories
*
* @return
*/
@Bean
public RedisTemplate<?, ?> redisTemplate() { //NOSONAR
RedisTemplate<byte[], byte[]> template = new RedisTemplate<>();
template.setConnectionFactory(redisConnectionFactory());
return template;
}
/**
* Redis cache manager.
*
* @return the cache manager
*/
@Bean(name = "redisCacheManager")
public CacheManager redisCacheManager() {
RedisCacheManager localRedisCacheManager = new RedisCacheManager(redisTemplate());
localRedisCacheManager.setCacheNames(Arrays.asList("REDIS_CACHE_1"));
localRedisCacheManager.afterPropertiesSet();
return localRedisCacheManager;
}
}
|
package amazon.com.qa.util;
public class TestUtil {
public static int PAGE_LOAD_TIMEOUT=30;
public static int IMPLICIT_WAIT=20;
}
|
package com.jpa.operator;
public enum FilterOperator {
EQUAL,
LIKE,
LEFTLIKE,
RIGHTLIKE,
GT,
GE,
LT,
LE,
BETWEEN,
ISNULL,
ISNOTNULL,
NOTEQUAL,
NOTLIKE,
IN;
private FilterOperator() {
}
}
|
package com.beiyelin.addressservice.service;
import com.beiyelin.addressservice.entity.Country;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @Author: xinsh
* @Description:
* @Date: Created in 15:53 2018/2/15.
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class CountryServiceTest {
@Autowired
CountryService countryService;
@Test
public void add() {
Country country = new Country();
country.setId("1");
country.setCode("101");
country.setName("中国");
Country newItem = countryService.create(country);
log.info(newItem.toString());
}
}
|
/**
*
*/
public class Main {
public static void main(String[] args) throws Exception {
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> {
new MainPage().setVisible(true);
});
}
}
|
package com.javarush.task.task18.task1817;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
import java.util.ArrayList;
/*
Пробелы
*/
public class Solution {
public static void main(String[] args) {
String fileName = args[0];
ArrayList<String> list = new ArrayList<String>();
try {
BufferedReader file = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
while (file.ready()) {
list.add(file.readLine());
}
file.close();
} catch (IOException e) {
}
double n1 = 0;
double n2 = 0;
for (int i = 0; i < list.size(); i++) {
n1 += list.get(i).length();
}
for (int i = 0; i < list.size(); i++) {
for (int j = 0; j < list.get(i).length(); j++) {
if (list.get(i).charAt(j) == ' ')
n2++;
}
}
double result = Math.round((float) n2 / n1 * 100 * 100.0) / 100.0;
System.out.print(result);
}
}
|
package jp.co.worksap.oss.findbugs.guava;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
import com.h3xstream.findbugs.test.BaseDetectorTest;
import com.h3xstream.findbugs.test.EasyBugReporter;
/**
* @author tolina GmbH
*
*/
public class UnexpectedAccessDetectorTest extends BaseDetectorTest {
private EasyBugReporter reporter;
@Before
public void setup() {
reporter = spy(new EasyBugReporter());
}
@Test
public void testNormalMethod() throws Exception {
// Locate test code
final String[] files = {
getClassFilePath("samples/guava/ClassWhichCallsNormalMethod"),
getClassFilePath("samples/guava/MethodWithoutVisibleForTesting")
};
// Run the analysis
analyze(files, reporter);
verify(reporter, never()).doReportBug(
bugDefinition()
.bugType("GUAVA_UNEXPECTED_ACCESS_TO_VISIBLE_FOR_TESTING")
.build()
);
}
@Test
public void testCallFromJUnit4Test() throws Exception {
// Locate test code
final String[] files = {
getClassFilePath("samples/guava/JUnit4Test"),
getClassFilePath("samples/guava/MethodWithVisibleForTesting")
};
// Run the analysis
analyze(files, reporter);
verify(reporter, never()).doReportBug(
bugDefinition()
.bugType("GUAVA_UNEXPECTED_ACCESS_TO_VISIBLE_FOR_TESTING")
.build()
);
}
@Test
public void testCallFromJUnit3Test() throws Exception {
// Locate test code
final String[] files = {
getClassFilePath("samples/guava/JUnit3Test"),
getClassFilePath("samples/guava/MethodWithVisibleForTesting")
};
// Run the analysis
analyze(files, reporter);
verify(reporter, never()).doReportBug(
bugDefinition()
.bugType("GUAVA_UNEXPECTED_ACCESS_TO_VISIBLE_FOR_TESTING")
.build()
);
}
@Test
public void testCallingAnnotatedMethod() throws Exception {
// Locate test code
final String[] files = {
getClassFilePath("samples/guava/ClassWhichCallsVisibleMethodForTesting"),
getClassFilePath("samples/guava/MethodWithVisibleForTesting")
};
// Run the analysis
analyze(files, reporter);
verify(reporter).doReportBug(
bugDefinition()
.bugType("GUAVA_UNEXPECTED_ACCESS_TO_VISIBLE_FOR_TESTING")
.inClass("ClassWhichCallsVisibleMethodForTesting")
.build()
);
}
}
|
package com.bolly.controller;
import java.util.List;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.bolly.exception.AppException;
import com.bolly.model.Movie;
@RestController
@ResponseBody
public class ApiController extends CommonController{
private static Logger logger = org.slf4j.LoggerFactory.getLogger(ApiController.class);
@RequestMapping(value = "movie", params={"recent_count"}, method = RequestMethod.GET, produces = "application/json")
public List<Movie> getRecentMovies(@RequestParam("recent_count") int recentCount){
logger.debug("At getRecentMovies");
return bollyServiceImpl.getRecentMovies(recentCount);
}
@RequestMapping(value = "movie/{id}", method = RequestMethod.GET, produces = "application/json")
public Movie getMovie(@PathVariable("id") int id) throws AppException{
logger.debug("At getMovie");
return bollyServiceImpl.getMovie(id);
}
}
|
package ar.com.corpico.appcorpico.orders.presentation;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.UiSettings;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;
import ar.com.corpico.appcorpico.orders.domain.entity.Tipo_Cuadrilla;
import ar.com.corpico.appcorpico.orders.domain.entity.Order;
/**
* Muestra el mapa
*/
public class OrdersMapsFragment extends SupportMapFragment implements OnMapReadyCallback, ar.com.corpico.appcorpico.orders.presentation.View {
private GoogleMap mMap;
private String mTipoCuadrilla;
private List<String> mTipoTrabajoSelected = new ArrayList();
private List<String> mTipoTrabajo = new ArrayList();
private List<String> mZona = new ArrayList();
private List<String> mZonaSelected = new ArrayList();
private String mEstado;
private String mSector;
private DateTime mDesde = new DateTime();
private DateTime mHasta = new DateTime();
private Presenter mOrdersMapPresenter;
private static final int LOCATION_REQUEST_CODE = 1;
private Marker marker;
public OrdersMapsFragment() {
}
public static OrdersMapsFragment newInstance(String tipoCuadrilla, String estado, List<String> zona,DateTime desde, DateTime hasta) {
OrdersMapsFragment fragment = new OrdersMapsFragment();
Bundle args = new Bundle();
// TODO: Pasar los demás parámetros de la Action Bar
args.putString("tipoCuadrilla", tipoCuadrilla);
args.putString("estado", estado);
args.putStringArrayList("zona", (ArrayList<String>) zona);
args.putSerializable("desde", desde);
args.putSerializable("hasta", hasta);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
// Toman parámetros
mTipoCuadrilla = getArguments().getString("tipoCuadrilla");
mEstado = getArguments().getString("estado");
mZona = getArguments().getStringArrayList("zona");
mDesde = (DateTime) getArguments().get("desde");
mHasta = (DateTime) getArguments().get("hasta");
//Spinner activitySpinner = (Spinner) getActivity().findViewById(R.id.spinner_toolBar);
}
getMapAsync(this);
//setLoadOrderList(mTipoCuadrilla);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = super.onCreateView(inflater, container, savedInstanceState);
this.setLoadOrderList(mTipoCuadrilla);
return root;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == LOCATION_REQUEST_CODE) {
// ¿Permisos asignados?
if (permissions.length > 0 &&
permissions[0].equals(Manifest.permission.ACCESS_FINE_LOCATION) &&
grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
} else {
Toast.makeText(getActivity(), "Error de permisos", Toast.LENGTH_LONG).show();
}
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
UiSettings uiSettings = mMap.getUiSettings();
uiSettings.setScrollGesturesEnabled(true);
uiSettings.setTiltGesturesEnabled(true);
mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
mMap.setMyLocationEnabled(true);
} else {
if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)) {
// Mostrar diálogo explicativo
} else {
// Solicitar permiso
ActivityCompat.requestPermissions(
getActivity(),
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
LOCATION_REQUEST_CODE);
}
}
mMap.getUiSettings().setZoomControlsEnabled(true);
//LatLng pico = new LatLng(-35.666667, -63.733333);
LatLng pico = new LatLng(-35.658103, -63.757882);
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(pico)
.zoom(14)
.build();
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
public void LoadOrderMap(List<Order> orders){
for (Order order : orders) {
Double mLat,mLng;
mLat = new Double((order.getLatitud().substring(0,7))).doubleValue()*-1;
mLng = new Double((order.getLongitud().substring(0,7))).doubleValue()*-1;
LatLng mLatLng = new LatLng(mLat,mLng);
marker = mMap.addMarker(new MarkerOptions()
.position(mLatLng)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW))
.title(order.getTitular() + " - " + order.getDomicilio()));
/*mMap.addMarker(new MarkerOptions()
.position(mLatLng)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW))
.title(order.getTitular() + " - " + order.getDomicilio()));*/
/*CameraPosition cameraPosition = CameraPosition.builder()
.target(mLatLng)
.zoom(14)
.build();
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));*/
}
}
@Override
public void showOrderList(List<Order> listorder) {
if (mMap != null) {
mMap.clear();
}
if (marker != null){
marker.remove();
}
LoadOrderMap(listorder);
}
@Override
public void showTipoCuadrillaList(List<Tipo_Cuadrilla> listorder) {
}
@Override
public void showCuadrillaxTipoList(List<Tipo_Cuadrilla> listcuadrilla) {
}
@Override
public List<String> getTipoTrabajo() {
return mTipoTrabajo;
}
@Override
public List<String> getZona() {
return mZona;
}
@Override
public void cleanData() {
mDesde=null;
mHasta=null;
mZonaSelected=new ArrayList<>();
mTipoTrabajoSelected=new ArrayList<>();
}
@Override
public void showOrderError(String error) {
}
@Override
public void setPresenter(Presenter presenter) {
mOrdersMapPresenter=presenter;
}
@Override
public void setTipoTrabajo(List<String> tipoTrabajo) {
mTipoTrabajo=tipoTrabajo;
//mTipoTrabajoSelected = new ArrayList<>();
}
@Override
public void setZonas(List<String> zona) {
mZona=zona;
//mZonaSelected = new ArrayList<>();
}
@Override
public void showOrdesEmpty() {
}
@Override
public void showProgressIndicator(boolean show) {
}
@Override
public void setOrderFilter(String estado, List<String> tipo, List<String> zona, DateTime desde, DateTime hasta, String search, Boolean estadoActual) {
if (tipo.size() == 0){
mTipoTrabajoSelected= mTipoTrabajo;
}else{
mTipoTrabajoSelected = tipo;
}
if (zona.size() == 0){
mZonaSelected= mZona;
}else{
mZonaSelected = zona;
}
mDesde=desde;
mHasta=hasta;
mOrdersMapPresenter.loadOrderList(mEstado,mTipoTrabajoSelected,mZonaSelected,mDesde,mHasta,search,estadoActual);
}
@Override
public void setLoadOrderList(String tipocuadrilla) {
mTipoCuadrilla=tipocuadrilla;
if (mTipoCuadrilla!=null){
mOrdersMapPresenter.setLoadTipoTrabajos(mTipoCuadrilla);
mOrdersMapPresenter.setLoadZonas();
if(mTipoTrabajoSelected.size()==0 && mZonaSelected.size()==0){
mOrdersMapPresenter.loadOrderList(mEstado,mTipoTrabajo,mZona,mDesde,mHasta,null,true);
}
if(mTipoTrabajoSelected.size()!=0 && mZonaSelected.size()==0){
mOrdersMapPresenter.loadOrderList(mEstado,mTipoTrabajoSelected,mZona,mDesde,mHasta,null,true);
}
if(mTipoTrabajoSelected.size()==0 && mZonaSelected.size()!=0){
mOrdersMapPresenter.loadOrderList(mEstado,mTipoTrabajo,mZonaSelected,mDesde,mHasta,null,true);
}
if(mTipoTrabajoSelected.size()!=0 && mZonaSelected.size()!=0){
mOrdersMapPresenter.loadOrderList(mEstado,mTipoTrabajoSelected,mZonaSelected,mDesde,mHasta,null,true);
}
}
}
@Override
public void setAsignarOrder(String cuadrilla, List<String> listorder) {
}
}
|
/*
* 版权声明 .
* 此文档的版权归通联支付网络服务有限公司所有
* Powered By [Allinpay-Boss-framework]
*/
package com.allinpay.its.boss.system.permission.action;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.allinpay.its.boss.framework.utils.Page;
import com.allinpay.its.boss.framework.utils.SessionUtil;
import com.allinpay.its.boss.system.BaseAction;
import com.allinpay.its.boss.system.permission.model.FrameworkSysRole;
import com.allinpay.its.boss.system.permission.service.FrameworkSysRoleServiceImpl;
@Controller
@RequestMapping("/sysrole")
public class FrameworkSysRoleAction extends BaseAction {
// private static final long serialVersionUID = 1579626063L;
@Autowired
private FrameworkSysRoleServiceImpl frameworkSysRoleService;
/**
* 列表信息查询
*
* @return String
* @author code gen
*/
@RequestMapping("")
public String findFrameworkSysRoles(Model springModel,
FrameworkSysRole model) {
Page page = frameworkSysRoleService.findFrameworkSysRoles(model,
model.getPageNum(), model.getNumPerPage());
springModel.addAttribute(page);
return "system/permission/FrameworkSysRole/FrameworkSysRolesQuery";
}
/**
* 新增页面
*
* @return String
* @author by code generator
*/
@RequestMapping("/addFrameworkSysRoleToPage")
public String addFrameworkSysRole(Model model,HttpServletRequest request) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) request.getSession().getAttribute(SessionUtil.USER_MAP);
frameworkSysRoleService.addFrameworkSysRoleToPage(model,map);
return "system/permission/FrameworkSysRole/FrameworkSysRoleAdd";
}
/**
* 新增保存
*
* @return String
* @author by code generator
*/
@RequestMapping(value = "/saveFrameworkSysRoleAction", method = RequestMethod.POST)
public ModelAndView saveFrameworkSysRole(FrameworkSysRole model) {
frameworkSysRoleService.saveSysRole(model);
return ajaxDoneSuccess("成功");
}
/**
* 删除
*
* @return String
* @author by code generator
*/
@RequestMapping("/delete/{pk_Id}")
public ModelAndView deleteFrameworkSysRole(@PathVariable("pk_Id") int pk_Id) {
frameworkSysRoleService.deleteSysRole(pk_Id);
return ajaxDoneSuccess("成功");
}
/**
* 批量删除
* @param orderIndexs
* @return
*/
@RequestMapping("/deleteAll")
public ModelAndView deleteAll(@RequestParam("orderIndexs") String orderIndexs) {
if (orderIndexs != null && orderIndexs.length()> 0 ){
String[] ids= orderIndexs.split(",");
for( int i=0; i<ids.length; i++){
if (ids[i].length()>0){
frameworkSysRoleService.delete(Integer.parseInt(ids[i]));
}
}
}
return ajaxDoneSuccess("成功");
}
/**
* 修改初始化
*
* @return String
* @author by code generator
*/
@RequestMapping("/modify/{pk_Id}")
public String initModifyFrameworkSysRole(@PathVariable("pk_Id") int pk_Id,
Model springModel,HttpServletRequest request) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) request.getSession().getAttribute(SessionUtil.USER_MAP);
frameworkSysRoleService.initModifySysRole(pk_Id, springModel,map);
return "system/permission/FrameworkSysRole/FrameworkSysRoleModify";
}
/**
* 修改
*
* @return String
* @author code gen
*/
@RequestMapping(value = "/modifyFrameworkSysRoleAction", method = RequestMethod.POST)
public ModelAndView modifyFrameworkSysRole(FrameworkSysRole model) {
frameworkSysRoleService.modifySysRole(model);
return ajaxDoneSuccess("成功");
}
/**
* 明细信息查找
*
* @return String
* @author code gen
*/
public String findFrameworkSysRole(FrameworkSysRole model) {
// 查询基本信息
// FrameworkSysRole frameworkSysRole =
// frameworkSysRoleService.getFrameworkSysRoleByPk(model);
// changeToFrameworkSysRoleForm(frameworkSysRole);
return "system/permission/FrameworkSysRole/FrameworkSysRoleDetail";
}
/**
* 将对象属性信息赋值给表单对象
*
* @param FrameworkSysRole
* POJO对象
* @return FrameworkSysRoleForm 表单信息POJO对象
* @author code gen
*/
// private void changeToFrameworkSysRoleForm(FrameworkSysRole
// frameworkSysRole) {
//
//
// frameworkSysRole.setId(frameworkSysRole.getId());
//
// frameworkSysRole.setSysRoleCode(frameworkSysRole.getSysRoleCode());
//
// frameworkSysRole.setSysRoleName(frameworkSysRole.getSysRoleName());
//
// frameworkSysRole.setSysRoleDescription(frameworkSysRole.getSysRoleDescription());
//
// frameworkSysRole.setState(frameworkSysRole.getState());
//
// frameworkSysRole.setRemark(frameworkSysRole.getRemark());
//
// frameworkSysRole.setCreateUserId(frameworkSysRole.getCreateUserId());
//
// frameworkSysRole.setCreateTime(frameworkSysRole.getCreateTime());
//
// frameworkSysRole.setModifyUserId(frameworkSysRole.getModifyUserId());
//
// frameworkSysRole.setModifyTime(frameworkSysRole.getModifyTime());
//
// frameworkSysRole.setVersion(frameworkSysRole.getVersion());
//
// }
}
|
package com.msir.pojo;
import java.util.Date;
/**
* Created by Fantasy on 2017/8/7.
*/
public class LocationDO {
private int id;
private int count;
private String n;
private String pinyinFull;
private String pinyinShort;
private Date gmtCreate;
private Date gmtModified;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getN() {
return n;
}
public void setN(String n) {
this.n = n;
}
public String getPinyinFull() {
return pinyinFull;
}
public void setPinyinFull(String pinyinFull) {
this.pinyinFull = pinyinFull;
}
public String getPinyinShort() {
return pinyinShort;
}
public void setPinyinShort(String pinyinShort) {
this.pinyinShort = pinyinShort;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
|
package DSArraypack;
public class DoubleCircularLinkedList {
Node start;
class Node
{
int data;
Node next;
Node prev;
}
void insertEnd(int value)
{
if(start==null)
{
Node newNode=new Node();
newNode.data=value;
newNode.next=newNode.prev=newNode;
start=newNode;
return;
}
Node last=(start).prev;
Node newNode=new Node();
newNode.data=value;
newNode.next=start;
(start).prev=newNode;
newNode.prev=last;
last.next=newNode;
}
void insertBeg(int value)
{
Node last = (start).prev;
Node newNode = new Node();
newNode.data=value;
newNode.next=start;
newNode.prev=last;
last.next = (start).prev = newNode;
start=newNode;
}
void insertAfter(int value1,int value2)
{
Node newNode=new Node();
newNode.data=value1;
Node temp=start;
while (temp.data!=value2)
temp=temp.next;
Node next=temp.next;
temp.next=newNode;
newNode.prev=temp;
newNode.next=next;
next.prev=newNode;
}
void display()
{
Node temp=start;
System.out.println("\nTraversal in forward direction\n");
while (temp.next!=start)
{
System.out.printf("%d", temp.data);
temp=temp.next;
}
System.out.printf("%d",temp.data);
System.out.println("\nTraversal in reverse direction \n");
Node last=start.prev;
temp=last;
while(temp.prev!=last)
{
System.out.printf("%d",temp.data);
temp=temp.prev;
}
System.out.printf("%d",temp.data);
}
public static void main(String []args)
{
DoubleCircularLinkedList dcl=new DoubleCircularLinkedList();
Node start=null;
dcl.insertBeg(10);
dcl.insertBeg(20);
dcl.insertAfter(1,30);
dcl.insertEnd(40);
dcl.display();
}
}
|
package com.smxknife.flink.networkflowanalysis.pageview;
/**
* @author smxknife
* 2020/8/27
*/
public class PageView {
}
|
package dev.schoenberg.kicker_stats.core.helper;
import static org.assertj.core.api.Assertions.*;
import org.junit.Before;
import org.junit.Test;
import dev.schoenberg.kicker_stats.core.domain.Credentials;
public class Sha3BouncyCastlePasswordHasherTest {
private Sha3BouncyCastlePasswordHasher tested;
@Before
public void setup() {
tested = new Sha3BouncyCastlePasswordHasher();
}
@Test
public void emptyInput() {
Credentials input = new Credentials("", "");
String result = tested.apply(input);
assertThat(result).isEqualTo("763c38be0664691418d38f5ccde0162c9ff11fbda1b946d56476bdaa90fd13d6");
}
@Test
public void passwordIsHashed() {
Credentials input = new Credentials("", "pwd");
String result = tested.apply(input);
assertThat(result).isEqualTo("1486ffb0ab36e1e0cf13d4702e6b3a7d88bb8be326a6370296fd16b900ede931");
}
@Test
public void mailIsUsedAsSalt() {
Credentials input = new Credentials("mail@gmail.com", "");
String result = tested.apply(input);
assertThat(result).isEqualTo("cf98880052b044aeae8a75612d44d5d0b5b33e2f89dbb100081ef95d19eaa1ba");
}
}
|
package ua.training.model.entity;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a question in a test.
* It may have a link to the first answer.
*/
public class Question {
private static final String TAB = " ";
private static final String EOL = System.lineSeparator();
private static final char SPACE = ' ';
private String text;
private Answer firstAnswer;
/**
* Class constructor specifying the text of the question.
*/
public Question(String text) {
this.text = text;
}
public String getText() {
return text;
}
public List<Answer> getAnswers() {
List<Answer> answers = new ArrayList<>();
if (firstAnswer != null) {
answers.add(firstAnswer);
Answer currentAnswer = firstAnswer;
while (currentAnswer.hasNextAnswer()) {
currentAnswer = currentAnswer.getNextAnswer();
answers.add(currentAnswer);
}
}
return answers;
}
/**
* Adds a next answer to the question.
* @param newAnswer an answer to be added to the question
*/
public void addAnswer(Answer newAnswer) {
if (firstAnswer != null) {
Answer currentAnswer = firstAnswer;
while(currentAnswer.hasNextAnswer()) {
currentAnswer = currentAnswer.getNextAnswer();
}
currentAnswer.setNextAnswer(newAnswer);
} else {
this.firstAnswer = newAnswer;
}
}
public Answer getFirstAnswer() {
return firstAnswer;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(text).append(EOL);
int index = 1;
Answer currentAnswer = firstAnswer;
while (currentAnswer != null) {
sb.append(TAB).append(index).append(SPACE).append(currentAnswer.getText()).append(EOL);
currentAnswer = currentAnswer.getNextAnswer();
index++;
}
return sb.toString();
}
}
|
package com.noteshare.user.controller;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.noteshare.common.utils.constant.Constants;
import com.noteshare.common.utils.jcropPicUtils.CutPicture;
import com.noteshare.common.utils.resources.Configuration;
import com.noteshare.user.model.User;
import com.noteshare.user.services.UserService;
@Controller
@RequestMapping("/jcrop")
public class JcropUploadController {
@Resource
private UserService userService;
@RequestMapping("/gotoJcrop")
public String gotoJcrop(){
return "jcrop/demo";
}
@RequestMapping("/jcropUpload")
@ResponseBody
public String jcropUpload(MultipartFile uploadFile, HttpServletRequest request,HttpSession session) {
JSONObject json = new JSONObject();
User user = (User) session.getAttribute(Constants.SESSION_USER);
try {
String userIconPath = Configuration.getProperty(Constants.JCROPPICPATH, "/uploadFiles/userIcon");
String realPath = request.getSession().getServletContext().getRealPath(userIconPath);
uploadFile.transferTo(new File(realPath + File.separator + user.getId() + "_original.jpg"));
json.put("path", userIconPath + File.separator + user.getId() + "_original.jpg");
json.put("result", "success");
} catch (IOException e) {
json.put("result", "fail");
}
return json.toJSONString();
}
@RequestMapping("/jcrop")
@ResponseBody
public String jcrop(float x,float y,float w,float h,HttpServletRequest request,HttpSession session) {
JSONObject json = new JSONObject();
User user = (User) session.getAttribute(Constants.SESSION_USER);
try {
String userIconPath = Configuration.getProperty(Constants.JCROPPICPATH, "/uploadFiles/userIcon");
//获取头像原始图片路径,然后进行裁剪
String tempPath = request.getSession().getServletContext().getRealPath(userIconPath) + File.separator + user.getId();
String realPath = tempPath + "_original.jpg";
String userIconFilePath = tempPath + ".jpg";
CutPicture.cut((int)x, (int)y, (int)w, (int)h, realPath, userIconFilePath);
json.put(userIconPath, userIconPath + File.separator + user.getId() + ".jpg");
//更新用户信息表
user.setUsericon("Y");
user.setModifytime(new Date());
userService.updateByPrimaryKeySelective(user);
session.setAttribute(Constants.SESSION_USER, user);
json.put("result", "success");
} catch (Exception e) {
json.put("result", "fail");
}
return json.toJSONString();
}
}
|
package com.xkzhangsan.time.test;
import com.xkzhangsan.time.holiday.Holiday;
import org.junit.Assert;
import org.junit.Test;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
/**
* 节假日测试类
* @author xkzhangsan
*/
public class HolidayTest {
/**
* 公历节日,母亲节
*/
@Test
public void localHolidayEnumTest(){
LocalDate localDate = LocalDate.of(2020, 5, 10);
Assert.assertEquals("母亲节", Holiday.getLocalHoliday(localDate));
//自定义节日数据
Map<String, String> localHolidayMap = new HashMap<String, String>();
localHolidayMap.put("0422", "世界地球日");
LocalDate localDate2 = LocalDate.of(2020, 4, 22);
Assert.assertEquals("世界地球日",Holiday.getLocalHoliday(localDate2, localHolidayMap));
}
/**
* 农历节日,除夕
*/
@Test
public void chineseHolidayEnumTest(){
LocalDate localDate = LocalDate.of(2020, 1, 24);
Assert.assertEquals("除夕",Holiday.getChineseHoliday(localDate));
//正常农历九月初九
LocalDate localDate2 = LocalDate.of(2014, 10, 2);
Assert.assertEquals("重阳节",Holiday.getChineseHoliday(localDate2));
//正常农历闰九月初九 闰月不算节假日
LocalDate localDate3 = LocalDate.of(2014, 11, 1);
Assert.assertEquals("",Holiday.getChineseHoliday(localDate3));
}
/**
* 二十四节气,2020-08-07 立秋
*/
@Test
public void solarTermEnumTest(){
LocalDate localDate = LocalDate.of(2020, 8, 7);
Assert.assertEquals("立秋",Holiday.getSolarTerm(localDate));
}
}
|
package com.catnap.demo.core.exception;
/**
* Created with IntelliJ IDEA.
*
* @author gwhit7
*/
public class ProductNotFoundException extends RuntimeException
{
public ProductNotFoundException(String id)
{
super("The product [" + id + "] cannot be found.");
}
}
|
/*
* 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 PRO1041.DAO;
/**
*
* @author tienp
*/
public class KhachHangDAO {
public String MaKH;
public String TenKH;
public String SDT;
public String NgayDi;
public String DiemDon;
public String DiemDen;
public String ThanhToan;
public KhachHangDAO(){
super();
}
public KhachHangDAO(String MaKH, String TenKH, String SDT, String NgayDi, String DiemDon, String DiemDen, String ThanhToan){
this.MaKH=MaKH;
this.TenKH=TenKH;
this.SDT=SDT;
this.NgayDi=NgayDi;
this.DiemDon=DiemDon;
this.DiemDen=DiemDen;
this.ThanhToan=ThanhToan;
}
public String getMaKH() {
return MaKH;
}
public void setMaKH(String MaKH) {
this.MaKH = MaKH;
}
public String getTenKH() {
return TenKH;
}
public void setTenKH(String TenKH) {
this.TenKH = TenKH;
}
public String getSDT() {
return SDT;
}
public void setSDT(String SDT) {
this.SDT = SDT;
}
public String getNgayDi() {
return NgayDi;
}
public void setNgayDi(String NgayDi) {
this.NgayDi = NgayDi;
}
public String getDiemDon() {
return DiemDon;
}
public void setDiemDon(String DiemDon) {
this.DiemDon = DiemDon;
}
public String getDiemDen() {
return DiemDen;
}
public void setDiemDen(String DiemDen) {
this.DiemDen = DiemDen;
}
public String getThanhToan() {
return ThanhToan;
}
public void setThanhToan(String ThanhToan) {
this.ThanhToan = ThanhToan;
}
}
|
// default package
// Generated Mar 2, 2017 1:23:57 PM by Hibernate Tools 5.2.1.Final
package model;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
/**
* Auteur generated by hbm2java
*/
@Entity
@Table(name = "auteur", schema = "public")
public class Auteur implements java.io.Serializable {
private int idAuteur;
private String nom;
private String prenom;
private Set sources = new HashSet(0);
public Auteur() {
}
public Auteur(int idAuteur) {
this.idAuteur = idAuteur;
}
public Auteur(int idAuteur, String nom, String prenom, Set sources) {
this.idAuteur = idAuteur;
this.nom = nom;
this.prenom = prenom;
this.sources = sources;
}
@Id
@Column(name = "id_auteur", unique = true, nullable = false)
public int getIdAuteur() {
return this.idAuteur;
}
public void setIdAuteur(int idAuteur) {
this.idAuteur = idAuteur;
}
@Column(name = "nom")
public String getNom() {
return this.nom;
}
public void setNom(String nom) {
this.nom = nom;
}
@Column(name = "prenom")
public String getPrenom() {
return this.prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "auteurs")
public Set getSources() {
return this.sources;
}
public void setSources(Set sources) {
this.sources = sources;
}
}
|
package compiler;
public enum ConstantType {
CLASS((byte) 7),
FIELDREF((byte) 9),
METHODREF((byte) 10),
INTEGER((byte) 3),
NAMEANDTYPE((byte) 12),
UTF8((byte) 1);
private byte value;
ConstantType(byte value) {
this.value = value;
}
public byte getValue() {
return value;
}
}
|
package com.freejavaman;
import java.util.Locale;
import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class mySpeech extends Activity {
//語音元件
private TextToSpeech ttSpeech;
/*private TextToSpeech.OnUtteranceCompletedListener ucListener = new TextToSpeech.OnUtteranceCompletedListener() {
public void onUtteranceCompleted(String utteranceId) {
}
};*/
//TTS引擎的初始化物件
private TextToSpeech.OnInitListener initListener = new TextToSpeech.OnInitListener() {
public void onInit(int status) {
//en - USA
//zh - TWN
Locale locale = new Locale("en" , "USA", "");
ttSpeech.setLanguage(locale);
//根據時區,判斷是否有支援語言
if (ttSpeech.isLanguageAvailable(locale) == TextToSpeech.LANG_AVAILABLE) {
ttSpeech.setLanguage(locale);
Log.v("mySpeech", "language support");
} else {
Log.v("mySpeech", "language NOT support");
}
ttSpeech.setOnUtteranceCompletedListener(ucListener);
}
};
EditText myText;
Button btn;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//建立語音元件之物件實體
ttSpeech = new TextToSpeech(this, initListener);
myText = (EditText)this.findViewById(R.id.myText);
btn = (Button)this.findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String txt = myText.getText().toString();
if (!txt.equals("")) {
ttSpeech.speak(txt, TextToSpeech.QUEUE_FLUSH, null);
}
}
});
}
protected void onDestroy() {
super.onDestroy();
//釋放語音資源
ttSpeech.shutdown();
}
}
|
package com.tencent.mm.plugin.exdevice.f.a;
import com.tencent.mm.network.q;
import com.tencent.mm.plugin.exdevice.a.a;
import com.tencent.mm.plugin.exdevice.a.b;
import com.tencent.mm.plugin.exdevice.model.ad;
import com.tencent.mm.protocal.c.bw;
import com.tencent.mm.protocal.c.bx;
import com.tencent.mm.protocal.c.xj;
import com.tencent.mm.sdk.platformtools.x;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class g extends a<bw, bx> {
List<String> gZA;
private final WeakReference<b<g>> isV;
public ArrayList<xj> ixu;
protected final /* synthetic */ com.tencent.mm.bk.a aGw() {
return new bw();
}
protected final /* synthetic */ com.tencent.mm.bk.a aGx() {
return new bx();
}
protected final /* synthetic */ void g(com.tencent.mm.bk.a aVar) {
bw bwVar = (bw) aVar;
for (String add : this.gZA) {
bwVar.ebM.add(add);
}
}
public g(List<String> list, b<g> bVar) {
this.gZA = list;
this.isV = new WeakReference(bVar);
}
public final int getType() {
return 1777;
}
public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) {
x.d("MicroMsg.NetSceneAddFollow", "ap: errType: %s, errCode: %s, errMsg: %s", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), str});
if (i2 == 0 && i3 == 0) {
bx bxVar = (bx) asj();
this.ixu = new ArrayList();
if (bxVar.rch != null) {
Iterator it = bxVar.rch.iterator();
while (it.hasNext()) {
x.d("MicroMsg.NetSceneAddFollow", "follow: index:%s step: %s username: %s", new Object[]{Integer.valueOf(r1.index), Integer.valueOf(r1.fHo), ((xj) it.next()).username});
this.ixu.add(r1);
}
x.d("MicroMsg.NetSceneAddFollow", "follows: %s, %d", new Object[]{this.ixu.toString(), Integer.valueOf(bxVar.rch.size())});
}
ad.aHg().a(this.ixu, "hardcode_rank_id", "hardcode_app_name");
}
super.a(i, i2, i3, str, qVar, bArr);
b bVar = (b) this.isV.get();
if (bVar != null) {
bVar.b(i2, i3, str, this);
}
}
protected final String getUri() {
return "/cgi-bin/mmoc-bin/hardware/addfollow";
}
}
|
package org.alienideology.jcord.handle.channel;
/**
* IAudioChannel - A channel that contains audio connection. Such as {@link IVoiceChannel} or {@link IPrivateChannel}.
*
* @author AlienIdeology
*/
public interface IAudioChannel extends IChannel {
}
|
package cn.wzd.junitTest;
import java.io.InputStream;
import java.util.List;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Before;
import org.junit.Test;
import cn.wzd.mapper.OrderUser;
import cn.wzd.po.Orders;
import cn.wzd.po.User;
public class OrderUserTest {
private SqlSessionFactory sqlSessionFactory;
@Before
public void setUp() throws Exception {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
this.sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
}
@Test
public void testFindOrderAndUserResultMap() throws Exception {
SqlSession session = sqlSessionFactory.openSession();
OrderUser orderUser = session.getMapper(OrderUser.class);
List<Orders> orders = orderUser.findOrderAndUserResultMap();
System.out.println("find list size====>"+orders.size());
session.close();
}
@Test
public void testFindUserAndOrdersResultMap() throws Exception {
SqlSession session = sqlSessionFactory.openSession();
OrderUser orderUser = session.getMapper(OrderUser.class);
List<User> users = orderUser.findUserAndOrdersResultMap();
System.out.println("find list size====>"+users.size());
session.close();
}
//findUserAndItemsResultMap
@Test
public void testFindUserAndItemsResultMap() throws Exception {
SqlSession session = sqlSessionFactory.openSession();
OrderUser orderUser = session.getMapper(OrderUser.class);
List<User> users = orderUser.findUserAndItemsResultMap();
System.out.println("find list size====>"+users.size());
session.close();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.