blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
21ccdeac09ed5e9354d88a9a1ce2ba1ccd2d7f45
4b39ec75d36432d4c25864d97b8312aabf0626a3
/construct_project_manage/manage-pojo/src/main/java/com/baidu/pojo/ContractReceipt.java
cae5524eb1d26598df7372470308e24a867c28b2
[]
no_license
acalculia/ConstructProjectManage
cdc514f5f8339af0cf4fcf88daa10401a9f08efb
f3f74e85d8d96e82d910461e3c43b20c74a3dacd
refs/heads/master
2022-12-27T20:38:42.156126
2020-10-03T01:51:27
2020-10-03T01:51:27
299,776,740
0
0
null
null
null
null
UTF-8
Java
false
false
4,029
java
package com.baidu.pojo; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; import java.io.Serializable; /** * 合同收款(ContractReceipt)实体类 * * @author makejava * @since 2020-09-29 15:19:36 */ @Data @AllArgsConstructor @NoArgsConstructor @TableName("contract_receipt") public class ContractReceipt implements Serializable { private static final long serialVersionUID = -90851615763214796L; /** * 编号 */ private Integer id; /** * 项目ID */ private Integer pid; /** * 合同ID */ private Integer ctrId; /** * 收款名称 */ private String receiptName; /** * 收款类型 */ private String receiptType; /** * 收款金额 */ private Double receiptAmount; /** * 收款金额大写 */ private String amountUpper; /** * 罚款 */ private Double penalty; /** * 扣款 */ private Double withhold; /** * 账户ID */ private Integer accountId; /** * 填报人 */ private String applyer; /** * 填报日期 */ private Date applyDate; /** * 备注 */ private String comments; /** * 审批状态 */ private Integer approveStatus; /** * 更新人 */ private String updateUser; /** * 更新日期 */ private Date updateDate; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getPid() { return pid; } public void setPid(Integer pid) { this.pid = pid; } public Integer getCtrId() { return ctrId; } public void setCtrId(Integer ctrId) { this.ctrId = ctrId; } public String getReceiptName() { return receiptName; } public void setReceiptName(String receiptName) { this.receiptName = receiptName; } public String getReceiptType() { return receiptType; } public void setReceiptType(String receiptType) { this.receiptType = receiptType; } public Double getReceiptAmount() { return receiptAmount; } public void setReceiptAmount(Double receiptAmount) { this.receiptAmount = receiptAmount; } public String getAmountUpper() { return amountUpper; } public void setAmountUpper(String amountUpper) { this.amountUpper = amountUpper; } public Double getPenalty() { return penalty; } public void setPenalty(Double penalty) { this.penalty = penalty; } public Double getWithhold() { return withhold; } public void setWithhold(Double withhold) { this.withhold = withhold; } public Integer getAccountId() { return accountId; } public void setAccountId(Integer accountId) { this.accountId = accountId; } public String getApplyer() { return applyer; } public void setApplyer(String applyer) { this.applyer = applyer; } public Date getApplyDate() { return applyDate; } public void setApplyDate(Date applyDate) { this.applyDate = applyDate; } public String getComments() { return comments; } public void setComments(String comments) { this.comments = comments; } public Integer getApproveStatus() { return approveStatus; } public void setApproveStatus(Integer approveStatus) { this.approveStatus = approveStatus; } public String getUpdateUser() { return updateUser; } public void setUpdateUser(String updateUser) { this.updateUser = updateUser; } public Date getUpdateDate() { return updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } }
c21a56e49a6a365c02e9c53c71b051004b05c59a
dd62012819e5fe95ab5cb1b60b97e8f63e9ec7b3
/esupplier-facade-wsp/src/main/java/com/yjf/esupplier/ws/bill/order/CancelBillOrder.java
93241601a23222d452713786f399622fd0c46627
[]
no_license
cl510804194/fengjievue
86a40c7e8c4ef3b432cd8152986b34c53174d6e6
e1f58f14398a1b5ce0b671f17bfd4c3c88a8ee4e
refs/heads/master
2020-04-19T09:48:17.742220
2019-01-29T08:52:26
2019-01-29T08:52:26
168,121,303
1
3
null
null
null
null
UTF-8
Java
false
false
1,095
java
package com.yjf.esupplier.ws.bill.order; import com.yjf.esupplier.ws.enums.UserBizTypeEnum; import com.yjf.esupplier.ws.order.ProcessOrder; public class CancelBillOrder extends ProcessOrder { private static final long serialVersionUID = 7381491037203560073L; UserBizTypeEnum bizTypeEnum; String batchNo; @Override public void check() { super.check(); validateNotNull(bizTypeEnum, "操作方"); validateHasZore(processorId, "用户id"); validateHasText(processName, "用户"); } public UserBizTypeEnum getBizTypeEnum() { return this.bizTypeEnum; } public void setBizTypeEnum(UserBizTypeEnum bizTypeEnum) { this.bizTypeEnum = bizTypeEnum; } public String getBatchNo() { return batchNo; } public void setBatchNo(String batchNo) { this.batchNo = batchNo; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("CancelBillOrder [bizTypeEnum="); builder.append(bizTypeEnum); builder.append(", toString()="); builder.append(super.toString()); builder.append("]"); return builder.toString(); } }
6e13f01dd9ab2ebc11de57b69d4636fc6340f26b
9833e1f937299a074760d6acad8b908a8daa3725
/mblog-web/src/main/java/mblog/web/controller/desk/SearchController.java
40f053fa7388c5e9fc961fc7f264457aba33f370
[ "Apache-2.0" ]
permissive
JsonandSesson/jsonlu
013fb227dcf9323e8b65929151d1cd06fc099a91
a01e576fc81090fd6ad6c7d8c9ca293ab7c2f366
refs/heads/master
2021-01-20T00:01:59.281018
2018-07-02T14:51:44
2018-07-02T14:51:44
89,069,350
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
/* +-------------------------------------------------------------------------- | Mblog [#RELEASE_VERSION#] | ======================================== | Copyright (c) 2014, 2015 mtons. All Rights Reserved | http://www.mtons.com | +--------------------------------------------------------------------------- */ package mblog.web.controller.desk; import mblog.core.data.Post; import mblog.core.persist.service.PostService; import mblog.web.controller.BaseController; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; /** * 文章搜索 * @author langhsu * */ @Controller public class SearchController extends BaseController { @Autowired private PostService postService; @RequestMapping("/search") public String search(String q, ModelMap model) { Pageable pageable = wrapPageable(); try { if (StringUtils.isNotEmpty(q)) { Page<Post> page = postService.search(pageable, q); model.put("page", page); } } catch (Exception e) { e.printStackTrace(); } model.put("q", q); return getView(Views.BROWSE_SEARCH); } }
cdce33292dead3c9e7d6367cd8850299d2c42316
c229818c28d0afbb3c399b46cb6923cc635a83e2
/common/common-spring/src/main/java/com/x/api/common/exception/AuthorizationException.java
24b15809b26c0f12a69af381405d1187329d6408
[ "Apache-2.0" ]
permissive
pftx/api-mono
9b8c3958d1884f36a24b4f1901f0696d8d0f3a8c
149c21009aed9b801f00c44b654a78e5636046fa
refs/heads/master
2021-08-20T07:08:15.999140
2017-11-28T13:16:00
2017-11-28T13:16:00
108,487,537
0
0
null
null
null
null
UTF-8
Java
false
false
2,423
java
/** * AuthorizationException.java * * Copyright 2017 the original author or authors. * * We licenses this file to you under the Apache License, version 2.0 * (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.x.api.common.exception; import java.util.Map; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; import com.x.api.common.util.Constants; /** * @author <a href="mailto:[email protected]">Lex Xie</a> * @version 1.0.0 * @since Nov 14, 2017 */ @ResponseStatus(HttpStatus.FORBIDDEN) public class AuthorizationException extends ServiceException { private static final long serialVersionUID = 564543920992298819L; public static AuthorizationException noPermissionToOperate(String entityType, long id) { return new AuthorizationException(String.format(Constants.MSG_NO_PERM_TO_OP, entityType, id)); } public static AuthorizationException noPermissionToRead(String entityType, long id) { return new AuthorizationException(String.format(Constants.MSG_NO_PERM_TO_READ, entityType, id)); } public AuthorizationException() { super(Constants.MSG_NO_PERMISSION); } public AuthorizationException(Map<String, Object> extension) { super(extension); } public AuthorizationException(String message, Map<String, Object> extension) { super(message, extension); } public AuthorizationException(String message, Throwable cause, Map<String, Object> extension) { super(message, cause, extension); } public AuthorizationException(String message, Throwable cause) { super(message, cause); } public AuthorizationException(String message) { super(message); } public AuthorizationException(Throwable cause, Map<String, Object> extension) { super(cause, extension); } public AuthorizationException(Throwable cause) { super(cause); } }
73a271c2235270f654766efd522c09d2c84965b2
159e291285772fe314d6ed7e4a78902371b6ef78
/src/dao/OrderInputDisplayDBAccess.java
f2dcee1dd1877073e313505fbc2148e705c414ca
[]
no_license
minimog83/GuestInfoSearchApp
90a89b1123d88e47ec18cd02abd01b390b8291a8
4276d67d05db13a804a4d0b2db375e5a7b67c1a8
refs/heads/master
2022-06-18T03:42:13.741465
2020-05-13T01:21:55
2020-05-13T01:21:55
263,495,378
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
/** * クラス名: OrderInputDisplayDBAccess * 概要  : 注文情報入力画面表示DAO * 作成者名: * 作成日 : * 修正者名: * 修正日 : */ package dao; import model.Customer; public class OrderInputDisplayDBAccess { public Customer searchCustomerById(int custId) throws Exception { return null; } }
4e0fecf4332cbc040c742bfbe8623c6606b2597a
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_6_buggy/mutated/496/QueryParser.java
8c773dc40a1eb275183309380dde6161b16f8192
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,588
java
package org.jsoup.select; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jsoup.helper.StringUtil; import org.jsoup.helper.Validate; import org.jsoup.parser.TokenQueue; /** * Parses a CSS selector into an Evaluator tree. */ public class QueryParser { private final static String[] combinators = {",", ">", "+", "~", " "}; private static final String[] AttributeEvals = new String[]{"=", "!=", "^=", "$=", "*=", "~="}; private TokenQueue tq; private String query; private List<Evaluator> evals = new ArrayList<Evaluator>(); /** * Create a new QueryParser. * @param query CSS query */ private QueryParser(String query) { this.query = query; this.tq = new TokenQueue(query); } /** * Parse a CSS query into an Evaluator. * @param query CSS query * @return Evaluator */ public static Evaluator parse(String query) { QueryParser p = new QueryParser(query); return consumeIndexse(); } /** * Parse the query * @return Evaluator */ Evaluator parse() { tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements evals.add(new StructuralEvaluator.Root()); combinator(tq.consume()); } else { findElements(); } while (!tq.isEmpty()) { // hierarchy and extras boolean seenWhite = tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { combinator(tq.consume()); } else if (seenWhite) { combinator(' '); } else { // E.class, E#id, E[attr] etc. AND findElements(); // take next el, #. etc off queue } } if (evals.size() == 1) return evals.get(0); return new CombiningEvaluator.And(evals); } private void combinator(char combinator) { tq.consumeWhitespace(); String subQuery = consumeSubQuery(); // support multi > childs Evaluator rootEval; // the new topmost evaluator Evaluator currentEval; // the evaluator the new eval will be combined to. could be root, or rightmost or. Evaluator newEval = parse(subQuery); // the evaluator to add into target evaluator boolean replaceRightMost = false; if (evals.size() == 1) { rootEval = currentEval = evals.get(0); // make sure OR (,) has precedence: if (rootEval instanceof CombiningEvaluator.Or && combinator != ',') { currentEval = ((CombiningEvaluator.Or) currentEval).rightMostEvaluator(); replaceRightMost = true; } } else { rootEval = currentEval = new CombiningEvaluator.And(evals); } evals.clear(); // for most combinators: change the current eval into an AND of the current eval and the new eval if (combinator == '>') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.ImmediateParent(currentEval)); else if (combinator == ' ') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.Parent(currentEval)); else if (combinator == '+') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.ImmediatePreviousSibling(currentEval)); else if (combinator == '~') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.PreviousSibling(currentEval)); else if (combinator == ',') { // group or. CombiningEvaluator.Or or; if (currentEval instanceof CombiningEvaluator.Or) { or = (CombiningEvaluator.Or) currentEval; or.add(newEval); } else { or = new CombiningEvaluator.Or(); or.add(currentEval); or.add(newEval); } currentEval = or; } else throw new Selector.SelectorParseException("Unknown combinator: " + combinator); if (replaceRightMost) ((CombiningEvaluator.Or) rootEval).replaceRightMostEvaluator(currentEval); else rootEval = currentEval; evals.add(rootEval); } private String consumeSubQuery() { StringBuilder sq = new StringBuilder(); while (!tq.isEmpty()) { if (tq.matches("(")) sq.append("(").append(tq.chompBalanced('(', ')')).append(")"); else if (tq.matches("[")) sq.append("[").append(tq.chompBalanced('[', ']')).append("]"); else if (tq.matchesAny(combinators)) break; else sq.append(tq.consume()); } return sq.toString(); } private void findElements() { if (tq.matchChomp("#")) byId(); else if (tq.matchChomp(".")) byClass(); else if (tq.matchesWord() || tq.matches("*|")) byTag(); else if (tq.matches("[")) byAttribute(); else if (tq.matchChomp("*")) allElements(); else if (tq.matchChomp(":lt(")) indexLessThan(); else if (tq.matchChomp(":gt(")) indexGreaterThan(); else if (tq.matchChomp(":eq(")) indexEquals(); else if (tq.matches(":has(")) has(); else if (tq.matches(":contains(")) contains(false); else if (tq.matches(":containsOwn(")) contains(true); else if (tq.matches(":containsData(")) containsData(); else if (tq.matches(":matches(")) matches(false); else if (tq.matches(":matchesOwn(")) matches(true); else if (tq.matches(":not(")) not(); else if (tq.matchChomp(":nth-child(")) cssNthChild(false, false); else if (tq.matchChomp(":nth-last-child(")) cssNthChild(true, false); else if (tq.matchChomp(":nth-of-type(")) cssNthChild(false, true); else if (tq.matchChomp(":nth-last-of-type(")) cssNthChild(true, true); else if (tq.matchChomp(":first-child")) evals.add(new Evaluator.IsFirstChild()); else if (tq.matchChomp(":last-child")) evals.add(new Evaluator.IsLastChild()); else if (tq.matchChomp(":first-of-type")) evals.add(new Evaluator.IsFirstOfType()); else if (tq.matchChomp(":last-of-type")) evals.add(new Evaluator.IsLastOfType()); else if (tq.matchChomp(":only-child")) evals.add(new Evaluator.IsOnlyChild()); else if (tq.matchChomp(":only-of-type")) evals.add(new Evaluator.IsOnlyOfType()); else if (tq.matchChomp(":empty")) evals.add(new Evaluator.IsEmpty()); else if (tq.matchChomp(":root")) evals.add(new Evaluator.IsRoot()); else // unhandled throw new Selector.SelectorParseException("Could not parse query '%s': unexpected token at '%s'", query, tq.remainder()); } private void byId() { String id = tq.consumeCssIdentifier(); Validate.notEmpty(id); evals.add(new Evaluator.Id(id)); } private void byClass() { String className = tq.consumeCssIdentifier(); Validate.notEmpty(className); evals.add(new Evaluator.Class(className.trim())); } private void byTag() { String tagName = tq.consumeElementSelector(); Validate.notEmpty(tagName); // namespaces: wildcard match equals(tagName) or ending in ":"+tagName if (tagName.startsWith("*|")) { evals.add(new CombiningEvaluator.Or(new Evaluator.Tag(tagName.trim().toLowerCase()), new Evaluator.TagEndsWith(tagName.replace("*|", ":").trim().toLowerCase()))); } else { // namespaces: if element name is "abc:def", selector must be "abc|def", so flip: if (tagName.contains("|")) tagName = tagName.replace("|", ":"); evals.add(new Evaluator.Tag(tagName.trim())); } } private void byAttribute() { TokenQueue cq = new TokenQueue(tq.chompBalanced('[', ']')); // content queue String key = cq.consumeToAny(AttributeEvals); // eq, not, start, end, contain, match, (no val) Validate.notEmpty(key); cq.consumeWhitespace(); if (cq.isEmpty()) { if (key.startsWith("^")) evals.add(new Evaluator.AttributeStarting(key.substring(1))); else evals.add(new Evaluator.Attribute(key)); } else { if (cq.matchChomp("=")) evals.add(new Evaluator.AttributeWithValue(key, cq.remainder())); else if (cq.matchChomp("!=")) evals.add(new Evaluator.AttributeWithValueNot(key, cq.remainder())); else if (cq.matchChomp("^=")) evals.add(new Evaluator.AttributeWithValueStarting(key, cq.remainder())); else if (cq.matchChomp("$=")) evals.add(new Evaluator.AttributeWithValueEnding(key, cq.remainder())); else if (cq.matchChomp("*=")) evals.add(new Evaluator.AttributeWithValueContaining(key, cq.remainder())); else if (cq.matchChomp("~=")) evals.add(new Evaluator.AttributeWithValueMatching(key, Pattern.compile(cq.remainder()))); else throw new Selector.SelectorParseException("Could not parse attribute query '%s': unexpected token at '%s'", query, cq.remainder()); } } private void allElements() { evals.add(new Evaluator.AllElements()); } // pseudo selectors :lt, :gt, :eq private void indexLessThan() { evals.add(new Evaluator.IndexLessThan(consumeIndex())); } private void indexGreaterThan() { evals.add(new Evaluator.IndexGreaterThan(consumeIndex())); } private void indexEquals() { evals.add(new Evaluator.IndexEquals(consumeIndex())); } //pseudo selectors :first-child, :last-child, :nth-child, ... private static final Pattern NTH_AB = Pattern.compile("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d+)?", Pattern.CASE_INSENSITIVE); private static final Pattern NTH_B = Pattern.compile("(\\+|-)?(\\d+)"); private void cssNthChild(boolean backwards, boolean ofType) { String argS = tq.chompTo(")").trim().toLowerCase(); Matcher mAB = NTH_AB.matcher(argS); Matcher mB = NTH_B.matcher(argS); final int a, b; if ("odd".equals(argS)) { a = 2; b = 1; } else if ("even".equals(argS)) { a = 2; b = 0; } else if (mAB.matches()) { a = mAB.group(3) != null ? Integer.parseInt(mAB.group(1).replaceFirst("^\\+", "")) : 1; b = mAB.group(4) != null ? Integer.parseInt(mAB.group(4).replaceFirst("^\\+", "")) : 0; } else if (mB.matches()) { a = 0; b = Integer.parseInt(mB.group().replaceFirst("^\\+", "")); } else { throw new Selector.SelectorParseException("Could not parse nth-index '%s': unexpected format", argS); } if (ofType) if (backwards) evals.add(new Evaluator.IsNthLastOfType(a, b)); else evals.add(new Evaluator.IsNthOfType(a, b)); else { if (backwards) evals.add(new Evaluator.IsNthLastChild(a, b)); else evals.add(new Evaluator.IsNthChild(a, b)); } } private int consumeIndex() { String indexS = tq.chompTo(")").trim(); Validate.isTrue(StringUtil.isNumeric(indexS), "Index must be numeric"); return Integer.parseInt(indexS); } // pseudo selector :has(el) private void has() { tq.consume(":has"); String subQuery = tq.chompBalanced('(', ')'); Validate.notEmpty(subQuery, ":has(el) subselect must not be empty"); evals.add(new StructuralEvaluator.Has(parse(subQuery))); } // pseudo selector :contains(text), containsOwn(text) private void contains(boolean own) { tq.consume(own ? ":containsOwn" : ":contains"); String searchText = TokenQueue.unescape(tq.chompBalanced('(', ')')); Validate.notEmpty(searchText, ":contains(text) query must not be empty"); if (own) evals.add(new Evaluator.ContainsOwnText(searchText)); else evals.add(new Evaluator.ContainsText(searchText)); } // pseudo selector :containsData(data) private void containsData() { tq.consume(":containsData"); String searchText = TokenQueue.unescape(tq.chompBalanced('(', ')')); Validate.notEmpty(searchText, ":containsData(text) query must not be empty"); evals.add(new Evaluator.ContainsData(searchText)); } // :matches(regex), matchesOwn(regex) private void matches(boolean own) { tq.consume(own ? ":matchesOwn" : ":matches"); String regex = tq.chompBalanced('(', ')'); // don't unescape, as regex bits will be escaped Validate.notEmpty(regex, ":matches(regex) query must not be empty"); if (own) evals.add(new Evaluator.MatchesOwn(Pattern.compile(regex))); else evals.add(new Evaluator.Matches(Pattern.compile(regex))); } // :not(selector) private void not() { tq.consume(":not"); String subQuery = tq.chompBalanced('(', ')'); Validate.notEmpty(subQuery, ":not(selector) subselect must not be empty"); evals.add(new StructuralEvaluator.Not(parse(subQuery))); } }
3098e8084fe9fb6f43f74e70ef9f377a0e0e4251
717b1dea2805c2f73ae33bed566335a1884269bd
/Hmm.../app/src/main/java/thinkers/hmm/util/FacultyReviewDraftUtil.java
42bff2ea5ca7950ea7282b6caa04f1a23fcafbea
[]
no_license
Charlie233/AndroidDevelopment
2c1eb14dde8377f67f0373e0f319fc7f06c33e9f
955b733bfa0fc99b5733388ed0b367852000f07e
refs/heads/master
2021-01-22T06:58:43.679917
2015-08-09T16:31:04
2015-08-09T16:31:04
40,441,373
0
0
null
null
null
null
UTF-8
Java
false
false
4,939
java
package thinkers.hmm.util; import android.util.Log; import java.sql.SQLException; import java.util.ArrayList; import thinkers.hmm.model.CourseReviewDraft; import thinkers.hmm.model.Faculty; import thinkers.hmm.model.FacultyReviewDraft; /** * Created by chaoli on 7/18/15. */ public class FacultyReviewDraftUtil extends DatabaseConnector { //Debug TAG private final String TAG = "Fac_review_draft_util"; //SQL Statements private final String selectDraftSQL = "SELECT * FROM FacultyReviewDrafts WHERE id=?;"; private final String selectDraftByUidSQL = "SELECT * FROM FacultyReviewDrafts WHERE uid=?;"; private final String updateDraftSQL = "UPDATE FacultyReviewDrafts SET fid=?, uid=?, " + "title=?, content=? WHERE id=?;"; private final String insertDraftSQL = "INSERT INTO FacultyReviewDrafts(fid,uid,title,content) VALUES" + "(?,?,?,?);"; private final String deleteDraftSQL = "DELETE FROM FacultyReviewDrafts WHERE id=?;"; public FacultyReviewDraft selectDraft(int draftId){ FacultyReviewDraft draft = null; try { open(); preparedStatement = connection.prepareStatement(selectDraftSQL); preparedStatement.setInt(1, draftId); resultSet = preparedStatement.executeQuery(); if (resultSet.next()) { int id = resultSet.getInt("id"); int fid = resultSet.getInt("fid"); int uid = resultSet.getInt("uid"); String title = resultSet.getString("title"); String content = resultSet.getString("content"); draft = new FacultyReviewDraft(id, uid, fid, title, content); } } catch(SQLException ex) { Log.d(TAG, ex.getClass().getSimpleName()); } finally { close(); } return draft; } public ArrayList<FacultyReviewDraft> selectDraftByUid(int uid){ ArrayList<FacultyReviewDraft> facultyReviewDrafts = new ArrayList<FacultyReviewDraft>(); FacultyReviewDraft draft = null; try { open(); preparedStatement = connection.prepareStatement(selectDraftSQL); preparedStatement.setInt(1, uid); resultSet = preparedStatement.executeQuery(); if (resultSet.next()) { int id = resultSet.getInt("id"); int fid = resultSet.getInt("fid"); String title = resultSet.getString("title"); String content = resultSet.getString("content"); draft = new FacultyReviewDraft(id, uid, fid, title, content); facultyReviewDrafts.add(draft); } } catch(SQLException ex) { Log.d(TAG, ex.getClass().getSimpleName()); } finally { close(); } return facultyReviewDrafts; } public boolean updateDraft(int draftId, FacultyReviewDraft draft){ try { open(); preparedStatement = connection.prepareStatement(updateDraftSQL); preparedStatement.setInt(1, draft.getFid()); preparedStatement.setInt(2, draft.getUid()); preparedStatement.setString(3, draft.getTitle()); preparedStatement.setString(4, draft.getContent()); preparedStatement.setInt(5, draftId); // execute the java preparedStatement preparedStatement.executeUpdate(); close(); return true; } catch(SQLException ex) { Log.d(TAG, ex.getClass().getSimpleName()); } finally { close(); } return false; } public boolean deleteDraft(int draftId){ try { open(); preparedStatement = connection.prepareStatement(deleteDraftSQL); preparedStatement.setInt(1, draftId); // execute the java preparedStatement preparedStatement.executeUpdate(); close(); return true; } catch(SQLException ex) { Log.d(TAG, ex.getClass().getSimpleName()); } finally { close(); } return false; } public boolean insertFacultyReviewDraft(FacultyReviewDraft draft){ try { open(); preparedStatement = connection.prepareStatement(insertDraftSQL); preparedStatement.setInt(1, draft.getFid()); preparedStatement.setInt(2, draft.getUid()); preparedStatement.setString(3, draft.getTitle()); preparedStatement.setString(4, draft.getContent()); // execute the java preparedStatement preparedStatement.executeUpdate(); close(); return true; } catch(SQLException ex) { Log.d(TAG, ex.getClass().getSimpleName()); } finally { close(); } return false; } }
b17054962a289fdaefe926b52ab4e79664a65c54
77fb90c41fd2844cc4350400d786df99e14fa4ca
/f/g/c/package_8/Multimap.java
235e8bc609fac0227f23ed9a70154395186cde94
[]
no_license
highnes7/umaang_decompiled
341193b25351188d69b4413ebe7f0cde6525c8fb
bcfd90dffe81db012599278928cdcc6207632c56
refs/heads/master
2020-06-19T07:47:18.630455
2019-07-12T17:16:13
2019-07-12T17:16:13
196,615,053
0
0
null
null
null
null
UTF-8
Java
false
false
1,277
java
package f.g.c.package_8; import f.g.c.a.b; import java.util.Collection; import java.util.Map; import java.util.Set; @b public abstract interface Multimap<K, V> { public abstract Map asMap(); public abstract void clear(); public abstract boolean containsEntry(Object paramObject1, Object paramObject2); public abstract boolean containsKey(Object paramObject); public abstract boolean containsValue(Object paramObject); public abstract Collection entries(); public abstract boolean equals(Object paramObject); public abstract Collection get(Object paramObject); public abstract int hashCode(); public abstract boolean isEmpty(); public abstract Set keySet(); public abstract Multiset keys(); public abstract boolean put(Object paramObject1, Object paramObject2); public abstract boolean putAll(Multimap paramMultimap); public abstract boolean putAll(Object paramObject, Iterable paramIterable); public abstract boolean remove(Object paramObject1, Object paramObject2); public abstract Collection removeAll(Object paramObject); public abstract Collection replaceValues(Object paramObject, Iterable paramIterable); public abstract int size(); public abstract Collection values(); }
98776c792cac50ed0b5d1792f1dfc3bb64a41000
4092dcc729a4268f5c8adf90669b52f7e347fc79
/app/src/main/java/com/dailycoding/buttonclickexample/MainActivity.java
b29a906b8192fb96166c57471281fff6b6dcc7a6
[]
no_license
pixAndroid/Button-Click-Events-Example
b838e1d21b07bb7078f76589d2904e212802db8e
faab5fd2c46738ff4995918bf598d8abc34f99d8
refs/heads/master
2023-03-09T23:46:19.483442
2020-05-01T06:30:10
2020-05-01T06:30:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,340
java
package com.dailycoding.buttonclickexample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button button01, button02, button03; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button01 = findViewById(R.id.button_01); button02 = findViewById(R.id.button_02); button03 = findViewById(R.id.button_03); button01.setOnClickListener(this); button02.setOnClickListener(this); button03.setOnClickListener(this); /* Remember: button01.setOnClickListener(this); this statement is not required if we approach click event like below. button01.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(this, "Button01 Clicked", Toast.LENGTH_SHORT).show(); } }); button02....... button03....... */ } @Override public void onClick(View v) { int id = v.getId(); if (id == R.id.button_01) { Toast.makeText(this, "Button01 Clicked", Toast.LENGTH_SHORT).show(); } else if (id == R.id.button_02) { Toast.makeText(this, "Button02 Clicked", Toast.LENGTH_SHORT).show(); } else if (id == R.id.button_03) { Toast.makeText(this, "Button03 Clicked", Toast.LENGTH_SHORT).show(); } } /* Remember: In XML, widgets or views must include android:onClick="myButtonClick" attribute ... public void myButtonClick(View view) { int id = view.getId(); switch (id) { case R.id.button_01: Toast.makeText(this, "Button01 Clicked", Toast.LENGTH_SHORT).show(); break; case R.id.button_02: Toast.makeText(this, "Button02 Clicked", Toast.LENGTH_SHORT).show(); break; case R.id.button_03: Toast.makeText(this, "Button03 Clicked", Toast.LENGTH_SHORT).show(); break; } }*/ }
1867173495af48d1c5f1e343a62057278a153fb3
1faff28927206a1d274012b6ef5f7c38adaa46d0
/pixelcat-web/src/main/java/com/pixelcat/pixelcat/web/config/WebConfig.java
7fe519aeca07cd0480739301df47996da21f7e2e
[]
no_license
Mysakura/pixelcat-parent
c56e50fedd203ea750ee94b68e4a33e127651d25
d57cd2741bd2c20fac8f91765886def94671d6b5
refs/heads/master
2023-03-27T00:40:14.042424
2021-03-17T11:48:09
2021-03-17T11:48:09
319,223,411
0
1
null
null
null
null
UTF-8
Java
false
false
650
java
package com.pixelcat.pixelcat.web.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOriginPatterns("*") // SpringBoot2.4.0 [allowedOriginPatterns]代替[allowedOrigins] .allowedMethods("*") .maxAge(3600) .allowCredentials(true); } }
1ee3ccf209f27417cac65d6a29141be189c68066
ad1653f32027bfb655361daf6b4db1d457ee1952
/opt4j-benchmarks/src/main/java/org/opt4j/benchmarks/zdt/ZDT3.java
5ddba889550f8aa1c7bb10fafb9c5589f86dd992
[ "MIT" ]
permissive
FedorSmirnov89/opt4j
7660e75958e2574efdd50d077b275e359ae043f3
aad653d2c026ec3a38c59f56af0bd60f831c4edd
refs/heads/master
2022-02-22T18:54:55.666546
2022-02-14T07:12:40
2022-02-14T07:12:40
119,882,017
2
0
MIT
2020-06-04T12:44:38
2018-02-01T19:21:24
Java
UTF-8
Java
false
false
1,732
java
/******************************************************************************* * Copyright (c) 2014 Opt4J * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. *******************************************************************************/ package org.opt4j.benchmarks.zdt; import static java.lang.Math.PI; import static java.lang.Math.sin; /** * Function ZDT 3. * * @author lukasiewycz * */ public class ZDT3 extends ZDT1 { /* * (non-Javadoc) * * @see org.opt4j.benchmark.zdt.ZDT1#h(double, double) */ @Override protected double h(double f1, double g) { double h = super.h(f1, g) - (f1 / g) * sin(10 * PI * f1); return h; } }
bfbae794dd3d80558158923a5cdd3f13992d5208
888b8d6199da62bbecb5a481f8bb4ff6a1177c65
/app/src/main/java/com/example/mymusicmp3/Activity/MainActivity.java
b820c9abe9023e5bd40cdca566f68d1fb6a5ff3c
[]
no_license
ThanhXuan1902/MyAppMp3
69c33c61678c0c6cac7b07cb8f99c735a4893612
45e86c85b63e09affa92b4106969ee874c5fecdc
refs/heads/master
2023-05-07T08:05:17.411840
2021-05-29T12:23:23
2021-05-29T12:23:23
371,965,271
0
0
null
null
null
null
UTF-8
Java
false
false
1,736
java
package com.example.mymusicmp3.Activity; import androidx.appcompat.app.AppCompatActivity; import androidx.viewpager.widget.ViewPager; import android.os.Bundle; import com.example.mymusicmp3.Adapter.MainViewPagerAdapter; import com.example.mymusicmp3.Fragment.Fragment_Thong_Tin; import com.example.mymusicmp3.Fragment.Fragment_Thu_Muc; import com.example.mymusicmp3.Fragment.Fragment_Tim_Kiem; import com.example.mymusicmp3.Fragment.Fragment_Trang_Chu; import com.example.mymusicmp3.R; import com.google.android.material.tabs.TabLayout; public class MainActivity extends AppCompatActivity { TabLayout tabLayout; ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AnhXa(); init(); } private void init() { MainViewPagerAdapter mainViewPagerAdapter = new MainViewPagerAdapter(getSupportFragmentManager()); mainViewPagerAdapter.addFragment(new Fragment_Trang_Chu(), "Trang Chủ"); mainViewPagerAdapter.addFragment(new Fragment_Tim_Kiem(),"Tìm Kiếm"); mainViewPagerAdapter.addFragment(new Fragment_Thu_Muc(), "Thư Mục"); mainViewPagerAdapter.addFragment(new Fragment_Thong_Tin(), "Thông Tin"); viewPager.setAdapter(mainViewPagerAdapter); tabLayout.setupWithViewPager(viewPager); // tabLayout.getTabAt(0).setIcon(R.drawable.icontrangchu); // tabLayout.getTabAt(1).setIcon(R.drawable.iconsearch); } private void AnhXa() { tabLayout = (TabLayout) findViewById(R.id.activity_main_TabLayout); viewPager = (ViewPager) findViewById(R.id.activity_main_ViewPager); } }
80cf7b040fa8ffa5eed92c82654a8dfeb6d058e3
c6d931a0b96addf006061f4f1e8bc78e53e35263
/core-test/src/main/java/org/openstack4j/api/gbp/NatPoolServiceTest.java
34cadf88d5f118dd3fd4c77fd09c4f90007d4482
[ "Apache-2.0" ]
permissive
17862953931/openstack4j
a8ea441009d14afa839cf6f42d128652687751e1
9d5f1a0c91b6db8942019fddd2997e6b2a33ef57
refs/heads/master
2020-09-04T09:29:26.354230
2020-02-19T02:52:06
2020-02-19T02:52:06
219,702,460
2
1
NOASSERTION
2020-02-19T02:52:07
2019-11-05T09:09:05
Java
UTF-8
Java
false
false
3,018
java
package org.openstack4j.api.gbp; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.util.List; import java.util.logging.Logger; import org.openstack4j.api.AbstractTest; import org.openstack4j.api.Builders; import org.openstack4j.model.common.ActionResponse; import org.openstack4j.model.gbp.NatPool; import org.testng.annotations.Test; import com.google.common.base.Preconditions; /** * Test cases for nat pool on GBP * * @author vinod borole */ @Test(suiteName="grouppolicy/nat_pools") public class NatPoolServiceTest extends AbstractTest { private static final String NAT_POOLS="/network/gbp/nat_pools.json"; private static final String NAT_POOL="/network/gbp/nat_pool.json"; private static final String NAT_POOL_UPDATE="/network/gbp/nat_pool_update.json"; @Override protected Service service() { return Service.NETWORK; } @Test public void testListNatPool() throws Exception{ respondWith(NAT_POOLS); List<? extends NatPool> natpoolList = osv2().gbp().natPool().list(); assertEquals(2, natpoolList.size()); Preconditions.checkNotNull(natpoolList.get(0)); Logger.getLogger(getClass().getName()).info(getClass().getName() + " : Nat Pool from List : "+natpoolList.get(0)); assertEquals(natpoolList.get(0).getId(), "f2e4fce7-4c55-497b-ac4c-290dd202c71a"); } @Test public void testGetNatPool() throws Exception{ respondWith(NAT_POOL); String id = "e2d4fce7-4c55-497b-ac4c-290dd202c71a"; NatPool natPool = osv2().gbp().natPool().get(id); Logger.getLogger(getClass().getName()).info(getClass().getName() + " : Nat Pool by ID : "+natPool); assertNotNull(natPool); assertEquals(id, natPool.getId()); } @Test public void testCreateNatPool() throws Exception{ respondWith(NAT_POOL); NatPool natPool= Builders.natPool().name("ptg_nat_pool").build(); NatPool npool = osv2().gbp().natPool().create(natPool); Logger.getLogger(getClass().getName()).info(getClass().getName() + " : Created Nat Pool : "+npool); assertEquals("ptg_nat_pool", npool.getName()); } @Test public void testUpdateNatPool() throws Exception{ respondWith(NAT_POOL_UPDATE); String id = "e2d4fce7-4c55-497b-ac4c-290dd202c71a"; NatPool natPoolUpdate= Builders.natPool().name("ptg_nat_pool-update").build(); NatPool natPool =osv2().gbp().natPool().update(id, natPoolUpdate); Logger.getLogger(getClass().getName()).info(getClass().getName() + " : Updated Nat Pool : "+natPool); assertEquals("ptg_nat_pool-update", natPool.getName()); } @Test public void testDeleteNatPool() { respondWith(200); String id = "e2d4fce7-4c55-497b-ac4c-290dd202c71a"; ActionResponse result = osv2().gbp().natPool().delete(id); assertTrue(result.isSuccess()); } }
743e5d29c4d5b066d3e7858826f2eadea0057ed0
8171b83701062ee394f4fc9b6c49a16d90003d22
/src/main/java/tk/zhangh/pattern/flyweight/App.java
fcb30d73698d1595aa096c14d489fd82c2b71efe
[]
no_license
zhanghTK/design-patterns
b8fa85310fb591604bfccb590095985e558e444d
9ee4604ded600c7ae82c9b5b8c08b3b9684b513c
refs/heads/master
2021-07-10T23:28:14.978338
2017-09-20T12:39:03
2017-09-20T12:39:03
106,897,028
0
1
null
null
null
null
UTF-8
Java
false
false
863
java
package tk.zhangh.pattern.flyweight; import java.util.ArrayList; import java.util.List; /** * Created by ZhangHao on 2017/9/13. */ public class App { private static Flyweight flyWeight; private static List<Character> characters; static { characters = new ArrayList<>(); characters.add('a'); characters.add('a'); characters.add('a'); } public static void main(String[] args) { // 1,2 只创建一个享元对象 flyWeight = FlyweightFactory.getFlyWeight('x'); // 1 flyWeight.operation("0,0"); flyWeight = FlyweightFactory.getFlyWeight('x'); // 2 flyWeight.operation("1,1"); // 符合享元对象内使用的三个享元对象实际是同一个 flyWeight = FlyweightFactory.getFlyWeight(characters); flyWeight.operation("-1, -1"); } }
abe25af494a3df28367f207eb7d19d9c788f8968
dc96ec1f1896338d31376e1ab9ab8a2b537a6797
/src/main/java/co/jp/nej/earth/model/form/ProcessForm.java
ed39f06ea432e8b6bddc4ca75ad6af4620ed316d
[]
no_license
carlosvela42/bpm
8e159cf38046c865d984e3b68b753b59296d1c64
dadd1c682050208690d3b90f50d73953b83b5d12
refs/heads/master
2021-01-23T19:56:31.763701
2017-09-08T11:21:58
2017-09-08T11:21:58
102,832,193
0
0
null
null
null
null
UTF-8
Java
false
false
1,941
java
package co.jp.nej.earth.model.form; import co.jp.nej.earth.model.MgrProcess; import co.jp.nej.earth.model.StrageDb; import co.jp.nej.earth.model.StrageFile; /** * @author p-tvo-sonta */ public class ProcessForm { private MgrProcess process; private StrageFile strageFile; private String workspaceId; private StrageDb strageDb; private String fileExtention; private boolean isInsert; /** * @return the process */ public MgrProcess getProcess() { return process; } /** * @param process the process to set */ public void setProcess(MgrProcess process) { this.process = process; } /** * @return the strageFile */ public StrageFile getStrageFile() { return strageFile; } /** * @param strageFile the strageFile to set */ public void setStrageFile(StrageFile strageFile) { this.strageFile = strageFile; } /** * @return the strageDb */ public StrageDb getStrageDb() { return strageDb; } /** * @param strageDb the strageDb to set */ public void setStrageDb(StrageDb strageDb) { this.strageDb = strageDb; } /** * @return the workspaceId */ public String getWorkspaceId() { return workspaceId; } /** * @param workspaceId the workspaceId to set */ public void setWorkspaceId(String workspaceId) { this.workspaceId = workspaceId; } /** * @return the fileExtention */ public String getFileExtention() { return fileExtention; } /** * @param fileExtention the fileExtention to set */ public void setFileExtention(String fileExtention) { this.fileExtention = fileExtention; } public boolean isInsert() { return isInsert; } public void setInsert(boolean insert) { isInsert = insert; } }
3b2abe23de1da08c2705722961c32532e1e0dff0
32c3e10d042f8486a96e90f23b0af6a4812cdd53
/monizk/src/main/java/com/bwei/monizk/SecondActivity.java
d1e787717cb296ae7c2cb3cf169081c3b73fae2e
[]
no_license
823253467/AAAA
bbf4b9a2b659b22886edb2435dbf82e696bc8b05
a8dd4620d0355026aa4751b194c108461de6445a
refs/heads/master
2021-08-08T13:30:53.681539
2017-11-10T11:54:37
2017-11-10T11:55:04
110,221,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,088
java
package com.bwei.monizk; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import android.widget.Toast; import com.xys.libzxing.zxing.activity.CaptureActivity; public class SecondActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); Intent intent = new Intent(SecondActivity.this, CaptureActivity.class); startActivityForResult(intent,0); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode==RESULT_OK){ Bundle bundle = data.getExtras(); String result = bundle.getString("result"); //text.setText(result); Toast.makeText(SecondActivity.this,result,Toast.LENGTH_SHORT).show(); Button button = new Button(this); } } }
e94dcfd016cd1a258220b197a3fb561876f98a19
3e9f44d23cb07d2f20e98b3e7732d8046cdc2081
/app/src/main/java/assignment/com/kotlinlearn/JavaConverterActivity.java
e088f776c4962afb7180750348bd7d71fbcd394f
[]
no_license
AnudeepJ/kotlinLearn
46c55cf7efdd3ed3cfc00f5e77a6b5cebc6e5a0c
415ac7a5a659b3b8e171912436c9a3b1d2a2494f
refs/heads/master
2021-01-11T13:44:05.020199
2017-06-23T07:37:55
2017-06-23T07:37:55
95,116,538
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package assignment.com.kotlinlearn; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import explara.emaxio.net.RequestDto; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class JavaConverterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_java_converter2); RequestDto apiRequest = new RequestDto("0f1eafe861681de53aa511f3570ee44a266275c5", "769", "657"); JavaApiManager javaApiManager = new JavaApiManager(); Call<ExhibitorresponseDto> exhibitorresponseDtoCall = javaApiManager.fetchExhibitorswithCall(apiRequest); exhibitorresponseDtoCall.enqueue(new Callback<ExhibitorresponseDto>() { @Override public void onResponse(Call<ExhibitorresponseDto> call, Response<ExhibitorresponseDto> response) { } @Override public void onFailure(Call<ExhibitorresponseDto> call, Throwable t) { } }); } }
8e270d0dc3c6d466db1cabe12fa9a0d3beb0aac2
71078c6881d153cb614fc8304f50445142f538b8
/LightAutomation/app/src/test/java/com/app1radek/lightautomation/ExampleUnitTest.java
fc827a15426eefac598a384c5f285c58c2e0ca9c
[]
no_license
Radoslaw92/FinalYearProject
754581686bcf3db79bcdd000f974e4e3dd867790
423fa20f8770f17a5d76c42e405200f0e6555e8b
refs/heads/master
2020-12-24T06:23:07.460654
2017-05-12T09:19:59
2017-05-12T09:19:59
73,402,816
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.app1radek.lightautomation; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
be9a47a415a5819d3eb0a2e7cd6b349d063bd055
8a33fcb2858dfd265f61d1320bed98096669c207
/backend/src/main/java/ir/maralani/wishlist/security/JwtUserDetailsService.java
1c5f5206609ad99ef3ab8c6b887c4c24a14fb036
[ "MIT" ]
permissive
amaralani/wishlist
8290a7b724f58d237389fc03c5f18e31f88a050a
b822845a13ada3d3f0fde8afbd6cb5252d23f5f5
refs/heads/master
2023-05-12T09:55:53.830625
2021-04-20T05:44:59
2021-04-20T05:44:59
248,979,749
0
0
MIT
2023-05-09T02:52:20
2020-03-21T13:17:49
Java
UTF-8
Java
false
false
3,533
java
/* * Acceptto Confidential * * This file is part of 'Atlas' module of the 'PAM' project. * * Copyright (c) 2017-2020 Acceptto Corporation All Rights Reserved. * * All information contained herein is, and remains the property * of Acceptto Corporation. * The intellectual and technical concepts contained herein are proprietary * to Acceptto Corporation and covered by U.S. and Foreign Patents, * patents in process, and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Acceptto Corporation. */ package ir.maralani.wishlist.security; import ir.maralani.wishlist.domain.User; import ir.maralani.wishlist.domain.UserDetailsWrapper; import ir.maralani.wishlist.service.UserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.InternalAuthenticationServiceException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * Simple User details service which is backed by the main system datasource and * takes all required security polices into account before granting access. */ @Component public class JwtUserDetailsService implements UserDetailsService { /** * Logger */ private final Logger log = LoggerFactory.getLogger(UserDetailsService.class); /** * User service */ private final UserService userService; @Autowired public JwtUserDetailsService(UserService userService) { this.userService = userService; } @Override @Transactional public UserDetails loadUserByUsername(final String username) { log.debug("Authenticating {}...", username); // Lookup the requested user by username, throw if not found User userDetails = userService.getByUsername(username) .orElseThrow(() -> new UsernameNotFoundException("User " + username + " was not found.")); if (userDetails.isExternal()) throw new UsernameNotFoundException("User does exist but default provider can't authenticate it."); // Check whether this user account is disabled by he administrators boolean isExpired = userDetails.isUserExpired(); // Empty collection to load granted authorities into final List<GrantedAuthority> grantedAuthorities = new ArrayList<>(); // Prepare the wrapped user details with the actual Id and return it return new UserDetailsWrapper(userDetails.getId(), username, userDetails.getPassword(), userDetails.getEnabled(), !isExpired, true, !userDetails.getLocked(), grantedAuthorities); } }
4eeef4973667debcbeea6c935021cf1f7a363cfc
771be70007cc90309862cd02417bb8eace30bba7
/nepxion-thunder/src/main/java/com/nepxion/thunder/common/smtp/SmtpEventInterceptor.java
251ff41424981f725efa22612f5a1b7f947cecc6
[ "Apache-2.0" ]
permissive
johnwoocxl/john-thunder
53260fe0842eecafe7196d9aecba4e8cda717cd3
fa83efa2a721764399a5814f6e01a3548973c150
refs/heads/master
2021-01-01T04:29:49.993332
2016-05-20T08:08:51
2016-05-20T08:08:51
59,276,131
1
2
null
null
null
null
UTF-8
Java
false
false
5,190
java
package com.nepxion.thunder.common.smtp; /** * <p>Title: Nepxion Thunder</p> * <p>Description: Nepxion Thunder For Distribution</p> * <p>Copyright: Copyright (c) 2015</p> * <p>Company: Nepxion</p> * @author Haojun Ren * @email [email protected] * @version 1.0 */ import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.nepxion.thunder.common.constant.ThunderConstants; import com.nepxion.thunder.common.property.ThunderProperties; import com.nepxion.thunder.common.util.StringUtil; import com.nepxion.thunder.protocol.ProtocolEvent; import com.nepxion.thunder.protocol.ProtocolEventInterceptor; public class SmtpEventInterceptor extends ProtocolEventInterceptor { private static final Logger LOG = LoggerFactory.getLogger(SmtpEventInterceptor.class); private ThunderProperties properties; private List<String> notificationExclusionList; private SmtpExecutor smtpExecutor; public SmtpEventInterceptor(ThunderProperties properties) { this.properties = properties; String notificationExclusion = properties.getString(ThunderConstants.SMTP_NOTIFICATION_EXCLUSION_ATTRIBUTE_NAME); String host = properties.getString(ThunderConstants.SMTP_HOST_ATTRIBUTE_NAME); String user = properties.getString(ThunderConstants.SMTP_USER_ATTRIBUTE_NAME); String password = properties.getString(ThunderConstants.SMTP_PASSWORD_ATTRIBUTE_NAME); notificationExclusionList = new ArrayList<String>(); String[] notificationExclusionArray = StringUtils.split(notificationExclusion, ","); for (String exclusion : notificationExclusionArray) { if (StringUtils.isNotEmpty(exclusion)) { notificationExclusionList.add(exclusion.trim()); } } boolean ssl = properties.getBoolean(ThunderConstants.SMTP_SSL_ATTRIBUTE_NAME); if (ssl) { smtpExecutor = new SmtpSslExecutor(host, user, password); } else { smtpExecutor = new SmtpExecutor(host, user, password); } } @Override protected void onEvent(ProtocolEvent event) { String exception = event.toException(); for (String notificationExclusion : notificationExclusionList) { if (exception.contains(notificationExclusion)) { return; } } try { send(event); } catch (Exception e) { LOG.error("Send mail failed", e); } } private void send(ProtocolEvent event) throws Exception { String from = properties.getString(ThunderConstants.SMTP_MAIL_FROM_ATTRIBUTE_NAME); String to = properties.getString(ThunderConstants.SMTP_MAIL_TO_ATTRIBUTE_NAME); String cc = properties.getString(ThunderConstants.SMTP_MAIL_CC_ATTRIBUTE_NAME); String bcc = properties.getString(ThunderConstants.SMTP_MAIL_BCC_ATTRIBUTE_NAME); String namespace = properties.getString(ThunderConstants.NAMESPACE_ELEMENT_NAME); String subject = StringUtil.firstLetterToUpper(namespace) + "调用异常通知"; String text = event.toString(); StringBuilder builder = new StringBuilder(); builder.append("<html>"); builder.append("<head>"); builder.append("<style type=text/css>"); builder.append("table{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;}"); builder.append("td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;font-size:12px;}"); builder.append("</style>"); builder.append("</head>"); // builder.append("<h3>" + subject + "</h3>"); builder.append("<body>"); builder.append("<table>"); builder.append("<tr>"); builder.append("<td bgcolor=#efefef>参数</td>"); builder.append("<td bgcolor=#efefef>值</td>"); builder.append("</tr>"); Map<String, Object> map = event.toMap(); for (Map.Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); String value = null; if (entry.getValue() != null) { value = entry.getValue().toString().replace("\n", "<br>"); // 换行符 if (StringUtils.equals(key, "exception")) { value = value.replace(" ", "&nbsp;"); value = value.replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;"); // tab符 } value = value.trim(); } builder.append("<tr>"); builder.append("<td>"); builder.append(key); builder.append("</td>"); builder.append("<td>"); builder.append(value); builder.append("</td>"); builder.append("</tr>"); } builder.append("</table>"); builder.append("</body>"); builder.append("</html>"); text = builder.toString(); smtpExecutor.sendHtml(from, to, cc, bcc, subject, text, ThunderConstants.ENCODING_FORMAT); } }
a60459cf2c66e5dd9e6713a80c24b9a061b335ea
1423621f39dbe13248b8b49dae62210799241f55
/LealBrasil/src/main/java/br/com/lealbrasil/model/entities/Enum_Aux_Credita_Debita.java
43de13a9e2cfc9d0164fc374cc6591e5293445a3
[]
no_license
projetabrasil/lealcreditos
9049c0e4fa5bdc131f130fa5954ef5d9ff54bd5f
de1e053237ab4b806a38df8732344ade0163549d
refs/heads/master
2021-01-11T15:35:05.571403
2017-03-04T00:03:20
2017-03-04T00:03:20
80,367,433
0
2
null
null
null
null
UTF-8
Java
false
false
508
java
package br.com.lealbrasil.model.entities; public enum Enum_Aux_Credita_Debita { C("C","CREDITO",0), D("D","DEBITO",1); private String abrev; private String descricao; private int id; Enum_Aux_Credita_Debita(String abrev, String descricao, int id){ this.abrev = abrev; this.descricao = descricao; this.id = id; } public String getAbrev() { return abrev; } public String getDescricao() { return descricao; } public int getId() { return id; } }
fe49e687f50f1e79a637066942f2a60e98974533
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE190_Integer_Overflow/s06/CWE190_Integer_Overflow__int_Environment_postinc_81_bad.java
560ad178b376789d3c196d46765d82afa1599ce6
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
1,160
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_Environment_postinc_81_bad.java Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-81_bad.tmpl.java */ /* * @description * CWE: 190 Integer Overflow * BadSource: Environment Read data from an environment variable * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: increment * GoodSink: Ensure there will not be an overflow before incrementing data * BadSink : Increment data, which can cause an overflow * Flow Variant: 81 Data flow: data passed in a parameter to an abstract method * * */ package testcases.CWE190_Integer_Overflow.s06; import testcasesupport.*; import javax.servlet.http.*; public class CWE190_Integer_Overflow__int_Environment_postinc_81_bad extends CWE190_Integer_Overflow__int_Environment_postinc_81_base { public void action(int data ) throws Throwable { /* POTENTIAL FLAW: if data == Integer.MAX_VALUE, this will overflow */ data++; int result = (int)(data); IO.writeLine("result: " + result); } }
23c6ecde043a5d3f9993144e147436f1c14735bb
70fa815cc015afd07a58c4b113ad766ae474b009
/circuit-breaker-customer-service/src/main/java/geektime/spring/consul/support/CircuitBreakerAspect.java
17c4b6968abad928100bd67d6afef2f260b5d4db
[ "MIT" ]
permissive
monsterhxw/Spring-Learning-Practice
bb04c5024c96cf93fe4590cbde4012cd241fac9c
1a4e549a83339957bab62ac81cd11dec5ae27316
refs/heads/master
2022-06-14T04:29:38.666014
2019-09-11T08:49:26
2019-09-11T08:49:26
204,445,300
1
0
MIT
2022-05-20T21:57:52
2019-08-26T09:46:36
Java
UTF-8
Java
false
false
1,862
java
package geektime.spring.consul.support; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; @Aspect @Component @Slf4j public class CircuitBreakerAspect { private static final Integer THRESHOLD = 3; private Map<String, AtomicInteger> counter = new ConcurrentHashMap<>(); private Map<String, AtomicInteger> breakCounter = new ConcurrentHashMap<>(); @Around("execution(* geektime.spring.consul.integation..*(..))") public Object doWithCircuitBreaker(ProceedingJoinPoint pjp) throws Throwable { String signature = pjp.getSignature().toLongString(); log.info("Invoke: {}", signature); Object retVal; try { if (counter.containsKey(signature)) { if (counter.get(signature).get() > THRESHOLD && breakCounter.get(signature).get() < THRESHOLD) { log.warn("Circuit breaker return null,break {} times.", breakCounter.get(signature).incrementAndGet()); return null; } } else { counter.put(signature, new AtomicInteger(0)); breakCounter.put(signature, new AtomicInteger(0)); } retVal = pjp.proceed(); counter.get(signature).set(0); breakCounter.get(signature).set(0); } catch (Throwable throwable) { log.warn("Circuit breaker counter: {}, Throwable: {}", counter.get(signature).incrementAndGet(), throwable.getMessage()); breakCounter.get(signature).set(0); throw throwable; } return retVal; } }
ef3ef49aa4e8bc0765310548c2e28e8f2c8d5c0c
2c1dc7049d820d2b75811a6c0479bd34eb84ad87
/utils/src/main/java/com/cloud/utils/crypt/EncryptionCLI.java
af9717c8102e0cba15445d62c64584596f775b5e
[ "GPL-2.0-only", "Apache-2.0", "BSD-3-Clause", "MIT", "GPL-1.0-or-later", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown" ]
permissive
apache/cloudstack
3775c9171022dfaf91d655bd166149e36f4caa41
819dd7b75c1b61ae444c45476f5834dbfb9094d0
refs/heads/main
2023-08-30T15:05:36.976909
2023-08-30T09:29:16
2023-08-30T09:29:16
9,759,448
1,468
1,232
Apache-2.0
2023-09-14T16:57:46
2013-04-29T22:27:12
Java
UTF-8
Java
false
false
3,695
java
// // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // package com.cloud.utils.crypt; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; public class EncryptionCLI { private static final String VERBOSE_OPTION = "verbose"; private static final String DECRYPT_OPTION = "decrypt"; private static final String INPUT_OPTION = "input"; private static final String PASSWORD_OPTION = "password"; private static final String ENCRYPTOR_VERSION_OPTION = "encryptorversion"; public static void main(String[] args) throws ParseException { Options options = new Options(); Option verbose = Option.builder("v").longOpt(VERBOSE_OPTION).argName(VERBOSE_OPTION).required(false).desc("Verbose output").hasArg(false).build(); Option decrypt = Option.builder("d").longOpt(DECRYPT_OPTION).argName(DECRYPT_OPTION).required(false).desc("Decrypt instead of encrypt").hasArg(false).build(); Option input = Option.builder("i").longOpt(INPUT_OPTION).argName(INPUT_OPTION).required(true).hasArg().desc("The input string to process").build(); Option password = Option.builder("p").longOpt(PASSWORD_OPTION).argName(PASSWORD_OPTION).required(true).hasArg().desc("The encryption password").build(); Option encryptorVersion = Option.builder("e").longOpt(ENCRYPTOR_VERSION_OPTION).argName(ENCRYPTOR_VERSION_OPTION).required(false).hasArg().desc("The encryptor version").build(); options.addOption(verbose); options.addOption(decrypt); options.addOption(input); options.addOption(password); options.addOption(encryptorVersion); CommandLine cmdLine = null; CommandLineParser parser = new DefaultParser(); HelpFormatter helper = new HelpFormatter(); try { cmdLine = parser.parse(options, args); } catch (ParseException ex) { System.out.println(ex.getMessage()); helper.printHelp("Usage:", options); System.exit(1); } CloudStackEncryptor encryptor = new CloudStackEncryptor(cmdLine.getOptionValue(PASSWORD_OPTION), cmdLine.getOptionValue(encryptorVersion), EncryptionCLI.class); String result; String inString = cmdLine.getOptionValue(INPUT_OPTION); if (cmdLine.hasOption(DECRYPT_OPTION)) { result = encryptor.decrypt(inString); } else { result = encryptor.encrypt(inString); } if (cmdLine.hasOption(VERBOSE_OPTION)) { System.out.printf("Input: %s%n", inString); System.out.printf("Encrypted: %s%n", result); } else { System.out.printf("%s%n", result); } } }
d4d59478c07220c525e4ed05ab149b75aa989158
5cae290c0ba81f5e8b43f94658616aae0fb3c09d
/src/com/algorithm/pratice/solutionForJZ7.java
247b1b1d3160ca69d7061050ee7e84c982fb5b38
[]
no_license
WAYNEYHN/JavaSelf-study
3e1711171ee0b1199042aa7fcce74786eafd63f3
813ca0afb51aaa4680c5f8f6064a4c4f9abb34ef
refs/heads/master
2022-12-13T15:24:17.467337
2020-08-30T15:54:56
2020-08-30T15:54:56
280,842,911
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package com.algorithm.pratice; public class solutionForJZ7 { public static void main(String[] args) { System.out.println(Fibonacci(1000)); } public static int Fibonacci(int n){ if(n==1) return 1; if(n==2) return 1; return Fibonacci(n-1) + Fibonacci(n-2); } }
823e1d060e79ba0a9d89a0a7cb19676dfc565341
9c2b135d1ce7ecfec6b29d481923097918c8566c
/Multithreading/PandC.java
763bfd24ac98b4e0da6c747b7c86bf52a57874f8
[]
no_license
gamefreakoneone/java-MUJ
6e2118336f6055a892dbf2763405868a11eb0441
83f76d06454f3fd0e198d0bc6a26a7bb4c2a7835
refs/heads/master
2023-03-02T06:49:21.945916
2021-02-12T09:56:22
2021-02-12T09:56:22
288,978,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,571
java
package Multithreading; class Q { int n; synchronized int get() { try { Thread.sleep(1000); } catch(InterruptedException e) {} return n; } synchronized void put(int n) { this.n=n; try { Thread.sleep(1000); } catch(InterruptedException e){} } } // end of class Q class producer implements Runnable { Q q; Thread t; producer(String name, Q q) { this.q = q; t= new Thread(this,name); t.start(); } public void run() { int i=0; while(i<10) { q.put(i); System.out.println("producer " + i); i++; } } // end of run } // end of producer class consumer implements Runnable { Q q; Thread t; consumer(String name, Q q) { this.q = q; t= new Thread(this,name); t.start(); } public void run() { int i=0; while(i<9) { i= q.get(); System.out.println("consumer "+ i); } } // end of run } // end of consumer public class PandC { public static void main(String args[]) { Q q= new Q(); producer p = new producer("producer",q); producer p2 = new producer("producer-2",q); consumer c= new consumer("consumer",q); // try{ // p.t.join(); // c.t.join(); // } // catch(InterruptedException e){} // System.out.println(Thread.currentThread().getName()); // } } }
1a2cf14e54a56f3c60a1089f2f1ff4668c5d2fc7
ca6bbb133c058afd2c79a087fe8530f266a78451
/java4-16/src/LeetCode/Solution.java
a3993ce8fa5347e06a2cf2997e449c108b242328
[]
no_license
yuyonshen/java2
1d97d5044f7e8f0ec0b789c5da57af83d91b6d61
02c75527eb068dc41a496e7071d23e77a9c015da
refs/heads/master
2022-12-02T07:42:21.743610
2020-08-05T13:21:42
2020-08-05T13:21:42
250,456,119
0
0
null
2022-11-16T08:36:10
2020-03-27T06:17:14
JavaScript
UTF-8
Java
false
false
1,137
java
package LeetCode; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } public class Solution { //给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值 public List<Integer> rightSideView(TreeNode root){ List<Integer> result=new ArrayList<>(); if(root==null){ return result; } Queue<TreeNode> queue=new LinkedList<>(); queue.offer(root); while(!queue.isEmpty()){ int size=queue.size(); for(int i=0;i<size;i++){ TreeNode node=queue.poll(); if(node.left!=null){ queue.offer(node.left); } if(node.right!=null){ queue.offer(node.right); } if(i==size-1){ result.add(node.val); } } } return result; } }
50285d5cc9dcccc641cb784266407dfbd62e0447
aa6997aba1475b414c1688c9acb482ebf06511d9
/src/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java
89bf0ac01263163f8677f5afa806ba2fc6e034eb
[]
no_license
yueny/JDKSource1.8
eefb5bc88b80ae065db4bc63ac4697bd83f1383e
b88b99265ecf7a98777dd23bccaaff8846baaa98
refs/heads/master
2021-06-28T00:47:52.426412
2020-12-17T13:34:40
2020-12-17T13:34:40
196,523,101
4
2
null
null
null
null
UTF-8
Java
false
false
4,514
java
/* * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ /* * Copyright 2002,2004 The Apache Software Foundation. * * 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.sun.org.apache.xml.internal.serialize; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; /** * This class is duplicated for each subpackage so keep it in sync. * It is package private and therefore is not exposed as part of any API. * * @xerces.internal */ final class SecuritySupport { private static final SecuritySupport securitySupport = new SecuritySupport(); /** * Return an instance of this class. */ static SecuritySupport getInstance() { return securitySupport; } ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException) e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } private SecuritySupport() { } }
1ef41a2805caa7df769bf4500de27f66c0c0b12f
d87f25a180e55f1dd1b5dbdc5f4602886e79026e
/androidinstagramoauth/build/generated/source/buildConfig/test/debug/br/com/dina/oauth/instagram/test/BuildConfig.java
66e8d2952d2b1d6b5190173be94547268262a933
[]
no_license
j2emanue/OAUTHInstaGram
8a30f8a5bda7302ddc42206965c9188bc2f3eb04
087b7d2e235f06605e0c0ad96f81f4f11cc117de
refs/heads/master
2021-01-19T00:16:31.696565
2014-11-17T23:23:13
2014-11-17T23:23:13
26,696,820
3
1
null
null
null
null
UTF-8
Java
false
false
620
java
/** * Automatically generated file. DO NOT MODIFY */ package br.com.dina.oauth.instagram.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "br.com.dina.oauth.instagram.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = -1; public static final String VERSION_NAME = ""; /** * @deprecated Use {@link #APPLICATION_ID} */ @Deprecated public static final String PACKAGE_NAME = "br.com.dina.oauth.instagram.test"; }
dd3d796847958e4b52272cdd8b07e1b67ed5e39e
7da8a251c871732df9c68c3dc9a6de3cc9c9c85b
/ismg/src/test/java/study/nio/ChannelTwo.java
2024eaf0393872af65b3a4d41244cec6dd5b54ab
[]
no_license
wsylp/mygit
db37e4e973c4881b9b7811da3709aa1be4674532
c9b4c47a06eb264a47012873bb9cd4b0784ad823
refs/heads/master
2021-01-22T13:23:45.357828
2017-10-22T13:36:29
2017-10-22T13:36:29
102,364,961
0
0
null
null
null
null
UTF-8
Java
false
false
9,169
java
package study.nio; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.Channel; import java.nio.channels.DatagramChannel; import java.nio.channels.FileChannel; import java.nio.channels.Pipe; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Iterator; import java.util.Set; /** * Created by wsylp on 2017/9/23. */ public class ChannelTwo { public static void main(String[] args) throws IOException { // transfrom(); //transTo(); //useSelector(); //useFileChannel(); //useServerSocketChannel(); //useDatagramChannel(); usePipe(); } private static void usePipe() throws IOException { //创建管道 Pipe pipe = Pipe.open(); //像管道写数据 Pipe.SinkChannel sinkChannel = pipe.sink(); //调用sinkChannel的write方法,将数据写入sinkChannel String newData = "New String to write to file..." + System.currentTimeMillis(); ByteBuffer buf = ByteBuffer.allocate(48); buf.clear(); buf.put(newData.getBytes()); buf.flip(); while(buf.hasRemaining()) { sinkChannel.write(buf); } //从管道中读取数据 //从读取管道的数据,需要访问source通道,像这样: Pipe.SourceChannel sourceChannel = pipe.source(); // 调用source通道的read()方法来读取数据,像这样: ByteBuffer rbuf = ByteBuffer.allocate(48); int bytesRead = sourceChannel.read(rbuf); //read()方法返回的int值会告诉我们多少字节被读进了缓冲区。 } private static void useDatagramChannel() throws IOException { //打开DatagramChannel //打开的 DatagramChannel可以在UDP端口9999上接收数据包。 DatagramChannel datagramChannel = DatagramChannel.open(); datagramChannel.socket().bind(new InetSocketAddress(9999)); //接收数据,通过receive()方法从DatagramChannel接收数据 ByteBuffer buf = ByteBuffer.allocate(100); buf.clear(); //receive()方法会将接收到的数据包内容复制到指定的Buffer. 如果Buffer容不下收到的数据,多出的数据将被丢弃 datagramChannel.receive(buf); //发送数据 String newData = "我的老家" + LocalTime.now(); ByteBuffer sbuf = ByteBuffer.allocate(100); sbuf.clear(); sbuf.put(newData.getBytes()); sbuf.flip(); // 这个例子发送一串字符到”jenkov.com”服务器的UDP端口80。 // 因为服务端并没有监控这个端口,所以什么也不会发生。也不会通知你发出的数据包是否已收到, // 因为UDP在数据传送方面没有任何保证。 //连接到特定的地址 //可以将DatagramChannel“连接”到网络中的特定地址的。由于UDP是无连接的,连接到特定地址并不会像TCP通道那样创建一个真正的连接。 //而是锁住DatagramChannel ,让其只能从特定地址收发数据。 int bytesSent = datagramChannel.send(buf, new InetSocketAddress("jenkov.com", 80)); //当连接后,也可以使用read()和write()方法,就像在用传统的通道一样。只是在数据传送方面没有任何保证。这里有几个例子: int bytesRead = datagramChannel.read(sbuf); int bytesWritten = datagramChannel.write(sbuf); } private static void useServerSocketChannel() throws IOException { //通过调用 ServerSocketChannel.open() 方法来打开ServerSocketChannel ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); serverSocketChannel.socket().bind(new InetSocketAddress(9999)); //ServerSocketChannel可以设置成非阻塞模式。在非阻塞模式下,accept() 方法会立刻返回,如果还没有新进来的连接, // 返回的将是null。 因此,需要检查返回的SocketChannel是否是null serverSocketChannel.configureBlocking(false); boolean flag = true; //通常不会仅仅只监听一个连接,在while循环中调用 accept()方法. while (flag) { //通过 ServerSocketChannel.accept() 方法监听新进来的连接。 // 当 accept()方法返回的时候,它返回一个包含新进来的连接的 SocketChannel。 // 因此, accept()方法会一直阻塞到有新连接到达。 SocketChannel socketChannel = serverSocketChannel.accept(); if (socketChannel != null) { System.out.println("得到连接"); } } //关闭serverSocketChannel serverSocketChannel.close(); } private static void useFileChannel() throws IOException { //我们无法直接打开一个FileChannel,需要通过使用一个InputStream、 // OutputStream或RandomAccessFile来获取一个FileChannel实例 RandomAccessFile randomAccessFile = new RandomAccessFile("g://nio.txt", "rw"); FileChannel channel = randomAccessFile.getChannel(); //从FIleChannel读取数据 //调用多个read()方法之一从FileChannel中读取数据 //分配一个Buffer.从FileChannel中读取的数据将被读到Buffer中 ByteBuffer buf = ByteBuffer.allocate(50); //调用read()方法,将数据从channel读取到Buffer中 //read 返回的int值表示多少个字节被读到了buffer 中,返回-1表示到了文件末尾 int bytesRead = channel.read(buf); //向FileChannel写数据 String newdata = "哈哈哈" + LocalDate.now(); ByteBuffer wbuf = ByteBuffer.allocate(100); wbuf.clear(); wbuf.put(newdata.getBytes()); wbuf.flip(); //FileChannel.write()是在while循环中调用的。因为无法保证write()方法一次能向FileChannel写入多少字节, // 因此需要重复调用write()方法,直到Buffer中已经没有尚未写入通道的字节。 while (wbuf.hasRemaining()) { channel.write(wbuf); } //关闭FileChannel //用完FileChannel后必须将其关闭 // channel.close(); //FileChannel的size方法 long fileSize = channel.size(); System.out.println("fileSize:" + fileSize); //FileChannel的truncate方法,截取文件将指定长度后面的删除 FileChannel truncate = channel.truncate(20); System.out.println("截取后的长度:" + truncate.size()); //FileChannel的force方法 // FileChannel.force()force方法将通道里尚未写入磁盘的数据强制写到磁盘上。 // 出于性能方面的考虑,操作系统会将数据缓存在内存中,所以无法保证写入到FileChannel里的数据一定会即时写到磁盘上。 // 要保证这一点,需要调用force()方法。 //force()方法有一个boolean类型的参数,指明是否同时将文件元数据(权限信息等)写到磁盘上。 truncate.force(true); } private static void useSelector() throws IOException { } /** * 将fileChannel传输到其他的channel */ private static void transTo() throws IOException { RandomAccessFile fromFile = new RandomAccessFile("g://fromFile.txt", "rw"); FileChannel fromChannel = fromFile.getChannel(); RandomAccessFile toFile = new RandomAccessFile("g://toFile.txt", "rw"); FileChannel toChannel = toFile.getChannel(); long position = 0; long count = fromChannel.size(); //SocketChannel的问题在transferTo()方法中同样存在。SocketChannel会一直传输数据直到目标buffer被填满 fromChannel.transferTo(position, count, toChannel); } private static void transfrom() throws IOException { RandomAccessFile fromFile = new RandomAccessFile("g://nio.txt", "rw"); FileChannel fileChannel = fromFile.getChannel(); RandomAccessFile toFile = new RandomAccessFile("g://tonio.txt", "rw"); FileChannel toFileChannel = toFile.getChannel(); long position = 0; long count = fileChannel.size(); //方法的输入参数position表示从position处开始向目标文件写入数据,count表示最多传输的字节数。如果源通道的剩余空间小于 count 个字节,则所传输的字节数要小于请求的字节数。 //此外要注意,在SoketChannel的实现中,SocketChannel只会传输此刻准备好的数据(可能不足count字节)。 //因此,SocketChannel可能不会将请求的所有数据(count个字节)全部传输到FileChannel中。 toFileChannel.transferFrom(fileChannel, position, count); } }
e3322912e9eb7f976c64f37096ee40c896300f2d
6307189a5449539060f09d62aee8a1820451c096
/src/main/java/net/cartola/emissorfiscal/documento/ProdutoOrigem.java
9230dc2a32ccaebb7c5de8df526ffa0e9011a479
[ "MIT" ]
permissive
cartola-erp/emissor-fiscal
763ade0486b2468d7b62d9592c5fd520bafcd5bf
03bcfa50c48323361a7e3aad1f03a4e582dd87e5
refs/heads/master
2022-10-08T05:28:28.574356
2022-09-20T20:16:20
2022-09-20T20:16:20
216,210,394
6
2
null
null
null
null
UTF-8
Java
false
false
617
java
package net.cartola.emissorfiscal.documento; /** * 09/10/2013 16:40:35 * @author murilo */ public enum ProdutoOrigem { NACIONAL, ESTRANGEIRA_IMPORTACAO_DIRETA, ESTRANGEIRA_ADQUIRIDO_MERCADO_INTERNO, NACIONAL_CONTEUDO_IMPORTADO_MAIOR_40, NACIONAL_CONFORMIDADE_PROCESSOS, NACIONAL_CONTEUDO_IMPORTADO_MENOR_40, ESTRANGEIRA_IMPORTACAO_DIRETA_CAMEX, ESTRANGEIRA_ADQUIRIDO_MERCADO_INTERNO_CAMEX, NACIONAL_CONTEUDO_IMPORTADO_MAIOR_70; public String getDescricaoComOrdinal() { return String.valueOf(this.ordinal()) +" - "+ this.name(); } }
0567db6d29fa300a6e3667f5a33423cb0f75b93d
6f125f9dac4eb239cd1c03369bbc23b24716bf48
/phone-shop-view/src/com/jdc/phoneshop/controller/warehouse/ItemList.java
7ec652b612b16096abb99aeed28b7b541b102fd8
[]
no_license
kolinokkan/javase-final-projects
bb9c2a37b81d42369b346fdc6de59a4e9f4f5868
784f054e79af67a35c50aeb2ddd816d63e34b9eb
refs/heads/master
2020-03-21T13:40:45.450259
2016-03-19T14:00:07
2016-03-19T14:00:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,430
java
package com.jdc.phoneshop.controller.warehouse; import java.net.URL; import java.util.List; import java.util.ResourceBundle; import java.util.Set; import com.jdc.phoneshop.controller.utils.MessageHandler; import com.jdc.phoneshop.controller.utils.NavigationHandler; import com.jdc.phoneshop.controller.utils.SecurityManager; import com.jdc.phoneshop.pos.model.ItemModel; import com.jdc.phoneshop.utils.ApplicationException; import com.jdc.phoneshop.utils.ApplicationException.ErrorType; import com.jdc.phoneshop.utils.StringUtils; import com.jdc.phoneshop.warehouse.model.MasterDataModel; import com.jdc.phoneshop.warehouse.model.PurchaseModel; import com.jdc.phoneshop.warehouse.model.entity.Category; import com.jdc.phoneshop.warehouse.model.entity.Item; import com.jdc.phoneshop.warehouse.model.entity.Maker; import javafx.beans.property.SimpleStringProperty; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.ComboBox; import javafx.scene.control.SelectionMode; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; public class ItemList implements Initializable { @FXML private TableView<Item> table; @FXML private TableColumn<Item, String> colId; @FXML private TableColumn<Item, String> colCategory; @FXML private TableColumn<Item, String> colMaker; @FXML private TableColumn<Item, String> colModel; @FXML private TableColumn<Item, String> colSpecification; @FXML private ComboBox<Category> combCategory; @FXML private ComboBox<Maker> combMaker; @FXML private TextField textModel; @FXML private TextField textCount; public void search() { try { Set<Item> items = ItemModel.getModel().search(combCategory.getValue(), combMaker.getValue(), textModel.getText()); table.getItems().clear(); table.getItems().addAll(items); } catch (ApplicationException e) { MessageHandler.handle(e); } } public void purchase() { try { List<Item> items = table.getSelectionModel().getSelectedItems(); String strCnt = textCount.getText(); if (StringUtils.isEmptyString(strCnt)) { throw new ApplicationException(ErrorType.Warning, "Please enter purchase count!"); } int count = Integer.parseInt(strCnt); PurchaseModel.getModel().purchase(items, count, SecurityManager.getEmployee()); NavigationHandler.load("Reference Purchase", getClass()); } catch (NumberFormatException e) { throw new ApplicationException(ErrorType.Warning, "Please enter purchase count with digit only!"); } catch (ApplicationException e) { MessageHandler.handle(e); } } public void clear() { combMaker.setValue(null); combCategory.setValue(null); textModel.clear(); } public void addItems() { NavigationHandler.load("Add Items", getClass()); } @Override public void initialize(URL location, ResourceBundle resources) { // init combos MasterDataModel<Category> catModel = MasterDataModel.getModel(Category.class); Set<Category> categories = catModel.getAll(); combCategory.getItems().addAll(categories); MasterDataModel<Maker> mkModel = MasterDataModel.getModel(Maker.class); Set<Maker> makers = mkModel.getAll(); combMaker.getItems().addAll(makers); // init table columns colId.setCellValueFactory(new PropertyValueFactory<>("id")); colCategory.setCellValueFactory(param -> { if (null != param) { Item item = param.getValue(); Category cat = MasterDataModel.getModel(Category.class).findByID(item.getCategory()); if (null != cat) { return new SimpleStringProperty(cat.getName()); } } return null; }); colMaker.setCellValueFactory(param -> { if (null != param) { Item item = param.getValue(); Maker cat = MasterDataModel.getModel(Maker.class).findByID(item.getMaker()); if (null != cat) { return new SimpleStringProperty(cat.getMaker()); } } return null; }); colModel.setCellValueFactory(new PropertyValueFactory<>("model")); colSpecification.setCellValueFactory(new PropertyValueFactory<>("specifications")); // add listener combCategory.valueProperty().addListener((a, b, c) -> search()); combMaker.valueProperty().addListener((a, b, c) -> search()); textModel.textProperty().addListener((a, b, c) -> search()); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); search(); } }
3422760bb0480130ffa939fed75de2b43b3a742a
ad9544b859a8e10e689e2f280ada03dc397ee3ba
/app/src/main/java/com/xcw0754/north/Libraries/volley/VolleyInterface.java
cbd70127fcc6aa701596db0b0ef7cce0abf4c2d2
[]
no_license
xcw0579/north
3243cf72a280befb75d454a4ed8d77e4807bdfc0
37541684ab56e87d907cfd24d0d71555686e1a97
refs/heads/master
2021-01-18T16:19:01.768458
2016-03-28T15:57:44
2016-03-28T15:57:44
53,187,540
0
0
null
null
null
null
UTF-8
Java
false
false
1,311
java
package com.xcw0754.north.Libraries.volley; import android.content.Context; import com.android.volley.Response; import com.android.volley.VolleyError; /** * Created by Administrator on 2016/3/3. */ public abstract class VolleyInterface { public Context context; public static Response.Listener<String> listener; public static Response.ErrorListener errorListener; public abstract void onMySuccess(String result); public abstract void onMyError(VolleyError error); public VolleyInterface (Context context, Response.Listener<String> listener, Response.ErrorListener errorListener) { this.context = context; this.listener = listener; this.errorListener = errorListener; } public Response.Listener<String> loadingListener() { listener = new Response.Listener<String>() { @Override public void onResponse(String response) { onMySuccess(response); } }; return listener; } public Response.ErrorListener errorListener() { errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { onMyError(error); } }; return errorListener; } }
f6aa0d980a09888aae6c75ce81352e312d9cc059
64673dd1686c0e9f52258a2c3ff11753e8cfb390
/13. Java Applet/SimplePaint.java
759452996635491cfdcd0be621dd023f04160736
[]
no_license
mustaghfirinaru/Java-Fundamental
b1c56874c05e4e3c9de1c2e48e35b9654e709daf
8f5ecb5e44af94690f18bb85e81eab6d4bae86f5
refs/heads/main
2023-02-19T14:46:10.783331
2021-01-06T13:19:00
2021-01-06T13:19:00
327,297,709
0
0
null
null
null
null
UTF-8
Java
false
false
9,018
java
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SimplePaint extends JApplet { public static void main(String[] args) { JFrame window = new JFrame("Simple Paint"); SimplePaintPanel content = new SimplePaintPanel(); window.setContentPane(content); window.setSize(600,480); window.setLocation(100,100); window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); window.setVisible(true); } public void init() { setContentPane( new SimplePaintPanel() ); } public static class SimplePaintPanel extends JPanel implements MouseListener, MouseMotionListener { private final static int BLACK = 0, RED = 1, GREEN = 2, BLUE = 3, CYAN = 4, MAGENTA = 5, YELLOW = 6; private int currentColor = BLACK; private int prevX, prevY; // The previous location of the mouse. private boolean dragging; // This is set to true while the user is drawing. private Graphics graphicsForDrawing; SimplePaintPanel() { setBackground(Color.WHITE); addMouseListener(this); addMouseMotionListener(this); } public void paintComponent(Graphics g) { super.paintComponent(g); // Fill with background color (white). int width = getWidth(); // Width of the panel. int height = getHeight(); // Height of the panel. int colorSpacing = (height - 56) / 7; // g.setColor(Color.GRAY); // g.drawRect(0, 0, width-1, height-1); // g.drawRect(1, 1, width-3, height-3); // g.drawRect(2, 2, width-5, height-5); // g.fillRect(width - 56, 0, 56, height); // g.setColor(Color.WHITE); // g.fillRect(width-53, height-53, 50, 50); // g.setColor(Color.BLACK); // g.drawRect(width-53, height-53, 49, 49); // g.drawString("CLEAR", width-48, height-23); // /* Draw the seven color rectangles. */ // g.setColor(Color.BLACK); // g.fillRect(width-53, 3 + 0*colorSpacing, 50, colorSpacing-3); // g.setColor(Color.RED); // g.fillRect(width-53, 3 + 1*colorSpacing, 50, colorSpacing-3); // g.setColor(Color.GREEN); // g.fillRect(width-53, 3 + 2*colorSpacing, 50, colorSpacing-3); // g.setColor(Color.BLUE); // g.fillRect(width-53, 3 + 3*colorSpacing, 50, colorSpacing-3); // g.setColor(Color.CYAN); // g.fillRect(width-53, 3 + 4*colorSpacing, 50, colorSpacing-3); // g.setColor(Color.MAGENTA); // g.fillRect(width-53, 3 + 5*colorSpacing, 50, colorSpacing-3); // g.setColor(Color.YELLOW); // g.fillRect(width-53, 3 + 6*colorSpacing, 50, colorSpacing-3); // /* Draw a 2-pixel white border around the color rectangle // of the current drawing color. */ g.setColor(Color.WHITE); g.drawRect(width-55, 1 + currentColor*colorSpacing, 53, colorSpacing); g.drawRect(width-54, 2 + currentColor*colorSpacing, 51, colorSpacing-2); } private void changeColor(int y) { int width = getWidth(); // Width of applet. int height = getHeight(); // Height of applet. int colorSpacing = (height - 56) / 7; // Space for one color rectangle. int newColor = y / colorSpacing; // Which color number was clicked? if (newColor < 0 || newColor > 6) // Make sure the color number is valid. return; Graphics g = getGraphics(); g.setColor(Color.GRAY); g.drawRect(width-55, 1 + currentColor*colorSpacing, 53, colorSpacing); g.drawRect(width-54, 2 + currentColor*colorSpacing, 51, colorSpacing-2); currentColor = newColor; g.setColor(Color.WHITE); g.drawRect(width-55, 1 + currentColor*colorSpacing, 53, colorSpacing); g.drawRect(width-54, 2 + currentColor*colorSpacing, 51, colorSpacing-2); g.dispose(); } private void setUpDrawingGraphics() { graphicsForDrawing = getGraphics(); switch (currentColor) { case BLACK: graphicsForDrawing.setColor(Color.BLACK); break; case RED: graphicsForDrawing.setColor(Color.RED); break; case GREEN: graphicsForDrawing.setColor(Color.GREEN); break; case BLUE: graphicsForDrawing.setColor(Color.BLUE); break; case CYAN: graphicsForDrawing.setColor(Color.CYAN); break; case MAGENTA: graphicsForDrawing.setColor(Color.MAGENTA); break; case YELLOW: graphicsForDrawing.setColor(Color.YELLOW); break; } } public void mousePressed(MouseEvent evt) { int x = evt.getX(); // x-coordinate where the user clicked. int y = evt.getY(); // y-coordinate where the user clicked. int width = getWidth(); // Width of the panel. int height = getHeight(); // Height of the panel. if (dragging == true) // Ignore mouse presses that occur return; // when user is already drawing a curve. // (This can happen if the user presses // two mouse buttons at the same time.) if (x > width - 53) { // User clicked to the right of the drawing area. // This click is either on the clear button or // on the color palette. if (y > height - 53) repaint(); // Clicked on "CLEAR button". else changeColor(y); // Clicked on the color palette. } else if (x > 3 && x < width - 56 && y > 3 && y < height - 3) { // The user has clicked on the white drawing area. // Start drawing a curve from the point (x,y). prevX = x; prevY = y; dragging = true; setUpDrawingGraphics(); } } // end mousePressed() /** * Called whenever the user releases the mouse button. If the user was drawing * a curve, the curve is done, so we should set drawing to false and get rid of * the graphics context that we created to use during the drawing. */ public void mouseReleased(MouseEvent evt) { if (dragging == false) return; // Nothing to do because the user isn't drawing. dragging = false; graphicsForDrawing.dispose(); graphicsForDrawing = null; } /** * Called whenever the user moves the mouse while a mouse button is held down. * If the user is drawing, draw a line segment from the previous mouse location * to the current mouse location, and set up prevX and prevY for the next call. * Note that in case the user drags outside of the drawing area, the values of * x and y are "clamped" to lie within this area. This avoids drawing on the color * palette or clear button. */ public void mouseDragged(MouseEvent evt) { if (dragging == false) return; // Nothing to do because the user isn't drawing. int x = evt.getX(); // x-coordinate of mouse. int y = evt.getY(); // y-coordinate of mouse. if (x < 3) // Adjust the value of x, x = 3; // to make sure it's in if (x > getWidth() - 57) // the drawing area. x = getWidth() - 57; if (y < 3) // Adjust the value of y, y = 3; // to make sure it's in if (y > getHeight() - 4) // the drawing area. y = getHeight() - 4; graphicsForDrawing.drawLine(prevX, prevY, x, y); // Draw the line. prevX = x; // Get ready for the next line segment in the curve. prevY = y; } // end mouseDragged() public void mouseEntered(MouseEvent evt) { } // Some empty routines. public void mouseExited(MouseEvent evt) { } // (Required by the MouseListener public void mouseClicked(MouseEvent evt) { } // and MouseMotionListener public void mouseMoved(MouseEvent evt) { } // interfaces). } // End class SimplePaintPanel } // end class SimplePaint
419c7ff2a6afa4872d88bd3e0f336ce00d8af3f9
0e7b52d0f42b5ff839cc6baeddc3e09e9ff12aec
/src/main/java/org/jenkinsci/plugins/deploy/weblogic/util/DeployerClassPathUtils.java
36905be408cc2fb361ff2cc8bb521b033feb3ff0
[]
no_license
barclay-reg/weblogic-deployer-plugin
3bf0bc2bbd0ae839477418219ba56d913eace380
b91e9d63ddfef122919efa6a04ff9b5314069534
refs/heads/master
2021-01-16T18:53:37.467426
2015-02-11T15:31:03
2015-02-11T15:31:03
30,654,068
0
0
null
2015-02-11T15:24:41
2015-02-11T15:24:41
null
UTF-8
Java
false
false
753
java
/** * */ package org.jenkinsci.plugins.deploy.weblogic.util; import org.codehaus.plexus.util.FileUtils; import org.jenkinsci.plugins.deploy.weblogic.properties.WebLogicDeploymentPluginConstantes; /** * @author rchaumie * */ public class DeployerClassPathUtils { /** * * @return */ public static boolean checkDefaultPathToWebLogicJar() { return FileUtils.fileExists(getDefaultPathToWebLogicJar()); } /** * * @return */ public static String getDefaultPathToWebLogicJar() { String envWlHome = System.getenv(WebLogicDeploymentPluginConstantes.WL_HOME_ENV_VAR_NAME); return FileUtils.normalize(envWlHome+WebLogicDeploymentPluginConstantes.WL_HOME_LIB_DIR+WebLogicDeploymentPluginConstantes.WL_WEBLOGIC_LIBRARY_NAME); } }
2142673580f9e2924cec44b1b8eb7af4a3eb743c
4db5e0ccf2efb1e0a4b8fd7630df1a7a71f4f809
/app/src/main/java/com/example/aplikasikrs/Adapter/MahasiswaAdapter.java
036a13cacfb0d4b2ec7a0f442d7cbaa4259c0e1e
[]
no_license
michaelgerardi/AplikasiKRS
68340895ca0433e96e52b7a6f48c4fe0e8c094cc
3150b4b9d3d9b66b9697a1da5e1b133be64ce9f3
refs/heads/master
2020-08-27T09:14:20.026361
2019-12-13T03:56:31
2019-12-13T03:56:31
217,313,330
0
0
null
null
null
null
UTF-8
Java
false
false
3,131
java
package com.example.aplikasikrs.Adapter; import android.content.Context; import android.content.Intent; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import com.example.aplikasikrs.EditMahasiswa; import com.example.aplikasikrs.Model.Mahasiswa; import com.example.aplikasikrs.R; import java.util.ArrayList; public class MahasiswaAdapter extends RecyclerView.Adapter<MahasiswaAdapter.ViewHolder> { ArrayList<Mahasiswa> MahasiswaArrayList; private Context context; public MahasiswaAdapter(ArrayList<Mahasiswa> mahasiswaArrayLista) { MahasiswaArrayList = mahasiswaArrayLista; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); View view = layoutInflater.inflate(R.layout.card_crud_mahasiswa, parent, false); context = parent.getContext(); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder mahasiswa, int position) { mahasiswa.txtNim.setText(MahasiswaArrayList.get(position).getNIM()); mahasiswa.txtNama.setText(MahasiswaArrayList.get(position).getNama()); mahasiswa.txtAlamat.setText(MahasiswaArrayList.get(position).getAlamat()); mahasiswa.txtEmail.setText(MahasiswaArrayList.get(position).getEmail()); mahasiswa.cd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (context != null) { Intent intent = new Intent(context, EditMahasiswa.class); context.startActivity(intent); } } }); } @Override public int getItemCount() { return (MahasiswaArrayList != null) ? MahasiswaArrayList.size() : 0; } public class ViewHolder extends RecyclerView.ViewHolder implements View.OnCreateContextMenuListener { private TextView txtNim, txtNama, txtAlamat, txtEmail; private ImageView Gambar; private CardView cd; public ViewHolder(View view) { super(view); txtNim = view.findViewById(R.id.txt_nim_mhs); txtNama = view.findViewById(R.id.txt_nama_mhs); txtEmail = view.findViewById(R.id.txt_email_mhs); txtAlamat = view.findViewById(R.id.txt_alamat_mhs); cd = view.findViewById(R.id.CV_Mahasiswa); } @Override public void onCreateContextMenu(ContextMenu Menu, View view, ContextMenu.ContextMenuInfo contextMenuInfo){ Menu.setHeaderTitle("Silahkan Pilih"); Menu.add(this.getAdapterPosition(),view.getId(),0,"Ubah data mahasiswa "); Menu.add(this.getAdapterPosition(),view.getId(),0,"Delete data mahasiswa "); } } }
4314bd4cb3bc35ea884fb331ad86ae8270643518
66a8ca95b9628366d632fc30f111b4fee9c0777d
/src/main/java/com/bootx/entity/AuditLog.java
3bf21d5c78178b3903e6cf105cdc746abbe9ff93
[ "Apache-2.0" ]
permissive
775490841/BootX
ad0c055e6c9b5a720ab1e7bb95354918031f90bf
1777a6e0dddcaa98342391eb3ba8d660ffa496f7
refs/heads/master
2022-06-19T10:40:14.825481
2020-05-12T15:27:49
2020-05-12T15:27:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,793
java
package com.bootx.entity; import com.bootx.common.BaseAttributeConverter; import javax.persistence.*; import java.util.Map; /** * Entity - 审计日志 * * @author blackboy * @version 1.0 */ @Entity @Table(name = "bootx_audit_log") public class AuditLog extends BaseEntity<Long> { private static final long serialVersionUID = -4494144902110236826L; /** * "审计日志"属性名称 */ public static final String AUDIT_LOG_ATTRIBUTE_NAME = AuditLog.class.getName() + ".AUDIT_LOG"; /** * 动作 */ @Column(nullable = false, updatable = false) private String action; /** * 详情 */ @Column(updatable = false) private String detail; /** * IP */ @Column(nullable = false, updatable = false) private String ip; /** * 请求URL */ @Column(nullable = false, updatable = false) private String requestUrl; /** * 请求参数 */ @Column(updatable = false, length = 4000) @Convert(converter = ParameterConverter.class) private Map<String, String[]> parameters; /** * 用户 */ @ManyToOne(fetch = FetchType.LAZY) private User user; /** * 获取动作 * * @return 动作 */ public String getAction() { return action; } /** * 设置动作 * * @param action * 动作 */ public void setAction(String action) { this.action = action; } /** * 获取详情 * * @return 详情 */ public String getDetail() { return detail; } /** * 设置详情 * * @param detail * 详情 */ public void setDetail(String detail) { this.detail = detail; } /** * 获取IP * * @return IP */ public String getIp() { return ip; } /** * 设置IP * * @param ip * IP */ public void setIp(String ip) { this.ip = ip; } /** * 获取请求URL * * @return 请求URL */ public String getRequestUrl() { return requestUrl; } /** * 设置请求URL * * @param requestUrl * 请求URL */ public void setRequestUrl(String requestUrl) { this.requestUrl = requestUrl; } /** * 获取请求参数 * * @return 请求参数 */ public Map<String, String[]> getParameters() { return parameters; } /** * 设置请求参数 * * @param parameters * 请求参数 */ public void setParameters(Map<String, String[]> parameters) { this.parameters = parameters; } /** * 获取用户 * * @return 用户 */ public User getUser() { return user; } /** * 设置用户 * * @param user * 用户 */ public void setUser(User user) { this.user = user; } /** * 类型转换 - 请求参数 * * @author blackboy * @version 1.0 */ @Converter public static class ParameterConverter extends BaseAttributeConverter<Map<String, String[]>> { } }
[ "a12345678" ]
a12345678
08a20d1e97d1d022758892ef021e2a700c2a0dc3
a4fae7172330f6712a4344250906c9b66f553d66
/src/main/java/com/seu/blog/service/impl/CategoryServiceImpl.java
267e59ffa3c81278455a17ac10d3d1bd9aceeaf5
[ "Apache-2.0" ]
permissive
huangkangyuan/vblog-api
2bbe734bd57527235106e48f3679631794d1fa06
09a59faea0b112811544931e3432e1042d1fae91
refs/heads/master
2022-08-02T04:20:16.583655
2019-09-03T11:50:23
2019-09-03T11:50:23
205,071,619
2
2
Apache-2.0
2022-07-06T20:42:06
2019-08-29T03:20:12
JavaScript
UTF-8
Java
false
false
1,479
java
package com.seu.blog.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.seu.blog.dao.CategoryDao; import com.seu.blog.entity.CategoryEntity; import com.seu.blog.service.CategoryService; import com.seu.blog.vo.CategoryVo; import com.seu.common.utils.PageUtils; import com.seu.common.utils.Query; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * 文章类别表 * * @author liangfeihu * @email [email protected] * @date 2018-07-04 15:00:54 */ @Service("categoryService") public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity> implements CategoryService { @Override public PageUtils queryPage(Map<String, Object> params) { Page<CategoryEntity> page = this.selectPage( new Query<CategoryEntity>(params).getPage(), new EntityWrapper<CategoryEntity>() ); return new PageUtils(page); } /** * 文章分类详情 * @return */ @Override public List<CategoryVo> queryCategoryDetails() { return this.baseMapper.queryCategoryDetails(); } /** * 单条文章分类详情 * * @return */ @Override public CategoryVo queryOneCategoryDetail(Integer categoryId) { return this.baseMapper.queryOneCategoryDetail(categoryId); } }
45d78798db55e286536f12813e695c7feed3cf73
3080f96acfc4f2271965a5376f67d67c6e730f47
/app/src/main/java/com/huduan/contactstest/activity/EditActivity.java
85793da1226cfa004516f5a5b1d959ff513a9abe
[]
no_license
huduan/contactsTest
5ae98522afc158e043aad5ef72d76b4b702032ed
5eb4f8150c5eec17a56237afa02ee6a84aed1d5f
refs/heads/master
2021-08-29T10:25:20.021930
2017-12-13T17:32:10
2017-12-13T17:32:10
110,543,529
0
0
null
null
null
null
UTF-8
Java
false
false
5,875
java
package com.huduan.contactstest.activity; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.huduan.contactstest.R; /** * Created by huduan on 17-11-23. */ public class EditActivity extends AppCompatActivity { private EditText edit_name; private EditText edit_number; Context mContext = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contacts_edit); mContext = this; Intent intent = getIntent(); final String name = intent.getStringExtra("name"); String number = intent.getStringExtra("number"); edit_name = findViewById(R.id.edit_name); edit_number = findViewById(R.id.edit_number); edit_name.setText(name); edit_number.setText(number); Button button1 = findViewById(R.id.edit_btn1); //确认编辑 button1.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.KITKAT) public void onClick(View v) { Intent intent1 = new Intent(mContext, MainActivity.class); startActivity(intent1); Editable phoneNumber = edit_number.getText(); updateContactPhoneNumber(name, phoneNumber); finish(); } }); Button button2 = findViewById(R.id.edit_btn2); //取消编辑 button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent2 = new Intent(mContext, MainActivity.class); startActivity(intent2); finish(); } }); } private void updateContactPhoneNumber(String contactName, Editable phoneNumber) { Uri uri = ContactsContract.Data.CONTENT_URI;//对data表的所有数据操作 ContentResolver resolver = getContentResolver(); ContentValues values = new ContentValues(); values.put(ContactsContract.Data.DATA1, String.valueOf(phoneNumber)); resolver.update(uri, values, ContactsContract.Data.MIMETYPE + "=? and " + ContactsContract.PhoneLookup.DISPLAY_NAME + "=?", new String[]{ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE, contactName}); } } /* //根据号码获取联系人的姓名 public void testContactNameByNumber() throws Exception{ String number = "110"; Uri uri = Uri.parse("content://com.android.contacts/data/phones/filter/"+number); ContentResolver resolver = getContext().getContentResolver(); Cursor cursor = resolver.query(uri, new String[]{android.provider.ContactsContract.Data.DISPLAY_NAME}, null, null, null); if(cursor.moveToFirst()){ String name = cursor.getString(0); Log.i(TAG, name); } cursor.close(); } //删除编辑前的信息 public void contactDelete(String name) { //根据name查询到对应的id Uri uri = Uri.parse("content://com.android.contacts/raw_contacts"); ContentResolver resolver = getContentResolver(); Cursor cursor = resolver.query(uri, new String[]{ContactsContract.Data._ID}, "display_name=?", new String[]{name}, null); if (cursor != null) { while (cursor.moveToFirst()) { int id = cursor.getInt(0); //根据id删除对应的联系人数据 resolver.delete(uri, "display_name=?", new String[]{name}); uri = Uri.parse("content://com.android.contacts/data"); resolver.delete(uri, "raw_contact_id=?", new String[]{id + ""}); } cursor.close(); } } //保存更改后的联系人信息 @RequiresApi(api = Build.VERSION_CODES.KITKAT) public void contactInsert() { //获取新增的联系人姓名和电话 String name = edit_name.getText().toString(); String number = edit_number.getText().toString(); //先插入空值,获取对应的rawContactId ContentValues values = new ContentValues(); Uri rawContactUri = getContentResolver().insert(ContactsContract.RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri); //根据contactId新增联系人 if (!Objects.equals(name, "")) { values.clear(); values.put(ContactsContract.Data.RAW_CONTACT_ID, rawContactId); values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE); values.put(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, name); getContentResolver().insert(android.provider.ContactsContract.Data.CONTENT_URI, values); } //插入电话号码 if (!Objects.equals(number, "")) { values.clear(); values.put(android.provider.ContactsContract.Contacts.Data.RAW_CONTACT_ID, rawContactId); values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE); values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, number); values.put(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE); getContentResolver().insert(ContactsContract.Data.CONTENT_URI, values); } } */
34bfe6d6666b222434ca6f098ecafb3d9c42df9b
6b23d8ae464de075ad006c204bd7e946971b0570
/WEB-INF/plugin/nippou/src/jp/groupsession/v2/ntp/model/NippouListSearchModel.java
36376a5d70fb9a4cd98bcec89162d28c702bdcbb
[]
no_license
kosuke8/gsession
a259c71857ed36811bd8eeac19c456aa8f96c61e
edd22517a22d1fb2c9339fc7f2a52e4122fc1992
refs/heads/master
2021-08-20T05:43:09.431268
2017-11-28T07:10:08
2017-11-28T07:10:08
112,293,459
0
0
null
null
null
null
UTF-8
Java
false
false
15,733
java
package jp.groupsession.v2.ntp.model; import java.util.HashMap; import java.util.List; import java.util.Map; import jp.co.sjts.util.date.UDate; import jp.groupsession.v2.cmn.model.AbstractModel; import jp.groupsession.v2.ntp.GSConstNippou; /** * <br>[機 能] 日報一覧の検索条件を格納Modelクラス * <br>[解 説] * <br>[備 考] * * @author JTS */ public class NippouListSearchModel extends AbstractModel { /** ソート区分 グループ週間表示でのソート順 */ public static final int SORTKBN_NIPPO_GROUPSYUKAN = 0; /** ソート区分 一覧検索でのソート順 */ public static final int SORTKBN_NIPPO_SEARCH = 1; /** ソート区分 タイムラインでのソート順 */ public static final int SORTKBN_NIPPO_TIMELINE = 2; /** * * <br>[機 能] 検索ソートキー列挙子 * <br>[解 説] * <br>[備 考] * * @author JTS */ public static enum ENUM_SORT { /** グループ週間表示でのソート順 */ SORT_KEY_NIPPO_GROUPSYUKAN(SORTKBN_NIPPO_GROUPSYUKAN, 0), /** ソート 名前 */ SORT_KEY_NAME(SORTKBN_NIPPO_SEARCH, GSConstNippou.SORT_KEY_NAME), /** ソート 開始日 */ SORT_KEY_FRDATE(SORTKBN_NIPPO_SEARCH, GSConstNippou.SORT_KEY_FRDATE), /** ソート 終了日 */ SORT_KEY_TODATE(SORTKBN_NIPPO_SEARCH, GSConstNippou.SORT_KEY_TODATE), /** ソート タイトル */ SORT_KEY_TITLE(SORTKBN_NIPPO_SEARCH, GSConstNippou.SORT_KEY_TODATE), /** タイムラインソート順 登録日時▲更新日時▲ */ DATE_DESC_EDATE_DESC(SORTKBN_NIPPO_TIMELINE, GSConstNippou.DATE_DESC_EDATE_DESC), /** タイムラインソート順 登録日時▲更新日時▼ */ DATE_DESC_EDATE_ASC(SORTKBN_NIPPO_TIMELINE, GSConstNippou.DATE_DESC_EDATE_ASC), /** タイムラインソート順 登録日時▼更新日時▲ */ DATE_ASC_EDATE_DESC(SORTKBN_NIPPO_TIMELINE, GSConstNippou.DATE_ASC_EDATE_DESC), /** タイムラインソート順 登録日時▼更新日時▼ */ DATE_ASC_EDATE_ASC(SORTKBN_NIPPO_TIMELINE, GSConstNippou.DATE_ASC_EDATE_ASC); /** ソートキー */ private final int sortKbn__; /** * <p>sortKbn を取得します。 * @return sortKbn */ public int getSortKbn() { return sortKbn__; } /** * <p>sortKey を取得します。 * @return sortKey */ public int getSortKey() { return sortKey__; } /** ソート区分 タイムラインソートか一覧検索ソートか */ private final int sortKey__; /** * コンストラクタ * @param sortKbn id値 * @param sortKey key値 */ ENUM_SORT(int sortKbn, int sortKey) { sortKbn__ = sortKbn; sortKey__ = sortKey; } /** * * <br>[機 能] ソートクラスの逆引き * <br>[解 説] * <br>[備 考] * @param sortKbn 区分 * @param sortKey キー値 * @return ソートENUMクラス */ public static ENUM_SORT getSortEnum(int sortKbn, int sortKey) { return ENUM_SORT_MAP.get(sortKbn).get(sortKey); } /**ソートクラスの逆引き用マップ*/ private static final Map<Integer, Map<Integer, ENUM_SORT>> ENUM_SORT_MAP = new HashMap<Integer, Map<Integer, ENUM_SORT>>() { { for (ENUM_SORT sort : ENUM_SORT.values()) { Map<Integer, ENUM_SORT> map; map = get(sort.getSortKbn()); if (map == null) { map = new HashMap<Integer, ENUM_SORT>(); put(sort.getSortKbn(), map); } map.put(sort.getSortKey(), sort); } } }; } /** ユーザSID */ private int usrSid__ = -1; /** 昇順降順 */ private int ntpOrder__; /** ソートKEY */ private ENUM_SORT ntpSortKey__; /** 昇順降順 */ private int ntpOrder2__; /** ソートKEY */ private ENUM_SORT ntpSortKey2__; /** オフセット */ private int ntpOffset__; /** 最大表示件数 */ private int ntpLimit__; //検索条件 /** グループSID */ private String ntpSltGroupSid__; /** 報告日付from */ private UDate ntpDateFrom__; /** 報告日付to */ private UDate ntpDateTo__; /** キーワード */ private List<String> ntpKeyValue__; /** キーワード区分(AND・OR) */ private int keyWordkbn__; /** 検索対象 (件名・本文) */ private String[] targetKbn__ = null; /** 検索対象 タイトル*/ private boolean targetTitle__ = false; /** 検索対象 内容*/ private boolean targetValue__ = false; /** タイトルカラー*/ private String[] bgcolor__ = null; /** 見込み度*/ private String[] mikomido__ = null; /** 活動分類*/ private int katudouBunrui__; /** 活動方法*/ private int katudouHouhou__; /** 案件SID*/ private int ankenSid__; /** 企業SID*/ private int companySid__; /** 拠点SID*/ private int companyBaseSid__; /** マイグループフラグ*/ private boolean myGrpFlg__ = false; /** 日報SID*/ private Integer nipSid__ = null; /** 案件権限チェック確認用モデル*/ private AnkenPermitCheckModel napMdl__ = null; /** 特例アクセス 閲覧不可ユーザ*/ private List<Integer> notAccessUserList__ = null; /** * <p>usrSid を取得します。 * @return usrSid */ public int getUsrSid() { return usrSid__; } /** * <p>usrSid をセットします。 * @param usrSid usrSid */ public void setUsrSid(int usrSid) { usrSid__ = usrSid; } /** * <p>ntpOrder を取得します。 * @return ntpOrder */ public int getNtpOrder() { return ntpOrder__; } /** * <p>ntpOrder をセットします。 * @param ntpOrder ntpOrder */ public void setNtpOrder(int ntpOrder) { ntpOrder__ = ntpOrder; } /** * <p>ntpSortKey を取得します。 * @return ntpSortKey */ public ENUM_SORT getNtpSortKey() { return ntpSortKey__; } /** * <p>ntpSortKey をセットします。 * @param ntpSortKey ntpSortKey */ public void setNtpSortKey(ENUM_SORT ntpSortKey) { ntpSortKey__ = ntpSortKey; } /** * <p>ntpOrder2 を取得します。 * @return ntpOrder2 */ public int getNtpOrder2() { return ntpOrder2__; } /** * <p>ntpOrder2 をセットします。 * @param ntpOrder2 ntpOrder2 */ public void setNtpOrder2(int ntpOrder2) { ntpOrder2__ = ntpOrder2; } /** * <p>ntpSortKey2 を取得します。 * @return ntpSortKey2 */ public ENUM_SORT getNtpSortKey2() { return ntpSortKey2__; } /** * <p>ntpSortKey2 をセットします。 * @param ntpSortKey2 ntpSortKey2 */ public void setNtpSortKey2(ENUM_SORT ntpSortKey2) { ntpSortKey2__ = ntpSortKey2; } /** * <p>ntpOffset を取得します。 * @return ntpOffset */ public int getNtpOffset() { return ntpOffset__; } /** * <p>ntpOffset をセットします。 * @param ntpOffset ntpOffset */ public void setNtpOffset(int ntpOffset) { ntpOffset__ = ntpOffset; } /** * <p>ntpLimit を取得します。 * @return ntpLimit */ public int getNtpLimit() { return ntpLimit__; } /** * <p>ntpLimit をセットします。 * @param ntpLimit ntpLimit */ public void setNtpLimit(int ntpLimit) { ntpLimit__ = ntpLimit; } /** * <p>ntpKeyValue を取得します。 * @return ntpKeyValue */ public List<String> getNtpKeyValue() { return ntpKeyValue__; } /** * <p>ntpKeyValue をセットします。 * @param ntpKeyValue ntpKeyValue */ public void setNtpKeyValue(List<String> ntpKeyValue) { ntpKeyValue__ = ntpKeyValue; } /** * <p>keyWordkbn を取得します。 * @return keyWordkbn */ public int getKeyWordkbn() { return keyWordkbn__; } /** * <p>keyWordkbn をセットします。 * @param keyWordkbn keyWordkbn */ public void setKeyWordkbn(int keyWordkbn) { keyWordkbn__ = keyWordkbn; } /** * <p>targetKbn を取得します。 * @return targetKbn */ public String[] getTargetKbn() { return targetKbn__; } /** * <p>targetKbn をセットします。 * @param targetKbn targetKbn */ public void setTargetKbn(String[] targetKbn) { targetKbn__ = targetKbn; } /** * <p>targetTitle を取得します。 * @return targetTitle */ public boolean isTargetTitle() { return targetTitle__; } /** * <p>targetTitle をセットします。 * @param targetTitle targetTitle */ public void setTargetTitle(boolean targetTitle) { targetTitle__ = targetTitle; } /** * <p>targetValue を取得します。 * @return targetValue */ public boolean isTargetValue() { return targetValue__; } /** * <p>targetValue をセットします。 * @param targetValue targetValue */ public void setTargetValue(boolean targetValue) { targetValue__ = targetValue; } /** * <p>bgcolor を取得します。 * @return bgcolor */ public String[] getBgcolor() { return bgcolor__; } /** * <p>bgcolor をセットします。 * @param bgcolor bgcolor */ public void setBgcolor(String[] bgcolor) { bgcolor__ = bgcolor; } /** * <p>mikomido を取得します。 * @return mikomido */ public String[] getMikomido() { return mikomido__; } /** * <p>mikomido をセットします。 * @param mikomido mikomido */ public void setMikomido(String[] mikomido) { mikomido__ = mikomido; } /** * <p>katudouBunrui を取得します。 * @return katudouBunrui */ public int getKatudouBunrui() { return katudouBunrui__; } /** * <p>katudouBunrui をセットします。 * @param katudouBunrui katudouBunrui */ public void setKatudouBunrui(int katudouBunrui) { katudouBunrui__ = katudouBunrui; } /** * <p>katudouHouhou を取得します。 * @return katudouHouhou */ public int getKatudouHouhou() { return katudouHouhou__; } /** * <p>katudouHouhou をセットします。 * @param katudouHouhou katudouHouhou */ public void setKatudouHouhou(int katudouHouhou) { katudouHouhou__ = katudouHouhou; } /** * <p>ntpDateFrom を取得します。 * @return ntpDateFrom */ public UDate getNtpDateFrom() { return ntpDateFrom__; } /** * <p>ntpDateFrom をセットします。 * @param ntpDateFrom ntpDateFrom */ public void setNtpDateFrom(UDate ntpDateFrom) { ntpDateFrom__ = ntpDateFrom; } /** * <p>ntpDateTo を取得します。 * @return ntpDateTo */ public UDate getNtpDateTo() { return ntpDateTo__; } /** * <p>ntpDateTo をセットします。 * @param ntpDateTo ntpDateTo */ public void setNtpDateTo(UDate ntpDateTo) { ntpDateTo__ = ntpDateTo; } /** * <p>ntpDateFr、ntpDateToを指定日付の範囲でセットします。 * @param ntpDateFr 開始日 * @param length 日数 */ public void setNtpDateDayLenge(UDate ntpDateFr, int length) { ntpDateFrom__ = ntpDateFr.cloneUDate(); ntpDateFrom__.setZeroHhMmSs(); ntpDateTo__ = ntpDateFr.cloneUDate(); ntpDateTo__.addDay(length - 1); ntpDateTo__.setMaxHhMmSs(); } /** * <p>myGrpFlg を取得します。 * @return myGrpFlg */ public boolean isMyGrpFlg() { return myGrpFlg__; } /** * <p>myGrpFlg をセットします。 * @param myGrpFlg myGrpFlg */ public void setMyGrpFlg(boolean myGrpFlg) { myGrpFlg__ = myGrpFlg; } /** * <p>ntpSltGroupSid を取得します。 * @return ntpSltGroupSid */ public String getNtpSltGroupSid() { return ntpSltGroupSid__; } /** * <p>ntpSltGroupSid をセットします。 * @param ntpSltGroupSid ntpSltGroupSid */ public void setNtpSltGroupSid(String ntpSltGroupSid) { ntpSltGroupSid__ = ntpSltGroupSid; } /** * <p>ankenSid を取得します。 * @return ankenSid */ public int getAnkenSid() { return ankenSid__; } /** * <p>ankenSid をセットします。 * @param ankenSid ankenSid */ public void setAnkenSid(int ankenSid) { ankenSid__ = ankenSid; } /** * <p>companySid を取得します。 * @return companySid */ public int getCompanySid() { return companySid__; } /** * <p>companySid をセットします。 * @param companySid companySid */ public void setCompanySid(int companySid) { companySid__ = companySid; } /** * <p>companyBaseSid を取得します。 * @return companyBaseSid */ public int getCompanyBaseSid() { return companyBaseSid__; } /** * <p>companyBaseSid をセットします。 * @param companyBaseSid companyBaseSid */ public void setCompanyBaseSid(int companyBaseSid) { companyBaseSid__ = companyBaseSid; } /** * <p>nipSid を取得します。 * @return nipSid */ public Integer getNipSid() { return nipSid__; } /** * <p>nipSid をセットします。 * @param nipSid nipSid */ public void setNipSid(Integer nipSid) { nipSid__ = nipSid; } /** * <p>napMdl を取得します。 * @return napMdl */ public AnkenPermitCheckModel getNapMdl() { return napMdl__; } /** * <p>napMdl をセットします。 * @param napMdl napMdl */ public void setNapMdl(AnkenPermitCheckModel napMdl) { napMdl__ = napMdl; } /** * <p>notAccessUserList を取得します。 * @return notAccessUserList */ public List<Integer> getNotAccessUserList() { return notAccessUserList__; } /** * <p>notAccessUserList をセットします。 * @param notAccessUserList notAccessUserList */ public void setNotAccessUserList(List<Integer> notAccessUserList) { notAccessUserList__ = notAccessUserList; } }
[ "PK140601-29@PK140601-29" ]
PK140601-29@PK140601-29
77dbed9e52805c3c9a4f827d854d7800a86e1691
595f7066261bc6b39415e852f3802d956ea9fad6
/src/gestionarticulos/PanelClienteBorrar.java
6981919ba7bd021799a7590544c9f0e5606fe208
[]
no_license
neop2k6/GestionArticulos
355f7998e533df5c6232da8487fd5f5ae2b7b1a4
4dd3e2340452dcf8e3cc11627e367ab48d0315e6
refs/heads/master
2020-05-27T01:01:07.527015
2013-05-09T13:52:59
2013-05-09T13:52:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,532
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gestionarticulos; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; /** * * @author alum */ public class PanelClienteBorrar extends JPanel implements ActionListener{ private Color colorFondo = new Color(170,45,72); LabelCliente lblBorrar, lblCodigo; JTextField txtNIF; JButton btnBorrar; Clientes clientes; PanelClienteBorrar(Clientes clientes){ super(); this.clientes= clientes; setPreferredSize(new Dimension(650, 250)); setLayout(new GridLayout(0,1)); setBackground(colorFondo); componentes(); } public void componentes(){ lblCodigo= new LabelCliente("NIF: "); add(lblCodigo); txtNIF= new JTextField(); add(txtNIF); btnBorrar=new JButton("Borrar"); btnBorrar.addActionListener(this); add(btnBorrar); } @Override public void actionPerformed(ActionEvent e) { String boton = e.getActionCommand(); String NIF; boolean borrado; NIF=txtNIF.getText(); if(boton.equals("Borrar")){ borrado=clientes.borrarCliente(NIF); if(borrado==true){ lblBorrar = new LabelCliente("Elemento Borrado"); add(lblBorrar); updateUI(); } } } }
0f6120ea3c3b3d27bffa7e7a238cd5224904d83f
f353942026e47e491b8b4b28c640e466cd3b8fd1
/common/web-framework/src/main/java/com/site/web/mvc/lifecycle/ErrorHandler.java
6873ac289b046d914a7098cae51d9fd616708aea
[]
no_license
qmwu2000/workshop
392c952f7ef66c4da492edd929c47b7a1db3e5fa
9c1cc55122f78045aa996d5714635391847ae212
refs/heads/master
2021-01-17T08:55:54.655925
2012-11-13T13:31:14
2012-11-13T13:31:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package com.site.web.mvc.lifecycle; import com.site.web.mvc.ActionContext; import com.site.web.mvc.model.ErrorModel; public interface ErrorHandler { public void handle(ActionContext<?> context, Throwable cause); public void initialize(ErrorModel error); }
e881d80ea1a1c56e7675b738ebe411af83b69637
2c62f6d9e0bc6065f24da213dfbd10c88ec275d9
/src/web/tela/Principal.java
0cb578764a1bae89353e7b48fd9265724d8d4d8f
[]
no_license
oliveiraanalouise/ValeTransporte
cbf7963ea0535d40ffbc581440259a432ac357bf
5b59d8a9e09304ccd23991c3f9fb4740a3bdc2af
refs/heads/master
2023-06-15T07:30:11.098147
2019-04-22T19:53:38
2019-04-22T19:57:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package web.tela; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dao.UsuarioDAO; import entity.Usuario; import web.Logica; @WebServlet("/telaprincipal") public class Principal extends Logica{ private static final long serialVersionUID = 1L; protected void service(HttpServletRequest pedido, HttpServletResponse resposta) throws ServletException, IOException { Usuario u = (Usuario) pedido.getSession().getAttribute("usuario"); pedido.setAttribute("supervisores", new UsuarioDAO().getAllSupervisor()); if(u!=null) redireciona("logado/index.jsp", pedido, resposta); else redireciona("erro402", pedido, resposta); } }
fa39e447cbf252f664789f93e63f45ab0777cad5
6edd8a7c10d50e392b11f0c9424b9917ee7d8625
/java/defangingAnIpAddress.java
73a6af1eb15aa46a69133cee5d9c06bde439b0a2
[]
no_license
coderquill/Leetcode-solutions
381a0daa1be6b4d2b81603cd7d6740c3a4e5beae
96593c06a48c92fc90fd60a07b2723f848260a25
refs/heads/master
2021-07-06T17:49:02.083550
2020-08-10T16:38:00
2020-08-10T16:38:00
163,708,083
0
0
null
null
null
null
UTF-8
Java
false
false
393
java
/*https://leetcode.com/problems/defanging-an-ip-address/*/ class Solution { public String defangIPaddr(String address) { String ans = ""; for(int i = 0; i<address.length(); i++){ if(address.charAt(i) == '.'){ ans = ans+"[.]"; }else{ ans = ans + address.charAt(i); } } return ans; } }
f1d38d9bbda721c42dad455951af20943c9c9c4d
4cc6fb1fde80a1730b660ba5ec13ad5f3228ea5c
/java-lihongjie/netty-game-server/game-db/src/test/java/com/snowcattle/game/db/service/jdbc/service/entity/IOrderService.java
54ca7b1fb02dde7ac06d9588e929a941dc754e9b
[ "GPL-3.0-only", "MIT" ]
permissive
lihongjie/tutorials
c598425b085549f5f7a29b1c7bf0c86ae9823c94
c729ae0eac90564e6366bc4907dcb8a536519956
refs/heads/master
2023-08-19T05:03:23.754199
2023-08-11T08:25:29
2023-08-11T08:25:29
124,048,964
0
0
MIT
2018-04-01T06:26:19
2018-03-06T08:51:04
Java
UTF-8
Java
false
false
672
java
package com.snowcattle.game.db.service.jdbc.service.entity; import com.snowcattle.game.db.service.jdbc.entity.Order; import java.util.List; /** * Created by jiangwenping on 17/3/20. */ public interface IOrderService { public long insertOrder(Order order); public Order getOrder(long userId, long id); public List<Order> getOrderList(long userId); public List<Order> getOrderList(long userId, String status); void updateOrder(Order order); void deleteOrder(Order order); public List<Long> insertOrderList(List<Order> order); public void updateOrderList(List<Order> order); public void deleteOrderList(List<Order> order); }
e06f0df323aabed618b021e5ffb18d8561a5a085
de7933d8dedceb731a7532681c1e774daa9c500b
/src/milestone2/FileHandler.java
f060e023f4e890cbc1ecc46b0f95a877408cd991
[]
no_license
PurushottamPadhya/ProjectManagement
e24555d4a0f79abc2ab5448c2b8bf30885de9760
ac94342eb742d70838dc9851f9c12f3078dff5b2
refs/heads/master
2022-12-29T16:05:59.995596
2020-10-13T05:33:26
2020-10-13T05:33:26
303,598,187
0
0
null
null
null
null
UTF-8
Java
false
false
2,678
java
package milestone2; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.List; import milestone1.Preference; import milestone1.Project; import milestone1.ShortlistProject; import milestone1.Student; import milestone1.Utility; public class FileHandler { /* * Write all file from the old txt files to dat file using serialization * */ public void serializeTxFile() { this.WriteProjects(); this.WriteStudents(); this.WritePreferences(); this.WriteSelectedProjects(); this.WriteStudentsInfo(); } @SuppressWarnings("unchecked") public void WriteProjects() { List<Project> projects = Utility.getProjectDetails(Utility.ProjectFileName); try { ObjectOutputStream outPutStream = new ObjectOutputStream(new FileOutputStream(Handler.ProjectFileNameSerialize)); outPutStream.writeObject(projects); } catch(IOException e) { e.getMessage(); } } @SuppressWarnings("unchecked") public void WriteStudents() { List<Student> projects = Utility.getStudentDetails(Utility.StudentFileName); try { ObjectOutputStream outPutStream = new ObjectOutputStream(new FileOutputStream(Handler.StudentFileNameSerialize)); outPutStream.writeObject(projects); } catch(IOException e) { e.getMessage(); } } @SuppressWarnings("unchecked") public void WriteStudentsInfo() { List<Student> projects = Utility.getStudentPersonalityDetails(Utility.StudentInfoFileName); try { ObjectOutputStream outPutStream = new ObjectOutputStream(new FileOutputStream(Handler.StudentInfoFileNameSerialize)); outPutStream.writeObject(projects); } catch(IOException e) { e.getMessage(); } } @SuppressWarnings("unchecked") public void WritePreferences() { List<Preference> preference = Utility.getStudentPreferencesDetails(Utility.PreferenceFileName); try { ObjectOutputStream outPutStream = new ObjectOutputStream(new FileOutputStream(Handler.PreferenceFileNameSerialize)); outPutStream.writeObject(preference); } catch(IOException e) { e.getMessage(); } } @SuppressWarnings("unchecked") public void WriteSelectedProjects() { List<ShortlistProject> shortList = Utility.getShortListedProjects(Utility.ShortlistFileName); try { ObjectOutputStream outPutStream = new ObjectOutputStream(new FileOutputStream(Handler.ShortlistFileNameSerialize)); outPutStream.writeObject(shortList); } catch(IOException e) { e.getMessage(); } } }
fecbdff101d163cee20b729371c580b23cbf2c4e
ec3e364e45fb5e6e1d2939b3e6fdc0fde7d066be
/src/main/java/com/dascom/website/controller/ManageController.java
6b1ec8fb72345b5e38b878c091384f9c874650fc
[]
no_license
Jack-S-Wang/dsBackWebsit
de648b8dec13a0a634c9889ff097533b570afd0d
f77886922a346bc523199ef99faca906adfdc685
refs/heads/master
2020-04-16T12:27:54.277459
2019-01-23T09:02:16
2019-01-23T09:02:16
165,580,581
0
0
null
null
null
null
UTF-8
Java
false
false
9,426
java
package com.dascom.website.controller; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.alibaba.fastjson.JSONObject; import com.dascom.website.service.AppService; import com.dascom.website.service.CatalogService; import com.dascom.website.service.DocumentService; import com.dascom.website.service.EncloureService; import com.dascom.website.service.UserService; /** * 官网管理的所有接口内容 * * @author DS-031 * */ @RestController public class ManageController { private static final Logger log = LogManager.getLogger(ManageController.class); @Autowired EncloureService encloure; @Autowired CatalogService catalog; @Autowired DocumentService document; @Autowired AppService appService; @Autowired UserService user; /** * 文件相关接口,设置了多文件上传,但外部并没有说明,这是因为还没有明确业务文件上传也需要多文件上传,文件是没有查询功能的 * @param file * @param id * @param Document_Id * @param cata_Id * @param updateContent * @param name * @param version * @param code * @param type * @return */ @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping(value = "/v3.0/attachment", method = RequestMethod.POST) public Object attachmentIn(MultipartFile[] file, String id, String Doc_Id, String cata_Id, String updateContent, String name, String version, String code, String IShow,String type) { JSONObject rs = new JSONObject(); if ((type == null || type == "")) { rs.put("code", 101001); rs.put("data", "必填参数为空了"); return rs; } try { JSONObject json = new JSONObject(); json.put("id", id); json.put("Doc_Id", Doc_Id); json.put("cata_Id", cata_Id); json.put("updateContent", updateContent); json.put("name", name); json.put("version", version); json.put("code", code); json.put("IShow", IShow); switch (type) { case "add": if (encloure.addEncloure(file, json) > 0) { rs.put("code", 101000); rs.put("data", "执行成功"); } else { rs.put("code", 101002); rs.put("data", "执行失败"); } break; case "update": if (encloure.updateEncloure(file, json) > 0) { rs.put("code", 101000); rs.put("data", "执行成功"); } else { rs.put("code", 101002); rs.put("data", "执行失败"); } break; case "del": if (encloure.delEncloure(json) > 0) { rs.put("code", 101000); rs.put("data", "执行成功"); } else { rs.put("code", 101002); rs.put("data", "执行失败"); } break; case "search": Object ob=encloure.searchEncloure(json); rs.put("code", 101000); rs.put("data", ob); break; } } catch (Exception ex) { ex.printStackTrace(); log.error(ex.getStackTrace()); rs.put("code", 101003); rs.put("data", "有异常" + ex.getMessage()); return rs; } return rs; } /** * app相关接口 * @param files * @param id * @param updateContent * @param name * @param version * @param number * @param code * @param type * @param genre * @return */ @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping(value = "/v3.0/application", method = RequestMethod.POST) public Object applicationIn(MultipartFile[] files, String id, String updateContent, String name, String version,String number, String code, String type,String genre) { JSONObject rs=new JSONObject(); if ((type == null || type == "")) { rs.put("code", 101001); rs.put("data", "必填参数为空了"); return rs; } try { JSONObject json = new JSONObject(); json.put("id", id); json.put("updateContent", updateContent); json.put("name", name); json.put("version", version); json.put("number", number); json.put("code", code); json.put("genre", genre); switch (type) { case "add": appService.addApp(files, json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "update": appService.updateApp(files, json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "del": appService.delApp(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "search": Object reob=appService.searchApp(json); rs.put("code", 101000); rs.put("data", reob); break; } } catch (Exception ex) { ex.printStackTrace(); log.error(ex.getStackTrace()); rs.put("code", 101003); rs.put("data", "有异常" + ex.getMessage()); return rs; } return rs; } /** * 目录相关接口 * * @param json * @return */ @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping(value = "/v3.0/catalgue", method = RequestMethod.POST) public Object catalgueIn(@RequestBody JSONObject json) { JSONObject rs = new JSONObject(); if ((json.getString("type") == null || json.getString("type") == "")) { rs.put("code", 101001); rs.put("data", "必填参数为空了"); return rs; } try { String type = json.getString("type"); switch (type) { case "add": catalog.addCatalog(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "update": catalog.updateCata(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "search": Object ob = catalog.searchCata(json); rs.put("code", 101000); rs.put("data", ob); break; case "del": catalog.delCata(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; } return rs; } catch (Exception ex) { ex.printStackTrace(); log.error(ex.getStackTrace()); rs.put("code", 101003); rs.put("data", "有异常错误"); return rs; } } /** * 文档接口 * @param json * @return */ @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping(value = "/v3.0/content", method = RequestMethod.POST) public Object documentIn(@RequestBody JSONObject json) { JSONObject rs = new JSONObject(); if ((json.getString("type") == null || json.getString("type") == "")) { rs.put("code", 101001); rs.put("data", "必填参数为空了"); return rs; } try { String type = json.getString("type"); switch (type) { case "add": document.addDocument(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "update": document.updateDocument(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "search": Object ob = document.searchDocument(json); rs.put("code", 101000); rs.put("data", ob); break; case "del": document.delDocument(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "searchShow": Object alo=document.searchShow(); rs.put("code", 101000); rs.put("data", alo); break; case "clear": document.del(); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "restore": document.restore(json.getString("Document_Id")); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "searchDel": Object dob=document.searchDel(); rs.put("code", 101000); rs.put("data", dob); break; } return rs; } catch (Exception ex) { ex.printStackTrace(); log.error(ex.getStackTrace()); rs.put("code", 101003); rs.put("data", "有异常错误"); return rs; } } /** * 管理员用户账号 * @param json * @return */ @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping(value = "/v3.0/admin", method = RequestMethod.POST) public Object userIn(@RequestBody JSONObject json) { JSONObject rs = new JSONObject(); if ((json.getString("type") == null || json.getString("type") == "")) { rs.put("code", 101001); rs.put("data", "必填参数为空了"); return rs; } try { String type = json.getString("type"); switch (type) { case "add": user.addUser(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "update": user.updateUser(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; case "search": Object ob = user.searchUser(json); rs.put("code", 101000); rs.put("data", ob); break; case "del": user.delUser(json); rs.put("code", 101000); rs.put("data", "执行成功"); break; } return rs; } catch (Exception ex) { ex.printStackTrace(); log.error(ex.getStackTrace()); rs.put("code", 101003); rs.put("data", "有异常错误"); return rs; } } }
3bd9fa77076e6fd412f0e38ff8980a29a566a35e
55a709450dccef57022b12ba3931c522c5484c98
/src/main/java/com/crm/cust/controller/CstActivityController.java
54b68b65ffaae8ab247686463b742757cd0c4342
[]
no_license
Gxuxu-cpu/springboot-crm
367004a4c93eb2c6b5e66d014b8c367750899c54
42f290051d3717e40a31bd74e4882e20d35d26c6
refs/heads/master
2022-07-16T06:06:14.278921
2019-12-25T00:56:21
2019-12-25T00:56:21
229,955,498
3
0
null
2022-06-29T17:52:04
2019-12-24T14:27:34
Java
GB18030
Java
false
false
4,195
java
package com.crm.cust.controller; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.crm.bean.CstActivity; import com.crm.bean.CstCustomer; import com.crm.bean.CstLinkman; import com.crm.cust.service.ICstActivityService; @Controller @RequestMapping("/activity") public class CstActivityController { @Resource private ICstActivityService cstActivityService; @RequestMapping("/list") /** * 需要查询交易记录的列表,以及用户?由于联系人页面显示的客户信息很少, * 直接从列表页面把值传递过去,减少数据库的查询次数。 * @param cstCustomer * @param model * @return */ public String list(CstCustomer cstCustomer,Model model) { //交往记录列表查询 List<CstActivity> activities = cstActivityService.findActivitiesByCustNo(cstCustomer.getCustNo()); model.addAttribute("activities", activities); //把客户列表传递过来的参数直接放入model再次进行传递 model.addAttribute("cstCustomer", cstCustomer); return "cust/cust/activities"; } //跳转到交易记录添加页面 //点击添加按钮的时候应该把 //客户的名称和编号同时传递到添加页面 =>model.addAttribute("cstCustomer", cstCustomer); //并且用隐藏域保存起来。 @RequestMapping("/toAdd") public String toAdd(Model model,CstCustomer cstCustomer) { model.addAttribute("cstCustomer", cstCustomer); return "cust/cust/activities_add"; } /** * * @param model * @param * @return * @throws UnsupportedEncodingException */ @RequestMapping("/add") public String add(Model model,CstActivity cstActivity) throws UnsupportedEncodingException { cstActivityService.saveEntity(cstActivity); //解决中文乱码的问题 cstActivity.setAtvCustName(URLEncoder.encode(cstActivity.getAtvCustName(), "utf-8")); //解决传递客户信息的问题,客户id和客户名称,拼接到地址后面 return "redirect:../activity/list?custNo="+cstActivity.getAtvCustNo()+"&custName="+cstActivity.getAtvCustName(); } /** * 点击更新按钮跳转到更新页面,根据id来查询即可=》形参中用lmkId接收即可 * 显示联系人信息 * @param model * @param cstCustomer * @return */ @RequestMapping("/toEdit") public String toEdit(Model model,Long atvId) { model.addAttribute("cstActivity", cstActivityService.findEntityById(atvId)); return "cust/cust/activities_edit"; } /** * 接收编辑页面传递来的linkman信息,调用通用方法的更新即可实现。 * @param model * @param * @return * @throws UnsupportedEncodingException */ @RequestMapping("/edit") public String edit(CstActivity cstActivity) throws UnsupportedEncodingException { cstActivityService.updateEntity(cstActivity); //解决中文乱码的问题 cstActivity.setAtvCustName(URLEncoder.encode(cstActivity.getAtvCustName(), "utf-8")); //解决传递客户信息的问题,客户id和客户名称,拼接到地址后面 return "redirect:../activity/list?custNo="+cstActivity.getAtvCustNo()+"&custName="+cstActivity.getAtvCustName(); } /** * <img onclick="to('../cstActivity/delete?lkmId=${cstActivity.lkmId}&lkmCustNo=${cstActivity.lkmCustNo}&lkmCustName=${cstActivity.lkmCustName}');" /> * 前台页面传递了三个参数 * lkmId用于删除 * lkmCustNo和lkmCustName用于页面的跳转 * @param cstActivity * @return * @throws UnsupportedEncodingException */ @RequestMapping("/delete") public String delete(CstActivity cstActivity) throws UnsupportedEncodingException { cstActivityService.deleteByPrimaryKey(cstActivity.getAtvId()); //解决中文乱码的问题 cstActivity.setAtvCustName(URLEncoder.encode(cstActivity.getAtvCustName(), "utf-8")); //解决传递客户信息的问题,客户id和客户名称,拼接到地址后面 return "redirect:../activity/list?custNo="+cstActivity.getAtvCustNo()+"&custName="+cstActivity.getAtvCustName(); } }
199126955712636eb3ed038375df7ebfa91668b8
8311618aedd4a4d7c68220fbb02a98e4c57b6ea6
/src/main/java/com/bolitik/id/security/WebSecurity.java
71e496e2ff007df677d59de89a6d4d007cec9e28
[]
no_license
MulyonoPutra/BE-SocialAuth
062737f19aacf5bacfdde318c5b555a88180fad4
e382d30467192bff2747af42860892045dc12496
refs/heads/master
2023-08-24T10:16:22.903012
2021-10-17T10:55:27
2021-10-17T10:55:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,714
java
package com.bolitik.id.security; import com.bolitik.id.security.JWT.JWTEntryPoint; import com.bolitik.id.security.JWT.JWTTokenFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class WebSecurity extends WebSecurityConfigurerAdapter { @Autowired UserDetailsServiceImpl userDetailsServiceImpl; @Autowired JWTEntryPoint jwtEntryPoint; @Bean JWTTokenFilter jwtTokenFilter(){ return new JWTTokenFilter(); } @Bean PasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(); } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected AuthenticationManager authenticationManager() throws Exception { return super.authenticationManager(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsServiceImpl).passwordEncoder(passwordEncoder()); } @Override protected void configure(HttpSecurity http) throws Exception { http.cors().and().csrf().disable() .authorizeRequests() .antMatchers("/oauth/**").permitAll() .anyRequest().authenticated() .and() .exceptionHandling().authenticationEntryPoint(jwtEntryPoint) .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.addFilterBefore(jwtTokenFilter(), UsernamePasswordAuthenticationFilter.class); } }
0c519a2525f6b549fe5d98f3c56cce2f5b20d297
e701e1d4c78d335d2543a7618f27164edafe048b
/Software-Construction/Module-Introduction/ShoppingCartWithPromotion/OrderedItemsInCart.java
2a31f52f200c9015b741a9f692596415a70e06bf
[]
no_license
meta-Niraj-Gupta/GET-2018
80827a44530ef5c4607b712d0f8680c825d9036b
ff4da9e4415de183f50f6526be72aeaa57f7e9d5
refs/heads/master
2020-03-24T17:42:43.346617
2018-10-22T13:03:08
2018-10-22T13:03:08
141,122,197
0
0
null
2018-07-16T10:13:22
2018-07-16T10:13:22
null
UTF-8
Java
false
false
4,756
java
package ShoppingCartWithPromotion; import java.util.HashMap; import java.util.Map; /** * * @author Niraj Gupta * The class is used to create an reference of OrderedItemsInCart which contains the product id and the quantity of the product. * This calss has following behaviours: * 1. The class can be used to add/remove products from cart * 2. The class allow user to view at any instance what they have added to their cart * 3. The class also generate bills once the product has been finally added to the cart. * */ public class OrderedItemsInCart { Map<Integer, Integer> shoppingCart; static public Map<Integer, Item> product; private double totalShoppingCost; private FixedProductPromotion fixedProductPromotion; private FixedOrderPromotion fixedOrderPromotion; /** * Default Constructor */ public OrderedItemsInCart(){ shoppingCart = new HashMap<Integer, Integer>(); totalShoppingCost = 0.0; } /** * This method adds items to the shopping cart having an product id as key and quantity as its value. * @param productId The product is used as a key to store value in HashMap named shoppingCart. * @param quantity The quantity of the product * @throws ItemNotFoundError */ public void addProductToCart(int productId, int quantity) throws ItemNotFoundException{ if(shoppingCart.containsKey(productId)){ editProductQuantity(productId, quantity); } if(product.containsKey(productId)){ shoppingCart.put(productId, quantity); }else{ throw new ItemNotFoundException("The product " + product.get(productId).getProductName() + " is not in the stock"); } totalShoppingCost += product.get(productId).getProductCost() * quantity; } /** * This method edit the quantity of the already existing item in the shopping cart. * @param productId The product is used as a key to store value in HashMap named shoppingCart. * @param quantity The quantity of the product * @throws ItemNotFoundError */ public void editProductQuantity(int productId, int quantity) throws ItemNotFoundException{ if(shoppingCart.containsKey(productId)){ shoppingCart.put(productId, shoppingCart.get(productId) + quantity); }else{ throw new ItemNotFoundException("The product " + product.get(productId).getProductName() + " is not in the stock"); } totalShoppingCost += product.get(productId).getProductCost() * quantity; } /** * This method removes the product from the shopping cart. * @param productId The product is used as a key to store value in HashMap named shoppingCart. */ public void removeProductFromCart(int productId){ if(shoppingCart.containsKey(productId)){ totalShoppingCost -= product.get(productId).getProductCost() * shoppingCart.get(productId); shoppingCart.remove(productId); } else{ System.out.println("Product is not added to the cart hence cannot be removed."); } } /** * This method prints the product id, name, rate, quantity and price whenever user wants to see what they have * added to the shopping cart. */ public void printCartItems(){ System.out.println("Your Cart Contains following items."); System.out.format("\n%-10s %-15s %10s\n", "ProductID", "ProductName", "Quantity"); for(int id : shoppingCart.keySet()){ Item item = product.get(id); System.out.format("%-10d %-15s %9d\n", item.getProductId(), item.getProductName(), shoppingCart.get(id)); } } /** * This method generates bill which will give information about product id, name, rate, quantity and price and the * total cost. */ public void generateBill(){ System.out.println("\n\t\t\t\tInvoice"); System.out.format("\n%-10s %-15s %10s %10s %10s\n", "ProductID", "ProductName", "Rate", "Quantity", "Price"); for(int id : shoppingCart.keySet()){ Item item = product.get(id); double itemCost = FixedProductPromotion.applyPromotion(fixedProductPromotion, item.getProductCost()) * shoppingCart.get(id); System.out.format("%-10d %-15s %10.2f %9d %10.2f\n",item.getProductId(),item.getProductName(),item.getProductCost(),shoppingCart.get(id),itemCost); totalShoppingCost += itemCost; } double netCost = FixedOrderPromotion.applyPromotion(fixedOrderPromotion, totalShoppingCost); System.out.println("\nTotal value added to cart is: " + totalShoppingCost); System.out.println("Total cost after applying promo code is " + netCost); } public void setFixedOrderPromotion(FixedOrderPromotion fixedOrderPromotion){ this.fixedOrderPromotion=fixedOrderPromotion; } public void setFixedProductPromotion(FixedProductPromotion fixedProductPromotion){ this.fixedProductPromotion=fixedProductPromotion; } }
4a13c4da8a41b601a126320c9bf05fdd28b6e22b
eb4781ece83f91562d977a022780e843a709ce63
/src/com/data/model/Page.java
ee8a8993080c5610390ad09e0b47334a501ecb1b
[]
no_license
gengchangbao/geng
750118f4acdf04468ac041c7f3adc2c1fa1183b8
e28a1e71954d220ad58d34ce45f5cbab7700bf7f
refs/heads/master
2021-01-20T20:03:23.679780
2016-08-07T07:00:53
2016-08-07T07:00:53
64,764,421
1
0
null
null
null
null
GB18030
Java
false
false
1,287
java
package com.data.model; import java.util.HashSet; import java.util.Set; /** * 页面类 * @author Administrator * */ public class Page { private Integer id; private String title="未命名sadsa"; private String description;//产品描述 //页序 private float orderno; public float getOrderno() { return orderno; } public void setOrderno(float orderno) { this.orderno = orderno; } //建立从Page到Survey之间多对一关联关系 private Survey survey; //建立从Page到Question之间一对多关联关系 private Set<Question> questions =new HashSet<Question>(); public Set<Question> getQuestions() { return questions; } public void setQuestions(Set<Question> questions) { this.questions = questions; } public Survey getSurvey() { return survey; } public void setSurvey(Survey survey) { this.survey = survey; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
577c6a9a4727a44533ff5decec9a711aa77f76a0
cf6a2dd9d33935b89c7153346e757c933a4501e2
/src/main/java/com/lun/designpattern/command/example5/StereoOnCommand.java
e81d99f90fdb8f635bde61a0be69ba15787dc50a
[]
no_license
JallenKwong/LearnDesignPattern
8ae49aaaaea41f07b28c385be8d00651ad48c2d9
5a39e0ed527b8441fa873bc08d83676fa5e616cc
refs/heads/master
2020-03-24T21:24:08.994402
2019-01-04T17:40:13
2019-01-04T17:40:13
143,030,412
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.lun.designpattern.command.example5; public class StereoOnCommand implements Command { Stereo stereo; public StereoOnCommand(Stereo stereo) { this.stereo = stereo; } public void execute() { stereo.on(); } public void undo() { stereo.off(); } }
58bb627a2f97c77007f1f98b3fe5ae983c3abd09
eb69fbb1045c6ca8091f9a853c9cdae5fe907653
/cpp_grammar/Absyn/SDecl.java
a62347d1e0e0ad254900fdd1a00a2bcae1c7c219
[]
no_license
bobbykain/402-a2
1fc997f5b0f343a20e0f14b438772e5f3f659919
0a9935a404a7adf62f722af4d16fb08d0ee1edc9
refs/heads/master
2020-04-26T03:04:37.696062
2019-03-01T07:25:30
2019-03-01T07:25:30
173,254,994
0
0
null
null
null
null
UTF-8
Java
false
false
588
java
package cpp_grammar.Absyn; // Java Package generated by the BNF Converter. public class SDecl extends Stm { public final Arg arg_; public SDecl(Arg p1) { arg_ = p1; } public <R,A> R accept(cpp_grammar.Absyn.Stm.Visitor<R,A> v, A arg) { return v.visit(this, arg); } public boolean equals(Object o) { if (this == o) return true; if (o instanceof cpp_grammar.Absyn.SDecl) { cpp_grammar.Absyn.SDecl x = (cpp_grammar.Absyn.SDecl)o; return this.arg_.equals(x.arg_); } return false; } public int hashCode() { return this.arg_.hashCode(); } }
18194174d8fbcf78d3b098ca77fa9b6ba4922e39
ddde0bf04f3d4e4c9b5abc262d0121f4cdf5f26b
/src/test/java/chapter6/ToListCollectorTest.java
4dbb894fa396b1945a99c89ac9df507deae4c341
[]
no_license
joshuafromkorea/Java_8_In_Action_Study
e55a865c0e1c3988ca64ea67404160210ba0201d
54d9089db5c9e878b8e0a5710a059966c5db566a
refs/heads/master
2020-06-01T16:16:29.670104
2019-06-30T09:27:23
2019-06-30T09:27:23
190,846,932
0
0
null
null
null
null
UTF-8
Java
false
false
824
java
package chapter6; import chapter4_5.Dish; import chapter4_5.MenuBuilder; import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class ToListCollectorTest { List<Dish> menu; @Before public void 메뉴_준비하기(){ menu = MenuBuilder.getMenu(); } @Test public void 커스텀_컬렉터_사용하기(){ List<Dish> toListDishes = menu.stream().collect(new ToListCollector<Dish>()); System.out.println(toListDishes); } @Test public void 컬렉터_구현없이_컬렉팅_하기(){ List<Dish> dishes = menu.stream().collect( ArrayList::new, List::add, List::addAll ); System.out.println(dishes); } }
c72eebd6d223fd5f9cb8dc1dabad5f892c762559
09b0e4db08a0ddf2cb52757901a800414e353fa7
/src/main/java/com/InfinityRaider/settlercraft/settlement/building/utility/BuildingTypeUtility.java
2db428037c7629caafaf80e82ec0c5d14fc14348
[ "MIT" ]
permissive
gilfort/SettlerCraft
5d2042aa2c537ad983312be03164da073fb9f465
a1f0a60054698ac9f74e7e9c5ca7d0b9bd335284
refs/heads/master
2020-12-01T13:06:07.348238
2016-07-18T18:27:43
2016-07-18T18:27:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
package com.InfinityRaider.settlercraft.settlement.building.utility; import com.InfinityRaider.settlercraft.api.v1.ISettlement; import com.InfinityRaider.settlercraft.settlement.building.BuildingTypeBase; public class BuildingTypeUtility extends BuildingTypeBase { public BuildingTypeUtility() { super("utilities"); } @Override public int maximumBuildingCountPerSettlement(ISettlement settlement) { return settlement.getBuildableBuildings(this).size() + 1; } }
c63dc51459df624920a6950e6652d5685a63a3d2
6474e6bde8542be192e9acf093ef3de46d287aca
/src/main/java/com/wanger/service/impl/UserServiceImpl.java
cfe4ce70ccf699305a835d3f3e6957d0d7e8414a
[]
no_license
renyan11/springboot-mybatis-druid
7a89d7b70afd109d58e245925c8e59d49f340368
c645c4ea3dc72234656f04c61406198985fb67ec
refs/heads/master
2020-12-03T03:38:49.197366
2017-06-29T10:50:33
2017-06-29T10:50:33
95,755,017
1
0
null
null
null
null
UTF-8
Java
false
false
1,153
java
package com.wanger.service.impl; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.wanger.dao.UserDao; import com.wanger.domain.UserEntity; import com.wanger.service.UserService; @Service public class UserServiceImpl implements UserService { @Autowired private UserDao userDao; @Override public UserEntity getUser(String userCode) { UserEntity user = userDao.selectByPrimaryKey(userCode); return user; } @Override public HashMap<String, Object> queryUser() { //分页处理,显示第一页的10条数据 PageHelper.startPage(1, 10); List<UserEntity> list = userDao.queryUser(null);//查询 // 取分页信息 PageInfo<UserEntity> pageInfo = new PageInfo<UserEntity>(list); long total = pageInfo.getTotal(); //获取总记录数 HashMap<String, Object> map = new HashMap<String, Object>(); map.put("list", list); map.put("total", total); return map; } }
778074edf7a80352a0cfc23036feea9eee4bcab2
968104d5adbb3d89aa53b1ec6fcf54ae03458bc8
/src/main/java/com/example/validationtutorial/ValidationTutorialApplication.java
4235347ed9998e249aef13fe64f8847f2ffd6ff7
[]
no_license
AndreeaNenciuCrasi/validation-test-tutorial
e55d776d4ee1a1eed37035abb3cfe952ce42c082
ab7941c608ee19042d43fa20d7f5db7b8da603d9
refs/heads/master
2023-04-21T14:26:37.069487
2021-04-27T12:55:01
2021-04-27T12:55:01
362,111,855
0
0
null
null
null
null
UTF-8
Java
false
false
880
java
package com.example.validationtutorial; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication public class ValidationTutorialApplication { public static void main(String[] args) { SpringApplication.run(ValidationTutorialApplication.class, args); } @Bean public CommandLineRunner run(UserRepository userRepository) throws Exception { return (String[] args) -> { User user1 = new User("Bob", "[email protected]"); User user2 = new User("Jenny", "[email protected]"); userRepository.save(user1); userRepository.save(user2); userRepository.findAll().forEach(System.out::println); }; } }
a99faec2a4417087ba6770be612541dafed7324d
ded949566b89fde685283f3e8c76863a75017d71
/src/carsLot/CarLotApp.java
75b8b5e552e68a100666ec72421a3551422d4acb
[]
no_license
EasyDanger/lab11-CarLot
a2743ed8308771226bc2a10cf8df9dbe23666975
fe121616abf2829f9daa5283ce61c2aa02ae48a7
refs/heads/master
2020-04-02T09:04:16.985059
2018-10-23T13:48:44
2018-10-23T13:48:44
154,274,356
0
0
null
null
null
null
UTF-8
Java
false
false
11,336
java
package carsLot; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.List; import java.util.Scanner; public class CarLotApp { // cars list is needed by the whole app. private static List<Car> cars = new ArrayList<>(); // finished is used for looping. static boolean finished = false; // A scanner! static Scanner read = new Scanner(System.in); public static void main(String[] args) { // these Cars very nearly got moved up unnecessarily to be static class // variables. I realized that i never actually had to call on any of these // variables by name, only from their index in the list. Thus, they could stay // where they were. Anyway, these give my list something to work with, so the // exercise doesn't have to start off populating the list every time we want to // test. UsedCar baja = new UsedCar("Subaru", "Baja", 2006, 5500, 26657.34); cars.add(baja); UsedCar vibe = new UsedCar("Pontiac", "Vibe", 2004, 4000.00, 100500.24); cars.add(vibe); UsedCar leBaron = new UsedCar("Chrysler", "LeBaron", 1991, 500.00, 298483.97); cars.add(leBaron); Car tesla = new Car("Tesla", "Model S", 2017, 65200.00); cars.add(tesla); Car f150 = new Car("Ford", "F-150", 2019, 28155.00); cars.add(f150); Car ghibli = new Car("Mazerati", "Ghibli", 2018, 74980.00); cars.add(ghibli); Car blank = new Car(); cars.add(blank); // initial greeting is outside the loop. System.out.println( "Welcome to the Danger Motors Employee Database Administrative Console Operations Application!"); // Do loop allows menu to loop. I considered a try catch here as well, however, // this is a small enough program that I think it's okay to only accept Strings. // I assume this would lead ot more resource consumption if it were a regular // thing in a different app, so I later switch to try catches and eventually // (from my timeline POV, not the order of the app) to using my validation // class. do { // It doesn't matter false is initialized, so long as it's before this loop // needs to check it. It's easier to understand at this location, though. finished = false; // menu options can be accessed by number or keyword. More practice using the // escape slash "\" with the quotes. System.out.println("\nSelect an option:\n"); System.out.println("1. List of Available Cars (\"list\")"); System.out.println("2. Add a Car (\"add\")"); System.out.println("3. Remove a Car (\"remove\")"); System.out.println("4. Look up a car by index humber (\"look\")"); System.out.println("5. Replace a car at a specific index number (\"replace\")"); System.out.println("6. List cars only of a specific make (\"make\")"); System.out.println("7. Exit this application (\"quit\")"); // there are a lot of specific options, so I'm allowed to use a switch again! String option = read.nextLine(); switch (option) { // cases take advantage of the break function to allow multiple controls to lead // to the same option. case "list": case "1": list(); break; case "add": case "2": System.out.println("\n\nIs the car you want to add new or used? {\"new\"/\"used\")"); option = read.nextLine(); switch (option) { case "new": addCar(cars.size()); break; case "used": addUsed(cars.size()); break; default: System.out.println("Sorry, that input wasn't valid. Back to the main menu."); break; } break; case "remove": case "3": // I figure the user needs to know what cars are available in order to drop one. // Maybe they remember, but why make it hard? list(); remove(); break; case "look": case "4": doSelect(); break; case "replace": case "5": // I'm quite proud of this. I started not to add the replace option below, // because it seemed to tedious. Then I realized I still had access to the // getInt function in the validator class, and that allows me to easily and // quickly verify integers between a certain range. Combined with the fact that // I can always functionally add items to the end of a list by serving the // list's size as the index argument for the add() method, and I could add three // words to my addCar/Used methods to allow them to accept Cars onto the list at // specific indices. It took longer to type this explanation than it took to do! list(); int place = (Vali.getInt(read, "Which number car do you want to replace?")) - 1; System.out.println("\n\nIs the car you want to add new or used? {\"new\"/\"used\")"); option = read.nextLine(); switch (option) { case "new": addCar(place); break; case "used": addUsed(place); break; default: System.out.println("Sorry, that input wasn't valid. Back to the main menu."); break; } break; // Our exit condition. case "quit": case "7": finished = true; break; case "6": case "make": System.out.println("Enter the make you want to search for:"); whatMake(read.nextLine()); break; default: System.out.println("Sorry, but that choice isn't valid."); break; } } while (!finished); System.out.println("Thanks for using the DMEDACOA. Goodbye."); } //Method to remove cars from cars. private static void remove() { // First time I used the getInt method. It must be minus one because of how // indices work. This version allows us to verify the range. int drop = (Vali.getInt(read, "Which car would you like to remove?\nEnter its number.", 0, cars.size())) - 1; // Allows user to verify their choice. I tried to give this option before every // change. System.out.println( "Are you sure you want to remove that " + cars.get(drop).getMake() + " from the list of cars?"); // I added my checkYes method to the Vali class. I hope to further develop it, // but it's helpful enough for now, even if it can only accept "y" and "yes". if (Vali.checkYes(read.nextLine())) { cars.remove(drop); } // I started putting this in places even if I didn't need to, for safety. This // finished is doing nothing, but I wanted to make sure in some places that my // menu loop would continue to loop. finished = false; } //Method to add used cars. private static void addUsed(int place) { // We need inputs to enter into the constructor. I could have probably used // ReGex here to allow them to put it all on one line. But that would be // unwieldy, I think. Also, tedious. System.out.println("Please enter the make of the car:"); String make = read.nextLine(); System.out.println("\nNow enter the model of the car:"); String model = read.nextLine(); System.out.println("\nNext, we need the year the car was made:"); int year = 0; // These aren't strings, and thus need more validation. It was after this sort // of verification in the addCar method that i realized I already had access to // a cheap int validator. This method is largely a copy of the addCar method, // but with mileage stuff added. Mileage and price validation were just copied // and adapted from the year validation. do { // Just making sure again. finished = false; try { year = read.nextInt(); read.nextLine(); if (year > 9999 || year < 1000) { throw new InputMismatchException(); } else { finished = true; } } catch (InputMismatchException ex) { System.out.println("Sorry, that's not a valid year. Please enter a 4 digit model year."); } } while (!finished); System.out.println("\nNow, put in the price of the car:"); double price = 0; do { finished = false; try { price = read.nextDouble(); read.nextLine(); finished = true; } catch (InputMismatchException ex) { System.out.println("Sorry, that's not a valid price. Please enter a number without a \"$\"."); read.nextLine(); } } while (!finished); System.out.println("Finally, enter the total mileage of the car:"); double miles = 0; do { finished = false; try { miles = read.nextDouble(); read.nextLine(); finished = true; } catch (InputMismatchException ex) { System.out.println("Sorry, that's not a valid number of miles. Please enter a number."); read.nextLine(); } } while (!finished); System.out.println("Are you sure you want to create a " + year + " " + make + " " + model + " for $" + price + " with " + miles + "? (y/n)"); if (Vali.checkYes(read.nextLine())) { cars.add(place, new UsedCar(make, model, year, price, miles)); } else { System.out.println("Do you still want to add another car? (y/n)"); if (Vali.checkYes(read.nextLine())) { addUsed(place); } } // this finished is actually useful, since this method does screw around with // this boolean and i need it false for the loop back in the main method. finished = false; } //Method to add car. Everything here is the same as in usedCar, minus mileage stuff. There is probably a better way to "extend" a method like that besides just copy/paste. private static void addCar(int place) { System.out.println("Please enter the make of the car:"); String make = read.nextLine(); System.out.println("\nNow enter the model of the car:"); String model = read.nextLine(); System.out.println("\nNext, we need the year the car was made:"); int year = 0; do { finished = false; try { year = read.nextInt(); read.nextLine(); if (year > 9999 || year < 1000) { throw new InputMismatchException(); } else { finished = true; } } catch (InputMismatchException ex) { System.out.println("Sorry, that's not a valid year. Please enter a 4 digit model year."); } } while (!finished); System.out.println("\nFinally, put in the price of the car:"); double price = 0; do { finished = false; try { price = read.nextDouble(); read.nextLine(); finished = true; } catch (InputMismatchException ex) { System.out.println("Sorry, that's not a valid price. Please enter a number without a \"$\"."); read.nextLine(); } } while (!finished); System.out.println( "Are you sure you want to create a " + year + " " + make + " " + model + " for $" + price + "? (y/n)"); if (Vali.checkYes(read.nextLine())) { cars.add(place, new Car(make, model, year, price)); } else { System.out.println("Do you still want to add a new car? (y/n)"); if (Vali.checkYes(read.nextLine())) { addCar(place); } } finished = false; } //Method to peek at a single car. private static void doSelect() { System.out.println("Pick a car."); int make = read.nextInt(); read.nextLine(); System.out.println(cars.get(make - 1)); } //Method to list cars. private static void list() { System.out.println("\nList of all available cars"); System.out.println("=========================="); int i = 0; for (Car car : cars) { i++; System.out.println(i + ". " + car); } } //Method to search by car make. private static void whatMake(String make) { System.out.println("\nList of all "+ make.toUpperCase() + " cars"); System.out.println("============================"); for (Car car: cars) { if (car.getMake().equalsIgnoreCase(make)) { System.out.println(car); } } } }
dc78e9ecc381edb65b43381a312658fa577c2a7e
2500392b8512552b144c805ad7930796b42fe25c
/src/main/java/graphql/execution/AbsoluteGraphQLError.java
0bce4fcf5c32f94547c8c1127f4c5c28c308bc52
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
reformasky/graphql-java
b84d9ae4e47a003c641d7c5a5f43fd3a501ef448
50f203c198e384ef07c8eb7bf557eca4d9e4926f
refs/heads/master
2021-04-26T16:42:50.489672
2018-03-04T05:31:33
2018-03-05T06:52:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,177
java
package graphql.execution; import graphql.ErrorType; import graphql.GraphQLError; import graphql.language.Field; import graphql.language.SourceLocation; import graphql.schema.DataFetcher; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import static graphql.Assert.assertNotNull; /** * A {@link GraphQLError} that has been changed from a {@link DataFetcher} relative error to an absolute one. */ class AbsoluteGraphQLError implements GraphQLError { private final List<SourceLocation> locations; private final List<Object> absolutePath; private final String message; private final ErrorType errorType; AbsoluteGraphQLError(ExecutionStrategyParameters executionStrategyParameters, GraphQLError relativeError) { assertNotNull(executionStrategyParameters); assertNotNull(relativeError); this.absolutePath = createAbsolutePath(executionStrategyParameters, relativeError); this.locations = createAbsoluteLocations(relativeError, executionStrategyParameters.field()); this.message = relativeError.getMessage(); this.errorType = relativeError.getErrorType(); } @Override public String getMessage() { return message; } @Override public List<SourceLocation> getLocations() { return locations; } @Override public ErrorType getErrorType() { return errorType; } @Override public List<Object> getPath() { return absolutePath; } private List<Object> createAbsolutePath(ExecutionStrategyParameters executionStrategyParameters, GraphQLError relativeError) { return Optional.ofNullable(relativeError.getPath()) .map(originalPath -> { List<Object> path = new ArrayList<>(); path.addAll(executionStrategyParameters.path().toList()); path.addAll(relativeError.getPath()); return path; }) .map(Collections::unmodifiableList) .orElse(null); } private List<SourceLocation> createAbsoluteLocations(GraphQLError relativeError, List<Field> fields) { Optional<SourceLocation> baseLocation; if (!fields.isEmpty()) { baseLocation = Optional.ofNullable(fields.get(0).getSourceLocation()); } else { baseLocation = Optional.empty(); } return Optional.ofNullable( relativeError.getLocations()) .map(locations -> locations.stream() .map(l -> baseLocation .map(base -> new SourceLocation( base.getLine() + l.getLine(), base.getColumn() + l.getColumn())) .orElse(null)) .collect(Collectors.toList())) .map(Collections::unmodifiableList) .orElse(null); } }
b041b676a2c47b403eb9e7d2429ea099c06099b9
28516c202a6e0eb7557f4abd987d27d45bb7a58d
/src/test/java/com/raylee/my_new_spring/my_new_spring/ch02/topic_1_20/ChiefTest.java
46a93822e5b1c7f260cc108a6484f704111a2e36
[]
no_license
lihm1028/my_new_spring
337349ad161f88d5b5f5bd61cb38872c86e78707
119afb6379ac3323dfac4c7f2bfd5d9fbf98e14e
refs/heads/master
2020-04-05T22:43:24.501038
2016-03-07T02:59:46
2016-03-07T02:59:46
95,567,352
1
0
null
2017-06-27T14:29:14
2017-06-27T14:29:14
null
UTF-8
Java
false
false
884
java
package com.raylee.my_new_spring.my_new_spring.ch02.topic_1_20; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/com/raylee/my_new_spring/my_new_spring/ch02/topic_1_20/ApplicationContext-test.xml" }) public class ChiefTest { @Autowired private ApplicationContext applicationContext; @Test public void testChief() { Chief jack = applicationContext.getBean(Chief.class); System.out.println(jack.getName()); Fighter mike = applicationContext.getBean(Fighter.class); System.out.println(mike.getName()); } }
dd0e4000e49c9ca7cd634760a556501b4d569a35
24e3962a3d9b13442be71c5723cfa6c3e2f483c0
/app/src/main/java/com/bw/movie/view/adapter/RecyclerViewUpComingAdapter.java
fc9d171eb14a79ea0809199ba3f85306a5abef56
[]
no_license
Liuyang79853/DimensionalityMovie
f7fe3c6336df1970a5704531e885097902d2727a
b8b37358a7e563e008014951889353677ade6580
refs/heads/master
2020-09-10T06:41:06.351381
2019-11-20T06:01:01
2019-11-20T06:01:01
221,675,139
0
0
null
null
null
null
UTF-8
Java
false
false
3,716
java
package com.bw.movie.view.adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.bw.movie.R; import com.bw.movie.model.bean.homepage.UpComingBean; import com.bw.movie.view.dateutils.DateUtils; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; /** * function:即将上映RecyclerView列表展示 */ public class RecyclerViewUpComingAdapter extends RecyclerView.Adapter { private Context context; private List<UpComingBean.ResultBean> datas = new ArrayList<>(); public RecyclerViewUpComingAdapter(Context context) { this.context = context; } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View inflate = LayoutInflater.from(context).inflate(R.layout.item_upcoming_recyclerview, null); MyViewHolder myViewHolder = new MyViewHolder(inflate); return myViewHolder; } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, final int i) { MyViewHolder myViewHolder = (MyViewHolder) viewHolder; myViewHolder.tv_name.setText(datas.get(i).getName()); String times = DateUtils.times(datas.get(i).getReleaseTime()); myViewHolder.tv_releaseTime.setText(times+"上映"); Glide.with(context).load(datas.get(i).getImageUrl()) .placeholder(R.mipmap.ic_launcher) .error(R.mipmap.ic_launcher) .into(myViewHolder.iv_imageUrl); myViewHolder.tv_wantSeeNum.setText(datas.get(i).getWantSeeNum()+"人想看"); myViewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.onItemClick(i); } }); myViewHolder.btn_appointment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.appointmentClick(datas.get(i).getMovieId()); } }); } @Override public int getItemCount() { return datas.size(); } public void addData(List<UpComingBean.ResultBean> upComingResult) { if (upComingResult.size()>0 && upComingResult != null){ datas.addAll(upComingResult); } notifyDataSetChanged(); } private OnItemClickListener mOnItemClickListener; public void onItemClickListener(OnItemClickListener onItemClickListener){ this.mOnItemClickListener = onItemClickListener; } public interface OnItemClickListener{ void onItemClick(int position); void appointmentClick(int movieId); } class MyViewHolder extends RecyclerView.ViewHolder { private final TextView tv_name; private final TextView tv_releaseTime; private final TextView tv_wantSeeNum; private final ImageView iv_imageUrl; private final Button btn_appointment; public MyViewHolder(@NonNull View itemView) { super(itemView); tv_name = itemView.findViewById(R.id.tv_name); tv_releaseTime = itemView.findViewById(R.id.tv_releaseTime); tv_wantSeeNum = itemView.findViewById(R.id.tv_wantSeeNum); iv_imageUrl = itemView.findViewById(R.id.iv_imageUrl); btn_appointment = itemView.findViewById(R.id.btn_appointment); } } }
e3c37f08bee96ec25ef45d8b8a99857eae47104b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/29/29_01a121b9c64921bffca64f07ac2896daabd34390/FNIRsStats/29_01a121b9c64921bffca64f07ac2896daabd34390_FNIRsStats_s.java
9232195688fcc965474b3d8bca0312ff7b5faa90
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
64,473
java
/****************************************************************************** * File: FNIRsStats.java * * Author: Nicholas Kolesar * * Hamilton College * * Fall 2013 * * Description: Mostly averages data sequences together. Averages * * element-wise among different sequences and among chunks of the same * * sequences, and calculates average values for all the values contained * * in chunks of the same sequence. Once these averages--grouping channels, * * averaging together all sequences of data for a particular condition * * within the average sequence for each particular channel group, and * * "chunking" the resulting average sequence--are complete, ANOVA p-values * * are calculated. This could be supplemented with other statistical * * analyses on the same chunked data sets later. * ******************************************************************************/ // SEE ABOUT CATCHING ANY UNFORESEEN INPUTMISMATCHEXCEPTIONS FROM THE // SCANNER READS LATER // the static keyword lets me instantiate GroupedChannels without having an // instance of HelloWorldNick first...Object Oriented is hard.... // MAKE A NOTE SOMEWHERE APPROPRIATE THAT WE CALL THE SEQUENCE OF DATA // FROM AN FNIRS CHANNEL A CHANNEL // CONVENTION FOR VALUES THAT SHOULD BE A SIZE_T = ????? // MAKE EXTRA SURE LATER ON THAT WE USE THE CORRECT LOCALE FOR ALL THE I/O package fNIRs; // (MAKE SURE WE INCLUDE THE PROPER LICENSES WITH OUR FINISHED PRODUCT) import org.apache.commons.math3.stat.inference.OneWayAnova; import java.util.Scanner; // to read doubles simply import java.util.Locale; // for Scanner (defines character encoding) import java.util.InputMismatchException; import java.util.ArrayList; // like C++ Vector and like Java Vector, which is // apparently deprecated import java.util.LinkedList; // like C++ Deque; implements List interface import java.util.TreeSet; // a sorted tree-based set implementation--for storing // the list of channels not in any group and the // list of channels which are in multiple groups import java.util.Collections; // for max(Collection) method import java.io.File; // included elsewhere in project? import java.io.FileReader; // for making the BufferedReader import java.io.FileNotFoundException; // in case creating a FileReader fails import java.io.BufferedReader; // for making the Scanner import java.io.FileWriter; import java.io.PrintWriter; //import java.io.IOException; //import java.util.Collection; // for sillily general Group constructor import java.util.List; // for generalized findNextOccurrence method public class FNIRsStats { private static void localError(String errMsg){ System.out.println("Error: " + errMsg); //System.exit(1); // PROBABLY DON'T WANT THIS IN FINAL PROGRAM-- // HANDLE THE EXCEPTION SOME OTHER WAY< } /* makeScanner * IN: a File object * Throws a FileNotFoundException if the file does not exist. * OUT: a Scanner for the input File */ private static Scanner makeScanner(File file) { FileReader reader; try { // the file may or may not exist at this point reader = new FileReader(file); } catch (FileNotFoundException fnf_exception) { // WE WILL PROBABLY WANT TO INTEGRATE THIS INTO THE GUI // Print the name of the missing file: localError(fnf_exception.getMessage()); return null; // never executed } // create Scanner to read easily from the input files: Scanner s = new Scanner(new BufferedReader(reader)); s.useLocale(Locale.US); // tell the scanner that numbers in the input // are formatted with decimal points, not // commas, etc. return s; } private static PrintWriter makePWriter(File file){ // SOMETHING ABOUT LOCALES?? FileWriter w = null; try { w = new FileWriter(file); } catch (Exception ex) { localError(ex.getMessage()); } PrintWriter p = new PrintWriter(w, true); // set autoflush to true return p; } public static void printList(List<?> lst){ System.out.println("Index\t Value"); for (int i = 0; i < lst.size(); i++) { System.out.println(i + "\t " + lst.get(i)); } } /* processAllSubjectData * IN: dataFiles, a nonempty List of data files to process together for * statistical analysis * groupFile, a group file that applies to all the files in dataFiles * Creates a GroupedChannels object containing, for each channel grouping * specified in the group file, the average sequence produced by * averaging all subjects' data for the specified channels. * OUT: the GroupedChannels object thus created */ public static GroupedChannels processAllSubjectData(List<File> dataFiles, File groupFile) { // initialize output data with the data from the first data file and the // appropriate channel grouping information: GroupedChannels output = new GroupedChannels(dataFiles.get(0), groupFile); // iterate through the remaining subjects' data files: for (File dataFile : dataFiles.subList(1, dataFiles.size())) { GroupedChannels subjectData = new GroupedChannels(dataFile, groupFile); output.combineGroups(subjectData); } return output; } // COULD OPTIMIZE BY HARDCODING THE REFLEXIVE ANOVAs // this should chunk the data, too public static void writeANOVAs(File outFile, GroupedChannels data, List<String> groupNames, List<Integer> conditions, int numChunks, int precision) { // open file for writing with a nice print stream object: PrintWriter ostream = makePWriter(outFile); // OKAY VAR NAME? // get all condition-group sequences: ArrayList<GroupedChannels.TaggedDataSequence> allTDSs = data.getAllSelectedTDSs(groupNames, conditions); //chunkData(allTDSs, numChunks); // COMMENT THIS LATER int idFieldWidth = getIdFieldWidth(groupNames, conditions, precision); String idFieldFormat = "%-" + idFieldWidth + "s"; // format string String separator = " , "; // what goes between columns of output // output the first row, containing identifying information for each // group-condition combination: // first, output spaces to take the place of the identifier column: ostream.printf("%" + idFieldWidth + "s" + separator, ""); // TOO HACKY?? // then, output all tds identifiers: for (GroupedChannels.TaggedDataSequence tds : allTDSs) { ostream.printf(idFieldFormat + separator, tds.getGroupName() + " c" + tds.getCondition()); } ostream.println(); // print newline // output ANOVA values line by line: OneWayAnova myANOVA = new OneWayAnova(); // this object will do the // ANOVAs for (GroupedChannels.TaggedDataSequence first : allTDSs) { // output tds identifier in first column: ostream.printf(idFieldFormat + separator, first.getGroupName() + " c" + first.getCondition()); // create Collection to send to the ANOVA object: LinkedList<double[]> dataSets = new LinkedList<double[]>(); // convert first's data sequence to an array, then add it to // dataSets dataSets.add(toPrimitiveDoubleArray(first.getData())); dataSets.add(null); // placeholder for second's data sequence for (GroupedChannels.TaggedDataSequence second : allTDSs) { // convert and add second's data sequence to position one in // dataSets: dataSets.set(1, toPrimitiveDoubleArray(second.getData())); double result = 0; try { result = myANOVA.anovaPValue(dataSets); // if (first == second) { // if the two TDSs are the same TDS, // result = 1; // then the ANOVA value should be 1, even // though a divide-by-zero // } } catch (Exception ex) { ostream.println(); localError(ex.getMessage()); } if (result != result) { // if result is NaN System.out.println("NaN on " + first.getGroupName() + " c" + first.getCondition() + " and " + second.getGroupName() + " c" + second.getCondition()); } // AGAIN, SEE IF "PRECISON" == "NUMBER OF DECIMAL PLACES" ostream.printf("%-"+idFieldWidth+"."+precision+"f"+separator, result); } ostream.println(); // print newline } ostream.close(); } private static int getIdFieldWidth(List<String> groupNames, List<Integer> conditions, int precision) { // calculate required widths for printed names and condition numbers: int nameWidth = longestLength(groupNames); // length of longest name int conditionWidth = // number of digits in the largest condition number String.valueOf(Collections.max(conditions)).length(); // make sure the fields will be wide enough to hold the ANOVA values, // which will consist of a 0 or 1 followed by a . and precision 0s: // AM I USING "PRECISION" RIGHT? int result = nameWidth + 2 + conditionWidth; // 2 == " c".length() if (result < precision + 2) { // 2 == "1.".length() // if not, increase the condition width so the total field width is // large enough: //System.out.println("ANOVA values are wider than identifiers."); result = precision + 2; } return result; } public static void outputANOVAs(GroupedChannels data, List<String> groupNames, List<Integer> conditions, int numChunks, int precision) { // get all condition-group sequences: ArrayList<GroupedChannels.TaggedDataSequence> allTDSs = data.getAllSelectedTDSs(groupNames, conditions); chunkData(allTDSs, numChunks); // COMMENT THIS LATER int idFieldWidth = getIdFieldWidth(groupNames, conditions, precision); // create a format string for the group/condition combination identifier // fields in the output: String idFieldFormat = "%-" + idFieldWidth + "s"; // format string String separator = " , "; // what goes between columns of output // output the first row, containing identifying information for each // group-condition combination: // first, output proper-width placeholder for the identifier column: System.out.printf("%" + idFieldWidth + "s" + separator, ""); // TOO HACKY?? // then, output all tds identifiers: for (GroupedChannels.TaggedDataSequence tds : allTDSs) { System.out.printf(idFieldFormat + separator, tds.getGroupName() + " c" + tds.getCondition()); // System.out.printf(idFieldFormat + " ", // tds.getGroupName(), // tds.getCondition()); } System.out.println(); // print newline // output ANOVA values line by line: OneWayAnova myANOVA = new OneWayAnova(); for (GroupedChannels.TaggedDataSequence first : allTDSs) { // output tds identifier in first column: System.out.printf(idFieldFormat + separator, first.getGroupName() + " c" + first.getCondition()); // create Collection to send to the ANOVA object: LinkedList<double[]> dataSets = new LinkedList<double[]>(); // convert first's data sequence to an array, then add it to // dataSets dataSets.add(toPrimitiveDoubleArray(first.getData())); dataSets.add(null); // placeholder for second's data sequence for (GroupedChannels.TaggedDataSequence second : allTDSs) { // convert and add second's data sequence to position one in // dataSets: //dataSets.add(second.getData().toArray()); dataSets.set(1, toPrimitiveDoubleArray(second.getData())); double result = 0; try { result = myANOVA.anovaPValue(dataSets); } catch (Exception ex) { System.out.println(); localError(ex.getMessage()); } System.out.printf("%-" + idFieldWidth + "." + precision + "f" + separator, result); //dataSets.remove(1); // remove second's data from dataSets } System.out.println(); // print newline } } public static void oldWriteANOVAs(File outFile, GroupedChannels data, List<String> groupNames, List<Integer> conditions, int numChunks, int precision) { // open file for writing with a nice print stream object: PrintWriter ostream = makePWriter(outFile); // OKAY VAR NAME? // get all condition-group sequences: ArrayList<GroupedChannels.TaggedDataSequence> allTDSs = data.getAllSelectedTDSs(groupNames, conditions); //chunkData(allTDSs, numChunks); // COMMENT THIS LATER // calculate required widths for printed names and condition numbers: int nameWidth = longestLength(groupNames); // length of longest name int conditionWidth = // number of digits in the largest condition number String.valueOf(Collections.max(conditions)).length(); // make sure the fields will be wide enough to hold the ANOVA values, // which will consist of a 0 or 1 followed by a . and precision 0s: int idFieldWidth = nameWidth + 2 + conditionWidth; // 2 == " c".length() if (idFieldWidth < precision + 2) { // 2 == "1.".length() // if not, increase the condition width so the total field width is // large enough: //System.out.println("ANOVA values are wider than identifiers."); idFieldWidth = precision + 2; } String idFieldFormat = "%-" + idFieldWidth + "s"; // format string // output the first row, containing identifying information for each // group-condition combination: // first, output proper-width placeholder for the identifier column: ostream.printf("%" + idFieldWidth + "s ", ""); // TOO HACKY?? // then, output all tds identifiers: for (GroupedChannels.TaggedDataSequence tds : allTDSs) { ostream.printf(idFieldFormat + " ", tds.getGroupName() + " c" + tds.getCondition()); // ostream.printf(idFieldFormat + " ", // tds.getGroupName(), // tds.getCondition()); } ostream.println(); // print newline // output ANOVA values line by line: OneWayAnova myANOVA = new OneWayAnova(); for (GroupedChannels.TaggedDataSequence first : allTDSs) { // output tds identifier in first column: ostream.printf(idFieldFormat + " ", first.getGroupName() + " c" + first.getCondition()); // create Collection to send to the ANOVA object: LinkedList<double[]> dataSets = new LinkedList<double[]>(); // convert first's data sequence to an array, then add it to // dataSets dataSets.add(toPrimitiveDoubleArray(first.getData())); dataSets.add(null); // placeholder for second's data sequence for (GroupedChannels.TaggedDataSequence second : allTDSs) { // convert and add second's data sequence to position one in // dataSets: dataSets.set(1,toPrimitiveDoubleArray(second.getData())); double result = 0; try { result = myANOVA.anovaPValue(dataSets); // if (first == second) { // if the two TDSs are the same TDS, // result = 1; // then the ANOVA value should be 1, even // though a divide-by-zero // } } catch (Exception ex) { ostream.println(); localError(ex.getMessage()); } if (result != result) { // if result is NaN System.out.println("NaN on " + first.getGroupName() + " c" + first.getCondition() + " and " + second.getGroupName() + " c" + second.getCondition()); } ostream.printf("%-" + idFieldWidth + "." + precision + "f ", result); } ostream.println(); // print newline } ostream.close(); } // this should chunk the data, too public static void oldOutputANOVAs(GroupedChannels data, List<String> groupNames, List<Integer> conditions, int numChunks, int precision) { // get all condition-group sequences: ArrayList<GroupedChannels.TaggedDataSequence> allTDSs = data.getAllSelectedTDSs(groupNames, conditions); chunkData(allTDSs, numChunks); // COMMENT THIS LATER // calculate required widths for printed names and condition numbers: int nameWidth = longestLength(groupNames); // length of longest name int conditionWidth = // number of digits in the largest condition number String.valueOf(Collections.max(conditions)).length(); // make sure the fields will be wide enough to hold the ANOVA values, // which will, in the widest case, consist of a 1 followed by a . and // precision 0s: // AM I USING "PRECISION" RIGHT? int idFieldWidth = nameWidth + conditionWidth + 2; if (idFieldWidth < precision + 2) { // for the "1." // if not, increase the condition width so the total field width is // large enough: idFieldWidth = precision + 2; } String idFieldFormat = "%-" + idFieldWidth + "s"; // output the first row, containing identifying information for each // group-condition combination: // first, output proper-width placeholder for the identifier column: System.out.printf("%" + idFieldWidth + "s ", ""); // TOO HACKY?? // then, output all tds identifiers: for (GroupedChannels.TaggedDataSequence tds : allTDSs) { System.out.printf(idFieldFormat + " ", tds.getGroupName() + " c" + tds.getCondition()); } System.out.println(); // print newline // output ANOVA values line by line: OneWayAnova myANOVA = new OneWayAnova(); for (GroupedChannels.TaggedDataSequence first : allTDSs) { // output tds identifier in first column: System.out.printf(idFieldFormat + " ", first.getGroupName() + " c" + first.getCondition()); // create Collection to send to the ANOVA object: LinkedList<double[]> dataSets = new LinkedList<double[]>(); // convert first's data sequence to an array, then add it to // dataSets dataSets.add(toPrimitiveDoubleArray(first.getData())); dataSets.add(null); // placeholder for second's data sequence for (GroupedChannels.TaggedDataSequence second : allTDSs) { // convert and add second's data sequence to position one in // dataSets: dataSets.set(1, toPrimitiveDoubleArray(second.getData()) ); double result = 0; try { result = myANOVA.anovaPValue(dataSets); } catch (Exception ex) { System.out.println(); localError(ex.getMessage()); } System.out.printf("%-" + idFieldWidth + "." + precision + "f ", result); //dataSets.remove(1); // remove second's data from dataSets } System.out.println(); // print newline } } public static void chunkData(List<GroupedChannels.TaggedDataSequence> data, int numChunks) { for (GroupedChannels.TaggedDataSequence tds : data) { averageChunks(tds.getData(), numChunks); } } // public static void // chunkData(List<List<GroupedChannels.TaggedDataSequence>> data, // int numChunks) { // for (List<GroupedChannels.TaggedDataSequence> lst : data) { // //for (List<GroupedChannels.TaggedDataSequence> inner : outer) { // for (GroupedChannels.TaggedDataSequence tds : lst) { // averageChunks(tds.getData(), numChunks); // } // //} // } // } /* longestLength * IN: lst, a List of Strings * OUT: returns the length of the longest string in lst */ private static int longestLength(List<String> lst) { int longest = 0; for (String s : lst) { if (s.length() > longest) { longest = s.length(); } } return longest; } /* combineArrayLists * IN: lst_of_lsts, an List of Lists * OUT: returns a list containing all the elements in lst_of_lsts's sublists */ private static <T> ArrayList<T> combineArrayLists(ArrayList<ArrayList<T>> lst_of_lsts) { ArrayList<T> output = new ArrayList<T>(); for (ArrayList<T> lst : lst_of_lsts) { output.addAll(lst); } return output; } /* combineLists * IN: lst_of_lsts, a List of Lists * OUT: returns a list containing all the elements in lst_of_lsts's sublists */ private static double[] toPrimitiveDoubleArray(ArrayList<Double> lst){ double[] result = new double[lst.size()]; for (int i = 0; i < lst.size(); i++) { result[i] = lst.get(i); } return result; } // CALL THIS "BLOCK AVERAGE" OR SOMETHING? public static ArrayList<Double> averageChunks(List<Double> ary, int numChunks){ ArrayList<Double> result = new ArrayList<Double>(); double chunkSize = ((double) ary.size()) / (double) numChunks; int start = 0; // index of start of current chunk double bound = 0; // decimal value of upper bound for current chunk while(start < ary.size()){ // REDUNDANT?? bound += chunkSize; // get upper bound for next chunk double sum = 0; // to store sum of values in the chunk double numValues = 0; // number of values in the chunk (to divide by // to get the average value for the chunk) for (int i = start; i < bound && i < ary.size(); i++){ sum += ary.get(i); numValues++; } result.add(sum / numValues); start += numValues; } return result; } /* GroupedChannels class * This class is a container for all the data read from an Hb or HbO file, * organized within channel groupings represented by Group objects. */ public static class GroupedChannels { // BETTER NAME PROBABLY /* GroupedChannels * IN: groupFile, a File specifying channel groupings for statistical * analysis. Format is a string to name the grouping, then * natural numbers identifying the channels in that group, * terminated by the next grouping's name or EOF. * dataFile, a File containing whitespace-delimited columns of * preprocessed Hb or HbO values, which correspond to channels * from the fNIRs device. The last column must contain an * integer condition number for each (newline-delimited) row. * This constructor creates all the necessary Groups to read from an Hb * or HbO file and checks to see if any channels are specified to be * in multiple groups or not specified to be in a group. */ public GroupedChannels (File data, File groups) { NumChannels = calcNumChannels(data); // find and store the number of // channels in the Hb/HbO // file GroupList = new ArrayList<Group>(); // initialize the list of Groups Conditions = new ArrayList<Integer>(); // initialize the list of // conditions DuplicatedChannels = new TreeSet<Integer>(); // initialize set of // channels in // multiple groups MissingChannels = new TreeSet<Integer>(); // initialize set of // channels in no group makeGroups(groups); // create a Group for each name and set of // channels in the group file readData(data); // read the data file and store its values as // channel grouping average sequences in the // groups just created } /* calcNumChannels() * IN: dataFile, a File containing whitespace-delimited columns of * preprocessed Hb or HbO values, which correspond to channels * from the fNIRs device. The last column must contain an * integer condition number for each (newline-delimited) row. * OUT: numChannels, the number of channels the Hb or HbO input file * has (not counting the extra condition column) */ private int calcNumChannels(File dataFile) { Scanner s = makeScanner(dataFile); // read one line from the file, then remove leading and trailing // whitespace: String line = s.nextLine().trim(); // produce an array by splitting line on whitespace characters: String[] columnValues = line.split("\\s+"); // regular expression // the number of channels is the number of columns in the input file // minus one, because the last column in each row contains the // condition number for the row: return columnValues.length - 1; } /* makeGroups * IN: groupFile, A file specifying channel groupings for statistical * analysis. Format is a string to name the grouping, then * natural numbers identifying the channels in that group, * terminated by the next grouping's name or EOF. * Checks to see if any channels are specified to be in multiple groups * or not specified to be in any group. */ private void makeGroups(File groupFile){ Scanner s = makeScanner(groupFile); String groupName; ArrayList<Integer> channels = new ArrayList<Integer>(); while(s.hasNext()) { // checks to see there is a token in the input groupName = s.next(); // next() gets the next token while (s.hasNextInt()) { channels.add(s.nextInt()); } GroupList.add(new Group(groupName, channels)); channels.clear(); // empty list for next iteration } s.close(); // scanner must be closed to signal it's okay to // close its underlying stream checkForMissingChannels(); } private void checkForMissingChannels(){ for (int chan = 1; chan <= NumChannels; chan++) { int found = 0; // number of the Groups that contain the channel for (Group g : GroupList) { if (g.hasChannel(chan)){ found++; } } switch (found) { case 0: // channel is missing from all groups MissingChannels.add(chan); break; case 1: // all is well break; default: DuplicatedChannels.add(chan); break; } } // output errors if the program is running with a console: if (!DuplicatedChannels.isEmpty()) { // THIS IS STATISTICALLY PRETTY BAD UNLESS THEY'RE NOT COMPARING // THOSE TWO GROUPS...WHICH IS TOTALLY POSSIBLE, I GUESS. // MAYBE THIS IS BEYOND THE SCOPE OF OUR PROJECT TO CHECK? localError(getDuplicatedChannelsMsg()); } if (!MissingChannels.isEmpty()) { localError(getMissingChannelsMsg()); } } TreeSet<Integer> getMissingChannels() { return MissingChannels; } TreeSet<Integer> getDuplicatedChannels() { return DuplicatedChannels; } String getMissingChannelsMsg() { if (MissingChannels.isEmpty()) { return null; } String msg = null; if (MissingChannels.size() == 1) { msg = "Channel " + MissingChannels.first() + " is"; } else { msg = "Channels "; for (Integer i : MissingChannels) { if (i == MissingChannels.last()) { msg += ", and "; } else if (i != MissingChannels.first()) { msg += ", "; } msg += i; } msg += " are"; } msg += " not in any group."; return msg; } String getDuplicatedChannelsMsg() { if (DuplicatedChannels.isEmpty()) { return null; } String msg = null; if (DuplicatedChannels.size() == 1) { msg = "Channel " + DuplicatedChannels.first() + " is"; } else { msg = "Channels "; for (Integer i : DuplicatedChannels) { if (i == DuplicatedChannels.last()) { msg += ", and "; } else if (i != DuplicatedChannels.first()) { msg += ", "; } msg += i; } msg += " are"; } msg += " in multiple groups!"; return msg; } /* readData * IN: dataFile, a preprocessed Hb or HbO file * Reads all the data from the file, averaging channels' values together * to produce group average value(s) for each row, which are stored * along with the condition that row was part of. */ private void readData(File dataFile) { Scanner s = makeScanner(dataFile); try { // in case the input doesn't match the specification while(s.hasNextDouble()){ //while there is another row of values Double[] values = new Double[NumChannels]; for (int channel = 0; channel < NumChannels; channel++){ values[channel] = s.nextDouble(); // read all data } int condition = s.nextInt(); // read condition for this row if (!Conditions.contains(condition)) Conditions.add(condition); // store condition number for (int channel = 1; channel <= NumChannels; channel++){ for (Group g : GroupList){ if (g.hasChannel(channel)){ g.addValue(values[channel-1], condition); } } } } } catch (InputMismatchException e) { localError(e.getMessage()); } catch (Exception e){ localError(e.getMessage()); } finally { s.close(); // scanner must be closed to signal it's okay to // close its underlying stream } } // public void outputData(GroupedChannels data, // List<String> groups, // List<Integer> conditions) { // // retrieve data for the specified groups and conditions: // ArrayList<ArrayList<GroupedChannels.TaggedDataSequence>> data = // getData(groups, conditions); // } /* combineGroups * IN: other, a GroupedChannels object whose data should be merged into * this object's channel grouping average sequences * OUT: The groups in this object which have the same set of channels as * a group in other have data sequences which are the length of * the shorter of the two original sequences. They contain the * averages of all the channels in both groupings as if they * were averaged together into the same sequence instead of * being put into separate Groups. */ public void combineGroups(GroupedChannels other){ if (other == this) localError("?????"); // MAYBE FIX THIS OR SOMETHING for (Group g : other.getGroups()) { // add g's data to the average sequence in the group that // matches g in this object: combineGroups(g); } } /* combineGroups * IN: other, another Group whose data should be merged into the * average sequence of the appropriate Group in this collection * of channel groupings * OUT: The group in this class with the same set of channels as other * has a data sequence the length of the shorter two original * sequences. It contains the average of all the channels in * both groupings as if they were averaged together into the * same sequence instead of being put into separate Groups. */ // broken :( // only works for combining two groups! public void combineGroups(Group other){ // Make sure we have a group with the same channels as the // specified one: Group ours = getGroup(other.getChannels()); // (MAKE THIS ERROR BETTER) if (ours == null) localError("No other group contains those channels."); // See which group has a shorter data sequence: int combinedSize; if (other.getData().size() > ours.getData().size()) combinedSize = ours.getData().size(); else { // our group's average sequence is too long combinedSize = other.getData().size(); removeAfter(ours.getData(), combinedSize); // BAD??? } for (int i = 0; i < combinedSize; i++){ double ourSum = ours.getData().get(i) * ours.getNumChannels() * ours.NumSubjects; double otherSum = other.getData().get(i) * other.getNumChannels(); //double totalNumChannels = ours.getNumChannels() + other.getNumChannels(); //Double combinedAverage = (ourSum + otherSum) / totalNumChannels / (ours.NumSubjects + 1); Double combinedAverage = (ourSum + otherSum) / (ours.NumSubjects + 1); ours.getData().set(i, combinedAverage); } ours.NumSubjects++; // since we've just added another subject's data // to this group's } /* removeAfter * IN: ary, a List to remove elements from * startIndex, an index at which to start removing elements * from the array * OUT: ary contains all its old elements up to (startIndex - 1) */ private void removeAfter(List<?> ary, int startIndex){ ary.subList(startIndex, ary.size()).clear(); } /* getAllTDSs * IN: none * OUT: returns an ArrayList containing all TaggedDataSequences * specified by a condition-group combination contained by the * object */ public ArrayList<TaggedDataSequence> getAllTDSs() { ArrayList<String> groupNames = getGroupNames(); ArrayList<Integer> conditions = getConditions(); return combineArrayLists(selectData(groupNames, conditions)); } /* getAllSelectedTDSs * IN: groups, a list of group names (strings) * conditions, a list of condition identifiers (ints) * OUT: returns an ArrayList containing all TaggedDataSequences * specified by a condition-group combination from the two input * lists. */ public ArrayList<GroupedChannels.TaggedDataSequence> getAllSelectedTDSs(List<String> groupNames, List<Integer> conditions) { return combineArrayLists(selectData(groupNames, conditions)); } /* selectData * IN: groupNames, a list of group names (strings) * conditions, a list of condition identifiers (ints) * OUT: returns an ArrayList of ArrayLists of TaggedDataSequences. This * collection of tagged data sequences contains every data * sequence specified by a condition-group combination from the * two input lists. * Note: Each value for the first dimension of the 2D list returned * corresponds to a group, and each value for the second dimension of * the list corresponds to a condition. Each TaggedDataSequence also * contains the name of the group and the number of the condition * that produced it. */ // THIS WILL ALLOW US TO HAVE CHECK BOXES FOR THE GROUPS AND CONDITIONS, // WHICH IS SUPER NEAT IF IT'S ACTUALLY USEFUL--ASK LEANNE! public ArrayList<ArrayList<TaggedDataSequence>> selectData(List<String> groupNames, List<Integer> conditions){ // AT CERTAIN POINTS, IT SEEMS LIKE I SHOULD BE USING A LINKED, // RATHER THAN ARRAY-BASED, STRUCTURE? // Initialize two-dimensional array of tagged sequences: ArrayList<ArrayList<TaggedDataSequence>> result = new ArrayList<ArrayList<TaggedDataSequence>>(); // Iterate through selected groups: for (String groupName : groupNames) { Group group = getGroup(groupName); // Declare the new one-dimensional array of tagged // sequences: ArrayList<TaggedDataSequence> temp = new ArrayList<TaggedDataSequence>(); // Iterate through conditions: for (Integer condition : conditions) { // get the data from the group for the given condition, // adding it to the temporary 1D result list temp.add(new TaggedDataSequence(group, condition, group.getData(condition ))); } // put list of results for this group in the result 2D list result.add(temp); } return result; } class TaggedDataSequence{ TaggedDataSequence(Group sourceGroup, int condition, ArrayList<Double> data){ SourceGroup = sourceGroup; Condition = condition; Data = data; } public String getGroupName(){ return SourceGroup.getName(); } public ArrayList<Double> getData(){ return Data; } public int getCondition(){ return Condition; } public void print(){ System.out.println("Data from group \"" + getGroupName() + "\" under condition " + getCondition() + ":" ); System.out.println("\t Row Value "); for (int i = 0; i < Data.size(); i++) System.out.println("\t " + i + "\t " + Data.get(i)); } private ArrayList<Double> Data; private Group SourceGroup; private int Condition; } /* getGroupNames * IN: none * OUT: returns an ArrayList containing the names of all the channel * groupings. */ public ArrayList<String> getGroupNames() { ArrayList<String> groupNames = new ArrayList<String>(); for (Group g : GroupList) { groupNames.add(g.getName()); } return groupNames; } /* getGroupNames * IN: none * OUT: returns an ArrayList containing the names of all the channel * groupings. */ public ArrayList<Integer> getConditions() { return new ArrayList<Integer> (Conditions); } /* getGroup * IN: channels, a List of channels the group should be assigned * OUT: returns a reference to group whose set of assigned channels is * channels */ public Group getGroup(List<Integer> channels){ for (Group g : GroupList) if (g.sameChannels(channels)) return g; return null; } /* getGroup * IN: groupNum, the number of a group, starting from 1, in the order * the groups were specified * OUT: a reference to the specified group */ public Group getGroup(int groupNum){ if (1 <= groupNum && groupNum <= GroupList.size()) return GroupList.get(groupNum - 1); else { localError("Group number " + groupNum + " not found"); return null; // never executed } } /* getGroup * IN: name, the name of a channel grouping * OUT: a reference to the specified group */ public Group getGroup(String name){ for (Group g : GroupList) { if (name.equals(g.getName())){ return g; } } localError("Group \"" + name + "\" not found"); return null; // never executed } public void print(){ System.out.println("Groups:"); for (Group g : GroupList) { System.out.print("\t"); g.printChannels(); System.out.print("\t"); g.printData(); g.printConditions(); if (g != GroupList.get(GroupList.size()-1)) System.out.println("\t-----------------------------------"); } } public ArrayList<Group> getGroups() { return new ArrayList<Group>(GroupList); } public void print(String groupName){ getGroup(groupName).print(); } public void printChannels(){ System.out.println("Groups:"); for (Group g : GroupList) { System.out.print("\t"); g.printChannels(); } } private class Group { public Group(String name, ArrayList<Integer> channels){ Name = name; DataSequence = new ArrayList<Double>(); Condition = new ArrayList<Integer>(); Channels = new ArrayList<Integer>(channels); // copy channels // into Channels NumChannels = channels.size(); Sum = 0; // for addValue NumVals = 0; // for addValue NumSubjects = 1; // for combineGroups } /* addValue * IN: value, an Hb/HbO value to be added to the Group's sequence * of averages * condition, the experimental condition associated with the * value * Adds the value to the running sum for the current row, and, if * enough values have been added to account for all the channels * in the group, then they are averaged and the average value is * added to the sequence. * OUT: If an average value was calculated, Sum is 0. Else it now * contains value. * If an average value was calcluated, NumVals is 0. Else it is * increased by 1 to account for the new value. * Condition's value for the current row is set to condition. * Note: Sum is initialized to 0 in the constructor. */ public void addValue(double value, int condition){ // BETTER NAME? assert(NumVals < NumChannels); if (NumVals == 0) // if this is the first value for the current Condition.add(condition); // row, then set row's condition // number Sum += value; // add this value to the total NumVals++; // increase the count of values in the sum // if we now have enough data to add another average value... if(NumVals == NumChannels) { // ...to the time series, // then average & add it: DataSequence.add(Sum / ((double) NumChannels)); Sum = 0; // reset Sum... NumVals = 0; // ...and the number of values in it } } public void print(){ System.out.print("Group \"" + getName() + "\" has channels: \t"); printChannels(); System.out.println("\tData: \tRow \tValue Condition"); for (int i = 0; i < DataSequence.size(); i++) System.out.println("\t\t " + i + "\t " + DataSequence.get(i) + "\t " + Condition.get(i)); } /* printChannels * IN: none * OUT: prints the name of the group and its channels, which are * tabbed in so that groups' channels can easily be compared * when printed on separate lines */ public void printChannels(){ for (int i = 0; i < this.getNumChannels(); i++){ System.out.print(Channels.get(i)); if (i < this.getNumChannels() - 1) System.out.print(" "); } System.out.println(); } /* printData * IN: none * OUT: prints the name of the group followed by its entire data * sequence, which begins tabbed in so that, for small test * data sequences, groups' data sequences can easily be * compared when printed on separate lines */ public void printData(){ for (Double i : DataSequence){ System.out.print(i + " "); } System.out.println(); } /* printConditions * IN: none * OUT: prints the name of the group followed by its condition * sequence, which is preceded by a tab character so it * lines up with that of another group printed on a * separate line */ public void printConditions(){ for (int c : Condition){ System.out.print(c + " "); } System.out.println(); System.out.print("\t\t\t\t\t"); System.out.print("\n"); } public String getName() { return Name; } public int getNumChannels() { return NumChannels; } /* sameChannels * IN: other, a reference to a Group * OUT: returns true iff other and this group have the same * channels assigned to them */ public Boolean sameChannels(Group other){ ArrayList<Integer> othersChannels = other.getChannels(); // see if other's channels are a subset of ours for (Integer chan : othersChannels){ if (!Channels.contains(chan)) return false; } // see if our channels are a subset of other's for (Integer chan : Channels){ if (!othersChannels.contains(chan)) return false; } // if both are subsets of each other, then they are equal return true; } /* sameChannels * IN: channels, a list of channels (Integers) * OUT: returns true iff the set of channels assigned to this group * is channels */ public Boolean sameChannels(List<Integer> channels){ // see if channels is a subset of our set of channels: for (Integer chan : channels){ if (!Channels.contains(chan)) return false; } // see if our set of channels is a subset of channels: for (Integer chan : Channels){ if (!channels.contains(chan)) return false; } // if both are subsets of each other, then they are equal return true; } /* getChannels * IN: none * OUT: returns an ArrayList of channels contained in the Group */ public ArrayList<Integer> getChannels(){ return new ArrayList<Integer>(Channels); // deep copy } /* hasChannel * IN: channel, an integer specifying an fNIRs device channel in * the input file (actually, could be any int) * OUT: returns true iff the channel is in this channel grouping */ public boolean hasChannel(int channel){ return Channels.contains(channel); } /* getData * IN: none * OUT: returns this group's data sequence */ public ArrayList<Double> getData(){ return DataSequence; } /* getData * IN: condition, the number of the condition whose trials are to * be averaged * OUT: returns an ArrayList containing the average of the first * rows of all occurrences of condition in the input, the * average of the second rows, etc., with the resulting * ArrayList only as long as the shortest occurrence. That * is, it returns a data sequence that is the average of all * the times the experimental condition occurred in the * input sequence. * returns an empty ArrayList if there were no occurrences of * the condition in the original input Hb or HbO file */ public ArrayList<Double> getData(int condition) { ArrayList<Double> avgSequence = new ArrayList<Double>(); int numOccurrences = 0; // number of separate times we've found // the condition in the data sequence // (for calculating the averages) int i = 0; while (true){ // length of current occurrence of condition: int numRowsFound = 0; // find the starting index of the next occurrence of // condition in the sequence: i = myFindNextOccurrence(i, condition); if (i == -1) { // -1 returned if not found // If we found at least one occurrence of the // condition: if (!avgSequence.isEmpty()) // To average, divide the sum in each row by the // number of occurrences of the condition // that have been found: for (int j = 0; j < avgSequence.size(); j++) avgSequence.set(j,(avgSequence.get(j) / (double) numOccurrences)); // return (possibly empty) avgSequence: return avgSequence; } do { // If this is the first occurrence of the condition, if (numOccurrences == 0) { // add each row of this occurrence of the condition // to the average by simply copying its value to // the average sequence as a new element: avgSequence.add(DataSequence.get(i)); // Else, if this occurrence of the condition is // longer than the shortest one found so far, } else if (numRowsFound >= avgSequence.size()){ // System.out.println("avgSequence: "); // printList(avgSequence); i = skip(i); // skip the rest of it... break; // and find the next occurrence of the // condition } else { // add each row of this occurrence of the condition // to the average by adding it to the running sum // contained in that row of the average sequence: avgSequence.set(numRowsFound, (avgSequence.get(numRowsFound) + DataSequence.get(i))); } numRowsFound++; // move on to the next row until we reach the next // condition or there are no more rows: i++; } while ((i < Condition.size()) && (Condition.get(i) == condition)); // If this interval was shorter than the others: if (numRowsFound < avgSequence.size()) // shorten the average sequence to match this one's // length (by removing the extra trailing elements): removeAfter(avgSequence, numRowsFound); // avgSequence.subList(numRowsFound, // avgSequence.size()).clear(); numOccurrences++; } } private int myFindNextOccurrence(int startIndex, int condition){ if (startIndex >= Condition.size() - 1) return -1; while (Condition.get(startIndex) != condition) { if (startIndex >= Condition.size() - 1) return -1; startIndex++; } return startIndex; } /* findNextOccurrence * IN: lst, a collection that implements the List interface (???) * startIndex, the first index in the List to check * value, the value to search lst for * OUT: returns the first index, starting from startIndex, of value * in lst * returns -1 if value is not found in lst (because indexOf * does) */ /* private <T> int findNextOccurrence(List<T> lst, int startIndex, T value){ // get the sub-list that we want to search for the value: List<T> toSearch = lst.subList(startIndex, lst.size()); return startIndex + // since the array we're searching starts at // this index in the whole array toSearch.indexOf(value); // first index of value in toSearch } */ /* skip * IN: startIndex, the index of the condition to skip * OUT: returns the index of the first row in the data sequence that * is not part of an occurrence of the condition */ private int skip(int startIndex) { //System.out.print("Skipping past index: "); //System.out.println(startIndex); // store the condition to skip: int condition = Condition.get(startIndex); // increment the index until we pass the current condition: while (Condition.get(++startIndex) == condition); //System.out.print("Index is now: "); //System.out.println(startIndex); return startIndex; } // class variables for Group: private final String Name; private final ArrayList<Integer> Channels; private double Sum; private ArrayList<Double> DataSequence; // contains actual "time // series" data private ArrayList<Integer> Condition; // stores a condition // associated with every // row of the time series private final int NumChannels; private int NumVals; private int NumSubjects; } // class variables for GroupedChannels: private final int NumChannels; private ArrayList<Group> GroupList; private ArrayList<Integer> Conditions; private TreeSet<Integer> MissingChannels; private TreeSet<Integer> DuplicatedChannels; } private static void runChunkTests(){ System.out.println("Running chunk averaging tests."); chunkTest("testData1", 3); chunkTest("testData1", 4); chunkTest("testData2", 3); chunkTest("testData3", 3); chunkTest("testData1", 2); System.out.println("Done testing."); } private static void chunkTest(String data, int numChunks){ File groupFile = new File("c:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/ChunkingTests/testGroups"); File dataFile = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/ChunkingTests/" + data); System.out.println("Reading group information from " + data + "."); GroupedChannels groups = new GroupedChannels(dataFile, groupFile); System.out.println("Average sequence before averaging:"); ArrayList<Double> output = groups.getGroup("foo").getData(1); printList(output); // test: output = averageChunks(groups.getGroup("foo").getData(1), numChunks); System.out.println("Average sequence after averaging " + numChunks + " chunks together:"); printList(output); } private static void runSubjectTests() { // test subject combining functions: // test files: File groupFile = new File("c:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/SubjectTests/groups"); File data1 = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/SubjectTests/testData1"); File data2 = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/SubjectTests/testData2"); File data3 = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/SubjectTests/testData3"); // read channel grouping information: System.out.println("Reading group information."); GroupedChannels groups1 = new GroupedChannels(data1, groupFile); GroupedChannels groups2 = new GroupedChannels(data2, groupFile); GroupedChannels groups3 = new GroupedChannels(data3, groupFile); System.out.println("Done reading group information."); // display contents of groups before combining: System.out.println("groups1:"); printList(groups1.getGroup("foo").getData(1)); System.out.println("groups2:"); printList(groups2.getGroup("foo").getData(1)); System.out.println("groups3:"); printList(groups3.getGroup("foo").getData(1)); // two subject test: File[] dataFileAry = {data1, data2}; // files to combine subjectTestsHelper(dataFileAry, groupFile); // three subject test: File[] dataFileAry2 = {data1, data2, data3}; // files to combine subjectTestsHelper(dataFileAry2, groupFile); } private static void subjectTestsHelper(File[] dataFileAry, File groupFile) { // create ArrayList of the files: ArrayList<File> dataFileLst = new ArrayList<File>(); for (File f : dataFileAry){ dataFileLst.add(f); } // Combine groups and display contents of combined group: System.out.println("result of combining groups:"); printList(processAllSubjectData(dataFileLst,groupFile ).getGroup("foo").getData(1)); } private static void runANOVATests() { System.out.println("Running ANOVA tests."); File groupFile = new File("c:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/ANOVA Testing/legitGroups"); File hbFile = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/ANOVA Testing/legitHb"); int precision = 7; int numChunks = 10; GroupedChannels groups1 = new GroupedChannels(hbFile, groupFile); String groupName = "groupOne"; runANOVATestsHelper(groups1, groupName, 0); runANOVATestsHelper(groups1, groupName, 1); LinkedList<double[]> container = new LinkedList<double[]>(); container.add(toPrimitiveDoubleArray(groups1.getGroup(groupName).getData(0))); container.add(toPrimitiveDoubleArray(groups1.getGroup(groupName).getData(1))); OneWayAnova myANOVA = new OneWayAnova(); double result = myANOVA.anovaPValue(container); System.out.println("Result: " + result); // outputANOVAs(groups1, // groups1.getGroupNames(), groups1.getConditions(), // numChunks, precision); File outFile = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/ANOVA Testing/outputFile.csv"); writeANOVAs(outFile, groups1, groups1.getGroupNames(), groups1.getConditions(), // groupNames, conditions, numChunks, precision); System.out.println("Done."); } private static void runANOVATestsHelper(GroupedChannels groups, String groupName, int condition) { System.out.println("(" + groupName + ", condition " + condition + ")"); printList(groups.getGroup(groupName).getData(condition) ); } private static void runChannelsTests() { System.out.println("Running channel grouping warnings tests."); File hbFile = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/channelWarningsTesting/legitHb"); // test 1: File groupFile = new File("c:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/channelWarningsTesting/badGroupFile"); GroupedChannels foo = new GroupedChannels(hbFile, groupFile); System.out.println("------------------------------------------"); // test 2: groupFile = new File("c:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/channelWarningsTesting/badGroupFile2"); foo = new GroupedChannels(hbFile, groupFile); System.out.println("Done."); } public static void main(String[] args) { //runChunkTests(); //runSubjectTests(); //runANOVATests(); runChannelsTests(); File legitGroupsFile = new File("c:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/legitGroups"); File legitHbFile = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/legitHb"); int precision = 7; int numChunks = 10; GroupedChannels legitGroups = new GroupedChannels(legitHbFile, legitGroupsFile); // ArrayList<String> mylst = legitGroups.getGroupNames(); // System.out.println(mylst.size()); // String foo = mylst.get(0); // System.out.println(foo); // printList(legitGroups.getGroupNames()); // legitGroups.getGroup("groupOne"); // legitGroups.getGroup("secondGroup"); // legitGroups.getGroup("groupThree"); // legitGroups.getGroup("group4"); // legitGroups.getGroup("g5"); /* outputANOVAs(legitGroups, legitGroups.getGroupNames(), legitGroups.getConditions(), numChunks, precision); File outFile = new File("C:/Users/nkolesar/Desktop/CS Seminar/fNIRs/sub19/outputFile.csv"); writeANOVAs(outFile, legitGroups, legitGroups.getGroupNames(), legitGroups.getConditions(), // groupNames, conditions, numChunks, precision); */ // group groupOne condition 0 // group groupOne condition 1 // -------------------------- // ==> ANOVA value of 0.0000...000 (50 decimal places) // WHY? System.exit(0); } }
312e3dafef5f9272296f716a24861a44079159a4
5cc9bc1d278e1aef2b75f706c5afe7464b6d3479
/src/main/java/wrappers/spouts/FluxShellSpout.java
a309f394346f542c0e3a76d7c8a2de01c858c10e
[]
no_license
dzamp/FUSION
596a3287c29bb64af0856c7cb91c378cbaca4820
05b078d0a0fcc9a52d0974d71f65b5488cd3305d
refs/heads/master
2021-09-07T22:50:53.507643
2018-03-02T12:24:41
2018-03-02T12:25:09
105,769,774
0
0
null
2018-01-14T18:22:22
2017-10-04T13:10:51
Java
UTF-8
Java
false
false
5,567
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package wrappers.spouts; import org.apache.storm.spout.ShellSpout; import org.apache.storm.topology.IRichSpout; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.tuple.Fields; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * A generic `ShellSpout` implementation that allows you specify output fields * and even streams without having to subclass `ShellSpout` to do so. * */ public class FluxShellSpout extends ShellSpout implements IRichSpout { private Map<String, String[]> outputFields; private Map<String, Object> componentConfig; /** * Create a ShellSpout with command line arguments * @param command Command line arguments for the bolt */ public FluxShellSpout(String[] command){ super(command); this.outputFields = new HashMap<String, String[]>(); } /** * Create a ShellSpout with command line arguments and output fields * * Keep this constructor for backward compatibility. * * @param args Command line arguments for the spout * @param outputFields Names of fields the spout will emit. */ public FluxShellSpout(String[] args, String[] outputFields){ this(args); this.setDefaultStream(outputFields); } /** * Add configuration for this spout. This method is called from YAML file: * * ``` * className: "org.apache.storm.flux.wrappers.bolts.FluxShellSpout" * constructorArgs: * # command line * - ["python", "splitsentence.py"] * # output fields * - ["word"] * configMethods: * - name: "addComponentConfig" * args: ["publisher.data_paths", "actions"] * ``` * * @param key * @param value */ public void addComponentConfig(String key, Object value) { if (this.componentConfig == null) { this.componentConfig = new HashMap<String, Object>(); } this.componentConfig.put(key, value); } /** * Add configuration for this spout. This method is called from YAML file: * * ``` * className: "org.apache.storm.flux.wrappers.bolts.FluxShellSpout" * constructorArgs: * # command line * - ["python", "splitsentence.py"] * # output fields * - ["word"] * configMethods: * - name: "addComponentConfig" * args: * - "publisher.data_paths" * - ["actions"] * ``` * * @param key * @param values */ public void addComponentConfig(String key, List<Object> values) { if (this.componentConfig == null) { this.componentConfig = new HashMap<String, Object>(); } this.componentConfig.put(key, values); } /** * Set default stream outputFields, this method is called from YAML file: * * ``` * spouts: * - className: org.apache.storm.flux.wrappers.bolts.FluxShellSpout * id: my_spout * constructorArgs: * - [python, my_spout.py] * configMethods: * - name: setDefaultStream * args: * - [word, count] * ``` * * @param outputFields Names of fields the spout will emit (if any) in default stream. */ public void setDefaultStream(String[] outputFields) { this.setNamedStream("default", outputFields); } /** * Set custom *named* stream outputFields, this method is called from YAML file: * * ``` * spouts: * - className: org.apache.storm.flux.wrappers.bolts.FluxShellSpout * id: my_spout * constructorArgs: * - [python, my_spout.py] * configMethods: * - name: setNamedStream * args: * - first * - [word, count] * ``` * @param name Name of stream the spout will emit into. * @param outputFields Names of fields the spout will emit in custom *named* stream. */ public void setNamedStream(String name, String[] outputFields) { this.outputFields.put(name, outputFields); } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { Iterator it = this.outputFields.entrySet().iterator(); while (it.hasNext()) { Map.Entry entryTuple = (Map.Entry)it.next(); String key = (String)entryTuple.getKey(); String[] value = (String[])entryTuple.getValue(); if(key.equals("default")) { declarer.declare(new Fields(value)); } else { declarer.declareStream(key, new Fields(value)); } } } @Override public Map<String, Object> getComponentConfiguration() { return this.componentConfig; } }
feba840abb895212bf33044efa5680b87c7b5167
7ac7787ab98f414a899bae939448d20707cfcbd8
/src/xadrez/XadrezException.java
5e66152e3679063f3e1b53ed3807d07c54c2b498
[]
no_license
barbararibeiroo/xadrez-sistema-java
225775e45b90ea91e84d73274c385859f875ade6
fffbea57f4b7c4a25087a67406b079b395b22ddd
refs/heads/master
2022-12-08T07:52:39.787982
2020-09-02T04:13:26
2020-09-02T04:13:26
288,878,480
0
0
null
null
null
null
UTF-8
Java
false
false
222
java
package xadrez; import tabuleiro.TabuleiroException; public class XadrezException extends TabuleiroException { private static final long serialVersionUID = 1L; public XadrezException(String msg) { super(msg); } }
9dcf4dcc5307932b39d18f884aff1540459d8e42
40bbf4c22d91f5b0a13438d09684ace0e7f233ac
/app/src/main/java/com/kuuhaku/tuxapps/AppsData.java
e5e44ff1dc3a0ac113da10be23c7ddfabd424349
[]
no_license
abdullah2205/Android-Programing
15e32af93f20de1414bdb462aa0576ef3edd4bd7
13d91735a4e4ee70e696015a600e17039e6e53b6
refs/heads/master
2022-11-12T17:31:52.984720
2020-07-09T02:44:15
2020-07-09T02:44:15
278,244,194
1
0
null
null
null
null
UTF-8
Java
false
false
7,852
java
package com.kuuhaku.tuxapps; import java.util.ArrayList; class AppsData { private static String[] namaAplikasi = { "Riot.im", "Kitty", "GIMP", "VeraCrypt", "Anchor", "Sourcetrail", "Term-clock", "Openshot", "Ksnip", "FF Password Exporter " }; private static String[] deskripsiAplikasi = { "Riot (formerly known as Vector) is a Matrix web client built using the Matrix React SDK.\n" + "Riot is officially supported on the web in modern versions of Chrome, Firefox, and Safari. " + "Other browsers may work, however official support is not provided. For accessing Riot on an " + "Android or iOS device, check out riot-android and riot-ios - riot-web does not support mobile devices. \n", "A cross-platform, fast, feature full, GPU based terminal emulator.", "GIMP is a cross-platform image editor available for GNU/Linux, OS X, Windows and more operating systems. It is free software, " + "you can change its source code and distribute your changes. Whether you are a graphic designer, photographer, illustrator, " + "or scientist, GIMP provides you with sophisticated tools to get your job done. You can further enhance your productivity with GIMP " + "thanks to many customization options and 3rd party plugins.", "VeraCrypt is a source-available freeware utility used for on-the-fly encryption (OTFE).[5] It can create a virtual encrypted disk within a file " + "or encrypt a partition[6] or (in Windows) the entire storage device with pre-boot authentication.[7] \n" + "VeraCrypt is a fork of the discontinued TrueCrypt project.[8] It was initially released on 22 June 2013 and " + "produced its latest release (version 1.24) on 6 October 2019.[9] Many security improvements have been implemented and " + "issues raised by TrueCrypt code audits have been fixed. VeraCrypt includes optimized implementations of cryptographic hash " + "functions and ciphers which boost performance on modern CPUs. ", "Anchor is an open source, multi-account, multi-chain, EOSIO wallet offering secure key storage and many of the tools you’ll need in your day-to-day " + "usage of these platforms. It also offers authenticator features that allow you to use Anchor to sign in and interact with compatible " + "EOSIO applications and dapps.", "Software developers spend most of their time figuring out existing source code, but common code editing tools offer little help for this task. " + "Debuggers only allow detailed inspection of one narrow code path. 'Find all references' helps you in navigating between files, but doesn't provide the " + "context to see the big picture of all relevant dependencies. Sourcetrail provides both overview and details by combining an interactive dependency graph, " + "a concise code view and efficient code search, all built into an easy-to-use cross-platform developer tool. It supports you in exploring legacy code, " + "understanding the implementation and refactoring the software architecture, making it a fun experience for the whole family!.", "A configurable terminal clock for your GNU/Linux system...\n" + "\n" + "Installation is easy on any Linux system. For debian systems, you can install the debian package from here.\n" + "For any other Linux distribution, you can run the installer, found here: https://github.com/Souravgoswami/term-clock-root", "OpenShot is a free and open-source video editor for FreeBSD, Linux, Haiku, macOS, and Windows. The project was started in August 2008 by Jonathan Thomas, " + "with the objective of providing a stable, free, and friendly to use video editor. OpenShot easy to use, quick to learn, and surprisingly powerful video editor.", "Ksnip is a Qt based cross-platform screenshot tool that provides many annotation features for your screenshots.\n" + "Changed: Add missing plugs to silence snap socket warnings. (#313)\n" + "Fixed: Window decoration and alt+tab menu show Wayland generic icon on KDE Plasma. (#269)\n" + "Fixed: Logout canceled by 'ksnip' under KDE. (#281)\n" + "Fixed: Ksnip not displayed on the monitor (off screen). (#307)\n" + "Fixed: CTRL+Q to quit Ksnip not working. (#308)\n" + "Fixed: Global Hotkeys not working with activated Num and Caps Lock under X11. (#310)", "It can be difficult to export your passwords from Firefox. Since version 57 of Firefox (Quantum) existing password export addons no longer work. " + "Mozilla provides no other official alternatives. FF Password Exporter makes it quick and easy to export all of your passwords from Firefox. " + "You can use FF Password Exporter on Windows, macOS, and Linux distributions." }; private static String[] versiAplikasi = { "1.3.2", "0.14.3", "2.10.14", "1.19.10", "1.0.0", "2020.1.131", "0.50", "2.4.4", "1.6.2", "1.1.1" }; private static String[] tipe_aplikasi = { "AppImage", "AppImage", "AppImage", "Debian (.deb)", "AppImage", "AppImage", "Source-Code", "Source-Code", "Debian (.deb)", "AppImage" }; private static String[] arsitektur = { "64bit - x86", "64bit - x86", "64bit - x86", "64bit - x86", "64bit - x86", "64bit - x86", "32bit - x86\n" + "64bit - x86\n" + "armhf - 32bit\n" + "arm64 - 64bit\n", "64bit - x86", "32bit - x86, 64bit - x86 ", "64bit - x86" }; private static String[] rilis = { "stable", "stable", "stable", "stable", "git", "git", "stable", "stable", "stable", "git" }; private static String[] tgl_rilis = { "2019-10-10", "2019-08-31", "2020-01-02", "2019-10-27", "2020-04-18", "2020-03-30", "2019-08-27", "2019-12-29", "2020-05-05", "2020-04-05" }; private static String[] ukuran = { "76.27 MB", "11.53 MB", "161.98 MB", "3.17 MB", "63.96 MB", "116.36 MB", "0.30 MB", "152.75 MB", "5.35 MB", "55.59 MB" }; private static int[] ikon = { R.drawable.riot, R.drawable.kitty, R.drawable.gimp, R.drawable.veracrypt, R.drawable.anchor, R.drawable.sourcetrail, R.drawable.term_clock, R.drawable.openshot, R.drawable.ksnip, R.drawable.ff }; static ArrayList<App> AmbilDataAplikasi() { ArrayList<App> isi_list = new ArrayList<>(); for (int posisi = 0; posisi < namaAplikasi.length; posisi++) { App aplikasi = new App(); //membuat instant class aplikasi.setNama(namaAplikasi[posisi]); aplikasi.setDeskripsi(deskripsiAplikasi[posisi]); aplikasi.setVersi(versiAplikasi[posisi]); aplikasi.setTipe_paket(tipe_aplikasi[posisi]); aplikasi.setArsitektur(arsitektur[posisi]); aplikasi.setRilis(rilis[posisi]); aplikasi.setTgl_rilis(tgl_rilis[posisi]); aplikasi.setUkuran(ukuran[posisi]); aplikasi.setIkon(ikon[posisi]); isi_list.add(aplikasi); } return isi_list; } }
64f84f344143b6d38a936257dcb52182563aed08
077f81916b719a57435ae579628977c3ebbc1478
/trinidad-api/target/maven-xrts-plugin/main/java/org/apache/myfaces/trinidad/resource/MessageBundle_da.java
d5962e418218d1d2b7efa40c8a004cbd823f61d1
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
m-y-mo/myfaces-trinidad_20165019
e9f2da811aaa07160b8b660fa13743750c5932d4
43125e45e1c56fab0cc56e32d079be787209d3b4
refs/heads/master
2020-03-07T10:27:37.758086
2018-03-30T13:34:10
2018-03-30T13:34:10
127,431,966
0
1
Apache-2.0
2020-02-11T14:23:38
2018-03-30T13:35:24
Java
UTF-8
Java
false
false
14,016
java
// Do not edit this file! // This file has been automatically generated. // Edit MessageBundle_da.xrts and run the XRTSMakeBundle tool instead. // package org.apache.myfaces.trinidad.resource; import java.util.ListResourceBundle; public class MessageBundle_da extends ListResourceBundle { @Override public Object[][] getContents() { return new Object[][] { {"org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED", "V\u00e6rdi er p\u00e5kr\u00e6vet"}, {"org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED_detail", "Indtast en v\u00e6rdi."}, {"org.apache.myfaces.trinidad.UIXSelectMany.REQUIRED", "Valg er p\u00e5kr\u00e6vet"}, {"org.apache.myfaces.trinidad.UIXSelectMany.REQUIRED_detail", "V\u00e6lg mindst \u00e9n v\u00e6rdi."}, {"org.apache.myfaces.trinidad.UIXSelectOne.REQUIRED", "Valg er p\u00e5kr\u00e6vet"}, {"org.apache.myfaces.trinidad.UIXSelectOne.REQUIRED_detail", "V\u00e6lg en v\u00e6rdi."}, {"org.apache.myfaces.trinidad.UIXTableSelectOne.REQUIRED", "R\u00e6kke skal v\u00e6re markeret"}, {"org.apache.myfaces.trinidad.UIXTableSelectOne.REQUIRED_detail", "Mark\u00e9r en r\u00e6kke."}, {"org.apache.myfaces.trinidad.UIXTableSelectMany.REQUIRED", "En r\u00e6kke skal v\u00e6re markeret"}, {"org.apache.myfaces.trinidad.UIXTableSelectMany.REQUIRED_detail", "Mark\u00e9r mindst \u00e9n r\u00e6kke."}, {"org.apache.myfaces.trinidad.UIXSelectMany.UNSUPPORTED_MODEL_TYPE", "Ikke-underst\u00f8ttet modeltype."}, {"org.apache.myfaces.trinidad.UIXSelectMany.UNSUPPORTED_MODEL_TYPE_detail", "SelectMany underst\u00f8tter ikke en model af typen {0}."}, {"org.apache.myfaces.trinidad.UIXEditableValue.CONVERSION", "Konvertering fejlede"}, {"org.apache.myfaces.trinidad.UIXEditableValue.CONVERSION_detail", "Indtast en v\u00e6rdi som {2}."}, {"org.apache.myfaces.trinidad.validator.RangeValidator.MAXIMUM_HINT", "Indtast en v\u00e6rdi, der er mindre end eller lig med {0}."}, {"org.apache.myfaces.trinidad.validator.RangeValidator.MINIMUM_HINT", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {0}."}, {"org.apache.myfaces.trinidad.validator.RangeValidator.RANGE_HINT", "Indtast en v\u00e6rdi mellem {0} og {1}."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_HINT", "Indtast en v\u00e6rdi, der maksimalt best\u00e5r af {0} tegn."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_HINT", "Indtast en v\u00e6rdi, der maksimalt best\u00e5r af {0} tegn."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_HINT", "Indtast en v\u00e6rdi, der best\u00e5r af {0} tegn."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT", "Indtast en v\u00e6rdi, der best\u00e5r af {0} til {1} tegn."}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_HINT", "Indtast en dato, der ligger f\u00f8r eller den {0}."}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_HINT", "Indtast en dato, der ligger efter eller den {0}."}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.RANGE_HINT", "Indtast en dato, der ligger mellem {0} og {1}."}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY_HINT", "Indtast en dato fra f\u00f8lgende ugedag(e): {0}."}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH_HINT", "Indtast en dato fra f\u00f8lgende m\u00e5ned(er): {0}."}, {"javax.faces.validator.LongRangeValidator.MINIMUM", "V\u00e6rdi er for lille"}, {"javax.faces.validator.LongRangeValidator.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"javax.faces.validator.LongRangeValidator.MAXIMUM", "V\u00e6rdi er for stor"}, {"javax.faces.validator.LongRangeValidator.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"javax.faces.LongRange", "Ikke et heltal"}, {"javax.faces.LongRange_detail", "Indtast et heltal."}, {"org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM", "V\u00e6rdi er for lang"}, {"org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM_detail", "L\u00e6ngden p\u00e5 den indtastede v\u00e6rdi overskrider den maksimalt tilladte bytel\u00e6ngde p\u00e5 {2}."}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM", "Dato ligger efter det gyldige interval"}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_detail", "Indtast en dato, der ligger den {2} eller f\u00f8r."}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM", "Dato ligger f\u00f8r det gyldige interval"}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_detail", "Indtast en dato, der ligger den {2} eller efter."}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE", "Dato ligger uden for det gyldige interval"}, {"org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE_detail", "Indtast en dato, der ligger den {2} og {3} eller derimellem."}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.DAY", "Dato er ikke tilladt."}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.DAY_detail", "Den indtastede dato er ikke tilladt."}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH", "Ugyldig m\u00e5ned"}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH_detail", "Indtast en dato fra f\u00f8lgende m\u00e5ned(er): {2}."}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY", "Ugyldig ugedag"}, {"org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY_detail", "Indtast en dato fra f\u00f8lgende ugedag(e): {2}."}, {"org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM", "V\u00e6rdi er for stor"}, {"org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM", "V\u00e6rdi er for lille"}, {"org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE", "V\u00e6rdi ligger uden for det gyldige interval"}, {"org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE_detail", "Indtast en v\u00e6rdi mellem {2} og {3}."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM", "V\u00e6rdi er for lang"}, {"org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_detail", "Indtast en v\u00e6rdi, der maksimalt best\u00e5r af {2} tegn."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM", "V\u00e6rdi er for kort"}, {"org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_detail", "Indtast en v\u00e6rdi, der mindst best\u00e5r af {2} tegn."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE", "V\u00e6rdi med ugyldig l\u00e6ngde"}, {"org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE_detail", "Indtast en v\u00e6rdi, der best\u00e5r af {2} til {3} tegn."}, {"org.apache.myfaces.trinidad.validator.LengthValidator.EXACT", "V\u00e6rdi med ugyldig l\u00e6ngde"}, {"org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_detail", "Indtast en v\u00e6rdi, der best\u00e5r af {2} tegn."}, {"org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM", "V\u00e6rdi er for stor"}, {"org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM", "V\u00e6rdi er for lille"}, {"org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE", "V\u00e6rdi ligger uden for det gyldige interval"}, {"org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE_detail", "Indtast en v\u00e6rdi mellem {2} og {3}."}, {"org.apache.myfaces.trinidad.validator.RegExpValidator.NO_MATCH", "V\u00e6rdi matcher ikke m\u00f8nster."}, {"org.apache.myfaces.trinidad.validator.RegExpValidator.NO_MATCH_detail", "Den indtastede v\u00e6rdi matcher ikke m\u00f8nsteret for det almindelige udtryk \"{2}\"."}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.DATE_HINT", "Eksempel: {0}"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.TIME_HINT", "Eksempel: {0}"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.BOTH_HINT", "Eksempelformat: {0}"}, {"org.apache.myfaces.trinidad.convert.ColorConverter.FORMAT_HINT", "Eksempelformat: {0}"}, {"org.apache.myfaces.trinidad.convert.NumberConverter.FORMAT_HINT", "Eksempelformat: {0}"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE", "Ugyldigt datoformat"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE_detail", "Gyldigt eksempel: {2}"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_TIME", "Ugyldigt klokkesl\u00e6tsformat"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_TIME_detail", "Gyldigt eksempel: {2}"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH", "Ugyldigt dato- og klokkesl\u00e6tsformat"}, {"org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail", "Gyldigt eksempel: {2}"}, {"org.apache.myfaces.trinidad.convert.ColorConverter.CONVERT", "Ugyldigt farveformat"}, {"org.apache.myfaces.trinidad.convert.ColorConverter.CONVERT_detail", "Gyldigt eksempel: {2}"}, {"org.apache.myfaces.trinidad.convert.ColorConverter.TRANSPARENT", "Gennemsigtig"}, {"org.apache.myfaces.trinidad.convert.IntegerConverter.CONVERT", "Ikke et heltal"}, {"org.apache.myfaces.trinidad.convert.IntegerConverter.CONVERT_detail", "Indtast et heltal."}, {"org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM", "V\u00e6rdi er for lille"}, {"org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM", "V\u00e6rdi er for stor"}, {"org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.LongConverter.CONVERT", "Ikke et heltal"}, {"org.apache.myfaces.trinidad.convert.LongConverter.CONVERT_detail", "Indtast et heltal."}, {"org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM", "V\u00e6rdi er for lille"}, {"org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM", "V\u00e6rdi er for stor"}, {"org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PATTERN", "Ikke et tal"}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PATTERN_detail", "Den v\u00e6rdi, du har indtastet, er ikke et tal, der matcher m\u00f8nsteret \"{2}\"."}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_NUMBER", "Ikke et tal"}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_NUMBER_detail", "Indtast et tal."}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_CURRENCY", "Ugyldigt valutaformat"}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_CURRENCY_detail", "Gyldigt eksempel: {2}"}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PERCENT", "Ugyldigt procentangivelsesformat"}, {"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PERCENT_detail", "Gyldigt eksempel: {2}"}, {"org.apache.myfaces.trinidad.convert.ShortConverter.CONVERT", "Ikke et heltal"}, {"org.apache.myfaces.trinidad.convert.ShortConverter.CONVERT_detail", "Indtast et heltal."}, {"org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM", "V\u00e6rdi er for lille"}, {"org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM", "V\u00e6rdi er for stor"}, {"org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.ByteConverter.CONVERT", "Ikke et heltal"}, {"org.apache.myfaces.trinidad.convert.ByteConverter.CONVERT_detail", "Indtast et heltal."}, {"org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM", "V\u00e6rdi er for lille"}, {"org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM_detail", "Indtast en v\u00e6rdi, der er st\u00f8rre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM", "V\u00e6rdi er for stor"}, {"org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM_detail", "Indtast en v\u00e6rdi, der er mindre end eller lig med {2}."}, {"org.apache.myfaces.trinidad.convert.DoubleConverter.CONVERT", "Ikke et tal"}, {"org.apache.myfaces.trinidad.convert.DoubleConverter.CONVERT_detail", "Indtast et tal."}, {"org.apache.myfaces.trinidad.convert.FloatConverter.CONVERT", "Ikke et tal."}, {"org.apache.myfaces.trinidad.convert.FloatConverter.CONVERT_detail", "Den indtastede v\u00e6rdi er ikke et tal."}, {"org.apache.myfaces.trinidad.convert.ALERT_FORMAT", "{0} - {1}"}, {"org.apache.myfaces.trinidad.convert.ALERT_FORMAT_detail", "{0} - {1}"}, }; } }
79ed0f7611e438c682d788e0b8a63368436627ec
beaa15c44f21c073cc91f17bc127cc155642f35c
/yh/app/src/main/java/com/flym/yh/ui/fragment/home/ReservationGohomeFragment.java
9886a715d23acb416bbaeecbf0dcc9dc09c675f2
[]
no_license
mengliuxian/ToolSet
d006b07a4242860cd217c4501b5715e9b45bfcf1
65d3fc82360d175db89109cbd7bb3a102007acfa
refs/heads/master
2021-06-22T02:43:19.851722
2018-09-05T13:16:56
2018-09-05T13:16:56
146,283,881
0
0
null
null
null
null
UTF-8
Java
false
false
4,534
java
package com.flym.yh.ui.fragment.home; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.TextView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.flym.yh.R; import com.flym.yh.adapter.home.ReservationGohomeAdapter; import com.flym.yh.base.BaseFragment; import com.flym.yh.data.model.GetServicesBean; import com.flym.yh.net.DisposableWrapper; import com.flym.yh.net.RetrofitUtil; import com.flym.yh.net.SimpleTransFormer; import com.flym.yh.ui.view.spring.DefaultFooter; import com.flym.yh.ui.view.spring.DefaultHeader; import com.flym.yh.ui.view.spring.SpringView; import com.flym.yh.utils.FragmentUtil; import com.flym.yh.utils.RecycleViewDivider; import java.util.ArrayList; import java.util.List; import butterknife.BindView; /** * @author lishuqi * @date 2018/3/23 * 预约上门 */ public class ReservationGohomeFragment extends BaseFragment { @BindView(R.id.toolbar_title) TextView toolbarTitle; @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.recycler) RecyclerView recycler; @BindView(R.id.spring) SpringView spring; private int page = 1; private List<GetServicesBean.ListBean> dataList = new ArrayList<>(); private ReservationGohomeAdapter mAdapter; public static ReservationGohomeFragment newInstance() { Bundle args = new Bundle(); ReservationGohomeFragment fragment = new ReservationGohomeFragment(); fragment.setArguments(args); return fragment; } @Override protected void initData() { getListOld(); setAdapter(); setSpring(); } /** * 设置适配器 */ private void setAdapter() { mAdapter = new ReservationGohomeAdapter(dataList); recycler.setLayoutManager(new LinearLayoutManager(getActivity())); recycler.setAdapter(mAdapter); recycler.addItemDecoration(new RecycleViewDivider(getActivity(), 1)); mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { GetServicesBean.ListBean listBean = dataList.get(position); FragmentUtil.replaceFragmentToActivity(R.id.container, ReservationGohomeDetailsFragment.newInstance(listBean), getFragmentManager(), getString(R.string.reservation_gohome_details)); } }); } /** * 设置刷新控件 */ private void setSpring() { spring.setType(SpringView.Type.FOLLOW); spring.setListener(new SpringView.OnFreshListener() { @Override public void onRefresh() { //spring.onFinishFreshAndLoad(); 完成 page = 1; getListOld(); } @Override public void onLoadmore() { page++; getListOld(); } }); spring.setFooter(new DefaultFooter(getActivity())); spring.setHeader(new DefaultHeader(getActivity())); } @Override protected void init(Bundle savedInstanceState) { } @Override public Toolbar getToolbar() { toolbarTitle.setText(getTag()); return toolbar; } @Override protected int getLayoutRes() { return R.layout.fragment_reservation_gohome; } /** * 获取服务列表 */ public void getListOld() { compositeDisposable.add(RetrofitUtil.getApiService() .doctorGetorderlist(1, 2) .compose(new SimpleTransFormer<GetServicesBean>(Object.class)) .subscribeWith(new DisposableWrapper<GetServicesBean>() { @Override public void onNext(GetServicesBean o) { if (page == 1) { dataList.clear(); } if (o.getList() != null) { dataList.addAll(o.getList()); } mAdapter.notifyDataSetChanged(); } @Override public void onFinish() { super.onFinish(); spring.onFinishFreshAndLoad(); } })); } }
[ "mengliuxian@outlookcom" ]
mengliuxian@outlookcom
69fcf348a9a30e84dda1ec192e45af345530aebe
c4881a366b9a5208a59fe7ab3069799eb9fbf49b
/hidetoolbarEnablefullscreen/app/src/androidTest/java/com/lco/hidetoolbarenablefullscreen/ExampleInstrumentedTest.java
9ce2d16445f8f1b8a55dd3147af0d037fc253c0e
[]
no_license
rahul6660357/Android
63976dd111dcc1e1126336912cf6cdea54333389
54cf0b05ee191fb720906f3c1cc7d676575b2765
refs/heads/master
2020-06-26T18:16:00.792335
2019-09-11T11:51:28
2019-09-11T11:51:28
199,710,747
1
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.lco.hidetoolbarenablefullscreen; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.lco.hidetoolbarenablefullscreen", appContext.getPackageName()); } }
25c48e58f603f2dda863dbd13d226d2f9dee863e
a8f838dc1c6ac4bc56c460d7613f09c0ac373658
/src/com/aterrizar/modelo/Aerolinea/AerolineaOceanic.java
15c8dc1eb875d2fda410f519a341ca39117a7520
[]
no_license
usueldo/aterrizarEntrega3_parte3
a90053e73e5d3450f82975a66775862a8fa9d0c7
3cb98e628b24ec015efbd4fedac868c619f473ef
refs/heads/master
2020-05-29T12:10:27.695463
2019-06-03T02:22:18
2019-06-03T02:22:18
189,127,047
0
0
null
null
null
null
UTF-8
Java
false
false
936
java
package com.aterrizar.modelo.Aerolinea; import java.util.List; import com.aterrizar.modelo.Asiento.AsientoDTO; public interface AerolineaOceanic { //Obtener asientos disponibles indicando Ciudad Origen public List<AsientoDTO> asientosDisponiblesParaOrigen( String codigoOrigenOceanic, String fechaSalida); //Obtener asientos disponibles indicando Ciudad Origen y Destino public List<AsientoDTO> asientosDisponiblesParaOrigenYDestino( String codigoOrigenOceanic, String fechaSalida, String codigoDestinoOceanic); //Indica si un asiento esta reservado public boolean estaReservado(String codigoDeVuelo, Integer numeroDeAsiento); //Indica si se pudo comprar o no un Asiento public boolean comprarSiHayDisponibilidad(String dni, String codigoVuelo, Integer numeroDeAsiento); //Indica si se pudo reservar o no un Asiento public boolean reservar(String dni, String codigoVuelo, Integer numeroDeAsiento); }
3039fbffdfb13f42d4178bfb2612df291c8788bc
b4f527dec7a1450f6f65f5cd2f953eacb9562b4d
/src/main/java/com/example/ApplicationFull/Repository/UserRepository.java
9ccd0a77388ab5059b0eefe9f727332147c287f4
[]
no_license
Darispeg/Prueba_Spring_Boot
983a9575edc281a149337133a5e58c23a24e4856
c82fb6e309d69a59d9a135fb81cf593447971efe
refs/heads/main
2023-04-10T01:40:50.530300
2021-04-25T21:56:31
2021-04-25T21:56:31
359,309,051
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.example.ApplicationFull.Repository; import java.util.Optional; import com.example.ApplicationFull.Entity.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository("UserRepository") public interface UserRepository extends JpaRepository<User, Long> { public Optional<User> findByUsername(String username); }
6d1ccd499f25831bb146489012eb5880bd3bcbac
98437f03f56c03aeed3efb52294f50f238482744
/src/main/java/com/smartral/inappbilling/utils/processing/EvaluatorFactory.java
c42b332e574ba208079ffa1aafcbf502f55deaa4
[]
no_license
objectorientedperson/Java-BackEnd-InAppBillingValidator
fe49cd45f863f4c43f4f90eb63d3f696ed10c5af
8f276b639e7032a2e130c9d3c79f317ae0805e1e
refs/heads/master
2021-01-19T20:36:56.087577
2020-01-09T12:29:54
2020-01-09T12:29:54
101,232,463
3
0
null
null
null
null
UTF-8
Java
false
false
2,950
java
/* * Copyright (c) 2012, Eric Coolman, Codename One and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Codename One designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Codename One through http://www.codenameone.com/ if you * need additional information or have any questions. */ package com.smartral.inappbilling.utils.processing; /** * Internal class, do not use. * * Predicate Evaluator Factory, attempts to create a predicate evaluator given the expression. * * ie: * * <code> * [0] = IndexEvaluator * [last()] = IndexEvaluator * [@ponum=3] = AttributeEvaluator * [lastname='Coolman'] = TextEvaluator * </code> * * @author Eric Coolman * */ class EvaluatorFactory { /** * Construct an evaluator for a given predicate expression. * * @param text a full predicate expression. * @return an Evaluator instance that can process the expression. */ public static Evaluator createEvaluator(String text) { if (isNumeric(text)) { return new IndexEvaluator(text); } else if (text.startsWith("@")) { return new AttributeEvaluator(text); } else if (text.indexOf(IndexEvaluator.FUNC_LAST) != -1) { return new IndexEvaluator(text); } else if (text.indexOf(TextEvaluator.FUNC_TEXT) != -1) { return new TextEvaluator(text); } else if (text.indexOf(IndexEvaluator.FUNC_POSITION) != -1) { return new IndexEvaluator(text); } else if (text.startsWith("@")) { return new AttributeEvaluator(text); } else if (text.indexOf('%') != -1) { return new ContainsEvaluator(text); } else if (text.indexOf('=') != -1) { return new TextEvaluator(text); } throw new IllegalStateException("Could not create a comparator for value: " + text); } /** * Test if string contains only digits. * * @param text * @return */ private static boolean isNumeric(String text) { text = text.trim(); int tlen = text.length(); for (int i = 0; i < tlen; i++) { if (Character.isDigit(text.charAt(i)) == false) { return false; } } return true; } }
836327ef86c62f34b593d16ee3da936a2d156902
f3589b17883d9d9cac7377fdbea24a58f90b34c5
/gc4ep-common/src/main/java/com/r2d2/common/service/impl/BaseDbServiceImpl.java
98de82a30fbee9455dfa5a0ddf189e968cd94f06
[]
no_license
zhikun-wang/gc4ep-server
eadd5160a2202804b319a0c580db60e6ea03c71a
af3e1deecce08e5092e6d6d9c2b2a69f8fc8cf1e
refs/heads/master
2020-03-15T03:03:44.760667
2018-06-12T09:35:17
2018-06-12T09:35:17
131,933,227
0
0
null
null
null
null
UTF-8
Java
false
false
2,850
java
package com.r2d2.common.service.impl; import com.r2d2.common.service.BaseDbService; import com.r2d2.common.util.SqlHelper; import java.util.HashMap; import java.util.List; import java.util.Map; /** Created by tim on 22/06/2017. */ public class BaseDbServiceImpl extends BaseServiceImpl implements BaseDbService { static Map<String, List<Map<String, Object>>> modelCache = new HashMap(); @Override public List<Map<String, Object>> queryTable(String modelName) { if (modelCache.containsKey(modelName)) { return modelCache.get(modelName); } String sql = "select table_name,column_name,column_type from information_schema.columns where table_schema = 'openapi' and table_name = ?"; List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{modelName}); if (!result.isEmpty()) { modelCache.put(modelName, result); } return result; } @Override public boolean isExist(String modelName) { return !queryTable(modelName).isEmpty(); } @Override public List<Map<String, Object>> allTable() { String sql = "select table_name from information_schema.tables where table_schema='openapi' and table_type='base table'"; return jdbcTemplate.queryForList(sql); } @Override public List<Map<String, Object>> refresh() { modelCache.clear(); return allTable(); } @Override public List<Map<String, Object>> query(String modelName, Map<String, Object> params) { String sql = SqlHelper.sqlQuery(modelName, queryTable(modelName), params); Object[] values = SqlHelper.modelValues(); return jdbcTemplate.queryForList(sql, values); } @Override public List<Map<String, Object>> all(String modelName) { return jdbcTemplate.queryForList(SqlHelper.sqlQuery(modelName, queryTable(modelName))); } @Override public int count(String modelName) { return jdbcTemplate.queryForObject(SqlHelper.sqlCount(modelName), Integer.class); } @Override public List<Map<String, Object>> paging(String modelName, Map<String, Object> params, int start, int limit) { return null; } @Override public int save(String modelName, Map<String, Object> model) { if (SqlHelper.isExistPK(model)) { delete(modelName, SqlHelper.getPK(model)); } String sql = SqlHelper.sqlInsert(modelName, queryTable(modelName), model); Object[] values = SqlHelper.modelValues(); return jdbcTemplate.update(sql, values); } @Override public int delete(String modelName, String pk) { String sql = SqlHelper.sqlDelete(modelName, queryTable(modelName)); int result = jdbcTemplate.update(sql, new Object[]{pk}); return result; } }
3a1a0ad50dc2c8f40ac268e64f76fd186661c05f
cff9d3da3ce757163a3b978c05992e1123c0e5ac
/src/com/biz/inout/service/InOutService_01.java
b66f0d27fedd80de4ff844a712fd4d29c66c9348
[]
no_license
rewit/Inoutcome01
2a60e0c36c6cd5254b3f7b55c5ab9bdcad49ee69
e5d961afdc16a7da4fbb5498fca1d5b5e4999c1e
refs/heads/master
2020-06-05T03:30:53.218824
2019-06-17T07:43:11
2019-06-17T07:43:11
192,298,720
0
0
null
null
null
null
UTF-8
Java
false
false
2,291
java
package com.biz.inout.service; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.biz.inout.model.InoutDto; import com.biz.inout.model.InoutVO; public class InOutService_01 { List<InoutVO> iolist; List<InoutDto> ioViewList; FileReader fileReader; BufferedReader buffer; public InOutService_01(String fileName) throws FileNotFoundException{ iolist = new ArrayList<InoutVO>(); ioViewList = new ArrayList<InoutDto>(); fileReader = new FileReader(fileName); buffer = new BufferedReader(fileReader); } public void readFile() throws IOException{ // vo에 담고, // list에 추가 String reader = ""; while(true) { reader = buffer.readLine(); if(reader == null) break; String[] iolists = reader.split(":"); InoutVO vo = new InoutVO(); vo.setIo_date(iolists[0]); vo.setPname(iolists[1]); vo.setInout(iolists[2]); vo.setPrice(Integer.valueOf(iolists[3])); vo.setAmt(Integer.valueOf(iolists[4])); iolist.add(vo); } } public void calcIolist() { // vo를 반복하면서 // 매입, 매출계산하고 // dto에 담아주고 for(InoutVO vo : iolist) { InoutDto dto = new InoutDto(); dto.setIo_date(vo.getIo_date()); dto.setPname(vo.getPname()); dto.setAmt(vo.getAmt()); dto.setPrice(vo.getPrice()); if(vo.getInout().equals("1")) { dto.setInout("매입"); int in_total = vo.getAmt() * vo.getPrice(); dto.setIn_total(in_total); } else { dto.setInout("매출"); int out_total = vo.getAmt() * vo.getPrice(); dto.setOut_total(out_total); } ioViewList.add(dto); } } public void listView() { // dto만 가지고 출력 System.out.println("매입매출 리스트"); System.out.println("========================"); System.out.println("일자\t구분\t상품명\t단가\t수량\t매입금액\t매출금액"); System.out.println("-------------------------"); for(InoutDto dto : ioViewList) { System.out.printf("%s\t%s\t%s\t%d\t%d\t%d\t%d\n", dto.getIo_date(), dto.getInout(), dto.getPname(), dto.getPrice(), dto.getAmt(), dto.getIn_total(), dto.getOut_total() ); } } }
934256bad5d57208debb0b2c2e5483c2387fc437
2deb528cf19d2fbe75233909c6f67c6d3fe5dfa2
/src/com/freefoam/productionreports/RecordEditText.java
9029ed430615d0749df829a8fb1314a7b85b6d28
[]
no_license
tonywalsh/machine-settings-app
4896d4461ad01df782d7afb7b17ce0bfc5f13bfb
ef5675333255d2a73d9f6649bcc927fba7b60f26
refs/heads/master
2021-01-10T22:01:29.406327
2013-06-16T22:14:07
2013-06-16T22:14:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
865
java
package com.freefoam.productionreports; import android.content.Context; import android.util.AttributeSet; import android.widget.EditText; public class RecordEditText extends EditText { private Boolean isActualValue; public RecordEditText(Context context) { super(context); this.isActualValue = false; } public RecordEditText(Context context, AttributeSet attrs) { super(context, attrs); this.isActualValue = false; } public RecordEditText(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.isActualValue = false; } public Boolean isActualValue() { return isActualValue; } public void setIsActualValue(Boolean isActualValue) { this.isActualValue = isActualValue; } public void disable() { this.setEnabled(false); this.setFocusable(false); this.setBackgroundColor(0xFF888888); } }
3c2f11197d2ebcedbc789ba580e81302cbeb89c5
ac831512fdd318caf1db0c64f8e7aa35f2a54eef
/catalogo/src/Goron/Fabrica_armago.java
6f17b0339b50f988b85a727d0f3ec5b44a29e71c
[]
no_license
JairoMurcia/abstract_factory
a8aa57819eff9b8cb27c9823333274fe74117b8f
96e6ffecd054bc5d82e388a3433914397e550c00
refs/heads/master
2020-07-25T04:55:12.465242
2019-09-13T01:07:38
2019-09-13T01:07:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
/* * 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 Goron; import clase_abstractas.Arma; import clase_abstractas.Arma_goron; import clase_abstractas.Fabrica_arma; /** * * @author jairo */ public class Fabrica_armago extends Fabrica_arma { public Arma get_arma(String tipo) { Arma_goron ag=null; if(tipo.equals("martillo")){ ag=new Martillo(); } return ag; } }
66f64f88826e214ddd29936a665e5145d24e0489
dd8dedf626ef9de4843e9f53196b8d62a75f4997
/BiDirectionalMappings/src/direction/dto/Passport.java
d4746f4f5d22e82eb594a753dbd1b83dece876e0
[]
no_license
ZanyKun/CodingAssignment
e6855290a01bc34d14440e356408ed44f47e37fa
e00940a1d58638332e769298290f38663a3d2fb4
refs/heads/master
2021-05-26T12:03:54.044074
2020-04-09T03:05:48
2020-04-09T03:05:48
254,125,669
0
0
null
null
null
null
UTF-8
Java
false
false
803
java
package direction.dto; import java.util.List; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @AllArgsConstructor @NoArgsConstructor @Data public class Passport{ @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "fk_passportid") int passportId; String countryOfOrigin; @ElementCollection List<String> visas; @OneToOne Person person; public Passport(String countryOfOrigin, List<String> visas) { this.countryOfOrigin = countryOfOrigin; this.visas = visas; } }
499e6364250c39911113cae6085c7da99ef93bd6
6badd20195bba380a7da878c3c4ad5609bc61074
/src/javaBean/Utente.java
839d627df4607d02aa8ed60e4c5487a723b31af0
[]
no_license
danielemazza/CampoTennis
a21119c8157d0fabeb4efc8da5427e5fa9b5d803
54744636ce395edfbe335c988572064d960e2bf1
refs/heads/master
2022-07-06T10:43:38.585748
2020-05-18T16:58:38
2020-05-18T16:58:38
265,001,468
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package javaBean; import java.io.Serializable; public class Utente implements Serializable { private static final long serialVersionUID=1L; String userName; String psw; String livello; public Utente() {} public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPsw() { return psw; } public void setPsw(String psw) { this.psw = psw; } public String getLivello() { return livello; } public void setLivello(String livello) { this.livello = livello; } }
463d5320b75309a4bf61aa2f8193b5defa363c5a
aa2fbe74bf9926c532894a3d018d4f0e84b8042b
/src/servlet/SelectLoveLiveUser.java
141a18805157a53176bdcb9fd44d9bb9000c3c04
[]
no_license
hluffy/database
e240036c5d6f12272e71b67055117a85f6f14e3c
fc9cf0efa49d051de93ad725e74bf7704c57cb31
refs/heads/master
2020-06-23T14:43:24.559857
2016-11-24T06:49:58
2016-11-24T06:49:58
74,645,201
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
3,642
java
package servlet; import java.io.IOException; import java.io.PrintWriter; //import java.sql.Connection; //import java.sql.DriverManager; //import java.sql.ResultSet; //import java.sql.Statement; import java.sql.*; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/lovelive") public class SelectLoveLiveUser extends HttpServlet{ /** * */ private static final long serialVersionUID = 1L; private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; private static final String JDBC_URL = "jdbc:mysql://localhost:3306/lovelive"; private static final String USERNAME = "root"; private static final String PASSWORD = "hanxiao"; public SelectLoveLiveUser(){ super(); } public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ response.setContentType("text/html;charset=UTF-8"); request.setCharacterEncoding("utf-8"); // String username = request.getParameter("username"); // System.out.println("cookies:"+request.getCookies()); // System.out.println("session:"+request.getSession()); // System.out.println("locale:"+request.getLocale()); // System.out.println("inputStream:"+request.getInputStream()); // System.out.println("type:"+request.getAuthType()); // System.out.println("encode:"+request.getCharacterEncoding()); // System.out.println("path:"+request.getContextPath()); // System.out.println("method:"+request.getMethod()); // System.out.println("pathInfo:"+request.getPathInfo()); // System.out.println("prot:"+request.getServerPort()); // System.out.println(username); // Enumeration headerNames = request.getHeaderNames(); // while(headerNames.hasMoreElements()){ // String headerName = (String)headerNames.nextElement(); // System.out.println(headerName+":"+request.getHeader(headerName)); // } Connection conn = null; Statement stat = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(JDBC_URL,USERNAME,PASSWORD); stat = conn.createStatement(); String sql ="select * from loveliveuser"; ResultSet result = stat.executeQuery(sql); PrintWriter out = response.getWriter(); String title = "Êý¾Ý¿â²âÊÔ"; String docType = "<!DOCTYPE html>\n"; out.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" + "</body><h1>loveliveÊý¾Ý</h1>\n"); while(result.next()){ int id = result.getInt("id"); String username =result.getString("username"); String password = result.getString("password"); // System.out.println("id:"+id); // System.out.println("username:"+username); // System.out.println("password:"+password); out.println("ID:" + id); out.print("<br/>UserName:"+username); out.println("<br/>PassWord:"+password+"<br/>"); } out.println("</body></html>"); result.close(); stat.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if(conn != null){ conn.close(); } } catch (Exception e2) { e2.printStackTrace(); } try { if(stat != null){ stat.close(); } } catch (Exception e2) { e2.printStackTrace(); } } } public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ doGet(request,response); } }
1348f74fe484c7882ab29b07bd2291c846a9367a
6dcb3cade201fc945b33899585404d4e17d462b7
/src/main/java/com/accp/action/wdg/AdvAction.java
eb7e13b773e566f06b1617a3a369c31cad328980
[]
no_license
QQTwo/qt
0850ecaf28aafa0d4f589703310b6d419879bd98
29b99eef693f81baf86fcc07a15f64ff8e67e9d3
refs/heads/master
2020-05-02T19:32:38.252483
2019-03-28T08:50:11
2019-03-28T08:50:11
178,161,467
0
0
null
null
null
null
UTF-8
Java
false
false
2,228
java
package com.accp.action.wdg; import java.io.File; import java.util.List; import java.util.UUID; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.accp.biz.wdg.AdvBiz; import com.accp.pojo.Advertisement; import com.accp.pojo.Advertisementtype; import com.accp.util.Base64ConvertImageUtil; import com.accp.vo.wdg.AdvertisementVo; import com.github.pagehelper.PageInfo; @RestController @RequestMapping("wdg") public class AdvAction { @Autowired private AdvBiz biz; // 查询所有广告 @GetMapping("advs/{atid}/{p}/{s}") public PageInfo<AdvertisementVo> queryAllAdvVo(@PathVariable Integer atid,@PathVariable Integer p,@PathVariable Integer s){ return biz.queryAllAdvVo(atid, p, s); } //删除广告 @DeleteMapping("adv/{ids}") public boolean removeAdv(@PathVariable String ids) { String [] temp = {ids}; return biz.removeAdv(temp); } //新增广告 @PostMapping("adv") public boolean addAdv(@RequestBody Advertisement adv,HttpSession session) { String hName = "."+adv.getAimgpath().substring(adv.getAimgpath().indexOf("/")+1, adv.getAimgpath().indexOf(";")); //重命名文件 String name = UUID.randomUUID().toString().replaceAll("-", "")+hName; String base64 = adv.getAimgpath().substring(adv.getAimgpath().indexOf(";")+8); String path = System.getProperty("user.dir")+"\\src\\main\\resources\\static\\uploadImg"+File.separator+ name; //保存图片至服务器 Base64ConvertImageUtil.generateImageFromBase64(base64,path); adv.setAimgpath("/uploadImg/"+name); return biz.addAdv(adv); } //查询所有广告分类 @GetMapping("adv/types") public List<Advertisementtype> queryAllType(){ return biz.queryAllAdv(); } }
abad8481c7232b0f2af54e4e62e380c9a642f8df
26966ff02e4ecf149f6a1369c888be033c0088b3
/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/work/Catalina/localhost/Library_Management_System/org/apache/jsp/EventList_jsp.java
7783924cbe6bf84d82c7dd53c3d73691739d9b29
[]
no_license
SHIVAKUMAR89/spring
48660016f34ee625e32cc334fcf28b330b4a8319
4e7474af082eef5ced0af7d46356babb22c0c9f2
refs/heads/master
2020-04-29T21:54:38.442687
2019-03-19T05:23:31
2019-03-19T05:23:31
176,429,272
0
0
null
null
null
null
UTF-8
Java
false
false
5,400
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.92 * Generated at: 2019-03-12 05:16:32 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.*; import com.beans.*; public final class EventList_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private volatile javax.el.ExpressionFactory _el_expressionfactory; private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public javax.el.ExpressionFactory _jsp_getExpressionFactory() { if (_el_expressionfactory == null) { synchronized (this) { if (_el_expressionfactory == null) { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); } } } return _el_expressionfactory; } public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { if (_jsp_instancemanager == null) { synchronized (this) { if (_jsp_instancemanager == null) { _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } } } return _jsp_instancemanager; } public void _jspInit() { } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write(" \r\n"); out.write("\r\n"); out.write("<!DOCTYPE html>\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta charset=\"ISO-8859-1\">\r\n"); out.write("<title>Event List</title>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("\r\n"); out.write("<form>\r\n"); out.write("\r\n"); out.write("<table border=1>\r\n"); out.write("<tr>\r\n"); out.write("<th>Event Name</th><th>Date</th><th>Event_MName</th><th>Event ContactNo</th><th>Event Mail</th><th>Venue</th>\r\n"); out.write("\r\n"); out.write("</tr>\r\n"); out.write("\r\n"); ArrayList<EventsInfo> al=(ArrayList)request.getAttribute("event"); Iterator<EventsInfo> it=al.iterator(); while(it.hasNext()){ EventsInfo d= (EventsInfo)it.next(); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\t\t\r\n"); out.write("\t\t<tr>\r\n"); out.write("\t\t<td>"); out.print(d.getE_Name() ); out.write("</td>\r\n"); out.write("\t\t<td>"); out.print(d.getE_Date() ); out.write("</td>\r\n"); out.write("\t\t<td>"); out.print(d.getE_MName() ); out.write("</td>\r\n"); out.write("\t\t<td>"); out.print(d.getContactNo() ); out.write("</td>\r\n"); out.write("\t\t<td>"); out.print(d.getE_Email() ); out.write("</td>\r\n"); out.write("\t\t<td>"); out.print(d.getVenue() ); out.write("</td>\r\n"); out.write("\t\t\r\n"); out.write("\t\t</tr>\r\n"); out.write("\t\t\t\r\n"); } out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("</table>\r\n"); out.write("</form>\r\n"); out.write("</body>\r\n"); out.write("</html>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
75b8e3542e89e0d94d887a78a09b0e9c0daeab16
54a235621e41fc9d7ed9246ee62bd2b478982c0c
/src/com/jafnee/sudoku/main/Start.java
7ac7866405ebffefee8aeeddfdd13baf1fdc3f97
[ "MIT" ]
permissive
Jafnee/Java-Sudoku-Solver
a92ed9f4fe0327efa3d7912061ddad0094ad48b3
dcdc87c44e65c678e4c9607c6c6ad41ff10d0ab5
refs/heads/master
2021-01-23T08:15:03.378300
2014-10-06T02:01:17
2014-10-06T02:01:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
/* * 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 com.jafnee.sudoku.main; /** * * @author Jafnee */ public class Start { /** * @param args the command line arguments */ public static void main(String[] args) { Main main = new Main(); } }
8188a15e048b19c3198fecbbfd43b5e15314b100
0c339dd0878a3daf79a2626680d2d1da9a47f476
/leyou/leyou-upload/src/main/java/com/leyou/LeyouUploadApplication.java
611f55bdf0d3b0e7ff586a3859ce8763dfdeee75
[]
no_license
bfzui6/leyou
9b5ccce04611648c04534edf0c91c7d3563c69fd
f87c7de2768f517f6723fa0ea435ae4e3dff20d3
refs/heads/master
2022-12-04T11:26:31.334546
2019-11-22T15:38:24
2019-11-22T15:38:24
223,432,892
0
0
null
2022-11-16T10:55:47
2019-11-22T15:33:31
Java
UTF-8
Java
false
false
411
java
package com.leyou; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication @EnableDiscoveryClient public class LeyouUploadApplication { public static void main(String[] args) { SpringApplication.run(LeyouUploadApplication.class); } }
01d15af8baf86157955c42f9067ef5406cca6561
3ced87120434ea0853c66a7b21f21c0d3bca5eb3
/Framesday8task/frames.java
e49a03cea6d0c17e790e530c8cb681a111622595
[]
no_license
hussain386/SeliniumAllTasks
5c3c3447955acdf79f13d91397abc84ede36ba8c
d3b29760289917bbfe795da482661261788922f5
refs/heads/master
2023-07-21T22:53:20.821361
2021-09-02T15:51:00
2021-09-02T15:51:00
402,476,498
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package Framesday8task; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class frames { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\Users\\hussain\\eclipse-workspace\\Seliniumtestingweb\\src\\Drivers\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://www.leafground.com/pages/frame.html"); driver.manage().window().maximize(); WebElement fisrtclick = driver.findElement(By.xpath("//iframe[@src='default.html']")); driver.switchTo().frame(fisrtclick); Thread.sleep(1000); WebElement clickme = driver.findElement(By.id("Click")); clickme.click(); Thread.sleep(1000); driver.switchTo().frame("frame2"); WebElement clickme2 = driver.findElement(By.id("Click1")); clickme2.click(); driver.switchTo().defaultContent(); List<WebElement> framescount = driver.findElements(By.tagName("iframe")); int size = framescount.size(); System.out.println("framescount:"+size); } }
c9afbfd84a3b9da65c8427c158a417e8eab32e46
99e0a15256f94d4d5fb84bac7514de6b1e9269f9
/git_private/src/cn/itcast/Git_test.java
2d4ae019774d8da299f7ee740fa6220e0423a340
[]
no_license
liyan199411/java264
a6103703673f9cc5688cca671117e7f89008dbe5
bdeaa196cc1246d4ffc95d74ce86fde024619af4
refs/heads/master
2021-06-30T14:28:46.328434
2017-09-22T06:07:12
2017-09-22T06:07:12
104,352,815
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
136
java
package cn.itcast; public class Git_test { public static void main(String[] args) { System.out.println("ÄãºÃ"); } }
d4567bd4e82d8beb0b9eeeddee5eebd8aa52354e
779d79a3c893f4c17ba82819e2404a74dc541b90
/src/gui/EmailPanel.java
8dda81a714b0cdc2a0bd24a88cc284ed4634f690
[]
no_license
vholmstedt/imaptalk
8a6eb33f3e9c16e1762360e1295069d9aaa2f1ba
b5dfb41d1cefc55354934c17156be310a8a755f5
refs/heads/master
2020-04-28T09:44:12.265731
2019-03-12T09:57:02
2019-03-12T09:57:02
175,176,389
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
/* * EmailPanel.java er en kildefil til boken "Objektorientert programmering med Java" * * **** Tredje opplag **** * * Boken er utgitt på http://www.fagbokforlaget.no * * ISBN 978-82-7674-748-5 * * Viggo Holmstedt 2002 - 2019 * ------------------------------------------- * File location: kap_17/imap/gui/ * Last modified: 2019-03-05 12:28 * */ package gui; import java.awt.BorderLayout; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.Border; import logic.EmailLogic; public class EmailPanel extends JPanel { public EmailPanel(EmailLogic emailLogic) { setLayout(new BorderLayout()); add(new JScrollPane(new JList<String>(emailLogic.someInfoAsListModel() ) { { setFont(new Font("monospace", Font.PLAIN, 14)); } }) { { Border border = BorderFactory.createEmptyBorder(); setBorder(border); } }); } }
551acc3c4debcb8f43c433fdd41ea12f3fd4901d
5b14fbb5ff835cda9e49a516d14951215279c480
/Day2.java
3f031e21abd2e83de462df376cb6038a60e6e030
[]
no_license
jessepatch/AdventOfCode2018
7f8d9c8b0d6874842304f7d841d8ff6490dd91f5
1fcbca1f2445488c3fa325d42eb03101939867f8
refs/heads/master
2020-04-09T10:17:16.647659
2018-12-14T01:23:12
2018-12-14T01:23:12
160,265,627
0
0
null
null
null
null
UTF-8
Java
false
false
1,914
java
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class Day2 { static String fileName = "C:\\Training\\Save Data\\AoC-day2.txt"; static ArrayList<String> allIds = new ArrayList<String>(); public static void main(String[] args) { compareBoxId(); findDifferences(); } public static void compareBoxId() { int twoCount = 0; int threeCount = 0; int checkSum = 0; Scanner scanner = null; try { scanner = new Scanner(new File(fileName)); } catch (FileNotFoundException ex) {} while(scanner.hasNext()) { String id = scanner.next(); allIds.add(id); int tempTwoCount = 0; int tempThreeCount = 0; for(int i = 0; i < id.length(); i++) { int matchCount = 0; for(int j = i + 1; j < id.length(); j++) { if(id.charAt(i) == id.charAt(j)) { matchCount++; } } if(matchCount == 1) { tempTwoCount++; } else if (matchCount == 2) { tempThreeCount++; } } if(tempThreeCount > 0) { threeCount++; } if(tempTwoCount - tempThreeCount > 0) { twoCount++; } } checkSum = twoCount * threeCount; System.out.println("CheckSum = " + checkSum); } public static void findDifferences() { int differenceCount = 0; String string1 = ""; String string2 = ""; int differenceAt = 0; for(int i = 0; i < allIds.size(); i++) { for(int j = i + 1; j < allIds.size(); j++) { differenceCount = 0; for(int k = 0; k < allIds.get(i).length(); k++) { if(allIds.get(i).charAt(k) != allIds.get(j).charAt(k)) { differenceCount++; differenceAt = k; } } if( differenceCount == 1) { string1 = allIds.get(i); string2 = allIds.get(j); String inCommon = string1.substring(0, differenceAt) + string1.substring(differenceAt + 1); System.out.println("They have " + inCommon + " in common"); } } } } }
2eb4b742157ee7165fb3a4a441b9778debdd9d96
7d80e2c5156bbf1b8d10e0f190f5653e0bb27158
/src/main/java/examples/hibernate/user/dao/UserDao.java
dbd23e0ff64209ffa05185e3c85ed09152261e97
[]
no_license
alexace013/examples-project
a0246c483fe43a697637ba47ee44c4f2dae1e6fe
ed9908c870df20da4796bb3da48d65f8472c546b
refs/heads/master
2022-11-29T23:34:14.265144
2018-04-06T19:53:01
2018-04-06T19:53:01
74,712,174
1
0
null
2022-11-24T07:56:00
2016-11-25T00:01:25
Java
UTF-8
Java
false
false
272
java
package examples.hibernate.user.dao; import examples.hibernate.user.User; import java.util.List; public interface UserDao { void create(User user); User read(Integer id); void update(User user); void delete(User user); List<User> findAll(); }
880067cc42dd430aa19c8263eb814f8f66c4b787
79f93f5228b8e000f52a8b93be5c18dbd39ea708
/src/main/java/br/net/luana/sistema/repositories/corRepositories/CorRepository.java
eb35759eb5d30cb3fcfc0c60547b392b2d8c0f19
[]
no_license
Luan-Ferrari/br.net.luana.SistemaEstoque
c5d79bb91cdb76e0baabd922fcc398574c8ca408
ac3e3e5a117033dc5229d4c7fe5da552b24451c0
refs/heads/master
2023-07-18T20:45:36.080383
2021-09-28T11:03:53
2021-09-28T11:03:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
package br.net.luana.sistema.repositories.corRepositories; import br.net.luana.sistema.domain.cores.Cor; import br.net.luana.sistema.repositories.MasterRepository; import org.springframework.stereotype.Repository; @Repository public interface CorRepository<T extends Cor, ID extends Integer> extends MasterRepository<T, ID> { Cor findByReferenciaNaFabrica(String referenciaNaFabrica); }
9e8dbf0e8b7edc86418f7df443ff67e0a96e92be
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_2a0eb2acdc369734e1264c8d8f9955d704508b53/StkAppService/8_2a0eb2acdc369734e1264c8d8f9955d704508b53_StkAppService_s.java
cce545f7ed2edc4d670a3d4657aece8aa2ff0942
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
29,371
java
/* * Copyright (C) 2007 The Android Open Source Project * * 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.android.stk; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.telephony.TelephonyManager; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.RemoteViews; import android.widget.TextView; import android.widget.Toast; import com.android.internal.telephony.cat.AppInterface; import com.android.internal.telephony.cat.Menu; import com.android.internal.telephony.cat.Item; import com.android.internal.telephony.cat.Input; import com.android.internal.telephony.cat.ResultCode; import com.android.internal.telephony.cat.CatCmdMessage; import com.android.internal.telephony.cat.CatCmdMessage.BrowserSettings; import com.android.internal.telephony.cat.CatLog; import com.android.internal.telephony.cat.CatResponseMessage; import com.android.internal.telephony.cat.TextMessage; import java.util.LinkedList; /** * SIM toolkit application level service. Interacts with Telephopny messages, * application's launch and user input from STK UI elements. * */ public class StkAppService extends Service implements Runnable { // members private volatile Looper mServiceLooper; private volatile ServiceHandler mServiceHandler; private AppInterface mStkService; private Context mContext = null; private CatCmdMessage mMainCmd = null; private CatCmdMessage mCurrentCmd = null; private Menu mCurrentMenu = null; private String lastSelectedItem = null; private boolean mMenuIsVisibile = false; private boolean responseNeeded = true; private boolean mCmdInProgress = false; private NotificationManager mNotificationManager = null; private LinkedList<DelayedCmd> mCmdsQ = null; private boolean launchBrowser = false; private BrowserSettings mBrowserSettings = null; static StkAppService sInstance = null; // Used for setting FLAG_ACTIVITY_NO_USER_ACTION when // creating an intent. private enum InitiatedByUserAction { yes, // The action was started via a user initiated action unknown, // Not known for sure if user initated the action } // constants static final String OPCODE = "op"; static final String CMD_MSG = "cmd message"; static final String RES_ID = "response id"; static final String MENU_SELECTION = "menu selection"; static final String INPUT = "input"; static final String HELP = "help"; static final String CONFIRMATION = "confirm"; // operations ids for different service functionality. static final int OP_CMD = 1; static final int OP_RESPONSE = 2; static final int OP_LAUNCH_APP = 3; static final int OP_END_SESSION = 4; static final int OP_BOOT_COMPLETED = 5; private static final int OP_DELAYED_MSG = 6; // Response ids static final int RES_ID_MENU_SELECTION = 11; static final int RES_ID_INPUT = 12; static final int RES_ID_CONFIRM = 13; static final int RES_ID_DONE = 14; static final int RES_ID_TIMEOUT = 20; static final int RES_ID_BACKWARD = 21; static final int RES_ID_END_SESSION = 22; static final int RES_ID_EXIT = 23; private static final String PACKAGE_NAME = "com.android.stk"; private static final String MENU_ACTIVITY_NAME = PACKAGE_NAME + ".StkMenuActivity"; private static final String INPUT_ACTIVITY_NAME = PACKAGE_NAME + ".StkInputActivity"; // Notification id used to display Idle Mode text in NotificationManager. private static final int STK_NOTIFICATION_ID = 333; // Inner class used for queuing telephony messages (proactive commands, // session end) while the service is busy processing a previous message. private class DelayedCmd { // members int id; CatCmdMessage msg; DelayedCmd(int id, CatCmdMessage msg) { this.id = id; this.msg = msg; } } @Override public void onCreate() { // Initialize members mStkService = com.android.internal.telephony.cat.CatService .getInstance(); // NOTE mStkService is a singleton and continues to exist even if the GSMPhone is disposed // after the radio technology change from GSM to CDMA so the PHONE_TYPE_CDMA check is // needed. In case of switching back from CDMA to GSM the GSMPhone constructor updates // the instance. (TODO: test). if ((mStkService == null) && (TelephonyManager.getDefault().getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA)) { CatLog.d(this, " Unable to get Service handle"); return; } mCmdsQ = new LinkedList<DelayedCmd>(); Thread serviceThread = new Thread(null, this, "Stk App Service"); serviceThread.start(); mContext = getBaseContext(); mNotificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); sInstance = this; } @Override public void onStart(Intent intent, int startId) { waitForLooper(); // onStart() method can be passed a null intent // TODO: replace onStart() with onStartCommand() if (intent == null) { return; } Bundle args = intent.getExtras(); if (args == null) { return; } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = args.getInt(OPCODE); switch(msg.arg1) { case OP_CMD: msg.obj = args.getParcelable(CMD_MSG); break; case OP_RESPONSE: msg.obj = args; /* falls through */ case OP_LAUNCH_APP: case OP_END_SESSION: case OP_BOOT_COMPLETED: break; default: return; } mServiceHandler.sendMessage(msg); } @Override public void onDestroy() { waitForLooper(); mServiceLooper.quit(); } @Override public IBinder onBind(Intent intent) { return null; } public void run() { Looper.prepare(); mServiceLooper = Looper.myLooper(); mServiceHandler = new ServiceHandler(); Looper.loop(); } /* * Package api used by StkMenuActivity to indicate if its on the foreground. */ void indicateMenuVisibility(boolean visibility) { mMenuIsVisibile = visibility; } /* * Package api used by StkMenuActivity to get its Menu parameter. */ Menu getMenu() { return mCurrentMenu; } /* * Package api used by UI Activities and Dialogs to communicate directly * with the service to deliver state information and parameters. */ static StkAppService getInstance() { return sInstance; } private void waitForLooper() { while (mServiceHandler == null) { synchronized (this) { try { wait(100); } catch (InterruptedException e) { } } } } private final class ServiceHandler extends Handler { @Override public void handleMessage(Message msg) { int opcode = msg.arg1; switch (opcode) { case OP_LAUNCH_APP: if (mMainCmd == null) { // nothing todo when no SET UP MENU command didn't arrive. return; } launchMenuActivity(null); break; case OP_CMD: CatCmdMessage cmdMsg = (CatCmdMessage) msg.obj; // There are two types of commands: // 1. Interactive - user's response is required. // 2. Informative - display a message, no interaction with the user. // // Informative commands can be handled immediately without any delay. // Interactive commands can't override each other. So if a command // is already in progress, we need to queue the next command until // the user has responded or a timeout expired. if (!isCmdInteractive(cmdMsg)) { handleCmd(cmdMsg); } else { if (!mCmdInProgress) { mCmdInProgress = true; handleCmd((CatCmdMessage) msg.obj); } else { mCmdsQ.addLast(new DelayedCmd(OP_CMD, (CatCmdMessage) msg.obj)); } } break; case OP_RESPONSE: if (responseNeeded) { handleCmdResponse((Bundle) msg.obj); } // call delayed commands if needed. if (mCmdsQ.size() != 0) { callDelayedMsg(); } else { mCmdInProgress = false; } // reset response needed state var to its original value. responseNeeded = true; break; case OP_END_SESSION: if (!mCmdInProgress) { mCmdInProgress = true; handleSessionEnd(); } else { mCmdsQ.addLast(new DelayedCmd(OP_END_SESSION, null)); } break; case OP_BOOT_COMPLETED: CatLog.d(this, "OP_BOOT_COMPLETED"); if (mMainCmd == null) { StkAppInstaller.unInstall(mContext); } break; case OP_DELAYED_MSG: handleDelayedCmd(); break; } } } private boolean isCmdInteractive(CatCmdMessage cmd) { switch (cmd.getCmdType()) { case SEND_DTMF: case SEND_SMS: case SEND_SS: case SEND_USSD: case SET_UP_IDLE_MODE_TEXT: case SET_UP_MENU: return false; } return true; } private void handleDelayedCmd() { if (mCmdsQ.size() != 0) { DelayedCmd cmd = mCmdsQ.poll(); switch (cmd.id) { case OP_CMD: handleCmd(cmd.msg); break; case OP_END_SESSION: handleSessionEnd(); break; } } } private void callDelayedMsg() { Message msg = mServiceHandler.obtainMessage(); msg.arg1 = OP_DELAYED_MSG; mServiceHandler.sendMessage(msg); } private void handleSessionEnd() { mCurrentCmd = mMainCmd; lastSelectedItem = null; // In case of SET UP MENU command which removed the app, don't // update the current menu member. if (mCurrentMenu != null && mMainCmd != null) { mCurrentMenu = mMainCmd.getMenu(); } if (mMenuIsVisibile) { launchMenuActivity(null); } if (mCmdsQ.size() != 0) { callDelayedMsg(); } else { mCmdInProgress = false; } // In case a launch browser command was just confirmed, launch that url. if (launchBrowser) { launchBrowser = false; launchBrowser(mBrowserSettings); } } private void handleCmd(CatCmdMessage cmdMsg) { if (cmdMsg == null) { return; } // save local reference for state tracking. mCurrentCmd = cmdMsg; boolean waitForUsersResponse = true; CatLog.d(this, cmdMsg.getCmdType().name()); switch (cmdMsg.getCmdType()) { case DISPLAY_TEXT: TextMessage msg = cmdMsg.geTextMessage(); responseNeeded = msg.responseNeeded; if (lastSelectedItem != null) { msg.title = lastSelectedItem; } else if (mMainCmd != null){ msg.title = mMainCmd.getMenu().title; } else { // TODO: get the carrier name from the SIM msg.title = ""; } launchTextDialog(); break; case SELECT_ITEM: mCurrentMenu = cmdMsg.getMenu(); launchMenuActivity(cmdMsg.getMenu()); break; case SET_UP_MENU: mMainCmd = mCurrentCmd; mCurrentMenu = cmdMsg.getMenu(); if (removeMenu()) { CatLog.d(this, "Uninstall App"); mCurrentMenu = null; StkAppInstaller.unInstall(mContext); } else { CatLog.d(this, "Install App"); StkAppInstaller.install(mContext); } if (mMenuIsVisibile) { launchMenuActivity(null); } break; case GET_INPUT: case GET_INKEY: launchInputActivity(); break; case SET_UP_IDLE_MODE_TEXT: waitForUsersResponse = false; launchIdleText(); break; case SEND_DTMF: case SEND_SMS: case SEND_SS: case SEND_USSD: waitForUsersResponse = false; launchEventMessage(); break; case LAUNCH_BROWSER: launchConfirmationDialog(mCurrentCmd.geTextMessage()); break; case SET_UP_CALL: launchConfirmationDialog(mCurrentCmd.getCallSettings().confirmMsg); break; case PLAY_TONE: launchToneDialog(); break; } if (!waitForUsersResponse) { if (mCmdsQ.size() != 0) { callDelayedMsg(); } else { mCmdInProgress = false; } } } private void handleCmdResponse(Bundle args) { if (mCurrentCmd == null) { return; } CatResponseMessage resMsg = new CatResponseMessage(mCurrentCmd); // set result code boolean helpRequired = args.getBoolean(HELP, false); switch(args.getInt(RES_ID)) { case RES_ID_MENU_SELECTION: CatLog.d(this, "RES_ID_MENU_SELECTION"); int menuSelection = args.getInt(MENU_SELECTION); switch(mCurrentCmd.getCmdType()) { case SET_UP_MENU: case SELECT_ITEM: lastSelectedItem = getItemName(menuSelection); if (helpRequired) { resMsg.setResultCode(ResultCode.HELP_INFO_REQUIRED); } else { resMsg.setResultCode(ResultCode.OK); } resMsg.setMenuSelection(menuSelection); break; } break; case RES_ID_INPUT: CatLog.d(this, "RES_ID_INPUT"); String input = args.getString(INPUT); Input cmdInput = mCurrentCmd.geInput(); if (cmdInput != null && cmdInput.yesNo) { boolean yesNoSelection = input .equals(StkInputActivity.YES_STR_RESPONSE); resMsg.setYesNo(yesNoSelection); } else { if (helpRequired) { resMsg.setResultCode(ResultCode.HELP_INFO_REQUIRED); } else { resMsg.setResultCode(ResultCode.OK); resMsg.setInput(input); } } break; case RES_ID_CONFIRM: CatLog.d(this, "RES_ID_CONFIRM"); boolean confirmed = args.getBoolean(CONFIRMATION); switch (mCurrentCmd.getCmdType()) { case DISPLAY_TEXT: resMsg.setResultCode(confirmed ? ResultCode.OK : ResultCode.UICC_SESSION_TERM_BY_USER); break; case LAUNCH_BROWSER: resMsg.setResultCode(confirmed ? ResultCode.OK : ResultCode.UICC_SESSION_TERM_BY_USER); if (confirmed) { launchBrowser = true; mBrowserSettings = mCurrentCmd.getBrowserSettings(); } break; case SET_UP_CALL: resMsg.setResultCode(ResultCode.OK); resMsg.setConfirmation(confirmed); if (confirmed) { launchCallMsg(); } break; } break; case RES_ID_DONE: resMsg.setResultCode(ResultCode.OK); break; case RES_ID_BACKWARD: CatLog.d(this, "RES_ID_BACKWARD"); resMsg.setResultCode(ResultCode.BACKWARD_MOVE_BY_USER); break; case RES_ID_END_SESSION: CatLog.d(this, "RES_ID_END_SESSION"); resMsg.setResultCode(ResultCode.UICC_SESSION_TERM_BY_USER); break; case RES_ID_TIMEOUT: CatLog.d(this, "RES_ID_TIMEOUT"); // GCF test-case 27.22.4.1.1 Expected Sequence 1.5 (DISPLAY TEXT, // Clear message after delay, successful) expects result code OK. // If the command qualifier specifies no user response is required // then send OK instead of NO_RESPONSE_FROM_USER if ((mCurrentCmd.getCmdType().value() == AppInterface.CommandType.DISPLAY_TEXT .value()) && (mCurrentCmd.geTextMessage().userClear == false)) { resMsg.setResultCode(ResultCode.OK); } else { resMsg.setResultCode(ResultCode.NO_RESPONSE_FROM_USER); } break; default: CatLog.d(this, "Unknown result id"); return; } mStkService.onCmdResponse(resMsg); } /** * Returns 0 or FLAG_ACTIVITY_NO_USER_ACTION, 0 means the user initiated the action. * * @param userAction If the userAction is yes then we always return 0 otherwise * mMenuIsVisible is used to determine what to return. If mMenuIsVisible is true * then we are the foreground app and we'll return 0 as from our perspective a * user action did cause. If it's false than we aren't the foreground app and * FLAG_ACTIVITY_NO_USER_ACTION is returned. * * @return 0 or FLAG_ACTIVITY_NO_USER_ACTION */ private int getFlagActivityNoUserAction(InitiatedByUserAction userAction) { return ((userAction == InitiatedByUserAction.yes) | mMenuIsVisibile) ? 0 : Intent.FLAG_ACTIVITY_NO_USER_ACTION; } private void launchMenuActivity(Menu menu) { Intent newIntent = new Intent(Intent.ACTION_VIEW); newIntent.setClassName(PACKAGE_NAME, MENU_ACTIVITY_NAME); int intentFlags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP; if (menu == null) { // We assume this was initiated by the user pressing the tool kit icon intentFlags |= getFlagActivityNoUserAction(InitiatedByUserAction.yes); newIntent.putExtra("STATE", StkMenuActivity.STATE_MAIN); } else { // We don't know and we'll let getFlagActivityNoUserAction decide. intentFlags |= getFlagActivityNoUserAction(InitiatedByUserAction.unknown); newIntent.putExtra("STATE", StkMenuActivity.STATE_SECONDARY); } newIntent.setFlags(intentFlags); mContext.startActivity(newIntent); } private void launchInputActivity() { Intent newIntent = new Intent(Intent.ACTION_VIEW); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | getFlagActivityNoUserAction(InitiatedByUserAction.unknown)); newIntent.setClassName(PACKAGE_NAME, INPUT_ACTIVITY_NAME); newIntent.putExtra("INPUT", mCurrentCmd.geInput()); mContext.startActivity(newIntent); } private void launchTextDialog() { Intent newIntent = new Intent(this, StkDialogActivity.class); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | getFlagActivityNoUserAction(InitiatedByUserAction.unknown)); newIntent.putExtra("TEXT", mCurrentCmd.geTextMessage()); startActivity(newIntent); } private void launchEventMessage() { TextMessage msg = mCurrentCmd.geTextMessage(); if (msg == null || msg.text == null) { return; } Toast toast = new Toast(mContext.getApplicationContext()); LayoutInflater inflate = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflate.inflate(R.layout.stk_event_msg, null); TextView tv = (TextView) v .findViewById(com.android.internal.R.id.message); ImageView iv = (ImageView) v .findViewById(com.android.internal.R.id.icon); if (msg.icon != null) { iv.setImageBitmap(msg.icon); } else { iv.setVisibility(View.GONE); } if (!msg.iconSelfExplanatory) { tv.setText(msg.text); } toast.setView(v); toast.setDuration(Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show(); } private void launchConfirmationDialog(TextMessage msg) { msg.title = lastSelectedItem; Intent newIntent = new Intent(this, StkDialogActivity.class); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | getFlagActivityNoUserAction(InitiatedByUserAction.unknown)); newIntent.putExtra("TEXT", msg); startActivity(newIntent); } private void launchBrowser(BrowserSettings settings) { if (settings == null) { return; } // Set browser launch mode Intent intent = new Intent(); intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); // to launch home page, make sure that data Uri is null. Uri data = null; if (settings.url != null) { CatLog.d(this, "settings.url = " + settings.url); if (settings.url.startsWith("http://")) { data = Uri.parse(settings.url); } else { String modifiedUrl = "http://" + settings.url; CatLog.d(this, "modifiedUrl = " + modifiedUrl); data = Uri.parse(modifiedUrl); } } else { // If no URL specified, just bring up the "home page". // // (Note we need to specify *something* in the intent's data field // here, since if you fire off a VIEW intent with no data at all // you'll get an activity chooser rather than the browser. There's // no specific URI that means "use the default home page", so // instead let's just explicitly bring up http://google.com.) data = Uri.parse("http://google.com/"); } intent.setData(data); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); switch (settings.mode) { case USE_EXISTING_BROWSER: intent.setAction(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); break; case LAUNCH_NEW_BROWSER: intent.setAction(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); break; case LAUNCH_IF_NOT_ALREADY_LAUNCHED: intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); break; } // start browser activity startActivity(intent); // a small delay, let the browser start, before processing the next command. // this is good for scenarios where a related DISPLAY TEXT command is // followed immediately. try { Thread.sleep(10000); } catch (InterruptedException e) {} } private void launchCallMsg() { TextMessage msg = mCurrentCmd.getCallSettings().callMsg; if (msg.text == null || msg.text.length() == 0) { return; } msg.title = lastSelectedItem; Toast toast = Toast.makeText(mContext.getApplicationContext(), msg.text, Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show(); } private void launchIdleText() { TextMessage msg = mCurrentCmd.geTextMessage(); if (msg == null) { CatLog.d(this, "mCurrentCmd.getTextMessage is NULL"); return; } if (msg.text == null) { mNotificationManager.cancel(STK_NOTIFICATION_ID); } else { Notification notification = new Notification(); RemoteViews contentView = new RemoteViews( PACKAGE_NAME, com.android.internal.R.layout.status_bar_latest_event_content); notification.flags |= Notification.FLAG_NO_CLEAR; notification.icon = com.android.internal.R.drawable.stat_notify_sim_toolkit; // Set text and icon for the status bar and notification body. if (!msg.iconSelfExplanatory) { notification.tickerText = msg.text; contentView.setTextViewText(com.android.internal.R.id.text, msg.text); } if (msg.icon != null) { contentView.setImageViewBitmap(com.android.internal.R.id.icon, msg.icon); } else { contentView .setImageViewResource( com.android.internal.R.id.icon, com.android.internal.R.drawable.stat_notify_sim_toolkit); } notification.contentView = contentView; notification.contentIntent = PendingIntent.getService(mContext, 0, new Intent(mContext, StkAppService.class), 0); mNotificationManager.notify(STK_NOTIFICATION_ID, notification); } } private void launchToneDialog() { Intent newIntent = new Intent(this, ToneDialog.class); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | getFlagActivityNoUserAction(InitiatedByUserAction.unknown)); newIntent.putExtra("TEXT", mCurrentCmd.geTextMessage()); newIntent.putExtra("TONE", mCurrentCmd.getToneSettings()); startActivity(newIntent); } private String getItemName(int itemId) { Menu menu = mCurrentCmd.getMenu(); if (menu == null) { return null; } for (Item item : menu.items) { if (item.id == itemId) { return item.text; } } return null; } private boolean removeMenu() { try { if (mCurrentMenu.items.size() == 1 && mCurrentMenu.items.get(0) == null) { return true; } } catch (NullPointerException e) { CatLog.d(this, "Unable to get Menu's items size"); return true; } return false; } }
0297cc78a40eac4d01fb368c5b115fe8a8058cfe
dfee389cc25dbb8341aeb19153e545649c01ba49
/src/animals/Duck.java
3393afc1a1de132116136236129ef6f00a1978cb
[]
no_license
jeflora/OOPExampleZoo
eda382a3c74a744376c833d708ac85d887de3c73
d0bd60569f8e451c560db9f92247711bfd3f1931
refs/heads/main
2023-04-03T01:36:26.600553
2021-04-13T10:45:56
2021-04-13T10:45:56
357,515,216
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package animals; import common.Gender; public class Duck extends Animal { // The class Duck extends Animal, so it inherits all the attributes and methods public Duck(String name, int age, Gender gender) { super(name, age, gender); } // This method will make the adequate noise public void makeNoise() { System.out.println("quack quack"); } // String formatter for printing the object public String toString() { return String.format("A %s Duck - Name: %s, Age: %d", this.gender.name().toLowerCase(), this.name, this.age); } }
c4e68b9ff1f902b29f01fee30fc8c7ed02657d80
8d10d96938ce5fb669200840406ace56ca3d522d
/src/test/java/com/cybertek/utilities/WebDriverFactory.java
e1556c087adf7967138fb9ce778905408c8dff62
[]
no_license
Hilal31/fall2019_selenium
a6d6b7d19432f94dac347c87136707c06e57b427
ecc7bf1d7fb30ca0aee21c631a8985fe7e1eab85
refs/heads/master
2023-05-25T13:21:12.949427
2020-04-01T17:51:24
2020-04-01T17:51:24
244,789,674
0
0
null
2023-05-09T18:45:24
2020-03-04T02:31:29
Java
UTF-8
Java
false
false
1,022
java
package com.cybertek.utilities; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class WebDriverFactory { // write a static return method which returns WebDriver // method name is : getDriver // it takes a String as a parameter --> browser type like Chrome, Firefox // returns ChromeDriver and FirefoxDriver String chrome = "Chrome"; String firefox = "Firefox"; public static WebDriver getDriver(String browserType) { //local variables WebDriver driver = null; switch (browserType.toLowerCase()){ case "chrome" : WebDriverManager.chromedriver().setup(); driver = new ChromeDriver(); break; case "firefox": WebDriverManager.firefoxdriver().setup(); driver = new FirefoxDriver(); } return driver; } }
bd80cae13e99fdbbad76894b53a92240cc40aa19
27eedd29fee42d69dc7d5ab3c555f904782fba73
/springboot-oauth2/oauth2-auth-server-jwt-enhancer/src/main/java/oauth2/config/WebSecurityConfig.java
93ffc519ad98aeae425c5a8afc8827142e40e8d3
[]
no_license
lichyseter/lichy-java-base
8d76ad18ad2bc43788857712bfeea5903ff30473
a7b3235691474a84852dd6e7542d05938ad0e748
refs/heads/master
2023-04-02T04:24:21.482636
2021-04-19T16:08:58
2021-04-19T16:08:58
332,465,569
0
0
null
null
null
null
UTF-8
Java
false
false
1,110
java
package oauth2.config; import org.springframework.context.annotation.Bean; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected void configure(HttpSecurity http) throws Exception { http.cors().and().authorizeRequests() .antMatchers("/**").permitAll(); } }
d1a74f89f4b274a3e181dc449ffdcbfd21e67e52
11ac681e34f936683858b43d54a925095758212f
/s4/B183360/InformationEstimator.java
024f9487bc62700d0dfbff79639912dfb1dac720
[]
no_license
tut183311/tut2018informationQuantity
d31a7d6a9e388f9e8c59479db84cc6267980fc37
a9cda4d7bd94f2d8c199d89cf9a9c732987751b0
refs/heads/master
2020-04-10T21:19:44.770703
2019-02-18T14:00:17
2019-02-18T14:00:17
161,293,780
0
0
null
2018-12-11T07:22:28
2018-12-11T07:22:28
null
UTF-8
Java
false
false
3,521
java
package s4.B183360; // Please modify to s4.Bnnnnnn, where nnnnnn is your student ID. import java.lang.*; import s4.specification.*; /* What is imported from s4.specification package s4.specification; public interface InformationEstimatorInterface{ void setTarget(byte target[]); // set the data for computing the information quantities void setSpace(byte space[]); // set data for sample space to computer probability double estimation(); // It returns 0.0 when the target is not set or Target's length is zero; // It returns Double.MAX_VALUE, when the true value is infinite, or space is not set. // The behavior is undefined, if the true value is finete but larger than Double.MAX_VALUE. // Note that this happens only when the space is unreasonably large. We will encounter other problem anyway. // Otherwise, estimation of information quantity, } */ public class InformationEstimator implements InformationEstimatorInterface{ // Code to tet, *warning: This code condtains intentional problem* byte [] myTarget; // data to compute its information quantity byte [] mySpace; // Sample space to compute the probability int count = 0; FrequencerInterface myFrequencer; // Object for counting frequency byte [] subBytes(byte [] x, int start, int end) { // corresponding to substring of String for byte[] , // It is not implement in class library because internal structure of byte[] requires copy. byte [] result = new byte[end - start]; for(int i = 0; i<end - start; i++) { result[i] = x[start + i]; }; return result; } // IQ: information quantity for a count, -log2(count/sizeof(space)) double iq(int freq) { return - Math.log10((double) freq / (double) mySpace.length)/ Math.log10((double) 2.0); } public void setTarget(byte [] target) { myTarget = target;} public void setSpace(byte []space) { myFrequencer = new Frequencer(); mySpace = space; myFrequencer.setSpace(space); } public double estimation(){ double[] iq = new double[myTarget.length+1]; int end=0,start=0; double value = Double.MAX_VALUE; double value1; for(int i=0; i<myTarget.length; i++){ end = i + 1; if(i == 0){ myFrequencer.setTarget(subBytes(myTarget, start, end)); //myTargetの対象の文字列をセット iq[i] = iq(myFrequencer.frequency()); } else{ for(int j=0; j<end; j++){ start = j; myFrequencer.setTarget(subBytes(myTarget, start, end)); //myTargetの対象の文字列をセット value1 = iq(myFrequencer.frequency()); if(start != 0){ value1 = iq[j-1] + value1; } if(value > value1){ value = value1; } } iq[i] = value; } } return iq[myTarget.length-1]; } public static void main(String[] args) { InformationEstimator myObject; double value; myObject = new InformationEstimator(); myObject.setSpace("3210321001230123".getBytes()); myObject.setTarget("0".getBytes()); value = myObject.estimation(); System.out.println(">0 "+value); myObject.setTarget("01".getBytes()); value = myObject.estimation(); System.out.println(">01 "+value); myObject.setTarget("0123".getBytes()); value = myObject.estimation(); System.out.println(">0123 "+value); myObject.setTarget("00".getBytes()); value = myObject.estimation(); System.out.println(">00 "+value); } }
086520078f55f46c9292ae6c2b49a624308c2636
ef7be0244c194fa45608480a4eef7dc8a533719b
/src/main/java/person/zxl/service/PersonService.java
555e5ea8528b1f46d616003a4cd20e6cd84a6510
[]
no_license
yuezxl/spring-boot-demo
bfd5c21226448398442d5a6abff8009dc3e87430
bcca9d6a6063177cb722fa403c72868e2dd5eee0
refs/heads/master
2020-05-22T16:53:12.195238
2017-03-12T07:36:22
2017-03-12T07:36:22
84,706,157
1
0
null
null
null
null
UTF-8
Java
false
false
166
java
package person.zxl.service; import java.util.List; import person.zxl.model.PersonModel; public interface PersonService { public List<PersonModel> getPersons(); }
10c3d98707d17c2dfd20af6eea209433eac90afc
e476180c994995ac65a3727e01a5be77e4622279
/app/src/main/java/com/example/stud/musicapp/api/SearchAlbums.java
ff3ef6bc57481e783163e05c2861352ef902452b
[]
no_license
damiaNR10/MusicApp
de446be96ef1794be31851bcff19b64a4ac65a2d
e67d64fc6effc716209812944a986af54da536de
refs/heads/master
2021-09-16T01:46:08.705347
2018-06-14T16:58:29
2018-06-14T16:58:29
129,282,965
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package com.example.stud.musicapp.api; import java.util.List; /** * Created by W57008 on 2018-06-14. */ public class SearchAlbums { public List<SearchAlbum> album; }
c96f0e65c7600d570d6629961af94945b3fd0c76
efa574725d7911c3a0d1c361123399e6d709ea30
/src/de/SebastianMikolai/PlanetFx/BungeeCord/BanManager/Datenbank/Mute.java
c6bd1292078eb7b36e2f527717d40de42cd71d45
[]
no_license
PlanetFxMedia/BanManager
357a58afaf77f5f686fe56c2fbab4c22ff53d6af
9e3bdb283b4eac8890b88f38a96a0e2c6659a959
refs/heads/master
2020-04-06T06:55:29.924350
2016-09-04T21:52:28
2016-09-04T21:52:28
65,642,503
0
1
null
null
null
null
UTF-8
Java
false
false
563
java
package de.SebastianMikolai.PlanetFx.BungeeCord.BanManager.Datenbank; import java.util.UUID; public class Mute { final UUID PlayerUUID; final String PlayerName; final String MutetBisTime; public Mute(UUID PlayerUUID, String PlayerName, String MutetBisTime) { this.PlayerUUID = PlayerUUID; this.PlayerName = PlayerName; this.MutetBisTime = MutetBisTime; } public UUID getPlayerUUID() { return this.PlayerUUID; } public String getPlayerName() { return this.PlayerName; } public String getMutetBisTime() { return this.MutetBisTime; } }
4df90eb5499e93672d303bbd98342f2d00d0eb79
a9de22590675be8ee38163127a2c24a20c248a0b
/src/com/iremote/advert/AmetaWeatherAction3.java
64e7b6fa7da462ea632a97b1204229b28ee2f48f
[]
no_license
jessicaallen777/iremote2
0943622300286f8d16e9bb4dca349613ffc23bb1
b27aa81785fc8bf5467a1ffcacd49a04e41f6966
refs/heads/master
2023-03-16T03:20:00.746888
2019-12-12T04:02:30
2019-12-12T04:02:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,619
java
package com.iremote.advert; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.font.TextAttribute; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.AttributedCharacterIterator; import java.text.AttributedString; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.ResourceBundle; import java.util.TimeZone; import javax.imageio.ImageIO; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.iremote.action.helper.RequestHelper; import com.iremote.common.IRemoteConstantDefine; import com.iremote.common.Utils; import com.iremote.common.Hibernate.HibernateUtil; import com.iremote.common.http.HttpUtil; import com.iremote.domain.PhoneUser; import com.opensymphony.xwork2.Action; public class AmetaWeatherAction3 { private static Log log = LogFactory.getLog(AmetaWeatherAction3.class); private static final String cachefilepath = "/opt/tools/cachefiles"; private static String key = "aV3UzkErYHEF1Khi34hrpfINLJGGuIsd"; private static int[][] WEATHER_ICON_POSITION = new int[][] {{ 100, 50}, { 205, 50},{ 295, 50},{ 390, 50},{ 485, 50},{ 585, 50}}; private static int[][] WEATHER_WEEK_POSITION = new int[][] {{ 140, 130}, { 235, 130},{ 325, 130},{ 420, 130},{ 515, 130},{ 615, 130}}; private static int[][] WEATHER_MAX_POSITION = new int[][] {{ 140, 160}, { 235, 160},{ 325, 160},{ 420, 160},{ 515, 160},{ 615, 160}}; private static int[][] WEATHER_MIN_POSITION = new int[][] {{ 140, 190}, { 235, 190},{ 325, 190},{ 420, 190},{ 515, 190},{ 615, 190}}; private static int[] SHADOW_X_POSITION = new int[]{94,189,284,379,474,569}; private static int[] SHADOW_Y_POSITION = new int[]{115,145,175}; private ByteArrayInputStream inputStream; private BufferedImage buffImg; private Graphics2D g2d; private String[] weathercode = new String[1]; private int[] color = new int[]{0x666666,0x333333,0x999999,0x6f7072}; private String[] weekdaykey = new String[]{"monday","tuesday","wednesday","thursday","friday","saturday","sunday"}; private String weatherstr; private String[] week = new String[6]; private String[] maxvalue = new String[6]; private String[] minvalue = new String[6]; private String[] icon = new String[5]; private String[] dayicon = new String[5]; private String querycity; private int totalwidth; private String ip ; private PhoneUser phoneuser; private String fontstyle = "Arial MT"; private String fontstyle1 = "Arial MT"; public ByteArrayInputStream getInputStream() { return inputStream; } public String execute() { HibernateUtil.commit(); HibernateUtil.closeSession(); RequestHelper.setHeader("Cache-control", "max-age=3600"); if (StringUtils.isBlank(ip)) ip = RequestHelper.getRemoteIp(); //ip = "119.123.41.227"; //ip = "47.254.33.167"; log.info("The IP address of the user is:"+ip); if (phoneuser != null && (IRemoteConstantDefine.DEFAULT_LANGUAGE.equalsIgnoreCase(phoneuser.getLanguage()) || IRemoteConstantDefine.DEFAULT_ZHHK_LANGUAGE.equalsIgnoreCase(phoneuser.getLanguage()))) { fontstyle = "Microsoft YaHei"; } if (phoneuser != null && (IRemoteConstantDefine.DEFAULT_LANGUAGE.equalsIgnoreCase(phoneuser.getLanguage()) || IRemoteConstantDefine.DEFAULT_FRCA_LANGUAGE.equalsIgnoreCase(phoneuser.getLanguage()) || IRemoteConstantDefine.DEFAULT_ZHHK_LANGUAGE.equalsIgnoreCase(phoneuser.getLanguage()))) { fontstyle1 = "Microsoft YaHei"; } if (useCachedImg()) return Action.SUCCESS; if (phoneuser==null||initWeather() == false||ip.startsWith("192.168")) { defaultImage(); return Action.SUCCESS; } try { int iw = Integer.valueOf(this.icon[0]); if (iw<45&&iw>0&&iw!=9&&iw!=10&&iw!=27&&iw!=28) createGraphics2D(RequestHelper.getRootPath() + "/images/weather/backgroud/ametabg.png"); else { defaultImage(); log.warn(String.format("unkown weather code : %s", this.weathercode[0])); savedefaultcacheimg(); return Action.SUCCESS; } ByteArrayOutputStream bos = new ByteArrayOutputStream(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); for(int i=0;i<6;i++){ if(i==0){ drawRect(SHADOW_X_POSITION[i],SHADOW_Y_POSITION[0],88,16,new Color(0xf2f2f2)); }else{ drawRect(SHADOW_X_POSITION[i],SHADOW_Y_POSITION[0],87,15,new Color(0xf2f2f2)); } drawRect(SHADOW_X_POSITION[i],SHADOW_Y_POSITION[1],87,15,new Color(0xf2f2f2)); drawRect(SHADOW_X_POSITION[i],SHADOW_Y_POSITION[2],87,15,new Color(0xf2f2f2)); } drawText(weatherstr, new Color(color[3]), 32, 40, fontstyle1, 24); drawTextCenter(week[0], new Color(color[1]), WEATHER_WEEK_POSITION[0][0], WEATHER_WEEK_POSITION[0][1], fontstyle,18); drawTextCenter(String.valueOf(maxvalue[0]), new Color(color[1]), WEATHER_MAX_POSITION[0][0], WEATHER_MAX_POSITION[0][1], fontstyle,18); drawTextCenter(String.valueOf(minvalue[0]), new Color(color[1]), WEATHER_MIN_POSITION[0][0], WEATHER_MIN_POSITION[0][1], fontstyle,18); drawTextRight(querycity , new Color(color[3]) , 15 , 40 , fontstyle,24); drawMyLine(185,50,185,200,new Color(color[2])); drawMyLine(280,50,280,200,new Color(color[2])); drawMyLine(375,50,375,200,new Color(color[2])); drawMyLine(470,50,470,200,new Color(color[2])); drawMyLine(565,50,565,200,new Color(color[2])); for(int i = 1 ;i < 6 ; i++){ drawImage(new File(String.format("%s%s%s%s", RequestHelper.getRootPath(), "/images/weather/ametasmallicon/", this.icon[i-1], "-s.jpg")), WEATHER_ICON_POSITION[i][0], WEATHER_ICON_POSITION[i][1], 1); drawTextCenter(week[i], new Color(color[1]), WEATHER_WEEK_POSITION[i][0], WEATHER_WEEK_POSITION[i][1], fontstyle,18); drawTextCenter(String.valueOf(maxvalue[i])+"\u2103", new Color(color[1]), WEATHER_MAX_POSITION[i][0], WEATHER_MAX_POSITION[i][1], "Microsoft YaHei",18); drawTextCenter(String.valueOf(minvalue[i])+"\u2103", new Color(color[1]), WEATHER_MIN_POSITION[i][0], WEATHER_MIN_POSITION[i][1], "Microsoft YaHei",18); } int locationwidth = getTextWidth(querycity,fontstyle, 24); drawImage(new File(String.format("%s%s%s%s", RequestHelper.getRootPath(), "/images/weather/", "locationicon", ".png")), 750-15-locationwidth-16-5, 16, 1); /* int textWidth = getTextWidth(str[1], color[1], WEATHER_TEXT_POSITION[1][0], WEATHER_TEXT_POSITION[1][1], fontstyle, WEATHER_TEXT_POSITION[1][2]); //F drawTextLeft("\u2109", color[2], WEATHER_TEXT_POSITION[3][0]+textWidth, WEATHER_TEXT_POSITION[3][1], "Microsoft YaHei", WEATHER_TEXT_POSITION[3][2]);*/ outputImage(bos); inputStream = new ByteArrayInputStream(bos.toByteArray()); savecacheimg(); } catch (IOException e) { defaultImage(); log.error(e.getMessage(), e); return Action.SUCCESS; } return Action.SUCCESS; } private boolean useCachedImg() { String filename = createcachefilename(); File f = new File(filename); if (!f.exists()) return false; fileImage(filename); log.info("use cached image"); return true; } private String createcachefilename() { if(phoneuser!=null){ return String.format("%s/%s_%s_%s.png", cachefilepath, Utils.formatTime(new Date(), "yyyyMMddHH"),phoneuser.getPlatform()+"_2", ip); } return String.format("%s/%s_%s_%s.png", cachefilepath, Utils.formatTime(new Date(), "yyyyMMddHH"),9+"_2", ip); } private void savedefaultcacheimg() { try { FileUtils.copyFile(new File(RequestHelper.getRootPath() + "/images/advert_oem/en_us/9/1.jpg"), new File(createcachefilename())); } catch (IOException e) { log.error(e.getMessage(), e); } } private int getTextWidth(String text, String fontType, int fontSize) { Font f = new Font(fontType, Font.PLAIN, fontSize); AttributedString ats = new AttributedString(text); ats.addAttribute(TextAttribute.FONT, f, 0, text.length()); g2d.setFont(f); FontMetrics fm = g2d.getFontMetrics(); return fm.stringWidth(text); } private void savecacheimg() { try { ImageIO.write(buffImg, "png", new File(createcachefilename())); } catch (IOException e) { log.error(e.getMessage(), e); } } private void drawMyLine(int startx,int starty,int endx,int endy, Color color) { g2d.setColor(color); Line2D line = new Line2D.Float(startx, starty, endx, endy); g2d.draw(line); } private void drawRect(int x,int y,int width,int height, Color color) { g2d.drawRect(x,y,width,height); g2d.setColor(color); g2d.fillRect(x,y,width,height); } private void createGraphics2D(String filepath) throws IOException { File file = new File(filepath); buffImg = ImageIO.read(file); totalwidth = buffImg.getWidth(); g2d = buffImg.createGraphics(); } private void outputImage(OutputStream os) throws IOException { g2d.dispose(); ImageIO.write(buffImg, "png", os); } private void drawTextCenter(String text, Color markContentColor, int xmiddle, int y, String fontType,int fontSize) { g2d.setColor(markContentColor); Font f = new Font(fontType, Font.PLAIN, fontSize); AttributedString ats = new AttributedString(text); ats.addAttribute(TextAttribute.FONT, f, 0, text.length()); AttributedCharacterIterator iter = ats.getIterator(); g2d.setFont(f); FontMetrics fm = g2d.getFontMetrics(); g2d.drawString(iter, xmiddle - fm.stringWidth(text) / 2, y); } private void drawText(String text, Color markContentColor, int x, int y, String fontType, int fontSize) { g2d.setColor(markContentColor); //g2d.setBackground(color); Font f = new Font(fontType, Font.PLAIN, fontSize); AttributedString ats = new AttributedString(text); ats.addAttribute(TextAttribute.FONT, f, 0, text.length()); AttributedCharacterIterator iter = ats.getIterator(); g2d.drawString(iter, x, y); } private void drawTextRight(String text, Color markContentColor, int x , int y,String fontType, int fontSize) { g2d.setColor(markContentColor); //g2d.setBackground(color1); Font f = new Font(fontType, Font.PLAIN, fontSize); AttributedString ats = new AttributedString(text); ats.addAttribute(TextAttribute.FONT, f, 0, text.length()); AttributedCharacterIterator iter = ats.getIterator(); g2d.setFont(f); FontMetrics fm =g2d.getFontMetrics(); g2d.drawString(iter, totalwidth - x - fm.stringWidth(text), y ); } private void drawImage(File waterFile, int x, int y, float alpha) throws IOException { BufferedImage waterImg = ImageIO.read(waterFile); int waterImgWidth = waterImg.getWidth(); int waterImgHeight = waterImg.getHeight(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); g2d.drawImage(waterImg, x, y, waterImgWidth, waterImgHeight, null); } private boolean initWeather() { try { String url1 = "http://www.ip-api.com/json/" + ip; String url3 = "http://dataservice.accuweather.com/forecasts/v1/daily/5day/"; String locationjson = HttpUtil.httprequest(url1, ""); JSONObject parselocation = JSON.parseObject(locationjson); String countrycode = parselocation.getString("countryCode"); String admincode = parselocation.getString("region"); if(StringUtils.isBlank(admincode)){ admincode = parselocation.getString("regionName").substring(0,2).toUpperCase(); } querycity = parselocation.getString("city"); if(querycity.contains("(")){ querycity = querycity.substring(0,querycity.indexOf("(")); } JSONObject jsonpar = new JSONObject(); jsonpar.put("apikey", key); jsonpar.put("q", querycity); jsonpar.put("details", "true"); String url2 = "http://dataservice.accuweather.com/locations/v1/cities/"+countrycode+"/"+admincode+"/search"; String keyjson = HttpUtil.httpGet(url2, jsonpar, null); JSONArray arraykey = (JSONArray) JSONArray.parse(keyjson); JSONObject parsekey = (JSONObject) arraykey.get(0); String keystr = parsekey.getString("Key"); url3 += keystr; String language = phoneuser.getLanguage().toLowerCase().replace("_", "-");// fr-ca en-us zh-cn JSONObject jsonparameter = new JSONObject(); jsonparameter.put("apikey", key); jsonparameter.put("language", language); jsonparameter.put("details", true); jsonparameter.put("metric", true); String resultjson = HttpUtil.httpGet(url3, jsonparameter, null); net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(resultjson); setValue(jsonObject,5); net.sf.json.JSONObject dailyforecastsjson = (net.sf.json.JSONObject) jsonObject .getJSONArray("DailyForecasts").get(0); String sunstring = dailyforecastsjson.getString("Sun"); net.sf.json.JSONObject sunjson = net.sf.json.JSONObject.fromObject(sunstring); String risestr = sunjson.getString("Rise"); risestr = risestr.substring(0, 19).replace("T", " "); String setstr = sunjson.getString("Set"); String userzone = setstr.substring(19); setstr = setstr.substring(0, 19).replace("T", " "); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date sunsetdate = sdf.parse(setstr); TimeZone rtz = TimeZone.getDefault(); int systemzonenumber = rtz.getRawOffset()/60/1000/60; int zonenumber = Integer.parseInt(userzone.substring(0,3)); long aparttime = (systemzonenumber-zonenumber)*60*60*1000; long systemcurrenttime = new Date().getTime(); long localtime = systemcurrenttime-aparttime; boolean night = true; if (localtime < sunsetdate.getTime()) { night = false; icon[0] = dayicon[0]; icon[1] = dayicon[1]; icon[2] = dayicon[2]; icon[3] = dayicon[3]; icon[4] = dayicon[4]; } Calendar cal=Calendar.getInstance(); cal.setTime(new Date(localtime)); int index = 1; switch(cal.get(Calendar.DAY_OF_WEEK)){ case Calendar.SATURDAY: index = 6; break; case Calendar.SUNDAY: index = 7; break; case Calendar.MONDAY: index = 1; break; case Calendar.TUESDAY: index = 2; break; case Calendar.WEDNESDAY: index = 3; break; case Calendar.THURSDAY: index = 4; break; case Calendar.FRIDAY: index = 5; break; } ResourceBundle rb = null; if(phoneuser.getLanguage().equalsIgnoreCase("zh_cn")){ rb = ResourceBundle.getBundle("pageMessageResource", Locale.SIMPLIFIED_CHINESE); }else if(phoneuser.getLanguage().equalsIgnoreCase("fr_ca")){ rb = ResourceBundle.getBundle("pageMessageResource", Locale.CANADA_FRENCH); }else{ rb = ResourceBundle.getBundle("pageMessageResource", Locale.US); } week[1] = rb.getString(weekdaykey[index-1]); week[2] = rb.getString(weekdaykey[(index)%7]); week[3] = rb.getString(weekdaykey[(index+1)%7]); week[4] = rb.getString(weekdaykey[(index+2)%7]); week[5] = rb.getString(weekdaykey[(index+3)%7]); maxvalue[0] = rb.getString("weatherhigh"); minvalue[0] = rb.getString("weatherlow"); week[0] = night?rb.getString("weathernight"):rb.getString("weatherday"); weatherstr = new String(rb.getString("weather").getBytes(),"utf-8"); } catch (Throwable e) { log.error(e.getMessage(), e); return false; } return true; } private void setValue(net.sf.json.JSONObject jsonObject,int day){ for(int i =0;i<day;i++){ net.sf.json.JSONObject dailyforecastsjson = (net.sf.json.JSONObject) jsonObject .getJSONArray("DailyForecasts").get(i); String temperaturestring = dailyforecastsjson.getString("Temperature"); net.sf.json.JSONObject temperaturejson = net.sf.json.JSONObject.fromObject(temperaturestring); String minimumstr = temperaturejson.getString("Minimum"); String maximumstr = temperaturejson.getString("Maximum"); net.sf.json.JSONObject minjson = net.sf.json.JSONObject.fromObject(minimumstr); net.sf.json.JSONObject maxjson = net.sf.json.JSONObject.fromObject(maximumstr); minvalue[i+1] = String.valueOf((int)minjson.getDouble("Value")); maxvalue[i+1] = String.valueOf((int)maxjson.getDouble("Value")); String daystr = dailyforecastsjson.getString("Day"); String nightstr = dailyforecastsjson.getString("Night"); net.sf.json.JSONObject dayjson = net.sf.json.JSONObject.fromObject(daystr); net.sf.json.JSONObject nightjson = net.sf.json.JSONObject.fromObject(nightstr); dayicon[i] = dayjson.getString("Icon"); String nighticon = nightjson.getString("Icon"); icon[i] = nighticon; } } private void defaultImage() { this.fileImage(RequestHelper.getRootPath() + "/images/advert_oem/en_us/9/1.jpg"); } private void fileImage(String filename) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); InputStream input = new BufferedInputStream(new FileInputStream(filename)); byte[] bt = new byte[1024]; while (input.read(bt) > 0) { bos.write(bt); } this.inputStream = new ByteArrayInputStream(bos.toByteArray()); bos.close(); input.close(); } catch (Throwable t) { log.error(t.getMessage(), t); } } public void setIp(String ip) { this.ip = ip; } public void setPhoneuser(PhoneUser phoneuser) { this.phoneuser = phoneuser; } }
aa79c8eba88678ca7860725e414a3279e896fbcd
bb741fd5ee0e50bcefcf1a7666c68b8a39eab298
/src/FishAndCook/Walker.java
533270a288bd7ec800c17e2113373e0520848059
[]
no_license
DavidSadowsky/RSBot
5b329b49035a6cb4a8c834242b3c99c68520b796
975dc59db29290f4b13dd277f06f6773f95be7b0
refs/heads/master
2023-01-23T00:48:59.315007
2020-12-03T21:02:37
2020-12-03T21:02:37
289,523,615
1
0
null
null
null
null
UTF-8
Java
false
false
13,784
java
package FishAndCook; import org.powerbot.script.Condition; import org.powerbot.script.Random; import org.powerbot.script.Tile; import org.powerbot.script.rt4.ClientContext; import org.powerbot.script.rt4.Game; import org.powerbot.script.rt4.GameObject; import org.powerbot.script.rt4.Player; import java.util.concurrent.Callable; import java.util.regex.Pattern; /** * Created by Chris on 05/01/2016. */ public class Walker { private ClientContext ctx; public Walker(ClientContext ctx) { this.ctx = ctx; } /** * Returns the next tile to walk to, disregarding whether it is reachable. * * @param t The tile path being traversed. * @return The next tile to traverse to. */ public Tile getNextTile(Tile[] t) { Tile nextTile = ctx.movement.newTilePath(t).next(); //The next tile, as suggested by the RSBot api, this will be the next reachable tile. int index = 0; //The index at which the next tile (by our definition) is at. Default to 0 (start tile). final Player p = ctx.players.local(); /* * Loop through the path, backwards. * Find the intended next tiles index * then check if there is a better option. */ for (int i = t.length - 1; i >= 0; i--) { if (t[i].equals(nextTile)) { //This is the index at which the suggested next tile resides if (i + 1 <= t.length - 1 && nextTile.distanceTo(p) < 3) { //If we're not at the end of the path and we're very close to the suggested next tile index = i + 1; //then it's too close to bother with. We will try to go to the tile after instead. break; } index = i; //Suggested next tile was the best option as it is not very close, and reachable. break; } else if(t[i].distanceTo(p)<8){ index = i; //if next closest tile is <8 and it's not the next tile then we can assume the next tile is probably not correct, perhaps no reachable tile available... break; } } return t[index]; } /** * Will detect which obstacle to tackle to give Walker the ability to * traverse to the next tile. * * * @param t The tile path being traversed. * @return True if obstacle was clicked. False otherwise. */ public boolean handleObstacle(Tile[] t) { Tile nextTile = getNextTile(t); //The calculated next tile. /* * Return false as there is no obstacle to handle. * Perhaps this was called whilst we were still walking * and the tile became reachable? */ if (nextTile.matrix(ctx).reachable()) { return false; } final Player p = ctx.players.local(); double distance = Double.POSITIVE_INFINITY; GameObject obstacle = null; for (GameObject go : ctx.objects.select(5).name(Pattern.compile("(staircase)|(ladder)|((.*)?door)|(gate(.*)?)", Pattern.CASE_INSENSITIVE))) { //Changed to filter by name else all the filtering in the next part takes much too long to be considered effective.. double calcDist = go.tile().distanceTo(new Tile(nextTile.x(), nextTile.y(), p.tile().floor())); /* * Check if the next tile is on a different floor. If it is then * we need to check whether it's up or down. We can use this * to filter objects by actions 'Climb-up' or 'Climb-down' */ if (nextTile.floor() != p.tile().floor()) { if (go.type() == GameObject.Type.INTERACTIVE && go.actions().length>0) { if (nextTile.floor() > p.tile().floor()) { //Need to climb up. if (calcDist < distance && reachable(go)) { for (String s : go.actions()) { if (s != null && !s.equals("null") && s.contains("Climb-up")) { obstacle = go; distance = calcDist; //Set the distance to the object so we can compare future objects against it to determine the best. break; } } } } else { //Need to climb down. if (calcDist < distance && reachable(go)) { for (String s : go.actions()) { if (s != null && !s.equals("null") && s.contains("Climb-down")) { obstacle = go; distance = calcDist; //Set the distance to the object so we can compare future objects against it to determine the best. break; } } } } } } else if (nextTile.distanceTo(ctx.players.local()) > 50){ //we can now assume that we need to go up or down .. not flawless whatsoever if (go.type() != GameObject.Type.BOUNDARY) { for (String s : go.actions()) { if (go.tile().distanceTo(nextTile) + go.tile().distanceTo(p) < distance && reachable(go)) { if (s != null && !s.equals("null") && (s.contains("Climb-up") || s.contains("Climb-down") || s.contains("Enter"))) { obstacle = go; distance = go.tile().distanceTo(nextTile) + go.tile().distanceTo(p); //Set the distance to the object so we can compare future objects against it to determine the best. break; } } } } } else { /* * Floor was the same so we are blocked by a door, or gate. * These are boundary objects, however we need to check the name * as some random boundary objects appear with the name null. */ if (go.type() == GameObject.Type.BOUNDARY) { if (calcDist < distance && reachable(go)) { obstacle = go; distance = calcDist; //Set the distance to the object so we can compare future objects against it to determine the best. } } } } if (obstacle == null) return false; if (obstacle.inViewport()) { obstacle.bounds(getBounds(obstacle)); if (nextTile.floor() > p.tile().floor()) { //Going up. if (obstacle.interact("Climb-up")) { return handlePostInteraction(); } } else if (nextTile.floor() < p.tile().floor()) { //Going down. if (obstacle.interact("Climb-down")) { return handlePostInteraction(); } } else if (nextTile.distanceTo(ctx.players.local()) > 50){ //This is just guessing if (obstacle.interact("Climb-")) { return handlePostInteraction(); } }else { if (obstacle.interact("Open")) { //Going through. return handlePostInteraction(); } } } else { if (ctx.movement.step(obstacle)) { //Can't see the obstacle, step towards it. ctx.camera.turnTo(obstacle); //and turn the camera. Condition.wait(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return p.animation() == -1 && !p.inMotion(); } }, 1000, 3); } } return false; } /** * Determines if a game object is reachable by * checking the tiles around it. * * @param go The game object being tested. * @return True or false. */ private boolean reachable(GameObject go) { int a = go.width(); Tile t1 = new Tile(go.tile().x() + a, go.tile().y(), go.tile().floor()); Tile t2 = new Tile(go.tile().x() - a, go.tile().y(), go.tile().floor()); Tile t3 = new Tile(go.tile().x(), go.tile().y() + a, go.tile().floor()); Tile t4 = new Tile(go.tile().x(), go.tile().y() - a, go.tile().floor()); return (t1.matrix(ctx).reachable() || t2.matrix(ctx).reachable() || t3.matrix(ctx).reachable() || t4.matrix(ctx).reachable()); } /** * Handles the period after interacting with the object. * * @return True if clicked successfully. */ private boolean handlePostInteraction() { final Player p = ctx.players.local(); if (ctx.game.crosshair() == Game.Crosshair.ACTION) { Condition.wait(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return p.animation() == -1 && !p.inMotion(); } }, 1000, 3); return true; } return false; } /** * Moves a single step towards the destination of a given path. * Most obstacles such as gates, ladders, doors, and stairs are handled. * * @param t The tile path to be traversed. * @return True if a step was taken, or object handled. */ public boolean walkPath(Tile[] t) { Tile ti = getNextTile(t); Tile nt = ti.derive(Random.nextInt(-1,1),Random.nextInt(-1,1)); if(nt.matrix(ctx).reachable()){ //System.out.println("Randomized.. " + ti + " became " + nt); return ctx.movement.step(nt); } //System.out.println("NOT Randomized."); return ti.matrix(ctx).reachable() ? ctx.movement.step(ti) : handleObstacle(t); } /** * Gets the bounds for a given object * * @param go The object to get bounds for. * @return Bounds. If not found, default bounds returned. */ private int[] getBounds(GameObject go) { switch (getType(go.name())) { case DOOR: switch (go.orientation()) { case 0: case 4: case 6: return new int[]{-5, 15, 0, -220, 0, 90}; case 1: return new int[]{0, 90, 0, -220, 110, 130}; case 2: return new int[]{100, 120, 0, -220, 0, 90}; case 3: return new int[]{0, 100, 0, -200, 10, 20}; } break; case GATE: switch (go.orientation()) { case 0: case 4: case 6: return new int[]{5, 10, 0, -80, 20, 80}; case 1: return new int[]{0, 80, 0, -80, 118, 123}; case 2: return new int[]{118, 123, 0, -80, 0, 80}; case 3: return new int[]{10, 80, 0, -80, 15, 0}; } break; case LADDER: switch (go.orientation()) { case 0: case 4: case 2: return new int[]{-20, 40, 20, -40, 0, -60}; case 1: case 5: return new int[]{0, -40, -64, 0, -32, 32}; case 6: return new int[]{-20, 40, 20, -40, 0, 60}; case 3: case 7: return new int[]{10, 40, -64, 0, -32, 32}; } break; } return new int[]{-32, 32, -64, 0, -32, 32}; } /** * Gets the enum associated with a given string, if applicable. * * @param s The string to check (name of object?) * @return The enum associated. */ private Type getType(String s) { if (s.matches("(?i)((.*)?door)")) { return Type.DOOR; } else if (s.matches("(?i)(gate(.*)?)")) { return Type.GATE; } else if (s.equalsIgnoreCase("ladder")) { return Type.LADDER; } return Type.TEAPOT; } /** * Reverses the given path, and then calls {@link #walkPath(Tile[] t)}. * * @param t * @return */ public boolean walkPathReverse(Tile[] t){ t = ctx.movement.newTilePath(t).reverse().toArray(); return walkPath(t); } public enum Type { DOOR, GATE, LADDER, TEAPOT } }
3eff70b6c8309015199cba4d0bf1318a8795020a
cd8c99d6e9e31765ed17fead15c460d99b54e7ed
/android/app/src/main/java/com/mtutorials_26604/MainApplication.java
55a35f009b30f6f3327d18eed69270308cf0dcaa
[]
no_license
crowdbotics-apps/mtutorials-26604
edb3fbfc1d40d7cb6659c3b8985104cac759f449
9c581de8e4b931eb5161520383f6d74bbf1f6be1
refs/heads/master
2023-04-25T05:55:37.425392
2021-05-12T14:26:19
2021-05-12T14:26:19
366,743,469
0
0
null
null
null
null
UTF-8
Java
false
false
2,615
java
package com.mtutorials_26604; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.mtutorials_26604.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
1dbcd60d6c9ecc3fd6dad4d2fe058d9c86d024ff
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/14/14_41d9dfe31698afd963c0d41ab2d9d528a2e55391/Tree/14_41d9dfe31698afd963c0d41ab2d9d528a2e55391_Tree_s.java
850e1158303dbd7ad0d497060273d61d51a0ac78
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,479
java
/** * This mod is distributed under the terms of the Minecraft Mod Public * License 1.0, or MMPL. Please check the contents of the license * located in /MMPL-1.0.txt */ package extrabiomes.plugin.trees; import static extrabiomes.trees.TreeBlocks.Type.ACACIA; import static extrabiomes.trees.TreeBlocks.Type.BROWN; import static extrabiomes.trees.TreeBlocks.Type.FIR; import static extrabiomes.trees.TreeBlocks.Type.ORANGE; import static extrabiomes.trees.TreeBlocks.Type.PURPLE; import static extrabiomes.trees.TreeBlocks.Type.REDWOOD; import static extrabiomes.trees.TreeBlocks.Type.YELLOW; import java.io.File; import java.util.logging.Level; import net.minecraft.src.Block; import net.minecraft.src.ItemStack; import net.minecraftforge.common.Configuration; import com.google.common.base.Optional; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import extrabiomes.CommonProxy; import extrabiomes.ExtrabiomesLog; import extrabiomes.trees.TreeBlocks; @Mod(modid = "EBXLTree", name = "ExtrabiomesXL Custom Trees Plugin", version = "3.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Tree { @SidedProxy(clientSide = "extrabiomes.client.ClientProxy", serverSide = "extrabiomes.CommonProxy") public static CommonProxy proxy; @Instance("EBXLTree") public static Tree instance; private static int autumnLeavesID; private static int greenLeavesID; private static int saplingID; private static Optional<Block> autumnLeaves = Optional.absent(); private static Optional<Block> greenLeaves = Optional.absent(); static Optional<Block> sapling = Optional.absent(); @Init public static void init(FMLInitializationEvent event) { proxy.registerRenderInformation(); if (isAutumnLeavesEnabled()) { autumnLeaves = Optional.of(new BlockAutumnLeaves( autumnLeavesID).setBlockName("autumnleaves")); proxy.registerBlock(autumnLeaves, extrabiomes.ItemCustomLeaves.class); for (final AutumnLeafType type : AutumnLeafType.values()) proxy.addName( new ItemStack(autumnLeaves.get(), 1, type .metadata()), type.itemName()); TreeBlocks.setBlocks(BROWN, Block.wood.blockID, 0, autumnLeavesID, AutumnLeafType.BROWN.metadata()); TreeBlocks.setBlocks(ORANGE, Block.wood.blockID, 0, autumnLeavesID, AutumnLeafType.ORANGE.metadata()); TreeBlocks.setBlocks(PURPLE, Block.wood.blockID, 0, autumnLeavesID, AutumnLeafType.PURPLE.metadata()); TreeBlocks.setBlocks(YELLOW, Block.wood.blockID, 0, autumnLeavesID, AutumnLeafType.YELLOW.metadata()); } if (isGreenLeavesEnabled()) { greenLeaves = Optional.of(new BlockAutumnLeaves( greenLeavesID).setBlockName("greenleaves")); proxy.registerBlock(greenLeaves, extrabiomes.ItemCustomLeaves.class); for (final GreenLeafType type : GreenLeafType.values()) proxy.addName( new ItemStack(greenLeaves.get(), 1, type .metadata()), type.itemName()); TreeBlocks.setBlocks(FIR, Block.wood.blockID, 0, autumnLeavesID, GreenLeafType.FIR.metadata()); TreeBlocks.setBlocks(REDWOOD, Block.wood.blockID, 0, autumnLeavesID, GreenLeafType.REDWOOD.metadata()); TreeBlocks.setBlocks(ACACIA, Block.wood.blockID, 0, autumnLeavesID, GreenLeafType.ACACIA.metadata()); } if (isSaplingEnabled()) { sapling = Optional.of(new BlockAutumnLeaves(saplingID) .setBlockName("sapling")); proxy.registerBlock(sapling, extrabiomes.utility.MultiItemBlock.class); for (final SaplingType type : SaplingType.values()) proxy.addName( new ItemStack(sapling.get(), 1, type.metadata()), type.itemName()); proxy.registerFuelHandler(new FuelHandler(saplingID)); } } public static boolean isAutumnLeavesEnabled() { return 0 < autumnLeavesID; } public static boolean isGreenLeavesEnabled() { return 0 < greenLeavesID; } public static boolean isSaplingEnabled() { return 0 < saplingID; } @PreInit public static void preInit(FMLPreInitializationEvent event) { ExtrabiomesLog.configureLogging(); final Configuration cfg = new Configuration(new File( event.getModConfigurationDirectory(), "/extrabiomes/extrabiomes.cfg")); try { cfg.load(); autumnLeavesID = cfg.getOrCreateBlockIdProperty( "autumnleaves.id", 150).getInt(0); if (!isAutumnLeavesEnabled()) ExtrabiomesLog .info("autumnleaves.id = 0, so autumn leaves have been disabled."); greenLeavesID = cfg.getOrCreateBlockIdProperty( "greenleaves.id", 155).getInt(0); if (!isGreenLeavesEnabled()) ExtrabiomesLog .info("greenleaves.id = 0, so green leaves have been disabled."); saplingID = cfg.getOrCreateBlockIdProperty("sapling.id", 159).getInt(0); if (!isSaplingEnabled()) ExtrabiomesLog .info("sapling.id = 0, so saplings have been disabled."); } catch (final Exception e) { ExtrabiomesLog .log(Level.SEVERE, e, "ExtrabiomesXL had a problem loading it's configuration."); } finally { cfg.save(); } } }