text
stringlengths
10
2.72M
package org.hieu.facade; /** * @author hieu * * Facade pattern hides the complexities of the system and provides an interface to the client using which the client can access the system. This type of design pattern comes under structural pattern as this pattern adds an interface to exiting system to hide its complexities. This pattern involves a single class which provides simplified methods which are required by client and delegates calls to existing system classes methods. We're going to create a Shape interface and concrete classes implementing the Shape interface. A facade class ShapeMaker is defined as a next step. ShapeMaker class uses the concrete classes to delegates user calls to these classes.FacadePatternDemo, our demo class will use ShapeMaker class to show the results. * */ public class FacadePatternDemo { public static void main(String[] args) { ShapeMaker shapeMaker = new ShapeMaker(); shapeMaker.drawCircle(); shapeMaker.drawRectangle(); shapeMaker.drawSquare(); } }
package com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.builder; import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.ArbeitsvorgangTypType; import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.PROBENIstdatenType; import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.ProbeListeType; import java.io.StringWriter; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; public class PROBENIstdatenTypeBuilder { public static String marshal(PROBENIstdatenType pROBENIstdatenType) throws JAXBException { JAXBElement<PROBENIstdatenType> jaxbElement = new JAXBElement<>(new QName("TESTING"), PROBENIstdatenType.class , pROBENIstdatenType); StringWriter stringWriter = new StringWriter(); return stringWriter.toString(); } private ProbeListeType probeListe; private ArbeitsvorgangTypType arbeitsvorgang; private String aggregat; private XMLGregorianCalendar zeitpunktDurchsatz; public PROBENIstdatenTypeBuilder setProbeListe(ProbeListeType value) { this.probeListe = value; return this; } public PROBENIstdatenTypeBuilder setArbeitsvorgang(ArbeitsvorgangTypType value) { this.arbeitsvorgang = value; return this; } public PROBENIstdatenTypeBuilder setAggregat(String value) { this.aggregat = value; return this; } public PROBENIstdatenTypeBuilder setZeitpunktDurchsatz(XMLGregorianCalendar value) { this.zeitpunktDurchsatz = value; return this; } public PROBENIstdatenType build() { PROBENIstdatenType result = new PROBENIstdatenType(); result.setProbeListe(probeListe); result.setArbeitsvorgang(arbeitsvorgang); result.setAggregat(aggregat); result.setZeitpunktDurchsatz(zeitpunktDurchsatz); return result; } }
package FacebookConnector; import java.util.List; /** * The interface provides the necessary methods for communicating with the EWA_SS11 FB wall * @author pl * */ public interface FacebookConnector { /** * Get a list with all highscore results from the FB wall * @return List of score elements * @throws Exception An exception is thrown if the connection to FB failed */ public List<Score> getHighScoreList() throws Exception; /** * Publish a highscore result to the FB wall * @param score The score element to be published on the FB wall * @return The rank of the score in the highscorelist on the FB wall * @throws Exception An exception is thrown if the connection to FB failed */ public Integer publishHighScoreResult(Score score) throws Exception; /** * Returns the access token of the FB connector * @return Access token */ public String getAccessToken(); }
package de.marko.pentest; import de.marko.pentest.rest.handler.CreateUserHandler; import de.marko.pentest.rest.handler.GetTokenHandlerV1; import de.marko.pentest.rest.handler.GetTokenHandlerV2; import de.marko.pentest.rest.handler.GetTokenHandlerV3; import de.marko.pentest.rest.handler.GetTokenHandlerV4; import de.marko.pentest.rest.handler.GetTokenHandlerV5; import de.marko.pentest.rest.handler.JacksonHandler; import de.marko.pentest.rest.handler.VertxJsonHandler; import io.vertx.core.AbstractVerticle; import io.vertx.core.Vertx; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServer; import io.vertx.ext.web.Router; import io.vertx.ext.web.handler.BodyHandler; import io.vertx.ext.web.handler.CookieHandler; import io.vertx.ext.web.handler.SessionHandler; import io.vertx.ext.web.sstore.LocalSessionStore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author marko * @version 1.0.0. * @date 19.08.2017 */ public class HttpAPIServer extends AbstractVerticle { private final static Logger LOGGER = LoggerFactory.getLogger(HttpAPIServer.class); private Vertx vertx; private static final HttpAPIServer instance = new HttpAPIServer(); private HttpAPIServer() { this.vertx = Vertx.vertx(); this.vertx.deployVerticle(this); } public static HttpAPIServer getInstance() { return instance; } @Override public void start() throws Exception { // Create Server HttpServer server = vertx.createHttpServer(); // Create Router to handle paths Router router = Router.router(this.vertx); // enable body handler router.route().handler(BodyHandler.create()); // enable session router.route().handler(CookieHandler.create()); router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx))); // POST /api/jackson router.post("/api/jackson").consumes("*/json").handler(new JacksonHandler()); // POST /api/vertx router.post("/api/vertx").consumes("*/json").handler(new VertxJsonHandler()); router.post("/api/user/create") .method(HttpMethod.POST) .handler(new CreateUserHandler()); router.post("/api/v1/user/gettoken") .method(HttpMethod.POST) .handler(new GetTokenHandlerV1()); router.post("/api/v2/user/gettoken") .method(HttpMethod.POST) .handler(new GetTokenHandlerV2()); router.post("/api/v3/user/gettoken") .method(HttpMethod.POST) .handler(new GetTokenHandlerV3()); router.post("/api/v4/user/gettoken") .method(HttpMethod.POST) .handler(new GetTokenHandlerV4()); router.post("/api/v5/user/gettoken") .method(HttpMethod.POST) .handler(new GetTokenHandlerV5()); // Start server and listen to port 8443 server.requestHandler(router::accept).listen(8443, res -> { if (res.succeeded()) { LOGGER.info("Server is now listening."); } else { LOGGER.info("Failed to bind!"); } }); } @Override public void stop() throws Exception { } public void close() { this.vertx.close(); } public Vertx vertx() { return this.vertx; } }
package rt.intersectables; import java.util.ArrayList; import javax.vecmath.Vector3f; import rt.BoundingBox; import rt.HitRecord; import rt.Material; import rt.Ray; /** * A sphere that can be used in CSG bodies * * @author Florian */ public class CSGSphere extends CSGSolid { Vector3f position; float radius; BoundingBox bound; public Material material; /** * Constructs a sphere with given radius and position * * @param position * @param radius */ public CSGSphere(Vector3f position, float radius) { this.position = position; this.radius = radius; bound = new BoundingBox(position, radius); } /** * Constructs a sphere with radius 1 at the point (0,0,0) */ public CSGSphere() { position = new Vector3f(0,0,0); radius = 1; bound = new BoundingBox(-1,1,-1,1,-1,1); } /** * Constructs a sphere with given radius, position and material * * @param position * @param radius * @param material */ public CSGSphere(Vector3f position, float radius, Material material) { this.position = position; this.radius = radius; this.material = material; bound = new BoundingBox(position, radius); } @Override ArrayList<IntervalBoundary> getIntervalBoundaries(Ray r) { ArrayList<IntervalBoundary> bounds = new ArrayList<IntervalBoundary>(2); IntervalBoundary b1, b2; b1 = new IntervalBoundary(); b2 = new IntervalBoundary(); float a, b, c, det; a = r.direction.x*r.direction.x + r.direction.y*r.direction.y + r.direction.z*r.direction.z; b = 2 * (r.direction.x * (r.origin.x - position.x) + r.direction.y * (r.origin.y - position.y) + r.direction.z * (r.origin.z - position.z)); c = (r.origin.x - position.x)*(r.origin.x - position.x) + (r.origin.y - position.y)*(r.origin.y - position.y) + (r.origin.z - position.z)*(r.origin.z - position.z) - radius*radius; det = b*b - 4*a*c; if(!(det > 0)) // no intersection (case det = 0 included) { return bounds; } det = (float) Math.sqrt(det); float t1 = (-b - det)/2/a; float t2 = (-b + det)/2/a; b1.hitRecord = createHitRecord(r, t1); b1.type = BoundaryType.START; b1.t = t1; b2.hitRecord = createHitRecord(r, t1); b2.type = BoundaryType.END; b2.t = t2; bounds.add(b1); bounds.add(b2); return bounds; } private HitRecord createHitRecord(Ray r, float t) { HitRecord hr = new HitRecord(); hr.intersectable = this; hr.material = material; hr.w = new Vector3f(r.direction); hr.w.negate(); hr.w.normalize(); hr.t = t; hr.position = new Vector3f(r.origin.x + r.direction.x*hr.t, r.origin.y + r.direction.y*hr.t, r.origin.z + r.direction.z*hr.t); hr.normal = new Vector3f(hr.position); hr.normal.sub(position); hr.normal.scale(1.f/radius); hr.t2 = new Vector3f(0,1,0); hr.t2.cross(hr.t2, hr.normal); hr.t2.normalize(); hr.t1 = new Vector3f(); hr.t1.cross(hr.normal, hr.t2); hr.t1.normalize(); return hr; } @Override public BoundingBox getBoundingBox() { return bound; } }
package 프로젝트day03; public class 기본데이터 { public static void main(String[] args) { int a, b, c; int classNo = 8; double temp = 26.2; char day = '목'; boolean food = false; String lunch = "1층 가서 생각해보자"; //한 줄 복사 : 컨트롤 + 알트 + 화살표 아래 //한 줄 이동 : 알트 + 화살표 System.out.println("오늘 온도 " + temp + "도"); System.out.println("오늘 수업 수 " + classNo); System.out.println("오늘 요일 " + day); System.out.println("아침 먹었나 " + food); System.out.println("점심 뭐먹지 " + lunch); System.out.println(temp == 27.5); System.out.println(temp > 27.5); // 오늘 온도 29.2로 변경하여, 어제의 온도보다 낮은지? temp = 29.2; System.out.println(temp > 27.5); } }
// Given an array nums[] of size n, construct a Product Array P // (of same size n) such that P[i] is equal to the product of // all the elements of nums except nums[i]. // Watch TECH DOSE video package searching; import java.util.Arrays; public class ProductArrayPuzzle { public static void main(String[] args) { int arr[] = { 10, 3, 5, 6, 2 }; int res[] = productArray(arr, arr.length); System.out.println(Arrays.toString(res)); } static int[] productArray(int arr[], int n) { int res[] = new int[n]; int product = 1; for (int i = 0; i < n; i++) { product *= arr[i]; res[i] = product; } product = 1; for (int i = n - 1; i > 0; i--) { res[i] = res[i - 1] * product; product *= arr[i]; } res[0] = product; return res; } }
/* * 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 it.unive.dagg.observers; import it.unive.interfaces.Effect; import it.unive.interfaces.StackListener; import java.util.ArrayList; public class StackObserver implements it.unive.interfaces.StackObserver { private ArrayList<StackListener> alsl; public StackObserver(){ this.alsl = new ArrayList<>(); } @Override public void casted(Effect e) { for(StackListener sl : alsl) sl.onEffectCasted(e); } @Override public void updateStackListener(StackListener deprecated, StackListener updated) { alsl.remove(deprecated); alsl.add(updated); } @Override public void addStackListener(StackListener sl) { alsl.add(sl); } @Override public void removeStackListener(StackListener sl) { alsl.remove(sl); } }
/* * FileName: PowerInfo.java * Description: 编辑权限信息时使用的值对象 * Company: 南宁超创信息工程有限公司 * Copyright: ChaoChuang (c) 2004 * History: 2004-12-19 (Qsj) 1.0 Create */ package com.spower.basesystem.manage.command; import java.util.LinkedHashMap; import java.util.Map; import com.spower.basesystem.common.Constants; /** * The <code>PowerInfo</code> class 编辑权限信息时使用的值对象. * * @author Qsj * @version 1.0, 2004-12-19 */ public class PowerInfo { /** 权限编号. */ private Long id; /** 权限名称. */ private String name; /** 操作类型. */ private String opType = Constants.OPERATE_INSERT; /** 权限功能的url. */ private String url; /** 权限图标的url. */ private String imgUrl; /** 权限所属的模块名称. */ private String moduleName; /** 权限编码. */ private String code; /** 权限类型标识. */ private String typeFlag; /** Tab编码. */ private String navTabId; /** * @return Returns the id. */ public Long getId() { return this.id; } /** * @param id The id to set. */ public void setId(Long id) { this.id = id; } /** * @return Returns the name. */ public String getName() { return this.name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the opType. */ public String getOpType() { return this.opType; } /** * @param opType The opType to set. */ public void setOpType(String opType) { this.opType = opType; } /** * @return Returns the url. */ public String getUrl() { return url; } /** * @param url The url to set. */ public void setUrl(String url) { this.url = url; } /** * @return Returns the imgUrl. */ public String getImgUrl() { return imgUrl; } /** * @param imgUrl The imgUrl to set. */ public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } /** * @return Returns the moduleName. */ public String getModuleName() { return moduleName; } /** * @param moduleName The moduleName to set. */ public void setModuleName(String moduleName) { this.moduleName = moduleName; } /** * @return Returns the powerTypeFlag. */ public String getTypeFlag() { return typeFlag; } /** * @param powerTypeFlag The powerTypeFlag to set. */ public void setTypeFlag(String powerTypeFlag) { this.typeFlag = powerTypeFlag; } public String getNavTabId() { return navTabId; } public void setNavTabId(String navTabId) { this.navTabId = navTabId; } public Map getTypeFlagMap() { Map map = new LinkedHashMap(); map.put("1", "需授权使用"); map.put("2", "公用权限"); return map; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
package com.yuorfei.dao; import com.yuorfei.bean.Article; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.PreparedStatementCreator; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import java.sql.*; import java.util.List; /** * 文章dao * Created by hxy on 2015/9/12. */ @Repository public class ArticleDao { private static final Log log = LogFactory.getLog(ArticleDao.class); @Autowired private JdbcTemplate jdbcTemplate; private class ArticleRowMapper implements RowMapper<Article> { public Article mapRow(ResultSet rs, int rowNum) throws SQLException { Article article = new Article(); article.setId(rs.getInt("id")); article.setContent(rs.getString("content")); article.setFormat_content(rs.getString("format_content")); article.setCreate_time(rs.getTimestamp("create_time")); article.setUpdate_time(rs.getTimestamp("update_time")); article.setVisible(rs.getByte("visible")); article.setTitle(rs.getString("title")); article.setKeyword(rs.getString("keyword")); article.setLabel(rs.getString("label")); return article; } } /** * 增加 * @param article ariticle对象 * @return 主键long */ @CacheEvict(value="Article", allEntries=true) public long add(final Article article){ KeyHolder keyHolder = new GeneratedKeyHolder(); final String sql = " insert into "+Article.TableName()+" (content,create_time,format_content,update_time,visible,title,keyword,label ) values(?,?,?,?,?,?,?,?) "; log.info(sql); jdbcTemplate.update(new PreparedStatementCreator() { public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); ps.setString(1, article.getContent()); ps.setTimestamp(2, article.getCreate_time()); ps.setString(3, article.getFormat_content()); ps.setTimestamp(4, article.getUpdate_time()); ps.setByte(5, article.getVisible()); ps.setString(6,article.getTitle()); ps.setString(7,article.getKeyword()); ps.setString(8,article.getLabel()); return ps; } },keyHolder); return keyHolder.getKey().longValue(); } /** * 根据id来删除article对象 * @param articleId 文章对象id * @return boolean */ @CacheEvict(value="Article", allEntries=true) public boolean delete(long articleId){ final String sql = " delete from " + Article.TableName() + " where id=? "; log.info(sql); int result = jdbcTemplate.update(sql,articleId); return result > 0; } /** * 根据id来获取article对象 * @param articleId article的id * @return article */ @Cacheable(value="Article",key="'find'+#articleId") public Article find(long articleId) { final String sql = " select * from "+ Article.TableName() + " where id=? "; log.info(sql); try{ return jdbcTemplate.queryForObject(sql, new ArticleRowMapper(), articleId); }catch(EmptyResultDataAccessException e){ log.error(e.getMessage()); return null; } } /** * 查找最新的文章的id * @return long */ @Cacheable(value="Article",key="'findRecentArticleId'") public long findRecentArticleId(){ final String sql = " select max(id) from "+ Article.TableName() ; log.info(sql); try{ return jdbcTemplate.queryForObject(sql,Long.class); }catch(Exception e){ log.error(e.getMessage()); return 0; } } /** * 更新 * @param article 文章对象 * @return long 受影响的列 */ @CacheEvict(value="Article", allEntries=true) public long update(Article article){ final String sql = " update "+Article.TableName()+" set content=?,create_time=?,format_content=?,update_time=?,visible=?,title=?,keyword=?,label=? where id=? "; log.info(sql); return jdbcTemplate.update( sql, article.getContent(), article.getCreate_time(), article.getFormat_content(), article.getUpdate_time(), article.getVisible(), article.getTitle(), article.getKeyword(), article.getLabel(), article.getId() ); } /** * 统计所有的文章数 * @return long */ @Cacheable(value = "Article",key="'count'") public long count(){ final String sql = " select count(id) from "+ Article.TableName(); log.info(sql); return jdbcTemplate.queryForObject(sql,Long.class); } /** * 分页列出文章 * @param pageIndex 页码 * @param pageSize 页数 * @return list */ @Cacheable(value = "Article",key="'listByPage'+#pageIndex+#pageSize") public List<Article> listByPage(int pageIndex,int pageSize){ final String sql = " select * from "+Article.TableName()+ " order by create_time desc limit ?,? "; log.info(sql); return jdbcTemplate.query(sql,new ArticleRowMapper(),(pageIndex-1)*pageSize,pageSize); } }
package com.smxknife.java2.lambda; import java.util.stream.Stream; /** * @author smxknife * 2018-12-24 */ public class IteratorDemo { public static void main(String[] args) { Stream.iterate(0, idx -> idx + 1).limit(4).forEach(System.out::println); } }
package ai; import state.*; import java.util.*; import game.TextOutput; import graph.*; public class RandomAI extends AI { @Override public Move getMove(int playerId) { int currentLocation = aiReadable.getNodeId(playerId); TextOutput.printDebug(String.format("In AI: player id %d location %d\n", playerId, currentLocation)); List<Move> possibleMoves = getPossibleMoves(currentLocation, playerId); int numberOfMoves = possibleMoves.size(); // get a random move int choice = (int) (Math.random() * numberOfMoves); Move chosenMove = possibleMoves.get(choice); return chosenMove; } private List<Move> getPossibleMoves(int currentLocation, int playerId) { List<Move> possibleMoves = new ArrayList<Move>(); String locationName = Integer.toString(currentLocation); List<Edge> edges = aiReadable.getGraph().edges(locationName); for(Edge e: edges) { int connectingNode = Integer.parseInt(e.connectedTo(locationName)); Move move = new Move(convertEdgeTypeToTicketType(e.type()), connectingNode); possibleMoves.add(move); if(aiReadable.getNumberOfTickets(Initialisable.TicketType.SecretMove, playerId) > 0) { Move anotherMove = new Move(Initialisable.TicketType.SecretMove, connectingNode); possibleMoves.add(anotherMove); } } // if player has double or secret moves... if(aiReadable.getNumberOfTickets(Initialisable.TicketType.DoubleMove, playerId) > 0) { possibleMoves.add(new Move(Initialisable.TicketType.DoubleMove, currentLocation)); } return possibleMoves; } }
package br.com.alura.gerenciador.servlet; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet Filter implementation class AutorizacaoFilter */ //@WebFilter("/entrada") public class AutorizacaoFilter implements Filter { private static final String USUARIO_LOGADO = "usuarioLogado"; private static final String LOGIN = "Login"; private static final String LOGIN_FORM = "LoginForm"; private static final String ACAO = "acao"; /** * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { System.out.println("AutorizacaoFilter"); HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String paramAcao = request.getParameter(ACAO); HttpSession sessao = request.getSession(); boolean usuarioNaoEstaLogado = sessao.getAttribute(USUARIO_LOGADO) == null; boolean ehUmaAcaoProtegida = !(paramAcao.equals(LOGIN) || paramAcao.equals(LOGIN_FORM)); if (ehUmaAcaoProtegida && usuarioNaoEstaLogado) { response.sendRedirect("entrada?acao=LoginForm"); return; } chain.doFilter(request, response); } }
package com.ibm.ive.tools.japt.inline; import com.ibm.jikesbt.*; import com.ibm.ive.tools.japt.*; import java.util.*; /** * @author sfoley * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class InlineRepository { private HashMap methods = new HashMap(); private boolean assumeUnknownVirtualTargets; private boolean inlineFromAnywhere; JaptRepository rep; InlineRepository( JaptRepository rep, boolean assumeUnknownVirtualTargets, boolean inlineFromAnywhere) { this.assumeUnknownVirtualTargets = assumeUnknownVirtualTargets; this.inlineFromAnywhere = inlineFromAnywhere; this.rep = rep; } Method getMethod(BT_Method method) { Method result = (Method) methods.get(method); if(result == null) { if(method.isStatic()) { result = new StaticMethod(method, this, inlineFromAnywhere); } else { result = new InstanceMethod(method, this, assumeUnknownVirtualTargets, inlineFromAnywhere); } methods.put(method, result); } return result; } Iterator iterator() { return methods.values().iterator(); } }
package com.ss.lms.controller; import java.sql.SQLException; import java.util.List; import java.util.stream.IntStream; import com.ss.lms.entity.Author; import com.ss.lms.service.AdministratorService; import com.ss.lms.util.ScannerUtil; public class AuthorCrudController implements IController { private enum State { MENU, CREATE, READ, UPDATE, DELETE, EXIT } private State state; private boolean isRunning; public void init() { state = State.MENU; isRunning = true; } public void run() { try { while (isRunning) { switch (state) { case MENU: menu(); break; case CREATE: create(); break; case READ: read(); break; case UPDATE: update(); break; case DELETE: delete(); break; case EXIT: isRunning = false; break; } } } catch (Exception e) { e.printStackTrace(); } } public void menu() { System.out.println("Choose an operation: "); System.out.println("\t1) Create author"); System.out.println("\t2) Read author list"); System.out.println("\t3) Update author"); System.out.println("\t4) Delete author"); System.out.println("\t5) Return to previous menu"); boolean isSelected = false; while (!isSelected) { int selection = ScannerUtil.loopForInt(); switch (selection) { case 1: state = State.CREATE; isSelected = true; break; case 2: state = State.READ; isSelected = true; break; case 3: state = State.UPDATE; isSelected = true; break; case 4: state = State.DELETE; isSelected = true; break; case 5: state = State.EXIT; isSelected = true; break; default: System.out.println("Invalid selection. Please try again."); break; } } } public void create() throws SQLException { Author author = new Author(); System.out.println("Enter author name:"); author.setName(ScannerUtil.loopForString()); System.out.println(new StringBuilder("Are you sure you want to create author with name: ") .append(author.getName()).append("? (y/n)")); boolean isSelected = false; while (!isSelected) { String confirmation = ScannerUtil.loopForString().toLowerCase(); switch (confirmation) { case "y": AdministratorService.getInstance().createAuthor(author); System.out.println("Author has been created."); this.state = State.MENU; isSelected = true; break; case "n": System.out.println("Author has not been created."); this.state = State.MENU; isSelected = true; break; default: System.out.println("Invalid selection. Please try again."); break; } } } public void read() throws SQLException { List<Author> authorList = AdministratorService.getInstance().readAuthors(); if (authorList.isEmpty()) { System.out.println("Author list is empty."); } else { authorList.stream().forEach(i -> System.out.println(i.getName())); } state = State.MENU; } public void update() throws SQLException { Author author = new Author(); System.out.println("Choose author:"); List<Author> authorList = AdministratorService.getInstance().readAuthors(); IntStream.range(0, authorList.size()).forEach(i -> System.out .println(new StringBuilder("\t").append(i + 1).append(") ").append(authorList.get(i).getName()))); System.out.println(new StringBuilder("\t").append(authorList.size() + 1).append(") Return to previous menu")); boolean isValid = false; while (!isValid) { int selection = ScannerUtil.loopForInt(); if (selection < 1 || selection > authorList.size() + 1) { System.out.println("Invalid selection. Please try again"); } else if (selection == authorList.size() + 1) { this.state = State.MENU; return; } else { author.setId(authorList.get(selection - 1).getId()); isValid = true; } } System.out.println("Enter new author name:"); author.setName(ScannerUtil.loopForString()); AdministratorService.getInstance().updateAuthor(author); System.out.println("Author has been updated."); this.state = State.MENU; } public void delete() throws SQLException { int id = 0; System.out.println("Choose author:"); List<Author> authorList = AdministratorService.getInstance().readAuthors(); IntStream.range(0, authorList.size()).forEach(i -> System.out .println(new StringBuilder("\t").append(i + 1).append(") ").append(authorList.get(i).getName()))); System.out.println(new StringBuilder("\t").append(authorList.size() + 1).append(") Return to previous menu")); boolean isValid = false; while (!isValid) { int selection = ScannerUtil.loopForInt(); if (selection < 1 || selection > authorList.size() + 1) { System.out.println("Invalid selection. Please try again"); } else if (selection == authorList.size() + 1) { this.state = State.MENU; return; } else { id = authorList.get(selection - 1).getId(); isValid = true; } } AdministratorService.getInstance().deleteAuthor(id); System.out.println("Author has been deleted."); this.state = State.MENU; } }
package com.zhowin.base_library.qiniu; import android.text.TextUtils; import com.zhowin.base_library.utils.ConstantValue; import com.zhowin.base_library.utils.GsonUtils; import com.zhowin.base_library.utils.SPUtils; /** * 七牛云的信息 */ public class QiNiuYunBean { /** * token : H7CC2KfaoBnDnzbpzzzvf7zjvawC9B9X1ZKZKHtS:bHoUTycrxXOTJoBn-tkSY8kLWIA=:eyJzY29wZSI6ImFudC12b2ljZSIsImRlYWRsaW5lIjoxNTk5NTMxODQ5fQ== * prefix : null * address : http://qfah2px93.hn-bkt.clouddn.com/ */ private String token; private String prefix; private String address; public static void setQiNiuInfo(QiNiuYunBean data) { String userInfo = GsonUtils.toJson(data); SPUtils.set(ConstantValue.QI_NIU_INFO, userInfo); setQiNiuToken(data.getToken()); } public static QiNiuYunBean getQiNiuInfo() { QiNiuYunBean qiNiuYunBean = GsonUtils.fromJson(SPUtils.getString(ConstantValue.QI_NIU_INFO), QiNiuYunBean.class); if (qiNiuYunBean != null) { return qiNiuYunBean; } else { return new QiNiuYunBean(); } } /** * 设置token */ public static void setQiNiuToken(String token) { if (!TextUtils.isEmpty(token)) { SPUtils.set(ConstantValue.QI_NIU_TOKEN, token); } else { SPUtils.set(ConstantValue.QI_NIU_TOKEN, ""); } } /** * 获取token */ public static String getQiNiuToken() { return (String) SPUtils.get(ConstantValue.QI_NIU_TOKEN, ""); } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
package com.hesoyam.pharmacy.medicine.service; import com.hesoyam.pharmacy.medicine.model.Contraindication; import java.util.List; public interface IContraindicationService { List<Contraindication> getAll(); }
package cs213.photoAlbum.util; import javax.swing.DefaultComboBoxModel; /** * The Class DefaultComboBoxModelAction. * @author Truong Pham */ public class DefaultComboBoxModelAction { /** * New combo box. * * @param model the model * @param date the date */ public void newComboBox(DefaultComboBoxModel<String> model, int[] date) { model.addElement(""); for(int i = 0; i < date.length; i++) { model.addElement(Integer.toString(date[i])); } } /** * Sets the year combo box. * * @param model the model * @param max the max * @param min the min */ public void setYearComboBox(DefaultComboBoxModel<String> model, int max, int min) { model.removeAllElements(); model.addElement(""); for(int i = min; i <= max; i++) { model.addElement(Integer.toString(i)); } } /** * Sets the hour combo box. * * @param model the new hour combo box */ public void setHourComboBox(DefaultComboBoxModel<String> model) { model.addElement(""); for(int i = 0; i < 24; i++) { model.addElement(Integer.toString(i)); } } /** * Sets the minute_ seconds combo box. * * @param model the model * @param model2 the model2 */ public void setMinute_SecondsComboBox(DefaultComboBoxModel<String> model, DefaultComboBoxModel<String> model2) { model.addElement(""); model2.addElement(""); for(int i = 0; i < 60; i++) { model.addElement(Integer.toString(i)); model2.addElement(Integer.toString(i)); } } }
package com.mineskies.limbo.listener; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.weather.WeatherChangeEvent; public class WorldListener implements Listener { @EventHandler public void onWeatherChange(WeatherChangeEvent event) { event.setCancelled(true); } @EventHandler public void onMobSpawn(CreatureSpawnEvent event) { event.setCancelled(event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM); } @EventHandler public void onPaintingBreak(EntityInteractEvent event) { event.setCancelled(true); } @EventHandler public void onLeafDecay(LeavesDecayEvent event) { event.setCancelled(true); } }
//package edu; import org.jbox2d.dynamics.*; import org.jbox2d.callbacks.ContactImpulse; import org.jbox2d.callbacks.ContactListener; import org.jbox2d.collision.Manifold; import org.jbox2d.dynamics.contacts.Contact; class LTouchings implements ContactListener { // This function is called when a new collision occurs public void beginContact(Contact cp) { // Get both fixtures Fixture f1 = cp.getFixtureA(); Fixture f2 = cp.getFixtureB(); // Get both bodies Body b1 = f1.getBody(); Body b2 = f2.getBody(); // Get our objects that reference these bodies Object o1 = b1.getUserData(); Object o2 = b2.getUserData(); if (o1==null || o2==null) return; // Touchings of if (o1.getClass() == LLeaf.class && o2.getClass() == LGround.class) DealLeafAndGround((LLeaf) o1, (LGround) o2); else if (o1.getClass() == LGround.class && o2.getClass() == LLeaf.class) DealLeafAndGround((LLeaf) o2, (LGround) o1); } public void endContact(Contact cp) { // Get both fixtures Fixture f1 = cp.getFixtureA(); Fixture f2 = cp.getFixtureB(); // Get both bodies Body b1 = f1.getBody(); Body b2 = f2.getBody(); // Get our objects that reference these bodies Object o1 = b1.getUserData(); Object o2 = b2.getUserData(); if (o1==null || o2==null || 1==1) return; // If object 1 is a Box, then object 2 must be a particle // Note we are ignoring particle on particle collisions if (o1.getClass() == LLeaf.class && o2.getClass() == LGround.class) { LLeaf leaf = (LLeaf)o1; //if(GTime > leaf.rotter) ; //leaf.ConstructGround = true; //else //leaf.tBeginRot = -1; } if (o2.getClass() == LLeaf.class && o1.getClass() == LGround.class) { LLeaf leaf = (LLeaf)o2; //if(GTime > leaf.tBeginRot + leaf.rotter) // leaf.ConstructGround = true; //else // leaf.tBeginRot = -1; } } void DealLeafAndGround(LLeaf Leaf, LGround Ground){ //if (Leaf.tBeginRot == -1) ; //Leaf.tBeginRot = GTime; //else } public void preSolve(Contact contact, Manifold oldManifold) { // TODO Auto-generated method stub } public void postSolve(Contact contact, ContactImpulse impulse) { // TODO Auto-generated method stub } }
package com.lc.exstreetseller.base; public class BaseFragment{ }
/* * Copyright (c) 2010-2011 by Bjoern Kolbeck, * Zuse Institute Berlin * * Licensed under the BSD License, see LICENSE file for details. * */ package org.xtreemfs.osd.rwre; import java.io.IOException; import java.util.List; import org.xtreemfs.common.uuids.ServiceUUID; import org.xtreemfs.osd.rwre.RWReplicationStage.Operation; import org.xtreemfs.pbrpc.generatedinterfaces.OSDServiceClient; /** * * @author bjko * * @deprecated In XtreemFS 1.3.0 the policy WaR1 was accidentally named WaRa. * * This will be fixed in 1.3.1 and therefore the unnecessary WaRa policy is marked as deprecated. * It is unnecessary because there is no sense to read from all replicas if the data is always written to all replicas. Instead, it suffices to read the local replica. */ public class WaRaUpdatePolicy extends CoordinatedReplicaUpdatePolicy { final int numResponses; public WaRaUpdatePolicy(List<ServiceUUID> remoteOSDUUIDs, String localUUID, String fileId, OSDServiceClient client) throws IOException { super(remoteOSDUUIDs, localUUID, fileId, client); this.numResponses = remoteOSDUUIDs.size(); } @Override protected int getNumRequiredAcks(Operation operation) { return numResponses; } @Override protected boolean backupCanRead() { return true; } }
/** @author Chazwarp923 */ package tech.chazwarp923.unifieditems.material; import java.util.ArrayList; public enum MaterialType { GENERIC(true, true, true, true, false, true, true, true), ALLOY(false, true, true, true, false, true, true, true), GENERIC_GEM(true, true, false, false, true, false, false, true), VANILLA(false, true, false, false, false, true, true, false), DUST(false, true, false, false, false, false, false, false), INGOT(false, false, true, false, false, false, false, false), NUGGET(false, false, false, true, false, false, false, false), GEM(false, false, false, false, true, false, false, false), PLATE(false, false, false, false, false, true, false, false), GEAR(false, false, false, false, false, false, true, false), BLOCK(false, false, false, false, false, false, false, true); ArrayList<String> types; MaterialType(boolean ore, boolean dust, boolean ingot, boolean nugget, boolean gem, boolean plate, boolean gear, boolean block) { ArrayList<String> temp = new ArrayList<String>(); if(ore) { temp.add("ore"); } if(dust) { temp.add("dust"); } if(ingot) { temp.add("ingot"); } if(nugget) { temp.add("nugget"); } if(gem) { temp.add("gem"); } if(plate) { temp.add("plate"); } if(gear) { temp.add("gear"); } if(block) { temp.add("block"); } types = temp; } }
package com.tencent.mm.plugin.chatroom.ui; import android.view.View; import android.view.View.OnClickListener; class LargeTouchableAreasItemView$1 implements OnClickListener { final /* synthetic */ LargeTouchableAreasItemView hMO; LargeTouchableAreasItemView$1(LargeTouchableAreasItemView largeTouchableAreasItemView) { this.hMO = largeTouchableAreasItemView; } public final void onClick(View view) { this.hMO.setItemViewSelected(!LargeTouchableAreasItemView.a(this.hMO)); if (LargeTouchableAreasItemView.b(this.hMO) != null) { LargeTouchableAreasItemView.b(this.hMO).dZ(LargeTouchableAreasItemView.a(this.hMO)); } } }
package com.adam.consumer; import static org.springframework.web.bind.annotation.RequestMethod.*; import java.util.List; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.RequestMapping; @FeignClient("producer") public interface ProducerClient { @RequestMapping(value = "/", method = POST) void order(); @RequestMapping(value = "/", method = GET) List<Product> getProducts(); }
import java.awt.List; import java.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.Scanner; import javax.print.DocFlavor.STRING; import com.sun.java.accessibility.util.Translator; class VMTranslator{ public static void main(String[] args) { if(args.length != 0){ LerArquivo(args[0]); }else{ System.out.println("Err[0] = Caminho para o arquivo inválido ou inexistente!"); } } public static void LerArquivo(String path){ try { FileInputStream input = new FileInputStream(path); File output = new File(path); Parser parse = new Parser(input); CodeWritter cWritter = new CodeWritter(output); cWritter.setFileName(); cWritter.writeInit(); Translator(parse, cWritter); for (Object file : cWritter.otherFiles) { if(!path.contains(file.toString())){ String nFilePath = path.replace(new File(path).getName(),file.toString()); Parser parser = new Parser(new FileInputStream(nFilePath)); Translator(parser, cWritter); parser.close(); } } parse.close(); cWritter.close(); } catch (Exception e) { System.out.println(e.getMessage()); } finally{ } } public static void Translator(Parser parse, CodeWritter cWritter){ while(parse.hasMoreCommands()){ parse.advance(); String type = parse.commandType(parse.cur_line); if(type != null){ switch(type){ case "C_ARITHMETIC": cWritter.writeArithmetic(parse.arg1()); break; case "C_PUSH": cWritter.writePushPop("C_PUSH", parse.arg1(), parse.arg2()); break; case "C_POP": cWritter.writePushPop("C_POP", parse.arg1(), parse.arg2()); break; case "C_LABEL": cWritter.writeLabel(parse.arg1()); break; case "C_GOTO": cWritter.writeGoto(parse.arg1()); break; case "C_IF": cWritter.writeIf(parse.arg1()); break; case "C_FUNCTION": cWritter.writeFunction(parse.arg1(), parse.arg2()); break; case "C_RETURN": cWritter.writeReturn(); break; case "C_CALL": cWritter.writeCall(parse.arg1(), parse.arg2()); break; } } System.out.println(parse.cur_line); } } } class Parser{ Scanner file; String cur_line; public Parser(FileInputStream file){ this.file = new Scanner(file); this.cur_line = ""; } public boolean hasMoreCommands(){ return file.hasNext(); } public String advance(){ return cur_line = file.nextLine(); } public String commandType(String command){ return commands().get(command.split(" ")[0].trim().toLowerCase()); } public String arg1(){ String[] istr = cur_line.split(" "); String arg = ""; if(!(istr[0].isEmpty())){ if(istr.length == 1){ arg = istr[0]; }else if(istr.length >= 2){ arg = istr[1]; } } return arg; } public int arg2(){ String[] istr = cur_line.split(" "); int arg = 0; if(!(istr[0].isEmpty())){ if(istr.length == 3){ arg = Integer.parseInt(istr[2]); } } return arg; } public void close(){ file.close(); } private HashMap<String,String> commands(){ HashMap<String,String> map = new HashMap<String,String>(); map.put("add", "C_ARITHMETIC"); map.put("sub", "C_ARITHMETIC"); map.put("neg", "C_ARITHMETIC"); map.put("eq", "C_ARITHMETIC"); map.put("gt", "C_ARITHMETIC"); map.put("lt", "C_ARITHMETIC"); map.put("and", "C_ARITHMETIC"); map.put("or", "C_ARITHMETIC"); map.put("not", "C_ARITHMETIC"); map.put("push", "C_PUSH"); map.put("pop", "C_POP"); map.put("label", "C_LABEL"); map.put("goto", "C_GOTO"); map.put("if-goto", "C_IF"); map.put("function", "C_FUNCTION"); map.put("return", "C_RETURN"); map.put("call", "C_CALL"); return map; } } class CodeWritter{ PrintStream file; File in; String fileName, functionName; int bool_count, instruction_count, otherFilesCount; ArrayList<String> otherFiles; public CodeWritter(File file){ this.in = file; this.fileName = file.getName(); this.bool_count = 0; this.instruction_count = 0; this.functionName = null; this.otherFiles = new ArrayList<>(); } public void setFileName(){ try{ String nFilePath = in.getAbsolutePath().replace(".vm", ".asm"); File nFile = new File(nFilePath); //Files.createFile(Paths.get("/home/igors/Documentos/UFU/ESC/Semana07/texto.txt")); nFile.getParentFile().mkdirs(); nFile.createNewFile(); if(nFile.exists()){ this.file = new PrintStream(nFile); } }catch(Exception e){ System.out.print(e.getMessage()); } } public void writeArithmetic(String command){ if(command != "neg" && command != "not"){ this.popD(); } this.decrementStack(); this.putAonStack(); switch(command){ case "add": this.file.println("M=M+D"); break; case "sub": this.file.println("M=M-D"); break; case "and": this.file.println("M=M&D"); break; case "or": this.file.println("M=M|D"); break; case "neg": this.file.println("M=-M"); break; case "not": this.file.println("M=!M"); break; case "eq": this.writeBoolean("eq"); break; case "gt": this.writeBoolean("gt"); break; case "lt": this.writeBoolean("lt"); break; }; } public void writeBoolean(String oper){ this.file.println("D=M-D"); this.file.println(String.format("@BOOL%d", bool_count)); if(oper.equals("eq")){ this.file.println("D;JEQ"); } if(oper.equals("gt")){ this.file.println("D;JGT"); } if(oper.equals("lt")){ this.file.println("D;JLT"); } this.putAonStack(); this.file.println("M=0"); this.file.println(String.format("@ENDBOOL%d", bool_count)); this.file.println("0;JMP"); this.file.println(String.format("(BOOL%d)", bool_count)); this.putAonStack(); this.file.println("M=-1"); this.file.println(String.format("(ENDBOOL%d)", bool_count)); bool_count++; } public void pushD(){ this.file.println("@SP"); this.file.println("A=M"); this.file.println("M=D"); this.file.println("@SP"); this.file.println("M=M+1"); } public void popD(){ this.file.println("@SP"); this.file.println("M=M-1"); this.file.println("A=M"); this.file.println("D=M"); } public void decrementStack(){ this.file.println("@SP"); this.file.println("M=M-1"); } public void incrementStack(){ this.file.println("@SP"); this.file.println("M=M+1"); } public void putAonStack(){ this.file.println("@SP"); this.file.println("A=M"); } public void writePushPop(String command, String segment, int index){ //Setting Adress String address = this.address().get(segment); if(segment.equals("constant")){ this.file.println("@" + index); } if(segment.equals("static")){ this.file.println("@" + this.fileName + "." + index); } if(segment.equals("pointer") || segment.equals("temp")){ this.file.println("@R" + (Integer.parseInt(address) + index)); } if(segment.equals("local") || segment.equals("argument") || segment.equals("this") || segment.equals("that")){ this.file.println("@" + address); this.file.println("D=M"); this.file.println("@" + index); this.file.println("A=D+A"); } if(command.equals("C_PUSH")){ if(segment.equals("constant")){ this.file.println("D=A"); }else{ this.file.println("D=M"); } this.pushD(); } if(command.equals("C_POP")){ this.file.println("D=A"); this.file.println("@R13"); this.file.println("M=D"); this.popD(); this.file.println("@R13"); this.file.println("A=M"); this.file.println("M=D"); } } public void writeInit(){ String initPointer = address().get("stack_pointer_init"); this.file.println(String.format("@%s", initPointer)); this.file.println("D=A"); this.file.println("@SP"); this.file.println("M=D"); this.file.println("@Sys.init"); this.file.println("0;JMP"); } public void writeLabel(String label){ this.file.println(String.format("(%s$%s)", this.functionName, label)); } public void writeGoto(String label){ this.file.println(String.format("@%s$%s", this.functionName, label)); this.file.println("0;JMP"); } public void writeIf(String label){ this.file.println("@SP"); this.file.println("AM=M-1"); this.file.println("D=M"); this.file.println(String.format("@%s$%s", this.functionName, label)); this.file.println("D;JNE"); } public void writeCall(String function, int arguments){ int i = this.instruction_count; this.instruction_count = this.instruction_count + 1; this.otherFilesCount = this.otherFilesCount +1; this.file.println(String.format("@%s.return_%d", function, i)); this.file.println("D=A"); this.file.println("@SP"); this.file.println("M=M+1"); this.file.println("A=M-1"); this.file.println("M=D"); this.file.println("@LCL"); this.file.println("D=M"); this.file.println("@SP"); this.file.println("M=M+1"); this.file.println("A=M-1"); this.file.println("M=D"); this.file.println("@ARG"); this.file.println("D=M"); this.file.println("@SP"); this.file.println("M=M+1"); this.file.println("A=M-1"); this.file.println("M=D"); this.file.println("@THIS"); this.file.println("D=M"); this.file.println("@SP"); this.file.println("M=M+1"); this.file.println("A=M-1"); this.file.println("M=D"); this.file.println("@THAT"); this.file.println("D=M"); this.file.println("@SP"); this.file.println("M=M+1"); this.file.println("A=M-1"); this.file.println("M=D"); this.file.println("D=A+1"); this.file.println(String.format("@%d", 5+arguments)); this.file.println("D=D-A"); this.file.println("@ARG"); this.file.println("M=D"); this.file.println("@SP"); this.file.println("D=M"); this.file.println("@LCL"); this.file.println("M=D"); this.file.println(String.format("@%s", function)); this.file.println("0;JMP"); this.file.println(String.format("@%s.return_%d", function, i)); if(!otherFiles.contains(function.substring(0, function.indexOf("."))+".vm")){ this.otherFiles.add(function.substring(0, function.indexOf("."))+".vm"); } } public void writeFunction(String function, int locals){ this.file.println(String.format("(%s)", function)); this.file.println(String.format("@%s.locals", function)); this.file.println("M=0"); this.file.println(String.format("(%s.locals_loop)", function)); this.file.println(String.format("@%d", locals)); this.file.println("D=A"); this.file.println(String.format("@%s.locals", function)); this.file.println("D=D-M"); this.file.println(String.format("@%s.end_locals_loop", function)); this.file.println("D;JEQ"); this.file.println("@SP"); this.file.println("M=M+1"); this.file.println("A=M-1"); this.file.println("M=0"); this.file.println(String.format("@%s.locals", function)); this.file.println("M=M+1"); this.file.println(String.format("@%s.locals_loop", function)); this.file.println("0;JMP"); this.file.println(String.format("(%s.end_locals_loop)", function)); this.functionName = function; } public void writeReturn(){ this.file.println("@LCL"); this.file.println("D=M"); this.file.println("@R14"); this.file.println("M=D"); this.file.println("@5"); this.file.println("A=D-A"); this.file.println("D=M"); this.file.println("@R15"); this.file.println("M=D"); this.file.println("@SP"); this.file.println("M=M-1"); this.file.println("A=M"); this.file.println("D=M"); this.file.println("@ARG"); this.file.println("A=M"); this.file.println("M=D"); this.file.println("D=A+1"); this.file.println("@SP"); this.file.println("M=D"); this.file.println("@R14"); this.file.println("AM=M-1"); this.file.println("D=M"); this.file.println("@THAT"); this.file.println("M=D"); this.file.println("@R14"); this.file.println("AM=M-1"); this.file.println("D=M"); this.file.println("@THIS"); this.file.println("M=D"); this.file.println("@R14"); this.file.println("AM=M-1"); this.file.println("D=M"); this.file.println("@ARG"); this.file.println("M=D"); this.file.println("@R14"); this.file.println("A=M-1"); this.file.println("D=M"); this.file.println("@LCL"); this.file.println("M=D"); this.file.println("@R15"); this.file.println("A=M"); this.file.println("0;JMP"); } public void close(){ file.close(); } private HashMap<String,String> address(){ HashMap<String,String> map = new HashMap<String,String>(); map.put("local","LCL"); //R1 map.put("argument", "ARG"); //R2 map.put("this", "THIS"); // R3 map.put("that", "THAT"); // R4 map.put("pointer", "3"); // R3); R4 map.put("temp", "5"); // R5-12 //R13-15 free space map.put("static", "16"); //R16-255 map.put("stack_pointer_init", "256"); return map; } }
package com.architech.ziarkowski.user_service; import com.architech.ziarkowski.dao.UserDataProviderFactory; import com.architech.ziarkowski.model.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class UserService { @Autowired private UserDataProviderFactory userDataProviderFactory; public boolean addUser(User user) { return userDataProviderFactory.getProvider().save(user); } }
package polarpelican.graphics; import java.awt.Graphics2D; /** * * @author Student */ public interface Renderable { void render(Graphics2D g, int x, int y); }
package com.adv.java.designPatterns; import java.util.ArrayList; import java.util.Arrays; public class SingletonDemoTest { public static void main(String[] args) { //The constructor SingletonDemo() is not visible //SingletonDemo demo=new SingletonDemo(); SingletonDemo singletonDemo=SingletonDemo.getInstance(); singletonDemo.setTeams(new ArrayList<>(Arrays.asList("India","AUS"))); System.out.println(singletonDemo.getTeams()); } }
/* * Copyright (C) 2022-2023 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hedera.mirror.importer.reader.signature; import static java.lang.String.format; import com.hedera.mirror.common.util.DomainUtils; import com.hedera.mirror.importer.domain.StreamFileData; import com.hedera.mirror.importer.domain.StreamFileSignature; import com.hedera.mirror.importer.exception.InvalidStreamFileException; import com.hedera.services.stream.proto.SignatureFile; import jakarta.inject.Named; import java.io.DataInputStream; import java.io.IOException; @Named public class ProtoSignatureFileReader implements SignatureFileReader { public static final byte VERSION = 6; @Override public StreamFileSignature read(StreamFileData signatureFileData) { var filename = signatureFileData.getFilename(); try { var signatureFile = readSignatureFile(signatureFileData); var fileSignature = signatureFile.getFileSignature(); var metadataSignature = signatureFile.getMetadataSignature(); var streamFileSignature = new StreamFileSignature(); streamFileSignature.setBytes(signatureFileData.getBytes()); streamFileSignature.setFileHash(DomainUtils.getHashBytes(fileSignature.getHashObject())); streamFileSignature.setFileHashSignature(DomainUtils.toBytes(fileSignature.getSignature())); streamFileSignature.setFilename(signatureFileData.getStreamFilename()); streamFileSignature.setMetadataHash(DomainUtils.getHashBytes(metadataSignature.getHashObject())); streamFileSignature.setMetadataHashSignature(DomainUtils.toBytes(metadataSignature.getSignature())); streamFileSignature.setSignatureType(StreamFileSignature.SignatureType.valueOf( fileSignature.getType().toString())); streamFileSignature.setVersion(VERSION); return streamFileSignature; } catch (IllegalArgumentException | IOException e) { throw new InvalidStreamFileException(filename, e); } } private SignatureFile readSignatureFile(StreamFileData signatureFileData) throws IOException { try (var dataInputStream = new DataInputStream(signatureFileData.getInputStream())) { var filename = signatureFileData.getFilename(); byte version = dataInputStream.readByte(); if (version != VERSION) { var message = format("Expected file %s with version %d, got %d", filename, VERSION, version); throw new InvalidStreamFileException(message); } var signatureFile = SignatureFile.parseFrom(dataInputStream); if (!signatureFile.hasFileSignature()) { throw new InvalidStreamFileException(format("The file %s does not have a file signature", filename)); } if (!signatureFile.hasMetadataSignature()) { var message = format("The file %s does not have a file metadata signature", filename); throw new InvalidStreamFileException(message); } return signatureFile; } } }
import com.company.*; import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javafx.stage.Stage; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; public class GUI extends Application { static int noUsers; static String[] passwords; static String[] usernames; final int sndCol = 5; RadioButton plainBTN, md5BTN, sha3BTN, sha224, sspmBTN, sgxBTN, bcryptBTN; Button submitBTN, simBTN, schemeBTN; RadioButton loginBTN, registerBTN, cuBTN, cpBTN, delBTN; TextField simFIELD, userFIELD, passFIELD, wildFIELD; ListView myHashes, consoleView; Label col1, col2, col3, simLABEL, consoleLABEL; final ToggleGroup operationGroup = new ToggleGroup(); final ToggleGroup schemeGroup = new ToggleGroup(); SchemeInterface sc; boolean schemeSEL = false; boolean SSnewkey, SStpmkey, SStpmop, SSusernames, SSredis; guiSSPM SS; @Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("Password Database Schemes"); //StackPane layout = new StackPane(); GridPane grid = new GridPane(); grid.setPadding((new Insets(10, 10, 10, 10))); grid.setVgap(13); grid.setHgap(10); setElements(); grid.add(myHashes, sndCol + 4, 2, 4, 11); grid.add(consoleView, sndCol, 8, 3, 5); grid.getChildren().addAll(col1, col2, col3, plainBTN, md5BTN, sha3BTN, sha224, sspmBTN, bcryptBTN, schemeBTN, sgxBTN, simLABEL, simFIELD, simBTN, consoleLABEL, submitBTN, loginBTN, registerBTN, cuBTN, cpBTN, delBTN, userFIELD, passFIELD, wildFIELD); Scene mainScene = new Scene(grid, 900, 500); primaryStage.setScene(mainScene); primaryStage.show(); //grid.setStyle("-fx-background-color: #4286f4;"); setActions(); } private void setElements() { col1 = new Label("1. Choose a Scheme"); col2 = new Label("2. Choose an Operation"); col3 = new Label("Database View"); //1st column simLABEL = new Label("Simulate Users"); simFIELD = new TextField(); simBTN = new Button("Simulate"); simFIELD.setPromptText("Input number, max 1M"); plainBTN = new RadioButton("plaintext"); md5BTN = new RadioButton("MD5"); sha3BTN = new RadioButton("SHA-3"); sha224 = new RadioButton("SHA-224"); sspmBTN = new RadioButton("SSPM"); bcryptBTN = new RadioButton("B-Crypt"); sgxBTN = new RadioButton("SSPM with Intel SGX"); schemeBTN = new Button("Enter Scheme"); plainBTN.setToggleGroup(schemeGroup); md5BTN.setToggleGroup(schemeGroup); sha3BTN.setToggleGroup(schemeGroup); sha224.setToggleGroup(schemeGroup); sspmBTN.setToggleGroup(schemeGroup); bcryptBTN.setToggleGroup(schemeGroup); GridPane.setConstraints(plainBTN, 0, 2); GridPane.setConstraints(md5BTN, 0, 3); GridPane.setConstraints(sha3BTN, 0, 4); GridPane.setConstraints(sha224, 0, 5); GridPane.setConstraints(bcryptBTN, 0, 6); GridPane.setConstraints(sgxBTN, 0, 7); GridPane.setConstraints(sspmBTN, 0, 8); GridPane.setConstraints(schemeBTN, 1, 8); GridPane.setConstraints(col1, 0, 1); GridPane.setConstraints(simLABEL, 0, 9); GridPane.setConstraints(simFIELD, 0, 10); GridPane.setConstraints(simBTN, 1, 10); simLABEL.setAlignment(Pos.CENTER); //2nd column consoleLABEL = new Label("Console Log"); submitBTN = new Button("Submit"); userFIELD = new TextField(); userFIELD.setPromptText("username"); passFIELD = new TextField(); passFIELD.setPromptText("password"); wildFIELD = new TextField(); wildFIELD.setVisible(false); loginBTN = new RadioButton("Login"); registerBTN = new RadioButton("Register"); cuBTN = new RadioButton("Change Username"); cpBTN = new RadioButton("Change Password"); delBTN = new RadioButton("Delete User"); loginBTN.setToggleGroup(operationGroup); registerBTN.setToggleGroup(operationGroup); cuBTN.setToggleGroup(operationGroup); cpBTN.setToggleGroup(operationGroup); delBTN.setToggleGroup(operationGroup); GridPane.setConstraints(loginBTN, sndCol, 2); GridPane.setConstraints(registerBTN, sndCol, 3); GridPane.setConstraints(cuBTN, sndCol, 4); GridPane.setConstraints(cpBTN, sndCol, 5); GridPane.setConstraints(delBTN, sndCol, 6); GridPane.setConstraints(userFIELD, sndCol + 2, 2); GridPane.setConstraints(passFIELD, sndCol + 2, 3); GridPane.setConstraints(wildFIELD, sndCol + 2, 4); GridPane.setConstraints(submitBTN, sndCol + 2, 6); GridPane.setConstraints(col2, sndCol, 1); GridPane.setConstraints(consoleLABEL, sndCol, 7); //3rd column & console myHashes = new ListView(); consoleView = new ListView(); consoleView.setStyle("-fx-control-inner-background: black; -fx-text-fill: yellow;"); GridPane.setConstraints(col3, sndCol + 4, 1); } private void setActions() { sspmBTN.setOnAction(e-> SS = new guiSSPM("title", "message")); simBTN.setOnAction(e -> { try { //System.out.println(simFIELD.getText()); noUsers = Integer.parseInt(simFIELD.getText()); simulateUsers(); } catch (Exception e1) { e1.printStackTrace(); } }); schemeBTN.setOnAction(e -> { schemeSEL = true; if (plainBTN.isSelected()) sc = new plain_text(); else if (md5BTN.isSelected()) sc = new md5(); else if (sha3BTN.isSelected()) sc = new SHA_3(); else if (sha224.isSelected()) sc = new SHA_224(); else if (sspmBTN.isSelected()){ SSnewkey = SS.newkey; SSusernames = SS.usernames; SSredis = SS.redis; SStpmkey = SS.tpmkey; SStpmop = SS.tpmop; sc = new SSPM(SSusernames, SSredis, SSnewkey, SStpmkey, SStpmop); //sc = new newSchemeV1(); } else schemeSEL = false; }); submitBTN.setOnAction(e -> { try { if (registerBTN.isSelected()) { boolean b = sc.register(userFIELD.getText(), passFIELD.getText()); updateConsoleView("Register", b); } if (loginBTN.isSelected()) { boolean b = sc.login(userFIELD.getText(), passFIELD.getText()); updateConsoleView("Login", b); } if (cuBTN.isSelected()) { boolean b = sc.changeUsername(userFIELD.getText(), passFIELD.getText(), wildFIELD.getText()); updateConsoleView("Change Username", b); } if (cpBTN.isSelected()) { boolean b = sc.changePassword(userFIELD.getText(), passFIELD.getText(), wildFIELD.getText()); updateConsoleView("Change Password", b); } if (delBTN.isSelected()) { boolean b = sc.deleteUser(userFIELD.getText(), passFIELD.getText()); updateConsoleView("Delete User", b); } if (!loginBTN.isSelected()) { updateListView(); } } catch (Exception e1) { e1.printStackTrace(); } }); loginBTN.setOnAction(e -> logRegDelforms()); registerBTN.setOnAction(e -> logRegDelforms()); delBTN.setOnAction(e -> logRegDelforms()); cuBTN.setOnAction(e -> { cucpForms(); userFIELD.setPromptText("old username"); passFIELD.setPromptText("new username"); wildFIELD.setPromptText("password"); }); cpBTN.setOnAction(e -> { cucpForms(); userFIELD.setPromptText("username"); passFIELD.setPromptText("old password"); wildFIELD.setPromptText("new password"); }); } private void logRegDelforms() { userFIELD.setVisible(true); userFIELD.setText(""); userFIELD.setPromptText("username"); passFIELD.setVisible(true); passFIELD.setText(""); passFIELD.setPromptText("password"); wildFIELD.setVisible(false); } private void cucpForms() { userFIELD.setVisible(true); wildFIELD.setVisible(true); passFIELD.setVisible(true); passFIELD.setText(""); userFIELD.setText(""); wildFIELD.setText(""); } boolean firstSim = false; private void simulateUsers() throws Exception { BufferedReader lines = new BufferedReader(new FileReader("passwords.txt")); String line = lines.readLine(); int i = 0; passwords = new String[noUsers]; while (line != null && i < noUsers) { passwords[i++] = line; line = lines.readLine(); } lines = new BufferedReader(new FileReader("usernames.txt")); line = lines.readLine(); i = 0; usernames = new String[noUsers]; while (line != null && i < noUsers) { usernames[i++] = line; line = lines.readLine(); } long startTime = System.nanoTime(); for (int j = 0; j < noUsers; j++) sc.register(usernames[j], passwords[j]); long endTime = System.nanoTime(); double duration = (double) ((endTime - startTime) / (1000000)); consoleView.getItems().add("Simmed " + noUsers + " Users and it took " + duration + " ms."); updateListView(); } private void updateListView() { myHashes.getItems().clear(); if (sspmBTN.isSelected()) { HashSet users = (HashSet) sc.getDB(); myHashes.getItems().addAll(users); } else { Map<String, String> users = (Map<String, String>) sc.getDB(); List<String> users_ = new ArrayList(); for (Map.Entry<String, String> entry : users.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); users_.add(key + ":" + value); } myHashes.getItems().addAll(users_); } } private void updateConsoleView(String op, boolean sta) { if (sta) consoleView.getItems().add(op + " sucessful!"); else consoleView.getItems().add(op + " not sucessful!"); } }
package ru.android.messenger.view.utils; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.design.widget.TextInputLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; import android.widget.EditText; import com.stfalcon.chatkit.commons.models.IUser; import java.util.Objects; import ru.android.messenger.R; import ru.android.messenger.model.PreferenceManager; import ru.android.messenger.model.utils.FileUtils; import ru.android.messenger.model.utils.FirebaseUtils; import ru.android.messenger.model.utils.ImageHelper; import ru.android.messenger.view.activity.LoginActivity; import ru.android.messenger.view.activity.UserInfoActivity; public class ViewUtils { private ViewUtils() { } public static Bitmap getDefaultProfileImage(Context context) { return BitmapFactory.decodeResource(context.getResources(), R.drawable.profile_thumbnail); } public static void logout(Context context) { FirebaseUtils.unsubscribeFromReceivingMessages(context); PreferenceManager.clearPreferencesWithoutLastLogin(context); FileUtils.deletePhotoFile(context); Intent intent = new Intent(context, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } public static void clearErrorInTextInputLayoutOnChangeText( final TextInputLayout textInputLayout, final EditText editText) { editText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // unused method } @Override public void afterTextChanged(Editable s) { // unused method } @Override public void onTextChanged(CharSequence str, int start, int before, int count) { textInputLayout.setError(null); } }); } public static Intent getUserInfoIntent(Context context, String firstName, String surname, String login, Bitmap photo) { Intent intent = new Intent(context, UserInfoActivity.class); intent.putExtra("user_first_name", firstName); intent.putExtra("user_surname", surname); intent.putExtra("user_login", login); intent.putExtra("user_photo", ImageHelper.getByteArrayFromBitmap(photo)); return intent; } public static Intent getUserInfoIntent(Context context, IUser user, Bitmap photo) { String[] userName = user.getName().split(" "); String firstName = userName[0]; String surname = userName[1]; String login = user.getId(); return getUserInfoIntent(context, firstName, surname, login, photo); } public static void createActionBarWithBackButtonForActivity( AppCompatActivity activity, Toolbar toolbar, String title) { activity.setSupportActionBar(toolbar); ActionBar actionBar = Objects.requireNonNull(activity.getSupportActionBar()); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setTitle(title); } public static void createActionBarWithNavigationDrawerButtonForActivity( AppCompatActivity activity, Toolbar toolbar) { activity.setSupportActionBar(toolbar); ActionBar actionBar = Objects.requireNonNull(activity.getSupportActionBar()); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.button_menu); } }
import java.util.ArrayList; public class BarChart implements Chart { private SpreadsheetApplication spreadsheetApplication; public BarChart(SpreadsheetApplication spreadsheetApplication) { this.spreadsheetApplication = spreadsheetApplication; } @Override public String getType() { return("BarChart"); } @Override public void update(String name, int value) { boolean find = false; ArrayList<ApplicationData> applicationDataArrayList = this.spreadsheetApplication.getApplicationDataArrayList(); for (ApplicationData applicationData : applicationDataArrayList) { if (applicationData.getName().equals(name)) { find = true; applicationData.setValue(value); } } if (!find) { ApplicationData applicationData = new ApplicationData(name, value); this.spreadsheetApplication.setApplicationDataArrayList(applicationData); } } @Override public void change(String name, int value) { System.out.println("BarChart change " + name + " " + value + "."); boolean find = false; ArrayList<ApplicationData> applicationDataArrayList = this.spreadsheetApplication.getApplicationDataArrayList(); for (ApplicationData applicationData : applicationDataArrayList) { if (applicationData.getName().equals(name)) { find = true; applicationData.setValue(value); } } if (!find) { ApplicationData applicationData = new ApplicationData(name, value); this.spreadsheetApplication.setApplicationDataArrayList(applicationData); } this.spreadsheetApplication.change(name, value); } @Override public void display() { ArrayList<ApplicationData> applicationDataArrayList = this.spreadsheetApplication.getApplicationDataArrayList(); for (ApplicationData applicationData : applicationDataArrayList) { int value = applicationData.getValue(); for (int i=0; i < value; i++) { System.out.printf("="); } System.out.printf(" %s\n", applicationData.getName()); } } }
package ch.fhnw.oop2.departure.util; import java.lang.reflect.Type; import com.google.gson.*; import javafx.beans.property.SimpleStringProperty; public class SimpleStringPropertySerializer implements JsonSerializer<SimpleStringProperty> { public JsonElement serialize(SimpleStringProperty src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.get()); } }
package temakereso.helper; import com.fasterxml.jackson.annotation.JsonFormat; @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum TopicStatus { OPEN("szabad"), RESERVED("foglalt"), DONE("elkészített"); private String name; TopicStatus(String name) { this.name = name; } public String getId() { return name(); } public String getName() { return name; } }
package com.siziksu.payment.dagger.component; import com.siziksu.payment.App; import com.siziksu.payment.dagger.module.ApplicationModule; import com.siziksu.payment.dagger.module.DataModule; import com.siziksu.payment.dagger.module.DomainModule; import com.siziksu.payment.dagger.module.PresenterModule; import com.siziksu.payment.data.Repository; import com.siziksu.payment.data.persistence.android.ContactClient; import com.siziksu.payment.domain.main.MainDomain; import com.siziksu.payment.presenter.amount.AmountPresenter; import com.siziksu.payment.presenter.confirmation.ConfirmationPresenter; import com.siziksu.payment.presenter.main.MainPresenter; import com.siziksu.payment.ui.view.amount.AmountSelectionActivity; import com.siziksu.payment.ui.view.confirmation.ConfirmationActivity; import com.siziksu.payment.ui.view.main.MainActivity; import javax.inject.Singleton; import dagger.Component; @Singleton @Component( modules = { ApplicationModule.class, DataModule.class, DomainModule.class, PresenterModule.class, } ) public interface ApplicationComponent { void inject(App target); void inject(MainActivity target); void inject(MainPresenter target); void inject(MainDomain target); void inject(Repository target); void inject(ContactClient target); void inject(AmountSelectionActivity target); void inject(AmountPresenter target); void inject(ConfirmationPresenter target); void inject(ConfirmationActivity target); }
/* * 2012-3 Red Hat Inc. and/or its affiliates and other contributors. * * 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.overlord.rtgov.internal.epn.jee; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.ejb.TransactionManagement; import javax.ejb.TransactionManagementType; import javax.jms.Message; import javax.jms.MessageListener; import org.overlord.commons.services.ServiceRegistryUtil; import org.overlord.rtgov.epn.EPNManager; import org.overlord.rtgov.epn.jms.JMSEPNManager; import java.text.MessageFormat; import java.util.logging.Level; import java.util.logging.Logger; /** * This is the JMS receiver for the Event Processor Network notifications. * */ @MessageDriven(name = "EPNNotificationsServer", messageListenerInterface = MessageListener.class, activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "EPNNotifications") }) @TransactionManagement(value= TransactionManagementType.CONTAINER) @TransactionAttribute(value= TransactionAttributeType.REQUIRED) public class EPNNotificationServer implements MessageListener { private static final Logger LOG=Logger.getLogger(EPNNotificationServer.class.getName()); private JMSEPNManager _epnManager; /** * This is the default constructor. */ public EPNNotificationServer() { } /** * The initialize method. */ @PostConstruct public void init() { EPNManager epnManager=ServiceRegistryUtil.getSingleService(EPNManager.class); if (epnManager instanceof JMSEPNManager) { _epnManager = (JMSEPNManager)epnManager; } else { LOG.severe(MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "epn-container-jee.Messages").getString("EPN-CONTAINER-JEE-7"), epnManager)); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Initialize EPN Notifications Server with EPN Manager="+_epnManager); } } /** * The close method. */ @PreDestroy public void close() { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Closing EPN Notifications Server"); } } /** * {@inheritDoc} */ public void onMessage(Message message) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Received notifications '"+message+"' - sending to "+_epnManager); } if (_epnManager != null) { try { _epnManager.handleNotificationsMessage(message); } catch (Exception e) { LOG.log(Level.SEVERE, java.util.PropertyResourceBundle.getBundle( "epn-container-jee.Messages").getString("EPN-CONTAINER-JEE-2"), e); } } } }
package mage.cards.e; import java.util.UUID; import mage.constants.SubType; import mage.target.common.TargetCreaturePermanent; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.costs.Cost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.PreventDamageToTargetEffect; import mage.constants.Outcome; import mage.target.TargetPermanent; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; /** * * @author jeffwadsworth */ public final class ErrantMinion extends CardImpl { public ErrantMinion(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // At the beginning of the upkeep of enchanted creature's controller, that player may pay any amount of mana. Errant Minion deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. this.addAbility(new BeginningOfUpkeepTriggeredAbility( Zone.BATTLEFIELD, new ErrantMinionEffect(), TargetController.CONTROLLER_ATTACHED_TO, false)); } private ErrantMinion(final ErrantMinion card) { super(card); } @Override public ErrantMinion copy() { return new ErrantMinion(this); } } class ErrantMinionEffect extends OneShotEffect { public ErrantMinionEffect() { super(Outcome.Damage); this.staticText = "that player may pay any amount of mana. Errant Minion deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way"; } public ErrantMinionEffect(final ErrantMinionEffect effect) { super(effect); } @Override public ErrantMinionEffect copy() { return new ErrantMinionEffect(this); } @Override public boolean apply(Game game, Ability source) { Permanent errantMinion = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (errantMinion == null) { return false; } Permanent enchantedCreature = game.getPermanentOrLKIBattlefield(errantMinion.getAttachedTo()); if (enchantedCreature == null) { return false; } Player controllerOfEnchantedCreature = game.getPlayer(enchantedCreature.getControllerId()); if (controllerOfEnchantedCreature != null) { int manaPaid = playerPaysXGenericMana(controllerOfEnchantedCreature, source, game); PreventDamageToTargetEffect effect = new PreventDamageToTargetEffect(Duration.OneUse, manaPaid); effect.setTargetPointer(new FixedTarget(controllerOfEnchantedCreature.getId())); game.addEffect(effect, source); DamageTargetEffect effect2 = new DamageTargetEffect(2); effect2.setTargetPointer(new FixedTarget(controllerOfEnchantedCreature.getId())); effect2.apply(game, source); return true; } return false; } protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; while (!payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } } game.informPlayers(player.getLogName() + " pays {" + xValue + '}'); return xValue; } }
package com.pangpang6.books.base.util.stream; /** * Created by jiangjiguang on 2018/1/6. */ public class CollectorTest { }
/** * \file Capability.java * This class represents the Capability node of the XML. */ package br.org.funcate.glue.model.xml; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * \brief This class represents the Capability node of the XML. * * @author Emerson Leite de Moraes * @author Willyan Aleksander * * Version 1.0 */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "_request", "_exception", "_vendorSpecificCapabilities", "_userDefinedSymbolization", "_layer" }) @XmlRootElement(name = "Capability") public class Capability { @XmlElement(name = "Request", required = true) protected Request _request; @XmlElement(name = "Exception", required = true) protected Exception _exception; @XmlElement(name = "VendorSpecificCapabilities", required = true) protected String _vendorSpecificCapabilities; @XmlElement(name = "UserDefinedSymbolization", required = true) protected UserDefinedSymbolization _userDefinedSymbolization; @XmlElement(name = "Layer", required = true) protected Layer _layer; /** * \brief Gets the value of the request property. * * @return possible object is {@link Request } * */ public Request getRequest() { return _request; } /** * \brief Sets the value of the request property. * * @param value * allowed object is {@link Request } * */ public void setRequest(Request value) { this._request = value; } /** * \brief Gets the value of the exception property. * * @return possible object is {@link Exception } * */ public Exception getException() { return _exception; } /** * \brief Sets the value of the exception property. * * @param value * allowed object is {@link Exception } * */ public void setException(Exception value) { this._exception = value; } /** * \brief Gets the value of the vendorSpecificCapabilities property. * * @return possible object is {@link String } * */ public String getVendorSpecificCapabilities() { return _vendorSpecificCapabilities; } /** * \brief Sets the value of the vendorSpecificCapabilities property. * * @param value * allowed object is {@link String } * */ public void setVendorSpecificCapabilities(String value) { this._vendorSpecificCapabilities = value; } /** * \brief Gets the value of the userDefinedSymbolization property. * * @return possible object is {@link UserDefinedSymbolization } * */ public UserDefinedSymbolization getUserDefinedSymbolization() { return _userDefinedSymbolization; } /** * \brief Sets the value of the userDefinedSymbolization property. * * @param value * allowed object is {@link UserDefinedSymbolization } * */ public void setUserDefinedSymbolization(UserDefinedSymbolization value) { this._userDefinedSymbolization = value; } /** * \brief Gets the value of the layer property. * * @return possible object is {@link Layer } * */ public Layer getLayer() { return _layer; } /** * \brief Sets the value of the layer property. * * @param value * allowed object is {@link Layer } * */ public void setLayer(Layer value) { this._layer = value; } }
package LeetCode.Trees; import java.util.Map; public class CheckBalancedBinaryTree { public boolean isBalanced(TreeNode root) { if (root == null) return true; return Math.abs(calculateHeight(root.left) - calculateHeight(root.right)) < 2 && isBalanced(root.left) && isBalanced(root.right); } public int calculateHeight(TreeNode root){ if(root == null) return 0; return Math.max(calculateHeight(root.left), calculateHeight(root.right)) + 1; } // bottom up recursion public boolean isBalanced1(TreeNode root) { return isBalancedHelper(root) != null; } public Integer isBalancedHelper(TreeNode root){ if (root == null) return 0; Integer left = isBalancedHelper(root.left); Integer right = isBalancedHelper(root.right); if(left == null || right == null) return null; if(Math.abs(left - right) > 1) return null; return Math.max(left, right) + 1; } public static void main(String[] args) { CheckBalancedBinaryTree ch = new CheckBalancedBinaryTree(); TreeNode root = new TreeNode(3, new TreeNode(9, null, null), new TreeNode(20, new TreeNode(15, null, null), new TreeNode(7, null, null))); TreeNode root1 = new TreeNode(1, new TreeNode(2, new TreeNode(3, new TreeNode(4, null, null), new TreeNode(4, null, null)), new TreeNode(3, null, null)), new TreeNode(2, null, null)); System.out.println(ch.isBalanced(root)); System.out.println(ch.isBalanced(root)); } }
package Manufacturing.ProductLine.Pretreatment; import Manufacturing.Ingredient.Ingredient; import Manufacturing.Machine.GeneralMachine.CleanMachine; import Manufacturing.Machine.GeneralMachine.DisinfectMachine; import Manufacturing.Machine.GeneralMachine.PeelMachine; import Manufacturing.Machine.IngredientMachine; import Presentation.Protocol.IOManager; import java.util.ArrayList; import java.util.List; /** * TODO:预处理创造类,提供预处理方法.<br> * <p>实现了外观模式</p> * <i>提供预处理模块中的筛选、清洗、杀菌等子系统中类的访问接口</i> * * @author 孟繁霖 * @date 2021-10-12 8:24 */ public class PretreatmentApp { private final IngredientMachine disinfectMachine; private final IngredientMachine peelMachine; private final IngredientMachine filterTreatMachine; private final IngredientMachine cleanMachine; public PretreatmentApp(IngredientMachine filterMachine) { disinfectMachine = new DisinfectMachine(); peelMachine = new PeelMachine(); this.filterTreatMachine =filterMachine; cleanMachine = new CleanMachine(); } /** * TODO:消毒方法 * * @param baseIngredientList : 原材料列表 * @author 孟繁霖 * @date 2021-10-12 8:25 */ public void disinfect(List<Ingredient> baseIngredientList) { IOManager.getInstance().print( "--------开始消毒---------", "--------開始消毒---------", "-------Disinfect-------"); // disinfectProcessor.treat(baseIngredientList); IOManager.getInstance().print( "正在消毒", "正在消毒", "Disinfecting..." ); for (int i = 0; i < baseIngredientList.size(); i++) { baseIngredientList.set(i, disinfectMachine.treat(baseIngredientList.get(i))); } IOManager.getInstance().print( "--------消毒完成---------", "--------消毒完成---------", "---Disinfection completed---"); } /** * TODO:剥皮方法 * * @param ingredientList : 原材料列表 * @author 孟繁霖 * @date 2021-10-12 8:25 */ public void peel(List<Ingredient> ingredientList) { IOManager.getInstance().print( "--------开始削皮---------", "--------開始削皮---------", "------Start peeling------"); // peelProcessor.treat(baseIngredientList); IOManager.getInstance().print( "正在削皮", "正在削皮", "Peeling..." ); for (int i = 0; i < ingredientList.size(); i++) { ingredientList.set(i, peelMachine.treat(ingredientList.get(i))); } IOManager.getInstance().print( "--------完成削皮---------", "--------完成削皮---------", "----Complete the peeling-----"); } /** * TODO: 过滤筛选方法. * * @param ingredientList : 原材料列表 * @return : java.util.List<Manufacturing.ProductLine.Fruit.RawMaterial> * @author 孟繁霖 * @date 2021-10-12 8:26 */ public List<Ingredient> filterTreat(List<Ingredient> ingredientList) { IOManager.getInstance().print( "#使用过滤器模式", "#使用過濾器模式", "#Use Filter Pattern"); IOManager.getInstance().print( "--开始筛选符合要求的原料--", "--開始篩選符合要求的原料--", "--Start to screen raw materials that meet the requirements--"); List<Ingredient> temp = new ArrayList<Ingredient>(); for (Ingredient ingredient: ingredientList) { if (filterTreatMachine.treat(ingredient) != null) temp.add(ingredient); } IOManager.getInstance().print( "---筛选完成,结果如下:---", "---篩選完成,結果如下:---", "---The screening is complete, and the results are as follows: ---"); for (Ingredient ingredient : temp) { IOManager.getInstance().printLanguageIrrelevantContent(ingredient.showContentsWithWeight()); } return temp; } /** * TODO:清理方法 * * @param ingredientList : 原材料列表 * @author 孟繁霖 * @date 2021-10-12 8:27 */ public void clean(List<Ingredient> ingredientList) { IOManager.getInstance().print( "--------开始清理---------", "-----------開始清理---------", "---------Start to clean up-------"); IOManager.getInstance().print( "正在清洗", "正在清洗", "Cleaning..." ); for (int i = 0; i < ingredientList.size(); i++) { ingredientList.set(i, cleanMachine.treat(ingredientList.get(i))); } IOManager.getInstance().print( "--------清理完成---------", "--------清理完成---------", "--------Cleaning up---------"); } }
package com.tyss.capgemini.loanproject.repository; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Scanner; import com.tyss.capgemini.loanproject.beans.CustomerBean; import com.tyss.capgemini.loanproject.beans.EmployeeBean; import com.tyss.capgemini.loanproject.beans.LoanApplicationBean; import com.tyss.capgemini.loanproject.beans.LoanTypeBean;; public class Repository { static Scanner scanner = new Scanner(System.in); public static final List<HashMap<String, Object>> CLIENT_LIST = new ArrayList<HashMap<String,Object>>(); public static final List<HashMap<String, Object>> ADMIN_LIST = new ArrayList<HashMap<String, Object>>(); public static final List<HashMap<String, Object>> CUSTOMER_LIST = new ArrayList<HashMap<String, Object>>(); public static final List<HashMap<String, Object>> LAD_LIST = new ArrayList<HashMap<String, Object>>(); public static final List<HashMap<String, Object>> MAIN_LIST = new ArrayList<HashMap<String, Object>>(); public static final List<HashMap<String, Object>> LOANTYPE_LIST = new ArrayList<HashMap<String, Object>>(); public static final List<HashMap<String, Object>> LOANFORM_LIST = new ArrayList<HashMap<String, Object>>(); public static final List<HashMap<String, Object>> EMPLOYEE_LIST = new ArrayList<HashMap<String,Object>>(); public static final List<Integer> APPLICATION_ID_LIST = new ArrayList<Integer>(); public static void UserTable() { APPLICATION_ID_LIST.add(1); APPLICATION_ID_LIST.add(2); APPLICATION_ID_LIST.add(3); APPLICATION_ID_LIST.add(4); // Admins EmployeeBean bean1 = new EmployeeBean("mayank191", "mayank.p@gmail.com", "Qwerty@123", "Mayank", "Singh", 7618723945L, "admin"); HashMap<String, Object> user1 = new LinkedHashMap<String, Object>(); user1.put("password", bean1.getPassword()); user1.put("username", bean1.getUsername()); user1.put("email", bean1.getEmail()); user1.put("firstname", bean1.getFirstname()); user1.put("lastname", bean1.getLastname()); user1.put("phone", bean1.getPhone()); user1.put("role", bean1.getRole()); ADMIN_LIST.add(user1); MAIN_LIST.add(user1); EMPLOYEE_LIST.add(user1); EmployeeBean bean2 = new EmployeeBean("ritam191", "ritam.p@gmail.com", "Qwerty@123", "Ritam", "Roy", 7618721134L, "admin"); HashMap<String, Object> user2 = new LinkedHashMap<String, Object>(); user2.put("password", bean2.getPassword()); user2.put("username", bean2.getUsername()); user2.put("email", bean2.getEmail()); user2.put("firstname", bean2.getFirstname()); user2.put("lastname", bean2.getLastname()); user2.put("phone", bean2.getPhone()); user2.put("role", bean2.getRole()); ADMIN_LIST.add(user2); MAIN_LIST.add(user2); EMPLOYEE_LIST.add(user2); EmployeeBean bean3 = new EmployeeBean("amlan191", "amlan.p@gmail.com", "Qwerty@123", "Amlan", "Dutta", 7612321135L, "admin"); HashMap<String, Object> user3 = new LinkedHashMap<String, Object>(); user3.put("password", bean3.getPassword()); user3.put("username", bean3.getUsername()); user3.put("email", bean3.getEmail()); user3.put("firstname", bean3.getFirstname()); user3.put("lastname", bean3.getLastname()); user3.put("phone", bean3.getPhone()); user3.put("role", bean3.getRole()); ADMIN_LIST.add(user3); MAIN_LIST.add(user3); EMPLOYEE_LIST.add(user3); EmployeeBean bean4 = new EmployeeBean("rahul191", "rahul.p@gmail.com", "Qwerty@123", "Rahul", "Yadav", 7618711678L, "admin"); HashMap<String, Object> user4 = new LinkedHashMap<String, Object>(); user4.put("password", bean4.getPassword()); user4.put("username", bean4.getUsername()); user4.put("email", bean4.getEmail()); user4.put("firstname", bean4.getFirstname()); user4.put("lastname", bean4.getLastname()); user4.put("phone", bean4.getPhone()); user4.put("role", bean4.getRole()); ADMIN_LIST.add(user4); MAIN_LIST.add(user4); EMPLOYEE_LIST.add(user4); EmployeeBean bean5 = new EmployeeBean("anand191", "anand.p@gmail.com", "Qwerty@123", "Anand", "Sharma", 7618312345L, "admin"); HashMap<String, Object> user5 = new LinkedHashMap<String, Object>(); user5.put("password", bean5.getPassword()); user5.put("username", bean5.getUsername()); user5.put("email", bean5.getEmail()); user5.put("firstname", bean5.getFirstname()); user5.put("lastname", bean5.getLastname()); user5.put("phone", bean5.getPhone()); user5.put("role", bean5.getRole()); ADMIN_LIST.add(user5); MAIN_LIST.add(user5); EMPLOYEE_LIST.add(user5); // Customer. CustomerBean bean6 = new CustomerBean("manoj191", "manoj.p@gmail.com", "Qwerty@123", "Manoj", "Sharma", 7613412385L, "customer", 90987.12, 60890); HashMap<String, Object> user6 = new LinkedHashMap<String, Object>(); user6.put("password", bean6.getPassword()); user6.put("username", bean6.getUsername()); user6.put("email", bean6.getEmail()); user6.put("firstname", bean6.getFirstname()); user6.put("lastname", bean6.getLastname()); user6.put("phone", bean6.getPhone()); user6.put("AccountBal", bean6.getAccountBal()); user6.put("role", bean6.getRole()); user6.put("loanAmount", bean6.getLoanAmount()); CUSTOMER_LIST.add(user6); MAIN_LIST.add(user6); CustomerBean bean7 = new CustomerBean("shreya191","shreya.p@gmail.com", "Qwerty@123", "Shreya", "Singh", 7613423385L, "customer", 60987.2, 90700); HashMap<String, Object> user7 = new LinkedHashMap<String, Object>(); user7.put("password", bean7.getPassword()); user7.put("username", bean7.getUsername()); user7.put("email", bean7.getEmail()); user7.put("firstname", bean7.getFirstname()); user7.put("lastname", bean7.getLastname()); user7.put("phone", bean7.getPhone()); user7.put("AccountBal", bean7.getAccountBal()); user7.put("role", bean7.getRole()); user7.put("loanAmount", bean7.getLoanAmount()); CUSTOMER_LIST.add(user7); MAIN_LIST.add(user7); CustomerBean bean8 = new CustomerBean("senku191", "senku.p@gmail.com", "Qwerty@123", "Senku", "Manohar", 7613412345L, "customer", 103567.2, 60000); HashMap<String, Object> user8 = new LinkedHashMap<String, Object>(); user8.put("password", bean8.getPassword()); user8.put("username", bean8.getUsername()); user8.put("email", bean8.getEmail()); user8.put("firstname", bean8.getFirstname()); user8.put("lastname", bean8.getLastname()); user8.put("phone", bean8.getPhone()); user8.put("AccountBal", bean8.getAccountBal()); user8.put("role", bean8.getRole()); user8.put("loanAmount", bean8.getLoanAmount()); CUSTOMER_LIST.add(user8); MAIN_LIST.add(user8); CustomerBean bean9 = new CustomerBean("tarushi191", "tarushi.p@gmail.com", "Qwerty@123", "Tarushi", "Verma", 7613423445L, "customer", 37657.0, 30000); HashMap<String, Object> user9 = new LinkedHashMap<String, Object>(); user9.put("password", bean9.getPassword()); user9.put("username", bean9.getUsername()); user9.put("email", bean9.getEmail()); user9.put("firstname", bean9.getFirstname()); user9.put("lastname", bean9.getLastname()); user9.put("phone", bean9.getPhone()); user9.put("AccountBal", bean9.getAccountBal()); user9.put("role", bean9.getRole()); user9.put("loanAmount", bean9.getLoanAmount()); CUSTOMER_LIST.add(user9); MAIN_LIST.add(user9); CustomerBean bean10 = new CustomerBean("poonam191", "poonam.p@gmail.com", "Qwerty@123", "Poonam", "Raghuwanshi", 7613423490L, "customer", 78985.8, 78000); HashMap<String, Object> user10 = new LinkedHashMap<String, Object>(); user10.put("password", bean10.getPassword()); user10.put("username", bean10.getUsername()); user10.put("email", bean10.getEmail()); user10.put("firstname", bean10.getFirstname()); user10.put("lastname", bean10.getLastname()); user10.put("phone", bean10.getPhone()); user10.put("AccountBal", bean10.getAccountBal()); user10.put("role", bean10.getRole()); user10.put("loanAmount", bean10.getLoanAmount()); CUSTOMER_LIST.add(user10); MAIN_LIST.add(user10); // LoanApprovalDepartment EmployeeBean bean11 = new EmployeeBean("saswat191", "Saswat.p@gmail.com", "Qwerty@123", "Saswat", "Biswas", 7613424567L, "L.A.D"); HashMap<String, Object> user11 = new LinkedHashMap<String, Object>(); user11.put("password", bean11.getPassword()); user11.put("username", bean11.getUsername()); user11.put("email", bean11.getEmail()); user11.put("firstname", bean11.getFirstname()); user11.put("lastname", bean11.getLastname()); user11.put("phone", bean11.getPhone()); user11.put("role", bean11.getRole()); LAD_LIST.add(user11); MAIN_LIST.add(user11); CLIENT_LIST.add(user11); EMPLOYEE_LIST.add(user11); EmployeeBean bean12 = new EmployeeBean("shrawani191", "shrawani.p@gmail.com", "Qwerty@123", "Shrawani", "Rowdy", 7613423445L, "L.A.D"); HashMap<String, Object> user12 = new LinkedHashMap<String, Object>(); user12.put("password", bean12.getPassword()); user12.put("username", bean12.getUsername()); user12.put("email", bean12.getEmail()); user12.put("firstname", bean12.getFirstname()); user12.put("lastname", bean12.getLastname()); user12.put("phone", bean12.getPhone()); user12.put("role", bean12.getRole()); LAD_LIST.add(user12); MAIN_LIST.add(user12); CLIENT_LIST.add(user12); EMPLOYEE_LIST.add(user12); EmployeeBean bean13 = new EmployeeBean("divya191", "divya.p@gmail.com", "Qwerty@123", "Divya", "Somaraju", 7613423490L, "L.A.D"); HashMap<String, Object> user13 = new LinkedHashMap<String, Object>(); user13.put("password", bean13.getPassword()); user13.put("username", bean13.getUsername()); user13.put("email", bean13.getEmail()); user13.put("firstname", bean13.getFirstname()); user13.put("lastname", bean13.getLastname()); user13.put("phone", bean13.getPhone()); user13.put("role", bean13.getRole()); LAD_LIST.add(user13); MAIN_LIST.add(user13); CLIENT_LIST.add(user13); EMPLOYEE_LIST.add(user3); // LoanTable LoanTypeBean loanBean1 = new LoanTypeBean("House Loan", "20 years(Max)", "9.75 %"); HashMap<String, Object> loan1 = new LinkedHashMap<String, Object>(); loan1.put("Type", loanBean1.getLoanType()); loan1.put("Time-Period", loanBean1.getTimePeriod()); loan1.put("Interest-Rates", loanBean1.getInterestRates()); LOANTYPE_LIST.add(loan1); LoanTypeBean loanBean2 = new LoanTypeBean("House Construction Loan", "40 years(Max)", "11.0 %"); HashMap<String, Object> loan2 = new LinkedHashMap<String, Object>(); loan2.put("Type", loanBean2.getLoanType()); loan2.put("Time-Period", loanBean2.getTimePeriod()); loan2.put("Interest-Rates", loanBean2.getInterestRates()); LOANTYPE_LIST.add(loan2); LoanTypeBean loanBean3 = new LoanTypeBean("Educational Loan", "5 years(Max)", "11.5 %"); HashMap<String, Object> loan3 = new LinkedHashMap<String, Object>(); loan3.put("Type", loanBean3.getLoanType()); loan3.put("Time-Period", loanBean3.getTimePeriod()); loan3.put("Interest-Rates", loanBean3.getInterestRates()); LOANTYPE_LIST.add(loan3); LoanTypeBean loanBean5 = new LoanTypeBean("Land Purchase Loan", "20 years(Max)", "14.2 %"); HashMap<String, Object> loan5 = new LinkedHashMap<String, Object>(); loan5.put("Type", loanBean5.getLoanType()); loan5.put("Time-Period", loanBean5.getTimePeriod()); loan5.put("Interest-Rates", loanBean5.getInterestRates()); LOANTYPE_LIST.add(loan5); LoanTypeBean loanBean6 = new LoanTypeBean("Personal Loan", "5 years(Max)", "11.14 %"); HashMap<String, Object> loan6 = new LinkedHashMap<String, Object>(); loan6.put("Type", loanBean6.getLoanType()); loan6.put("Time-Period", loanBean6.getTimePeriod()); loan6.put("Interest-Rates", loanBean6.getInterestRates()); LOANTYPE_LIST.add(loan6); LoanApplicationBean loanApplicationForm1 = new LoanApplicationBean("1", "BNI12345", "manoj.p@gmail.com", "Manoj", "Sharma", "", "14/3/1973", "Meghna", "Singh", "", "Personal Loan", "BNI22343456", "Cannaught Circle", "approved", "50000"); HashMap<String, Object> form1 = new LinkedHashMap<String, Object>(); form1.put("ApplicationId", loanApplicationForm1.getApplicationId()); form1.put("Email", loanApplicationForm1.getEmail()); form1.put("AccountNo", loanApplicationForm1.getAccountNo()); form1.put("ApplicantName", loanApplicationForm1.getApplicantFirstName() + " " + loanApplicationForm1.getApplicantMiddleName() + " " + loanApplicationForm1.getApplicantLastName()); form1.put("DateOfBirth", loanApplicationForm1.getDateOfBirth()); form1.put("CoApplicantName", loanApplicationForm1.getCoapplicantFirstName() + " " + loanApplicationForm1.getCoapplicantMiddleName() + " " + loanApplicationForm1.getCoapplicantLastName()); form1.put("LoanType", loanApplicationForm1.getLoanChoice()); form1.put("BranchCode", loanApplicationForm1.getBranchCode()); form1.put("BranchName", loanApplicationForm1.getBranchName()); form1.put("LoanStatus", loanApplicationForm1.getFormStatus()); form1.put("LoanAmount", loanApplicationForm1.getLoanAmount()); LOANFORM_LIST.add(form1); //CLIENT_LIST.add(form1); LoanApplicationBean loanApplicationForm4 = new LoanApplicationBean("4", "BNI12345", "shreya.p@gmail.com", "Shreya", "Singh", "", "14/3/1973", "Meghna", "Singh", "", "Personal Loan", "BNI22343456", "Cannaught Circle", "approved", "30000"); HashMap<String, Object> form4 = new LinkedHashMap<String, Object>(); form4.put("ApplicationId", loanApplicationForm4.getApplicationId()); form4.put("AccountNo", loanApplicationForm4.getAccountNo()); form4.put("Email", loanApplicationForm4.getEmail()); form4.put("ApplicantName", loanApplicationForm4.getApplicantFirstName() + " " + loanApplicationForm4.getApplicantMiddleName() + " " + loanApplicationForm4.getApplicantLastName()); form4.put("DateOfBirth", loanApplicationForm4.getDateOfBirth()); form4.put("CoApplicantName", loanApplicationForm4.getCoapplicantFirstName() + " " + loanApplicationForm4.getCoapplicantMiddleName() + " " + loanApplicationForm4.getCoapplicantLastName()); form4.put("LoanType", loanApplicationForm4.getLoanChoice()); form4.put("BranchCode", loanApplicationForm4.getBranchCode()); form4.put("BranchName", loanApplicationForm4.getBranchName()); form4.put("LoanStatus", loanApplicationForm4.getFormStatus()); form4.put("LoanAmount", loanApplicationForm1.getLoanAmount()); LOANFORM_LIST.add(form4); LoanApplicationBean loanApplicationForm2 = new LoanApplicationBean("2", "BNI22345", "senku.p@gmail.com", "Senku", "Manohar", "", "14/3/1973", "Shiv", "Kumar", "Rajput", "House Construction Loan", "BNI33343456", "Cannaught Bank", "rejected", "1000000"); HashMap<String, Object> form2 = new LinkedHashMap<String, Object>(); form2.put("ApplicationId", loanApplicationForm2.getApplicationId()); form2.put("AccountNo", loanApplicationForm2.getAccountNo()); form2.put("Email", loanApplicationForm2.getEmail()); form2.put("ApplicantName", loanApplicationForm2.getApplicantFirstName() + " " + loanApplicationForm2.getApplicantMiddleName() + " " + loanApplicationForm2.getApplicantLastName()); form2.put("DateOfBirth",loanApplicationForm2.getDateOfBirth()); form2.put("CoApplicantName", loanApplicationForm2.getCoapplicantFirstName() + " " + loanApplicationForm2.getCoapplicantMiddleName() + " " + loanApplicationForm2.getCoapplicantLastName()); form2.put("LoanType", loanApplicationForm2.getLoanChoice()); form2.put("BranchCode", loanApplicationForm2.getBranchCode()); form2.put("BranchName", loanApplicationForm2.getBranchName()); form2.put("LoanStatus", loanApplicationForm2.getFormStatus()); form2.put("LoanAmount", loanApplicationForm1.getLoanAmount()); LOANFORM_LIST.add(form2); LoanApplicationBean loanApplicationForm3 = new LoanApplicationBean("3", "BNI21145", "tarushi.p@gmail.com", "Tarushi", "Verma", "", "14/3/1973", "Anjali", "Kumari", "", "Educational Loan", "BNI13311456", "Purani Delhi", "requested", "20000"); HashMap<String, Object> form3 = new LinkedHashMap<String, Object>(); form3.put("ApplicationId", loanApplicationForm3.getApplicationId()); form3.put("AccountNo", loanApplicationForm3.getAccountNo()); form3.put("Email", loanApplicationForm3.getEmail()); form3.put("ApplicantName", loanApplicationForm3.getApplicantFirstName() + " " + loanApplicationForm3.getApplicantMiddleName() + " " + loanApplicationForm3.getApplicantLastName()); form3.put("DateOfBirth", loanApplicationForm3.getDateOfBirth()); form3.put("CoApplicantName", loanApplicationForm3.getCoapplicantFirstName() + " " + loanApplicationForm3.getCoapplicantMiddleName() + " " + loanApplicationForm3.getCoapplicantLastName()); form3.put("LoanType", loanApplicationForm3.getLoanChoice()); form3.put("BranchCode", loanApplicationForm3.getBranchCode()); form3.put("BranchName", loanApplicationForm3.getBranchName()); form3.put("LoanStatus", loanApplicationForm3.getFormStatus()); form3.put("LoanAmount", loanApplicationForm1.getLoanAmount()); LOANFORM_LIST.add(form3); } }
/* * 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 mainalquiler; import java.util.ArrayList; /** * * @author ivandavid */ public class Alquiler { private ArrayList<Vehiculo> vehiculo; public Alquiler() { this.vehiculo=new ArrayList<>(); } public void añadirVehiculo(Vehiculo vh){ vehiculo.add(vh); } public void mostrarVehiculo(){ for (Vehiculo vehiculom : vehiculo) { if(vehiculom.getKilometraje() <= 200 && vehiculom.getKilometraje() >= 100 ){ System.out.println(vehiculom); } } } public ArrayList<Vehiculo> getVehiculo() { return vehiculo; } public void setVehiculo(ArrayList<Vehiculo> vehiculo) { this.vehiculo = vehiculo; } @Override public String toString() { return "Alquiler{" + "vehiculo=" + vehiculo + '}'; } }
package com.goldgov.dygl.module.partyorganization.service; import java.util.List; import java.util.Map; import com.goldgov.dygl.module.partymember.exception.NoAuthorizedFieldException; import com.goldgov.gtiles.module.businessfield.service.BusinessField; public interface IPartyOrganizationService_AC_A { List<Map<String, Object>> findInfoByACIds(String[] entityIDs) throws NoAuthorizedFieldException; String addInfo(Map<String, Object> paramMap) throws NoAuthorizedFieldException; void updateInfo(String entityID, Map<String, Object> paramMap) throws NoAuthorizedFieldException; void deleteInfo(String[] entityIDs) throws NoAuthorizedFieldException; List<BusinessField> findInfoById(String entityID) throws NoAuthorizedFieldException; List<Map<String, Object>> findInfoList(PartyOrganizationQuery query, Map<String, Object> paramMap) throws NoAuthorizedFieldException; List<BusinessField> preAddInfo() throws NoAuthorizedFieldException; public void addUserRole(String userId,String partyMemberID,String partyOrgID); public void deleteInfoOnOrgID(String partyOrganizationID,String[] entityIDs); public void deleteInfoOnOrgID_ACID(String partyOrganizationID,String[] entityIDs); public void updateRoleStatus(String partyOrgID,String[] acaID,Integer acticeStatus); public void deleteInfoRole_ACID(String partyOrganizationID,String[] entityIDs); }
/* * This file is part of AceQL * AceQL: Remote JDBC access over HTTP. * Copyright (C) 2015, KawanSoft SAS * (http://www.kawansoft.com). All rights reserved. * AceQL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Any modifications to this file must keep this entire header * intact. */ package org.kawanfw.sql.api.client.android; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; //import org.kawanfw.sql.api.client.RemoteDriver; /** * This example: * <ul> * <li>Inserts a Customer and an Order on a remote database.</li> * </li>Displays the inserted raws on the console with two SELECT executed on * the remote database.</li> * </ul> * * @author Nicolas de Pomereu */ public class BackendConnection { /** * The JDBC Connection to the remote AceQL Server */ Connection connection = null; /** * Constructor * * @param connection the AwakeConnection to use for this session */ public BackendConnection(Connection connection) { this.connection = connection; } /** * RemoteConnection Quick Start client example. Creates a Connection to a * remote database. * * @return the Connection to the remote database * @throws SQLException if a database access error occurs */ public static Connection remoteConnectionBuilder(String url, String username, String password) throws SQLException { // Required for Android, optional for others environments: try { //ClassNotFoundException if AceQL client jar is not in the classpath Class.forName("org.kawanfw.sql.api.client.RemoteDriver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } // Attempt to establish a connection to the remote database: return DriverManager.getConnection(url, username, password); } public void close() throws SQLException { connection.close(); } public PreparedStatement prepareStatement(String sql) throws SQLException { return connection.prepareStatement(sql); } public Connection getConnection() { return connection; } }
// Sun Certified Java Programmer // Chapter 7, P601 // Generics and Collections // a Java 5 class using a generic collection import java.util.*; public class TestLegacy { public static void main(String[] args) { List<Integer> myList = new ArrayList<Integer>(); // type safe collection myList.add(4); myList.add(6); Adder adder = new Adder(); int total = adder.addAll(myList); // pass it to an untyped argument System.out.println(total); } }
package com.pkjiao.friends.mm.share; public interface CallbackListener { public abstract void onSuccess(); public abstract void onFailure(); public abstract void onCancel(); }
package com.uwetrottmann.trakt5.entities; import com.google.gson.annotations.SerializedName; import org.threeten.bp.OffsetDateTime; public class User { public String username; @SerializedName("private") public Boolean isPrivate; public String name; /** If a user is a regular VIP. */ public Boolean vip; /** If a user is an execute producer. */ public Boolean vip_ep; public UserIds ids; // full public OffsetDateTime joined_at; public String location; public String about; public String gender; public int age; public Images images; public static class UserIds { public String slug; } }
import java.util.ArrayList; public class No implements Comparable<No>{ private EstadoTabuleiro estado; private No pai; private ArrayList<No> filhos; private int custoHeuristica; // h(n). private int custoCaminho; // g(n) private int f; // f(n) = g(n) + h(n) private int estrategia; public No(EstadoTabuleiro estado) { this.estado = estado; this.pai = null; this.custoHeuristica = 0; this.custoCaminho = 0; this.filhos = new ArrayList(); this.estrategia = 0; } public No(EstadoTabuleiro estado, int estrategia) { this.estado = estado; this.pai = null; this.custoHeuristica = 0; this.custoCaminho = 0; this.filhos = new ArrayList(); this.estrategia = estrategia; } public void setCustoHeuristica(int custo) { this.custoHeuristica = custo; } public int getCustoHeuristica() { if(estrategia == 1) { return f; } else { return custoHeuristica; } } public int getCustoCaminho() { return custoCaminho; } public void setCustoCaminho(int custo) { custoCaminho = custo; } public boolean addFilho(No filho) { No pai = this; while(pai!=null) { if(pai.estado.compararCom(filho.estado)) { return false; } pai = pai.pai; } filho.pai = this; filho.custoCaminho = custoCaminho + 1; filho.f = filho.custoCaminho + filho.custoHeuristica; filhos.add(filho); return true; } public No getPai() { return pai; } public EstadoTabuleiro getEstadoTabuleiro() { return estado; } public ArrayList<No> getFilhos(){ return filhos; } @Override public int compareTo(No t) { if(t.getCustoHeuristica() < getCustoHeuristica()) { return 1; } if(t.getCustoHeuristica() > getCustoHeuristica()) { return -1; } return 0; } }
package com.nmhung.model; import lombok.Data; @Data public class SubjectModel { private Integer id; private String name; private Integer totalLesson; public SubjectModel(Integer id, String name, Integer totalLesson) { this.id = id; this.name = name; this.totalLesson = totalLesson; } public SubjectModel() { } }
package com.lyz.databinding.adapter; import android.support.v7.widget.RecyclerView; import android.view.View; import com.lyz.databinding.bean.DataModel; /** * TypeAbstractViewHolder.java * Author: liyanzhen * Date: 17/4/22 * * 编码格式: utf-8 * 开发单位: 中南大学软件学院嵌入式与网络实验室 * 版权: 本文件版权归属于长沙洋华机电设备有限公司 */ public abstract class TypeAbstractViewHolder extends RecyclerView.ViewHolder { public TypeAbstractViewHolder(View view) { super(view); } public abstract void bindHolder(DataModel data); }
package com.Collections_TreeSetUsingNavigateSetInterface; public class IterateElement { }
package com.sample.app; public class Shark extends Fish { private Fish food; public Shark() { setSize(Size.LARGE); setColor(Color.GRAY); } public Fish getFood() { return food; } public void setFood(Fish food) { this.food = food; } void eat(Fish food) { this.food = food; } }
package com.baidu.camera.template; import android.view.MotionEvent; import com.badlogic.gdx.ApplicationAdapter; import com.baidu.camera.template.module.TemplateScene; /** * Created by yangmengrong on 14-8-26. */ public interface TemplateModule { void open(); void open(TemplateScene tempItem); void close(); boolean isOpened(); ApplicationAdapter getApplicationAdapter(); void saveTemplate(); }
package potentialtrain; import view.MainView; import java.io.File; public class Main { public static final String LOGO_PATH = "assets"+ File.separator+"logo.jpg"; public static void main(String[] args) { MainView.main(args); } }
package android.support.design.widget; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.database.DataSetObserver; import android.support.design.a.d; import android.support.design.a.h; import android.support.design.a.i; import android.support.v4.e.i.a; import android.support.v4.e.i.b; import android.support.v4.e.i.c; import android.support.v4.view.ViewPager; import android.support.v4.view.u; import android.support.v4.view.z; import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.widget.FrameLayout.LayoutParams; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import java.util.ArrayList; import java.util.Iterator; public class TabLayout extends HorizontalScrollView { private static final a<d> hj = new c(); private int hA; private int hB; private a hC; private u hD; private ViewPager hE; private u hF; private DataSetObserver hG; private e hH; private final a<f> hI; private final ArrayList<d> hk; private d hl; private final c hm; private int hn; private int ho; private int hp; private int hq; private int hr; private ColorStateList hs; private float ht; private float hu; private final int hv; private int hw; private final int hx; private final int hy; private final int hz; private int mMode; public TabLayout(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public TabLayout(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.hk = new ArrayList(); this.hw = Integer.MAX_VALUE; this.hI = new b(12); t.G(context); setHorizontalScrollBarEnabled(false); this.hm = new c(this, context); super.addView(this.hm, 0, new LayoutParams(-2, -1)); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, i.TabLayout, i, h.Widget_Design_TabLayout); this.hm.M(obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabIndicatorHeight, 0)); this.hm.L(obtainStyledAttributes.getColor(i.TabLayout_tabIndicatorColor, 0)); int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabPadding, 0); this.hq = dimensionPixelSize; this.hp = dimensionPixelSize; this.ho = dimensionPixelSize; this.hn = dimensionPixelSize; this.hn = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabPaddingStart, this.hn); this.ho = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabPaddingTop, this.ho); this.hp = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabPaddingEnd, this.hp); this.hq = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabPaddingBottom, this.hq); this.hr = obtainStyledAttributes.getResourceId(i.TabLayout_tabTextAppearance, h.TextAppearance_Design_Tab); TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(this.hr, i.TextAppearance); try { this.ht = (float) obtainStyledAttributes2.getDimensionPixelSize(i.TextAppearance_android_textSize, 0); this.hs = obtainStyledAttributes2.getColorStateList(i.TextAppearance_android_textColor); if (obtainStyledAttributes.hasValue(i.TabLayout_tabTextColor)) { this.hs = obtainStyledAttributes.getColorStateList(i.TabLayout_tabTextColor); } if (obtainStyledAttributes.hasValue(i.TabLayout_tabSelectedTextColor)) { dimensionPixelSize = obtainStyledAttributes.getColor(i.TabLayout_tabSelectedTextColor, 0); int defaultColor = this.hs.getDefaultColor(); r3 = new int[2][]; int[] iArr = new int[]{SELECTED_STATE_SET, dimensionPixelSize}; r3[1] = EMPTY_STATE_SET; iArr[1] = defaultColor; this.hs = new ColorStateList(r3, iArr); } this.hx = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabMinWidth, -1); this.hy = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabMaxWidth, -1); this.hv = obtainStyledAttributes.getResourceId(i.TabLayout_tabBackground, 0); this.hA = obtainStyledAttributes.getDimensionPixelSize(i.TabLayout_tabContentStart, 0); this.mMode = obtainStyledAttributes.getInt(i.TabLayout_tabMode, 1); this.hB = obtainStyledAttributes.getInt(i.TabLayout_tabGravity, 0); obtainStyledAttributes.recycle(); Resources resources = getResources(); this.hu = (float) resources.getDimensionPixelSize(d.design_tab_text_size_2line); this.hz = resources.getDimensionPixelSize(d.design_tab_scrollable_min_width); aI(); } finally { obtainStyledAttributes2.recycle(); } } public void setSelectedTabIndicatorColor(int i) { this.hm.L(i); } public void setSelectedTabIndicatorHeight(int i) { this.hm.M(i); } private void setScrollPosition$4867b5c2(int i) { a(i, 0.0f, true, true); } private void a(int i, float f, boolean z, boolean z2) { int round = Math.round(((float) i) + f); if (round >= 0 && round < this.hm.getChildCount()) { if (z2) { c cVar = this.hm; if (cVar.hQ != null && cVar.hQ.iO.isRunning()) { cVar.hQ.iO.cancel(); } cVar.hM = i; cVar.hN = f; cVar.aJ(); } if (this.hD != null && this.hD.iO.isRunning()) { this.hD.iO.cancel(); } scrollTo(b(i, f), 0); if (z) { setSelectedTabView(round); } } } private float getScrollPosition() { c cVar = this.hm; return cVar.hN + ((float) cVar.hM); } private void a(d dVar, boolean z) { if (dVar.ia != this) { throw new IllegalArgumentException("Tab belongs to a different TabLayout."); } f fVar = dVar.ib; c cVar = this.hm; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -1); a(layoutParams); cVar.addView(fVar, layoutParams); if (z) { fVar.setSelected(true); } a(dVar, this.hk.size()); if (z) { dVar.select(); } } public void setOnTabSelectedListener(a aVar) { this.hC = aVar; } private d aG() { d dVar; d dVar2 = (d) hj.bW(); if (dVar2 == null) { dVar = new d((byte) 0); } else { dVar = dVar2; } dVar.ia = this; f fVar = this.hI != null ? (f) this.hI.bW() : null; if (fVar == null) { fVar = new f(this, getContext()); } f.a(fVar, dVar); fVar.setFocusable(true); fVar.setMinimumWidth(getTabMinWidth()); dVar.ib = fVar; return dVar; } public int getTabCount() { return this.hk.size(); } public final d I(int i) { return (d) this.hk.get(i); } public int getSelectedTabPosition() { return this.hl != null ? this.hl.mPosition : -1; } private void removeAllTabs() { for (int childCount = this.hm.getChildCount() - 1; childCount >= 0; childCount--) { f fVar = (f) this.hm.getChildAt(childCount); this.hm.removeViewAt(childCount); if (fVar != null) { f.a(fVar); this.hI.j(fVar); } requestLayout(); } Iterator it = this.hk.iterator(); while (it.hasNext()) { d dVar = (d) it.next(); it.remove(); dVar.ia = null; dVar.ib = null; dVar.hX = null; dVar.hh = null; dVar.mText = null; dVar.hY = null; dVar.mPosition = -1; dVar.hZ = null; hj.j(dVar); } this.hl = null; } public void setTabMode(int i) { if (i != this.mMode) { this.mMode = i; aI(); } } public int getTabMode() { return this.mMode; } public void setTabGravity(int i) { if (this.hB != i) { this.hB = i; aI(); } } public int getTabGravity() { return this.hB; } public void setTabTextColors(ColorStateList colorStateList) { if (this.hs != colorStateList) { this.hs = colorStateList; int size = this.hk.size(); for (int i = 0; i < size; i++) { ((d) this.hk.get(i)).aL(); } } } public ColorStateList getTabTextColors() { return this.hs; } public void setupWithViewPager(ViewPager viewPager) { e eVar; if (!(this.hE == null || this.hH == null)) { ViewPager viewPager2 = this.hE; eVar = this.hH; if (viewPager2.wJ != null) { viewPager2.wJ.remove(eVar); } } if (viewPager != null) { u adapter = viewPager.getAdapter(); if (adapter == null) { throw new IllegalArgumentException("ViewPager does not have a PagerAdapter set"); } this.hE = viewPager; if (this.hH == null) { this.hH = new e(this); } eVar = this.hH; eVar.if = 0; eVar.ie = 0; viewPager.a(this.hH); setOnTabSelectedListener(new g(viewPager)); a(adapter, true); return; } this.hE = null; setOnTabSelectedListener(null); a(null, true); } @Deprecated public void setTabsFromPagerAdapter(u uVar) { a(uVar, false); } public boolean shouldDelayChildPressedState() { return getTabScrollRange() > 0; } private int getTabScrollRange() { return Math.max(0, ((this.hm.getWidth() - getWidth()) - getPaddingLeft()) - getPaddingRight()); } private void a(u uVar, boolean z) { if (!(this.hF == null || this.hG == null)) { this.hF.unregisterDataSetObserver(this.hG); } this.hF = uVar; if (z && uVar != null) { if (this.hG == null) { this.hG = new b(this, (byte) 0); } uVar.registerDataSetObserver(this.hG); } aH(); } private void aH() { removeAllTabs(); if (this.hF != null) { int i; int count = this.hF.getCount(); for (i = 0; i < count; i++) { a(aG().a(this.hF.cb()), false); } if (this.hE != null && count > 0) { i = this.hE.getCurrentItem(); if (i != getSelectedTabPosition() && i < getTabCount()) { b(I(i), true); return; } return; } return; } removeAllTabs(); } private void a(d dVar, int i) { dVar.mPosition = i; this.hk.add(i, dVar); int size = this.hk.size(); for (int i2 = i + 1; i2 < size; i2++) { ((d) this.hk.get(i2)).mPosition = i2; } } public void addView(View view) { t(view); } public void addView(View view, int i) { t(view); } public void addView(View view, ViewGroup.LayoutParams layoutParams) { t(view); } public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { t(view); } private void t(View view) { if (view instanceof TabItem) { TabItem tabItem = (TabItem) view; d aG = aG(); if (tabItem.mText != null) { aG.a(tabItem.mText); } if (tabItem.hh != null) { aG.hh = tabItem.hh; aG.aL(); } if (tabItem.hi != 0) { aG.hZ = LayoutInflater.from(aG.ib.getContext()).inflate(tabItem.hi, aG.ib, false); aG.aL(); } a(aG, this.hk.isEmpty()); return; } throw new IllegalArgumentException("Only TabItem instances can be added to TabLayout"); } private void a(LinearLayout.LayoutParams layoutParams) { if (this.mMode == 1 && this.hB == 0) { layoutParams.width = 0; layoutParams.weight = 1.0f; return; } layoutParams.width = -2; layoutParams.weight = 0.0f; } private int J(int i) { return Math.round(getResources().getDisplayMetrics().density * ((float) i)); } protected void onMeasure(int i, int i2) { int i3 = 1; int J = (J(getDefaultHeight()) + getPaddingTop()) + getPaddingBottom(); switch (MeasureSpec.getMode(i2)) { case Integer.MIN_VALUE: i2 = MeasureSpec.makeMeasureSpec(Math.min(J, MeasureSpec.getSize(i2)), 1073741824); break; case 0: i2 = MeasureSpec.makeMeasureSpec(J, 1073741824); break; } J = MeasureSpec.getSize(i); if (MeasureSpec.getMode(i) != 0) { if (this.hy > 0) { J = this.hy; } else { J -= J(56); } this.hw = J; } super.onMeasure(i, i2); if (getChildCount() == 1) { View childAt = getChildAt(0); switch (this.mMode) { case 0: if (childAt.getMeasuredWidth() >= getMeasuredWidth()) { J = 0; break; } else { J = 1; break; } case 1: if (childAt.getMeasuredWidth() == getMeasuredWidth()) { i3 = 0; } J = i3; break; default: J = 0; break; } if (J != 0) { childAt.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), getChildMeasureSpec(i2, getPaddingTop() + getPaddingBottom(), childAt.getLayoutParams().height)); } } } private void K(int i) { Object obj = null; if (i != -1) { if (getWindowToken() != null && z.ai(this)) { int i2; c cVar = this.hm; int childCount = cVar.getChildCount(); for (i2 = 0; i2 < childCount; i2++) { if (cVar.getChildAt(i2).getWidth() <= 0) { obj = 1; break; } } if (obj == null) { int scrollX = getScrollX(); i2 = b(i, 0.0f); if (scrollX != i2) { if (this.hD == null) { this.hD = aa.aP(); this.hD.setInterpolator(a.bM); this.hD.setDuration(300); this.hD.a(new 1(this)); } this.hD.i(scrollX, i2); this.hD.iO.start(); } this.hm.h(i, 300); return; } } setScrollPosition$4867b5c2(i); } } private void setSelectedTabView(int i) { int childCount = this.hm.getChildCount(); if (i < childCount && !this.hm.getChildAt(i).isSelected()) { for (int i2 = 0; i2 < childCount; i2++) { boolean z; View childAt = this.hm.getChildAt(i2); if (i2 == i) { z = true; } else { z = false; } childAt.setSelected(z); } } } final void b(d dVar, boolean z) { if (this.hl != dVar) { if (z) { int i = dVar != null ? dVar.mPosition : -1; if (i != -1) { setSelectedTabView(i); } if ((this.hl == null || this.hl.mPosition == -1) && i != -1) { setScrollPosition$4867b5c2(i); } else { K(i); } } this.hl = dVar; if (this.hl != null && this.hC != null) { this.hC.a(this.hl); } } else if (this.hl != null) { K(dVar.mPosition); } } private int b(int i, float f) { int i2 = 0; if (this.mMode != 0) { return 0; } int width; View childAt = this.hm.getChildAt(i); View childAt2 = i + 1 < this.hm.getChildCount() ? this.hm.getChildAt(i + 1) : null; if (childAt != null) { width = childAt.getWidth(); } else { width = 0; } if (childAt2 != null) { i2 = childAt2.getWidth(); } return ((((int) ((((float) (i2 + width)) * f) * 0.5f)) + childAt.getLeft()) + (childAt.getWidth() / 2)) - (getWidth() / 2); } private void aI() { int max; if (this.mMode == 0) { max = Math.max(0, this.hA - this.hn); } else { max = 0; } z.c(this.hm, max, 0, 0, 0); switch (this.mMode) { case 0: this.hm.setGravity(8388611); break; case 1: this.hm.setGravity(1); break; } r(true); } private void r(boolean z) { int i = 0; while (true) { int i2 = i; if (i2 < this.hm.getChildCount()) { View childAt = this.hm.getChildAt(i2); childAt.setMinimumWidth(getTabMinWidth()); a((LinearLayout.LayoutParams) childAt.getLayoutParams()); if (z) { childAt.requestLayout(); } i = i2 + 1; } else { return; } } } private int getDefaultHeight() { Object obj; int size = this.hk.size(); for (int i = 0; i < size; i++) { d dVar = (d) this.hk.get(i); if (dVar != null && dVar.hh != null && !TextUtils.isEmpty(dVar.mText)) { obj = 1; break; } } obj = null; if (obj != null) { return 72; } return 48; } private int getTabMinWidth() { if (this.hx != -1) { return this.hx; } return this.mMode == 0 ? this.hz : 0; } public LayoutParams generateLayoutParams(AttributeSet attributeSet) { return generateDefaultLayoutParams(); } private int getTabMaxWidth() { return this.hw; } }
/* * 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 service; import Modelo.Cliente; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; /** * * @author Robin */ @Stateless @Path("modelo.cliente") public class ClienteFacadeREST extends AbstractFacade<Cliente> { @PersistenceContext(unitName = "TareaBimestralPU") private EntityManager em; public ClienteFacadeREST() { super(Cliente.class); } @POST @Override @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public void create(Cliente entity) { super.create(entity); } @PUT @Path("{id}") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public void edit(@PathParam("id") String id, Cliente entity) { super.edit(entity); } @DELETE @Path("{id}") public void remove(@PathParam("id") String id) { super.remove(super.find(id)); } @GET @Path("{id}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Cliente find(@PathParam("id") String id) { return super.find(id); } @GET @Override @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON}) public List<Cliente> findAll() { return super.findAll(); } @POST @Path("crear") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON}) public String crear (@FormParam("cedula")String cedula,@FormParam("nombre")String nombre,@FormParam("direccion")String direccion,@FormParam("correo")String correo, @FormParam("telefono")String telefono, @FormParam("ciudad")String ciudad,@FormParam("edad")int edad,@FormParam("joyeriaPref")int joyeriaPref) { Cliente ob =new Cliente(cedula, nombre, direccion, correo, telefono, ciudad, edad, joyeriaPref); super.create(ob); return "el objeto se inserto con exito"; } @POST @Path("editar") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON}) public String editar (@FormParam("cedula")String cedula,@FormParam("nombre")String nombre,@FormParam("direccion")String direccion,@FormParam("correo")String correo, @FormParam("telefono")String telefono, @FormParam("ciudad")String ciudad,@FormParam("edad")int edad,@FormParam("joyeriaPref")int joyeriaPref) { Cliente jc = super.find(cedula); jc.setCedula(cedula); jc.setNombre(nombre); jc.setDireccion(direccion); jc.setCorreo(correo); jc.setTelefono(telefono); jc.setCiudad(ciudad); jc.setEdad(edad); jc.setJoyeriaPref(joyeriaPref); super.edit(jc); return ("se actualizo con exito"); } @POST @Path("eliminar") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON}) public String eliminar(@FormParam ("cedula")String cedula){ Cliente jc = super.find(cedula); super.remove(jc); return "se elimino con exito"; } @POST @Path("consultarJoyeria") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON}) public List<Cliente> leerJoyeria(@FormParam("joyeriaPref")int joyeriaPref){ TypedQuery consulta = getEntityManager().createQuery("SELECT c FROM Cliente c WHERE c.joyeriaPref = :joyeriaPref", Cliente.class); consulta.setParameter("joyeriaPref", joyeriaPref); return consulta.getResultList(); } @POST @Path("consultarEdad") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON}) public List<Cliente> leerEdad(@FormParam("edad")int edad){ TypedQuery consulta = getEntityManager().createQuery("SELECT c FROM Cliente c WHERE c.edad = :edad", Cliente.class); consulta.setParameter("edad", edad); return consulta.getResultList(); } @GET @Path("{from}/{to}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public List<Cliente> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { return super.findRange(new int[]{from, to}); } @GET @Path("count") @Produces(MediaType.TEXT_PLAIN) public String countREST() { return String.valueOf(super.count()); } @Override protected EntityManager getEntityManager() { return em; } }
package com.machine.learning.explore.web; import com.machine.learning.explore.Explore; import java.util.List; public class WebExplore implements Explore { @Override public List<String> findExploreUrl() { return null; } @Override public Object findUseInfo() { return null; } }
package com.mercadolibre.desafioquality.DTO.AvailabilityHotelRoomDTOs; import java.util.List; public class ResponseDTO { private String statusCode; private String message; private List<HotelDTO> hotelList; public ResponseDTO(String statusCode, String message, List<HotelDTO> hotelList) { this.statusCode = statusCode; this.message = message; this.hotelList = hotelList; } public List<HotelDTO> getHotelList() { return hotelList; } public void setHotelList(List<HotelDTO> hotelList) { this.hotelList = hotelList; } public String getStatusCode() { return statusCode; } public void setStatusCode(String statusCode) { this.statusCode = statusCode; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
/* Copyright (C) 2009, Bioingenium Research Group http://www.bioingenium.unal.edu.co Author: Alexander Pinzon Fernandez JNukak3D is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. JNukak3D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with JNukak3D; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, or see http://www.gnu.org/copyleft/gpl.html */ package edu.co.unal.bioing.jnukak3d.ui; import edu.co.unal.bioing.jnukak3d.ui.event.nkToolGenerator; import edu.co.unal.bioing.jnukak3d.ui.event.nkToolListener; import edu.co.unal.bioing.jnukak3d.ui.event.nkToolEvent; import javax.swing.Icon; import java.util.Vector; /** * * @author Alexander Pinzon Fernandez */ public class nkTool implements nkToolGenerator { String name; String textHelp; int id; Icon icon; private Vector prv_nkToolEvent_listeners; public nkTool() { this.name = ""; this.textHelp = ""; this.id = -1; this.icon = null; } public nkTool(String name, String textHelp, int id) { this(name, textHelp, id, (Icon)null); } public nkTool(String name, String textHelp, int id, Icon icon) { this.name = name; this.textHelp = textHelp; this.id = id; this.icon = icon; } public Icon getIcon() { return icon; } public void setIcon(Icon icon) { this.icon = icon; } public int getId() { return id; } public String getName() { return name; } public String getTextHelp() { return textHelp; } public void setId(int id) { this.id = id; } public void setName(String name) { this.name = name; } public void setTextHelp(String textHelp) { this.textHelp = textHelp; } final synchronized public void addnkToolListener (nkToolListener pl) { if( null == prv_nkToolEvent_listeners) prv_nkToolEvent_listeners = new Vector(); if( null == pl || prv_nkToolEvent_listeners.contains( pl)) return; prv_nkToolEvent_listeners.addElement( pl); } final synchronized public void removenkToolListener(nkToolListener pl) { if( null != prv_nkToolEvent_listeners && null != pl) prv_nkToolEvent_listeners.removeElement( pl); } public void firenkToolEvent(){ if( null == prv_nkToolEvent_listeners) return; nkToolEvent e = new nkToolEvent(this, id, name); for( int i= 0; i < prv_nkToolEvent_listeners.size(); ++i) ((nkToolListener)prv_nkToolEvent_listeners.elementAt( i)).nkToolInvoke(e); } }
package com.goldgov.dygl.module.partyMemberDuty.duty.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.goldgov.dygl.module.partyMemberDuty.duty.domain.Cycle; import com.goldgov.dygl.module.partyMemberDuty.duty.service.CycleQuery; import com.goldgov.gtiles.core.dao.mybatis.annotation.MybatisRepository; @MybatisRepository("cycleDao") public interface ICycleDao { public void addInfo(Cycle cycle); public void updateInfo(Cycle cycle); public void deleteInfo(@Param("ids") String[] entityIDs); public Cycle findInfoById(@Param("id") String entityID); public List<Cycle> findInfoListByPage(@Param("query") CycleQuery query); }
// Sun Certified Java Programmer // Chapter 8; P677 // Inner Classes class Food { Cookable c = new Cookable() { public void cook() { System.out.println("anonymous cookable implementer"); } }; }
package com.zhowin.miyou.mine.activity; import android.view.View; import com.zhowin.base_library.http.HttpCallBack; import com.zhowin.base_library.utils.ToastUtils; import com.zhowin.miyou.R; import com.zhowin.miyou.base.BaseBindActivity; import com.zhowin.miyou.databinding.ActivityMyWalletBinding; import com.zhowin.miyou.http.HttpRequest; import com.zhowin.miyou.mine.model.MyWalletBalance; /** * 我的钱包 */ public class MyWalletActivity extends BaseBindActivity<ActivityMyWalletBinding> { @Override public int getLayoutId() { return R.layout.activity_my_wallet; } @Override public void initView() { setOnClick(R.id.tvRecharge, R.id.tvExchange); getMyWalletBalance(); } @Override public void initData() { } private void getMyWalletBalance() { showLoadDialog(); HttpRequest.getMyWalletBalance(this, new HttpCallBack<MyWalletBalance>() { @Override public void onSuccess(MyWalletBalance myWalletBalance) { dismissLoadDialog(); if (myWalletBalance != null) { mBinding.tvRechargeNumber.setText(myWalletBalance.getDiamondNum() + ""); mBinding.tvExchangeNumber.setText(myWalletBalance.getCharmValue() + ""); } } @Override public void onFail(int errorCode, String errorMsg) { dismissLoadDialog(); ToastUtils.showToast(errorMsg); } }); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.tvRecharge: MyDiamondActivity.start(mContext, 1); break; case R.id.tvExchange: MyDiamondActivity.start(mContext, 2); break; } } }
package driving; import static org.lwjgl.opengl.GL11.*; import org.lwjgl.LWJGLException; import org.lwjgl.util.glu.GLU; import lib.game.AbstractGame; public class Driving extends AbstractGame { static boolean fullScreen = false; public Driving() throws LWJGLException { super("Driving", 1000, 600, fullScreen); start(); } @Override public void init() { //TODO init glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLU.gluPerspective(75, (float)width/(float)height, 0.001f, 500f); glMatrixMode(GL_MODELVIEW); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); } @Override public void update() { //TODO update } @Override public void render() { //TODO render } @Override public void processInput() { //TODO processInput } public static void main(String[] args) { try { new Driving(); } catch (LWJGLException e) { e.printStackTrace(); } } }
package sci.ml.logit.train; import sci.ml.logit.io.DataframeReader; import weka.classifiers.functions.Logistic; import weka.core.Attribute; import weka.core.DenseInstance; import weka.core.Instance; import weka.core.Instances; import java.io.File; import java.util.ArrayList; import java.util.Arrays; /** * Created by hok on 8/31/16. */ public class WekaLogisticRegressionTrainer { private File dataFrameFile; private DataframeReader dataframeReader; private int labelCol; private int[] featureCols; public WekaLogisticRegressionTrainer(File dataframeFile, int labelCol, int[] featureCols) { this.dataFrameFile = dataframeFile; this.labelCol = labelCol; this.featureCols = featureCols; this.dataframeReader = new DataframeReader(this.dataFrameFile, this.labelCol, this.featureCols); } public Logistic train() { this.dataframeReader.startReading(); String[] headers = this.dataframeReader.getHeaders(); ArrayList<Attribute> attributes = new ArrayList<Attribute>(); Attribute labelAttr = new Attribute(headers[this.labelCol], Arrays.asList(new String[]{"0", "1"})); attributes.add(labelAttr); for (int id: this.featureCols) attributes.add(new Attribute(headers[id])); Instances instances = new Instances("SOCcerStackedLogisticModel", attributes, 0); instances.setClass(labelAttr); DataframeReader.DataPoint dataPoint = this.dataframeReader.next(); while ((dataPoint!=null) && this.dataframeReader.isReading()) { Instance instance = new DenseInstance(attributes.size()); int label = dataPoint.getLabel(); instance.setValue(labelAttr, (label==0)?"0":"1"); double[] featureVals = dataPoint.getFeatureValues(false); for (int i=1; i<attributes.size(); i++) { instance.setValue(attributes.get(i), featureVals[i-1]); } instances.add(instance); dataPoint = this.dataframeReader.next(); } Logistic logisticModel = new Logistic(); try { logisticModel.buildClassifier(instances); } catch (Exception e) { e.printStackTrace(); } return logisticModel; } public static void main(String[] args) { WekaLogisticRegressionTrainer trainer = new WekaLogisticRegressionTrainer(new File(args[0]), 2, new int[]{22, 23}); Logistic lgModel = trainer.train(); double[][] coefficients = lgModel.coefficients(); for (int i=0; i<coefficients.length; i++) { for (int j=0; j<coefficients[i].length; j++) { System.out.println(i+", "+j+"\r"+coefficients[i][j]); } } } }
package com.sinata.rwxchina.component_aboutme.activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.jaeger.library.StatusBarUtil; import com.sinata.rwxchina.basiclib.base.BaseActivity; import com.sinata.rwxchina.basiclib.utils.immersionutils.ImmersionUtils; import com.sinata.rwxchina.component_aboutme.R; /** * @author:zy * @detetime:2017/12/21 * @describe:退款中 * @modifyRecord:修改记录 */ public class RefundingActivity extends BaseActivity { private ImageView back; private TextView title; private View statusBar; @Override public void initParms(Bundle parms) { setSetStatusBar(true); } @Override public View bindView() { return null; } @Override public int bindLayout() { return R.layout.activity_refunding; } @Override public void initView(View view, Bundle savedInstanceState) { View titleView = view.findViewById(R.id.refunding_title); back = titleView.findViewById(R.id.back); title = titleView.findViewById(R.id.titleLayout_title_tv); statusBar = findViewById(R.id.home_title_fakeview); } @Override public void setListener() { } @Override public void widgetClick(View v) { } @Override public void doBusiness(Context mContext) { setTitle(); } public void setTitle() { title.setText("退款详情"); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); setTitleBarView(); } /** * 设置标题栏 */ private void setTitleBarView(){ ImmersionUtils.setListImmersion(getWindow(),this,statusBar); } @Override public void steepStatusBar() { super.steepStatusBar(); //状态栏透明 StatusBarUtil.setTranslucentForImageViewInFragment(RefundingActivity.this, null); } }
package itri.io.emulator.simulator; import itri.io.emulator.common.RandomTools; import itri.io.emulator.parameter.OperationInfo; import java.io.IOException; import java.io.RandomAccessFile; public class WriteOperation extends Operation { public WriteOperation(OperationInfo info) { super(info); } @Override public void operate(RandomAccessFile file) { byte[] ranBytes = RandomTools.generateByte(length); try { file.seek(offset); if (!isSync) { file.write(ranBytes); } else { synchronized (file) { file.write(ranBytes); } } } catch (IOException e) { System.out.println("Write error happens at " + offset + ", should write " + length + " bytes."); } } }
package ru.alishev.springcources; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; public class RapMusic implements Music{ public static RapMusic getRapMusic() { return new RapMusic(); } @PostConstruct public void doMyInit() { System.out.println("Doing my initialization"); } @PreDestroy public void doMyDestroy() { System.out.println("Doing my destruction"); } @Override public String getSong() { return "Mobb deep - Shoock ones pt.2"; } }
package org.apache.maven.plugin.deltacoverage.scm; import java.io.File; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.maven.plugin.deltacoverage.change.ChangeType; import org.apache.maven.plugin.deltacoverage.change.ClassChange; import org.apache.maven.plugin.deltacoverage.change.LineChange; import org.apache.maven.plugin.deltacoverage.util.ProcessExecutor; import org.apache.maven.plugin.logging.Log; /** * Implements the {@link SCMExecutor} interface for CVS version control system. * Extends {@link AbstractSCMExecutor} class to implement SCM specific methods. * * Relies on command line execution of CVS command. Hence, it is necessary that a CVS client * is installed and CVS command can be executed from command line. * * Uses {@link ProcessBuilder} to build a command. The command is then executed and the output * is parsed to populate list of {@link ClassChange}. * * @author Abhijeet_Kesarkar * */ public class CVSExecutor extends AbstractSCMExecutor { private static final String REPLACE_VERSION = "$version"; private static final String COMMAND_DIFF = "DIFF"; /** * Constructor * @param log logger instance */ public CVSExecutor(Log log) { super(log); } @Override public List<ClassChange> getDiff(File workingDir, String baselineVersion) throws Exception { Map<String, String> replaceArgs= new HashMap<String, String>(); replaceArgs.put(REPLACE_VERSION, baselineVersion); ProcessBuilder builder = ProcessExecutor.getInstance().buildCommand(SCMExecutorFactory.SCM_CVS + "_" + COMMAND_DIFF, replaceArgs, workingDir); getLog().info("CVS Command : " + builder.command()); Process process = builder.start(); LineNumberReader reader = new LineNumberReader(new InputStreamReader(process.getInputStream())); return parseDiffOutput(reader); } /** * Parses the output of the diff command to return the list of changes. * @param reader reading the output of the command executed. * @return list of {@link ClassChange} * @throws Exception in case of IO error */ private List<ClassChange> parseDiffOutput(LineNumberReader reader) throws Exception{ List<ClassChange> classChanges = new ArrayList<ClassChange>(); String line = null; ClassChange classChange = null; List<LineChange> lines = null; int changeIndex = 0; while ((line = reader.readLine()) != null) { getLog().debug(line); if (isIndexLine(line)) { // e.g. Index <filename> classChange = getClassChange(line); classChanges.add(classChange); reader.readLine(); // ignore reader.readLine(); // ignore line = reader.readLine(); // ignore if (!line.startsWith("diff")) // not new file { line = reader.readLine(); // ignore if( !line.startsWith("diff")) // not local modification { reader.readLine(); // ignore } } } else if (isDiffLine(line)) { // this line contains the change description like 21,28c34,37 ChangeType type = getChangeType(line); lines = null; changeIndex = 0; if (type == ChangeType.ADD || type == ChangeType.MODIFY) { String range = line.split("[acd]")[1]; lines = getLineChanges(range, type); classChange.getLines().addAll(lines); } } else if (isChangeLine(line) && lines != null) { // this line contains the modified code (starts with > ) lines.get(changeIndex++).setValue(line.substring(1)); } } return classChanges; } /** * Converts line range to create list of {@link LineChange} corresponding * to each line changed. * e.g. for input range as "12,16" indicating line numbers 12 to 16 (both inclusive), * returns list of five LineChange instances numbering 12 to 16. Specified ChangeType * is set in each LineChange instance. * * @param range e.g. "12,16" or simply "12" * @param type {@link ChangeType} * @return list of {@link LineChange} */ private static List<LineChange> getLineChanges(String range, ChangeType type) { String[] ranges = range.split(","); int from = Integer.valueOf(ranges[0]); int to = (ranges.length > 1 ? Integer.valueOf(ranges[1]) : from); List<LineChange> lineChanges = new ArrayList<LineChange>(); for (int i = from; i <= to; i++) { LineChange change = new LineChange(); change.setLineNumber(i); change.setType(type); lineChanges.add(change); } return lineChanges; } /** * Parses the change description to return the change type. * e.g. * <table> * <tr><th>Change description</th><th>Indicates</th><th>Returns</th></tr> * <tr><td>9a13,15</td><td>Lines 13 to 15 added after line 9</td><td>ChangeType.ADD</td></tr> * <tr><td>21,25c26</td><td>Line numbers 21 to 25 changed with line 26</td><td>ChangeType.MODIFY</td></tr> * <tr><td>33d0</td><td>Line numbers 33 deleted</td><td>ChangeType.DELETE</td></tr> * </table> * * @param changeDescription like 9a13,15 * @return {@link ChangeType} indicating if the change was ADD, MODIFY or DELETE */ private static ChangeType getChangeType(String changeDescription) { if (changeDescription.indexOf('a') != -1) { return ChangeType.ADD; } else if (changeDescription.indexOf('c') != -1) { return ChangeType.MODIFY; } else { return ChangeType.DELETE; } } /** * Creates a new instance of {@link ClassChange} based on current index line. * The line looks something like<p> * <code>Index: org/apache/maven/plugin/deltacoverage/DeltaCoverageMojo.java</code> * Decodes file name, class name from the line and returns a new instance of <code>ClassChange</code> * * @param line index line * @return {@link ClassChange} instance */ private static ClassChange getClassChange(String line) { ClassChange classChange = new ClassChange(); String filename = getFileNameFromIndex(line); classChange.setFilename(filename); classChange.setName(getNameFromFileName(filename)); List<LineChange> lines = new ArrayList<LineChange>(); classChange.setLines(lines); return classChange; } /** * Converts file name to class name. * e.g. * converts * <code>org/apache/maven/plugin/deltacoverage/DeltaCoverageMojo.java</code> * to * <code>org.apache.maven.plugin.deltacoverage.DeltaCoverageMojo</code> * * @param filename * @return fully qualified class name */ private static String getNameFromFileName(String filename) { return filename.substring(0, filename.indexOf(".")).replace('/', '.'); } /** * Extracts filename from index line. * e.g. * Extracts <code>org/apache/maven/plugin/deltacoverage/DeltaCoverageMojo.java</code> * from * <code>Index: org/apache/maven/plugin/deltacoverage/DeltaCoverageMojo.java</code> * @param indexLine * @return */ private static String getFileNameFromIndex(String indexLine) { return indexLine.substring(indexLine.indexOf(':') + 2); } /** * Indicates if the specified line is an index line * e.g. * <code>Index: org/apache/maven/plugin/deltacoverage/DeltaCoverageMojo.java</code> * * @param line * @return boolean true if line is index line. */ private static boolean isIndexLine(String line) { return line.startsWith("Index"); } /** * Indicates if the specified line is a diff line. A diff line is the one that contains * change description like "12a21,42". * Method of elimination is used. i.e. checks if it is not all other types of lines. * * @param line * @return boolean true if line is a diff line. */ private static boolean isDiffLine(String line) { //return line.matches("[0-9,]+[acd][0-9,]+"); return !(line.startsWith("<") || line.startsWith(">") || line.startsWith("---") || line.startsWith("cvs diff") || line.startsWith("?") || line.startsWith("\\")); } /** * Indicates if the specified line is a change line. A change line is one that contains * the actual code change. * e.g. * <pre> * <code>> // this is a changed line</code> * <code>> x = y;</code> * </pre> * @param line * @return boolean true if line is a change line. */ private static boolean isChangeLine(String line) { return line.startsWith(">"); } }
package com.projet3.library_webapp.library_webapp_consumer.DAO; import java.util.List; import com.projet3.library_webapp.library_webapp_model.book.Book; import com.projet3.library_webapp.library_webapp_model.book.Borrowing; public class BookDAOImpl extends AbstractBookDAO implements BookDAO { public Book getBook(int id) { Book book = bookServiceConnection.getBook(id); return book; } public List<Book> getBookList() { List<Book> bookList = bookServiceConnection.getBookList(); return bookList; } public List<Book> bookResearch(String title) { List<Book> bookFound = bookServiceConnection.bookResearch(title); return bookFound; } public List<Borrowing> getUserBorrowing(int userId) { List<Borrowing> bookFound = bookServiceConnection.getUserBorrowing(userId); return bookFound; } public void extendBorrowing(int borrowingId) { bookServiceConnection.extendBorrowing(borrowingId); } }
package ba.bitcamp.LabS10D02.predavanje; public class Strings { public static void main(String[] args) { String str = ""; for (int i = 1; i < 100; i++) { str += i + ", "; } str += "100"; System.out.println(str); System.out.println("*************"); StringBuilder sb = new StringBuilder(); for (int i = 1; i < 100; i++) { sb.append(i).append(", "); } sb.append("100"); System.out.println(sb); System.out.println("*************"); String sbcc = ""; for (int i = 1; i < 100; i++) { sbcc = sbcc.concat(String.valueOf(i)).concat(", "); } sbcc = sbcc.concat("100"); System.out.println(sbcc); } }
package enthu_f; public class e_1120 { public static void main(String args[]) { { int i = 0, j = 11; do { if (i > j) { break; } j--; } while (++i < 5); System.out.println(i + " " + j); } } }
package com.lera.vehicle.reservation.command.customer; import com.lera.vehicle.reservation.domain.customer.CreditCardType; import com.lera.vehicle.reservation.domain.customer.Customer; import com.lera.vehicle.reservation.domain.customer.CustomerType; import org.junit.Test; import java.util.Calendar; import static org.junit.Assert.*; public class AddCustomerObjectTest { AddCustomerObject addCustomerObject = new AddCustomerObject(); @Test public void getFullName() { addCustomerObject.setFullName("Customer"); assertEquals("Customer", addCustomerObject.getFullName()); } @Test public void getDateOfBirth() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setDateOfBirth(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getDateOfBirth()); } @Test public void getAddress() { addCustomerObject.setAddress("Address"); assertEquals("Address", addCustomerObject.getAddress()); } @Test public void getMobilePhone() { addCustomerObject.setMobilePhone("1111"); assertEquals("1111", addCustomerObject.getMobilePhone()); } @Test public void getCompanyName() { addCustomerObject.setCompanyName("Company"); assertEquals("Company", addCustomerObject.getCompanyName()); } @Test public void getEmail() { addCustomerObject.setEmail("email@email"); assertEquals("email@email", addCustomerObject.getEmail()); } @Test public void getCustomerType() { addCustomerObject.setCustomerType(CustomerType.RETAIL); assertEquals(CustomerType.RETAIL, addCustomerObject.getCustomerType()); } @Test public void getLicenceNo() { addCustomerObject.setLicenceNo("licence"); assertEquals("licence", addCustomerObject.getLicenceNo()); } @Test public void getLicenceIssueDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setLicenceIssueDate(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getLicenceIssueDate()); } @Test public void getLicenceExpiryDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setLicenceExpiryDate(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getLicenceExpiryDate()); } @Test public void getPassportNo() { addCustomerObject.setPassportNo("passportNo"); assertEquals("passportNo", addCustomerObject.getPassportNo()); } @Test public void getPassportIssueDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setPassportIssueDate(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getPassportIssueDate()); } @Test public void getPassportExpiryDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setPassportExpiryDate(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getPassportExpiryDate()); } @Test public void getInsuranceCompany() { addCustomerObject.setInsuranceCompany("Company2"); assertEquals("Company2", addCustomerObject.getInsuranceCompany()); } @Test public void getInsurancePolicyNo() { addCustomerObject.setInsurancePolicyNo("policyNo"); assertEquals("policyNo", addCustomerObject.getInsurancePolicyNo()); } @Test public void getInsuranceExpiryDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setInsuranceExpiryDate(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getInsuranceExpiryDate()); } @Test public void getCreditCardType() { addCustomerObject.setCreditCardType(CreditCardType.VISA); assertEquals(CreditCardType.VISA, addCustomerObject.getCreditCardType()); } @Test public void getCreditCardNo() { addCustomerObject.setCreditCardNo(1111111); assertEquals(1111111, addCustomerObject.getCreditCardNo()); } @Test public void getNameOnCard() { addCustomerObject.setNameOnCard("NameOnCard"); assertEquals("NameOnCard", addCustomerObject.getNameOnCard()); } @Test public void getCreditCardExpiryDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, Calendar.APRIL, 9); addCustomerObject.setCreditCardExpiryDate(calendar.getTime()); assertEquals(calendar.getTime(), addCustomerObject.getCreditCardExpiryDate()); } }
package helloworld; import java.util.Scanner; public class GugudanMission { public static void main(String[] args) { Scanner scanner =new Scanner(System.in); String inputValue = scanner.nextLine(); String[] splitedValue = inputValue.split(","); int first = Integer.parseInt(splitedValue[0]); int second = Integer.parseInt(splitedValue[1]); for(int i=2; i<=first; i++) { for(int j=1; j<=second; j++) { System.out.println(i + "*" + j + "=" + i*j); } } } }
package com.zhujinghui.novel.dao; import com.zhujinghui.novel.pojo.Genre; import com.zhujinghui.novel.pojo.Novel; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; /** * @Author: JinghuiZhu * @Description: 小说DAO * @Date: Created in 17:28 2019/2/22 * @Modified By: */ public interface NovelDAO extends JpaRepository<Novel,Integer> { Page<Novel> findByGenre(Genre genre, Pageable pageable); }
package com.yosep.msa.account; //import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.Link; public class YoggaebiUserResource extends EntityModel<YoggaebiUser>{ public YoggaebiUserResource(YoggaebiUser user, Link... links) { super(user, links); add(linkTo(YoggaebiUserController.class).slash(user.getUserName()).withSelfRel()); // TODO Auto-generated constructor stub } }
package com.tencent.mm.ui.appbrand; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.os.Build.VERSION; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.tencent.mm.R; import com.tencent.mm.compatible.util.j; import com.tencent.mm.modelappbrand.b.b$h; import com.tencent.mm.plugin.appbrand.q.k; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.al; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.ak; import com.tencent.mm.ui.base.o; public final class c implements b$h { private ImageView bRk = null; private ProgressBar bRm = null; private Bitmap bitmap = null; private View contentView = null; private Context context; private View kHl; private View nHH; private TextView oan = null; private TextView oao = null; o qMQ; public boolean qMR = true; private long trh = 10000; private ImageView tri = null; private String trj = null; private boolean trk = false; private boolean trl = false; public a trm; ag trn = null; public interface a { void cra(); } static /* synthetic */ void a(c cVar) { if (cVar.bRk == null || cVar.qMQ == null || cVar.nHH == null || cVar.kHl == null) { x.e("MicroMsg.AppBrandServiceImageBubble", "these references include null reference"); return; } int i; if (cVar.bitmap != null) { x.d("MicroMsg.AppBrandServiceImageBubble", "bitmap is null,return"); i = 1; } else { boolean i2 = false; } if (i2 == 0) { cVar.Kc(); } else { cVar.n(cVar.bitmap); } i2 = cVar.qMR ? 83 : 85; int i3 = cVar.qMR ? 0 : 10; int fA = j.fA(cVar.context); int height = cVar.kHl.getHeight(); if (cVar.trl && height < fA) { height += fA; } if (VERSION.SDK_INT >= 21) { Rect cqU = ak.cqU(); i3 = cVar.qMR ? 0 : i3 + cqU.right; height += cqU.bottom; x.i("MicroMsg.AppBrandServiceImageBubble", "bubble navbar height %s %s", new Object[]{Integer.valueOf(cqU.right), Integer.valueOf(cqU.bottom)}); } cVar.qMQ.showAtLocation(cVar.nHH, i2, i3, height); if (cVar.trh > 0) { al alVar = new al(new 3(cVar), false); long j = cVar.trh; alVar.J(j, j); } } public final void Kc() { x.d("MicroMsg.AppBrandServiceImageBubble", "beforeLoadBitmap"); this.bRm.setVisibility(0); this.bRk.setVisibility(8); this.tri.setVisibility(8); } public final void n(Bitmap bitmap) { x.d("MicroMsg.AppBrandServiceImageBubble", "onBitmapLoaded"); if (bitmap == null) { x.w("MicroMsg.AppBrandServiceImageBubble", "bitmap is null"); return; } this.bitmap = bitmap; this.bRm.setVisibility(8); if (bitmap == null || bitmap.isRecycled()) { this.tri.setVisibility(0); this.bRk.setVisibility(8); return; } this.bRk.setVisibility(0); this.bRk.setImageBitmap(bitmap); this.tri.setVisibility(8); } public final void Kd() { x.i("MicroMsg.AppBrandServiceImageBubble", "onLoadFailed"); this.tri.setVisibility(0); this.bRm.setVisibility(8); this.bRk.setVisibility(8); } public final String Ke() { return k.bq(this); } public c(Context context, View view, View view2, boolean z) { this.context = context; this.nHH = view; this.kHl = view2; this.trl = z; this.contentView = View.inflate(this.context, R.i.chatting_footer_app_brand_image_bubble, null); this.oan = (TextView) this.contentView.findViewById(R.h.image_tv_1); this.oao = (TextView) this.contentView.findViewById(R.h.image_tv_2); this.bRk = (ImageView) this.contentView.findViewById(R.h.image_iv); this.tri = (ImageView) this.contentView.findViewById(R.h.error_iv); this.bRm = (ProgressBar) this.contentView.findViewById(R.h.image_pb); this.qMQ = new o(this.contentView, -2, -2, true); this.qMQ.setBackgroundDrawable(new ColorDrawable(0)); this.qMQ.setOutsideTouchable(true); this.qMQ.setFocusable(false); this.contentView.setOnClickListener(new 1(this)); this.trn = new 2(this, this.context.getMainLooper()); } }
/* * 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 imageUpload; import com.oreilly.servlet.MultipartRequest; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author wasat */ public class ImageUpload extends HttpServlet { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); MultipartRequest m =new MultipartRequest(req, "C:/Users/hp/Desktop/image"); if(m!=null) { RequestDispatcher rd=req.getRequestDispatcher("home.html"); rd.include(req, res); out.println("<script>window.alert('Successfully Uploaded');</script>"); } else { RequestDispatcher rd=req.getRequestDispatcher("home.html"); rd.include(req, res); out.println("<script>window.alert('Not Uploaded');</script>"); } } }
package com.pzhu.topicsys.modules.student.service.impl; import java.util.Date; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.github.pagehelper.Page; import com.pzhu.topicsys.common.exception.BusinessException; import com.pzhu.topicsys.common.mybatis.entity.Student; import com.pzhu.topicsys.common.mybatis.entity.User; import com.pzhu.topicsys.common.mybatis.mapper.StudentMapper; import com.pzhu.topicsys.common.mybatis.mapper.UserMapper; import com.pzhu.topicsys.common.util.PageBounds; import com.pzhu.topicsys.common.util.PageResult; import com.pzhu.topicsys.modules.student.service.StudentService; @Service public class StudentServiceImpl implements StudentService { @Resource private StudentMapper studentMapper; @Resource private UserMapper userMapper; @Override public PageResult findStudents(String name, PageBounds page) { Page<Student> list = this.studentMapper.findStudents(name, page.toRowBounds()); PageResult result = new PageResult(page.getPage(), page.getSize(), list); return result; } @Override public boolean save(String userId, String username, String name, String departmentId, String phone, String password) { if (username == null || name == null || departmentId == null|| phone == null) { throw new BusinessException("缺少参数"); } if (userId == null) { // 新增 User userDB = this.userMapper.getUserByUsername(username); if (userDB != null) { throw new BusinessException(String.format("%s已经存在,不允许重复", username)); } User user = User.newStudent(); user.setUsername(username); user.setName(name); user.setPassword(password); Student student = Student.newStudent(); student.setUserId(user.getUserId()); student.setDepartmentId(departmentId); student.setPhone(phone); int studentResult = this.studentMapper.insert(student); int userResult = this.userMapper.insertSelective(user); if (studentResult > 0 && userResult > 0) { return true; } else { throw new BusinessException("新增失败,请与管理员联系"); } } else { // 修改 User user = this.userMapper.selectByPrimaryKey(userId); Student student = this.studentMapper.selectByUserId(userId); if (user == null || student == null) { throw new BusinessException("查无此学生"); } else { user.setName(name); user.setUpdateTime(new Date()); student.setDepartmentId(departmentId); student.setPhone(phone); student.setUpdateTime(new Date()); int studentResult = this.studentMapper.updateByPrimaryKeySelective(student); int userResult = this.userMapper.updateByPrimaryKeySelective(user); if (studentResult > 0 && userResult > 0) { return true; } else { throw new BusinessException("修改失败,请与管理员联系"); } } } } }
package org.rw.crow.commons; import static org.junit.Assert.fail; import java.io.File; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.rw.crow.commons.PathUtils; /** * * @author Crow * @date 2015年9月2日 * */ public class PathUtilsTest { @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void testUnifySeparator(){ String path1 = "C:\\\"Workspaces\"\\MyEclipse Professional 2014\\Lotus"; // String path2 = "C:/Workspaces/MyEclipse Professional 2014/Lotus"; System.out.println(PathUtils.unifySeparator(path1)); // System.out.println(PathUtils.unifySeparator(path2, PathUtils.BACKSLASH)); } @Test public void testPathNotEndWithSlash(){ String path1 = "C:/Workspaces/MyEclipse Professional 2014/Lotus/"; System.out.println(PathUtils.pathNotEndWithSlash(path1)); } @Test public void testPathEndWithSlash(){ String path1 = "C:/Workspaces/MyEclipse Professional 2014/Lotus"; String path2 = "C:/Workspaces/MyEclipse Professional 2014/Lotus/"; String path3 = "C:/Workspaces/MyEclipse Professional 2014/Lotus/README.md"; System.out.println(PathUtils.pathEndWithSlash(path1)); System.out.println(PathUtils.pathEndWithSlash(path2)); System.out.println(PathUtils.pathEndWithSlash(path3)); } @Test public void testGetFileName(){ String path = "C:/Workspaces/MyEclipse Professional 2014/Lotus/README.md"; File file = new File(path); String fileName = file.getName(); System.out.println(fileName); } @Test public void testGetDirPath() { fail("Not yet implemented"); } @Test public void testGetFilePath() { String path = PathUtils.getFilePath("README.md", "C:\\\"Workspaces\"\\MyEclipse Professional 2014\\Lotus", "alice/kepler/", "galileo"); System.out.println(path); } @Test public void testRemoveFileNameSuffixes(){ System.out.println(PathUtils.removeFileNameSuffixes("README.md")); } @Test public void testGetPlainFileName(){ String path1 = "C:/Workspaces/MyEclipse Professional 2014/Lotus/"; String path2 = "C:/Workspaces/MyEclipse Professional 2014/Lotus/README.md"; System.out.println(PathUtils.getPlainFileName(path1)); System.out.println(PathUtils.getPlainFileName(path2)); } }
package android.support.design.widget; import android.support.design.widget.u.c; class CollapsingToolbarLayout$2 implements c { final /* synthetic */ CollapsingToolbarLayout el; CollapsingToolbarLayout$2(CollapsingToolbarLayout collapsingToolbarLayout) { this.el = collapsingToolbarLayout; } public final void a(u uVar) { CollapsingToolbarLayout.a(this.el, uVar.iO.aQ()); } }
package net.keabotstudios.numikovillage; import static org.lwjgl.glfw.Callbacks.glfwFreeCallbacks; import static org.lwjgl.glfw.GLFW.GLFW_FALSE; import static org.lwjgl.glfw.GLFW.GLFW_RESIZABLE; import static org.lwjgl.glfw.GLFW.GLFW_TRUE; import static org.lwjgl.glfw.GLFW.GLFW_VISIBLE; import static org.lwjgl.glfw.GLFW.glfwCreateWindow; import static org.lwjgl.glfw.GLFW.glfwDefaultWindowHints; import static org.lwjgl.glfw.GLFW.glfwDestroyWindow; import static org.lwjgl.glfw.GLFW.glfwGetPrimaryMonitor; import static org.lwjgl.glfw.GLFW.glfwGetVideoMode; import static org.lwjgl.glfw.GLFW.glfwGetWindowSize; import static org.lwjgl.glfw.GLFW.glfwInit; import static org.lwjgl.glfw.GLFW.glfwMakeContextCurrent; import static org.lwjgl.glfw.GLFW.glfwPollEvents; import static org.lwjgl.glfw.GLFW.glfwSetErrorCallback; import static org.lwjgl.glfw.GLFW.glfwSetKeyCallback; import static org.lwjgl.glfw.GLFW.glfwSetWindowPos; import static org.lwjgl.glfw.GLFW.glfwShowWindow; import static org.lwjgl.glfw.GLFW.glfwSwapBuffers; import static org.lwjgl.glfw.GLFW.glfwSwapInterval; import static org.lwjgl.glfw.GLFW.glfwTerminate; import static org.lwjgl.glfw.GLFW.glfwWindowHint; import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose; import static org.lwjgl.glfw.GLFW.glfwSetWindowShouldClose; import static org.lwjgl.system.MemoryStack.stackPush; import static org.lwjgl.system.MemoryUtil.NULL; import java.nio.IntBuffer; import org.lwjgl.Version; import org.lwjgl.glfw.GLFWErrorCallback; import org.lwjgl.glfw.GLFWKeyCallbackI; import org.lwjgl.glfw.GLFWVidMode; import org.lwjgl.opengl.GL; import org.lwjgl.system.MemoryStack; public class DisplayManager { private long window; private int width, height; public void initalize(int width, int height, String title, GLFWKeyCallbackI cbfun) { long startTime = System.currentTimeMillis(); System.out.println("Intializing LWJGL and GLFW... (" + Version.getVersion() + ")"); GLFWErrorCallback.createPrint(System.err).set(); glfwTerminate(); if ( !glfwInit() ) throw new IllegalStateException("Unable to initialize GLFW."); System.out.println("Initalized GLFW. Took " + (System.currentTimeMillis() - startTime) + "ms."); glfwDefaultWindowHints(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); startTime = System.currentTimeMillis(); System.out.println("Creating GLFW window..."); window = glfwCreateWindow(width, height, title, NULL, NULL); if ( window == NULL ) throw new RuntimeException("Failed to create the GLFW window."); glfwSetKeyCallback(window, cbfun); try ( MemoryStack stack = stackPush() ) { IntBuffer pWidth = stack.mallocInt(1); IntBuffer pHeight = stack.mallocInt(1); glfwGetWindowSize(window, pWidth, pHeight); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); width = pWidth.get(0); height = pHeight.get(0); glfwSetWindowPos( window, (vidmode.width() - pWidth.get(0)) / 2, (vidmode.height() - pHeight.get(0)) / 2 ); } glfwMakeContextCurrent(window); glfwSwapInterval(1); glfwShowWindow(window); GL.createCapabilities(); System.out.println("Created GLFW window. Took " + (System.currentTimeMillis() - startTime) + "ms."); System.out.println("Initialization complete! Go have fun with some kitties!"); } public boolean shouldClose() { if(window == NULL) return true; return glfwWindowShouldClose(window); } public void update() { if(window == NULL) return; glfwSwapBuffers(window); glfwPollEvents(); try ( MemoryStack stack = stackPush() ) { IntBuffer pWidth = stack.mallocInt(1); IntBuffer pHeight = stack.mallocInt(1); glfwGetWindowSize(window, pWidth, pHeight); width = pWidth.get(0); height = pHeight.get(0); } } public void close() { if(window == NULL) return; glfwSetWindowShouldClose(window, true); } public void destroy() { if(window == NULL) return; glfwDestroyWindow(window); glfwFreeCallbacks(window); glfwTerminate(); glfwSetErrorCallback(null).free(); } public int getWidth() { return width; } public int getHeight() { return height; } public float getAspect() { return (float) width / (float) height; } }
package com.espendwise.manta.util.validation.rules; import com.espendwise.manta.model.data.BusEntityAssocData; import com.espendwise.manta.model.data.ItemData; import com.espendwise.manta.model.data.WorkflowAssocData; import com.espendwise.manta.model.data.WorkflowQueueData; import com.espendwise.manta.support.spring.ServiceLocator; import com.espendwise.manta.util.UpdateRequest; import com.espendwise.manta.util.Utility; import com.espendwise.manta.util.arguments.ObjectArgument; import com.espendwise.manta.util.trace.ExceptionReason; import com.espendwise.manta.util.validation.ValidationRule; import com.espendwise.manta.util.validation.ValidationRuleResult; import com.espendwise.manta.web.controllers.LocateAccountFilterController; import java.util.*; import org.apache.log4j.Logger; public class SkuNotFoundRule implements ValidationRule { private List<Long> skuNumbers; private Long storeId; private static final Logger logger = Logger.getLogger(SkuNotFoundRule.class); public SkuNotFoundRule(Long storeId, List<Long> skuNumbers) { this.skuNumbers = skuNumbers; this.storeId = storeId; } public List<Long> getSkuNumbers() { return skuNumbers; } public Long getStoreId() { return storeId; } @Override public ValidationRuleResult apply() { ValidationRuleResult vr = new ValidationRuleResult(); // String[] list = getSkuNumbers().split(","); // List<String> skus = Utility.toList(list); List<ItemData> products = ServiceLocator.getCatalogService().findProducts( getStoreId(), getSkuNumbers() ); Set<String> errors = new HashSet<String>(); logger.info("SkuNotFoundRule() == > apply(): products=" + products + ", skuNumbers= "+ getSkuNumbers()); if (products != null) { Set<Long> foundSku = new HashSet<Long>(); for (ItemData p : products) { foundSku.add(p.getSkuNum()); } for (Long sku : getSkuNumbers()) { if (!foundSku.contains(sku)){ errors.add(sku.toString()); } } } else { for (Long sku : getSkuNumbers()) { errors.add(sku.toString()); } } logger.info("SkuNotFoundRule() == > apply(): errors.isEmpty()=" + errors.isEmpty()); if (!errors.isEmpty()) { vr.failed( ExceptionReason.WorflowRuleUpdateReason.WORKFLOW_RULE_SKU_NOT_FOUND, new ObjectArgument<Set>(errors) ); return vr; } vr.success(); return vr; } }
/* * 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 ch.transoft.crm.service; import ch.transoft.crm.entity.Customer; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; /** * * @author Dell */ public class CustomerServiceImpl { private EntityManager entityManager; public CustomerServiceImpl(EntityManager entityManager){ this.entityManager = entityManager; } /** * Returns a list of Customer objects in the database * @return List<Customer> */ public List<Customer> getAllCustomer() { Query query = entityManager.createNamedQuery("Customer.findAll"); return query.getResultList(); } }
public class Calc { public static void main(String[] args) { int num1 = Integer.parseInt(args[0]); int num2 = Integer.parseInt(args[2]); int ans = 0; String op = args[1]; String s = ""; String s1; int i; switch(op) { case "S": for (i = num1;i < num2;i++ ) { ans += i; s += String.valueOf(i); s += "+"; } ans += i; s += String.valueOf(i); s += "="; s += String.valueOf(ans); System.out.println(s); break; default: System.out.println("Error!!"); break; } } }
package finggui; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.EtchedBorder; /** * The second panel of the GUI. It contains all domain information. * * The class extends JPanel (as it is one big JPanel that will be directly * added to the JFrame), and it is a BorderLayout. * * The first component added to the panel is a JLabel, getDomainNamesLabel, * which is placed at BorderLayout North. * * Inside this JPanel class resides another Panel, domainPanel, which is a * GridLayout, and is responsible for lining up the JRadioButtons, JLabel, * and JCheckBox. This will placed at BorderLayout Center. * * At the bottom of this panel is a JTextField, sessionNameField. This will be * placed at BorderLayout South. * * @author Frank * @date 8.8.2013 */ public class SecondPanel extends JPanel implements ActionListener{ private JPanel domainPanel; private JLabel getDomainNamesLabel; private ButtonGroup domainButtonGroup; public JRadioButton yesRadioButton; public JRadioButton noRadioButton; private JLabel saveSessionLabel; public JCheckBox yesCheckBox; public JTextField sessionNameField; /** * Default constructor. Sets the layout for the panel, initializes the * domainPanel, adds it to the JPanel, and then calls methods to initialize * and organize the components properly. */ public SecondPanel(){ setLayout(new BorderLayout()); setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null)); domainPanel = new JPanel(new GridLayout(2, 2)); // Add JPanel to panel this.add(domainPanel, BorderLayout.CENTER); initTop(); initDomain(); initSession(); } /** * Initializes the north most content, the JLabel. */ public void initTop(){ getDomainNamesLabel = new JLabel("Get Domain Names"); getDomainNamesLabel.setHorizontalAlignment(JLabel.CENTER); // Add component to North of JPanel this.add(getDomainNamesLabel, BorderLayout.NORTH); } /** * Initializes the second grouping of information: the two JRadioButtons, * the JLabel, and the JCheckBox. */ public void initDomain(){ domainButtonGroup = new ButtonGroup(); yesRadioButton = new JRadioButton("Yes"); yesRadioButton.setHorizontalAlignment(JRadioButton.CENTER); yesRadioButton.setSelected(true); noRadioButton = new JRadioButton("No"); noRadioButton.setHorizontalAlignment(JRadioButton.CENTER); // Add JRadioButtons to ButtonGroup domainButtonGroup.add(yesRadioButton); domainButtonGroup.add(noRadioButton); saveSessionLabel = new JLabel("Save session?"); saveSessionLabel.setHorizontalAlignment(JLabel.CENTER); yesCheckBox = new JCheckBox("Yes"); yesCheckBox.setHorizontalAlignment(JCheckBox.CENTER); yesCheckBox.addActionListener(this); // Add components to Center of domainPanel domainPanel.add(yesRadioButton); domainPanel.add(noRadioButton); domainPanel.add(saveSessionLabel); domainPanel.add(yesCheckBox); } /** * Initializes the third grouping of information: the JTextField, which * can be editable when the user selects yesCheckBox. */ public void initSession(){ sessionNameField = new JTextField("Enter Session Name Here"); sessionNameField.setEditable(false); sessionNameField.setHorizontalAlignment(JTextField.CENTER); // Add components to sessionPanel //sessionPanel.add(sessionNameField); this.add(sessionNameField, BorderLayout.SOUTH); } /** * Action Listener. * * If the yesCheckBox is checked, then allow the JTextField * sessionNameField to become editable. If the yesCheckBox is not checked, * then do not allow the JTextField sessionNameField to become editable. */ public void actionPerformed(ActionEvent actionEvent) { if(actionEvent.getSource() == yesCheckBox){ sessionNameField.setEditable(yesCheckBox.isSelected()); } } }
package com.kozmolab; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; public class GameScene extends AndroidApplication { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg=new AndroidApplicationConfiguration(); cfg.useGL20=true; initialize(new KozmoLab(), cfg); } }
package de.hse.swa.resource; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Request; import javax.ws.rs.core.UriInfo; import de.hse.swa.dao.UserDao; import de.hse.swa.dbmodel.User; // Will map the resource to the URL users @Path("/users") public class UsersResource { // Allows to insert contextual objects into the class, // e.g. ServletContext, Request, Response, UriInfo @Context UriInfo uriInfo; @Context Request request; // Return the list of users to the user in the browser @GET @Produces(MediaType.TEXT_XML) public List<User> getTusersBrowser() { return UserDao.getInstance().getUsers(); } // Return the list of users in JSON format @GET @Produces({MediaType.APPLICATION_JSON }) public List<User> getUsers() { return UserDao.getInstance().getUsers(); } // returns the number of users // Use http://localhost:8080/Jodel/rest/users/count // to get the total number of records @GET @Path("count") @Produces(MediaType.TEXT_PLAIN) public String getCount() { int count = UserDao.getInstance().getUsers().size(); return String.valueOf(count); } @POST @Path("login/facebook") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Map<String, Object> facebookLogin(User user, @Context HttpServletResponse servletResponse) { User checkUser = UserDao.getInstance().getUsersByUserId(user.getUserID()); if(checkUser==null) { UserDao.getInstance().saveUser(user); checkUser = UserDao.getInstance().getUsersByUserId(user.getUserID()); } Map<String, Object> response = new HashMap<>(); response.put("success", true); response.put("user", checkUser); return response; } // This is the workhorse @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public List<User> newUser(User user, @Context HttpServletResponse servletResponse) throws IOException { UserDao.getInstance().saveUser(user); return UserDao.getInstance().getUsers(); } // Defines that the next path parameter after users is // treated as a parameter and passed to the UserResources // Allows to type http://localhost:8080/Rest/rest/users/1 // 1 will be treaded as parameter and passed to UserResource @Path("{user}") public UserResource getUser(@PathParam("user") Integer id) { return new UserResource(uriInfo, request, id); } }
package com.redhat.vizuri.insurance; public enum PolicyLevel { GOLD,SILVER,STANDARD }
/* * SwapInfoSellUSDResponse.java * This file was last modified at 2018.12.03 20:05 by Victor N. Skurikhin. * $Id$ * This is free and unencumbered software released into the public domain. * For more information, please refer to <http://unlicense.org> */ package ru.otus.soap.wsclient.cbr; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="SwapInfoSellUSDResult" minOccurs="0"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "swapInfoSellUSDResult" }) @XmlRootElement(name = "SwapInfoSellUSDResponse") public class SwapInfoSellUSDResponse { @XmlElement(name = "SwapInfoSellUSDResult") protected SwapInfoSellUSDResponse.SwapInfoSellUSDResult swapInfoSellUSDResult; /** * Gets the value of the swapInfoSellUSDResult property. * * @return * possible object is * {@link SwapInfoSellUSDResponse.SwapInfoSellUSDResult } * */ public SwapInfoSellUSDResponse.SwapInfoSellUSDResult getSwapInfoSellUSDResult() { return swapInfoSellUSDResult; } /** * Sets the value of the swapInfoSellUSDResult property. * * @param value * allowed object is * {@link SwapInfoSellUSDResponse.SwapInfoSellUSDResult } * */ public void setSwapInfoSellUSDResult(SwapInfoSellUSDResponse.SwapInfoSellUSDResult value) { this.swapInfoSellUSDResult = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") public static class SwapInfoSellUSDResult { } } /* vim: syntax=java:fileencoding=utf-8:fileformat=unix:tw=78:ts=4:sw=4:sts=4:et */ //EOF
package com.awsp8.wizardry.Items; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemClover extends Item{ public ItemClover(int maxStackSize, CreativeTabs tab, int texture, String name) { setMaxStackSize(maxStackSize); setCreativeTab(tab); setUnlocalizedName(name); setTextureName("wizardry:" + name); } }
package com.ticket.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.ticket.message.User; import com.ticket.util.DBAccess; public class UserSelectDao { DBAccess dbAccess = new DBAccess(); public List<User> selectByName(String name, String sex, String cardType, String type) { String sql = "select id,loginName,uid,realName,sex,city,cardType,cardNumber,birthday,type,info from User where realName like '%" + name + "%' and sex='" + sex + "' and cardType='" + cardType + "' and type='" + type + "'"; UserManageDao userManageDao = new UserManageDao(); List<User> userList = new ArrayList<User>(); userList = userManageDao.selectList(sql); return userList; } public List<User> selectByCard(String sex, String cardType, String type, String cardNumbaer) { String sql = "select id,loginName,uid,realName,sex,city,cardType,cardNumber,birthday,type,info from User where sex='" + sex + "' and cardType='" + cardType + "' and type='" + type + "' and cardNumber='" + cardNumbaer + "'"; UserManageDao userManageDao = new UserManageDao(); List<User> userList = new ArrayList<User>(); userList = userManageDao.selectList(sql); return userList; } public List<User> selectBySex(String sex, String cardType, String type) { String sql = "select id,loginName,uid,realName,sex,city,cardType,cardNumber,birthday,type,info from User where sex='" + sex + "' and cardType='" + cardType + "' and type='" + type + "'"; UserManageDao userManageDao = new UserManageDao(); List<User> userList = new ArrayList<User>(); userList = userManageDao.selectList(sql); return userList; } public List<User> selectOne(String name, String sex, String cardType, String type, String cardNumbaer) { String sql = "select id,loginName,uid,realName,sex,city,cardType,cardNumber,birthday,type,info from User where realName='" + name + "' and sex='" + sex + "' and cardType='" + cardType + "' and type='" + type + "' and cardNumber='" + cardNumbaer + "'"; UserManageDao userManageDao = new UserManageDao(); List<User> userList = new ArrayList<User>(); userList = userManageDao.selectList(sql); return userList; } }
package org.mlgb.dsps.util.vo; public class MessagesStatsVO { private long messagesTotal; private long messagesConsumed; public long getMessagesTotal() { return messagesTotal; } public void setMessagesTotal(long messagesTotal) { this.messagesTotal = messagesTotal; } public long getMessagesConsumed() { return messagesConsumed; } public void setMessagesConsumed(long messagesConsumed) { this.messagesConsumed = messagesConsumed; } public MessagesStatsVO() { super(); this.messagesTotal = 0; this.messagesConsumed = 0; } @Override public String toString() { return "Messages stats:\n" + "#messages: " + this.messagesTotal + "\n" + "#consumed messages: " + this.messagesConsumed; } }
package com.asiainfo.dubbo.config.springboot.consumer; import javax.annotation.PostConstruct; import org.apache.dubbo.config.annotation.Reference; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.asiainfo.dubbo.config.service.HelloService; /** * @Description: TODO * * @author chenzq * @date 2019年4月27日 下午11:23:29 * @version V1.0 * @Copyright: Copyright(c) 2019 jaesonchen.com Inc. All rights reserved. */ @SpringBootApplication @RestController public class ConsumerApplication { @Reference(version = "1.0.0") private HelloService helloService; @RequestMapping("/hello/{name}") public String sayHello(@PathVariable("name") String name) { return this.helloService.hello(name); } @PostConstruct public void init() { System.err.println(helloService.hello("jaeson")); } public static void main(String[] args) { SpringApplication app = new SpringApplication(new Class<?>[] { ConsumerApplication.class }); app.setAdditionalProfiles(new String[] { "consumer" }); app.run(args); } }
package com.tencent.mm.boot.svg.a.a; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.Paint.Join; import android.graphics.Paint.Style; import android.graphics.Path; import android.os.Looper; import com.tencent.mm.svg.WeChatSVGRenderC2Java; import com.tencent.mm.svg.c; import com.tencent.smtt.sdk.WebView; public final class aaz extends c { private final int height = 96; private final int width = 96; protected final int b(int i, Object... objArr) { switch (i) { case 0: return 96; case 1: return 96; case 2: Canvas canvas = (Canvas) objArr[0]; Looper looper = (Looper) objArr[1]; Matrix f = c.f(looper); float[] e = c.e(looper); Paint i2 = c.i(looper); i2.setFlags(385); i2.setStyle(Style.FILL); Paint i3 = c.i(looper); i3.setFlags(385); i3.setStyle(Style.STROKE); i2.setColor(WebView.NIGHT_MODE_COLOR); i3.setStrokeWidth(1.0f); i3.setStrokeCap(Cap.BUTT); i3.setStrokeJoin(Join.MITER); i3.setStrokeMiter(4.0f); i3.setPathEffect(null); c.a(i3, looper).setStrokeWidth(1.0f); i3 = c.a(i2, looper); i3.setColor(-14046139); Path j = c.j(looper); j.moveTo(0.0f, 0.0f); j.lineTo(96.0f, 0.0f); j.lineTo(96.0f, 96.0f); j.lineTo(0.0f, 96.0f); j.lineTo(0.0f, 0.0f); j.close(); canvas.saveLayerAlpha(null, 0, 4); canvas.drawPath(j, c.a(i3, looper)); canvas.restore(); canvas.save(); Paint a = c.a(i2, looper); a.setColor(WebView.NIGHT_MODE_COLOR); e = c.a(e, 1.0f, 0.0f, 12.0f, 0.0f, 1.0f, 12.0f); f.reset(); f.setValues(e); canvas.concat(f); canvas.saveLayerAlpha(null, 51, 4); canvas.save(); float[] a2 = c.a(e, 1.0f, 0.0f, 6.0f, 0.0f, 1.0f, 6.0f); f.reset(); f.setValues(a2); canvas.concat(f); canvas.save(); Paint a3 = c.a(a, looper); Path j2 = c.j(looper); j2.moveTo(30.0f, 56.4f); j2.cubicTo(44.58032f, 56.4f, 56.4f, 44.58032f, 56.4f, 30.0f); j2.cubicTo(56.4f, 15.4196825f, 44.58032f, 3.6f, 30.0f, 3.6f); j2.cubicTo(15.4196825f, 3.6f, 3.6f, 15.4196825f, 3.6f, 30.0f); j2.cubicTo(3.6f, 44.58032f, 15.4196825f, 56.4f, 30.0f, 56.4f); j2.close(); j2.moveTo(30.0f, 60.0f); j2.cubicTo(13.4314575f, 60.0f, 0.0f, 46.568542f, 0.0f, 30.0f); j2.cubicTo(0.0f, 13.4314575f, 13.4314575f, 0.0f, 30.0f, 0.0f); j2.cubicTo(46.568542f, 0.0f, 60.0f, 13.4314575f, 60.0f, 30.0f); j2.cubicTo(60.0f, 46.568542f, 46.568542f, 60.0f, 30.0f, 60.0f); j2.close(); WeChatSVGRenderC2Java.setFillType(j2, 1); canvas.drawPath(j2, a3); canvas.restore(); canvas.save(); Paint a4 = c.a(a, looper); Path j3 = c.j(looper); j3.moveTo(28.199999f, 12.0f); j3.lineTo(31.8f, 12.0f); j3.lineTo(31.8f, 30.0f); j3.lineTo(28.199999f, 30.0f); j3.lineTo(28.199999f, 12.0f); j3.close(); canvas.drawPath(j3, a4); canvas.restore(); canvas.save(); a = c.a(a, looper); e = c.a(a2, 0.70710677f, -0.70710677f, 35.309544f, -0.70710677f, -0.70710677f, 85.24478f); f.reset(); f.setValues(e); canvas.concat(f); j2 = c.j(looper); j2.moveTo(34.03675f, 26.09117f); j2.lineTo(37.63675f, 26.09117f); j2.lineTo(37.63675f, 44.09117f); j2.lineTo(34.03675f, 44.09117f); j2.lineTo(34.03675f, 26.09117f); j2.close(); canvas.drawPath(j2, a); canvas.restore(); canvas.restore(); canvas.restore(); canvas.restore(); c.h(looper); break; } return 0; } }
package cn.cj.spring_boot.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.cj.spring_boot.dao.BaseDictDao; import cn.cj.spring_boot.domain.BaseDict; import cn.cj.spring_boot.service.BaseDictService; /** * 字典表处理Service * <p> * Title: BaseDictServiceImpl * </p> * <p> * Description: * </p> * <p> * Company: www.itcast.cn * </p> * * @version 1.0 */ @Service public class BaseDictServiceImpl implements BaseDictService { @Autowired private BaseDictDao baseDictDao; @Override public List<BaseDict> getDictListByTypeCode(String typeCode) { List<BaseDict> list = baseDictDao.getDictListByTypeCode(typeCode); return list; } }
package com.google.android.exoplayer2.f.g; import android.text.TextUtils; import com.google.android.exoplayer2.i.d; import com.google.android.exoplayer2.i.j; import com.google.android.exoplayer2.i.t; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; final class a { private static final Pattern azs = Pattern.compile("\\[voice=\"([^\"]*)\"\\]"); private final j azt = new j(); private final StringBuilder azu = new StringBuilder(); public final d g(j jVar) { String str; int i; int i2; this.azu.setLength(0); int i3 = jVar.position; do { } while (!TextUtils.isEmpty(jVar.readLine())); this.azt.m(jVar.data, jVar.position); this.azt.setPosition(i3); j jVar2 = this.azt; StringBuilder stringBuilder = this.azu; h(jVar2); if (jVar2.me() < 5) { str = null; } else { if ("::cue".equals(jVar2.readString(5))) { i3 = jVar2.position; String a = a(jVar2, stringBuilder); if (a == null) { str = null; } else if ("{".equals(a)) { jVar2.setPosition(i3); str = ""; } else { if ("(".equals(a)) { i3 = jVar2.position; int i4 = jVar2.limit; int i5 = i3; i = 0; while (i5 < i4 && i == 0) { i2 = i5 + 1; boolean z = ((char) jVar2.data[i5]) == ')'; i5 = i2; boolean i6 = z; } str = jVar2.readString((i5 - 1) - jVar2.position).trim(); } else { str = null; } a = a(jVar2, stringBuilder); if (!")".equals(a) || a == null) { str = null; } } } else { str = null; } } if (str == null || !"{".equals(a(this.azt, this.azu))) { return null; } d dVar = new d(); if (!"".equals(str)) { i2 = str.indexOf(91); if (i2 != -1) { Matcher matcher = azs.matcher(str.substring(i2)); if (matcher.matches()) { dVar.azC = matcher.group(1); } str = str.substring(0, i2); } String[] split = str.split("\\."); String str2 = split[0]; i6 = str2.indexOf(35); if (i6 != -1) { dVar.azA = str2.substring(0, i6); dVar.azz = str2.substring(i6 + 1); } else { dVar.azA = str2; } if (split.length > 1) { dVar.azB = Arrays.asList((String[]) Arrays.copyOfRange(split, 1, split.length)); } } i3 = 0; Object obj = null; while (i3 == 0) { i6 = this.azt.position; obj = a(this.azt, this.azu); if (obj == null || "}".equals(obj)) { i3 = true; } else { i3 = 0; } if (i3 == 0) { this.azt.setPosition(i6); jVar2 = this.azt; stringBuilder = this.azu; h(jVar2); String b = b(jVar2, stringBuilder); if (!"".equals(b) && ":".equals(a(jVar2, stringBuilder))) { String str3; h(jVar2); StringBuilder stringBuilder2 = new StringBuilder(); i6 = 0; while (i6 == 0) { int i7 = jVar2.position; String a2 = a(jVar2, stringBuilder); if (a2 == null) { str3 = null; break; } else if ("}".equals(a2) || ";".equals(a2)) { jVar2.setPosition(i7); i6 = true; } else { stringBuilder2.append(a2); } } str3 = stringBuilder2.toString(); if (!(str3 == null || "".equals(str3))) { int i8 = jVar2.position; String a3 = a(jVar2, stringBuilder); if (!";".equals(a3)) { if ("}".equals(a3)) { jVar2.setPosition(i8); } } if ("color".equals(b)) { dVar.ayT = d.as(str3); dVar.ayU = true; } else if ("background-color".equals(b)) { dVar.backgroundColor = d.as(str3); dVar.ayV = true; } else if ("text-decoration".equals(b)) { if ("underline".equals(str3)) { dVar.ayX = 1; } } else if ("font-family".equals(b)) { dVar.ayS = t.aC(str3); } else if ("font-weight".equals(b)) { if ("bold".equals(str3)) { dVar.ayY = 1; } } else if ("font-style".equals(b) && "italic".equals(str3)) { dVar.ayZ = 1; } } } } } if ("}".equals(obj)) { return dVar; } return null; } private static void h(j jVar) { int i = 1; while (jVar.me() > 0 && i != 0) { switch ((char) jVar.data[jVar.position]) { case 9: case 10: case 12: case 13: case ' ': jVar.da(1); i = 1; break; default: i = 0; break; } if (i == 0) { int i2 = jVar.position; i = jVar.limit; byte[] bArr = jVar.data; if (i2 + 2 <= i) { int i3 = i2 + 1; if (bArr[i2] == (byte) 47) { int i4 = i3 + 1; if (bArr[i3] == (byte) 42) { while (i4 + 1 < i) { i2 = i4 + 1; if (((char) bArr[i4]) == '*' && ((char) bArr[i2]) == '/') { i2++; i = i2; i4 = i2; } else { i4 = i2; } } jVar.da(i - jVar.position); i = 1; if (i == 0) { i = 0; } } } } i = 0; if (i == 0) { i = 0; } } i = 1; } } private static String a(j jVar, StringBuilder stringBuilder) { h(jVar); if (jVar.me() == 0) { return null; } String b = b(jVar, stringBuilder); return "".equals(b) ? ((char) jVar.readUnsignedByte()) : b; } private static String b(j jVar, StringBuilder stringBuilder) { int i = 0; stringBuilder.setLength(0); int i2 = jVar.position; int i3 = jVar.limit; while (i2 < i3 && i == 0) { char c = (char) jVar.data[i2]; if ((c < 'A' || c > 'Z') && ((c < 'a' || c > 'z') && !((c >= '0' && c <= '9') || c == '#' || c == '-' || c == '.' || c == '_'))) { i = 1; } else { i2++; stringBuilder.append(c); } } jVar.da(i2 - jVar.position); return stringBuilder.toString(); } }
package br.com.zup.zupacademy.daniel.mercadolivre.common; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @Component @Primary public class GerenciadorDeEmailFake implements GerenciadorDeEmail{ @Override public void enviaEmail(String remetente, String destinatario, String assunto, String corpo) { System.out.println("\nAssunto: "+assunto+"\n\nCorpo: "+corpo+ "\n\nemail enviado com sucesso\n"); } }
package test.thread; import org.apache.commons.lang3.StringUtils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.concurrent.Callable; /** * Created by maguoqiang on 2017/12/7. * */ public class DownloadResult2Thread implements Callable<InputStream> { private String url; private String path; public DownloadResult2Thread(String url,String path) { this.url=url; this.path=path; } @Override public InputStream call() throws Exception { System.out.println(url + "," + path); URL url_img; InputStream in = null; try { url_img = new URL(url); URLConnection conn; conn = url_img.openConnection(); in = conn.getInputStream(); } catch (MalformedURLException e) { e.printStackTrace(); } return in; } }