text stringlengths 10 2.72M |
|---|
/*
* 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 GitarrDBModule;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author johanwallin
*/
@Entity
@Table(name = "PRODUCT")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"),
@NamedQuery(name = "Product.findByProductid", query = "SELECT p FROM Product p WHERE p.productid = :productid"),
@NamedQuery(name = "Product.findByProductName", query = "SELECT p FROM Product p WHERE p.productName = :productName"),
@NamedQuery(name = "Product.findByManufacturer", query = "SELECT p FROM Product p WHERE p.manufacturer = :manufacturer"),
@NamedQuery(name = "Product.findByGenre", query = "SELECT p FROM Product p WHERE p.genre = :genre"),
@NamedQuery(name = "Product.findByPurchasePrice", query = "SELECT p FROM Product p WHERE p.purchasePrice = :purchasePrice"),
@NamedQuery(name = "Product.findBySellingPrice", query = "SELECT p FROM Product p WHERE p.sellingPrice = :sellingPrice")})
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 30)
@Column(name = "PRODUCTID")
private String productid;
@Size(max = 30)
@Column(name = "PRODUCT_NAME")
private String productName;
@Size(max = 30)
@Column(name = "MANUFACTURER")
private String manufacturer;
@Size(max = 30)
@Column(name = "GENRE")
private String genre;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "PURCHASE_PRICE")
private Double purchasePrice;
@Column(name = "SELLING_PRICE")
private Double sellingPrice;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productid")
private Collection<Inventory> inventoryCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productid")
private Collection<Transaction> transactionCollection;
public Product() {
}
public Product(String productid) {
this.productid = productid;
}
public String getProductid() {
return productid;
}
public void setProductid(String productid) {
this.productid = productid;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public Double getPurchasePrice() {
return purchasePrice;
}
public void setPurchasePrice(Double purchasePrice) {
this.purchasePrice = purchasePrice;
}
public Double getSellingPrice() {
return sellingPrice;
}
public void setSellingPrice(Double sellingPrice) {
this.sellingPrice = sellingPrice;
}
@XmlTransient
public Collection<Inventory> getInventoryCollection() {
return inventoryCollection;
}
public void setInventoryCollection(Collection<Inventory> inventoryCollection) {
this.inventoryCollection = inventoryCollection;
}
@XmlTransient
public Collection<Transaction> getTransactionCollection() {
return transactionCollection;
}
public void setTransactionCollection(Collection<Transaction> transactionCollection) {
this.transactionCollection = transactionCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (productid != null ? productid.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Product)) {
return false;
}
Product other = (Product) object;
if ((this.productid == null && other.productid != null) || (this.productid != null && !this.productid.equals(other.productid))) {
return false;
}
return true;
}
@Override
public String toString() {
return "GitarrDBModule.Product[ productid=" + productid + " ]";
}
}
|
/**
* Copyright (c) 2016, 指端科技.
*/
package com.rofour.baseball.controller.model.manager;
import com.rofour.baseball.controller.model.BasePage;
import java.io.Serializable;
/**
* @ClassName: QuotaInfo
* @Description: 指标传输实体
* @author xl
* @date 2016年7月18日 下午3:40:34
*/
public class QuotaInfo extends BasePage implements Serializable {
private static final long serialVersionUID = -8747123116840994336L;
/**
* 主键
*/
private int quotaId;
/**
* 指标名称
*/
private String quotaName;
/**
* 对应字段
*/
private String fieldName;
/**
* 状态 0-废弃 1-在用
*/
private Integer state;
private int oldQuotaId;
public QuotaInfo() {
}
/**
* @Constructor: QuotaInfo
* @param quotaId
* @param quotaName
* @param fieldName
* @param state
*/
public QuotaInfo(int quotaId, String quotaName, String fieldName, Integer state) {
super();
this.quotaId = quotaId;
this.quotaName = quotaName;
this.fieldName = fieldName;
this.state = state;
}
public int getOldQuotaId() {
return oldQuotaId;
}
public void setOldQuotaId(int oldQuotaId) {
this.oldQuotaId = oldQuotaId;
}
public int getQuotaId() {
return quotaId;
}
public void setQuotaId(int quotaId) {
this.quotaId = quotaId;
}
public String getQuotaName() {
return quotaName;
}
public void setQuotaName(String quotaName) {
this.quotaName = quotaName;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
}
|
package org.buaa.ly.MyCar.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sun.imageio.plugins.common.LZWCompressor;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
@Data
@Entity
@Table(name = "Store")
@DynamicInsert
@ToString(exclude = {"vehicles", "rentOrders", "returnOrders", "realRentOrders", "realReturnOrders"})
public class Store implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
Integer id;
@Column(name = "name")
String name;
@Column(name = "address")
String address;
@Column(name = "phone")
String phone;
@Column(name = "city")
String city;
@Column(name = "status")
Integer status;
@Column(name = "create_time")
Timestamp createTime;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "store")
@JSONField(deserialize = false, serialize = false)
List<Vehicle> vehicles;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "rentStore")
@JSONField(serialize = false, deserialize = false)
List<Order> rentOrders;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "returnStore")
@JSONField(serialize = false, deserialize = false)
List<Order> returnOrders;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "realRentStore")
@JSONField(serialize = false, deserialize = false)
List<Order> realRentOrders;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "realReturnStore")
@JSONField(serialize = false, deserialize = false)
List<Order> realReturnOrders;
}
|
/*******************************************************************************
* Copyright (C) 2010 Lucas Madar and Peter Brewer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Lucas Madar
* Peter Brewer
******************************************************************************/
package org.tellervo.desktop.tridasv2.ui;
import java.awt.Color;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.tellervo.desktop.ui.Builder;
import com.l2fprod.common.beans.editor.AbstractPropertyEditor;
import com.lowagie.text.Font;
public class TridasDefaultPropertyEditor extends AbstractPropertyEditor {
private JLabel label;
private JButton button;
private Object value;
public TridasDefaultPropertyEditor() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setOpaque(false);
label = new JLabel("");
label.setForeground(Color.GRAY.brighter());
label.setFont(label.getFont().deriveFont(Font.ITALIC));
label.setOpaque(false);
panel.add(label);
// set class editor
editor = panel;
button = new JButton();
button.setIcon(Builder.getIcon("cancel.png", 16));
button.setMargin(new Insets(0,5,0,5));
panel.add(Box.createHorizontalGlue());
panel.add(button);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectNull();
}
});
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
label.setText(value == null ? "" : " present");
button.setVisible(value == null ? false : true);
}
protected void selectNull() {
Object oldValue = value;
label.setText("");
value = null;
firePropertyChange(oldValue, null);
}
}
|
package com.tencent.mm.modelsns;
public final class d {
StringBuffer ehd = new StringBuffer();
StringBuffer ehe = new StringBuffer();
private int index = 0;
public final void q(String str, Object obj) {
this.ehd.append(this.index + " " + str + "->" + obj + "\n");
this.ehe.append(obj);
this.index++;
}
public final void r(String str, Object obj) {
this.ehd.append(str + "->" + obj + "\n");
this.ehe.append(obj);
}
public final String toString() {
return this.ehe.toString();
}
public final String wF() {
this.index = 0;
this.ehd.append("--end--\n\n");
return this.ehd.toString();
}
}
|
package pageObjectModel;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import common.VerifyElement;
public class ParentSignUp
{
WebDriver driver;
VerifyElement pageElement;
boolean elementStatus ;
private By ParentSignUpButton= By.linkText("Parents, Start Your Free Month");
private By userEmail = By.id("user_email");
private By userPassword = By.id("user_password");
private By signUpButton = By.id("signup-button");
Logger logs;
public ParentSignUp(WebDriver driver)
{
this.driver=driver;
}
public void enterData(String email, String password) throws InterruptedException
{
logs = Logger.getLogger("ParentSignUp"); // Class name as an argument
PropertyConfigurator.configure("log4j.properties");
pageElement = new VerifyElement(driver);
elementStatus = pageElement.isElementPresent(ParentSignUpButton);
Assert.assertTrue(elementStatus);
driver.findElement(ParentSignUpButton).click();
logs.info("Parent SignUp Button Clicked");
Thread.sleep(10);
elementStatus= pageElement.isElementPresent(userEmail);
Assert.assertTrue(elementStatus);
logs.info("Email field visible");
driver.findElement(userEmail).sendKeys(email);
logs.info("Entered user Email in Text field");
elementStatus= pageElement.isElementPresent(userPassword);
Assert.assertTrue(elementStatus);
logs.info("Password field visible");
driver.findElement(userPassword).sendKeys(password);
logs.info("Password Entered");
elementStatus= pageElement.isElementPresent(signUpButton);
Assert.assertTrue(elementStatus);
logs.info("SignUp button visible");
driver.findElement(signUpButton).click();
logs.info("clicked on SignUp Button");
Thread.sleep(10);
logs.info("Waiting for 10sec");
}
}
|
class if_Test2 {
public static void main(String ar[]){
int a=-6;
if (a>0) {
System.out.println("¾ç¼ö");
}
else {
System.out.println("À½¼ö");
}
}
} |
package com.cardflip;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.google.firebase.auth.FirebaseAuth;
public class GameOver extends AppCompatActivity implements View.OnClickListener{
private TextView score;
private Button button;
private Button logout;
private FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game_over);
Bundle bundle = getIntent().getExtras();
int value = bundle.getInt("score");
score = (TextView) findViewById(R.id.score);
score.setText("Score = " + value);
firebaseAuth = FirebaseAuth.getInstance();
if(firebaseAuth.getCurrentUser() == null){
finish();
startActivity(new Intent(this, LoginActivity.class));
}
button =(Button) findViewById(R.id.button);
logout = (Button) findViewById(R.id.logout);
button.setOnClickListener(this);
logout.setOnClickListener(this);
}
@Override
public void onClick(View view)
{
if(view == button){
finish();
startActivity(new Intent(this, GameType.class));
}
if(view == logout){
firebaseAuth.signOut();
finish();
startActivity(new Intent(this, LoginActivity.class));
}
}
}
|
package com.android.netperf_new;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class VideoLoadFragment extends Fragment {
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public VideoLoadFragment() {
// Required empty public constructor
}
public static VideoLoadFragment newInstance(String param1, String param2) {
VideoLoadFragment fragment = new VideoLoadFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_webview_content_scrolling, container, false);
String frameVideo = "<html><body><iframe width=\"380\" height=\"200\" src=\"https://www.youtube.com/embed/47yJ2XCRLZs\" frameborder=\"0\" allowfullscreen></iframe></body></html>";
WebView displayYoutubeVideo = (WebView) view.findViewById(R.id.myWebView2);
displayYoutubeVideo.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
WebSettings webSettings = displayYoutubeVideo.getSettings();
webSettings.setJavaScriptEnabled(true);
displayYoutubeVideo.loadData(frameVideo, "text/html", "utf-8");
return view;
}
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
// if (context instanceof OnFragmentInteractionListener) {
// mListener = (OnFragmentInteractionListener) context;
// } else {
// throw new RuntimeException(context.toString()
// + " must implement OnFragmentInteractionListener");
// }
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.webbeans.portable;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.util.GenericsUtil;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Set;
import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.AnnotatedParameter;
import jakarta.enterprise.inject.spi.AnnotatedType;
/**
* Implementation of {@link AnnotatedMethod} interface.
*
* @version $Rev$ $Date$
*
* @param <X> class info
*/
public class AnnotatedMethodImpl<X> extends AbstractAnnotatedCallable<X> implements AnnotatedMethod<X>
{
/**
* Create a ew instance.
*
* @param declaringType declaring type
* @param javaMember method
*/
AnnotatedMethodImpl(WebBeansContext webBeansContext, Method javaMember, AnnotatedType<X> declaringType)
{
super(webBeansContext, GenericsUtil.resolveReturnType(declaringType.getJavaClass(), javaMember), javaMember, declaringType);
setAnnotations(javaMember.getDeclaredAnnotations());
setAnnotatedParameters(GenericsUtil.resolveParameterTypes(declaringType.getJavaClass(), javaMember), javaMember.getParameterAnnotations());
}
/**
* Copy ct for Configurators
*/
AnnotatedMethodImpl(WebBeansContext webBeansContext, AnnotatedMethod<? super X> originalAnnotatedMethod, AnnotatedType<X> declaringType)
{
super(webBeansContext, originalAnnotatedMethod.getBaseType(), originalAnnotatedMethod.getJavaMember(), declaringType);
getAnnotations().addAll(originalAnnotatedMethod.getAnnotations());
for (AnnotatedParameter<? super X> originalAnnotatedParameter : originalAnnotatedMethod.getParameters())
{
getParameters().add(new AnnotatedParameterImpl(webBeansContext, originalAnnotatedParameter, this));
}
}
@Override
protected Set<Type> extractTypeClojure(Type baseType)
{ // we want to skip hasTypeParameters() check which is already done for methods
return GenericsUtil.getDirectTypeClosure(baseType, getOwningClass());
}
/**
* {@inheritDoc}
*/
@Override
public Method getJavaMember()
{
return Method.class.cast(javaMember);
}
@Override
public String toString()
{
return "Annotated Method '" + javaMember.getName() + "', " + super.toString();
}
}
|
/*
* Copyright (C) 2020-2023 Hedera Hashgraph, LLC
*
* 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 com.hedera.services.txns.validation;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK;
import com.hedera.services.jproto.JKey;
import com.hederahashgraph.api.proto.java.Key;
import com.hederahashgraph.api.proto.java.ResponseCodeEnum;
import org.apache.commons.codec.DecoderException;
/**
* Copied type from hedera-services.
* <p>
* Differences with the original:
* 1. Removed methods which are not needed currently -queryableFileStatus, queryableAccountOrContractStatus,
* queryableAccountStatus, internalQueryableAccountStatus, queryableContractStatus, queryableContractStatus,
* chronologyStatus, asCoercedInstant, isValidStakedId
*/
public final class PureValidation {
private PureValidation() {
throw new UnsupportedOperationException("Utility Class");
}
public static ResponseCodeEnum checkKey(final Key key, final ResponseCodeEnum failure) {
try {
final var fcKey = JKey.mapKey(key);
if (!fcKey.isValid()) {
return failure;
}
return OK;
} catch (DecoderException e) {
return failure;
}
}
}
|
package com.app.collection;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
public class DemoHashMap {
public static void main(String[] args) {
HashMap<Integer, String> hm = new HashMap<Integer, String>();
hm.put(null, "20");
hm.put(0, "vijay");
hm.put(1, "ashok");
hm.put(2, "naresh");
hm.put(3, "naveen");
//hm.put(null, "null");//null=null
//hm.put(null, "10");//null=10 replaced
System.out.println(hm);
Set<Integer> s = hm.keySet();//to get keys
System.out.println(s);
Collection<String> c = hm.values();//to get values
System.out.println(c);
//to get both k and v(all entries)
Set<Entry<Integer,String>> set = hm.entrySet();
Iterator<Entry<Integer,String>> itr = set.iterator();
while(itr.hasNext())
{
Entry<Integer,String> e = itr.next();
System.out.println(e.getKey()+" "+e.getValue());
}
}
}
|
package com.blackonwhite.service;
import com.blackonwhite.client.TelegramClient;
import com.blackonwhite.exceprion.BotException;
import com.blackonwhite.model.Card;
import com.blackonwhite.model.User;
import com.blackonwhite.util.TextUtils;
import org.springframework.stereotype.Service;
import telegram.Message;
import javax.transaction.Transactional;
import java.util.Locale;
import java.util.ResourceBundle;
import static com.blackonwhite.util.TextUtils.getResourseMessage;
@Service
public class MessageProcessor {
private final CommandService commandService;
private final CardService cardService;
private final TelegramClient telegramClient;
public MessageProcessor(CommandService commandService, CardService cardService, TelegramClient telegramClient) {
this.commandService = commandService;
this.cardService = cardService;
this.telegramClient = telegramClient;
}
@Transactional
public void parseMessage(Message message, User user) {
if (message.getText().startsWith("/")) {
commandService.command(message, user);
return;
}
if (user.getStatus() != null) {
processMessageByStatus(user, message);
} else throw new BotException(
TextUtils.getResourseMessage(message, "UNKNOWN_COMMAND"), message.getChat().getId());
}
private void processMessageByStatus(User user, Message message) {
switch (user.getStatus()) {
case CREATE_WHITE:
createCard(message, Card.CardType.WHITE, user);
break;
case CREATE_BLACK:
createCard(message, Card.CardType.BLACK, user);
break;
case ROOM_CONNECTION:
try {
message.getChat().setId(Integer.parseInt(message.getText()));
} catch (NumberFormatException ex) {
throw new BotException("Invalid Room ID", message.getChat().getId());
}
telegramClient.simpleQuestion("CONNECTION_QUESTION&" + user.getChatId(),
String.format(getResourseMessage(message, "CONNECTION_QUESTION"),
message.getFrom().getFirstName() + " " + message.getFrom().getLastName()), message);
user.setStatus(null);
break;
default:
throw new IllegalArgumentException("Invalid User Status");
}
}
private void createCard(Message message, Card.CardType type, User user) {
cardService.createCard(type, message.getText());
telegramClient.simpleMessage(
ResourceBundle.getBundle("dictionary", new Locale(message.getFrom().getLanguageCode()))
.getString("DONE"), message);
user.setStatus(null);
}
}
|
package org.zerock.w2;
import org.zerock.web.HelloServlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(name = "hello", value = "hello2")
public class Hello1 extends HelloServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doGet(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response);
}
}
|
import java.io.File;
public class CreateDirectory {
public static void main(String[] args) {
try {
String directoryName = "";
for(int i = 0; i < args.length; i++) {
directoryName += args[i];
}
File file = new File("./" + directoryName);
file.mkdir();
} catch(Exception e) {
e.printStackTrace();
}
}
} |
package com.sneaker.mall.api.model;
import com.alibaba.fastjson.annotation.JSONField;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
public class User extends BaseModel<Long> {
/**
* 编码
*/
private String code;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
@JSONField(serialize = false)
private String password;
/**
* 名称
*/
private String name;
/**
* 有权限的仓库ID
*/
private String sids;
/**
* 权限组ID
*/
private String rids;
/**
* 工种
*/
private String worktype;
/**
* 电话
*/
private String phone;
/**
* 是否是管理员
*/
@JSONField(deserialize = true)
private int admin;
/**
* 状态
*/
@JSONField(deserialize = true)
private int status;
/**
* 公司ID
*/
private long cid;
/**
* 公司信息
*/
private Company com;
/**
* 是否是业务员
*/
private boolean saleman = false;
/**
* 用户登录ticket
*/
private String ticket;
/**
* 图像地址
*/
private String photo;
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public boolean isSaleman() {
return saleman;
}
public void setSaleman(boolean saleman) {
this.saleman = saleman;
}
public long getCid() {
return cid;
}
public void setCid(long cid) {
this.cid = cid;
}
public Company getCom() {
return com;
}
public void setCom(Company com) {
this.com = com;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
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 String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSids() {
return sids;
}
public void setSids(String sids) {
this.sids = sids;
}
public String getRids() {
return rids;
}
public void setRids(String rids) {
this.rids = rids;
}
public String getWorktype() {
return worktype;
}
public void setWorktype(String worktype) {
this.worktype = worktype;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getAdmin() {
return admin;
}
public void setAdmin(int admin) {
this.admin = admin;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
public String getTicket() {
return this.ticket;
}
}
|
package start.mapper1;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @Author: Jason
* @Create: 2020/10/13 6:59
* @Description 用户mapper
*/
@Repository
public interface UserMapper1 {
@Insert("insert into test_user(name,age) values(#{name},#{age})")
void addUser(@Param("name") String name, @Param("age") int age);
}
|
package com.shopify.api;
import lombok.Data;
@Data
public class ShopifyWebhookDataCustomer{
private String id;
private String email;
private String phone;
} |
package com.gcipriano.katas.salestaxes.model.taxing;
import java.math.BigDecimal;
public interface Tax
{
BigDecimal applyOn(BigDecimal amount);
}
|
public class Tank extends Weapen{
public void move(){
System.out.println("this is tankmove");
}
public void attack()
{
System.out.println("this is tankattack");
}
} |
package com.stark.innerclass;
/**
* 静态内部类
* 1.声明在类体部,方法体外,并且使用static修饰的内部类
* 2.访问特点可以类比静态变量和静态方法
* 3.脱离外部类的实例独立创建
* 在外部类的外部构建内部类的实例
* new Outer.Inner();
* 在外部类的内部构建内部类的实例
* new Inner();
* 4.静态内部类体部可以直接访问外部类中所有的静态成员,包含私有
* <p>
* 用途:多用于单例模式
*/
public class StaticInnerTest {
public static void main(String[] args) {
System.out.println("test");
StaticOuter.StaticInner.staticPrint(); //在使用内部类的时候才会进行加载
new StaticOuter.StaticInner().print(); //实例化内部类时不需要实例化外部类
new StaticOuter().print();
}
}
class StaticOuter {
private String s1 = "s1";
private static String s2 = "s2";
private static void sattic_print() {
System.out.println("outer");
}
public void print() {
//可以直接实例化
StaticInner innerClass = new StaticInner();
innerClass.print();
}
public static class StaticInner {
static {
System.out.println("inner class load");
}
public static void staticPrint() {
StaticOuter.sattic_print();
}
public void print() {
//System.out.println(s1);
System.out.println(s2);
}
}
}
|
package org.wit.snr.nn.srbm.math;
public interface ActivationFunction {
double evaluate(double... x);
}
|
/*
* 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 MomentFunctions;
/**
*
* @author Will_and_Sara
*/
public class BasicProductMoments {
private double _Mean;
private double _SampleVariance;
private double _Min;
private double _Max;
protected int _Count;
private boolean _Converged = false;
private double _ZAlphaForConvergence = 1.96039491692453;
private double _ToleranceForConvergence = 0.01;
private int _MinValuesBeforeConvergenceTest = 100;
public double GetMean(){return _Mean;}
public double GetStDev(){return Math.sqrt(_SampleVariance);}
public double GetMin(){return _Min;}
public double GetMax(){return _Max;}
public int GetSampleSize(){return _Count;}
/**
*This function can be used to determine if enough samples have been added to determine convergence of the data stream.
* @return this function will return false until the minimum number of observations have been added, and then will return the result of the convergence test after the most recent observation.
*/
public boolean IsConverged(){return _Converged;}
/**
*This method allows the user to define a minimum number of observations before testing for convergence.
* This would help to mitigate early convergence if similar observations are in close sequence early in the dataset.
* @param numobservations the minimum number of observations to wait until testing for convergence.
*/
public void SetMinValuesBeforeConvergenceTest(int numobservations){_MinValuesBeforeConvergenceTest = numobservations;}
/**
*This method sets the tolerance for convergence. This tolerance is used as an epsilon neighborhood around the confidence defined in SetZalphaForConvergence.
* @param tolerance the distance that is determined to be close enough to the alpha in question.
*/
public void SetConvergenceTolerance(double tolerance){_ToleranceForConvergence = tolerance;}
/**
*This method defines the alpha value used to determine convergence. This value is based on a two sided confidence interval. It uses the upper Confidence Limit.
* @param ConfidenceInterval The value that would be used to determine the normal alpha value. The default is a .9 Confidence interval, which corresponds to 1.96 alpha value.
*/
public void SetZAlphaForConvergence(double ConfidenceInterval){
Distributions.MethodOfMoments.Normal sn = new Distributions.MethodOfMoments.Normal();
_ZAlphaForConvergence = sn.GetInvCDF(ConfidenceInterval +((1-ConfidenceInterval)/2));
}
/**
*This constructor allows one to create an instance without adding any data.
*/
public BasicProductMoments(){
_Mean = 0;
_SampleVariance = 0;
_Min = 0;
_Max = 0;
_Count = 0;
}
/**
*This constructor allows one to create an instance with some initial data, observations can be added after the constructor through the "AddObservations(double observation) call.
* @param data the dataset to calculate mean and standard deviation for.
*/
public BasicProductMoments(double[] data){
_Mean = 0;
_SampleVariance = 0;
_Min = 0;
_Max = 0;
_Count = 0;
for (double d : data){
this.AddObservation(d);
}
}
/**
*An inline algorithm for incrementing mean and standard of deviation. After this method call, the properties of this class should be updated to include this observation.
* @param observation the observation to be added
*/
public void AddObservation(double observation){
if(_Count == 0){
_Count = 1;
_Min = observation;
_Max = observation;
_Mean = observation;
}else{
//single pass algorithm.
if(observation> _Max){_Max = observation;}
if(observation< _Min){_Min = observation;}
_Count++;
double newmean = _Mean +((observation-_Mean)/_Count);//check for integer rounding issues.
_SampleVariance = ((((double)(_Count-2)/(double)(_Count-1))*_SampleVariance)+(Math.pow(observation-_Mean,2.0))/_Count);
_Mean = newmean;
}
TestForConvergence();
}
public void AddObservations(double[] data){
for(double d : data){
AddObservation(d);
}
}
private void TestForConvergence(){
if(_Count>_MinValuesBeforeConvergenceTest){
if(!_Converged){
double var = (_ZAlphaForConvergence * this.GetStDev())/(this.GetMean()*java.lang.Math.abs(this.GetStDev()));
_Converged = (java.lang.Math.abs(var)<=_ToleranceForConvergence);
}
}
}
}
|
package com.movhaul.agent.Fragment;
import android.Manifest;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.gun0912.tedpicker.ImagePickerActivity;
import com.hbb20.CountryCodePicker;
import com.sloop.fonts.FontsManager;
import com.movhaul.agent.Model.Config_Utils;
import com.movhaul.agent.R;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Created by Salman on 23-05-2017.
*/
public class RegisterFragment extends Fragment {
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 234;
private static final int REQUEST_CODE = 10;
private static final int REQUEST_CODE_PHOTO = 20;
public String[] ar_banks;
public String[] ar_state;
public String[] ar_city;
public String[] ar_banks_copy;
public HashMap<String, String[]> city_hash = new HashMap<>();
TextView tv_activity_header, tv_login;
TextInputLayout til_name, til_address, til_state, til_city, til_phone, til_email, til_bank;
EditText et_name, et_address, et_state, et_city, et_phone, et_email, et_bank, et_coverage, et_bank_no;
LinearLayout lt_state, lt_city, lt_bank, lt_coverage, lt_id_card, lt_photo;
Typeface tf;
CountryCodePicker ccp_register;
ArrayList<Uri> image_uris;
String str_id_card_photo, str_photograph;
ImageView iv_id_card, iv_photograph;
LinearLayout lt_action_back;
Button btn_submit;
Snackbar snackbar;
TextView tv_snack;
CheckBox cb_terms;
String str_name, str_address, str_state, str_city, str_phone, str_email, str_coverage, str_bank, str_bank_no,str_mobile_prefix;
Config_Utils config;
Dialog dialog_success;
ProgressDialog mProgressDialog;
Button d2_btn_ok;
TextView d2_tv_dialog1, d2_tv_dialog2, d2_tv_dialog3, d2_tv_dialog4;
android.widget.ImageView btn_close;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View get_RegisterView = inflater.inflate(R.layout.register_fragment, container, false);
FontsManager.initFormAssets(getActivity(), "fonts/lato.ttf");
FontsManager.changeFonts(get_RegisterView);
tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/lato.ttf");
snackbar = Snackbar
.make(getActivity().findViewById(R.id.top), "No NetWork", Snackbar.LENGTH_LONG);
View sbView = snackbar.getView();
tv_snack = (android.widget.TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
tv_snack.setTextColor(Color.WHITE);
tv_snack.setTypeface(tf);
config = new Config_Utils();
city_hash = config.getCity_hash();
ar_banks = new String[]{" GT Bank ", " Hongkong&Sangai Bank ", " SAFC ", " Bank Of Africa ", "Federal Bank of Nigeria", " LEKIA Bank ", " Nigeria Bank ",};
ar_state = new String[]{"Abia", "Akwa Ibom", "Benue", "Borno", "Delta", "Enugu", "Edo", "Jigawa", "Kebbi", "Lagos", "Ogun", "Oyo", "Rivers", "Yobe"};
ar_city = new String[]{"Asaba", "Bauchi", "Dutse", "Jimeta", "Kanduna", "Lafia", "Lekki", "Oron", "Port Harcourt", "Sokoto", "Warri", "Zaria"};
str_mobile_prefix = "+234";
tv_login = (TextView) get_RegisterView.findViewById(R.id.textview_login);
tv_activity_header = (TextView) getActivity().findViewById(R.id.textview_header);
tv_activity_header.setText(getString(R.string.register));
Log.e("tag", "register");
lt_action_back = (LinearLayout) getActivity().findViewById(R.id.action_back);
lt_action_back.setVisibility(View.VISIBLE);
til_name = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_username);
til_address = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_address);
til_state = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_state);
til_city = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_city);
til_phone = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_phone);
til_email = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_email);
til_bank = (TextInputLayout) get_RegisterView.findViewById(R.id.textinput_bank);
lt_bank = (LinearLayout) get_RegisterView.findViewById(R.id.layout_choose_bank);
lt_state = (LinearLayout) get_RegisterView.findViewById(R.id.layout_choose_state);
lt_city = (LinearLayout) get_RegisterView.findViewById(R.id.layout_choose_city);
lt_coverage = (LinearLayout) get_RegisterView.findViewById(R.id.layout_coverage);
lt_id_card = (LinearLayout) get_RegisterView.findViewById(R.id.layout_id_card);
lt_photo = (LinearLayout) get_RegisterView.findViewById(R.id.layout_photograph);
btn_submit = (Button) get_RegisterView.findViewById(R.id.button_submit);
iv_id_card = (ImageView) get_RegisterView.findViewById(R.id.imageview_idcard);
iv_photograph = (ImageView) get_RegisterView.findViewById(R.id.imageview_photograph);
et_name = (EditText) get_RegisterView.findViewById(R.id.edittext_user_name);
et_address = (EditText) get_RegisterView.findViewById(R.id.edittext_address);
et_phone = (EditText) get_RegisterView.findViewById(R.id.edittext_phone);
et_email = (EditText) get_RegisterView.findViewById(R.id.edittext_email);
et_bank_no = (EditText) get_RegisterView.findViewById(R.id.edittext_bank_no);
et_bank = (EditText) get_RegisterView.findViewById(R.id.edittext_bank);
et_state = (EditText) get_RegisterView.findViewById(R.id.edittext_state);
et_city = (EditText) get_RegisterView.findViewById(R.id.edittext_city);
et_coverage = (EditText) get_RegisterView.findViewById(R.id.edittext_coverage);
cb_terms = (CheckBox) get_RegisterView.findViewById(R.id.check_box);
ccp_register = (CountryCodePicker) get_RegisterView.findViewById(R.id.ccp_register);
til_name.setTypeface(tf);
til_address.setTypeface(tf);
til_state.setTypeface(tf);
til_city.setTypeface(tf);
til_phone.setTypeface(tf);
til_email.setTypeface(tf);
til_bank.setTypeface(tf);
ccp_register.setTypeFace(tf);
mProgressDialog = new ProgressDialog(getActivity());
mProgressDialog.setTitle(getString(R.string.loading));
mProgressDialog.setMessage(getString(R.string.wait));
mProgressDialog.setIndeterminate(false);
mProgressDialog.setCancelable(false);
dialog_success = new Dialog(getActivity());
dialog_success.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog_success.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog_success.setCancelable(false);
dialog_success.setContentView(R.layout.dialog_confirm);
d2_btn_ok = (Button) dialog_success.findViewById(R.id.button_ok);
btn_close = (android.widget.ImageView) dialog_success.findViewById(R.id.button_close);
d2_tv_dialog1 = (TextView) dialog_success.findViewById(R.id.textView_1);
d2_tv_dialog2 = (TextView) dialog_success.findViewById(R.id.textView_2);
d2_tv_dialog3 = (TextView) dialog_success.findViewById(R.id.textView_3);
d2_tv_dialog4 = (TextView) dialog_success.findViewById(R.id.textView_4);
d2_tv_dialog1.setTypeface(tf);
d2_tv_dialog2.setTypeface(tf);
d2_tv_dialog3.setTypeface(tf);
d2_tv_dialog4.setTypeface(tf);
d2_btn_ok.setTypeface(tf);
d2_tv_dialog1.setText(R.string.success);
d2_tv_dialog2.setText(R.string.thanks);
d2_tv_dialog3.setText(R.string.verf);
d2_tv_dialog4.setVisibility(View.GONE);
btn_close.setVisibility(View.GONE);
d2_btn_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog_success.dismiss();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, new LoginFragment());
ft.commit();
tv_activity_header.setText(getString(R.string.login));
lt_action_back.setVisibility(View.GONE);
}
});
tv_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, new LoginFragment());
ft.commit();
tv_activity_header.setText(getString(R.string.login));
lt_action_back.setVisibility(View.GONE);
}
});
et_address.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT) {
et_phone.requestFocus();
return true;
}
return false;
}
});
ccp_register.setOnCountryChangeListener(new CountryCodePicker.OnCountryChangeListener() {
@Override
public void onCountrySelected() {
str_mobile_prefix = ccp_register.getSelectedCountryCodeWithPlus();
Log.e("tag", "flg_ccp" + ccp_register.getSelectedCountryCodeWithPlus());
}
});
et_bank.setText("GT Bank");
/* lt_bank.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popup(ar_banks, et_bank, 2);
}
});*/
lt_state.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popup(config.states, et_state, 0);
et_city.setText("");
}
});
lt_city.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!et_state.getText().toString().isEmpty()) {
ar_city = city_hash.get(et_state.getText().toString());
popup(ar_city, et_city, 1);
} else {
snackbar.show();
tv_snack.setText("Choose State First.");
}
}
});
et_coverage.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
if (et_coverage.getText().toString().trim().length() > 0) {
lt_coverage.setVisibility(View.VISIBLE);
String io = et_coverage.getText().toString();
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
lparams.setMargins(5, 5, 5, 5);
TextView tv = new TextView(getActivity());
tv.setLayoutParams(lparams);
tv.setGravity(Gravity.LEFT);
Drawable img = getResources().getDrawable(R.drawable.del_icon);
img.setBounds(0, 0, 20, 20);
tv.setCompoundDrawables(null, null, img, null);
tv.setCompoundDrawablePadding(5);
tv.setBackground(getResources().getDrawable(R.drawable.chips_edittext_gb));
tv.setTextColor(getResources().getColor(R.color.textColor));
tv.setPadding(15, 10, 10, 5);
tv.setGravity(Gravity.CENTER);
tv.setText(io);
lt_coverage.addView(tv);
et_coverage.setText("");
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
lt_coverage.removeView(v);
if (lt_coverage.getChildCount() == 0) {
lt_coverage.setVisibility(View.GONE);
}
}
});
Log.e("tag", "count: " + lt_coverage.getChildCount());
}
}
return false;
}
});
lt_id_card.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ContextCompat.checkSelfPermission(getActivity().getApplicationContext(), android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
Log.e("tag", "permission Not granted");
ActivityCompat.requestPermissions(getActivity(),
new String[]{android.Manifest.permission.CAMERA},
MY_PERMISSIONS_REQUEST_CAMERA);
} else {
com.gun0912.tedpicker.Config config = new com.gun0912.tedpicker.Config();
config.setSelectionMin(1);
config.setSelectionLimit(1);
config.setCameraHeight(R.dimen.app_camera_height);
config.setCameraBtnBackground(R.drawable.round_rd);
config.setToolbarTitleRes(R.string.img_vec_lic);
config.setSelectedBottomHeight(R.dimen.bottom_height);
ImagePickerActivity.setConfig(config);
Intent intent = new Intent(getActivity(), com.gun0912.tedpicker.ImagePickerActivity.class);
startActivityForResult(intent, REQUEST_CODE);
}
}
});
lt_photo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ContextCompat.checkSelfPermission(getActivity().getApplicationContext(), android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(getActivity().getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
Log.e("tag", "permission Not granted");
ActivityCompat.requestPermissions(getActivity(),
new String[]{android.Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_CAMERA);
} else {
com.gun0912.tedpicker.Config config = new com.gun0912.tedpicker.Config();
config.setSelectionMin(1);
config.setSelectionLimit(1);
config.setCameraHeight(R.dimen.app_camera_height);
config.setCameraBtnBackground(R.drawable.round_rd);
config.setToolbarTitleRes(R.string.img_vec_lic_photo);
config.setSelectedBottomHeight(R.dimen.bottom_height);
ImagePickerActivity.setConfig(config);
Intent intent = new Intent(getActivity(), com.gun0912.tedpicker.ImagePickerActivity.class);
startActivityForResult(intent, REQUEST_CODE_PHOTO);
}
}
});
btn_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
str_name = et_name.getText().toString().trim();
str_address = et_address.getText().toString().trim();
str_state = et_state.getText().toString().trim();
str_city = et_city.getText().toString().trim();
str_phone = et_phone.getText().toString().trim();
str_email = et_email.getText().toString().trim();
str_coverage = et_coverage.getText().toString().trim();
str_bank = et_bank.getText().toString().trim();
str_bank_no = et_bank_no.getText().toString().trim();
str_coverage = et_coverage.getText().toString();
if (!str_name.isEmpty() && str_name.length() > 4) {
if (!str_address.isEmpty() && str_address.length() > 4) {
if (!str_state.isEmpty()) {
if (!str_city.isEmpty()) {
if (!str_phone.isEmpty() && str_phone.length() > 9) {
if (!str_email.isEmpty() && android.util.Patterns.EMAIL_ADDRESS.matcher(str_email).matches()) {
if (!str_bank_no.isEmpty() && str_bank_no.length() > 9) {
if (str_id_card_photo != null) {
if (str_photograph != null) {
if (cb_terms.isChecked()) {
new register_agent().execute();
} else {
snackbar.show();
tv_snack.setText("Please Read & Agree the Terms and Conditions");
}
} else {
snackbar.show();
tv_snack.setText("Upload Passport size photograph");
}
} else {
snackbar.show();
tv_snack.setText("Upload State Issued ID Card");
}
} else {
snackbar.show();
tv_snack.setText("Enter Valid Account Number");
et_bank_no.requestFocus();
}
} else {
snackbar.show();
tv_snack.setText("Enter Valid Email");
et_email.requestFocus();
}
} else {
snackbar.show();
tv_snack.setText("Enter Valid Phone Number");
}
} else {
snackbar.show();
tv_snack.setText("Choose City");
}
} else {
snackbar.show();
tv_snack.setText("Choose State");
}
} else {
snackbar.show();
tv_snack.setText("Enter Valid Address.");
et_address.requestFocus();
}
} else {
snackbar.show();
tv_snack.setText("Enter Valid Name.");
et_name.requestFocus();
}
}
});
return get_RegisterView;
}
public void popup(final String[] ar_bank, final EditText et_data, final int type) {
ar_banks_copy = ar_bank;
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
final View dialogView = inflater.inflate(R.layout.dialog_choose_bank, null);
dialogBuilder.setView(dialogView);
final AlertDialog b = dialogBuilder.create();
LinearLayout myRoot = (LinearLayout) dialogView.findViewById(R.id.layout_top);
LinearLayout a = null;
for (int i = 0; i < ar_banks_copy.length; i++) {
a = new LinearLayout(getActivity());
LinearLayout.LayoutParams para = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
para.setMargins(5, 5, 5, 5);
a.setOrientation(LinearLayout.HORIZONTAL);
a.setLayoutParams(para);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(60, 60);
params.gravity = Gravity.CENTER;
ImageView imageView = new ImageView(getActivity());
imageView.setImageResource(R.drawable.button_change);
imageView.setLayoutParams(params);
TextView tss = new TextView(getActivity());
tss.setText(ar_banks_copy[i]);
LinearLayout.LayoutParams paramsQ = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
paramsQ.gravity = Gravity.CENTER;
tss.setLayoutParams(paramsQ);
tss.setTextSize(18);
tss.setTextColor(getResources().getColor(R.color.textColor));
FontsManager.changeFonts(tss);
View vres = new View(getActivity());
LinearLayout.LayoutParams paramss = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1);
vres.setLayoutParams(paramss);
vres.setBackgroundColor(getResources().getColor(R.color.viewColor));
a.addView(imageView);
a.addView(tss);
myRoot.addView(a);
if (i != ar_banks_copy.length - 1)
myRoot.addView(vres);
final int k = i;
a.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("tag", "a:" + ar_banks_copy[k]);
b.dismiss();
String state = ar_banks_copy[k];
et_data.setText(state);
}
});
}
b.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
List<String> photos = null;
if (resultCode == getActivity().RESULT_OK && requestCode == REQUEST_CODE) {
image_uris = data.getParcelableArrayListExtra(com.gun0912.tedpicker.ImagePickerActivity.EXTRA_IMAGE_URIS);
Log.e("tag", "12345" + image_uris);
if (image_uris != null) {
str_id_card_photo = image_uris.get(0).toString();
Glide.with(getActivity()).load(new File(str_id_card_photo)).centerCrop().into(iv_id_card);
}
} else if (resultCode == getActivity().RESULT_OK && requestCode == REQUEST_CODE_PHOTO) {
image_uris = data.getParcelableArrayListExtra(com.gun0912.tedpicker.ImagePickerActivity.EXTRA_IMAGE_URIS);
Log.e("tag", "12345" + image_uris);
if (image_uris != null) {
str_photograph = image_uris.get(0).toString();
Glide.with(getActivity()).load(new File(str_photograph)).centerCrop().into(iv_photograph);
}
}
}
//
public class register_agent extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
Log.e("tag", "driver_register");
mProgressDialog.show();
}
@Override
protected String doInBackground(String... strings) {
String json = "", jsonStr = "";
try {
String responseString = null;
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(Config_Utils.WEB_URL + "agentsignup");
httppost.setHeader("agent_name", str_name);
httppost.setHeader("agent_mobile", str_mobile_prefix + str_phone);
httppost.setHeader("agent_email",str_email);
httppost.setHeader("agent_address", str_address);
httppost.setHeader("agent_state", str_state);
httppost.setHeader("agent_city", str_city);
httppost.setHeader("agent_region", str_coverage);
httppost.setHeader("agent_bank", str_bank);
httppost.setHeader("agent_account_no", str_bank_no);
try {
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
File sourceFile = new File(str_id_card_photo);
Log.e("tagtag3", "" + sourceFile);
entity.addPart("agentimage", new FileBody(sourceFile, "image/jpeg"));
entity.addPart("agentidentity", new FileBody(sourceFile, "image/jpeg"));
httppost.setEntity(entity);
HttpResponse response = httpclient.execute(httppost);
HttpEntity r_entity = response.getEntity();
//Log.e("tagurl", "ur:" + Config.WEB_URL + "driversignup");
Log.e("tag", "headers:" + httppost.getAllHeaders().toString());
int statusCode = response.getStatusLine().getStatusCode();
Log.e("tagtag", response.getStatusLine().toString());
if (statusCode == 200) {
responseString = EntityUtils.toString(r_entity);
} else {
responseString = "Error occurred! Http Status Code: "
+ statusCode;
}
} catch (ClientProtocolException e) {
responseString = e.toString();
Log.e("tagerr0: ", e.toString());
} catch (IOException e) {
responseString = e.toString();
Log.e("tagerr1: ", e.toString());
}
return responseString;
} catch (Exception e) {
Log.e("tagerr2:", e.toString());
}
return null;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Log.e("tag", "tagtag" + s);
mProgressDialog.dismiss();
if (s != null) {
try {
JSONObject jo = new JSONObject(s);
String status = jo.getString("status");
String msg = jo.getString("message");
Log.d("tag", "<-----Status----->" + status);
if (status.equals("true")) {
dialog_success.show();
} else {
if (msg.contains("Error OccuredError: ER_DUP_ENTRY: Duplicate entry")) {
snackbar.show();
tv_snack.setText("User Already Registerd");
} else {
snackbar.show();
tv_snack.setText("No network found");
}
}
} catch (JSONException e) {
e.printStackTrace();
Log.e("tag", "tagnt: " + e.toString());
snackbar.show();
tv_snack.setText("No network found");
}
} else {
snackbar.show();
tv_snack.setText("No network found");
}
}
}
}
|
package py.com.isproject.rodate.bean;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import org.springframework.beans.factory.annotation.Autowired;
import py.com.isproject.rodate.model.Usuario;
import py.com.isproject.rodate.repository.UsuarioRepository;
@Named
@ViewScoped
public class UsuarioListMB {
@Autowired
private UsuarioRepository usuarioRepository;
private List<Usuario> usuarios;
@PostConstruct
public void init() {
fetchUsuarios();
}
private void fetchUsuarios() {
setUsuarios(usuarioRepository.findAll());
}
public List<Usuario> getUsuarios() {
return usuarios;
}
public void setUsuarios(List<Usuario> usuarios) {
this.usuarios = usuarios;
}
}
|
package hirondelle.web4j.model;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/** General implementation of {@link MessageList}. */
public class MessageListImpl implements MessageList, Serializable {
/** Create an empty {@link MessageList}. */
public MessageListImpl(){
//empty
}
/**
Create a {@link MessageList} having one simple {@link AppResponseMessage}.
<P>The argument satisfies the same conditions as {@link AppResponseMessage#forSimple}.
*/
public MessageListImpl(String aMessage) {
add(aMessage);
}
/**
Create a {@link MessageList} having one compound {@link AppResponseMessage}.
<P>The arguments satisfy the same conditions as
{@link AppResponseMessage#forCompound}.
*/
public MessageListImpl(String aMessage, Object... aParams) {
add(aMessage, aParams);
}
public final void add(String aMessage){
fAppResponseMessages.add(AppResponseMessage.forSimple(aMessage));
}
public final void add(String aMessage, Object... aParams){
fAppResponseMessages.add(AppResponseMessage.forCompound(aMessage, aParams));
}
public final void add (AppException ex) {
fAppResponseMessages.addAll( ex.getMessages() );
}
public final List<AppResponseMessage> getMessages () {
return Collections.unmodifiableList(fAppResponseMessages);
}
public final boolean isNotEmpty () {
return !isEmpty();
}
public final boolean isEmpty () {
return fAppResponseMessages.isEmpty();
}
/** Intended for debugging only. */
@Override public String toString(){
return
"Messages : + " + fAppResponseMessages.toString() +
" Has Been Displayed : " + fHasBeenDisplayed
;
}
// PRIVATE
/** List of {@link AppResponseMessage}s attached to this exception. */
private final List<AppResponseMessage> fAppResponseMessages = new ArrayList<AppResponseMessage>();
/** Controls the display-once-only behavior needed for JSPs. */
private boolean fHasBeenDisplayed = false;
private static final long serialVersionUID = 1000L;
/** Always treat de-serialization as a full-blown constructor, by validating the final state of the deserialized object. */
private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException, IOException {
aInputStream.defaultReadObject();
}
}
|
package com.tencent.mm.plugin.subapp.ui.voicetranstext;
import android.view.View;
import android.view.View.OnClickListener;
class VoiceTransTextUI$1 implements OnClickListener {
final /* synthetic */ VoiceTransTextUI ouz;
VoiceTransTextUI$1(VoiceTransTextUI voiceTransTextUI) {
this.ouz = voiceTransTextUI;
}
public final void onClick(View view) {
this.ouz.finish();
}
}
|
package com.zafodB.ethwalletp5.UI;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.zafodB.ethwalletp5.API.APIClient;
import com.zafodB.ethwalletp5.API.APIInterface;
import com.zafodB.ethwalletp5.API.Models;
import com.zafodB.ethwalletp5.Crypto.Hash;
import com.zafodB.ethwalletp5.Crypto.WalletWrapper;
import com.zafodB.ethwalletp5.FragmentChangerClass;
import com.zafodB.ethwalletp5.R;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class RestoreWalletFragment extends Fragment {
EditText emailInput;
EditText passwordInput;
Button restoreWalletBtn;
String password;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.restore_wallet_fragment, container, false);
emailInput = view.findViewById(R.id.backup_email_input);
passwordInput = view.findViewById(R.id.backup_password_input);
restoreWalletBtn = view.findViewById(R.id.restore_wallet_button);
restoreWalletBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = emailInput.getText().toString();
password = passwordInput.getText().toString();
// TODO: Email and password validation
if (email.length() == 0 || password.length() == 0) {
Toast.makeText(getActivity(), "Provide your email and password", Toast.LENGTH_SHORT).show();
} else {
String emailHash = Hash.stringHash(email);
String emailPassHash = Hash.stringHash(email + password);
requestBackup(emailHash, emailPassHash);
}
}
});
return view;
}
private void requestBackup(String emailHash, String emailPassHash) {
Models.Backup backupRequest = new Models.Backup(emailHash, emailPassHash);
APIInterface apiService = APIClient.getInstance();
Call<Models.Backup> call = apiService.restoreWallet(backupRequest);
call.enqueue(new Callback<Models.Backup>() {
@Override
public void onResponse(Call<Models.Backup> call, Response<Models.Backup> response) {
if (response.code() == 200) {
String encryptedWalletFile = response.body().getWalletFile();
WalletWrapper walletWrapper = new WalletWrapper();
walletWrapper.saveWalletFileFromString(getContext(), encryptedWalletFile, password,"Restored Wallet");
FragmentChangerClass.FragmentChanger changer = (FragmentChangerClass.FragmentChanger) getActivity();
FrontPageFragment frontPageFrag = new FrontPageFragment();
changer.ChangeFragments(frontPageFrag);
Toast.makeText(getActivity(), "Wallet restored successfully", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Models.Backup> call, Throwable t) {
Toast.makeText(getActivity(), "Failed" + "\t" + t.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
} |
package com.favccxx.shy.constants;
public interface ShyConstants {
public static int STATUS_SUCCESS = 200;
public static int STATUS_ERROR = 400;
public static int CODE_SUCCESS = 2000; //操作成功
public static int CODE_LACK_PARAMS = 4001; //缺少必要的参数
public static int CODE_INVALID_PARAMS = 4002; //参数错误
public static String DEFAULT_SUCCESS_MSG = "操作成功!";
public static String DEFAULT_ERROR_MSG = "操作失败!";
}
|
package se.slashat.slashat.async;
import se.slashat.slashat.R;
import se.slashat.slashat.adapter.EpisodeAdapter;
import se.slashat.slashat.fragment.ArchiveFragment;
import se.slashat.slashat.model.Episode;
import se.slashat.slashat.service.ArchiveService;
import android.app.ProgressDialog;
import android.os.AsyncTask;
/**
* Load episodes from the EpisodeService async with ProgressDialog updates
*
* @author Nicklas Löf
*
*/
public class EpisodeLoaderAsyncTask extends AsyncTask<Void, Void, Episode[]> {
private ArchiveFragment archiveFragment;
private ProgressDialog progressDialog;
public EpisodeLoaderAsyncTask(ArchiveFragment archiveFragment) {
this.archiveFragment = archiveFragment;
}
public interface UpdateCallback {
public void onUpdate();
}
@Override
protected Episode[] doInBackground(Void... params) {
Episode[] episodes = ArchiveService.getEpisodes(new UpdateCallback() {
@Override
public void onUpdate() {
publishProgress();
}
});
return episodes;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(archiveFragment.getActivity());
progressDialog.setTitle("Laddar avsnitt");
progressDialog.setMessage("Laddar");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setProgress(0);
progressDialog.show();
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
progressDialog.setMessage(ArchiveService.getProgressMessage());
int numberOfEpisodes = ArchiveService.getNumberOfEpisodes();
if (progressDialog.getMax() != numberOfEpisodes) {
progressDialog.setMax(numberOfEpisodes);
}
progressDialog.incrementProgressBy(ArchiveService.getProcessedNumbers()
- progressDialog.getProgress());
}
@Override
protected void onPostExecute(Episode[] result) {
super.onPostExecute(result);
progressDialog.dismiss();
archiveFragment.setListAdapter(new EpisodeAdapter(archiveFragment
.getActivity(), R.layout.archive_item_row, result,
archiveFragment));
}
}
|
package zm.gov.moh.core.repository.database.dao.domain;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import zm.gov.moh.core.repository.database.entity.domain.Drug;
@Dao
public interface DrugDao {
@Query("SELECT * FROM drug WHERE uuid = :uuid")
LiveData<Drug> getDrugNameByUuid(String uuid);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(Drug... drugNames);
}
|
package net.minecraft.client.renderer.debug;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
public class DebugRendererCollisionBox implements DebugRenderer.IDebugRenderer {
private final Minecraft field_191312_a;
private EntityPlayer field_191313_b;
private double field_191314_c;
private double field_191315_d;
private double field_191316_e;
public DebugRendererCollisionBox(Minecraft p_i47215_1_) {
this.field_191312_a = p_i47215_1_;
}
public void render(float p_190060_1_, long p_190060_2_) {
this.field_191313_b = (EntityPlayer)this.field_191312_a.player;
this.field_191314_c = this.field_191313_b.lastTickPosX + (this.field_191313_b.posX - this.field_191313_b.lastTickPosX) * p_190060_1_;
this.field_191315_d = this.field_191313_b.lastTickPosY + (this.field_191313_b.posY - this.field_191313_b.lastTickPosY) * p_190060_1_;
this.field_191316_e = this.field_191313_b.lastTickPosZ + (this.field_191313_b.posZ - this.field_191313_b.lastTickPosZ) * p_190060_1_;
World world = this.field_191312_a.player.world;
List<AxisAlignedBB> list = world.getCollisionBoxes((Entity)this.field_191313_b, this.field_191313_b.getEntityBoundingBox().expandXyz(6.0D));
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.glLineWidth(2.0F);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
for (AxisAlignedBB axisalignedbb : list)
RenderGlobal.drawSelectionBoundingBox(axisalignedbb.expandXyz(0.002D).offset(-this.field_191314_c, -this.field_191315_d, -this.field_191316_e), 1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\client\renderer\debug\DebugRendererCollisionBox.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package com.media2359.mediacorpspellinggame.data;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by xijunli on 13/2/17.
*/
public final class Question implements Parcelable {
public static final Creator<Question> CREATOR = new Creator<Question>() {
@Override
public Question createFromParcel(Parcel in) {
return new Question(in);
}
@Override
public Question[] newArray(int size) {
return new Question[size];
}
};
private int id;
@SerializedName("question")
private String theQuestion;
@SerializedName("answers")
private List<String> correctAnswers;
private int score;
@SerializedName("additions")
private List<String> additions;
public Question(int id, String theQuestion, List<String> correctAnswers, int score, List<String> additions) {
this.id = id;
this.theQuestion = theQuestion;
this.correctAnswers = correctAnswers;
this.score = score;
this.additions = additions;
}
protected Question(Parcel in) {
id = in.readInt();
theQuestion = in.readString();
in.readStringList(correctAnswers);
score = in.readInt();
in.readStringList(additions);
}
public int getId() {
return id;
}
public String getTheQuestion() {
return theQuestion;
}
public List<String> getCorrectAnswers() {
return correctAnswers;
}
public int getScore() {
return score;
}
public List<String> getAdditions() {
return additions;
}
@Override
public int hashCode() {
return id;
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj instanceof Question) {
Question right = (Question) obj;
return (getId() == right.getId());
}
return false;
}
@Override
public String toString() {
return "Id: " + id + " Q: " + theQuestion;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeString(theQuestion);
dest.writeStringList(correctAnswers);
dest.writeInt(score);
dest.writeStringList(additions);
}
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package co.th.aten.network.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author Atenpunk
*/
@Entity
@Table(name = "transaction_sell_detail")
@NamedQueries({
@NamedQuery(name = "TransactionSellDetail.findAll", query = "SELECT t FROM TransactionSellDetail t")})
public class TransactionSellDetail implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "trx_detail_id")
private Integer trxDetailId;
@Basic(optional = false)
@Column(name = "trx_header_id")
private int trxHeaderId;
@Column(name = "product_id")
private Integer productId;
@Column(name = "catalog_id")
private Integer catalogId;
@Column(name = "price")
private BigDecimal price;
@Column(name = "pv")
private BigDecimal pv;
@Column(name = "bv")
private BigDecimal bv;
@Column(name = "total_price")
private BigDecimal totalPrice;
@Column(name = "total_pv")
private BigDecimal totalPv;
@Column(name = "total_bv")
private BigDecimal totalBv;
@Column(name = "qty")
private Integer qty;
@Basic(optional = false)
@Column(name = "qty_assign")
private int qtyAssign;
@Lob
@Column(name = "remark")
private String remark;
@Column(name = "trx_detail_status")
private Character trxDetailStatus;
@Column(name = "trx_detail_flag")
private Character trxDetailFlag;
@Column(name = "create_by")
private Integer createBy;
@Column(name = "create_date")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Column(name = "update_by")
private Integer updateBy;
@Column(name = "update_date")
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
public TransactionSellDetail() {
}
public TransactionSellDetail(Integer trxDetailId) {
this.trxDetailId = trxDetailId;
}
public TransactionSellDetail(Integer trxDetailId, int trxHeaderId, int qtyAssign) {
this.trxDetailId = trxDetailId;
this.trxHeaderId = trxHeaderId;
this.qtyAssign = qtyAssign;
}
public Integer getTrxDetailId() {
return trxDetailId;
}
public void setTrxDetailId(Integer trxDetailId) {
this.trxDetailId = trxDetailId;
}
public int getTrxHeaderId() {
return trxHeaderId;
}
public void setTrxHeaderId(int trxHeaderId) {
this.trxHeaderId = trxHeaderId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getCatalogId() {
return catalogId;
}
public void setCatalogId(Integer catalogId) {
this.catalogId = catalogId;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getPv() {
return pv;
}
public void setPv(BigDecimal pv) {
this.pv = pv;
}
public BigDecimal getBv() {
return bv;
}
public void setBv(BigDecimal bv) {
this.bv = bv;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public BigDecimal getTotalPv() {
return totalPv;
}
public void setTotalPv(BigDecimal totalPv) {
this.totalPv = totalPv;
}
public BigDecimal getTotalBv() {
return totalBv;
}
public void setTotalBv(BigDecimal totalBv) {
this.totalBv = totalBv;
}
public Integer getQty() {
return qty;
}
public void setQty(Integer qty) {
this.qty = qty;
}
public int getQtyAssign() {
return qtyAssign;
}
public void setQtyAssign(int qtyAssign) {
this.qtyAssign = qtyAssign;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Character getTrxDetailStatus() {
return trxDetailStatus;
}
public void setTrxDetailStatus(Character trxDetailStatus) {
this.trxDetailStatus = trxDetailStatus;
}
public Character getTrxDetailFlag() {
return trxDetailFlag;
}
public void setTrxDetailFlag(Character trxDetailFlag) {
this.trxDetailFlag = trxDetailFlag;
}
public Integer getCreateBy() {
return createBy;
}
public void setCreateBy(Integer createBy) {
this.createBy = createBy;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Integer getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Integer updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
@Override
public int hashCode() {
int hash = 0;
hash += (trxDetailId != null ? trxDetailId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TransactionSellDetail)) {
return false;
}
TransactionSellDetail other = (TransactionSellDetail) object;
if ((this.trxDetailId == null && other.trxDetailId != null) || (this.trxDetailId != null && !this.trxDetailId.equals(other.trxDetailId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "co.th.aten.network.entity.TransactionSellDetail[trxDetailId=" + trxDetailId + "]";
}
}
|
package com.quaero.quaerosmartplatform.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 计划到料查询列表
* </p>
*
* @author wuhanzhang@
* @since 2021/1/25 8:57
*/
@Data
@ApiModel
public class MaterialPlanByDateListVo {
@ApiModelProperty("供应商编号")
private String cardCode;
@ApiModelProperty("供应商名称")
private String cardName;
@ApiModelProperty("料号")
private String itemCode;
@ApiModelProperty("名称规格")
private String itemName;
@ApiModelProperty("计划到料数")
private BigDecimal plannedQty;
@ApiModelProperty("计划到料日期")
private Date dueDate;
@ApiModelProperty("交货日期 缺料日期")
private Date shipDate;
@ApiModelProperty("缺料数")
private BigDecimal PmcQty;
}
|
package practice;
import java.util.Scanner;
public class ConvertRadius {
static Scanner sc = new Scanner(System.in);
static double radiusValue,area,circumference;
final static double PI = 3.1415;
public static void main(String [] args)
{
System.out.print("Enter radius value: ");
radiusValue = sc.nextDouble();
area = PI*(radiusValue*radiusValue);
circumference = 2*(PI*radiusValue);
System.out.println("The area is: "+ area);
System.out.println("The circumference is: "+ circumference);
}
}
|
package ec.com.yacare.y4all.asynctask.ws;
import android.os.AsyncTask;
import android.provider.Settings;
import android.util.Log;
import ec.com.yacare.y4all.activities.DatosAplicacion;
import ec.com.yacare.y4all.activities.socket.MonitorIOActivity;
import ec.com.yacare.y4all.lib.webservice.ContestarPortero;
public class ContestarPorteroAsyncTask extends AsyncTask<String, Float, String> {
private MonitorIOActivity monitorIOActivity;
public ContestarPorteroAsyncTask(MonitorIOActivity monitorIOActivity) {
super();
this.monitorIOActivity = monitorIOActivity;
}
@Override
protected String doInBackground(String... arg0) {
DatosAplicacion datosAplicacion;
String idDispositivo;
datosAplicacion = ((DatosAplicacion) monitorIOActivity.getApplicationContext());
idDispositivo = Settings.Secure.getString(monitorIOActivity.getApplicationContext().getContentResolver(),Settings.Secure.ANDROID_ID);
String respStr = ContestarPortero.contestarPortero(datosAplicacion.getEquipoSeleccionado().getNumeroSerie(), idDispositivo);
Log.d("ws: contestarPortero",respStr);
return respStr;
}
}
|
package net.minecraft.entity.ai;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper;
public class EntityAICreeperSwell extends EntityAIBase {
EntityCreeper swellingCreeper;
EntityLivingBase creeperAttackTarget;
public EntityAICreeperSwell(EntityCreeper entitycreeperIn) {
this.swellingCreeper = entitycreeperIn;
setMutexBits(1);
}
public boolean shouldExecute() {
EntityLivingBase entitylivingbase = this.swellingCreeper.getAttackTarget();
return !(this.swellingCreeper.getCreeperState() <= 0 && (entitylivingbase == null || this.swellingCreeper.getDistanceSqToEntity((Entity)entitylivingbase) >= 9.0D));
}
public void startExecuting() {
this.swellingCreeper.getNavigator().clearPathEntity();
this.creeperAttackTarget = this.swellingCreeper.getAttackTarget();
}
public void resetTask() {
this.creeperAttackTarget = null;
}
public void updateTask() {
if (this.creeperAttackTarget == null) {
this.swellingCreeper.setCreeperState(-1);
} else if (this.swellingCreeper.getDistanceSqToEntity((Entity)this.creeperAttackTarget) > 49.0D) {
this.swellingCreeper.setCreeperState(-1);
} else if (!this.swellingCreeper.getEntitySenses().canSee((Entity)this.creeperAttackTarget)) {
this.swellingCreeper.setCreeperState(-1);
} else {
this.swellingCreeper.setCreeperState(1);
}
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\entity\ai\EntityAICreeperSwell.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package nowcoder.剑指offer;
/**
* @Author: Mr.M
* @Date: 2019-03-08 15:06
* @Description: 两个链表的第一个公共结点
**/
public class T36两个链表的第一个公共结点 {
public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {
if(pHead1==null || pHead2==null){
return null;
}
int len1 = 0;
int len2 = 0;
ListNode x1 = pHead1;
ListNode x2 = pHead2;
while (x1.next!=null){
x1 = x1.next;
len1++;
}
while (x2.next!=null){
x2 = x2.next;
len2++;
}
int diff = len1-len2;
while (diff>0){
pHead1 = pHead1.next;
diff--;
}
while (-diff>0){
pHead2 = pHead2.next;
diff++;
}
while (pHead1!=pHead2){
pHead1 = pHead1.next;
pHead2 = pHead2.next;
}
return pHead1;
}
}
|
public class Main {
public static void main(String[] args) {
Fenster fenster = new Fenster("TestVersion 0.03");
fenster.setVisible(true);
}
}
|
package gr.athena.innovation.fagi.core.similarity;
import gr.athena.innovation.fagi.specification.SpecificationConstants;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.apache.logging.log4j.LogManager;
/**
* Class providing methods for computing Jaro Similarity and Jaro Distance.
*
* @author nkarag
*/
public class Jaro {
private static final org.apache.logging.log4j.Logger LOG
= LogManager.getLogger(Jaro.class);
/**
* Computes the Jaro Distance which indicates the similarity score between two strings.
* <a href="https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro_distance">
* https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro_distance</a>.
*
* @param a the first string.
* @param b the second string.
* @return the distance. Range is between [0,1].
*/
public static double computeSimilarity(String a, String b) {
Jaro jaro = new Jaro();
double result = jaro.apply(a, b);
if (result > SpecificationConstants.Similarity.SIMILARITY_MAX) {
return 1;
} else if (result < SpecificationConstants.Similarity.SIMILARITY_MIN) {
return 0;
} else {
double roundedResult = new BigDecimal(result).
setScale(SpecificationConstants.Similarity.ROUND_DECIMALS_3, RoundingMode.HALF_UP).doubleValue();
return roundedResult;
}
}
/**
* Computes the Jaro Distance using the complement of
* <a href="https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro_distance">
* https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro_distance</a>.
*
* @param a the first string.
* @param b the second string.
* @return the distance. Range is between [0,1].
*/
public static double computeDistance(String a, String b) {
return 1 - computeSimilarity(a, b);
}
private double apply(String a, String b) {
int aLength = a.length();
int bLength = b.length();
if (aLength == 0 || bLength == 0) {
return 1;
}
int matchDistance = Integer.max(aLength, bLength) / 2 - 1;
boolean[] aMatches = new boolean[aLength];
boolean[] bMatches = new boolean[bLength];
int matches = 0;
int transpositions = 0;
for (int i = 0; i < aLength; i++) {
int start = Integer.max(0, i - matchDistance);
int end = Integer.min(i + matchDistance + 1, bLength);
for (int j = start; j < end; j++) {
if (bMatches[j]) {
continue;
}
if (a.charAt(i) != b.charAt(j)) {
continue;
}
aMatches[i] = true;
bMatches[j] = true;
matches++;
break;
}
}
if (matches == 0) {
return 0;
}
int k = 0;
for (int i = 0; i < aLength; i++) {
if (!aMatches[i]) {
continue;
}
while (!bMatches[k]) {
k++;
}
if (a.charAt(i) != b.charAt(k)) {
transpositions++;
}
k++;
}
double aFraction = (double) matches / aLength;
double bFraction = (double) matches / bLength;
double transp = ((double) matches - transpositions / 2.0);
return (aFraction + bFraction + (transp / matches)) / 3.0;
}
}
|
package com.ilp.innovations.myapplication;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.ilp.innovations.myapplication.Beans.Slot;
import com.ilp.innovations.myapplication.Services.BookingUpdaterService;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class RegisterSlotActivity extends Activity {
private EditText txtSlotId;
private EditText txtEmpId;
private EditText txtVehNum;
private Button btnBook;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_book_slot);
txtSlotId = (EditText) findViewById(R.id.slotId);
txtEmpId = (EditText) findViewById(R.id.empId);
txtVehNum = (EditText) findViewById(R.id.vehicleNum);
btnBook = (Button) findViewById(R.id.btnBook);
Intent intent = getIntent();
String slot = intent.getStringExtra("slotId");
if(slot!=null) {
txtSlotId.setText(slot);
txtSlotId.setEnabled(false);
}
else {
finish();
}
btnBook.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String empId = txtEmpId.getText().toString();
String vehNum = txtVehNum.getText().toString();
if(empId.length()!=0 || vehNum.length()!=0) {
Intent bookService = new Intent(getApplicationContext(),
BookingUpdaterService.class);
bookService.putExtra("slotId",txtSlotId.getText().toString());
bookService.putExtra("empId",empId);
bookService.putExtra("vehNum",vehNum);
bookService.setAction(BookingUpdaterService.ACTION_BOOK_SLOT);
startService(bookService);
}
else {
txtEmpId.setError("Either employee id or vehicle num is required");
txtVehNum.setError("Either employee id or vehicle num is required");
}
}
});
}
@Override
public void onResume() {
super.onResume();
IntentFilter filter = new IntentFilter();
filter.addAction(BookingUpdaterService.BROADCAST_ACTION_BOOK_SLOT);
registerReceiver(receiver, filter);
Log.d("myTag", "Broadcast receiver registered");
}
@Override
public void onPause() {
unregisterReceiver(receiver);
Log.d("myTag", "Broadcast receiver unregistered");
super.onPause();
}
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String response = intent.getStringExtra("response");
if(response!=null) {
String action = intent.getAction();
if (action.equals(BookingUpdaterService.BROADCAST_ACTION_BOOK_SLOT)) {
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
if (!error) {
Intent resultIntent = new Intent();
RegisterSlotActivity.this.setResult(1, resultIntent);
RegisterSlotActivity.this.finish();
}
else {
Toast.makeText(getApplicationContext(),
jObj.getString("errorMsg"),
Toast.LENGTH_SHORT).show();
txtEmpId.setError("Booking failed");
txtVehNum.setError("Booking failed");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
else {
Toast.makeText(getApplicationContext(),
"Error in connection. Either not connected to internet or wrong server addr",
Toast.LENGTH_LONG).show();
}
}
};
}
|
import javax.swing.*;
import java.awt.*;
public class RhythmPanel extends JPanel{
private int length;
public boolean[] rhythm;
private boolean erase;
public RhythmPanel(){
setLength(16);
setErase(false);
}
// Actual methods
@Override
public Dimension getPreferredSize(){
return new Dimension(Main.OTHER_FRAME_WIDTH, Main.OTHER_FRAME_HEIGHT);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
if(!getErase()){
drawRectangles(g, this.getWidth(), this.getHeight());
} else {
g.setColor(new Color(0,0,0,0));
g.fillRect(0,0, this.getWidth(), this.getHeight());
}
}
private void drawRectangles(Graphics g, int width, int height){
int clear = (width/4)/(getLength()+1); // width of the space in between rectangles
int rect = (width*3/4)/getLength(); // width of each rectangle
g.setColor(Color.BLACK);
for(int i = 1; i <= getLength(); i++){
g.drawRoundRect(clear*i+rect*(i-1), height/3, rect, height/3, 10, 10);
}
int xPos;
for(int i = 1; i <= getLength(); i++){
xPos = clear*i+rect*(i-1);
if(getRhythm()[i-1]){
g.setColor(Color.CYAN);
g.fillRoundRect(xPos+1, height/3+1, rect-1, height/3-1, 10, 10);
} else {
g.setColor(new Color(0,0,0,0));
g.fillRoundRect(xPos+1, height/3+1, rect-1, height/3-1, 10, 10);
g.setColor(Color.BLACK);
g.drawRoundRect(xPos, height/3, rect, height/3, 10, 10);
}
}
}
// Getters & Setters
public int getLength(){
return this.length;
}
public void setLength(int length){
this.length = length;
setRhythm(new boolean[getLength()]);
}
public boolean[] getRhythm(){
return this.rhythm;
}
public void setRhythm(boolean[] rhythm){
this.rhythm = rhythm;
}
public boolean getErase(){
return this.erase;
}
public void setErase(boolean erase){
this.erase = erase;
}
}
|
package io.github.wickhamwei.wessential.wresidence.command;
import io.github.wickhamwei.wessential.WEssentialMain;
import io.github.wickhamwei.wessential.wresidence.WResidence;
import io.github.wickhamwei.wessential.wtools.WPlayer;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Objects;
public class SetRes implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (commandSender instanceof Player) {
String playerName = commandSender.getName();
WPlayer player = WPlayer.getWPlayer(playerName);
if (strings.length == 1) {
if (player.isOp() && player.getBukkitPlayer().getGameMode() == GameMode.CREATIVE) {
Location pointOne = WResidence.getPoint(player, true);
Location pointTwo = WResidence.getPoint(player, false);
if (pointOne != null && pointTwo != null && Objects.requireNonNull(pointOne.getWorld()).getName().equals(Objects.requireNonNull(pointTwo.getWorld()).getName())) {
WResidence.setResidence(player, strings[0], pointOne, pointTwo);
} else {
player.sendMessage(WEssentialMain.languageConfig.getConfig().getString("message.w_residence_set_fail"));
}
} else {
player.sendMessage(WEssentialMain.languageConfig.getConfig().getString("message.op_only"));
}
return true;
}
}
return false;
}
}
|
package exercicios;
import java.util.Scanner;
public class Ex01 {
public void executa() {
// Instancia o scanner para leitura de dados
Scanner sc = new Scanner(System.in);
// Recebe o 1o inteiro
System.out.println("Informe o 1o inteiro:");
int n1 = sc.nextInt();
// Recebe o 2o inteiro
System.out.println("Informe o 2o inteiro:");
int n2 = sc.nextInt();
// Impressão dos resultados
System.out.printf("%d + %d = %d\n", n1, n2, n1 + n2);
System.out.printf("%d - %d = %d\n", n1, n2, n1 - n2);
}
}
|
package fr.lteconsulting.servlet;
import java.io.IOException;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.pegdown.PegDownProcessor;
import fr.lteconsulting.dao.BigDao;
import fr.lteconsulting.model.Quizz;
import fr.lteconsulting.model.Utilisateur;
public class ResultatsServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
@EJB
private BigDao dao;
protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
{
List<Utilisateur> utilisateurs = dao.getUtilisateurs();
PegDownProcessor markdown = new PegDownProcessor();
StringBuilder sb = new StringBuilder();
sb.append( "nom;email;score;allgood;onebad;onegood;bad;nbquestions\n" );
for( Quizz quizz : dao.getQuizzs() )
{
// sb.append( "##" + quizz.getNom() + "\n" );
for( Utilisateur utilisateur : utilisateurs )
{
// sb.append( "###" + utilisateur.getNomComplet() + "\n" );
String results = dao.processResultats( quizz.getId(), utilisateur.getId() );
sb.append( results );
}
}
response.setContentType( "text/csv" );
response.setCharacterEncoding( "UTF-8" );
// response.getWriter().print( markdown.markdownToHtml( sb.toString() ) );
response.getWriter().print( sb.toString() );
}
}
|
package edu.nju.logic.service;
import edu.nju.data.entity.Answer;
import edu.nju.data.entity.Question;
import edu.nju.data.entity.User;
/**
* Created by cuihao on 2016/7/25.
*/
public interface AuthService {
boolean canEditQuestion(long user, Question question);
boolean canDeleteQuestion(long user, Question question);
boolean canEditAnswer(long user, Answer answer);
boolean canDeleteAnswer(long user, Answer answer);
}
|
package leetcode560;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int[] nums = {1,2,3,4,5,6,7,-22};
System.out.println("Nums: " + Arrays.toString(nums));
int k = 5;
System.out.println("K: " + k);
FindSubarraySumEqualToTargetFunction solution = new FindSubarraySumEqualToTargetFunction();
System.out.println("Solution: " + solution.subarraySum(nums, k));
}
}
|
package com.example.fibonacci;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class DetallesPais extends AppCompatActivity {
TextView detalles;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detalles_pais);
detalles = findViewById(R.id.detallesPais);
Bundle pais = getIntent().getBundleExtra("bundle");
detalles.setText("Nombre del Pais: " + pais.getString("nombrePa")+
"\nSigla: " + pais.getString("sigla")+
"\nNombre Internacional: " + pais.getString("internacional")+
"\nCapital: " + pais.getString("capital"));
}
}
|
package pl.polsl.wkiro.recognizer.utils;
import com.openalpr.jni.exceptions.TaskInterruptedException;
public class TaskUtils {
public static boolean checkTaskInterrupted(boolean throwException) {
boolean result = false;
if (Thread.interrupted()) {
if(throwException) {
throw new TaskInterruptedException("Process interrupted");
} else {
result = true;
}
}
return result;
}
}
|
package com.tienganhchoem.model;
public class TracNghiemModel extends AbstractModel<TracNghiemModel>{
private String content;
private String answerA;
private String answerB;
private String answerC;
private String answerD;
private String answerTrue;
private Long idBaiTracNghiem;
private Long idCauHoiTracNghiem;
private Long lessionid;
public Long getLessionid() {
return lessionid;
}
public void setLessionid(Long lessionid) {
this.lessionid = lessionid;
}
public Long getIdCauHoiTracNghiem() {
return idCauHoiTracNghiem;
}
public void setIdCauHoiTracNghiem(Long idCauHoiTracNghiem) {
this.idCauHoiTracNghiem = idCauHoiTracNghiem;
}
public Long getIdBaiTracNghiem() {
return idBaiTracNghiem;
}
public void setIdBaiTracNghiem(Long idBaiTracNghiem) {
this.idBaiTracNghiem = idBaiTracNghiem;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getAnswerA() {
return answerA;
}
public void setAnswerA(String answerA) {
this.answerA = answerA;
}
public String getAnswerB() {
return answerB;
}
public void setAnswerB(String answerB) {
this.answerB = answerB;
}
public String getAnswerC() {
return answerC;
}
public void setAnswerC(String answerC) {
this.answerC = answerC;
}
public String getAnswerD() {
return answerD;
}
public void setAnswerD(String answerD) {
this.answerD = answerD;
}
public String getAnswerTrue() {
return answerTrue;
}
public void setAnswerTrue(String answerTrue) {
this.answerTrue = answerTrue;
}
}
|
package questions.ReverseNodesInkGroup_0025;
import questions.common.ListNode;
/*
* @lc app=leetcode.cn id=25 lang=java
*
* [25] K 个一组翻转链表
*
* https://leetcode-cn.com/problems/reverse-nodes-in-k-group/description/
*
* algorithms
* Hard (54.91%)
* Likes: 456
* Dislikes: 0
* Total Accepted: 52.4K
* Total Submissions: 90.1K
* Testcase Example: '[1,2,3,4,5]\n2'
*
* 给你一个链表,每 k 个节点一组进行翻转,请你返回翻转后的链表。
*
* k 是一个正整数,它的值小于或等于链表的长度。
*
* 如果节点总数不是 k 的整数倍,那么请将最后剩余的节点保持原有顺序。
*
*
*
* 示例:
*
* 给你这个链表:1->2->3->4->5
*
* 当 k = 2 时,应当返回: 2->1->4->3->5
*
* 当 k = 3 时,应当返回: 3->2->1->4->5
*
*
*
* 说明:
*
*
* 你的算法只能使用常数的额外空间。
* 你不能只是单纯的改变节点内部的值,而是需要实际进行节点交换。
*
*
*/
// @lc code=start
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode reverseKGroup(ListNode head, int k) {
ListNode hair = new ListNode(0);
ListNode tail = head;
ListNode pre = hair;
int i = 1;
// 分割
while(tail != null) {
if (i == k) {
i = 1;
ListNode nextTemp = tail.next;
ListNode newHead = helper(head, tail);
pre.next = newHead;
pre = head;
head = nextTemp;
tail = nextTemp;
}
if (tail != null) {
tail = tail.next;
i++;
}
}
pre.next = head;
return hair.next;
}
// 翻转链表
private ListNode helper(ListNode head, ListNode tail) {
ListNode prev = null;
ListNode curr = head;
ListNode end = tail.next;
while (curr != null && curr != end) {
ListNode nextTemp = curr.next;
curr.next = prev;
prev = curr;
curr = nextTemp;
}
return prev;
}
public static void main(String[] args) {
ListNode l1 = new ListNode(1);
ListNode l2 = new ListNode(2);
ListNode l3 = new ListNode(3);
ListNode l4 = new ListNode(4);
ListNode l5 = new ListNode(5);
l1.next = l2;
l2.next = l3;
l3.next = l4;
l4.next = l5;
// new Solution().helper(l1, l2);
new Solution().reverseKGroup(l1, 2);
}
}
// @lc code=end |
package com.tencent.mm.plugin.recharge.model;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import org.json.JSONObject;
public final class a {
public static final int[] mot = new int[]{-1, -1};
public static final int[] mou = new int[]{-2, -2};
public int bJt;
public String mov;
public String mow;
public int[] mox;
public String name;
public a(String str, String str2, int i) {
this(str, str2, "", i);
}
public a(String str, String str2, String str3, int i) {
this.mox = mot;
this.mov = str;
this.name = str2;
this.mow = str3;
this.bJt = i;
}
public final JSONObject bpY() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("record", bi.aG(this.mov, ""));
jSONObject.put("name", bi.aG(this.name, ""));
jSONObject.put("location", bi.aG(this.mow, ""));
return jSONObject;
} catch (Throwable e) {
x.printErrStackTrace("MicroMsg.MallInputRecord", e, "", new Object[0]);
return null;
}
}
public static a Z(JSONObject jSONObject) {
String optString = jSONObject.optString("name");
String optString2 = jSONObject.optString("record");
String optString3 = jSONObject.optString("location");
if (bi.oW(optString2)) {
return null;
}
return new a(optString2, optString, optString3, 2);
}
}
|
package com.smxknife.java.ex30;
/**
* @author smxknife
* 2020/1/20
*/
public class IntMaxPlus1 {
public static void main(String[] args) {
int i = Integer.MAX_VALUE + 1;
System.out.println(Integer.toBinaryString(Integer.MAX_VALUE));
System.out.println(Integer.MAX_VALUE);
System.out.println(Math.pow(2, 31));
System.out.println(i);
System.out.println(1 << 4);
System.out.println(1 >> 4);
}
}
|
package org.newdawn.slick.openal;
public interface Audio {
void stop();
int getBufferID();
boolean isPlaying();
int playAsSoundEffect(float paramFloat1, float paramFloat2, boolean paramBoolean);
int playAsSoundEffect(float paramFloat1, float paramFloat2, boolean paramBoolean, float paramFloat3, float paramFloat4, float paramFloat5);
int playAsMusic(float paramFloat1, float paramFloat2, boolean paramBoolean);
boolean setPosition(float paramFloat);
float getPosition();
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\org\newdawn\slick\openal\Audio.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package com.tencent.mm.plugin.profile.ui;
import android.view.View;
import android.view.View.OnClickListener;
import com.tencent.mm.plugin.profile.ui.NormalUserFooterPreference.c;
import com.tencent.mm.plugin.report.service.h;
class NormalUserFooterPreference$c$2 implements OnClickListener {
final /* synthetic */ c lXI;
NormalUserFooterPreference$c$2(c cVar) {
this.lXI = cVar;
}
public final void onClick(View view) {
this.lXI.bnF();
if (NormalUserFooterPreference.E(this.lXI.lXw) != 0) {
h.mEJ.h(11263, new Object[]{Integer.valueOf(NormalUserFooterPreference.E(this.lXI.lXw)), NormalUserFooterPreference.a(this.lXI.lXw).field_username});
}
}
}
|
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package edu.tsinghua.lumaqq.ecore.group;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>XCluster</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getUser <em>User</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getOrganization <em>Organization</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getAdmins <em>Admins</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getAuthType <em>Auth Type</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCategory <em>Category</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getClusterId <em>Cluster Id</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCreator <em>Creator</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getDescription <em>Description</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getExternalId <em>External Id</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getHeadId <em>Head Id</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getLastMessageTime <em>Last Message Time</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getMessageSetting <em>Message Setting</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getName <em>Name</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getNotice <em>Notice</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getOldCategory <em>Old Category</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getParentClusterId <em>Parent Cluster Id</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getStockholders <em>Stockholders</em>}</li>
* <li>{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getType <em>Type</em>}</li>
* </ul>
* </p>
*
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster()
* @model
* @generated
*/
public interface XCluster extends EObject {
/**
* Returns the value of the '<em><b>User</b></em>' containment reference list.
* The list contents are of type {@link edu.tsinghua.lumaqq.ecore.group.XUser}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>User</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>User</em>' containment reference list.
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_User()
* @model type="edu.tsinghua.lumaqq.ecore.group.XUser" containment="true" resolveProxies="false"
* @generated
*/
EList getUser();
/**
* Returns the value of the '<em><b>Organization</b></em>' containment reference list.
* The list contents are of type {@link edu.tsinghua.lumaqq.ecore.group.XOrganization}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Organization</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Organization</em>' containment reference list.
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Organization()
* @model type="edu.tsinghua.lumaqq.ecore.group.XOrganization" containment="true" resolveProxies="false"
* @generated
*/
EList getOrganization();
/**
* Returns the value of the '<em><b>Admins</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Admins</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Admins</em>' attribute.
* @see #setAdmins(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Admins()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getAdmins();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getAdmins <em>Admins</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Admins</em>' attribute.
* @see #getAdmins()
* @generated
*/
void setAdmins(String value);
/**
* Returns the value of the '<em><b>Auth Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Auth Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Auth Type</em>' attribute.
* @see #isSetAuthType()
* @see #unsetAuthType()
* @see #setAuthType(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_AuthType()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getAuthType();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getAuthType <em>Auth Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Auth Type</em>' attribute.
* @see #isSetAuthType()
* @see #unsetAuthType()
* @see #getAuthType()
* @generated
*/
void setAuthType(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getAuthType <em>Auth Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetAuthType()
* @see #getAuthType()
* @see #setAuthType(int)
* @generated
*/
void unsetAuthType();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getAuthType <em>Auth Type</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Auth Type</em>' attribute is set.
* @see #unsetAuthType()
* @see #getAuthType()
* @see #setAuthType(int)
* @generated
*/
boolean isSetAuthType();
/**
* Returns the value of the '<em><b>Category</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Category</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Category</em>' attribute.
* @see #isSetCategory()
* @see #unsetCategory()
* @see #setCategory(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Category()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getCategory();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCategory <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Category</em>' attribute.
* @see #isSetCategory()
* @see #unsetCategory()
* @see #getCategory()
* @generated
*/
void setCategory(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCategory <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetCategory()
* @see #getCategory()
* @see #setCategory(int)
* @generated
*/
void unsetCategory();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCategory <em>Category</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Category</em>' attribute is set.
* @see #unsetCategory()
* @see #getCategory()
* @see #setCategory(int)
* @generated
*/
boolean isSetCategory();
/**
* Returns the value of the '<em><b>Cluster Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Cluster Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Cluster Id</em>' attribute.
* @see #isSetClusterId()
* @see #unsetClusterId()
* @see #setClusterId(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_ClusterId()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getClusterId();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getClusterId <em>Cluster Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Cluster Id</em>' attribute.
* @see #isSetClusterId()
* @see #unsetClusterId()
* @see #getClusterId()
* @generated
*/
void setClusterId(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getClusterId <em>Cluster Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetClusterId()
* @see #getClusterId()
* @see #setClusterId(int)
* @generated
*/
void unsetClusterId();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getClusterId <em>Cluster Id</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Cluster Id</em>' attribute is set.
* @see #unsetClusterId()
* @see #getClusterId()
* @see #setClusterId(int)
* @generated
*/
boolean isSetClusterId();
/**
* Returns the value of the '<em><b>Creator</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Creator</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Creator</em>' attribute.
* @see #isSetCreator()
* @see #unsetCreator()
* @see #setCreator(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Creator()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getCreator();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCreator <em>Creator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Creator</em>' attribute.
* @see #isSetCreator()
* @see #unsetCreator()
* @see #getCreator()
* @generated
*/
void setCreator(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCreator <em>Creator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetCreator()
* @see #getCreator()
* @see #setCreator(int)
* @generated
*/
void unsetCreator();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getCreator <em>Creator</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Creator</em>' attribute is set.
* @see #unsetCreator()
* @see #getCreator()
* @see #setCreator(int)
* @generated
*/
boolean isSetCreator();
/**
* Returns the value of the '<em><b>Description</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Description</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Description</em>' attribute.
* @see #isSetDescription()
* @see #unsetDescription()
* @see #setDescription(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Description()
* @model default="" unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
String getDescription();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getDescription <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Description</em>' attribute.
* @see #isSetDescription()
* @see #unsetDescription()
* @see #getDescription()
* @generated
*/
void setDescription(String value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getDescription <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetDescription()
* @see #getDescription()
* @see #setDescription(String)
* @generated
*/
void unsetDescription();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getDescription <em>Description</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Description</em>' attribute is set.
* @see #unsetDescription()
* @see #getDescription()
* @see #setDescription(String)
* @generated
*/
boolean isSetDescription();
/**
* Returns the value of the '<em><b>External Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>External Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>External Id</em>' attribute.
* @see #isSetExternalId()
* @see #unsetExternalId()
* @see #setExternalId(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_ExternalId()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getExternalId();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getExternalId <em>External Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>External Id</em>' attribute.
* @see #isSetExternalId()
* @see #unsetExternalId()
* @see #getExternalId()
* @generated
*/
void setExternalId(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getExternalId <em>External Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetExternalId()
* @see #getExternalId()
* @see #setExternalId(int)
* @generated
*/
void unsetExternalId();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getExternalId <em>External Id</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>External Id</em>' attribute is set.
* @see #unsetExternalId()
* @see #getExternalId()
* @see #setExternalId(int)
* @generated
*/
boolean isSetExternalId();
/**
* Returns the value of the '<em><b>Head Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Head Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Head Id</em>' attribute.
* @see #isSetHeadId()
* @see #unsetHeadId()
* @see #setHeadId(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_HeadId()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getHeadId();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getHeadId <em>Head Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Head Id</em>' attribute.
* @see #isSetHeadId()
* @see #unsetHeadId()
* @see #getHeadId()
* @generated
*/
void setHeadId(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getHeadId <em>Head Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetHeadId()
* @see #getHeadId()
* @see #setHeadId(int)
* @generated
*/
void unsetHeadId();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getHeadId <em>Head Id</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Head Id</em>' attribute is set.
* @see #unsetHeadId()
* @see #getHeadId()
* @see #setHeadId(int)
* @generated
*/
boolean isSetHeadId();
/**
* Returns the value of the '<em><b>Last Message Time</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Last Message Time</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Last Message Time</em>' attribute.
* @see #isSetLastMessageTime()
* @see #unsetLastMessageTime()
* @see #setLastMessageTime(long)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_LastMessageTime()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Long" required="true"
* @generated
*/
long getLastMessageTime();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getLastMessageTime <em>Last Message Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Last Message Time</em>' attribute.
* @see #isSetLastMessageTime()
* @see #unsetLastMessageTime()
* @see #getLastMessageTime()
* @generated
*/
void setLastMessageTime(long value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getLastMessageTime <em>Last Message Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetLastMessageTime()
* @see #getLastMessageTime()
* @see #setLastMessageTime(long)
* @generated
*/
void unsetLastMessageTime();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getLastMessageTime <em>Last Message Time</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Last Message Time</em>' attribute is set.
* @see #unsetLastMessageTime()
* @see #getLastMessageTime()
* @see #setLastMessageTime(long)
* @generated
*/
boolean isSetLastMessageTime();
/**
* Returns the value of the '<em><b>Message Setting</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Message Setting</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Message Setting</em>' attribute.
* @see #setMessageSetting(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_MessageSetting()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getMessageSetting();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getMessageSetting <em>Message Setting</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Message Setting</em>' attribute.
* @see #getMessageSetting()
* @generated
*/
void setMessageSetting(String value);
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Name()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getName();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Returns the value of the '<em><b>Notice</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Notice</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Notice</em>' attribute.
* @see #isSetNotice()
* @see #unsetNotice()
* @see #setNotice(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Notice()
* @model default="" unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
String getNotice();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getNotice <em>Notice</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Notice</em>' attribute.
* @see #isSetNotice()
* @see #unsetNotice()
* @see #getNotice()
* @generated
*/
void setNotice(String value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getNotice <em>Notice</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetNotice()
* @see #getNotice()
* @see #setNotice(String)
* @generated
*/
void unsetNotice();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getNotice <em>Notice</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Notice</em>' attribute is set.
* @see #unsetNotice()
* @see #getNotice()
* @see #setNotice(String)
* @generated
*/
boolean isSetNotice();
/**
* Returns the value of the '<em><b>Old Category</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Old Category</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Old Category</em>' attribute.
* @see #isSetOldCategory()
* @see #unsetOldCategory()
* @see #setOldCategory(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_OldCategory()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getOldCategory();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getOldCategory <em>Old Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Old Category</em>' attribute.
* @see #isSetOldCategory()
* @see #unsetOldCategory()
* @see #getOldCategory()
* @generated
*/
void setOldCategory(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getOldCategory <em>Old Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetOldCategory()
* @see #getOldCategory()
* @see #setOldCategory(int)
* @generated
*/
void unsetOldCategory();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getOldCategory <em>Old Category</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Old Category</em>' attribute is set.
* @see #unsetOldCategory()
* @see #getOldCategory()
* @see #setOldCategory(int)
* @generated
*/
boolean isSetOldCategory();
/**
* Returns the value of the '<em><b>Parent Cluster Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Parent Cluster Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Parent Cluster Id</em>' attribute.
* @see #isSetParentClusterId()
* @see #unsetParentClusterId()
* @see #setParentClusterId(int)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_ParentClusterId()
* @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Int" required="true"
* @generated
*/
int getParentClusterId();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getParentClusterId <em>Parent Cluster Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Parent Cluster Id</em>' attribute.
* @see #isSetParentClusterId()
* @see #unsetParentClusterId()
* @see #getParentClusterId()
* @generated
*/
void setParentClusterId(int value);
/**
* Unsets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getParentClusterId <em>Parent Cluster Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetParentClusterId()
* @see #getParentClusterId()
* @see #setParentClusterId(int)
* @generated
*/
void unsetParentClusterId();
/**
* Returns whether the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getParentClusterId <em>Parent Cluster Id</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Parent Cluster Id</em>' attribute is set.
* @see #unsetParentClusterId()
* @see #getParentClusterId()
* @see #setParentClusterId(int)
* @generated
*/
boolean isSetParentClusterId();
/**
* Returns the value of the '<em><b>Stockholders</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Stockholders</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Stockholders</em>' attribute.
* @see #setStockholders(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Stockholders()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getStockholders();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getStockholders <em>Stockholders</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Stockholders</em>' attribute.
* @see #getStockholders()
* @generated
*/
void setStockholders(String value);
/**
* Returns the value of the '<em><b>Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' attribute.
* @see #setType(String)
* @see edu.tsinghua.lumaqq.ecore.group.GroupPackage#getXCluster_Type()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getType();
/**
* Sets the value of the '{@link edu.tsinghua.lumaqq.ecore.group.XCluster#getType <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' attribute.
* @see #getType()
* @generated
*/
void setType(String value);
} // XCluster
|
package gugutech.elseapp.controller;
import gugutech.elseapp.model.UserUserT;
import gugutech.elseapp.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Created by ali4 on 2015/8/12.
*/
@Controller
@RequestMapping(value = "user")
public class UserController {
private UserService userService;
public UserController(){
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"classpath:conf/spring.xml","classpath:conf/spring-mybatis.xml"});
userService = (UserService)applicationContext.getBean("userServiceImpl");
}
@RequestMapping(method = RequestMethod.GET,value = "/all")
@ResponseBody
public List<UserUserT> findAllUsers(){
return userService.findAllUsers();
}
}
|
package ru.mrequ.core;
public interface Drawer {
void drawText(String text);
void draw(GameObject o);
}
|
package business.api.exceptions;
public class NotFoundLessonIdException extends ApiException {
private static final long serialVersionUID = 2050228254550241644L;
public static final String DESCRIPTION = "The ID not was found, tray again";
public static final int CODE = 333;
public NotFoundLessonIdException() {
this("");
}
public NotFoundLessonIdException(String detail) {
super(DESCRIPTION + ". " + detail, CODE);
}
}
|
package com.espendwise.manta.util.validation.rules;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.persistence.EntityManager;
import org.apache.log4j.Logger;
import com.espendwise.manta.dao.AccountDAO;
import com.espendwise.manta.dao.AccountDAOImpl;
import com.espendwise.manta.dao.CatalogDAO;
import com.espendwise.manta.dao.CatalogDAOImpl;
import com.espendwise.manta.dao.ItemDAO;
import com.espendwise.manta.dao.ItemDAOImpl;
import com.espendwise.manta.dao.SiteDAO;
import com.espendwise.manta.dao.SiteDAOImpl;
import com.espendwise.manta.i18n.I18nUtil;
import com.espendwise.manta.model.data.BusEntityData;
import com.espendwise.manta.model.data.CatalogStructureData;
import com.espendwise.manta.model.data.ItemMappingData;
import com.espendwise.manta.model.view.BatchOrderView;
import com.espendwise.manta.model.view.CatalogView;
import com.espendwise.manta.model.view.SiteAccountView;
import com.espendwise.manta.service.EventService;
import com.espendwise.manta.support.spring.ServiceLocator;
import com.espendwise.manta.util.DelimitedParser;
import com.espendwise.manta.util.RefCodeNames;
import com.espendwise.manta.util.Utility;
import com.espendwise.manta.util.arguments.Args;
import com.espendwise.manta.util.criteria.CatalogSearchCriteria;
import com.espendwise.manta.util.criteria.StoreSiteCriteria;
import com.espendwise.manta.util.trace.ExceptionReason;
import com.espendwise.manta.util.validation.ValidationRule;
import com.espendwise.manta.util.validation.ValidationRuleResult;
public class BatchOrderSaveConstraint implements ValidationRule {
private static final Logger logger = Logger.getLogger(BatchOrderSaveConstraint.class);
private BatchOrderView batchOrderView;
private EntityManager entityManager;
private Locale locale;
public interface COLUMN {
public static final int
ACCOUNT_ID = 0,
SITE_REF_NUM = 1,
DIST_SKU = 2,
QUANTITY = 3,
PO_NUM = 4,
DIST_UOM = 5,
VERSION = 6,
SITE_ID = 7,
STORE_SKU = 8;
}
/** Holds value of property sepertorChar. */
static char sepertorChar = ',';
/** Holds value of property quoteChar. */
static char quoteChar = '\"';
private Map<InboundBatchOrderData, String> lineNumberMap = new HashMap<InboundBatchOrderData, String>();
private List<InboundBatchOrderData> parsedObjects = new ArrayList<InboundBatchOrderData>();
private ValidationRuleResult result;
private boolean isVersion1 = true;
private int columnCount = 0;
public BatchOrderSaveConstraint(BatchOrderView batchOrderView, EntityManager entityManager, Locale locale) {
this.batchOrderView = batchOrderView;
this.entityManager = entityManager;
this.locale = locale;
}
public ValidationRuleResult apply() {
logger.info("apply()=> BEGIN");
result = new ValidationRuleResult();
InputStream inputStream = null;
try{
boolean fileFormatIssue = true;
int i = batchOrderView.getFileName().lastIndexOf('.');
if (i > 0){
String fileExtension = batchOrderView.getFileName().substring(i).toLowerCase();
if (fileExtension.equals(".txt") || fileExtension.equals(".csv")){
fileFormatIssue = false;
}
}
if (fileFormatIssue){
String message = I18nUtil.getMessage(locale, "validation.web.batchOrder.error.mustBeCsvOrTxtFileFormat");
appendErrors(message);
return result;
}
inputStream = new BufferedInputStream(new ByteArrayInputStream(batchOrderView.getFileBinaryData()));
if (inputStream.available() == 0){
appendErrors("Stream size is 0 - " +batchOrderView.getFileName());
return result;
}
Reader reader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader r = new BufferedReader(reader);
int lineCount = 0;
String line = null;
while ((line = r.readLine()) != null) {
if (lineCount++ == 0) {// skip header
if (line.length() < 4){
appendErrors("Data has less than 4 required columns");
}
continue;
}
List l = DelimitedParser.parse(line, sepertorChar,quoteChar,true);
if (lineCount == 2){
columnCount = l.size();
if (columnCount > COLUMN.VERSION && l.get(COLUMN.VERSION) != null){
String version = (String)l.get(COLUMN.VERSION);
if (version.equals("1"))
isVersion1 = true;
else if (version.equals("2"))
isVersion1 = false;
else{
appendErrors("Version Num (" + version + ") should be 1 or 2");
break;
}
}
}
parseLine(l, lineCount);
}
if (result.isFailed()) {
return result;
}
validateBusEntitiesAndItems();
if (result.isFailed()) {
return result;
}
logger.info("apply()=> END, SUCCESS");
result.success();
} catch (Exception e){
e.printStackTrace();
appendErrors("Unexpected Error - " + e.getMessage());
return result;
} finally {
if (inputStream != null){
try{
inputStream.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
}
return result;
}
private void validateBusEntitiesAndItems() {
List<Long> accountIdList = new ArrayList<Long>();
List<Long> accountNotExistList = new ArrayList<Long>();
Map<String, Long> siteMap = new HashMap<String, Long>();
Map<String, Long> shoppingCatalogMap = new HashMap<String, Long>();
String preSiteKey = null;
// get list of account ids that associated with the store and use it to validate input account id
AccountDAO accountDao = new AccountDAOImpl(entityManager);
List<Long> acctIdsAssocWithStore = null;
if (isVersion1)
acctIdsAssocWithStore = accountDao.findAccountIdsByStore(batchOrderView.getStoreId());
SiteDAO siteDao = new SiteDAOImpl(entityManager);
CatalogDAO catalogDAO = new CatalogDAOImpl(entityManager);
ItemDAO itemDAO = new ItemDAOImpl(entityManager);
Map<String, InboundBatchOrderData> orderItems = null;
List<Map<String, InboundBatchOrderData>> orders = new ArrayList<Map<String, InboundBatchOrderData>>();
Iterator<InboundBatchOrderData> it = parsedObjects.iterator();
while(it.hasNext()){
InboundBatchOrderData flat =(InboundBatchOrderData) it.next();
if (isVersion1){
if (accountNotExistList.contains(flat.getAccountId()))
continue;
else if (!accountIdList.contains(flat.getAccountId())){
if (!acctIdsAssocWithStore.contains(flat.getAccountId())){
accountNotExistList.add(flat.getAccountId());
appendErrors(flat, "validation.web.batchOrder.error.accountIdNotExistInPrimaryEntity", flat.getAccountId(), batchOrderView.getStoreId());
continue;
}
BusEntityData accounD = accountDao.findAccountById(flat.getAccountId());
if (accounD.getBusEntityStatusCd().equals(RefCodeNames.BUS_ENTITY_STATUS_CD.INACTIVE)){
accountNotExistList.add(flat.getAccountId());
appendErrors(flat, "validation.web.batchOrder.error.noneActiveAccountFoundForAccountId", flat.getAccountId());
continue;
}
accountIdList.add(flat.getAccountId());
}
}
String siteKey = flat.getSiteKey();
if (!siteMap.containsKey(siteKey)){
StoreSiteCriteria siteCriteria = new StoreSiteCriteria();
siteCriteria.setStoreId(batchOrderView.getStoreId());
siteCriteria.setActiveOnly(true);
if (isVersion1){
siteCriteria.setAccountIds(Utility.toList(flat.getAccountId()));
siteCriteria.setRefNums(Utility.toList(flat.getSiteRefNum()));
} else {
siteCriteria.setSiteIds(Utility.toList(flat.getSiteId()));
}
List<SiteAccountView> sites = siteDao.findSites(siteCriteria);
if (sites.isEmpty()){
appendErrors(flat, "validation.web.batchOrder.error.failedToFindActiveLocation");
}else if (sites.size() > 1){
appendErrors(flat, "validation.web.batchOrder.error.multipleLocationsMatched");
}else{
Long siteId = sites.get(0).getBusEntityData().getBusEntityId();
siteMap.put(siteKey, siteId);
CatalogSearchCriteria catalogCriteria = new CatalogSearchCriteria(2);
catalogCriteria.setConfiguredOnly(true);
catalogCriteria.setSiteId(siteId);
catalogCriteria.setActiveOnly(true);
List<CatalogView> catalogs = catalogDAO.findCatalogsByCriteria(catalogCriteria);
if (catalogs.isEmpty()){
appendErrors(flat, "validation.web.batchOrder.error.failedToFindActiveShoppingCatalog");
}else if (catalogs.size() > 1){
appendErrors(flat, "validation.web.batchOrder.error.multipleShoppingCatalogMatched");
}else{
shoppingCatalogMap.put(siteKey, catalogs.get(0).getCatalogId());
}
}
}
if (siteMap.containsKey(siteKey) && shoppingCatalogMap.containsKey(siteKey)){
List<Long> itemIds = new ArrayList<Long>();
if (isVersion1){
List<ItemMappingData> items = itemDAO.getDistItemMapping((Long)shoppingCatalogMap.get(siteKey), flat.distSku, flat.distUom);
for (ItemMappingData item : items){
itemIds.add(item.getItemId());
}
}else{
CatalogStructureData item = itemDAO.getCatalogItemByStoreSku((Long)shoppingCatalogMap.get(siteKey), flat.storeSku);
if (item != null)
itemIds.add(item.getItemId());
}
if (itemIds.size() == 0)
appendErrors(flat, "validation.web.batchOrder.error.itemNotInShoppingCatalog");
else if (itemIds.size() > 1)
appendErrors(flat, "validation.web.batchOrder.error.multipleItemsMatched");
else {
if (!siteKey.equals(preSiteKey)){
preSiteKey = siteKey;
orderItems = new HashMap<String, InboundBatchOrderData>();
orders.add(orderItems);
}
InboundBatchOrderData existItem = orderItems.get(flat.getItemKey());
if (existItem != null){ // consolidate the same items in a order
existItem.qty += flat.qty;
}else{
orderItems.put(flat.getItemKey(), flat);
}
}
}
}
batchOrderView.setOrderCount(orders.size());
}
private void parseLine(List pParsedLine, int lineNumber) {
InboundBatchOrderData parsedObj = new InboundBatchOrderData();
lineNumberMap.put(parsedObj, lineNumber+"");
int columnCount = pParsedLine.size();
if (columnCount > COLUMN.ACCOUNT_ID && pParsedLine.get(COLUMN.ACCOUNT_ID) != null){
try{
parsedObj.setAccountId(new Integer((String)pParsedLine.get(COLUMN.ACCOUNT_ID)).intValue());
}catch(Exception e){
appendErrors(parsedObj, "validation.web.batchOrder.error.errorParsingAccountId", pParsedLine.get(COLUMN.ACCOUNT_ID));
parsedObj.setAccountId(-1);
}
}
if (columnCount > COLUMN.SITE_REF_NUM && pParsedLine.get(COLUMN.SITE_REF_NUM) != null)
parsedObj.setSiteRefNum((String)pParsedLine.get(COLUMN.SITE_REF_NUM));
if (columnCount > COLUMN.DIST_SKU && pParsedLine.get(COLUMN.DIST_SKU) != null)
parsedObj.setDistSku((String)pParsedLine.get(COLUMN.DIST_SKU));
if (columnCount > COLUMN.QUANTITY){
if (pParsedLine.get(COLUMN.QUANTITY) == null){
appendErrors(parsedObj, "validation.web.batchOrder.error.positiveQtyExpectedOnColumn", (COLUMN.QUANTITY +1));
}else{
try{
parsedObj.setQty(new Integer((String)pParsedLine.get(COLUMN.QUANTITY)).intValue());
if (parsedObj.qty <= 0){
appendErrors(parsedObj, "validation.web.batchOrder.error.positiveQtyExpectedOnColumn", (COLUMN.QUANTITY +1));
}
}catch(Exception e){
appendErrors(parsedObj, "validation.web.batchOrder.error.errorParsingQty", pParsedLine.get(COLUMN.QUANTITY));
parsedObj.setQty(-1);
}
}
}
if (columnCount > COLUMN.PO_NUM && pParsedLine.get(COLUMN.PO_NUM) != null){
String poNum = (String) pParsedLine.get(COLUMN.PO_NUM);
if (Utility.isSet(poNum) && poNum.length() > 22){
appendErrors(parsedObj, "validation.web.batchOrder.error.poNumShouldNotExceed22Characters", pParsedLine.get(COLUMN.PO_NUM));
}else{
parsedObj.setPoNum(((String)pParsedLine.get(COLUMN.PO_NUM)));
}
}
if (columnCount > COLUMN.DIST_UOM && pParsedLine.get(COLUMN.DIST_UOM) != null)
parsedObj.setDistUom(((String)pParsedLine.get(COLUMN.DIST_UOM)));
if (columnCount > COLUMN.SITE_ID && pParsedLine.get(COLUMN.SITE_ID) != null){
try{
parsedObj.setSiteId(new Long((String)pParsedLine.get(COLUMN.SITE_ID)).longValue());
}catch(Exception e){
appendErrors(parsedObj, "validation.web.batchOrder.error.errorParsingSiteId", pParsedLine.get(COLUMN.SITE_ID));
parsedObj.setSiteId(-1);
}
}
if (columnCount > COLUMN.STORE_SKU && pParsedLine.get(COLUMN.STORE_SKU) != null){
try{
parsedObj.setStoreSku(new Long((String)pParsedLine.get(COLUMN.STORE_SKU)).longValue());
}catch(Exception e){
appendErrors(parsedObj, "validation.web.batchOrder.error.errorParsingStoreSku", pParsedLine.get(COLUMN.STORE_SKU));
parsedObj.setStoreSku(-1);
}
}
processParsedObject(parsedObj);
}
protected void processParsedObject(Object pParsedObject) {
InboundBatchOrderData parsedObj = (InboundBatchOrderData) pParsedObject;
if (isVersion1){
if (parsedObj.getAccountId()==0){
appendErrors(parsedObj, "validation.web.batchOrder.error.accountIdExpectedOnColumn", (COLUMN.ACCOUNT_ID+1));
}
if (!Utility.isSet(parsedObj.siteRefNum)){
appendErrors(parsedObj, "validation.web.batchOrder.error.locationRefNumExpectedOnColumn", (COLUMN.SITE_REF_NUM +1));
}
if (!Utility.isSet(parsedObj.distSku)){
appendErrors(parsedObj, "validation.web.batchOrder.error.distSkuExpectedOnColumn", (COLUMN.DIST_SKU +1));
}
} else {
if (parsedObj.siteId==0){
appendErrors(parsedObj, "validation.web.batchOrder.error.siteIdExpectedOnColumn", (COLUMN.SITE_ID +1));
}
if (parsedObj.storeSku==0){
appendErrors(parsedObj, "validation.web.batchOrder.error.storeSkuExpectedOnColumn", (COLUMN.STORE_SKU +1));
}
}
parsedObjects.add(parsedObj);
}
// add error message
private void appendErrors(InboundBatchOrderData flat, String messageKey, Object... args) {
String lineNum = lineNumberMap.get(flat);
String message = I18nUtil.getMessage(locale, messageKey, args);
String errMsg = "Error at line# " +lineNum + " : " + message;
logger.info(errMsg);
result.failed(ExceptionReason.BatchOrderReason.ERROR_ON_LINE,
Args.typed(lineNum, message));
}
private void appendErrors(String message) {
String errMsg = "";
errMsg += "Error: " + message;
logger.info(errMsg);
result.failed(ExceptionReason.BatchOrderReason.GENERAL_ERROR,
Args.typed(message));
}
public class InboundBatchOrderData {
private long accountId;
private String siteRefNum;
private String poNum;
private String distSku;
private int qty;
private String distUom = null;
private long siteId;
private long storeSku;
public String toString(){
return "InboundBatchOrderData: accountId="+ accountId + ", siteRefNum=" + siteRefNum +
", poNum=" + poNum + ", distSku=" + distSku + ", distUom=" + distUom + ", qty="+ qty + ", siteId="+ siteId +
", storeSku="+ storeSku;
}
private String getSiteKey(){
String key = accountId+":";
if (isVersion1){
key += siteRefNum;
}else{
key += siteId;
}
if (Utility.isSet(poNum))
return key + ":" + poNum;
else
return key;
}
private String getItemKey(){
if (isVersion1){
if (Utility.isSet(distUom))
return distSku+":"+ distUom;
else
return distSku;
}else{
return storeSku+"";
}
}
public void setAccountId(long accountId) {
this.accountId = accountId;
}
public long getAccountId() {
return accountId;
}
public void setSiteRefNum(String siteRefNum) {
this.siteRefNum = siteRefNum;
}
public String getSiteRefNum() {
return siteRefNum;
}
public void setPoNum(String poNum) {
this.poNum = poNum;
}
public String getPoNum() {
return poNum;
}
public void setDistSku(String distSku) {
this.distSku = distSku;
}
public String getDistSku() {
return distSku;
}
public void setQty(int qty) {
this.qty = qty;
}
public int getQty() {
return qty;
}
public void setDistUom(String distUom) {
this.distUom = distUom;
}
public String getDistUom() {
return distUom;
}
public void setSiteId(long siteId) {
this.siteId = siteId;
}
public long getSiteId() {
return siteId;
}
public void setStoreSku(long storeSku) {
this.storeSku = storeSku;
}
public long getStoreSku() {
return storeSku;
}
}
public EventService getEventService() {
return ServiceLocator.getEventService();
}
}
|
package banking.exceptions.account_exceptions;
public class AccountDoesntExistException extends Exception {
/**
*
*/
private static final long serialVersionUID = -8267845269358150548L;
}
|
package jp.smartcompany.job.modules.core.manager.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jp.smartcompany.job.modules.core.CoreBean;
import jp.smartcompany.job.modules.core.dao.ErrorAuditDao;
import jp.smartcompany.job.modules.core.manager.ErrorAuditManager;
import jp.smartcompany.job.modules.core.pojo.entity.ErrorAuditDO;
import jp.smartcompany.job.util.SysUtil;
import org.springframework.stereotype.Repository;
/**
* @author Xiao Wenpeng
*/
@Repository(CoreBean.Manager.ERROR_AUDIT)
public class ErrorAuditManagerImpl extends ServiceImpl<ErrorAuditDao, ErrorAuditDO> implements ErrorAuditManager {
@Override
public IPage<ErrorAuditDO> listByPage(String keyword, String startTime, String endTime, IPage<ErrorAuditDO> p) {
String keywordLike = "%"+keyword+"%";
QueryWrapper<ErrorAuditDO> queryWrapper = SysUtil.query();
queryWrapper.apply(StrUtil.isNotBlank(keyword), "lower(username) like {0} or lower(called_method) like {1} or lower(url) like {2} or lower(ip) like {3} or lower(user_agent) like {4} or lower(message) like {5}",keywordLike,keywordLike,keywordLike,keywordLike,keywordLike,keywordLike);
if (StrUtil.isNotBlank(startTime)&&StrUtil.isNotBlank(endTime)) {
queryWrapper.or().between("create_time", startTime, endTime);
}
return page(
p,
queryWrapper
);
}
}
|
package cn.lucode.fastdev.redis.service;
import java.util.List;
import java.util.Set;
/**
* Created by yunfeng.lu on 2017/10/4.
*/
public interface IRedisOperation {
void setValue(String key,String value);
void setSetValue(String key,Long timeout,String... values);
/**
* 添加SET类型值
* @param key
* @param hashKey
* @param hashValue
*/
void setHashValue(String key,String hashKey,String hashValue);
void setValue(String key,String value,Long timeout);
String getValue(String key);
/**
* 设置set类型下的所有ITEM
* @param key
* @return
*/
Set<String> getSetValues(String key);
/**
* 获取指定的hash key下面的结果
* @param key
* @param hashKey
* @return
*/
String getHashValue(String key,String hashKey);
/**
* 批量获取执行的hash value
* @param key
* @param hashKeys
* @return
*/
List<String> mutiGetHashValue(String key,List<String> hashKeys);
/**
* 批量删除hash key
* @param key
* @param hashKey
*/
void removeHashEntry(String key,String... hashKey);
/**
* 获取当前key下面的所有hash keys
* @param key
* @return
*/
Set<String> getHashKeys(String key);
List<String> getValues(String prex);
void removeV(String key);
} |
package de.jmda.gen.java.impl;
import static de.jmda.core.util.StringUtil.sb;
import de.jmda.core.util.StringUtil;
import de.jmda.gen.GeneratorException;
import de.jmda.gen.impl.DefaultGenerator;
import de.jmda.gen.java.ParameterNameGenerator;
public class DefaultParameterNameGenerator
extends DefaultGenerator
implements ParameterNameGenerator
{
public final static String DEFAULT_PARAMETER_NAME = "parameter_name";
public DefaultParameterNameGenerator()
{
super();
}
public DefaultParameterNameGenerator(String input)
{
super(input);
}
@Override
public StringBuffer generate() throws GeneratorException
{
StringBuffer result = super.generate();
if (StringUtil.isBlank(result))
{
result = sb(DEFAULT_PARAMETER_NAME);
}
return validate(result);
}
protected StringBuffer validate(StringBuffer stringBuffer)
throws GeneratorException
{
if (false == StringUtil.startsWithLower(stringBuffer))
{
throw new GeneratorException(
stringBuffer + " has to start with lower case");
}
return stringBuffer;
}
} |
/*
* Copyright 2013 Cloudera.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kitesdk.data.spi;
import com.google.common.collect.Maps;
import java.net.URISyntaxException;
import java.util.Map;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class TestURIPattern {
private Map<String, String> expected = null;
@Before
public void setup() {
expected = Maps.newHashMap();
}
@Test
public void testNonAbsoluteExactMatch() throws URISyntaxException {
URIPattern pattern = new URIPattern("hive");
String uri = "hive";
Assert.assertTrue(pattern.matches(uri));
}
@Test
public void testSubURI() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme:*sub-uri");
String uri = "scheme:other-scheme:/path/to/data.avro";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
expected.put("sub-uri", "other-scheme:/path/to/data.avro");
Assert.assertEquals(expected, actual);
}
@Test
public void testStaticMatch() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme:static");
String uri = "scheme:static";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
Assert.assertEquals(expected, actual);
}
@Test
public void testPathGlob() throws URISyntaxException {
URIPattern pattern = new URIPattern("file:///*path");
String uri = "file:/path/to/data.avro";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "file");
expected.put("path", "path/to/data.avro");
Assert.assertEquals(expected, actual);
}
@Test
public void testPathVariables() throws URISyntaxException {
URIPattern pattern = new URIPattern("mysql:/:db/:table");
String uri = "mysql:/myDB/myTable";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "mysql");
expected.put("db", "myDB");
expected.put("table", "myTable");
Assert.assertEquals(expected, actual);
}
@Test
public void testEmptyPath() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme://authority");
String uri = "scheme://real-authority";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
expected.put("host", "real-authority");
Assert.assertEquals(expected, actual);
// should not match any path element or fragment
Assert.assertFalse(pattern.matches(uri + "/"));
Assert.assertFalse(pattern.matches("scheme:/"));
Assert.assertFalse(pattern.matches(uri + "/abc"));
Assert.assertFalse(pattern.matches(uri + "#fragment"));
}
@Test
public void testStaticPathStart() throws URISyntaxException {
URIPattern pattern = new URIPattern("mysql:/required/:db/:table");
String uri = "mysql:/required/myDB/myTable";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "mysql");
expected.put("db", "myDB");
expected.put("table", "myTable");
Assert.assertEquals(expected, actual);
Assert.assertNull(pattern.getMatch("mysql:/myDB/myTable"));
}
@Test
public void testStaticPathMixed() throws URISyntaxException {
URIPattern pattern = new URIPattern("mysql:/db/:db/table/:table");
String uri = "mysql:/db/myDB/table/myTable";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "mysql");
expected.put("db", "myDB");
expected.put("table", "myTable");
Assert.assertEquals(expected, actual);
Assert.assertNull(pattern.getMatch("mysql:/myDB/myTable"));
}
@Test
public void testStaticPathEnd() throws URISyntaxException {
URIPattern pattern = new URIPattern("mysql:/:db/:table/wtf");
String uri = "mysql:/myDB/myTable/wtf";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "mysql");
expected.put("db", "myDB");
expected.put("table", "myTable");
Assert.assertEquals(expected, actual);
Assert.assertNull(pattern.getMatch("mysql:/myDB/myTable"));
}
@Test
public void testPathVariablesWithGlob() throws URISyntaxException {
URIPattern pattern = new URIPattern("mysql:/:db/:table/*the-rest");
String uri = "mysql:/myDB/myTable/a/b/c";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "mysql");
expected.put("db", "myDB");
expected.put("table", "myTable");
expected.put("the-rest", "a/b/c");
Assert.assertEquals(expected, actual);
}
@Test
public void testDefaultAuthority() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme://user:pass:w0rd@host:3434/*path");
String uri = "scheme:/path/to/data.avro";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
expected.put("host", "host");
expected.put("port", "3434");
expected.put("username", "user");
expected.put("password", "pass:w0rd");
expected.put("path", "path/to/data.avro");
Assert.assertEquals(expected, actual);
}
@Test
public void testOverrideAuthority() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme://user:pass:w0rd@host:3434/*path");
String uri = "scheme://other:3435/path/to/data.avro";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
expected.put("host", "other");
expected.put("port", "3435");
expected.put("username", "user");
expected.put("password", "pass:w0rd");
expected.put("path", "path/to/data.avro");
Assert.assertEquals(expected, actual);
}
@Test
public void testDefaultQueryArgs() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme:/*path?custom-option=true&use-ssl=false");
String uri = "scheme:/path/to/data.avro";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
expected.put("path", "path/to/data.avro");
expected.put("custom-option", "true");
expected.put("use-ssl", "false");
Assert.assertEquals(expected, actual);
}
@Test
public void testOverrideQueryArgs() throws URISyntaxException {
URIPattern pattern = new URIPattern("scheme:/*path?custom-option=true&use-ssl=false");
String uri = "scheme:/path/to/data.avro?use-ssl=true";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "scheme");
expected.put("path", "path/to/data.avro");
expected.put("custom-option", "true");
expected.put("use-ssl", "true");
Assert.assertEquals(expected, actual);
}
@Test
public void testMixed() throws URISyntaxException {
URIPattern pattern = new URIPattern(
"mysql://cloudera:cloudera@db-host:3434/:db/:table/*the-rest?custom-option=true&use-ssl=false");
String uri =
"mysql://real-db-host/my-db/my-table?use-ssl=true";
Assert.assertTrue(pattern.matches(uri));
Map<String, String> actual = pattern.getMatch(uri);
expected.put("scheme", "mysql");
expected.put("host", "real-db-host");
expected.put("port", "3434");
expected.put("username", "cloudera");
expected.put("password", "cloudera");
expected.put("db", "my-db");
expected.put("table", "my-table");
expected.put("custom-option", "true");
expected.put("use-ssl", "true");
Assert.assertEquals(expected, actual);
}
// This is common in this type of matching, but the query part prevents it
// @Test
// public void testPathVariablesOptional() throws URISyntaxException {
// URIPattern pattern = new URIPattern("mysql:/:db/:table?");
// String uri = "mysql:/myDB/myTable";
// Assert.assertTrue(pattern.matches(uri));
// Map<String, String> actual = pattern.getMatch(uri);
// expected.put("db", "myDB");
// expected.put("table", "myTable");
// Assert.assertEquals(expected, actual);
//
// uri = "mysql:/myDB";
// Assert.assertTrue(pattern.matches(uri));
// actual = pattern.getMatch(uri);
// expected.put("scheme", "mysql");
// expected.put("db", "myDB");
// expected.put("table", "myTable");
// Assert.assertEquals(expected, actual);
// }
}
|
package com.example.admin.busmanagerproject;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import Adapter.AdapterNotification;
import DatabaseAdapter.DatabaseAdapter;
import Model.Employer;
import Model.Notification;
public class MainActivity extends AppCompatActivity {
String DATABASE_NAME="BusManager.sqlite";
SQLiteDatabase database;
ListView listView;
ArrayList<Notification> listnotificaition;
AdapterNotification adapternoti;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AddControl();
AddEvent();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
//getDataBaseContext();
getDatabaseNotification();
listView.setAdapter(adapternoti);
Intent intent=new Intent(MainActivity.this,Bus_List.class);
startActivity(intent);
}
private void AddEvent() {
listnotificaition=new ArrayList<>();
adapternoti=new AdapterNotification(MainActivity.this,R.layout.item_annoucement,listnotificaition);
}
private void AddControl() {
listView= (ListView) findViewById(R.id.listthongbao);
}
public int GetEmployer(int id,String password){
int employer_id=0;
try{
database=DatabaseAdapter.initDatabase(MainActivity.this,DATABASE_NAME);
Cursor cursor1 = database.rawQuery("SELECT * " +
"FROM Employer " +
"WHERE employer_Id = "+id
+" AND employer_Password = "+password,null);
if(cursor1!=null){
while(cursor1.moveToNext()){
employer_id=cursor1.getInt(0);
}
return employer_id;
}
}catch (Exception ex){
return 0;
}
return employer_id;
}
public void getDataBaseEmployer(){
database=DatabaseAdapter.initDatabase(MainActivity.this,DATABASE_NAME);
Cursor cursor=database.rawQuery("SELECT * FROM Employer WHERE admin_Id=1",null);
while(cursor.moveToNext()){
int em_Id=cursor.getInt(0);
String em_pass=cursor.getString(1);
String em_name=cursor.getString(2);
String em_birth=cursor.getString(3);
String em_phone=cursor.getString(4);
String em_email=cursor.getString(5);
String em_address=cursor.getString(6);
int em_departmentId=cursor.getInt(7);
int Admin_id=cursor.getInt(8);
Employer employer=new Employer(em_Id,em_name,em_pass,em_birth,em_phone,em_email,em_address,em_departmentId,Admin_id);
}
}
public void getDatabaseNotification(){
database=DatabaseAdapter.initDatabase(MainActivity.this,DATABASE_NAME);
Cursor cursor=database.rawQuery("SELECT * FROM Notification ",null);
while (cursor.moveToNext()){
int sothongbao=cursor.getInt(0);
String datethongbao=cursor.getString(1);
String noidungthongbao=cursor.getString(2);
int admin_id=cursor.getInt(3);
Notification noti=new Notification(sothongbao,datethongbao,noidungthongbao,admin_id);
listnotificaition.add(noti);
adapternoti.notifyDataSetChanged();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
package com.bw.movie.mvp.view.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.bw.movie.IView.IFeedBackView;
import com.bw.movie.R;
import com.bw.movie.mvp.model.bean.FeedBackBean;
import com.bw.movie.mvp.present.FeedBackPresent;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MyFeedActivity extends AppCompatActivity implements IFeedBackView {
@BindView(R.id.edit_feed)
EditText editFeed;
@BindView(R.id.edit_but)
Button editBut;
private FeedBackPresent feedBackPresent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_feed);
ButterKnife.bind(this);
initView();
initData();
}
private void initView() {
feedBackPresent = new FeedBackPresent(this);
}
private void initData() {
editBut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(editFeed.getText().equals("")){
Toast.makeText(MyFeedActivity.this, "请输入意见", Toast.LENGTH_SHORT).show();
}else {
String edit_feed = editFeed.getText().toString();
feedBackPresent.getfeedback(edit_feed);
}
/*SharedPreferences user = getSharedPreferences("user", Context.MODE_PRIVATE);
boolean isLogin = user.getBoolean("isLogin", true);
if(isLogin){
}else {
Toast.makeText(MyFeedActivity.this, "请先登录", Toast.LENGTH_SHORT).show();
}*/
}
});
}
@Override
public void success(FeedBackBean feedBackBean) {
String message = feedBackBean.getMessage();
String status = feedBackBean.getStatus();
Log.i("message", "success: FeedBackBean==="+message+status);
Toast.makeText(this, ""+message, Toast.LENGTH_SHORT).show();
startActivity(new Intent(this,MyFeedsActivity.class));
}
@Override
public void Error(String msg) {
}
}
|
package com.ar.cmsistemas.bean;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import com.ar.cmsistemas.service.CiudadService;
@ManagedBean(name = "altaCiudadBean")
@ViewScoped
public class AltaCiudadBean {
private String ciudad;
public String getCiudad() {
return ciudad;
}
public void setCiudad(String ciudad) {
this.ciudad = ciudad;
}
public void guardar(){
CiudadService service = new CiudadService();
service.saveCiudad(ciudad);
}
}
|
package com.tencent.mm.plugin.wallet_payu.bind.model;
import android.os.Bundle;
import com.tencent.mm.plugin.wallet_payu.pwd.a.a;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.wallet_core.d.i;
class c$1 extends a {
final /* synthetic */ c pEf;
c$1(c cVar, MMActivity mMActivity, i iVar, Bundle bundle) {
this.pEf = cVar;
super(mMActivity, iVar, bundle);
}
public final CharSequence ui(int i) {
if (i == 0) {
return this.fEY.getString(com.tencent.mm.plugin.wxpay.a.i.wallet_check_pwd_bind_bankcard_tip_payu);
}
return super.ui(i);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Task4 {
/*4. Ввести целое число в консоли. Если оно является
положительным, то прибавить к нему 1; если
отрицательным, то вычесть из него 2; если нулевым,
то заменить его на 10. Вывести полученное число.*/
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sNum = reader.readLine();
int nNum = Integer.parseInt(sNum);
if (nNum > 0) {
nNum += 1;
} else if (nNum == 0) {
nNum = 10;
} else {
nNum -= 2;
}
System.out.println(nNum);
}
}
|
package checkers;
public interface CheckersClient {
void setColor(int color);
void boardNotify(Move move);
Move getMove();
}
|
package com.ecomm.config;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.ecomm.entity.Category;
import com.ecomm.entity.Customer;
import com.ecomm.entity.Product;
import com.ecomm.entity.Supplier;
@Configuration
@EnableTransactionManagement
@ComponentScan("com.ecomm")
public class DBConn
{
@Bean
public DataSource getMySQLDataSource()
{
DriverManagerDataSource dataSource=new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/PROJECT");
dataSource.setUsername("root");
dataSource.setPassword("12345");
System.out.println("==Data Source Created===");
return dataSource;
}
@Bean
public SessionFactory getSessionFactory()
{
Properties hibernateProp=new Properties();
hibernateProp.put("hbm2ddl.auto", "update");
hibernateProp.put("hibernate.dialect","org.hibernate.dialect.MySQL8Dialect");
LocalSessionFactoryBuilder factoryMgr=new LocalSessionFactoryBuilder(getMySQLDataSource());
factoryMgr.addProperties(hibernateProp);
factoryMgr.addAnnotatedClass(Category.class);
factoryMgr.addAnnotatedClass(Customer.class);
factoryMgr.addAnnotatedClass(Supplier.class);
factoryMgr.addAnnotatedClass(Product.class);
System.out.println("=== SessionFactory Object Created====");
return factoryMgr.buildSessionFactory();
}
@Bean(name="txManager")
public HibernateTransactionManager getHibernateTransactionManager(SessionFactory sessionFactory)
{
HibernateTransactionManager tranMgr=new HibernateTransactionManager(sessionFactory);
System.out.println("==== Transaction Manager Object Created====");
return tranMgr;
}
}
|
package receiver;
import java.util.ArrayList;
import shipment.Shipment;
public abstract class Receiver {
private ArrayList<Shipment> shipments;
private int[] preferredDeliveryTime;
public Receiver(int[] preferredDeliveryTime) {
shipments = new ArrayList<Shipment>();
this.preferredDeliveryTime=preferredDeliveryTime;
}
public boolean Recieve(Shipment shipment) {
return true;
}
public ArrayList<Shipment> getShipments() {
return shipments;
}
public void addShipment(Shipment shipment) {
shipments.add(shipment);
}
public int[] getPreferredDeliveryTime() {
return preferredDeliveryTime;
}
}
/*TODO
* get familiar with Git basic commands
* fields must be private
* discuss the import from other packages
* the commenting methods
* no objects created from abstract classes
*/
|
package Structural.Bridge;
import org.omg.CORBA.OBJ_ADAPTER;
/**
*
* Bridge pattern decouples abstraction from it's implementation.
* so that they can change independently.
*
* it is mainly used to implement platform independence feature.
*
* Abstractor, RefinedAbstractor, Implementor, ConcreteImplementor.
*
* In this pattern, composition is used in abstraction's implementation
* to hold reference of implementor.
*
*
*/
public class BridgePattern {
public static void main(String[] args) {
FileDownloaderImplementor windows = new WindowsDownloaderImplementor();
FileDownloaderAbstraction abstraction = new FileDownloaderAbstractionImpl(windows);
abstraction.download("path");
abstraction.store(new Object());
}
}
|
/**
* ClassName: package-info<br/> Function: TODO: ADD FUNCTION. <br/> Reason: TODO: ADD REASON.
* <br/> Date: 2018年09月21日 17:22 <br/>
*
* @author lcc
* @version
* @see
* @since
*/
package com.example.javax; |
package valatava.lab.warehouse.service.dto;
import java.util.Set;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import lombok.Data;
/**
* A DTO representing a user, with his authorities.
*
* @author Yuriy Govorushkin
*/
@Data
public class UserDTO {
private Long id;
@NotBlank
private String login;
@Email
private String email;
private String firstName;
private String lastName;
private boolean activated = false;
private Set<String> authorities;
}
|
package com.gm.wj.controller;
import cn.hutool.json.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gm.wj.entity.User;
import com.gm.wj.result.Result;
import com.gm.wj.service.UserService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mockito;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.RequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import javax.servlet.http.Cookie;
import static org.hamcrest.CoreMatchers.is;
/**
* @author Evan
* @date 2020/11/9 21:42
*
* A failed attempt at unit testing of controllers.
*/
//@SpringBootTest
@RunWith(SpringRunner.class)
@WebMvcTest(value = LoginController.class)
public class LoginControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private UserService userService;
@Test
public void testLogin_Normal() throws Exception {
User testUser = User.builder()
.username("test").password("123").build();
Mockito.when(userService.findByUsername("test")).thenReturn(testUser);
String JSON = "{\"username\":\"test\",\"password\":\"123\"}";
RequestBuilder requestBuilder = MockMvcRequestBuilders.post("/api/login")
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE).content(JSON)
.contentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
MvcResult result = mockMvc.perform(requestBuilder).andReturn();
MockHttpServletResponse response = result.getResponse();
Assert.assertEquals(HttpStatus.OK.value(), response.getStatus());
System.out.println(result.getResponse().getContentAsString() + "11111111111");
String expected = "{\"code\":200,\"message\":\"成功\",\"result\":\"test\"}";
JSONAssert.assertEquals(expected, result.getResponse().getContentAsString(), false);
}
}
|
package com.gabriel.paiva.cursomc.cursomc.enums;
import java.io.Serializable;
public enum TipoCliente {
PESSOAFISICA (1, "Pessoa física"),
PESSOAJURIDICA (2, "Pessoa jurídica");
private Integer code;
private String descricao;
private TipoCliente(Integer code, String descricao) {
this.code = code;
this.descricao = descricao;
}
public Integer getCode() {
return code;
}
public String getDescricao() {
return descricao;
}
public static TipoCliente toEnum(Integer code){
if(code == null)
return null;
for(TipoCliente tipoCliente : TipoCliente.values()){
if(tipoCliente.getCode().equals(code)){
return tipoCliente;
}
}
throw new IllegalArgumentException("Codigo inválido:" + code);
}
}
|
/**
*
*/
/**
* @author sameerkhurana10
*
*/
package VSMFeatureDictionary; |
package controllers;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import models.Entity;
import tools.AuthTool;
import tools.EntityTool;
import tools.PropertyTool;
import tools.SaverTool;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
/**
* Main controller. Responsible for creating, editing, deleting entities.
*/
public class MainController {
@FXML
private ListView<Entity> myListView = new ListView<>();
@FXML
private TextArea myTextArea;
/**
* FXML loader.
*/
private FXMLLoader fxmlLoader;
/**
* Parent edit.
*/
private Parent fxmlEdit;
/**
* Parent exit.
*/
private Parent fxmlQuit;
/**
* Edit Controller.
*/
private EditController editController;
/**
* Exit conformation controller.
*/
private ExitConformationController exitConformationController;
@FXML
private AnchorPane anchorPane;
/**
* Observable List which contains entities.
*/
private ObservableList<Entity> obList = FXCollections
.observableArrayList(new ArrayList<>());
/**
* Rename stage.
*/
private Stage renameListViewStage;
/**
* Exit stage.
*/
private Stage exitStage;
@FXML
private void initialize() {
loadEntities();
initStartData();
initListeners();
initEditStage();
initExitConformationStage();
}
/**
* Load entities from xml.
*/
private void loadEntities() {
obList.addAll(new EntityTool(true).loadEntities());
}
/**
* Init start data.
*/
private void initStartData() {
Entity info = new Entity("info",
"Для добавления новой записи нажмите 'Add'.\n" +
"Чтобы переименновать существующую запись дважды кликните по \nней или используйте контекстным меню 'Edit'.\n" +
"Для загрузки/сохранения/удаления записи используйте контекстным \nменю 'Edit'.\n" +
"Для выбора режима выхода из этого восхитительного приложения \nиспользуйте контекстным меню 'Quit'.\n");
obList.add(info);
obList.add(new Entity("Новая запись..."));
myListView.setItems(obList);
}
/**
* Init listeners.
*/
private void initListeners() {
myListView.getSelectionModel().getSelectedItems()
.addListener(new ListChangeListener<Entity>() {
@Override
public void onChanged(Change<? extends Entity> c) {
String text = myListView
.getFocusModel()
.getFocusedItem()
.getValue();
myTextArea.setText(text);
}
});
myTextArea.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(
ObservableValue<? extends String> observable,
String oldValue, String newValue) {
if (myListView.getFocusModel().getFocusedItem() != null) {
Entity currentEntity = myListView.getFocusModel()
.getFocusedItem();
currentEntity.setValue(newValue);
ObservableList<Entity> tL = myListView.getItems();
for (int i = 0; i < tL.size(); i++) {
if (currentEntity.equals(tL.get(i))) {
tL.set(i, currentEntity);
}
}
myListView.setItems(tL);
}
}
});
anchorPane.sceneProperty().addListener(new ChangeListener<Scene>() {
@Override
public void changed(ObservableValue<? extends Scene> observable, Scene oldValue, Scene newValue) {
if (oldValue == null && newValue != null) {
// scene is set for the first time. Now its the time to listen stage changes.
newValue.windowProperty().addListener((observableWindow, oldWindow, newWindow) -> {
if (oldWindow == null && newWindow != null) {
// stage is set. now is the right time to do whatever we need to the stage in the controller.
((Stage) newWindow).setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
SaverTool.saveAllEntities(myListView.getItems());
}
});
}
});
}
}
});
}
/**
* Init edit stage.
*/
private void initEditStage() {
try {
fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/views/Edit.fxml"));
fxmlEdit = fxmlLoader.load();
editController = fxmlLoader.getController();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Init exit conformation stage.
*/
private void initExitConformationStage() {
try {
fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/views/ConfirmExit.fxml"));
fxmlQuit = fxmlLoader.load();
exitConformationController = fxmlLoader.getController();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Add value in ListView.
* @param actionEvent actionEvent
*/
public void addSomeValues(ActionEvent actionEvent) {
obList.add(new Entity("Новая запись (" + (myListView.getItems().size()) + ")"));
myListView.setItems(obList);
}
/**
* On mouse click on item list view.
* @param mouseEvent mouse event
*/
public void onClick(MouseEvent mouseEvent) {
if (mouseEvent.getClickCount() == 2) {
Entity currentEntity = myListView.getFocusModel().getFocusedItem();
if (currentEntity != null && !currentEntity.getName().equals("info")) {
showEditDialog(currentEntity);
}
}
}
/**
* Show edit dialog.
* @param currentEntity Entity
*/
private void showEditDialog(Entity currentEntity) {
if (renameListViewStage == null) {
renameListViewStage = new Stage();
renameListViewStage.setTitle("Edit");
renameListViewStage.setMinHeight(130);
renameListViewStage.setMinWidth(300);
renameListViewStage.setResizable(false);
renameListViewStage.setScene(new Scene(fxmlEdit));
renameListViewStage.initModality(Modality.WINDOW_MODAL);
renameListViewStage.initOwner(myListView.getScene().getWindow());
}
editController.setEntity(currentEntity);
renameListViewStage.showAndWait();
myListView.refresh();
}
/**
* Rename entity from menu bar.
* @param actionEvent action event
*/
public void renameFromMenuBar(ActionEvent actionEvent) {
Entity currentEntity = myListView.getFocusModel().getFocusedItem();
if (currentEntity != null) {
showEditDialog(currentEntity);
}
}
/**
* Save entity from menu bar.
* @param actionEvent action event
*/
public void saveFromMenuBar(ActionEvent actionEvent) {
Entity currentEntity = myListView.getFocusModel().getFocusedItem();
SaverTool.saveEntity(currentEntity);
}
/**
* Delete entity from menu bar.
* @param actionEvent
*/
public void deleteFromMenuBar(ActionEvent actionEvent) {
Entity currentEntity = myListView.getFocusModel().getFocusedItem();
if (myListView.getItems().size() > 2
&& currentEntity != null) {
ObservableList<Entity> entities = myListView.getItems();
entities.remove(currentEntity);
myListView.setItems(entities);
}
}
/**
* Load entity from disk.
* @param actionEvent actionEvent
*/
public void loadFromMenuBar(ActionEvent actionEvent) {
FileChooser fileChooser = new FileChooser();
File file = fileChooser.showOpenDialog(myListView.getScene().getWindow());
if (file != null && file.length() > 0) {
EntityTool readTool = new EntityTool(true);
Entity entityFromDisk = readTool.readEntityXML(file);
ObservableList<Entity> entities = myListView.getItems();
entities.add(entityFromDisk);
myListView.setItems(entities);
myListView.refresh();
}
}
/**
* Init exit stage.
*/
private void initExitStage() {
if (exitStage == null) {
exitStage = new Stage();
exitStage.setTitle("Confirm quit");
exitStage.setResizable(false);
exitStage.setScene(new Scene(fxmlQuit));
exitStage.initModality(Modality.WINDOW_MODAL);
exitStage.initOwner(myListView.getScene().getWindow());
}
}
/**
* Quit application without save any change.
* @param actionEvent actionEvent
*/
public void quitWithoutSave(ActionEvent actionEvent) {
initExitStage();
exitStage.showAndWait();
Platform.exit();
}
/**
* Quit application with save current file.
* @param actionEvent actionEvent
*/
public void quitAndSaveCurrent(ActionEvent actionEvent) {
initExitStage();
Entity currentEntity = myListView.getFocusModel().getFocusedItem();
exitConformationController.setEntity(currentEntity);
exitStage.showAndWait();
Platform.exit();
}
/**
* Quit application with save all files.
* @param actionEvent
*/
public void quitAndSaveAll(ActionEvent actionEvent) {
initExitStage();
exitConformationController.setEntities(myListView.getItems());
exitStage.showAndWait();
Platform.exit();
}
}
|
import club.ximeng.util.IdCardUtil;
import org.junit.Test;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
/**
* 身份证单元测试
*
* @author liu xm
* @date 2021/3/23 13:19
*/
public class IdCardUtilTest {
private static final String ID_18 = "321083197812162119";
private static final String ID_15 = "372901880730303";
@Test
public void isValidCardTest() {
boolean valid = IdCardUtil.isValidCard(ID_18);
System.out.println(valid);
boolean valid15 = IdCardUtil.isValidCard(ID_15);
System.out.println(valid15);
// 无效
String idCard = "360198910283844";
System.out.println(IdCardUtil.isValidCard(idCard));
// 生日无效
idCard = "201511221897205960";
System.out.println(IdCardUtil.isValidCard(idCard));
// 生日无效
idCard = "815727834224151";
System.out.println(IdCardUtil.isValidCard(idCard));
}
@Test
public void convert15To18Test() {
String convert15To18 = IdCardUtil.convert15To18(ID_15);
System.out.println(convert15To18);
String convert15To18Second = IdCardUtil.convert15To18("330102200403064");
System.out.println(convert15To18Second);
IdCardUtil.convert15To18(null);
}
@Test
public void getAgeByIdCardTest() {
long date = LocalDate.parse("2017-04-10", DateTimeFormatter.ofPattern("yyyy-MM-dd"))
.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli();
int age = IdCardUtil.getAgeByIdCard(ID_18, date);
System.out.println(age);
int age2 = IdCardUtil.getAgeByIdCard(ID_15, date);
System.out.println(age2);
}
@Test
public void getBirthByIdCardTest() {
String birth = IdCardUtil.getBirthByIdCard(ID_18);
System.out.println(birth);
String birth2 = IdCardUtil.getBirthByIdCard(ID_15);
System.out.println(birth2);
}
@Test
public void getProvinceByIdCardTest() {
String province = IdCardUtil.getProvinceByIdCard(ID_18);
System.out.println(province);
String province2 = IdCardUtil.getProvinceByIdCard(ID_15);
System.out.println(province2);
}
@Test
public void getCityCodeByIdCardTest() {
String codeByIdCard = IdCardUtil.getCityCodeByIdCard(ID_18);
System.out.println(codeByIdCard);
}
@Test
public void getGenderByIdCardTest() {
int gender = IdCardUtil.getGenderByIdCard(ID_18);
System.out.println(gender);
}
@Test
public void isValidCard18Test() {
boolean isValidCard18 = IdCardUtil.isValidCard18("3301022011022000D6");
System.out.println(isValidCard18);
// 不忽略大小写情况下,X严格校验必须大写
isValidCard18 = IdCardUtil.isValidCard18("33010219200403064x", false);
System.out.println(isValidCard18);
isValidCard18 = IdCardUtil.isValidCard18("33010219200403064X", false);
System.out.println(isValidCard18);
// 非严格校验下大小写皆可
isValidCard18 = IdCardUtil.isValidCard18("33010219200403064x");
System.out.println(isValidCard18);
isValidCard18 = IdCardUtil.isValidCard18("33010219200403064X");
System.out.println(isValidCard18);
}
@Test
public void isValidHKCardIdTest() {
String hkCard = "P174468(6)";
boolean flag = IdCardUtil.isValidHongKongCard(hkCard);
System.out.println(flag);
}
}
|
package com.server;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* This class creates a servlet for handling HTTO requests to get JSON string
*/
public class FarmServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static ProcessRequest processRequest = new ProcessRequest();
public FarmServlet() {
}
/**
* Gets JSON and uploads JSON string to database
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
String json = request.getParameter("json");
//json = URLDecoder.decode(json, "UTF-8");
System.out.println("JSON " + json);
String res = processRequest.process(json);
System.out.println("Response : " + res);
response.getWriter().print(res);
} catch (Exception e) {
e.printStackTrace();
response.getWriter().print("Error");
}
}
}
|
package com.tencent.mm.plugin.aa.a.c;
import com.tencent.mm.plugin.aa.a.k;
import com.tencent.mm.vending.app.a;
import com.tencent.mm.vending.g.g;
import com.tencent.mm.vending.h.e;
import com.tencent.mm.vending.j.d;
import java.util.Map;
public class e$c implements e<d<Boolean, String, Long>, Map<String, Object>> {
final /* synthetic */ e eBv;
public e$c(e eVar) {
this.eBv = eVar;
}
public final /* synthetic */ Object call(Object obj) {
Map map = (Map) obj;
a aVar = this.eBv.eBr;
int intExtra = aVar.uPN.getIntExtra("enter_scene", 1);
if (intExtra == 1) {
map.put(k.eAD, Integer.valueOf(com.tencent.mm.plugin.aa.a.a.ezF));
} else if (intExtra == 2) {
map.put(k.eAD, Integer.valueOf(com.tencent.mm.plugin.aa.a.a.ezG));
} else if (intExtra == 3) {
map.put(k.eAD, Integer.valueOf(com.tencent.mm.plugin.aa.a.a.ezH));
}
g.a(g.cx(map).c(aVar.eBp.eAL));
return null;
}
public final String xr() {
return "Vending.LOGIC";
}
}
|
package sc.ustc.view.widget;
/**
* @author HitoM
*/
public class Button extends AbstractWidget {
public static final String BUTTON_TAG = "buttonView";
@Override
public String getHtmlView() {
return "<input type=\"submit\" value=\""+this.getValue()+"\"/>\n";
}
}
|
package ca.antonious.habittracker.habitdetails;
import ca.antonious.habittracker.models.Habit;
/**
* Created by George on 2016-09-04.
*
* IHabitDetailsView is to be implemented by a GUI class that
* renders the details of a habit. It exposes a method to notify
* the view when a habit has been updated.
*/
public interface IHabitDetailsView {
void displayHabit(Habit habit);
}
|
package net.optifine;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.BlockPane;
import net.minecraft.block.BlockQuartz;
import net.minecraft.block.BlockRotatedPillar;
import net.minecraft.block.BlockStainedGlass;
import net.minecraft.block.BlockStainedGlassPane;
import net.minecraft.block.state.BlockStateBase;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.init.Blocks;
import net.minecraft.src.Config;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.biome.BiomeGenBase;
import net.optifine.config.MatchBlock;
import net.optifine.config.Matches;
import net.optifine.model.BlockModelUtils;
import net.optifine.model.ListQuadsOverlay;
import net.optifine.reflect.Reflector;
import net.optifine.render.RenderEnv;
import net.optifine.util.PropertiesOrdered;
import net.optifine.util.ResUtils;
import net.optifine.util.TileEntityUtils;
public class ConnectedTextures {
private static Map[] spriteQuadMaps = null;
private static Map[] spriteQuadFullMaps = null;
private static Map[][] spriteQuadCompactMaps = null;
private static ConnectedProperties[][] blockProperties = null;
private static ConnectedProperties[][] tileProperties = null;
private static boolean multipass = false;
protected static final int UNKNOWN = -1;
protected static final int Y_NEG_DOWN = 0;
protected static final int Y_POS_UP = 1;
protected static final int Z_NEG_NORTH = 2;
protected static final int Z_POS_SOUTH = 3;
protected static final int X_NEG_WEST = 4;
protected static final int X_POS_EAST = 5;
private static final int Y_AXIS = 0;
private static final int Z_AXIS = 1;
private static final int X_AXIS = 2;
public static final IBlockState AIR_DEFAULT_STATE = Blocks.air.getDefaultState();
private static TextureAtlasSprite emptySprite = null;
private static final BlockDir[] SIDES_Y_NEG_DOWN = new BlockDir[] { BlockDir.WEST, BlockDir.EAST, BlockDir.NORTH, BlockDir.SOUTH };
private static final BlockDir[] SIDES_Y_POS_UP = new BlockDir[] { BlockDir.WEST, BlockDir.EAST, BlockDir.SOUTH, BlockDir.NORTH };
private static final BlockDir[] SIDES_Z_NEG_NORTH = new BlockDir[] { BlockDir.EAST, BlockDir.WEST, BlockDir.DOWN, BlockDir.UP };
private static final BlockDir[] SIDES_Z_POS_SOUTH = new BlockDir[] { BlockDir.WEST, BlockDir.EAST, BlockDir.DOWN, BlockDir.UP };
private static final BlockDir[] SIDES_X_NEG_WEST = new BlockDir[] { BlockDir.NORTH, BlockDir.SOUTH, BlockDir.DOWN, BlockDir.UP };
private static final BlockDir[] SIDES_X_POS_EAST = new BlockDir[] { BlockDir.SOUTH, BlockDir.NORTH, BlockDir.DOWN, BlockDir.UP };
private static final BlockDir[] SIDES_Z_NEG_NORTH_Z_AXIS = new BlockDir[] { BlockDir.WEST, BlockDir.EAST, BlockDir.UP, BlockDir.DOWN };
private static final BlockDir[] SIDES_X_POS_EAST_X_AXIS = new BlockDir[] { BlockDir.NORTH, BlockDir.SOUTH, BlockDir.UP, BlockDir.DOWN };
private static final BlockDir[] EDGES_Y_NEG_DOWN = new BlockDir[] { BlockDir.NORTH_EAST, BlockDir.NORTH_WEST, BlockDir.SOUTH_EAST, BlockDir.SOUTH_WEST };
private static final BlockDir[] EDGES_Y_POS_UP = new BlockDir[] { BlockDir.SOUTH_EAST, BlockDir.SOUTH_WEST, BlockDir.NORTH_EAST, BlockDir.NORTH_WEST };
private static final BlockDir[] EDGES_Z_NEG_NORTH = new BlockDir[] { BlockDir.DOWN_WEST, BlockDir.DOWN_EAST, BlockDir.UP_WEST, BlockDir.UP_EAST };
private static final BlockDir[] EDGES_Z_POS_SOUTH = new BlockDir[] { BlockDir.DOWN_EAST, BlockDir.DOWN_WEST, BlockDir.UP_EAST, BlockDir.UP_WEST };
private static final BlockDir[] EDGES_X_NEG_WEST = new BlockDir[] { BlockDir.DOWN_SOUTH, BlockDir.DOWN_NORTH, BlockDir.UP_SOUTH, BlockDir.UP_NORTH };
private static final BlockDir[] EDGES_X_POS_EAST = new BlockDir[] { BlockDir.DOWN_NORTH, BlockDir.DOWN_SOUTH, BlockDir.UP_NORTH, BlockDir.UP_SOUTH };
private static final BlockDir[] EDGES_Z_NEG_NORTH_Z_AXIS = new BlockDir[] { BlockDir.UP_EAST, BlockDir.UP_WEST, BlockDir.DOWN_EAST, BlockDir.DOWN_WEST };
private static final BlockDir[] EDGES_X_POS_EAST_X_AXIS = new BlockDir[] { BlockDir.UP_SOUTH, BlockDir.UP_NORTH, BlockDir.DOWN_SOUTH, BlockDir.DOWN_NORTH };
public static final TextureAtlasSprite SPRITE_DEFAULT = new TextureAtlasSprite("<default>");
public static BakedQuad[] getConnectedTexture(final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, BakedQuad quad, final RenderEnv renderEnv) {
final TextureAtlasSprite textureatlassprite = quad.getSprite();
if (textureatlassprite == null) return renderEnv.getArrayQuadsCtm(quad);
else {
final Block block = blockState.getBlock();
if (skipConnectedTexture(blockAccess, blockState, blockPos, quad, renderEnv)) {
quad = getQuad(emptySprite, quad);
return renderEnv.getArrayQuadsCtm(quad);
} else {
final EnumFacing enumfacing = quad.getFace();
final BakedQuad[] abakedquad = getConnectedTextureMultiPass(blockAccess, blockState, blockPos, enumfacing, quad, renderEnv);
return abakedquad;
}
}
}
private static boolean skipConnectedTexture(final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final BakedQuad quad, final RenderEnv renderEnv) {
final Block block = blockState.getBlock();
if (block instanceof BlockPane) {
final TextureAtlasSprite textureatlassprite = quad.getSprite();
if (textureatlassprite.getIconName().startsWith("minecraft:blocks/glass_pane_top")) {
final IBlockState iblockstate1 = blockAccess.getBlockState(blockPos.offset(quad.getFace()));
return iblockstate1 == blockState;
}
}
if (block instanceof BlockPane) {
final EnumFacing enumfacing = quad.getFace();
if (enumfacing != EnumFacing.UP && enumfacing != EnumFacing.DOWN) return false;
if (!quad.isFaceQuad()) return false;
final BlockPos blockpos = blockPos.offset(quad.getFace());
IBlockState iblockstate = blockAccess.getBlockState(blockpos);
if (iblockstate.getBlock() != block) return false;
if (block == Blocks.stained_glass_pane && iblockstate.getValue(BlockStainedGlassPane.COLOR) != blockState.getValue(BlockStainedGlassPane.COLOR)) return false;
iblockstate = iblockstate.getBlock().getActualState(iblockstate, blockAccess, blockpos);
final double d0 = quad.getMidX();
if (d0 < 0.4D) {
if (iblockstate.getValue(BlockPane.WEST)) return true;
} else if (d0 > 0.6D) {
if (iblockstate.getValue(BlockPane.EAST)) return true;
} else {
final double d1 = quad.getMidZ();
if (d1 < 0.4D) {
if (iblockstate.getValue(BlockPane.NORTH)) return true;
} else {
if (d1 <= 0.6D) return true;
if (iblockstate.getValue(BlockPane.SOUTH)) return true;
}
}
}
return false;
}
protected static BakedQuad[] getQuads(final TextureAtlasSprite sprite, final BakedQuad quadIn, final RenderEnv renderEnv) {
if (sprite == null) return null;
else if (sprite == SPRITE_DEFAULT) return renderEnv.getArrayQuadsCtm(quadIn);
else {
final BakedQuad bakedquad = getQuad(sprite, quadIn);
final BakedQuad[] abakedquad = renderEnv.getArrayQuadsCtm(bakedquad);
return abakedquad;
}
}
private static synchronized BakedQuad getQuad(final TextureAtlasSprite sprite, final BakedQuad quadIn) {
if (spriteQuadMaps == null) return quadIn;
else {
final int i = sprite.getIndexInMap();
if (i >= 0 && i < spriteQuadMaps.length) {
Map map = spriteQuadMaps[i];
if (map == null) {
map = new IdentityHashMap(1);
spriteQuadMaps[i] = map;
}
BakedQuad bakedquad = (BakedQuad) map.get(quadIn);
if (bakedquad == null) {
bakedquad = makeSpriteQuad(quadIn, sprite);
map.put(quadIn, bakedquad);
}
return bakedquad;
} else return quadIn;
}
}
private static synchronized BakedQuad getQuadFull(final TextureAtlasSprite sprite, final BakedQuad quadIn, final int tintIndex) {
if (spriteQuadFullMaps == null) return null;
else if (sprite == null) return null;
else {
final int i = sprite.getIndexInMap();
if (i >= 0 && i < spriteQuadFullMaps.length) {
Map map = spriteQuadFullMaps[i];
if (map == null) {
map = new EnumMap(EnumFacing.class);
spriteQuadFullMaps[i] = map;
}
final EnumFacing enumfacing = quadIn.getFace();
BakedQuad bakedquad = (BakedQuad) map.get(enumfacing);
if (bakedquad == null) {
bakedquad = BlockModelUtils.makeBakedQuad(enumfacing, sprite, tintIndex);
map.put(enumfacing, bakedquad);
}
return bakedquad;
} else return null;
}
}
private static BakedQuad makeSpriteQuad(final BakedQuad quad, final TextureAtlasSprite sprite) {
final int[] aint = quad.getVertexData().clone();
final TextureAtlasSprite textureatlassprite = quad.getSprite();
for (int i = 0; i < 4; ++i) fixVertex(aint, i, textureatlassprite, sprite);
final BakedQuad bakedquad = new BakedQuad(aint, quad.getTintIndex(), quad.getFace(), sprite);
return bakedquad;
}
private static void fixVertex(final int[] data, final int vertex, final TextureAtlasSprite spriteFrom, final TextureAtlasSprite spriteTo) {
final int i = data.length / 4;
final int j = i * vertex;
final float f = Float.intBitsToFloat(data[j + 4]);
final float f1 = Float.intBitsToFloat(data[j + 4 + 1]);
final double d0 = spriteFrom.getSpriteU16(f);
final double d1 = spriteFrom.getSpriteV16(f1);
data[j + 4] = Float.floatToRawIntBits(spriteTo.getInterpolatedU(d0));
data[j + 4 + 1] = Float.floatToRawIntBits(spriteTo.getInterpolatedV(d1));
}
private static BakedQuad[] getConnectedTextureMultiPass(final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final EnumFacing side, final BakedQuad quad, final RenderEnv renderEnv) {
final BakedQuad[] abakedquad = getConnectedTextureSingle(blockAccess, blockState, blockPos, side, quad, true, 0, renderEnv);
if (!multipass) return abakedquad;
else if (abakedquad.length == 1 && abakedquad[0] == quad) return abakedquad;
else {
final List<BakedQuad> list = renderEnv.getListQuadsCtmMultipass(abakedquad);
for (int i = 0; i < list.size(); ++i) {
final BakedQuad bakedquad = list.get(i);
BakedQuad bakedquad1 = bakedquad;
for (int j = 0; j < 3; ++j) {
final BakedQuad[] abakedquad1 = getConnectedTextureSingle(blockAccess, blockState, blockPos, side, bakedquad1, false, j + 1, renderEnv);
if (abakedquad1.length != 1 || abakedquad1[0] == bakedquad1) break;
bakedquad1 = abakedquad1[0];
}
list.set(i, bakedquad1);
}
for (int k = 0; k < abakedquad.length; ++k) abakedquad[k] = list.get(k);
return abakedquad;
}
}
public static BakedQuad[] getConnectedTextureSingle(final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final EnumFacing facing, final BakedQuad quad, final boolean checkBlocks, final int pass,
final RenderEnv renderEnv) {
final Block block = blockState.getBlock();
if (!(blockState instanceof BlockStateBase)) return renderEnv.getArrayQuadsCtm(quad);
else {
final BlockStateBase blockstatebase = (BlockStateBase) blockState;
final TextureAtlasSprite textureatlassprite = quad.getSprite();
if (tileProperties != null) {
final int i = textureatlassprite.getIndexInMap();
if (i >= 0 && i < tileProperties.length) {
final ConnectedProperties[] aconnectedproperties = tileProperties[i];
if (aconnectedproperties != null) {
final int j = getSide(facing);
for (final ConnectedProperties connectedproperties : aconnectedproperties) {
if (connectedproperties != null && connectedproperties.matchesBlockId(blockstatebase.getBlockId())) {
final BakedQuad[] abakedquad = getConnectedTexture(connectedproperties, blockAccess, blockstatebase, blockPos, j, quad, pass, renderEnv);
if (abakedquad != null) return abakedquad;
}
}
}
}
}
if (blockProperties != null && checkBlocks) {
final int l = renderEnv.getBlockId();
if (l >= 0 && l < blockProperties.length) {
final ConnectedProperties[] aconnectedproperties1 = blockProperties[l];
if (aconnectedproperties1 != null) {
final int i1 = getSide(facing);
for (final ConnectedProperties connectedproperties1 : aconnectedproperties1) {
if (connectedproperties1 != null && connectedproperties1.matchesIcon(textureatlassprite)) {
final BakedQuad[] abakedquad1 = getConnectedTexture(connectedproperties1, blockAccess, blockstatebase, blockPos, i1, quad, pass, renderEnv);
if (abakedquad1 != null) return abakedquad1;
}
}
}
}
}
return renderEnv.getArrayQuadsCtm(quad);
}
}
public static int getSide(final EnumFacing facing) {
if (facing == null) return -1;
else switch (facing) {
case DOWN:
return 0;
case UP:
return 1;
case EAST:
return 5;
case WEST:
return 4;
case NORTH:
return 2;
case SOUTH:
return 3;
default:
return -1;
}
}
private static EnumFacing getFacing(final int side) {
switch (side) {
case 0:
return EnumFacing.DOWN;
case 1:
return EnumFacing.UP;
case 2:
return EnumFacing.NORTH;
case 3:
return EnumFacing.SOUTH;
case 4:
return EnumFacing.WEST;
case 5:
return EnumFacing.EAST;
default:
return EnumFacing.UP;
}
}
private static BakedQuad[] getConnectedTexture(final ConnectedProperties cp, final IBlockAccess blockAccess, final BlockStateBase blockState, final BlockPos blockPos, final int side, final BakedQuad quad, final int pass,
final RenderEnv renderEnv) {
int i = 0;
final int j = blockState.getMetadata();
int k = j;
final Block block = blockState.getBlock();
if (block instanceof BlockRotatedPillar) {
i = getWoodAxis(side, j);
if (cp.getMetadataMax() <= 3) k = j & 3;
}
if (block instanceof BlockQuartz) {
i = getQuartzAxis(side, j);
if (cp.getMetadataMax() <= 2 && k > 2) k = 2;
}
if (!cp.matchesBlock(blockState.getBlockId(), k)) return null;
else {
if (side >= 0 && cp.faces != 63) {
int l = side;
if (i != 0) l = fixSideByAxis(side, i);
if ((1 << l & cp.faces) == 0) return null;
}
final int i1 = blockPos.getY();
if (cp.heights != null && !cp.heights.isInRange(i1)) return null;
else {
if (cp.biomes != null) {
final BiomeGenBase biomegenbase = blockAccess.getBiomeGenForCoords(blockPos);
if (!cp.matchesBiome(biomegenbase)) return null;
}
if (cp.nbtName != null) {
final String s = TileEntityUtils.getTileEntityName(blockAccess, blockPos);
if (!cp.nbtName.matchesValue(s)) return null;
}
final TextureAtlasSprite textureatlassprite = quad.getSprite();
switch (cp.method) {
case 1:
return getQuads(getConnectedTextureCtm(cp, blockAccess, blockState, blockPos, i, side, textureatlassprite, j, renderEnv), quad, renderEnv);
case 2:
return getQuads(getConnectedTextureHorizontal(cp, blockAccess, blockState, blockPos, i, side, textureatlassprite, j), quad, renderEnv);
case 3:
return getQuads(getConnectedTextureTop(cp, blockAccess, blockState, blockPos, i, side, textureatlassprite, j), quad, renderEnv);
case 4:
return getQuads(getConnectedTextureRandom(cp, blockAccess, blockState, blockPos, side), quad, renderEnv);
case 5:
return getQuads(getConnectedTextureRepeat(cp, blockPos, side), quad, renderEnv);
case 6:
return getQuads(getConnectedTextureVertical(cp, blockAccess, blockState, blockPos, i, side, textureatlassprite, j), quad, renderEnv);
case 7:
return getQuads(getConnectedTextureFixed(cp), quad, renderEnv);
case 8:
return getQuads(getConnectedTextureHorizontalVertical(cp, blockAccess, blockState, blockPos, i, side, textureatlassprite, j), quad, renderEnv);
case 9:
return getQuads(getConnectedTextureVerticalHorizontal(cp, blockAccess, blockState, blockPos, i, side, textureatlassprite, j), quad, renderEnv);
case 10:
if (pass == 0) return getConnectedTextureCtmCompact(cp, blockAccess, blockState, blockPos, i, side, quad, j, renderEnv);
default:
return null;
case 11:
return getConnectedTextureOverlay(cp, blockAccess, blockState, blockPos, i, side, quad, j, renderEnv);
case 12:
return getConnectedTextureOverlayFixed(cp, quad, renderEnv);
case 13:
return getConnectedTextureOverlayRandom(cp, blockAccess, blockState, blockPos, side, quad, renderEnv);
case 14:
return getConnectedTextureOverlayRepeat(cp, blockPos, side, quad, renderEnv);
case 15:
return getConnectedTextureOverlayCtm(cp, blockAccess, blockState, blockPos, i, side, quad, j, renderEnv);
}
}
}
}
private static int fixSideByAxis(final int side, final int vertAxis) {
switch (vertAxis) {
case 0:
return side;
case 1:
switch (side) {
case 0:
return 2;
case 1:
return 3;
case 2:
return 1;
case 3:
return 0;
default:
return side;
}
case 2:
switch (side) {
case 0:
return 4;
case 1:
return 5;
case 2:
case 3:
default:
return side;
case 4:
return 1;
case 5:
return 0;
}
default:
return side;
}
}
private static int getWoodAxis(final int side, final int metadata) {
final int i = (metadata & 12) >> 2;
switch (i) {
case 1:
return 2;
case 2:
return 1;
default:
return 0;
}
}
private static int getQuartzAxis(final int side, final int metadata) {
switch (metadata) {
case 3:
return 2;
case 4:
return 1;
default:
return 0;
}
}
private static TextureAtlasSprite getConnectedTextureRandom(final ConnectedProperties cp, final IBlockAccess blockAccess, final BlockStateBase blockState, BlockPos blockPos, final int side) {
if (cp.tileIcons.length == 1) return cp.tileIcons[0];
else {
final int i = side / cp.symmetry * cp.symmetry;
if (cp.linked) {
BlockPos blockpos = blockPos.down();
for (IBlockState iblockstate = blockAccess.getBlockState(blockpos); iblockstate.getBlock() == blockState.getBlock(); iblockstate = blockAccess.getBlockState(blockpos)) {
blockPos = blockpos;
blockpos = blockpos.down();
if (blockpos.getY() < 0) break;
}
}
int l = Config.getRandom(blockPos, i) & Integer.MAX_VALUE;
for (int i1 = 0; i1 < cp.randomLoops; ++i1) l = Config.intHash(l);
int j1 = 0;
if (cp.weights == null) j1 = l % cp.tileIcons.length;
else {
final int j = l % cp.sumAllWeights;
final int[] aint = cp.sumWeights;
for (int k = 0; k < aint.length; ++k) if (j < aint[k]) {
j1 = k;
break;
}
}
return cp.tileIcons[j1];
}
}
private static TextureAtlasSprite getConnectedTextureFixed(final ConnectedProperties cp) { return cp.tileIcons[0]; }
private static TextureAtlasSprite getConnectedTextureRepeat(final ConnectedProperties cp, final BlockPos blockPos, final int side) {
if (cp.tileIcons.length == 1) return cp.tileIcons[0];
else {
final int i = blockPos.getX();
final int j = blockPos.getY();
final int k = blockPos.getZ();
int l = 0;
int i1 = 0;
switch (side) {
case 0:
l = i;
i1 = -k - 1;
break;
case 1:
l = i;
i1 = k;
break;
case 2:
l = -i - 1;
i1 = -j;
break;
case 3:
l = i;
i1 = -j;
break;
case 4:
l = k;
i1 = -j;
break;
case 5:
l = -k - 1;
i1 = -j;
}
l = l % cp.width;
i1 = i1 % cp.height;
if (l < 0) l += cp.width;
if (i1 < 0) i1 += cp.height;
final int j1 = i1 * cp.width + l;
return cp.tileIcons[j1];
}
}
private static TextureAtlasSprite getConnectedTextureCtm(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final TextureAtlasSprite icon,
final int metadata, final RenderEnv renderEnv) {
final int i = getConnectedTextureCtmIndex(cp, blockAccess, blockState, blockPos, vertAxis, side, icon, metadata, renderEnv);
return cp.tileIcons[i];
}
private static synchronized BakedQuad[] getConnectedTextureCtmCompact(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final BakedQuad quad,
final int metadata, final RenderEnv renderEnv) {
final TextureAtlasSprite textureatlassprite = quad.getSprite();
final int i = getConnectedTextureCtmIndex(cp, blockAccess, blockState, blockPos, vertAxis, side, textureatlassprite, metadata, renderEnv);
return ConnectedTexturesCompact.getConnectedTextureCtmCompact(i, cp, side, quad, renderEnv);
}
private static BakedQuad[] getConnectedTextureOverlay(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final BakedQuad quad,
final int metadata, final RenderEnv renderEnv) {
if (!quad.isFullQuad()) return null;
else {
final TextureAtlasSprite textureatlassprite = quad.getSprite();
final BlockDir[] ablockdir = getSideDirections(side, vertAxis);
final boolean[] aboolean = renderEnv.getBorderFlags();
for (int i = 0; i < 4; ++i) aboolean[i] = isNeighbourOverlay(cp, blockAccess, blockState, ablockdir[i].offset(blockPos), side, textureatlassprite, metadata);
final ListQuadsOverlay listquadsoverlay = renderEnv.getListQuadsOverlay(cp.layer);
Object dirEdges;
try {
if (!aboolean[0] || !aboolean[1] || !aboolean[2] || !aboolean[3]) {
if (aboolean[0] && aboolean[1] && aboolean[2]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[5], quad, cp.tintIndex), cp.tintBlockState);
dirEdges = null;
return (BakedQuad[]) dirEdges;
}
if (aboolean[0] && aboolean[2] && aboolean[3]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[6], quad, cp.tintIndex), cp.tintBlockState);
dirEdges = null;
return (BakedQuad[]) dirEdges;
}
if (aboolean[1] && aboolean[2] && aboolean[3]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[12], quad, cp.tintIndex), cp.tintBlockState);
dirEdges = null;
return (BakedQuad[]) dirEdges;
}
if (aboolean[0] && aboolean[1] && aboolean[3]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[13], quad, cp.tintIndex), cp.tintBlockState);
dirEdges = null;
return (BakedQuad[]) dirEdges;
}
final BlockDir[] ablockdir1 = getEdgeDirections(side, vertAxis);
final boolean[] aboolean1 = renderEnv.getBorderFlags2();
for (int j = 0; j < 4; ++j) aboolean1[j] = isNeighbourOverlay(cp, blockAccess, blockState, ablockdir1[j].offset(blockPos), side, textureatlassprite, metadata);
if (aboolean[1] && aboolean[2]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[3], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[3]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[16], quad, cp.tintIndex), cp.tintBlockState);
final Object object4 = null;
return (BakedQuad[]) object4;
}
if (aboolean[0] && aboolean[2]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[4], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[2]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[14], quad, cp.tintIndex), cp.tintBlockState);
final Object object3 = null;
return (BakedQuad[]) object3;
}
if (aboolean[1] && aboolean[3]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[10], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[1]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[2], quad, cp.tintIndex), cp.tintBlockState);
final Object object2 = null;
return (BakedQuad[]) object2;
}
if (aboolean[0] && aboolean[3]) {
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[11], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[0]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[0], quad, cp.tintIndex), cp.tintBlockState);
final Object object1 = null;
return (BakedQuad[]) object1;
}
final boolean[] aboolean2 = renderEnv.getBorderFlags3();
for (int k = 0; k < 4; ++k) aboolean2[k] = isNeighbourMatching(cp, blockAccess, blockState, ablockdir[k].offset(blockPos), side, textureatlassprite, metadata);
if (aboolean[0]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[9], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean[1]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[7], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean[2]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[1], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean[3]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[15], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[0] && (aboolean2[1] || aboolean2[2]) && !aboolean[1] && !aboolean[2]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[0], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[1] && (aboolean2[0] || aboolean2[2]) && !aboolean[0] && !aboolean[2]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[2], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[2] && (aboolean2[1] || aboolean2[3]) && !aboolean[1] && !aboolean[3]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[14], quad, cp.tintIndex), cp.tintBlockState);
if (aboolean1[3] && (aboolean2[0] || aboolean2[3]) && !aboolean[0] && !aboolean[3]) listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[16], quad, cp.tintIndex), cp.tintBlockState);
final Object object5 = null;
return (BakedQuad[]) object5;
}
listquadsoverlay.addQuad(getQuadFull(cp.tileIcons[8], quad, cp.tintIndex), cp.tintBlockState);
dirEdges = null;
} finally {
if (listquadsoverlay.size() > 0) renderEnv.setOverlaysRendered(true);
}
return (BakedQuad[]) dirEdges;
}
}
private static BakedQuad[] getConnectedTextureOverlayFixed(final ConnectedProperties cp, final BakedQuad quad, final RenderEnv renderEnv) {
if (!quad.isFullQuad()) return null;
else {
final ListQuadsOverlay listquadsoverlay = renderEnv.getListQuadsOverlay(cp.layer);
Object object;
try {
final TextureAtlasSprite textureatlassprite = getConnectedTextureFixed(cp);
if (textureatlassprite != null) listquadsoverlay.addQuad(getQuadFull(textureatlassprite, quad, cp.tintIndex), cp.tintBlockState);
object = null;
} finally {
if (listquadsoverlay.size() > 0) renderEnv.setOverlaysRendered(true);
}
return (BakedQuad[]) object;
}
}
private static BakedQuad[] getConnectedTextureOverlayRandom(final ConnectedProperties cp, final IBlockAccess blockAccess, final BlockStateBase blockState, final BlockPos blockPos, final int side, final BakedQuad quad, final RenderEnv renderEnv) {
if (!quad.isFullQuad()) return null;
else {
final ListQuadsOverlay listquadsoverlay = renderEnv.getListQuadsOverlay(cp.layer);
Object object;
try {
final TextureAtlasSprite textureatlassprite = getConnectedTextureRandom(cp, blockAccess, blockState, blockPos, side);
if (textureatlassprite != null) listquadsoverlay.addQuad(getQuadFull(textureatlassprite, quad, cp.tintIndex), cp.tintBlockState);
object = null;
} finally {
if (listquadsoverlay.size() > 0) renderEnv.setOverlaysRendered(true);
}
return (BakedQuad[]) object;
}
}
private static BakedQuad[] getConnectedTextureOverlayRepeat(final ConnectedProperties cp, final BlockPos blockPos, final int side, final BakedQuad quad, final RenderEnv renderEnv) {
if (!quad.isFullQuad()) return null;
else {
final ListQuadsOverlay listquadsoverlay = renderEnv.getListQuadsOverlay(cp.layer);
Object object;
try {
final TextureAtlasSprite textureatlassprite = getConnectedTextureRepeat(cp, blockPos, side);
if (textureatlassprite != null) listquadsoverlay.addQuad(getQuadFull(textureatlassprite, quad, cp.tintIndex), cp.tintBlockState);
object = null;
} finally {
if (listquadsoverlay.size() > 0) renderEnv.setOverlaysRendered(true);
}
return (BakedQuad[]) object;
}
}
private static BakedQuad[] getConnectedTextureOverlayCtm(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final BakedQuad quad,
final int metadata, final RenderEnv renderEnv) {
if (!quad.isFullQuad()) return null;
else {
final ListQuadsOverlay listquadsoverlay = renderEnv.getListQuadsOverlay(cp.layer);
Object object;
try {
final TextureAtlasSprite textureatlassprite = getConnectedTextureCtm(cp, blockAccess, blockState, blockPos, vertAxis, side, quad.getSprite(), metadata, renderEnv);
if (textureatlassprite != null) listquadsoverlay.addQuad(getQuadFull(textureatlassprite, quad, cp.tintIndex), cp.tintBlockState);
object = null;
} finally {
if (listquadsoverlay.size() > 0) renderEnv.setOverlaysRendered(true);
}
return (BakedQuad[]) object;
}
}
private static BlockDir[] getSideDirections(final int side, final int vertAxis) {
switch (side) {
case 0:
return SIDES_Y_NEG_DOWN;
case 1:
return SIDES_Y_POS_UP;
case 2:
if (vertAxis == 1) return SIDES_Z_NEG_NORTH_Z_AXIS;
return SIDES_Z_NEG_NORTH;
case 3:
return SIDES_Z_POS_SOUTH;
case 4:
return SIDES_X_NEG_WEST;
case 5:
if (vertAxis == 2) return SIDES_X_POS_EAST_X_AXIS;
return SIDES_X_POS_EAST;
default:
throw new IllegalArgumentException("Unknown side: " + side);
}
}
private static BlockDir[] getEdgeDirections(final int side, final int vertAxis) {
switch (side) {
case 0:
return EDGES_Y_NEG_DOWN;
case 1:
return EDGES_Y_POS_UP;
case 2:
if (vertAxis == 1) return EDGES_Z_NEG_NORTH_Z_AXIS;
return EDGES_Z_NEG_NORTH;
case 3:
return EDGES_Z_POS_SOUTH;
case 4:
return EDGES_X_NEG_WEST;
case 5:
if (vertAxis == 2) return EDGES_X_POS_EAST_X_AXIS;
return EDGES_X_POS_EAST;
default:
throw new IllegalArgumentException("Unknown side: " + side);
}
}
protected static Map[][] getSpriteQuadCompactMaps() { return spriteQuadCompactMaps; }
private static int getConnectedTextureCtmIndex(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final TextureAtlasSprite icon,
final int metadata, final RenderEnv renderEnv) {
final boolean[] aboolean = renderEnv.getBorderFlags();
switch (side) {
case 0:
aboolean[0] = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
aboolean[1] = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
aboolean[2] = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
aboolean[3] = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos6 = blockPos.down();
aboolean[0] = aboolean[0] && !isNeighbour(cp, blockAccess, blockState, blockpos6.west(), side, icon, metadata);
aboolean[1] = aboolean[1] && !isNeighbour(cp, blockAccess, blockState, blockpos6.east(), side, icon, metadata);
aboolean[2] = aboolean[2] && !isNeighbour(cp, blockAccess, blockState, blockpos6.north(), side, icon, metadata);
aboolean[3] = aboolean[3] && !isNeighbour(cp, blockAccess, blockState, blockpos6.south(), side, icon, metadata);
}
break;
case 1:
aboolean[0] = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
aboolean[1] = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
aboolean[2] = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
aboolean[3] = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos5 = blockPos.up();
aboolean[0] = aboolean[0] && !isNeighbour(cp, blockAccess, blockState, blockpos5.west(), side, icon, metadata);
aboolean[1] = aboolean[1] && !isNeighbour(cp, blockAccess, blockState, blockpos5.east(), side, icon, metadata);
aboolean[2] = aboolean[2] && !isNeighbour(cp, blockAccess, blockState, blockpos5.south(), side, icon, metadata);
aboolean[3] = aboolean[3] && !isNeighbour(cp, blockAccess, blockState, blockpos5.north(), side, icon, metadata);
}
break;
case 2:
aboolean[0] = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
aboolean[1] = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
aboolean[2] = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
aboolean[3] = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos4 = blockPos.north();
aboolean[0] = aboolean[0] && !isNeighbour(cp, blockAccess, blockState, blockpos4.east(), side, icon, metadata);
aboolean[1] = aboolean[1] && !isNeighbour(cp, blockAccess, blockState, blockpos4.west(), side, icon, metadata);
aboolean[2] = aboolean[2] && !isNeighbour(cp, blockAccess, blockState, blockpos4.down(), side, icon, metadata);
aboolean[3] = aboolean[3] && !isNeighbour(cp, blockAccess, blockState, blockpos4.up(), side, icon, metadata);
}
if (vertAxis == 1) {
switchValues(0, 1, aboolean);
switchValues(2, 3, aboolean);
}
break;
case 3:
aboolean[0] = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
aboolean[1] = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
aboolean[2] = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
aboolean[3] = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos3 = blockPos.south();
aboolean[0] = aboolean[0] && !isNeighbour(cp, blockAccess, blockState, blockpos3.west(), side, icon, metadata);
aboolean[1] = aboolean[1] && !isNeighbour(cp, blockAccess, blockState, blockpos3.east(), side, icon, metadata);
aboolean[2] = aboolean[2] && !isNeighbour(cp, blockAccess, blockState, blockpos3.down(), side, icon, metadata);
aboolean[3] = aboolean[3] && !isNeighbour(cp, blockAccess, blockState, blockpos3.up(), side, icon, metadata);
}
break;
case 4:
aboolean[0] = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
aboolean[1] = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
aboolean[2] = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
aboolean[3] = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos2 = blockPos.west();
aboolean[0] = aboolean[0] && !isNeighbour(cp, blockAccess, blockState, blockpos2.north(), side, icon, metadata);
aboolean[1] = aboolean[1] && !isNeighbour(cp, blockAccess, blockState, blockpos2.south(), side, icon, metadata);
aboolean[2] = aboolean[2] && !isNeighbour(cp, blockAccess, blockState, blockpos2.down(), side, icon, metadata);
aboolean[3] = aboolean[3] && !isNeighbour(cp, blockAccess, blockState, blockpos2.up(), side, icon, metadata);
}
break;
case 5:
aboolean[0] = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
aboolean[1] = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
aboolean[2] = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
aboolean[3] = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos = blockPos.east();
aboolean[0] = aboolean[0] && !isNeighbour(cp, blockAccess, blockState, blockpos.south(), side, icon, metadata);
aboolean[1] = aboolean[1] && !isNeighbour(cp, blockAccess, blockState, blockpos.north(), side, icon, metadata);
aboolean[2] = aboolean[2] && !isNeighbour(cp, blockAccess, blockState, blockpos.down(), side, icon, metadata);
aboolean[3] = aboolean[3] && !isNeighbour(cp, blockAccess, blockState, blockpos.up(), side, icon, metadata);
}
if (vertAxis == 2) {
switchValues(0, 1, aboolean);
switchValues(2, 3, aboolean);
}
}
int i = 0;
if (aboolean[0] & !aboolean[1] & !aboolean[2] & !aboolean[3]) i = 3;
else if (!aboolean[0] & aboolean[1] & !aboolean[2] & !aboolean[3]) i = 1;
else if (!aboolean[0] & !aboolean[1] & aboolean[2] & !aboolean[3]) i = 12;
else if (!aboolean[0] & !aboolean[1] & !aboolean[2] & aboolean[3]) i = 36;
else if (aboolean[0] & aboolean[1] & !aboolean[2] & !aboolean[3]) i = 2;
else if (!aboolean[0] & !aboolean[1] & aboolean[2] & aboolean[3]) i = 24;
else if (aboolean[0] & !aboolean[1] & aboolean[2] & !aboolean[3]) i = 15;
else if (aboolean[0] & !aboolean[1] & !aboolean[2] & aboolean[3]) i = 39;
else if (!aboolean[0] & aboolean[1] & aboolean[2] & !aboolean[3]) i = 13;
else if (!aboolean[0] & aboolean[1] & !aboolean[2] & aboolean[3]) i = 37;
else if (!aboolean[0] & aboolean[1] & aboolean[2] & aboolean[3]) i = 25;
else if (aboolean[0] & !aboolean[1] & aboolean[2] & aboolean[3]) i = 27;
else if (aboolean[0] & aboolean[1] & !aboolean[2] & aboolean[3]) i = 38;
else if (aboolean[0] & aboolean[1] & aboolean[2] & !aboolean[3]) i = 14;
else if (aboolean[0] & aboolean[1] & aboolean[2] & aboolean[3]) i = 26;
if (i == 0) return i;
else if (!Config.isConnectedTexturesFancy()) return i;
else {
switch (side) {
case 0:
aboolean[0] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().north(), side, icon, metadata);
aboolean[1] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().north(), side, icon, metadata);
aboolean[2] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().south(), side, icon, metadata);
aboolean[3] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().south(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos11 = blockPos.down();
aboolean[0] = aboolean[0] || isNeighbour(cp, blockAccess, blockState, blockpos11.east().north(), side, icon, metadata);
aboolean[1] = aboolean[1] || isNeighbour(cp, blockAccess, blockState, blockpos11.west().north(), side, icon, metadata);
aboolean[2] = aboolean[2] || isNeighbour(cp, blockAccess, blockState, blockpos11.east().south(), side, icon, metadata);
aboolean[3] = aboolean[3] || isNeighbour(cp, blockAccess, blockState, blockpos11.west().south(), side, icon, metadata);
}
break;
case 1:
aboolean[0] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().south(), side, icon, metadata);
aboolean[1] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().south(), side, icon, metadata);
aboolean[2] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().north(), side, icon, metadata);
aboolean[3] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().north(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos10 = blockPos.up();
aboolean[0] = aboolean[0] || isNeighbour(cp, blockAccess, blockState, blockpos10.east().south(), side, icon, metadata);
aboolean[1] = aboolean[1] || isNeighbour(cp, blockAccess, blockState, blockpos10.west().south(), side, icon, metadata);
aboolean[2] = aboolean[2] || isNeighbour(cp, blockAccess, blockState, blockpos10.east().north(), side, icon, metadata);
aboolean[3] = aboolean[3] || isNeighbour(cp, blockAccess, blockState, blockpos10.west().north(), side, icon, metadata);
}
break;
case 2:
aboolean[0] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().down(), side, icon, metadata);
aboolean[1] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().down(), side, icon, metadata);
aboolean[2] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().up(), side, icon, metadata);
aboolean[3] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().up(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos9 = blockPos.north();
aboolean[0] = aboolean[0] || isNeighbour(cp, blockAccess, blockState, blockpos9.west().down(), side, icon, metadata);
aboolean[1] = aboolean[1] || isNeighbour(cp, blockAccess, blockState, blockpos9.east().down(), side, icon, metadata);
aboolean[2] = aboolean[2] || isNeighbour(cp, blockAccess, blockState, blockpos9.west().up(), side, icon, metadata);
aboolean[3] = aboolean[3] || isNeighbour(cp, blockAccess, blockState, blockpos9.east().up(), side, icon, metadata);
}
if (vertAxis == 1) {
switchValues(0, 3, aboolean);
switchValues(1, 2, aboolean);
}
break;
case 3:
aboolean[0] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().down(), side, icon, metadata);
aboolean[1] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().down(), side, icon, metadata);
aboolean[2] = !isNeighbour(cp, blockAccess, blockState, blockPos.east().up(), side, icon, metadata);
aboolean[3] = !isNeighbour(cp, blockAccess, blockState, blockPos.west().up(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos8 = blockPos.south();
aboolean[0] = aboolean[0] || isNeighbour(cp, blockAccess, blockState, blockpos8.east().down(), side, icon, metadata);
aboolean[1] = aboolean[1] || isNeighbour(cp, blockAccess, blockState, blockpos8.west().down(), side, icon, metadata);
aboolean[2] = aboolean[2] || isNeighbour(cp, blockAccess, blockState, blockpos8.east().up(), side, icon, metadata);
aboolean[3] = aboolean[3] || isNeighbour(cp, blockAccess, blockState, blockpos8.west().up(), side, icon, metadata);
}
break;
case 4:
aboolean[0] = !isNeighbour(cp, blockAccess, blockState, blockPos.down().south(), side, icon, metadata);
aboolean[1] = !isNeighbour(cp, blockAccess, blockState, blockPos.down().north(), side, icon, metadata);
aboolean[2] = !isNeighbour(cp, blockAccess, blockState, blockPos.up().south(), side, icon, metadata);
aboolean[3] = !isNeighbour(cp, blockAccess, blockState, blockPos.up().north(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos7 = blockPos.west();
aboolean[0] = aboolean[0] || isNeighbour(cp, blockAccess, blockState, blockpos7.down().south(), side, icon, metadata);
aboolean[1] = aboolean[1] || isNeighbour(cp, blockAccess, blockState, blockpos7.down().north(), side, icon, metadata);
aboolean[2] = aboolean[2] || isNeighbour(cp, blockAccess, blockState, blockpos7.up().south(), side, icon, metadata);
aboolean[3] = aboolean[3] || isNeighbour(cp, blockAccess, blockState, blockpos7.up().north(), side, icon, metadata);
}
break;
case 5:
aboolean[0] = !isNeighbour(cp, blockAccess, blockState, blockPos.down().north(), side, icon, metadata);
aboolean[1] = !isNeighbour(cp, blockAccess, blockState, blockPos.down().south(), side, icon, metadata);
aboolean[2] = !isNeighbour(cp, blockAccess, blockState, blockPos.up().north(), side, icon, metadata);
aboolean[3] = !isNeighbour(cp, blockAccess, blockState, blockPos.up().south(), side, icon, metadata);
if (cp.innerSeams) {
final BlockPos blockpos1 = blockPos.east();
aboolean[0] = aboolean[0] || isNeighbour(cp, blockAccess, blockState, blockpos1.down().north(), side, icon, metadata);
aboolean[1] = aboolean[1] || isNeighbour(cp, blockAccess, blockState, blockpos1.down().south(), side, icon, metadata);
aboolean[2] = aboolean[2] || isNeighbour(cp, blockAccess, blockState, blockpos1.up().north(), side, icon, metadata);
aboolean[3] = aboolean[3] || isNeighbour(cp, blockAccess, blockState, blockpos1.up().south(), side, icon, metadata);
}
if (vertAxis == 2) {
switchValues(0, 3, aboolean);
switchValues(1, 2, aboolean);
}
}
if (i == 13 && aboolean[0]) i = 4;
else if (i == 15 && aboolean[1]) i = 5;
else if (i == 37 && aboolean[2]) i = 16;
else if (i == 39 && aboolean[3]) i = 17;
else if (i == 14 && aboolean[0] && aboolean[1]) i = 7;
else if (i == 25 && aboolean[0] && aboolean[2]) i = 6;
else if (i == 27 && aboolean[3] && aboolean[1]) i = 19;
else if (i == 38 && aboolean[3] && aboolean[2]) i = 18;
else if (i == 14 && !aboolean[0] && aboolean[1]) i = 31;
else if (i == 25 && aboolean[0] && !aboolean[2]) i = 30;
else if (i == 27 && !aboolean[3] && aboolean[1]) i = 41;
else if (i == 38 && aboolean[3] && !aboolean[2]) i = 40;
else if (i == 14 && aboolean[0] && !aboolean[1]) i = 29;
else if (i == 25 && !aboolean[0] && aboolean[2]) i = 28;
else if (i == 27 && aboolean[3] && !aboolean[1]) i = 43;
else if (i == 38 && !aboolean[3] && aboolean[2]) i = 42;
else if (i == 26 && aboolean[0] && aboolean[1] && aboolean[2] && aboolean[3]) i = 46;
else if (i == 26 && !aboolean[0] && aboolean[1] && aboolean[2] && aboolean[3]) i = 9;
else if (i == 26 && aboolean[0] && !aboolean[1] && aboolean[2] && aboolean[3]) i = 21;
else if (i == 26 && aboolean[0] && aboolean[1] && !aboolean[2] && aboolean[3]) i = 8;
else if (i == 26 && aboolean[0] && aboolean[1] && aboolean[2] && !aboolean[3]) i = 20;
else if (i == 26 && aboolean[0] && aboolean[1] && !aboolean[2] && !aboolean[3]) i = 11;
else if (i == 26 && !aboolean[0] && !aboolean[1] && aboolean[2] && aboolean[3]) i = 22;
else if (i == 26 && !aboolean[0] && aboolean[1] && !aboolean[2] && aboolean[3]) i = 23;
else if (i == 26 && aboolean[0] && !aboolean[1] && aboolean[2] && !aboolean[3]) i = 10;
else if (i == 26 && aboolean[0] && !aboolean[1] && !aboolean[2] && aboolean[3]) i = 34;
else if (i == 26 && !aboolean[0] && aboolean[1] && aboolean[2] && !aboolean[3]) i = 35;
else if (i == 26 && aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3]) i = 32;
else if (i == 26 && !aboolean[0] && aboolean[1] && !aboolean[2] && !aboolean[3]) i = 33;
else if (i == 26 && !aboolean[0] && !aboolean[1] && aboolean[2] && !aboolean[3]) i = 44;
else if (i == 26 && !aboolean[0] && !aboolean[1] && !aboolean[2] && aboolean[3]) i = 45;
return i;
}
}
private static void switchValues(final int ix1, final int ix2, final boolean[] arr) {
final boolean flag = arr[ix1];
arr[ix1] = arr[ix2];
arr[ix2] = flag;
}
private static boolean isNeighbourOverlay(final ConnectedProperties cp, final IBlockAccess iblockaccess, final IBlockState blockState, final BlockPos blockPos, final int side, final TextureAtlasSprite icon, final int metadata) {
final IBlockState iblockstate = iblockaccess.getBlockState(blockPos);
if (!isFullCubeModel(iblockstate)) return false;
else {
if (cp.connectBlocks != null) {
final BlockStateBase blockstatebase = (BlockStateBase) iblockstate;
if (!Matches.block(blockstatebase.getBlockId(), blockstatebase.getMetadata(), cp.connectBlocks)) return false;
}
if (cp.connectTileIcons != null) {
final TextureAtlasSprite textureatlassprite = getNeighbourIcon(iblockaccess, blockState, blockPos, iblockstate, side);
if (!Config.isSameOne(textureatlassprite, cp.connectTileIcons)) return false;
}
final IBlockState iblockstate1 = iblockaccess.getBlockState(blockPos.offset(getFacing(side)));
return iblockstate1.getBlock().isOpaqueCube() ? false : (side == 1 && iblockstate1.getBlock() == Blocks.snow_layer ? false : !isNeighbour(cp, iblockaccess, blockState, blockPos, iblockstate, side, icon, metadata));
}
}
private static boolean isFullCubeModel(final IBlockState state) {
if (state.getBlock().isFullCube()) return true;
else {
final Block block = state.getBlock();
return block instanceof BlockGlass ? true : block instanceof BlockStainedGlass;
}
}
private static boolean isNeighbourMatching(final ConnectedProperties cp, final IBlockAccess iblockaccess, final IBlockState blockState, final BlockPos blockPos, final int side, final TextureAtlasSprite icon, final int metadata) {
final IBlockState iblockstate = iblockaccess.getBlockState(blockPos);
if (iblockstate == AIR_DEFAULT_STATE) return false;
else {
if (cp.matchBlocks != null && iblockstate instanceof BlockStateBase) {
final BlockStateBase blockstatebase = (BlockStateBase) iblockstate;
if (!cp.matchesBlock(blockstatebase.getBlockId(), blockstatebase.getMetadata())) return false;
}
if (cp.matchTileIcons != null) {
final TextureAtlasSprite textureatlassprite = getNeighbourIcon(iblockaccess, blockState, blockPos, iblockstate, side);
if (textureatlassprite != icon) return false;
}
final IBlockState iblockstate1 = iblockaccess.getBlockState(blockPos.offset(getFacing(side)));
return iblockstate1.getBlock().isOpaqueCube() ? false : side != 1 || iblockstate1.getBlock() != Blocks.snow_layer;
}
}
private static boolean isNeighbour(final ConnectedProperties cp, final IBlockAccess iblockaccess, final IBlockState blockState, final BlockPos blockPos, final int side, final TextureAtlasSprite icon, final int metadata) {
final IBlockState iblockstate = iblockaccess.getBlockState(blockPos);
return isNeighbour(cp, iblockaccess, blockState, blockPos, iblockstate, side, icon, metadata);
}
private static boolean isNeighbour(final ConnectedProperties cp, final IBlockAccess iblockaccess, final IBlockState blockState, final BlockPos blockPos, final IBlockState neighbourState, final int side, final TextureAtlasSprite icon,
final int metadata) {
if (blockState == neighbourState) return true;
else if (cp.connect == 2) {
if (neighbourState == null) return false;
else if (neighbourState == AIR_DEFAULT_STATE) return false;
else {
final TextureAtlasSprite textureatlassprite = getNeighbourIcon(iblockaccess, blockState, blockPos, neighbourState, side);
return textureatlassprite == icon;
}
} else if (cp.connect == 3) return neighbourState == null ? false : (neighbourState == AIR_DEFAULT_STATE ? false : neighbourState.getBlock().getMaterial() == blockState.getBlock().getMaterial());
else if (!(neighbourState instanceof BlockStateBase)) return false;
else {
final BlockStateBase blockstatebase = (BlockStateBase) neighbourState;
final Block block = blockstatebase.getBlock();
final int i = blockstatebase.getMetadata();
return block == blockState.getBlock() && i == metadata;
}
}
private static TextureAtlasSprite getNeighbourIcon(final IBlockAccess iblockaccess, final IBlockState blockState, final BlockPos blockPos, IBlockState neighbourState, final int side) {
neighbourState = neighbourState.getBlock().getActualState(neighbourState, iblockaccess, blockPos);
final IBakedModel ibakedmodel = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(neighbourState);
if (ibakedmodel == null) return null;
else {
if (Reflector.ForgeBlock_getExtendedState.exists()) neighbourState = (IBlockState) Reflector.call(neighbourState.getBlock(), Reflector.ForgeBlock_getExtendedState, neighbourState, iblockaccess, blockPos);
final EnumFacing enumfacing = getFacing(side);
List list = ibakedmodel.getFaceQuads(enumfacing);
if (list == null) return null;
else {
if (Config.isBetterGrass()) list = BetterGrass.getFaceQuads(iblockaccess, neighbourState, blockPos, enumfacing, list);
if (list.size() > 0) {
final BakedQuad bakedquad1 = (BakedQuad) list.get(0);
return bakedquad1.getSprite();
} else {
final List list1 = ibakedmodel.getGeneralQuads();
if (list1 == null) return null;
else {
for (final Object element : list1) { final BakedQuad bakedquad = (BakedQuad) element; if (bakedquad.getFace() == enumfacing) return bakedquad.getSprite(); }
return null;
}
}
}
}
}
private static TextureAtlasSprite getConnectedTextureHorizontal(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final TextureAtlasSprite icon,
final int metadata) {
boolean flag;
boolean flag1;
flag = false;
flag1 = false;
label0: switch (vertAxis) {
case 0:
switch (side) {
case 0:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
break label0;
case 1:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
break label0;
case 2:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
break label0;
case 3:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
break label0;
case 4:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
break label0;
case 5:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
default:
break label0;
}
case 1:
switch (side) {
case 0:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
break label0;
case 1:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
break label0;
case 2:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
break label0;
case 3:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
break label0;
case 4:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
break label0;
case 5:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
default:
break label0;
}
case 2:
switch (side) {
case 0:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
break;
case 1:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
break;
case 2:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
break;
case 3:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
break;
case 4:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
break;
case 5:
flag = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
}
}
int i = 3;
if (flag) {
if (flag1) i = 1;
else i = 2;
} else if (flag1) i = 0;
else i = 3;
return cp.tileIcons[i];
}
private static TextureAtlasSprite getConnectedTextureVertical(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final TextureAtlasSprite icon,
final int metadata) {
boolean flag = false;
boolean flag1 = false;
switch (vertAxis) {
case 0:
if (side == 1) {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
} else if (side == 0) {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
} else {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
}
break;
case 1:
if (side == 3) {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
} else if (side == 2) {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
} else {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.north(), side, icon, metadata);
}
break;
case 2:
if (side == 5) {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
} else if (side == 4) {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.down(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
} else {
flag = isNeighbour(cp, blockAccess, blockState, blockPos.west(), side, icon, metadata);
flag1 = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
}
}
int i = 3;
if (flag) {
if (flag1) i = 1;
else i = 2;
} else if (flag1) i = 0;
else i = 3;
return cp.tileIcons[i];
}
private static TextureAtlasSprite getConnectedTextureHorizontalVertical(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side,
final TextureAtlasSprite icon, final int metadata) {
final TextureAtlasSprite[] atextureatlassprite = cp.tileIcons;
final TextureAtlasSprite textureatlassprite = getConnectedTextureHorizontal(cp, blockAccess, blockState, blockPos, vertAxis, side, icon, metadata);
if (textureatlassprite != null && textureatlassprite != icon && textureatlassprite != atextureatlassprite[3]) return textureatlassprite;
else {
final TextureAtlasSprite textureatlassprite1 = getConnectedTextureVertical(cp, blockAccess, blockState, blockPos, vertAxis, side, icon, metadata);
return textureatlassprite1 == atextureatlassprite[0] ? atextureatlassprite[4]
: (textureatlassprite1 == atextureatlassprite[1] ? atextureatlassprite[5] : (textureatlassprite1 == atextureatlassprite[2] ? atextureatlassprite[6] : textureatlassprite1));
}
}
private static TextureAtlasSprite getConnectedTextureVerticalHorizontal(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side,
final TextureAtlasSprite icon, final int metadata) {
final TextureAtlasSprite[] atextureatlassprite = cp.tileIcons;
final TextureAtlasSprite textureatlassprite = getConnectedTextureVertical(cp, blockAccess, blockState, blockPos, vertAxis, side, icon, metadata);
if (textureatlassprite != null && textureatlassprite != icon && textureatlassprite != atextureatlassprite[3]) return textureatlassprite;
else {
final TextureAtlasSprite textureatlassprite1 = getConnectedTextureHorizontal(cp, blockAccess, blockState, blockPos, vertAxis, side, icon, metadata);
return textureatlassprite1 == atextureatlassprite[0] ? atextureatlassprite[4]
: (textureatlassprite1 == atextureatlassprite[1] ? atextureatlassprite[5] : (textureatlassprite1 == atextureatlassprite[2] ? atextureatlassprite[6] : textureatlassprite1));
}
}
private static TextureAtlasSprite getConnectedTextureTop(final ConnectedProperties cp, final IBlockAccess blockAccess, final IBlockState blockState, final BlockPos blockPos, final int vertAxis, final int side, final TextureAtlasSprite icon,
final int metadata) {
boolean flag = false;
switch (vertAxis) {
case 0:
if (side == 1 || side == 0) return null;
flag = isNeighbour(cp, blockAccess, blockState, blockPos.up(), side, icon, metadata);
break;
case 1:
if (side == 3 || side == 2) return null;
flag = isNeighbour(cp, blockAccess, blockState, blockPos.south(), side, icon, metadata);
break;
case 2:
if (side == 5 || side == 4) return null;
flag = isNeighbour(cp, blockAccess, blockState, blockPos.east(), side, icon, metadata);
}
if (flag) return cp.tileIcons[0];
else return null;
}
public static void updateIcons(final TextureMap textureMap) {
blockProperties = null;
tileProperties = null;
spriteQuadMaps = null;
spriteQuadCompactMaps = null;
if (Config.isConnectedTextures()) {
final IResourcePack[] airesourcepack = Config.getResourcePacks();
for (int i = airesourcepack.length - 1; i >= 0; --i) { final IResourcePack iresourcepack = airesourcepack[i]; updateIcons(textureMap, iresourcepack); }
updateIcons(textureMap, Config.getDefaultResourcePack());
final ResourceLocation resourcelocation = new ResourceLocation("mcpatcher/ctm/default/empty");
emptySprite = textureMap.registerSprite(resourcelocation);
spriteQuadMaps = new Map[textureMap.getCountRegisteredSprites() + 1];
spriteQuadFullMaps = new Map[textureMap.getCountRegisteredSprites() + 1];
spriteQuadCompactMaps = new Map[textureMap.getCountRegisteredSprites() + 1][];
if (blockProperties.length <= 0) blockProperties = null;
if (tileProperties.length <= 0) tileProperties = null;
}
}
private static void updateIconEmpty(final TextureMap textureMap) {}
public static void updateIcons(final TextureMap textureMap, final IResourcePack rp) {
final String[] astring = ResUtils.collectFiles(rp, "mcpatcher/ctm/", ".properties", getDefaultCtmPaths());
Arrays.sort(astring);
final List list = makePropertyList(tileProperties);
final List list1 = makePropertyList(blockProperties);
for (final String s : astring) {
Config.dbg("ConnectedTextures: " + s);
try {
final ResourceLocation resourcelocation = new ResourceLocation(s);
final InputStream inputstream = rp.getInputStream(resourcelocation);
if (inputstream == null) Config.warn("ConnectedTextures file not found: " + s);
else {
final Properties properties = new PropertiesOrdered();
properties.load(inputstream);
inputstream.close();
final ConnectedProperties connectedproperties = new ConnectedProperties(properties, s);
if (connectedproperties.isValid(s)) {
connectedproperties.updateIcons(textureMap);
addToTileList(connectedproperties, list);
addToBlockList(connectedproperties, list1);
}
}
} catch (final FileNotFoundException var11) {
Config.warn("ConnectedTextures file not found: " + s);
} catch (final Exception exception) {
exception.printStackTrace();
}
}
blockProperties = propertyListToArray(list1);
tileProperties = propertyListToArray(list);
multipass = detectMultipass();
Config.dbg("Multipass connected textures: " + multipass);
}
private static List makePropertyList(final ConnectedProperties[][] propsArr) {
final List list = new ArrayList();
if (propsArr != null) for (final ConnectedProperties[] aconnectedproperties : propsArr) { List list1 = null; if (aconnectedproperties != null) list1 = new ArrayList(Arrays.asList(aconnectedproperties)); list.add(list1); }
return list;
}
private static boolean detectMultipass() {
final List list = new ArrayList();
for (final ConnectedProperties[] aconnectedproperties : tileProperties) { if (aconnectedproperties != null) list.addAll(Arrays.asList(aconnectedproperties)); }
for (final ConnectedProperties[] aconnectedproperties2 : blockProperties) { if (aconnectedproperties2 != null) list.addAll(Arrays.asList(aconnectedproperties2)); }
final ConnectedProperties[] aconnectedproperties1 = ((ConnectedProperties[]) list.toArray(new ConnectedProperties[list.size()]));
final Set set1 = new HashSet();
final Set set = new HashSet();
for (final ConnectedProperties connectedproperties : aconnectedproperties1) {
if (connectedproperties.matchTileIcons != null) set1.addAll(Arrays.asList(connectedproperties.matchTileIcons));
if (connectedproperties.tileIcons != null) set.addAll(Arrays.asList(connectedproperties.tileIcons));
}
set1.retainAll(set);
return !set1.isEmpty();
}
private static ConnectedProperties[][] propertyListToArray(final List list) {
final ConnectedProperties[][] propArr = new ConnectedProperties[list.size()][];
for (int i = 0; i < list.size(); ++i) {
final List subList = (List) list.get(i);
if (subList != null) {
final ConnectedProperties[] subArr = (ConnectedProperties[]) subList.toArray(new ConnectedProperties[subList.size()]);
propArr[i] = subArr;
}
}
return propArr;
}
private static void addToTileList(final ConnectedProperties cp, final List tileList) {
if (cp.matchTileIcons != null) for (final TextureAtlasSprite textureatlassprite : cp.matchTileIcons) {
if (!(textureatlassprite instanceof TextureAtlasSprite)) Config.warn("TextureAtlasSprite is not TextureAtlasSprite: " + textureatlassprite + ", name: " + textureatlassprite.getIconName());
else {
final int j = textureatlassprite.getIndexInMap();
if (j < 0) Config.warn("Invalid tile ID: " + j + ", icon: " + textureatlassprite.getIconName());
else addToList(cp, tileList, j);
}
}
}
private static void addToBlockList(final ConnectedProperties cp, final List blockList) {
if (cp.matchBlocks != null) for (final MatchBlock matchBlock : cp.matchBlocks) {
final int j = matchBlock.getBlockId();
if (j < 0) Config.warn("Invalid block ID: " + j);
else addToList(cp, blockList, j);
}
}
private static void addToList(final ConnectedProperties cp, final List list, final int id) {
while (id >= list.size()) list.add(null);
List subList = (List) list.get(id);
if (subList == null) {
subList = new ArrayList();
list.set(id, subList);
}
subList.add(cp);
}
private static String[] getDefaultCtmPaths() {
final List list = new ArrayList();
final String s = "mcpatcher/ctm/default/";
if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/glass.png"))) {
list.add(s + "glass.properties");
list.add(s + "glasspane.properties");
}
if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/bookshelf.png"))) list.add(s + "bookshelf.properties");
if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/sandstone_normal.png"))) list.add(s + "sandstone.properties");
final String[] astring = new String[] { "white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "silver", "cyan", "purple", "blue", "brown", "green", "red", "black" };
for (int i = 0; i < astring.length; ++i) {
final String s1 = astring[i];
if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/glass_" + s1 + ".png"))) {
list.add(s + i + "_glass_" + s1 + "/glass_" + s1 + ".properties");
list.add(s + i + "_glass_" + s1 + "/glass_pane_" + s1 + ".properties");
}
}
final String[] astring1 = ((String[]) list.toArray(new String[list.size()]));
return astring1;
}
}
|
package TestJava;
public class uncheckchild {
public void disp() throws ArithmeticException
{
System.err.println("i am from disp");
}
}
|
import java.lang.Exception;
@SuppressWarnings("serial")
public class EmptyDeckException extends Exception
{
public EmptyDeckException()
{
super("Error, the deck has insuffisent cards");
}
}
|
// Sun Certified Java Programmer
// Chapter 3, P198
// Assignments
class ValueTest {
public static void main(String[] args) {
int a = 10; // Assign a value to a
System.out.println("a = " + a);
int b = a;
System.out.println("b = " + b);
b = 30;
System.out.println("a = " + a + " after change to b");
System.out.println("b = " + b);
}
}
|
package com.ibeiliao.pay.admin.controller.pay;
import com.ibeiliao.pay.admin.utils.resource.Menu;
import org.springframework.stereotype.Controller;
/**
* 支付管理功能,这里仅用于菜单展示
* @author linyi 2016/8/1.
*/
@Controller
@Menu(name = "支付管理", parent = "", sequence = 800000)
public class PayManagementController {
}
|
package ch3.sub7;
import ch3.sub6.methodreference.Apple;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
public class Application {
public static void main(String[] args) {
List<Apple> inventory = Arrays.asList(
new Apple(Color.RED, 80 ),
new Apple(Color.GREEN, 155),
new Apple(Color.RED, 120)
);
System.out.println(inventory.toString());
// inventory.sort((Apple a1, Apple a2) -> a1.getWeight().compareTo(a2.getWeight()));
inventory.sort(Comparator.comparing(Apple::getWeight));
System.out.println(inventory.toString());
// Comparator 조합
inventory.sort(Comparator.comparing(Apple::getWeight)
.reversed()
.thenComparing(Apple::getColor));
// Predicate 조합
}
}
|
package pl.gabinetynagodziny.officesforrent.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name="reservations")
public class Reservation {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long reservationId;
@ManyToOne(fetch = FetchType.LAZY)
private Office office;
@ManyToOne(fetch = FetchType.LAZY)
private User user;
private LocalDate reservationDate;
private Integer reservationTime;
private LocalDateTime createdDate;
private LocalDateTime lastUpdatedDate;
private Boolean accepted = false;
private LocalDateTime acceptanceDate;
public void doAcceptance(){
this.acceptanceDate = LocalDateTime.now();
this.accepted = true;
}
public Reservation(Office office, User user, String reservationDateString, String reservationTimeString){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
this.office = office;
this.user = user;
this.reservationDate = LocalDate.parse(reservationDateString, formatter);
this.reservationTime = Integer.parseInt(reservationTimeString.substring(0,reservationTimeString.indexOf(":")));
}
@PrePersist
public void prePersist() {
createdDate = LocalDateTime.now();
}
@PreUpdate
public void preUpdate() {
lastUpdatedDate = LocalDateTime.now();
}
}
|
package com.sudipatcp.twopointers;
import java.util.ArrayList;
import java.util.Collections;
public class CountTriangles {
public static int nTriang(ArrayList<Integer> A) {
Collections.sort(A);
long countTr = 0;
for(int i = A.size() - 1; i >= 1; i--) {
int j = 0;
int k = i - 1;
while (j < k) {
if (A.get(j) + A.get(k) > A.get(i)) {
countTr += k-j;
countTr = countTr % 1000000007;
k--;
}else{
j++;
}
}
}
return (int)countTr;
}
public static void main(String[] args) {
int a[] = {1, 1, 1, 2, 2};
ArrayList<Integer> listA = new ArrayList<Integer>();
for(int i : a){
listA.add(i);
}
System.out.println(nTriang(listA));
}
}
|
import java.util.Arrays;
public class CountingStar {
public static String[] starCount(String[] args) {
int count = 0;
for(String s: args) {
if(s.equals("Star"))
count ++;
}
if (count % 2 == 0) {
return Arrays.copyOf(args, args.length);
} else {
String[] res = new String[args.length - count];
int i = 0;
for(String s: args) {
if(!s.equals("Star"))
res[i++] = s;
}
return res;
}
}
public static void main(String[] args) {
String[] strings = {"Star", "Why", "Stan", "Starr", "Tea", "ok"};
for(String s: CountingStar.starCount(strings)) {
System.out.print(s + " ");
}
}
} |
package com.blackonwhite.payload;
public enum CallBackPayload {
WHITE_CARD_CHOICE,
BLACK_CARD_CHOICE,
QUESTION,
START_GAME
}
|
package com.yiibai;
/**
* Created by jany.nie on 2019/6/20.
*/
public class OrderNotFoundException extends Exception {
public OrderNotFoundException(String s) {
}
}
|
/**
*
*/
/**
* @author GURSHARAN SINGH
*
*/
module GreedyAlgoQA {
} |
package stack.queue;
public class ResizingArrayStack {
private Object[] stack;
private int N;
public ResizingArrayStack() {
stack = new Object[1];
}
public boolean isEmpty() {
return N == 0;
}
public void push(Object o) {
if(null == o);
//throw new Exception();
if(N == stack.length)
resize(2*N);
stack[N++] = o;
}
public Object pop() {
Object o = null;
if(isEmpty());
//throw new Exception();
else {
o = stack[--N];
stack[N] = null;
if(N>0 && N==stack.length/4)
resize(stack.length/2);
}
return o;
}
private void resize(int capacity) {
Object[] copy = new Object[capacity];
for(int i=0; i<N; i++)
copy[i] = stack[i];
stack = copy;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
|
/**
* Spring Framework configuration files.
*/
package workstarter.config;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.