blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
568bef576b14b82b42ce661aec03c05cb9e87c07
0e4de01bebaa4a39bb68ce5abe5e57f30915c9f8
/dingo-exec/src/main/java/io/dingodb/exec/base/OutputHint.java
5c0e431b20ecf92e6e981331e6f6145a0b7f3575
[ "Apache-2.0" ]
permissive
dd-guo/dingo
11c5c34dfce091c40d69ac5aca5ac1f9c6ae2fe1
79bc41b6d52f0a9b261774f4437e968fd9a8efb7
refs/heads/main
2023-08-22T00:38:17.415780
2021-10-28T10:41:27
2021-11-01T05:27:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,225
java
/* * Copyright 2021 DataCanvas * * 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 io.dingodb.exec.base; import io.dingodb.net.Location; import lombok.Getter; import lombok.Setter; import javax.annotation.Nonnull; public class OutputHint { @Getter @Setter private String tableName = null; @Getter @Setter private Object partId = null; @Getter @Setter private Location location = null; @Getter @Setter private boolean toSumUp = false; @Nonnull public static OutputHint of(String tableName, Object partId) { OutputHint hint = new OutputHint(); hint.tableName = tableName; hint.partId = partId; return hint; } }
[ "huzongxing0826@gmail.com" ]
huzongxing0826@gmail.com
0901a1323de6c04a91efd7dca22a489d6bd47145
f52dceaf0f65669a196a1e9fb736874cc7b72eb7
/src/main/java/com/pm/company/SpringSecurityInitializer.java
a234f77c14f3f44ae39be78944a07c54d8e48166
[]
no_license
pawmac24/PawelVisit
1f4e55d8a5355bca6aea9887be20c38d847e776b
d0d65def40df6d506468d0c6488391da476c090a
refs/heads/master
2020-07-15T19:06:31.887888
2016-11-16T22:38:19
2016-11-16T22:38:19
73,959,254
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.pm.company; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; public class SpringSecurityInitializer extends AbstractSecurityWebApplicationInitializer { }
[ "pawmac24@gmail.com" ]
pawmac24@gmail.com
d7260d3889df4c2baf9a4bdf20e50197d6cdfa77
4f51dbc70213a4634559bcd749025e996340c45c
/Tryouts/app/src/main/java/com/example/tryouts/MainActivity.java
8265c3e922e556a18424046a8a703a6b261fdb60
[]
no_license
almepi/ED
cc16766157f45825ceae7de2b76ef48cf330872b
77624b19f792c60bfa380b3b7bded16931446614
refs/heads/master
2020-03-28T20:33:59.603994
2019-04-15T06:16:37
2019-04-15T06:16:37
149,083,525
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package com.example.tryouts; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } //TableLayout tableLayout = findViewById(R.id.tableLayout); /* for (int index = 0; index< tableLayout.getChildCount(); View view = tableLayout.getChildAt(index); if((view instanceof ViewGroup) log.i(TAG, String.format("inex %s view %s", index, view)); } */ /* ALGORITMO ITERATIVO int factorial(int n){ int factorial = 1; for(int numero = 1; numero <= n; numero ++) factorial = factorial * numero; return factorial; } /*ALGORITMO RECURSIVO int factorial(int n){ if (n==0) return 1; return n.factorial(n-1); } */ */ /* for(int id : ids){ final Button button = findViewById(id); button.add(button); button.setOnClickListenner(v-> { Log.i(TAG, msg " onClickListenner "); }}; } */
[ "alejandro.megias22@gmail.com" ]
alejandro.megias22@gmail.com
d67b1ea7b58167982ad5c41f7b8828cda7a24a8b
32afa2df409027832cc69e0a1a8085d8fbeb8b7c
/app/src/main/java/com/crazy/firebirdtools/main/shanghai/dto/ShangHaiDetailBean.java
f6b7b6752ec9bc27302a99d94e6a2ce71c9689c2
[]
no_license
taowei00/FireBird
e33711cf0b43ad782d8575bf102761a90f44e8fc
53e54af602f8978530f3bdd3e7e5121381e610ba
refs/heads/master
2022-04-26T00:21:28.285740
2020-04-06T01:26:51
2020-04-06T01:26:51
208,973,795
1
0
null
null
null
null
UTF-8
Java
false
false
515
java
package com.crazy.firebirdtools.main.shanghai.dto; import java.util.ArrayList; /** * created by ${tw} * on 2019/10/25 */ public class ShangHaiDetailBean { public int error_code; public String reason; public XiaoHuaListBean result; public static class XiaoHuaListBean { public ArrayList<XiaoHuaBean> data; } public static class XiaoHuaBean { public String content; public String hashId; public String unixtime; public String updatetime; } }
[ "1986928786@qq.com" ]
1986928786@qq.com
6d934ddbef44418c2b3171033c2240d65eb45d15
34e57f92e56692a2526088bb92beae243b9c5a1b
/src/test/java/com/yizhilu/core/test/RedisTest.java
a181f811a50eed92a98b7b92085a5ec1b081d343
[]
no_license
liuqinggang/neixunutil
0066e65ff959ee97f6cc70db7a25c893286f0f90
1c49785409c2e97fe86b0f8a2da07cadb03a1358
refs/heads/master
2021-01-10T08:12:41.211413
2016-01-15T09:07:03
2016-01-15T09:07:03
49,700,919
2
0
null
null
null
null
UTF-8
Java
false
false
559
java
package com.yizhilu.core.test; import redis.clients.jedis.Jedis; import java.util.Set; /** * Created by liuqinggang on 15/12/18. */ public class RedisTest { public static void main(String[] args) { /* Jedis jedis = RedisUtil.getJedis(); Set<String> strigs =jedis.keys("*"); for(String k:strigs){ System.out.println(k); }*/ /* System.out.println(jedis.get("aa".getBytes())); System.out.println(jedis.get("aa".getBytes())); System.out.println(jedis.get("aa".getBytes()));*/ } }
[ "730553@qq.com" ]
730553@qq.com
e67b00446946e6306a92164e0d2982e4d4b83ab2
340d0924eba26df8c699f3ca44b19d918349839a
/MUMScrum-master/src/main/java/edu/mumscrum/web/HomeController.java
62f4842c14dd7ff080264ee44b6cfce241fef500
[ "Apache-2.0" ]
permissive
phuongpham7/JavaGit
1e053fdfbed2eb6cc40712663f7d79c3b6f4db5a
2ac1675f2ecd7267184bf2bbf6228c3f1da0c6b0
refs/heads/master
2021-01-19T20:57:55.052545
2017-04-18T05:05:22
2017-04-18T05:05:22
88,583,896
0
0
null
null
null
null
UTF-8
Java
false
false
2,095
java
package edu.mumscrum.web; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import edu.mumscrum.domain.Employee; import edu.mumscrum.domain.EmployeeRole; import edu.mumscrum.domain.Role; import edu.mumscrum.hrSubSystem.*; import edu.mumscrum.service.ProductService; @Controller public class HomeController { @Autowired private IHRSubsystem hr; @Autowired private ProductService productService; @RequestMapping("/") public String greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name, Model model, HttpSession session) { if(session.getAttribute("loggedInUser") != null){ Employee user = (Employee) session.getAttribute("loggedInUser"); for(EmployeeRole roles : user.getRolelist()){ if(roles.getRoleName() == Role.PRODUCTOWNER){ model.addAttribute("productOwner", user); } if(roles.getRoleName() == Role.SCRUMMASTER){ model.addAttribute("scrumMaster", user); } if(roles.getRoleName() == Role.DEVELOPER){ model.addAttribute("developer", user); } if(roles.getRoleName() == Role.TESTER){ model.addAttribute("tester", user); } if(roles.getRoleName().equals(Role.HR)){ model.addAttribute("Hr", user); } } model.addAttribute("user", user); return "employee/main"; } model.addAttribute("name", name); return "home"; } @RequestMapping("/user") public String getUser(Model model) { Employee employees = hr.findAll().get(0); //Employee employees2 = employee. model.addAttribute("name", employees); return "employee/user"; } @RequestMapping(value="/error", method= RequestMethod.GET) public String error(){ return "error"; } }
[ "pham.th.th.phuong@gmail.com" ]
pham.th.th.phuong@gmail.com
71be62b2d36d95ad8b63fe4dc018e9240b30b618
1c6ac393d86f6c7df5e5bd1f30ac4edfd38b1130
/test/src/main/java/binghamton/bachuai13/util/FoldUtils.java
312557fae593bd31ea484b9c1d639d83fe32324c
[]
no_license
yzhan202/zhang-ijcai19
115d74da72994396395392fc34992c4c142b3f17
51507aa1739fb1731c299205c814c05213ac2060
refs/heads/master
2021-07-06T00:46:33.765990
2020-02-23T19:24:16
2020-02-23T19:24:16
242,576,379
0
0
null
2021-06-04T02:29:05
2020-02-23T19:19:13
Java
UTF-8
Java
false
false
13,892
java
package binghamton.bachuai13.util; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import org.apache.commons.lang.builder.HashCodeBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import edu.umd.cs.psl.database.DataStore; import edu.umd.cs.psl.database.Database; import edu.umd.cs.psl.database.DatabaseQuery; import edu.umd.cs.psl.database.Partition; import edu.umd.cs.psl.database.ResultList; import edu.umd.cs.psl.database.loading.Inserter; import edu.umd.cs.psl.model.argument.GroundTerm; import edu.umd.cs.psl.model.argument.Variable; import edu.umd.cs.psl.model.atom.Atom; import edu.umd.cs.psl.model.atom.GroundAtom; import edu.umd.cs.psl.model.atom.ObservedAtom; import edu.umd.cs.psl.model.atom.QueryAtom; import edu.umd.cs.psl.model.predicate.Predicate; import edu.umd.cs.psl.model.predicate.StandardPredicate; import edu.umd.cs.psl.util.database.Queries; class FoldUtils { private static Logger log = LoggerFactory.getLogger("FoldUtils"); private static Random rand = new Random(0); /** * creates two splits of data by randomly sampling from partition fullData * and places one split in partition train and one in partition test. * @param data * @param trainTestRatio * @param fullData * @param train * @param test * @param filterRatio */ public static List<Set<GroundTerm>> generateSnowballSplit(DataStore data, Partition observedData, Partition groundTruth, Partition train, Partition test, Partition trainLabels, Partition testLabels, Set<DatabaseQuery> queries, Set<Variable> keys, int targetSize, Predicate edge, double explore) { log.info("Splitting data from " + observedData + " into clusters of target size " + targetSize + " into new partitions " + train +" and " + test); Database db = data.getDatabase(observedData); Set<GroundAtom> edges = Queries.getAllAtoms(db, edge); Set<GroundTerm> nodeSet = new HashSet<GroundTerm>(); for (GroundAtom atom : edges) { nodeSet.add(atom.getArguments()[0]); nodeSet.add(atom.getArguments()[1]); } List<GroundTerm> nodes = new ArrayList<GroundTerm>(nodeSet.size()); nodes.addAll(nodeSet); List<GroundTerm> trainList = new ArrayList<GroundTerm>(); List<GroundTerm> testList = new ArrayList<GroundTerm>(); // start sampling GroundTerm nextTrain = nodes.get(rand.nextInt(nodes.size())); nodes.remove(nextTrain); GroundTerm nextTest = nodes.get(rand.nextInt(nodes.size())); nodes.remove(nextTest); trainList.add(nextTrain); testList.add(nextTest); log.info("Started snowball sampling with train seed {}, test {}", nextTrain, nextTest); List<GroundTerm> frontierTrain = new ArrayList<GroundTerm>(); List<GroundTerm> frontierTest = new ArrayList<GroundTerm>(); boolean check; while (nodes.size() > 0 && (trainList.size() < targetSize || testList.size() < targetSize)) { // sample training point nextTrain = (rand.nextDouble() < explore) ? nodes.get(rand.nextInt(nodes.size())) : sampleNextNeighbor(db, edge, nextTrain, nodes, frontierTrain, rand); if (nextTrain == null) { nextTrain = nodes.get(rand.nextInt(nodes.size())); } check = nodes.remove(nextTrain); if (!check) { log.debug("Something went wrong. Attempted to add a train node {} that should have already been removed", nextTest); } trainList.add(nextTrain); if (!nodes.isEmpty()) { // sample testing point nextTest = (rand.nextDouble() < explore) ? nodes.get(rand.nextInt(nodes.size())) : sampleNextNeighbor(db, edge, nextTest, nodes, frontierTest, rand); if (nextTest == null) { nextTest = nodes.get(rand.nextInt(nodes.size())); } check = nodes.remove(nextTest); if (!check) log.debug("Something went wrong. Attempted to add a test node {} that should have already been removed", nextTest); testList.add(nextTest); } // log.debug("added {} to train, added {} to test", nextTrain, nextTest) } db.close(); Map<GroundTerm, Partition> keyMap = new HashMap<GroundTerm, Partition>(trainList.size() + testList.size()); for (GroundTerm term : trainList) keyMap.put(term, train); for (GroundTerm term : testList) keyMap.put(term, test); // test for consistent splits HashCodeBuilder hcb = new HashCodeBuilder(1,5); for (GroundTerm term : trainList) hcb.append(term); for (GroundTerm term : testList) hcb.append(term); log.info("Hashcode of snowball split: {}", hcb.toHashCode()); return processSplits(data, observedData, groundTruth, train, test, trainLabels, testLabels, queries, keys, keyMap); } private static GroundTerm sampleNextNeighbor(Database db, Predicate edge, GroundTerm node, List<GroundTerm> nodes, List<GroundTerm> frontier, Random rand) { Variable neighbor = new Variable("Neighbor"); QueryAtom q = new QueryAtom(edge, Queries.convertArguments(db, edge, node, neighbor)); ResultList results = db.executeQuery(new DatabaseQuery(q)); for (int i = 0; i < results.size(); i++) frontier.add(db.getAtom(edge, node, results.get(i)[0]).getArguments()[1]); frontier.retainAll(nodes); frontier.remove(node); if (frontier.isEmpty()) return null; int index = rand.nextInt(frontier.size()); Iterator<GroundTerm> iter; for (iter = frontier.iterator(); index > 0; iter.next()) index--; GroundTerm next = iter.next(); frontier.remove(next); return next; } /** * creates two splits of data by randomly sampling from partition fullData * and places one split in partition train and one in partition test. * @param data * @param trainTestRatio * @param fullData * @param train * @param test * @param filterRatio */ public static List<Set<GroundTerm>> generateRandomSplit(DataStore data, double trainTestRatio, Partition observedData, Partition groundTruth, Partition train, Partition test, Partition trainLabels, Partition testLabels, Set<DatabaseQuery> queries, Set<Variable> keys, double filterRatio) { log.info("Splitting data from " + observedData + " with ratio " + trainTestRatio + " into new partitions " + train +" and " + test); Database db = data.getDatabase(observedData, groundTruth); Set<GroundTerm> keySet = new HashSet<GroundTerm>(); for (DatabaseQuery q : queries) { ResultList groundings = db.executeQuery(q); for (Variable key : keys) { int keyIndex = q.getVariableIndex(key); if (keyIndex == -1) continue; for (int i = 0; i < groundings.size(); i++) { GroundTerm [] grounding = groundings.get(i); keySet.add(grounding[keyIndex]); } } } List<GroundTerm> keyList = new ArrayList<GroundTerm>(); keyList.addAll(keySet); Collections.sort(keyList); Collections.shuffle(keyList, rand); int split = (int) (keyList.size() * trainTestRatio); HashCodeBuilder hcb = new HashCodeBuilder(1,5); Map<GroundTerm, Partition> keyMap = new HashMap<GroundTerm, Partition>(); for (int i = 0; i < keyList.size(); i++) { if (i < split) keyMap.put(keyList.get(i), train); else keyMap.put(keyList.get(i), test); hcb.append(keyList.get(i)); } log.info("Found {} unique keys, split hashcode: {}", keyMap.size(), hcb.toHashCode()); db.close(); return processSplits(data, observedData, groundTruth, train, test, trainLabels, testLabels, queries, keys, keyMap); } private static List<Set <GroundTerm>> processSplits(DataStore data, Partition observedData, Partition groundTruth, Partition train, Partition test, Partition trainLabels, Partition testLabels, Set<DatabaseQuery> queries, Set<Variable> keys, Map<GroundTerm, Partition> keyMap) { List<Set<GroundTerm>> splits = new ArrayList<Set<GroundTerm>>(2); splits.add(0, new HashSet<GroundTerm>()); splits.add(1, new HashSet<GroundTerm>()); for (Map.Entry<GroundTerm, Partition> e : keyMap.entrySet()) { int index = -1; if (e.getValue() == train) index = 0; if (e.getValue() == test) index = 1; if (index >= 0) splits.get(index).add(e.getKey()); } Database db = data.getDatabase(observedData); log.info("Assigned " + splits.get(0).size() + " in train partition and " + splits.get(1).size() + " in test"); Partition [] partitions = {train, test}; for (Partition p : partitions) { log.debug("Putting data into partition " + p); for (DatabaseQuery q : queries) { // get predicate from query StandardPredicate predicate = (StandardPredicate) getPredicate(q); Inserter insert = data.getInserter(predicate, p); ResultList groundings = db.executeQuery(q); for (int i = 0; i < groundings.size(); i++) { GroundTerm [] grounding = groundings.get(i); // check if all keys in this ground term are in this split boolean add = true; for (Variable key : keys) { int keyIndex = q.getVariableIndex(key); if (keyIndex != -1 && keyMap.get(grounding[keyIndex]) != p) add = false; } if (add) { GroundAtom groundAtom = db.getAtom(predicate, grounding); insert.insertValue(groundAtom.getValue(), (Object []) groundAtom.getArguments()); log.trace("Inserted " + groundAtom + " into " + p); } } } } db.close(); db = data.getDatabase(groundTruth); // move labels from groundTruth into trainLabels and testLabels log.debug("Moving ground truth into split training and testing label partitions"); for (DatabaseQuery q : queries) { StandardPredicate predicate = (StandardPredicate) getPredicate(q); // insert into train label partition Inserter insert = data.getInserter(predicate, trainLabels); ResultList groundings = db.executeQuery(q); for (int i = 0; i < groundings.size(); i++) { GroundTerm [] grounding = groundings.get(i); // check if all keys in this ground term are in this split boolean add = true; for (Variable key : keys) { int keyIndex = q.getVariableIndex(key); if (keyIndex != -1 && keyMap.get(grounding[keyIndex]) != train) add = false; } if (add) { GroundAtom groundAtom = db.getAtom(predicate, grounding); insert.insertValue(groundAtom.getValue(), (Object []) groundAtom.getArguments()); log.trace("Inserted " + groundAtom + " into " + trainLabels); } } insert = data.getInserter(predicate, testLabels); groundings = db.executeQuery(q); for (int i = 0; i < groundings.size(); i++) { GroundTerm [] grounding = groundings.get(i); // check if all keys in this ground term are in this split boolean add = true; for (Variable key : keys) { int keyIndex = q.getVariableIndex(key); if (keyIndex != -1 && keyMap.get(grounding[keyIndex]) != test) add = false; } if (add) { GroundAtom groundAtom = db.getAtom(predicate, grounding); insert.insertValue(groundAtom.getValue(), (Object []) groundAtom.getArguments()); log.trace("Inserted " + groundAtom + " into " + testLabels); } } } db.close(); return splits; } /** * Generates a list of sets of GroundTerm []s from all groundings of provided predicates and partitions * Randomly splits uniformly among n sets * @param data * @param predicates Predicates to distribute * @param partitions partitions to look in * @param n number of splits to make * @return length n list of sets of GroundTerm arrays */ public static List<Set<GroundingWrapper>> splitGroundings(DataStore data, List<Predicate> predicates, List<Partition> partitions, int n) { List<Set<GroundingWrapper>> groundings = new ArrayList<Set<GroundingWrapper>>(n); for (int i = 0; i < n; i++) groundings.add(i, new HashSet<GroundingWrapper>()); Set<GroundingWrapper> allGroundings = new HashSet<GroundingWrapper>(); for (Partition part : partitions) { Database db = data.getDatabase(part); for (Predicate pred : predicates) { Set<GroundAtom> list = Queries.getAllAtoms(db, pred); for (GroundAtom atom : list) allGroundings.add(new GroundingWrapper(atom.getArguments())); } db.close(); } List<GroundingWrapper> allGroundingList = new ArrayList<GroundingWrapper>(allGroundings.size()); allGroundingList.addAll(allGroundings); Collections.sort(allGroundingList); HashCodeBuilder hcb = new HashCodeBuilder(3, 7); for (GroundingWrapper grounding : allGroundingList) { int i = rand.nextInt(n); groundings.get(i).add(grounding); hcb.append(grounding); hcb.append(i); } log.info("Split hashcode {}", hcb.toHashCode()); return groundings; } /** * Copies groundings of predicate from one partition to another * @param data * @param from * @param to * @param predicate * @param groundings */ public static void copy(DataStore data, Partition from, Partition to, Predicate predicate, Set<GroundingWrapper> groundings) { Inserter insert = data.getInserter((StandardPredicate) predicate, to); Set<StandardPredicate> predicates = new HashSet<StandardPredicate>(); predicates.add((StandardPredicate) predicate); Database db = data.getDatabase(from, predicates); for (GroundingWrapper grounding : groundings) { //log.debug("grounding length {}, first arg {}", grounding.length, grounding[0]) GroundAtom atom = db.getAtom(predicate, grounding.getArray()); if (atom instanceof ObservedAtom) insert.insertValue(atom.getValue(), (Object []) grounding.getArray()); else log.debug("Encountered non-ObservedAtom, " + atom); } db.close(); } private static Predicate getPredicate(DatabaseQuery q) { Set<Atom> atoms = new HashSet<Atom>(); q.getFormula().getAtoms(atoms); if (atoms.size() > 1) throw new IllegalArgumentException("Fold splitting query must be a single atom"); Atom atom = atoms.iterator().next(); Predicate predicate = atom.getPredicate(); return predicate; } }
[ "yzhan202@binghamton.edu" ]
yzhan202@binghamton.edu
041f8a9be84c238a94928c1df94c5fd0c5092517
06157dfbdd21f3d04ac4a76682cd4d70cb19f7d0
/src/item16/disco.java
afc61781e6020e981948230ccd2bc1a317c40268
[]
no_license
danielniebles/Practica1
f7b0f6ad5d520259123aad33c9360cd4c3a8db46
928693c79c40a64608a6f608f7c80cd03dbcf09a
refs/heads/master
2021-01-19T06:32:16.086992
2016-08-16T01:39:12
2016-08-16T01:39:12
65,693,925
0
0
null
null
null
null
UTF-8
Java
false
false
709
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 item16; /** * * @author Daniel */ public class disco extends publicacion{ private String duracion, precio; public void setDuracion(String duracion) { this.duracion = duracion; } public void setPrecio(String precio) { this.precio = precio; } public void Mostrar(){ System.out.println("Título: "+getTitulo()); System.out.println("Duración: "+duracion); System.out.println("Precio: "+precio); } }
[ "daniel.niebles@udea.edu.co" ]
daniel.niebles@udea.edu.co
a672a0734c9b272ded2edfc052b2c2d52e12681a
afd7287c7fb5a867b68636b8bd77e6a5ad6c7789
/StringLength.java
721fd95f329785b1a3c703aaa9d4a4c064d94ec7
[]
no_license
prasannapogunulla/play
02352b144701205e53a2d28d44124371f2fccade
626b1cb30ac2a4f0ae6cc6ee1e31f1f23abf70c6
refs/heads/master
2020-03-28T05:25:18.982853
2018-09-15T07:21:16
2018-09-15T07:21:16
147,775,003
0
0
null
null
null
null
UTF-8
Java
false
false
283
java
import java.util.Scanner; class StringLength { public static void main(String args[]) { String str; Scanner sc=new Scanner(System.in); str=sc.nextLine(); int i = 0; for(char c: str.toCharArray()) { i++; } System.out.println(i); } }
[ "noreply@github.com" ]
noreply@github.com
fdf622e8539cc27ad0d9f0c0da288e001534ddc3
e51c3f140f4b2536d2311744619343c4de4d24ee
/config-and-service-discovery/discovery-server/src/main/java/demo/hao/DiscoveryServerApplication.java
d037884be493f4460b1befa4758e6c712cce8dd8
[]
no_license
haodeng/microservice-tips
1bcc87d0d2fd1f246b0e30040390aff5849adc5f
1a223da0d671ae73083cc2682f0fd318df66571f
refs/heads/main
2023-07-21T19:03:25.183668
2021-08-14T19:42:38
2021-08-14T19:42:38
374,476,771
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package demo.hao; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class DiscoveryServerApplication { public static void main(String[] args) { SpringApplication.run(DiscoveryServerApplication.class, args); } }
[ "hao.deng.m@gmail.com" ]
hao.deng.m@gmail.com
e1b232b645dbb71a0aeecb0758f10b53ed945d9b
bbd3fc7820fec1532788f490d8684d3bfa3fe5a6
/src/main/java/com/cskaoyan/service/impl/ProcessCountCheckServiceImpl.java
7bc8a51a48809a096f339d7966a18f39941a212b
[]
no_license
1cutecoder/MyERP
2ff89056c06c1a92499a288387a72e4838d0c517
005ff8ccc555141fa90880782dd9cd6d9b442196
refs/heads/master
2022-12-25T12:08:18.518083
2019-07-04T02:50:31
2019-07-04T02:50:31
195,155,766
0
0
null
2022-12-16T04:51:54
2019-07-04T02:30:19
Java
UTF-8
Java
false
false
1,950
java
package com.cskaoyan.service.impl; import com.cskaoyan.bean.ProcessCountCheck; import com.cskaoyan.bean.ProcessCountCheckExample; import com.cskaoyan.bean.ProcessMeasureCheck; import com.cskaoyan.mapper.ProcessCountCheckMapper; import com.cskaoyan.service.ProcessCountCheckService; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class ProcessCountCheckServiceImpl implements ProcessCountCheckService { @Autowired ProcessCountCheckMapper processCountCheckMapper; @Override public List<ProcessCountCheck> findAllProcessCount(int page, int rows) { PageHelper.startPage(page,rows); List<ProcessCountCheck> allProcessCount = processCountCheckMapper.findAllProcessCount(); return allProcessCount; } @Override public int insert(ProcessCountCheck processCountCheck) { int i = processCountCheckMapper.insert(processCountCheck); return i; } @Override public int update(ProcessCountCheck processCountCheck) { int i = processCountCheckMapper.updateByPrimaryKey(processCountCheck); return i; } @Override public int deleteProcessCount(String[] ids) { int i = processCountCheckMapper.deleteProcessCount(ids); return i; } @Override public List<ProcessCountCheck> searchpCountById(String searchValue, int page, int rows) { int startIndex=(page-1)*rows; int pageSize=rows; List<ProcessCountCheck> processCountChecks = processCountCheckMapper.searchpCountById(searchValue, startIndex, pageSize); return processCountChecks; } @Override public long selectTotal() { ProcessCountCheckExample example = new ProcessCountCheckExample(); long total = processCountCheckMapper.countByExample(example); return total; } }
[ "820861340@qq.com" ]
820861340@qq.com
ddbf7b5795c656d9d406858db26a4a1b705b350c
fbbc1906e473ec06eaf3755154c84b087a96fe56
/src/main/java/de/tuberlin/dima/plugalong/Graphs.java
20d12b864cdf168c3b47ba9c8312707086ee5dfa
[]
no_license
sscdotopen/plugalong
863bf4eb377f5f061266b1ad9a644fb93deb7df7
1217f69018e271e0ae09ab7ea783c589083f7045
refs/heads/master
2021-01-01T18:34:53.520975
2012-09-18T12:19:55
2012-09-18T12:19:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
package de.tuberlin.dima.plugalong; import java.io.File; public class Graphs { //static final Graph MINI = new Graph(new File("/home/ssc/Entwicklung/projects/plugalong/src/main/resources/mini.csv"), "mini", 4); static final Graph FACEBOOK = new Graph(new File("/home/ssc/Entwicklung/projects/plugalong/src/main/resources/facebook.csv"), "facebook", 63732); static final Graph GOOGLE_WEB = new Graph(new File("/home/ssc/Entwicklung/projects/plugalong/src/main/resources/googleweb.csv"), "googleweb", 916428); static final Graph YOUTUBE = new Graph(new File("/home/ssc/Entwicklung/projects/plugalong/src/main/resources/youtube.csv"), "youtube", 100199); static final Graph ENRON = new Graph(new File("/home/ssc/Entwicklung/projects/plugalong/src/main/resources/enron.csv"), "enron", 36692); }
[ "ssc@apache.org" ]
ssc@apache.org
42a7b6eacba11c393f7f5ef5d62015e449736750
e1d6176203fb340e4c64eec770fa99f3813a1f59
/backend/stockmanagementsystemserver/src/main/java/com/stockmanagementsystem/server/controllers/constants/APIName.java
7998151f1d7c5ebb70cd674086eefb2f73266747
[]
no_license
O-Abdelaaziz/stockmanagementsystem
7835ef5dc2ee1243a056cff47a541efa2328f3ef
f296984462c47cae5b720a577dd7d8ecd2a07ce9
refs/heads/master
2023-06-20T20:49:48.485493
2021-07-27T06:13:25
2021-07-27T06:13:25
385,163,357
2
0
null
null
null
null
UTF-8
Java
false
false
3,314
java
package com.stockmanagementsystem.server.controllers.constants; /** * @Created 22/07/2021 - 13:32 * @Package com.stockmanagementsystem.server.controllers.constants * @Project stockmanagementsystemserver * @User LegendDZ * @Author Abdelaaziz Ouakala **/ public class APIName { public static final String APP_ROOT = "gestiondestock/v1"; public static final String AUTHENTICATE=APP_ROOT+"/authenticate"; public static final String ARTICLES="/articles"; public static final String ARTICLE_PATH_VARIABLE_ID ="id"; public static final String ARTICLE_PATH_VARIABLE_CODE ="code"; public static final String ARTICLE_PATH_ID ="/{id}"; public static final String ARTICLE_PATH_CODE ="/{code}"; public static final String CATEGORY="/categories"; public static final String CATEGORY_PATH_VARIABLE_ID ="id"; public static final String CATEGORY_PATH_VARIABLE_CODE ="code"; public static final String CATEGORY_PATH_ID ="/{id}"; public static final String CATEGORY_PATH_CODE ="/{code}"; public static final String CLIENT="/clients"; public static final String CLIENT_PATH_VARIABLE_ID ="id"; public static final String CLIENT_PATH_VARIABLE_CODE ="code"; public static final String CLIENT_PATH_ID ="/{id}"; public static final String CLIENT_PATH_CODE ="/{code}"; public static final String COMMANDE_CLIENT="/commandeclients"; public static final String COMMANDE_CLIENT_PATH_VARIABLE_ID ="id"; public static final String COMMANDE_CLIENT_PATH_VARIABLE_CODE ="code"; public static final String COMMANDE_CLIENT_PATH_ID ="/{id}"; public static final String COMMANDE_CLIENT_PATH_CODE ="/{code}"; public static final String FOURNISSEUR="/fournisseurs"; public static final String FOURNISSEUR_PATH_VARIABLE_ID ="id"; public static final String FOURNISSEUR_PATH_VARIABLE_CODE ="code"; public static final String FOURNISSEUR_PATH_ID ="/{id}"; public static final String FOURNISSEUR_PATH_CODE ="/{code}"; public static final String COMMANDE_FOURNISSEUR="/commandefournisseurs"; public static final String COMMANDE_FOURNISSEUR_PATH_VARIABLE_ID ="id"; public static final String COMMANDE_FOURNISSEUR_PATH_VARIABLE_CODE ="code"; public static final String COMMANDE_FOURNISSEUR_PATH_ID ="/{id}"; public static final String COMMANDE_FOURNISSEUR_PATH_CODE ="/{code}"; public static final String ENTREPRISE="/entreprises"; public static final String ENTREPRISE_PATH_VARIABLE_ID ="id"; public static final String ENTREPRISE_PATH_VARIABLE_CODE ="code"; public static final String ENTREPRISE_PATH_ID ="/{id}"; public static final String ENTREPRISE_PATH_CODE ="/{code}"; public static final String VENTES="/ventes"; public static final String VENTES_PATH_VARIABLE_ID ="id"; public static final String VENTES_PATH_VARIABLE_CODE ="code"; public static final String VENTES_PATH_ID ="/{id}"; public static final String VENTES_PATH_CODE ="/{code}"; public static final String UTILISATEUR="/utilisateur"; public static final String UTILISATEUR_PATH_VARIABLE_ID ="id"; public static final String UTILISATEUR_PATH_VARIABLE_CODE ="code"; public static final String UTILISATEUR_PATH_ID ="/{id}"; public static final String UTILISATEUR_PATH_CODE ="/{code}"; }
[ "mr.ouakala.abdelaaziz@gmail.com" ]
mr.ouakala.abdelaaziz@gmail.com
c480ce9e7411d06cb4fff9fdcf45b5f2f7b215c6
49b16f5fecb49bb551ad88b896481d7a48a18d26
/baiji-rpc-client/src/main/java/com/ctriposs/baiji/rpc/client/ServiceException.java
d4b84ea0148cf8f539af6ec2285d53bd1552821d
[ "Apache-2.0" ]
permissive
xiongs/baiji4j
5b3474ca0db0ba4e99cdb2ce9ec491148413bd69
640352016f45eb4ef6917edfd7fcdcdda56dfa2c
refs/heads/master
2021-01-22T19:35:19.337224
2014-09-28T08:25:04
2014-09-28T08:36:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,401
java
package com.ctriposs.baiji.rpc.client; import com.ctriposs.baiji.rpc.common.HasResponseStatus; import com.ctriposs.baiji.rpc.common.types.ErrorDataType; import com.ctriposs.baiji.rpc.common.types.ResponseStatusType; import java.util.List; public class ServiceException extends Exception implements HasExceptionType { private static final long serialVersionUID = -1L; private String _errorCode; private HasResponseStatus _responseObject; public ServiceException() { } public ServiceException(String message) { super(message); } public ServiceException(String message, HasResponseStatus responseObject) { super(message); _responseObject = responseObject; } public ServiceException(String message, HasResponseStatus responseObject, String errorCode) { super(message); _responseObject = responseObject; _errorCode = errorCode; } /** * Gets the error code of the first error * * @return */ public String getErrorCode() { return _errorCode; } /** * Sets the error code of the first error * * @param errorCode */ public void setErrorCode(String errorCode) { _errorCode = errorCode; } /** * Gets the deserialized response object containing error data * * @return */ public HasResponseStatus getResponseObject() { return _responseObject; } /** * Sets the deserialized response object containing error data * * @param responseObject */ public void setResponseObject(HasResponseStatus responseObject) { _responseObject = responseObject; } /** * Gets the list of error data * * @return */ public List<ErrorDataType> getResponseErrors() { if (_responseObject == null || _responseObject.getResponseStatus() == null) { return null; } return _responseObject.getResponseStatus().getErrors(); } @Override public String getExceptionTypeName() { ResponseStatusType responseStatus = _responseObject.getResponseStatus(); if (responseStatus != null && responseStatus.getErrors() != null && !responseStatus.getErrors().isEmpty()) return responseStatus.getErrors().get(0).getErrorClassification().toString().toLowerCase(); return "other"; } }
[ "kentstl@163.com" ]
kentstl@163.com
77b9bf74f6e78d8149feb2289fd99cd97fb6a8f9
305812427216ee3cd505dd6bcb274a37263c4c34
/Programming/Bike-rental/test/applicationlayer/RentBikeControllerTest.java
e71066f1111a1232f8e166f278edb0e37c510c28
[]
no_license
quangkhanh250699/TKXDPM.KSTN.20201-05
a71669c6c7590f7e8917a5e357ad8b4383665113
dada421f6c8906f96e6ffd883e4ce98679ac1331
refs/heads/main
2023-02-22T21:17:09.155024
2020-12-24T04:07:09
2020-12-24T04:07:09
302,371,800
0
0
null
null
null
null
UTF-8
Java
false
false
1,222
java
package applicationlayer; import barcode.SimpleBarcodeProcessor; import checkout.CreditCard; import datalayer.acessor.BikeAccessor; import datalayer.model.Bike; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class RentBikeControllerTest { private RentBikeController rentBikeController; private CreditCard card; @BeforeEach void setUp() { rentBikeController = new RentBikeController(); card = new CreditCard("118131_group5_2020", "Group 5", "296", "1125"); } @AfterEach void tearDown() { } @Test void requestBike() { String barcode = "1"; SimpleBarcodeProcessor processor = new SimpleBarcodeProcessor(); Bike bike = rentBikeController.requestBike(barcode); int bikeId = processor.processBarcode(barcode); assertEquals(bikeId, bike.getBikeId()); } @Test void requestRentBike() { Bike bike = (new BikeAccessor()).get(10); String notification = rentBikeController.requestRentBike(1, bike, card); assertEquals("Your transaction is successful!", notification); } }
[ "quangkhanh250699@gmail.com" ]
quangkhanh250699@gmail.com
1c691adfffa644d723ac846773daf86058cd9237
253779a1d458a060c7b87a0c522c485ec8563cd7
/composition/src/com/company/Main.java
dbbd70cf283bd89b0cecd690d45cc82b28dfc0ae
[]
no_license
tianchizhishui/java_basic_OOP
eb52d4d10cc413e5ed9db3d1306b1a84c791150a
3878a84199df80aa95f2622fc7e60d76c5efbeea
refs/heads/master
2020-08-16T01:56:43.978302
2019-10-16T02:39:17
2019-10-16T02:39:17
215,439,892
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.company; public class Main { public static void main(String[] args) { Dimensions dimensions = new Dimensions(20, 20, 5); Case theCase = new Case("220B", "Dell", "240", dimensions); Monitor monitor = new Monitor("27 inch Beast", "acer", 27, new Resolution(2540, 1440)); MatherBoard matherBoard = new MatherBoard("BJ-200", "asus", 4, 6, "v2.44"); PC thePC = new PC(theCase, monitor, matherBoard); thePC.powerUp(); } }
[ "55475915+tianchizhishui@users.noreply.github.com" ]
55475915+tianchizhishui@users.noreply.github.com
05fc4fdf5800f5e646653a570876f86b309e761d
c6363a7aa8645bbc497554c2e1e7fd88e6962dbb
/app/src/main/java/disono/webmons/com/Configurations.java
aa17250bd7573f31ad96522021ea274bfda288d9
[ "Apache-2.0" ]
permissive
dukererenst/android-clean-architecture-boilerplate
3e3822e31d41bd7d94416550191449f29ccc317e
e6aacdb7165c072cd3f82f160a562f712c2e959a
refs/heads/master
2020-08-31T12:33:56.410273
2016-10-14T07:22:50
2016-10-14T07:22:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,350
java
package disono.webmons.com; /** * Author: Archie, Disono (disono.apd@gmail.com / webmonsph@gmail.com) * Website: www.webmons.com * License: Apache 2.0 * Copyright 2016 Webmons Development Studio. * Created at: 8/24/2016 6:51 PM */ public class Configurations { private final static String _baseURL = "http://your-domain/api/v1/"; private final static String _socketIOURL = "http://your-domain:port/"; // token expiry date (minutes) private final static int _JWT_Exp = 60; // earliest point in time that the token can be used (minutes) private final static int _JWT_Nbf = 30; // SIP private final static String _SIPDomain = ""; /** * String values * * @param key * @return */ public static String envString(String key) { switch (key) { case "baseURL": return _baseURL; case "socketIOURL": return _socketIOURL; case "sipDomain": return _SIPDomain; } return null; } /** * Integer values * * @param key * @return */ public static int envInt(String key) { if (key.equals("JWT_Exp")) { return _JWT_Exp; } else if (key.equals("JWT_Nbf")) { return _JWT_Nbf; } return 0; } }
[ "disonoarchie@gmail.com" ]
disonoarchie@gmail.com
e20bd49a18eb3c1d881e092110ada8419d0ee1a8
9d8003bb5b58c20b7ee1f4b8d140c86f7549054c
/src/main/java/Controller/ObslugaPlatnosciController.java
57f086ae7756e29a481910c8d6a85c59ee8284ae
[]
no_license
Apteka321/Przychodnia
334363343e57ba71712333f773a02d69d7c510f0
19ec707847f0bd9f9d836a15e752fbb2b8c9713b
refs/heads/master
2020-05-21T21:54:23.850227
2017-05-28T13:19:06
2017-05-28T13:19:06
84,091,881
2
0
null
null
null
null
WINDOWS-1250
Java
false
false
7,657
java
package Controller; import java.math.BigDecimal; import java.net.URL; import java.util.Calendar; import java.util.List; import java.util.ResourceBundle; import org.hibernate.Query; import org.hibernate.Session; import View.Komunikaty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Label; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import model.HibernateUtil; import model.Recepcjonistka; import model.Wizyta; import model.Zabieg; import model.repository.impl.KontaRepositoryImpl; import model.repository.impl.KontoRepositoryImpl; import model.repository.impl.MetodyPielegniarkiImpl; import model.repository.impl.MetodyRecepcjonistkaImpl; public class ObslugaPlatnosciController implements Initializable { @FXML private TableView<WizytaPlatnosc> tabelaDoZaplaty; @FXML private TableColumn<WizytaPlatnosc, Integer> kolumnaIdWizyty; @FXML private TableColumn<WizytaPlatnosc, String> kolumnaImie; @FXML private TableColumn<WizytaPlatnosc, String> kolumnaNazwisko; @FXML private TableColumn<WizytaPlatnosc, BigDecimal> kolumnaZaplata; @FXML private TableColumn<WizytaPlatnosc, String> kolumnaRodzaj; @FXML private Label sumaZaplata; public ObservableList<WizytaPlatnosc> listaDluznikow; MetodyRecepcjonistkaImpl metodyRecepcjonistkaImpl = new MetodyRecepcjonistkaImpl(); public Recepcjonistka recepcjonistka = new KontaRepositoryImpl().getListaRecepcjonistek().get(0); public void initialize(URL arg0, ResourceBundle arg1) { try { kolumnaIdWizyty.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, Integer>("idWizyty")); kolumnaImie.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, String>("imie")); kolumnaNazwisko.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, String>("nazwisko")); kolumnaZaplata.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, BigDecimal>("suma")); kolumnaRodzaj.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, String>("tytul")); listaDluznikow = FXCollections.observableArrayList(); Session session = HibernateUtil.getSessionFactory().openSession(); Query query = session.createQuery("From Wizyta where Czy_Ubezpieczony =" + 0); List<Wizyta> lista = query.list(); for (Wizyta wizyta : lista) { if (!(wizyta.getStatus_wizyty().equals("Zaplacono"))) { WizytaPlatnosc wPlatnosc = new WizytaPlatnosc(wizyta.getID(), wizyta.getPESEL_pacjenta().getOsoba().getImie(), wizyta.getPESEL_pacjenta().getOsoba().getNazwisko(), wizyta.getID_Specjalizacji().getKoszt_wizyty(), "Wizyta"); listaDluznikow.add(wPlatnosc); } } Query query2 = session.createQuery("From Zabieg"); List<Zabieg> listaZ = query2.list(); for (Zabieg zabieg : listaZ) { if (zabieg.getSkierowanie().getID_wizyty().getCzy_ubezpieczony() == 0) { if (!(zabieg.getSkierowanie().getID_wizyty().getStatus_wizyty().equals("Zaplacono"))) { WizytaPlatnosc wPlatnosc = new WizytaPlatnosc(zabieg.getSkierowanie().getID_wizyty().getID(), zabieg.getSkierowanie().getID_wizyty().getPESEL_pacjenta().getOsoba().getImie(), zabieg.getSkierowanie().getID_wizyty().getPESEL_pacjenta().getOsoba().getNazwisko(), zabieg.getLista_zabiegow().getCena(), "Zabieg"); listaDluznikow.add(wPlatnosc); } } } tabelaDoZaplaty.setItems(listaDluznikow); session.close(); } catch (Exception e) { Komunikaty.wyswietlInformacje("Informacja", "Brak dłużników"); } } BigDecimal cena; Integer idWiztyt; @FXML void poKliknieciu(MouseEvent event) { sumaZaplata.setText(tabelaDoZaplaty.getSelectionModel().getSelectedItem().getSuma().toString()); cena = tabelaDoZaplaty.getSelectionModel().getSelectedItem().getSuma(); idWiztyt = tabelaDoZaplaty.getSelectionModel().getSelectedItem().getIdWizyty(); } @FXML void zaplac(ActionEvent event) { java.sql.Date date = new java.sql.Date(Calendar.getInstance().getTime().getTime()); Session session = HibernateUtil.getSessionFactory().openSession(); metodyRecepcjonistkaImpl.dokonajPlatnosci(idWiztyt, recepcjonistka, cena, date); for (int i = 0; i < tabelaDoZaplaty.getItems().size(); i++) { tabelaDoZaplaty.getItems().clear(); } try { kolumnaIdWizyty.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, Integer>("idWizyty")); kolumnaImie.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, String>("imie")); kolumnaNazwisko.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, String>("nazwisko")); kolumnaZaplata.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, BigDecimal>("suma")); kolumnaRodzaj.setCellValueFactory(new PropertyValueFactory<WizytaPlatnosc, String>("tytul")); listaDluznikow = FXCollections.observableArrayList(); Query query = session.createQuery("From Wizyta where Czy_Ubezpieczony =" + 0); List<Wizyta> lista = query.list(); for (Wizyta wizyta : lista) { if (!(wizyta.getStatus_wizyty().equals("Zaplacono"))) { WizytaPlatnosc wPlatnosc = new WizytaPlatnosc(wizyta.getID(), wizyta.getPESEL_pacjenta().getOsoba().getImie(), wizyta.getPESEL_pacjenta().getOsoba().getNazwisko(), wizyta.getID_Specjalizacji().getKoszt_wizyty(), "Wizyta"); listaDluznikow.add(wPlatnosc); } } Query query2 = session.createQuery("From Zabieg"); List<Zabieg> listaZ = query2.list(); for (Zabieg zabieg : listaZ) { if (zabieg.getSkierowanie().getID_wizyty().getCzy_ubezpieczony() == 0) { if (!(zabieg.getSkierowanie().getID_wizyty().getStatus_wizyty().equals("Zaplacono"))) { WizytaPlatnosc wPlatnosc = new WizytaPlatnosc(zabieg.getSkierowanie().getID_wizyty().getID(), zabieg.getSkierowanie().getID_wizyty().getPESEL_pacjenta().getOsoba().getImie(), zabieg.getSkierowanie().getID_wizyty().getPESEL_pacjenta().getOsoba().getNazwisko(), zabieg.getLista_zabiegow().getCena(), "Zabieg"); listaDluznikow.add(wPlatnosc); } } } tabelaDoZaplaty.setItems(listaDluznikow); session.close(); } catch (Exception e) { Komunikaty.wyswietlInformacje("Informacja", "Brak dłużników"); } } public class WizytaPlatnosc { Integer idWizyty; String imie; String nazwisko; BigDecimal suma; String tytul; public Integer getIdWizyty() { return idWizyty; } public void setIdWizyty(Integer idWizyty) { this.idWizyty = idWizyty; } public String getImie() { return imie; } public void setImie(String imie) { this.imie = imie; } public String getNazwisko() { return nazwisko; } public void setNazwisko(String nazwisko) { this.nazwisko = nazwisko; } public BigDecimal getSuma() { return suma; } public void setSuma(BigDecimal suma) { this.suma = suma; } public String getTytul() { return tytul; } public void setTytul(String tytul) { this.tytul = tytul; } public WizytaPlatnosc(Integer idWizyty, String imie, String nazwisko, BigDecimal suma, String tytul) { super(); this.idWizyty = idWizyty; this.imie = imie; this.nazwisko = nazwisko; this.suma = suma; this.tytul = tytul; } } }
[ "Daniel@Daniel-Komputer" ]
Daniel@Daniel-Komputer
3ed397633624b75c7afa0a502a7ab80d93825f82
a4e43fec0d8e3ce462bb6a9fcdab073fc94bb659
/net.younic.content/src/net/younic/content/internal/StringResourceConverter.java
7c161c50f569d3706d6a42833566ce23ffeac4c8
[ "Apache-2.0" ]
permissive
escv/younic
ceaaf3115d3c0c96731219ffa4ad8bdbbb92b8dd
384a60c47d9de7e68e3a2c5b8a498437f946caee
refs/heads/master
2023-01-22T06:06:24.250652
2023-01-21T13:03:24
2023-01-21T13:03:24
121,954,090
7
0
Apache-2.0
2023-01-11T18:49:34
2018-02-18T13:24:47
Java
UTF-8
Java
false
false
1,589
java
/* * ============================================================================= * * Copyright (c) 2011-2016, The younic team (https://github.com/escv/younic) * * 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 net.younic.content.internal; import java.io.IOException; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import net.younic.content.IResourceConverter; import net.younic.core.api.IResourceContentProvider; import net.younic.core.api.Resource; @Component(service=IResourceConverter.class) public class StringResourceConverter implements IResourceConverter { @Reference private IResourceContentProvider contentProvider; @Override public Object convert(Resource resource) throws IOException { return contentProvider.readContent(resource); } @Override public boolean handles(Resource resource) { return true; } @Override public int rank() { return 0; } }
[ "andre.albert@prodyna.com" ]
andre.albert@prodyna.com
fa32f14245000acb848f04df9476e662a679de17
97d193999ac3f516b6585e56b249dab6a16225b9
/src/br/com/dnkt/examples/java8/numericstreams/NumericStreamBoxingUnboxingExample.java
8c3505e90ad63657ba1b180aae2525a15afb4953
[]
no_license
DanielMouraCavalcante/java8-examples
843d1448f7cf2a3de3f3d46230aae189b5397707
6edcf97ee234c0c63aef6573ef1445a6995aec9e
refs/heads/main
2023-02-03T08:06:14.283887
2020-12-17T11:20:25
2020-12-17T11:20:25
322,270,294
0
0
null
null
null
null
UTF-8
Java
false
false
946
java
package br.com.dnkt.examples.java8.numericstreams; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; public class NumericStreamBoxingUnboxingExample { public static List<Integer> boxing() { return IntStream.rangeClosed(1,25) .boxed() //Stream<Integer> //all the elements will be passed one by one to get to the result as the collection. .collect(Collectors.toList()); } public static int unBoxing(List<Integer> integerList) { int sum = integerList.stream() .mapToInt(Integer::intValue).sum(); return sum; } public static void main(String[] args) { System.out.println("Converting PrimitiveStream to List : "+ boxing()); List<Integer> integers = boxing(); System.out.println("Sum using Unboding : " + unBoxing(integers)); } }
[ "daniel.cavalcante@picpay.com" ]
daniel.cavalcante@picpay.com
2584f1a995e81f25f0d8f4704977c4356a632307
2c8310792719730a67e743557c28f208a64fbed5
/CaseStudyFinal/src/com/ems/entities/Room.java
539c7cebd80c8c281ad01821b172fede3049d338
[ "MIT" ]
permissive
syip01/ManageIt
6ecd6f1383a32ff85466c2c81a2c0f9e04d1ddce
007970468d69887505c3a2a6430ed13e9d99a949
refs/heads/master
2022-12-23T21:27:57.866949
2019-09-05T04:06:27
2019-09-05T04:06:27
206,456,158
0
0
MIT
2022-12-16T00:41:38
2019-09-05T02:18:16
CSS
UTF-8
Java
false
false
1,816
java
package com.ems.entities; import javax.persistence.*; import javax.validation.constraints.*; @Entity @Table @NamedQueries ({ @NamedQuery (query="SELECT r FROM Room r", name="queryAllRooms"), @NamedQuery (query="SELECT r FROM Room r WHERE r.name=:name", name="queryRoom"), }) public class Room { @Transient private static final int DEFAULT_ID = 0; @Id @GeneratedValue @Min(0) private int id; @Basic @Column(nullable = false, unique = true) @NotNull @Size(min = 4, max = 30, message="Name length must be between {2} and {1}") private String name; @Basic @Column(nullable = false) @NotNull @Size(min = 4, max = 50, message="Location length must be between {2} and {1}") private String location; public Room() { this(DEFAULT_ID, "Default Name", "Default Location"); } public Room(int id, String name, String location) { super(); this.setId(id); this.name = name; this.location = location; } public int getId() { return id; } public void setId(int id) { if(id < DEFAULT_ID) throw new IllegalArgumentException("Invalid id: Must be greater than " + DEFAULT_ID); this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } @Override public String toString() { return "Room [id=" + id + ", name=" + name + ", location=" + location + "]"; } @Override public boolean equals(Object obj) { if(obj instanceof Room) { Room obj2 = (Room) obj; return this.id == obj2.id && this.name.equals(obj2.name) && this.location.equals(obj2.location); } return false; } }
[ "syip01@gmail.com" ]
syip01@gmail.com
5be63d6f3039d85ea8e6c55383efe78ad2287ce9
5fa8c6ad6e6dd1652a59b682d5fdeb5f74bd3f6a
/src/sujin/Kruskal/Q1922.java
c3de851bf2724595aac745797989269f75027dcb
[]
no_license
SujinJeong/SSAFY_ALGO_STUDY
3183223ad089847e2264b7645e56b88b16f96535
bf9a8cf49e272acefff0cc890eaa6afe5d85c947
refs/heads/master
2023-07-19T04:15:23.440682
2021-09-05T06:27:01
2021-09-05T06:27:01
332,477,282
3
8
null
2021-01-28T12:16:40
2021-01-24T14:59:11
Java
UTF-8
Java
false
false
2,036
java
package sujin.Kruskal; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Q1922 { static int[] parent; static class Info implements Comparable<Info> { int start, end, weight; public Info(int start, int end, int weight) { super(); this.start = start; this.end = end; this.weight = weight; } @Override public int compareTo(Info o) { return this.weight - o.weight; } } public static int getParent(int x) { if (parent[x] == x) return x; return parent[x] = getParent(parent[x]); } public static void unionFind(int x, int y) { int p1 = getParent(x); int p2 = getParent(y); if (p1 < p2) { // 부모가 다를 떄 연결 parent[p2] = p1; } else { parent[p1] = p2; } } public static boolean findParent(int x, int y) { int p1 = getParent(x); int p2 = getParent(y); if (p1 == p2) { // 부모가 다를 떄 연결 return true; } else return false; } public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; PriorityQueue<Info> pq = new PriorityQueue<>(); int n = Integer.parseInt(br.readLine()); int m = Integer.parseInt(br.readLine()); parent = new int[n + 1]; // 초기화 for (int i = 0; i <= n; i++) { parent[i] = i; } for (int i = 0; i < m; i++) { st = new StringTokenizer(br.readLine()); int start = Integer.parseInt(st.nextToken()); int end = Integer.parseInt(st.nextToken()); int weight = Integer.parseInt(st.nextToken()); pq.add(new Info(start, end, weight)); } // 최소 비용 찾기 int rslt = 0; while (!pq.isEmpty()) { Info i = pq.poll(); // 같은부모면 이미 계산 되었음 if (findParent(i.start, i.end)) continue; else { unionFind(i.start, i.end); rslt += i.weight; } } System.out.println(rslt); } }
[ "64065318+SujinJeong@users.noreply.github.com" ]
64065318+SujinJeong@users.noreply.github.com
aa1b5ee28549abbe391399f6d7e324702b552c43
d422e6bef4d71b84e6d301f84633d24eca8e6b1f
/jdk-demo/src/test/java/com/adeng/java8/concurrent/CompletableFutureTest.java
0602fafe22f617f7deb7c7bd8dd7e160aedfe132
[]
no_license
adeng-wc/j2ee-demo
f5b90dfd370217fb046f1d9976325bd236634b38
09326d9a6e2a8a4d7710e3a26651c76fde30f598
refs/heads/master
2023-04-30T08:40:26.015903
2023-04-23T08:12:02
2023-04-23T08:12:02
174,507,762
0
1
null
2022-12-29T12:06:08
2019-03-08T09:27:22
Java
UTF-8
Java
false
false
9,689
java
package com.adeng.java8.concurrent; import org.junit.Test; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; /** * @author hzwengcheng 2018-06-18 10:48 */ public class CompletableFutureTest { @Test public void thenApply() { String result = CompletableFuture.supplyAsync(() -> "hello").thenApply(s -> s + " world").join(); System.out.println(result); } @Test public void thenAccept() { CompletableFuture.supplyAsync(() -> "hello").thenAccept(s -> System.out.println(s + " world")); } /** * 对上一步的计算结果不关心,执行下一个操作 */ @Test public void thenRun() { CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "hello"; }).thenRun(() -> System.out.println("hello world")); while (!future.isDone()) { } } @Test public void test() throws ExecutionException, InterruptedException { //异步 CompletableFuture<String> completableFuture = CompletableFuture.supplyAsync(() -> String.format("[Thread: %s]Hello,world!", Thread.currentThread().getName())); String value = completableFuture.get(); System.out.println("value: " + value); System.out.println("starting"); } @Test public void thenCombine() { //聚合 CombinedEntity result = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "hello"; }).thenCombine(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return "world"; }), (s1, s2) -> { return CombinedEntity.builder() .name(s1).nickName(s2).build(); }).join(); System.out.println(result); } @Test public void thenCombineAsync() { //聚合 CombinedEntity result = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return CombinedEntity.builder().name("testName" + System.currentTimeMillis()).build(); }).thenCombineAsync(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return CombinedEntity.builder().nickName("testNickName" + System.currentTimeMillis()).build(); }), (s1, s2) -> { return CombinedEntity.builder() .name(s1.getName()).nickName(s2.getNickName()).build(); }).join(); System.out.println(result); } @Test public void allOf() throws ExecutionException, InterruptedException { Random rand = new Random(); CompletableFuture<String> future1 = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(5000 + rand.nextInt(1000)); } catch (InterruptedException e) { e.printStackTrace(); } return "100:" + System.currentTimeMillis(); }).exceptionally((e) -> { System.out.println(e); return null; }); CompletableFuture<String> future2 = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(5000 + rand.nextInt(1000)); } catch (InterruptedException e) { e.printStackTrace(); } return "abc:" + System.currentTimeMillis(); }).exceptionally((e) -> { System.out.println(e); return null; }); CompletableFuture<Void> f = CompletableFuture.allOf(future1, future2); // CompletableFuture<Object> f = CompletableFuture.anyOf(future1, future2); System.out.println(f.get()); System.out.println("starting"); System.out.println(future1.get() + " " + future2.get()); } @Test public void thenAcceptBoth() { CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "hello"; }).thenAcceptBoth(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return "world"; }), (s1, s2) -> System.out.println(s1 + " " + s2)); while (!future.isDone()) { } } @Test public void runAfterBoth() { CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "s1"; }).runAfterBothAsync(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return "s2"; }), () -> System.out.println("hello world")); while (!future.isDone()) { } } @Test public void applyToEither() { String result = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return "s1"; }).applyToEither(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "hello world"; }), s -> s).join(); System.out.println(result); } @Test public void acceptEither() { CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return "s1"; }).acceptEither(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "hello world"; }), System.out::println); while (!future.isDone()) { } } @Test public void runAfterEither() { CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return "s1"; }).runAfterEither(CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "s2"; }), () -> System.out.println("hello world")); while (!future.isDone()) { } } @Test public void exceptionally() { String result = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } if (1 == 1) { throw new RuntimeException("测试一下异常情况"); } return "s1"; }).exceptionally(e -> { System.out.println(e.getMessage()); return "hello world"; }).join(); System.out.println(result); } @Test public void whenComplete() { String result = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } if (1 == 1) { throw new RuntimeException("测试一下异常情况"); } return "s1"; }).whenComplete((s, t) -> { System.out.println(s); System.out.println(t.getMessage()); }).exceptionally(e -> { System.out.println(e.getMessage()); return "hello world"; }).join(); System.out.println(result); } /** * 运行完成时,对结果的处理。这里的完成时有两种情况,一种是正常执行,返回值。另外一种是遇到异常抛出造成程序的中断。 */ @Test public void handle() { String result = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } //出现异常 if (1 == 1) { throw new RuntimeException("测试一下异常情况"); } return "s1"; }).handle((s, t) -> { if (t != null) { return "hello world"; } return s; }).join(); System.out.println(result); } }
[ "wengcheng@corp.netease.com" ]
wengcheng@corp.netease.com
46046133a09eb8e25ac422e44549b419128dd1bf
fe527f24f626dfd8cb1911c65f4f9207fba316c9
/src/jp/syoboi/android/garaponmate/view/PlayerVideoView.java
908053bc7157dbf873453a6d8c7bf3e49d825770
[]
no_license
gaeeyo/garaponMate
8f077a2d817017210d099d81c61eb8db6ea0479e
14e3f38262ff918b7ff3370a67f3358d3de9941e
refs/heads/master
2020-06-03T21:43:27.161804
2014-08-23T01:26:09
2014-08-23T01:26:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,141
java
package jp.syoboi.android.garaponmate.view; import android.content.Context; import android.content.res.Resources; import android.media.MediaPlayer; import android.media.MediaPlayer.OnBufferingUpdateListener; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnSeekCompleteListener; import android.net.Uri; import android.util.Log; import android.view.View; import android.widget.VideoView; import jp.syoboi.android.garaponmate.Prefs; import jp.syoboi.android.garaponmate.R; public class PlayerVideoView implements PlayerViewInterface { private static final String TAG = "PlayerVideoView"; VideoView mVideoView; boolean mPause; boolean mStarted; boolean mStopped = true; int mDuration; int mCurPos; int mSeekPos; boolean mSeeking; String mPendingId; PlayerViewCallback mCallback; Resources mResources; MediaPlayer mMediaPlayer; public PlayerVideoView(Context context, PlayerViewCallback callback) { mResources = context.getResources(); mVideoView = new VideoView(context) { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { Log.v(TAG, "onSizeChanged w:" + w + " h:" + h); super.onSizeChanged(w, h, oldw, oldh); } }; mCallback = callback; mVideoView.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mPause = true; } }); mVideoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mMediaPlayer = mp; if (mPendingId != null) { mPause = false; mStarted = false; String id = mPendingId; mPendingId = null; setVideo(id); return; } if (mCallback != null) { mCallback.onMessage(null); } mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() { @Override public void onBufferingUpdate(MediaPlayer mp, int percent) { if (mCallback != null) { if (percent == 100) { mCallback.onMessage(null); } else { mCallback.onMessage(mResources.getString(R.string.bufferingFmt, percent)); } } } }); mp.setOnSeekCompleteListener(new OnSeekCompleteListener() { @Override public void onSeekComplete(MediaPlayer mp) { mSeeking = false; if (mSeekPos != 0) { int seekPos = mSeekPos; mSeekPos = 0; seek(seekPos); } } }); mp.setScreenOnWhilePlaying(true); mDuration = mVideoView.getDuration(); play(); } }); mVideoView.setOnErrorListener(new OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { String whatMsg; switch (what) { case MediaPlayer.MEDIA_ERROR_UNKNOWN: whatMsg = "MEDIA_ERROR_UNKNOWN"; break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: whatMsg = "MEDIA_ERROR_SERVER_DIED"; break; default: whatMsg = "what:" + what; break; } String extraMsg; switch (extra) { case MediaPlayer.MEDIA_ERROR_IO: extraMsg = "MEDIA_ERROR_IO"; break; case MediaPlayer.MEDIA_ERROR_MALFORMED: extraMsg = "MEDIA_ERROR_MALFORMED"; break; case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: extraMsg = "MEDIA_ERROR_UNSUPPORTED"; break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: extraMsg = "MEDIA_ERROR_TIMED_OUT"; break; default: extraMsg = "extra:" + extra; break; } mCallback.onMessage("ERROR:\nwhat:" + whatMsg + "\n" + extraMsg); return true; } }); } @Override public void play() { mVideoView.start(); mStarted = true; mPause = false; } @Override public void stop() { mPause = true; if (mVideoView.isPlaying()) { mVideoView.stopPlayback(); } } @Override public void pause() { mPause = true; if (mVideoView.isPlaying()) { mVideoView.pause(); } } @Override public void setVideo(final String id) { stop(); mCallback.onMessage(mResources.getString(R.string.loading)); mPause = false; mDuration = 0; mStarted = false; mStopped = false; Uri uri = Uri.parse("http://" + Prefs.getGaraponHost() + "/cgi-bin/play/m3u8.cgi?" + id + "-" + Prefs.getCommonSessionId()); mVideoView.setVideoURI(uri); } @Override public void onPause() { mCurPos = mVideoView.getCurrentPosition(); if (mStarted) { mVideoView.suspend(); } } @Override public void onResume() { mVideoView.resume(); if (mCurPos != 0) { mVideoView.seekTo(mCurPos); mCurPos = 0; } } @Override public void destroy() { mVideoView.stopPlayback(); mCallback = null; } @Override public void jump(int sec) { if (!mSeeking) { mSeeking = true; int curPos = mVideoView.getCurrentPosition(); if (sec > 0) { mCurPos = curPos + sec * 1000; if (mVideoView.canSeekForward()) { mVideoView.seekTo(mCurPos); } } else { mCurPos = curPos + sec * 1000; if (mVideoView.canSeekBackward()) { mVideoView.seekTo(mCurPos); } } } else { mSeekPos = mCurPos + sec * 1000; } } @Override public View getView() { return mVideoView; } @Override public void seek(int msec) { if (!mSeeking) { mSeeking = true; mCurPos = msec; mVideoView.seekTo(msec); } else { mSeekPos = msec; } } @Override public int getDuration() { return mVideoView.getDuration(); } @Override public int getCurrentPos() { if (mSeeking) { return mCurPos; } return mVideoView.getCurrentPosition(); } @Override public void setSound(String lr) { if (mMediaPlayer != null) { if ("L".equals(lr)) { mMediaPlayer.setVolume(1, 0); } else if ("R".equals(lr)) { mMediaPlayer.setVolume(0, 1); } else { mMediaPlayer.setVolume(1, 1); } } } @Override public boolean isSetSoundAvailable() { return true; } @Override public void setSpeed(float speed) { // TODO Auto-generated method stub } @Override public boolean isSpeedAvailable() { // TODO Auto-generated method stub return false; } }
[ "iknnofm0126@gmail.com" ]
iknnofm0126@gmail.com
db607520b2843318afa095ea5e84e641c95f1f97
55801effeb61f64ce38b411af7d5c0c958c18fce
/src/test/java/com/bartek/library/controller/book/NewBookPurchaseRequestControllerTest.java
50c5f6989a4debc021170fab86f5eea9f9895bc5
[ "MIT" ]
permissive
Dzionek95/Library
cd0542235d11184a5d8ebc7d67f1d885109b40a4
104152f727d742f74d30a206e591ae36826809c8
refs/heads/master
2018-07-03T03:29:39.669058
2018-05-31T17:54:44
2018-05-31T17:54:44
119,084,065
1
0
MIT
2018-02-05T14:15:36
2018-01-26T17:49:33
Java
UTF-8
Java
false
false
2,604
java
package com.bartek.library.controller.book; import com.bartek.library.model.book.NewBookPurchaseRequest; import com.bartek.library.service.book.NewBookPurchaseRequestService; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(controllers = NewBookPurchaseRequestController.class, secure = false) @RunWith(SpringRunner.class) public class NewBookPurchaseRequestControllerTest { @Autowired private MockMvc mockMvc; @MockBean private NewBookPurchaseRequestService newBookPurchaseRequestService; @Test public void shouldReturnOneBookByCreateNewBookRequest() throws Exception { //given LocalDateTime dummyTime = LocalDateTime.parse("2018-01-10 20:59:42", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); //TODO find out why I cannot pass dummy time NewBookPurchaseRequest dummyPurchaseRequest = NewBookPurchaseRequest .builder() .approved(false) .author("Adam Malysz") .title("Jak skakac wysoko?") .category("Poradnik") .requestedBy("Zbyszek") .build(); String expectedResponse = "{\"id\":0,\"title\":\"Jak skakac wysoko?\",\"author\":\"Adam Malysz\",\"category\":\"Poradnik\",\"requestedBy\":\"Zbyszek\",\"dateOfRequest\":null,\"approved\":false}"; //when when(newBookPurchaseRequestService.createNewBookRequest(any())).thenReturn(dummyPurchaseRequest); //then Assert.assertEquals(expectedResponse, mockMvc.perform(post("/purchase/save") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(new ObjectMapper().writeValueAsString(dummyPurchaseRequest))) .andExpect(status().isOk()) .andReturn().getResponse().getContentAsString()); } }
[ "bartlomiej9519@gmail.com" ]
bartlomiej9519@gmail.com
d8f28442ec981a4ceca68bf47827129a033c868e
963701167846372d0c756d2aa3828fa5387520b0
/app/src/main/java/fauzi/hilmy/quizgojek/ActivityDetailKuliner.java
79c43c3751175ad0b0477cbad02851080a981252
[]
no_license
Fauzee26/QuizRecyclerView
a9f284e4ab511bca40d31b509e46af16c90e312b
6e1d6c75c32c295f9ca5a8ee8428e5de2b999314
refs/heads/master
2021-05-02T05:47:28.962202
2018-02-09T02:49:11
2018-02-09T02:49:11
120,848,571
0
0
null
null
null
null
UTF-8
Java
false
false
1,043
java
package fauzi.hilmy.quizgojek; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; import android.widget.TextView; public class ActivityDetailKuliner extends AppCompatActivity { TextView lblNama, lblDetail; ImageView img; String nama, detail; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_kuliner); Intent gfdsa = getIntent(); nama = gfdsa.getStringExtra("namaa"); detail = gfdsa.getStringExtra("detaila"); lblNama = (TextView)findViewById(R.id.lblNama); lblDetail = (TextView)findViewById(R.id.lblDetail); img = (ImageView)findViewById(R.id.img); lblNama.setText(nama); lblDetail.setText(detail); Bundle mBundle = getIntent().getExtras(); if (mBundle != null){ img.setImageResource(mBundle.getInt("imga")); } } }
[ "32213481+Fauzee26@users.noreply.github.com" ]
32213481+Fauzee26@users.noreply.github.com
3bc3ec2ae12dbf856ab6265213aa22381263ebda
d89abab2356b49f6a52cae524a64545f51c8419d
/src/main/java/ams/service/IBasicUserService.java
c94f4a56d5303a4054103227bc40bd609f250418
[]
no_license
Plum00LI/ams
f87ddba109997f34c8140783b11ae798a48ad60b
2dc0bde489dc4b781c088bb8018ba556d3a0f714
refs/heads/master
2023-01-25T03:35:51.120182
2020-12-06T15:26:26
2020-12-06T15:26:26
318,594,691
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
package ams.service; import javax.servlet.http.HttpServletResponse; import java.util.Map; import ams.entity.PageData; import java.util.List; public interface IBasicUserService { void add(Map<String, Object> map); void delete(Map<String, Object> map); void update(Map<String, Object> map); List<Map<String,Object>> select(Map<String, Object> map); Map<String, Object> likeSelect(Map<String, Object> map); void batchAdd(List<Map<String, Object>> list); void batchDelete(List<Map<String, Object>> list); void batchUpdate(List<Map<String, Object>> list); void exportExcel(Map<String, Object> paramMap, HttpServletResponse response); }
[ "15120022843@126.com" ]
15120022843@126.com
52323c1b7c234c7097f90309d175584a0f29dc62
8beef846b44983c749c63dc428f7c531738aa57e
/Workspace/org.aieonf.sketch/src/org/aieonf/sketch/Activator.java
ff46a5aa3e8dce430c8bf14c639506dfd31e6d7b
[ "Apache-2.0" ]
permissive
condast/AieonF
6d4455812cdb6971a7d1a6a4afcdef5a3ae24251
7c096a63b0c2b0eb6c43a34e011e6b2ad7d678f8
refs/heads/master
2021-06-24T00:00:01.186191
2021-01-18T15:27:29
2021-01-18T15:27:29
22,102,220
0
0
null
null
null
null
UTF-8
Java
false
false
812
java
package org.aieonf.sketch; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { public static final String BUNDLE_ID = "org.aieonf.sketch"; private static BundleContext context; static BundleContext getContext() { return context; } /* * (non-Javadoc) * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ @Override public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; } /* * (non-Javadoc) * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ @Override public void stop(BundleContext bundleContext) throws Exception { Activator.context = null; } }
[ "info@condast.com" ]
info@condast.com
1292e1d42a9854612640a92e7bae7a738bb06a57
29f6b4804f06b8aabccd56fd122b54e4d556c59a
/CodeAnalysis/SourceMeter_Interface/SourceMeter-8.2.0-x64-linux/Java/Demo/apache-log4j-2.3-src/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/Rfc5424LayoutTest.java
f2deedb314bc67395fb767b1598af60e06e3c20a
[ "Apache-2.0" ]
permissive
obahy/Susereum
6ef6ae331c7c8f91d64177db97e0c344f62783fa
56e20c1777e0c938ac42bd8056f84af9e0b76e46
refs/heads/master
2020-03-27T11:52:28.424277
2018-12-12T02:53:47
2018-12-12T02:53:47
146,511,286
3
2
Apache-2.0
2018-12-05T01:34:17
2018-08-28T21:57:59
HTML
UTF-8
Java
false
false
19,244
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 org.apache.logging.log4j.core.layout; import java.util.Arrays; import java.util.List; import java.util.Locale; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.MarkerManager; import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.BasicConfigurationFactory; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.net.Facility; import org.apache.logging.log4j.core.util.KeyValuePair; import org.apache.logging.log4j.message.StructuredDataMessage; import org.apache.logging.log4j.status.StatusLogger; import org.apache.logging.log4j.test.appender.ListAppender; import org.apache.logging.log4j.util.Strings; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; public class Rfc5424LayoutTest { LoggerContext ctx = (LoggerContext) LogManager.getContext(); Logger root = ctx.getLogger(""); private static final String line1 = "ATM - - [RequestContext@3692 loginId=\"JohnDoe\"] starting mdc pattern test"; private static final String line2 = "ATM - - [RequestContext@3692 loginId=\"JohnDoe\"] empty mdc"; private static final String line3 = "ATM - - [RequestContext@3692 loginId=\"JohnDoe\"] filled mdc"; private static final String line4 = "ATM - Audit [Transfer@18060 Amount=\"200.00\" FromAccount=\"123457\" ToAccount=\"123456\"]" + "[RequestContext@3692 ipAddress=\"192.168.0.120\" loginId=\"JohnDoe\"] Transfer Complete"; private static final String lineEscaped3 = "ATM - - [RequestContext@3692 escaped=\"Testing escaping #012 \\\" \\] \\\"\" loginId=\"JohnDoe\"] filled mdc"; private static final String lineEscaped4 = "ATM - Audit [Transfer@18060 Amount=\"200.00\" FromAccount=\"123457\" ToAccount=\"123456\"]" + "[RequestContext@3692 escaped=\"Testing escaping #012 \\\" \\] \\\"\" ipAddress=\"192.168.0.120\" loginId=\"JohnDoe\"] Transfer Complete"; static ConfigurationFactory cf = new BasicConfigurationFactory(); @BeforeClass public static void setupClass() { ThreadContext.clearAll(); StatusLogger.getLogger().setLevel(Level.OFF); ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = (LoggerContext) LogManager.getContext(); ctx.reconfigure(); } @AfterClass public static void cleanupClass() { ConfigurationFactory.removeConfigurationFactory(cf); ThreadContext.clearAll(); } /** * Test case for MDC conversion pattern. */ @Test public void testLayout() throws Exception { for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } // set up appender final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, "RequestContext", null, null, true, null, "ATM", null, "key1, key2, locale", null, "loginId", null, true, null, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); // set appender on root and set level to debug root.addAppender(appender); root.setLevel(Level.DEBUG); ThreadContext.put("loginId", "JohnDoe"); // output starting message root.debug("starting mdc pattern test"); root.debug("empty mdc"); ThreadContext.put("key1", "value1"); ThreadContext.put("key2", "value2"); root.debug("filled mdc"); ThreadContext.put("ipAddress", "192.168.0.120"); ThreadContext.put("locale", Locale.US.getDisplayName()); try { final StructuredDataMessage msg = new StructuredDataMessage("Transfer@18060", "Transfer Complete", "Audit"); msg.put("ToAccount", "123456"); msg.put("FromAccount", "123457"); msg.put("Amount", "200.00"); root.info(MarkerManager.getMarker("EVENT"), msg); List<String> list = appender.getMessages(); assertTrue("Expected line 1 to end with: " + line1 + " Actual " + list.get(0), list.get(0).endsWith(line1)); assertTrue("Expected line 2 to end with: " + line2 + " Actual " + list.get(1), list.get(1).endsWith(line2)); assertTrue("Expected line 3 to end with: " + line3 + " Actual " + list.get(2), list.get(2).endsWith(line3)); assertTrue("Expected line 4 to end with: " + line4 + " Actual " + list.get(3), list.get(3).endsWith(line4)); for (final String frame : list) { int length = -1; final int frameLength = frame.length(); final int firstSpacePosition = frame.indexOf(' '); final String messageLength = frame.substring(0, firstSpacePosition); try { length = Integer.parseInt(messageLength); // the ListAppender removes the ending newline, so we expect one less size assertEquals(frameLength, messageLength.length() + length); } catch (final NumberFormatException e) { assertTrue("Not a valid RFC 5425 frame", false); } } appender.clear(); ThreadContext.remove("loginId"); root.debug("This is a test"); list = appender.getMessages(); assertTrue("No messages expected, found " + list.size(), list.isEmpty()); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } /** * Test case for escaping newlines and other SD PARAM-NAME special characters. */ @Test public void testEscape() throws Exception { for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } // set up layout/appender final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, "RequestContext", null, null, true, "#012", "ATM", null, "key1, key2, locale", null, "loginId", null, true, null, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); // set appender on root and set level to debug root.addAppender(appender); root.setLevel(Level.DEBUG); ThreadContext.put("loginId", "JohnDoe"); // output starting message root.debug("starting mdc pattern test"); root.debug("empty mdc"); ThreadContext.put("escaped", "Testing escaping \n \" ] \""); root.debug("filled mdc"); ThreadContext.put("ipAddress", "192.168.0.120"); ThreadContext.put("locale", Locale.US.getDisplayName()); try { final StructuredDataMessage msg = new StructuredDataMessage("Transfer@18060", "Transfer Complete", "Audit"); msg.put("ToAccount", "123456"); msg.put("FromAccount", "123457"); msg.put("Amount", "200.00"); root.info(MarkerManager.getMarker("EVENT"), msg); List<String> list = appender.getMessages(); assertTrue("Expected line 1 to end with: " + line1 + " Actual " + list.get(0), list.get(0).endsWith(line1)); assertTrue("Expected line 2 to end with: " + line2 + " Actual " + list.get(1), list.get(1).endsWith(line2)); assertTrue("Expected line 3 to end with: " + lineEscaped3 + " Actual " + list.get(2), list.get(2).endsWith(lineEscaped3)); assertTrue("Expected line 4 to end with: " + lineEscaped4 + " Actual " + list.get(3), list.get(3).endsWith(lineEscaped4)); appender.clear(); ThreadContext.remove("loginId"); root.debug("This is a test"); list = appender.getMessages(); assertTrue("No messages expected, found " + list.size(), list.isEmpty()); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } /** * Test case for MDC exception conversion pattern. */ @Test public void testException() throws Exception { for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } // set up layout/appender final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, "RequestContext", null, null, true, null, "ATM", null, "key1, key2, locale", null, "loginId", "%xEx", true, null, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); // set appender on root and set level to debug root.addAppender(appender); root.setLevel(Level.DEBUG); ThreadContext.put("loginId", "JohnDoe"); // output starting message root.debug("starting mdc pattern test", new IllegalArgumentException("Test")); try { final List<String> list = appender.getMessages(); assertTrue("Not enough list entries", list.size() > 1); final String string = list.get(1); assertTrue("No Exception in " + string, string.contains("IllegalArgumentException")); appender.clear(); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } /** * Test case for MDC logger field inclusion. */ @Test public void testMDCLoggerFields() throws Exception { for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } final LoggerFields[] loggerFields = new LoggerFields[] { LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("source", "%C.%M")}, null, null, false), LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("source2", "%C.%M")}, null, null, false) }; // set up layout/appender final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, "RequestContext", null, null, true, null, "ATM", null, "key1, key2, locale", null, null, null, true, loggerFields, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); // set appender on root and set level to debug root.addAppender(appender); root.setLevel(Level.DEBUG); // output starting message root.info("starting logger fields test"); try { final List<String> list = appender.getMessages(); assertTrue("Not enough list entries", list.size() > 0); assertTrue("No class/method", list.get(0).contains("Rfc5424LayoutTest.testMDCLoggerFields")); appender.clear(); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } @Test public void testLoggerFields() { final String[] fields = new String[] { "[BAZ@32473 baz=\"org.apache.logging.log4j.core.layout.Rfc5424LayoutTest.testLoggerFields\"]", "[RequestContext@3692 bar=\"org.apache.logging.log4j.core.layout.Rfc5424LayoutTest.testLoggerFields\"]", "[SD-ID@32473 source=\"org.apache.logging.log4j.core.layout.Rfc5424LayoutTest.testLoggerFields\"]" }; final List<String> expectedToContain = Arrays.asList(fields); for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } final LoggerFields[] loggerFields = new LoggerFields[] { LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("source", "%C.%M")}, "SD-ID", "32473", false), LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("baz", "%C.%M"), new KeyValuePair("baz", "%C.%M") }, "BAZ", "32473", false), LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("bar", "%C.%M")}, null, null, false) }; final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, "RequestContext", null, null, true, null, "ATM", null, "key1, key2, locale", null, null, null, false, loggerFields, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); root.addAppender(appender); root.setLevel(Level.DEBUG); root.info("starting logger fields test"); try { final List<String> list = appender.getMessages(); assertTrue("Not enough list entries", list.size() > 0); final String message = list.get(0); assertTrue("No class/method", message.contains("Rfc5424LayoutTest.testLoggerFields")); for (final String value : expectedToContain) { Assert.assertTrue("Message expected to contain " + value + " but did not", message.contains(value)); } appender.clear(); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } @Test public void testDiscardEmptyLoggerFields() { final String mdcId = "RequestContext"; final List<String> expectedToContain = Arrays.asList( "[BAZ@32473 baz=\"org.apache.logging.log4j.core.layout.Rfc5424LayoutTest.testLoggerFields\"]" + "[RequestContext@3692 bar=\"org.apache.logging.log4j.core.layout.Rfc5424LayoutTest.testLoggerFields\"]" ); for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } final LoggerFields[] loggerFields = new LoggerFields[] { LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("dummy", Strings.EMPTY), new KeyValuePair("empty", Strings.EMPTY)}, "SD-ID", "32473", true), LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("baz", "%C.%M"), new KeyValuePair("baz", "%C.%M") }, "BAZ", "32473", false), LoggerFields.createLoggerFields(new KeyValuePair[] { new KeyValuePair("bar", "%C.%M")}, null, null, false) }; final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, mdcId, null, null, true, null, "ATM", null, "key1, key2, locale", null, null, null, false, loggerFields, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); root.addAppender(appender); root.setLevel(Level.DEBUG); root.info("starting logger fields test"); try { final List<String> list = appender.getMessages(); assertTrue("Not enough list entries", list.size() > 0); final String message = list.get(0); Assert.assertTrue("SD-ID should have been discarded", !message.contains("SD-ID")); Assert.assertTrue("BAZ should have been included", message.contains("BAZ")); Assert.assertTrue(mdcId + "should have been included", message.contains(mdcId)); appender.clear(); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } @Test public void testSubstituteStructuredData() { final String mdcId = "RequestContext"; final String expectedToContain = "ATM - MSG-ID - Message"; for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, false, mdcId, null, null, true, null, "ATM", "MSG-ID", "key1, key2, locale", null, null, null, false, null, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); root.addAppender(appender); root.setLevel(Level.DEBUG); root.info("Message"); try { final List<String> list = appender.getMessages(); assertTrue("Not enough list entries", list.size() > 0); final String message = list.get(0); Assert.assertTrue("Not the expected message received", message.contains(expectedToContain)); appender.clear(); } finally { root.removeAppender(appender); ThreadContext.clearMap(); appender.stop(); } } @Test public void testParameterizedMessage() { for (final Appender appender : root.getAppenders().values()) { root.removeAppender(appender); } // set up appender final AbstractStringLayout layout = Rfc5424Layout.createLayout(Facility.LOCAL0, "Event", 3692, true, "RequestContext", null, null, true, null, "ATM", null, "key1, key2, locale", null, null, null, true, null, null); final ListAppender appender = new ListAppender("List", null, layout, true, false); appender.start(); // set appender on root and set level to debug root.addAppender(appender); root.setLevel(Level.DEBUG); root.info("Hello {}", "World"); try { final List<String> list = appender.getMessages(); assertTrue("Not enough list entries", list.size() > 0); final String message = list.get(0); assertTrue("Incorrect message. Expected - Hello World, Actual - " + message, message.contains("Hello World")); } finally { root.removeAppender(appender); appender.stop(); } } }
[ "abelgomezr45@gmail.com" ]
abelgomezr45@gmail.com
5bb31f87460897f9aa34d329e61a5e7855b39087
a4178e5042f43f94344789794d1926c8bdba51c0
/iwxxm2Converter/src/schemabindings/schemabindings21/org/isotc211/_2005/gmd/MDCoverageDescriptionType.java
59494bf5e35aaf5406af3f84243cdb5c5181608a
[ "Apache-2.0" ]
permissive
moryakovdv/iwxxmConverter
c6fb73bc49765c4aeb7ee0153cca04e3e3846ab0
5c2b57e57c3038a9968b026c55e381eef0f34dad
refs/heads/master
2023-07-20T06:58:00.317736
2023-07-05T10:10:10
2023-07-05T10:10:10
128,777,786
11
7
Apache-2.0
2023-07-05T10:03:12
2018-04-09T13:38:59
Java
UTF-8
Java
false
false
4,714
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2018.02.27 at 12:41:52 PM MSK // package schemabindings21.org.isotc211._2005.gmd; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import schemabindings21.org.isotc211._2005.gco.RecordTypePropertyType; /** * Information about the domain of the raster cell * * <p>Java class for MD_CoverageDescription_Type complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="MD_CoverageDescription_Type"> * &lt;complexContent> * &lt;extension base="{http://www.isotc211.org/2005/gmd}AbstractMD_ContentInformation_Type"> * &lt;sequence> * &lt;element name="attributeDescription" type="{http://www.isotc211.org/2005/gco}RecordType_PropertyType"/> * &lt;element name="contentType" type="{http://www.isotc211.org/2005/gmd}MD_CoverageContentTypeCode_PropertyType"/> * &lt;element name="dimension" type="{http://www.isotc211.org/2005/gmd}MD_RangeDimension_PropertyType" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MD_CoverageDescription_Type", propOrder = { "attributeDescription", "contentType", "dimension" }) @XmlSeeAlso({ MDImageDescriptionType.class }) public class MDCoverageDescriptionType extends AbstractMDContentInformationType { @XmlElement(required = true) protected RecordTypePropertyType attributeDescription; @XmlElement(required = true) protected MDCoverageContentTypeCodePropertyType contentType; protected List<MDRangeDimensionPropertyType> dimension; /** * Gets the value of the attributeDescription property. * * @return * possible object is * {@link RecordTypePropertyType } * */ public RecordTypePropertyType getAttributeDescription() { return attributeDescription; } /** * Sets the value of the attributeDescription property. * * @param value * allowed object is * {@link RecordTypePropertyType } * */ public void setAttributeDescription(RecordTypePropertyType value) { this.attributeDescription = value; } public boolean isSetAttributeDescription() { return (this.attributeDescription!= null); } /** * Gets the value of the contentType property. * * @return * possible object is * {@link MDCoverageContentTypeCodePropertyType } * */ public MDCoverageContentTypeCodePropertyType getContentType() { return contentType; } /** * Sets the value of the contentType property. * * @param value * allowed object is * {@link MDCoverageContentTypeCodePropertyType } * */ public void setContentType(MDCoverageContentTypeCodePropertyType value) { this.contentType = value; } public boolean isSetContentType() { return (this.contentType!= null); } /** * Gets the value of the dimension property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the dimension property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDimension().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link MDRangeDimensionPropertyType } * * */ public List<MDRangeDimensionPropertyType> getDimension() { if (dimension == null) { dimension = new ArrayList<MDRangeDimensionPropertyType>(); } return this.dimension; } public boolean isSetDimension() { return ((this.dimension!= null)&&(!this.dimension.isEmpty())); } public void unsetDimension() { this.dimension = null; } }
[ "moryakovdv@gmail.com" ]
moryakovdv@gmail.com
1f887577fcb70da7c8d63a7cd5e028cc4ebda691
8322a9a3aaf1d7cd12324033f814edf3400c2271
/ParseStarterProject/src/main/java/com/parse/starter/StarterApplication.java
d64242f1fc312bd50869aaba8087d25f77cee87e
[]
no_license
arpitsingh21/GridAlly
01143b48a09ce9346caa78ce3f90437616985b84
241a8505bdd2e6ceac9afb23cc22d70a1e281d37
refs/heads/master
2020-12-25T18:43:45.277506
2017-06-11T07:09:55
2017-06-11T07:09:55
93,988,078
1
2
null
null
null
null
UTF-8
Java
false
false
1,062
java
/* * Copyright (c) 2015-present, Parse, LLC. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com.parse.starter; import android.app.Application; import android.util.Log; import com.parse.Parse; import com.parse.ParseACL; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseUser; import com.parse.SaveCallback; public class StarterApplication extends Application { @Override public void onCreate() { super.onCreate(); // Enable Local Datastore. Parse.enableLocalDatastore(this); // Add your initialization code here Parse.initialize(getApplicationContext()); ParseUser.enableAutomaticUser(); ParseACL defaultACL = new ParseACL(); defaultACL.setPublicReadAccess(true); defaultACL.setPublicWriteAccess(true); ParseACL.setDefaultACL(defaultACL, true); } }
[ "arpit006singhas@gmail.com" ]
arpit006singhas@gmail.com
0abc8af91dc5f5ccdcbd95c149956973a5c01784
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5690574640250880_0/java/sseypt/C.java
24f15754cee6df88e317185d07e04ca249c38f50
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Java
false
false
9,265
java
package gcj2014.global_qr; import java.io.File; import java.io.FileReader; import java.io.BufferedReader; import java.io.FileWriter; import java.io.BufferedWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; import java.text.NumberFormat; import java.text.DecimalFormat; import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import java.util.*; public class C { private static int debugCC = -1; private static int cc; private static int R; private static int C; private static int M; private static char[][] field; private static boolean possible = false; private static void putput() throws IOException { int cases = INT(); cc: for (cc = 1; cc<=cases; cc++) { possible = false; R = INT(); C = INT(); M = INT(); // println(R+" "+C+" "+M); field = new char[R][C]; if ((R==1 || C==1) || (M==0 || M==R*C-1)) possible = true; if (!possible) possible = solveField(R,C,M); println("Case #"+cc+":"); if (possible) printField(); else println("Impossible"); } } public static void generateField() throws IOException { // 1 row/col case if (R==1 || C==1) { field = new char[Math.max(R, C)][1]; for(int i=0; i<M; i++) field[i][0] = '*'; for(int i=M; i<Math.max(R, C)-1; i++) field[i][0] = '.'; } // ---end // 0 or R*C-1 mines else if (M==0 || M==R*C-1) { for(int x=0; x<C; x++) for(int y=0; y<R; y++) field[y][x] = M==0?'.':'*'; } // ---end else { int yLeft = R; int xLeft = C; int mLeft = M; boolean filled = false; while(yLeft*xLeft>9 && !filled) { // specials if (yLeft==2 || xLeft==2) { if (yLeft==2 && mLeft>=yLeft) { for(int y=R-yLeft; y<R-yLeft+2; y++) field[y][C-xLeft] = '*'; mLeft-=yLeft; xLeft--; } else if (xLeft==2 && mLeft>=xLeft) { for(int x=C-xLeft; x<C-xLeft+2; x++) field[R-yLeft][x] = '*'; mLeft-=xLeft; yLeft--; } else { filled = true; } } // ---end else { if (yLeft>xLeft && mLeft>=xLeft) { for(int x=C-xLeft; x<C; x++) field[R-yLeft][x] = '*'; mLeft-=xLeft; yLeft--; } else if (mLeft>=yLeft) { for(int y=R-yLeft; y<R; y++) field[y][C-xLeft] = '*'; mLeft-=yLeft; xLeft--; } else { filled = true; } } } boolean error = false; debugln("fill leftovers for "+yLeft+"x"+xLeft+" "+mLeft); while (mLeft>0 && !error) { // specials if (yLeft*xLeft==9) { for(int y=R-yLeft; y<R&&mLeft>0; y++) { field[y][C-xLeft] = '*'; mLeft--; } xLeft--; for(int x=C-xLeft; x<C&&mLeft>0; x++) { field[R-yLeft][x] = '*'; mLeft--; } yLeft--; } if (yLeft*xLeft==8 || yLeft*xLeft==6) { if (yLeft==2) { for(int y=R-yLeft; y<R&&mLeft>0; y++) { field[y][C-xLeft] = '*'; mLeft--; } xLeft--; } if (xLeft==2) { for(int x=C-xLeft; x<C&&mLeft>0; x++) { field[R-yLeft][x] = '*'; mLeft--; } yLeft--; } } // ---end if (yLeft>=xLeft && yLeft-2<R) { for(int y=R-yLeft; y<R-2&&mLeft>0; y++) { field[y][C-xLeft] = '*'; mLeft--; } xLeft--; } else if (xLeft-2<C) { for(int x=C-xLeft; x<C-2&&mLeft>0; x++) { field[R-yLeft][x] = '*'; mLeft--; } yLeft--; } else { error = true; } debugln("fill leftovers for "+yLeft+"x"+xLeft+" "+mLeft); } if (error) System.out.println("FILL ERROR!!!!"); if (error) System.err.println("FILL ERROR!!!!"); } } public static int[] reduceProblem (int y, int x, int m) throws IOException { debugln("reduce from "+y+"x"+x+" "+m); // specials if (y==2 && m>=y) { m-=y; x--; } if (x==2 && m>=x) { m-=x; y--; } // ---end if (y>x && m>=x) { m-=x; y--; } else if (m>=y) { m-=y; x--; } else { debugln("cant reduce"); return new int[] {-1}; } debugln("reduce to "+y+"x"+x+" "+m); return new int[] {y,x,m}; } public static boolean solveField(int y, int x, int m) throws IOException { // shortcuts switch (y*x) { case 4: if (m>0) return false; break; case 6: if (m!=0 && m!=2) return false; break; case 8: if (m==1||m==3||m==5||m==6) return false; break; case 9: if (m==2||m==4||m>=6) return false; break; } if ((y==2 || x==2) && (m%2==1)) return false; if (y*x<=9) return true; //--- int[] yxm = reduceProblem(y, x, m); if (yxm[0]==-1) return true; y = yxm[0]; x = yxm[1]; m = yxm[2]; return solveField(y, x, m); } public static void printField() throws IOException { generateField(); boolean rotate = field[0].length!=C; // . for(int y=0; y<R; y++) { for(int x=0; x<C; x++) { if (rotate) { if (field[x][y]!='*') field[x][y] = '.'; } else if (field[y][x]!='*') field[y][x] = '.'; } } // c field[field.length-1][field[0].length-1] = 'c'; // count * . c int cs = 0; int cd = 0; int cc = 0; for(int y=0; y<R; y++) { for(int x=0; x<C; x++) { if (rotate) { if (field[x][y]=='*') cs++; if (field[x][y]=='.') cd++; if (field[x][y]=='c') cc++; } else { if (field[y][x]=='*') cs++; if (field[y][x]=='.') cd++; if (field[y][x]=='c') cc++; } } } if (cs!=M || cc!=1 || cs+cd+cc != R*C) { System.out.println("ERROR!!!!"); System.err.println("ERROR!!!!"); } // ---end for(int y=0; y<R; y++) { for(int x=0; x<C; x++) { if (rotate) print(""+field[x][y]); else print(""+field[y][x]); } println(""); } } public static void main(String[] args) throws IOException { // 02:29 - 02:44 / 06:35 - 07:19 / 08:00 - // String problemFile = "test"; // String problemFile = "%s-small-practice"; String problemFile = "%s-small-attempt0"; // String problemFile = "%s-large"; try { String problem = new Object(){}.getClass().getEnclosingClass().getSimpleName(); String folder = "_"+new Object(){}.getClass().getPackage().getName(); init(folder+"/"+String.format(problemFile, problem)); putput(); done(); } catch (Throwable e) { e.printStackTrace(); System.exit(1); } } private static File input; private static FileReader inputReader; private static BufferedReader in; private static File output; private static FileWriter outputWriter; private static BufferedWriter out; private static StringTokenizer st; private static void init (String fileName) throws IOException { // input input = new File(fileName+".in"); inputReader = new FileReader(input); in = new BufferedReader(inputReader); // output output = new File(fileName+".out"); outputWriter = new FileWriter(output); out = new BufferedWriter(outputWriter); } private static void done () { try {in.close();} catch (Exception e){} try {inputReader.close();} catch (Exception e){} try {out.close();} catch (Exception e){} try {outputWriter.close();} catch (Exception e){} } // in private static String LINE() throws IOException { return in.readLine(); } private static String TOKEN() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(LINE()); } return st.nextToken(); } private static int INT() throws IOException { return parseInt(TOKEN()); } private static long LONG() throws IOException { return parseLong(TOKEN()); } private static double DOUBLE() throws IOException { return parseDouble(TOKEN()); } private static String STRING() throws IOException { return TOKEN(); } // putput private static String DOUBLE_STRING(Double d) { NumberFormat f = NumberFormat.getInstance(); f.setGroupingUsed(false); return f.format(d); } private static DecimalFormat _DF = new DecimalFormat("0000"); private static String DF(int i) { return _DF.format(i); } // out private static void print (String str) throws IOException { out.write(str); debug(str,true); } private static void println (String str) throws IOException { print(str+"\r\n"); } private static void debug (String str, boolean force) throws IOException { if (debugCC==0 || cc==debugCC || force) System.out.print(str); } private static void debug (String str) throws IOException { if (debugCC==0 || cc==debugCC) System.out.print(str); } private static void debugln (String str) throws IOException { debug(str+"\r\n"); } }
[ "eewestman@gmail.com" ]
eewestman@gmail.com
df030388b0acb5d0973de925c0e93a25f71804bf
ef2b85bd1a83354d469b3aa5a1ab3348cd491126
/imooc-coupon2-service/coupon2-template/src/main/java/com/imooc/coupon/serialization/CouponTemplateSerialize.java
89c9a5861442dc425e0388453bcb588994b6955c
[]
no_license
djz236/imooc-coupon2
dfa46c59f7ba8a4bf0ac7b375e1992755dc347be
f8df2b7ef317da9ef930ee52f6f64f06a1bbcf2f
refs/heads/master
2023-03-30T07:35:05.860158
2021-03-29T07:39:59
2021-03-29T07:39:59
340,902,040
0
0
null
null
null
null
UTF-8
Java
false
false
2,116
java
package com.imooc.coupon.serialization; import com.alibaba.fastjson.JSON; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.imooc.coupon.entity.CouponTemplate; import java.io.IOException; import java.text.SimpleDateFormat; /** * 优惠券模板实体类自定义序列化器 */ public class CouponTemplateSerialize extends JsonSerializer<CouponTemplate> { @Override public void serialize(CouponTemplate couponTemplate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { //开始序列化对象 jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("id", couponTemplate.getId().toString()); jsonGenerator.writeStringField("name", couponTemplate.getName()); jsonGenerator.writeStringField("logo", couponTemplate.getLogo()); jsonGenerator.writeStringField("desc", couponTemplate.getDesc()); jsonGenerator.writeStringField("category", couponTemplate.getCategory().getDescription()); jsonGenerator.writeStringField("productLine", couponTemplate.getProductLine().getDescription()); jsonGenerator.writeStringField("count", couponTemplate.getCount().toString()); jsonGenerator.writeStringField("createTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") .format(couponTemplate.getCreateTime())); jsonGenerator.writeStringField("userId", couponTemplate.getUserId().toString()); jsonGenerator.writeStringField("key", couponTemplate.getKey() + String.format("%04d", couponTemplate.getId())); jsonGenerator.writeStringField("target", couponTemplate.getTarget().getDescription()); jsonGenerator.writeStringField("rule", JSON.toJSONString(couponTemplate.getRule())); //jsonGenerater 结束序列化 jsonGenerator.writeEndObject(); } }
[ "djz236@163.com" ]
djz236@163.com
e83b842ca3c01241ac29847d3598a369139f4ba5
6312b363a37b9524d6f3bf172c09f026d148eebc
/oopsdemo/src/oopddemo3/Car.java
f1e03b38de33007565a25abcd2595ba2acfbec72
[]
no_license
itsprateeksharma/jdbcdemo
08f5278c470f2160d73e9ae0dc6b9840ca4c2afa
a27531204ffd66c6f730cd214e48ef7805ef4557
refs/heads/master
2023-07-02T15:53:01.917248
2021-08-04T11:09:16
2021-08-04T11:09:16
392,655,952
0
0
null
null
null
null
UTF-8
Java
false
false
1,727
java
package oopddemo3; public class Car { String company; boolean isAutomatic; String modelName; float highTechAC; String color; String fuelType; String Power; int numberOfGear; public Car(String company, boolean isAutomatic, String modelName, float highTechAC, String color, String fuelType, String power, int numberOfGear) { this.company = company; this.isAutomatic = isAutomatic; this.modelName = modelName; this.highTechAC = highTechAC; this.color = color; this.fuelType = fuelType; Power = power; this.numberOfGear = numberOfGear; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } public boolean isAutomatic() { return isAutomatic; } public void setAutomatic(boolean isAutomatic) { this.isAutomatic = isAutomatic; } public String getModelName() { return modelName; } public void setModelName(String modelName) { this.modelName = modelName; } public float getHighTechAC() { return highTechAC; } public void setHighTechAC(float highTechAC) { this.highTechAC = highTechAC; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getFuelType() { return fuelType; } public void setFuelType(String fuelType) { this.fuelType = fuelType; } public String getPower() { return Power; } public void setPower(String power) { Power = power; } public int getNumberOfGear() { return numberOfGear; } public void setNumberOfGear(int numberOfGear) { this.numberOfGear = numberOfGear; } }
[ "arryprateek@gmail.com" ]
arryprateek@gmail.com
1d37d5688175650a0aeabbdabd434a7878370f1b
a44d2b0d271505bf8de80a5e71a025768913bfbd
/src/learn/Array/CharLength.java
ad5a09135e6a5fc59e6c000f7d39d47a20856338
[]
no_license
lavanya123m/java
95ec8a30aa6c05a67fbf55633603d7da456e71cf
38eb673a74af8c0ea05916121523b31f635363f1
refs/heads/master
2021-04-09T14:53:28.630613
2018-03-19T00:48:00
2018-03-19T00:48:00
125,782,066
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
package learn.Array; import java.util.Scanner; public class CharLength { public static char[] scanner(){ @SuppressWarnings("resource") Scanner sc=new Scanner(System.in); System.out.println("enter array values"); int p=sc.nextInt(); char[] a=new char[p]; System.out.print("enter the values"); for(int i=0;i<a.length;i++){ a[i]=sc.next().charAt(i); } return a; } public static void charLength(char[] c){ for(int i=0;i<c.length;i++){ System.out.println(c[i]); } } public static void main(String args[]){ char a[]=scanner(); charLength(a); } }
[ "lavanya.hd170@gmail.com" ]
lavanya.hd170@gmail.com
a075d2caa10ec61f09d13ab6b1bd810227f86f29
ca35391e2eb8c7eedf4cc605cb188aaf11cacbcd
/app/src/main/java/com/netikras/studies/studentbuddy/api/client/android/data/DataManager.java
99fa48100b3811d298aaa1d53744d7ea2adebd53
[]
no_license
netikras/stubu_client
815cb4db4bd04e46b8b362122c29ea3adcf25d58
a1f738129893f702b9355decdb890095b4b630c4
refs/heads/master
2021-09-03T17:59:45.972468
2018-01-10T22:38:48
2018-01-10T22:38:48
107,720,884
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.netikras.studies.studentbuddy.api.client.android.data; import com.netikras.studies.studentbuddy.api.client.android.data.stores.BaseDataStore; /** * Created by netikras on 17.10.31. */ public interface DataManager { <S extends BaseDataStore> S getStore(Class<S> storeClass); }
[ "dariuxas@gmail.com" ]
dariuxas@gmail.com
7ac18f5f1f3a472b5a724c902615df514cb5a5d3
28978a12539b5472c191318600a2a930da6723cd
/app/src/main/java/note/lym/org/noteproject/eventbus/FlbEvent.java
4d89f87b7c819a6ba987f14f10959ad890873c4a
[]
no_license
w1984908499/NoteProject
ad3e37376dc0eb1ed11db12f3a4417388947a974
2a68bef4cc1b72011abc06d0fe7c7177605b70f3
refs/heads/master
2021-06-22T10:43:45.733533
2017-08-30T07:41:12
2017-08-30T07:41:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
package note.lym.org.noteproject.eventbus; /** * * @author yaoming.li * @since 2017-07-14 16:26 */ public class FlbEvent { }
[ "liyaoming@wepiao.com" ]
liyaoming@wepiao.com
b62e7ead3fef5c4e21bb3e773ce75c91f3ae613e
10c12e0b31590d2a5363b2a0ecde12ea28893b27
/SpringActiveMq/src/main/java/top/takefly/mq/produce/MessageQueueProducer.java
0f80d38aeb6a434972646a098a7d3b6316d44f20
[]
no_license
CATTechnology/activemq
8f914b9aecf4958b564dad2b69a52ff4acd74e7e
ab1d42de97984791690b2af02f6c1a1bdff0283c
refs/heads/master
2022-12-21T06:02:33.587416
2019-09-17T06:18:34
2019-09-17T06:18:34
207,627,574
0
0
null
2022-12-16T05:06:54
2019-09-10T17:56:40
Java
UTF-8
Java
false
false
1,333
java
package top.takefly.mq.produce; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.jms.core.JmsTemplate; import org.springframework.stereotype.Component; import javax.jms.Destination; import javax.jms.TextMessage; import javax.jms.Topic; /** * @program: SpringActiveMq * @description: 生产者 * @author: 戴灵飞 * @create: 2019-09-09 11:55 **/ @Component public class MessageQueueProducer { @Autowired private JmsTemplate jmsTemplate; @Autowired private Destination queue; @Autowired private Topic topic; public static void main(String[] args) throws InterruptedException { ApplicationContext context = new ClassPathXmlApplicationContext("application-jms.xml"); MessageQueueProducer producer = context.getBean("messageQueueProducer", MessageQueueProducer.class); while(true){ producer.jmsTemplate.send(producer.queue , session->{ TextMessage textMessage = session.createTextMessage(); textMessage.setText("MessageProducer生产的消息....."); return textMessage; }); Thread.sleep(3000L); } } }
[ "2221734739@qq.com" ]
2221734739@qq.com
e9f88c10d5b26de7ab2d4d8d37b6bbdd6daa8e92
6a6a0844895f29f6f3e3737e7061c7f95e4485bd
/Automation/src/qsp/Launchapplication.java
170365e471e8470c63e715d88b4101c4fde88f63
[]
no_license
Rafeek313/ActiTimeonline
4cfeed6f277ebcac3136d1517e25f589d2793230
1558005ae292e0906b6f617cfe28f75741ee16c4
refs/heads/master
2023-06-19T12:28:33.892397
2021-07-10T16:15:15
2021-07-10T16:15:15
384,736,919
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package qsp; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Launchapplication { static { System.setProperty("webdriver.chrome.driver", "./driver/chromedriver.exe"); } public static void main(String[] args) { WebDriver driver=new ChromeDriver(); driver.get("https://www.youtube.com"); } }
[ "eppys@LAPTOP-Q08K87KM" ]
eppys@LAPTOP-Q08K87KM
b489c55b3d37331de1c65d5be30f0d3616a75bdb
ae7e6901160ebdfbcdf67e99fa017420593e53b8
/table/XMLTable.java
7f7a6c95d2de0680ab1d539299f9efd656fa801b
[]
no_license
omarshawkyelsabagh/DBMS-JDBC
d9baa8153df6ebb2e9ade4af0ce81714902bd037
e9465c84073ff53b54215134c873c106ab9dc9ba
refs/heads/master
2021-09-04T04:09:17.226965
2018-01-15T17:52:36
2018-01-15T17:52:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,521
java
package eg.edu.alexu.csd.oop.jdbc.table; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import eg.edu.alexu.csd.oop.jdbc.interfaces.IDBMS; import eg.edu.alexu.csd.oop.jdbc.interfaces.ITable; public class XMLTable implements ITable { private Transformer transformer; private DocumentBuilder dBuilder; private Map<String, Integer> tableData; private ArrayList<String> order; private ColumnHandler check; private String dbName; private String tableName; private String fileWithExtension; private String path; private IDBMS dbms; private Model engine; public XMLTable(final String tableName, final ArrayList<String> columns, final ArrayList<String> types, final String dbName, final String path, final IDBMS dbms) throws TransformerConfigurationException, ParserConfigurationException { this.dbName = dbName; this.tableName = tableName; this.path = path; this.dbms = dbms; engine = new Model(); fileWithExtension = tableName + ".xml"; tableData = new HashMap<String, Integer>(); order = new ArrayList<String>(); ArrayList<Integer> typesInt = engine.determineTypes(types); for (int i = 0; i < columns.size(); i++) { tableData.put(columns.get(i), typesInt.get(i)); order.add(columns.get(i)); } check = new ColumnHandler(tableData); createWritersAndTransfomers(); } private void addColumnToTable(final String colName, final String dataType) throws IOException, TransformerException, SAXException { Document document = dBuilder.parse(new File(path + File.separator + dbName + File.separator + fileWithExtension)); Node rootElement = document.getDocumentElement(); NodeList rows = document.getElementsByTagName("row"); ArrayList<ArrayList<String>> table = getTable(rows); while (rows.getLength() > 0) { rootElement.removeChild(rows.item(0)); } for (ArrayList<String> row : table) { Element newRow = document.createElement("row"); for (int j = 0; j < order.size(); ++j) { Element newColumn = document.createElement(order.get(j)); newColumn.setTextContent(row.get(j)); newRow.appendChild(newColumn); } Element extraColumn = document.createElement(colName); extraColumn.setTextContent("null"); newRow.appendChild(extraColumn); rootElement.appendChild(newRow); } tableData.put(colName, engine.determineType(dataType)); order.add(colName); writeXML(document); } @Override public void alterTable(final String colName, final String dataType) throws IOException, SAXException, TransformerException { if (dataType == null) { deleteColumnFromTable(colName); } else { if (tableData.containsKey(colName)) { throw new RuntimeException("This column already exists."); } addColumnToTable(colName, dataType); } } private void createWritersAndTransfomers() throws TransformerConfigurationException, ParserConfigurationException { TransformerFactory transformerFactory = TransformerFactory .newInstance(); transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty( "{http://xml.apache.org/xslt}indent-amount", "3"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setValidating(true); dBuilder = dbFactory.newDocumentBuilder(); dBuilder.setErrorHandler(new ErrorHandler() { @Override public void error(final SAXParseException arg0) throws SAXException { throw arg0; } @Override public void fatalError(final SAXParseException arg0) throws SAXException { throw arg0; } @Override public void warning(final SAXParseException arg0) throws SAXException { throw arg0; } }); } private void deleteColumnFromTable(final String colName) throws IOException, SAXException, TransformerException { Document document = dBuilder.parse(new File(path + File.separator + dbName + File.separator + fileWithExtension)); NodeList rows = document.getElementsByTagName("row"); for (int i = 0; i < rows.getLength(); i++) { Element row = (Element) rows.item(i); row.removeChild(row.getElementsByTagName(colName).item(0)); } for (int i = 0; i < order.size(); ++i) { if (order.get(i).equals(colName)) { order.remove(i); break; } } tableData.remove(colName); writeXML(document); } @Override public int deleteFromTable(final String condition) { try { ConditionHandler conditionTaker = new ConditionHandler(condition, tableData); Document document = dBuilder.parse(new File(path + File.separator + dbName + File.separator + fileWithExtension)); Node rootElement = document.getDocumentElement(); NodeList rows = document.getElementsByTagName("row"); int deleted = 0; for (int i = 0; i < rows.getLength(); ++i) { Element row = (Element) rows.item(i); if (rowMatchesCondition(conditionTaker, row)) { rootElement.removeChild(row); i--; ++deleted; } } writeXML(document); return deleted; } catch (Exception e) { throw new RuntimeException("Failed to delete data."); } } public ArrayList<String> getColumnNames() { return order; } public ArrayList<String> getColumnTypes() { ArrayList<String> types = new ArrayList<String>(); for (String column : order) { types.add(engine.typeToString(tableData.get(column))); } return types; } private String getNullValueOfColumn(final String columnName) { return tableData.get(columnName).equals(DataTypesConstants.typeString) || tableData.get(columnName) .equals(DataTypesConstants.typeDate) ? "\'null\'" : "null"; } private ArrayList<ArrayList<String>> getTable(final NodeList rows) { ArrayList<ArrayList<String>> table = new ArrayList<ArrayList<String>>(); for (int i = 0; i < rows.getLength(); ++i) { ArrayList<String> newRow = new ArrayList<String>(); Element row = (Element) rows.item(i); for (int j = 0; j < order.size(); ++j) { newRow.add(new String(row.getElementsByTagName(order.get(j)) .item(0).getTextContent())); } table.add(new ArrayList<String>(newRow)); } return table; } private ArrayList<String> getTypes(final ArrayList<String> columnNames) { ArrayList<String> types = new ArrayList<String>(); for (String name : columnNames) { types.add(engine.typeToString(tableData.get(name))); } return types; } @Override public int insert(final ArrayList<String> columnsName, final ArrayList<String> values) throws Exception { ArrayList<String> orderedValues = setOrderedValuesInInsert(columnsName, values); return insertCore(orderedValues); } private int insertCore(final ArrayList<String> orderedValues) throws IOException, SAXException, TransformerException { Document document = dBuilder.parse(new File(path + File.separator + dbName + File.separator + fileWithExtension)); Node rootElement = document.getDocumentElement(); Element newRow = document.createElement("row"); for (int i = 0; i < order.size(); ++i) { String insertedValue = removeQuotes(orderedValues.get(i), order.get(i)); Element newColumn = document.createElement(order.get(i)); newColumn.setTextContent(insertedValue); newRow.appendChild(newColumn); } rootElement.appendChild(newRow); writeXML(document); return 1; } private String removeQuotes(final String valueOfColumn, final String columnName) { String returnValue = null; if (tableData.get(columnName).equals(DataTypesConstants.typeDate) || tableData.get(columnName).equals( DataTypesConstants.typeString)) { returnValue = valueOfColumn .substring(1, valueOfColumn.length() - 1); } else { returnValue = valueOfColumn; } return returnValue; } private boolean rowMatchesCondition(final ConditionHandler conditionTaker, final Element row) { String conditionColumnName = conditionTaker.getColumnName(); Integer conditionColumnNameInt = null; String toBeEvaluated = null; if (conditionColumnName != null) { toBeEvaluated = row .getElementsByTagName(conditionTaker.getColumnName()) .item(0).getTextContent(); conditionColumnNameInt = tableData.get(conditionColumnName); } return conditionTaker.evaluateCondition(toBeEvaluated, conditionColumnNameInt); } @Override public void select(ArrayList<String> columnNames, final String condition, final boolean distinct) { if (columnNames == null) { columnNames = order; } ArrayList<ArrayList<String>> selected = null; try { ConditionHandler conditionTaker = new ConditionHandler(condition, this.tableData); selected = selectCore(columnNames, conditionTaker, distinct); } catch (Exception e) { throw new RuntimeException("Invalid selected data."); } selected = distinct ? engine.convertToColumnwise( engine.removeDulplicatesFromRows(selected), columnNames) : engine.convertToColumnwise(selected, columnNames); ArrayList<String> types = getTypes(columnNames); sendSelectedDataToDBMS(columnNames, types, selected); } private ArrayList<ArrayList<String>> selectCore( final ArrayList<String> columnNames, final ConditionHandler conditionTaker, final boolean distinct) throws IOException, SAXException { ArrayList<ArrayList<String>> selected = new ArrayList<ArrayList<String>>(); Document document = dBuilder.parse(new File(path + File.separator + dbName + File.separator + fileWithExtension)); NodeList rows = document.getElementsByTagName("row"); for (int i = 0; i < rows.getLength(); i++) { Element row = (Element) rows.item(i); if (rowMatchesCondition(conditionTaker, row)) { ArrayList<String> toBeAdded = new ArrayList<String>(); for (int j = 0; j < columnNames.size(); ++j) { toBeAdded.add(row.getElementsByTagName(columnNames.get(j)) .item(0).getTextContent()); } selected.add(toBeAdded); } } return selected; } @Override public void sendSelectedDataToDBMS(final ArrayList<String> columnNames, final ArrayList<String> types, final ArrayList<ArrayList<String>> data) { dbms.setSelectedColumnNames(columnNames); dbms.setSelectedColumnTypes(types); dbms.setSelectedData(data); dbms.setSelectedTableName(tableName); } private ArrayList<String> setOrderedNamesInUpdate( final ArrayList<String> columnNames, final ArrayList<String> values) { ArrayList<String> orderedNames = new ArrayList<String>(); if (columnNames != null) { for (int i = 0; i < order.size(); ++i) { boolean exists = false; for (int j = 0; j < columnNames.size(); ++j) { if (columnNames.get(j).equals(order.get(i))) { exists = true; break; } } if (exists) { orderedNames.add(order.get(i)); } } } else { if (values.size() != order.size()) { throw new RuntimeException("Invalid updated data."); } for (int i = 0; i < order.size(); ++i) { orderedNames.add(order.get(i)); } } return orderedNames; } private ArrayList<String> setOrderedValuesInInsert( final ArrayList<String> columnsName, final ArrayList<String> values) { ArrayList<String> orderedValues = new ArrayList<String>(); if (columnsName != null) { if (!check.areColumnsValid(columnsName, values)) { throw new RuntimeException("Invalid updated data."); } for (int i = 0; i < order.size(); ++i) { boolean exists = false; String value = null; for (int j = 0; j < columnsName.size(); ++j) { if (columnsName.get(j).equals(order.get(i))) { exists = true; value = values.get(j); break; } } if (exists) { orderedValues.add(value); } else { orderedValues.add(getNullValueOfColumn(order.get(i))); } } } else { if (values.size() != order.size()) { throw new RuntimeException("Invalid insert command."); } if (!check.areColumnsValid(order, values)) { throw new RuntimeException("Invalid columns data types."); } for (int i = 0; i < order.size(); ++i) { orderedValues.add(values.get(i)); } } return orderedValues; } private ArrayList<String> setOrderedValuesInUpdate( final ArrayList<String> columnNames, final ArrayList<String> values) { ArrayList<String> orderedValues = new ArrayList<String>(); if (columnNames != null) { if (!check.areColumnsValid(columnNames, values)) { throw new RuntimeException("Invalid updated data."); } for (int i = 0; i < order.size(); ++i) { boolean exists = false; String value = null; for (int j = 0; j < columnNames.size(); ++j) { if (columnNames.get(j).equals(order.get(i))) { exists = true; value = values.get(j); break; } } if (exists) { orderedValues.add(value); } } } else { if (values.size() != order.size()) { throw new RuntimeException("Invalid updated data."); } if (!check.areColumnsValid(order, values)) { throw new RuntimeException("Invalid updated data types."); } for (int i = 0; i < order.size(); ++i) { orderedValues.add(values.get(i)); } } return orderedValues; } @Override public int update(final ArrayList<String> columnsName, final ArrayList<String> values, final String condition) throws Exception { ArrayList<String> orderedValues = setOrderedValuesInUpdate(columnsName, values); ArrayList<String> orderedNames = setOrderedNamesInUpdate(columnsName, values); ConditionHandler conditionTaker = new ConditionHandler(condition, this.tableData); return updateCore(conditionTaker, orderedValues, orderedNames); } private int updateCore(final ConditionHandler conditionTaker, final ArrayList<String> orderedValues, final ArrayList<String> orderedNames) throws IOException, SAXException, TransformerException { Document document = dBuilder.parse(new File(path + File.separator + dbName + File.separator + fileWithExtension)); NodeList rows = document.getElementsByTagName("row"); int updated = 0; for (int i = 0; i < rows.getLength(); i++) { Element row = (Element) rows.item(i); if (rowMatchesCondition(conditionTaker, row)) { for (int j = 0; j < orderedNames.size(); ++j) { String newValue = removeQuotes(orderedValues.get(j), orderedNames.get(j)); row.getElementsByTagName(orderedNames.get(j)).item(0) .setTextContent(newValue); } ++updated; } } writeXML(document); return updated; } private void writeXML(final Document toBeWritten) throws TransformerException { DOMSource source = new DOMSource(toBeWritten); StreamResult result = new StreamResult(new File(path + File.separator + dbName + File.separator + fileWithExtension)); transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, tableName + ".dtd"); transformer.transform(source, result); } }
[ "omarshawkyanwer@gmail.com" ]
omarshawkyanwer@gmail.com
57a231be1781446737b560e3ad68d071d6ab9db3
653098ecdc6bffc3127b9012034ef95956ec01dd
/src/com/javarush/test/level14/lesson08/home05/Mouse.java
b81fea1c58af09a38d5fba82de1355216988daf3
[]
no_license
Avdey87/JavaRushHomeWork1
7eaffc9242aaa8941b2c04b2c15dc85a91a30317
04d26aabe047baee9da0ec197ed766ee9d70bd22
refs/heads/master
2020-12-24T07:21:15.637670
2016-12-08T09:34:22
2016-12-08T09:34:22
58,726,163
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package com.javarush.test.level14.lesson08.home05; /** * Created by aavdeev on 12.04.2016. */ public class Mouse implements CompItem { @Override public String getName(){ return "Mouse"; } }
[ "avdey87@gmail.com" ]
avdey87@gmail.com
4621e7b22762207b9fcc377bab6b097dabdc2441
ad4146bc4c2208c76efd8e68a1d0886bbd6c7e03
/app/src/main/java/com/toyoapps/dssforstudents/helpers/AKDSSScrollDisabledListView.java
bbb168c3202a413db41c2f2d7faea91542fd8657
[]
no_license
AKoulabukhov/AKDecisionSupportSystem
9186345dcdc44ac4066a81e92e78ce8d05d05b70
02ce92e6463b236ddcd379b302b1370100be06d0
refs/heads/master
2023-03-07T17:36:05.528623
2023-02-18T15:20:28
2023-02-18T15:20:28
58,084,258
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package com.toyoapps.dssforstudents.helpers; import android.content.Context; import android.util.AttributeSet; import android.widget.ListView; /** * Created by alexander koulabuhov on 04/05/16. */ public class AKDSSScrollDisabledListView extends ListView { public AKDSSScrollDisabledListView (Context context, AttributeSet attrs) { super(context, attrs); } public AKDSSScrollDisabledListView (Context context) { super(context); } public AKDSSScrollDisabledListView (Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } }
[ "toyo@MacBook-Air-Aleksandr.local" ]
toyo@MacBook-Air-Aleksandr.local
6e5b96da5273cd8d4a80efe706886ecaf9d25f85
6bcec8ea9090256ba23452f46bd01665bce863d3
/01-SBMS-SI/src/main/java/com/codingtest/Car.java
ad8f0ee2955651da35470562ce95b4c5dcec9e4e
[]
no_license
ashishyadav9211/SpringBoot_MicroService
256e8b7348fe1c7b3ad1e33114e4e8362e6e1608
2dc7f183391d7848990b6c777d1ae84014eae1f0
refs/heads/master
2023-01-28T13:03:07.570915
2020-12-15T18:52:27
2020-12-15T18:52:27
319,093,539
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package com.codingtest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class Car { private Engine eng; public Car() { System.out.println("*** Car :: Constructor ****"); } @Autowired public void setEng(Engine eng) { System.out.println("*** Setter method Called ****"); this.eng = eng; } public void drive() { System.out.println("*** drive method called ***"); if(eng.enggineStatus==0) System.out.println(" *** Engine Started *****"); } }
[ "05ashish1992@gmail.com" ]
05ashish1992@gmail.com
a5f753649cd5bdf48848f311165326557a8017d5
6e72cf339cbfc423c30aa4b7d134009d690eb10a
/src/main/java/com/atlassian/jira/rest/client/model/GroupLabel.java
335326ec84fcba45aa69bf34f8463e840070444f
[]
no_license
rajcarthy/jira-cloud-client
90f52e62a2dd3a8358103bf4c76c3e2f617c53e3
0c427830d3bec56e400760da67b621694bf3297b
refs/heads/master
2023-02-08T13:00:00.349995
2020-12-31T18:32:04
2020-12-31T18:32:04
325,853,593
0
0
null
null
null
null
UTF-8
Java
false
false
3,814
java
/* * The Jira Cloud platform REST API * Jira Cloud platform REST API documentation * * OpenAPI spec version: 1001.0.0-SNAPSHOT * Contact: ecosystem@atlassian.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.atlassian.jira.rest.client.model; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.v3.oas.annotations.media.Schema; /** * A group label. */ @Schema(description = "A group label.") @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2020-12-30T18:52:18.038445-08:00[America/Los_Angeles]") public class GroupLabel { @JsonProperty("text") private String text = null; @JsonProperty("title") private String title = null; /** * The type of the group label. */ public enum TypeEnum { ADMIN("ADMIN"), SINGLE("SINGLE"), MULTIPLE("MULTIPLE"); private String value; TypeEnum(String value) { this.value = value; } @JsonValue public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } @JsonCreator public static TypeEnum fromValue(String text) { for (TypeEnum b : TypeEnum.values()) { if (String.valueOf(b.value).equals(text)) { return b; } } return null; } } @JsonProperty("type") private TypeEnum type = null; public GroupLabel text(String text) { this.text = text; return this; } /** * The group label name. * @return text **/ @Schema(description = "The group label name.") public String getText() { return text; } public void setText(String text) { this.text = text; } public GroupLabel title(String title) { this.title = title; return this; } /** * The title of the group label. * @return title **/ @Schema(description = "The title of the group label.") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public GroupLabel type(TypeEnum type) { this.type = type; return this; } /** * The type of the group label. * @return type **/ @Schema(description = "The type of the group label.") public TypeEnum getType() { return type; } public void setType(TypeEnum type) { this.type = type; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GroupLabel groupLabel = (GroupLabel) o; return Objects.equals(this.text, groupLabel.text) && Objects.equals(this.title, groupLabel.title) && Objects.equals(this.type, groupLabel.type); } @Override public int hashCode() { return Objects.hash(text, title, type); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GroupLabel {\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "uyscuti@localhost.localdomain" ]
uyscuti@localhost.localdomain
12ea017163043bddda58987a56ada93476ed4137
a03fc1d1ecb64169f965940de2e78a8c288600c3
/ComfortableNumbers.java
28349bcd9228cb930cd038293f922fe7878dec6c
[]
no_license
natashkela/HackerRank-Exercises
55865e155721ae535ef251e1a741c6e01666e6c7
9847fba3b3ebf403c4d3c1de3bd21d229f4558ce
refs/heads/master
2020-05-21T04:31:25.258742
2017-05-03T02:54:57
2017-05-03T02:54:57
58,437,083
0
0
null
null
null
null
UTF-8
Java
false
false
973
java
int comfortableNumbers(int L, int R) { if(L==R) return 0; int a = L; int b = a + 1; int sumA = 0; int pairs = 0; LinkedList<String> listPairs = new LinkedList<String>(); while (a < R) { String aStr = String.valueOf(a); int aX = 0; while (aX < aStr.length()) { sumA = sumA + Integer.parseInt(aStr.charAt(aX)+""); aX = aX + 1; } while (b <= R) { String bStr = String.valueOf(b); int bX = 0; int sumB = 0; while (bX < bStr.length()) { sumB = sumB + Integer.parseInt(bStr.charAt(bX)+""); bX = bX + 1; } if((b >= a - sumA) && (b <= a + sumA)&& (a >= b - sumB) && (a <= b + sumB)) { pairs = pairs + 1; } b = b + 1; } a = a + 1; b = a + 1; sumA = 0; } return pairs; }
[ "noreply@github.com" ]
noreply@github.com
c140184ae7b41a197f60305eeaf710a05889c165
7eaccafcf6128f4abd3cd4d7eacef8cac9fd3394
/salescloud-mobile/src/main/java/dk/jyskit/salescloud/application/pages/contractsummary/PartnerSupportOgRateAftaleReport.java
6526cca8fa1ce1a2136ea07dda788623e0801835
[]
no_license
JayRox1605/salescloudtestoneplus
d83f5f039c3f731806acd7b4d044129c1ee35f54
bfa2c8dcbe9cb126b3a6dee556188edc61d91989
refs/heads/master
2022-12-05T10:42:40.636879
2020-08-13T19:16:55
2020-08-13T19:16:55
291,664,159
0
0
null
2020-08-31T09:06:03
2020-08-31T08:53:44
HTML
UTF-8
Java
false
false
1,474
java
package dk.jyskit.salescloud.application.pages.contractsummary; import dk.jyskit.salescloud.application.MobileSession; import dk.jyskit.salescloud.application.model.BusinessArea; import dk.jyskit.salescloud.application.model.BusinessAreas; import dk.jyskit.salescloud.application.model.PartnerData; public class PartnerSupportOgRateAftaleReport extends PartnerReport { public PartnerSupportOgRateAftaleReport(String documentHeader, boolean includeSupport, boolean includeHardware) { super(includeSupport ? "partner_support_og_rate_aftale" : "rate_hardware", documentHeader, getFileName(MobileSession.get().getBusinessArea()), includeSupport, includeHardware); } private static String getFileName(BusinessArea businessArea) { switch (businessArea.getBusinessAreaId()) { case BusinessAreas.MOBILE_VOICE: return "support_og_rate_aftale_mobile.png"; case BusinessAreas.SWITCHBOARD: return "support_og_rate_aftale_omstilling.png"; case BusinessAreas.FIBER: return "support_og_rate_aftale_fiber.png"; case BusinessAreas.FIBER_ERHVERV: return "support_og_rate_aftale_fiber.png"; case BusinessAreas.WIFI: return "support_og_rate_aftale_wifi.png"; case BusinessAreas.TDC_WORKS: return "support_og_rate_aftale_works.png"; case BusinessAreas.ONE_PLUS: return "one_tilbud_2019.jpg"; // return "support_og_rate_aftale_one.png"; } return "??"; } @Override int getVariant() { return PartnerData.VARIANT_SUPPORT_OG_RATEAFTALE; } }
[ "jan@jyskit.dk" ]
jan@jyskit.dk
7afea22405e357d03bf4ebd78a464cdfbe1a1c99
8a84e55f07a2c7dc6a1fdd7e42e719953a355d62
/src/main/java/com/feed_the_beast/ftblib/client/teamsgui/GuiManageAllies.java
06ce06d388892cdcdcfcaed4df0fcc9a45ce6e25
[]
no_license
Eiple/FTBLib
e0faca122df162e852fd742f11b06d62b7ef88b7
e1ba74be153d11481d6fe06f1bfa613aef99c210
refs/heads/master
2021-01-25T14:58:59.596475
2018-02-06T01:53:31
2018-02-06T01:53:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,099
java
package com.feed_the_beast.ftblib.client.teamsgui; import com.feed_the_beast.ftblib.FTBLibLang; import com.feed_the_beast.ftblib.lib.EnumTeamStatus; import com.feed_the_beast.ftblib.lib.data.FTBLibTeamGuiActions; import com.feed_the_beast.ftblib.lib.gui.GuiBase; import com.feed_the_beast.ftblib.lib.gui.GuiHelper; import com.feed_the_beast.ftblib.lib.icon.Color4I; import com.feed_the_beast.ftblib.lib.util.ColorUtils; import com.feed_the_beast.ftblib.lib.util.misc.MouseButton; import com.feed_the_beast.ftblib.net.MessageMyTeamAction; import com.feed_the_beast.ftblib.net.MessageMyTeamPlayerList; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.text.TextFormatting; import java.util.Collection; import java.util.List; /** * @author LatvianModder */ public class GuiManageAllies extends GuiManagePlayersBase { private static class ButtonPlayer extends ButtonPlayerBase { private ButtonPlayer(GuiBase gui, MessageMyTeamPlayerList.Entry m) { super(gui, m); } @Override Color4I getPlayerColor() { return entry.status.isEqualOrGreaterThan(EnumTeamStatus.ALLY) ? ColorUtils.getChatFormattingColor(TextFormatting.DARK_AQUA.ordinal()) : getDefaultPlayerColor(); } @Override public void addMouseOverText(List<String> list) { list.add((entry.status.isEqualOrGreaterThan(EnumTeamStatus.ALLY) ? EnumTeamStatus.ALLY : EnumTeamStatus.MEMBER).getLangKey().translate()); } @Override public void onClicked(MouseButton button) { GuiHelper.playClickSound(); NBTTagCompound data = new NBTTagCompound(); data.setString("player", entry.name); if (entry.status.isEqualOrGreaterThan(EnumTeamStatus.ALLY)) { data.setBoolean("add", false); entry.status = EnumTeamStatus.NONE; } else { data.setBoolean("add", true); entry.status = EnumTeamStatus.ALLY; } new MessageMyTeamAction(FTBLibTeamGuiActions.ALLIES.getId(), data).sendToServer(); updateIcon(); } } public GuiManageAllies(Collection<MessageMyTeamPlayerList.Entry> m) { super(FTBLibLang.TEAM_GUI_ALLIES.translate(), m, ButtonPlayer::new); } }
[ "latvianmodder@gmail.com" ]
latvianmodder@gmail.com
9154101bab7c87759f9cd45c86ad49382b5254ae
bbda67269252d2f4663d178a1b50c66631b8e12a
/src/grail/complex/MyInterfaceRotatableLine.java
fa620bb4396b4d67af5b6fc4a757c320c169685d
[]
no_license
lamngo13/COMP-301-Project-4
6071cb5d7357c4da3fb904cc2b8f59ae6670703c
9303f6396cd91ebe98a5838357d2f634275c4e4a
refs/heads/main
2023-08-31T10:49:11.732889
2021-10-19T20:45:29
2021-10-19T20:45:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,332
java
package grail.complex; import util.annotations.EditablePropertyNames; import util.annotations.PropertyNames; import util.annotations.StructurePattern; import util.annotations.StructurePatternNames; import util.annotations.Tags; import tags301.Comp301Tags; import util.misc.ThreadSupport; import util.models.PropertyListenerRegisterer; import java.beans.PropertyChangeListener; import bus.uigen.OEFrame; import bus.uigen.ObjectEditor; import grail.complex.MyAPolarPoint; import grail.complex.MyPoint; import grail.simples.Locatable; @StructurePattern(StructurePatternNames.LINE_PATTERN) @PropertyNames({"X", "Y", "Width", "Height", "Angle", "Radius"}) @EditablePropertyNames({"X", "Y", "Angle", "Radius"}) @Tags(Comp301Tags.ROTATING_LINE) public interface MyInterfaceRotatableLine extends Locatable, PropertyListenerRegisterer{ // public int getX(); // public int getY(); // public void setX(int newX); // public void setY(int newY); public int getWidth(); public int getHeight(); public double getAngle(); public void setAngle(double newAngle); public double getRadius(); public void setRadius(double newRadius); public void rotate(int units); public void move(int xOffset, int yOffset); public void addPropertyChangeListener(PropertyChangeListener hamburger); }
[ "noreply@github.com" ]
noreply@github.com
5ac6f584a26273e5c7d268a3632e4c822ebf3be2
e4f9b119ef204a60ceeb13d876b754fd155d9d88
/src/main/java/App.java
833b3c3a64b0d9bd29b012344f28429fe4f8af16
[]
no_license
Passakorn-P/05CI
6909f96be6d99f28d77943cb7d6dc3410c473100
31a49bc435503269578c42d78883ddf943133598
refs/heads/master
2021-04-30T00:52:57.680145
2018-02-14T11:09:41
2018-02-14T11:09:41
121,468,074
0
0
null
2018-02-14T10:56:09
2018-02-14T03:53:35
Java
UTF-8
Java
false
false
804
java
/* * This Java source file was generated by the Gradle 'init' task. */ public class App { public boolean isPrime(long number) { double max = Math.sqrt(number)+1; if (number == 2) return true; if (number % 2 == 0) return false; for (long i = 3; i < max ; i += 2) { if (number % i == 0) { return false; } } return true; } public static void main(String[] args) { /* Input arguments length check conditions */ if (args.length < 1 || args.length > 1) { System.out.println("Please input a number as the program argument"); System.exit(0); } App appObj = new App(); long input = Long.parseLong(args[0]); System.out.println(appObj.isPrime(input)); } }
[ "passakorn.p@cmu.ac.th" ]
passakorn.p@cmu.ac.th
4da3d3fec3968aa3dc7d7f44c2a1b3ad3e83b8e3
15935d54064aa037c955a51e1268c500e73d1178
/src/main/java/com/phan/codechallenge/reece/config/RequestLoggingFilterConfig.java
e978b5151b987dacac3c3a003b81de0db1acc102
[]
no_license
peter-han/codechallenge_reece
10c0729b8a5db965924acc84e3c3a9520dcf6e1b
7aecf64f158436e48d409afae5d442e1b3749400
refs/heads/develop
2023-06-19T11:39:32.292867
2021-07-12T02:26:26
2021-07-12T02:26:26
384,627,163
0
0
null
2021-07-12T02:01:00
2021-07-10T06:25:02
Java
UTF-8
Java
false
false
732
java
package com.phan.codechallenge.reece.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.filter.CommonsRequestLoggingFilter; @Configuration public class RequestLoggingFilterConfig { @Bean public CommonsRequestLoggingFilter logFilter() { CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter(); filter.setIncludeQueryString(true); filter.setIncludePayload(true); filter.setMaxPayloadLength(10000); filter.setIncludeHeaders(false); filter.setAfterMessagePrefix("REQUEST DATA : "); // TODO customer data masking return filter; } }
[ "roc_han@163.com" ]
roc_han@163.com
6c9201d6f5bc5c00c778cdb676d2ced417b60908
f986e9053713ebd08ffed475e1ebc1845c4e044f
/Spring-boot-Demo-master/bookservice-1/src/main/java/com/example/bookservice/controller.java
d5f9fc71b703b68ac5b88aeb668532a55672c85c
[]
no_license
Rahu9977/Demo
f8f9156939e61a69e8f6b1618aa41c6dcc355cf9
7a4f56afae1994b5323b24113b9bf8d727918819
refs/heads/master
2023-04-18T00:54:23.288854
2021-04-08T12:35:28
2021-04-08T12:35:28
134,707,528
0
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package com.example.bookservice; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class controller { @CrossOrigin("http://localhost:4200") @GetMapping("/findAllBookss") public List<Book> getBooks() { System.out.println("DssD"+ Stream.of(new Book(101,"wddwd",233), new Book(102,"sssa",533), new Book(222,"ssd",323)).collect(Collectors.toList())); return Stream.of(new Book(101,"wddwd",233), new Book(102,"sssa",533), new Book(222,"ssd",323)).collect(Collectors.toList()); } private static List<Book> todos = new ArrayList<>(); static { todos.add(new Book(101,"wddwd",233)); todos.add(new Book(102,"sssa",533)); todos.add(new Book(222,"ssd",323)); } @GetMapping("/") public List<Book> findAll() { System.out.println("DD"+todos); return todos; } }
[ "rahulchaudhari419@gmail.com" ]
rahulchaudhari419@gmail.com
e223ee72b85832d21a0737470ef2675b1879da4a
cbff9c0efceae791a8e93d300b65e64dac159660
/customer/src/main/java/org/customer/inquiry/repositoryimpl/InquiryRepositoryImpl.java
43b9e61d17ccb8c4e0025d247cb6bece7f6f6a03
[]
no_license
rcodesmith/fornax-sculptor-sandbox
8842b5eb61f22d11c8d5d11422f7922c83398d8d
9a4727958ec6e1cfe1c4d6879a84c4e3baabc3a8
refs/heads/master
2021-05-28T13:24:22.789323
2011-03-13T21:08:15
2011-03-13T21:08:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,141
java
package org.customer.inquiry.repositoryimpl; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.customer.inquiry.domain.Inquiry; import org.customer.inquiry.domain.InquiryRepository; import org.customer.inquiry.domain.Supplier; import org.customer.inquiry.exception.InquiryNotFoundException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.google.appengine.api.datastore.Key; /** * Repository implementation for Inquiry */ @Repository("inquiryRepository") public class InquiryRepositoryImpl extends InquiryRepositoryBase implements InquiryRepository { private final Log log = LogFactory.getLog(InquiryRepositoryImpl.class); @Autowired private InquirySender inquirySender; public InquiryRepositoryImpl() { } @Override public boolean sendInquiry(Key id) throws InquiryNotFoundException { Inquiry inquiry = findById(id); if (inquiry.isSendDone()) { return true; } List<Supplier> allSuppliers = getSupplierRepository().findAll(); Set<Supplier> suppliersToSend = findSuppliersToSend(inquiry, allSuppliers); if (suppliersToSend.isEmpty()) { inquiry.setSendDone(true); return true; } boolean ok = false; for (Supplier supplier : suppliersToSend) { inquiry.increaseSendAttempt(); ok = sendInquiryToSupplier(inquiry, supplier); if (ok) { inquiry.wasSentToSupplier(supplier, allSuppliers.size()); log.info("Inquiry " + inquiry.getId() + " was sent to supplier: " + supplier.getName() + " Inquiry message: " + inquiry.getMessage()); } else { log.info("Failed to send Inquiry " + inquiry.getId() + " to supplier: " + supplier.getName()); } } return ok; } protected boolean sendInquiryToSupplier(Inquiry inquiry, Supplier supplier) { return inquirySender.sendInquiryToSupplier(inquiry, supplier); } private Set<Supplier> findSuppliersToSend(Inquiry inquiry, List<Supplier> allSuppliers) { Set<Supplier> result = new HashSet<Supplier>(); for (Supplier each : allSuppliers) { if (!inquiry.isSentToSupplier(each)) { result.add(each); } } return result; } @Override public List<Inquiry> findAll() { return sort(super.findAll()); } /** * Latest first */ private List<Inquiry> sort(List<Inquiry> list) { List<Inquiry> result = new ArrayList<Inquiry>(list); Collections.sort(list, new Comparator<Inquiry>() { @Override public int compare(Inquiry inq1, Inquiry inq2) { return inq2.getCreatedDate().compareTo(inq1.getCreatedDate()); } }); return result; } }
[ "patrik_nordwall@df330e69-2214-0410-8926-af1636e6a837" ]
patrik_nordwall@df330e69-2214-0410-8926-af1636e6a837
c9658b0d00087bc74587554588ab7d911010ab2c
911f46d9722f1fae7ad4500318868630722179de
/src/Exceptions/HeapException.java
4c6d1c8f44e5cf17d09ae2dfb33d2b45b4a33fe2
[]
no_license
alexandra-olahut/Toy-interpreter
925984b9b7433ab621b55f6caab8550b973321fa
6937cd61efd306fde5b8c1ef845ba54c68b7b177
refs/heads/main
2023-03-28T20:01:25.938118
2021-03-20T18:28:56
2021-03-20T18:28:56
348,821,884
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package Exceptions; public class HeapException extends RuntimeException { public HeapException(String msg) {super(msg);} @Override public String getMessage() {return "(!) Heap error : \n" + super.getMessage();} }
[ "70906697+alexandra-olahut@users.noreply.github.com" ]
70906697+alexandra-olahut@users.noreply.github.com
9846f92473aabb550da8c1dccb1fdd07c9b4b550
ba8372fbd3a9b67e19b7ad657154c8cc5bbfa330
/app/src/androidTest/java/br/com/luan/materialbase/ExampleInstrumentedTest.java
bfee08dce8f20eadff1295be8aeb3982731950a0
[]
no_license
luangs7/MaterialBase
11be1783d95db57f98aa990d07184b5baaf24e4f
3194084b46450ca1defcdb1524c4a1676c1d0143
refs/heads/master
2020-12-13T12:52:00.936286
2017-07-19T20:31:16
2017-07-19T20:31:16
95,599,822
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package br.com.luan.materialbase; 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.*; /** * Instrumentation 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("br.com.luan.materialbase", appContext.getPackageName()); } }
[ "luan@squarebits.com.br" ]
luan@squarebits.com.br
c2394e45b076cde95333ca2a855507ae3687dba3
6bdd333033972ecfe170e7f1ad7bf51c25303fa2
/app/src/main/java/com/kytelabs/bleduino/modules/LedModuleActivity.java
0c3ea410c45946a4ed8afa49a2699a1fdf3013a9
[]
no_license
UncleGravity/bleduino-android
00dbaa817a87916fa2d8486f2641507b950d41f8
a8418c3181cc5e904bf057ab95d1942c8a869dfe
refs/heads/master
2020-04-10T19:45:51.156549
2015-08-07T17:54:49
2015-08-07T17:54:49
32,430,434
4
1
null
null
null
null
UTF-8
Java
false
false
11,190
java
package com.kytelabs.bleduino.modules; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattService; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; import android.os.IBinder; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.crashlytics.android.Crashlytics; import com.kytelabs.bleduino.R; import com.kytelabs.bleduino.adapters.LedListAdapter; import com.kytelabs.bleduino.ble.BLEGattAttributes; import com.kytelabs.bleduino.ble.BLEService; import com.kytelabs.bleduino.pojos.LedListItem; import com.kytelabs.bleduino.pojos.SettingsListItem; import java.util.Arrays; import java.util.List; import java.util.UUID; import butterknife.ButterKnife; import butterknife.InjectView; import io.fabric.sdk.android.Fabric; public class LedModuleActivity extends ActionBarActivity implements LedListAdapter.OnLedClickListener { private final static String TAG = LedModuleActivity.class.getSimpleName(); //Member Variables //-------------------------------------------------------------------------------- private LedListItem[] mLedListItems; @InjectView(R.id.ledRecyclerView) RecyclerView mRecyclerView; @InjectView(R.id.app_bar) Toolbar mToolbar; // BLE variables //---------------------------------------------------------------------------- BluetoothGattCharacteristic mFirmataCharacteristic; BLEService mBluetoothLeService; private final ServiceConnection mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { mBluetoothLeService = ((BLEService.LocalBinder) service).getService(); if (!mBluetoothLeService.initialize()) { //Bluetooth is disabled Log.e(TAG, "Unable to initialize BLE"); Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivity(enableBtIntent); } Log.e(TAG, "OnServiceConnected called"); //---------- Get characteristic to be used in this module -------------// if(mBluetoothLeService.getBluetoothGatt() != null){ //Get list of services List<BluetoothGattService> mBluetoothGattServices = mBluetoothLeService.getSupportedGattServices(); //mBluetoothGatt.getServices(); //Look for uart service for (BluetoothGattService leService : mBluetoothGattServices) { //Found service, get write characteristic, put value, then write it. if(leService.getUuid().equals(UUID.fromString(BLEGattAttributes.BLEDUINO_FIRMATA_SERVICE))){ mFirmataCharacteristic = leService.getCharacteristic(UUID.fromString(BLEGattAttributes.BLEDUINO_FIRMATA_CHARACTERISTIC)); // Subscribe //mBluetoothLeService.setCharacteristicNotification(mFirmataCharacteristic, true); }}} } @Override public void onServiceDisconnected(ComponentName name) { mBluetoothLeService = null; } }; //================================================================================ // Activity Life Cycle //================================================================================ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_led_module); ButterKnife.inject(this); //Toolbar Setup //-------------------------------------------------------------------------------- setSupportActionBar(mToolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); //RecyclerView Setup //-------------------------------------------------------------------------------- populateLedList(); setupAdapter(); // BLEService Setup (bind service to activity) //---------------------------------------------------------------------------- Intent gattServiceIntent = new Intent(this, BLEService.class); bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE); } @Override protected void onResume() { super.onResume(); registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter()); } @Override protected void onPause() { super.onPause(); // Unregister BLE service unregisterReceiver(mGattUpdateReceiver); } @Override protected void onDestroy() { super.onDestroy(); unbindService(mServiceConnection); mBluetoothLeService = null; } //================================================================================ // Action Bar //================================================================================ @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_led_module, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } //================================================================================ // Recycler View //================================================================================ private void populateLedList() { mLedListItems = new LedListItem[21]; mLedListItems[0] = new LedListItem("0"); mLedListItems[1] = new LedListItem("1"); mLedListItems[2] = new LedListItem("2"); mLedListItems[3] = new LedListItem("3"); mLedListItems[4] = new LedListItem("4"); mLedListItems[5] = new LedListItem("5"); mLedListItems[6] = new LedListItem("6"); mLedListItems[7] = new LedListItem("7"); mLedListItems[8] = new LedListItem("8"); mLedListItems[9] = new LedListItem("9"); mLedListItems[10] = new LedListItem("10"); mLedListItems[11] = new LedListItem("13"); mLedListItems[12] = new LedListItem("A0"); mLedListItems[13] = new LedListItem("A1"); mLedListItems[14] = new LedListItem("A2"); mLedListItems[15] = new LedListItem("A3"); mLedListItems[16] = new LedListItem("A4"); mLedListItems[17] = new LedListItem("A5"); mLedListItems[18] = new LedListItem("MOSI"); mLedListItems[19] = new LedListItem("MISO"); mLedListItems[20] = new LedListItem("SCK"); } private void setupAdapter() { RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(layoutManager); LedListAdapter adapter = new LedListAdapter(this, Arrays.asList(mLedListItems)); //TODO LedListAdapter mRecyclerView.setAdapter(adapter); } @Override public void onLedClick(LedListItem led) { // do stuff sendLedCommand(led.getPinNumber(), led.isPinState()); } //================================================================================ // Bluetooth Low Energy Code //================================================================================ private boolean sendLedCommand(int pinNumber, boolean pinState) { // TODO handle when there is no device connected. mBluetoothGatt == null if(mBluetoothLeService.getBluetoothGatt() == null){ Toast.makeText(getApplicationContext(), "No BLEduino connected", Toast.LENGTH_SHORT).show(); return false; } if(mBluetoothLeService.getConnectionState() == BLEService.STATE_DISCONNECTED){ Toast.makeText(getApplicationContext(), "No BLEduino connected", Toast.LENGTH_SHORT).show(); return false; } // Toggle LED pin byte[] ledCommand = new byte[3]; ledCommand[0] = (byte) pinNumber; ledCommand[1] = 0; ledCommand[2] = (byte) (pinState ? 1 : 0); mFirmataCharacteristic.setValue(ledCommand); mBluetoothLeService.writeCharacteristic(mFirmataCharacteristic); Log.d(TAG, "command = [" + ledCommand[0] + ", " + ledCommand[1] + ", " + ledCommand[2] + "]"); return true; } private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (BLEService.ACTION_GATT_CONNECTED.equals(action)) { Toast.makeText(getApplicationContext(), "Discovering Services.", Toast.LENGTH_SHORT).show(); // Display "Connected" notification. } else if (BLEService.ACTION_GATT_DISCONNECTED.equals(action)) { //TODO make this into a dialog //Get bleduino settings SharedPreferences prefs = getSharedPreferences(SettingsListItem.SETTINGS_FILE, 0); if(prefs.getBoolean(SettingsListItem.SETTING_NOTIFY, true)){ Toast.makeText(getApplicationContext(),"Disconnected!",Toast.LENGTH_SHORT).show(); } } else if (BLEService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) { // All services and characteristics discovered. // Show all the supported services and characteristics on the user interface. Toast.makeText(getApplicationContext(), "Connected", Toast.LENGTH_LONG).show(); } } }; // No idea, check what an update filter is. private static IntentFilter makeGattUpdateIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BLEService.ACTION_GATT_CONNECTED); intentFilter.addAction(BLEService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(BLEService.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(BLEService.ACTION_DATA_AVAILABLE); return intentFilter; } }
[ "angel@kytelabs.com" ]
angel@kytelabs.com
b415a9eddfb1200e7514a48a34f749d9dc55b135
9d60fe50d0f51886a60e2d8d8cbc72941f75362b
/Pertemuann 10/Praktek/formberatbadan.java
2742a72118846d412a3e25c6430d1c64fac41bb5
[]
no_license
RizqullahRamadhan27/PBO4417-
dccebec48f12381cde2c1abc4f048edc36d70497
75f0dd057f59342b0c88d1104acde2b61c6bb88b
refs/heads/main
2023-05-30T21:53:19.559917
2021-06-15T11:56:01
2021-06-15T11:56:01
345,363,080
0
0
null
null
null
null
UTF-8
Java
false
false
10,550
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 beratbadan; /** * * @author ASUS */ public class formberatbadan extends javax.swing.JFrame { String Nim; String nama; Float tinggi ; Float tinggi2 ; Float berat ; /** * Creates new form formberatbadan */ public formberatbadan() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { NIM = new java.awt.Label(); NAMA = new java.awt.Label(); BERAT = new java.awt.Label(); TINGGI = new java.awt.Label(); txt_NIM = new java.awt.TextField(); txt_NAMA = new java.awt.TextField(); txt_TINGGI = new java.awt.TextField(); txt_BERAT = new java.awt.TextField(); lblhasil = new java.awt.Label(); btn_hitung = new java.awt.Button(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); NIM.setText("Nim"); NAMA.setText("Nama"); BERAT.setText("Berat(Kg)"); TINGGI.setText("Tinggi(M)"); lblhasil.setText("Hasil"); btn_hitung.setLabel("Hitung"); btn_hitung.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_hitungActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(NIM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(BERAT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(NAMA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(TINGGI, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txt_NAMA, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_BERAT, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_TINGGI, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_NIM, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(btn_hitung, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(274, 274, 274))) .addGroup(layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(lblhasil, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(36, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(26, 26, 26) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(NIM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_NIM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(NAMA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_NAMA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(BERAT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(TINGGI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(txt_BERAT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txt_TINGGI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) .addComponent(btn_hitung, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(23, 23, 23) .addComponent(lblhasil, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(37, 37, 37)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btn_hitungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_hitungActionPerformed String Nim = txt_NIM.getText(); String nama = txt_NAMA.getText(); berat = Float.parseFloat(txt_BERAT.getText()); tinggi = Float.parseFloat(txt_TINGGI.getText()); tinggi2 = tinggi * tinggi; Float hasil = berat / tinggi2; if (hasil > 24.0){ lblhasil.setText(txt_NIM.getText()+", "+txt_NAMA.getText() +", "+ "Berat Badan Anda Tidak Ideal"); } else if (hasil < 18.0){ lblhasil.setText(txt_NIM.getText()+", "+txt_NAMA.getText() +", "+ "Berat Badan Anda Tidak Ideal"); } else { lblhasil.setText(txt_NIM.getText()+", "+txt_NAMA.getText() +", "+ "Berat Badan Anda Sudah Ideal"); } }//GEN-LAST:event_btn_hitungActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(formberatbadan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(formberatbadan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(formberatbadan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(formberatbadan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new formberatbadan().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.Label BERAT; private java.awt.Label NAMA; private java.awt.Label NIM; private java.awt.Label TINGGI; private java.awt.Button btn_hitung; private java.awt.Label lblhasil; private java.awt.TextField txt_BERAT; private java.awt.TextField txt_NAMA; private java.awt.TextField txt_NIM; private java.awt.TextField txt_TINGGI; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
noreply@github.com
264ce9919e38fea37c36b86038503981e9369430
4147f1be7bc1aba9fbdec976dc2637a0f183e08c
/src/com/cmcc/nativepackage/IDCard.java
1de757342eee758385a7f9484431490ac369f839
[]
no_license
Kunoon/BeiST20141020
6494fee2fd5c902b84f4babfa6d215049b770d8c
fdd8dc35ee75137a651fec55ad704af1a1eb174d
refs/heads/master
2021-01-01T05:41:16.124465
2014-10-22T10:03:38
2014-10-22T10:03:38
25,573,741
1
1
null
null
null
null
UTF-8
Java
false
false
778
java
package com.cmcc.nativepackage; import java.lang.Integer; public class IDCard { static { //System.loadLibrary("ist_idc"); System.loadLibrary("CMCC_UNITDEVICE_WEWINS_A8"); } //杩炴帴浜屼唬璇佽韩浠借瘑鍒澶�? public static native int openIDCard(int idCardType,String deviceId,String password); public static native int closeIDCard(); //鑾峰彇缁勪欢鐗堟湰淇℃伅 public static native int getIDCardVersion(byte[] version); //鍒濆鍖栦簩浠h瘉韬唤璇嗗埆璁惧锛屾竻闄や簩浠h瘉韬唤璇嗗埆璁惧鍐呯紦�?樻暟鎹�? public static native int initialIDCard (); //鑾峰緱浜屼唬璇佷俊鎭�? public static native int getIdCardInfo(String[] idCardInfo,byte[] img); }
[ "yk.letters@gmail.com" ]
yk.letters@gmail.com
d0b1a411e6999744042eaaa15fc80b97996c3361
bbc5c74c6fd9fd8a6b529b5f124f6f03fb7609aa
/Lesson3/Product.java
fe19cbf5052fd6f091d941144a8ad6790c3265a8
[]
no_license
Saulesmeita/java-student-projects
da3620a64bb13f36e8421766935a86a5cbdb3b1d
4790b37c8f08ed0667dd651a995376f549f7c134
refs/heads/master
2020-08-12T21:34:53.523092
2019-12-11T14:11:13
2019-12-11T14:11:13
214,846,950
0
1
null
null
null
null
UTF-8
Java
false
false
833
java
package lv.javaguru.lesson3; public class Product { String name; double regularPrice; double discount; public Product(String name) { this.name = name; } public double getRegularPrice() { return regularPrice; } public void setRegularPrice(double regularPrice) { this.regularPrice = regularPrice; } public double getDiscount() { return discount; } public void setDiscount(double discount) { this.discount = discount; } double actualPrice() { return regularPrice * (100 - discount) / 100; } void printInformation() { System.out.printf("%n Product: name = %s, regular price = %.2f EUR, discount = %.2f%%, actual price = %.2f EUR. %n", name, regularPrice, discount, actualPrice()); } }
[ "anna.terehova@gmail.com" ]
anna.terehova@gmail.com
ec91083de37cb4365a7463bebc18fd50a79e79a0
b79d7c89bef6e418ee3e6abb548d085052720b93
/Advanced/app/src/main/java/com/bihe0832/request/libware/request/MyX509TrustManager.java
fe69dc2b2cf7524894a0137f65c3bece138e2fcb
[]
no_license
scean/Android-HttpURLConnection
bdcc473ffa85b3df1f27e89c5cd60ba70e7ff44c
c963f655284fc2af7dbd8e62809ca1404c428f8e
refs/heads/master
2020-03-13T18:14:45.038571
2017-03-15T05:47:23
2017-03-15T05:47:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,876
java
package com.bihe0832.request.libware.request; import java.io.FileInputStream; import java.security.KeyStore; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; public class MyX509TrustManager implements X509TrustManager { X509TrustManager sunJSSEX509TrustManager; private static volatile MyX509TrustManager instance; public static MyX509TrustManager getInstance () { if (instance == null) { synchronized (MyX509TrustManager.class) { if (instance == null) { try { instance = new MyX509TrustManager(); }catch (Exception e){ e.printStackTrace(); instance = null; } } } } return instance; } private MyX509TrustManager() throws Exception { // create a "default" JSSE X509TrustManager. KeyStore ks = null; try { ks = KeyStore.getInstance("JKS"); } catch (Exception e){ e.printStackTrace(); } TrustManager tms [] = {}; if (ks != null){ FileInputStream fis = null; try { fis = new FileInputStream("trustedCerts"); ks.load(fis, "passphrase".toCharArray()); TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE"); tmf.init(ks); tms = tmf.getTrustManagers(); } finally { if (fis != null) { fis.close(); } fis = null; } }else{ TrustManagerFactory tmf = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init((KeyStore) null); tms = tmf.getTrustManagers(); } for (int i = 0; i < tms.length; i++) { if (tms[i] instanceof X509TrustManager) { sunJSSEX509TrustManager = (X509TrustManager) tms[i]; return; } } throw new Exception("Couldn't initialize"); } @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { sunJSSEX509TrustManager.checkClientTrusted(chain, authType); } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { sunJSSEX509TrustManager.checkServerTrusted(chain, authType); } @Override public X509Certificate[] getAcceptedIssuers() { return sunJSSEX509TrustManager.getAcceptedIssuers(); } }
[ "code@bihe0832.com" ]
code@bihe0832.com
66e4e9c96a8b3ab7c68cc3a7697b6666066ce94e
204ded156be6d14ecf59300c5ed961481553cddd
/TradingMachineUtility/src/main/java/com/projects/tradingMachine/utility/Utility.java
eaf30b0b32ca4b9e5bab555a35806953ca192f50
[]
no_license
NicolaNardino/TradingMachine
3ef336b149ecfc24b70eb5a34a849fc748298035
b70e335a6e723f564611f44bbcdbaddef8b4ab7d
refs/heads/master
2022-08-09T11:55:04.868050
2022-08-01T16:42:38
2022-08-01T16:42:38
54,989,906
43
22
null
2022-08-01T16:42:39
2016-03-29T16:00:27
Java
UTF-8
Java
false
false
3,201
java
package com.projects.tradingMachine.utility; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Properties; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.projects.tradingMachine.utility.marketData.MarketData; import quickfix.DataDictionaryProvider; import quickfix.FixVersions; import quickfix.LogUtil; import quickfix.Message; import quickfix.MessageUtils; import quickfix.Session; import quickfix.SessionID; import quickfix.SessionNotFound; import quickfix.field.ApplVerID; public final class Utility { private static final Logger logger = LoggerFactory.getLogger(Utility.class); private static final Random Random = new Random(); public enum DestinationType {Queue, Topic} public static void shutdownExecutorService(final ExecutorService es, long timeout, TimeUnit timeUnit) throws InterruptedException { es.shutdown(); if (!es.awaitTermination(timeout, timeUnit)) es.shutdownNow(); logger.info("Terminated ScheduledExecutorService"); } public static Properties getApplicationProperties(final String propertiesFileName) throws FileNotFoundException, IOException { final Properties p = new Properties(); try(final InputStream inputStream = ClassLoader.getSystemResourceAsStream(propertiesFileName)) { p.load(inputStream); return p; } } public static double roundDouble(final double value, final int scale) { return new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP).doubleValue(); } public static void sendMessage(final SessionID sessionID, final Message message) { try { final Session session = Session.lookupSession(sessionID); if (session == null) { throw new SessionNotFound(sessionID.toString()); } final DataDictionaryProvider dataDictionaryProvider = session.getDataDictionaryProvider(); try { dataDictionaryProvider.getApplicationDataDictionary(getApplVerID(session, message)).validate(message, true); } catch (Exception e) { LogUtil.logThrowable(sessionID, "Outgoing message failed validation: "+ e.getMessage(), e); return; } session.send(message); //thread safe. } catch (final SessionNotFound e) { logger.error(e.getMessage(), e); } } private static ApplVerID getApplVerID(final Session session, final Message message) { final String beginString = session.getSessionID().getBeginString(); if (FixVersions.BEGINSTRING_FIXT11.equals(beginString)) { return new ApplVerID(ApplVerID.FIX50); } else { return MessageUtils.toApplVerID(beginString); } } public static MarketData buildRandomMarketDataItem(final String symbol) { return new MarketData(symbol, roundDouble(Random.nextDouble() * 100, 2), Utility.roundDouble(Random.nextDouble() * 100, 2), Random.nextInt(1000), Random.nextInt(1000)); } }
[ "nicola.nardino@nicolanardino.net" ]
nicola.nardino@nicolanardino.net
b874bb27e6aa9f72315e7d0574e0b7572f75210f
98da94968d37e42440cceeadb971bc90d7fc4c33
/JavaTest11_30/src/Java11_30/StaticSquare.java
aad5c5593be63d3208e9f079c4d63f2092d12fa7
[]
no_license
CXYhh121/JavaCode
da77cbb7a36669fe3e7578a0aa51fbf847853ee4
eb769b1a90d266e88ec95c05acb6f7d76c873808
refs/heads/master
2021-08-16T18:31:19.104488
2020-09-19T10:17:50
2020-09-19T10:17:50
222,690,495
1
0
null
2020-09-19T10:17:51
2019-11-19T12:26:02
JavaScript
UTF-8
Java
false
false
1,182
java
package Java11_30; //1.普通代码块 //2.定义在类中不佳任何修饰符的代码块,称为构造块 //构造块优先于构造方法执行,并且产生几个对象就调用几次构造块 //一般也可用构造块完成属性的初始化操作 //3.静态代码块,定义在类中,用static关键字修饰的称为静态代码块 //静态代码块优先于构造块执行,无论多少对象产生,只执行一次,在类加载时执行 //主类中的静态代码块优先于主方法执行 class TestSquare { public TestSquare() { System.out.println("1.TestSquare的构造方法...."); } { System.out.println("2.TestSquare的构造代码块..."); } static { System.out.println("3.TestSquare的静态代码块..."); } } public class StaticSquare { public StaticSquare() { System.out.println("1"); } { System.out.println("2"); } static { System.out.println("3"); } public static void main(String[] args) { //System.out.println("4"); //StaticSquare staticSquare = new StaticSquare(); TestSquare testSquare = new TestSquare(); } }
[ "CXYhh121@126.com" ]
CXYhh121@126.com
8db511ab984c65eb38fef8aa5060d913164d8e1f
7a2c66bf546b5a637f4704502487e7bab6d81cc9
/src/main/java/net/haesleinhuepf/clij2/plugins/StatisticsOfLabelledPixels.java
2f255186c646a71e0b95c7dbb506aa2aca4dc5a1
[ "BSD-3-Clause" ]
permissive
maarzt/clij2
470a13565e4f996dfaf72c3eebce4544d76c1c8c
c65124ab157b04726c731bfdbf6c3aae15a4f072
refs/heads/master
2021-04-20T13:10:58.980067
2020-03-22T20:59:31
2020-03-22T20:59:31
249,686,118
0
0
NOASSERTION
2020-03-24T11:07:48
2020-03-24T11:07:47
null
UTF-8
Java
false
false
19,548
java
package net.haesleinhuepf.clij2.plugins; import ij.ImagePlus; import ij.measure.ResultsTable; import net.haesleinhuepf.clij.clearcl.ClearCLBuffer; import net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum; import net.haesleinhuepf.clij.macro.CLIJMacroPlugin; import net.haesleinhuepf.clij.macro.CLIJOpenCLProcessor; import net.haesleinhuepf.clij.macro.documentation.OffersDocumentation; import net.haesleinhuepf.clij2.AbstractCLIJ2Plugin; import net.haesleinhuepf.clij2.CLIJ2; import org.scijava.plugin.Plugin; import java.util.ArrayList; /** * Author: @haesleinhuepf * September 2019 in Prague */ @Plugin(type = CLIJMacroPlugin.class, name = "CLIJ2_statisticsOfLabelledPixels") public class StatisticsOfLabelledPixels extends AbstractCLIJ2Plugin implements CLIJMacroPlugin, CLIJOpenCLProcessor, OffersDocumentation { public enum STATISTICS_ENTRY { IDENTIFIER(0), BOUNDING_BOX_X(1), BOUNDING_BOX_Y(2), BOUNDING_BOX_Z(3), BOUNDING_BOX_END_X(4), BOUNDING_BOX_END_Y(5), BOUNDING_BOX_END_Z(6), BOUNDING_BOX_WIDTH(7), BOUNDING_BOX_HEIGHT(8), BOUNDING_BOX_DEPTH(9), MINIMUM_INTENSITY(10), MAXIMUM_INTENSITY(11), MEAN_INTENSITY(12), SUM_INTENSITY(13), STANDARD_DEVIATION_INTENSITY(14), PIXEL_COUNT(15), SUM_INTENSITY_TIMES_X(16), SUM_INTENSITY_TIMES_Y(17), SUM_INTENSITY_TIMES_Z(18), MASS_CENTER_X(19), MASS_CENTER_Y(20), MASS_CENTER_Z(21), SUM_X(22), SUM_Y(23), SUM_Z(24), CENTROID_X(25), CENTROID_Y(26), CENTROID_Z(27); static final int NUMBER_OF_ENTRIES = 28; public final int value; STATISTICS_ENTRY(int value) { this.value = value; } } @Override public boolean executeCL() { ClearCLBuffer inputImage = (ClearCLBuffer) args[0]; ClearCLBuffer inputLabelMap = (ClearCLBuffer) args[1]; ResultsTable resultsTable = ResultsTable.getResultsTable(); statisticsOfLabelledPixels(getCLIJ2(), inputImage, inputLabelMap, resultsTable); resultsTable.show("Results"); return true; } public static ResultsTable statisticsOfLabelledPixels(CLIJ2 clij2, ClearCLBuffer inputImage, ClearCLBuffer inputLabelMap, ResultsTable resultsTable) { double[][] statistics = statisticsOfLabelledPixels(clij2, inputImage, inputLabelMap); ArrayList<STATISTICS_ENTRY> entries = new ArrayList<STATISTICS_ENTRY>(); entries.add(STATISTICS_ENTRY.IDENTIFIER); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_X); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_Y); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_Z); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_END_X); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_END_Y); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_END_Z); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_WIDTH); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_HEIGHT); entries.add(STATISTICS_ENTRY.BOUNDING_BOX_DEPTH); entries.add(STATISTICS_ENTRY.MINIMUM_INTENSITY); entries.add(STATISTICS_ENTRY.MAXIMUM_INTENSITY); entries.add(STATISTICS_ENTRY.MEAN_INTENSITY); entries.add(STATISTICS_ENTRY.SUM_INTENSITY); entries.add(STATISTICS_ENTRY.STANDARD_DEVIATION_INTENSITY); entries.add(STATISTICS_ENTRY.PIXEL_COUNT); entries.add(STATISTICS_ENTRY.SUM_INTENSITY_TIMES_X); entries.add(STATISTICS_ENTRY.SUM_INTENSITY_TIMES_Y); entries.add(STATISTICS_ENTRY.SUM_INTENSITY_TIMES_Z); entries.add(STATISTICS_ENTRY.MASS_CENTER_X); entries.add(STATISTICS_ENTRY.MASS_CENTER_Y); entries.add(STATISTICS_ENTRY.MASS_CENTER_Z); entries.add(STATISTICS_ENTRY.SUM_X); entries.add(STATISTICS_ENTRY.SUM_Y); entries.add(STATISTICS_ENTRY.SUM_Z); entries.add(STATISTICS_ENTRY.CENTROID_X); entries.add(STATISTICS_ENTRY.CENTROID_Y); entries.add(STATISTICS_ENTRY.CENTROID_Z); for (int line = 0; line < statistics.length; line++) { resultsTable.incrementCounter(); for (STATISTICS_ENTRY entry : entries) { resultsTable.addValue(entry.toString(), statistics[line][entry.value]); } } return resultsTable; } public static double[][] statisticsOfLabelledPixels(CLIJ2 clij2, ClearCLBuffer inputImage, ClearCLBuffer inputLabelMap) { int numberOfLabels = (int) clij2.maximumOfAllPixels(inputLabelMap); return statisticsOfLabelledPixels(clij2, inputImage, inputLabelMap, 1, numberOfLabels); } public static double[] statisticsOfLabelledPixels(CLIJ2 clij2, ClearCLBuffer inputImage, ClearCLBuffer inputLabelMap, int labelIndex) { return statisticsOfLabelledPixels(clij2, inputImage, inputLabelMap, labelIndex, labelIndex)[0]; } // as it's super slow on the GPU, let's do it on the CPU public static double[][] statisticsOfLabelledPixels(CLIJ2 clij2, ClearCLBuffer inputImage, ClearCLBuffer inputLabelMap, int startLabelIndex, int endLabelIndex) { double[][] statistics = new double[endLabelIndex - startLabelIndex + 1][STATISTICS_ENTRY.NUMBER_OF_ENTRIES]; boolean[] initializedFlags = new boolean[statistics.length]; ClearCLBuffer image = inputImage; ClearCLBuffer labelMap = inputLabelMap; if (inputImage.getNativeType() != NativeTypeEnum.Float) { image = clij2.create(inputImage.getDimensions(), NativeTypeEnum.Float); clij2.copy(inputImage, image); } if (inputLabelMap.getNativeType() != NativeTypeEnum.Float) { labelMap = clij2.create(inputLabelMap.getDimensions(), NativeTypeEnum.Float); clij2.copy(inputLabelMap, labelMap); } ImagePlus imp = clij2.pull(image); ImagePlus lab = clij2.pull(labelMap); int width = imp.getWidth(); for (int z = 0; z < imp.getNSlices(); z++) { imp.setZ(z + 1); lab.setZ(z + 1); float[] pixels = (float[]) imp.getProcessor().getPixels(); float[] labels = (float[]) lab.getProcessor().getPixels(); int x = 0; int y = 0; for (int i = 0; i < pixels.length; i++) { int index = (int) labels[i]; if (index > 0) { int targetIndex = index - startLabelIndex; double value = pixels[i]; boolean initialized = initializedFlags[targetIndex]; if (x < statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_X.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_X.value] = x; } if (y < statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_Y.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_Y.value] = y; } if (z < statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_Z.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_Z.value] = z; } if (x > statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_END_X.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_END_X.value] = x; } if (y > statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_END_Y.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_END_Y.value] = y; } if (z > statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_END_Z.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.BOUNDING_BOX_END_Z.value] = z; } if (value > statistics[targetIndex][STATISTICS_ENTRY.MAXIMUM_INTENSITY.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.MAXIMUM_INTENSITY.value] = value; } if (value < statistics[targetIndex][STATISTICS_ENTRY.MINIMUM_INTENSITY.value] || !initialized) { statistics[targetIndex][STATISTICS_ENTRY.MINIMUM_INTENSITY.value] = value; } statistics[targetIndex][STATISTICS_ENTRY.SUM_INTENSITY.value] += value; statistics[targetIndex][STATISTICS_ENTRY.SUM_INTENSITY_TIMES_X.value] += value * x; statistics[targetIndex][STATISTICS_ENTRY.SUM_INTENSITY_TIMES_Y.value] += value * y; statistics[targetIndex][STATISTICS_ENTRY.SUM_INTENSITY_TIMES_Z.value] += value * z; statistics[targetIndex][STATISTICS_ENTRY.SUM_X.value] += x; statistics[targetIndex][STATISTICS_ENTRY.SUM_Y.value] += y; statistics[targetIndex][STATISTICS_ENTRY.SUM_Z.value] += z; statistics[targetIndex][STATISTICS_ENTRY.PIXEL_COUNT.value] += 1; initializedFlags[targetIndex] = true; } x++; if (x >= width) { x = 0; y++; } } } for (int j = 0; j < statistics.length; j++) { statistics[j][STATISTICS_ENTRY.MEAN_INTENSITY.value] = statistics[j][STATISTICS_ENTRY.SUM_INTENSITY.value] / statistics[j][STATISTICS_ENTRY.PIXEL_COUNT.value]; statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_WIDTH.value] = statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_END_X.value] - statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_X.value] + 1; statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_HEIGHT.value] = statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_END_Y.value] - statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_Y.value] + 1; statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_DEPTH.value] = statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_END_Z.value] - statistics[j][STATISTICS_ENTRY.BOUNDING_BOX_Z.value] + 1; statistics[j][STATISTICS_ENTRY.IDENTIFIER.value] = j + startLabelIndex; statistics[j][STATISTICS_ENTRY.MASS_CENTER_X.value] = statistics[j][STATISTICS_ENTRY.SUM_INTENSITY_TIMES_X.value] / statistics[j][STATISTICS_ENTRY.SUM_INTENSITY.value]; statistics[j][STATISTICS_ENTRY.MASS_CENTER_Y.value] = statistics[j][STATISTICS_ENTRY.SUM_INTENSITY_TIMES_Y.value] / statistics[j][STATISTICS_ENTRY.SUM_INTENSITY.value]; statistics[j][STATISTICS_ENTRY.MASS_CENTER_Z.value] = statistics[j][STATISTICS_ENTRY.SUM_INTENSITY_TIMES_Z.value] / statistics[j][STATISTICS_ENTRY.SUM_INTENSITY.value]; statistics[j][STATISTICS_ENTRY.CENTROID_X.value] = statistics[j][STATISTICS_ENTRY.SUM_X.value] / statistics[j][STATISTICS_ENTRY.PIXEL_COUNT.value]; statistics[j][STATISTICS_ENTRY.CENTROID_Y.value] = statistics[j][STATISTICS_ENTRY.SUM_Y.value] / statistics[j][STATISTICS_ENTRY.PIXEL_COUNT.value]; statistics[j][STATISTICS_ENTRY.CENTROID_Z.value] = statistics[j][STATISTICS_ENTRY.SUM_Z.value] / statistics[j][STATISTICS_ENTRY.PIXEL_COUNT.value]; } double[] squaredDifferencesFromMean = new double[statistics.length]; for (int z = 0; z < imp.getNSlices(); z++) { imp.setZ(z + 1); lab.setZ(z + 1); float[] pixels = (float[]) imp.getProcessor().getPixels(); float[] labels = (float[]) lab.getProcessor().getPixels(); for (int i = 0; i < pixels.length; i ++) { int index = (int) labels[i]; if (index > 0) { int targetIndex = index - startLabelIndex; double value = pixels[i]; squaredDifferencesFromMean[targetIndex] += Math.pow(value - statistics[targetIndex][STATISTICS_ENTRY.MEAN_INTENSITY.value], 2); } } } for (int j = 0; j < statistics.length; j++) { statistics[j][STATISTICS_ENTRY.STANDARD_DEVIATION_INTENSITY.value] = Math.sqrt(squaredDifferencesFromMean[j] / statistics[j][STATISTICS_ENTRY.PIXEL_COUNT.value]); } if (inputImage != image) { image.close(); } if (inputLabelMap != labelMap) { labelMap.close(); } return statistics; } /* public static double[][] statisticsOfLabelledPixels(CLIJ clij, ClearCLBuffer inputImage, ClearCLBuffer inputLabelMap, int startLabelIndex, int endLabelIndex) { if (endLabelIndex - startLabelIndex > 10) { System.out.println("processing many labels"); return statisticsOfManyLabelledPixels(clij, inputImage, inputLabelMap, startLabelIndex, endLabelIndex); } double[][] statistics = new double[endLabelIndex - startLabelIndex + 1][STATISTICS_ENTRY.NUMBER_OF_ENTRIES]; ClearCLBuffer tempMask = clij.create(inputImage); for (int i = startLabelIndex; i <= endLabelIndex; i++) { System.out.println("Deriving stats from " + i); LabelToMask.labelToMask(clij, inputLabelMap, tempMask, new Float(i)); double[] boundingBox = BoundingBox.boundingBox(clij, tempMask); int numberOfPixels = (int)clij.op().sumPixels(tempMask); double maximumIntensity = MaximumOfMaskedPixels.maximumOfMaskedPixels(clij, inputImage, tempMask); double minimumIntensity = MinimumOfMaskedPixels.minimumOfMaskedPixels(clij, inputImage, tempMask); double meanIntensity = MeanOfMaskedPixels.meanOfMaskedPixels(clij, inputImage, tempMask); statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_X.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_X.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_Y.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_Y.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_Z.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_Z.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_WIDTH.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_WIDTH.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_HEIGHT.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_HEIGHT.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_DEPTH.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_DEPTH.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.MINIMUM_INTENSITY.value] = minimumIntensity; statistics[i - startLabelIndex][STATISTICS_ENTRY.MAXIMUM_INTENSITY.value] = maximumIntensity; statistics[i - startLabelIndex][STATISTICS_ENTRY.MEAN_INTENSITY.value] = meanIntensity; statistics[i - startLabelIndex][STATISTICS_ENTRY.PIXEL_COUNT.value] = numberOfPixels; } tempMask.close(); return statistics; }*/ // All the cropping doesn't work; we must recompile all the time; not good // We can revive that code to speed stats up when image-size-specific re-compilation is no longer necessary /* private static double[][] statisticsOfManyLabelledPixels(CLIJ clij, ClearCLBuffer inputImage, ClearCLBuffer inputLabelMap, int startLabelIndex, int endLabelIndex) { double[][] statistics = new double[endLabelIndex - startLabelIndex + 1][STATISTICS_ENTRY.NUMBER_OF_ENTRIES]; ClearCLBuffer tempMask = clij.create(inputImage); for (int i = startLabelIndex; i <= endLabelIndex; i++) { System.out.println("Deriving stats from " + i); LabelToMask.labelToMask(clij, inputLabelMap, tempMask, new Float(i)); double[] boundingBox = BoundingBox.boundingBox(clij, tempMask); long[] size = new long[3]; for (int d = 0; d < 3; d++) { size[d] = (long)Math.max(((long)(boundingBox[d + 3] / 10)) * 10, 1); } ClearCLBuffer cropImage = clij.create(size, inputImage.getNativeType()); ClearCLBuffer cropMask = clij.create(size, tempMask.getNativeType()); clij.op().crop(inputImage, cropImage, (int)boundingBox[0], (int)boundingBox[1], (int)boundingBox[2]); clij.op().crop(tempMask, cropMask, (int)boundingBox[0], (int)boundingBox[1], (int)boundingBox[2]); int numberOfPixels = (int)clij.op().sumPixels(cropMask); double maximumIntensity = MaximumOfMaskedPixels.maximumOfMaskedPixels(clij, cropImage, cropMask); double minimumIntensity = MinimumOfMaskedPixels.minimumOfMaskedPixels(clij, cropImage, cropMask); double meanIntensity = MeanOfMaskedPixels.meanOfMaskedPixels(clij, cropImage, cropMask); statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_X.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_X.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_Y.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_Y.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_Z.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_Z.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_WIDTH.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_WIDTH.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_HEIGHT.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_HEIGHT.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.BOUNDING_BOX_DEPTH.value] = boundingBox[STATISTICS_ENTRY.BOUNDING_BOX_DEPTH.value]; statistics[i - startLabelIndex][STATISTICS_ENTRY.MINIMUM_INTENSITY.value] = minimumIntensity; statistics[i - startLabelIndex][STATISTICS_ENTRY.MAXIMUM_INTENSITY.value] = maximumIntensity; statistics[i - startLabelIndex][STATISTICS_ENTRY.MEAN_INTENSITY.value] = meanIntensity; statistics[i - startLabelIndex][STATISTICS_ENTRY.PIXEL_COUNT.value] = numberOfPixels; cropImage.close(); cropMask.close(); IJ.log("idx: " + i); } tempMask.close(); return statistics; } */ @Override public String getParameterHelpText() { return "Image input, Image labelmap"; } @Override public String getDescription() { return "Determines bounding box, area (in pixels/voxels), min, max and mean intensity " + " of a labelled object in a label map and corresponding pixels in the original image." + "Instead of a label map, you can also use a binary image as a binary image is a label map with just one label."; } @Override public String getAvailableForDimensions() { return "2D, 3D"; } }
[ "rhaase@mpi-cbg.de" ]
rhaase@mpi-cbg.de
dd5274d5e76b6a03ded58d28c0f55f8f955ab80e
577505666995063f9f2a175fcbd4cfaaa005e6bb
/src/test/java/com/cyou/test/locks/DeadLockDemo.java
3b0dd3fe16d1dd8eed8bee24ca9f701447d30f26
[]
no_license
trustex/tools_box
f84506f1efaa743a40bd2e8bb4d0d61c1c87367b
2ead8f60bc4b6c4ed50d385e2fde3868ceb5e17a
refs/heads/master
2020-07-15T22:11:35.034104
2017-12-08T06:10:14
2017-12-08T06:10:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package com.cyou.test.locks; public class DeadLockDemo { private static String A = "A"; private static String B = "B"; public static void main(String[] args) { new DeadLockDemo().deadLock(); } private void deadLock() { Thread threadA = new Thread(new Runnable() { @Override public void run() { synchronized (A) { try { Thread.currentThread().sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (B) { System.out.println("AB"); } } } }); Thread threadB = new Thread(new Runnable() { @Override public void run() { synchronized (B) { try { Thread.currentThread().sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (A) { System.out.println("BA"); } } } }); threadA.start(); threadB.start(); } }
[ "litaijun@forgame.com" ]
litaijun@forgame.com
d11de88e41e7eb2c4d5b8ebe6c4eb21a9e817738
9b04c5a90b31776a17c254d218abb63f59889f5d
/gsb/gsb-entity/src/main/java/com/gongsibao/entity/trade/CostInvoiceMap.java
a9deca6ddc38caa1c6c273de5bed09b5d0804e41
[]
no_license
damogui/testtt
de80c460e878c22553dabe965a7dfe21181d83cf
ae486b93370db3b3153239a25aecd1caeea8d248
refs/heads/master
2021-09-14T19:46:43.345265
2018-05-18T08:29:08
2018-05-18T08:29:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
963
java
package com.gongsibao.entity.trade; import org.netsharp.core.annotations.Column; import org.netsharp.core.annotations.Table; import com.gongsibao.entity.BaseEntity; @Table(name="so_cost_invoice_map",header="请款申请和成本关联关系") public class CostInvoiceMap extends BaseEntity { /** * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么) */ private static final long serialVersionUID = -831734029562333975L; @Column(name="invoice_id",header="发票申请id") private Integer invoiceId; @Column(name="cost_id",header="成本id") private Integer costId; public Integer getInvoiceId() { return invoiceId; } public void setInvoiceId(Integer invoiceId) { this.invoiceId = invoiceId; } public Integer getCostId() { return costId; } public void setCostId(Integer costId) { this.costId = costId; } }
[ "hwhping@163.com" ]
hwhping@163.com
34e1fe23857218068c2e4756d76e388954a04c2d
4d55bea0fd5c978fafa6f8484f876c3c7f782518
/settingsmaven/src/main/java/learningmaven/settings/settings/App.java
13fa2571d6e42eee088eec109918401449b86139
[]
no_license
vaishuPP/Maven_newtour
4a35bd8df9c33d03e3124dd608340f658c685c6b
f68fd4b8b5bde0269602c42b8ab6d79a012c588b
refs/heads/master
2020-04-17T22:07:10.405654
2019-01-23T10:07:18
2019-01-23T10:07:18
166,981,103
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package learningmaven.settings.settings; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
[ "IGS@IGS-369" ]
IGS@IGS-369
bbaf527a8b665d1e04f55712b36caf1f2b8492ca
63f751519e64ac067e11189edaf6a34aeb3e5dba
/3.JavaMultithreading/src/com/javarush/task/task29/task2912/ConsoleLogger.java
d33d3977a0f357be288c7707482e7989c18b1af3
[]
no_license
sharygin-vic/JavaRushTasks
8507b96c2103828be4c8c3de29f6ad446b33b9df
88e383a10a64286a2750bd67ec7f27d1a10a21dd
refs/heads/master
2021-01-21T18:25:20.400669
2017-08-01T22:50:45
2017-08-01T22:50:45
92,046,759
1
0
null
null
null
null
UTF-8
Java
false
false
293
java
package com.javarush.task.task29.task2912; public class ConsoleLogger extends AbstractLogger { public ConsoleLogger(int level) { this.level = level; } @Override public void info(String message) { System.out.println("Logging to console: " + message); } }
[ "lasprog@mail.ru" ]
lasprog@mail.ru
9738e561428b8a68f97c7dc2bc5eef582c0fde78
3309c8655baebd7f5f4cb5b04c9ef5c161f5f0b7
/coreASIM/org.coreasim.biomics.wrapper/src/org/coreasim/biomics/serializers/MessageMapperProvider.java
2c4767e8609c8320eed6a8d5da44eaaa2498781d
[ "AFL-3.0" ]
permissive
biomics/icef
3f7cc4ad6da711262f2e163b0d11486be1a641f8
d69f9be9b1f773598b47de5736f16c0daaffccea
refs/heads/master
2021-01-17T09:51:28.442886
2017-09-07T05:54:53
2017-09-07T05:54:53
58,002,569
1
1
null
null
null
null
UTF-8
Java
false
false
1,431
java
/* * MessageMapperProvider.java v1.0 * * This file contains source code developed by the European * FP7 research project BIOMICS (Grant no. 318202) * Copyright (C) 2016 Daniel Schreckling * * Licensed under the Academic Free License version 3.0 * http://www.opensource.org/licenses/afl-3.0.php * * */ package org.coreasim.biomics.serializers; import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provider; import com.fasterxml.jackson.databind.AnnotationIntrospector; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; @Provider public class MessageMapperProvider implements ContextResolver<ObjectMapper> { final ObjectMapper defaultObjectMapper; public MessageMapperProvider() { defaultObjectMapper = createDefaultMapper(); } @Override public ObjectMapper getContext(final Class<?> type) { return defaultObjectMapper; } private static ObjectMapper createDefaultMapper() { final ObjectMapper result = new ObjectMapper(); result.enable(SerializationFeature.INDENT_OUTPUT); return result; } }
[ "ds@sec.uni-passau.de" ]
ds@sec.uni-passau.de
b44628270d08c09b8b10eb95860a7b6984424e17
ed16d4b7246007f9fce3aa79026b70efbc87f6f2
/src/com/sia/controller/Save.java
5591e8f324344d32317f153bbf7ec9f240e1209a
[]
no_license
ChamriOumaima/Simulateur-credit
8ac263430d160a74d93dd2628382931c1fa80512
c3b08a8c9beeafb0ea6cf4555005969b08addd59
refs/heads/master
2020-11-25T21:41:37.876497
2019-12-18T04:32:16
2019-12-18T04:32:16
228,858,258
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package com.sia.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Save */ public class Save extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Save() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.sendRedirect("formulaire.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.sendRedirect("formulaire.jsp"); } }
[ "oumachamri@gmail.com" ]
oumachamri@gmail.com
a2168508eaab5e31a87f402d7129790cbb31373e
53d219dfb70d5961e33b4f6e5bbeb09baaa571b9
/src/leetcode/No39CombinationSum.java
1280754cb2cc6fb556f7424c3695e8aaac1004de
[]
no_license
liucongbupt/bupt
2d52351151adf7c602211aea1622720f91ee6619
df0929dd262c92ede30b2ad329be6a520fb7f07f
refs/heads/master
2021-01-02T08:25:49.537307
2020-04-06T00:37:18
2020-04-06T00:37:18
99,000,211
1
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package leetcode; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author liucong * @ClassName: leetcode.No39CombinationSum * @Description: * @date 2017年04月20日 下午2:29 **/ public class No39CombinationSum { public List<List<Integer>> combinationSum(int[] nums, int target) { List<List<Integer>> list = new ArrayList<>(); if (nums==null||nums.length==0) return list; Arrays.sort(nums); backtrack(list, new ArrayList<Integer>(), nums, target, 0); return list; } private void backtrack(List<List<Integer>> list, List<Integer> tempList, int [] nums, int remain, int start){ if(remain < 0) return; else if(remain == 0) list.add(new ArrayList<>(tempList)); else{ for(int i = start; i < nums.length; i++){ tempList.add(nums[i]); backtrack(list, tempList, nums, remain - nums[i], i); // not i + 1 because we can reuse same elements tempList.remove(tempList.size() - 1); } } } }
[ "liucongbj@163.com" ]
liucongbj@163.com
497bc9f163ea6550d063be8f5dc66244c78e515d
60a4fb5e2fccf8dbb724ff18e8260bf270fd41ca
/EMProject/src/com/em/util/ResponseMsg.java
3370ce2598768f0263be6f2d0563b02076ed200b
[]
no_license
ffydcg/Wy
0914f7c7e6101b0f8bd4bdbaee3bf6468bdacf48
3847c40f0f70d522fec62ec18f0591db16809409
refs/heads/master
2021-01-19T14:27:28.116496
2017-08-21T02:53:47
2017-08-21T02:53:47
100,904,455
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package com.em.util; public class ResponseMsg { private String resCode; private String resMsg; private Object object; public String getResCode() { return resCode; } public void setResCode(String resCode) { this.resCode = resCode; } public String getResMsg() { return resMsg; } public void setResMsg(String resMsg) { this.resMsg = resMsg; } public Object getObject() { return object; } public void setObject(Object object) { this.object = object; } }
[ "ffydcg@sina.com" ]
ffydcg@sina.com
1fc1b8ef6b032a1470bc3f011ae742af3b7d0550
e2e2cd96d820fe355aa56ec924c9a2f0bc12ff46
/szqdms/src/com/org/dms/dao/part/storageMng/stockInMng/InBillPrintDao.java
fa437288ea5ce63d33d79be0520bb3c5877f80db
[]
no_license
liveqmock/dms
3937762ca6138a7901e2a59a0411762a0e2fda5b
895e57198270830f0c5f6548cf941ddc34756902
refs/heads/master
2021-01-12T19:59:32.510144
2015-04-12T08:41:37
2015-04-12T08:41:37
33,809,541
0
1
null
2015-04-12T08:41:15
2015-04-12T08:41:15
null
UTF-8
Java
false
false
39,266
java
package com.org.dms.dao.part.storageMng.stockInMng; import com.org.dms.common.DicConstant; import com.org.dms.vo.part.PtBuStockInVO; import com.org.framework.base.BaseDAO; import com.org.framework.common.BaseResultSet; import com.org.framework.common.PageManager; import com.org.framework.common.QuerySet; import com.org.framework.common.User; import com.org.mvc.context.ActionContext; /** * 入库单打印Dao * * @user : lichuang * @date : 2014-08-08 */ public class InBillPrintDao extends BaseDAO { //定义instance public static final InBillPrintDao getInstance(ActionContext atx) { InBillPrintDao dao = new InBillPrintDao(); atx.setDBFactory(dao.factory); return dao; } /** * 查询入库单 * * @param page * @param user * @param conditions * @return * @throws Exception */ public BaseResultSet searchInBill(PageManager page, User user, String conditions) throws Exception { StringBuilder wheres = new StringBuilder(conditions); wheres.append(" AND T.STATUS = " + DicConstant.YXBS_01 + "\n"); wheres.append(" AND T.OEM_COMPANY_ID=" + user.getOemCompanyId() + "\n"); wheres.append(" ORDER BY T.IN_DATE DESC\n"); page.setFilter(wheres.toString()); //定义返回结果集 BaseResultSet bs = null; StringBuilder sql = new StringBuilder(); sql.append("SELECT *\n"); sql.append(" FROM (SELECT A.IN_ID,\n"); sql.append(" A.IN_NO,\n"); sql.append(" A.WAREHOUSE_CODE,\n"); sql.append(" A.WAREHOUSE_NAME,\n"); sql.append(" A.ORDER_ID,\n"); sql.append(" A.ORDER_NO,\n"); sql.append(" A.IN_TYPE,\n"); sql.append(" B.SUPPLIER_NAME OUT_UNIT,\n"); sql.append(" NULL OUT_WAREHOUSE,\n"); sql.append(" B.PURCHASE_AMOUNT,\n"); sql.append(" B.PLAN_AMOUNT,\n"); sql.append(" C.AMOUNT,\n"); sql.append(" A.IN_DATE,\n"); sql.append(" A.STATUS,\n"); sql.append(" A.OEM_COMPANY_ID\n"); sql.append(" FROM PT_BU_STOCK_IN A, PT_BU_PCH_ORDER_SPLIT B,\n"); sql.append("(SELECT SUM(A.IN_AMOUNT * B.PCH_PRICE) AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A, PT_BA_PART_SUPPLIER_RL B\n" ); sql.append(" WHERE A.PART_ID = B.PART_ID AND B.PART_IDENTIFY = "+DicConstant.YXBS_01+"\n" ); sql.append(" GROUP BY A.IN_ID) C"); sql.append(" WHERE A.ORDER_ID = B.SPLIT_ID\n"); sql.append(" AND A.IN_ID = C.IN_ID\n"); sql.append(" AND A.IN_TYPE = " + DicConstant.RKLX_01 + "\n"); sql.append(" AND A.PRINT_STATUS = " + DicConstant.DYZT_01 + "\n"); sql.append(" UNION ALL\n"); sql.append(" SELECT A.IN_ID,\n"); sql.append(" A.IN_NO,\n"); sql.append(" A.WAREHOUSE_CODE,\n"); sql.append(" A.WAREHOUSE_NAME,\n"); sql.append(" A.ORDER_ID,\n"); sql.append(" A.ORDER_NO,\n"); sql.append(" A.IN_TYPE,\n"); sql.append(" B.WAREHOUSE_NAME OUT_UNIT,\n"); sql.append(" B.WAREHOUSE_NAME OUT_WAREHOUSE,\n"); sql.append(" NULL PURCHASE_AMOUNT,\n"); sql.append(" NULL PLAN_AMOUNT,\n"); sql.append(" C.AMOUNT,\n"); sql.append(" A.IN_DATE,\n"); sql.append(" A.STATUS,\n"); sql.append(" A.OEM_COMPANY_ID\n"); sql.append(" FROM PT_BU_STOCK_IN A, PT_BU_STOCK_OUT B,\n"); sql.append("(SELECT SUM(A.IN_AMOUNT * B.SALE_PRICE) AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A, PT_BA_INFO B\n" ); sql.append(" WHERE A.PART_ID = B.PART_ID\n" ); sql.append(" GROUP BY A.IN_ID) C"); sql.append(" WHERE A.ORDER_ID = B.OUT_ID\n"); sql.append(" AND A.IN_ID = C.IN_ID\n"); sql.append(" AND A.IN_TYPE = " + DicConstant.RKLX_02 + "\n"); sql.append(" AND A.IN_STATUS = " + DicConstant.RKDZT_02 + "\n"); sql.append(" AND A.PRINT_STATUS = " + DicConstant.DYZT_01 + "\n"); sql.append(" UNION ALL\n"); sql.append(" SELECT A.IN_ID,\n"); sql.append(" A.IN_NO,\n"); sql.append(" A.WAREHOUSE_CODE,\n"); sql.append(" A.WAREHOUSE_NAME,\n"); sql.append(" A.ORDER_ID,\n"); sql.append(" A.ORDER_NO,\n"); sql.append(" A.IN_TYPE,\n"); sql.append(" B.APPLY_ORG_NAME OUT_UNIT,\n"); sql.append(" NULL OUT_WAREHOUSE,\n"); sql.append(" NULL PURCHASE_AMOUNT,\n"); sql.append(" NULL PLAN_AMOUNT,\n"); sql.append(" C.AMOUNT,\n"); sql.append(" A.IN_DATE,\n"); sql.append(" A.STATUS,\n"); sql.append(" A.OEM_COMPANY_ID\n"); sql.append(" FROM PT_BU_STOCK_IN A, PT_BU_RETURN_APPLY B,\n"); sql.append("(SELECT SUM(A.IN_AMOUNT * B.SALE_PRICE) AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A, PT_BA_INFO B\n" ); sql.append(" WHERE A.PART_ID = B.PART_ID\n" ); sql.append(" GROUP BY A.IN_ID) C"); sql.append(" WHERE A.ORDER_ID = B.RETURN_ID\n"); sql.append(" AND A.IN_ID = C.IN_ID\n"); sql.append(" AND A.IN_TYPE = " + DicConstant.RKLX_03 + "\n"); sql.append(" AND B.APPLY_SATUS = " + DicConstant.TJSQDZT_05 + "\n"); sql.append(" AND A.IN_STATUS = " + DicConstant.RKDZT_02 + "\n"); sql.append(" AND A.PRINT_STATUS = " + DicConstant.DYZT_01 + "\n"); sql.append(" UNION ALL\n"); sql.append(" SELECT A.IN_ID,\n"); sql.append(" A.IN_NO,\n"); sql.append(" A.WAREHOUSE_CODE,\n"); sql.append(" A.WAREHOUSE_NAME,\n"); sql.append(" A.ORDER_ID,\n"); sql.append(" A.ORDER_NO,\n"); sql.append(" A.IN_TYPE,\n"); sql.append(" NULL OUT_UNIT,\n"); sql.append(" NULL OUT_WAREHOUSE,\n"); sql.append(" NULL PURCHASE_AMOUNT,\n"); sql.append(" NULL PLAN_AMOUNT,\n"); sql.append(" C.AMOUNT,\n"); sql.append(" A.IN_DATE,\n"); sql.append(" A.STATUS,\n"); sql.append(" A.OEM_COMPANY_ID\n"); sql.append(" FROM PT_BU_STOCK_IN A,\n"); sql.append("(SELECT SUM(A.IN_AMOUNT * B.PLAN_PRICE) AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A, PT_BA_INFO B\n" ); sql.append(" WHERE A.PART_ID = B.PART_ID\n" ); sql.append(" GROUP BY A.IN_ID) C"); sql.append(" WHERE A.IN_TYPE = " + DicConstant.RKLX_04 + "\n"); sql.append(" AND A.IN_ID = C.IN_ID"); sql.append(" AND A.IN_STATUS = " + DicConstant.RKDZT_02 + "\n"); sql.append(" AND A.PRINT_STATUS = " + DicConstant.DYZT_01 + ") T\n"); //执行方法,不需要传递conn参数 bs = factory.select(sql.toString(), page); bs.setFieldDic("IN_TYPE", DicConstant.RKLX); bs.setFieldDateFormat("IN_DATE", "yyyy-MM-dd HH:mm:ss"); return bs; } /** * 查询采购入库单配件 * * @param page * @param user * @param conditions * @return * @throws Exception */ public BaseResultSet queryPchInBillPart(PageManager page, User user, String conditions, String IN_ID) throws Exception { StringBuilder wheres = new StringBuilder(conditions); wheres.append(" AND A.IN_ID = " + IN_ID + "\n"); wheres.append(" AND A.IN_ID = B.IN_ID\n"); wheres.append(" AND A.ORDER_ID = C.SPLIT_ID\n"); wheres.append(" AND B.PART_ID = C.PART_ID\n"); wheres.append(" AND C.PART_ID = D.PART_ID\n"); wheres.append(" AND C.SPLIT_ID = G.SPLIT_ID\n"); wheres.append(" AND G.SUPPLIER_ID = D.SUPPLIER_ID AND D.PART_IDENTIFY = "+DicConstant.YXBS_01+"\n"); wheres.append(" AND B.PART_ID = E.PART_ID\n"); wheres.append(" AND E.UNIT = F.ID\n"); wheres.append(" ORDER BY B.PART_CODE ASC\n"); page.setFilter(wheres.toString()); //定义返回结果集 BaseResultSet bs = null; StringBuilder sql = new StringBuilder(); sql.append("SELECT B.PART_ID,\n"); sql.append(" B.PART_CODE,\n"); sql.append(" B.PART_NAME,\n"); sql.append(" E.PART_NO,\n"); sql.append(" F.DIC_VALUE UNIT,\n"); sql.append(" B.IN_AMOUNT,\n"); sql.append(" D.PCH_PRICE,\n"); sql.append(" D.PCH_PRICE * B.IN_AMOUNT PCH_AMOUNT,\n"); sql.append(" E.PLAN_PRICE,\n"); sql.append(" E.PLAN_PRICE * B.IN_AMOUNT PLAN_AMOUNT,\n"); sql.append(" ROWNUM\n"); sql.append(" FROM PT_BU_STOCK_IN A,\n"); sql.append(" PT_BU_STOCK_IN_DTL B,\n"); sql.append(" PT_BU_PCH_ORDER_SPLIT_DTL C,\n"); sql.append(" PT_BA_PART_SUPPLIER_RL D,\n"); sql.append(" PT_BA_INFO E,\n"); sql.append(" DIC_TREE F,\n"); sql.append(" PT_BU_PCH_ORDER_SPLIT G\n"); //执行方法,不需要传递conn参数 bs = factory.select(sql.toString(), page); return bs; } /** * 查询销售退件入库单配件 * * @param page * @param user * @param conditions * @return * @throws Exception */ public BaseResultSet querySaleRetInBillPart(PageManager page, User user, String conditions, String IN_ID) throws Exception { StringBuilder wheres = new StringBuilder(conditions); wheres.append(" AND A.IN_ID = " + IN_ID + "\n"); wheres.append(" AND A.IN_ID = B.IN_ID\n"); wheres.append(" AND A.ORDER_ID = C.RETURN_ID\n"); wheres.append(" AND B.PART_ID = C.PART_ID\n"); wheres.append(" AND C.PART_ID = D.PART_ID\n"); wheres.append(" AND D.UNIT = E.ID\n"); wheres.append(" ORDER BY B.PART_CODE ASC\n"); page.setFilter(wheres.toString()); //定义返回结果集 BaseResultSet bs = null; StringBuilder sql = new StringBuilder(); sql.append("SELECT B.PART_ID,\n"); sql.append(" B.PART_CODE,\n"); sql.append(" B.PART_NAME,\n"); sql.append(" D.PART_NO,\n"); sql.append(" E.DIC_VALUE UNIT,\n"); sql.append(" B.IN_AMOUNT,\n"); sql.append(" C.SALE_PRICE,\n"); sql.append(" C.SALE_PRICE * B.IN_AMOUNT RET_AMOUNT,\n"); sql.append(" D.PLAN_PRICE,\n"); sql.append(" D.PLAN_PRICE * B.IN_AMOUNT PLAN_AMOUNT,\n"); sql.append(" ROWNUM\n"); sql.append(" FROM PT_BU_STOCK_IN A,\n"); sql.append(" PT_BU_STOCK_IN_DTL B,\n"); sql.append(" PT_BU_RETURN_APPLY_DTL C,\n"); sql.append(" PT_BA_INFO D,\n"); sql.append(" DIC_TREE E\n"); //执行方法,不需要传递conn参数 bs = factory.select(sql.toString(), page); return bs; } /** * 查询移库入库单和其他入库单配件 * * @param page * @param user * @param conditions * @return * @throws Exception */ public BaseResultSet queryMoveAndOtherInBillPart(PageManager page, User user, String conditions, String IN_ID) throws Exception { StringBuilder wheres = new StringBuilder(conditions); wheres.append(" AND A.IN_ID = " + IN_ID + "\n"); wheres.append(" AND A.PART_ID = B.PART_ID\n"); wheres.append(" AND B.UNIT = C.ID\n"); wheres.append(" ORDER BY B.PART_CODE ASC\n"); page.setFilter(wheres.toString()); //定义返回结果集 BaseResultSet bs = null; StringBuilder sql = new StringBuilder(); sql.append("SELECT A.PART_ID,\n"); sql.append(" A.PART_CODE,\n"); sql.append(" A.PART_NAME,\n"); sql.append(" B.PART_NO,\n"); sql.append(" C.DIC_VALUE UNIT,\n"); sql.append(" A.IN_AMOUNT,\n"); sql.append(" B.PLAN_PRICE,\n"); sql.append(" B.PLAN_PRICE * A.IN_AMOUNT PLAN_AMOUNT,\n"); sql.append(" ROWNUM\n"); sql.append(" FROM PT_BU_STOCK_IN_DTL A,\n"); sql.append(" PT_BA_INFO B,\n"); sql.append(" DIC_VALUE C\n"); //执行方法,不需要传递conn参数 bs = factory.select(sql.toString(), page); return bs; } /** * 更新入库单 * * @param vo * @return * @throws Exception */ public boolean updateInBill(PtBuStockInVO vo) throws Exception { return factory.update(vo); } /** * 更新入库单明细的采购单价/采购金额/计划单价/计划金额/单位 * * @param IN_ID 入库单ID * @param IN_TYPE 入库类型 * @throws Exception */ public void updateInBillDtl(String IN_ID, String IN_TYPE) throws Exception { StringBuilder sql = new StringBuilder(); sql.append("UPDATE PT_BU_STOCK_IN_DTL A\n"); sql.append(" SET \n"); if (DicConstant.RKLX_01.equals(IN_TYPE)) {//只有采购入库更新采购单价和采购金额 // sql.append(" A.PCH_PRICE =\n"); // sql.append(" (SELECT D.PCH_PRICE\n"); // sql.append(" FROM PT_BU_STOCK_IN B,\n"); // sql.append(" PT_BU_PCH_ORDER_SPLIT_DTL C,\n"); // sql.append(" PT_BU_PCH_ORDER_SPLIT E,\n"); // sql.append(" PT_BA_INFO D\n"); // sql.append(" WHERE B.IN_ID = " + IN_ID + "\n"); // sql.append(" AND B.ORDER_ID = C.SPLIT_ID\n"); // sql.append(" AND C.SPLIT_ID = E.SPLIT_ID\n"); // sql.append(" AND E.SUPPLIER_ID = D.SUPPLIER_ID AND D.PART_IDENTIFY = "+DicConstant.YXBS_01+"\n"); // sql.append(" AND C.PART_ID = D.PART_ID\n"); // sql.append(" AND C.PART_ID = A.PART_ID),\n"); // sql.append(" A.PCH_AMOUNT =\n"); // sql.append(" (SELECT D.PCH_PRICE * A.IN_AMOUNT\n"); // sql.append(" FROM PT_BU_STOCK_IN B,\n"); // sql.append(" PT_BU_PCH_ORDER_SPLIT_DTL C,\n"); // sql.append(" PT_BU_PCH_ORDER_SPLIT E,\n"); // sql.append(" PT_BA_PART_SUPPLIER_RL D\n"); // sql.append(" WHERE B.IN_ID = " + IN_ID + "\n"); // sql.append(" AND B.ORDER_ID = C.SPLIT_ID\n"); // sql.append(" AND C.SPLIT_ID = E.SPLIT_ID\n"); // sql.append(" AND E.SUPPLIER_ID = D.SUPPLIER_ID AND D.PART_IDENTIFY = "+DicConstant.YXBS_01+"\n"); // sql.append(" AND C.PART_ID = D.PART_ID\n"); // sql.append(" AND C.PART_ID = A.PART_ID),\n"); } sql.append(" A.PLAN_PRICE =\n"); sql.append(" (SELECT E.PLAN_PRICE FROM PT_BA_INFO E WHERE E.PART_ID = A.PART_ID),\n"); sql.append(" A.PLAN_AMOUNT =\n"); sql.append(" (SELECT E.PLAN_PRICE * A.IN_AMOUNT\n"); sql.append(" FROM PT_BA_INFO E\n"); sql.append(" WHERE E.PART_ID = A.PART_ID),\n"); sql.append(" A.UNIT =\n"); sql.append(" (SELECT E.UNIT FROM PT_BA_INFO E WHERE E.PART_ID = A.PART_ID)\n"); sql.append(" WHERE A.IN_ID = " + IN_ID + "\n"); factory.update(sql.toString(), null); } /** * 更新入库流水的计划价 * * @param IN_ID 入库单ID * @throws Exception */ public void updateInFlow(String IN_ID) throws Exception { StringBuilder sql = new StringBuilder(); sql.append("UPDATE PT_BU_STOCK_IN_CONTINUAL A\n"); sql.append(" SET A.PLAN_PRICE =\n"); sql.append(" (SELECT 1 FROM PT_BA_INFO B WHERE B.PART_ID = A.PART_ID)\n"); sql.append(" WHERE A.IN_ID = " + IN_ID + "\n"); factory.update(sql.toString(), null); } public QuerySet queryPchInInfo(User user, String IN_ID) throws Exception { //定义返回结果集 QuerySet qs = null; // StringBuffer sql= new StringBuffer(); // sql.append("SELECT A.IN_ID,\n"); // sql.append(" A.IN_NO,\n"); // sql.append(" A.WAREHOUSE_CODE,\n"); // sql.append(" A.WAREHOUSE_NAME,\n"); // sql.append(" A.ORDER_ID,\n"); // sql.append(" A.ORDER_NO,\n"); // sql.append(" TO_CHAR(SYSDATE, 'YYYY-MM-DD') PRINT_DATE,"); // sql.append(" D.DIC_VALUE IN_TYPE,\n"); // sql.append(" B.SUPPLIER_NAME OUT_UNIT,\n"); // sql.append(" NULL OUT_WAREHOUSE,\n"); // sql.append(" B.PURCHASE_AMOUNT,\n"); // sql.append(" B.PLAN_AMOUNT,\n"); // sql.append(" C.AMOUNT,\n"); // sql.append(" A.IN_DATE,\n"); // sql.append(" A.STATUS,\n"); // sql.append(" A.OEM_COMPANY_ID\n"); // sql.append(" FROM PT_BU_STOCK_IN A, PT_BU_PCH_ORDER_SPLIT B,\n"); // sql.append("(SELECT SUM(A.IN_AMOUNT * B.PCH_PRICE) AMOUNT, A.IN_ID\n" ); // sql.append(" FROM PT_BU_STOCK_IN_DTL A, PT_BA_PART_SUPPLIER_RL B\n" ); // sql.append(" WHERE A.PART_ID = B.PART_ID AND B.PART_IDENTIFY = "+DicConstant.YXBS_01+"\n" ); // sql.append(" GROUP BY A.IN_ID) C,DIC_TREE D"); // sql.append(" WHERE A.ORDER_ID = B.SPLIT_ID\n"); // sql.append(" AND A.IN_ID = C.IN_ID\n"); // sql.append(" AND A.IN_TYPE = D.ID\n"); StringBuffer sql= new StringBuffer(); sql.append("SELECT A.IN_ID,\n" ); sql.append(" A.IN_NO,\n" ); sql.append(" A.WAREHOUSE_CODE,\n" ); sql.append(" A.WAREHOUSE_NAME,\n" ); sql.append(" A.ORDER_ID,\n" ); sql.append(" A.ORDER_NO,\n" ); sql.append(" TO_CHAR(SYSDATE, 'YYYY-MM-DD') PRINT_DATE,\n" ); sql.append(" D.DIC_VALUE IN_TYPE,\n" ); sql.append(" B.SUPPLIER_NAME OUT_UNIT,\n" ); sql.append(" NULL OUT_WAREHOUSE,\n" ); sql.append(" B.PURCHASE_AMOUNT,\n" ); sql.append(" C.AMOUNT,\n" ); sql.append(" E.PLAN_AMOUNT,\n" ); sql.append(" A.IN_DATE,\n" ); sql.append(" A.STATUS,\n" ); sql.append(" A.OEM_COMPANY_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_PCH_ORDER_SPLIT B,\n" ); sql.append(" (SELECT SUM(A.IN_AMOUNT * A.PCH_PRICE) AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A\n" ); sql.append(" WHERE 1=1\n" ); sql.append(" GROUP BY A.IN_ID) C,\n" ); sql.append(" (SELECT SUM(A.IN_AMOUNT * A.PLAN_PRICE) PLAN_AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A\n" ); sql.append(" WHERE 1=1\n" ); sql.append(" GROUP BY A.IN_ID) E,\n" ); sql.append(" DIC_TREE D\n" ); sql.append(" WHERE A.ORDER_ID = B.SPLIT_ID\n" ); sql.append(" AND A.IN_ID = C.IN_ID\n" ); sql.append(" AND A.IN_ID = E.IN_ID\n" ); sql.append(" AND A.IN_TYPE = D.ID"); sql.append(" AND A.IN_ID = "+ IN_ID + "\n"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); return qs; } public QuerySet queryPchInDtlInfo(User user, String IN_ID,String flag) throws Exception { //定义返回结果集 QuerySet qs = null; if("1".equals(flag)){ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.IN_AMOUNT,\n" ); sql.append(" C.DISTRIBUTION_NO,\n" ); sql.append(" ROUND(NVL(B.PCH_PRICE,0),2) PCH_PRICE,\n" ); sql.append(" ROUND(NVL(B.PCH_PRICE,0) * B.IN_AMOUNT,2) PCH_AMOUNT,\n" ); sql.append(" ROUND(NVL(B.PLAN_PRICE,0),2) PLAN_PRICE,\n" ); sql.append(" ROUND(NVL(B.PLAN_PRICE,0) * B.IN_AMOUNT,2) PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_IN_DTL B,\n" ); sql.append(" PT_BU_PCH_ORDER_SPLIT_DTL C,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.IN_ID = B.IN_ID\n" ); sql.append(" AND A.ORDER_ID = C.SPLIT_ID\n" ); sql.append(" AND B.PART_ID = C.PART_ID\n" ); sql.append(" AND C.PART_ID = D.PART_ID\n" ); sql.append(" AND B.IN_AMOUNT >0 \n" ); sql.append(" AND D.UNIT = E.ID(+)\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); qs = factory.select(null,sql.toString()); }else{ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.IN_AMOUNT,\n" ); sql.append(" C.DISTRIBUTION_NO,\n" ); sql.append(" ROUND(NVL(B.PCH_PRICE,0),2) PCH_PRICE,\n" ); sql.append(" ROUND(NVL(B.PCH_PRICE,0) * B.IN_AMOUNT,3) PCH_AMOUNT,\n" ); sql.append(" ROUND(NVL(B.PLAN_PRICE,0),2) PLAN_PRICE,\n" ); sql.append(" ROUND(NVL(B.PLAN_PRICE,0) * B.IN_AMOUNT,3) PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_IN_DTL B,\n" ); sql.append(" PT_BU_PCH_ORDER_SPLIT_DTL C,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.IN_ID = B.IN_ID\n" ); sql.append(" AND A.ORDER_ID = C.SPLIT_ID\n" ); sql.append(" AND B.PART_ID = C.PART_ID\n" ); sql.append(" AND C.PART_ID = D.PART_ID\n" ); sql.append(" AND B.IN_AMOUNT >0 \n" ); sql.append(" AND D.UNIT = E.ID(+)\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); qs = factory.select(null,sql.toString()); } //执行方法,不需要传递conn参数 return qs; } public QuerySet queryMoveInInfo(User user, String IN_ID) throws Exception { //定义返回结果集 QuerySet qs = null; StringBuffer sql= new StringBuffer(); sql.append("SELECT A.IN_ID,\n" ); sql.append(" A.IN_NO,\n" ); sql.append(" A.WAREHOUSE_CODE,\n" ); sql.append(" A.WAREHOUSE_NAME,\n" ); sql.append(" A.ORDER_ID,\n" ); sql.append(" A.ORDER_NO,\n" ); sql.append(" TO_CHAR(SYSDATE, 'YYYY-MM-DD') PRINT_DATE,\n" ); sql.append(" D.DIC_VALUE IN_TYPE,\n" ); sql.append(" B.WAREHOUSE_NAME OUT_UNIT,\n" ); sql.append(" A.IN_DATE,\n" ); sql.append(" A.STATUS,\n" ); sql.append(" E.PLAN_AMOUNT,\n" ); sql.append(" A.OEM_COMPANY_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_OUT B,\n" ); sql.append(" DIC_TREE D,\n" ); sql.append("(SELECT SUM(A.IN_AMOUNT * A.PLAN_PRICE) PLAN_AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A\n" ); sql.append(" WHERE 1=1\n" ); sql.append(" GROUP BY A.IN_ID) E"); sql.append(" WHERE A.ORDER_ID = B.OUT_ID\n" ); sql.append(" AND A.IN_TYPE = D.ID\n" ); sql.append(" AND A.IN_ID = E.IN_ID\n"); sql.append(" AND A.IN_ID = "+ IN_ID + "\n"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); return qs; } public QuerySet queryMoveInDtlInfo(User user, String IN_ID,String flag) throws Exception { //定义返回结果集 QuerySet qs = null; if("1".equals(flag)){ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.IN_AMOUNT,\n" ); sql.append(" NVL(D.SALE_PRICE,0) PCH_PRICE,\n" ); sql.append(" NVL(D.SALE_PRICE,0) * B.IN_AMOUNT PCH_AMOUNT,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) PLAN_PRICE,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) * B.IN_AMOUNT PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_IN_DTL B,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.IN_ID = B.IN_ID\n" ); sql.append(" AND B.PART_ID = D.PART_ID\n" ); sql.append(" AND B.IN_AMOUNT >0 \n" ); sql.append(" AND D.UNIT = E.ID\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); qs = factory.select(null,sql.toString()); }else{ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.IN_AMOUNT,\n" ); sql.append(" NVL(D.SALE_PRICE,0) PCH_PRICE,\n" ); sql.append(" NVL(D.SALE_PRICE,0) * B.IN_AMOUNT PCH_AMOUNT,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) PLAN_PRICE,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) * B.IN_AMOUNT PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_IN_DTL B,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.IN_ID = B.IN_ID\n" ); sql.append(" AND B.PART_ID = D.PART_ID\n" ); sql.append(" AND B.IN_AMOUNT >0 \n" ); sql.append(" AND D.UNIT = E.ID\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); qs = factory.select(null,sql.toString()); } //执行方法,不需要传递conn参数 return qs; } public QuerySet queryRetInInfo(User user, String IN_ID) throws Exception { //定义返回结果集 QuerySet qs = null; StringBuffer sql= new StringBuffer(); sql.append("SELECT A.IN_ID,\n" ); sql.append(" A.IN_NO,\n" ); sql.append(" A.WAREHOUSE_CODE,\n" ); sql.append(" A.WAREHOUSE_NAME,\n" ); sql.append(" A.ORDER_ID,\n" ); sql.append(" B.RETURN_NO,\n" ); sql.append(" B.APPLY_ORG_NAME,\n" ); sql.append(" C.DIC_VALUE IN_TYPE,\n" ); sql.append(" D.ONAME OUT_UNIT,\n" ); sql.append(" TO_CHAR(SYSDATE, 'YYYY-MM-DD') PRINT_DATE,\n" ); sql.append(" A.IN_DATE,\n" ); sql.append(" E.PLAN_AMOUNT,\n" ); sql.append(" A.STATUS,\n" ); sql.append(" A.OEM_COMPANY_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_RETURN_APPLY B,DIC_TREE C,TM_ORG D,\n" ); sql.append("(SELECT SUM(A.IN_AMOUNT * A.PLAN_PRICE) PLAN_AMOUNT, A.IN_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN_DTL A\n" ); sql.append(" WHERE 1=1\n" ); sql.append(" GROUP BY A.IN_ID) E"); sql.append(" WHERE A.ORDER_ID = B.RETURN_ID AND A.IN_ID = E.IN_ID AND A.IN_TYPE = C.ID AND B.APPLY_ORG_CODE = D.CODE\n" ); sql.append(" AND A.IN_ID = "+ IN_ID + "\n"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); return qs; } public QuerySet queryRetInDtlInfo(User user, String IN_ID,String flag) throws Exception { //定义返回结果集 QuerySet qs = null; if("1".equals(flag)){ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.RETURN_COUNT IN_AMOUNT,\n" ); sql.append(" NVL(B.SALE_PRICE,0) PCH_PRICE,\n" ); sql.append(" NVL(B.SALE_PRICE,0) * B.RETURN_COUNT PCH_AMOUNT,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) PLAN_PRICE,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) * B.RETURN_COUNT PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_RETURN_APPLY_DTL B,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.ORDER_ID = B.RETURN_ID\n" ); sql.append(" AND B.PART_ID = D.PART_ID\n" ); sql.append(" AND B.IN_AMOUNT >0 \n" ); sql.append(" AND D.UNIT = E.ID(+)\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); }else{ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.RETURN_COUNT IN_AMOUNT,\n" ); sql.append(" NVL(B.SALE_PRICE,0) PCH_PRICE,\n" ); sql.append(" NVL(B.SALE_PRICE,0) * B.RETURN_COUNT PCH_AMOUNT,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) PLAN_PRICE,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) * B.RETURN_COUNT PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_RETURN_APPLY_DTL B,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.ORDER_ID = B.RETURN_ID\n" ); sql.append(" AND B.PART_ID = D.PART_ID\n" ); sql.append(" AND B.IN_AMOUNT >0 \n" ); sql.append(" AND D.UNIT = E.ID(+)\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); } return qs; } public QuerySet queryOtherInInfo(User user, String IN_ID) throws Exception { //定义返回结果集 QuerySet qs = null; StringBuffer sql= new StringBuffer(); sql.append("SELECT A.IN_ID,\n" ); sql.append(" A.IN_NO,\n" ); sql.append(" A.WAREHOUSE_CODE,\n" ); sql.append(" A.WAREHOUSE_NAME,\n" ); sql.append(" A.ORDER_ID,\n" ); sql.append(" A.ORDER_NO,\n" ); sql.append(" C.DIC_VALUE IN_TYPE,\n" ); sql.append(" TO_CHAR(SYSDATE, 'YYYY-MM-DD') PRINT_DATE,\n" ); sql.append(" A.IN_DATE,\n" ); sql.append(" A.STATUS,\n" ); sql.append(" A.OEM_COMPANY_ID\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" DIC_TREE C\n" ); sql.append(" WHERE A.IN_TYPE = C.ID \n" ); sql.append(" AND A.IN_ID = "+ IN_ID + "\n"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); return qs; } public QuerySet queryOtherInDtlInfo(User user, String IN_ID,String flag) throws Exception { //定义返回结果集 QuerySet qs = null; if("1".equals(flag)){ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.IN_AMOUNT,\n" ); sql.append(" NVL(D.SALE_PRICE,0) PCH_PRICE,\n" ); sql.append(" NVL(D.SALE_PRICE,0) * B.IN_AMOUNT PCH_AMOUNT,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) PLAN_PRICE,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) * B.IN_AMOUNT PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_IN_DTL B,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.IN_ID = B.IN_ID\n" ); sql.append(" AND B.PART_ID = D.PART_ID\n" ); sql.append(" AND D.UNIT = E.ID(+)\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); }else{ StringBuffer sql= new StringBuffer(); sql.append("SELECT B.PART_ID,\n" ); sql.append(" B.PART_CODE,\n" ); sql.append(" B.PART_NAME,\n" ); sql.append(" D.PART_NO,\n" ); sql.append(" NVL(E.DIC_VALUE,'') UNIT,\n" ); sql.append(" B.IN_AMOUNT,\n" ); sql.append(" NVL(D.SALE_PRICE,0) PCH_PRICE,\n" ); sql.append(" NVL(D.SALE_PRICE,0) * B.IN_AMOUNT PCH_AMOUNT,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) PLAN_PRICE,\n" ); sql.append(" NVL(B.PLAN_PRICE,0) * B.IN_AMOUNT PLAN_AMOUNT,\n" ); sql.append(" ROWNUM\n" ); sql.append(" FROM PT_BU_STOCK_IN A,\n" ); sql.append(" PT_BU_STOCK_IN_DTL B,\n" ); sql.append(" PT_BA_INFO D,\n" ); sql.append(" DIC_TREE E\n" ); sql.append(" WHERE 1 = 1\n" ); sql.append(" AND A.IN_ID = "+IN_ID+"\n" ); sql.append(" AND A.IN_ID = B.IN_ID\n" ); sql.append(" AND B.PART_ID = D.PART_ID\n" ); sql.append(" AND D.UNIT = E.ID(+)\n" ); sql.append(" ORDER BY B.PART_CODE ASC"); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); } //执行方法,不需要传递conn参数 return qs; } public QuerySet getInType(String IN_ID) throws Exception { //定义返回结果集 QuerySet qs = null; StringBuffer sql= new StringBuffer(); sql.append("SELECT IN_TYPE FROM PT_BU_STOCK_IN WHERE IN_ID = "+IN_ID+"\n" ); //执行方法,不需要传递conn参数 qs = factory.select(null,sql.toString()); return qs; } }
[ "fuxiao86@163.com" ]
fuxiao86@163.com
d9a74460877f8096c66877b6556c134905e63e7e
cfea4264ced28111b2965f71065da7a1d8aeb018
/src/main/java/com/kute/webflux/config/WebConfig.java
8d1400b4e3aa7ded2aaa42e8378f17c5fb9dfcb1
[]
no_license
kute/pure-webflux-test
fa36663ac914822d9ea295c7cdbf9c3141735e49
72cf45074a6605fb76c4aa19f75497d2bc7e73e5
refs/heads/master
2022-06-24T15:13:20.013004
2019-12-23T02:25:24
2019-12-23T02:25:24
172,476,130
0
0
null
2021-03-31T21:02:03
2019-02-25T09:33:33
Java
UTF-8
Java
false
false
1,145
java
package com.kute.webflux.config; import com.google.common.collect.Lists; import com.kute.webflux.config.converter.MongoTypeToJavaTypeExtentionConverter; import com.mongodb.MongoClientOptions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.convert.MongoCustomConversions; /** * created by bailong001 on 2019/04/10 12:28 */ @Configuration public class WebConfig { @Autowired private MongoTypeToJavaTypeExtentionConverter mongoTypeToJavaTypeExtentionConverter; /** * regist converter * * @return */ @Bean public MongoCustomConversions mongoCustomConversions() { return new MongoCustomConversions(Lists.newArrayList(mongoTypeToJavaTypeExtentionConverter)); } @Bean public MongoClientOptions mongoOptions() { return MongoClientOptions.builder() .connectTimeout(30000) .maxWaitTime(10000) .maxConnectionIdleTime(6000) .build(); } }
[ "bailong001@ke.com" ]
bailong001@ke.com
11e8aee2249695f4428f18bba42607847c81ccaf
67e7f6e68d3c43d0f7d3cc27e0bf982dc058b3eb
/core/src/main/java/com/orientechnologies/orient/core/db/ODatabasePoolBase.java
319e29b29b805e81e6b9a15ea125c9ae4be2cc3b
[ "Apache-2.0" ]
permissive
delebash/orientdb-parent
220a473d881e36de5a1205eaabe12e523b94c6f7
925736bbbc7f4e39f12307e9247055b2cce8cccb
refs/heads/master
2016-09-06T11:38:10.635602
2014-01-20T00:25:25
2014-01-20T00:25:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,044
java
/* * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) * * 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.orientechnologies.orient.core.db; import java.util.Map; import com.orientechnologies.common.concur.resource.OResourcePool; import com.orientechnologies.orient.core.config.OGlobalConfiguration; import com.orientechnologies.orient.core.exception.OSecurityAccessException; /** * Database pool base class. * * @author Luca Garulli * */ public abstract class ODatabasePoolBase<DB extends ODatabase> extends Thread { protected ODatabasePoolAbstract<DB> dbPool; protected final String url; protected final String userName; protected final String userPassword; protected ODatabasePoolBase() { url = userName = userPassword = null; } protected ODatabasePoolBase(final String iURL, final String iUserName, final String iUserPassword) { url = iURL; userName = iUserName; userPassword = iUserPassword; } public ODatabasePoolBase<DB> setup() { setup(OGlobalConfiguration.DB_POOL_MIN.getValueAsInteger(), OGlobalConfiguration.DB_POOL_MAX.getValueAsInteger()); return this; } protected abstract DB createResource(Object owner, String iDatabaseName, Object... iAdditionalArgs); public ODatabasePoolBase<DB> setup(final int iMinSize, final int iMaxSize) { return this.setup(iMinSize, iMaxSize, OGlobalConfiguration.DB_POOL_IDLE_TIMEOUT.getValueAsLong(), OGlobalConfiguration.DB_POOL_IDLE_CHECK_DELAY.getValueAsLong()); } public ODatabasePoolBase<DB> setup(final int iMinSize, final int iMaxSize, final long idleTimeout, final long timeBetweenEvictionRunsMillis) { if (dbPool == null) synchronized (this) { if (dbPool == null) { dbPool = new ODatabasePoolAbstract<DB>(this, iMinSize, iMaxSize, idleTimeout, timeBetweenEvictionRunsMillis) { public void onShutdown() { if (owner instanceof ODatabasePoolBase<?>) ((ODatabasePoolBase<?>) owner).close(); } public DB createNewResource(final String iDatabaseName, final Object... iAdditionalArgs) { if (iAdditionalArgs.length < 2) throw new OSecurityAccessException("Username and/or password missed"); return createResource(owner, iDatabaseName, iAdditionalArgs); } public boolean reuseResource(final String iKey, final Object[] iAdditionalArgs, final DB iValue) { if (((ODatabasePooled) iValue).isUnderlyingOpen()) { ((ODatabasePooled) iValue).reuse(owner, iAdditionalArgs); if (iValue.getStorage().isClosed()) // STORAGE HAS BEEN CLOSED: REOPEN IT iValue.getStorage().open((String) iAdditionalArgs[0], (String) iAdditionalArgs[1], null); else if (!((ODatabaseComplex<?>) iValue).getUser().checkPassword((String) iAdditionalArgs[1])) throw new OSecurityAccessException(iValue.getName(), "User or password not valid for database: '" + iValue.getName() + "'"); return true; } return false; } }; } } return this; } /** * Acquires a connection from the pool using the configured URL, user-name and user-password. If the pool is empty, then the * caller thread will wait for it. * * @return A pooled database instance */ public DB acquire() { setup(); return dbPool.acquire(url, userName, userPassword); } /** * Acquires a connection from the pool. If the pool is empty, then the caller thread will wait for it. * * @param iName * Database name * @param iUserName * User name * @param iUserPassword * User password * @return A pooled database instance */ public DB acquire(final String iName, final String iUserName, final String iUserPassword) { setup(); return dbPool.acquire(iName, iUserName, iUserPassword); } /** * Acquires a connection from the pool specifying options. If the pool is empty, then the caller thread will wait for it. * * @param iName * Database name * @param iUserName * User name * @param iUserPassword * User password * @return A pooled database instance */ public DB acquire(final String iName, final String iUserName, final String iUserPassword, final Map<String, Object> iOptionalParams) { setup(); return dbPool.acquire(iName, iUserName, iUserPassword, iOptionalParams); } /** * Don't call it directly but use database.close(). * * @param iDatabase */ public void release(final DB iDatabase) { if (dbPool != null) dbPool.release(iDatabase); } /** * Closes the entire pool freeing all the connections. */ public void close() { if (dbPool != null) { dbPool.close(); dbPool = null; } } /** * Returns the maximum size of the pool * */ public int getMaxSize() { setup(); return dbPool.getMaxSize(); } /** * Returns all the configured pools. * */ public Map<String, OResourcePool<String, DB>> getPools() { return dbPool.getPools(); } /** * Removes a pool by name/user * */ public void remove(final String iName, final String iUser) { dbPool.remove(iName, iUser); } @Override public void run() { close(); } }
[ "danelebash@hotmail.com" ]
danelebash@hotmail.com
3cdf44d6f2cf20eb9824c868a70802154b8af831
59c0d6e0c0897eedf72b7e6b369fc3f9de37583c
/petadopt-core-dto/src/main/java/com/ck/dto/PetStatusTypeDTO.java
d9a0cc702d0c8f651c9d8e09c0fea4db411fdb62
[]
no_license
pvcong/petadoption
7e849ad5f127318a64a363368a778bc029669b7e
066a68443988a568377e01e4bf8f42ecebd67cd6
refs/heads/master
2022-11-25T12:50:29.423223
2020-07-31T17:15:03
2020-07-31T17:15:03
276,328,970
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.ck.dto; import java.util.List; public class PetStatusTypeDTO { private Integer petStatusTypeId; private String name; private List<PetStatusDTO> petStatusDTOS; public PetStatusTypeDTO() { } public Integer getPetStatusTypeId() { return petStatusTypeId; } public void setPetStatusTypeId(Integer petStatusTypeId) { this.petStatusTypeId = petStatusTypeId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<PetStatusDTO> getPetStatusDTOS() { return petStatusDTOS; } public void setPetStatusDTOS(List<PetStatusDTO> petStatusDTOS) { this.petStatusDTOS = petStatusDTOS; } }
[ "pvcong99@gmail.com" ]
pvcong99@gmail.com
ab9e758aeb8fd45bd79a051da1012e6ed072f03b
74331cc336f2e3902635a154799dc565a679810e
/src/main/java/com/hanbit/hp/controller/WelcomeController.java
8b16ed1f4ff6bb96062ceeef1c365cf779680b52
[]
no_license
Baek-soo-hyun/100suhyun_spring_hanbit-server
c9fd02a8191e805168174ebdcf0455abdda1effa
85f5c485372c3850d5b8dddefa325e9ada82c14a
refs/heads/master
2021-01-06T20:43:06.081712
2017-03-23T11:55:49
2017-03-23T11:55:49
78,803,405
0
0
null
null
null
null
UTF-8
Java
false
false
3,275
java
package com.hanbit.hp.controller; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.hanbit.hp.annotation.SignInRequired; @Controller public class WelcomeController { private static final Logger LOGGER = LoggerFactory.getLogger(WelcomeController.class); //slf4j 인터페이스에 있는 걸로 import //사용하는 모든 클래스 위에 클래스명만 바꿔서 이렇게 써주면 로거를 사용할 수 있다. @RequestMapping("/welcome") @ResponseBody @SignInRequired //우리가 만들어준 어노테이션 public Map welcome() { Map welcome = new HashMap(); welcome.put("msg", "Hello, Hanbit Plate"); LOGGER.trace("First Log"); LOGGER.debug("First Log"); LOGGER.info("First Log"); LOGGER.warn("First Log"); LOGGER.error("First Log"); return welcome; } @RequestMapping("/form") public String form() { return "hello"; } @RequestMapping("/api2/calc") @ResponseBody public Map calculate (@RequestParam(name="operator", required=false) String operator, @RequestParam(name="left", required=false) String leftStr, @RequestParam(name="right", required=false) String rightStr) { int left = 0; int right = 0; int result = 0; try { left = Integer.valueOf(leftStr); right = Integer.valueOf(rightStr); } catch (Exception e) { } if("plus".equals(operator)) { result = left + right; } else if("minus".equals(operator)) { result = left - right; } Map map = new HashMap(); map.put("result", result); return map; } /*@RequestMapping("/form") @ResponseBody public String form (Model model, @RequestParam(name="operator", required=false) String operator, @RequestParam(name="left", required=false) String leftStr, @RequestParam(name="right", required=false) String rightStr) { int left = 0; int right = 0; int result = 0; try { left = Integer.valueOf(leftStr); right = Integer.valueOf(rightStr); } catch (Exception e) { } if("plus".equals(operator)) { result = left + right; } else if("minus".equals(operator)) { result = left - right; } model.addAttribute("result", result); return "hello"; }*/ @RequestMapping("/hanbit") //표현할 url 파라미터를 써준다. public String hanbit() { /*model.addAttribute("name", "한빛"); html 파일에서 {{name}} 부분에 "한빛"을 넣어라.*/ return "sub/hanbit"; //html 파일의 경로를 상대 경로로 표현하면 된다. } // HTML 템플릿명으로 뒤에 .html 없이 url을 표현하고 싶을 때 이 방식을 사용하면 된다. @RequestMapping("/api2/hello") @ResponseBody public List api() { List list = new ArrayList(); list.add("Hanbit"); list.add("Plate"); list.add("API"); return list; } }
[ "100suhyun@naver.com" ]
100suhyun@naver.com
b9feca98a0cdcbd9dd05e8e36c695bae738f8b39
b64135920000e9baa173e8f1a11954f3c61a4df4
/src/main/java/com/tkn/thymeleafinaction/user/controller/UserController.java
7e95a82e86af97423a1ad8e9c87800f59e471710
[]
no_license
WaterMoonMirror/thymeleaf-in-action
fff386b47ee78ed7cca992783500ccddaa2f248d
0260fd02eb833c4cc9c7c37d388ef6db72dba713
refs/heads/master
2020-04-02T02:00:30.786759
2018-10-20T08:46:29
2018-10-20T08:46:29
153,886,598
0
0
null
null
null
null
UTF-8
Java
false
false
2,530
java
package com.tkn.thymeleafinaction.user.controller; import com.tkn.thymeleafinaction.user.model.User; import com.tkn.thymeleafinaction.user.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.util.List; @RestController @RequestMapping("/users") public class UserController { @Autowired private UserService userService; /** * 查询所有用户 * @param model * @return */ @GetMapping() public ModelAndView getListUser(Model model){ model.addAttribute("userList",userService.listUser()); model.addAttribute("title","用户管理"); return new ModelAndView("users/list","userModel",model); } /** * 获取id用户 * @param model * @return */ @GetMapping("{id}") public ModelAndView getUserById(Model model, @PathVariable("id") Long id){ model.addAttribute("user",userService.getUserById(id)); model.addAttribute("title","查看用户"); return new ModelAndView("users/view","userModel",model); } /** * 获取form页面 * @param model * @return */ @GetMapping("/form") public ModelAndView getform(Model model){ model.addAttribute("user",new User()); model.addAttribute("title","创建用户"); return new ModelAndView("users/form","userModel",model); } /** * 添加用户 * @return */ @PostMapping() public ModelAndView addUser(User user){ userService.saveOrUpdateUser(user); return new ModelAndView("redirect:/users"); } /** * 删除用户 * @return */ @GetMapping("delete/{id}") public ModelAndView delete(@PathVariable("id") Long id,Model model){ userService.deleteUser(id); model.addAttribute("userList",userService.listUser()); model.addAttribute("title","删除用户"); return new ModelAndView("users/list","userModel",model); } /** * 修改用户 * @return */ @GetMapping("modify/{id}") public ModelAndView update(@PathVariable("id") Long id,Model model){ model.addAttribute("user",userService.getUserById(id)); model.addAttribute("title","修改用户"); return new ModelAndView("users/form","userModel",model); } }
[ "lizhu0227@163.com" ]
lizhu0227@163.com
37573025fdbae9fa0d3422e70c0f3c58471ec088
589f8ded1df40816c1ffaa3bb2820cce75d3a219
/src/com/dailykart/bo/OrderDetails.java
25e87e26c65e4992d02284226cf9d5c3606fc6e5
[]
no_license
Chetan302/git-for-demo
9ed44fb3d479a6255d44e5c61a3f6d6b1714dd42
d1d9c411c661281e19fc415329cb580b9854519f
refs/heads/main
2023-08-05T22:53:40.575756
2021-10-05T11:07:31
2021-10-05T11:07:31
413,747,048
0
0
null
2021-10-05T11:07:31
2021-10-05T09:10:05
Java
UTF-8
Java
false
false
560
java
package com.dailykart.bo; public class OrderDetails { private long awBillNo; private String currerntLocation; public long getAwBillNo() { return awBillNo; } public void setAwBillNo(long awBillNo) { this.awBillNo = awBillNo; } public String getCurrerntLocation() { return currerntLocation; } public void setCurrerntLocation(String currerntLocation) { this.currerntLocation = currerntLocation; } @Override public String toString() { return "OrderDetails [awBillNo=" + awBillNo + ", currerntLocation=" + currerntLocation + "]"; } }
[ "chaudharichetan943@gmail.com" ]
chaudharichetan943@gmail.com
2d2fcb5dc1cefa207479b9a5d833b260036d535b
b173920c60dac3bb3100f23eb6e1a2ccb4148350
/src/by/epamtc/shamuradova/appliance_search/service/validation/command/impl/OvenValidatorCommand.java
e4aacfcee1e9d244987ec4a7227bed6beb0cd26b
[]
no_license
ViktoriaShamuradova/EpamTask5ProductSearch-
df8c8676bd7275e605f2d4a858a62cce00f4b84c
922391f46bb4b7466d2d47a020609c8761aecad1
refs/heads/master
2022-11-19T23:51:10.672665
2020-07-21T18:03:20
2020-07-21T18:03:20
278,200,583
0
0
null
null
null
null
UTF-8
Java
false
false
3,667
java
package by.epamtc.shamuradova.appliance_search.service.validation.command.impl; import by.epamtc.shamuradova.appliance_search.entity.criteria.Criteria; import by.epamtc.shamuradova.appliance_search.entity.criteria.SearchCriteria; import by.epamtc.shamuradova.appliance_search.service.validation.command.Command; import java.util.Map; public class OvenValidatorCommand implements Command { private static double minPowerConsumption = 1000; private static double maxPowerConsumption = 2100; private static double minCapacity = 30; private static double maxCapacity = 35; private static double minDepth = 50; private static double maxDepth = 65; private static double minHeight = 30; private static double maxHeight = 50; private static double minWeight = 9; private static double maxWeight = 15; private static double minWidth = 50; private static double maxWidth = 75; @Override public boolean execute(Criteria criteria) { Map<String, Object> criteria1 = criteria.getCriteria(); for (Map.Entry<String, Object> item : criteria1.entrySet()) { if (item.getKey().equalsIgnoreCase(SearchCriteria.Oven.POWER_CONSUMPTION.toString())) { try { Double value = (Double) item.getValue(); if (value < minPowerConsumption || value > maxPowerConsumption) { return false; } } catch (ClassCastException e) { return false; } } if (item.getKey().equalsIgnoreCase(SearchCriteria.Oven.CAPACITY.toString())) { try { Double value = (Double) item.getValue(); if (value < minCapacity || value > maxCapacity) { return false; } } catch (ClassCastException e) { return false; } } if (item.getKey().equalsIgnoreCase(SearchCriteria.Oven.DEPTH.toString())) { try { Double value = (Double) item.getValue(); if (value < minDepth || value > maxDepth) { return false; } } catch (ClassCastException e) { return false; } } if (item.getKey().equalsIgnoreCase(SearchCriteria.Oven.HEIGHT.toString())) { try { Double value = (Double) item.getValue(); if (value < minHeight || value > maxHeight) { return false; } } catch (ClassCastException e) { return false; } } if (item.getKey().equalsIgnoreCase(SearchCriteria.Oven.WEIGHT.toString())) { try { Double value = (Double) item.getValue(); if (value < minWeight || value > maxWeight) { return false; } }catch (ClassCastException e){ return false; } } if (item.getKey().equalsIgnoreCase(SearchCriteria.Oven.WIDTH.toString())) { try { Double value = (Double) item.getValue(); if (value < minWidth || value > maxWidth) { return false; } }catch (ClassCastException e){ return false; } } } return true; } }
[ "viktoriashamuradova@gmail.com" ]
viktoriashamuradova@gmail.com
a31e2bf941c6fc2e16735b1b83d52ce269628d55
2074bf61fbe41cf6b358982cf3da419fe58a36b0
/circular-buffer/src/main/java/CircularBuffer.java
07301cbb7516044d4ded216774e9b7e61bf165e3
[ "MIT" ]
permissive
cmccandless/ExercismSolutions-java
667ea822d89d5906d63faaa3fc894680dc4d06da
3972b10322ce968515bd638916d7c51ec869011c
refs/heads/master
2020-04-20T02:09:55.089297
2019-02-08T20:54:44
2019-02-08T20:54:44
168,564,332
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
public class CircularBuffer<T> { private Object[] buf; private int r = 0, w = 0, length = 0; public CircularBuffer(int size) { buf = new Object[size]; } private int increment(int i) { return (i + 1) % buf.length; } private T _read() { @SuppressWarnings("unchecked") T x = (T)buf[r]; r = increment(r); length--; return x; } private void _write(T x) { buf[w] = x; w = increment(w); length++; } public void clear() { w = r = length = 0; } public T read() throws BufferIOException { if (length == 0) throw new BufferIOException("Tried to read from empty buffer"); return _read(); } public void write(T x) throws BufferIOException { if (length == buf.length) throw new BufferIOException("Tried to write to full buffer"); _write(x); } public void overwrite(T x) { if (length == buf.length) _read(); _write(x); } }
[ "crm1994@gmail.com" ]
crm1994@gmail.com
bc1abb2179d10a0f6919e91c1685f35eca781451
639682cf6096c4aeccf1d4c88ced0d636274cb3d
/app/src/main/java/info/wwwood/eventos/presentationlayer/services/GeoPositionService.java
05d00af0c6e12059c028c51d7e695a10eb624cf0
[]
no_license
xaviergadea/Eventos
13cd82f5712a2198d60dcfb5699eade77b9a54ed
8f795cfbe99676f6f3b2b2f80622aa7de36faf95
refs/heads/master
2021-01-01T04:13:00.686998
2016-05-11T18:17:00
2016-05-11T18:17:00
57,235,040
0
0
null
null
null
null
UTF-8
Java
false
false
1,375
java
package info.wwwood.eventos.presentationlayer.services; import android.app.Service; import android.content.Context; import android.content.Intent; import android.location.LocationManager; import android.os.IBinder; import android.support.annotation.Nullable; import info.wwwood.eventos.presentationlayer.androidextends.application.PueAndroidApplication; import info.wwwood.eventos.presentationlayer.listeners.GeoPositionListener; /** * Created by android-ed1 on 11/05/2016. */ public class GeoPositionService extends Service { private LocationManager locationManager; private GeoPositionListener geoPositionListener; @Override public void onCreate() { super.onCreate(); locationManager=(LocationManager) getSystemService(Context.LOCATION_SERVICE); geoPositionListener=new GeoPositionListener(((PueAndroidApplication)getApplication()).getAsistenciaActual()); iniciarPosicionamiento(); } private void iniciarPosicionamiento(){ locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,5000,0,geoPositionListener); //5000 segons i 0 metres de moviment } @Override public void onDestroy() { locationManager.removeUpdates(geoPositionListener); super.onDestroy(); } @Nullable @Override public IBinder onBind(Intent intent) { return null; } }
[ "hvintro@gmail.com" ]
hvintro@gmail.com
75a1d7ef78cc737be84dc6966d11fbef78c185ec
03e63a4615b31dfe8bbda1a0761cc02ed0a6b44d
/Chapter02/beans/src/test/java/org/neoa/cems/beans/naming/AliasesCfgTest.java
95bed894033260ed6bab8afdb6aea932211a9769
[]
no_license
AcrixF/Pro-Spring-Certified
c3e15f5c6c45892e53198185ce500283692d018c
defaa9ff76eae0daf22bb4dce56d036fa661df50
refs/heads/master
2022-11-17T07:58:51.698032
2020-07-13T01:35:36
2020-07-13T01:35:36
274,477,535
0
0
null
null
null
null
UTF-8
Java
false
false
1,229
java
package org.neoa.cems.beans.naming; import org.junit.jupiter.api.Test; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.neoa.cems.beans.ci.SimpleBean; import org.neoa.cems.beans.ci.SimpleBeanImpl; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.jupiter.api.Assertions.*; public class AliasesCfgTest { private Logger logger = LoggerFactory.getLogger(AliasesCfgTest.class); @Test public void testSimpleBeans() { ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(AliasesCfg.class); SimpleBean simpleBean = ctx.getBean("beanOne", SimpleBean.class); assertNotNull(simpleBean); assertTrue(simpleBean instanceof SimpleBeanImpl); SimpleBean simpleBean2 = ctx.getBean("beanTwo", SimpleBean.class); assertEquals(simpleBean2, simpleBean); assertThrows(NoSuchBeanDefinitionException.class, () -> ctx.getBean("simpleBean", SimpleBean.class)); ctx.close(); } }
[ "Cristian.X.Flores.-ND@disney.com" ]
Cristian.X.Flores.-ND@disney.com
aeae7c636833edbd790b7e34aa4475c102fccd0a
6d07bfddf63f2affe0cc0de05e0711fcda13f947
/src/test/java/cn/sissors/hummingbird/runtime/config/HummingbirdPropertiesConfiguration.java
5b7855e0bd5dc76c0b2d671951aa57c4bd6f3f62
[ "Apache-2.0" ]
permissive
zhangyazhong/Hummingbird
4955a0ec23fcf0485a374fee00c4b329edbf10a3
1732d3d0bdec429dc47f2d5012ec3c56b78fcf51
refs/heads/master
2022-01-20T06:19:55.788750
2021-04-27T02:46:10
2021-04-27T02:46:10
157,814,596
4
2
Apache-2.0
2021-12-18T18:18:44
2018-11-16T04:55:35
Java
UTF-8
Java
false
false
562
java
package cn.sissors.hummingbird.runtime.config; import com.google.common.collect.ImmutableList; import java.util.List; /** * @author zyz * @version 2018-10-28 */ public class HummingbirdPropertiesConfiguration extends PropertiesConfiguration { @Override public List<String> locations() { return ImmutableList.of( "classpath: default.properties", "classpath: user-defined.properties", "classpath: missing.properties", "/etc/cn.sissors.hummingbird.properties" ); } }
[ "ZhongCentury@gmail.com" ]
ZhongCentury@gmail.com
cb8fe5d7a6d56a4921d30d454d0d6471c22c73ae
7c6472a77de735f0d27892c0fe8d8fa20b50f503
/chapter07/src/chapter3/SeedTest.java
8d7a402c8ea6450e7ca84d7864d0b388c894035e
[]
no_license
321lichao123/crazyJava
1760856859bafa4378a555397d200f6a5aa76c9a
c2b40d77e1069e5988c36fd922ec83fae2e7d977
refs/heads/main
2023-06-05T16:07:22.688168
2021-06-09T08:12:07
2021-06-09T08:12:07
366,220,143
0
0
null
null
null
null
UTF-8
Java
false
false
2,344
java
package chapter3; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; public class SeedTest { public static void main(String[] args) { Random r1 = new Random(50); System.out.println("第一个种子为50的random对象"); System.out.println("r1.nextBoolean():\t" + r1.nextBoolean()); System.out.println("r1.nextInt():\t\t" + r1.nextInt()); System.out.println("r1.nextDouble():\t" + r1.nextDouble()); System.out.println("r1.nextGaussian():\t" + r1.nextGaussian()); System.out.println("******************"); Random r2 = new Random(50); System.out.println("第二个种子为50的random对象"); System.out.println("r2.nextBoolean():\t" + r2.nextBoolean()); System.out.println("r2.nextInt():\t\t" + r2.nextInt()); System.out.println("r2.nextDouble():\t" + r2.nextDouble()); System.out.println("r2.nextGaussian():\t" + r2.nextGaussian()); System.out.println("******************"); Random r3 = new Random(100); System.out.println("第三个种子为50的random对象"); System.out.println("r3.nextBoolean():\t" + r3.nextBoolean()); System.out.println("r3.nextInt():\t\t" + r3.nextInt()); System.out.println("r3.nextDouble():\t" + r3.nextDouble()); System.out.println("r3.nextGaussian():\t" + r3.nextGaussian()); System.out.println("******************"); ThreadLocalRandom c1 = ThreadLocalRandom.current(); System.out.println("第四个种子为50的random对象"); System.out.println("c1.nextBoolean():\t" + c1.nextBoolean()); System.out.println("c1.nextInt():\t\t" + c1.nextInt()); System.out.println("c1.nextDouble():\t" + c1.nextDouble()); System.out.println("c1.nextGaussian():\t" + c1.nextGaussian()); System.out.println("******************"); ThreadLocalRandom c2 = ThreadLocalRandom.current(); System.out.println("第五个种子为50的random对象"); System.out.println("c2.nextBoolean():\t" + c2.nextBoolean()); System.out.println("c2.nextInt():\t\t" + c2.nextInt()); System.out.println("c2.nextDouble():\t" + c2.nextDouble()); System.out.println("c2.nextGaussian():\t" + c2.nextGaussian()); } }
[ "1246877006@qq.com" ]
1246877006@qq.com
a8a47a452235e284ba1b60e20abf5f0c9c9f68e3
8aa8c18756902c2ec03fdb22d0551bdbddda5e9e
/fr.rostren.tracker.model/src-gen/fr/rostren/tracker/CheckingAccount.java
d9d0c6630ba7e364592d63e151fcdc832a99a141
[]
no_license
tomaro29/tracker
71d098e98f9ead803c6332a9f83f29e7875fdf84
ad987874dc9ebab1b2aa24fb4e7616ed4b6295e6
refs/heads/master
2020-12-24T06:29:19.698259
2017-08-02T13:38:40
2017-08-02T13:38:40
17,882,331
0
0
null
null
null
null
UTF-8
Java
false
false
1,554
java
/******************************************************************************* * Copyright (c) 2017 * All rights reserved. * * Contributors: * <mrostren> Initial code *******************************************************************************/ /** */ package fr.rostren.tracker; import org.eclipse.emf.common.util.EList; /** * <!-- begin-user-doc --> A representation of the model object ' * <em><b>Checking Account</b></em>'. <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link fr.rostren.tracker.CheckingAccount#getOperations <em>Operations</em>}</li> * </ul> * * @see fr.rostren.tracker.TrackerPackage#getCheckingAccount() * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='isLinkedToOperations'" * @generated */ public interface CheckingAccount extends Account { /** * Returns the value of the '<em><b>Operations</b></em>' containment reference list. * The list contents are of type {@link fr.rostren.tracker.Operation}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Operations</em>' containment reference list * isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Operations</em>' containment reference list. * @see fr.rostren.tracker.TrackerPackage#getCheckingAccount_Operations() * @model containment="true" * @generated */ EList<Operation> getOperations(); } // CheckingAccount
[ "maro2229@yahoo.fr" ]
maro2229@yahoo.fr
ccd576065eff4b10229d42f6e0f4d6c8edc448ee
824620315070776e44cc2eabe09fa64914dc7934
/src/test/java/com/epam/pep/Remove2ATest.java
56d6d31e70668db90419c54433885c5761f0364e
[]
no_license
thridevmanikanta/TDDRepo
0215530d4dab9a0e9fd680625ad0030960fbc731
668fd01835e8b46b6a685d0c2f35ac5884f81229
refs/heads/master
2021-07-05T05:18:20.424625
2019-06-11T16:12:27
2019-06-11T16:12:27
191,408,085
0
0
null
2020-10-13T13:50:03
2019-06-11T16:16:06
Java
UTF-8
Java
false
false
892
java
package com.epam.pep; import static org.junit.Assert.assertEquals; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class Remove2ATest { Remove2A remove2a; @BeforeEach public void createObj() { remove2a = new Remove2A(); } @Test public void SingleA() { assertEquals("BCD",remove2a.remove("ABCD")); } @Test public void DoubleA() { assertEquals("CD",remove2a.remove("AACD")); } @Test public void SecondA() { assertEquals("BCD",remove2a.remove("BACD")); } @Test public void NoA() { assertEquals("BBAA",remove2a.remove("BBAA")); } @Test public void AnyLength() { assertEquals("BAA",remove2a.remove("AABAA")); } @Test public void OnlyA() { assertEquals("",remove2a.remove("A")); } @Test public void Only2A() { assertEquals("",remove2a.remove("AA")); } @Test public void Null() { assertEquals("",remove2a.remove("")); } }
[ "thridevmanikanta@gmail.com" ]
thridevmanikanta@gmail.com
f01dfb4a62afd0f38258e73ed191d576dfc7248d
5ecc0b012113b515229bb19132771291f7489a4e
/app/build/generated/source/r/debug/android/support/swiperefreshlayout/R.java
d8b4e9aa077c575f65627e1706c22d957819c434
[ "MIT" ]
permissive
jhordyabonia/aprendiendo-con-sam
075ef3bd2b52e7b143bdecd581bc1df6d0a2a0c6
3a3b5f67fb37822cdfd9b20b63d6ac3631a5b5fc
refs/heads/master
2020-04-25T17:05:14.444972
2019-03-13T20:05:35
2019-03-13T20:05:35
172,934,216
0
0
null
null
null
null
UTF-8
Java
false
false
10,179
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.swiperefreshlayout; public final class R { public static final class attr { public static final int alpha = 0x7f020027; public static final int font = 0x7f02007a; public static final int fontProviderAuthority = 0x7f02007c; public static final int fontProviderCerts = 0x7f02007d; public static final int fontProviderFetchStrategy = 0x7f02007e; public static final int fontProviderFetchTimeout = 0x7f02007f; public static final int fontProviderPackage = 0x7f020080; public static final int fontProviderQuery = 0x7f020081; public static final int fontStyle = 0x7f020082; public static final int fontVariationSettings = 0x7f020083; public static final int fontWeight = 0x7f020084; public static final int ttcIndex = 0x7f02013c; } public static final class color { public static final int notification_action_color_filter = 0x7f04003f; public static final int notification_icon_bg_color = 0x7f040040; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; } public static final class drawable { public static final int notification_action_background = 0x7f060092; public static final int notification_bg = 0x7f060093; public static final int notification_bg_low = 0x7f060094; public static final int notification_bg_low_normal = 0x7f060095; public static final int notification_bg_low_pressed = 0x7f060096; public static final int notification_bg_normal = 0x7f060097; public static final int notification_bg_normal_pressed = 0x7f060098; public static final int notification_icon_background = 0x7f060099; public static final int notification_template_icon_bg = 0x7f06009a; public static final int notification_template_icon_low_bg = 0x7f06009b; public static final int notification_tile_bg = 0x7f06009c; public static final int notify_panel_notification_icon_bg = 0x7f06009d; } public static final class id { public static final int action_container = 0x7f07000d; public static final int action_divider = 0x7f07000f; public static final int action_image = 0x7f070010; public static final int action_text = 0x7f070016; public static final int actions = 0x7f070017; public static final int async = 0x7f07001d; public static final int blocking = 0x7f070020; public static final int chronometer = 0x7f070028; public static final int forever = 0x7f07003c; public static final int icon = 0x7f070042; public static final int icon_group = 0x7f070043; public static final int info = 0x7f070046; public static final int italic = 0x7f070048; public static final int line1 = 0x7f070054; public static final int line3 = 0x7f070055; public static final int normal = 0x7f07005d; public static final int notification_background = 0x7f07005e; public static final int notification_main_column = 0x7f07005f; public static final int notification_main_column_container = 0x7f070060; public static final int right_icon = 0x7f07006a; public static final int right_side = 0x7f07006b; public static final int tag_transition_group = 0x7f07008b; public static final int tag_unhandled_key_event_manager = 0x7f07008c; public static final int tag_unhandled_key_listeners = 0x7f07008d; public static final int text = 0x7f07008e; public static final int text2 = 0x7f07008f; public static final int time = 0x7f070097; public static final int title = 0x7f070098; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { public static final int notification_action = 0x7f09001f; public static final int notification_action_tombstone = 0x7f090020; public static final int notification_template_custom_big = 0x7f090021; public static final int notification_template_icon_group = 0x7f090022; public static final int notification_template_part_chronometer = 0x7f090023; public static final int notification_template_part_time = 0x7f090024; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0b0029; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0c00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158; public static final int Widget_Compat_NotificationActionText = 0x7f0c0159; } public static final class styleable { public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x010101a5, 0x01010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "jabonia@avanti.co" ]
jabonia@avanti.co
2b4f093f8298f447a3cedb69d702369c46b3a361
74ae4ff3976315a3eaea9d0726b25d9fa9d084f5
/src/Prac3/DebugThree3Fixed.java
5f868fafe5e2632aad5212eeaf9afa86ad5f9058
[]
no_license
LeithSeymour/CP2406_LeithSeymour
665c0fc93e6246529130d21d277b37eca428870d
0675e2b1a6845aaa8b70924314b67e67bec32403
refs/heads/master
2020-12-30T10:24:45.512652
2017-09-27T11:48:50
2017-09-27T11:48:50
98,970,196
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
package Prac3;// This application gets a user's name and displays a greeting import java.util.Scanner; public class DebugThree3Fixed { public static void main(String args[]) { displayGreeting(getName()); } private static String getName() { String name; Scanner input = new Scanner(System.in); System.out.print("Enter name"); name = input.next(); return name; } private static void displayGreeting(String name) { System.out.println("Hello, " + name + "!"); } }
[ "leith.seymour@my.jcu.edu.au" ]
leith.seymour@my.jcu.edu.au
df472e0996156f258ce034f3b910a7386d24fcdd
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/29/29_b8555683c793687c5cb84942a3b1d282668c9678/CheckAndUpdateDBSchemaHandler/29_b8555683c793687c5cb84942a3b1d282668c9678_CheckAndUpdateDBSchemaHandler_s.java
11a786412beaabd1826a68f435fbba52ec7f6a03
[]
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
10,333
java
/* * Metadata Editor * @author Jiri Kremser * * * * Metadata Editor - Rich internet application for editing metadata. * Copyright (C) 2011 Jiri Kremser (kremser@mzk.cz) * Moravian Library in Brno * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * */ package cz.mzk.editor.server.handler; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Date; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.inject.Inject; import com.google.inject.Provider; import com.gwtplatform.dispatch.server.ExecutionContext; import com.gwtplatform.dispatch.server.actionhandler.ActionHandler; import com.gwtplatform.dispatch.shared.ActionException; import org.apache.log4j.Logger; import cz.mzk.editor.client.util.Constants; import cz.mzk.editor.server.ServerUtils; import cz.mzk.editor.server.DAO.DBSchemaDAO; import cz.mzk.editor.server.DAO.DatabaseException; import cz.mzk.editor.server.DAO.ScriptRunner; import cz.mzk.editor.server.config.EditorConfiguration; import cz.mzk.editor.server.config.EditorConfigurationImpl; import cz.mzk.editor.shared.rpc.action.CheckAndUpdateDBSchemaAction; import cz.mzk.editor.shared.rpc.action.CheckAndUpdateDBSchemaResult; /** * The class CheckAndUpdateDBSchemaHandler * * @author Jiri Kremser * @version 17. 1. 2011 */ public class CheckAndUpdateDBSchemaHandler implements ActionHandler<CheckAndUpdateDBSchemaAction, CheckAndUpdateDBSchemaResult> { /** The logger. */ private static final Logger LOGGER = Logger.getLogger(CheckAndUpdateDBSchemaHandler.class.getPackage() .toString()); private static final Object LOCK = CheckAndUpdateDBSchemaHandler.class; @Inject private DBSchemaDAO dbSchemaDao; /** The configuration. */ private final EditorConfiguration configuration; /** The http session provider. */ @Inject private Provider<HttpSession> httpSessionProvider; @Inject private Provider<ServletContext> contextProvider; /** * Instantiates a new scan input queue handler. * * @param configuration * the configuration */ @Inject public CheckAndUpdateDBSchemaHandler(final EditorConfiguration configuration) { this.configuration = configuration; } /* * (non-Javadoc) * @see * com.gwtplatform.dispatch.server.actionhandler.ActionHandler#execute(com * .gwtplatform.dispatch.shared.Action, * com.gwtplatform.dispatch.server.ExecutionContext) */ @Override public CheckAndUpdateDBSchemaResult execute(final CheckAndUpdateDBSchemaAction action, final ExecutionContext context) throws ActionException { boolean success = false; int version = -1; synchronized (LOCK) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Processing action: CheckAndUpdateDBSchemaAction"); } HttpSession ses = httpSessionProvider.get(); ServerUtils.checkExpiredSession(ses); ServletContext servletContext = contextProvider.get(); String pathPrefix = servletContext.getRealPath("/WEB-INF/classes/"); if (dbSchemaDao.canConnect()) { version = getVersion(pathPrefix); boolean upToDate = false; try { upToDate = dbSchemaDao.checkVersion(version); } catch (DatabaseException e) { LOGGER.error(e.getMessage(), e); e.printStackTrace(); upToDate = false; } if (!upToDate) { try { Process p; String command = "pg_dump -c --inserts " + configuration.getDBName(); String outFile = File.separator + new Date().toString().replaceAll("[ ,:]", "_"); String dirPath = EditorConfigurationImpl.WORKING_DIR + File.separator + Constants.DB_BACKUP_DIR; if (!new File(dirPath).exists()) { new File(dirPath).mkdirs(); } try { if (configuration.isLocalhost()) { p = ScriptRunner.runRemoteCommandViaSsh(dirPath + File.separator + "bin", configuration.getDBName(), configuration.getDBHost(), command, dirPath + outFile); } else { p = Runtime.getRuntime().exec(command + " > " + outFile); } int pNum; if ((pNum = p.waitFor()) == 0) { LOGGER.debug("The DB has been backed up to the file: " + dirPath + outFile); } else { LOGGER.error("ERROR " + pNum + " : during the backup to the file: " + dirPath + outFile + " the proces returned " + pNum); throw new ActionException("Unable backup the current DB schema"); } } catch (IOException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new ActionException("Unable backup the current DB schema", e); } catch (InterruptedException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new ActionException("Unable backup the current DB schema", e); } dbSchemaDao.updateSchema(version, pathPrefix); success = true; } catch (DatabaseException e) { LOGGER.error(e.getMessage(), e); e.printStackTrace(); throw new ActionException("Unable update the DB schema", e); } } } } return new CheckAndUpdateDBSchemaResult(success, String.valueOf(version)); } /* * (non-Javadoc) * @see * com.gwtplatform.dispatch.server.actionhandler.ActionHandler#getActionType * () */ @Override public Class<CheckAndUpdateDBSchemaAction> getActionType() { return CheckAndUpdateDBSchemaAction.class; } /* * (non-Javadoc) * @see * com.gwtplatform.dispatch.server.actionhandler.ActionHandler#undo(com. * gwtplatform.dispatch.shared.Action, * com.gwtplatform.dispatch.shared.Result, * com.gwtplatform.dispatch.server.ExecutionContext) */ @Override public void undo(CheckAndUpdateDBSchemaAction action, CheckAndUpdateDBSchemaResult result, ExecutionContext context) throws ActionException { // TODO Auto-generated method stub } private int getVersion(String pathPrefix) throws ActionException { File dbSchema = new File(pathPrefix + File.separator + Constants.SCHEMA_VERSION_PATH); if (!dbSchema.exists()) { throw new ActionException("Unable to find the file with DB schema version " + dbSchema.getAbsolutePath()); } if (!dbSchema.canWrite()) { throw new ActionException("Unable to write to the file with DB schema version " + dbSchema.getAbsolutePath()); } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(dbSchema)); return Integer.parseInt(reader.readLine()); } catch (FileNotFoundException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new ActionException("Unable to find the file with DB schema version " + dbSchema.getAbsolutePath(), e); } catch (IOException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new ActionException("Unable to read from file with DB schema version " + dbSchema.getAbsolutePath(), e); } catch (NumberFormatException nfe) { LOGGER.error(nfe.getMessage()); nfe.printStackTrace(); throw new ActionException("Unable to convert the content of the first line in " + dbSchema.getAbsolutePath() + " to a number", nfe); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { LOGGER.error(e.getMessage(), e); e.printStackTrace(); reader = null; } } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
a3e78a16250e61bde7a743b52c0c693ff2d68c65
c9f2b6b0aa6dc4500c1f30ee53d43eb5d54ae463
/src/main/java/com/project/dao/receptionist/PatientDetailsDao.java
4432d43664a04099bd633fd6588659e879cae954
[]
no_license
NamburiBharath/HospitalManagement
677e0a23ed01dd1f523e4418b2f8c363b00351a6
dc98fd8c548b7a8e50fa96648f874d2dfbf53946
refs/heads/master
2023-05-04T15:28:42.166914
2021-05-16T12:21:13
2021-05-16T12:21:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
986
java
package com.project.dao.receptionist; import javax.transaction.Transactional; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.query.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.project.dao.LoginDao; import com.project.entity.Patient; @Component public class PatientDetailsDao { @Autowired SessionFactory sf; @Autowired LoginDao infoLog; @Transactional public Patient show(String pid) { infoLog.logActivities("in PatientDetailsDao-show: got= "+pid); Session session= sf.getCurrentSession(); Query q1=session.createQuery("from Patient where pid= :id"); q1.setParameter("id", pid); try { Patient temp= (Patient) q1.uniqueResult(); infoLog.logActivities("in PatientDetailsDao-show: found= "+temp); return temp; } catch(Exception e) { infoLog.logActivities("in PatientDetailsDao-show: "+e); return null; } } }
[ "riddhi17pawar@gmail.com" ]
riddhi17pawar@gmail.com
9809426e7bb8dd7df20f823139c79199d37ce775
ef38d70d9b0c20da068d967e089046e626b60dea
/apache-ant/AntBugResults/47/last_version.java
710d5ac1ede40ff69db4500813ce894c23a37ce1
[]
no_license
martapanc/SATD-replication-package
0ea0e8a27582750d39f8742b3b9b2e81bb7ec25d
e3235d25235b3b46416239ee9764bfeccd2d7433
refs/heads/master
2021-07-18T14:28:24.543613
2020-07-10T09:04:40
2020-07-10T09:04:40
94,113,844
1
0
null
null
null
null
UTF-8
Java
false
false
31,685
java
/* * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Ant", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.*; import org.apache.tools.ant.util.*; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.io.*; import java.util.*; /** * Task to compile Java source files. This task can take the following * arguments: * <ul> * <li>sourcedir * <li>destdir * <li>deprecation * <li>classpath * <li>bootclasspath * <li>extdirs * <li>optimize * <li>debug * <li>encoding * <li>target * <li>depend * <li>vebose * </ul> * Of these arguments, the <b>sourcedir</b> and <b>destdir</b> are required. * <p> * When this task executes, it will recursively scan the sourcedir and * destdir looking for Java source files to compile. This task makes its * compile decision based on timestamp. * * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> */ public class Javac extends MatchingTask { /** * Integer returned by the "Modern" jdk1.3 compiler to indicate success. */ private static final int MODERN_COMPILER_SUCCESS = 0; private static final String FAIL_MSG = "Compile failed, messages should have been provided."; private Path src; private File destDir; private Path compileClasspath; private String encoding; private boolean debug = false; private boolean optimize = false; private boolean deprecation = false; private boolean depend = false; private boolean verbose = false; private String target; private Path bootclasspath; private Path extdirs; private static String lSep = System.getProperty("line.separator"); protected boolean failOnError = true; protected File[] compileList = new File[0]; /** * Create a nested <src ...> element for multiple source path * support. * * @return a nexted src element. */ public Path createSrc() { if (src == null) { src = new Path(project); } return src.createPath(); } /** * Set the source dirs to find the source Java files. */ public void setSrcdir(Path srcDir) { if (src == null) { src = srcDir; } else { src.append(srcDir); } } /** * Set the destination directory into which the Java source * files should be compiled. */ public void setDestdir(File destDir) { this.destDir = destDir; } /** * Set the classpath to be used for this compilation. */ public void setClasspath(Path classpath) { if (compileClasspath == null) { compileClasspath = classpath; } else { compileClasspath.append(classpath); } } /** * Maybe creates a nested classpath element. */ public Path createClasspath() { if (compileClasspath == null) { compileClasspath = new Path(project); } return compileClasspath.createPath(); } /** * Adds a reference to a CLASSPATH defined elsewhere. */ public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } /** * Sets the bootclasspath that will be used to compile the classes * against. */ public void setBootclasspath(Path bootclasspath) { if (this.bootclasspath == null) { this.bootclasspath = bootclasspath; } else { this.bootclasspath.append(bootclasspath); } } /** * Maybe creates a nested classpath element. */ public Path createBootclasspath() { if (bootclasspath == null) { bootclasspath = new Path(project); } return bootclasspath.createPath(); } /** * Adds a reference to a CLASSPATH defined elsewhere. */ public void setBootClasspathRef(Reference r) { createBootclasspath().setRefid(r); } /** * Sets the extension directories that will be used during the * compilation. */ public void setExtdirs(Path extdirs) { if (this.extdirs == null) { this.extdirs = extdirs; } else { this.extdirs.append(extdirs); } } /** * Maybe creates a nested classpath element. */ public Path createExtdirs() { if (extdirs == null) { extdirs = new Path(project); } return extdirs.createPath(); } /** * Throw a BuildException if compilation fails */ public void setFailonerror(boolean fail) { failOnError = fail; } /** * Proceed if compilation fails */ public void setProceed(boolean proceed) { failOnError = !proceed; } /** * Set the deprecation flag. */ public void setDeprecation(boolean deprecation) { this.deprecation = deprecation; } /** * Set the Java source file encoding name. */ public void setEncoding(String encoding) { this.encoding = encoding; } /** * Set the debug flag. */ public void setDebug(boolean debug) { this.debug = debug; } /** * Set the optimize flag. */ public void setOptimize(boolean optimize) { this.optimize = optimize; } /** * Set the depend flag. */ public void setDepend(boolean depend) { this.depend = depend; } /** * Set the verbose flag. */ public void setVerbose(boolean verbose) { this.verbose = verbose; } /** * Sets the target VM that the classes will be compiled for. Valid * strings are "1.1", "1.2", and "1.3". */ public void setTarget(String target) { this.target = target; } /** * Executes the task. */ public void execute() throws BuildException { // first off, make sure that we've got a srcdir if (src == null) { throw new BuildException("srcdir attribute must be set!", location); } String [] list = src.list(); if (list.length == 0) { throw new BuildException("srcdir attribute must be set!", location); } if (destDir != null && !destDir.isDirectory()) { throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location); } // scan source directories and dest directory to build up both copy lists and // compile lists resetFileLists(); for (int i=0; i<list.length; i++) { File srcDir = (File)project.resolveFile(list[i]); if (!srcDir.exists()) { throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", location); } DirectoryScanner ds = this.getDirectoryScanner(srcDir); String[] files = ds.getIncludedFiles(); scanDir(srcDir, destDir != null ? destDir : srcDir, files); } // compile the source files String compiler = project.getProperty("build.compiler"); if (compiler == null) { if (Project.getJavaVersion().startsWith("1.3")) { compiler = "modern"; } else { compiler = "classic"; } } if (compileList.length > 0) { log("Compiling " + compileList.length + " source file" + (compileList.length == 1 ? "" : "s") + (destDir != null ? " to " + destDir : "")); boolean compileSucceeded = false; if (compiler.equalsIgnoreCase("classic")) { compileSucceeded = doClassicCompile(); } else if (compiler.equalsIgnoreCase("modern")) { compileSucceeded = doModernCompile(); } else if (compiler.equalsIgnoreCase("jikes")) { compileSucceeded = doJikesCompile(); } else if (compiler.equalsIgnoreCase("jvc")) { compileSucceeded = doJvcCompile(); } else { String msg = "Don't know how to use compiler " + compiler; throw new BuildException(msg, location); } if (!compileSucceeded) { if (failOnError) { throw new BuildException(FAIL_MSG, location); } else { log(FAIL_MSG, Project.MSG_ERR); } } } } /** * Clear the list of files to be compiled and copied.. */ protected void resetFileLists() { compileList = new File[0]; } /** * Scans the directory looking for source files to be compiled. * The results are returned in the class variable compileList */ protected void scanDir(File srcDir, File destDir, String files[]) { GlobPatternMapper m = new GlobPatternMapper(); m.setFrom("*.java"); m.setTo("*.class"); SourceFileScanner sfs = new SourceFileScanner(this); File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); if (newFiles.length > 0) { File[] newCompileList = new File[compileList.length + newFiles.length]; System.arraycopy(compileList, 0, newCompileList, 0, compileList.length); System.arraycopy(newFiles, 0, newCompileList, compileList.length, newFiles.length); compileList = newCompileList; } } /** * Builds the compilation classpath. * * @param addRuntime Shall <code>rt.jar</code> or * <code>classes.zip</code> be added to the classpath. */ protected Path getCompileClasspath(boolean addRuntime) { Path classpath = new Path(project); // add dest dir to classpath so that previously compiled and // untouched classes are on classpath if (destDir != null) { classpath.setLocation(destDir); } // Compine the build classpath with the system classpath, in an // order determined by the value of build.classpath if (compileClasspath == null) { classpath.addExisting(Path.systemClasspath); } else { classpath.addExisting(compileClasspath.concatSystemClasspath()); } // optionally add the runtime classes if (addRuntime) { if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >= 0) { // Pull in *.zip from packages directory FileSet msZipFiles = new FileSet(); msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator + "Packages")); msZipFiles.setIncludes("*.ZIP"); classpath.addFileset(msZipFiles); } else if (Project.getJavaVersion() == Project.JAVA_1_1) { classpath.addExisting(new Path(null, System.getProperty("java.home") + File.separator + "lib" + File.separator + "classes.zip")); } else { // JDK > 1.1 seems to set java.home to the JRE directory. classpath.addExisting(new Path(null, System.getProperty("java.home") + File.separator + "lib" + File.separator + "rt.jar")); // Just keep the old version as well and let addExistingToPath // sort it out. classpath.addExisting(new Path(null, System.getProperty("java.home") + File.separator +"jre" + File.separator + "lib" + File.separator + "rt.jar")); } } return classpath; } /** * Peforms a compile using the classic compiler that shipped with * JDK 1.1 and 1.2. * * @return true if the compile succeeded */ private boolean doClassicCompile() throws BuildException { log("Using classic compiler", Project.MSG_VERBOSE); Commandline cmd = setupJavacCommand(); // Use reflection to be able to build on all JDKs /* // provide the compiler a different message sink - namely our own sun.tools.javac.Main compiler = new sun.tools.javac.Main(new LogOutputStream(this, Project.MSG_WARN), "javac"); if (!compiler.compile(cmd.getArguments())) { throw new BuildException("Compile failed"); } */ try { // Create an instance of the compiler, redirecting output to // the project log OutputStream logstr = new LogOutputStream(this, Project.MSG_WARN); Class c = Class.forName("sun.tools.javac.Main"); Constructor cons = c.getConstructor(new Class[] { OutputStream.class, String.class }); Object compiler = cons.newInstance(new Object[] { logstr, "javac" }); // Call the compile() method Method compile = c.getMethod("compile", new Class [] { String[].class }); Boolean ok = (Boolean)compile.invoke(compiler, new Object[] {cmd.getArguments()}); return ok.booleanValue(); } catch (ClassNotFoundException ex) { throw new BuildException("Cannot use classic compiler, as it is not available"+ " A common solution is to set the environment variable"+ " JAVA_HOME to your jdk directory.", location); } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException) ex; } else { throw new BuildException("Error starting classic compiler: ", ex, location); } } } /** * Performs a compile using the newer compiler that ships with JDK 1.3 * * @return true if the compile succeeded */ private boolean doModernCompile() throws BuildException { try { Class.forName("com.sun.tools.javac.Main"); } catch (ClassNotFoundException cnfe) { log("Modern compiler is not available - using classic compiler", Project.MSG_WARN); return doClassicCompile(); } log("Using modern compiler", Project.MSG_VERBOSE); Commandline cmd = setupJavacCommand(); PrintStream err = System.err; PrintStream out = System.out; // Use reflection to be able to build on all JDKs >= 1.1: try { PrintStream logstr = new PrintStream(new LogOutputStream(this, Project.MSG_WARN)); System.setOut(logstr); System.setErr(logstr); Class c = Class.forName ("com.sun.tools.javac.Main"); Object compiler = c.newInstance (); Method compile = c.getMethod ("compile", new Class [] {(new String [] {}).getClass ()}); int result = ((Integer) compile.invoke (compiler, new Object[] {cmd.getArguments()})) .intValue (); return (result == MODERN_COMPILER_SUCCESS); } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException) ex; } else { throw new BuildException("Error starting modern compiler", ex, location); } } finally { System.setErr(err); System.setOut(out); } } /** * Does the command line argument processing common to classic and * modern. */ private Commandline setupJavacCommand() { Commandline cmd = new Commandline(); Path classpath = getCompileClasspath(false); if (deprecation == true) { cmd.createArgument().setValue("-deprecation"); } if (destDir != null) { cmd.createArgument().setValue("-d"); cmd.createArgument().setFile(destDir); } cmd.createArgument().setValue("-classpath"); // Just add "sourcepath" to classpath ( for JDK1.1 ) if (Project.getJavaVersion().startsWith("1.1")) { cmd.createArgument().setValue(classpath.toString() + File.pathSeparator + src.toString()); } else { cmd.createArgument().setPath(classpath); cmd.createArgument().setValue("-sourcepath"); cmd.createArgument().setPath(src); if (target != null) { cmd.createArgument().setValue("-target"); cmd.createArgument().setValue(target); } } if (encoding != null) { cmd.createArgument().setValue("-encoding"); cmd.createArgument().setValue(encoding); } if (debug) { cmd.createArgument().setValue("-g"); } if (optimize) { cmd.createArgument().setValue("-O"); } if (bootclasspath != null) { cmd.createArgument().setValue("-bootclasspath"); cmd.createArgument().setPath(bootclasspath); } if (extdirs != null) { cmd.createArgument().setValue("-extdirs"); cmd.createArgument().setPath(extdirs); } if (depend) { if (Project.getJavaVersion().startsWith("1.1")) { cmd.createArgument().setValue("-depend"); } else if (Project.getJavaVersion().startsWith("1.2")) { cmd.createArgument().setValue("-Xdepend"); } else { log("depend attribute is not supported by the modern compiler", Project.MSG_WARN); } } if (verbose) { cmd.createArgument().setValue("-verbose"); } logAndAddFilesToCompile(cmd); return cmd; } /** * Logs the compilation parameters, adds the files to compile and logs the * &qout;niceSourceList&quot; */ protected void logAndAddFilesToCompile(Commandline cmd) { log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE); StringBuffer niceSourceList = new StringBuffer("File"); if (compileList.length != 1) { niceSourceList.append("s"); } niceSourceList.append(" to be compiled:"); niceSourceList.append(lSep); for (int i=0; i < compileList.length; i++) { String arg = compileList[i].getAbsolutePath(); cmd.createArgument().setValue(arg); niceSourceList.append(" " + arg + lSep); } log(niceSourceList.toString(), Project.MSG_VERBOSE); } /** * Performs a compile using the Jikes compiler from IBM.. * Mostly of this code is identical to doClassicCompile() * However, it does not support all options like * bootclasspath, extdirs, deprecation and so on, because * there is no option in jikes and I don't understand * what they should do. * * It has been successfully tested with jikes >1.10 * * @author skanthak@muehlheim.de * * @return true if the compile succeeded */ private boolean doJikesCompile() throws BuildException { log("Using jikes compiler", Project.MSG_VERBOSE); Path classpath = new Path(project); // Jikes doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. if (bootclasspath != null) { classpath.append(bootclasspath); } // Jikes doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. addExtdirsToClasspath(classpath); classpath.append(getCompileClasspath(true)); // Jikes has no option for source-path so we // will add it to classpath. classpath.append(src); // if the user has set JIKESPATH we should add the contents as well String jikesPath = System.getProperty("jikes.class.path"); if (jikesPath != null) { classpath.append(new Path(project, jikesPath)); } Commandline cmd = new Commandline(); cmd.setExecutable("jikes"); if (deprecation == true) cmd.createArgument().setValue("-deprecation"); if (destDir != null) { cmd.createArgument().setValue("-d"); cmd.createArgument().setFile(destDir); } cmd.createArgument().setValue("-classpath"); cmd.createArgument().setPath(classpath); if (encoding != null) { cmd.createArgument().setValue("-encoding"); cmd.createArgument().setValue(encoding); } if (debug) { cmd.createArgument().setValue("-g"); } if (optimize) { cmd.createArgument().setValue("-O"); } if (verbose) { cmd.createArgument().setValue("-verbose"); } if (depend) { cmd.createArgument().setValue("-depend"); } /** * XXX * Perhaps we shouldn't use properties for these * three options (emacs mode, warnings and pedantic), * but include it in the javac directive? */ /** * Jikes has the nice feature to print error * messages in a form readable by emacs, so * that emacs can directly set the cursor * to the place, where the error occured. */ String emacsProperty = project.getProperty("build.compiler.emacs"); if (emacsProperty != null && Project.toBoolean(emacsProperty)) { cmd.createArgument().setValue("+E"); } /** * Jikes issues more warnings that javac, for * example, when you have files in your classpath * that don't exist. As this is often the case, these * warning can be pretty annoying. */ String warningsProperty = project.getProperty("build.compiler.warnings"); if (warningsProperty != null && !Project.toBoolean(warningsProperty)) { cmd.createArgument().setValue("-nowarn"); } /** * Jikes can issue pedantic warnings. */ String pedanticProperty = project.getProperty("build.compiler.pedantic"); if (pedanticProperty != null && Project.toBoolean(pedanticProperty)) { cmd.createArgument().setValue("+P"); } /** * Jikes supports something it calls "full dependency * checking", see the jikes documentation for differences * between -depend and +F. */ String fullDependProperty = project.getProperty("build.compiler.fulldepend"); if (fullDependProperty != null && Project.toBoolean(fullDependProperty)) { cmd.createArgument().setValue("+F"); } int firstFileName = cmd.size(); logAndAddFilesToCompile(cmd); return executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } /** * Do the compile with the specified arguments. * @param args - arguments to pass to process on command line * @param firstFileName - index of the first source file in args */ protected int executeExternalCompile(String[] args, int firstFileName) { String[] commandArray = null; File tmpFile = null; try { /* * Many system have been reported to get into trouble with * long command lines - no, not only Windows ;-). * * POSIX seems to define a lower limit of 4k, so use a temporary * file if the total length of the command line exceeds this limit. */ if (Commandline.toString(args).length() > 4096) { PrintWriter out = null; try { tmpFile = new File("jikes"+(new Random(System.currentTimeMillis())).nextLong()); out = new PrintWriter(new FileWriter(tmpFile)); for (int i = firstFileName; i < args.length; i++) { out.println(args[i]); } out.flush(); commandArray = new String[firstFileName+1]; System.arraycopy(args, 0, commandArray, 0, firstFileName); commandArray[firstFileName] = "@" + tmpFile.getAbsolutePath(); } catch (IOException e) { throw new BuildException("Error creating temporary file", e, location); } finally { if (out != null) { try {out.close();} catch (Throwable t) {} } } } else { commandArray = args; } try { Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); exe.setAntRun(project); exe.setWorkingDirectory(project.getBaseDir()); exe.setCommandline(commandArray); exe.execute(); return exe.getExitValue(); } catch (IOException e) { throw new BuildException("Error running Jikes compiler", e, location); } } finally { if (tmpFile != null) { tmpFile.delete(); } } } /** * Emulation of extdirs feature in java >= 1.2. * This method adds all files in the given * directories (but not in sub-directories!) to the classpath, * so that you don't have to specify them all one by one. * @param classpath - Path to append files to */ protected void addExtdirsToClasspath(Path classpath) { if (extdirs == null) { String extProp = System.getProperty("java.ext.dirs"); if (extProp != null) { extdirs = new Path(project, extProp); } else { return; } } String[] dirs = extdirs.list(); for (int i=0; i<dirs.length; i++) { if (!dirs[i].endsWith(File.separator)) { dirs[i] += File.separator; } File dir = project.resolveFile(dirs[i]); FileSet fs = new FileSet(); fs.setDir(dir); fs.setIncludes("*"); classpath.addFileset(fs); } } /* * * @return true if the compile succeeded */ private boolean doJvcCompile() throws BuildException { log("Using jvc compiler", Project.MSG_VERBOSE); Path classpath = new Path(project); // jvc doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. if (bootclasspath != null) { classpath.append(bootclasspath); } // jvc doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. addExtdirsToClasspath(classpath); classpath.append(getCompileClasspath(true)); // jvc has no option for source-path so we // will add it to classpath. classpath.append(src); Commandline cmd = new Commandline(); cmd.setExecutable("jvc"); if (destDir != null) { cmd.createArgument().setValue("/d"); cmd.createArgument().setFile(destDir); } // Add the Classpath before the "internal" one. cmd.createArgument().setValue("/cp:p"); cmd.createArgument().setPath(classpath); // Enable MS-Extensions and ... cmd.createArgument().setValue("/x-"); // ... do not display a Message about this. cmd.createArgument().setValue("/nomessage"); // Do not display Logo cmd.createArgument().setValue("/nologo"); if (debug) { cmd.createArgument().setValue("/g"); } if (optimize) { cmd.createArgument().setValue("/O"); } int firstFileName = cmd.size(); logAndAddFilesToCompile(cmd); return executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } }
[ "marta.pancaldi@stud-inf.unibz.it" ]
marta.pancaldi@stud-inf.unibz.it
20e1b0f8358c8bf6cedd82bdcba93a24465ebfdf
e5abd0951ba29057719e044b26571804eceb338e
/03.Inheritance/HomeworkInheritance/src/p02_bookShop/Main.java
4039898d23ab9f079e91bc54295a0c08b99a54e4
[]
no_license
tahirmuhammadcs/java-oop-basics
2d30a4fbf0f5e10792580a4fb090943c372e5daf
a72400afd466764b1335de3947b63e56a0c2cb92
refs/heads/master
2020-03-31T07:24:12.367245
2017-04-25T21:23:49
2017-04-25T21:23:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,330
java
package p02_bookShop; import java.lang.instrument.IllegalClassFormatException; import java.lang.reflect.Method; import java.util.Scanner; public class Main { public static void main(String[] args) throws IllegalClassFormatException { try { Scanner scanner = new Scanner(System.in); String author = scanner.nextLine(); String title = scanner.nextLine(); Double price = Double.valueOf(scanner.nextLine()); Book book = new Book(author, title, price); GoldenEditionBook goldenEditionBook = new GoldenEditionBook(author, title, price); Method[] bookDeclaredMethods = Book.class.getDeclaredMethods(); Method[] goldenBookDeclaredMethods = GoldenEditionBook.class.getDeclaredMethods(); if (goldenBookDeclaredMethods.length > 1) { throw new IllegalClassFormatException("Code duplication in GoldenEditionBook!"); } System.out.println(book.toString()); System.out.println(goldenEditionBook.toString()); } catch (IllegalArgumentException error) { System.out.println(error.getMessage()); } } }
[ "gramovv@gmail.com" ]
gramovv@gmail.com
c67471534a6abea17e8d57c47c469afcc87cd5c9
f64f9c3fb47e771bdc709055ab4a1f980ce93c12
/src/main/java/com/example/foodie/service/OrderService.java
2bf8b32fcb8205495d556bedba8b49d7cea8089f
[]
no_license
librerush/foodie-backend
7ff3ce4d3cf5ca8babf6b3b7b796810712229df1
e65293ee401d83c8b52ea27e13e728f15c1237d9
refs/heads/master
2023-06-03T03:40:18.099708
2021-06-18T05:58:32
2021-06-18T05:58:32
365,216,030
0
0
null
null
null
null
UTF-8
Java
false
false
3,619
java
package com.example.foodie.service; import com.example.foodie.dto.OrderDto; import com.example.foodie.dto.ProductQuantityDto; import com.example.foodie.dto.ResultDto; import com.example.foodie.entity.Order; import com.example.foodie.entity.OrderProduct; import com.example.foodie.entity.Product; import com.example.foodie.entity.User; import com.example.foodie.repository.OrderProductRepository; import com.example.foodie.repository.OrderRepository; import com.example.foodie.repository.UserRepository; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.web.server.ResponseStatusException; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @Service public class OrderService implements ServiceTemplate<Order, Long, OrderDto> { private final OrderRepository orderRepository; private final UserRepository userRepository; private final OrderProductRepository orderProductRepository; public OrderService(OrderRepository orderRepository, UserRepository userRepository, OrderProductRepository orderProductRepository) { this.orderRepository = orderRepository; this.userRepository = userRepository; this.orderProductRepository = orderProductRepository; } @Override public Order create(OrderDto orderDto) { Long id = orderDto.getUserId(); List<ProductQuantityDto> productList = orderDto.getProducts(); Optional<User> userOptional = userRepository.findById(id); if (userOptional.isEmpty()) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No user with id: " + id); } User user = userOptional.get(); Order order = new Order(LocalDateTime.now(), user); order = orderRepository.save(order); for (ProductQuantityDto productEntry : productList) { Product product = productEntry.getProduct(); long quantity = productEntry.getQuantity(); OrderProduct orderProduct = new OrderProduct(order, product, quantity); order.getOrderProduct().add(orderProduct); product.getOrderProduct().add(orderProduct); orderProductRepository.save(orderProduct); } return order; } @Override public ResultDto delete(Order order) { try { orderRepository.delete(order); } catch (IllegalArgumentException e) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Order not found: " + order); } return new ResultDto(true, "Deleted order: " + order); } @Override public ResultDto deleteById(Long aLong) { try { orderRepository.deleteById(aLong); } catch (Exception e) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Order id not found: " + aLong); } return new ResultDto(true, "Deleted order with id: " + aLong); } @Override public Order update(Order order) { return orderRepository.save(order); } @Override public Optional<Order> findById(Long aLong) { return Optional.empty(); } @Override public Order getById(Long id) throws ResponseStatusException { Optional<Order> orderOptional = orderRepository.findById(id); if (orderOptional.isPresent()) { return orderOptional.get(); } throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No order with id: " + id); } @Override public List<Order> findAll() { return null; } }
[ "librerush@tutanota.com" ]
librerush@tutanota.com
a9195f2bcff44361946b70ac3e3c4ae677374573
ab7c378ac568560c3755194d01ea0c9e926d95ac
/src/main/java/array/JumpGame.java
ef0e55c1c8ba1a07889c3e8b964ecf0a8399e462
[ "Apache-2.0" ]
permissive
WeiyanXiang/algorithm-study
cc24b5ae299aace182562f312ba93ce79675b856
3b6ecbdaf24cafba50e4934d6c1f6073c6ffa884
refs/heads/master
2023-01-12T11:45:38.088041
2023-01-01T22:43:54
2023-01-01T22:43:54
117,467,774
3
1
Apache-2.0
2021-08-31T16:21:00
2018-01-14T21:22:31
Java
UTF-8
Java
false
false
1,183
java
package array; /** * @author Weiyan Xiang on 2020/11/7 */ public class JumpGame { /** * https://leetcode.com/problems/jump-game/ */ public boolean canJump(int[] nums) { return jump(nums, nums.length); } public boolean canJumpRec(int[] nums) { return jumpRec(nums, nums.length - 2, nums.length - 1); } private boolean jumpRec(int[] nums, int i, int last) { if (i == 0) return true; if (nums[i] + i < last) return false; return jumpRec(nums, i - 1, i); } /** * backward thinking */ private boolean jump(int[] nums, int n) { // second to last element int last = n - 1; for (int i = n - 2; i >= 0; i--) { if (nums[i] + i >= last) last = i; } return last == 0; } public boolean canJumpForward(int[] nums) { return jumpForward(nums, nums.length); } /** * Forward thinking */ private boolean jumpForward(int[] nums, int n) { int reach = 0, i = 0; for (i = 0; i < n && i <= reach; i++) { reach = Math.max(nums[i] + i, reach); } return i == n; } }
[ "ltxfxwy@gmail.com" ]
ltxfxwy@gmail.com
42bc599479fd43160360d2489c288db8031b1313
7857fc70c33c882a078f2713487a3d5a20275290
/src/main/java/com/centrica/vms/ws/service/VMSPhase3AckService.java
e2af328ad126ddf0a0769960ad362d348a1956c3
[]
no_license
khalam1982/vendmanagementsystem
11ac43fe5584238d1cbdbffe4259b9ad26283def
18c2eac94f4473a08d5b5c42cfdd2e85b99ee950
refs/heads/master
2016-09-13T03:23:22.494178
2016-05-03T21:35:26
2016-05-03T21:35:26
57,913,328
0
0
null
null
null
null
UTF-8
Java
false
false
13,481
java
package com.centrica.vms.ws.service; import java.util.Calendar; import java.util.Date; import java.util.Iterator; import java.util.Set; import org.owasp.esapi.ESAPI; import org.owasp.esapi.Logger; import com.centrica.vms.common.StatusAckCode; import com.centrica.vms.exception.DBException; import com.centrica.vms.exception.EPaymentKeyInvalidException; import com.centrica.vms.exception.EPaymentKeyOutOfRangeException; import com.centrica.vms.exception.LGLicenceException; import com.centrica.vms.exception.UnknownBreakupException; import com.centrica.vms.exception.VMSAppException; import com.centrica.vms.exception.VMSInvalidPANException; import com.centrica.vms.model.VendTxnStatus; import com.centrica.vms.model.VendTransaction.Status; import com.centrica.vms.scheduler.external.service.SAPService; import com.centrica.vms.scheduler.service.VMSSchedulerService; import com.centrica.vms.scheduler.service.VMSSchedulerServiceImpl; import com.centrica.vms.ws.headend.ack.model.DeliveryReceipt; import com.centrica.vms.ws.headend.ack.model.DeliveryReceiptResponse; import com.centrica.vms.ws.headend.ack.model.DeliveryStatusCode; import com.centrica.vms.ws.headend.ack.model.MeterSource; import com.centrica.vms.ws.headend.ack.model.ResponseCode; import com.centrica.vms.ws.model.VendTxnWSDetails; public class VMSPhase3AckService extends VMSAckVoidService { private Logger logger = ESAPI.getLogger(getClass().getName()); private static final String VMS_USERNAME_VALUE="system"; public DeliveryReceiptResponse handleAckRequest(DeliveryReceipt deliveryReceipt) throws EPaymentKeyInvalidException, EPaymentKeyOutOfRangeException, UnknownBreakupException, VMSInvalidPANException, LGLicenceException, VMSAppException{ logger.debug(Logger.EVENT_SUCCESS,"Entering handleAckRequest method"); DeliveryReceiptResponse deliveryReceiptResponse = new DeliveryReceiptResponse(); String transactionID = deliveryReceipt.getTransactionID(); ResponseCode deliveryStatus = null; deliveryStatus = deliveryReceipt.getDeliveryStatus(); String msn = deliveryReceipt.getMsn(); String vendcode = deliveryReceipt.getVendCode(); Calendar timestamp = deliveryReceipt.getTimestamp(); logger.info(Logger.EVENT_UNSPECIFIED,"Request details" + new Object[] { transactionID, deliveryStatus }); try { // Get the transaction ID first based on MSN and Vend code if (transactionID.equals("000000000000000000")) { transactionID = wsTransactionDAO.getVendTxnWSDetails(msn, vendcode); } VendTxnWSDetails vendTxnWSDetails = wsTransactionDAO.getVendTxnWSDetails(transactionID); Integer existingStatus = getExistingStatus(vendTxnWSDetails); if (!new VendRetryService().retryVend(vendTxnWSDetails, deliveryReceipt, existingStatus)) { updateDeliveryStatus(transactionID, msn, vendcode, timestamp, deliveryStatus, deliveryReceipt.getMeterSource()); // Call SAP acknowledgement only if there wasn't already a // success ACK received by VMS. if (existingStatus != Status.SC_100.getStatus()) { new SAPService().sendAcknowledgementToSAP(transactionID); } } deliveryReceiptResponse = prepareDeliveryResponse(transactionID, StatusAckCode.ACCEPTED.getStatusCode()); } catch (DBException ex) { logger.error(Logger.EVENT_FAILURE,"DB Exception is thrown"); deliveryReceiptResponse = prepareDeliveryResponse(transactionID, StatusAckCode.INVALID.getStatusCode()); } transactionID = null; logger.debug(Logger.EVENT_SUCCESS,"Leaving handleAckRequest method "); return deliveryReceiptResponse; } private Integer getExistingStatus(VendTxnWSDetails vendTxnWSDetails) { Integer status = 0; if(vendTxnWSDetails!=null){ Iterator<VendTxnStatus> itr = vendTxnWSDetails.getTxnStatusDetails().iterator(); status = getVendTxnStatus(itr); } return status; } /** * Method to update the delivery status * @param transactionID * @param headendStatus * @param meterSource * @throws DBException * @throws EPaymentKeyInvalidException * @throws EPaymentKeyOutOfRangeException * @throws UnknownBreakupException * @throws VMSInvalidPANException * @throws LGLicenceException */ private void updateDeliveryStatus(String transactionID, String msn, String vendcode, Calendar timestamp, ResponseCode headendStatus, MeterSource meterSource) throws DBException, EPaymentKeyInvalidException, EPaymentKeyOutOfRangeException, UnknownBreakupException, VMSInvalidPANException, LGLicenceException, VMSAppException { logger.debug(Logger.EVENT_SUCCESS,"Entering updateDeliveryStatus method"); Integer status = null; logger.info(Logger.EVENT_UNSPECIFIED,"Transaction id : "+ transactionID); VendTxnWSDetails vendTxnWSDetails = wsTransactionDAO.getVendTxnWSDetails(transactionID); if(vendTxnWSDetails!=null){ Iterator<VendTxnStatus> itr = vendTxnWSDetails.getTxnStatusDetails().iterator(); status = getVendTxnStatus(itr); //Update top up source if meter source is not empty. if (meterSource != null) { vendTxnWSDetails.setTopUpSource(getSourceString(meterSource)); } else { vendTxnWSDetails.setTopUpSource("OTA"); } /* * Update the acknowledgement status when the previous status is * sent to head end or vend code retry was in progress (in case of reversal) */ if(status==Status.SC_200.getStatus() || status==Status.SC_170.getStatus() || status == Status.SC_120.getStatus() || presumedEnded(status)){ if(status==Status.SC_170.getStatus() || status == Status.SC_120.getStatus()){ // Acknowledgement received when request is in retry, remove job from the scheduler logger.info(Logger.EVENT_UNSPECIFIED,"Unschedule job from the scheduler with no status update"); VMSSchedulerService vmsschedulerService = new VMSSchedulerServiceImpl(); Boolean unSchedulestatus = vmsschedulerService.unScheduleJob(transactionID); logger.info(Logger.EVENT_UNSPECIFIED,"UnSchedule status is -"+unSchedulestatus); } if (headendStatus.getValue() == StatusAckCode.ACCEPTED.getStatusCode()) { status = Status.SC_100.getStatus(); } else if (headendStatus.getValue() == StatusAckCode.INVALID.getStatusCode()) { status = Status.SC_110.getStatus(); } else if (headendStatus.getValue() == StatusAckCode.ERROR.getStatusCode()) { status = Status.SC_105.getStatus(); } else if (headendStatus.getValue() == StatusAckCode.DUPLICATE.getStatusCode()) { status = Status.SC_106.getStatus(); } else if (headendStatus.getValue() == StatusAckCode.KEYPAD_LOCK.getStatusCode()) { status = Status.SC_107.getStatus(); } else if (headendStatus.getValue() == StatusAckCode.MAX_CREDIT.getStatusCode()) { status = Status.SC_108.getStatus(); } else if (headendStatus.getValue() == StatusAckCode.UNKNOWN.getStatusCode()) { status = Status.SC_109.getStatus(); } updateVendTxnStatus(vendTxnWSDetails, status); } else if (status == Status.SC_180.getStatus()) { // ACK received for Voided Vend logger.info(Logger.EVENT_UNSPECIFIED,"ACK received for Voided Vend"); status = Status.SC_190.getStatus(); updateVendTxnStatus(vendTxnWSDetails, status); //Trigger the Vend acknowledgement to SAP to ACK received for voided vend //new SAPService().sendAcknowledgementToSAP(transactionID); //Commented the above line as this is a duplicate call. Please refer the caller method of this method. // Trigger Negative Adjustment try { logger.info(Logger.EVENT_UNSPECIFIED,"Original Transaction ID : " + transactionID); if (headendStatus.getValue() != StatusAckCode.UNKNOWN.getStatusCode()) { //Don't do adjustment if the original vend failed due to network issue processNegtiveAdjustment(vendTxnWSDetails, wsTransactionDAO.getVoidTxnID(transactionID)); } } catch (EPaymentKeyInvalidException e) { logger.error(Logger.EVENT_FAILURE,"EPaymentKeyInvalidException::" + e.getMessage()); throw e; } catch (EPaymentKeyOutOfRangeException e) { logger.error(Logger.EVENT_FAILURE,"EPaymentKeyOutOfRangeException::" + e.getMessage()); throw e; } catch (UnknownBreakupException e) { logger.error(Logger.EVENT_FAILURE,"UnknownBreakupException::" + e.getMessage()); throw e; } catch (VMSInvalidPANException e) { logger.error(Logger.EVENT_FAILURE,"VMSInvalidPANException::" + e.getMessage()); throw e; } catch (LGLicenceException e) { logger.error(Logger.EVENT_FAILURE,"LGLicenceException::" + e.getMessage()); throw e; } catch (VMSAppException e) { logger.error(Logger.EVENT_FAILURE,"VMSAppException::" + e.getMessage()); throw e; } } else { logger.info(Logger.EVENT_UNSPECIFIED,"Transaction id "+ transactionID +"is voided"); } } logger.info(Logger.EVENT_UNSPECIFIED,"Transaction status" + status); logger.debug(Logger.EVENT_SUCCESS,"Leaving updateDeliveryStatus method"); } private String getSourceString(MeterSource meterSource) { int source = meterSource.getValue(); switch (source) { case 1: return "IHD"; case 2: return "OTA"; case 3: return "METER"; default: return "OTA"; //Default to OTA if source is not received from Headend. } } private boolean presumedEnded(Integer status) { if (presumedAck(status) || presumedFailedAtHES(status)) { return true; } return false; } private boolean presumedFailedAtHES(Integer status) { /* 300 - HEADEND_UNHANDLED ERROR * 310 - HEADEND_DEVICE DOES N0T EXIST * 320 - HEADEND_MULTIPLE DEVICE EXIST * 330 - HEADEND_DEVICE NOT ACTIVE * 340 - HEADEND_DEVICE NOT CONNECTED * 350 - HEADEND_DEVICE NOT IN PREPAYMENT MODE * 370 - COMMUNICATION FAILURE IN HEADEND * 125 - UNSENT TO HEADEND * * One of the above errors mean that the initial "applyVendCode" synchronous call or its * equivalent has failed at headend, but an ACK is received possibly because the customer applied it manually * */ if (status == Status.SC_125.getStatus() || status == Status.SC_300.getStatus() || status == Status.SC_310.getStatus() || status == Status.SC_320.getStatus() || status == Status.SC_330.getStatus() || status == Status.SC_340.getStatus() || status == Status.SC_350.getStatus() || status == Status.SC_370.getStatus()) { return true; } return false; } private boolean presumedAck(Integer status) { /* 100 - HEADEND_RECEIVED BY METER * 105 - REJECTED ERROR * 106 - REJECTED DUPLICATE TOP UP * 107 - REJECTED KEYPAD LOCK * 108 - REJECTED MAX CREDIT REACHED * 109 - REJECTED UNKNOWN * 110 - HEADEND_NOT RECEIVED BY METER * 190 - ACK RECEIVED FOR VOIDED VEND * * One of the above codes mean that the current ACK is not the first ACK for the vend. * 100 means the previous ACK was a success. Other codes mean the previous ACK was a failure. * * Possible reasons could be because the meter was R2S2 or because a manual vend was attempted on meter * */ if (status == Status.SC_100.getStatus() || status == Status.SC_105.getStatus() || status == Status.SC_106.getStatus() || status == Status.SC_107.getStatus() || status == Status.SC_108.getStatus() || status == Status.SC_109.getStatus() || status == Status.SC_110.getStatus() || status == Status.SC_190.getStatus()) { return true; } return false; } /** * Method to prepare the delivery response * @param transactionID * @param statusCode * @return */ private DeliveryReceiptResponse prepareDeliveryResponse(String transactionID, int statusCode) { logger.debug(Logger.EVENT_SUCCESS,"Entering prepareDeliveryResponse method"); DeliveryReceiptResponse deliveryReceiptResponse = new DeliveryReceiptResponse(); deliveryReceiptResponse.setTransactionID(transactionID); if (statusCode == DeliveryStatusCode.value1.getValue()) { deliveryReceiptResponse.setDeliveryStatus(DeliveryStatusCode.value1); } else { deliveryReceiptResponse.setDeliveryStatus(DeliveryStatusCode.value2); } logger.debug(Logger.EVENT_SUCCESS,"Leaving prepareDeliveryResponse method"); return deliveryReceiptResponse; } /** * @param itr * @return */ protected Integer getVendTxnStatus(Iterator<VendTxnStatus> itr) { logger.debug(Logger.EVENT_SUCCESS,"Entering getVendTxnStatus method"); Integer vendTransactionStatus = 0; VendTxnStatus vendTxnStatus = null; if (itr != null) { if (itr.hasNext()) { vendTxnStatus = itr.next(); vendTransactionStatus = vendTxnStatus.getStatus(); } } logger.debug(Logger.EVENT_SUCCESS,"Leaving getVendTxnStatus method"); return vendTransactionStatus; } /** * @param vendTxnWSDetails * @param status * @throws DBException */ private void updateVendTxnStatus(VendTxnWSDetails vendTxnWSDetails, int status) throws DBException{ logger.debug(Logger.EVENT_SUCCESS,"Entering updateVendTxnStatus method "); VendTxnStatus vendTxnStatus = new VendTxnStatus(); Set<VendTxnStatus> txnStatusDetails = vendTxnWSDetails.getTxnStatusDetails(); logger.info(Logger.EVENT_UNSPECIFIED,"Vend Transaction Status : " + status); vendTxnStatus.setStatus(status); vendTxnStatus.setUpdatedTimeStamp(new Date()); vendTxnWSDetails.setUpdatedBy(VMS_USERNAME_VALUE); txnStatusDetails.add(vendTxnStatus); vendTxnWSDetails.setTxnStatusDetails(txnStatusDetails); wsTransactionDAO.update(vendTxnWSDetails); logger.debug(Logger.EVENT_SUCCESS,"Leaving updateVendTxnStatus method "); } }
[ "contactkhalam@gmail.com" ]
contactkhalam@gmail.com
e223d8bbe751d5b3485835e733fbed9e32d8b9e7
156ddc801637f908b8629fc73d1ed61158295247
/Age_Calculator/src/CalculatorPkgclass/CustomerData.java
6054d63939c2564c223b58c4847c237fe35574a9
[]
no_license
Akila4/Online-Calculator-Apps
01f6fdfcc11894a45679b120d7271628762fd434
e9e11d876016f58109bb22d992a11bf8e8eed1ef
refs/heads/master
2020-04-22T09:44:31.833925
2019-02-11T13:01:38
2019-02-11T13:01:38
170,283,297
0
0
null
2019-02-12T08:45:56
2019-02-12T08:45:56
null
UTF-8
Java
false
false
992
java
package CalculatorPkgclass; public class CustomerData { int Day; int Month; int Year; int BDay; int BMonth; int BYear; public void setDay(int day) { Day=day; } public void setMonth(int month) { Month=month; } public void setYear(int year) { Year=year; } public void setbirthDay(int day) { BDay=day; } public void setbirthMonth(int month) { BMonth=month; } public void setbirthYear(int year) { BYear=year; } public int getDay() { return Day; } public int getMonth() { return Month; } public int getYear() { return Year; } public int getbirthDay() { return BDay; } public int getbirthMonth() { return BMonth; } public int getbirthYear() { return BYear; } }
[ "noreply@github.com" ]
noreply@github.com
e5909b35a7ae50f28757153ab7f26ff3000e6037
8df30366e02eda0fdfc13171e9aa93e9c4180647
/spring-cloud-samples/finchley/crazy/hy-service-provider/src/main/java/org/crazyit/cloud/FirstServiceProvider.java
b0268ae857141fcdbcb8f21374503cb7ccf3ae4b
[]
no_license
FutureWL/spring-samples
d9ab92614b5d238d321101c5e2c09e1e2b989d24
718da85c5397e8441f69293b3aaaf47b7e05130a
refs/heads/master
2023-03-06T15:35:45.645062
2020-10-03T02:07:24
2020-10-03T02:07:24
160,497,481
1
0
null
null
null
null
UTF-8
Java
false
false
940
java
package org.crazyit.cloud; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @EnableEurekaClient @RestController public class FirstServiceProvider { public static void main(String[] args) { new SpringApplicationBuilder(FirstServiceProvider.class).run(args); } @GetMapping(value = "/person/{personId}", produces = MediaType.APPLICATION_JSON_VALUE) public Person findPerson(@PathVariable("personId") Integer personId) { Person person = new Person(personId, "Crazyit", 30); return person; } }
[ "624263934@qq.com" ]
624263934@qq.com
5dc1ffa4d6a7b00a7c511ba0e33aad70a5904369
a0f4669e5f45e095b1f5592ca71e6275ab832877
/src/main/java/app/avalia/compiler/provider/ClassProvider.java
bf04eac87ff2e24ae4435bd33727861b6e350b72
[ "MIT" ]
permissive
AvaliaApp/ail
8182372d96bc386e76413035c728c9289d9f53cf
80f93fefbd47166d921fb72566cd0a7b080b8508
refs/heads/master
2022-12-23T18:42:59.365134
2020-10-03T08:00:13
2020-10-03T08:00:13
298,902,542
1
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package app.avalia.compiler.provider; import app.avalia.compiler.bytecode.BytecodeVisitor; import app.avalia.compiler.lang.AILClass; import org.objectweb.asm.MethodVisitor; import static org.objectweb.asm.Opcodes.*; public class ClassProvider implements AILProvider<AILClass> { @Override public void parse(AILClass provider) { } @Override public void begin(BytecodeVisitor visitor, AILClass component) { visitor.get().visit(49, ACC_PUBLIC + ACC_SUPER, "AvaliaAssembly", null, "org/bukkit/plugin/java/JavaPlugin", new String[]{"org/bukkit/event/Listener", "org/bukkit/command/CommandExecutor"}); visitor.get().visitSource("AvaliaAssembly.java", null); MethodVisitor mv = visitor.get().visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "org/bukkit/plugin/java/JavaPlugin", "<init>", "()V", false); mv.visitInsn(RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } @Override public void end(BytecodeVisitor visitor, AILClass component) { visitor.get().visitEnd(); } }
[ "poczta.xvacuum@gmail.com" ]
poczta.xvacuum@gmail.com
32278cac12ab70e81472630354978700ddf532ca
004832e529873885f1559eb8c864384b3e1cda3f
/dist/gameserver/data/scripts/npc/model/LostCaptainInstance.java
06953d11a8683285f4f881b4058a3edcc549bf1e
[]
no_license
wks1222/mobius-source
02323e79316eabd4ce7e5b29f8cd5749c930d098
325a49fa23035f4d529e5a34b809b83c68d19cad
refs/heads/master
2021-01-10T02:22:17.746138
2015-01-17T20:08:13
2015-01-17T20:08:13
36,601,733
1
0
null
null
null
null
UTF-8
Java
false
false
2,218
java
/* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package npc.model; import lineage2.gameserver.data.xml.holder.NpcHolder; import lineage2.gameserver.idfactory.IdFactory; import lineage2.gameserver.model.Creature; import lineage2.gameserver.model.entity.Reflection; import lineage2.gameserver.model.instances.ReflectionBossInstance; import lineage2.gameserver.templates.InstantZone; import lineage2.gameserver.templates.npc.NpcTemplate; import lineage2.gameserver.utils.Location; /** * @author Mobius * @version $Revision: 1.0 $ */ public class LostCaptainInstance extends ReflectionBossInstance { private static final int TELE_DEVICE_ID = 4314; /** * Constructor for LostCaptainInstance. * @param objectId int * @param template NpcTemplate */ public LostCaptainInstance(int objectId, NpcTemplate template) { super(objectId, template); } /** * Method onDeath. * @param killer Creature */ @Override protected void onDeath(Creature killer) { Reflection r = getReflection(); r.setReenterTime(System.currentTimeMillis()); super.onDeath(killer); InstantZone iz = r.getInstancedZone(); if (iz != null) { String tele_device_loc = iz.getAddParams().getString("tele_device_loc", null); if (tele_device_loc != null) { KamalokaGuardInstance npc = new KamalokaGuardInstance(IdFactory.getInstance().getNextId(), NpcHolder.getInstance().getTemplate(TELE_DEVICE_ID)); npc.setSpawnedLoc(Location.parseLoc(tele_device_loc)); npc.setReflection(r); npc.spawnMe(npc.getSpawnedLoc()); } } } }
[ "mobius@cyber-wizard.com" ]
mobius@cyber-wizard.com
39bed123510c8c95764e0ef472773cbd40ec6bb5
6d2d7e534761a9d446ba75c1829430c51e2ded27
/app/src/main/java/com/dataexpo/autogate/activity/UsersActivity.java
5b7a9afd57538a32713d2e6e9a2d7b620ccee318
[]
no_license
yangyongchaoGitHub/autogate
2b8a81781602d687e793cc465bffebb20a5dfa4e
719c1ee247af1c86f6d64d7a97fa47a0fbbf131e
refs/heads/master
2021-07-25T20:35:04.828086
2021-07-12T03:01:47
2021-07-12T03:01:47
225,794,527
2
0
null
null
null
null
UTF-8
Java
false
false
13,506
java
package com.dataexpo.autogate.activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.dataexpo.autogate.R; import com.dataexpo.autogate.comm.FileUtils; import com.dataexpo.autogate.comm.Utils; import com.dataexpo.autogate.listener.OnItemClickListener; import com.dataexpo.autogate.listener.OnItemLongClickListener; import com.dataexpo.autogate.model.User; import com.dataexpo.autogate.service.data.UserService; import com.dataexpo.autogate.view.CircleImageView; import java.util.ArrayList; import java.util.List; import static android.widget.NumberPicker.OnScrollListener.SCROLL_STATE_IDLE; public class UsersActivity extends BascActivity implements OnItemClickListener, OnItemLongClickListener, View.OnClickListener { private static final String TAG = UsersActivity.class.getSimpleName(); private UserAdapter mUserAdapter; private TextView btn_cancel; private TextView btn_delete; private Bitmap bitmap = null; private boolean isShowCheck = false; private List<User> users = new ArrayList<>(); private int index = 0; private int pageSize = 10; //加载更多数据时最后一项的索引 private int lastLoadDataItemPosition; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user); mContext = this; initView(); //test(); } @Override protected void onResume() { super.onResume(); initData(); } private void initData() { ArrayList<User> list = UserService.getInstance().limitList(index, pageSize); Log.i(TAG, "limitList end size: " + list.size() + " user size: " + users.size() + " lastLoadDataItemPosition " + lastLoadDataItemPosition); if (list.size() > 0) { index += list.size(); users.addAll(list); mUserAdapter.setDataList(users); mUserAdapter.notifyDataSetChanged(); } else { //隐藏底部 if (mUserAdapter.footVh != null) { mUserAdapter.footVh.pb.setVisibility(View.INVISIBLE); mUserAdapter.footVh.tv.setVisibility(View.INVISIBLE); } } } private void initView() { RecyclerView recyclerView; recyclerView = findViewById(R.id.user_info_recyclerview); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(mContext); //RecyclerView.LayoutManager layoutManager = new GridLayoutManager(mContext, 4); recyclerView.setLayoutManager(layoutManager); mUserAdapter = new UserAdapter(); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { if (newState == SCROLL_STATE_IDLE && lastLoadDataItemPosition == mUserAdapter.getItemCount()){ if (mUserAdapter.footVh != null) { mUserAdapter.footVh.pb.setVisibility(View.VISIBLE); mUserAdapter.footVh.tv.setVisibility(View.VISIBLE); } new LoadDataThread().start(); } } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof LinearLayoutManager){ LinearLayoutManager manager = (LinearLayoutManager) layoutManager; int firstVisibleItem = manager.findFirstVisibleItemPosition(); int l = manager.findLastCompletelyVisibleItemPosition(); lastLoadDataItemPosition = firstVisibleItem+(l-firstVisibleItem)+1; } } }); recyclerView.setAdapter(mUserAdapter); mUserAdapter.setItemClickListener(this); mUserAdapter.setOnItemLongClickListener(this); findViewById(R.id.btn_user_manager_back).setOnClickListener(this); // btn_cancel = findViewById(R.id.btn_user_manager_cancel); //// btn_delete = findViewById(R.id.btn_user_manager_delete); //// btn_delete.setOnClickListener(this); // btn_cancel.setOnClickListener(this); findViewById(R.id.btn_user_manager_filter).setOnClickListener(this); findViewById(R.id.ib_back).setOnClickListener(this); } @Override public void onItemClick(View view, int position) { Log.i(TAG, "onItemClick view: " + view + " position " + position); Intent intent = new Intent(this, UserDetails.class); User u = users.get(position); intent.putExtra(Utils.EXTRA_EXPO_USRE, u); startActivity(intent); } @Override public void onLongItemClick(View view, int position) { Log.i(TAG, "onLongItemClick view: " + view + " position " + position); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_user_manager_filter: Intent intent = new Intent(mContext, UserFilterActivity.class); startActivityForResult(intent, 1); break; case R.id.btn_user_manager_back: case R.id.ib_back: finish(); break; default: } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.i(TAG, "onActityResult!!!! "); users = UserService.getInstance().findUserNoFaceRegist(); mUserAdapter.notifyDataSetChanged(); } public class UserAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener { private static final int ITEM_FOOTER = 0x1; private static final int ITEM_DATA = 0x2; private List<User> mList; private boolean mShowCheckBox; private OnItemClickListener mItemClickListener; private OnItemLongClickListener mItemLongClickListener; private FooterViewHolder footVh = null; private void setDataList(List<User> list) { mList = list; } private void setShowCheckBox(boolean showCheckBox) { mShowCheckBox = showCheckBox; } @Override public void onClick(View v) { if (mItemClickListener != null) { mItemClickListener.onItemClick(v, (Integer) v.getTag()); } } private void setItemClickListener(OnItemClickListener itemClickListener) { mItemClickListener = itemClickListener; } private void setOnItemLongClickListener(OnItemLongClickListener itemLongClickListener) { mItemLongClickListener = itemLongClickListener; } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view; RecyclerView.ViewHolder vh = null; Log.i(TAG, "viewType: ------------------ " + viewType); switch (viewType){ case ITEM_DATA: view = LayoutInflater.from(mContext).inflate(R.layout.item_user_info_list, parent, false); view.setOnClickListener(this); vh = new DataViewHolder(view); //使用代码设置宽高(xml布局设置无效时) view.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); break; case ITEM_FOOTER: view = LayoutInflater.from(mContext).inflate(R.layout.item_footer,null); //使用代码设置宽高(xml布局设置无效时) vh = new FooterViewHolder(view); footVh = (FooterViewHolder) vh; view.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); footVh.pb.setVisibility(View.INVISIBLE); footVh.tv.setVisibility(View.INVISIBLE); break; } return vh; } /** * 获取Item的View类型 * @param position * @return */ @Override public int getItemViewType(int position) { //根据 Item 的 position 返回不同的 Viewtype if (position == (getItemCount())-1){ return ITEM_FOOTER; }else{ return ITEM_DATA; } } /** * 绑定数据 * @param holder * @param position */ @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) { if (holder instanceof DataViewHolder){ DataViewHolder dataViewHolder = (DataViewHolder) holder; dataViewHolder.itemView.setTag(position); if (mShowCheckBox) { dataViewHolder.check_btn.setVisibility(View.VISIBLE); if (mList.get(position).isCheck()) { dataViewHolder.check_btn.setChecked(true); } else { dataViewHolder.check_btn.setChecked(false); } } else { dataViewHolder.check_btn.setVisibility(View.GONE); } // 添加数据 User user = mList.get(position); dataViewHolder.text_name.setText(user.name); String code = user.code; String cardcode = user.cardCode; dataViewHolder.text_code.setText(code); dataViewHolder.text_cardcode.setText(cardcode); Bitmap bitmap = BitmapFactory.decodeFile(FileUtils.getUserPic(user.image_name)); Log.i(TAG, "bitmap: " + bitmap); if (bitmap == null) { bitmap = getWhite(); } dataViewHolder.image.setImageBitmap(bitmap); dataViewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mItemLongClickListener != null) { mItemLongClickListener.onLongItemClick(v, position); return true; } return false; } }); }else if (holder instanceof FooterViewHolder){ } } @Override public int getItemCount() { return mList != null ? mList.size() + 1 : 0; } /** * 创建ViewHolder */ public class DataViewHolder extends RecyclerView.ViewHolder{ private View itemView; private TextView text_name; private TextView text_code; private TextView text_cardcode; private CircleImageView image; private CheckBox check_btn; public DataViewHolder(@NonNull View itemView) { super(itemView); this.itemView = itemView; image = itemView.findViewById(R.id.user_info_image); text_name = itemView.findViewById(R.id.text_user_name); text_code = itemView.findViewById(R.id.text_user_code); text_cardcode = itemView.findViewById(R.id.text_user_cardcode); check_btn = itemView.findViewById(R.id.check_btn); } } /** * 创建footer的ViewHolder */ public class FooterViewHolder extends RecyclerView.ViewHolder{ private ProgressBar pb; private TextView tv; public FooterViewHolder(View itemView) { super(itemView); pb = itemView.findViewById(R.id.progressBar); tv = itemView.findViewById(R.id.textView); } } } class LoadDataThread extends Thread{ @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { initData(); } }); } } //获取一个白底bitmap white1是一个一像素白点 private Bitmap getWhite() { if (bitmap == null) { bitmap = ((BitmapDrawable)getResources().getDrawable(R.drawable.white1)).getBitmap(); } return bitmap; } }
[ "1123096216@qq.com" ]
1123096216@qq.com
db440deecdcb85b6bd828cb1bb21e30a2533d17b
480de63db331e99b42dee16e39edcb96c3f8e0f3
/module_home/src/main/java/com/anthony/home/business/presenter/HomePresenter.java
b8997e2f98d40a8bf997445ea54575a04583d0a7
[]
no_license
AnthonyCoder/MvpForJava
6c7e7d634620fe1cb9c75ae921a8594a96ad485e
b499bf1ee0ef4e3f4338c6347a4332289ada1af9
refs/heads/master
2020-07-01T01:51:34.527625
2019-11-15T01:41:54
2019-11-15T01:41:54
201,011,537
19
4
null
2019-09-30T16:02:35
2019-08-07T08:53:05
Java
UTF-8
Java
false
false
2,083
java
package com.anthony.home.business.presenter; import com.anthony.common.base.net.UrlConstant; import com.anthony.common.base.net.client.request.form.child.WanAndroidFormRequestClient; import com.anthony.common.base.net.common.business.BasePresenter; import com.anthony.common.base.net.common.observer.AppObserver; import com.anthony.home.bean.BannerResult; import com.anthony.home.bean.HomeArticleResult; import com.anthony.home.bean.WeChatAuthorResult; import com.anthony.home.business.contact.HomeContact; /** * 创建时间:2019/8/9 * 创建人:anthony.wang * 功能描述: */ public class HomePresenter extends BasePresenter<HomeContact.View> implements HomeContact.Presenter { public HomePresenter(HomeContact.View view) { super(view); } @Override public void getBanner() { WanAndroidFormRequestClient.getInstance().executeGet(UrlConstant.GET_BANNER_JSON, null, new AppObserver<BannerResult>(view) { @Override public void onNext(BannerResult bannerResults) { super.onNext(bannerResults); view.onBanner(bannerResults.getData()); } }); } @Override public void getWeChatAuthors() { WanAndroidFormRequestClient.getInstance().executeGet(UrlConstant.GET_WXARTICLE_CHAPTERS_JSON, null, new AppObserver<WeChatAuthorResult>(view) { @Override public void onNext(WeChatAuthorResult weChatAuthorResult) { super.onNext(weChatAuthorResult); view.onWeChatAuthors(weChatAuthorResult.getData()); } }); } @Override public void getHomeArticles(int page) { WanAndroidFormRequestClient.getInstance().executeGet(formatUrl(UrlConstant.GET_ARTICLE_LIST_JSON,page+""), null, new AppObserver<HomeArticleResult>(view,"获取文章") { @Override public void onNext(HomeArticleResult homeArticleResult) { super.onNext(homeArticleResult); view.onHomeArticles(homeArticleResult); } }); } }
[ "anthony.wang@generalbiologic.com" ]
anthony.wang@generalbiologic.com