text
stringlengths
10
2.72M
package org.stepik.api.objects.reviews; import com.google.gson.annotations.SerializedName; import org.jetbrains.annotations.NotNull; import org.stepik.api.objects.ObjectsContainer; import org.stepik.api.objects.attempts.Attempt; import org.stepik.api.objects.submissions.Submission; import java.util.ArrayList; import java.util.List; /** * @author meanmail */ public class ReviewSessions extends ObjectsContainer<ReviewSession> { @SerializedName("review-sessions") private List<ReviewSession> reviewSessions; private List<Attempt> attempts; private List<Review> reviews; @SerializedName("rubric-scores") private List<RubricScore> rubricScores; private List<Submission> submissions; @NotNull public List<Attempt> getAttempts() { if (attempts == null) { attempts = new ArrayList<>(); } return attempts; } @NotNull public List<Review> getReviews() { if (reviews == null) { reviews = new ArrayList<>(); } return reviews; } public List<RubricScore> getRubricScores() { if (rubricScores == null) { rubricScores = new ArrayList<>(); } return rubricScores; } public List<Submission> getSubmissions() { if (submissions == null) { submissions = new ArrayList<>(); } return submissions; } @NotNull public List<ReviewSession> getReviewSessions() { if (reviewSessions == null) { reviewSessions = new ArrayList<>(); } return reviewSessions; } @NotNull @Override public List<ReviewSession> getItems() { return getReviewSessions(); } @NotNull public Class<ReviewSession> getItemClass() { return ReviewSession.class; } }
package com.example.beautyOfProgram; /** * 构造一个最小堆 数组元素大小为K * */ public class Heap { private Node[] heapArray; private int currentSize; private int maxSize; // 构造一个含有k个元素的堆 public Heap(int k) { this.maxSize = k; heapArray = new Node[k]; currentSize = 0; } // 向堆中添加元素 public void add(int element) { if (currentSize == maxSize) { if (heapArray[0].getKey() >= element) { return; } delete(); insert(element); } else { insert(element); } } public void insert(int element) { Node newNode = new Node(element); heapArray[currentSize] = newNode; shiftUp(currentSize++); } private void shiftUp(int current) { Node bottom = heapArray[current]; int parent = (current - 1) / 2; while (current > 0 && bottom.getKey() < heapArray[parent].getKey()) { heapArray[current] = heapArray[parent]; current = parent; parent = (current - 1) / 2; } heapArray[current] = bottom; } public Node delete() { Node root = heapArray[0]; heapArray[0] = heapArray[--currentSize]; shiftDown(0); return root; } private void shiftDown(int current) { Node top = heapArray[current]; int smallChild; while (current < currentSize / 2) { int leftChild = (2 * current) + 1; int rightChild = leftChild + 1; if(rightChild < currentSize && heapArray[leftChild].getKey() < heapArray[rightChild].getKey()){ smallChild = leftChild; }else{ smallChild = rightChild; } if(top.getKey() < heapArray[smallChild].getKey()){ break; } heapArray[current] = heapArray[smallChild]; current = smallChild; } heapArray[current] = top; } //遍历堆 public void display(){ for(int i=0;i<currentSize;i++){ System.out.print(heapArray[i].getKey()+" "); } } }
/** * FileName: SpringOperateLogService.java * Description: * Company: 南宁超创信息工程有限公司 * History: 2010-9-13(hzr) 1.0 Create */ package com.spower.basesystem.oplog.service.spring; import com.spower.basesystem.common.command.BaseCommandInfo; import com.spower.basesystem.common.command.Page; import com.spower.basesystem.oplog.service.IOperateLogService; import com.spower.basesystem.oplog.service.dao.IOperateLogDao; /** * @author hzr 2010-9-13 */ public class SpringOperateLogService implements IOperateLogService { private IOperateLogDao operateLogDao; public void deleteOperateLogs() { this.operateLogDao.deleteOperateLogs(); } public Page selectOperateLogList(BaseCommandInfo info) { return this.operateLogDao.selectOperateLogList(info); } public void setOperateLogDao(IOperateLogDao operateLogDao) { this.operateLogDao = operateLogDao; } }
package com.cg.project.castleglobalproject.base.network.base; public interface Method { int DEPRECATED_GET_OR_POST = -1; int GET = 0; int POST = 1; int PUT = 2; int DELETE = 3; int HEAD = 4; int OPTIONS = 5; int TRACE = 6; int PATCH = 7; }
package fr.lteconsulting.training.moviedb.ejb; import fr.lteconsulting.training.moviedb.model.Categorie; import javax.ejb.Stateless; import javax.persistence.TypedQuery; @Stateless public class GestionCategories extends GestionGenerique<Categorie> { public GestionCategories() throws NoSuchFieldException { super(Categorie.class); } public long getNbProduitParCategorieId(Integer id) { TypedQuery<Long> query = em.createQuery("select count(p) from Produit p where p.categorie.id=:id", Long.class); query.setParameter("id", id); return query.getSingleResult(); } }
package com.basepackage.service; import java.util.List; //import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import com.basepackage.bean.Csv; public class ReadFileImpl implements ReadFile{ @Override public void readCsv() { //read Csv List<Csv> csvList = new ArrayList<>(); try { List<String> lines= Files.readAllLines(Paths.get("F:\\java ecllipse\\Riya\\emp.csv")); for(String line :lines) { String[] result = line.split(","); csvList.add(new Csv(result[0],result[1], result[2],result[3])); // System.out.println(result[0]+":"+result[1]+":"+result[2]+":"+result[3]); } System.out.println(csvList); } catch(Exception e) { e.printStackTrace(); } } }
package com.tencent.mm.compatible.util; import java.security.PrivilegedAction; public final class i implements PrivilegedAction { private String dgD; private String dgE; public i(String str) { this.dgD = str; } public final Object run() { Object property = System.getProperty(this.dgD); return property == null ? this.dgE : property; } }
package io.github.jamesdonoh.halfpricesushi.model; import android.content.Context; import android.util.Log; import org.json.JSONArray; import java.util.List; /** * Data access layer that provides caching and hides database implementation. */ public class OutletCache { private static final String TAG = OutletCache.class.getSimpleName(); private static List<Outlet> outlets = null; public static List<Outlet> getAllOutlets(Context context) { if (outlets == null) { outlets = OutletDatabaseHelper.getInstance(context).getAllOutlets(); } return outlets; } public static Outlet getOutletById(Context context, int outletId) { Log.d(TAG, "getOutletById(" + outletId + ")"); // TODO replace simple implementation with with more efficient version for (Outlet outlet : getAllOutlets(context)) { if (outlet.getId() == outletId) { return outlet; } } throw new IllegalArgumentException("Unknown outlet ID: " + outletId); } public static boolean hasOutletData(Context context) { return OutletDatabaseHelper.getInstance(context).hasOutletData(); } public static void updateOutletData(Context context, JSONArray jsonArray) { OutletDatabaseHelper.getInstance(context).updateOutletData(jsonArray); } public static void storeOutletRating(Context context, Outlet outlet) { // Store rating in local database OutletDatabaseHelper.getInstance(context).replaceRating(outlet); // Send rating to API OutletApi.getInstance(context).sendRating(outlet); } }
package com.ibm.xml.parser; import org.w3c.dom.*; import com.ibm.esc.xml.core.*; /** * Type comment */ public class TXPI extends Child implements ProcessingInstruction { private String name = null; private String data = null; /** * Constructor. * @param name The first token following the markup. * @param data From the first non white space character after PI target (<var>name</var>) * to the character immediately preceding the <code>?&gt;</code>. */ public TXPI(String name, String data) { this.name = name; if (data.length() > 0) { int start = 0; while (start < data.length() && XMLChar.isSpace(data.charAt(start))) start ++; this.data = data.substring(start); } else this.data = data; } /** * Returns the data of the PI. The PI data is from the character immediately after the * PI name to the character immediately preceding the <code>?&gt;</code>. * <p>This method is defined by DOM. * @return The PI data. * @see #setData */ public String getData() { return this.data; } /** * <p>This method is defined by DOM. * */ public String getNodeName() { return getTarget(); } /** * Returns that this object is a PI Node. * <p>This method is defined by DOM. * @return PI Node indicator. */ public short getNodeType() { return Node.PROCESSING_INSTRUCTION_NODE; } /** * <p>This method is defined by DOM. * * @see #getName */ public String getTarget() { return this.name; } /** * Return all text associated with this Node without considering entities. * <p>This method is defined by Child. * @return Always returns <var>""</var>. * @see com.ibm.xml.parser.Child#toXMLString */ public String getText() { return ""; } /** * Sets the data of the PI. The PI data is from the character immediately after the * PI name to the character immediately preceding the <code>?&gt;</code>. * <p>This method is defined by DOM. * @param data The PI data. * @see #getData */ public void setData(String data) { this.data = data; //clearDigest(); } }
package com.vacoola.backend.dao; import com.vacoola.backend.entity.User; import org.hibernate.Query; import org.hibernate.SessionFactory; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Transactional public class UserDaoImpl implements UserDao { private SessionFactory sessionFactory; public SessionFactory getSessionFactory() { return sessionFactory; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @Override public void save(User user) { if (user.getAdmin()==null) { user.setAdmin(false); } sessionFactory.getCurrentSession().save(user); } @Override public void update(User user) { if (user.getAdmin()==null) { user.setAdmin(false); } sessionFactory.getCurrentSession().update(user); } @Override public void delete(User user) { sessionFactory.getCurrentSession().delete(user); } /*NOP*/ @Override public List<User> getPageUsers(long from, long pageSize) { Query query = sessionFactory.getCurrentSession().createQuery("from User"); query.setFirstResult((int)from); query.setMaxResults((int)pageSize); return (List<User>)query.list(); } @Override public List<User> getAllUsers() { return (List<User>) sessionFactory.getCurrentSession().createQuery("from User").list(); } @Override public long countUsers() { List<Object> list = sessionFactory.getCurrentSession().createQuery("select COUNT(*) from User").list(); return (long) list.get(0); } }
package game.util; import java.awt.*; /** * Created by Stephen on 12/17/2014. */ public final class ColorUtil { private static final float MAGIC_NUMBER = 0.618033989f; private static final float SATURATION = 0.57f; private static final float VALUE = 0.82f; private static float _hue = (float) Math.random(); public static Color nextColor() { _hue += MAGIC_NUMBER; _hue %= 1; return hsvToRgb(_hue, SATURATION, VALUE); } private static Color hsvToRgb(float h, float s, float v) { float f = (6 * h) % 1; float p = v * (1 - s); float q = v * (1 - f * s); float t = v * (1 - (1 - f) * s); switch ((int)(6 * h)) { case 0: return new Color(v, t, p); case 1: return new Color(q, v, p); case 2: return new Color(p, v, t); case 3: return new Color(p, q, v); case 4: return new Color(t, p, v); case 5: return new Color(v, p, q); } throw new IllegalStateException("Should not get here."); } }
package de.bringmeister.data; import com.google.gson.annotations.Expose; import de.bringmeister.common.JsonPriceUnit; import javax.money.Monetary; import lombok.Data; @Data public class JsonPriceEntry { private String id; @Expose private Price price; @Expose private JsonPriceUnit unit; @Data public class Price{ @Expose private String currency; private Double value; public void setValue(Double value){ this.value = value; } public void setCurrency(String code){ Monetary.getCurrency("code"); currency = code; } } }
package com.mes.old.meta; // Generated 2017-5-22 1:25:24 by Hibernate Tools 5.2.1.Final /** * IvWarehousemanagerId generated by hbm2java */ public class IvWarehousemanagerId implements java.io.Serializable { private String warehouseid; private String employeeid; private String duty; private byte isdefault; private String warehousename; private String employeename; private String deptid; private String dutydesc; private String shortening; private String notes; private String warehousetype; private String address; public IvWarehousemanagerId() { } public IvWarehousemanagerId(String warehouseid, String employeeid, byte isdefault, String employeename) { this.warehouseid = warehouseid; this.employeeid = employeeid; this.isdefault = isdefault; this.employeename = employeename; } public IvWarehousemanagerId(String warehouseid, String employeeid, String duty, byte isdefault, String warehousename, String employeename, String deptid, String dutydesc, String shortening, String notes, String warehousetype, String address) { this.warehouseid = warehouseid; this.employeeid = employeeid; this.duty = duty; this.isdefault = isdefault; this.warehousename = warehousename; this.employeename = employeename; this.deptid = deptid; this.dutydesc = dutydesc; this.shortening = shortening; this.notes = notes; this.warehousetype = warehousetype; this.address = address; } public String getWarehouseid() { return this.warehouseid; } public void setWarehouseid(String warehouseid) { this.warehouseid = warehouseid; } public String getEmployeeid() { return this.employeeid; } public void setEmployeeid(String employeeid) { this.employeeid = employeeid; } public String getDuty() { return this.duty; } public void setDuty(String duty) { this.duty = duty; } public byte getIsdefault() { return this.isdefault; } public void setIsdefault(byte isdefault) { this.isdefault = isdefault; } public String getWarehousename() { return this.warehousename; } public void setWarehousename(String warehousename) { this.warehousename = warehousename; } public String getEmployeename() { return this.employeename; } public void setEmployeename(String employeename) { this.employeename = employeename; } public String getDeptid() { return this.deptid; } public void setDeptid(String deptid) { this.deptid = deptid; } public String getDutydesc() { return this.dutydesc; } public void setDutydesc(String dutydesc) { this.dutydesc = dutydesc; } public String getShortening() { return this.shortening; } public void setShortening(String shortening) { this.shortening = shortening; } public String getNotes() { return this.notes; } public void setNotes(String notes) { this.notes = notes; } public String getWarehousetype() { return this.warehousetype; } public void setWarehousetype(String warehousetype) { this.warehousetype = warehousetype; } public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof IvWarehousemanagerId)) return false; IvWarehousemanagerId castOther = (IvWarehousemanagerId) other; return ((this.getWarehouseid() == castOther.getWarehouseid()) || (this.getWarehouseid() != null && castOther.getWarehouseid() != null && this.getWarehouseid().equals(castOther.getWarehouseid()))) && ((this.getEmployeeid() == castOther.getEmployeeid()) || (this.getEmployeeid() != null && castOther.getEmployeeid() != null && this.getEmployeeid().equals(castOther.getEmployeeid()))) && ((this.getDuty() == castOther.getDuty()) || (this.getDuty() != null && castOther.getDuty() != null && this.getDuty().equals(castOther.getDuty()))) && (this.getIsdefault() == castOther.getIsdefault()) && ((this.getWarehousename() == castOther.getWarehousename()) || (this.getWarehousename() != null && castOther.getWarehousename() != null && this.getWarehousename().equals(castOther.getWarehousename()))) && ((this.getEmployeename() == castOther.getEmployeename()) || (this.getEmployeename() != null && castOther.getEmployeename() != null && this.getEmployeename().equals(castOther.getEmployeename()))) && ((this.getDeptid() == castOther.getDeptid()) || (this.getDeptid() != null && castOther.getDeptid() != null && this.getDeptid().equals(castOther.getDeptid()))) && ((this.getDutydesc() == castOther.getDutydesc()) || (this.getDutydesc() != null && castOther.getDutydesc() != null && this.getDutydesc().equals(castOther.getDutydesc()))) && ((this.getShortening() == castOther.getShortening()) || (this.getShortening() != null && castOther.getShortening() != null && this.getShortening().equals(castOther.getShortening()))) && ((this.getNotes() == castOther.getNotes()) || (this.getNotes() != null && castOther.getNotes() != null && this.getNotes().equals(castOther.getNotes()))) && ((this.getWarehousetype() == castOther.getWarehousetype()) || (this.getWarehousetype() != null && castOther.getWarehousetype() != null && this.getWarehousetype().equals(castOther.getWarehousetype()))) && ((this.getAddress() == castOther.getAddress()) || (this.getAddress() != null && castOther.getAddress() != null && this.getAddress().equals(castOther.getAddress()))); } public int hashCode() { int result = 17; result = 37 * result + (getWarehouseid() == null ? 0 : this.getWarehouseid().hashCode()); result = 37 * result + (getEmployeeid() == null ? 0 : this.getEmployeeid().hashCode()); result = 37 * result + (getDuty() == null ? 0 : this.getDuty().hashCode()); result = 37 * result + this.getIsdefault(); result = 37 * result + (getWarehousename() == null ? 0 : this.getWarehousename().hashCode()); result = 37 * result + (getEmployeename() == null ? 0 : this.getEmployeename().hashCode()); result = 37 * result + (getDeptid() == null ? 0 : this.getDeptid().hashCode()); result = 37 * result + (getDutydesc() == null ? 0 : this.getDutydesc().hashCode()); result = 37 * result + (getShortening() == null ? 0 : this.getShortening().hashCode()); result = 37 * result + (getNotes() == null ? 0 : this.getNotes().hashCode()); result = 37 * result + (getWarehousetype() == null ? 0 : this.getWarehousetype().hashCode()); result = 37 * result + (getAddress() == null ? 0 : this.getAddress().hashCode()); return result; } }
package com.dennistjahyadigotama.soaya.activities; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonArrayRequest; import com.android.volley.toolbox.Volley; import com.dennistjahyadigotama.soaya.R; import com.dennistjahyadigotama.soaya.User; import com.dennistjahyadigotama.soaya.activities.CategoryActivity.adapter.CategoryGetter; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Created by Denn on 8/5/2016. */ public class SelectCategoryActivity extends AppCompatActivity { RecyclerView recyclerView; RequestQueue requestQueue; List<CategoryGetter> categoryGetterList = new ArrayList<>(); String url= User.selectCategoryActivityUrl; SelectCategoryAdapter adapter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.select_category_activity); requestQueue = Volley.newRequestQueue(this); recyclerView = (RecyclerView)findViewById(R.id.recycler_view); adapter = new SelectCategoryAdapter(categoryGetterList,this); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(layoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); GetData(); } private void GetData() { JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(url+"?GetCategory=a", new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { String id,name,picurl,subsname,row,type; try { for(int i=0;i<response.length();i++) { JSONObject jsonObject = response.getJSONObject(i); id= jsonObject.getString("id"); name=jsonObject.getString("name"); picurl=jsonObject.getString("picurl"); subsname=jsonObject.getString("subsname"); row=jsonObject.getString("rows"); type=jsonObject.getString("type"); CategoryGetter categoryGetter = new CategoryGetter(); categoryGetter.setId(id); categoryGetter.setName(name); categoryGetter.setPicurl(picurl); categoryGetter.setSubsname(subsname); categoryGetter.setType(type); categoryGetter.setRow(row); categoryGetterList.add(categoryGetter); } Collections.sort(categoryGetterList, new Comparator<CategoryGetter>() { @Override public int compare(CategoryGetter lhs, CategoryGetter rhs) { return lhs.getRow().compareTo(rhs.getRow()); } }); adapter.notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); requestQueue.add(jsonArrayRequest); } @Override public void onBackPressed() { super.onBackPressed(); Intent returnIntent = new Intent(); setResult(Activity.RESULT_CANCELED,returnIntent); finish(); } }
package nb.service; import nb.dao.AssetDao; import nb.dao.AssetDaoImpl; import nb.dao.AssetHistoryDao; import nb.dao.LotHistoryDao; import nb.domain.Asset; import nb.domain.AssetHistory; import nb.domain.Bid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; import static nb.controller.util.StringUtils.getBidDateFormatted; import static nb.controller.util.StringUtils.getExchangeName; @Service //(name ="assetServiceImpl") @Transactional public class AssetServiceImpl implements AssetService { @Autowired private AssetHistoryDao assetHistoryDao; @Autowired private AssetDao assetDao; @Autowired private LotHistoryDao lotHistoryDao; public AssetServiceImpl() { } public AssetServiceImpl(AssetDaoImpl assetDao) { this.assetDao = assetDao; } public AssetDao getAssetDao() { return assetDao; } public void setAssetDao(AssetDao assetDao) { this.assetDao = assetDao; } public AssetHistoryDao getAssetHistoryDao() { return assetHistoryDao; } public void setAssetHistoryDao(AssetHistoryDao assetHistoryDao) { this.assetHistoryDao = assetHistoryDao; } public LotHistoryDao getLotHistoryDao() { return lotHistoryDao; } public void setLotHistoryDao(LotHistoryDao lotHistoryDao) { this.lotHistoryDao = lotHistoryDao; } @Override @Transactional(readOnly = true) public Asset getAsset(Long id) { return assetDao.read(id); } @Override public boolean createAsset(Asset asset) { assetDao.create(asset); return true; } @Override public boolean createAsset(String userName, Asset asset) { assetHistoryDao.create(new AssetHistory(userName, asset)); assetDao.create(asset); return true; } @Override public boolean updateAsset(Asset asset) { return assetDao.update(asset); } @Override public boolean updateAsset(String userName, Asset asset) { assetHistoryDao.create(new AssetHistory(userName, asset)); return assetDao.update(asset); } @Override public boolean delete(Long id) { assetDao.delete(assetDao.read(id)); return true; } @Override public boolean delete(Asset asset) { assetDao.delete(asset); return true; } @Override @Transactional(readOnly = true) public List<Asset> getAssetsByPortion(int num) { return assetDao.findAll(num); } @Override @Transactional(readOnly = true) public Long getTotalCountOfAssets() { return assetDao.totalCount(); } @Override public BigDecimal getTotalSumOfAssets() { return assetDao.totalSum(); } @Override @Transactional(readOnly = true) public List getAll() { return assetDao.findAll(); } @Override @Transactional(readOnly = true) public List findAllSuccessBids(Date startBidDate, Date endBidDate) { return assetDao.findAllSuccessBids(startBidDate, endBidDate); } @Override @Transactional(readOnly = true) public List findAllSuccessBids(Date startBidDate, Date endBidDate, int portion) { return assetDao.findAllSuccessBids(startBidDate, endBidDate, portion); } @Override @Transactional(readOnly = true) public List getRegions() { return assetDao.getRegions(); } @Override @Transactional(readOnly = true) public List getTypes() { return assetDao.getTypes(); } @Override @Transactional(readOnly = true) public List getAssetsByInNum(String inn) { return assetDao.getAssetsByINum(inn); } @Override @Transactional(readOnly = true) public List getAllAssetsByInNum(String inn) { return assetDao.getAllAssetsByINum(inn); } @Override @Transactional(readOnly = true) public List getAllBidDates() { return assetDao.getAllBidDates(); } @Override @Transactional(readOnly = true) public List getExchanges() { return assetDao.getExchanges(); } @Override @Transactional(readOnly = true) public List getDecisionNumbers() { return assetDao.getDecisionNumbers(); } @Override @Transactional(readOnly = true) public BigDecimal getFirstAccPrice(Long assId) { return assetHistoryDao.getFirstAccPrice(assId); } @Override @Transactional(readOnly = true) public BigDecimal getFirstAccPrice(Asset asset) { return assetHistoryDao.getFirstAccPrice(asset.getId()); } @Override @Transactional(readOnly = true) public BigDecimal getLastAccPrice(Asset asset) { return assetHistoryDao.getLastAccPrice(asset.getId()); } @Override @Transactional(readOnly = true) public BigDecimal getLastAccPrice(Long id) { return assetHistoryDao.getLastAccPrice(id); } @Override @Transactional(readOnly = true) public List getLotIdHistoryByAsset(Long assId) { return assetHistoryDao.getLotIdHistoryByAsset(assId); } @Override @Transactional(readOnly = true) public BigDecimal getAccPriceByLotIdHistory(Long assetId, Long lotId) { return assetHistoryDao.getAccPriceByLotIdHistory(assetId, lotId); } @Override @Transactional(readOnly = true) public List getDateAndAccPriceHistoryByAsset(Long assId) { return assetHistoryDao.getDateAndAccPriceHistoryByAsset(assId); } @Override public List getAssetHistory(String inn) { List<String> rezList = new ArrayList<>(); Asset asset = (Asset) getAllAssetsByInNum(inn).get(0); List<Long> lotIdList = getLotIdHistoryByAsset(asset.getId()); lotIdList.forEach(lotId -> { List<Bid> bidList = lotHistoryDao.getLotHistoryAggregatedByBid(lotId); bidList.stream() .sorted() .map(bid -> String.join("||", asset.getInn(), lotId.toString(), getExchangeName(bid), getBidDateFormatted(bid), getAccPriceByLotIdHistory(asset.getId(), lotId).toString())) .forEach(rezList::add); }); return rezList; } }
package com.esc.fms.service.file; import com.esc.fms.entity.FileOperationHistory; /** * Created by tangjie on 2017/9/17. */ public interface FileOperationHistoryService { int insert(FileOperationHistory record); }
package com.saasbp.auth.adapter.in.web; import java.util.UUID; import javax.validation.constraints.NotNull; public class EmailConfirmationDto { @NotNull private UUID code; public UUID getCode() { return code; } public void setCode(UUID code) { this.code = code; } }
package com.gerray.fmsystem.ContractorModule; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.Spinner; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDialogFragment; import com.gerray.fmsystem.R; import com.google.android.material.textfield.TextInputEditText; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class UpdateDialog extends AppCompatDialogFragment { private TextInputEditText edCost; private Spinner edStatus; private final String text; public UpdateDialog(String text) { this.text = text; } @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.ed_workdet, null, false); edStatus = view.findViewById(R.id.status_spinner); edCost = view.findViewById(R.id.update_cost); builder.setView(view) .setTitle("Update Details") .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .setPositiveButton("Update", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { updateWork(text); } }); return builder.create(); } public void updateWork(String workID) { final DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("Work Orders").child(workID); databaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { String status = edStatus.getSelectedItem().toString(); Integer cost = Integer.valueOf(edCost.getText().toString().trim()); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { if (snapshot.child("cost").exists()) { databaseReference.child("cost").setValue(cost); }else { databaseReference.child("cost").setValue(cost); } if (snapshot.child("status").exists()) { databaseReference.child("status").setValue(status); } } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } }
package com.akexorcist.myapplication.adpter.holder; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; import com.akexorcist.myapplication.R; /** * Created by Akexorcist on 6/20/2016 AD. */ public class UserMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvUserName; public TextView tvMessage; public UserMessageViewHolder(View itemView) { super(itemView); tvUserName = (TextView) itemView.findViewById(R.id.tv_user_name); tvMessage = (TextView) itemView.findViewById(R.id.tv_message); } }
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.commerceservices.order.hook.impl; import de.hybris.platform.commerceservices.enums.QuoteAction; import de.hybris.platform.commerceservices.enums.QuoteUserType; import de.hybris.platform.commerceservices.order.exceptions.IllegalQuoteStateException; import de.hybris.platform.commerceservices.order.hook.CommerceCartMetadataUpdateMethodHook; import de.hybris.platform.commerceservices.order.strategies.QuoteActionValidationStrategy; import de.hybris.platform.commerceservices.order.strategies.QuoteUserIdentificationStrategy; import de.hybris.platform.commerceservices.order.strategies.QuoteUserTypeIdentificationStrategy; import de.hybris.platform.commerceservices.service.data.CommerceCartMetadataParameter; import de.hybris.platform.commerceservices.util.QuoteExpirationTimeUtils; import de.hybris.platform.core.model.order.CartModel; import de.hybris.platform.core.model.order.QuoteModel; import de.hybris.platform.core.model.user.UserModel; import de.hybris.platform.servicelayer.time.TimeService; import java.text.DateFormat; import java.util.Date; import java.util.Optional; import org.springframework.beans.factory.annotation.Required; /** * Validates cart metadata attributes (i.e. name, description) for a cart created from a quote using quote specific * rules. */ public class QuoteCommerceCartMetadataUpdateValidationHook implements CommerceCartMetadataUpdateMethodHook { private QuoteActionValidationStrategy quoteActionValidationStrategy; private QuoteUserIdentificationStrategy quoteUserIdentificationStrategy; private QuoteUserTypeIdentificationStrategy quoteUserTypeIdentificationStrategy; private TimeService timeService; /** * Validates cart metadata attributes (name, description, and expiration time) for a cart created from a quote using * quote specific rules. Updates to a cart associated with a quote can only be done for the quote states linked to * Save action. * * A buyer cannot set or remove the expiration time for a quote. A seller cannot set name and description attributes. * Also, expiration time when present must be valid as per * {@link QuoteExpirationTimeUtils#isExpirationTimeValid(Date, Date)}. A seller approver cannot set cart metadata * attributes. * * @param parameter * a bean holding any number of additional attributes a client may want to pass to the method * @throws IllegalArgumentException * if any of the attributes cannot be set by the user as per the quote rules or if the type of the user * cannot be determined * @throws IllegalQuoteStateException * if the cart is associated with a quote for which the operation cannot be performed * */ @Override public void beforeMetadataUpdate(final CommerceCartMetadataParameter parameter) { final CartModel cart = parameter.getCart(); final QuoteModel cartQuoteModel = cart.getQuoteReference(); if (cartQuoteModel == null) { return; } final UserModel quoteUser = getQuoteUserIdentificationStrategy().getCurrentQuoteUser(); getQuoteActionValidationStrategy().validate(QuoteAction.SAVE, cartQuoteModel, quoteUser); final QuoteUserType quoteUserType = getQuoteUserTypeIdentificationStrategy().getCurrentQuoteUserType(quoteUser).orElseThrow( () -> new IllegalArgumentException(String.format("Failed to determine quote user's [%s] type.", quoteUser.getPk()))); validateParameter(parameter, quoteUserType); } protected void validateParameter(final CommerceCartMetadataParameter parameter, final QuoteUserType quoteUserType) { final Optional<Date> optionalExpirationTime = parameter.getExpirationTime(); if (QuoteUserType.BUYER.equals(quoteUserType)) { if (optionalExpirationTime.isPresent() || parameter.isRemoveExpirationTime()) { throw new IllegalArgumentException("Buyer is not allowed to modify expiration time of a cart created from a quote."); } } else if (QuoteUserType.SELLER.equals(quoteUserType)) { optionalExpirationTime.ifPresent(expirationTime -> validateExpirationTime(expirationTime)); if (parameter.getName().isPresent() || parameter.getDescription().isPresent()) { throw new IllegalArgumentException( "Seller is not allowed to modify name or description of a cart created from a quote."); } } else if (QuoteUserType.SELLERAPPROVER.equals(quoteUserType)) { throw new IllegalArgumentException( "Seller approver is not allowed to modify cart's metadata of a cart created from a quote."); } else { throw new IllegalArgumentException("Unknown quote user type."); } } protected void validateExpirationTime(final Date expirationTime) { if (!QuoteExpirationTimeUtils.isExpirationTimeValid(expirationTime, getTimeService().getCurrentDateWithTimeNormalized())) { final DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); final String expirationTimeString = expirationTime == null ? "null" : df.format(expirationTime); throw new IllegalArgumentException(String.format("Invalid quote expiration time [%s].", expirationTimeString)); } } @Override public void afterMetadataUpdate(final CommerceCartMetadataParameter parameter) { //empty } protected QuoteActionValidationStrategy getQuoteActionValidationStrategy() { return quoteActionValidationStrategy; } @Required public void setQuoteActionValidationStrategy(final QuoteActionValidationStrategy quoteActionValidationStrategy) { this.quoteActionValidationStrategy = quoteActionValidationStrategy; } protected QuoteUserIdentificationStrategy getQuoteUserIdentificationStrategy() { return quoteUserIdentificationStrategy; } @Required public void setQuoteUserIdentificationStrategy(final QuoteUserIdentificationStrategy quoteUserIdentificationStrategy) { this.quoteUserIdentificationStrategy = quoteUserIdentificationStrategy; } protected QuoteUserTypeIdentificationStrategy getQuoteUserTypeIdentificationStrategy() { return quoteUserTypeIdentificationStrategy; } @Required public void setQuoteUserTypeIdentificationStrategy( final QuoteUserTypeIdentificationStrategy quoteUserTypeIdentificationStrategy) { this.quoteUserTypeIdentificationStrategy = quoteUserTypeIdentificationStrategy; } protected TimeService getTimeService() { return timeService; } @Required public void setTimeService(final TimeService timeService) { this.timeService = timeService; } }
package botenanna.display; import botenanna.BotenAnnaBot; import botenanna.BotenAnnaWindow; import botenanna.behaviortree.BehaviorTree; import botenanna.game.Situation; import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.scene.paint.Color; import javafx.scene.text.Font; import java.io.IOException; /** Display for bot info */ public class BotInfoDisplay extends InfoDisplay { private static final Color BLUE = new Color(.34, .42, 1, 1); private static final Color ORANGE = new Color(1, 0.7, 0.3, 1); private BotenAnnaBot bot; public BotInfoDisplay(BotenAnnaBot bot) { super("Car #" + bot.getIndex(), bot.getTeam() == BotenAnnaBot.Team.BLUE ? BLUE : ORANGE); this.bot = bot; //addChangeBtButton(); } /** Add button to header that allows changing of behaviour tree. */ private void addChangeBtButton() { Button changeBt = new Button("Tree"); changeBt.setFont(new Font(10)); changeBt.setPadding(new Insets(1, 4, 1, 4)); changeBt.setPrefHeight(16); changeBt.setOnAction(e -> changeBehaviourTree()); header.getChildren().add(changeBt); } /** Update info displayed. */ public void update() { Situation input = bot.getLastInputReceived(); if (input == null) return; infoLabel.setText(String.format( "Pos: %s\n" + "Possession: %b\n" + "Executing: %s", input.getMyCar().getPosition().toStringFixedSize(), input.hasPossession(input.myPlayerIndex), bot.getBehaviorTree().getCurrentNodeAsString())); } /** Change the behaviour tree of the bot connected to this display. */ private void changeBehaviourTree() { try { BehaviorTree tree = BotenAnnaWindow.defaultBTBuilder.buildFromFileChooser(); if (tree != null) { bot.setBehaviorTree(tree); } } catch (IOException e) { // Do nothing } } }
package android.support.v7.widget; import android.support.v7.widget.RecyclerView.e.b; import android.support.v7.widget.RecyclerView.t; class RecyclerView$f implements b { final /* synthetic */ RecyclerView RQ; private RecyclerView$f(RecyclerView recyclerView) { this.RQ = recyclerView; } /* synthetic */ RecyclerView$f(RecyclerView recyclerView, byte b) { this(recyclerView); } public final void l(t tVar) { tVar.T(true); if (tVar.SZ != null && tVar.Ta == null) { tVar.SZ = null; } tVar.Ta = null; if (!t.w(tVar) && !RecyclerView.c(this.RQ, tVar.SU) && tVar.gu()) { this.RQ.removeDetachedView(tVar.SU, false); } } }
package com.tencent.mm.plugin.appbrand.jsapi.wifi.wifisdk.internal; import android.content.BroadcastReceiver; import android.content.Context; import android.net.ConnectivityManager; import android.net.wifi.WifiConfiguration; import android.os.Build.VERSION; import android.os.Handler; import android.os.Looper; import android.os.Message; import java.lang.reflect.Proxy; public final class a { private com.tencent.mm.plugin.appbrand.jsapi.wifi.wifisdk.a gdF; public Context gdG; a gdH = null; b gdI = null; public WifiConfiguration gdJ = null; ConnectivityManager gdK; private int gdL = 0; private final int gdM = 13000; public boolean gdr = false; public BroadcastReceiver gds = null; public String gdv; public String gdw; public Handler mHandler = null; private static Object a(a aVar, String str) { return Proxy.newProxyInstance(Class.forName(str).getClassLoader(), new Class[]{r0}, aVar); } public a(com.tencent.mm.plugin.appbrand.jsapi.wifi.wifisdk.a aVar, Context context) { this.gdF = aVar; this.gdG = context; try { this.gdK = (ConnectivityManager) this.gdG.getSystemService("connectivity"); } catch (Exception e) { } this.mHandler = new Handler(context.getMainLooper()) { public final void handleMessage(Message message) { if (message != null) { switch (message.what) { case 1: if (!a.this.akx()) { a.this.ui("fail to connect wifi:time out"); return; } return; default: return; } } } }; } public final boolean a(WifiConfiguration wifiConfiguration) { if (wifiConfiguration == null || wifiConfiguration.networkId == d.gdP || this.gdK == null) { return false; } try { Class cls = Class.forName("android.net.wifi.WifiManager"); String str; Object a; Class cls2; if (VERSION.SDK_INT < 16) { cls.getMethod("asyncConnect", new Class[]{Context.class, Handler.class}).invoke(c.bgP, new Object[]{this.gdG, this.mHandler}); cls.getMethod("connectNetwork", new Class[]{Integer.TYPE}).invoke(c.bgP, new Object[]{Integer.valueOf(wifiConfiguration.networkId)}); return true; } else if (VERSION.SDK_INT == 16) { str = "android.net.wifi.WifiManager$ChannelListener"; if (this.gdI == null) { this.gdI = new b(this); } a = a(this.gdH, str); cls2 = Class.forName(str); Object invoke = cls.getMethod("initialize", new Class[]{Context.class, Looper.class, cls2}).invoke(c.bgP, new Object[]{this.gdG, this.gdG.getMainLooper(), a}); String str2 = "android.net.wifi.WifiManager$ActionListener"; if (this.gdH == null) { this.gdH = new a(this); } Object a2 = a(this.gdH, str2); Class cls3 = Class.forName(str2); cls.getMethod("connect", new Class[]{Class.forName("android.net.wifi.WifiManager$Channel"), Integer.TYPE, cls3}).invoke(c.bgP, new Object[]{invoke, Integer.valueOf(wifiConfiguration.networkId), a2}); return true; } else { if (this.gdH == null) { this.gdH = new a(this); } str = "android.net.wifi.WifiManager$ActionListener"; a = a(this.gdH, str); cls2 = Class.forName(str); cls.getMethod("connect", new Class[]{Integer.TYPE, cls2}).invoke(c.bgP, new Object[]{Integer.valueOf(wifiConfiguration.networkId), a}); return true; } } catch (Exception e) { return c.lb(wifiConfiguration.networkId); } } public final boolean akx() { return this.gdL == 3 || this.gdL == 2; } public final void ui(String str) { if (this.gdJ != null) { b.la(this.gdJ.networkId); g(false, str); new StringBuilder("cancelConnect, ").append(d.uj(this.gdJ.SSID)).append(" networkId:").append(this.gdJ.networkId); } } public final void kZ(int i) { if (this.gdL != i) { String str; this.gdL = i; StringBuilder stringBuilder = new StringBuilder("switchState:"); switch (this.gdL) { case 0: str = "STATE_NONE"; break; case 1: str = "STATE_CONNECTING"; break; case 2: str = "STATE_CONNECTED"; break; case 3: str = "STATE_FAIL"; break; default: str = "UnknowState"; break; } stringBuilder.append(str); } } public final void g(boolean z, String str) { if (!akx()) { if (this.gdF != null) { com.tencent.mm.plugin.appbrand.jsapi.wifi.wifisdk.a aVar = this.gdF; if (z) { str = "ok"; } aVar.uh(str); } this.mHandler.removeMessages(1); if (this.gdr) { this.gdG.unregisterReceiver(this.gds); this.gdr = false; } kZ(z ? 2 : 3); if (!z && this.gdJ != null) { b.la(this.gdJ.networkId); } } } }
package cn.eastseven; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; public class PoiDemo { public static void main(String[] args) throws Exception { File file = new File("src/main/resources/sanguozhi12.xls"); Workbook workbook = WorkbookFactory.create(file); Sheet sheet = workbook.getSheetAt(0); int physicalNumberOfRows = sheet.getPhysicalNumberOfRows(); int firstRowNum = sheet.getFirstRowNum(); int lastRowNum = sheet.getLastRowNum(); System.out.println("physicalNumberOfRows="+physicalNumberOfRows+",firstRowNum="+firstRowNum+",lastRowNum="+lastRowNum); Row firstRow = sheet.getRow(firstRowNum); int physicalNumberOfCells = firstRow.getPhysicalNumberOfCells(); System.out.println("physicalNumberOfCells="+physicalNumberOfCells); String createTable = "create table san_guo_zhi( \n"; for(int index = 0; index < physicalNumberOfCells; index++) { createTable += ",column"+index+" varchar(32) \n"; } createTable = createTable.replaceFirst(",", ""); createTable += ") DEFAULT CHARSET=utf8;"; System.out.println(createTable); String data = ""; for(int indexRow = 0; indexRow < physicalNumberOfRows; indexRow++) { Row row = sheet.getRow(indexRow); String insert = "insert san_guo_zhi values( "; for(int indexCol = 0; indexCol < physicalNumberOfCells; indexCol++) { Cell cell = row.getCell(indexCol); if(cell == null) { insert += ",null"; } else { switch (cell.getCellType()) { case Cell.CELL_TYPE_BLANK: insert += ",null"; break; case Cell.CELL_TYPE_BOOLEAN: insert += ",'"+cell.getBooleanCellValue()+"'"; break; case Cell.CELL_TYPE_ERROR: insert += ",null"; break; case Cell.CELL_TYPE_FORMULA: insert += ",null"; break; case Cell.CELL_TYPE_NUMERIC: insert += ",'"+cell.getNumericCellValue()+"'"; break; case Cell.CELL_TYPE_STRING: insert += ",'"+cell.getStringCellValue()+"'"; break; default: break; } } } insert = insert.replaceFirst(",", ""); insert += ");"; //System.out.println(insert); data += insert + "\n"; } File dataFile = new File("src/main/resources/data.sql"); if(dataFile.exists()) { dataFile.deleteOnExit(); } dataFile.createNewFile(); OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(dataFile), "utf-8"); out.write(data); out.flush(); out.close(); } }
package org.motechproject.server.model.rct; import org.motechproject.ws.rct.ControlGroup; import org.motechproject.ws.rct.PregnancyTrimester; import java.util.Set; public class Stratum { private Integer id; private RCTFacility facility; private PregnancyTrimester pregnancyTrimester; private PhoneOwnershipType phoneOwnership; private Integer size; private Set<ControlGroupAssignment> assignments; private Integer nextAssignment; private Boolean isActive; public boolean isActive() { return isActive; } public void setActive(boolean active) { isActive = active; } public ControlGroup groupAssigned(){ for (ControlGroupAssignment controlGroupAssignment : assignments) { if (controlGroupAssignment.hasAssignmentNumber(nextAssignment)) { return controlGroupAssignment.group(); } } return ControlGroup.NONE; } public void determineNextAssignment() { nextAssignment = (nextAssignment.equals(size)) ? 1 : (nextAssignment + 1); } public RCTFacility getRctFacility(){ return facility; } }
package bean.main; import java.util.List; public interface MainDAOInter { // 관심상품 버튼 눌렀는지 확인 select public Integer wishCheck(ProductDTO dto) throws Exception; // 관심상품 등록 insert public void wishInsert(ProductDTO dto) throws Exception; // 관심상품 삭제 delete public void wishDelete(ProductDTO dto) throws Exception; // 메인 페이지 전체상품 조회순 상품명, 이미지 8개 select public List getMainPd() throws Exception; // 상품목록 카테고리 select public List getCategory() throws Exception; // 카테고리별 상품목록 조회순 상품명, 이미지 select public List getCatePd(ProductListDTO dto) throws Exception; // 카테고리별 상품목록 Best (조회순 6개) 상품명, 이미지 select --> 관심상품 등록순으로 변경 예정 public List getCateBest(String category) throws Exception; // 카테고리별 상품개수 select count(*) public int catePdCount(String category) throws Exception; // 검색 상품목록 조회순 상품명, 이미지 select public List getSearchPd(ProductListDTO dto) throws Exception; // 검색 상품개수 select count(*) public int searchPdCount(String keyword) throws Exception; // // 상품 페이지 상품번호로 상품명, 이미지 select // public List getPd(int num) throws Exception; // 상품번호로 상품구매 url select public String getUrl(int num) throws Exception; // 아이디로 wishlist 상품번호 select --> 상품번호로 상품명, 이미지, 영양성분 select public List getWishPd(ProductListDTO dto) throws Exception; // 아이디로 관심상품 개수 select public int wishPdCount(String id) throws Exception; // 전체상품 조회순 select public List getAllPd(ProductListDTO dto) throws Exception; // 전체상품 조회순 상품명, 이미지 6개 select public List getAllBest() throws Exception; // 전체상품 개수 select count(*) public int allPdCount() throws Exception; // 관심상품 검색 관심상품 등록순 상품번호, 상품명, 이미지, 영양성분 select public List getWishSearch(ProductListDTO dto) throws Exception; // 관심상품 검색 개수 select count(*) public int wishSearchCount(ProductListDTO dto) throws Exception; // 관심상품 영양성분별 관심상품 등록순 상품번호, 상품명, 이미지, 영양성분 select public List getWishTagPd(ProductListDTO dto) throws Exception; // 관심상품 영양성분별 개수 select count(*) public int wishTagPdCount(ProductListDTO dto) throws Exception; // 관심상품 id로 전체삭제 delete public void wishAllDelete(String id) throws Exception; // 건강뉴스 select public List getHealthy() throws Exception; }
package model; import java.util.Date; /** * * @author gserafini */ public class Chamados { private String chamado; private Date dataEncerramento; public String getChamado() { return chamado; } public void setChamado(String chamado) { this.chamado = chamado; } public Date getDataEncerramento() { return dataEncerramento; } public void setDataEncerramento(Date dataEncerramento) { this.dataEncerramento = dataEncerramento; } public Chamados(String chamado, Date dataEncerramento) { this.chamado = chamado; this.dataEncerramento = dataEncerramento; } public Chamados(String chamado) { this.chamado = chamado; } public Chamados() { } }
package com.phone1000.martialstudyself.activitys; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import com.phone1000.martialstudyself.R; import com.phone1000.martialstudyself.adapeters.ParentOneVPAdapter; import com.phone1000.martialstudyself.adapeters.ParentTwoVPAdapter; import com.phone1000.martialstudyself.bases.BaseActivity; import com.phone1000.martialstudyself.fragment.ParentTwoAllFragment; import com.phone1000.martialstudyself.fragment.ParentTwoMenPaiFragment; import com.phone1000.martialstudyself.fragment.ParentTwoQiXieFragment; import com.phone1000.martialstudyself.fragment.ParentTwoWaiGuoFragment; import org.xutils.view.annotation.ContentView; import org.xutils.view.annotation.ViewInject; import org.xutils.x; import java.util.ArrayList; import java.util.List; @ContentView(R.layout.activity_parent_two) public class ParentTwoActivity extends BaseActivity implements View.OnClickListener { @ViewInject(R.id.parent_two_tab) private TabLayout mTab; @ViewInject(R.id.parent_two_viewpager) private ViewPager mViewPager; private ParentTwoVPAdapter adapter; @ViewInject(R.id.parent_two_back) private ImageView mBack; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_parent_two); x.view().inject(this); initView(); } private void initView() { adapter = new ParentTwoVPAdapter(getSupportFragmentManager(),getData()); mViewPager.setAdapter(adapter); mTab.setupWithViewPager(mViewPager); mBack.setOnClickListener(this); } private List<Fragment> getData() { List<Fragment> data = new ArrayList<>(); data.add(new ParentTwoAllFragment()); data.add(new ParentTwoMenPaiFragment()); data.add(new ParentTwoQiXieFragment()); data.add(new ParentTwoWaiGuoFragment()); return data; } @Override public void onClick(View v) { this.finish(); } }
package zadartravel.studioadriatic.com.zadartravel; import android.content.Context; import android.content.Intent; import android.os.Parcelable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.widget.ImageView; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.AsyncHttpResponseHandler; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import cz.msebera.android.httpclient.Header; public class MainActivity extends AppCompatActivity { public static final String API_LIST_URL = "http://www.zadar.travel/json.php?tag=lokacija&sort=cro365"; private RecyclerView mRecyclerView; private ZadarTravelAdapter mZadarTravelAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); AsyncHttpClient client = new AsyncHttpClient(); client.get(this, API_LIST_URL, new AsyncHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { try { JSONObject json = new JSONObject(new String(responseBody, "UTF-8")); JSONArray list = json.getJSONArray("lokacije"); final ArrayList<ZadarModel> zadarlist = new ArrayList<ZadarModel>(); for (int i = 0; i < list.length(); i++) { ZadarModel model = new ZadarModel();// inicijaliziranje klase JSONObject item = list.getJSONObject(i); model.setId_lokacija(String.valueOf(item.getString("id_lokacija"))); model.setId_smjestaj(String.valueOf(item.getString("id_smjestaj"))); model.setNaziv(String.valueOf(item.getString("naziv"))); model.setVrsta(String.valueOf(item.getString("vrsta"))); model.setTelefon(String.valueOf(item.getString("telefon"))); model.setMobitel(String.valueOf(item.getString("mobitel"))); model.setAdresa(String.valueOf(item.getString("adresa"))); model.setEmail(String.valueOf(item.getString("email"))); model.setZvjezdice(Integer.valueOf(item.getString("zvjezdice"))); model.setWeb(String.valueOf(item.getString("web"))); model.setDuzina(Double.valueOf(item.getString("duzina"))); model.setSirina(Double.valueOf(item.getString("sirina"))); model.setBrojlezajeva(Integer.valueOf(item.getString("brojlezajeva"))); model.setInternet(Integer.valueOf(item.getString("internet"))); model.setKlima(Integer.valueOf(item.getString("klima"))); model.setCroatia365(Integer.valueOf(item.getString("croatia365"))); model.setImages("http://zadar.travel/images/thumb10/"+item.getString("images")); //model.setOdmora(Integer.valueOf(item.getString("odmora"))); //model.setOdcentra(Integer.valueOf(item.getString("odcentra"))); model.setKucniljubimci(Integer.valueOf(item.getString("kucniljubimci"))); //model.setDostupno(Integer.valueOf(item.getString("dostupno"))); zadarlist.add(model); } mZadarTravelAdapter = new ZadarTravelAdapter(MainActivity.this, zadarlist, R.layout.item_layout);// dodajem adapter LinearLayoutManager llm = new LinearLayoutManager(MainActivity.this); mRecyclerView.setLayoutManager(llm); mRecyclerView.setAdapter(mZadarTravelAdapter);// namještam na recycler viewu adapter mZadarTravelAdapter.setOnItemClickListener(new ZadarTravelAdapter.OnItemClickListener() { @Override public void onItemClick(ZadarModel model) { Intent intent = new Intent(MainActivity.this, DetailsActivity.class); intent.putExtra(DetailsActivity.ZADARMODEL, model); startActivity(intent); } }); } catch (JSONException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { } }); }; }
package practice; public class MethodOverridingChildClass extends MethodOverridingParentClass { public void myMethod(){ System.out.println("I am a method from Child Class"); } public static void main(String [] args){ MethodOverridingChildClass obj = new MethodOverridingChildClass(); // It calls the child class method myMethod() obj.myMethod(); /* When parent class reference refers to the child class object * then the method of the child class (overriding method) is called. * This we call as runtime polymorphism */ MethodOverridingParentClass obj1 = new MethodOverridingChildClass(); // It calls the child class method myMethod() obj1.myMethod(); /* When Parent class reference refers to the parent class object * then the method of parent class (overriden method) is called. */ MethodOverridingParentClass obj2 = new MethodOverridingParentClass(); obj2.myMethod(); } }
package eu.tivian.musico.database; import android.provider.BaseColumns; /** * Contract class which describes the schema of the database used for this app. */ public final class DatabaseContract { /** * To prevent someone from accidentally instantiating the contract class, * make the constructor private. */ private DatabaseContract() { } /** * SQL statement used to list all albums present in the database. */ public static String SQL_LIST_ALL = "SELECT " + AlbumEntry.TABLE_NAME + "." + AlbumEntry._ID + ", " + ArtistEntry.TABLE_NAME + "." + ArtistEntry.COLUMN_NAME + ", " + AlbumEntry.TABLE_NAME + "." + AlbumEntry.COLUMN_TITLE + ", " + AlbumEntry.TABLE_NAME + "." + AlbumEntry.COLUMN_YEAR + ", " + GenreEntry.TABLE_NAME + "." + GenreEntry.COLUMN_NAME + ", " + AlbumEntry.TABLE_NAME + "." + AlbumEntry.COLUMN_COVER + ", " + PurchaseEntry.TABLE_NAME + "." + PurchaseEntry.COLUMN_DATE + ", " + StoreEntry.TABLE_NAME + "." + StoreEntry.COLUMN_NAME + ", " + PurchaseEntry.TABLE_NAME + "." + PurchaseEntry.COLUMN_PRICE + ", " + CurrencyEntry.TABLE_NAME + "." + CurrencyEntry.COLUMN_NAME + " " + "FROM " + AlbumEntry.TABLE_NAME + " " + "JOIN " + ArtistEntry.TABLE_NAME + " " + "ON " + ArtistEntry.TABLE_NAME + "." + ArtistEntry._ID + " = " + AlbumEntry.TABLE_NAME + "." + AlbumEntry.COLUMN_ARTIST_ID + " " + "JOIN " + GenreEntry.TABLE_NAME + " " + "ON " + GenreEntry.TABLE_NAME + "." + GenreEntry._ID + " = " + AlbumEntry.TABLE_NAME + "." + AlbumEntry.COLUMN_GENRE_ID + " " + "JOIN " + PurchaseEntry.TABLE_NAME + " " + "ON " + PurchaseEntry.TABLE_NAME + "." + PurchaseEntry.COLUMN_ALBUM_ID + " = " + AlbumEntry.TABLE_NAME + "." + AlbumEntry._ID + " " + "JOIN " + CurrencyEntry.TABLE_NAME + " " + "ON " + CurrencyEntry.TABLE_NAME + "." + CurrencyEntry._ID + " = " + PurchaseEntry.TABLE_NAME + "." + PurchaseEntry.COLUMN_CURRENCY_ID + " " + "LEFT OUTER JOIN " + StoreEntry.TABLE_NAME + " " + "ON " + StoreEntry.TABLE_NAME + "." + StoreEntry._ID + " = " + PurchaseEntry.TABLE_NAME + "." + PurchaseEntry.COLUMN_STORE_ID; /** * SQL statement used to list all tracks for chosen album. */ public static String SQL_LIST_TRACKS = "SELECT " + SongEntry.TABLE_NAME + "." + SongEntry.COLUMN_TITLE + ", " + SongEntry.TABLE_NAME + "." + SongEntry.COLUMN_DURATION + " " + "FROM " + TrackEntry.TABLE_NAME + ", " + SongEntry.TABLE_NAME + " " + "WHERE " + TrackEntry.TABLE_NAME + "." + TrackEntry.COLUMN_ALBUM_ID + " = ? " + "AND " + TrackEntry.TABLE_NAME + "." + TrackEntry.COLUMN_SONG_ID + " = " + SongEntry.TABLE_NAME + "." + SongEntry._ID; /** * Array of SQL statements executed when the database is created for the first time. * This field is used for things like database trigger creation, etc. */ public static String[] SQL_STATEMENTS = { "CREATE TRIGGER " + StoreEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + PurchaseEntry.TABLE_NAME + " " + "WHEN NOT EXISTS (SELECT * FROM " + PurchaseEntry.TABLE_NAME + " WHERE " + PurchaseEntry.COLUMN_STORE_ID + " = OLD." + PurchaseEntry.COLUMN_STORE_ID + ") " + "BEGIN " + "DELETE FROM " + StoreEntry.TABLE_NAME + " WHERE " + StoreEntry._ID + " = OLD." + PurchaseEntry.COLUMN_STORE_ID + "; " + "END", "CREATE TRIGGER " + CurrencyEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + PurchaseEntry.TABLE_NAME + " " + "WHEN NOT EXISTS (SELECT * FROM " + PurchaseEntry.TABLE_NAME + " WHERE " + PurchaseEntry.COLUMN_CURRENCY_ID + " = OLD." + PurchaseEntry.COLUMN_CURRENCY_ID + ") " + "BEGIN " + "DELETE FROM " + CurrencyEntry.TABLE_NAME + " WHERE " + CurrencyEntry._ID + " = OLD." + PurchaseEntry.COLUMN_CURRENCY_ID + "; " + "END", "CREATE TRIGGER " + AlbumEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + PurchaseEntry.TABLE_NAME + " " + "BEGIN " + "DELETE FROM " + AlbumEntry.TABLE_NAME + " WHERE " + AlbumEntry._ID + " = OLD." + PurchaseEntry.COLUMN_ALBUM_ID + "; " + "END", "CREATE TRIGGER " + TrackEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + AlbumEntry.TABLE_NAME + " " + "BEGIN " + "DELETE FROM " + TrackEntry.TABLE_NAME + " WHERE " + TrackEntry.COLUMN_ALBUM_ID + " = OLD." + AlbumEntry._ID + "; " + "END", "CREATE TRIGGER " + SongEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + TrackEntry.TABLE_NAME + " " + "WHEN NOT EXISTS (SELECT * FROM " + TrackEntry.TABLE_NAME + " WHERE " + TrackEntry.COLUMN_SONG_ID + " = OLD." + TrackEntry.COLUMN_SONG_ID + ") " + "BEGIN " + "DELETE FROM " + SongEntry.TABLE_NAME + " WHERE " + SongEntry._ID + " = OLD." + TrackEntry.COLUMN_SONG_ID + "; " + "END", "CREATE TRIGGER " + ArtistEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + AlbumEntry.TABLE_NAME + " " + "WHEN NOT EXISTS (SELECT * FROM " + AlbumEntry.TABLE_NAME + " WHERE " + AlbumEntry.COLUMN_ARTIST_ID + " = OLD." + AlbumEntry.COLUMN_ARTIST_ID + ") " + "BEGIN " + "DELETE FROM " + ArtistEntry.TABLE_NAME + " WHERE " + ArtistEntry._ID + " = OLD." + AlbumEntry.COLUMN_ARTIST_ID + "; " + "END", "CREATE TRIGGER " + GenreEntry.TABLE_NAME + "_cascade " + "AFTER DELETE ON " + AlbumEntry.TABLE_NAME + " " + "WHEN NOT EXISTS (SELECT * FROM " + AlbumEntry.TABLE_NAME + " WHERE " + AlbumEntry.COLUMN_GENRE_ID + " = OLD." + AlbumEntry.COLUMN_GENRE_ID + ") " + "BEGIN " + "DELETE FROM " + GenreEntry.TABLE_NAME + " WHERE " + GenreEntry._ID + " = OLD." + AlbumEntry.COLUMN_GENRE_ID + "; " + "END" }; /** * A representation of the schema for table containing songs. */ public static class SongEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "song"; /** * The name of the column for song title. */ public static final String COLUMN_TITLE = "title"; /** * The name of the column for the duration of the song. */ public static final String COLUMN_DURATION = "duration"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_TITLE + " TEXT NOT NULL, " + COLUMN_DURATION + " TEXT, " + "UNIQUE (" + COLUMN_TITLE + ", " + COLUMN_DURATION + ") " + ")"; } /** * A representation of the schema for table describing artists. */ public static class ArtistEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "artist"; /** * The name of the column for the name of the artist. */ public static final String COLUMN_NAME = "name"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_NAME + " TEXT UNIQUE NOT NULL " + ")"; } /** * A representation of the schema for table describing albums. */ public static class AlbumEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "album"; /** * The name of the column for the foreign key associated with the {@link ArtistEntry}{@code ._ID}. */ public static final String COLUMN_ARTIST_ID = "artist_id"; /** * The name of the column for he title of the album. */ public static final String COLUMN_TITLE = "title"; /** * The name of the column for the year of the original release of the album. */ public static final String COLUMN_YEAR = "year"; /** * The name of the column for the genre of the album. */ public static final String COLUMN_GENRE_ID = "genre_id"; /** * The name of the column for a blob representation of the JPEG for the album cover. */ public static final String COLUMN_COVER = "cover"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_ARTIST_ID + " INTEGER NOT NULL, " + COLUMN_TITLE + " TEXT NOT NULL, " + COLUMN_YEAR + " INTEGER NOT NULL, " + COLUMN_GENRE_ID + " INTEGER, " + COLUMN_COVER + " BLOB, " + "FOREIGN KEY (" + COLUMN_ARTIST_ID + ") REFERENCES " + ArtistEntry.TABLE_NAME + "(" + ArtistEntry._ID + "), " + "FOREIGN KEY (" + COLUMN_GENRE_ID + ") REFERENCES " + GenreEntry.TABLE_NAME + "(" + GenreEntry._ID + "), "+ "UNIQUE (" + COLUMN_ARTIST_ID + ", " + COLUMN_TITLE + ", " + COLUMN_YEAR + ") " + ")"; } /** * A representation of the schema for table of tracks. */ public static class TrackEntry { /** * The name of the table. */ public static final String TABLE_NAME = "track"; /** * The name of the column for the foreign key associated with the {@link SongEntry}{@code ._ID}. */ public static final String COLUMN_SONG_ID = "song_id"; /** * The name of the column for the foreign key associated with the {@link AlbumEntry}{@code ._ID}. */ public static final String COLUMN_ALBUM_ID = "album_id"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + COLUMN_SONG_ID + " INTEGER NOT NULL, " + COLUMN_ALBUM_ID + " INTEGER NOT NULL, " + "PRIMARY KEY (" + COLUMN_SONG_ID + ", " + COLUMN_ALBUM_ID + "), " + "FOREIGN KEY (" + COLUMN_SONG_ID + ") REFERENCES " + SongEntry.TABLE_NAME + "(" + SongEntry._ID + "), " + "FOREIGN KEY (" + COLUMN_ALBUM_ID + ") REFERENCES " + AlbumEntry.TABLE_NAME + "(" + AlbumEntry._ID + ") " + ")"; } /** * A representation of the schema for table of genres. */ public static class GenreEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "genre"; /** * The name of the column for the name of the genre. */ public static final String COLUMN_NAME = "name"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_NAME + " TEXT UNIQUE NOT NULL " + ")"; } /** * A representation of the schema for table of stores. */ public static class StoreEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "store"; /** * The name of the column for the name of the store. */ public static final String COLUMN_NAME = "name"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_NAME + " TEXT UNIQUE NOT NULL " + ")"; } /** * A representation of the schema for the table of currencies. */ public static class CurrencyEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "currency"; /** * The name of the column for the * {@link <a href="https://www.iban.com/currency-codes">ISO 4217</a>} encoded currency code. */ public static final String COLUMN_NAME = "name"; /** * The name of the column for the currency rate of the specific currency. * By default they're PLN based. */ public static final String COLUMN_RATE = "rate"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_NAME + " TEXT UNIQUE NOT NULL, " + COLUMN_RATE + " REAL " + ")"; } /** * A representation of the schema for the table of purchases. */ public static class PurchaseEntry implements BaseColumns { /** * The name of the table. */ public static final String TABLE_NAME = "purchase"; /** * The name of the column for the foreign key associated with the {@link AlbumEntry}{@code ._ID}. */ public static final String COLUMN_ALBUM_ID = "album_id"; /** * The name of the column for the foreign key associated with the {@link StoreEntry}{@code ._ID}. */ public static final String COLUMN_STORE_ID = "store_id"; /** * The name of the column for the price of the album. */ public static final String COLUMN_PRICE = "price"; /** * The name of the column for the foreign key associated with the {@link CurrencyEntry}{@code ._ID}. */ public static final String COLUMN_CURRENCY_ID = "currency_id"; /** * The name of the column for the date of the purchase. */ public static final String COLUMN_DATE = "date"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + COLUMN_ALBUM_ID + " INTEGER NOT NULL, " + COLUMN_STORE_ID + " INTEGER, " + COLUMN_PRICE + " REAL NOT NULL, " + COLUMN_CURRENCY_ID + " INTEGER NOT NULL, " + COLUMN_DATE + " INTEGER, " + "FOREIGN KEY (" + COLUMN_ALBUM_ID + ") REFERENCES " + AlbumEntry.TABLE_NAME + "(" + AlbumEntry._ID + "), " + "FOREIGN KEY (" + COLUMN_STORE_ID + ") REFERENCES " + StoreEntry.TABLE_NAME + "(" + StoreEntry._ID + "), " + "FOREIGN KEY (" + COLUMN_CURRENCY_ID + ") REFERENCES " + CurrencyEntry.TABLE_NAME + "(" + CurrencyEntry._ID + "), " + "UNIQUE (" + COLUMN_ALBUM_ID + ", " + COLUMN_STORE_ID + ", " + COLUMN_PRICE + ", " + COLUMN_CURRENCY_ID + ", " + COLUMN_DATE + ")" + ")"; } /** * A representation of the schema for table of settings. */ public static class SettingsEntry { /** * The name of the table. */ public static final String TABLE_NAME = "settings"; /** * The name of the column for the name of the setting key. */ public static final String COLUMN_KEY = "key"; /** * The name of the column for the name of the setting value. */ public static final String COLUMN_VALUE = "value"; /** * The setting key for the username. */ public static final String KEY_USERNAME = "username"; /** * The setting key for the chosen application language. */ public static final String KEY_LANGUAGE = "language"; /** * The setting key for the last date when the currency rates were updated. */ public static final String KEY_RATE_UPDATE = "rates_update"; /** * SQL statement used to create this table. */ static final String SQL_SCHEMA = "CREATE TABLE " + TABLE_NAME + " ( " + COLUMN_KEY + " TEXT PRIMARY KEY NOT NULL, " + COLUMN_VALUE + " TEXT " + ")"; /** * Default values for this table, supplied when the database is created for the first time. */ static final String SQL_DEFAULT = "INSERT INTO " + TABLE_NAME + " " + "VALUES ('" + KEY_LANGUAGE + "', 1)"; } }
package es.ubu.lsi.client; import java.io.*; import java.net.Socket; import es.ubu.lsi.common.*; import es.ubu.lsi.server.GameServer; /** * Implementa la interfaz GameClient. * * @author Antonio de los Mozos Alonso * @author Miguel Angel Leon Bardavio * @see GameClient * */ public class GameClientImpl implements GameClient { /** * Nombre o direccion del host. */ private String server; /** * Puerto de conexion al servidor. */ private int port; /** * Nickname del jugador. */ private String username; /** * ID con el que nos identifica el servidor. */ private int clientId; /** * Conector. */ private Socket clientSocket; /** * Flujo de salida. */ private ObjectOutputStream out; /** * Flujo de entrada. */ private ObjectInputStream in; /** * Hilo de escucha al servidor. */ private GameClientListener listener; /** * Inicializa los atributos pasados como argumentos. * * @param server Nombre del servidor. * @param port Puerto de conexion del servidor. * @param username Nombre de usuario. * @author Antonio de los Mozos Alonso */ public GameClientImpl(String server, int port, String username){ this.server = server; this.port = port; this.username = username; } /* (non-Javadoc) * @see es.ubu.lsi.client.GameClient#start() */ public boolean start(){ try { this.clientSocket = new Socket(this.server, this.port); this.out = new ObjectOutputStream(this.clientSocket.getOutputStream()); this.in = new ObjectInputStream(this.clientSocket.getInputStream()); this.out.writeObject(this.username); this.clientId = (Integer) this.in.readObject(); if (this.clientId == 0) { return false; }else{ Thread listenerThread = new Thread(this.listener = new GameClientListener()); listenerThread.start(); return true; } } catch (Exception e) { System.err.println("START EXCEPTION:"+e.getMessage()); return false; } } /* (non-Javadoc) * @see es.ubu.lsi.client.GameClient#sendElement(es.ubu.lsi.common.GameElement) */ public void sendElement(GameElement element){ try { this.out.writeObject(element); } catch (IOException e) { System.err.println("SEND ELEMENT IO EXCEPTION:" + e.getMessage()); } } /* (non-Javadoc) * @see es.ubu.lsi.client.GameClient#disconnect() */ public void disconnect(){ try { this.listener.listenerRunStatus = false; this.clientSocket.close(); } catch (IOException e) { System.err.println("DISCONNECT IO EXCEPTION:" + e.getMessage()); } } /** * Hilo principal del cliente. * <p> * Instancia al cliente y un hilo de escucha al servidor. Despues espera entrada por consola por parte del * usuario para el envio de la jugada al servidor. * <p> * El puerto de conexion es siempre el 1500. El servidor por defecto es localhost. * <p> * Ejemplo de llamada: 'java es.ubu.lsi.client.GameClientImpl 10.168.168.13 nickname'. * * @param args Recibe una direccion IP/Nombre de la máquina y un nickname como argumentos. * @author Miguel Angel Leon Bardavio */ public static void main(String[] args){ GameClientImpl client = new GameClientImpl(args[0], 1500, args[1]); try { if(client.start()){ BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)); String userInput; while ((userInput = stdIn.readLine().toUpperCase()) != null) { if (userInput.equals("PIEDRA") || userInput.equals("PAPEL") || userInput.equals("TIJERA")) { client.sendElement(new GameElement(client.clientId, ElementType.valueOf(userInput))); }else if (userInput.equals("LOGOUT") || userInput.equals("SHUTDOWN")) { client.sendElement(new GameElement(client.clientId, ElementType.valueOf(userInput))); client.disconnect(); break; }else { System.out.println("INVALID COMMAND"); } } }else{ System.err.println("Fallo al arrancar la aplicación del cliente."); } } catch (IOException e) { System.err.println("MAIN IO EXCEPTION:" + e.getMessage()); System.exit(1); } } /** * Hilo de escucha al servidor y muestra los mensajes que recibe del servidor por pantalla. * * @author Antonio de los Mozos Alonso */ private class GameClientListener implements Runnable{ /** * Estado del listener, true:escuchando, false en caso contrario. */ private Boolean listenerRunStatus; /* (non-Javadoc) * @see java.lang.Runnable#run() */ public void run(){ this.listenerRunStatus = true; try { while (listenerRunStatus) { String result = in.readObject().toString(); System.out.println(username + " : " + result); } System.err.println("LISTENER SHUTDOWN"); } catch (IOException e) { System.err.println("LISTENER IO EXCEPTION:" + e.getMessage()); } catch (ClassNotFoundException e) { System.err.println("LISTENER CAST EXCEPTION:" + e.getMessage()); } } } }
package Controller; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; /** * * @author Gabriel */ public class Choose_Language { public static void Choose_Language(String language) throws IOException{ switch(language){ case "Portuguese": Select_language("Portuguese"); break; case "English": Select_language("English"); break; } } public static void Select_language(String language) throws IOException{ InputStream is = null; BufferedReader br = null; try{ if(language.equals("Portuguese")){ //is = new FileInputStream("C:\\Users\\User\\Desktop\\Aero\\src\\language\\portuguese.txt"); is = new FileInputStream("C:\\Users\\Gabriel\\Desktop\\AirSystem\\src\\language\\portuguese.txt"); }else if(language.equals("English")){ //is = new FileInputStream("C:\\Users\\User\\Desktop\\Aero\\src\\language\\english.txt"); is = new FileInputStream("C:\\Users\\Gabriel\\Desktop\\AirSystem\\src\\language\\english.txt"); } map_languages = new HashMap<String, String>(); InputStreamReader isr = new InputStreamReader(is); br = new BufferedReader(isr); String s = br.readLine(); // primeira linha while (s != null) { String palavras[] = s.split("="); map_languages.put(palavras[0], palavras[1]); s = br.readLine(); } }catch(IOException e){ System.out.println("Error: " + e.getMessage()); }finally{ br.close(); } } public static Map<String, String> map_languages = new HashMap<>(); public static Map<String, String> getMap_languages() { return map_languages; } public void setMap_languages(Map<String, String> map_languages) { this.map_languages = map_languages; } }
package com.varad.twitter_mvp_architecture.data; import java.util.ArrayList; /** * Created by varad on 11/10/18. */ public class Tweet { public final static int MEDIA_TYPE_NULL = 0; // 0 - No media public final static int MEDIA_TYPE_IMAGE = 1; // 1 - Image public final static int MEDIA_TYPE_VIDEO = 2; // 2 - Video public final static int MEDIA_TYPE_GIF = 3; // 3 - GIFs private int id; private String userDpUrl; private String userName; private String userHandle; private String textContent; private int isTextContent; private int mediaType; private ArrayList<String> media; public Tweet() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserDpUrl() { return userDpUrl; } public void setUserDpUrl(String userDpUrl) { this.userDpUrl = userDpUrl; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserHandle() { return userHandle; } public void setUserHandle(String userHandle) { this.userHandle = userHandle; } public String getTextContent() { return textContent; } public void setTextContent(String textContent) { this.textContent = textContent; } public int getIsTextContent() { return isTextContent; } public void setIsTextContent(int isTextContent) { this.isTextContent = isTextContent; } public int getMediaType() { return mediaType; } public void setMediaType(int mediaType) { this.mediaType = mediaType; } public ArrayList<String> getMedia() { return media; } public void setMedia(ArrayList<String> media) { this.media = media; } }
package day02scanner; import java.util.Scanner; public class ScannerClass02 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Please, enter the length of the side of the square"); double length = scan.nextDouble(); System.out.println("Area: " + length * length); System.out.println("Parmiters: " + 4 * length); scan.close(); } }
package com.pointburst.jsmusic.ui.fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.pointburst.jsmusic.R; import com.pointburst.jsmusic.events.MediaEvent; import com.pointburst.jsmusic.model.Media; import de.greenrobot.event.EventBus; /** * Created by m.farhan on 12/30/14. */ public class MediaFragment extends MediaBaseFragment { private View mView; private Media mMedia; private ImageView mMediaImageView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mView = inflater.inflate(R.layout.fragment_media,container,false); mMediaImageView = (ImageView)mView.findViewById(R.id.media_img_view); return mView; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ((TextView)mView.findViewById(R.id.tv_title)).setText(mMedia.getTitle()); picassoLoad(mMedia.getArtImageUrl(), mMediaImageView); } private void setBusEvent(int index){ MediaEvent mediaEvent = new MediaEvent(); mediaEvent.setIndex(index); mediaEvent.setType(MediaEvent.PLAY_SONG_AT_INDEX); EventBus.getDefault().postSticky(mediaEvent); } public void setMedia(Media media){ mMedia = media; } @Override public void onResume() { super.onResume(); EventBus.getDefault().register(this); } @Override public void onPause() { super.onPause(); EventBus.getDefault().unregister(this); } public void onEvent(Object o){ } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser) { setBusEvent(getCurrentMediaIndex()); } else{ } } }
package com.jlgproject.util; import android.app.Activity; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodManager; import com.jlgproject.App; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Collections; import java.util.List; /** * @author 王锋 on 2017/6/26. */ public class Utils { /**关闭软键盘 * * @param activity */ public static void closeKeyboard(Activity activity) { View view = activity.getWindow().peekDecorView(); if (view != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } } public static <T extends Comparable<T>> boolean compare(List<T> a, List<T> b) { if (a.size() != b.size()) return false; Collections.sort(a); Collections.sort(b); for (int i = 0; i < a.size(); i++) { if (!a.get(i).equals(b.get(i))) return false; } return true; } public static void setUserType(Context context,int newUserType) { int user_Type = SharedUtil.getSharedUtil().getInt(context, ConstUtils.USER_TYPE); if (user_Type != 0) { SharedUtil.getSharedUtil().remove(context, ConstUtils.USER_TYPE); SharedUtil.getSharedUtil().putInt(context, ConstUtils.USER_TYPE,newUserType); L.e("-----------删除并存储成功--------------"); }else{ SharedUtil.getSharedUtil().putInt(context, ConstUtils.USER_TYPE,newUserType); L.e("-----------存储成功--------------"); } } //获取Assets 下的资源 public static String getFromAssets(String fileName) { try { InputStreamReader inputReader = new InputStreamReader(App.getContext().getAssets().open(fileName), "utf-8"); BufferedReader bufReader = new BufferedReader(inputReader); String line = ""; String Result = ""; while ((line = bufReader.readLine()) != null) Result += line; return Result; } catch (Exception e) { e.printStackTrace(); } return null; } public static String zhifu_xy = "一、概述\n" + "1、本快捷支付服务协议(以下简称“本协议”)由中金债事(北京)网络科技有限公司(以下简称“中金债事”)与您就快捷支付服务所订立的有效合约。您通过网络页面点击确认本协议或以其他方式选择接受本协议,即表示您与中金债事已达成协议并同意接受本协议的全部约定内容。\n" + "2、在接受本协议之前,请您仔细阅读本协议的全部内容(特别是以粗体下划线标注的内容 )。如您不同意接受本协议的任意内容,或者无法准确理解相关条款含义的,请不要进行后续操作。如果您对本协议的条款有疑问的,请通过中金债事客服渠道进行询问(客服电话为4000689588),中金债事将向您解释条款内容。\n" + "3、您同意,中金债事有权随时对本协议内容进行单方面的变更,并以在www.zhongjinzhaishi.com网站公告的方式提前予以公布,无需另行单独通知您;若您在本协议内容公告变更生效后继续使用本服务的,表示您已充分阅读、理解并接受变更修改后的协议内容,也将遵循变更修改后的协议内容使用本服务;若您不同意变更修改后的协议内容,您应在变更生效前停止使用本服务。\n" + "二、双方权利义务\n" + "1、您应确保您是使用本服务的银行卡持有人,可合法、有效使用该银行卡且未侵犯任何第三方合法权益,否则因此造成中金债事、持卡人损失的,您应负责赔偿并承担全部法律责任,包括但不限于对您的债云端账户中的余额进行止付、终止或中止为您提供支付服务,从您的前述支付宝账户中扣除相应的款项等。\n" + "2、您应确保开通本服务所提供的手机号码为本人所有,并授权中金债事可以通过第三方渠道对您所提供手机号码的真实性、有效性进行核实。\n" + "3、您同意中金债事有权依据其自身判断对涉嫌欺诈或被他人控制并用于欺诈目的的债云端账户采取相应的措施,上述措施包括但不限于对您的债云端账户中的余额进行止付、终止或中止为您提供支付服务、处置涉嫌欺诈的资金等。\n" + "4、您应妥善保管银行卡、卡号、密码、发卡行预留的手机号码以及债云端账号、密码、数字证书、支付盾、宝令、手机动态口令、债云端账户绑定的手机号码、来自于发卡行和/或债云端向您发送的校验码等与银行卡或与债云端账户有关的一切信息和设备如您遗失或泄露前述信息和/或设备的,您应及时通知发卡行及/或中金债事,以减少可能发生的损失。无论是否已通知发卡行及/或中金债事,因您的原因所致损失需由您自行承担。\n" + "5、您在使用本服务时,应当认真确认交易信息,包括且不限于商品名称、数量、金额等,并按中金债事业务流程发出符合《中金债事快捷支付服务协议》约定的指令。您认可和同意:您发出的指令不可撤回或撤销,中金债事一旦根据您的指令委托银行或第三方从银行卡中划扣资金给收款人,您不应以非本人意愿交易或其他任何原因要求中金债事退款或承担其他责任。\n" + "6、您在对使用本服务过程中发出指令的真实性及有效性承担全部责任;您承诺,中金债事依照您的指令进行操作的一切风险由您承担。\n" + "7、您认可债云端账户的使用记录数据、交易金额数据等均以债云端系统平台记录的数据为准。\n" + "8、您同意债云端有权留存您在债云端网站填写的相应信息,并授权中金债事查询该银行卡信息,包括且不限于借记卡余额、信用卡账单等内容,以供后续向您持续性地提供相应服务(包括但不限于将本信息用于向您推广、提供其他更加优质的产品或服务)。\n" + "9、出现下列情况之一的,中金债事有权立即终止您使用债云端相关服务而无需承担任何责任:(1)将本服务用于非法目的;(2)违反本协议的约定;(3)违反中金债事及/或中金债事关联公司及/或中金债事旗下其他公司网站的条款、协议、规则、通告等相关规定及您与前述主体签署的任一协议,而被上述任一主体终止提供服务的;(4)中金债事认为向您提供本服务存在风险的;(5)您的银行卡无效、有效期届满或注销(如有)。\n" + "10、若您未违反本协议约定且因不能归责于您的原因,造成银行卡内资金通过本服务出现损失,且您未从中获益的,您可向中金债事申请补偿。您应在知悉资金发生损失后及时通知中金债事并按要求提交相关的申请材料和证明文件,中金债事将通过自行补偿或保险公司赔偿的方式处理您的申请。具体处理方式由中金债事自行选择决定,中金债事承诺不会因此损害您的合法权益。如中金债事选择保险赔偿的方式,您同意委托中金债事为您向保险公司索赔,并且您承诺:资金损失事实真实存在,保险赔偿申请材料真实、有效。您已充分知晓并认识到,基于虚假信息申请保险赔偿将涉及刑事犯罪,保险公司与中金债事有权向国家有关机构申请刑事立案侦查。\n" + "11、不论中金债事选择何种方式保障您使用本服务的资金安全,您同意并认可中金债事最终的补偿行为或保险赔偿行为并不代表前述资金损失应归责于中金债事,亦不代表中金债事须为此承担其他任何责任。您同意,中金债事在向您支付补偿的同时,即刻取得您可能或确实存在的就前述资金损失而产生的对第三方的所有债权及其他权利,包括但不限于就上述债权向第三方追偿的权利,且您不再就上述已经让渡给中金债事的债权向该第三方主张任何权利,亦不再就资金损失向中金债事主张任何权利。\n" + "12、若您又从其它渠道挽回了资金损失的,或有新证据证明您涉嫌欺诈的,或者发生您应当自行承担责任的其他情形,您应在第一时间通知中金债事并将返还中金债事已补偿或保险公司已赔偿的款项,否则中金债事有权自行或根据保险公司委托采取包括但不限于从您全部或部分债云端账户(含该账户之关联账户)划扣等方式向您进行追偿。\n" + " 三、承诺与保证\n" + "1、您保证使用本服务过程中提供的信息真实、准确、完整、有效,您为了使用本服务向中金债事提供的所有信息,如姓名、身份证号、银行卡卡号及预留手机号,将全部成为您债云端账户信息的一部分。中金债事按照您设置的相关信息为您提供相应服务,对于因您提供信息不真实或不完整所造成的损失由您自行承担。\n" + "2、您授权中金债事在您使用本服务期间或本服务终止后,有权保留您在使用本服务期间所形成的相关信息数据,同时该授权不可撤销。\n" + " 四、其他条款\n" + "1、因本协议产生之争议,均应依照中华人民共和国法律予以处理,并由被告住所地人民法院管辖。\n" + "2、您同意,本协议之效力、解释、变更、执行与争议解决均适用中华人民共和国法律,没有相关法律规定的,参照通用国际商业惯例和(或)行业惯例。\n" + "3、本协议部分内容被有管辖权的法院认定为违法或无效的,不因此影响其他内容的效力。\n" + "4、本协议未约定事宜,均以中金债事不时公布的《中金债事快捷支付服务协议》及相关附属规则为补充。\n"; public static String zhuce_xy = "债云端服务协议(以下简称本协议)由中金债事(北京)网络科技有限公司(以下简称本公司)和您签订。\n" + "一、声明与承诺\n" + "(一)在接受本协议或您以本公司允许的其他方式实际使用债云端服务之前,请您仔细阅读本协议的全部内容。如果您不同意本协议的任意内容,或者无法准确理解本公司对条款的解释,请不要进行后续操作,包括但不限于不要接受本协议,不使用本服务。如果您对本协议的条款有疑问,请通过本公司客服渠道(客服电话:4000689588)进行询问,本公司将向您解释条款内容。\n" + "(二)您同意,如本公司需要对本协议进行变更或修改的,须通过www.zhongjinzhaishi.com网站公告的方式提前予以公布,公告期限届满后即时生效;若您在本协议内容公告变更生效后继续使用债云端服务的,表示您已充分阅读、理解并接受变更后的协议内容,也将遵循变更后的协议内容使用债云端服务;若您不同意变更后的协议内容,您应在变更生效前停止使用债云端服务。\n" + "(三)如您为无民事行为能力人或为限制民事行为能力人,例如您未满18周岁,则您应在监护人监护、指导下阅读本协议和使用本服务。若您非自然人,则您确认,在您取得债云端账户时,或您以其他本公司允许的方式实际使用债云端服务时,您为在中国大陆地区合法设立并开展经营活动或其他业务的法人或其他组织,且您订立并履行本协议不受您所属、所居住或开展经营活动或其他业务的国家或地区法律法规的排斥。不具备前述条件的,您应立即终止注册或停止使用债云端服务。\n" + "(四)您在使用债云端服务时,应自行判断交易对方是否具有完全民事行为能力并自行决定是否使用债云端服务与对方进行交易,且您应自行承担与此相关的所有风险。\n" + " (五)您确认,您在债云端上发生的所有交易,您已经不可撤销地授权债云端按照其制定的《云债行服务协议》等规则进行处理;同时, 您不可撤销地授权本公司按照云债行的指令将争议款项的全部或部分支付给交易一方或双方,同时本公司有权从债云端获取您的相关信息(包括但不限于交易商品描述、物流信息、行为信息、账户相关信息等)。本公司按照债云端的指令进行资金的止付、扣划完全来自于您的授权,本公司对因此给您造成的任何损失均不承担责任。但您确认,您使用债云端服务时,您仍应完全遵守本协议及本公司制定的各项规则及页面提示等。\n" + "(六)您同意,您在中金债事智慧云官网发生的所有交易,您已经不可撤销地授权中金债事智慧云按照其与您之间的协议及其制定并发布的《云债行协议》等规则进行处理;同时,您不可撤销地授权本公司按照中金债事智慧云官网的指令将争议款项的全部或部分支付给交易一方或双方,同时本公司有权从中金债事智慧云官网获取您的相关信息(包括但不限于交易商品描述、物流信息、行为信息、账户相关信息等)。本公司按照债云端的指令进行资金的止付、扣划完全来自于您的授权,本公司对因此给您造成的任何损失均不承担责任。但您确认,您使用支付宝服务时,您仍应完全遵守本本协议及本公司制定的各项规则及页面提示等。\n" + "二、定义及解释\n" + "(一)债云端账户(或“该账户”):指您按照本公司允许的方式取得的供您使用债云端服务的账户。\n" + "(二)本网站:除本协议另有规定外,指www.zhongjinzhaishi.com及/或客户端。\n" + "(三)止付:指债云端账户余额为不可用状态,例如被止付的债云端账户余额不能用于充值、支付、提现或转账等服务。\n" + "(七)冻结:指有权机关要求的冻结或依据其他协议进行的保证金冻结等。被冻结余额为不可用状态,被冻结账户不可登录、使用。\n" + "(八)债云端服务(或“本服务”):指本协议第三条所描述的服务。\n" + "(九)支付宝账户: 。\n" + "三.债云端服务\n" + "债云端服务(或称“本服务”)是本公司向您提供的非金融机构支付服务,是受您委托代您收款和付款的资金转移服务,具体服务项目及内容请见本网站网页,包括(但不限于)以下服务:\n" + "1、代收代付款项服务:代收代付款项服务是指本公司为您提供的代为收取或支付相关款项的服务, 其中:\n" + "A.代收,即本公司代为收取任何人向您支付的各类款项。为免疑义,代收具体是指在符合本公司规定或产品规则的情况下,自您委托本公司将您银行卡内的资金充值到您的支付宝账户或委托本公司代为收取第三方向您支付的款项之时起至根据您的指令将该等款项的全部或部分实际入账到您的银行账户或支付宝账户之时止(含本条之1项3)规定的提现)的整个过程(但不包括本条之1项B(a)所述情形)。\n" + "B.代付, 即本公司将您的款项代为支付给您指定的第三方。为免疑义, 代付具体是指在符合本公司规定或产品规则的情况下: (a)自款项从您的账户(包括但不限于银行账户或其他账户, 但不 包括支付宝账户)转出之时起至委托本公司根据您或有权方给出的指令将上述款项的全部或部分支付给第三方且第三方收到该款项(无论是否要求立即支付或根据届时情况不时支付)之时止的整个过程; 或 (b) 自您根据本协议委托本公司将您银行卡的资金充值到您的支付宝账户或自您因委托本公司代收相关款项到您的支付宝账户之时起至委托本公司根据您或有权方给出的指令将上述款项的全部或部分支付给第三方(无论是否要求立即支付或根据届时情况不时支付)之时止的整个过程。并且您同意, 本公司代付后, 非经法律程序或者非依本协议之约定, 该支付是不可撤销的。\n" + "本公司提供的上述的代收代付款项服务可以分为以下各类具体服务:\n" + "1)充值: 作为代收款项服务的一部分, 在符合本公司规定或产品规则的情况下,您委托本公司将您银行卡内的资金充值到您的支付宝账户。\n" + "2)提现: 作为代收款项服务的一部分, 在符合本公司规定或产品规则的情况下, 您可以请求本公司将您支付宝账户中的资金提取到您名下的有效中国大陆银行账户内, 该银行账户开户名需与您的姓名或名称一致。除被止付或限制款项外, 本公司将于收到提现指令后的一至五个工作日内, 将相应款项汇入该银行账户。您理解, 根据您提供的账户所属银行不同, 会有到账时间差异。此外, 我们可能会对提现进行风险审查, 因此可能导致提现延迟。您理解并同意您最终收到款项的服务是由您提供的银行账户对应的银行提供的, 您需向该银行请求查证。\n" + "3)债云端中介服务, 亦称“债云端担保交易”, 即本公司接受您的委托向您提供的有关买卖交易的代收或代付款项的中介服务。\n" + "除本协议另有规定外, 交易双方使用债云端中介服务, 即认可:买方点击确认收货后, 本公司即有权将买家已支付的款项代为支付给卖家。除本协议另有规定外, 您与交易对方发生交易纠纷时, 您不可撤销地授权本公司自行判断并决定将争议款项的全部或部分支付给交易一方或双方。4)货到付款服务, 又称COD服务, 是指买卖双方约定买卖合同项下的交易货款, 由卖家委托的物流公司在向买方运送交易货物时以现金、POS刷卡、快捷支付等方式直接或间接地代收, 再由本公司代付至卖方支付宝账户的一种支付方式。在您使用本项服务时, 除适用支付宝中介服务的相关约定外, 还将优先适用以下条款:\n" + "a) 作为买方, 本公司为您代付的交易货款系由您收到交易货物时以现金、POS刷卡、快捷支付等方式通过物流公司直接或间接代付至卖方支付宝账户内。您向卖方支付的交易货款将直接或者 间接通过物流公司, 物流公司为此可能向您单独收取费用。您理解并同意, 该费用是物流公司基于其向您提供的服务所收取的, 与本公司向您提供的COD服务无关。\n" + "您确认, 本服务能否完成取决于您提供的收货地址是卖方所选用的物流公司可以送达的地址。在物流公司确认不可送达时, 本公司有权要求您重新选择本公司提供的其他支付方式。\n" + "b) 作为卖方, 本公司为您代收的交易货款系由买方直接或间接地通过您委托的物流公司并最终由本公司代收到您的支付宝账户内。您理解并同意, 完成上述流程是需要一定时间的, 而本公司承诺在与物流公司将交易货款全部清算给本公司的次日将上述交易货款代收至您的支付宝账户内。因此产生的交易款项流转时间是您明知且认可的。 您确认, 该服务能否完成, 取决于您选用的物流公司是否可将交易货物送达买方提供的收货地址, 或买方提供的收货地址准确无误, 或货物完全符合您与买方的约定, 及物流公司是否将相应交易货款清算至本公司等。您理解并接受, 您选用的物流公司不揽货、不清算、错误送达、货物被买方拒收等情形与本公司无关, 且为本公司不可预见、不可预防和不可控制的, 因此产生的损失需全部由您自行承担。\n" + "5)即时到账服务: 是指买卖双方约定买卖合同项下的货款通过买方支付宝账户即时向卖方支付宝账户支付的一种支付方式。本公司提示您注意: 该项服务一般适用于您与交易对方彼此都有充分信任的小额交易。 在您与交易对方使用即时到账服务支付款项时, 该款项无需等您确认收货即立刻进入交易对方的支付宝账户。在使用即时到账服务时, 您理解并接受:\n" + "a) 为控制可能存在的风险, 本公司对所有用户使用即时到账服务支付交易货款时的单日交易总额以及单笔交易最高额进行了限制, 并保留对限制种类和限制限额进行无需预告地调整的权利。\n" + "b) 使用即时到账服务支付货款是基于您对交易对方的充分信任, 一旦您选用该方式, 您应自行承担所有交易风险并自行处理所有相关的交易及货款纠纷, 本公司不负责处理相关纠纷。\n" + "6)后付服务: 指买卖双方在交易时通过本服务支付,选择特定服务(以下简称“特定服务”)作为资金渠道的,本公司将根据特定服务的约定提供款项的代收代付服务;该特定服务包括但不限于花呗(或不时调整的其他名称)、余额宝冻结转支付(或不时调整的其他名称或实质上提供了余额宝冻结转支付功能的产品)服务。在使用后付服务时,您理解并接受:\n" + "a) 该笔交易项下的款项将由买家在确认收货后由本公司代收代付至卖家的支付宝账户。若买家采用特定服务中约定其他款项支付方式的,本公司将依照该等约定提供款项代收代付服务。\n" + "b) 如该笔交易发生在淘宝或阿里巴巴中国站,为保证交易的正常进行,就该笔交易产生的纠纷将按照本协议第一条第(五)、(六)款的约定处理。非因该笔交易产生的纠纷或非因淘宝、阿里巴巴中国站上发生的交易产生的纠纷,您需要联系特定服务的提供方或自行处理。\n" + "7)转账服务: 是指收付款双方使用本服务, 在付款方向本公司指示收款方支付宝账户或银行账户和转账金额后, 将付款方支付宝账户内指定金额的款项划转至收款方支付宝账户或银行账户的一种资金转移服务。本公司提示您注意: 该项服务适用于您与收(付)款方彼此都有充分了解的转账行为。 在您使用转账服务指示转出资金时, 您所转出的款项将进入您向本公司指示的收款方的支付宝账户或银行账户。在您获得支付宝账户后, 您的支付宝账户即具备接受(收)来自转账服务的转账款项的功能, 但未经实名的支付宝账户可能会受到收款和(或)提现的限制。基于此项服务可能存在的风险, 在使用转账服务时, 您理解并接受:\n" + "a)为控制可能存在的风险, 本公司对所有用户使用转账服务时的转账款项的单日转账总额以及单笔转账最高额进行了限制, 并保留对限制种类和限制限额进行无需预告进行调整的权利。\n" + "b)您可能收到由于使用转账服务的付款方指示错误(失误)而转账到您支付宝账户或银行账户的款项, 在此情况下您应该根据国家的相关法律的规定和实际情况处理收到的该笔款项。\n" + "c)使用转账服务是基于您对转账对方的充分了解(包括但不限于对方的真实身份及确切的支付宝账户名等), 一旦您选用转账服务进行转账, 您应当自行承担因您指示错误(失误)而导致的风险。本公司依照您指示的收款方并根据本协议的约定完成转账后, 即完成了当次服务的所有义务, 对于收付款双方之间产生的关于当次转账的任何纠纷不承担任何责任, 也不提供任何形式的纠纷解决途径, 您应当自行处理相关的纠纷。\n" + "2、查询: 本公司将对您使用本公司服务的操作的全部或部分进行记录, 不论该操作之目的最终是否实现。您可以登录支付宝账户查询您支付宝账户内的交易记录。\n" + "3、购结汇服务: 本公司根据适用的相关法律法规向您提供的人民币和外币的购结汇服务。\n" + "4、其他: 您实际使用的本公司接受您的委托为您不时提供的其他服务及本公司提供的其他产品或服务。\n" + "四、支付宝账户\n" + "(一) 注册相关\n" + "除本协议另有规定或相关产品另有规则外,您须在本网站注册并取得本公司提供给您的支付宝账户,或在您于其他阿里网站完成支付宝登录名注册,取得支付宝账户,并且按照本公司要求提供相关信息完成激活后方可使用本服务。您需使用作为支付宝登录名的本人电子邮箱或手机号码,或者本公司允许的其它方式(例如通过扫描二维码、识别生物特征的方式)登录支付宝账户,并且您应当自行为支付宝账户设置密码。您同意:\n" + "1、按照支付宝要求准确提供并在取得该账户后及时更新您正确、最新及完整的身份信息及相关资料。若本公司有合理理由怀疑您提供的身份信息及相关资料错误、不实、过时或不完整的,本公司有权暂停或终止向您提供部分或全部支付宝服务。本公司对此不承担任何责任,您将承担因此产生的任何直接或间接支出。若因国家法律法规、部门规章或监管机构的要求,本公司需要您补充提供任何相关资料时,如您不能及时配合提供,本公司有权暂停或终止向您提供部分或全部支付宝服务。\n" + "2、您应当准确提供并及时更新您提供的电子邮件地址、联系电话、联系地址、邮政编码等联系方式,以便本公司与您进行及时、有效联系。您应完全独自承担因通过这些联系方式无法与您取得联系而导致的您在使用本服务过程中遭受的任何损失或增加任何费用等不利后果。您理解并同意,您有义务保持您提供的联系方式的有效性,如有变更需要更新的,您应按本公司 的要求进行操作。\n" + "3、您应及时更新资料(包括但不限于身份证、户口本、护照等证件或其他身份证明文件、联系方式、作为支付宝账户登录名的邮箱或手机号码、与支付宝账户绑定的邮箱、手机号码等),否则支付宝有权将支付宝登录名、支付宝账户绑定的邮箱、手机号码开放给其他用户注册或使用。因您未及时更新资料导致的一切后果,均应由您自行承担,该后果包括但不限于导致 本服务无法提供或提供时发生任何错误、账户及账户内资金被别人盗用,您不得将此作为取消交易、拒绝付款的理由。\n" + "4、若您为个人用户, 您确认, 本公司有权在出现下列情形时要求核对您的有效身份证件或其他必要文件, 并留存有效身份证件的彩色扫描件, 您应积极配合, 否则本公司有权限制或停止向您提供部分或全部支付宝服务:\n" + "A. 您办理单笔收付金额人民币1万元以上或者外币等值1000美元以上支付业务的;\n" + "B. 您全部账户30天内资金双边收付金额累计人民币5 万元以上或外币等值1万美元以上的;\n" + "C. 您全部账户资金余额连续10天超过人民币5000元或外币等值1000美元的;\n" + "D. 您使用支付宝服务买卖金融产品或服务的;\n" + "E.您购买我公司记名预付卡或办理记名预付卡充值的;\n" + "F.您购买不记名预付卡或通过不记名预付卡充值超过人民币1万元的;\n" + "G.您要求变更身份信息或您身份信息已过有效期的;\n" + "H.本公司认为您的交易行为或交易情况出现异常的;\n" + "I.本公司认为您的身份资料存在疑点或本公司在向您提供服务的过程中认为您已经提供的身份资料存在疑点的;\n" + "J.本公司认为应核对或留存您身份证件或其他必要文件的其他情形的。\n" + "本条款所称“以上”,包括本数。\n" + "5、您在债云端账户中设置的昵称、头像等必须遵守法律法规、公序良俗、社会公德,且不会侵害其他第三方的合法权益,否则债云端有权对您的债云端账户采取限制措施,包括但不限于屏蔽、撤销您支付宝账户的昵称、头像,停止提供部分或全部债云端服务。\n" + "(二)中金债事智慧云官网相关\n" + "您理解并同意,您在本网站完成债云端账户注册程序后,您即取得以您手机号或电子邮箱为内容的债云端登录名。您可以通过您的债云端登录名直接登录中金债事智慧云官网,无需重新注册。但如您此次注册使用的手机号或电子邮箱于2017年6月30日前已在中金债事智慧云官网完成过注册的,则您此次注册的债云端登录名在官网登录的功能不会自动开通。为了使您更便捷地使用官网的服务,您在此明确且不可撤销地授权,您的账户信息在您注册成功时,已授权本公司披露给中金债事智慧云官网并授权官网使用。\n" + "(三) 账户安全\n" + "您将对使用该账户及密码、校验码进行的一切操作及言论负完全的责任,您同意:\n" + "1、本公司通过您的债云端登录名和密码识别您的指示,您应当妥善保管您的债云端登录名和密码及身份信息,对于因密码泄露、身份信息泄露所致的损失,由您自行承担。您保证不向其他任 何人泄露您的债云端登录名及密码以及身份信息,亦不使用其他任何人的债云端登录名及密码。本公司亦可能通过本服务应用您使用的其他产品或设备识别您的指示,您应当妥善保 管处于您或应当处于您掌控下的这些产品或设备,对于这些产品或设备遗失所致的任何损失,由您自行承担。\n" + "2、基于计算机端、手机端以及使用其他电子设备的用户使用习惯,我们可能在您使用具体产品时设置不同的账户登录模式及采取不同的措施识别您的身份。\n" + "3、您同意,(a)如您发现有他人冒用或盗用您的债云端登录名及密码或任何其他未经合法授权之情形,或发生与债云端账户关联的手机或其他设备遗失或其他可能危及到债云端账户资金安全情形时,应立即以有效方式通知本公司,向本公司申请暂停相关服务。您不可撤销地授权本公司将前述情况同步给中金债事智慧云官网,以保障您的合法权益;及(b)确保您在持续登录官网时段结束时,以正确步骤离开网站。本公司不能也不会对因您未能遵守本款约定而发生的任何损失、损毁及其他不利后果负责。您理解本公司对您的请求采取行动需要合理期限,在此之前,本公司对已执行的指令及(或)所导致的您的损失不承担任何责任。\n" + "4、您确认,您应自行对您的债云端账户负责,只有您本人方可使用该账户。该账户不可转让、不可赠与、不可继承,但账户内的相关财产权益可被依法继承。\n" + "5、您同意,基于运行和交易安全的需要,本公司可以暂时停止提供或者限制本服务部分功能,或提供新的功能,在任何功能减少、增加或者变化时,只要您仍然使用本服务,表示您仍然同意本协议或者变更后的协议。\n" + "6、本公司有权了解您使用本公司产品或服务的真实交易背景及目的,您应如实提供本公司所需的真实、全面、准确的信息;如果本公司有合理理由怀疑您提供虚假交易信息的,本公司有权暂时或永久限制您所使用的产品或服务的部分或全部功能。\n" + "7、您同意,本公司有权国家法律或和行政法规所赋予权力的有权机关的要求对您的个人信息以及在扎运动的资金、交易及账户等进行查询、冻结或扣划。\n" + "(四) 注销相关\n" + "在需要终止使用本服务时,您可以申请注销您的债云端账户,您同意:\n" + "1、您所申请注销的债云端账户应当是您依照本协议的约定注册并由本公司提供给您本人的账户。您应当依照本公司规定的程序进行债云端账户注销。\n" + "2、债云端账户注销将导致本公司终止为您提供本服务,本协议约定的双方的权利义务终止(依本协议其他条款另行约定不得终止的或依其性质不能终止的除外),同时还可能对于该账户产生如下结果:\n" + "A、任何兑换代码(购物券、礼品券、债币券等)都将作废;如您不愿将该部分兑换代码或卡券消耗掉或将其作废,则您不能申请注销债云端账户。\n" + "B、任何银行卡将不能适用该账户内的支付或提现服务。\n" + "3、您可以通过自助或者人工的方式申请注销债云端账户,但如果您使用了本公司提供的安全产品,应当在该安全产品环境下申请注销。\n" + "4、您申请注销的债云端账户应当处于正常状态,即您的债云端账户的账户信息和用户信息是最新、完整、正确的,且该账户可以使用所有债云端服务功能的状态。账户信息或用户信息过时、 缺失、不正确的账户或被暂停或终止提供服务的账户不能被申请注销。如您申请注销的账户有关联账户或子账户的,在该关联账户或子账户被注销前,该账户不得被注销。\n" + "5、您申请注销的债云端账户应当不存在任何由于该账户被注销而导致的未了结的合同关系与其他基于该账户的存在而产生或维持的权利义务,及本公司认为注销该账户会由此产生未了结的权利义务而产生纠纷的情况。您申请注销的债云端账户应当没有任何关联的理财产品,不存在任何待处理交易,没有任何余额、红包等资产,且符合债云端页面或网站提示的其他条件和流程。如不符合前述任何情况的,您不能申请注销该账户。\n" + "6、如果您申请注销的债云端账户一旦注销成功,将不再予以恢复。\n" + "\n" + "五、债云端服务使用规则\n" + "为有效保障您使用本服务时的合法权益,您理解并同意接受以下规则:\n" + "(一)一旦您使用本服务,您即授权本公司代理您在您及(或)您指定人符合指定条件或状态时,支付款项给您指定人,或收取您指定人支付给您的款项。\n" + "(二)本公司通过以下三种方式接受来自您的指令:其一,您在本网站或其他可使用本服务的网站或软件上通过以您的债云端账户名及密码或数字证书等安全产品登录债云端账户并依照本服务预设流程所修改或确认的交易状态或指令;其二,您通过您注册时作为该账户名称或者与该账户绑定的手机或其他专属于您的通讯工具(以下合称该手机)号码向本系统发送的信息(短信 或电话等)回复;其三,您通过您注册时作为该账户名称或者与该账户名称绑定的其他硬件、终端、软件、代号、编码、代码、其他账户名等有形体或无形体向本系统发送的信息(如本方式所指有形体或无形体具备与该手机接受信息相同或类似的功能,以下第五条第(三)、(四)、(五)项和第六条第(三)项涉及该手机的条款同样适用于本方式)。无论您通过以上三种方式中的任一种向本公司发出指令,都不可撤回或撤销,且成为本公司代理您支付或收取款项或进行其他账户操作的唯一指令,视为您本人的指令,您应当自己对本公司忠实执行上述指令产生的任何结果承担责任。本协议所称绑定,指您的支付宝账户与本条上述所称有形体或无形体存在对应的关联关系,这种关联关系使得支付宝服务的某些服务功能得以实现,且这种关联关系有时使得这些有形体或无形体能够作为本系统对您的支付宝账户的识别和认定依据。除本协议另有规定外,您与第三方发生交易纠纷时,您授权本公司自行判断并决定将争议款项的全部或部分支付给交易一方或双方。\n" + "(三)您确认,您使用拍码方式向商家付款或通过“当面付”功能进行支付时,在一定额度内(该额度可能因您使用该支付服务时所处的国家/地区、支付场景、风险控制需要及其他本公司认为适宜的事由而有不同,具体额度请见相关提示或公告)或根据您与本公司的另行约定,您无需输入密码即可完成支付,您授权本公司按照商家确定的金额从您的资产里扣款给商家。\n" + "(四)您在使用本服务过程中,本协议内容、网页上出现的关于操作的提示或本公司发送到该手机的信息(短信或电话等)内容是您使用本服务的相关规则,您使用本服务即表示您同意接受本服务的相关规则。您了解并同意本公司有权单方修改本服务的相关规则,而无须征得您的同意,本服务的相关规则应以您使用服务时的页面提示(或发送到该手机的短信或电话或客户端通知等)为准,您同意并遵照本服务的相关规则是您使用本服务的前提。\n" + "(五)本公司会以网站公告、电子邮件、发送到该手机的短信、电话、站内信或客户端通知等方式向您发送通知,例如通知您交易进展情况,或者提示您进行相关操作,您应及时予以关注。但本公司不保证您能够收到或者及时收到该等通知,且对此不承担任何后果。因您没有及时对交易状态进行修改或确认或未能提交相关申请而导致的任何纠纷或损失,本公司不负任何责任。\n" + "(六)您如果需要向交易对方交付货物,应根据交易状态页面(或您手机接收到的信息)显示的买方地址,委托有合法经营资格的承运人将货物直接运送至对方或其指定收货人,并要求对方或其委托的第三方(该第三方应当提供对方的授权文件并出示相应的身份证件)在收货凭证上签字确认,因货物延迟送达或在送达过程中的丢失、损坏,本公司不承担任何责任,应由您与交易对方自行处理。\n" + "(七) 本公司对您所交易的标的物不提供任何形式的鉴定、证明的服务。除本协议另有规定外,如您与交易对方发生交易纠纷,您授权由本公司根据本协议及本网站上载说明的各项规则进行处理。您为解决纠纷而支出的通讯费、文件复印费、鉴定费等均由您自行承担。因市场因素致使商品涨价跌价而使任何一方得益或者受到损失而产生的纠纷(《争议处理规 则》另有约定的除外),本公司不予处理。\n" + "(八)您应按照支付宝的要求完善您的身份信息以最终达到实名,否则您可能会受到收款、提现和(或)支付(包括但不限于余额、余额宝)的限制,且本公司有权对您的资金进行 止付,直至您达到实名。\n" + "(九) 本公司会将您委托本公司代收或代付的款项,严格按照法律法规或有权机关的监管要求进行管理;除本协议另有规定外,不作任何其他非您指示的用途。\n" + "(十) 本公司并非银行或其它金融机构,本服务也非金融业务,本协议项下的资金移转均通过银行来实现,你理解并同意您的资金于流转途中的合理时间。\n" + "(十一) 您理解,基于相关法律法规,对本协议项下的任何服务,本公司均不提供任何担保、垫资。\n" + "(十二)您确认并同意,您应自行承担您使用本服务期间由本公司代收或代付的款项在代收代付服务过程中的任何货币贬值、汇率波动及收益损失等风险,您仅在该代收代付款项(不含被冻结、止付或受限制的款项)的金额范围内享有对该等代收代付款项指令支付、提现的权利,您对所有代收代付款项(含被冻结、止付或受限制的款项)产生的任何收益(包括但不限于利息和其他孳息)不享有任何权利。本公司就所有该代收代付款项产生的任何收益(包括但不限利息和其他于孳息)享有所有权。\n" + "(十三)您不得将本服务用于非本公司许可的其他用途。\n" + "(十四)交易风险\n" + "1、在使用本服务时,若您或您的交易对方未遵从本协议或网站说明、交易、支付页面中之操作提示、规则),则本公司有权拒绝为您与交易对方提供相关服务,且本公司不承担损害赔偿责任。 若发生上述状况,而款项已先行划付至您或他人的支付宝账户名下,您同意本公司有权直接自相关账户中扣回相应款项及(或)禁止您要求支付此笔款项之权利。此款项若已汇入您 的银行账户,您同意本公司有向您事后索回之权利,因您的原因导致本公司事后追索的,您应当承担本公司合理的追索费用。\n" + "2、因您的过错导致的任何损失由您自行承担,该过错包括但不限于:不按照交易、支付提示操作,未及时进行交易操作,遗忘或泄漏密码,密码被他人破解,您使用的计算机被他人侵入。\n" + "(十五)服务费用\n" + "1、在您使用本服务时,本公司有权依照《债云端服务收费规则》向您收取服务费用。本公司拥有制订及调整服务费之权利,具体服务费用以您使用本服务时本网站产品页面上所列之收费方式公告或您与本公司达成的其他书面协议为准。\n" + "2、除非另有说明或约定,您同意本公司有权自您委托本公司代管、代收或代付的款项或您任一支付宝账户余额或者其他资产中直接扣除上述服务费用。\n" + "(十六)积分\n" + "1、就您使用本服务,本公司将通过多种方式向您授予积分。无论您通过何种方式获得积分,您都不得使用积分换取任何现金或金钱。\n" + "2、积分并非您拥有所有权的财产,本公司有权单方面调整积分数值或调整本公司的积分规则,而无须征得您的同意。\n" + "3、您仅有权按本公司的积分规则,将所获积分交换本公司提供的指定的服务或产品。\n" + "4、如本公司怀疑您的积分的获得及(或)使用存有欺诈、滥用或其它本公司认为不当的行为,本公司可随时取消、限制或终止您的积分或积分使用。\n" + "(十七)您认可债云端账户的使用记录、交易金额数据等均以债云端系统记录的数据为准。如您对该等数据存有异议的,应自您账户数据发生变动之日起三日内向本公司提出异议,并提供相关证据供本公司核实,否则视为您认可该数据。\n" + "(十八)如您使用债云端代扣服务的,下面任一情况下均会导致扣款不成功,您需要自行承担该风险:\n" + "1、 您的指定账户余额不足;\n" + "2、 您的指定账户被有权机关采取强制措施,或者已依据其他协议被冻结、止付。\n" + "\n" + "六、债云端服务使用限制\n" + "(一) 您在使用本服务时应遵守中华人民共和国相关法律法规、您所在国家或地区之法令及相关国际惯例,不将本服务用于任何非法目的(包括用于禁止或限制交易物品的交易),也不以任 何非法方式使用本服务。\n" + "(二) 您不得利用本服务从事侵害他人合法权益之行为,否则本公司有权拒绝提供本服务,且您应承担所有相关法律责任,因此导致本公司或本公司雇员受损的,您应承担赔偿责任。上述行 为包括但不限于:\n" + "1、侵害他人名誉权、隐私权、商业秘密、商标权、著作权、专利权等合法权益。\n" + "2、违反依法定或约定之保密义务。\n" + "3、冒用他人名义使用本服务。\n" + "4、从事不法交易行为,如洗钱、恐怖融资、贩卖枪支、毒品、禁药、盗版软件、黄色淫秽物品、其他本公司认为不得使用本服务进行交易的物品等。\n" + "5、提供赌博资讯或以任何方式引诱他人参与赌博。\n" + "6、非法使用他人银行账户(包括信用卡账户)或无效银行账号(包括信用卡账户)交易。\n" + "7、违反《银行卡业务管理办法》使用银行卡,或利用信用卡套取现金(以下简称套现)。\n" + "8、进行与您或交易对方宣称的交易内容不符的交易,或不真实的交易。\n" + "9、从事任何可能含有电脑病毒或是可能侵害本服务系统、资料之行为。\n" + "10、其他本公司有正当理由认为不适当之行为。\n" + "(三) 您理解并同意,本公司不对因下述任一情况导致的任何损害赔偿承担责任,包括但不限于利润、商誉、使用、数据等方面的损失或其他无形损失的损害赔偿 (无论本公司是否已被告知该等损害赔偿的可能性):\n" + "1、本公司有权基于单方判断,包含但不限于本公司认为您已经违反本协议的明文规定及精神,对您的名下的全部或部分支付宝账户暂停、中断或终止向您提供本服务或其任何部分, 并移除您的资料。\n" + "2、在发现异常交易或合理怀疑交易有疑义或有违反法律规定或本协议约定之时,为维护用户资金安全和合法权益,本公司有权不经通知先行暂停或终止您名下全部或部分债云端账户的使用(包括但不限于对这些账户名下的款项和在途交易采取取消交易、调账等措施),同时可能需要您配合提供包括但不限于物流凭证、身份证、银行卡,交易过程中交易双方的聊天记录截图等资料。如您未及时、完整、准确提供上述资料,本公司有权采取包括但不限于如下限制措施:关闭余额支付功能、限制收款功能、止付账户内余额或停止提供全部或部分债云端服务。如涉嫌犯罪,本公司有权移交公安机关处理。\n" + "3、您理解并同意, 存在如下情形时,本公司有权对您名下债云端账户暂停或终止提供全部或部分债云端服务,或对资金的全部或部分进行止付,且有权限制您所使用的产品或服务的部分或全部功能(包括但不限于对这些账户名下的款项和在途交易采取取消交易、调账等限制措施),并通过邮件或站内信或者客户端通知等方式通知您, 您应及时予以关注:\n" + "1)根据本协议的约定;\n" + "2)根据法律法规及法律文书的规定;\n" + "3)根据有权机关的要求;\n" + "4)您使用债云端服务的行为涉嫌违反国家法律法规及行政规定的;\n" + "5)本公司基于单方面合理判断认为账户操作、资金进出等存在异常时;\n" + "6)本公司依据自行合理判断认为可能产生风险的;\n" + "7)您在参加市场活动时有批量注册账户、刷信用及其他舞弊等违反活动规则、违反诚实信用原则的;\n" + "8)他人向您账户错误汇入资金等导致您可能存在不当得利的;\n" + "9)您遭到他人投诉,且对方已经提供了一定证据的;\n" + "10)您可能错误地将他人账户进行了实名制或实名认证的。\n" + "如您申请恢复服务、解除上述止付或限制,您应按本公司要求如实提供相关资料及您的身份证明以及本公司要求的其他信息或文件,以便本公司进行核实,且本公司有权依照自行判 断来决定是否同意您的申请。您应充分理解您的申请并不必然被允许。您拒绝如实提供相关资料及身份证明的,或未通过本公司审核的,则您确认本公司有权长期对该等账户停止提供服务且长期限制该等产品或者服务的部分或全部功能。\n" + "在本公司认为该等异常已经得到合理解释或有效证据支持或未违反国家相关法律法规及部门规章的情况下,最晚将于止付款项或暂停执行指令之日起的30个日历天内解除止付或限制。但本公司有进一步理由相信该等异常仍可能对您或其他用户或本公司造成损失的情形除外,包括但不限于:\n" + "1)收到针对该等异常的投诉;\n" + "2)您已经实质性违反了本协议或另行签署的协议,且我们基于保护各方利益的需要必须继续止付款项或暂停执行指令;\n" + "3)您虽未违反国家相关法律法规及部门规章规定,但该等使用涉及支付宝限制合作的行业类目或商品,包括但不限于通过本公司的产品或服务从事类似金字塔或矩阵型的高额返利业务模式。\n" + "4、在本公司合理认为有必要时,本公司无需事先通知即可终止提供本服务,并暂停、关闭或删除您名下全部或部分支付宝账户及这些账户中所有相关资料及档案,并将您滞留在这些账户的全部合法资金退回到您的银行账户。\n" + "(四)您理解并同意,如因您进行与您宣称的交易内容不符的交易,或违反您所在平台对商品类目管理的规定,导致本公司、您所在平台或用户遭受损失的,本公司有权向您追偿并有权随时从您名下的支付宝账户扣除相应资金以弥补该等损失。且本公司有权对您名下支付宝账户暂停或终止向您提供部分或全部支付宝服务,或对您名下资产的部分或全部进行止付。\n" + "\n" + "七、隐私权保护\n" + "本公司重视对用户隐私的保护。关于您的身份资料和其他特定资料依本协议第十条所载明的《隐私权规则》受到保护与规范,详情请参阅《隐私权规则》。\n" + "\n" + "八、系统中断或故障\n" + "本公司系统因下列状况无法正常运作,使您无法使用各项服务时,本公司不承担损害赔偿责任,该状况包括但不限于:\n" + "(一)本公司在本网站公告之系统停机维护期间。\n" + "(二)电信设备出现故障不能进行数据传输的。\n" + "(三)因台风、地震、海啸、洪水、停电、战争、恐怖袭击等不可抗力之因素,造成本公司系统障碍不能执行业务的。\n" + "(四)由于黑客攻击、电信部门技术调整或故障、网站升级、银行方面的问题等原因而造成的服务中断或者延迟。\n" + "\n" + "九、责任范围及责任限制\n" + "(一)本公司仅对本协议中列明的责任承担范围负责。\n" + "(二)您明确因交易所产生的任何风险应由您与交易对方承担。\n" + "(三)债云端用户信息是由用户本人自行提供的,本公司无法保证该信息之准确、及时和完整,您应对您的判断承担全部责任。\n" + "(四)本公司不对交易标的及本服务提供任何形式的保证,包括但不限于以下事项:\n" + "1、本服务符合您的需求。\n" + "2、本服务不受干扰、及时提供或免于出错。\n" + "3、您经由本服务购买或取得之任何产品、服务、资讯或其他资料符合您的期望。\n" + "(五)本服务之合作单位,所提供之服务品质及内容由该合作单位自行负责。\n" + "(六)您经由本服务之使用下载或取得任何资料,应由您自行考量且自负风险,因资料之下载而导致您电脑系统之任何损坏或资料流失,您应负完全责任。\n" + "(七)您自本公司及本公司工作人员或经由本服务取得之建议和资讯,无论其为书面或口头形式,均不构成本公司对本服务之保证。\n" + "(八)在法律允许的情况下,本公司对于与本协议有关或由本协议引起的任何间接的、惩罚性的、特殊的、派生的损失(包括业务损失、收益损失、利润损失、商誉损失、使用数据 其他经济利益的损失),不论是如何产生的,也不论是由对本协议的违约(包括违反保证)还是由侵权造成的,均不负有任何责任,即使事先已被告知此等损失的可能性。另外即使本协议规定的排他性救济没有达到其基本目的,也应排除本公司对上述损失的责任。\n" + "(九)除本协议另有规定外,在任何情况下,本公司对本协议所承担的违约赔偿责任总额不超过向您收取的当次服务费用总额。\n" + "(十)您充分知晓并同意本公司可能同时为您及您的(交易)对手方提供本服务,您同意对本公司可能存在的该等行为予以明确豁免,并不得以此来主张本公司在提供本服务时存在法律上的瑕疵。\n" + "(十一)除本协议另有规定或本公司另行同意外,您对本公司的委托及向本公司发出的指令均不可撤销。\n" + "\n" + "十、完整协议\n" + "本协议由《云债行服务协议》条款等本网站不时公示的各项规则组成,各项规则有约定,而本协议条款没有约定的,以各项规则约定为准。您对本协议理解和认同,您即对本协议所有组成部分的内容理解并认同,一旦您取得债云端账户,或您以其他本公司允许的方式实际使用本服务,您和本公司即受本协议所有组成部分的约束。本协议部分内容被有管辖权的法院认定为违法或无效的,不因此影响其他内容的效力。\n" + "\n" + "\n" + "十一、商标、知识产权的保护\n" + "(一) 本网站上所有内容,包括但不限于著作、图片、档案、资讯、资料、网站架构、网站画面的安排、网页设计,均由本公司或本公司关联企业依法拥有其知识产权,包括但不限于商标权、专利权、著作权、商业秘密等。\n" + "(二) 非经本公司或本公司关联企业书面同意,任何人不得擅自使用、修改、复制、公开传播、改变、散布、发行或公开发表本网站程序或内容。\n" + "(三) 尊重知识产权是您应尽的义务,如有违反,您应承担损害赔偿责任。\n" + "\n" + "十二、法律适用与管辖\n" + "本协议之效力、解释、变更、执行与争议解决均适用中华人民共和国法律。因本协议产生之争议,均应依照中华人民共和国法律予以处理,并由被告住所地人民法院管辖。\n"; }
package com.example.fuelistic_test.ui; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import android.Manifest; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.os.Bundle; import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.RadioButton; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.example.fuelistic_test.Database.SessionManager; import com.example.fuelistic_test.Common.Common; import com.example.fuelistic_test.Model.Order; import com.example.fuelistic_test.R; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.Task; import com.google.android.material.textfield.TextInputLayout; import com.google.firebase.database.FirebaseDatabase; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Locale; import io.reactivex.rxjava3.core.Single; import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.observers.DisposableSingleObserver; public class PlaceOrder2nd extends AppCompatActivity { private CompositeDisposable compositeDisposable = new CompositeDisposable(); LocationRequest locationRequest; LocationCallback locationCallback; FusedLocationProviderClient fusedLocationProviderClient; Location currentLocation; EditText edit_address; EditText edit_comment; TextView text_address; RadioButton rdb_home_add; RadioButton rdb_other_add; RadioButton rdb_use_current_add; RadioButton rdb_cod; RadioButton rdb_braintree; double totalPrice = 0; String deliveryDate , deliveryMode, fuelType,orderQuantity; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_place_order2nd); //get data from prev screen //Get all the data from Intent deliveryDate = getIntent().getStringExtra("deliveryDate"); deliveryMode = getIntent().getStringExtra("deliveryMode"); // fuelType = getIntent().getStringExtra("fuelType"); orderQuantity = getIntent().getStringExtra("orderQuantity"); edit_address = findViewById(R.id.edit_address); edit_comment = findViewById(R.id.edit_comment); text_address = findViewById(R.id.text_address_detail); rdb_home_add = findViewById(R.id.rdb_home_add); rdb_other_add = findViewById(R.id.rdb_other_add); rdb_use_current_add = findViewById(R.id.rdb_use_current_add); rdb_cod = findViewById(R.id.rdb_cod); rdb_braintree = findViewById(R.id.rdb_braintree); //trying to get data from session manager SessionManager sessionManager = new SessionManager(this); HashMap<String, String> userDetails = sessionManager.getUserDetailFromSession(); final String address = userDetails.get(SessionManager.KEY_ADDRESS); //Data edit_address.setText(address); //Event rdb_home_add.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { edit_address.setText(address); text_address.setVisibility(View.GONE); } } }); rdb_other_add.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { edit_address.setText(" "); //clear edit_address.setHint("Enter your address.."); text_address.setVisibility(View.GONE); } } }); rdb_use_current_add.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @SuppressLint("MissingPermission") @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { fusedLocationProviderClient.getLastLocation() .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { // Toast.makeText(this,""+e.getMessage(),Toast.LENGTH_SHORT).show(); text_address.setVisibility(View.GONE); } }) .addOnCompleteListener(new OnCompleteListener<Location>() { @Override public void onComplete(@NonNull Task<Location> task) { final String coordinates = new StringBuilder() .append(task.getResult().getLatitude()) .append("/") .append(task.getResult().getLongitude()).toString(); Single<String> singleAddress = Single.just(getAddressFromLatLng(task.getResult().getLatitude(), task.getResult().getLongitude())); Disposable disposable = singleAddress.subscribeWith(new DisposableSingleObserver<String>(){ @Override public void onSuccess(@io.reactivex.rxjava3.annotations.NonNull String s) { edit_address.setText(s); //text_address.setText(s); text_address.setVisibility(View.GONE); } @Override public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) { edit_address.setText(coordinates); text_address.setText(e.getMessage()); text_address.setVisibility(View.VISIBLE); } }); } }); } } }); initLocation(); // builder.setNegativeButton("NO", new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialogInterface, int i) { // dialogInterface.dismiss(); // } // }).setPositiveButton("YES", new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialogInterface, int i) { // //Implement later // } // }); // // AlertDialog dialog = builder.create(); // dialog.show(); } private String getAddressFromLatLng(double latitude, double longitude) { Geocoder geocoder = new Geocoder(this , Locale.getDefault()); String result = ""; try{ List<Address> addressList = geocoder.getFromLocation(latitude,longitude,1); if (addressList !=null && addressList.size()>0){ Address address = addressList.get(0); StringBuilder sb = new StringBuilder(address.getAddressLine(0)); result = sb.toString(); } else { result = "Address not found!!"; } } catch (IOException e) { e.printStackTrace(); result = e.getMessage(); } return result; } @Override public void onStop(){ if(fusedLocationProviderClient!=null) fusedLocationProviderClient.removeLocationUpdates(locationCallback); compositeDisposable.clear(); super.onStop(); } @SuppressLint("MissingPermission") private void initLocation() { buildLocationRequest(); buildLocationCallback(); fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this); fusedLocationProviderClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper()); } private void buildLocationCallback() { locationCallback = new LocationCallback(){ @Override public void onLocationResult(LocationResult locationResult) { super.onLocationResult(locationResult); currentLocation = locationResult.getLastLocation(); } }; } private void buildLocationRequest() { locationRequest= new LocationRequest(); locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); locationRequest.setInterval(5000); locationRequest.setFastestInterval(3000); locationRequest.setSmallestDisplacement(10f); } public void place_Order(View view) { if(rdb_cod.isChecked()) paymentCOD(edit_address.getText().toString(), edit_comment.getText().toString()); } private void paymentCOD(String address, String comment) { double finalPrice = totalPrice ; Order order = new Order(); //trying to get data from session manager SessionManager sessionManager = new SessionManager(this); HashMap<String, String> userDetails = sessionManager.getUserDetailFromSession(); order.setUserName(userDetails.get(SessionManager.KEY_USERNAME)); order.setUserPhone(userDetails.get(SessionManager.KEY_PHONENUMBER)); order.setShippingAddress(address); order.setComment(comment); if(currentLocation != null){ order.setLat(currentLocation.getLatitude()); order.setLng(currentLocation.getLongitude()); } else{ order.setLng(-0.1f); order.setLat(-0.1f); } order.setTotalPayment(totalPrice); order.setDeliveryCharge(0); //laterr order.setFinalPayment(finalPrice); order.setCod(true); order.setTransactionId("Cash On Delivery"); order.setFuelType(fuelType); order.setQuantity(orderQuantity); order.setDeliveryDate(deliveryDate); order.setDeliveryMode(deliveryMode); writeOrderToFirebase(order); } private void writeOrderToFirebase(Order order) { FirebaseDatabase.getInstance() .getReference("Orders") .child(Common.createOrderNumber()) .setValue(order) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { // Toast.makeText(this, ""+e.getMessage(), Toast.LENGTH_SHORT).show(); } }).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { // Toast.makeText(this, " AADD",Toast.LENGTH_SHORT).show(); Intent intent = new Intent(getApplicationContext(), UserDashboard.class); startActivity(intent); } }); } }
package util; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; import java.util.ArrayList; //Класс, работающий с введённой в консоль строкой public class Parser { @Option(name = "-d", usage = "Directory search") private String path = null; @Option(name = "-r", usage = "Need search child") private boolean needChild = false; @Argument private ArrayList<String> arguments = new ArrayList<>(); private String fileName; public void parse(String[] args) { CmdLineParser lineParser = new CmdLineParser(this); //Проверка на корректность введённой строки try { lineParser.parseArgument(args); if (arguments.isEmpty()) { System.out.println("[-r] [-d directory] filename.txt"); lineParser.printUsage(System.out); throw new IllegalArgumentException("File name is required!"); } } catch (CmdLineException e) { System.out.println("[-r] [-d directory] filename.txt"); lineParser.printUsage(System.out); throw new IllegalArgumentException("File name is required!"); } fileName = arguments.get(0); } public String getPath() { return path; } public boolean isNeedChild() { return needChild; } public String getFileName() { return fileName; } }
package exer3; import java.util.List; import exer2.Book; public class BookDAO2 extends BaseDAO2 { public int saveBook(Book book) {//保存 String sql = "insert into t_book('name','author','price','sales','stock','publishing')values(?,?,?,?,?,?)"; return updateDB(sql,book.getName(), book.getAuthor(),book.getPrice(), book.getSales(),book.getStock(), book.getPublishing()); } public int updateBook(Book book) {// 修改 String sql = "update t_book set 'name' = ?,'author' = ?,'price' = ?,'sales' = ?,'stock' = ?,'publishing' = ? where id = ?"; return updateDB(sql,book.getName(), book.getAuthor(),book.getPrice(), book.getSales(),book.getStock(), book.getPublishing(),book.getId()); } public int deleteBookById(Integer id) {// 根据主键删除 String sql = "delete from t_book where id = ?"; return updateDB(sql,id); } public Book queryBookById(Integer id) {// 根据主键查询 String sql = "select id,name,author,price,sales,stock,publishing from t_book where id = ?"; return queryOne(Book.class,sql,id); } public List<Book> queryBooks(Book book) {// 查询所有 String sql = "select id,name,author,price,sales,stock,publishing from t_book"; return queryAll(Book.class, sql); } }
package Docente.View; import java.util.Scanner; import Docente.entity.Docente; import General.InputTypesUniversidad; public class RegistroDocente { public static Docente ingresarDocente(Scanner scanner) { int codigoDocente=InputTypesUniversidad.readInt("Ingrese su codigo de estudiante:", scanner); String Nombre=InputTypesUniversidad.readString("Nombre:", scanner); String Apellido=InputTypesUniversidad.readString("Apellido: ", scanner); int CI=InputTypesUniversidad.readInt("Carnet de Identidad:", scanner); int fechaNacimiento=InputTypesUniversidad.readInt("Fecha de nacimiento:", scanner); int celular=InputTypesUniversidad.readInt("Telefono:", scanner); String titulacion=InputTypesUniversidad.readString("Direccion:", scanner); int numeroSeguroMedico=InputTypesUniversidad.readInt("Codigo de la clase:", scanner); return new Docente(codigoDocente, Nombre,Apellido, fechaNacimiento, celular, titulacion, numeroSeguroMedico); } }
package com.niubimq.queue; import java.util.concurrent.LinkedBlockingQueue; import javax.management.Attribute; import javax.management.AttributeList; import javax.management.AttributeNotFoundException; import javax.management.DynamicMBean; import javax.management.InvalidAttributeValueException; import javax.management.MBeanAttributeInfo; import javax.management.MBeanException; import javax.management.MBeanInfo; import javax.management.ReflectionException; import com.niubimq.pojo.Message; import com.niubimq.pojo.MessageWrapper; /** * @Description: </p> * @author junjin4838 * @version 1.0 */ public class QueueFactory implements DynamicMBean { private static Object lock = new Object(); public static final int ORIGIN_QUEUE = 1; public static final int IMMEDIATE_QUEUE = 2; public static final int CONSUMING_QUEUE = 3; public static final int CONSUMED_QUEUE = 4; public static final int TIMMING_QUEUE = 5; private static QueueFactory queueFactoryInstance; /** * Queue1:原始消息队列 */ public static LinkedBlockingQueue<Message> originalMessageQueue = new LinkedBlockingQueue<Message>(); /** * Queue2:即时消息队列 */ public static LinkedBlockingQueue<Message> immediatelyMessageQueue = new LinkedBlockingQueue<Message>(); /** * Queue3:包含连接对象的消息队列 */ public static LinkedBlockingQueue<MessageWrapper> consumingMessageQueue = new LinkedBlockingQueue<MessageWrapper>(); /** * Queue4:消费完毕的消息队列 */ public static LinkedBlockingQueue<Message> consumedMessageQueue = new LinkedBlockingQueue<Message>(); /** * Queue5:定时消息队列 */ public static LinkedBlockingQueue<Message> timmingMessageQueue = new LinkedBlockingQueue<Message>(); /** * 默认构造器 */ public QueueFactory() { } /** * 双重检锁 -- 获取单例 * * @return */ public static QueueFactory getInstance() { if (queueFactoryInstance == null) { synchronized (lock) { if (queueFactoryInstance == null) { queueFactoryInstance = new QueueFactory(); return queueFactoryInstance; } } } return queueFactoryInstance; } /** * 返回相应的消息队列 * * @param queueType * @return */ public LinkedBlockingQueue<?> getQueue(int queueType) { if (queueType == ORIGIN_QUEUE) { return originalMessageQueue; } else if (queueType == IMMEDIATE_QUEUE) { return immediatelyMessageQueue; } else if (queueType == CONSUMING_QUEUE) { return consumingMessageQueue; } else if (queueType == CONSUMED_QUEUE) { return consumedMessageQueue; } else if (queueType == TIMMING_QUEUE) { return timmingMessageQueue; } else return null; } public Object getAttribute(String queueType) throws AttributeNotFoundException, MBeanException, ReflectionException { if (queueType.equals("originalMessageQueueSize")) { return originalMessageQueue.size(); } else if (queueType.equals("immediatelyMessageQueueSize")) { return immediatelyMessageQueue.size(); } else if (queueType.equals("consumingMessageQueueSize")) { return consumingMessageQueue.size(); } else if (queueType.equals("consumedMessageQueueSize")) { return consumedMessageQueue.size(); } else if (queueType.equals("timmingMessageQueueSize")) { return timmingMessageQueue.size(); } else return null; } public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { } public AttributeList getAttributes(String[] attributes) { return null; } public AttributeList setAttributes(AttributeList attributes) { return null; } public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { return null; } public MBeanInfo getMBeanInfo() { MBeanAttributeInfo[] dAttributes = new MBeanAttributeInfo[] { new MBeanAttributeInfo("originalMessageQueueSize", "Integer", "原始消息队列", true, false, false), new MBeanAttributeInfo("immediatelyMessageQueueSize", "Integer", "即时消息队列", true, false, false), new MBeanAttributeInfo("consumingMessageQueueSize", "Integer", "正在消费的消息队列", true, false, false), new MBeanAttributeInfo("consumedMessageQueueSize", "Integer", "已消费等待入库的消息队列", true, false, false), new MBeanAttributeInfo("timmingMessageQueueSize", "Integer", "已消费等待入库的消息队列", true, false, false) }; MBeanInfo info = new MBeanInfo(this.getClass().getName(), "QueueFactory", dAttributes, null, null, null); return info; } }
package net.liuzd.spring.boot.v2.domain.enums; public enum TripType { BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO }
package com.timmy.highUI.dialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.timmy.R; public class DialogThemeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dialog_theme); } }
// Tests that duplicate but compatible method parameters error. int main() { return 0; } class DupeParamMethodCompatClass { int f(int x, int x) { return 0; } }
package com.somethinglurks.jbargain.api.node.meta; /** * Represents a type of flag on a post, author, or comment */ public enum Flag { STICKY, AUTHOR_LEARNER, AUTHOR_RED_PLATE, AUTHOR_GREEN_PLATE, AUTHOR_ASSOCIATED, AUTHOR_STORE_REP, AUTHOR_EMPLOYEE, AUTHOR_REFERRER, AUTHOR_THIRD_PARTY, AUTHOR_MODERATOR, AUTHOR_VOTED_POSITIVE, AUTHOR_VOTED_NEGATIVE, DEAL_EXPIRED, DEAL_OUT_OF_STOCK, DEAL_TARGETED, DEAL_UPCOMING, FORUM_CLOSED, FORUM_POLL, FORUM_RESOLVED, COMPETITION_CLOSED }
package com.gligor.hypnosis.repositories; import com.gligor.hypnosis.entities.TroupeMember; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface MemberRepository extends JpaRepository<TroupeMember, Long> { public TroupeMember findByName(String name); }
package behavioralPatterns.iteratorPattern; /** * @Author:Jack * @Date: 2021/9/12 - 16:09 * @Description: behavioralPatterns.iteratorPattern * @Version: 1.0 */ public interface IProject { public void add(String name,int num,int cost); public String getProjectInfo(); public IProjectIterator iterator(); }
package com.akikun.leetcode; import java.util.ArrayList; import java.util.List; /** * @completed 2020.06.19 */ public class _00125_ValidPalindrome { public boolean isPalindrome(String s) { if (s.length() < 2) { return true; } char[] arr = s.toLowerCase().toCharArray(); List<Character> list = new ArrayList<>(); for (char c : arr) { if (Character.isAlphabetic(c) || Character.isDigit(c)) { list.add(c); } } int len = list.size(); for (int i = 0, j = len - 1; i <= j; ++i, --j) { if (list.get(i) != list.get(j)) { return false; } } return true; } }
package com.androidapp.yemyokyaw.movieapp.viewholders; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import com.androidapp.yemyokyaw.movieapp.R; import com.androidapp.yemyokyaw.movieapp.data.vo.MovieVO; import com.androidapp.yemyokyaw.movieapp.delegates.MovieListDelegate; /** * Created by yemyokyaw on 12/16/17. */ public class MovieTrailerViewHolder extends RecyclerView.ViewHolder { private MovieListDelegate mDelegate; public MovieTrailerViewHolder(View itemView, MovieListDelegate newsItemDelegate) { super(itemView); mDelegate = newsItemDelegate; } }
package lame.schema; public class StringField extends Field { public StringField(String name) { super(name, Type.STRING); } }
package cz.habarta.typescript.generator; import static org.junit.Assert.*; import org.junit.Test; public class EnumTest { @Test public void testEnumAsUnion() { final Settings settings = TestUtils.settings(); // settings.mapEnum = EnumMapping.asUnion; final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(AClass.class)); final String expected = ( "\n" + "interface AClass {\n" + " direction: Direction;\n" + "}\n" + "\n" + "type Direction = 'North' | 'East' | 'South' | 'West';\n" ).replace("'", "\""); assertEquals(expected, output); } @Test public void testSingleEnum() { final Settings settings = TestUtils.settings(); final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(Direction.class)); final String expected = ( "\n" + "type Direction = 'North' | 'East' | 'South' | 'West';\n" ).replace("'", "\""); assertEquals(expected, output); } @Test public void testEnumAsInlineUnion() { final Settings settings = TestUtils.settings(); settings.quotes = "'"; settings.mapEnum = EnumMapping.asInlineUnion; final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(AClass.class)); final String expected = "\n" + "interface AClass {\n" + " direction: 'North' | 'East' | 'South' | 'West';\n" + "}\n"; assertEquals(expected, output); } @Test public void testEnumAsNumberBasedEnum() { final Settings settings = TestUtils.settings(); settings.mapEnum = EnumMapping.asNumberBasedEnum; final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(AClass.class)); final String expected = ( "\n" + "interface AClass {\n" + " direction: Direction;\n" + "}\n" + "\n" + "declare const enum Direction {\n" + " North,\n" + " East,\n" + " South,\n" + " West,\n" + "}\n" ).replace("'", "\""); assertEquals(expected, output); } private static class AClass { public Direction direction; } enum Direction { North, East, South, West } }
package com.hepsiemlak; import org.junit.Assert; import org.openqa.selenium.*; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.regex.Matcher; import java.util.regex.Pattern; import static org.junit.Assert.assertTrue; public class BasePage extends Base { WebElement webElement = null; public WebElement webElementiBul(String key, String value) { WebDriverWait wait = new WebDriverWait(webDriver, 10); switch (key) { case "id": webElement = wait.until(ExpectedConditions.elementToBeClickable(webDriver.findElement(By.id(value)))); webElement.click(); break; case "css": webElement = wait.until(ExpectedConditions.elementToBeClickable(webDriver.findElement(By.cssSelector(value)))); webElement.click(); break; case "xpath": webElement = wait.until(ExpectedConditions.elementToBeClickable(webDriver.findElement(By.xpath(value)))); webElement.click(); break; case "classname": webElement = webDriver.findElement(By.className(value)); webElement.click(); break; case "name": webElement = webDriver.findElement(By.name(value)); webElement.click(); break; case "linkText": webElement = webDriver.findElement(By.linkText(value)); webElement.click(); break; default: System.out.println("TestClass içerisinde Web Elementi Bul fonksiyonu düzgün çalışmadı..."); break; } return webElement; } public void webElementineGönder(String key, String value, String sendingValue) { webElement = webElementiBul(key, value); webElement.sendKeys(sendingValue); } public void webElementControl(String expected, String actual) { Assert.assertEquals(expected, actual); } public void webelementiBekle(int i) throws InterruptedException { Thread.sleep(i * 1000); } public void webElementMoveTo(By by) { webElement = webDriver.findElement(by); Actions actions = new Actions(webDriver); actions.moveToElement(webElement).build().perform(); } public void webElementiBuluncaTikla(String webelement) { WebElement element = webDriver.findElement(By.cssSelector(webelement)); ((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true);", element); } public void webElementDropDown(String value, int key) { Select dropdown = new Select(webDriver.findElement(By.cssSelector(value))); dropdown.selectByIndex(key); } public void isValidPhoneNumb(String number) { Pattern pattern = Pattern.compile("(([\\+]90?)|([0]?))([ ]?)((\\([0-9]{3}\\))|([0-9]{3}))([ ]?)([0-9]{3})(\\s*[\\-]?)([0-9]{2})(\\s*[\\-]?)([0-9]{2})"); Matcher matcher = pattern.matcher(number); assertTrue(matcher.matches()); System.out.println("Phone number is valid."); } }
package com.gokuai.base; import org.json.JSONObject; /** * 返回结果和返回状态号 */ public class ReturnResult { int statusCode; String result; public ReturnResult(){ } public ReturnResult(String result, int code) { statusCode = code; this.result = result; } /** * 返回请求内容 * * @return */ public String getResult() { return result; } /** * 返回请求号 * * @return */ public int getStatusCode() { return statusCode; } public void setResult(String result) { this.result = result; } public void setStatusCode(int statusCode) { this.statusCode = statusCode; } public static ReturnResult create(String jsonString) { JSONObject json = null; String result = ""; int statusCode = 0; try { json = new JSONObject(jsonString); result = json.getString("result"); statusCode = json.getInt("statusCode"); } catch (Exception e) { e.printStackTrace(); json = null; } if (json == null) { return new ReturnResult("result json is null", 0); } return new ReturnResult(result, statusCode); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("result:" + result + "\n"); sb.append("statusCode:" + statusCode + "\n"); return sb.toString(); //To change body of overridden methods use File | Settings | File Templates. } }
package com.parsa.sample; /** * This class calculates factorial of a number. * * @author ramesh * */ public class FactorialDemo { /** * This method returns factorial of provided number. * * @param n - num * @return int - factorial */ int getFactorial(int n) { int output; if (n == 0) return 1; if (n == 1) return 1; else output = getFactorial(n - 1) * n; return output; } }
package com.arkaces.aces_marketplace_api; import com.arkaces.aces_marketplace_api.account_service.AccountServiceService; import com.arkaces.aces_marketplace_api.services.ServiceEntity; import com.arkaces.aces_marketplace_api.services.ServiceRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import java.util.List; @Service @Slf4j @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class ServiceSync { private final ServiceRepository serviceRepository; private final AccountServiceService accountServiceService; @Scheduled(fixedDelayString = "${syncIntervalSec}000") public void sync() { log.info("Executing sync"); try { List<ServiceEntity> serviceEntities = serviceRepository.findAll(); for (ServiceEntity serviceEntity : serviceEntities) { try { log.info("Syncing service " + serviceEntity.getId() + " to url " + serviceEntity.getUrl()); accountServiceService.syncToRemote(serviceEntity.getId(), serviceEntity.getUrl()); } catch (Exception e) { log.info("Failed to sync service " + serviceEntity.getId() + ": " + e.getMessage()); } } } catch (Exception e) { log.error("Sync failed", e); } } }
package com.zhouyi.business.core.service; import com.zhouyi.business.core.common.ReturnCode; import com.zhouyi.business.core.dao.SysRoleMapper; import com.zhouyi.business.core.dao.SysUserRoleMapper; import com.zhouyi.business.core.exception.ExceptionCast; import com.zhouyi.business.core.model.Response; import com.zhouyi.business.core.model.SysRole; import com.zhouyi.business.core.model.SysUserRole; import com.zhouyi.business.core.utils.ResponseUtil; import com.zhouyi.business.core.vo.SysUserRoleVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author 杜承旭 * @ClassNmae: SysUserRoleServiceImpl * @Description: TODO * @date 2019/7/15 16:42 * @Version 1.0 **/ @Service public class SysUserRoleServiceImpl extends BaseServiceImpl<SysUserRole, SysUserRoleVo> implements SysUserRoleService{ @Autowired private SysRoleMapper sysRoleMapper; @Autowired private SysUserRoleMapper sysUserRoleMapper; @Override public Response getRoleListByUserCode(SysUserRoleVo sysUserRoleVo) { Response dataList = this.findDataList(sysUserRoleVo); Map map = (Map)dataList.getData(); if (map == null){ ExceptionCast.cast(ResponseUtil.returnError(ReturnCode.ERROR_05)); } Integer total = (Integer)map.get("total"); List<SysUserRole> list = (List<SysUserRole>)map.get("list"); List<SysRole> sysRoles = new ArrayList<>(); for (SysUserRole sysUserRole : list){ String roleId = sysUserRole.getRoleId(); SysRole sysRole = sysRoleMapper.selectByPrimaryKey(roleId); sysRoles.add(sysRole); } HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("total",total); hashMap.put("list",sysRoles); return ResponseUtil.getResponseInfo(ReturnCode.SUCCESS,hashMap); } @Override public boolean deleteRolesById(String userId) { try { sysUserRoleMapper.deleteRoleByUserId(userId); return true; } catch (Exception e) { e.printStackTrace(); return false; } } }
package com.coinhunter.core.domain.watch; public enum WatchPosition { BUY, SELL }
/* * Copyright 2008 University of California at Berkeley * * 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.rebioma.client.maps; import org.rebioma.client.DataSwitch; import org.rebioma.client.bean.AscData; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.maps.client.base.LatLng; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; public class EnvLayerLegend extends TileLayerLegend { private final AscData data; private final Image img = new Image(); private final Label minLabel = new Label(); private final Label maxLabel = new Label(); private final HTML valueHtml = new HTML(); protected LatLng lookupPoint; protected Double lookupValue; public EnvLayerLegend(AscData data) { super(); this.data = data; img.setUrl(GWT.getModuleBaseURL() + "ascOverlay?legend=1"); minLabel.setText("" + data.getMinValue()); maxLabel.setText("" + data.getMaxValue()); this.addLegend(); } /** * Note that if the lookup returns a null result, the callback is not * executed. */ @Override public void lookupValue(final LatLng point, final LegendCallback callback) { DataSwitch.get().getValue(data.getId(), point.getLatitude(), point.getLongitude(), new AsyncCallback<Double>() { public void onFailure(Throwable caught) { } public void onSuccess(Double result) { lookupPoint = point; lookupValue = result; String value = result == null ? "" : result.toString(); setDisplay(point, value); callback.onLookup(point, value); } }); } @Override public void setDisplay(LatLng point, String value) { if (value == null) { value = ""; } String pointText = point.getToUrlValue(7); if (value.length() < 1) { valueHtml.setHTML("No Data @ " + pointText); } else { valueHtml.setHTML(value + " " + data.getUnits() + " @ " + pointText); } this.setVisible(true); } @Override protected DialogBox getDetails() { final DialogBox dialogBox = new DialogBox(); String metadata; dialogBox.setText(dataSummary()); VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); dialogBox.setWidget(dialogContents); HTML info = new HTML(dataAsHtml()); dialogContents.add(info); metadata = "<a href='" + data.getMetadata() + "' target='_blank'>Metadata</a>"; HTML link = new HTML(metadata); link.setStyleName("metadatalink"); dialogContents.add(link); dialogContents.setCellHorizontalAlignment(info,HasHorizontalAlignment.ALIGN_LEFT); Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogContents.add(closeButton); dialogContents.setCellHorizontalAlignment(closeButton,HasHorizontalAlignment.ALIGN_LEFT); return dialogBox; } @Override protected Widget getLegendWidget() { // Panel for mix/max labels and legend image: HorizontalPanel topHp = new HorizontalPanel(); topHp.setSpacing(5); topHp.add(minLabel); topHp.add(img); topHp.add(maxLabel); // Panel for value, coordinates, and details link: HorizontalPanel bottomHp = new HorizontalPanel(); bottomHp.setWidth("100%"); bottomHp.add(valueHtml); bottomHp.setCellWidth(valueHtml, "360px"); valueHtml.setStyleName("map-LegendValue"); valueHtml.setHTML("Click map for values..."); HTML detailsLink = new HTML("Details"); detailsLink.setStyleName("map-LegendDetailLink"); detailsLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showDetails(); } }); bottomHp.add(detailsLink); bottomHp.setCellHorizontalAlignment(detailsLink, HasHorizontalAlignment.ALIGN_RIGHT); // Panel that contains top and bottom panels: VerticalPanel vp = new VerticalPanel(); vp.setStylePrimaryName("rebioma-legendWidget"); vp.add(topHp); vp.add(bottomHp); vp.setWidth("380px"); return vp; } /** * Arrondi d'un double avec n �l�ments apr�s la virgule. * @param a La valeur � convertir. * @param n Le nombre de d�cimales � conserver. * @return La valeur arrondi � n d�cimales. */ public static double floor(double a, int n) { double p = Math.pow(10.0, n); return Math.floor((a*p)+0.5) / p; } private String dataAsHtml() { double width1, width2, cellsize = 0; width1 = (data.getEastBoundary() - data.getWestBoundary()); width2 = Double.valueOf(data.getWidth()); width2 = floor(width2,6); cellsize = width1 / width2 ; StringBuilder builder = new StringBuilder(); builder.append("<div id=\"content\">"); builder.append("<P>"); builder.append("<b>Year Sampled:</b> " + data.getYear()); builder.append("<BR>"); builder.append("<b>Minimum Value:</b> " + data.getMinValue()); builder.append("<BR>"); builder.append("<b>Maximum Value:</b> " + data.getMaxValue()); builder.append("<BR>"); builder.append("<b>Units:</b> " + data.getUnits()); builder.append("<BR>"); builder.append("<b>Type:</b> " + data.getVariableType()); builder.append("<BR>"); builder.append("<b>Cell Size:</b> " + cellsize); builder.append("<BR>"); builder.append("<b>Row Count:</b> " + data.getHeight()); builder.append("<BR>"); builder.append("<b>Column Count:</b> " + data.getWidth()); builder.append("</div>"); return builder.toString(); } private String dataSummary() { return data.getEnvDataType() + " - " + data.getEnvDataSubtype() + " " + data.getYear(); } }
package config; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; @Configuration @RequiredArgsConstructor @EnableAuthorizationServer public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { final AuthenticationManager authenticationManager; @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("html") .secret("pwd") .authorizedGrantTypes("password") .scopes("openid"); } @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.authenticationManager(authenticationManager); } }
package MouseActions; public class SerialiseSelect { }
package com.rishi.baldawa.iq; import org.junit.Test; import static org.junit.Assert.assertEquals; public class RomanToIntTest { @Test public void romanToInt() throws Exception { assertEquals(new RomanToInt().solution("I"), 1); assertEquals(new RomanToInt().solution("III"), 3); assertEquals(new RomanToInt().solution("IV"), 4); assertEquals(new RomanToInt().solution("VI"), 6); assertEquals(new RomanToInt().solution("IX"), 9); assertEquals(new RomanToInt().solution("X"), 10); assertEquals(new RomanToInt().solution("XL"), 40); assertEquals(new RomanToInt().solution("MCMIV"), 1904); assertEquals(new RomanToInt().solution("DCXXI"), 621); } }
package br.com.victorguimas.oauth.models; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; @Entity public class Auth { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String client_id; private String refresh_token; private String access_token; private Date expires_at; @OneToOne private User user; public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } public String getClient_id() { return client_id; } public void setClient_id(String client_id) { this.client_id = client_id; } public String getRefresh_token() { return refresh_token; } public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } public String getAccess_token() { return access_token; } public void setAccess_token(String access_token) { this.access_token = access_token; } public Date getExpires_at() { return expires_at; } public void setExpires_at(Date expires_at) { this.expires_at = expires_at; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } }
package com.jim.multipos.utils; public interface OnItemClickListener<T> { void onItemClicked(int position); void onItemClicked(T item); }
package lowOfDeteter.demo; import java.util.List; /** * @Author:Jack * @Date: 2021/8/21 - 22:15 * @Description: lowOfDeteter * @Version: 1.0 */ public class GroupLeader { private List<Girl> girlList; public GroupLeader(List<Girl> girlList){ this.girlList = girlList; } public void count(){ System.out.println("number of girl is " + girlList.size()); } }
package com.example.android.monthcalendarwidget; public class YearMonthDay { int year; int month; int day; public YearMonthDay(int y, int m, int d){ this.year = y; this.month = m; this.day = d; } public YearMonthDay(){ this(0,0,0); } }
package GUIModule; import javax.swing.*; import java.awt.*; public class TableToolBar extends JToolBar { public TableToolBar(JLabel algorithmLabel, JTextField trafficField, JTextField ruleField, JTable table, GUI gui) { Insets margins = new Insets(0, 0, 0, 0); ToolBarButton startButton = new ToolBarButton("data/start.png" ); ActionStartButton startButtonAction = new ActionStartButton(algorithmLabel,trafficField,ruleField, table, gui); startButton.addActionListener(startButtonAction); add(startButton); startButton.setToolTipText("Запустить"); startButton.setMargin(margins); ToolBarButton fullReportButton = new ToolBarButton("data/report.png"); fullReportButton.addActionListener(new ActionFullReportButton(table, startButtonAction.getPreviousStartStatistics())); add(fullReportButton); fullReportButton.setToolTipText("Подробный отчет"); fullReportButton.setMargin(margins); ToolBarButton compareFullReportButton = new ToolBarButton("data/compare.png"); compareFullReportButton.addActionListener(new ActionCompareFullReportButton(table, startButtonAction.getPreviousStartStatistics())); add(compareFullReportButton); compareFullReportButton.setToolTipText("Сравнить запуски"); ToolBarButton resultsButton = new ToolBarButton("data/results.png"); resultsButton.addActionListener(new ActionResultsReport(table,startButtonAction.getPreviousStartResult())); add(resultsButton); resultsButton.setToolTipText("Результат классификации"); compareFullReportButton.setMargin(margins); setTextLabels(true); } public void setTextLabels(boolean labelsAreEnabled) { Component c; int i = 0; while((c = getComponentAtIndex(i++)) != null) { ToolBarButton button = (ToolBarButton)c; if (labelsAreEnabled) button.setText(button.getToolTipText()); else button.setText(null); } } }
package com.open.proxy.aop.advice; /** * 拦截接口 * * @author jinming.wu * @date 2014-4-7 */ public interface Advice { }
package com.zap.desafio.dto; import lombok.Getter; import lombok.Setter; import java.math.BigDecimal; import java.util.Objects; @Getter @Setter public class ParameterDto { private BigDecimal price; private BigDecimal rentalPrice; private BigDecimal monthlyCondoFee; private BigDecimal usableAreas; private String businessType; private LocationDto locationDto; public ParameterDto() { price = BigDecimal.ZERO; rentalPrice = BigDecimal.ZERO; monthlyCondoFee = BigDecimal.ZERO; usableAreas = BigDecimal.ZERO; businessType = ""; locationDto = new LocationDto(0, 0); } }
/** * @author Pawel Wloch @SoftLab * @date 14.10.2018 */ package org.softlab.cs.tradevalidator.validation.utils; import java.util.Date; import java.util.List; import java.util.Map; public interface ResourceProvider { public String getLIVRRules(); /** * * @return a map of ISO 4217 currency codes with currency available holidays information */ public Map<String, List<Date>> getCurrencyInfoMap(); }
package com.bridgeit.CommercialDataProcessing; import java.io.File; import java.io.PrintStream; public class LinkedList<T> { Node<T> head; public static Company company = new Company(); public void add(T file) { Node<T> n = new Node<T>(file); if (head == null) { head = n; } else { Node<T> t = head; while (t.next != null) { t = t.next; } t.next = n; } } public boolean search(T item) { int c = 0; if (head == null) { return false; } else { Node<T> t = head; while (t != null) { if (item.equals(t.data)) { c++; break; } t = t.next; } } if (c > 0) return true; else return false; } public void append(T data) { Node<T> n = new Node<T>(data); n.data = data; n.next = null; Node<T> t = head; while (t.next != null) { t = t.next; } t.next = n; } public void display() { Node<T> t = head; while (t != null) { System.out.println(t.data.toString()); t = t.next; } } public void write() throws Exception { Node<T> t = head; try { PrintStream o = new PrintStream(new File("OrderedList")); System.setOut(o); while (t != null) { System.out.println(t.data); t = t.next; } } catch (Exception e) { System.out.println("File not found"); } } public int index(T item) { int c = 0, i = 0; if (head == null) { return -1; } else { Node<T> t = head; while (t != null) { i++; if (item == t.data) { c++; break; } t = t.next; } } if (c > 0) return i; else return -1; } public void pop() { Node<T> t = head; while (t.next != null) t = t.next; System.out.println(t.data); } public T pop(int pos) { Node<T> t = head; int i = 1; while (t != null && i < pos) { t = t.next; i++; } // System.out.println(t.data); return t.data; } public boolean isEmpty() { if (head == null) return true; else return false; } public int size() { int i = 0; if (head == null) return 0; else { Node<T> t = head; while (t != null) { t = t.next; i++; } } return i; } public void remove(int item) { Node<T> temp = head, prev = null; if (item == 1) { head = temp.next; return; } int i = 2; while (temp != null && i <= item) { prev = temp; temp = temp.next; i++; } if (temp == null) return; prev.next = temp.next; } public void insert(int index, T data) { Node<T> n = new Node<T>(data); n.data = data; n.next = null; if (index == 0) { addFirst(data); } else { Node<T> temp = head; for (int i = 0; i < index - 1; i++) { temp = temp.next; } n.next = temp.next; temp.next = n; } } public void addFirst(T data) { Node<T> n = new Node<T>(data); Node<T> temp = head; n.next = temp; head = n; } public void sort(T i) { Node<T> t, a, prev, pos; pos = new Node<T>(i); pos.next = head; head = pos; while (pos.next != null) { t = pos.next; prev = pos; a = t.next; while (a != null) { if (((String) a.data).compareTo((String) t.data) > 0) { Node<T> temp = a.next; a.next = prev.next; prev.next = t.next; t.next = temp; prev = a; a = temp; } else { a = a.next; t = t.next; prev = prev.next; } } pos = pos.next; head = head.next; } } }
package com.tencent.mm.plugin.appbrand.appusage; public final class j$c { }
package com.mydemo.activity.listcontent; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import com.mydemo.activity.R; import com.mydemo.activity.navhome.NavHomeVpActivity; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by Administrator on 2016/6/18. */ public class ListContentActivity extends Activity { @Bind(R.id.t1) TextView mT1; @Bind(R.id.t2) TextView mT2; @Bind(R.id.t3) TextView mT3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_s2_list_content); ButterKnife.bind(this); } @OnClick({R.id.t1, R.id.t2, R.id.t3}) public void onClick(View view) { Intent it=new Intent(); switch (view.getId()) { case R.id.t1: /** * StickHeaderListView 适合无数据交互 */ it.setClass(this,NavHomeVpActivity.class); break; case R.id.t2: /** * 下拉刷新, */ it.setClass(this,NavHomeVpActivity.class); break; case R.id.t3: /** * 分组扩展 */ it.setClass(this,NavHomeVpActivity.class); break; case R.id.t4: /** *各种方向的滑动 */ it.setClass(this,NavHomeVpActivity.class); break; case R.id.t5: /** *TabLayout */ it.setClass(this,NavHomeVpActivity.class); break; } startActivity(it); } }
package com.tencent.mm.plugin.sns.ui; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.TextView.BufferType; import com.tencent.mm.bt.h; import com.tencent.mm.model.q; import com.tencent.mm.plugin.appbrand.s$l; import com.tencent.mm.plugin.sns.c.a; import com.tencent.mm.plugin.sns.i$f; import com.tencent.mm.plugin.sns.i$g; import com.tencent.mm.plugin.sns.i$j; import com.tencent.mm.plugin.sns.i.e; import com.tencent.mm.plugin.sns.model.af; import com.tencent.mm.plugin.sns.storage.j; import com.tencent.mm.plugin.sns.storage.k; import com.tencent.mm.pluginsdk.ui.a.b; import com.tencent.mm.protocal.c.boh; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.r; class SnsStrangerCommentDetailUI$a extends r<j> { private Activity bOb; private OnClickListener hqU = new OnClickListener() { public final void onClick(View view) { String str = (String) view.getTag(); x.d("MicroMsg.SnsStrangerCommentDetailUI", "onCommentClick:" + str); Intent intent = new Intent(); intent.putExtra("Contact_User", str); a.ezn.d(intent, SnsStrangerCommentDetailUI$a.this.bOb); } }; final /* synthetic */ SnsStrangerCommentDetailUI obC; public final /* synthetic */ Object a(Object obj, Cursor cursor) { j jVar = (j) obj; if (jVar == null) { jVar = new j(); } jVar.d(cursor); return jVar; } public SnsStrangerCommentDetailUI$a(SnsStrangerCommentDetailUI snsStrangerCommentDetailUI, Activity activity) { this.obC = snsStrangerCommentDetailUI; super(activity, new j()); this.bOb = activity; } public final View getView(int i, View view, ViewGroup viewGroup) { a aVar; if (view == null) { a aVar2 = new a(this); view = View.inflate(this.bOb, i$g.sns_stranger_comment_item, null); aVar2.eCl = (ImageView) view.findViewById(i$f.sns_comment_avatar_iv); aVar2.eZj = (TextView) view.findViewById(i$f.sns_comment_content_tv); aVar2.lWV = (TextView) view.findViewById(i$f.sns_comment_nickname_tv); aVar2.mKZ = (TextView) view.findViewById(i$f.sns_comment_source); aVar2.hrV = (TextView) view.findViewById(i$f.sns_comment_time); aVar2.obF = (ImageView) view.findViewById(i$f.sns_comment_heart_iv); view.setTag(aVar2); aVar = aVar2; } else { aVar = (a) view.getTag(); } j jVar = (j) getItem(i); try { Object obj; boh boh = (boh) new boh().aG(jVar.field_curActionBuf); b.p(aVar.eCl, boh.seC); aVar.eCl.setTag(boh.seC); aVar.eCl.setOnClickListener(this.hqU); if (boh.sme != null) { obj = boh.sme; } else { obj = ((j) this.tlE).field_talker; } aVar.lWV.setTag(boh.seC); CharSequence a = com.tencent.mm.pluginsdk.ui.d.j.a(this.bOb, obj, aVar.lWV.getTextSize()); a.setSpan(new 2(this, boh.seC), 0, obj.length(), 33); aVar.lWV.setText(a, BufferType.SPANNABLE); aVar.lWV.setOnTouchListener(new ab()); if (jVar.field_type == 3) { aVar.eZj.setVisibility(0); aVar.obF.setVisibility(8); x.v("MicroMsg.SnsStrangerCommentDetailUI", "source:" + boh.rdq + " time:" + boh.lOH + " timeFormatted:" + az.k(this.bOb, ((long) boh.lOH) * 1000)); aVar.eZj.setText(boh.jSA + " "); com.tencent.mm.pluginsdk.ui.d.j.g(aVar.eZj, 2); aVar.eZj.setVisibility(0); } else { aVar.eZj.setVisibility(8); aVar.obF.setVisibility(0); } if (!q.GF().equals(boh.seC)) { aVar.mKZ.setVisibility(0); TextView textView = aVar.mKZ; switch (boh.rdq) { case 18: textView.setText(this.obC.getString(i$j.sns_from_lbs)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, com.tencent.mm.bp.a.f(this.bOb, e.personactivity_notice_stranger_nearicon), null); break; case 22: case 23: case 24: case 26: case 27: case s$l.AppCompatTheme_actionModeCloseButtonStyle /*28*/: case s$l.AppCompatTheme_actionModeBackground /*29*/: textView.setText(this.obC.getString(i$j.sns_from_shake)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, com.tencent.mm.bp.a.f(this.bOb, e.personactivity_notice_stranger_shakeicon), null); break; case 25: textView.setText(this.obC.getString(i$j.sns_from_bottle)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, com.tencent.mm.bp.a.f(this.bOb, e.personactivity_notice_stranger_bottleicon), null); break; case s$l.AppCompatTheme_actionModeSplitBackground /*30*/: textView.setText(this.obC.getString(i$j.sns_from_qrcode)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, com.tencent.mm.bp.a.f(this.bOb, e.personactivity_notice_stranger_codeicon), null); break; default: textView.setText(this.obC.getString(i$j.sns_from_stranger)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, com.tencent.mm.bp.a.f(this.bOb, e.personactivity_notice_stranger_searchicon), null); break; } } aVar.mKZ.setVisibility(8); aVar.hrV.setText(az.k(this.bOb, ((long) boh.lOH) * 1000)); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.SnsStrangerCommentDetailUI", e, "", new Object[0]); } return view; } public final void WT() { k byt = af.byt(); String l = SnsStrangerCommentDetailUI.l(this.obC); l = k.bAO() + " where talker = " + h.fz(l) + " and snsID = " + SnsStrangerCommentDetailUI.m(this.obC) + " and ( type = 3 or type = 5 )"; x.v("MicroMsg.SnsCommentStorage", "comment sql:" + l); setCursor(byt.dCZ.b(l, null, 0)); } protected final void WS() { WT(); } }
package BankTura; public class ContaPoupanca extends Conta{ // Atributos private double juros = 0.5; // Métodos construtores de permissão de acesso public double getJuros() { return juros; } public void setJuros(double juros) { this.juros = juros; } }
package com.example.barea.notelist; import android.content.Intent; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.widget.Toast; import com.example.barea.notelist.Model.Note; import com.example.barea.notelist.Utils.PrefUtils; import com.example.barea.notelist.view.NoteAdapter; import com.example.barea.notelist.view.RecyclerTouchListener; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Function; import io.reactivex.observers.DisposableSingleObserver; import io.reactivex.schedulers.Schedulers; public class MainActivity extends AppCompatActivity { private List<Note> notes = new ArrayList<>(); private NoteAdapter noteAdapter; ManageNote manageNote; @BindView(R.id.coordinator_layout) CoordinatorLayout coordinatorLayout; @BindView(R.id.recycler_view) RecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); manageNote = new ManageNote(getApplicationContext()); noteAdapter = new NoteAdapter(this,notes); RecyclerView.LayoutManager linerLyou = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(linerLyou); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(noteAdapter); recyclerView.addOnItemTouchListener(new RecyclerTouchListener(this, recyclerView, new RecyclerTouchListener.onClickListener() { @Override public void onClick(View v, int position) { } @Override public void onLongClick(View v, int position) { Note note = notes.get(position); Integer id = note.getId(); Intent i = new Intent(MainActivity.this, DesplyTask.class); i.putExtra("noteId",String.valueOf(id)); i.putExtra("Note", note.getNote()); MainActivity.this.startActivity(i); } })); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MainActivity.this, DesplyTask.class); MainActivity.this.startActivity(i); } }); if(TextUtils.isEmpty(PrefUtils.getApiKey(this))){ manageNote.CreateUser(getApplicationContext()); } else { load(); } } @Override public void onResume(){ super.onResume(); load(); } public void load(){ manageNote.compositeDisposable.add( manageNote.apiService.fetchAllNotes() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .map(new Function<List<Note>, List<Note>>() { @Override public List<Note> apply(List<Note> lnotes) throws Exception { // TODO - note about sort Collections.sort(lnotes, new Comparator<Note>() { @Override public int compare(Note n1, Note n2) { return n2.getId() - n1.getId(); } }); return lnotes; } }) .subscribeWith(new DisposableSingleObserver<List<Note>>() { @Override public void onSuccess(List<Note> lnotes) { notes.clear(); notes.addAll(lnotes); noteAdapter.notifyDataSetChanged(); } @Override public void onError(Throwable e) { Toast.makeText(getApplicationContext(), e.getMessage(),Toast.LENGTH_LONG).show(); } })); } }
/** * Copyright (c) 2016, 润柒 All Rights Reserved. * */ package com.richer.jsms.common.pkg; import java.util.Collection; /** * * 分页信息. * <ul> * <li>pagesize - 每页记录数,=0不分页</li> * <li>pageno - 当前页数,base=1</li> * <li>pagecount - 总页数</li> * <li>recdcount - 总记录数</li> * <li>pagestyle - 分页方式, n-普通(统计真正记录数),c-持续(不返回真正记录数,返回已查到记录数+1)</li> * </ul> * * @author <a href="mailto:sunline360@sina.com">润柒</a> * @since JDK 1.7 * @version 0.0.1 */ public class Pager { /** * 每页记录数 =0不分页 */ private int pagesize = 10; /** * 当前页数 base = 1 */ private int pageno = 1; /** * 总记录数 */ private int recdcount = 0; /** * 排序方式 */ private String order = Order.ASC; /** * 排序字段 */ private String sort; /** * 分页方式 n-普通(统计真正记录数),c-持续(不返回真正记录数,返回已查到记录数+1) */ private String pagestyle = PageStyle.NORMAL; //{{ setter and getter public int getPagesize() { return pagesize; } public void setPagesize(int pagesize) { this.pagesize = pagesize; } public int getPageno() { return pageno; } public void setPageno(int pageno) { this.pageno = pageno; } public int getRecdcount() { return recdcount; } public void setRecdcount(int recdcount) { this.recdcount = recdcount; } /** * 分页方式, n-普通(统计真正记录数),c-持续(不返回真正记录数,返回已查到记录数+1) * * @return */ public String getPagestyle() { return pagestyle; } public void setPagestyle(String pagestyle) { this.pagestyle = pagestyle; } public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } public String getSort() { return sort; } public void setSort(String sort) { this.sort = sort; } /** * 检验并设置总记录数 * * @param rcds */ public void check(Collection<?> rcds) { if (PageStyle.NORMAL.equalsIgnoreCase(getPagestyle())) { if (this.getRecdcount() == 0) { this.setRecdcount(rcds.size()); } return; } int count = rcds.size(); int total = count + getPagesize() * (getPageno() - 1); if (count == getPagesize()) { total++; //记录数刚好=page size时,+1以便前端翻页器可以继续翻页 } else if (count > getPagesize()) { total = count;//若分页控制失效,则认为当前页记录数为总记录数 } setRecdcount(total); } public static final class Order { public static final String DESC = "desc"; public static final String ASC = "asc"; } public static final class PageStyle { /** * 传统分页模式,统计总记录数,按分页窗口取数据 * 前端需提供:查询条件,pageno,pagesize */ public static final String NORMAL = "n"; /** * 持续分页模式,不统计总记录数,总记录数=到当前页为止已查到记录数+1,按分页窗口取数据. * 前端需提供:查询条件,pageno,pagesize */ public static final String CONTINUE = "c"; /** * where条件分页模式,由前端提供查询条件限定查询分页窗口,不统计总记录数,总记录数=到当前页为止已查到记录数+1,仅取第一页窗口数据. * 前端需提供:查询条件,分页条件,pagesize */ public static final String WHERE = "w"; } }
package com.zebra.pay.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.parser.Feature; import java.util.Map; /** * JSON操作工具集 * @author 2013159 * */ public class JsonUtils { public static String toJsonString(Object object){ return JSON.toJSONString(object); } public static Map<String, Object> toMapObject(String values){ return JSON.parseObject(values,new TypeReference<Map<String, Object>>(){},new Feature[0]); } public static void main(String[] args) { toMapObject("{a:1,b:2}"); } }
package net.minecraft.client.model; import java.util.Random; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.util.math.MathHelper; public class ModelGhast extends ModelBase { ModelRenderer body; ModelRenderer[] tentacles = new ModelRenderer[9]; public ModelGhast() { int i = -16; this.body = new ModelRenderer(this, 0, 0); this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16); this.body.rotationPointY += 8.0F; Random random = new Random(1660L); for (int j = 0; j < this.tentacles.length; j++) { this.tentacles[j] = new ModelRenderer(this, 0, 0); float f = (((j % 3) - (j / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F; float f1 = ((j / 3) / 2.0F * 2.0F - 1.0F) * 5.0F; int k = random.nextInt(7) + 8; this.tentacles[j].addBox(-1.0F, 0.0F, -1.0F, 2, k, 2); (this.tentacles[j]).rotationPointX = f; (this.tentacles[j]).rotationPointZ = f1; (this.tentacles[j]).rotationPointY = 15.0F; } } public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { for (int i = 0; i < this.tentacles.length; i++) (this.tentacles[i]).rotateAngleX = 0.2F * MathHelper.sin(ageInTicks * 0.3F + i) + 0.4F; } public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.6F, 0.0F); this.body.render(scale); byte b; int i; ModelRenderer[] arrayOfModelRenderer; for (i = (arrayOfModelRenderer = this.tentacles).length, b = 0; b < i; ) { ModelRenderer modelrenderer = arrayOfModelRenderer[b]; modelrenderer.render(scale); b++; } GlStateManager.popMatrix(); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\client\model\ModelGhast.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package annotations; public class App { public static void main(String[] args) { BasketBall basketBall=new BasketBall(); basketBall.bounce(); } }
public class Department { private String name; private Student students[]; private Teacher teachers[]; private Group groups[]; public Department() { setName("NoName"); students = new Student[0]; teachers = new Teacher[0]; groups = new Group[0]; } public Department(String name) { this.name = name; students = new Student[0]; teachers = new Teacher[0]; groups = new Group[0]; } public void setName(String name) { this.name = name; } public void setStudents(Student students[]) { this.students = students; } public void setTeachers(Teacher teachers[]) { this.teachers = teachers; } public void setGroups(Group groups[]) { this.groups = groups; } public void addStudent(Student s) { Student newStd[] = new Student[students.length+1]; for(int i = 0; i < students.length; i++) newStd[i] = students[i]; newStd[students.length] = s; students = newStd; } public void addTeacher(Teacher t) { Teacher newT[] = new Teacher[teachers.length+1]; for(int i = 0; i < teachers.length; i++) newT[i] = teachers[i]; newT[teachers.length] = t; teachers = newT; } public void addGroup(Group g) { Group newG[] = new Group[groups.length+1]; for(int i = 0; i < groups.length; i++) newG[i] = groups[i]; newG[groups.length] = g; groups = newG; } public String getName() { return name; } public Student[] getStudents() { return students; } public Teacher[] getTeachers() { return teachers; } public Group[] getGroups() { return groups; } public Student studentAt(int i) { return students[i]; } public Teacher teacherAt(int i) { return teachers[i]; } public Group groupAt(int i) { return groups[i]; } public boolean studentIsExist(String name) { for(int i = 0; i < students.length; i++) if(students[i].getName().equalsIgnoreCase(name)) return true; return false; } public boolean teacherIsExist(String name) { for(int i = 0; i < teachers.length; i++) if(teachers[i].getName().equalsIgnoreCase(name)) return true; return false; } public boolean groupIsExist(int id) { for(int i = 0; i < groups.length; i++) if(groups[i].getID() == id) return true; return false; } public void deleteStudentByName(String name) { int index = -1; for(int i = 0; i < students.length; i++) { if(students[i].getName().equalsIgnoreCase(name)) { index = i; break; } } if(index < 0) return; else { Student newStd[] = new Student[students.length-1]; for(int i = 0; i < students.length; i++) { if(i == index) continue; else if(index > i) newStd[i] = students[i]; else newStd[i-1] = students[i]; } students = newStd; } } public void deleteTeacherByName(String name) { int index = -1; for(int i = 0; i < teachers.length; i++) { if(teachers[i].getName().equalsIgnoreCase(name)) { index = i; break; } } if(index < 0) return; else { Teacher newTea[] = new Teacher[teachers.length-1]; for(int i = 0; i < teachers.length; i++) { if(i == index) continue; else if(index > i) newTea[i] = teachers[i]; else newTea[i-1] = teachers[i]; } teachers = newTea; } } public void deleteGroupByID(int id) { int index = -1; for(int i = 0; i < groups.length; i++) { if(groups[i].getID() == id) { index = i; break; } } if(index < 0) return; else { Group newGrp[] = new Group[groups.length-1]; for(int i = 0; i < groups.length; i++) { if(i == index) continue; else if(index > i) newGrp[i] = groups[i]; else newGrp[i-1] = groups[i]; } groups = newGrp; } } public Student studentByName(String name) { for(int i = 0; i < students.length; i++) if(students[i].getName().equalsIgnoreCase(name)) return students[i]; return null; } public Teacher teacherByName(String name) { for(int i = 0; i < teachers.length; i++) if(teachers[i].getName().equalsIgnoreCase(name)) return teachers[i]; return null; } public Group groupByID(int id) { for(int i = 0; i < groups.length; i++) if(groups[i].getID() == id) return groups[i]; return null; } public String toString() { String str = " " + name + ":\n"; str += " Teachers: "; for(int i = 0;i < teachers.length;++i) str += "\n " + teachers[i].toString(); if(teachers.length == 0) str += "\n null"; str += "\n Students:"; for(int i = 0;i < students.length;++i) str += "\n " + students[i].toString(); if(students.length == 0) str += "\n null"; str += "\n Groups:"; for(int i = 0;i < groups.length;++i) str += "\n " + groups[i].toString(); if(groups.length == 0) str += "\n null"; return str; } public String sortedStudentsByName() { Student buff; Student[] stdBuff = new Student[students.length]; for(int i = 0;i < stdBuff.length;++i) stdBuff[i] = students[i]; for(int i = 0; i < stdBuff.length; i++) { for(int j = i; j < stdBuff.length; j++) { for(int k = 0; k < Math.max(stdBuff[i].getName().length(), stdBuff[j].getName().length()); k++) { if(stdBuff[i].getName().charAt(k) == stdBuff[j].getName().charAt(k)) continue; if(stdBuff[i].getName().charAt(k) > stdBuff[j].getName().charAt(k)) { buff = stdBuff[i]; stdBuff[i] = stdBuff[j]; stdBuff[j] = buff; break; } else break; } } } String output = ""; for(int i = 0; i < stdBuff.length; i++) output += "\n " + stdBuff[i].toString(); return output; } public String sortedTeachers() { Teacher buff; Teacher[] tchBuff = new Teacher[teachers.length]; for(int i = 0;i < tchBuff.length;++i) tchBuff[i] = teachers[i]; for(int i = 0; i < tchBuff.length; i++) for(int j = i; j < tchBuff.length; j++) for(int k = 0; k < Math.max(tchBuff[i].getName().length(), tchBuff[j].getName().length()); k++) { if(tchBuff[i].getName().charAt(k) == tchBuff[j].getName().charAt(k)) continue; if(tchBuff[i].getName().charAt(k) > tchBuff[j].getName().charAt(k)) { buff = tchBuff[i]; tchBuff[i] = tchBuff[j]; tchBuff[j] = buff; break; } else break; } String output = ""; for(int i = 0; i < tchBuff.length; i++) output += "\n " + tchBuff[i].toString(); return output; } public String sortedGroups() { Group buff; Group[] grpBuff = new Group[groups.length]; for(int i = 0;i < grpBuff.length;++i) grpBuff[i] = groups[i]; for(int i = 0; i < grpBuff.length; i++) for(int j = i; j < grpBuff.length; j++) if(grpBuff[i].getID() > grpBuff[j].getID()) { buff = grpBuff[i]; grpBuff[i] = grpBuff[j]; grpBuff[j] = buff; break; } String output = ""; for(int i = 0; i < grpBuff.length; i++) output += "\n " + grpBuff[i].toString(); return output; } public String sortedByName() { String output = name + ":\n Teachers:"; output += sortedTeachers(); output += "\n Students:"; output += sortedStudentsByName(); output += "\n Groups:"; output += sortedGroups(); return output; } public String sortedStudentsByCourse() { Student buff; Student[] stdBuff = new Student[students.length]; for(int i = 0;i < stdBuff.length;++i) stdBuff[i] = students[i]; for(int i = 0; i < stdBuff.length; i++) for(int j = i; j < stdBuff.length; j++) if(stdBuff[i].getCourse() > stdBuff[j].getCourse()) { buff = stdBuff[i]; stdBuff[i] = stdBuff[j]; stdBuff[j] = buff; break; } String output = ""; for(int i = 0; i < stdBuff.length; i++) output += "\n " + stdBuff[i].toString(); return output; } public String sortedByCourse() { String output = name +":\n Teachers:"; output += sortedTeachers(); output += "\n Students:"; output += sortedStudentsByCourse(); output += "\n Groups:"; output += sortedGroups(); return output; } }
package com.ebay.lightning.client; import java.util.AbstractMap; import java.util.AbstractMap.SimpleEntry; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.log4j.Logger; import com.ebay.lightning.client.caller.RestAPICaller; import com.ebay.lightning.client.caller.ServiceCaller; import com.ebay.lightning.client.config.LightningClientConfig; import com.ebay.lightning.core.beans.ReservationReceipt; import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * {@code ServiceHostResolver} manages the seeds aka lightning core instances. The list of seeds to be managed * are passed to the constructor via {link LightningClientConfig}. The {@link LightningClient} routes the * tasks to the seed returned by {@code ServiceHostResolver}. * * @author shashukla * @see LightningClientConfig * @see RestAPICaller */ public class ServiceHostResolver { private static final Logger log = Logger.getLogger(ServiceHostResolver.class); private ServiceCaller apiCaller; private LightningClientConfig config; private ExecutorService executor; private int minimumSize = 1; /** * Constructs a new {@code ServiceHostResolver} object with seed management configuration * * @param config {@link LightningClientConfig} contains the seeds and configuration for seed management * @param apiCaller {@code ServiceCaller} makes calls to seed to check if it can process a request of specific load */ public ServiceHostResolver(LightningClientConfig config, ServiceCaller apiCaller) { this.config = config; this.apiCaller = apiCaller; int seedSize = config.getSeeds() != null ? config.getSeeds().size() : 0; int threadPoolSize = seedSize > minimumSize ? seedSize : minimumSize; executor = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactoryBuilder().setNameFormat("ServiceHostResolver-%d").build()); } /** * Get the next available seed that can handle the task. * @param forLoad the load of the task to be executed by the seed * @return the reservation receipt and the seed that accepted the pay load * throws RuntimeException if none of the seeds accepted the request */ public SimpleEntry<ReservationReceipt, String> getNextEndPoint(final int forLoad) { List<String> seeds = getAllSeed(true); String errMsg = null; SimpleEntry<ReservationReceipt, String> nextEndPoint = null; try { nextEndPoint = getNextEndPoint(forLoad, seeds); } catch (Exception e) { errMsg = "Error getting Endpoint in my region: " + e.getMessage(); } if (nextEndPoint == null && config.isAllowCrossRegionInteraction() && config.getCrossRegionSeeds() != null) { try { seeds = config.getCrossRegionSeeds(); log.info(errMsg +", Now trying cross region seeds "+ seeds); nextEndPoint = getNextEndPoint(forLoad, seeds); } catch (Exception e) { errMsg = errMsg + ", Error getting Endpoint in cross-region: " + e.getMessage(); } } if (nextEndPoint == null && errMsg != null) { throw new RuntimeException(errMsg); } return nextEndPoint; } /** * Get the next available seed that can handle the task. * @param forLoad the load of the task to be executed by the seed * @param seeds the list of seeds to check sequentially until one accepts * @return the reservation receipt and the seed that accepted the pay load * throws RuntimeException if none of the seeds accepted the load request */ private SimpleEntry<ReservationReceipt, String> getNextEndPoint(final int forLoad, List<String> seeds) { int retryAttempt = 0; if (seeds != null && !seeds.isEmpty()) { while (retryAttempt++ < config.getMaxRetryAttempt()) { for (int i = 0; i < seeds.size(); i++) { try { final String seedToCall = seeds.get(i); ReservationReceipt reservationRcptTemp = getReservationRcpt(forLoad, seedToCall); boolean denied = ReservationReceipt.State.DENIED.equals(reservationRcptTemp.getState()); if (!denied) { return new AbstractMap.SimpleEntry<ReservationReceipt, String>(reservationRcptTemp, seedToCall); } } catch (Exception e) { log.error("Unable to get reservation on" + seeds.get(i), e); } } //if none of the seeds accept the reservation then get the first randomized seed log.info(String.format("None of the seeds [%s] have accepted my reservation for load [%d], retrying attmept: %d", seeds, forLoad, retryAttempt)); //All core machines are busy, lets wait for some time before trying sleepFor(2000); } throw new RuntimeException(String.format("None of the seeds [%s] accepted reservation for load [%d] even after %d retries", seeds, forLoad, config.getMaxRetryAttempt())); } else { throw new RuntimeException("No Seeds found "); } } /** * Check if the seed can accept the request * @param forLoad the load of the task to be executed by the seed * @param seedToCall the seed to check * @return the reservation receipt returned by the seed. Returns {@code null} if the seed * do not respond within a second. * throws RuntimeException if none of the seeds accepted the load request */ private ReservationReceipt getReservationRcpt(final int forLoad, final String seedToCall) throws InterruptedException, ExecutionException, TimeoutException { Future<ReservationReceipt> future = executor.submit(new Callable<ReservationReceipt>() { @Override public ReservationReceipt call() throws Exception { return apiCaller.reserve(forLoad, seedToCall); } }); ReservationReceipt reservationRcptTemp = future.get(1000, TimeUnit.MILLISECONDS); return reservationRcptTemp; } private void sleepFor(int sleepTime) { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { //ignore } } /** * Gets the list of seeds from configuration and shuffles if required * @return the list of seeds */ private List<String> getAllSeed(boolean shuffleSeeds) { List<String> result = config.getSeeds(); if (shuffleSeeds) { java.util.Collections.shuffle(result); } return result; } /* (non-Javadoc) * @see java.lang.Object#finalize() */ @Override protected void finalize() throws Throwable { super.finalize(); executor.shutdownNow(); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); int even = num % 2 == 0 ? num + 2 : num + 1; System.out.println(even); } }
package org.alienchain.explorer.filter; import org.alienchain.explorer.config.WebAppConfig; import org.jooby.Request; import org.jooby.Response; import org.jooby.Route.Chain; import org.jooby.Route.Filter; public class CommonFilter implements Filter{ @Override public void handle(Request req, Response rsp, Chain chain) throws Throwable { WebAppConfig config = req.require(WebAppConfig.class); req.set("seconfig", config.getSearchEngine()); req.set("apiConfig", config.getApiConfig()); chain.next(req, rsp); } }
/* * Copyright 2008 Kjetil Valstadsve * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package vanadis.remoting; import junit.framework.Assert; import vanadis.core.collections.Generic; import org.junit.Before; import org.junit.Test; import java.lang.reflect.Method; import java.util.Collections; import java.util.List; public class MethodComparatorTest extends Assert { private Method m1; private Method m2; private Method m3; private Method m4; private Method m5; private Method m0; private static final MethodComparator CMP = new MethodComparator(); private interface Type { void foo(int one, boolean two); void foo(String one, boolean two); void foo(String one); void bar(); void bar(String one); void bar(boolean one); } @Before public void setUp() throws NoSuchMethodException { m0 = Type.class.getMethod("foo", int.class, boolean.class); m1 = Type.class.getMethod("foo", String.class, boolean.class); m2 = Type.class.getMethod("foo", String.class); m3 = Type.class.getMethod("bar"); m4 = Type.class.getMethod("bar", String.class); m5 = Type.class.getMethod("bar", boolean.class); } @Test public void sort() { List<Method> list = Generic.list(Type.class.getMethods()); Collections.sort(list, CMP); assertEquals(m3, list.get(0)); assertEquals(m5, list.get(1)); assertEquals(m4, list.get(2)); assertEquals(m2, list.get(3)); assertEquals(m0, list.get(4)); assertEquals(m1, list.get(5)); } @Test public void equals() { assertEquals(0, CMP.compare(m0, m0)); assertEquals(0, CMP.compare(m1, m1)); assertEquals(0, CMP.compare(m2, m2)); assertEquals(0, CMP.compare(m3, m3)); assertEquals(0, CMP.compare(m4, m4)); assertEquals(0, CMP.compare(m5, m5)); } }
package com.bowlong.third.netty3; import java.util.List; import java.util.Map; import org.jboss.netty.buffer.ChannelBuffer; import com.bowlong.util.NewList; import com.bowlong.util.NewMap; @SuppressWarnings("rawtypes") public class N3B2Helper { public static final byte[] toBytes(Map o) throws Exception { ChannelBuffer os = ChannelBufferPool.borrowObject(); try { toBytes(os, o); int offset = os.writerIndex(); byte[] result = new byte[offset]; os.getBytes(0, result, 0, offset); return result; } catch (Exception e) { throw e; } finally { ChannelBufferPool.returnObject(os); } } public static final void toBytes(ChannelBuffer os, Map o) throws Exception { N3B2OutputStream.writeObject(os, o); } public static final NewMap toMap(ChannelBuffer is) throws Exception { NewMap v = (NewMap) N3B2InputStream.readObject(is); return v; } public static final NewMap toNewMapNoExcept(final ChannelBuffer buf){ NewMap ret = null; try { ret = toNewMap(buf); } catch (Exception e) { } return ret = (ret == null) ? new NewMap() : ret; } public static final NewMap toNewMap(final ChannelBuffer buf) throws Exception { NewMap v = N3B2InputStream.readNewMap(buf); return v; } // //////////////////// public static final byte[] toBytes(List o) throws Exception { ChannelBuffer os = ChannelBufferPool.borrowObject(); try { toBytes(os, o); int offset = os.writerIndex(); byte[] result = new byte[offset]; os.getBytes(0, result, 0, offset); return result; } catch (Exception e) { throw e; } finally { ChannelBufferPool.returnObject(os); } } public static final void toBytes(ChannelBuffer os, List o) throws Exception { N3B2OutputStream.writeObject(os, o); } public static final NewList toList(ChannelBuffer is) throws Exception { NewList v = (NewList) N3B2InputStream.readObject(is); return v; } }
package com.ybg.weixin.util; import java.util.Random; public class Access_Code_Factory { public static String getCode() { String str = "0,1,2,3,4,5,6,7,8,9"; String str2[] = str.split(",");// 将字符串以,分割 Random rand = new Random();// 创建Random类的对象rand int index = 0; String randStr = "";// 创建内容为空字符串对象randStr randStr = "";// 清空字符串对象randStr中的值 for (int i = 0; i < 6; ++i) { index = rand.nextInt(str2.length - 1);// 在0到str2.length-1生成一个伪随机数赋值给index randStr += str2[index];// 将对应索引的数组与randStr的变量值相连接 } return randStr.trim(); } }
import java.util.*; public class PhoneBook { private Map<String, Set<String>> contacts = new HashMap<>(); public void initializePhoneBook() { addContact("Рутковский", "9104395592"); addContact("Рутковский", "0679481774"); addContact("Букреева","9453109133"); addContact("Петренко", "0931114098"); addContact("Сокольский", "3105520023"); addContact("Букреева", "8883124467"); } public void addContact(String name, String number) { if (contacts.containsKey(name)) { contacts.get(name).add(number); } else { Set<String> numbers = new HashSet<>(); numbers.add(number); contacts.put(name, numbers); } } public void showContacts() { System.out.println(contacts); } public Set<String> getContact(String name) { if (contacts.containsKey(name)) { return contacts.get(name); } else return new HashSet<>(); } }
package couchbase.sample.util; import java.util.Hashtable; import couchbase.sample.exception.ArgException; public class ArgumentReader { public static Hashtable<String, String>getArguments(String[] args) throws ArgException{ Hashtable<String, String> argsTable = new Hashtable<String, String>(); if(args!=null && args.length>0){ int len = args.length; //System.out.println("Number of arguments: " + len); if(len%2==0){ //loop to half the times of args length as it is name/value pair for(int i=0;i<len/2;i++){ //add arguments and its value in the argsTable argsTable.put(args[2*i], args[2*i+1]); //System.out.println(argsTable); }//EOF if }else{ throw new ArgException("Some argument missing the value. Please check the arguments."); } }else{ throw new ArgException("You must provide # of threads & # of docs to write."); } return argsTable; } }
package kr.ds.handler; public class Content7CodeHandler { private String num; private boolean click; public String getNum() { return num; } public void setNum(String num) { this.num = num; } public boolean isClick() { return click; } public void setClick(boolean click) { this.click = click; } }
package Overloading; public class Sum { // They all have the same name but different parameter inputs. public int add(int a, int b) { return a + b; } public int add(int a, int b, int c) { return a + b + c; } public int add(int a, int b, int c, int d) { return a + b + c + d; } public int add(int a, int b, int c, int d, int e) { return a + b + c + d + e; } }
package com.vwaber.udacity.popularmovies.data; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.vwaber.udacity.popularmovies.data.FavoritesContract.FavoritesEntry; class FavoritesDbHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "favorites.db"; private static final int DATABASE_VERSION = 2; FavoritesDbHelper(Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { final String SQL_CREATE_WEATHER_TABLE = "CREATE TABLE " + FavoritesEntry.TABLE_NAME + " (" + FavoritesEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + FavoritesEntry.COLUMN_DATE + " DATETIME DEFAULT CURRENT_TIMESTAMP, " + FavoritesEntry.COLUMN_TMDB_ID + " INTEGER NOT NULL UNIQUE);"; sqLiteDatabase.execSQL(SQL_CREATE_WEATHER_TABLE); } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) { sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + FavoritesEntry.TABLE_NAME); onCreate(sqLiteDatabase); } }
package battle; public class opponents { //maxhp,hp,att,speed public int [] mouse = {30, 30, 10, 100}; public int [] cat = {60, 60, 30, 50}; public int [] dog = {100,100,50, 30}; public int getMaxHp(int x) { if (x == 0) return mouse[0]; else if (x == 1) return cat[0]; else return dog[0]; } public int getHp(int x) { if (x == 0) return mouse[1]; else if (x == 1) return cat[1]; else return dog[1]; } public int getAttack(int x) { if (x == 0) return mouse[2]; else if (x == 1) return cat[2]; else return dog[2]; } public int getspeed(int x) { if (x == 0) return mouse[3]; else if (x == 1) return cat[3]; else return dog[3]; } public String getEnemy(int x) { if (x == 0) return "Mouse"; else if (x == 1) return "Cat"; else return "Dog"; } }
package com.tfjybj.integral.utils.exception; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import java.io.PrintWriter; import java.io.StringWriter; @ControllerAdvice public class ExceptionAdvice { protected static Logger logger = LoggerFactory.getLogger(ExceptionUtil.class); @ExceptionHandler({Exception.class}) @ResponseBody public ResultUtil handleApplicationException(Exception e) { ResultUtil resultUtil; if (e instanceof ApplicationException) { ApplicationException girlException = (ApplicationException) e; resultUtil = new ResultUtil(girlException.getCode(), girlException.getMessage()); if (StringUtils.isEmpty(girlException.getCode())) { resultUtil.setCode("500"); } return resultUtil; } logger.info(getStackTrace(e)); return new ResultUtil("500", "未知异常,请联系管理员!"); } public static String getStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { throwable.printStackTrace(pw); return sw.toString(); } finally { pw.close(); } } }
package test.com.milano.bc; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; import java.sql.SQLException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import com.milano.bc.DocenteBC; import com.milano.bc.model.Docente; class DocenteBCTest { private static DocenteBC docenteBC; @BeforeAll static void setUpBeforeClass() throws Exception { docenteBC = new DocenteBC(); } @Test void testGetAmministratori() { try { Docente[] docenti = docenteBC.getDocenti(); assertNotNull(docenti); } catch (SQLException exc) { exc.printStackTrace(); fail(exc.getMessage()); } } @AfterEach void tearDown() throws Exception { docenteBC = null; } }
package com.tencent.mm.ui.chatting.view; import android.view.View; import android.view.View.OnClickListener; class b$4 implements OnClickListener { final /* synthetic */ b tZe; b$4(b bVar) { this.tZe = bVar; } public final void onClick(View view) { if (this.tZe.tZc != null) { this.tZe.tZc.onCancel(); } } }
// Sun Certified Java Programmer // Chapter 6, P455 // Strings, I/O, Formatting, and Parsing import java.io.*; class Tester455 { public static void main(String[] args) { File existingDir = new File("existingDir"); // assign a dir System.out.println(existingDir.Directory()); File existingDirFile = new File( existingDir, "existingDirFile.txt"); // assign a file System.out.println(existingDirFile.isFile()); FileReader fr = new FileReader(existingDirFile); BufferedReader br = new BufferedReader(fr); // make a Reader String s; while ((s = br.readLine()) != null) // read data System.out.println(s); br.close(); } }
/* * 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 laptinhmang; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author dangn */ public class IOS { //private ArrayList<LichSu> listLS; private String file = "lichsu.txt"; public IOS() { } public ArrayList<LichSu> readList(){ ArrayList<LichSu> listLS = new ArrayList<>(); try { FileInputStream fis = new FileInputStream(new File(file)); ObjectInputStream ois = new ObjectInputStream(fis); listLS = (ArrayList<LichSu>) ois.readObject(); ois.close(); fis.close(); } catch (FileNotFoundException ex) { } catch (IOException ex) { } catch (ClassNotFoundException ex) { } return listLS; } public void writeList(ArrayList<LichSu> listLS){ try { FileOutputStream fos = new FileOutputStream(new File(file)); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(listLS); oos.close(); fos.close(); } catch (FileNotFoundException ex) { } catch (IOException ex) { } } }
package com.sk.anna.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.sk.anna.dao.IEmployeeDao; import com.sk.anna.model.Employee; import com.sk.anna.service.IEmployeeService; @Service public class EmployeeServiceImpl implements IEmployeeService { @Autowired IEmployeeDao dao; @Override @Transactional public Integer saveEmployee(Employee emp) { //CALCULATIONS double sal=emp.getEmpSal(); emp.setEmpHra(sal * 25/100.0); emp.setEmpTa(sal * 12/100.0); return dao.saveEmployee(emp); } @Override @Transactional public List<Employee> getAllEmployees() { List<Employee> list= dao.getAllEmployees(); return list; } @Override @Transactional public void deleteEmployee(Integer id) { dao.deleteEmployee(id); } @Override @Transactional public void updateEmployee(Employee emp) { double sal = emp.getEmpSal(); emp.setEmpHra(sal * 25/100.0); emp.setEmpTa(sal * 12/100.0); dao.updateEmployee(emp); } @Override @Transactional public Employee getOneEmployee(Integer id) { Employee emp=dao.getOneEmployee(id); return emp; } @Override @Transactional(readOnly = true) public long getEmpnameCount(String empName) { return dao.getEmpnameCount(empName); } }
package java2.businesslogic.announcementcreation; import java2.businesslogic.ValidationError; import java2.businesslogic.ServiceResponse; import java2.domain.Announcement; import java2.database.AnnouncementDatabase; import java2.domain.User; import java2.database.UserDatabase; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; import java.util.Optional; //@Component public class AddAnnouncementService { @Autowired private AnnouncementDatabase announcementDatabase; @Autowired private UserDatabase userDatabase; @Autowired private AddAnnouncementValidator addAnnouncementValidator; public ServiceResponse addAnnouncement(String login, String title, String description) { List<ValidationError> validationErrors = addAnnouncementValidator.validate(login, title, description); if(!validationErrors.isEmpty()) { return new ServiceResponse(false, validationErrors); } else { Optional<User> userFound = userDatabase.findByLogin(login); User user = userFound.get(); Announcement newAnnouncement = new Announcement(); newAnnouncement.setCreator(user); newAnnouncement.setTitle(title); newAnnouncement.setDescription(description); announcementDatabase.add(newAnnouncement); return new ServiceResponse(true, null); } } }