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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
de5053ccee36a3e5e3b99bd5969a57fbf557bcd9 | 08c62003df8a708fe08ceef2146621a2579dc579 | /webapp/src/main/java/us/globalforce/services/SentimentService.java | 4054e61a832df5000d664ac131d9c40139aa7355 | [] | no_license | justinsb/globalforce | 74d400de2c9f4c9c2e52e881cc8d0e168fcbcd32 | bd169edce768144d0409683136e338c193de368b | refs/heads/master | 2020-05-16T06:28:49.269940 | 2013-11-21T01:58:07 | 2013-11-21T01:58:07 | 14,573,895 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,890 | java | package us.globalforce.services;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import us.globalforce.model.Task;
import us.globalforce.salesforce.client.SObject;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
@Singleton
public class SentimentService {
private static final Logger log = LoggerFactory.getLogger(SentimentService.class);
private static final String FIELD_SENTIMENT = "Sentiment__c";
@Inject
SentimentAnalyzer sentimentAnalyzer;
@Inject
JdbcRepository repository;
public Sentiment findSentiment(String organizationId, SObject o) {
Object sentimentValue = o.find(FIELD_SENTIMENT);
if (sentimentValue != null) {
// TODO: Store the value in Salesforce and retrieve it!
log.error("Sentiment value set on: {}", o);
String s = sentimentValue.toString();
if (!Strings.isNullOrEmpty(s)) {
if (s.equals("-2")) {
return Sentiment.STRONG_NEGATIVE;
} else if (s.equals("-1")) {
return Sentiment.NEGATIVE;
} else if (s.equals("0")) {
return Sentiment.NEUTRAL;
} else if (s.equals("1")) {
return Sentiment.POSITIVE;
} else if (s.equals("2")) {
return Sentiment.STRONG_POSITIVE;
} else {
throw new IllegalStateException();
}
}
}
String objectId = o.getId();
log.info("Checking sentiment for {}", objectId);
List<Task> tasks = repository.listTasks(organizationId, ProblemType.Sentiment, objectId);
if (tasks.isEmpty()) {
List<String> sections = Lists.newArrayList();
sections.add(o.findString("Subject", ""));
sections.add(o.findString("Description", ""));
SentimentAnalysis analysis = sentimentAnalyzer.scoreSentiment(sections);
List<String> sentences = analysis.getSentences();
for (int i = 0; i < sentences.size(); i++) {
String sentence = sentences.get(i);
// Sentiment sentiment = analysis.getSentiments().get(i);
// TODO: Once we have more confidence in the model, only create tasks where we're not sure
repository.addTask(organizationId, ProblemType.Sentiment, o.getSfClass(), objectId, i, sentence);
}
return null;
} else {
return determineSentiment(tasks);
}
}
public Sentiment determineSentiment(List<Task> tasks) {
Collections.sort(tasks, new Comparator<Task>() {
@Override
public int compare(Task o1, Task o2) {
int s1 = o1.sequence;
int s2 = o2.sequence;
if (s1 <= s2) {
if (s1 == s2) {
return 0;
} else {
return -1;
}
} else {
return 1;
}
}
});
List<String> sentences = Lists.newArrayList();
List<Sentiment> sentiments = Lists.newArrayList();
for (Task task : tasks) {
sentences.add(task.input);
Sentiment sentiment = null;
if (task.decision != null) {
sentiment = Sentiment.parse(task.decision);
}
sentiments.add(sentiment);
}
SentimentAnalysis analysis = new SentimentAnalysis(sentences, sentiments);
if (analysis.isComplete()) {
return analysis.getOverall();
}
return null;
}
}
| [
"justin@fathomdb.com"
] | justin@fathomdb.com |
426fe35db2451354a2dc26837a268229b5b120f6 | f98002d6186eb2079730f6a41782a808b15fa407 | /src/programs/Pdb2FastaFailSafe.java | f9fac2691020a5f22fd31e019cc8579078575d0f | [] | no_license | ZivBA/CrysHomModeling | 7d6a79fbbdd9d0c0191cd41bc01b679534bf1feb | 3df2ec6dcd35586568d190497af6a4d9e40535fd | refs/heads/master | 2021-06-28T18:35:24.297893 | 2017-07-31T07:16:36 | 2017-07-31T07:16:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,664 | java | package programs;
import meshi.PDB.PdbLine;
import meshi.geometry.Distance;
import meshi.molecularElements.*;
import meshi.parameters.AtomTypes;
import meshi.parameters.Residues;
import meshi.sequences.Sequence;
import meshi.sequences.SequenceCharFilter;
import meshi.util.MeshiLog;
import meshi.util.MeshiProgram;
import meshi.util.file.MeshiWriter;
import meshi.util.filters.Filter;
import java.util.Iterator;
public class Pdb2FastaFailSafe extends MeshiProgram implements Residues, AtomTypes {
private static final String MONOMERS_TO_IGNORE = ("HOH HEM GDP TRS LLP CA CS K CAC AMP ALF SO4 AP5 ACE AXT 3PP PO4 "+
"D12 CO UNK IHP FBP PGA FAD BME NAG DAC ADP FMN MN FE HEA B12 "+
"GTS GOL T5A MG NAP CU DCA CL ZN PER POP CIT AGM CMP GL3 MGN ORO "+
"F43 PGC TP7 SHT EGL CYO FS4 COM COB PYR GOA ISP 3PY CBX NH2 NAD "+
"TPO SM IPS SPS NDP FUC CAS C20 PLP PHO DCD TAU FE2 POH HEC NMO");
private static final String STANDARD_RESIDUES = ("ALA CYS ASP GLU PHE GLY HIS ILE LYS LEU "+
"MET ASN PRO GLN ARG SER THR VAL TRP TYR");
private static final String[][] dictionary = { join("MSE", "MET"),
join("ARO", "ARG"),
join("CSE", "CYS"), //selenium cysteine
join("CSZ", "CYS"), //selenium cysteine
join("MSE", "MSE"), //selenium methionine
join("SLN", "MET"), //selenium methionine
join("YCM", "MET"),
join("OCS", "CYS"), //CYSTEINESULFONIC ACID
join("CSW", "CYS"), //CYSTEINE-S-DIOXIDE
join("SMC", "CYS"), //CYSTEINE RESIDUE METHYLATED IN S-POSITION
join("CYG", "CYS"), //GLUTAMYL-S-CYSTEINE
join("CCS", "CYS"),
join("CSX", "CYS"),
join("SEP", "SER"), //PHOSPHOSERINE
join("ASQ", "ASP"), //PHOSPHOASPARTATE
join("PHD", "ASP"), //PHOSPHORYLATION
join("PCA", "GLU"), //PYROGLUTAMIC ACID
join("MHS", "HIS"),
join("CME", "CYS")};//S,S-(2-HYDROXYETHYL)THIOCYSTEINE
private static String[] join(String s0, String s1) {
String[] out = new String[2];
out[0] = s0;
out[1] = s1;
return out;
}
public static void main(String args[]) {
if (args.length != 4 )
throw new RuntimeException("\n"+"Usage: Pdb2Fasta filenmae [chain] output.pdb output.fasta"+"\n"+
"note that a \'_\' sign should be used if no chain is specified");
busha();
String fileName = args[0];
String chain = args[1];
if (chain.equals("_")) chain = " ";
MeshiWriter pdbOut = openFile(args[2]);
MeshiWriter fastaOut = openFile(args[3]);
MeshiLog log = new MeshiLog();
log.add("REMARK File generated by the command:");
log.add("REMARK Pdb2Fasta "+args[0]+" "+args[1]+" "+args[2]+" "+args[3]);
AtomList originalAtomsList = new AtomList(fileName,new MyFilter(chain));
// originalAtomsList.print();
AtomList newAtomList = getNewAtomList(originalAtomsList, log);
newAtomList.renumber();
ResidueList residueList = new MyResidueList(newAtomList, log);
log.add("REMARK Chain length "+(residueList.size() - 1));
log.print(pdbOut);
residueList.atoms().print(pdbOut);
Sequence sequence = new Sequence(residueList.toString(), originalAtomsList.comment()+" chain "+chain ,
new ResidueSequenceCharFilter());
fastaOut.println(sequence);
fastaOut.flush();
}
private static AtomList getNewAtomList(AtomList originalAtomsList, MeshiLog log) {
AtomList newAtomList = new AtomList();
String toIgnoreFound = "";
String toConvertFound = "";
for (Iterator atoms = originalAtomsList.iterator(); atoms.hasNext();) {
Atom atom = (Atom) atoms.next();
String residueName = atom.residueName();
if (STANDARD_RESIDUES.contains(residueName)) {
newAtomList.add(atom);
}
else {
if (MONOMERS_TO_IGNORE.contains(residueName)) {
if (!toIgnoreFound.contains(residueName)) {
log.add(residueName+" monomers were ignored");
toIgnoreFound += " "+residueName;
}
}
else {
boolean found = false;
for (int i = 0; i < dictionary.length & (! found); i++) {
if (residueName.equals(dictionary[i][0])) {
if (!toConvertFound.contains(residueName)) {
log.add("REMARK "+residueName+" was converted to "+dictionary[i][1]);
toConvertFound += " "+residueName;
}
residueName = dictionary[i][1];
atom = new MyAtom(atom,residueName);
newAtomList.add(atom);
found = true;
}
}
//if (! found) throw new RuntimeException("Weird atom "+atom);
if (! found) log.add("******************************************\n"+
"Pdb2Fasta WARNING: Weird atom "+atom+"\n"+
"******************************************\n");
}
}
}
return newAtomList;
}
private static MeshiWriter openFile(String fileName) {
try {
return new MeshiWriter(fileName);
}
catch (Exception ex) { throw new RuntimeException("Cannot open "+fileName+" for writing \n"+ex);}
}
private static class MyResidueList extends ResidueList {
private Residue previousResidue = null;
public MyResidueList(AtomList atomList, MeshiLog log) {
super();
Iterator atoms = atomList.iterator();
Residue PreviousResidue = null;
if (! atoms.hasNext()) throw new RuntimeException(" No Atoms in AtomList "+atomList.comment());
Atom first = (Atom) atoms.next();
if (! atoms.hasNext()) throw new RuntimeException(" Not enough Atoms in AtomList "+atomList.comment());
Atom atom = first;
while (atoms.hasNext()) {
Object[] temp = getResidue(atoms, first);
Residue residue = (Residue) temp[0];
first = (Atom) temp[1];
if (residue.ca() == null) {
residue.atoms().print();
log.add("******************************************\n"+
"Pdb2Fasta WARNING: No CA in "+residue+"\n"+
"******************************************\n");
}
else {
if (residue.number <= 0) log.add("REMARK residue "+residue+" ignored - non-positive residue number");
else {
if (previousResidue != null) {
if (previousResidue.number >= residue.number){
log.add("Weird residues "+previousResidue+"\n"+residue);
continue;
}
else {
if (previousResidue.number == residue.number-1) {
double distance = (new Distance(previousResidue.ca(),residue.ca())).distance();
if (distance > 4.2) {
log.add("*****************************************\n"+
"Pdb2Fasta WARNING:Consecutive CA atoms are too far away.\ndistance = "+
distance+" between these residues CAs:"+previousResidue+
" "+residue+
"\n******************************************\n");
continue;
}
}
if (previousResidue.number < residue.number-1)
log.add("REMARK Gap between "+previousResidue+" and "+residue);
}
}
add(residue, previousResidue, log);
previousResidue = residue;
}
}
}
}
Object[] getResidue(Iterator atoms, Atom first) {
Object[] out = new Object[2];
AtomList atomList = new AtomList();
Atom atom = first;
atomList.add(first);
while (atoms.hasNext() & (atom.residueNumber() == first.residueNumber())) {
atom = (Atom) atoms.next();
if (atom.residueNumber() == first.residueNumber()) {
atomList.add(atom);
}
}
out[1] = atom; // the next first;
out[0] = new MyResidue(atomList);
return out;
}
boolean add(Residue residue, Residue previousResidue, MeshiLog log) {
if (residue.number <= 0) throw new RuntimeException("Residue "+residue+" with number <= 0 cannot be added");
int iPrevious;
if (previousResidue == null)
iPrevious = -1;
else iPrevious = previousResidue.number;
for (int i = iPrevious+1 ; i < residue.number; i++) {
DummyResidue newResidue = new DummyResidue(i);
log.add("REMARK filling the gap with "+newResidue);
super.add(newResidue);
}
previousResidue = residue;
return super.add(residue);
}
}
// public Residue(String name, int type, int number,
// AtomList atomList, int mode) {
private static class MyResidue extends Residue {
public MyResidue(AtomList atomList) {
super(getName(atomList),getType(atomList),getNumber(atomList),NORMAL);
atoms = atomList;
}
private static String getName(AtomList atomList) {
return ((Atom) atomList.elementAt(0)).residueName();
}
private static int getNumber(AtomList atomList) {
return ((Atom) atomList.elementAt(0)).residueNumber();
}
private static int getType(AtomList atomList) {
String name = getName(atomList);
int out;
try {
out = Residue.type(name);
}
catch (Exception ex) {out = -1;}
return out;
}
}
private static class ResidueSequenceCharFilter extends SequenceCharFilter {
public boolean accept(Object obj) {
Character c = (Character) obj;
return "XACDEFGHIKLMNOPQRSTVWY-".indexOf(c) >= 0;
}
}
private static class MyAtom extends Atom {
public MyAtom(Atom atom, String residueName){
super(atom.name, residueName , atom.residueNumber() , "A",
atom.type);
this.alternateLocation = atom.alternateLocation();
this.temperatureFactor = atom.temperatureFactor();
this.setXYZ(atom.x(),atom.y(),atom.z());
}
}
private static class MyFilter implements Filter {
private final String chain;
public MyFilter(String chain) {
this.chain = chain;
}
public boolean accept(Object obj) {
PdbLine line = (PdbLine) obj;
return (line.isAnAtomOrHeteroAtom() && line.chain().equals(chain));
}
}
private static void busha() {
int zvl = ALA; // force the reading of "meshi.parameters.Residues"
zvl = ACA;// force the reading of "meshi.parameters.AtomTypes"
}
}
| [
"ziv.benaharon1@mai.huji.ac.il"
] | ziv.benaharon1@mai.huji.ac.il |
98f73d2f74bd4804163d91e5c02bd332fcb598e3 | 26b6d8ab2c80b990ab0bc2a0f5c77fab33d69079 | /Graphicsprogramming/displaystr.java | dcc87f3553eec90e3a6d8ba0e061eca4c58b36d6 | [] | no_license | RevathyJS/JavaPrograms | 9622435da740327644e8ffeeed5de2910f510841 | 07e6c90dae92156f8b7a277200a95b7cd3fae7d0 | refs/heads/master | 2023-01-06T23:51:21.988761 | 2020-10-29T06:10:17 | 2020-10-29T06:10:17 | 288,152,900 | 9 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,278 | 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 Graphicsprogramming;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
/**
*
* @author HP
*/
public class displaystr extends Applet implements Runnable {
/**
* Initialization method that will be called after the applet is loaded into
* the browser.
*/
Thread t;
public void init() {
// TODO start asynchronous download of heavy resources
setBackground(Color.BLUE);
setForeground(Color.MAGENTA);
t = new Thread(this);
t.start();
}
public void run() {
try {
for(int i=10;i<=100;i+=10)
{
Thread.sleep(1000);
setBackground(new Color(10+i,10+i,10+i));
setForeground(new Color(200-i,200-i,100-i));
}
} catch (InterruptedException e) {
System.out.println(e);
}
}
// TODO overwrite start(), stop() and destroy() methods
public void paint(Graphics g) {
g.drawString("Java programming", 100, 100);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7ab06b47be6ae5699cd114a38a424c5ceae5c9c5 | fcf17fe159a655a321ef8097038b7283af313dca | /src/lesson11/HWLesson11.java | ce59c536a915710e947749b05780a4a664d92f32 | [] | no_license | alextopolcean/Java13Morning | c83a4905ea3165d0c785fdbb6faab05bfa5c43a2 | 2214360242e55067e30fdd6e62215c32e9811fe9 | refs/heads/master | 2022-12-07T05:33:29.834688 | 2020-08-18T19:52:36 | 2020-08-18T19:52:36 | 286,563,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,756 | java | package lesson11;
public class HWLesson11 {
public static void main(String[] args) {
//homeWork1();
homeWork2(10, 5);
homeWork3(5, 17);
homeWork4(3,10);
homeWork5(10);
}
public static void homeWork1() {
for (int i = 0; i < 20; i = i * 2) {
System.out.println(i);
}
}
// Даны целые числа A и B, где B > 0. Вывести B раз число A
public static void homeWork2(int a, int b) {
for (int i = 0; i < b; i++) {
System.out.println(a);
}
}
// Вывести в порядке возрастания все числа между А и B, где а = 5, а B = 17
public static void homeWork3(int a, int b) {
for (int i = 5; i <= 17; i++) {
System.out.println(i);
}
}
// Сколько раз будет выведено сообщение на экран?
public static void homeWork4(int a, int b) {
for (int i = a; i < b; i++) {
System.out.println(i);
}
}
/* Нарисуйте" (выведите на консоль) треугольник из звёздочек, используя только одну звёздочку и то, что только что
изучили:
*
**
***
****
*****
******
*******
********
*********
**********
*/
public static void homeWork5(int line) {
String star = "*";
String output = "";
for (int i = 0; i < line; i++) {
//System.out.println(output += star);
output = output + star;
System.out.println(output);
}
}
}
| [
"alextopolcean@gmail.com"
] | alextopolcean@gmail.com |
33231375d7946a1f66d6f7067f02d9face78e5a8 | c919e10b420a149ad36a5093a48b0e23bf8b6fdd | /src/main/java/headfront/dataexplorer/tabs/datasheet/DataSheetPopulator.java | e4b2da9cd2c555f5c8dd3ea4fe842df9517a9e95 | [
"MIT"
] | permissive | deepakcdo/JetFuelView | d907f40405941ea351734881e45132f967598afb | 924c498501d67198615543ca57d1618b9f23f364 | refs/heads/master | 2022-07-31T17:02:17.719370 | 2021-08-13T16:10:43 | 2021-08-13T16:10:43 | 142,627,050 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,341 | java | package headfront.dataexplorer.tabs.datasheet;
import com.crankuptheamps.client.CommandId;
import com.crankuptheamps.client.exception.AMPSException;
import headfront.amps.AmpsConnection;
import headfront.amps.services.TopicService;
import headfront.convertor.MessageConvertor;
import headfront.dataexplorer.DataExplorerSelection;
import headfront.dataexplorer.tabs.AbstractDataTab;
import headfront.dataexplorer.tabs.DataSheetTab;
import headfront.guiwidgets.NarrowableList;
import headfront.utils.StringUtils;
import javafx.application.Platform;
import javafx.scene.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Deepak on 04/06/2017.
*/
public class DataSheetPopulator {
private static final Logger LOG = LoggerFactory.getLogger(DataSheetTab.class);
private AmpsConnection connection;
private DataSheetTab dataSheetTab;
private final int rowId;
private final int columnID;
private int allocatedColumnID = 0;
private DataExplorerSelection selection;
private int allocatedRowID = 0;
private TopicService topicService;
private Map<String, Integer> rowIDsMap = new HashMap<>();
private Map<String, Integer> recordLocations = new HashMap<>();
private InternalAmpsListener ampsListener;
public DataSheetPopulator(AmpsConnection connection, DataSheetTab dataSheetTab, int rowId, int columnID,
DataExplorerSelection selection, TopicService topicService) {
this.connection = connection;
this.dataSheetTab = dataSheetTab;
this.rowId = rowId;
this.columnID = columnID;
this.allocatedColumnID = columnID + 1;
this.selection = selection;
this.topicService = topicService;
LOG.info("Creating DataSheetPopulator at rowid = " + rowId + " and columnId = " + columnID);
boolean showAllFields = false;
if (selection.getSelectionType() == NarrowableList.SelectionType.SHOW_NEW ||
selection.getSelectionType() == NarrowableList.SelectionType.SHOW_ALL) {
showAllFields = true;
}
if (selection.getFieldSelectionType() == NarrowableList.SelectionType.SHOW_ALL) {
showAllFields = true;
}
if (selection.getFields().size() > 0) {
showAllFields = false;
}
setup();
String topic = selection.getTopic();
ampsListener = new InternalAmpsListener("", connection, false, connection.getMessageConvertor(topic), selection,
topicService.getSowKey(topic), showAllFields);
try {
CommandId commandId;
boolean subscribeOnly = false;
if (selection.getSelectionType() == NarrowableList.SelectionType.SHOW_NEW) {
subscribeOnly = true;
}
if (selection.getUseFilter()) {
commandId = topicService.subscribeToFilter(selection.getTopic(), selection.getFilter(), selection.getOrderBy(),
ampsListener::processAmpsMessage, false, subscribeOnly, false, selection.getJetFuelSelectorStart(), selection.getOptions());
} else {
commandId = topicService.subscribeToRecord(selection.getTopic(), selection.getRecords(),
ampsListener::processAmpsMessage, false, subscribeOnly, false, selection.getJetFuelSelectorStart(), selection.getOptions());
}
ampsListener.setAmpsSubCommandID(commandId);
} catch (AMPSException e) {
LOG.error("Unable to subscribe to " + selection);
}
}
public void stop() {
ampsListener.stopSubscription();
}
private void setup() {
List<String> fields = selection.getFields();
fields.add(AmpsConnection.TIMESTAMP);
fields.add(AmpsConnection.OOF_KEY);
int counter = 1;
for (String f : fields) {
String fieldName = f.split("\\[")[0].trim();
int xcoordinate = rowId + (counter++);
dataSheetTab.setData(xcoordinate, columnID, fieldName);
rowIDsMap.put(fieldName, xcoordinate);
allocatedRowID = xcoordinate;
}
}
// Dont like this as this is not a tab but I cant refactor this now.
class InternalAmpsListener extends AbstractDataTab {
private List<String> recordIds;
private String recordIdField;
private boolean showAllFields;
public InternalAmpsListener(String tabName, AmpsConnection connection,
boolean showHistory, MessageConvertor messageConvertor,
DataExplorerSelection selection, List<String> recordIds, boolean showAllFields) {
super(tabName, connection, showHistory, messageConvertor, selection, recordIds);
this.recordIds = recordIds;
this.recordIdField = StringUtils.createRecordKey(recordIds);
this.showAllFields = showAllFields;
}
@Override
protected Node createContent() {
return null;
}
@Override
public void updateModel(List<? extends Object> messages) {
messages.forEach(msg -> {
Platform.runLater(() -> {
Map<String, Object> dataMap = (Map<String, Object>) msg;
Object idObject;
if (recordIds.size() == 1) {
idObject = dataMap.get(recordIdField);
} else {
String createdId = "";
for (String recId : recordIds) {
createdId = createdId + dataMap.get(recId) + StringUtils.KEY_SEPERATOR;
}
idObject = createdId.substring(0, createdId.length() - 1);
}
if (idObject != null) {
String rawId = idObject.toString();
final String id = rawId;
Integer oldId = recordLocations.get(id);
if (oldId == null) {
oldId = allocatedColumnID++;
recordLocations.put(id, oldId);
}
dataSheetTab.setData(rowId, oldId, id);
final int columnIdToUse = oldId;
dataMap.forEach((k, v) -> {
Integer rowIdToUse = rowIDsMap.get(k);
if (rowIdToUse == null && showAllFields) {
rowIdToUse = allocatedRowID + 1;
dataSheetTab.setData(rowIdToUse, columnID, k);
rowIDsMap.put(k, rowIdToUse);
allocatedRowID = rowIdToUse;
}
if (rowIdToUse != null) {
dataSheetTab.setData(rowIdToUse, columnIdToUse, v);
}
});
} else {
LOG.info("Ignoring message as it did not have and ID with field " + recordIds + " data was " + dataMap);
}
});
});
}
}
}
| [
"deepakcdo@gmail.com"
] | deepakcdo@gmail.com |
07ff74c92eff371c3e9e4a9b76e8f8fce924032b | 4de8b5686bb21b54cdf74ec0406d39adf6f2d208 | /06_SourceCode/IPv5_SPECCHIO/SPECCHIO Web Interface/src.main.java/ch/specchio/model/Attribute.java | 2cf6d1444dab6082c60beb565ea0bbd785f32732 | [] | no_license | SPECCHIODB/SPECCHIO-Webinterface | e9491c74d0eea1aa04022553e4aa77e40bde648e | 36e13bbb7b6034a025a74d0abf795c9b244d322c | refs/heads/master | 2022-08-03T21:49:07.127395 | 2022-07-29T07:44:12 | 2022-07-29T07:44:12 | 201,246,897 | 0 | 1 | null | 2019-11-11T09:10:28 | 2019-08-08T11:46:00 | HTML | UTF-8 | Java | false | false | 1,302 | java | package ch.specchio.model;
/**
* Wrapper-Class for an ch.specchio.types.attribute object
*/
public class Attribute implements Comparable<Attribute>{
private ch.specchio.types.attribute attribute;
private String name;
private String defaultStorageField;
private int id;
public Attribute(String name, String defaultStorageField) {
this.name = name;
this.defaultStorageField = defaultStorageField;
}
public Attribute(ch.specchio.types.attribute attribute) {
this.attribute = attribute;
this.id = attribute.getId();
this.name = attribute.getName();
this.defaultStorageField = attribute.getDefaultStorageField();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDefaultStorageField() {
return defaultStorageField;
}
public void setDefaultStorageField(String defaultStorageField) {
this.defaultStorageField = defaultStorageField;
}
public ch.specchio.types.attribute getAttribute() {
return attribute;
}
public void setAttribute(ch.specchio.types.attribute attribute) {
this.attribute = attribute;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public int compareTo(Attribute a) {
return this.name.compareTo(a.getName());
}
}
| [
"remo.rossi1@students.fhnw.ch"
] | remo.rossi1@students.fhnw.ch |
008bd5aadc73c871d5f2236d5b1775a1413bfefa | c5871dc9ac991b76b9f51686759f60d0b481acde | /src/main/java/com/unionx/wantuo/dao/CollectMapper.java | 43be6b6b88aa71539d1435184d4de3b0629c0e56 | [] | no_license | original-work/wantuo | b960e2e1e3036123b5cb38896b01a18c1d54f202 | 53246cfc3ee0427c678e4087b605c05fa8266006 | refs/heads/master | 2021-09-06T17:40:02.134826 | 2018-02-09T06:10:43 | 2018-02-09T06:10:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package com.unionx.wantuo.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.unionx.wantuo.base.BaseDao;
import com.unionx.wantuo.model.Collect;
import com.unionx.wantuo.model.Organization;
public interface CollectMapper extends BaseDao<Collect>{
/**
* 收藏机构方法
* @param ct
* @return
*/
public int insertSelective(Collect ct);
/**
* 取消收藏
* @param patriarchAccounts 家长登入账号
* @param organizationAccounts 机构账号
* @return
*/
public int unfavorite(@Param("patriarchAccounts")String patriarchAccounts,@Param("organizationAccounts")
String organizationAccounts);
/**
* @Title: select
* @Description: TODO(根据家长帐号,学校帐号查询是否关注)
* @param @param c
* @param @return 设定文件
* @author abner
* @return Integer 返回类型
* @throws
*/
public Integer select(Collect c);
public List<Organization> queryList(Map<Object, Object> map);
public Integer count(Map<Object, Object> map);
} | [
"winer632@qq.com"
] | winer632@qq.com |
51175a72b7017077ad991723b8dee1f87261c4db | 0a4f5c2b0cd0717b4ce362b8c73cbabd73ff882e | /202-happy-number/src/Solution.java | 9eb8b5fec7d12dd1d0a45e93bd2e5b7cd5519f52 | [] | no_license | king-ly/leetcode-java | 8deed9e11288a234de338140d2da652ea86e4b18 | 7f85520d5cedd6077be7a9aa741b54b3df134a19 | refs/heads/master | 2022-12-02T17:59:24.720236 | 2020-08-17T07:27:14 | 2020-08-17T07:27:14 | 288,111,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | import java.util.HashMap;
import java.util.HashSet;
public class Solution {
public boolean isHappy(int n) {
HashSet set = new HashSet();
while (n != 1) {
String newNum = String.valueOf(n);
int sum = 0;
for (int i = 0; i < newNum.length(); i++) {
int tmp = Integer.valueOf(newNum.charAt(i)) - 48; //因为为string之后就变成 1->'1'(49)
sum = sum + (int) Math.pow(tmp, 2);
}
if (sum == 1) {
return true;
} else if (set.contains(sum)) {
return false;
} else {
set.add(sum);
n = sum;
}
}
return n == 1;
}
public static void main(String[] args) {
int n = 19;
System.out.println(new Solution().isHappy(n));
}
}
| [
"king-ly@qq.com"
] | king-ly@qq.com |
037c60341a09044da38badfa7ba6ced62ba72b66 | 0307f0bffa6aa0772446b90be3b3c1b3d263e35e | /study-dataaccess/breadkey/with-maven/jpa/src/main/java/pokemon/business/service/TrainerDao.java | d07121482db3b2b5ff0e54653b33f6230583eaba | [] | no_license | study-return-study/spring-study | 6bc1475e40b5c3f4c5d81ba4933967c942e565e1 | a7b8e28d9f6370ed72757b970eae5b4198f29abf | refs/heads/master | 2020-04-16T22:34:23.978722 | 2019-03-12T12:22:55 | 2019-03-12T12:22:55 | 165,974,205 | 0 | 0 | null | 2019-03-12T12:22:56 | 2019-01-16T04:34:15 | Java | UTF-8 | Java | false | false | 374 | java | package pokemon.business.service;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import pokemon.business.domain.Trainer;
@Repository
public interface TrainerDao extends JpaRepository<Trainer, Integer> {
@Query
Trainer findByName(String name);
}
| [
"noreply@github.com"
] | noreply@github.com |
d9a5d22dd6adaf51c535fa45076622ced070a8db | 72fdeedee84a4943d1ff02bf6712e638eb37eb19 | /app/src/main/java/com/app/rlts/fragment/StudentTeacherFragment.java | 3b4205e04b274c2b61189609ca08316a9221b618 | [] | no_license | dgmacusi/rlts-sp2-mobile | 51f3cfe33d068edf477e10bc385219ec0631ee08 | 8bfd2cd42babdd3aca356eefddf7e3cd13e09a64 | refs/heads/master | 2020-03-09T17:22:55.464901 | 2018-05-20T14:40:04 | 2018-05-20T14:40:04 | 128,907,530 | 0 | 0 | null | 2018-05-06T18:38:04 | 2018-04-10T09:25:24 | Java | UTF-8 | Java | false | false | 3,702 | java | package com.app.rlts.fragment;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import com.app.rlts.R;
import com.app.rlts.activity.TimelogActivity;
import com.app.rlts.entity.Timelog;
import com.app.rlts.interfaces.AsyncTimelogResponse;
import com.app.rlts.task.AsyncGetStudentTeacherTimelogTask;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
public class StudentTeacherFragment extends Fragment implements AsyncTimelogResponse {
View inflateView;
Button searchButton;
ArrayList<Timelog> timelogArray = new ArrayList<>();
EditText studentteacher_date;
EditText studentteacher_no;
Calendar calendar = Calendar.getInstance();
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
inflateView = inflater.inflate(R.layout.fragment_studentteacher, container, false);
studentteacher_date = (EditText) inflateView.findViewById(R.id.studentteacher_date);
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateLabel();
}
};
studentteacher_date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new DatePickerDialog(getActivity(), date,
calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)).show();
}
});
studentteacher_no = (EditText) inflateView.findViewById(R.id.studentteacher_number);
searchButton = (Button) inflateView.findViewById(R.id.studentteacher_search);
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String date = studentteacher_date.getText().toString();
String number = studentteacher_no.getText().toString();
new AsyncGetStudentTeacherTimelogTask(StudentTeacherFragment.this).execute(date, number);
}
});
return inflateView;
}
private void updateLabel(){
String format = "yyyy-MM-dd";
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
studentteacher_date.setText(dateFormat.format(calendar.getTime()));
}
@Override
public void retrieveTimelog(ArrayList<Timelog> tArray) {
try {
timelogArray.clear();
for (int i = 0; i < tArray.size(); i++) {
this.timelogArray.add(tArray.get(i));
}
} catch (Exception e) {
e.printStackTrace();
}
Intent i = new Intent(getActivity(), TimelogActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("timelogArray", (Serializable)timelogArray);
i.putExtras(bundle);
i.putExtra("fragment", "studentteacher");
startActivity(i);
}
}
| [
"dgmacusi@gmail.com"
] | dgmacusi@gmail.com |
b7a8879703dced8244d92bc8b2c45a6f22aceed3 | ad9cede43886fa5105fdc3b8aae9744da75b438d | /src/kr/co/sbh/TraceService.java | 8b95bc94ee2cd47f00d3862c6f191be7223a7004 | [] | no_license | ddononi/SafeComeHome | 6550a8f54bc586f21ce8aefaee4bb057240704de | aa39b444c484f446613859e8c1aa4fb4bbae75e3 | refs/heads/master | 2020-06-12T20:56:37.754167 | 2012-11-18T13:13:49 | 2012-11-18T13:13:49 | 4,286,660 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,485 | java | package kr.co.sbh;
import java.io.IOException;
import java.util.Vector;
import net.daum.mf.map.api.MapPoint;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
public class TraceService extends Service implements LocationListener {
private Location mLocation;
private SharedPreferences settings;
private SharedPreferences mPrefer;
private UploadToServer uts; // 서버 업로드 쓰레드
/** 서비스가 실행될때 */
@Override
public int onStartCommand(final Intent intent, final int flags,
final int startId) {
// 피보호자가입을 했다면 피보호자로 판단
settings = getSharedPreferences(BaseActivity.PREFER, MODE_PRIVATE);
mPrefer = getSharedPreferences("sbh", MODE_PRIVATE);
if (settings.getBoolean("joined", false) == false) {
stopSelf();
Log.i("sch", "stopself service~");
return 0;
}
startTracker();
return Service.START_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
Log.i("dservice", "stop!");
// 서비스가 끝날때 위치 수신리스너 제거
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.removeUpdates(this);
super.onDestroy();
}
public void startTracker() {
getLocation();
}
/**
* 위치 리스너 설정
*/
private void getLocation() {
LocationManager locationManager;
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// criteria 를 이용하여 최적의 위치정보 제공자를 찾는다.
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);// 정확도
criteria.setPowerRequirement(Criteria.POWER_HIGH); // 전원 소비량
criteria.setAltitudeRequired(false); // 고도 사용여부
criteria.setBearingRequired(false); //
criteria.setSpeedRequired(false); // 속도
criteria.setCostAllowed(true); // 금전적비용
String provider = locationManager.getBestProvider(criteria, true);
// 1분 간격
locationManager.requestLocationUpdates(provider, 10000L, 100, this);
mLocation = locationManager.getLastKnownLocation(provider);
}
@Override
public void onLocationChanged(Location location) {
Log.w(BaseActivity.DEBUG_TAG, "onLocationChanged");
if (mPrefer.getBoolean("isStarted", false)) {
TraceService.this.stopSelf();
}
MapPoint point = MapPoint.mapPointWithGeoCoord(location.getLatitude(),
location.getLongitude());
uts = new UploadToServer(point, "");
uts.start();
mLocation = location; // 위치 받아오기
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
/**
* 경로 좌표를 서버에 전송한다.
*/
private class UploadToServer extends Thread {
private MapPoint point;
private String flag;
public UploadToServer(MapPoint point, String flag) {
this.point = point;
this.flag = flag;
}
@Override
public void run() {
super.run();
// http 로 보낼 이름 값 쌍 컬랙션
Vector<NameValuePair> vars = new Vector<NameValuePair>();
try {
// HTTP post 메서드를 이용하여 데이터 업로드 처리
// 위경도 좌표를 서버에 전송
vars.add(new BasicNameValuePair("lat", String.valueOf(point
.getMapPointGeoCoord().latitude)));
vars.add(new BasicNameValuePair("lng", String.valueOf(point
.getMapPointGeoCoord().longitude)));
vars.add(new BasicNameValuePair("flag", "trace"));
// vars.add(new BasicNameValuePair("flag",));
HttpPost request = new HttpPost("http://"
+ BaseActivity.SERVER_URL
+ BaseActivity.PATH_UPLOAD_URL);
// 한글깨짐을 방지하기 위해 utf-8 로 인코딩시키자
UrlEncodedFormEntity entity = null;
entity = new UrlEncodedFormEntity(vars, "UTF-8");
request.setEntity(entity);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
HttpClient client = new DefaultHttpClient();
final String responseBody = client.execute(request,
responseHandler); // 전송
if (responseBody.trim().contains("ok")) {
Log.i(BaseActivity.DEBUG_TAG, "정상업로드");
}
} catch (ClientProtocolException e) {
Log.e(BaseActivity.DEBUG_TAG,
"Failed to get playerId (protocol): ", e);
} catch (IOException e) {
Log.e(BaseActivity.DEBUG_TAG, "Failed to get playerId (io): ",
e);
}
}
}
}
| [
"juwan@juwan-PC.(none)"
] | juwan@juwan-PC.(none) |
7976c9d3835b9f8ebe9aae399464cfe8021a7519 | 9e6892d899a2b762ae433802f13d6d18588f4ca1 | /src/main/java/com/example/simplebloc/service/AuthorService.java | 8ee2249c1510187b48f6a1ca7da35876614203a8 | [] | no_license | MinThantZin/springsimpleblocexample | a88aa92a05f448476116a77ac9d7c4e19b670bed | ea31158eb4737d0472a6d03540679e815270067d | refs/heads/master | 2023-06-19T22:13:39.101004 | 2021-07-09T16:27:19 | 2021-07-09T16:27:19 | 384,493,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.example.simplebloc.service;
import com.example.simplebloc.entity.Author;
import com.example.simplebloc.repository.AuthorRepository;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface AuthorService {
Author createAuthor(Author author);
List<Author> findAll();
}
| [
"thantzinmin@Thants-MBP.lan"
] | thantzinmin@Thants-MBP.lan |
46c4291f747458e1f449eae95834873407407495 | 8e5a85c2fd0b5b8e1f01bfcfd1a9af7a4c0e57cc | /bndtools.core/src/bndtools/central/Central.java | faf1e86537491e4d72cd5b7e20666f9e20dc9c08 | [] | no_license | rimmeraj/multi-bndtools | 31974fafc3cd3c52633a619ce4b30760a416fc74 | e3d8035fd4b582e91f879ca6991b2e32f9e5691d | refs/heads/master | 2016-09-10T18:40:36.099986 | 2015-01-28T05:02:22 | 2015-01-28T05:02:22 | 29,950,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,213 | java | package bndtools.central;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import org.bndtools.api.BndtoolsConstants;
import org.bndtools.api.ILogger;
import org.bndtools.api.IStartupParticipant;
import org.bndtools.api.Logger;
import org.bndtools.api.ModelListener;
import org.bndtools.utils.Function;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.Version;
import aQute.bnd.build.Project;
import aQute.bnd.build.Workspace;
import aQute.bnd.build.WorkspaceRepository;
import aQute.bnd.osgi.Constants;
import aQute.bnd.service.Refreshable;
import aQute.bnd.service.RepositoryPlugin;
public class Central implements IStartupParticipant {
private static final ILogger logger = Logger.getLogger(Central.class);
private static Central instance = null;
static Workspace workspace = null;
static final List<Function<Workspace,Void>> workspaceInitCallbackQueue = new LinkedList<Function<Workspace,Void>>();
static WorkspaceR5Repository r5Repository = null;
static RepositoryPlugin workspaceRepo = null;
static final AtomicBoolean indexValid = new AtomicBoolean(false);
static final ConcurrentMap<String,Map<String,SortedSet<Version>>> exportedPackageMap = new ConcurrentHashMap<String,Map<String,SortedSet<Version>>>();
static final ConcurrentMap<String,Collection<String>> containedPackageMap = new ConcurrentHashMap<String,Collection<String>>();
static final ConcurrentMap<String,Collection<IResource>> sourceFolderMap = new ConcurrentHashMap<String,Collection<IResource>>();
private final BundleContext bundleContext;
private final Map<IJavaProject,Project> javaProjectToModel = new HashMap<IJavaProject,Project>();
private final List<ModelListener> listeners = new CopyOnWriteArrayList<ModelListener>();
private RepositoryListenerPluginTracker repoListenerTracker;
/**
* WARNING: Do not instantiate this class. It must be public to allow instantiation by the Eclipse registry, but it
* is not intended for direct creation by clients. Instead call Central.getInstance().
*/
@Deprecated
public Central() {
bundleContext = FrameworkUtil.getBundle(Central.class).getBundleContext();
}
@Override
public void start() {
synchronized (Central.class) {
instance = this;
}
repoListenerTracker = new RepositoryListenerPluginTracker(bundleContext);
repoListenerTracker.open();
}
@Override
public void stop() {
repoListenerTracker.close();
synchronized (Central.class) {
instance = null;
}
}
public static Central getInstance() {
synchronized (Central.class) {
return instance;
}
}
public Project getModel(IJavaProject project) {
try {
Project model = javaProjectToModel.get(project);
if (model == null) {
File projectDir = project.getProject().getLocation().makeAbsolute().toFile();
try {
model = getProject(projectDir);
} catch (IllegalArgumentException e) {
// initialiseWorkspace();
// model = Central.getProject(projectDir);
return null;
}
if (workspace == null) {
model.getWorkspace();
}
if (model != null) {
javaProjectToModel.put(project, model);
}
}
return model;
} catch (Exception e) {
// TODO do something more useful here
throw new RuntimeException(e);
}
}
/**
* Implementation of the resource changed interface. We are checking in the POST_CHANGE phase if one of our tracked
* models needs to be updated.
*/
public synchronized void resourceChanged(IResourceChangeEvent event) {
if (event.getType() != IResourceChangeEvent.POST_CHANGE)
return;
IResourceDelta rootDelta = event.getDelta();
try {
final Set<Project> changed = new HashSet<Project>();
rootDelta.accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
try {
IPath location = delta.getResource().getLocation();
if (location == null) {
System.out.println("Cannot convert resource to file: " + delta.getResource());
} else {
File file = location.toFile();
// We now are on project level, we do not go
// deeper
// because projects/workspaces should check for
// any
// changes.
// We are careful not to create unnecessary
// projects
// here.
if (file.getName().equals(Workspace.CNFDIR)) {
if (workspace.refresh()) {
changed.addAll(workspace.getCurrentProjects());
}
return false;
}
if (workspace.isPresent(file)) {
Project project = workspace.getProjectByFile(file);
changed.add(project);
} else {
// Project not created yet, so we
// have
// no cached results
}
return false;
}
return true;
} catch (Exception e) {
e.printStackTrace();
throw new CoreException(new Status(Status.ERROR, BndtoolsConstants.CORE_PLUGIN_ID, "During checking project changes", e));
}
}
});
for (Project p : changed) {
p.refresh();
changed(p);
}
} catch (CoreException e) {
logger.logError("While handling changes", e);
}
}
public static IFile getWorkspaceBuildFile() throws Exception {
File file = Central.getWorkspace().getPropertiesFile();
IFile[] matches = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(file.toURI());
if (matches == null || matches.length != 1) {
logger.logError("Cannot find workspace location for bnd configuration file " + file, null);
return null;
}
return matches[0];
}
public synchronized static WorkspaceR5Repository getWorkspaceR5Repository() throws Exception {
if (r5Repository != null)
return r5Repository;
r5Repository = new WorkspaceR5Repository();
r5Repository.init();
return r5Repository;
}
public synchronized static RepositoryPlugin getWorkspaceRepository() throws Exception {
if (workspaceRepo != null)
return workspaceRepo;
workspaceRepo = new WorkspaceRepository(getWorkspace());
return workspaceRepo;
}
public synchronized static Workspace getWorkspace() throws Exception {
if (instance == null)
throw new IllegalStateException("Central has not been initialised");
if (workspace != null)
return workspace;
Workspace newWorkspace = null;
try {
Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE);
newWorkspace = Workspace.getWorkspace(getWorkspaceDirectory());
newWorkspace.addBasicPlugin(new WorkspaceListener(newWorkspace));
newWorkspace.addBasicPlugin(instance.repoListenerTracker);
newWorkspace.addBasicPlugin(getWorkspaceR5Repository());
// Initialize projects in synchronized block
newWorkspace.getBuildOrder();
// Monitor changes in cnf so we can refresh the workspace
addCnfChangeListener(newWorkspace);
// The workspace has been initialized fully, set the field now
workspace = newWorkspace;
// Call the queued workspace init callbacks
while (!workspaceInitCallbackQueue.isEmpty()) {
Function<Workspace,Void> callback = workspaceInitCallbackQueue.remove(0);
callback.run(workspace);
}
return workspace;
} catch (final Exception e) {
if (newWorkspace != null) {
newWorkspace.close();
}
throw e;
}
}
public synchronized static void onWorkspaceInit(Function<Workspace,Void> callback) {
if (workspace != null)
callback.run(workspace);
else
workspaceInitCallbackQueue.add(callback);
}
private static File getWorkspaceDirectory() throws CoreException {
IWorkspaceRoot eclipseWorkspace = ResourcesPlugin.getWorkspace().getRoot();
IProject cnfProject = eclipseWorkspace.getProject("bnd");
if (!cnfProject.exists())
cnfProject = eclipseWorkspace.getProject("cnf");
if (cnfProject.exists()) {
if (!cnfProject.isOpen())
cnfProject.open(null);
return cnfProject.getLocation().toFile().getParentFile();
}
// Have to assume that the eclipse workspace == the bnd workspace,
// and cnf hasn't been imported yet.
return eclipseWorkspace.getLocation().toFile();
}
private static void addCnfChangeListener(final Workspace workspace) {
ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() {
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (event.getType() != IResourceChangeEvent.POST_CHANGE)
return;
IResourceDelta rootDelta = event.getDelta();
if (isCnfChanged(rootDelta)) {
workspace.refresh();
}
}
});
}
private static boolean isCnfChanged(IResourceDelta delta) {
final AtomicBoolean result = new AtomicBoolean(false);
try {
delta.accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
try {
if (!isChangeDelta(delta))
return false;
IResource resource = delta.getResource();
if (resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT && resource.getName().equals(Workspace.CNFDIR))
return true;
if (resource.getType() == IResource.PROJECT)
return false;
if (resource.getType() == IResource.FOLDER && resource.getName().equals("ext")) {
result.set(true);
return false;
}
if (resource.getType() == IResource.FILE) {
if (Workspace.BUILDFILE.equals(resource.getName())) {
result.set(true);
return false;
}
// Check files included by the -include directive in build.bnd
List<File> includedFiles = workspace.getIncluded();
if (includedFiles == null) {
return false;
}
for (File includedFile : includedFiles) {
IPath location = resource.getLocation();
if (location != null && includedFile.equals(location.toFile())) {
result.set(true);
return false;
}
}
}
return true;
} catch (Exception e) {
throw new CoreException(new Status(Status.ERROR, BndtoolsConstants.CORE_PLUGIN_ID, "During checking project changes", e));
}
}
});
} catch (CoreException e) {
logger.logError("Central.isCnfChanged() failed", e);
}
return result.get();
}
public static boolean isChangeDelta(IResourceDelta delta) {
if (IResourceDelta.MARKERS == delta.getFlags())
return false;
if ((delta.getKind() & (IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED)) == 0)
return false;
return true;
}
public void changed(Project model) {
model.setChanged();
for (ModelListener m : listeners)
try {
m.modelChanged(model);
} catch (Exception e) {
e.printStackTrace();
}
}
public void addModelListener(ModelListener m) {
if (!listeners.contains(m)) {
listeners.add(m);
}
}
public void removeModelListener(ModelListener m) {
listeners.remove(m);
}
public static IJavaProject getJavaProject(Project model) {
for (IProject iproj : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
if (iproj.getName().equals(model.getName())) {
IJavaProject ij = JavaCore.create(iproj);
if (ij != null && ij.exists()) {
return ij;
}
// current project is not a Java project
}
}
return null;
}
public static IPath toPath(File file) throws Exception {
IPath result = null;
File absolute = file.getCanonicalFile();
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
IFile[] candidates = wsroot.findFilesForLocationURI(absolute.toURI());
if (candidates != null && candidates.length > 0) {
result = candidates[0].getFullPath();
} else {
String workspacePath = getWorkspace().getBase().getAbsolutePath();
String absolutePath = absolute.getPath();
if (absolutePath.startsWith(workspacePath))
result = new Path(absolutePath.substring(workspacePath.length()));
}
return result;
}
public static IPath toPathMustBeInEclipseWorkspace(File file) throws Exception {
IPath result = null;
File absolute = file.getCanonicalFile();
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
IFile[] candidates = wsroot.findFilesForLocationURI(absolute.toURI());
if (candidates != null && candidates.length > 0) {
result = candidates[0].getFullPath();
}
return result;
}
public static void refresh(IPath path) {
try {
IResource r = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if (r != null)
return;
IPath p = (IPath) path.clone();
while (p.segmentCount() > 0) {
p = p.removeLastSegments(1);
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(p);
if (resource != null) {
resource.refreshLocal(2, null);
return;
}
}
} catch (Exception e) {
logger.logError("While refreshing path " + path, e);
}
}
public static void refreshPlugins() throws Exception {
List<File> refreshedFiles = new ArrayList<File>();
List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class);
boolean changed = false;
for (Refreshable rp : rps) {
if (rp.refresh()) {
changed = true;
refreshedFiles.add(rp.getRoot());
}
}
//
// If repos were refreshed then
// we should also update the classpath
// containers. We can force this by setting the "bndtools.refresh" property.
//
if (changed) {
try {
for (File file : refreshedFiles) {
refreshFile(file);
}
for (Project p : Central.getWorkspace().getAllProjects()) {
p.setChanged();
for (ModelListener l : getInstance().listeners)
l.modelChanged(p);
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
public static void refreshPlugin(Refreshable plugin) throws Exception {
if (plugin.refresh()) {
refreshFile(plugin.getRoot());
for (Project p : Central.getWorkspace().getAllProjects()) {
p.setChanged();
for (ModelListener l : getInstance().listeners)
l.modelChanged(p);
}
}
}
public static void refreshFile(File f) throws Exception {
String path = toLocal(f);
IResource r = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if (r != null) {
r.refreshLocal(IResource.DEPTH_INFINITE, null);
}
}
public static void refresh(Project p) throws Exception {
IJavaProject jp = getJavaProject(p);
if (jp != null)
jp.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
}
private static String toLocal(File f) throws Exception {
String root = getWorkspace().getBase().getAbsolutePath();
String path = f.getAbsolutePath();
if (path.startsWith(root))
return f.getAbsolutePath().substring(root.length());
return path;
}
public void close() {}
public static void invalidateIndex() {
indexValid.set(false);
}
public static boolean needsIndexing() {
return indexValid.compareAndSet(false, true);
}
public static Map<String,SortedSet<Version>> getExportedPackageModel(IProject project) {
String key = project.getFullPath().toPortableString();
return exportedPackageMap.get(key);
}
public static Collection<String> getContainedPackageModel(IProject project) {
String key = project.getFullPath().toPortableString();
return containedPackageMap.get(key);
}
public static Collection<IResource> getSourceFolderModel(IProject project) {
String key = project.getFullPath().toPortableString();
return sourceFolderMap.get(key);
}
public static void setProjectPackageModel(IProject project, Map<String,SortedSet<Version>> exports, Collection<String> contained, Collection<IResource> sourceFolders) {
String key = project.getFullPath().toPortableString();
exportedPackageMap.put(key, exports);
containedPackageMap.put(key, contained);
if (sourceFolders == null) {
sourceFolderMap.remove(key);
} else {
sourceFolderMap.put(key, sourceFolders);
}
}
public static Project getProject(File projectDir) throws Exception {
File projectDirAbsolute = projectDir.getAbsoluteFile();
assert projectDirAbsolute.isDirectory();
Workspace ws = getWorkspace();
return ws.getProjectByFile(projectDir);
}
public static Project getProject(IProject p) throws Exception {
return getProject(p.getLocation().toFile());
}
}
| [
"dave.smith@candata.com"
] | dave.smith@candata.com |
af2237428b15a1c9f0697a3ca491ce0d6bf4b4c7 | ac875bed8b0cd0789c8dd4d82eaea149b0709e89 | /src/test/java/org/springframework/data/jpa/repository/query/EclipseLinkJpa21UtilsTests.java | aef97aeea8efdda5c7bad03ed31cb6c30c7d2b3a | [
"LicenseRef-scancode-generic-cla"
] | no_license | aatmaca/spring-data-jpa | 75f11c0af2ebff43eca22a2cc11bffd03111a19b | d168e285f980c05e4395bf084d924ca4512cf788 | refs/heads/master | 2021-07-19T10:05:24.295897 | 2017-10-19T12:46:17 | 2017-10-19T13:19:45 | 107,960,129 | 1 | 0 | null | 2017-10-23T09:26:17 | 2017-10-23T09:26:17 | null | UTF-8 | Java | false | false | 889 | java | /*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.jpa.repository.query;
import org.springframework.test.context.ContextConfiguration;
/**
* @author Christoph Strobl
*/
@ContextConfiguration("classpath:eclipselink.xml")
public class EclipseLinkJpa21UtilsTests extends Jpa21UtilsTests {}
| [
"ogierke@pivotal.io"
] | ogierke@pivotal.io |
ade3aff1191bd20a6e942464f41be7fee4505762 | e80c2f3fdb63466c3f8c7ca399445770e6a15d7f | /src/com/kq/flatmap/MyFlatMapDemo.java | 9b2d6eeff1ea4eaa255aa4636c6aa159819315b8 | [] | no_license | kongq1983/java8 | 386d2c2e1d3a39e09ce97991e13e682600b18553 | 409cd50577d59d4f797f80e09eec85e2c87e7759 | refs/heads/master | 2023-05-25T18:06:42.464147 | 2023-05-19T15:51:04 | 2023-05-19T15:51:04 | 130,213,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package com.kq.flatmap;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* MyFlatMapDemo
*
* @author kq
* @date 2019-12-04
*/
public class MyFlatMapDemo {
public static void main(String[] args) {
String[] array1 = {"one","two"};
String[] array2 = {"two","three","five"};
List<Object> list = Stream.of(array1,array2).collect(Collectors.toList());
for(Object o : list) {
System.out.println(o);
}
System.out.println("---------------------------------------");
List<Object> list1 = Stream.of(array1,array2).flatMap(Arrays::stream).collect(Collectors.toList());
for(Object o : list1) {
System.out.println(o);
}
System.out.println("---------------------------------------");
List<Object> list2 = Stream.of(array1,array2).flatMap(Stream::of).collect(Collectors.toList());
for(Object o : list2) {
System.out.println(o);
}
}
}
| [
"king@qq.com"
] | king@qq.com |
8d475f38edff4687eaf62b5d71aa3ffe41b55bfb | a6b3217d403ac063e5371c8c208fe6f1aa391cbb | /framework/webservice/src/test/java/SleepStep.java | 6dd9de0eba9b3cebe8bc15a03b7e8717e2fb1174 | [] | no_license | matskober/pipeline | 999127430a3e44d1f6362db370d141a3df8f30ba | d93a6127df021f45607ebd3e71a16dd46785f576 | refs/heads/nlb | 2022-09-15T22:14:55.398713 | 2019-10-11T09:42:08 | 2019-10-11T09:52:32 | 97,686,130 | 0 | 0 | null | 2017-07-19T07:26:10 | 2017-07-19T07:26:10 | null | UTF-8 | Java | false | false | 1,228 | java | import net.sf.saxon.s9api.QName;
import net.sf.saxon.s9api.SaxonApiException;
import org.daisy.common.xproc.calabash.XProcStepProvider;
import com.xmlcalabash.core.XProcException;
import com.xmlcalabash.core.XProcRuntime;
import com.xmlcalabash.core.XProcStep;
import com.xmlcalabash.library.Identity;
import com.xmlcalabash.runtime.XAtomicStep;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SleepStep extends Identity {
private static final Logger logger = LoggerFactory.getLogger(SleepStep.class);
private static final QName _milliseconds = new QName("milliseconds");
private SleepStep(XProcRuntime runtime, XAtomicStep step) {
super(runtime, step);
}
@Override
public void run() throws SaxonApiException {
Long ms = Long.parseLong(getOption(_milliseconds).getString());
logger.info("{}: going to sleep for {}ms...", this, ms);
try {
Thread.sleep(ms);
} catch (InterruptedException e) {
throw new XProcException(step.getNode(), e);
}
logger.info("{}: woke up", this);
super.run();
}
public static class Provider implements XProcStepProvider {
public XProcStep newStep(XProcRuntime runtime, XAtomicStep step) {
return new SleepStep(runtime, step);
}
}
}
| [
"bertfrees@gmail.com"
] | bertfrees@gmail.com |
b76b70baec7eca385942577c64cdbe65b9a30992 | 0515b3400c84bc4f714aab75cb6b5cec84f209ab | /src/workflow/api/RelationServlet.java | 98371721817f2db5e7ccef01e591602cd075b585 | [] | no_license | Ghostcandywyj/863_framework | 6233e12f774035012a989a259ad19093831d3e6d | d4d52479b5be29ffe945ec67cf04b630d532b1fd | refs/heads/master | 2021-01-18T08:38:38.533766 | 2014-06-09T11:50:29 | 2014-06-09T11:50:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,167 | java | package workflow.api;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import workflow.api.data.RelationGraphEdge;
import workflow.api.data.RelationGraphNode;
import workflow.api.data.UserRelationNode;
import workflow.db.Rating;
import workflow.db.RatingDAO;
import workflow.db.Relationnet;
import workflow.db.RelationnetDAO;
import workflow.db.Relationnetfull;
import workflow.db.RelationnetfullDAO;
import workflow.db.UserDAO;
import db.User;
@SuppressWarnings("unchecked")
public class RelationServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public RelationServlet() {
super();
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req,resp);
}
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
resp.setContentType("text/html;charset=UTF-8");
resp.setHeader("Access-Control-Allow-Origin", "*");
String query=req.getParameter("query");
Long loginId=(Long)req.getSession().getAttribute("userid");
// if(loginId==null){
// resp.getWriter().append(ServletConstants.SESSION_TIMEOUT_ERROR);
// return;
// }
if(query.equals("getAllRelation")){// get relation graph from database
resp.getWriter().append(getRelation());
}else if(query.equals("getTrustValue")){
long trustorId=Long.parseLong(req.getParameter("trustorId"));
long trusteeId=Long.parseLong(req.getParameter("trusteeId"));
resp.getWriter().append(getTrustValue(trustorId,trusteeId));
}
else if(query.equals("getTrustRelation")){//get realtion where user.trustvalue > threshold
long uid=Long.parseLong(req.getParameter("uid"));
float threshold=Float.parseFloat(req.getParameter("threshold"));
resp.getWriter().append(getTrustRelation(uid,threshold));
}else if(query.equals("addRelation")){
long trustorId=Long.parseLong(req.getParameter("trustorId"));
long trusteeId=Long.parseLong(req.getParameter("trusteeId"));
resp.getWriter().append(addRelation(trustorId,trusteeId));
}else if(query.equals("removeRelation")){
long trustorId=Long.parseLong(req.getParameter("trustorId"));
long trusteeId=Long.parseLong(req.getParameter("trusteeId"));
resp.getWriter().append(removeRelation(trustorId,trusteeId));
}
else{
resp.getWriter().append(ServletConstants.UNKOWN_REQUEST_ERROR);
}
resp.getWriter().flush();
resp.getWriter().close();
}
private String getTrustValue(long trustorId, long trusteeId) {
RelationnetDAO rDAO=new RelationnetDAO();
List<Relationnet> rn=rDAO.findByTrustorAndTrusteeId(trustorId, trusteeId);
if(rn.size()!=0)
return rn.get(0).getTrustValue()+"";
else
return 0+"";
}
private String removeRelation(long uid, long trusteeId) {
RelationnetDAO rDAO=new RelationnetDAO();
Session session=rDAO.getSession();
List<Relationnet> rn=rDAO.findByTrustorAndTrusteeId(uid, trusteeId);
if(rn.size()!=0){
Relationnet item=rn.get(0);
Transaction tx=null;
try{
tx=session.beginTransaction();
session.delete(item);
session.flush();
tx.commit();
UserDAO userDAO=new UserDAO();
List<Relationnet> rns= rDAO.findByTrustorId(uid);
List<List<?>> userNames=new ArrayList<List<?>>();
for(Relationnet temp:rns){
User user=userDAO.findById(temp.getTrusteeId());
List<Object> u=new ArrayList<Object>();
u.add(user.getId());
u.add(user.getUsername());
userNames.add(u);
}
JSONArray json=new JSONArray(userNames);
//System.out.println(json.toString());
return json.toString();
}catch(Exception e){
return ServletConstants.ERROR_MSG;
}finally{
session.close( ); // 关闭session
}
}
return ServletConstants.ERROR_MSG;
}
private String addRelation(long uid, long trusteeId) {
RelationnetDAO rDAO=new RelationnetDAO();
Session session=rDAO.getSession();
List<Relationnet> rn=rDAO.findByTrustorAndTrusteeId(uid, trusteeId);
if(rn.size()==0){
Relationnet item=new Relationnet();
item.setTrustorId(uid);
item.setTrusteeId(trusteeId);
item.setTrustValue(1.0f);
Transaction tx=null;
try{
tx=session.beginTransaction();
session.save(item);
session.flush();
tx.commit();
UserDAO userDAO=new UserDAO();
List<Relationnet> rns= rDAO.findByTrustorId(uid);
List<List<?>> userNames=new ArrayList<List<?>>();
for(Relationnet temp:rns){
User user=userDAO.findById(temp.getTrusteeId());
List<Object> u=new ArrayList<Object>();
u.add(user.getId());
u.add(user.getUsername());
userNames.add(u);
}
JSONArray json=new JSONArray(userNames);
//System.out.println(json.toString());
return json.toString();
}catch(Exception e){
return ServletConstants.ERROR_MSG;
}finally{
session.close( ); // 关闭session
}
}
return ServletConstants.ERROR_MSG;
}
private String getTrustRelation(long uid, float threshold) {
RelationnetfullDAO rnfDAO=new RelationnetfullDAO();
RelationnetDAO rnDAO=new RelationnetDAO();
List<Relationnet> rns=rnDAO.findByTrustorId(uid);
List<Relationnetfull> rnfs=rnfDAO.findByTrustorAndThreshold(uid, threshold);
Map<Long,Float> trustee2Rate=new HashMap<Long,Float>();
Map<Long,Float> trustee2Ratefull=new HashMap<Long,Float>();
Set<Long> trusteeSet=new HashSet<Long>();
List<UserRelationNode> result=new ArrayList<UserRelationNode>();
for(Relationnetfull rnf: rnfs){
trusteeSet.add(rnf.getTrusteeId());
trustee2Ratefull.put(rnf.getTrusteeId(),rnf.getTrustValue());
}
for(Relationnet rn:rns){
trusteeSet.add(rn.getTrusteeId());
trustee2Rate.put(rn.getTrusteeId(), rn.getTrustValue());
}
for(long trusteeId: trusteeSet){
UserRelationNode node=new UserRelationNode();
node.setTrustee(trusteeId);
if(trustee2Rate.containsKey(trusteeId))
node.setRate((float)trustee2Rate.get(trusteeId));
else
node.setRate(0);
if(trustee2Ratefull.containsKey(trusteeId))
node.setFullrate((float)trustee2Ratefull.get(trusteeId));
else
node.setFullrate(node.getRate());
result.add(node);
}
List<Relationnet> otherRelation=new ArrayList<Relationnet>();
for(long trusteeId : trusteeSet){
RelationnetDAO relationnetDAO=new RelationnetDAO();
List<Relationnet> rns2=relationnetDAO.findByTrustorId(trusteeId);
for(Relationnet rn2: rns2){
if(trusteeSet.contains(rn2.getTrusteeId()))
otherRelation.add(rn2);
}
}
JSONObject json=new JSONObject();
try {
json.put("relation", result );
json.put("other", otherRelation);
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
private String getRelation() {
RelationnetDAO rnDAO=new RelationnetDAO();
List<Relationnet> relation=rnDAO.findAll();
RatingDAO rDAO=new RatingDAO();
List<Rating> rating=rDAO.findAll();
Set<Long> userSet=new HashSet<Long>();
Set<Long> wsSet=new HashSet<Long>();
List<RelationGraphNode> nodes=new ArrayList<RelationGraphNode>();
List<RelationGraphEdge> edges=new ArrayList<RelationGraphEdge>();
Map<Long,Long> user2Id=new HashMap<Long,Long>();
Map<Long,Long> ws2Id=new HashMap<Long,Long>();
for(Relationnet r: relation){
userSet.add(r.getTrustorId());
userSet.add(r.getTrusteeId());
}
for(Rating r: rating){
userSet.add(r.getUserId());
wsSet.add(r.getWsId());
}
long count=0;
for(long uid: userSet){
RelationGraphNode rgn=new RelationGraphNode();
rgn.setId(count);
rgn.setName(uid);
rgn.setUser(true);
nodes.add(rgn);
user2Id.put(uid, count);
count++;
}
for(long wsid: wsSet){
RelationGraphNode rgn=new RelationGraphNode();
rgn.setId(count);
rgn.setName(wsid);
rgn.setUser(false);
nodes.add(rgn);
ws2Id.put(wsid, count);
count++;
}
for(Relationnet r: relation){
RelationGraphEdge edge=new RelationGraphEdge();
edge.setSource(user2Id.get(r.getTrustorId()));
edge.setTarget(user2Id.get(r.getTrusteeId()));
edge.setWeight(r.getTrustValue());
edges.add(edge);
}
for(Rating r: rating){
RelationGraphEdge edge=new RelationGraphEdge();
edge.setSource(user2Id.get(r.getUserId()));
edge.setTarget(ws2Id.get(r.getWsId()));
edge.setWeight(r.getRateValue());
edges.add(edge);
}
JSONObject json=new JSONObject();
try {
json.put("nodes", nodes);
json.put("edges", edges);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return json.toString();
}
}
| [
"mzyuan90@gmail.com"
] | mzyuan90@gmail.com |
8afa19ed5c9779619a45bb7520fd73d3eab43a76 | a56a4405a803b76fe5f1eb398cffa375ccda25b8 | /upc-manager/src/main/java/org/hanzhdy/manager/upc/mapper/DictTypeMapper.java | 919089236fd34db755a2fb73123fc982cd365d75 | [] | no_license | icedorange/UPCenter | 09478bd61d2d33161adf337b210133c0135069df | 4cedd0ca9d81d854015345ab1707d2be55192913 | refs/heads/master | 2021-01-23T16:06:34.292968 | 2017-07-20T03:21:26 | 2017-07-20T03:21:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,388 | java | package org.hanzhdy.manager.upc.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.hanzhdy.manager.upc.model.DictType;
import org.hanzhdy.manager.upc.model.DictTypeExample;
public interface DictTypeMapper {
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int countByExample(DictTypeExample example);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int deleteByExample(DictTypeExample example);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int deleteByPrimaryKey(Long id);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int insert(DictType record);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int insertSelective(DictType record);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
List<DictType> selectByExample(DictTypeExample example);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
DictType selectByPrimaryKey(Long id);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int updateByExampleSelective(@Param("record") DictType record, @Param("example") DictTypeExample example);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int updateByExample(@Param("record") DictType record, @Param("example") DictTypeExample example);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int updateByPrimaryKeySelective(DictType record);
/**
* 本段代码由Mybatis Generator自动生成.
* 映射数据库: s_dicttype
* @author MyBatis Generator
*/
int updateByPrimaryKey(DictType record);
} | [
"hanzhdy@163.com"
] | hanzhdy@163.com |
d7d75ed1b9d59aa43ac9aee1494488034c923993 | 0e6a202fb2a7d2e8fcecc7bbd3abe840ceae6669 | /DataStructureInJava/com/oops/polymorphism/Dog.java | 4451251ce3811ad7dbfac0e5d11110eefdcaa193 | [] | no_license | sumanvashishth/javaprjct | 878f4d8a7e587306cd3b7a96f01f57a4d854aae7 | 818438cfbfe17456ab02cd46bb06a2596c0cd23b | refs/heads/master | 2022-12-13T12:38:15.130990 | 2020-08-26T07:40:22 | 2020-08-26T07:40:22 | 290,428,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.oops.polymorphism;
public class Dog extends Pet{
String name = "Milo";
public void walk() {
System.out.println("Dog is walking");
}
}
| [
"suman.vashishth@gmail.com"
] | suman.vashishth@gmail.com |
ba35178b905ecebb1fb036fcd958141f3ce803f2 | 41b1d16a45669c3e053d2148f0f302e412267c02 | /src/main/java/com/java/concurrency/annotations/ThreadSafe.java | 614196a9ed745d9910a8c0d566fff27a7dd27e67 | [
"Apache-2.0"
] | permissive | hbheyho/ConcurrentLearning | e840def69e48b0ca1192f399db0d9819ecb40862 | 69e9ffa15fc04f24adabd00272b68bf2081a4f43 | refs/heads/master | 2023-01-07T07:24:35.761282 | 2020-11-10T14:33:18 | 2020-11-10T14:33:18 | 300,902,317 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.java.concurrency.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Author: HB
* @Description: 注解类 => 用来标注线程安全
* @CreateDate: 10:47 2020/10/5
*/
// Target => 注解作用的目标. ElementType.TYPE => 类, 代表注解作用在Class, enum, interface 上
@Target(ElementType.TYPE)
// Retention => 注解存在的范围, RetentionPolicy.SOURCE => 在编译的时候会被忽略. 除此之外, 还有CLASS, RUNTIME
@Retention(RetentionPolicy.SOURCE)
public @interface ThreadSafe {
// 注解默认值为 "", 可通过 @ThreadSafe(value="xx") 设置注解值
String value() default "";
}
| [
"hbheyhoo@163.com"
] | hbheyhoo@163.com |
df526033cc85e7520290b86605de95e49e5eb77b | e68b73dbc38524e72fdf31e3306ed50b7e738854 | /src/com/sinotrans/gd/wlp/system/service/impl/SysOfficeManagerImpl.java | d1cb4c5ab7845e88b6b00341a6bd972eff6cb960 | [] | no_license | wenzhixin123/wr-brk | 3930d20e80e935c0dbd248204cf2c2d6baee5450 | 0acedb9f99c1726a1f8da77208a329728e57748c | refs/heads/master | 2021-07-20T23:41:37.051911 | 2017-10-24T07:48:48 | 2017-10-24T07:49:26 | 108,091,431 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,796 | java | package com.sinotrans.gd.wlp.system.service.impl;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sinotrans.framework.core.exception.ApplicationException;
import com.sinotrans.framework.core.model.BaseModel;
import com.sinotrans.framework.core.service.impl.BaseManagerImpl;
import com.sinotrans.framework.core.util.ContextUtils;
import com.sinotrans.gd.wlp.common.entity.BasOption;
import com.sinotrans.gd.wlp.common.service.LogisticsOrderManager;
import com.sinotrans.gd.wlp.common.web.RcUtil;
import com.sinotrans.gd.wlp.system.entity.OfficeTree;
import com.sinotrans.gd.wlp.system.entity.SessionContextUserEntity;
import com.sinotrans.gd.wlp.system.model.SysOfficeModel;
import com.sinotrans.gd.wlp.system.service.SysOfficeManager;
import com.sinotrans.gd.wlp.util.CommonUtil;
import com.sinotrans.gd.wlp.util.JsonUtil;
import com.sinotrans.gd.wlp.util.OfficeCodeTypeEnum;
import com.sinotrans.gd.wlp.util.StringUtil;
import edu.emory.mathcs.backport.java.util.Collections;
@Service
public class SysOfficeManagerImpl extends BaseManagerImpl implements
SysOfficeManager {
@Autowired
private LogisticsOrderManager logisticsOrderManager;
public SysOfficeModel get(String id) {
return this.dao.get(SysOfficeModel.class, id);
}
public List<SysOfficeModel> getAll() {
return this.dao.getAll(SysOfficeModel.class);
}
public List<SysOfficeModel> findByExample(SysOfficeModel example) {
return this.dao.findByExample(example);
}
public SysOfficeModel save(SysOfficeModel model) {
return this.dao.save(model);
}
public List<SysOfficeModel> saveAll(Collection<SysOfficeModel> models) {
return this.dao.saveAll(models);
}
public void remove(SysOfficeModel model) {
this.dao.remove(model);
}
public void removeAll(Collection<SysOfficeModel> models) {
this.dao.removeAll(models);
}
public void removeByPk(String id) {
this.dao.removeByPk(SysOfficeModel.class, id);
}
public void removeAllByPk(Collection<String> ids) {
this.dao.removeAllByPk(SysOfficeModel.class, ids);
}
public List<BasOption> getOption(String code, String officeCode,
String language) {
List<BasOption> optionList = new ArrayList<BasOption>();
List<SysOfficeModel> bcmList = this.getAll();
for (SysOfficeModel c : bcmList) {
BasOption wo = new BasOption();
wo.setKey(c.getOfficeUuid());
wo.setValue(c.getOfficeName());
optionList.add(wo);
}
return optionList;
}
/*
* 查询出树形结构列表(id:officeUuid、) (non-Javadoc)
*
* @see com.sinotrans.gd.wlp.system.service.SysOfficeManager#getOfficetree()
*/
public List<OfficeTree> getOfficetree() {
List<SysOfficeModel> allOffice = this.getAll();
List<OfficeTree> resultList = new ArrayList<OfficeTree>();
for (SysOfficeModel allOM : allOffice) {
if (allOM.getStatus() != null && !allOM.getStatus().equals("")
&& allOM.getStatus().equals(CommonUtil.Active)) {// 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
OfficeTree ot = new OfficeTree();
String officeId = allOM.getOfficeUuid();
ot.setId(allOM.getOfficeUuid());
ot.setText(allOM.getOfficeName());
ot.setChildren(recursive(officeId, allOffice));// 循环看看它是否有子节点
if (RcUtil.isEmpty(allOM.getPreOfficeUuid())) {// 根节点
ot.setId(allOM.getOfficeUuid());
ot.setText(allOM.getOfficeName());
resultList.add(ot);
}
}
}
return resultList;
}
/*
* 查询出树形结构列表(暂时测试中。。。) (non-Javadoc)
*
* @see com.sinotrans.gd.wlp.system.service.SysOfficeManager#getOfficetree()
*/
// public List<OfficeTree> getOfficetree(String officeCode) {
// // SysOfficeModel so = new SysOfficeModel();
// // so.setOfficeCode(officeCode);
// List<SysOfficeModel> allOffice = this.getAll();
// List<OfficeTree> resultList = new ArrayList<OfficeTree>();
// for (SysOfficeModel allOM : allOffice) {
// if (allOM.getStatus() != null && !allOM.getStatus().equals("")
// && allOM.getStatus().equals(CommonUtil.Active)){//
// 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
// OfficeTree ot = new OfficeTree();
// String officeId = allOM.getOfficeUuid();
// ot.setId(allOM.getOfficeUuid());
// ot.setText(allOM.getOfficeName());
// ot.setChildren(recursive(officeId, allOffice));// 循环看看它是否有子节点
// if (RcUtil.isEmpty(allOM.getPreOfficeUuid())) {// 根节点
// ot.setId(allOM.getOfficeUuid());
// ot.setText(allOM.getOfficeName());
// resultList.add(ot);
// }
// }
// }
// return resultList;
// }
/*
* 查询出部门树形列表(id:OfficeCode、text:name) (non-Javadoc)
*
* @see com.sinotrans.gd.wlp.system.service.SysOfficeManager#getOfficeCode()
*/
public List<OfficeTree> getOfficeCode() {
List<SysOfficeModel> allOffice = this.getAll();
List<OfficeTree> resultList = new ArrayList<OfficeTree>();
for (SysOfficeModel allOM : allOffice) {
OfficeTree ot = new OfficeTree();
String officeId = allOM.getOfficeUuid();
ot.setId(officeId);
ot.setText(allOM.getOfficeName());
ot.setChildren(recursive(officeId, allOffice));// 循环看看它是否有子节点
if (RcUtil.isEmpty(allOM.getPreOfficeUuid())) {// 根节点
ot.setId(officeId);
ot.setText(allOM.getOfficeName());
resultList.add(ot);
}
}
return resultList;
}
/*
* 查询出部门树形列表(id:OfficeCode、text:name) (non-Javadoc)
*
* @see com.sinotrans.gd.wlp.system.service.SysOfficeManager#getOfficeCode()
*/
public List<OfficeTree> getOfficeCodetree() {
List<SysOfficeModel> allOffice = this.getAll();
List<OfficeTree> resultList = new ArrayList<OfficeTree>();
for (SysOfficeModel allOM : allOffice) {
OfficeTree ot = new OfficeTree();
String officeId = allOM.getOfficeUuid();
ot.setId(allOM.getOfficeCode());
ot.setText(allOM.getOfficeName());
ot.setChildren(recursivetree(officeId, allOffice));// 循环看看它是否有子节点
if (RcUtil.isEmpty(allOM.getPreOfficeUuid())) {// 根节点
ot.setId(allOM.getOfficeCode());
ot.setText(allOM.getOfficeName());
resultList.add(ot);
}
}
return resultList;
}
/**
* 循环递归 部门信息
*
* @param officeId
* @param allOffice
* @return
*/
private List<OfficeTree> recursivetree(String officeId,
List<SysOfficeModel> allOffice) {
List<OfficeTree> subOfficeList = new ArrayList<OfficeTree>();
for (SysOfficeModel som : allOffice) {
if (officeId.equals(som.getPreOfficeUuid())) {
if (som.getStatus() != null && !som.getStatus().equals("")
&& som.getStatus().equals(CommonUtil.Active)) { // 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
OfficeTree ot = new OfficeTree();
String subOfficeId = som.getOfficeUuid();
ot.setId(som.getOfficeCode());
ot.setText(som.getOfficeName());
ot.setChildren(recursivetree(subOfficeId, allOffice));
subOfficeList.add(ot);
}
}
}
return subOfficeList;
}
/**
* 循环递归 部门信息
*
* @param officeId
* @param allOffice
* @return
*/
private List<OfficeTree> recursive(String officeId,
List<SysOfficeModel> allOffice) {
List<OfficeTree> subOfficeList = new ArrayList<OfficeTree>();
for (SysOfficeModel som : allOffice) {
if (officeId.equals(som.getPreOfficeUuid())&&!officeId.equals(som.getOfficeUuid())) {
if (som.getStatus() != null && !som.getStatus().equals("")
&& som.getStatus().equals(CommonUtil.Active)) { // 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
OfficeTree ot = new OfficeTree();
String subOfficeId = som.getOfficeUuid();
// ot.setId(som.getOfficeCode());
ot.setId(subOfficeId);
ot.setText(som.getOfficeName());
ot.setChildren(recursive(subOfficeId, allOffice));
subOfficeList.add(ot);
}
}
}
//子组织排序
if(subOfficeList.size()>0){
boolean needSort = true;
for(OfficeTree officeSon:subOfficeList){
if(officeSon.getChildren()!=null&&officeSon.getChildren().size()>0){
needSort = false;
}
}
if(needSort){
Collections.sort(subOfficeList, new Comparator() {
public int compare(Object a, Object b) {
String one = ((OfficeTree)a).getText();
String two = ((OfficeTree)b).getText();
return Collator.getInstance(Locale.CHINESE).compare(one, two);
}
});
}
}
return subOfficeList;
}
/**
* 用于在编辑页面验证组织机构代码是否重复
*
* @param officeCode
* @return 返回 true 为已存在
*/
@Override
public boolean getYanZhenUserCode(String officeCode) {
SysOfficeModel office = new SysOfficeModel();
office.setOfficeCode(StringUtil.toTrim(officeCode));
List<SysOfficeModel> officeList = this.findByExample(office);
if (officeList.size() > 0) {
return true;
} else {
return false;
}
}
/*
* 保存 (non-Javadoc)
*
* @see
* com.sinotrans.gd.wlp.system.service.SysOfficeManager#savaOfficeModel(
* java.lang.String)
*/
@Override
public String savaOfficeModel(String Officeitemjson) {
Officeitemjson=logisticsOrderManager.getBase642Ojbect(Officeitemjson);
SysOfficeModel sysOfficeModel = (SysOfficeModel) JsonUtil.jsonToBean(
Officeitemjson, SysOfficeModel.class);
if (getYanZhenUserCode(sysOfficeModel.getOfficeCode())) {
sysOfficeModel.setRowState(BaseModel.ROW_STATE_MODIFIED);
} else {
sysOfficeModel.setRowState(BaseModel.ROW_STATE_ADDED);
}
ContextUtils.getBeanOfType(SysOfficeManager.class).save(sysOfficeModel);
return null;
}
/**
* 根据OfficeCode查询该组织机构的UUID
*
* @param officeCode
* @return
*/
@Override
public String getOfficeOofficeCodeModel(String officeCode) {
SysOfficeModel office = new SysOfficeModel();
office.setOfficeCode(officeCode.trim());
office.setStatus(CommonUtil.Active);
List<SysOfficeModel> officeList = this.findByExample(office);
if (officeList != null && officeList.size() > 0) {
SysOfficeModel syoOff = officeList.get(0);
return syoOff.getOfficeUuid();
} else {
throw new ApplicationException("未获取到相应的组织机构对象!");
}
}
/**
* 根据OfficeCode查询该组织机构的name
*
* @param officeCode
* @return
*/
@Override
public String getOfficeCodereturnCodename(String officeCode) {
SysOfficeModel office = new SysOfficeModel();
office.setOfficeCode(officeCode.trim());
office.setStatus(CommonUtil.Active);
List<SysOfficeModel> officeList = this.findByExample(office);
if (officeList != null && officeList.size() > 0) {
SysOfficeModel syoOff = officeList.get(0);
return syoOff.getOfficeName();
} else {
throw new ApplicationException("未获取到相应的组织机构对象!");
}
}
public void getOffficeCodeTree(String officeCode) {
// List<SysOfficeModel> sysOffList = new ArrayList<SysOfficeModel>();
// sysOffList = this.getAll();
// for (SysOfficeModel sysOfficeModel : sysOffList) {
//
// }
}
/**
* 提供用户管理页面列表使用的组织机构名称显示
*
* @param officeCode
* @param status
*/
public List<SysOfficeModel> getOfficeUserList(String officeCode,
String status) {
SysOfficeModel office = new SysOfficeModel();
if (officeCode != null)
office.setOfficeCode(officeCode);
if (status != null)
office.setStatus(status);
List<SysOfficeModel> officeList = this.findByExample(office);
return officeList;
}
/*
* 根据节点查找父类测试中.........
*/
public List<OfficeTree> getOfficetree(String officeCode) {
List<SysOfficeModel> allOffice = this.getAll();
SysOfficeModel code = new SysOfficeModel();
code.setOfficeCode(officeCode);
List<SysOfficeModel> officecode = this.findByExample(code);
List<OfficeTree> resultList = new ArrayList<OfficeTree>();
for (SysOfficeModel allOM : officecode) {
String PreOfficeUuid = allOM.getPreOfficeUuid();
String OfficeUuid = allOM.getOfficeUuid();
String OfficeName = allOM.getOfficeName();
OfficeTree ot = new OfficeTree();
ot.setId(OfficeUuid);
ot.setText(OfficeName);
resultList.add(ot);
resultList = recursive2(resultList, PreOfficeUuid, allOffice);
}
return resultList;
}
/**
* 循环递归 查找父类
*
* @param officeId
* @param allOffice
* @return
*/
private List<OfficeTree> recursive2(List<OfficeTree> resultList,
String ProvinceCode, List<SysOfficeModel> allOffice) {
List<OfficeTree> subOfficeList = new ArrayList<OfficeTree>();
for (SysOfficeModel som : allOffice) {
if (ProvinceCode.equals(som.getOfficeUuid())) {
if (som.getStatus() != null && !som.getStatus().equals("")
&& som.getStatus().equals(CommonUtil.Active)) { // 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
OfficeTree ot = new OfficeTree();
String subOfficeId = som.getOfficeUuid();
String PreOffice = som.getPreOfficeUuid();
ot.setId(subOfficeId);
ot.setText(som.getOfficeName());
ot.setChildren(resultList);
subOfficeList.add(ot);
if (PreOffice != null) {
subOfficeList = recursive2(subOfficeList, PreOffice,
allOffice);
log.debug("subOfficeList:"
+ JsonUtil.list2Json(subOfficeList));
}
}
}
}
return subOfficeList;
}
/*
* 根据节点查找父类与子类测试中.........
*/
public List<OfficeTree> getUserOfficetree(String officeCode) {
List<SysOfficeModel> allOffice = this.getAll();
SysOfficeModel code = new SysOfficeModel();
code.setOfficeCode(officeCode);
List<SysOfficeModel> officecode = this.findByExample(code);
List<OfficeTree> resultList = new ArrayList<OfficeTree>();
for (SysOfficeModel allOM : officecode) {
String PreOfficeUuid = allOM.getPreOfficeUuid();
String OfficeUuid = allOM.getOfficeUuid();
String OfficeName = allOM.getOfficeName();
OfficeTree ot = new OfficeTree();
ot.setId(OfficeUuid);
ot.setText(OfficeName);
ot.setChildren(recursive4(OfficeUuid, allOffice));
resultList.add(ot);
resultList = recursive3(resultList, PreOfficeUuid, allOffice);
}
return resultList;
}
/**
* 循环递归 查找父类
*
* @param officeId
* @param allOffice
* @return
*/
private List<OfficeTree> recursive3(List<OfficeTree> resultList,
String ProvinceCode, List<SysOfficeModel> allOffice) {
List<OfficeTree> subOfficeList = new ArrayList<OfficeTree>();
for (SysOfficeModel som : allOffice) {
if (ProvinceCode.equals(som.getOfficeUuid())) {
if (som.getStatus() != null && !som.getStatus().equals("")
&& som.getStatus().equals(CommonUtil.Active)) { // 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
OfficeTree ot = new OfficeTree();
String subOfficeId = som.getOfficeUuid();
String PreOffice = som.getPreOfficeUuid();
ot.setId(subOfficeId);
ot.setText(som.getOfficeName());
ot.setChildren(resultList);
subOfficeList.add(ot);
if (PreOffice != null) {
subOfficeList = recursive3(subOfficeList, PreOffice,
allOffice);
log.debug("subOfficeList:"
+ JsonUtil.list2Json(subOfficeList));
}
}
}
}
return subOfficeList;
}
/**
* 循环递归 查找子类
*
* @param officeId
* @param allOffice
* @return
*/
private List<OfficeTree> recursive4(String officeId,
List<SysOfficeModel> allOffice) {
List<OfficeTree> subOfficeList = new ArrayList<OfficeTree>();
for (SysOfficeModel som : allOffice) {
if (officeId.equals(som.getPreOfficeUuid())&&!officeId.equals(som.getOfficeUuid())) {
if (som.getStatus() != null && !som.getStatus().equals("")
&& som.getStatus().equals(CommonUtil.Active)) { // 此处判断是否状态为有效。作废或者草稿数据是不能被显示的
OfficeTree ot = new OfficeTree();
String subOfficeId = som.getOfficeUuid();
ot.setId(subOfficeId);
ot.setText(som.getOfficeName());
ot.setChildren(recursive4(subOfficeId, allOffice));
subOfficeList.add(ot);
}
}
}
return subOfficeList;
}
/*
* 根据节点查找父节点 office code
*/
public String getPreOfficeCode(String officeCode) {
if (StringUtil.isNull(officeCode)) {
return "";
}
List<SysOfficeModel> allOffice = this.getAll();
for (SysOfficeModel allOM : allOffice) {
if (officeCode.equals(allOM.getOfficeCode())) {
String uuid = allOM.getPreOfficeUuid();
if (uuid == null) {
return "";
}
for (SysOfficeModel model : allOffice) {
if (uuid.equals(model.getOfficeUuid())) {
return model.getOfficeCode();
}
}
}
}
return "";
}
@Override
public boolean isMatchOfficeCodeType(OfficeCodeTypeEnum octe)throws Exception {
String userOfficeCode = SessionContextUserEntity.currentUser().getOfficeCode();
String id = getOfficeOofficeCodeModel(userOfficeCode);
SysOfficeModel model = this.get(id);
if(model.getIsInternal() != null){
OfficeCodeTypeEnum currentEnum = OfficeCodeTypeEnum.getEnum(model.getIsInternal().toString());
if(currentEnum.equals(octe)){
return true;
}else{
return false;
}
}else{
return false;
}
}
@Override
public boolean isMatchOfficeCodeTypeByString(String enumVlue)throws Exception {
OfficeCodeTypeEnum e = OfficeCodeTypeEnum.getEnum(enumVlue);
boolean isMatch = false;
try { isMatch=this.isMatchOfficeCodeType(e);}
catch (Exception e2) {
e2.printStackTrace();
}
return isMatch;
}
}
| [
"1239095396@qq.com"
] | 1239095396@qq.com |
7d4d9983c594791543b1ff104f1529951586599f | 8b7e0d1c54d5a44269e5fbd5fa31dbdfb0c83678 | /Clothe Me/src/Items/Jacket.java | e14226566ddaa9bcf1c47b883e4a029f6040fb9f | [] | no_license | Viaaaron/Clothe-Me | 938f73c732938eb904039cfca1cd3f1fcdcd1c1a | d48d5b4ff85d17d1173f58879403e210124871ab | refs/heads/master | 2020-04-10T14:40:27.230812 | 2018-12-14T17:29:26 | 2018-12-14T17:29:26 | 161,083,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package Items;
import java.util.Random;
public class Jacket {
public void jacket() {
Random rand = new Random();
int jacketNumber = rand.nextInt(6) + 1;
switch (jacketNumber) {
case 1:
System.out.println("Jacket: Adidas Blue");
break;
case 2:
System.out.println("Jacket: Adidas Black");
break;
case 3:
System.out.println("Jacket: White polo");
break;
case 4:
System.out.println("Jacket: Arc' Terx");
break;
case 5:
System.out.println("Jacket: Black Parka");
break;
case 6:
System.out.println("Jacket: Green zip");
break;
}
}
}
| [
"Viaaaron@gmail.com"
] | Viaaaron@gmail.com |
671d0937885fe67aadcbc9c57427718c6365931b | cfafebee95b0e1ddc50c9e1edded3e3ee89b8cae | /servers/src/main/java/com/dreamy/enums/IndexRankEnums/net/NetActivityRandEnums.java | 1410dcc5b157c75359163afdf609df079322ce3d | [] | no_license | dreamyteam/dreamy_ip | 88bc1b006abb5f1489ac6e70a8aa0969f18fb498 | b7a1abf3dadaab94f6de901d98f884f03ca158e0 | refs/heads/master | 2021-01-21T04:41:07.791275 | 2016-06-23T07:17:42 | 2016-06-23T07:17:42 | 55,125,586 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,234 | java | package com.dreamy.enums.IndexRankEnums.net;
/**
* Created with IntelliJ IDEA.
* User: yujianfu (mr.vencnet@gmail.com)
* Date: 16/6/17
* Time: 上午10:16
*/
public enum NetActivityRandEnums {
level_1(0, 5000, 1000),
level_2(5001, 10000, 2000),
level_3(10001, 50000, 3000),
level_4(50001, 100000, 4000),
level_5(100001, 200000, 5000),
level_6(200001, 500000, 6000),
level_7(500001, 1000000, 7000),
level_8(1000001, 10000000, 8000),
level_9(10000001, 50000000, 9000),
level_10(50000001, 100000000, 9500),
level_11(100000001, 1000000000, 10000);
private Integer start;
private Integer end;
private Integer score;
NetActivityRandEnums(Integer start, Integer end, Integer score) {
this.start = start;
this.end = end;
this.score = score;
}
public Integer getStart() {
return start;
}
public void setStart(Integer start) {
this.start = start;
}
public Integer getEnd() {
return end;
}
public void setEnd(Integer end) {
this.end = end;
}
public Integer getScore() {
return score;
}
public void setScore(Integer score) {
this.score = score;
}
}
| [
"jeff@dreamy.live"
] | jeff@dreamy.live |
03cdf79e421fefb9c7e65b257398e2cec713e65c | 173a09e5534d22c963dfdeada415dbc31404c41b | /CharTest.java | 7e65376c7e058190e88793f87068b1b5b154a395 | [] | no_license | soohomoon/test_0802_project | e7c28470fcee2d6de03e84e6ff6b22409dcb923b | cb1c3e41a938c8bee4e2d146ea605e7b32b4c74f | refs/heads/master | 2020-06-28T04:11:32.690544 | 2019-10-04T06:01:40 | 2019-10-04T06:01:40 | 200,139,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package ch0_OT;
public class CharTest {
public static void main(String[] args) {
char c1 = 'A';
char c2 = '\u0041';
System.out.println("print latter : " + c1 + '\t' + c2 + '\n');
int i = c1 +1;
System.out.println(i);
System.out.println((char)i);
boolean b1 = true;
if(b1) {
System.out.println("true");
}else {
System.out.println("false");
}
}
}
| [
"demowin@gmail.com"
] | demowin@gmail.com |
f60b98c1c196fa1ad68299d066ff438a161572a5 | 2cd89e80fc6415330e80368e421b56cbd64613f4 | /vlilibrary/src/androidTest/java/com/vannv83/vlilibrary/ExampleInstrumentedTest.java | 57e372592b888256f0510444a8dcf707b629b757 | [] | no_license | vannv83/prebidcore | 15b37350d2f66faf842d23304735a055d781919f | 7e3a288da5d9e0834d332c4d302e43b0ee613a4f | refs/heads/master | 2022-06-13T22:14:04.841706 | 2020-05-04T10:42:57 | 2020-05-04T10:42:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package com.vannv83.vlilibrary;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.vannv83.vlilibrary.test", appContext.getPackageName());
}
}
| [
"phongvan0128@gmail.com"
] | phongvan0128@gmail.com |
cd87297efbde636c812c5be38a1af52c2d6fb55f | 81b77700cfa76121dc0b4dac3618625e3a1f0368 | /family_service_platform/src/main/java/com/bayu/service/base/TblDeptService.java | 17554745e8c9475d1c2298f99e6ace9777465c2f | [] | no_license | jiajizhou02/bayu | d6ab250fa50f1aa2c9a330d218c3ff3ad33e66c1 | 4d8c19bc6569648c4cc0173ba3035852c375fc83 | refs/heads/master | 2023-02-05T16:39:22.679090 | 2020-12-23T04:00:21 | 2020-12-23T04:00:21 | 323,508,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.bayu.service.base;
import com.bayu.bean.TblDept;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 部门信息表 服务类
* </p>
*
* @author lian
* @since 2020-10-22
*/
public interface TblDeptService extends IService<TblDept> {
}
| [
"zhou1"
] | zhou1 |
bc0737fbf844db61d61a9ff6b3012682a3966418 | bc32b125f09b4f4e3e35d3281497df779f045c60 | /Ajedrez/sources/ajedrez/Peon.java | c545795a254f6619c133b4210f1aad5b63647e01 | [] | no_license | Ghazj/Ajedrez | d4f3328d16361aaf5f0637473701d87a2d462fa0 | ed69f386e31c97b18d191a37a4db5e1256a88515 | refs/heads/master | 2020-08-07T01:26:39.123371 | 2019-10-10T22:00:08 | 2019-10-10T22:00:08 | 213,240,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package ajedrez;
public class Peon extends Pieza {
public Peon(String color) {
this.nombre = "Peon";
this.valor = 1;
this.color = color;
estado = true;
}
}
| [
"Marquett@Marquett-PC"
] | Marquett@Marquett-PC |
10921f33f76b1a6de47bd9fbae9748ce68adfa8e | 2ccaba1890e3fd697145e90baa129526a6ead428 | /src/main/java/com/pnpinfos/herbalclinic/web/rest/errors/BadRequestAlertException.java | e36e02c38823063a0566bf6fee6104527b239513 | [] | no_license | stevexu01/herbal-clinic-ng | ca0358655bab31f7465c86a8804600fabfa6738b | 7bc5d9af069ab812ad09147b5c28c460e9366c5c | refs/heads/master | 2022-12-25T08:09:24.315020 | 2020-02-22T01:05:33 | 2020-02-22T01:05:33 | 230,025,109 | 0 | 1 | null | 2022-12-16T04:43:01 | 2019-12-25T01:52:17 | Java | UTF-8 | Java | false | false | 1,328 | java | package com.pnpinfos.herbalclinic.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
public class BadRequestAlertException extends AbstractThrowableProblem {
private static final long serialVersionUID = 1L;
private final String entityName;
private final String errorKey;
public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) {
this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey);
}
public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) {
super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey));
this.entityName = entityName;
this.errorKey = errorKey;
}
public String getEntityName() {
return entityName;
}
public String getErrorKey() {
return errorKey;
}
private static Map<String, Object> getAlertParameters(String entityName, String errorKey) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("message", "error." + errorKey);
parameters.put("params", entityName);
return parameters;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
671425db67c314fc01f046f0da0756324744eb1a | be0cd81ce58cd00f3f7c6ebab975cc388755e809 | /rabbitmq-producer/src/test/java/com/xuecheng/test/rabbitmq/ProducerDemo1.java | f1b7d59447fa0dda7daea7c457b5709047c27ca9 | [] | no_license | xq1005440136/xczx_service | a1621cf8e26392b17b1f8fdcc098924b1e6d6b91 | 05741aeeebd25c6788ecaef5fb0e2f3df992d4c4 | refs/heads/master | 2022-11-28T18:42:58.087016 | 2020-01-07T12:53:39 | 2020-01-07T12:53:39 | 229,425,894 | 0 | 0 | null | 2022-11-24T06:27:19 | 2019-12-21T12:42:49 | Java | UTF-8 | Java | false | false | 2,604 | java | package com.xuecheng.test.rabbitmq;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
public class ProducerDemo1 {
private static final String QUEUE="hello,rabbitmq";
public static void main(String[] args) throws IOException, TimeoutException {
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost("127.0.0.1");
connectionFactory.setPort(5672);
connectionFactory.setUsername("guest");
connectionFactory.setPassword("guest");
connectionFactory.setVirtualHost("/");// 设置虚拟机
Connection connection =null;
Channel channel=null;
try {
//建立新连接
connection=connectionFactory.newConnection();
// 创建通道
channel= connection.createChannel();
/**
* 声明队列,如果Rabbit中没有此队列将自动创建
* param1:队列名称
* param2:是否持久化
* param3:队列是否独占此连接
* param4:队列不再使用时是否自动删除此队列
* param5:队列参数
*/
channel.queueDeclare(QUEUE,true,false,false,null);
String message = "hello,xiaoqiang";
/**
* 消息发布方法
* param1:Exchange的名称,如果没有指定,则使用Default Exchange
* param2:routingKey,消息的路由Key,是用于Exchange(交换机)将消息转发到指定的消息队列
* param3:消息包含的属性
* param4:消息体
*/
channel.basicPublish("",QUEUE,null,message.getBytes());
System.out.println("Send Message is:'" + message +"'");
} catch (IOException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
} finally {
if(channel!=null){
channel.close();
}
if(connection!=null){
connection.close();
}
}
}
}
| [
"782005363@qq.com"
] | 782005363@qq.com |
4e70ffbaf3739c34f2ad951d5915aab4079ef347 | bcb24056fde2cb3915508e210250fba1e29bd113 | /2.JavaCore/src/com/javarush/task/task18/task1809/Solution.java | f3d07b18c122cc9859d77a43246214c26451d0b3 | [] | no_license | s3rji/JavaRush | fd8ba2ac8a1b5984813508f695302185a265b5bf | 8ce3a54e89ec0e8ccae4ae6c5598017ed8954abe | refs/heads/master | 2023-07-17T01:43:47.525951 | 2021-08-26T19:01:22 | 2021-08-26T19:01:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package com.javarush.task.task18.task1809;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/*
Реверс файла
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner reader = new Scanner(System.in);
String fileSource = reader.nextLine();
String fileDest = reader.nextLine();
try (FileInputStream sourceReader = new FileInputStream(fileSource);
FileOutputStream destWritter = new FileOutputStream(fileDest)) {
byte[] buffer = new byte[sourceReader.available()];
sourceReader.read(buffer);
for (int i = buffer.length - 1; i >= 0; i--) {
destWritter.write(buffer[i]);
}
}
}
}
| [
"s3rg.rov@yandex.ru"
] | s3rg.rov@yandex.ru |
2792da6073bf5819bdcd50d40e89c4ea9267995a | dec8bd5ee4851b2faed2e59482f4c6dde9e153d3 | /imejadialog/src/main/java/com/kiprotich/japheth/Imejadialog/ImejaDialog.java | 8f8283e26c4e3fb4712ff9746023eb7dd692856a | [
"MIT"
] | permissive | rohitnotes/Imeja-Dialog | c497fd4e5cfce37f16e413ea9e2f9947d721c652 | e84c225fb967232665ae33819e13d18636da418d | refs/heads/master | 2022-04-04T08:15:42.783955 | 2020-02-07T06:06:27 | 2020-02-07T06:06:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,950 | java | package com.kiprotich.japheth.Imejadialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Html;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
import androidx.annotation.UiThread;
import com.kiprotich.japheth.Imejadialog.utils.DialogUtils;
public class ImejaDialog extends Dialog {
Builder builder;
//TODO:: change to custom view, when realize custom view
ViewGroup rootView;
LinearLayout titleFrame;
ImageView titleIcon;
TextView title;
ImejaSpinner spinner;
TextView message;
private ImejaDialog(Builder builder) {
super(builder.context, builder.theme);
final LayoutInflater inflater = LayoutInflater.from(builder.context);
rootView = (ViewGroup) inflater.inflate(DialogInit.getInflateLayout(builder), null);
this.builder = builder;
DialogInit.init(this);
}
private ImejaDialog(Context context, int theme) {
super(context, theme);
}
//TODO:: add indeterminate support:
//The second property tells the dialog whether to display a spinner. If false, the ProgressDialog will contain a real progress bar, and you will need to periodically update the UI with the current completion percent of your background task.
@Override
public void onWindowFocusChanged(boolean hasFocus){
AnimationDrawable spinnerAnimation = (AnimationDrawable) spinner.getBackground();
spinnerAnimation.start();
}
// dialog.getWindow().getAttributes().gravity = Gravity.CENTER;
// //затемнение
// WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
// lp.dimAmount=0.2f;
// dialog.getWindow().setAttributes(lp);
//// dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
public static class Builder {
Context context;
View customView;
CharSequence title;
CharSequence message;
boolean cancelable;
boolean indeterminate;
float dimAmount;
int spinnerDuration;
int titleGravity;
int messageGravity;
OnShowListener showListener;
OnCancelListener cancelListener;
OnDismissListener dismissListener;
OnKeyListener keyListener;
Typeface regularFont;
Typeface mediumFont;
int theme;
int titleColor;
int messageColor;
int spinnerColor;
int backgroundColor;
boolean spinnerClockwise = true;
boolean oneShot = false;
boolean isTitleColorSet = false;
boolean isMessageColorSet = false;
boolean isSpinnerColorSet = false;
boolean isBackgroundColorSet = false;
public Builder(Context context) {
this.context = context;
this.theme = R.style.ImejaDialog;
this.cancelable = true;
this.titleGravity = Gravity.CENTER;
this.messageGravity = Gravity.CENTER;
this.dimAmount = 0.2f;
if (this.mediumFont == null) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.mediumFont = Typeface.create("sans-serif-medium", Typeface.NORMAL);
} else {
this.mediumFont = Typeface.create("sans-serif", Typeface.BOLD);
}
} catch (Exception ignored) {
this.mediumFont = Typeface.DEFAULT_BOLD;
}
}
if (this.regularFont == null) {
try {
this.regularFont = Typeface.create("sans-serif", Typeface.NORMAL);
} catch (Exception ignored) {
this.regularFont = Typeface.SANS_SERIF;
if (this.regularFont == null) {
this.regularFont = Typeface.DEFAULT;
}
}
}
}
public Builder setTitle(@StringRes int titleRes) {
setTitle(this.context.getText(titleRes));
return this;
}
public Builder setTitle(@NonNull CharSequence title) {
this.title = title;
return this;
}
public Builder setTitleGravity(int gravity) {
this.titleGravity = gravity;
return this;
}
public Builder setMessageContent(@StringRes int messageContent) {
return setMessageContent(messageContent, false);
}
public Builder setMessageContent(@StringRes int messageContentRes, boolean html) {
CharSequence text = this.context.getText(messageContentRes);
if (html) {
text = Html.fromHtml(text.toString().replace("\n", "<br/>"));
}
return setMessageContent(text);
}
public Builder setMessageContent(@StringRes int messageContentRes, Object... formatArgs) {
String str = String.format(this.context.getString(messageContentRes), formatArgs)
.replace("\n", "<br/>");
//noinspection deprecation
return setMessageContent(Html.fromHtml(str));
}
public Builder setMessageContent(@NonNull CharSequence messageContent) {
if (this.customView != null) {
throw new IllegalStateException("You cannot setMessageContent() " +
"when you're using a custom view.");
}
this.message = messageContent;
return this;
}
public Builder setMessageContentGravity(int gravity) {
this.messageGravity = gravity;
return this;
}
public Builder setMessageColor(@ColorInt int color) {
this.messageColor = color;
this.isMessageColorSet = true;
return this;
}
public Builder setMessageColorRes(@ColorRes int colorRes) {
return setMessageColor(DialogUtils.getColor(this.context, colorRes));
}
public Builder setMessageColorAttr(@AttrRes int colorAttr) {
return setMessageColor(DialogUtils.resolveColor(this.context, colorAttr));
}
public Builder setCancelable(boolean cancelable) {
this.cancelable = cancelable;
return this;
}
public Builder setOnCancelListener(@NonNull OnCancelListener cancelListener) {
this.cancelListener = cancelListener;
return this;
}
public Builder setOnShowListener(@NonNull OnShowListener showListener) {
this.showListener = showListener;
return this;
}
public Builder setOnDismissListener(@NonNull OnDismissListener dismissListener) {
this.dismissListener = dismissListener;
return this;
}
public Builder setOnKeyListener(@NonNull OnKeyListener keyListener) {
this.keyListener = keyListener;
return this;
}
/**
* @param indeterminate indeterminate
* @return {@link Builder} ImejaDialog.Builder
* @deprecated Do not use this method, it's not working now!
*/
@Deprecated
public Builder setIndeterminate(boolean indeterminate) {
this.indeterminate = indeterminate;
return this;
}
/**
* @param dimAmount dimAmount
* @return {@link Builder} ImejaDialog.Builder
* @deprecated Do not use this method, it's not working now!
*/
@Deprecated
public Builder setDimAmount(float dimAmount) {
this.dimAmount = dimAmount;
return this;
}
public Builder setSpinnerColor(@ColorInt int color) {
this.spinnerColor = color;
this.isSpinnerColorSet = true;
return this;
}
public Builder setSpinnerColorRes(@ColorRes int colorRes) {
return setSpinnerColor(DialogUtils.getColor(this.context, colorRes));
}
public Builder setSpinnerColorAttr(@AttrRes int colorAttr) {
return setSpinnerColor(DialogUtils.resolveColor(this.context, colorAttr));
}
public Builder setSpinnerDuration(int spinnerDuration) {
this.spinnerDuration = spinnerDuration;
return this;
}
public Builder setSpinnerClockwise(boolean spinnerClockwise) {
this.spinnerClockwise = spinnerClockwise;
return this;
}
public Builder setOneShot(boolean oneShot) {
this.oneShot = oneShot;
return this;
}
public Builder setTitleColor(@ColorInt int color) {
this.titleColor = color;
this.isTitleColorSet = true;
return this;
}
public Builder setTitleColorRes(@ColorRes int colorRes) {
return setTitleColor(DialogUtils.getColor(this.context, colorRes));
}
public Builder setTitleColorAttr(@AttrRes int colorAttr) {
return setTitleColor(DialogUtils.resolveColor(this.context, colorAttr));
}
/**
* @param color ImejaDialog background ColorInt
* @return {@link Builder} ImejaDialog.Builder
* @deprecated Do not use this method, it's not working now!
*/
@Deprecated
public Builder setBackgroundColor(@ColorInt int color) {
this.backgroundColor = color;
this.isBackgroundColorSet = true;
return this;
}
/**
* @param colorRes ImejaDialog background colorRes
* @return {@link Builder} ImejaDialog.Builder
* @deprecated Do not use this method, it's not working now!
*/
@Deprecated
public Builder setBackgroundColorRes(@ColorRes int colorRes) {
return setBackgroundColor(DialogUtils.getColor(this.context, colorRes));
}
/**
* @param colorAttr ImejaDialog background colorAttr
* @return {@link Builder} ImejaDialog.Builder
* @deprecated Do not use this method, it's not working now!
*/
@Deprecated
public Builder setBackgroundColorAttr(@AttrRes int colorAttr) {
return setBackgroundColor(DialogUtils.resolveColor(this.context, colorAttr));
}
public Builder setTheme(@StyleRes int theme) {
this.theme = theme;
return this;
}
//TODO:: add setCustomView
//TODO:: add set title icon
@UiThread
public ImejaDialog build() {
return new ImejaDialog(this);
}
@UiThread
public ImejaDialog show() {
ImejaDialog dialog = build();
dialog.show();
return dialog;
}
}
//methods for future features
private Drawable adjust(Drawable d) {
int to = Color.RED;
//Need to copy to ensure that the bitmap is mutable.
Bitmap src = ((BitmapDrawable) d).getBitmap();
Bitmap bitmap = src.copy(Bitmap.Config.ARGB_8888, true);
for(int x = 0;x < bitmap.getWidth();x++)
for(int y = 0;y < bitmap.getHeight();y++)
if(match(bitmap.getPixel(x, y)))
bitmap.setPixel(x, y, to);
return new BitmapDrawable(bitmap);
}
private Bitmap adjust(Bitmap src) {
int to = Color.RED;
Bitmap bitmap = src.copy(Bitmap.Config.ARGB_8888, true);
for(int x = 0;x < bitmap.getWidth();x++)
for(int y = 0;y < bitmap.getHeight();y++)
if(match(bitmap.getPixel(x, y)))
bitmap.setPixel(x, y, to);
return bitmap;
}
private static final int[] FROM_COLOR = new int[]{49, 179, 110};
private static final int THRESHOLD = 3;
private boolean match(int pixel) {
//There may be a better way to match, but I wanted to do a comparison ignoring
//transparency, so I couldn't just do a direct integer compare.
return Math.abs(Color.red(pixel) - FROM_COLOR[0]) < THRESHOLD &&
Math.abs(Color.green(pixel) - FROM_COLOR[1]) < THRESHOLD &&
Math.abs(Color.blue(pixel) - FROM_COLOR[2]) < THRESHOLD;
}
}
| [
"keeprawteachjapheth@gmail.com"
] | keeprawteachjapheth@gmail.com |
c9cb073d258f1be49c415283288ee59a9c66c795 | b3786b8f80fb8489e769137a6f201bacdcece0df | /source/umontreal/iro/lecuyer/xmlconfig/ExcelSourceArray2D.java | 59a9bd2baaea652aa14d8fed4175bff4b69ee833 | [
"Apache-2.0"
] | permissive | umontreal-simul/contactcenters | 958c3be912f5804b2b7b2083dd88e12736bf47e8 | f5ddb4a0a4b30dbf436ac36e6d97facce2f3576d | refs/heads/master | 2023-06-24T04:18:19.672967 | 2021-07-25T11:39:56 | 2021-07-25T11:39:56 | 389,332,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,988 | java | package umontreal.iro.lecuyer.xmlconfig;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.WeakHashMap;
import jxl.BooleanCell;
import jxl.Cell;
import jxl.CellType;
import jxl.DateCell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import umontreal.ssj.util.ClassFinder;
import umontreal.ssj.util.NameConflictException;
import umontreal.iro.lecuyer.util.StringConvert;
import umontreal.iro.lecuyer.util.UnsupportedConversionException;
/**
* Represents a source array whose contents is
* read from a Microsoft Excel workbook.
* Each row of the sheet with the given name, and
* contained in the workbook pointed to by
* a URL becomes a row of the source array,
* with elements of the row separated
* using commas.
* Data is read using JExcel API.
*
* In the XML file, the \texttt{URL} attribute
* of an element representing a Excel source
* array
* must be used to indicate the
* URL of the data file.
* The \texttt{sheetName} attribute can also be used
* to indicate the name of a sheet.
* By default, the first sheet is read.
*/
public class ExcelSourceArray2D extends AbstractParam implements SourceArray2D,
Cloneable, StorableParam {
private static final Map<URL, Workbook> wbCache = new WeakHashMap<URL, Workbook>();
private URL url;
private String sheetName;
private Workbook wb;
private Sheet sheet;
/**
* Returns the URL of the text file containing
* the values of the array, in CSV format.
* @return the URL of the CSV data.
*/
public URL getURL() {
return url;
}
/**
* Sets the URL pointing to the CSV file
* containing the
* elements of this
* array to
* \texttt{url}.
* @param url the URL of the data.
*/
public void setURL (URL url) {
this.url = url;
}
/**
* Returns the name of the sheet to extract data from.
* @return the name of the sheet.
*/
public String getSheetName() {
return sheetName;
}
/**
* Sets the sheet name to \texttt{sheetName}.
* @param sheetName the sheet name.
*/
public void setSheetName (String sheetName) {
this.sheetName = sheetName;
}
public int columns (int row) {
if (sheet == null)
throw new IllegalStateException
("Uninitialized source array");
return sheet.getColumns ();
}
@SuppressWarnings("unchecked")
public <T> T get (Class<T> pcls, int row, int column) throws UnsupportedConversionException {
if (sheet == null)
throw new IllegalStateException
("Uninitialized source array");
final Cell cell = sheet.getCell (column, row);
if (cell == null)
return null;
String str = null;
if (cell.getType () == CellType.NUMBER ||
cell.getType () == CellType.NUMBER_FORMULA) {
final NumberCell nc = (NumberCell)cell;
final double v = nc.getValue ();
if (pcls == double.class || pcls == Double.class)
return (T)new Double (v);
else if (pcls == float.class || pcls == Float.class)
return (T)new Float ((float)v);
else if (pcls == int.class || pcls == Integer.class)
return (T)new Integer ((int)Math.round (v));
else if (pcls == long.class || pcls == Long.class)
return (T)new Long (Math.round (v));
else if (pcls == byte.class || pcls == Byte.class)
return (T)new Byte ((byte)Math.round (v));
else if (pcls == short.class || pcls == Short.class)
return (T)new Short ((short)Math.round (v));
else if (pcls == BigInteger.class)
return (T)BigInteger.valueOf (Math.round (v));
else if (pcls == BigDecimal.class)
return (T)new BigDecimal (v);
else
str = String.valueOf (v);
}
else if (cell.getType () == CellType.BOOLEAN ||
cell.getType () == CellType.BOOLEAN_FORMULA) {
final BooleanCell bc = (BooleanCell)cell;
final boolean v = bc.getValue ();
if (pcls == Boolean.class)
return (T)new Boolean (v);
else
str = String.valueOf (v);
}
else if (cell.getType () == CellType.DATE ||
cell.getType () == CellType.DATE_FORMULA) {
final DateCell dc = (DateCell)cell;
final Date v = dc.getDate ();
if (pcls == Date.class)
return (T)v;
}
else if (cell.getType () == CellType.EMPTY) {
final double v = 0;
if (pcls == double.class || pcls == Double.class)
return (T)new Double (v);
else if (pcls == float.class || pcls == Float.class)
return (T)new Float ((float)v);
else if (pcls == int.class || pcls == Integer.class)
return (T)new Integer ((int)Math.round (v));
else if (pcls == long.class || pcls == Long.class)
return (T)new Long (Math.round (v));
else if (pcls == byte.class || pcls == Byte.class)
return (T)new Byte ((byte)Math.round (v));
else if (pcls == short.class || pcls == Short.class)
return (T)new Short ((short)Math.round (v));
else if (pcls == BigInteger.class)
return (T)BigInteger.valueOf (Math.round (v));
else if (pcls == BigDecimal.class)
return (T)new BigDecimal (v);
}
if (str == null)
str = cell.getContents ();
if (pcls == String.class)
return (T)str;
try {
return StringConvert.fromString (null, null, pcls, str);
}
catch (final NameConflictException nce) {
final UnsupportedConversionException iae = new UnsupportedConversionException
("Cannot convert value at (" + row + ", " + column + ")=" + str);
iae.initCause (nce);
throw iae;
}
catch (final NumberFormatException nfe) {
final UnsupportedConversionException uce = new UnsupportedConversionException
("Cannot convert value at (" + row + ", " + column + ")=" + str);
uce.initCause (nfe);
throw uce;
}
}
public void init () {
wb = wbCache.get (url);
if (wb == null)
try {
final InputStream is = url.openStream ();
final WorkbookSettings wbs = new WorkbookSettings();
wbs.setSuppressWarnings (true);
wbs.setLocale (Locale.ENGLISH);
wb = Workbook.getWorkbook (is, wbs);
wbCache.put (url, wb);
}
catch (final IOException ioe) {
final IllegalArgumentException iae = new IllegalArgumentException
("Could not read workbook");
iae.initCause (ioe);
throw iae;
}
catch (final BiffException be) {
final IllegalArgumentException iae = new IllegalArgumentException
("Could not read workbook");
iae.initCause (be);
throw iae;
}
if (sheetName == null || sheetName.length () == 0) {
sheet = wb.getSheet (0);
if (sheet == null) {
wb.close();
wb = null;
throw new IllegalArgumentException
("No sheet in the workbook");
}
}
else {
sheet = wb.getSheet (sheetName);
if (sheet == null) {
wb.close();
wb = null;
throw new IllegalArgumentException
("No sheet with name " + sheetName + " in the workbook");
}
}
}
public int rows () {
if (sheet == null)
throw new IllegalStateException
("Uninitialized source array");
return sheet.getRows ();
}
public Element toElement (ClassFinder finder, Node parent,
String elementName, int spc) {
final Element el = DOMUtils.addNestedElement (parent, elementName, true, spc);
if (url != null)
el.setAttribute ("URL", url.toString ());
if (sheetName != null)
el.setAttribute ("sheetName", sheetName);
return el;
}
public void dispose() {
sheet = null;
wb = null;
}
@Override
public ExcelSourceArray2D clone() {
ExcelSourceArray2D cpy;
try {
cpy = (ExcelSourceArray2D)super.clone ();
}
catch (final CloneNotSupportedException cne) {
throw new InternalError
("Clone not supported for a class implementing Cloneable");
}
return cpy;
}
public String getElementName() {
return "Excel";
}
public static void clearCache() {
for (final Workbook wb : wbCache.values ())
wb.close ();
wbCache.clear ();
}
}
| [
"chwyean@gmail.com"
] | chwyean@gmail.com |
a6b6817b744bd13097f297c0bb8f544c724464c4 | 8155b3907cd529e29a1c71f95133b129d09037de | /src/com/caihong/bbs/webservices/UserService.java | 7b5d5aea4e42d8ad86b193b3bb69448bf7e98da0 | [] | no_license | xrogzu/caihongbbs | 4410a4b541a4bac846bf875887958f92cc617903 | 94682bebbdb15b500f7b30ceb4af5b57d3b62d8a | refs/heads/master | 2020-04-06T04:13:52.247974 | 2017-02-23T06:06:57 | 2017-02-23T06:06:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,564 | java | /**
* TOM
*/
package com.caihong.bbs.webservices;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import com.caihong.bbs.cache.BbsConfigEhCache;
import com.caihong.bbs.entity.BbsUser;
import com.caihong.bbs.entity.BbsUserExt;
import com.caihong.bbs.entity.BbsUserGroup;
import com.caihong.bbs.manager.BbsConfigMng;
import com.caihong.bbs.manager.BbsUserMng;
import com.caihong.bbs.manager.BbsWebserviceAuthMng;
import com.caihong.bbs.manager.BbsWebserviceCallRecordMng;
public class UserService extends SpringBeanAutowiringSupport{
private static final String SERVICE_CODE_USER_DELETE="user_delete";
private static final String SERVICE_CODE_USER_ADD="user_add";
private static final String SERVICE_CODE_USER_UPDATE="user_update";
private static final String RESPONSE_CODE_SUCCESS="100";
private static final String RESPONSE_CODE_AUTH_ERROR="101";
private static final String RESPONSE_CODE_PARAM_REQUIRED="102";
private static final String RESPONSE_CODE_USER_NOT_FOUND="103";
private static final String RESPONSE_CODE_USER_ADD_ERROR="104";
private static final String RESPONSE_CODE_USER_UPDATE_ERROR="105";
private static final String RESPONSE_CODE_USER_DELETE_ERROR="106";
private static final String LOCAL_IP="127.0.0.1";
private static final Integer SITE_ID=1;
private static final Integer GROUP_DOCTOR_ID=13; //认证医生group id
private static final Integer CMS_GROUP_DOCTOR_ID=2; //网站认证医生group id
public String addUser(String auth_username,String auth_password,String username,String password,String email,String realname,String sex,String tel,String telphone,String groupId,String prestige) {
String responseCode=RESPONSE_CODE_AUTH_ERROR;
if(validate(auth_username, auth_password)){
if(StringUtils.isBlank(username)||StringUtils.isBlank(password)){
responseCode=RESPONSE_CODE_PARAM_REQUIRED;
}else{
BbsUserGroup group =null;
Integer group_id;
if(groupId!=null&&new Integer(groupId).equals(CMS_GROUP_DOCTOR_ID)){
group_id=GROUP_DOCTOR_ID;
}else{
group=bbsConfigMng.get().getRegisterGroup();
group_id=group.getId();
}
BbsUserExt userExt=new BbsUserExt();
userExt.setRealname(realname);
if(StringUtils.isNotBlank(sex)){
if(sex.equals("true")){
userExt.setGender(true);
}else if(sex.equals("false")){
userExt.setGender(false);
}
}
userExt.setMoble(tel);
try {
BbsUser user=bbsUserMng.registerMember(username, email,telphone,false, password, LOCAL_IP, group_id, userExt, null,new Integer(prestige));
responseCode=RESPONSE_CODE_SUCCESS;
bbsWebserviceCallRecordMng.save(auth_username, SERVICE_CODE_USER_ADD);
bbsConfigEhCache.setBbsConfigCache(0, 0, 0, 1, user, SITE_ID);
} catch (Exception e) {
responseCode=RESPONSE_CODE_USER_ADD_ERROR;
}
}
}
return responseCode;
}
public String updateUser(String auth_username,String auth_password,String username,String password,String email,String realname,String sex,String tel,String telphone,String groupId) {
String responseCode=RESPONSE_CODE_AUTH_ERROR;
if(validate(auth_username, auth_password)){
if(StringUtils.isBlank(username)){
responseCode=RESPONSE_CODE_PARAM_REQUIRED;
}else{
BbsUser user=bbsUserMng.findByUsername(username);
if(user!=null){
try {
Boolean sexBoolean=null;
if(StringUtils.isNotBlank(sex)){
if(sex.equals("true")){
sexBoolean=true;
}else if(sex.equals("false")){
sexBoolean=false;
}
}
Integer group_id=null;
if(groupId!=null&&new Integer(groupId).equals(CMS_GROUP_DOCTOR_ID)){
group_id=GROUP_DOCTOR_ID;
}else{
group_id=bbsConfigMng.get().getRegisterGroup().getId();
}
bbsUserMng.updateMember(user.getId(), email,telphone, password, realname, sexBoolean, tel,group_id);
responseCode=RESPONSE_CODE_SUCCESS;
bbsWebserviceCallRecordMng.save(auth_username, SERVICE_CODE_USER_UPDATE);
} catch (Exception e) {
e.printStackTrace();
responseCode=RESPONSE_CODE_USER_UPDATE_ERROR;
}
}else{
responseCode=RESPONSE_CODE_USER_NOT_FOUND;
}
}
}
return responseCode;
}
public String delUser(String auth_username,String auth_password,String username) {
String responseCode=RESPONSE_CODE_AUTH_ERROR;
if(validate(auth_username, auth_password)){
if(StringUtils.isNotBlank(username)){
BbsUser user=bbsUserMng.findByUsername(username);
if(user!=null){
try{
bbsUserMng.deleteById(user.getId());
responseCode=RESPONSE_CODE_SUCCESS;
bbsWebserviceCallRecordMng.save(auth_username, SERVICE_CODE_USER_DELETE);
} catch (Exception e) {
responseCode=RESPONSE_CODE_USER_DELETE_ERROR;
}
}else{
responseCode=RESPONSE_CODE_USER_NOT_FOUND;
}
}else{
responseCode=RESPONSE_CODE_PARAM_REQUIRED;
}
}
return responseCode;
}
private boolean validate(String username,String password){
if(StringUtils.isBlank(username)||StringUtils.isBlank(password)){
return false;
}else{
return bbsWebserviceAuthMng.isPasswordValid(username, password);
}
}
@Autowired
private BbsUserMng bbsUserMng;
@Autowired
private BbsConfigMng bbsConfigMng;
@Autowired
private BbsConfigEhCache bbsConfigEhCache;
@Autowired
private BbsWebserviceAuthMng bbsWebserviceAuthMng;
@Autowired
private BbsWebserviceCallRecordMng bbsWebserviceCallRecordMng;
}
| [
"qianfo_713@163.com"
] | qianfo_713@163.com |
d8f9e0dc0154e97c04f8dfb984af05f59a454235 | b6239c71ef46e59d253a87b0ea4b332465130243 | /app/src/main/java/com/sabotage/takeover/businesslogic/netvork/ApiGoogle.java | e430d66836604300e1113e1a15ed241271056be3 | [] | no_license | art7384/takeover | b04aa9ec960c1bb4782d4559f3806e95f050d7f2 | 6168577acfcd343928476778764c53665d4111dc | refs/heads/master | 2021-01-10T13:58:13.791340 | 2015-10-08T14:51:12 | 2015-10-08T14:51:12 | 43,885,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.sabotage.takeover.businesslogic.netvork;
import com.android.volley.Response;
import com.google.android.gms.maps.model.LatLng;
import com.sabotage.takeover.businesslogic.transport.netvork.Request;
import com.sabotage.takeover.businesslogic.transport.netvork.RequestModel;
import org.json.JSONObject;
/**
* Created by on 30.06.2015.
*/
public class ApiGoogle {
public ApiGoogle(){
}
public Request getDirections(
LatLng orign,
LatLng destination,
Response.Listener<JSONObject> listener,
Response.ErrorListener errorListener){
RequestModel requestModel = new RequestModel();
requestModel.method = GoogleComand.GET_DIRECTION.getmMethod();
requestModel.url = GoogleComand.GET_DIRECTION.toString();
requestModel.strParams.put(GoogleParams.ORIGIN.toString(), orign.latitude + "," + orign.longitude);
requestModel.strParams.put(GoogleParams.DESTINATION.toString(), destination.latitude + "," + destination.longitude);
requestModel.strParams.put(GoogleParams.SENSOR.toString(), "true");
requestModel.listener = listener;
requestModel.errorListener = errorListener;
return Request.create(requestModel);
}
}
| [
"art7384@gmail.com"
] | art7384@gmail.com |
fbe40ca1c119f710a0f12a0b4f0dbe53dab769c8 | c78bed8d07c2a8baf3ef0c24ec2c197cd6247989 | /tableview/src/main/java/com/evrencoskun/tableview/pagination/IPagination.java | 99561ff56dd76d55efa36b47bb7a5af48f788c35 | [
"BSD-3-Clause"
] | permissive | jaboto/dhis2-android-capture-app | a8f00e055b696c9afa389cf38fbc23a619b2801b | 7d8b077198532753384b3eb979589aeabb072e39 | refs/heads/master | 2020-12-11T11:46:23.061917 | 2020-05-07T13:46:34 | 2020-05-07T13:46:34 | 220,835,057 | 1 | 0 | BSD-3-Clause | 2019-11-10T18:54:05 | 2019-11-10T18:54:04 | null | UTF-8 | Java | false | false | 2,101 | java | /*
* Copyright (c) 2018. Evren Coşkun
*
* 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.evrencoskun.tableview.pagination;
public interface IPagination {
/**
* Loads the next page of the data set to the table view.
*/
void nextPage();
/**
* Loads the previous page of the data set to the table view.
*/
void previousPage();
/**
* Loads the data set of the specified page to the table view.
*
* @param page The page to be loaded.
*/
void goToPage(int page);
/**
* Sets the number of items (rows) per page to be displayed in the table view.
*
* @param numItems The number of items per page.
*/
void setItemsPerPage(int numItems);
/**
* Sets the OnTableViewPageTurnedListener for this Pagination.
*
* @param onTableViewPageTurnedListener The OnTableViewPageTurnedListener.
*/
void setOnTableViewPageTurnedListener(Pagination.OnTableViewPageTurnedListener onTableViewPageTurnedListener);
/**
* Removes the OnTableViewPageTurnedListener for this Pagination.
*/
void removeOnTableViewPageTurnedListener();
/**
* @return The current page loaded to the table view.
*/
int getCurrentPage();
/**
* @return The number of items per page loaded to the table view.
*/
int getItemsPerPage();
/**
* @return The number of pages in the pagination.
*/
int getPageCount();
/**
* @return Current pagination state of the table view.
*/
boolean isPaginated();
}
| [
"marina_cape@hotmail.com"
] | marina_cape@hotmail.com |
88b9a3869b2c722656749c78566d996e875406d7 | 5c9d7ea67b0d68b5070ecce07b4323d67cdf85b4 | /app/src/main/java/com/fafabtc/app/vm/ExchangeEntryViewModel.java | 6cb8b1ba90bccf28cdeb32fce4fd3b0a9d95f042 | [
"Apache-2.0"
] | permissive | sendy943/fafabtc | 59d310d494b872a9cabf8220ae99191d783dc43c | 2db20ce9755622d76a3dce1c6676d7561dbd2bb3 | refs/heads/master | 2020-03-07T17:44:48.979202 | 2018-03-29T14:39:17 | 2018-03-29T14:39:17 | 127,619,457 | 1 | 0 | null | 2018-04-01T10:33:01 | 2018-04-01T10:33:01 | null | UTF-8 | Java | false | false | 4,203 | java | package com.fafabtc.app.vm;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel;
import com.fafabtc.app.utils.ExecutorManager;
import com.fafabtc.app.utils.RxUtils;
import com.fafabtc.data.data.repo.AccountAssetsRepo;
import com.fafabtc.data.data.repo.ExchangeRepo;
import com.fafabtc.data.model.entity.exchange.AccountAssets;
import com.fafabtc.data.model.entity.exchange.Exchange;
import com.fafabtc.data.model.vo.ExchangeEntry;
import com.fafabtc.domain.model.Resource;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.CompletableObserver;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Function;
import io.reactivex.observers.DisposableSingleObserver;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
/**
* Created by jastrelax on 2018/1/8.
*/
public class ExchangeEntryViewModel extends ViewModel {
@Inject
ExchangeRepo exchangeRepo;
@Inject
AccountAssetsRepo accountAssetsRepo;
private AccountAssets accountAssets;
MutableLiveData<List<ExchangeEntry>> exchangeList = new MutableLiveData<>();
MutableLiveData<Resource> deleteResult = new MutableLiveData<>();
CompositeDisposable compositeDisposable = new CompositeDisposable();
@Inject
public ExchangeEntryViewModel() {
}
public void loadExchanges() {
Disposable disposable = exchangeRepo.getExchanges()
.toObservable()
.flatMap(new Function<Exchange[], ObservableSource<Exchange>>() {
@Override
public ObservableSource<Exchange> apply(Exchange[] exchanges) throws Exception {
return Observable.fromArray(exchanges);
}
})
.map(new Function<Exchange, ExchangeEntry>() {
@Override
public ExchangeEntry apply(Exchange exchange) throws Exception {
ExchangeEntry entry = new ExchangeEntry();
entry.setExchange(exchange);
entry.setAccountAssets(accountAssets);
return entry;
}
})
.toList()
.subscribeOn(Schedulers.from(ExecutorManager.getNOW()))
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableSingleObserver<List<ExchangeEntry>>() {
@Override
public void onSuccess(List<ExchangeEntry> exchangeEntries) {
exchangeList.setValue(exchangeEntries);
}
@Override
public void onError(Throwable e) {
Timber.e(e);
}
});
compositeDisposable.add(disposable);
}
public void deleteAssets() {
accountAssetsRepo.deleteAssets(accountAssets)
.compose(RxUtils.completableAsyncIO())
.subscribe(new CompletableObserver() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onComplete() {
deleteResult.setValue(Resource.success());
}
@Override
public void onError(Throwable e) {
deleteResult.setValue(Resource.error());
}
});
}
public MutableLiveData<Resource> getDeleteResult() {
return deleteResult;
}
public LiveData<List<ExchangeEntry>> getExchanges() {
return exchangeList;
}
public void setAccountAssets(AccountAssets accountAssets) {
this.accountAssets = accountAssets;
}
@Override
protected void onCleared() {
super.onCleared();
compositeDisposable.dispose();
}
}
| [
"yinpinjiu@gmail.com"
] | yinpinjiu@gmail.com |
6a99f94b163536ef3adf532d2d8185c98e5387ae | 9005e840edfefaac41d14cebcd62d458ead60a03 | /target/classes/basic/datepicker/BasicDatePickerEvent.java | 478f909d2aa2ecebf868ccfde1d6c8bb7c953f6b | [] | no_license | cedrica/MailDialog | 8784f936ed9aeb6f2415b9219b98345b867ff23f | 25c8618e4cbb098b93f69bd058494a3bf6afeb7e | refs/heads/master | 2020-12-30T16:02:36.068287 | 2017-05-12T08:40:30 | 2017-05-12T08:40:30 | 90,955,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package basic.datepicker;
import com.preag.core.ui.event.ApplicationEvent;
import javafx.event.Event;
import javafx.event.EventTarget;
import javafx.event.EventType;
public class BasicDatePickerEvent extends ApplicationEvent {
private static final long serialVersionUID = 1L;
// @formatter:off
public static final EventType<BasicDatePickerEvent> ANY = new EventType<>(ApplicationEvent.ANY,"BasicDatePickerEvent");
public static final EventType<BasicDatePickerEvent> SELET_BIRTHDAY = new EventType<>(ANY,"BasicDatePickerEventSelectBirthday");
// @formatter:on
public BasicDatePickerEvent(EventType<? extends Event> eventType) {
super(eventType);
}
public BasicDatePickerEvent(Object source, EventTarget target, EventType<? extends Event> eventType) {
super(source, target, eventType);
}
}
| [
"ca.leumaleu@project-immobilien.com"
] | ca.leumaleu@project-immobilien.com |
f367943e67b3a204d8e756ad96e4daa8567be866 | c56bc41557f63dcbe68e101dfffccdf194cd05ac | /nsibridge/src/main/java/net/es/oscars/nsibridge/soap/gen/nsi_2_0_2013_07/connection/types/DataPlaneStateChangeRequestType.java | 3d9aea2311ec50f41b751f87f919024f771e9980 | [] | no_license | Cloudxtreme/oscars | de0f6cf8f9e18949dd9915a8d0e9e027d30af444 | d8c919280f214596b7131fa9d2f1adf7aa31b493 | refs/heads/master | 2021-05-26T21:15:20.905401 | 2013-09-30T22:54:32 | 2013-09-30T22:54:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java |
package net.es.oscars.nsibridge.soap.gen.nsi_2_0_2013_07.connection.types;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Type definition for the data plane state change notification
* message.
*
* This notification message sent up from a PA when a data plane
* status has changed. Possible data plane status changes are:
* activation, deactivation and activation version change.
*
* Elements:
*
* dataPlaneStatus - Current data plane activation state for the
* reservation identified by connectionId.
*
*
* <p>Java class for DataPlaneStateChangeRequestType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="DataPlaneStateChangeRequestType">
* <complexContent>
* <extension base="{http://schemas.ogf.org/nsi/2013/07/connection/types}NotificationBaseType">
* <sequence>
* <element name="dataPlaneStatus" type="{http://schemas.ogf.org/nsi/2013/07/connection/types}DataPlaneStatusType"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataPlaneStateChangeRequestType", propOrder = {
"dataPlaneStatus"
})
public class DataPlaneStateChangeRequestType
extends NotificationBaseType
{
@XmlElement(required = true)
protected DataPlaneStatusType dataPlaneStatus;
/**
* Gets the value of the dataPlaneStatus property.
*
* @return
* possible object is
* {@link DataPlaneStatusType }
*
*/
public DataPlaneStatusType getDataPlaneStatus() {
return dataPlaneStatus;
}
/**
* Sets the value of the dataPlaneStatus property.
*
* @param value
* allowed object is
* {@link DataPlaneStatusType }
*
*/
public void setDataPlaneStatus(DataPlaneStatusType value) {
this.dataPlaneStatus = value;
}
}
| [
"haniotak@c75a6b91-02ef-0310-b74a-e20389c9c41d"
] | haniotak@c75a6b91-02ef-0310-b74a-e20389c9c41d |
4e7ff07153e5d66c41bbb05a2af7d4b14b515404 | af9fcad9893fcdb80880066f608358f36488527d | /android/support/v4/widget/DrawerLayout$ViewDragCallback$1.java | c4e17c2bcedebbc8b694ed5a73a030be4b36522b | [] | no_license | TECKBIDDEN/JAVA-Package | b213a610c578170042018732d1d2cc2f934d4551 | 8637c2ae99af3b9cf95f78acf7480f1a5f713a34 | refs/heads/master | 2020-03-31T03:03:10.147600 | 2014-11-19T11:28:13 | 2014-11-19T11:28:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package android.support.v4.widget;
class DrawerLayout$ViewDragCallback$1
implements Runnable
{
public void run()
{
DrawerLayout.ViewDragCallback.access$000(this.this$1);
}
}
/* Location: C:\Users\Lino\java\2014\APKtoJava_RC2\tools\classes-dex2jar.jar
* Qualified Name: android.support.v4.widget.DrawerLayout.ViewDragCallback.1
* JD-Core Version: 0.6.0
*/ | [
"github@TAXXI.IT"
] | github@TAXXI.IT |
85c2336a91aa00b343b807cea877b3106713739e | c91eab93436f6a2bdc02049988a5158e95ad7ca7 | /Census/src/cellularData/Registration.java | e66f6bc359a1848e3d97d11b29f670f145207dea | [] | no_license | CANNONSUYASH/Census-Based | 48c977dc5828d19fbafe741df265e117a4afae40 | 5a5705f80f7c7d3fd2b97a790037cd73c962727a | refs/heads/master | 2020-03-24T13:22:21.279048 | 2018-07-29T08:20:09 | 2018-07-29T08:20:09 | 142,742,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,140 | java | package cellularData;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;
public class Registration extends JFrame {
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
private JPasswordField passwordField;
private JPasswordField passwordField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Registration frame = new Registration();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Registration() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 541, 427);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("Name");
lblNewLabel.setBounds(42, 47, 76, 14);
contentPane.add(lblNewLabel);
JLabel lblContact = new JLabel("Contact");
lblContact.setBounds(42, 72, 76, 14);
contentPane.add(lblContact);
JLabel lblPassword = new JLabel("Password");
lblPassword.setBounds(42, 97, 76, 14);
contentPane.add(lblPassword);
JLabel lblConfirmPassword = new JLabel("Confirm Password");
lblConfirmPassword.setBounds(42, 122, 120, 14);
contentPane.add(lblConfirmPassword);
textField = new JTextField();
textField.setBounds(162, 44, 217, 20);
contentPane.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(162, 69, 217, 20);
contentPane.add(textField_1);
passwordField = new JPasswordField();
passwordField.setBounds(162, 119, 217, 20);
contentPane.add(passwordField);
passwordField_1 = new JPasswordField();
passwordField_1.setBounds(162, 94, 217, 20);
contentPane.add(passwordField_1);
JButton btnNewButton = new JButton("Submit");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
/* TODO output your page here. You may use following sample code. */
if(passwordField.getText().equals(passwordField_1.getText())) {
System.out.println("");
String s= "s";
MyDb db = new MyDb();
Connection con = db.getCon();
Statement stmt = con.createStatement();
// out.println("Data is inserted");
stmt.execute("insert into registration(username,contact,Password)values('"+textField.getText()+"','"+textField_1.getText()+"','"+passwordField_1.getText()+"')");
confirm_Popup confirm = new confirm_Popup();
confirm.setVisible(true);
}
else {
Invalid_Popup inv = new Invalid_Popup();
inv.setVisible(true);
}
} catch (SQLException ex) {
System.out.println(ex);
}
}
});
btnNewButton.setBounds(162, 170, 89, 23);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("Cancel");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
//
// Registration reg = new Registration();
// reg.dispose();
// reg.setVisible(false);
//
}
});
btnNewButton_1.setBounds(295, 170, 89, 23);
contentPane.add(btnNewButton_1);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3555d4182c30696dc6071950eab8ff5038bfc28c | 60b4b1f322c05f9edfea2c6615b828406aeb3b2f | /Medi-Pet/src/java/servlet/APetServlet.java | 42415012b9ba5b4c3df20235817012fe0e0cf55a | [] | no_license | M21-AIS/Medi-Pet | 4a428125a314f094cd243c5eb1896250e23eb0be | a3143b3b18f28b5c1987d0d6f390b6790bb10f96 | refs/heads/master | 2021-08-30T18:23:56.787706 | 2017-12-18T23:45:27 | 2017-12-18T23:45:27 | 114,526,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,827 | 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 servlet;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dao.PetDAO;
import bean.Pet;
public class APetServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static String INSERT_OR_EDIT = "/petA.jsp";
private static String LIST_PET = "/listAPet.jsp";
private PetDAO dao;
public APetServlet() {
super();
dao = new PetDAO();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String forward="";
String action = request.getParameter("action");
if (action.equalsIgnoreCase("delete")){
int petId = Integer.parseInt(request.getParameter("petId"));
dao.deletePet(petId);
forward = LIST_PET;
request.setAttribute("pets", dao.getAllPets());
} else if (action.equalsIgnoreCase("edit")){
forward = INSERT_OR_EDIT;
int petId = Integer.parseInt(request.getParameter("petId"));
Pet pet = dao.getPetById(petId);
request.setAttribute("pet", pet);
} else if( action.equalsIgnoreCase( "insert" ) ) {
forward = INSERT_OR_EDIT;
} else {
forward = LIST_PET;
request.setAttribute("pets", dao.getAllPets() );
}
RequestDispatcher view = request.getRequestDispatcher(forward);
view.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Pet pet = new Pet();
pet.setName(request.getParameter("name"));
pet.setDob(request.getParameter("dob"));
pet.setSex(request.getParameter("sex"));
pet.setBreed(request.getParameter("breed"));
pet.setFullname(request.getParameter("fullname"));
String petid = request.getParameter("petid");
if(petid == null || petid.isEmpty())
{
dao.addPet(pet);
}
else
{
pet.setPetid(Integer.parseInt(petid));
dao.checkPet(pet);
}
RequestDispatcher view = request.getRequestDispatcher(LIST_PET);
request.setAttribute("pets", dao.getAllPets());
view.forward(request, response);
}
} | [
"User@Q"
] | User@Q |
ccb989d466f8394a756c00e2598e65a349907707 | a1f88b35222838a52e0b665d0a29c21a0be070c4 | /src/main/tonivade/db/command/key/KeysCommand.java | 7d57a40a81052ae23af33ee69269207f2aae95fe | [
"MIT"
] | permissive | yourcaptain/tinydb | 2c053e6ede6f6e8c950016ae3c8aa2042a977ccf | b7fda73b668380eaaa38136af2f9c11d06538a8a | refs/heads/master | 2021-01-10T18:52:33.957124 | 2016-07-15T08:45:37 | 2016-07-15T08:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,879 | java | /*
* Copyright (c) 2015, Antonio Gabriel Muñoz Conejo <antoniogmc at gmail dot com>
* Distributed under the terms of the MIT License
*/
package tonivade.db.command.key;
import static java.util.stream.Collectors.toSet;
import java.util.Set;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import tonivade.db.command.ITinyDBCommand;
import tonivade.db.command.annotation.ReadOnly;
import tonivade.db.data.DatabaseKey;
import tonivade.db.data.IDatabase;
import tonivade.redis.annotation.Command;
import tonivade.redis.annotation.ParamLength;
import tonivade.redis.command.IRequest;
import tonivade.redis.command.IResponse;
import tonivade.redis.protocol.SafeString;
@ReadOnly
@Command("keys")
@ParamLength(1)
public class KeysCommand implements ITinyDBCommand {
@Override
public void execute(IDatabase db, IRequest request, IResponse response) {
Pattern pattern = createPattern(request.getParam(0));
Predicate<? super DatabaseKey> predicate = (key) -> {
return pattern.matcher(key.toString()).matches();
};
Set<SafeString> keys = db.keySet().stream().filter(predicate).map(DatabaseKey::getValue).collect(toSet());
response.addArray(keys);
}
private Pattern createPattern(SafeString param) {
return Pattern.compile(convertGlobToRegEx(param.toString()));
}
/*
* taken from http://stackoverflow.com/questions/1247772/is-there-an-equivalent-of-java-util-regex-for-glob-type-patterns
*/
private String convertGlobToRegEx(String line) {
int strLen = line.length();
StringBuilder sb = new StringBuilder(strLen);
boolean escaping = false;
int inCurlies = 0;
for (char currentChar : line.toCharArray()) {
switch (currentChar) {
case '*':
if (escaping) {
sb.append("\\*");
} else {
sb.append(".*");
}
escaping = false;
break;
case '?':
if (escaping) {
sb.append("\\?");
} else {
sb.append('.');
}
escaping = false;
break;
case '.':
case '(':
case ')':
case '+':
case '|':
case '^':
case '$':
case '@':
case '%':
sb.append('\\');
sb.append(currentChar);
escaping = false;
break;
case '\\':
if (escaping) {
sb.append("\\\\");
escaping = false;
} else {
escaping = true;
}
break;
case '{':
if (escaping) {
sb.append("\\{");
} else {
sb.append('(');
inCurlies++;
}
escaping = false;
break;
case '}':
if (inCurlies > 0 && !escaping) {
sb.append(')');
inCurlies--;
} else if (escaping) {
sb.append("\\}");
} else {
sb.append("}");
}
escaping = false;
break;
case ',':
if (inCurlies > 0 && !escaping) {
sb.append('|');
} else if (escaping) {
sb.append("\\,");
} else {
sb.append(",");
}
break;
default:
escaping = false;
sb.append(currentChar);
}
}
return sb.toString();
}
}
| [
"antoniogmc@gmail.com"
] | antoniogmc@gmail.com |
b1911bc229ef80b87a2a071bc1a3770123a28774 | eda6dbe107dd60b64aa750ff605a9790995ab327 | /app/src/main/java/com/ywzheng/znote/ui/adapter/array.java | b8f562976b167d71ba248da92eafbe32b3c4942d | [] | no_license | YWzheng/Znote | 2bcfca7b589eb0b1b5fa80ab873e614c0424bf9e | c9fb999cd7bda0d04acaa0748fc8ea316577fca5 | refs/heads/master | 2020-12-25T17:29:56.699625 | 2016-11-24T09:05:38 | 2016-11-24T09:05:38 | 47,962,877 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package com.ywzheng.znote.ui.adapter;
import android.content.Context;
import android.widget.ArrayAdapter;
/**
* Created by yongwei on 2016/9/6.
*/
public class array extends ArrayAdapter {
public array(Context context, int resource) {
super(context, resource);
}
}
| [
"zhengyongwei2015@gmail.com"
] | zhengyongwei2015@gmail.com |
f972eafa7416c8b61ca24c7e8fa57bc55bc14775 | cc1477be5ed57a4f90d2084c3491020e16cc7d1f | /src/main/java/com/alibinshao/zhonghong/fdp/sys/service/SysMenuService.java | 0eb44e5a9b5e6566748ad719c98a5d8eec81516b | [] | no_license | alibinshao860118/com.alibinshao.AppServer | 97f907d95227930420358cb0d3dccf3ebcac7d66 | 714ec04aa146745987b11a67f8db8298b5a97cfc | refs/heads/master | 2022-07-07T13:56:37.256933 | 2019-11-20T03:59:09 | 2019-11-20T03:59:09 | 216,303,352 | 0 | 0 | null | 2022-06-21T02:04:40 | 2019-10-20T03:42:43 | JavaScript | UTF-8 | Java | false | false | 3,701 | java | /**
* Copyright © 2012-2017 <a href="http://www.foresee.com">Foresee</a> All rights reserved.
*/
package com.alibinshao.zhonghong.fdp.sys.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibinshao.zhonghong.fdp.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibinshao.zhonghong.fdp.common.persistence.Page;
import com.alibinshao.zhonghong.fdp.common.service.CrudService;
import com.alibinshao.zhonghong.fdp.sys.entity.SysMenu;
import com.alibinshao.zhonghong.fdp.sys.utils.UserUtils;
import com.alibinshao.zhonghong.fdp.sys.dao.ISysMenuDao;
/**
* <pre>
* Service服务类
* </pre>
* @author gulong
* @version 1.00.00
* <pre>
* 修改记录
* 修改后版本: 修改人: 修改日期: 修改内容:
* </pre>
*/
@Service
@Transactional(readOnly = true)
public class SysMenuService extends CrudService<ISysMenuDao,SysMenu>{
public SysMenu get(String id) {
return super.get(id);
}
public List<SysMenu> findList(SysMenu entity) {
return super.findList(entity);
}
public Page<SysMenu> findPage(SysMenu entity) {
return super.findPage(entity);
}
@Transactional(readOnly = false)
public void save(SysMenu entity) {
super.save(entity);
}
@Transactional(readOnly = false)
public void insert(SysMenu entity) {
entity.preInsert();
dao.insert(entity);
}
@Transactional(readOnly = false)
public void update(SysMenu entity) {
entity.preUpdate();
dao.update(entity);
}
@Transactional(readOnly = false)
public void delete(SysMenu entity) {
super.delete(entity);
}
/**
* 获取登录用户所拥有的菜单
* @return Map<String,Object>
*/
public List<Map<String,Object>> getMenus(){
List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();
boolean isAdmin = UserUtils.getUser().isAdmin();
SysMenu entity = new SysMenu();
entity.setParentId("0");
entity.setMenuType("1");
entity.setVisible("1");
if(isAdmin){
//超级管理员拥有所有的菜单
entity.setUserId(null);
}else{
//普通用户根据当前登录用户身份来获取可见菜单
entity.setUserId(UserUtils.getUser().getId());
}
List<SysMenu> topMenus = dao.findList(entity);
for (SysMenu sysMenu : topMenus) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("id", sysMenu.getId());
map.put("title", sysMenu.getName());
map.put("icon", sysMenu.getImageUrl());
map.put("isCurrent", true);
map.put("menu", getChildMenus(sysMenu.getId(),entity.getUserId()));
resultList.add(map);
}
return resultList;
}
private List<Map<String,Object>> getChildMenus(String parentId,String userId){
List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();
SysMenu entity = new SysMenu();
entity.setParentId(parentId);
entity.setMenuType("1");
entity.setVisible("1");
entity.setUserId(userId);
List<SysMenu> childMenus = dao.findList(entity);
for (SysMenu sysMenu : childMenus) {
Map<String,Object> map2 = new HashMap<String,Object>();
map2.put("id", sysMenu.getId());
map2.put("title", sysMenu.getName());
map2.put("icon", sysMenu.getImageUrl());
map2.put("href", sysMenu.getUrl());
map2.put("isCurrent", false);
resultList.add(map2);
if(StringUtils.equals("1", sysMenu.getMenuType())){
map2.put("children", getChildMenus(sysMenu.getId(), userId));
}
}
return resultList;
}
}
| [
"Administrator@liangbinbin-ww"
] | Administrator@liangbinbin-ww |
ebeb632d85c9436a44ae7b056f8516a8db77fd54 | 6ec5b562fbd587cd4ed51c934774cd48bf177774 | /gen/com/example/crappybird/R.java | da7c21bc0855fa1f5dd04a2f0c1b4e4f90ff428b | [] | no_license | mmust/CrappyBird | 57e8787f1dac9c8467c93bea6b55866fbf535076 | c174533c91576468848146c12dc525b572961d54 | refs/heads/master | 2021-01-15T08:48:26.228433 | 2015-07-06T15:24:25 | 2015-07-06T15:24:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,787 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.crappybird;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
public static final int ohwow=0x7f020001;
public static final int pajaro=0x7f020002;
public static final int pajarotear=0x7f020003;
public static final int success=0x7f020004;
}
public static final class id {
public static final int action_settings=0x7f080001;
public static final int restart=0x7f080002;
public static final int the_canvas=0x7f080000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int hello_world=0x7f050002;
public static final int restart=0x7f050003;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| [
"gabrielbendandi75@gmail.com"
] | gabrielbendandi75@gmail.com |
3ee79b64ea54a4e17725333cab4289e5fc693359 | 7fa927f667e13f81d729073b703dbaeb63b5e6a1 | /app/src/main/java/com/boop442/weather442/ui/MainActivity.java | f6b9f0928264165205c1bb22347efeeb2bcb8a27 | [] | no_license | telpuhova/weather442 | 41aef14e781801e4e5fbf2349e0d7f59e2e7e77d | b453bd2a09ba387a91d18a081092f3835cb10766 | refs/heads/master | 2021-04-12T05:00:28.950492 | 2018-04-09T03:24:46 | 2018-04-09T03:24:46 | 125,885,679 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,754 | java | package com.boop442.weather442.ui;
import android.content.Intent;
import android.graphics.Typeface;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.boop442.weather442.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
@BindView(R.id.locationsButton) Button mLocationsButton;
@BindView(R.id.aboutButton) Button mAboutButton;
@BindView(R.id.titleTextView) TextView mTitleTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/I Am Awake.ttf");
Typeface typeface2 = Typeface.createFromAsset(getAssets(), "fonts/Halimun.ttf");
mTitleTextView.setTypeface(typeface);
mLocationsButton.setOnClickListener(this);
mAboutButton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v == mLocationsButton) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user == null) {
FirebaseAuth.getInstance().signInAnonymously();
}
Intent intent = new Intent(MainActivity.this, LocationsActivity.class);
startActivity(intent);
}
if (v == mAboutButton) {
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
startActivity(intent);
}
}
//logging out
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_logout) {
logout();
return true;
}
return super.onOptionsItemSelected(item);
}
private void logout() {
FirebaseAuth.getInstance().signOut();
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}
}
| [
"telpuhova@gmail.com"
] | telpuhova@gmail.com |
df131bd3cf12bf30bfe9a92bac28c28b3382bd40 | 4b88d72de4c949899c748ecc508adfdabb9b3937 | /mood/android/main/src/com/localsocial/actions/CommandFactory.java | 4731346c7f3b63c503be830746715fa6ce392dc5 | [] | no_license | Rococo/localsocial-tutorials | 44189c8572f434cc4b3a5f29f9109472b40b2aa4 | ee56ea6c81fa3056c1bd0da3d7175b6de5c9fba7 | refs/heads/master | 2020-12-25T19:26:14.632678 | 2012-07-05T22:53:22 | 2012-07-05T22:53:22 | 1,603,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,629 | java | package com.localsocial.actions;
import java.util.concurrent.Executor;
import com.localsocial.model.ObjectCache;
import android.content.Context;
import android.os.Handler;
import android.widget.Toast;
public class CommandFactory {
/**
* create a command to execute in a ui handler thread
*
* @param command the command
* @return the ui command
*/
public static void toast(String msg) {
Context ctx = (Context) ObjectCache.getObject("com.localsocial.tulsi.Context");
Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
}
/**
* create a command to execute in a ui handler thread
*
* @param command the command
* @return the ui command
*/
// public static Command createCommand(final Handler handler, Command command) {
// if (command == null)
// return null;
// return new DelegatingCommand(command) {
//
// @Override
// public void execute(final Object param) {
// handler.post(new Runnable() {
//
// @Override
// public void run() {
// try {
// m_command.execute(param);
// } catch (Exception e) {
// e.printStackTrace();
// toast("Unexpected error processing command");
// }
// }
// });
// }
// };
// };
/**
* create a command to execute in a non-ui handler thread
*
* @param command the command
* @return the non-ui command
*/
// public static Command createCommand(final Executor executor, Command command) {
// if (command == null)
// return null;
// return new DelegatingCommand(command) {
// @Override
// public void execute(final Object param) {
// executor.execute(new Runnable() {
// @Override
// public void run() {
// try {
// m_command.execute(param);
// } catch (Exception e) {
// e.printStackTrace();
// toast("Unexpected error processing command");
// }
// }
//
// public String toString() {
// return new StringBuffer().append(m_command).append(" : ").append(param).toString();
// }
//
// });
// }
// };
// };
}
| [
"m.nairn@gmail.com"
] | m.nairn@gmail.com |
2e78728a45289f766737d9a80e9f3420f3bf2481 | 53fcd006c4ba5b48fb4a5554ad5b0467366f6d1f | /app/src/main/java/com/geek/listcontacts/model/ContactModel.java | 33a78c7874641de0a32ba1a5ff0196d2a7163170 | [] | no_license | Miraida/List-Contacts | 852fa4a1e861640826a6e48c4f69abe3994312f0 | 6563fa1537bf313f0373f0b121d1fa7a75abb934 | refs/heads/master | 2023-03-28T07:30:17.355152 | 2021-04-01T15:20:29 | 2021-04-01T15:20:29 | 353,742,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.geek.listcontacts.model;
import java.io.Serializable;
public class ContactModel implements Serializable {
String name;
String number;
public ContactModel(String name, String number) {
this.name = name;
this.number = number;
}
public String getName() {
return name;
}
public String getNumber() {
return number;
}
}
| [
"miraidajaanbaeva@gmail.com"
] | miraidajaanbaeva@gmail.com |
7fbd64d7b1007ce9fdda4f35eea4f3a92f949e51 | 115cb73dce13f0ac6ee814f8fe724fdd5c804ee0 | /MongoDBExample/src/main/java/useritem/User.java | 59f896b3e7810f5a61ad6018935d88836490ac31 | [] | no_license | FrancoGT3/MongoProjectsFrancoHenryJulio | a823b17b858eb5958a03ca2dc491c769aa3da711 | dc5d533e98e78d692bcb4078e1a5c8d4f83eaee6 | refs/heads/master | 2021-08-16T17:32:19.193359 | 2017-11-20T05:43:23 | 2017-11-20T05:43:23 | 111,367,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package useritem;
import java.util.List;
import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;
import com.google.code.morphia.annotations.Embedded;
@Entity
public class User
{
@Id
private String id;
private String name;
@Embedded
private List<Item> items;
private int itemCount;
public User() {}
public User(String id, String name, List<Item> items)
{
this.id = id;
this.name = name;
this.items = items;
this.itemCount = items.size();
}
public String getId()
{
return id;
}
public List<Item> getItems()
{
return items;
}
public String toString()
{
return "User id: " + id + ", name: " + name + ", " + itemCount + " items: " + items;
}
} | [
"darkfranco@github.com"
] | darkfranco@github.com |
5b46fb38491e9b8c84120bcc09063f6fcefd6498 | f3f1917e06a3aba7ea5aaab7b1139122f1540b34 | /src/main/java/com/alexandrepontes/userRegistration/resources/UserResource.java | f6b7b620f5a0f8df58e84b0247a4a8546c82e6c9 | [] | no_license | apontes77/API-study-Spring | 47bc1f63dc0f1bc839cfc44b9bfd4b9a9774bcd3 | a0657ca38358269c489c04bc900523d06f68cc1d | refs/heads/main | 2023-02-12T15:42:52.022113 | 2021-01-03T22:45:47 | 2021-01-03T22:45:47 | 325,403,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,919 | java | package com.alexandrepontes.userRegistration.resources;
import com.alexandrepontes.userRegistration.models.User;
import com.alexandrepontes.userRegistration.services.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import javax.validation.Valid;
import java.net.URI;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "/api")
@Api(value="API REST Users")
@CrossOrigin(origins="*")
public class UserResource {
@Autowired
private UserService userService;
@RequestMapping(value="/users/{id}", method = RequestMethod.GET)
@ApiOperation(value = "Retorna um usuário em particular por meio do seu ID.")
public ResponseEntity<User> find(@PathVariable Long id) {
User user = userService.find(id);
return ResponseEntity.ok().body(user);
}
@RequestMapping(method=RequestMethod.POST, value = "/users")
@ApiOperation(value = "Insere um usuário na base de dados.")
public ResponseEntity<Void> insert(@Valid @RequestBody User u){
User user = new User();
user = userService.insert(u);
URI uri = ServletUriComponentsBuilder
.fromCurrentRequest()
.path("/{id}")
.buildAndExpand(user.getId())
.toUri();
return ResponseEntity.created(uri).build();
}
@RequestMapping(value="/users/{id}", method=RequestMethod.PUT)
@ApiOperation(value = "Atualiza dados de um usuário por meio do seu ID.")
public ResponseEntity<Void> update(@Valid @RequestBody User u, @PathVariable Long id){
u.setId(userService.find(id).getId());
userService.update(u);
return ResponseEntity.noContent().build();
}
@RequestMapping(value="/users/{id}", method = RequestMethod.DELETE)
@ApiOperation(value = "Exclui dados de um usuário por meio do seu ID.")
public ResponseEntity<Void> delete(@PathVariable Long id) {
userService.delete(id);
return ResponseEntity.noContent().build();
}
@RequestMapping(method = RequestMethod.GET, value = "/users")
@ApiOperation(value = "Retorna todos os usuários cadastrados na base de dados.")
public ResponseEntity<List<User>> findAll() {
List<User> users = userService.findAll();
List<User> totalUsers = users.stream()
.map(obj -> new User(obj.getId(), obj.getName(), obj.getCPF(), obj.getEmail(), obj.getBirthDay()))
.collect(Collectors.toList());
return ResponseEntity.ok().body(totalUsers);
}
}
| [
"alexandrepontesgyn@gmail.com"
] | alexandrepontesgyn@gmail.com |
6f2baa785b0cc5b96a6ccea05b0b24def365208e | d044c2eba5c2a616368d8ef50bbe991030ed8dc1 | /TagBAdmin/app/src/main/java/com/nechingu/tagbadmin/ui/Header.java | 6b3e28b59668bc3ab74684cd738d8d2829ac8c17 | [] | no_license | cmFodWx5YWRhdjEyMTA5/android_working | a23822b18709052480915f6d2df2274505ee93f8 | 926b605700a7b8d994a7d239320e9b60421ace62 | refs/heads/master | 2022-12-14T23:44:01.890608 | 2020-09-21T13:29:23 | 2020-09-21T13:29:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,146 | java | package com.nechingu.tagbadmin.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.nechingu.tagbadmin.R;
public class Header extends RelativeLayout implements OnClickListener {
public static final String LOGO = "logo";
private static final String BUTTON_TEXT_BACK = "뒤로";
private View vewLogoTitle;
private LinearLayout llHeaderLeft;
private TextView tvHeaderLeft;
private Button btnHeaderRight;
private TextView txtHeaderTitle;
private ButtonType mLeftButtonType;
private ButtonType mRightButtonType;
public enum ButtonType {
NONE, LOGO, BACK, SETTING, LOGIN, LOGOUT
}
public Header(Context context, AttributeSet attrs) {
super(context, attrs);
addView(((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.header, this, false));
vewLogoTitle = findViewById(R.id.vewLogoTitle);
llHeaderLeft = (LinearLayout)findViewById(R.id.llHeaderLeft);
tvHeaderLeft = (TextView) findViewById(R.id.tvHeaderLeft);
btnHeaderRight = (Button) findViewById(R.id.btnHeaderRight);
txtHeaderTitle = (TextView) findViewById(R.id.txtHeaderTitle);
}
public void setTitle(String title) {
vewLogoTitle.setVisibility(View.GONE);
txtHeaderTitle.setVisibility(View.VISIBLE);
txtHeaderTitle.setText(title);
}
public void setTitle(ButtonType buttonType) {
vewLogoTitle.setVisibility(View.VISIBLE);
txtHeaderTitle.setVisibility(View.GONE);
}
public void setLeftButton(ButtonType buttonType) {
setLeftButton(buttonType, this);
}
/**
*
* set header left button.
*
* @param leftButtonText
* text for left button. if null or empty, left button will not be displayed. if {@link #LOGO} logo will
* be displayed.
* @param onClickListener
* set OnclickListener to left button.
*/
public void setLeftButton(String leftButtonText, OnClickListener onClickListener) {
llHeaderLeft.setOnClickListener(onClickListener);
if (leftButtonText == null || leftButtonText.trim().equals("")) {
llHeaderLeft.setVisibility(View.GONE);
} else {
llHeaderLeft.setVisibility(View.VISIBLE);
tvHeaderLeft.setText(leftButtonText);
}
if(BUTTON_TEXT_BACK.equals(leftButtonText)) {
tvHeaderLeft.setText("");
}
}
public void setLeftButton(ButtonType leftButtonType, OnClickListener onClickListener) {
mLeftButtonType = leftButtonType;
switch (leftButtonType) {
case BACK :
llHeaderLeft.setVisibility(View.VISIBLE);
llHeaderLeft.setOnClickListener(onClickListener);
break;
default:
break;
}
}
/**
* set header right button.
*
* @param rightButtonText
* text for right button. if null or empty, right button will not be displayed.
*
* @param onClickListener
* set OnclickListener to right button.
*/
public void setRightButton(String rightButtonText, OnClickListener onClickListener) {
btnHeaderRight.setOnClickListener(onClickListener);
if (rightButtonText == null || rightButtonText.trim().equals("")) {
btnHeaderRight.setVisibility(View.GONE);
} else {
btnHeaderRight.setVisibility(View.VISIBLE);
btnHeaderRight.setText(rightButtonText);
}
}
public void setRightButton(ButtonType rightButtonType, OnClickListener onClickListener) {
mRightButtonType = rightButtonType;
switch (rightButtonType) {
case SETTING:
btnHeaderRight.setVisibility(View.VISIBLE);
btnHeaderRight.setOnClickListener(onClickListener);
break;
default:
break;
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.llHeaderLeft:
if (mLeftButtonType == ButtonType.BACK) {
}
break;
case R.id.btnHeaderRight:
if (mRightButtonType == ButtonType.SETTING) {
}
break;
}
}
} | [
"glediaer@gmail.com"
] | glediaer@gmail.com |
0570fc3c50b3ecf5c3085b4257875f73b4f13c08 | 956622ad2a8a50f4b19a5b31501ccaaac5a6af61 | /toolkit/Source/src/gs2d/projects/Android/GS2D/src/net/asantee/gs2d/audio/MediaStreamManager.java | 8b679beb7ca586c3df2976290c91d0a663ebdec8 | [
"MIT"
] | permissive | NandoKstroNet/ethanon | 9a7eb064ad5136438c00a78c5e31251818c909b5 | 3edbc02981a575ac321b9c1d274c429324941aac | refs/heads/master | 2021-01-17T22:24:55.358357 | 2013-08-30T14:02:54 | 2013-08-30T14:02:54 | 13,395,505 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,975 | java | /*--------------------------------------------------------------------------------------
Ethanon Engine (C) Copyright 2008-2013 Andre Santee
http://ethanonengine.com/
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------------*/
package net.asantee.gs2d.audio;
import java.io.IOException;
import net.asantee.gs2d.GS2DActivity;
import android.app.Activity;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.media.AudioManager;
import android.media.MediaPlayer;
public class MediaStreamManager {
private static MediaPlayer mediaPlayer = null;
private Activity activity;
private AssetManager assets;
private AudioManager manager;
private static float globalVolume = 1.0f;
private String currentTrack = "";
public MediaStreamManager(Activity activity) {
this.activity = activity;
this.manager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
this.assets = activity.getAssets();
}
public static void setGlobalVolume(float volume) {
globalVolume = volume;
setVolume(volume);
}
public static float getGlobalVolume() {
return globalVolume;
}
public boolean load(String fileName) {
// dummy (will be loaded on play time)
return true;
}
public void stop() {
if (mediaPlayer != null) {
mediaPlayer.stop(); // Hammertime!
}
}
public void release() {
mediaPlayer.release();
mediaPlayer = null;
}
public static void setVolume(float volume) {
if (mediaPlayer != null) {
mediaPlayer.setVolume(volume * globalVolume, volume * globalVolume);
}
}
private boolean mayKeepSong(String fileName) {
return (fileName.equals(currentTrack) && mediaPlayer.isPlaying());
}
public void play(String fileName, float volume, float speed, boolean loop) {
if (mediaPlayer != null) {
if (mayKeepSong(fileName)) {
return;
} else {
mediaPlayer.stop();
}
}
currentTrack = fileName;
float streamVolume = manager.getStreamVolume(AudioManager.STREAM_MUSIC);
streamVolume /= manager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
streamVolume *= MediaStreamManager.getGlobalVolume() * volume;
String relativeFileName = SoundEffectManager.removePrefix(fileName, SoundEffectManager.PREFIX);
AssetFileDescriptor afd;
try {
afd = assets.openFd(relativeFileName);
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
mediaPlayer.prepare();
if (afd != null) {
try {
afd.close();
} catch (IOException e) {
GS2DActivity.toast(fileName + " couldn't close asset", activity);
}
}
} catch (IOException e) {
GS2DActivity.toast(fileName + " file not found", activity);
return;
}
mediaPlayer.setLooping(loop);
setVolume(streamVolume);
mediaPlayer.start();
}
}
| [
"andre.santee@gmail.com"
] | andre.santee@gmail.com |
66948321130a361affa73fb3e9dfc358e1d03949 | 8534ea766585cfbd6986fd845e59a68877ecb15b | /com/slideme/sam/manager/controller/activities/common/AccountAwareActivity.java | e60ed5242de9f4f9ddb2237c6c6d2f9e1e4aaebc | [] | no_license | Shanzid01/NanoTouch | d7af94f2de686f76c2934b9777a92b9949b48e10 | 6d51a44ff8f719f36b880dd8d1112b31ba75bfb4 | refs/heads/master | 2020-04-26T17:39:53.196133 | 2019-03-04T10:23:51 | 2019-03-04T10:23:51 | 173,720,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package com.slideme.sam.manager.controller.activities.common;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.os.Bundle;
import com.slideme.sam.manager.SAM;
import com.slideme.sam.manager.util.C1914e;
import com.slideme.sam.manager.util.C1922m;
public abstract class AccountAwareActivity extends FlipperFragmentActivity {
private AccountManagerCallback<Bundle> f2739a = new C1656a(this);
public abstract void mo4239a();
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (!SAM.f2622o.m4851c() && this.k) {
mo4242b();
}
}
protected void onDestroy() {
super.onDestroy();
}
protected void onPostCreate(Bundle bundle) {
super.onPostCreate(bundle);
if (SAM.f2622o.m4851c()) {
mo4239a();
}
}
private void mo4242b() {
AccountManager accountManager = AccountManager.get(this);
Account[] accountsByType = accountManager.getAccountsByType("com.slideme.user_account");
if (C1914e.f3493a) {
C1922m.m5797b("AccountManager", "handleAccount -> " + String.valueOf(accountsByType.length) + " accounts");
}
switch (accountsByType.length) {
case 0:
accountManager.addAccount("com.slideme.user_account", "Normal user", null, null, this, this.f2739a, null);
return;
case 1:
accountManager.getAuthToken(accountsByType[0], "com.slideme.user_account", null, this, this.f2739a, null);
return;
default:
SAM.f2622o.m4847a(this, new C1657b(this, accountManager), true);
return;
}
}
}
| [
"shanzid.shaiham@gmail.com"
] | shanzid.shaiham@gmail.com |
542dcaa67d0317771055aba95e90a527e8cc2869 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_f2973903804837a6c3357b7d013d134a918de276/FICostbasisLayout/2_f2973903804837a6c3357b7d013d134a918de276_FICostbasisLayout_t.java | 5f6912dd0eff849001192b55e4700567e2f17ead | [] | 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 | 15,431 | java | /**
*
*/
package com.grimesco.gcocentralapp.Fidelity;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import com.grimesco.gcocentral.FImanageFileUpload;
import com.grimesco.gcocentral.act.dao.account.ACTAccountDao;
import com.grimesco.gcocentral.fidelity.dao.*;
import com.grimesco.gcocentralapp.GCOCentralSetting;
import com.grimesco.translateFidelity.model.POJO.FIcostbasis;
import com.grimesco.translateFidelity.model.POJO.FIreconciliation;
import com.grimesco.translateFidelity.model.POJO.FItransaction;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
/**
* @author jaeboston
*
*/
public class FICostbasisLayout extends VerticalLayout {
private static Logger logger = LoggerFactory.getLogger(FICostbasisLayout.class);
/**
*
*/
private static final long serialVersionUID = 1L;
static public java.util.Date workingDate;
public FIcostbasisDao costbasisDao;
public FItransactionDao transactionDao;
public ACTAccountDao actAccountDao;
public FItransaction workingTransaction;
public FIcostbasis workingCostbasis;
public String workingShortName;
public ArrayList<FIreconciliation> reconciliationList;
public ArrayList<FIreconciliation> selectedCostbasisList;
public Table reconsiliationTable;
public Label selected;
public Label manCostbasisLabel;
private Label spacer = new Label(" ");
public IndexedContainer reconsiliationTableSource; //-- source for the reconsiliation table
public Button manResolvetButton = new Button("Submit costbasis");
public Button rejectButton = new Button("Reject this costbasis");
public Button cancelButton = new Button("Cancel");
public TextField manCostbasisField;
public HorizontalLayout manCostbasisLayout;
//-- constructor
public FICostbasisLayout() {
}
//-- constructor
public void init(String caption, FIcostbasisDao _costbasisDao, String _shortName, final long _transactionID, ArrayList<FIreconciliation> _reconciliationList, FItransactionDao _transactionDao, ACTAccountDao _actaccountDao, final java.util.Date _workingdate) {
//-- clear out the layout
this.removeAllComponents();
this.workingDate = _workingdate;
this.transactionDao = _transactionDao;
this.costbasisDao = _costbasisDao;
this.actAccountDao = _actaccountDao;
this.reconciliationList = _reconciliationList;
this.workingShortName = _shortName;
this.setWidth("1150px");
this.setHeight("600px");
//-- get the working FItransaction
this.workingTransaction = transactionDao.get(_transactionID);
this.workingCostbasis = costbasisDao.getByTransactionID(_transactionID);
this.setMargin(true);
this.setSpacing(true);
//-- make it fill the whole window
setSizeFull();
// Add some content; a label and a close-button
Label message = new Label(
"<h1> Working on the following transaction</h1>"
+ "<table cellspacing='20'>"
+ "<tr><th>Short Name</th><th>File Date</th><th>Symbol</th><th>Trade Date</th><th>Quantity</th><th>Net Amount</th></tr>"
+ "<tr><td>" + this.workingShortName + "</td>"
+ "<td>" + this.workingTransaction.getSOURCE_DATE_display() + "</td>"
+ "<td>" + String.valueOf(this.workingTransaction.getSYMBOL()) + "</td>"
+ "<td>" + this.workingTransaction.getTRANSACTION_DATE_display() + "</td>"
+ "<td>" + String.valueOf(this.workingTransaction.getTRANSACTION_QUANTITY()) + "</td>"
+ "<td>" + String.valueOf(this.workingTransaction.getAMOUNT()) + "</td></tr></table><hr>");
message.setContentMode(Label.CONTENT_XHTML);
this.addComponent(message);
//-- label configuration
manCostbasisLabel = new Label("Selected Costbasis Quantity");
//-- costbasis text field configuration
manCostbasisField = new TextField();
manCostbasisField.setInputPrompt("Enter costbasis");
manCostbasisField.setImmediate(true);
//-- costbasis manual sumbit button configuration
manResolvetButton.setVisible(false);
manResolvetButton.setImmediate(true);
//-- costbasis reject button configuration
rejectButton.setVisible(true);
rejectButton.setImmediate(true);
//rejectButton.setStyleName(Runo.BUTTON_LINK);
//-- addNewRow button configuration
cancelButton.setVisible(true);
cancelButton.setImmediate(true);
//-- Man costbasis layout configuration
manCostbasisLayout = new HorizontalLayout();
manCostbasisLayout.setMargin(true);
manCostbasisLayout.setSpacing(true);
manCostbasisLayout.addComponent(manCostbasisLabel);
manCostbasisLayout.addComponent(manCostbasisField);
manCostbasisLayout.addComponent(manResolvetButton);
manCostbasisLayout.addComponent(cancelButton);
this.spacer.setWidth("200px");
manCostbasisLayout.addComponent(this.spacer);
manCostbasisLayout.addComponent(rejectButton);
//-- Add the layout to window
this.addComponent(manCostbasisLayout);
//--Add reconciliation list table
reconsiliationTable = new Table();
reconsiliationTable.setHeight("400px");
//-- selectable
reconsiliationTable.setSelectable(true);
reconsiliationTable.setMultiSelect(true);
reconsiliationTable.setImmediate(true); // react at once when something is selected
this.addComponent(reconsiliationTable);
//-- add selected label
selected = new Label("No selection");
this.addComponent(selected);
//-- Populate the content in the table
reconsiliationTableSource = GCOCentralSetting.updateFIReconciliationContainer(this.reconciliationList);
reconsiliationTable.setContainerDataSource(reconsiliationTableSource);
//-- set the fotters
reconsiliationTable.setFooterVisible(true);
reconsiliationTable.setColumnFooter("Source Date", "Total");
reconsiliationTable.setColumnFooter("Current Quantity", String.valueOf(getTotalQuantity()));
reconsiliationTable.setColumnFooter("Cost Basis", String.valueOf(getTotalCostBasis()));
reconsiliationTable.setColumnFooter("Adjusted Cost Basis", String.valueOf(getTotalAdjCostBasis()));
//-------------------------------------------
//-- // listen for valueChange, a.k.a 'select' and update the label
//-------------------------------------------
reconsiliationTable.addValueChangeListener(new Table.ValueChangeListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
// in multiselect mode, a Set of itemIds is returned,
// in singleselect mode the itemId is returned directly
Set<?> value = (Set<?>) event.getProperty().getValue();
double selectedQuantity = 0.0;
if (null == value || value.size() == 0) {
selected.setValue("No selection");
} else {
//-- work through the selected rows of the table
Set<?> itemids = (Set<?>)reconsiliationTable.getValue();
int reconciliationID;
selectedCostbasisList = new ArrayList<FIreconciliation>();
Iterator iterator = itemids.iterator();
while(iterator.hasNext()) {
Object item = iterator.next();
//selectedQuantity = selectedQuantity + Double.parseDouble(String.valueOf(reconsiliationTable.getContainerProperty(item, "Current Quantity")));
selectedQuantity = selectedQuantity + Double.parseDouble((String)(reconsiliationTable.getContainerProperty(item, "Current Quantity").getValue()));
//reconciliationID = Integer.parseInt(String.valueOf(reconsiliationTable.getContainerProperty(item, "ID")));
reconciliationID = Integer.parseInt((String)reconsiliationTable.getContainerProperty(item, "ID").getValue());
selectedCostbasisList.add(findReconciliation(reconciliationID));
}
//-- set the value in the field
manCostbasisField.setValue(String.valueOf(round(selectedQuantity)));
selected.setValue("Selected Transactions: <b>" + itemids.size() + "</b>");
selected.setContentMode(Label.CONTENT_XHTML);
manResolvetButton.setVisible(true);
}
}
});
//-------------------------------------------
//-- listerner for export button : update the database done in FIView.java
//-------------------------------------------
manResolvetButton.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
}
});
//-------------------------------------------
//-- listerner for rejectButton : database update done on FIView.java using executeReject() method
//-------------------------------------------
rejectButton.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
}
});
} //-- end of init
//-- public method
public void executeResolution() {
int insertedRows = 0;
boolean dateValid = true;
ArrayList<FItransaction> costbase_transactionList = new ArrayList<FItransaction>();
//-- Build the data
//-- create a new transaction for each of the selected reconciliation record with cost basis
for (FIreconciliation rec : selectedCostbasisList) {
FItransaction transaction = new FItransaction();
//-- populate new transaction
transaction.setID(rec.getID());
transaction.setACCOUNT_NUMBER(rec.getACCOUNT_NUMBER());
transaction.setAMOUNT(rec.getCOST_BASIS_AMOUNT());
transaction.setBROKER_CODE(workingTransaction.getBROKER_CODE());
transaction.setCOMMISSION(workingTransaction.getCOMMISSION());
transaction.setKICK_OUT_CODE(workingTransaction.getKICK_OUT_CODE());
transaction.setOPTION_SYMBOL(workingTransaction.getOPTION_SYMBOL());
transaction.setSETTLEMENT_DATE(rec.getLOT_ACQUIRED_DATE());
transaction.setSOURCE(workingTransaction.getSOURCE());
transaction.setSYMBOL(workingTransaction.getSYMBOL());
transaction.setTRANSACTION_DATE(workingTransaction.getTRANSACTION_DATE());
transaction.setTRANSACTION_QUANTITY(rec.getLOT_QUANTITY());
transaction.setTRANSACTION_SECURITY_TYPE_CODE(workingTransaction.getTRANSACTION_SECURITY_TYPE_CODE());
transaction.setTRANSACTION_TYPE_CODE(workingTransaction.getTRANSACTION_TYPE_CODE());
transaction.setSOURCE_DATE(workingTransaction.getSOURCE_DATE());
//-- Data Validation
//-- make sure resolved date is later than the file date
if (workingDate.before(transaction.getDATE_SOURCE_DATE())){
dateValid = false;
break;
}
costbase_transactionList.add(transaction);
}
if (dateValid) {
//-- upload the data to database
try {
//-- insert new transaction to transaction table
insertedRows = costbasisDao.insertBatchReconcilTransaction(workingCostbasis.getID(), costbase_transactionList, workingDate);
} catch (DataAccessException e) {
//-- Error and exception statements.
Notification.show("error updating: ", e.getMessage(), Notification.Type.ERROR_MESSAGE); //-- Notification
}
//-- when it is done close window
if (insertedRows == selectedCostbasisList.size()) {
//-- remove the parent's panel content done it on FIView.java
//((Panel)getParent()).setContent(null);
} else {
Notification.show("updated rows = " + insertedRows + "COSTBASIS trnasction NOT updated correctly: ", Notification.Type.ERROR_MESSAGE);
}
} else {
Notification.show("Resolution Date should be later than the File date", Notification.Type.ERROR_MESSAGE); //-- Notification
}
}
public void executeReject() {
int updatedRows = 0;
//-- upload the data to database
try {
//-- insert new transaction to transaction table
updatedRows = costbasisDao.updateRejectUnresolvedCostBasis(this.workingTransaction.ID);
//updateBatchRejectUnresolvedCostBasis
} catch (DataAccessException e) {
//-- Error and exception statements.
Notification.show("error updating: ", e.getMessage(), Notification.Type.ERROR_MESSAGE); //-- Notification
}
//-- when it is done close window
if (updatedRows == 1) {
//-- refresh parent windows's table.
} else {
//-- show error message to make sure
Notification.show("updated rows = " + updatedRows + "COSTBASIS transction NOT updated correctly: ", Notification.Type.ERROR_MESSAGE);
}
}
//-- private method
private double getTotalQuantity() {
double sum = 0;
for (FIreconciliation rec : reconciliationList) {
sum = sum + Double.parseDouble(String.valueOf(rec.getLOT_QUANTITY()));
}
//-- round
return round(sum);
}
//-- private method
private double getTotalCostBasis() {
double sum = 0;
for (FIreconciliation rec : reconciliationList) {
sum = sum + Double.parseDouble(String.valueOf(rec.getCOST_BASIS_AMOUNT()));
}
//-- round
return round(sum);
}
//-- private method
private double getTotalAdjCostBasis() {
double sum = 0;
for (FIreconciliation rec : reconciliationList) {
sum = sum + Double.parseDouble(String.valueOf(rec.getTOTAL_ADJUSTED_COST_BASIS_AMOUNT()));
}
return round(sum);
}
//-- private method
private double round(double num) {
double factor = 1e4; // = 1 * 10^5 = 10000.
double result = Math.round(num * factor) / factor;
return result;
}
//-- private method
private FIreconciliation findReconciliation(int id) {
for(FIreconciliation recond : this.reconciliationList) {
if (recond.getID() == id)
return recond;
}
//-- if nothing is found, return NULL
return null;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
eb04a412ab7039e5d06ac1861aff968b1eb78c85 | 1bd6a2e8767799106e8c9723a8b19ffa39c04430 | /remittancemgmt/src/main/java/com/cg/ibs/remittancemgmt/bean/AutoPayment.java | 1282d161bc5de0905962e2b2cd59ad00ac87771f | [] | no_license | srujansudam/remittancemgmt | 421fc65b8903beb1b8cb06ef3bf809d89c1c1a4c | ba154694a24ab8d533dc13881e84d2b5b0b57747 | refs/heads/master | 2020-08-05T14:23:48.342296 | 2019-10-31T01:59:33 | 2019-10-31T01:59:33 | 212,576,900 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,366 | java | package com.cg.ibs.remittancemgmt.bean;
import java.math.BigDecimal;
import java.math.BigInteger;
public class AutoPayment {
private BigDecimal amount;
private String dateOfStart;
private int ibsServiceChoice;
private BigInteger serviceProviderId;
public AutoPayment() {
super();
}
public AutoPayment(BigDecimal amount, String dateOfStart, int ibsServiceChoice) {
super();
this.amount = amount;
this.dateOfStart = dateOfStart;
this.ibsServiceChoice = ibsServiceChoice;
}
@Override
public String toString() {
return "AutoPayment [amount=" + amount + ", dateOfStart=" + dateOfStart + ", ibsServiceChoice="
+ ibsServiceChoice + "]";
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getDateOfStart() {
return dateOfStart;
}
public void setDateOfStart(String dateOfStart) {
this.dateOfStart = dateOfStart;
}
public int getIbsServiceChoice() {
return ibsServiceChoice;
}
public void setIbsServiceChoice(int ibsServiceChoice) {
this.ibsServiceChoice = ibsServiceChoice;
}
public BigInteger getServiceProviderId() {
return serviceProviderId;
}
public void setServiceProviderId(BigInteger serviceProviderId) {
this.serviceProviderId = serviceProviderId;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e3f6454182573d7cb4433e9e478841e5a6fd894f | 46fdd819dae10ca59f54c88762de7f0f8058a40a | /finance-common/src/main/java/net/hedtech/banner/finance/common/Ftvprog/controller/FtvprogFormController.java | 2d9000ab906aba28a23c3e5443d6839962940586 | [] | no_license | marsellvov/common | ec15a727c42493cf8cefaf4d1f719b81d4415663 | d22f732fc858c51b96e307f3109f9ee795ac4e39 | refs/heads/master | 2021-01-13T15:25:33.824506 | 2015-10-23T10:34:21 | 2015-10-23T10:34:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,631 | java | package net.hedtech.banner.finance.common.Ftvprog.controller;
import java.util.*;
import morphis.core.utils.behavior.annotations.After;
import morphis.core.utils.behavior.annotations.Before;
import org.jdesktop.databuffer.DataRow.DataRowStatus;
import morphis.foundations.core.appdatalayer.*;
import morphis.foundations.core.appdatalayer.data.*;
import morphis.foundations.core.appdatalayer.events.*;
import morphis.foundations.core.types.*;
import morphis.foundations.core.appsupportlib.*;
import morphis.foundations.core.appsupportlib.exceptions.*;
import morphis.foundations.core.appsupportlib.model.*;
import morphis.foundations.core.appsupportlib.ui.KeyFunction;
import morphis.foundations.core.appsupportlib.util.*;
import morphis.foundations.core.appsupportlib.runtime.*;
import morphis.foundations.core.appsupportlib.runtime.control.*;
import morphis.foundations.core.appsupportlib.runtime.events.*;
import morphis.foundations.core.appsupportlib.runtime.controlsModel.*;
import morphis.foundations.core.appsupportlib.runtime.controlsModel.containers.*;
import morphis.foundations.core.appsupportlib.runtime.controlsModel.items.*;
import morphis.foundations.core.appsupportlib.runtime.controlsModel.lovs.*;
import morphis.foundations.core.appsupportlib.runtime.controlsModel.alerts.*;
import morphis.foundations.core.appsupportlib.runtime.action.*;
import static morphis.foundations.core.appsupportlib.runtime.TaskServices.*;
import static morphis.foundations.core.appsupportlib.runtime.ItemServices.*;
import static morphis.foundations.core.appsupportlib.runtime.BlockServices.*;
import static morphis.foundations.core.appsupportlib.runtime.ViewServices.*;
import static morphis.foundations.core.appsupportlib.runtime.MessageServices.*;
import static morphis.foundations.core.appsupportlib.runtime.ValueSetServices.*;
import static morphis.foundations.core.appsupportlib.runtime.LovServices.*;
import static morphis.foundations.core.appsupportlib.runtime.ListServices.*;
import static morphis.foundations.core.appsupportlib.runtime.TreeServices.*;
import static morphis.foundations.core.appsupportlib.Math.*;
import static morphis.foundations.core.appsupportlib.Lib.*;
import static morphis.foundations.core.appsupportlib.Globals.*;
import static morphis.foundations.core.types.Types.*;
import morphis.foundations.core.util.*;
import net.hedtech.general.common.dbservices.*;
import net.hedtech.general.common.dbservices.dbtypes.*;
import net.hedtech.general.common.forms.controller.DefaultFormController;
import net.hedtech.general.common.libraries.Foqrpls.*;
import net.hedtech.general.common.libraries.Goqrpls.*;
import net.hedtech.general.common.libraries.Goqwflw.*;
import net.hedtech.general.common.libraries.Eoqrpls.*;
import net.hedtech.banner.finance.common.Ftvprog.model.*;
import net.hedtech.banner.finance.common.Ftvprog.*;
import net.hedtech.banner.finance.common.Ftvprog.services.*;
import net.hedtech.general.common.libraries.Goqolib.services.GFormClass;
import net.hedtech.general.common.libraries.Goqolib.services.GInqFormClass;
public class FtvprogFormController extends DefaultFormController {
private GFormClass getGFormClass() {
return (net.hedtech.general.common.libraries.Goqolib.services.GFormClass) this.getTask().getTaskPart("GOQOLIB").getSupportCodeManager().getPackage("G$_FORM_CLASS");
}
private GInqFormClass getGInqFormClass() {
return (net.hedtech.general.common.libraries.Goqolib.services.GInqFormClass) this.getTask().getTaskPart("GOQOLIB").getSupportCodeManager().getPackage("G$_INQ_FORM_CLASS");
}
public FtvprogFormController (ITask task) {
super(task);
}
@Override
public FtvprogTask getTask() {
return (FtvprogTask)super.getTask();
}
public FtvprogModel getFormModel() {
return this.getTask().getModel();
}
//action methods generated from triggers
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.G$_VERIFY_ACCESS
*
*
*</p>
*/
@ActionTrigger(action="G$_VERIFY_ACCESS")
public void Ftvprog_GVerifyAccess()
{
getGFormClass().gVerifyAccess();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.G$_REVOKE_ACCESS
*
*
*</p>
*/
@ActionTrigger(action="G$_REVOKE_ACCESS")
public void Ftvprog_GRevokeAccess()
{
getGFormClass().gRevokeAccess();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE-FORM
*
*
*</p>
* @param args
*/
@TaskStartedPre
public void Ftvprog_TaskStartedPre(EventObject args)
{
getGFormClass().taskStartedPre(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE_FORM_TRG
*
*
*</p>
*/
@ActionTrigger(action="PRE_FORM_TRG")
public void Ftvprog_PreFormTrg()
{
getGFormClass().preFormTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.POST-FORM
*
*
*</p>
* @param args
*/
@TaskEnded
public void Ftvprog_TaskEnded(EventObject args)
{
getGFormClass().taskEnded(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.POST_FORM_TRG
*
*
*</p>
*/
@ActionTrigger(action="POST_FORM_TRG")
public void Ftvprog_PostFormTrg()
{
getGFormClass().postFormTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE-BLOCK
*
*
*</p>
*/
@Before
@ActionTrigger(action="PRE-BLOCK", function=KeyFunction.BLOCK_IN)
public void Ftvprog_blockIn()
{
getGFormClass().blockIn();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE_BLOCK_TRG
*
*
*</p>
*/
@ActionTrigger(action="PRE_BLOCK_TRG")
public void Ftvprog_PreBlockTrg()
{
getGFormClass().preBlockTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.POST-BLOCK
*
*
*</p>
*/
@Before
@ActionTrigger(action="POST-BLOCK", function=KeyFunction.BLOCK_OUT)
public void Ftvprog_blockOut()
{
getGFormClass().blockOut();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.POST_BLOCK_TRG
*
*
*</p>
*/
@ActionTrigger(action="POST_BLOCK_TRG")
public void Ftvprog_PostBlockTrg()
{
getGFormClass().postBlockTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE-COMMIT
*
*
*</p>
* @param args
*/
@BeforeCommit
public void Ftvprog_BeforeCommit(CancelEvent args)
{
getGFormClass().beforeCommit(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE_COMMIT_TRG
*
*
*</p>
*/
@ActionTrigger(action="PRE_COMMIT_TRG")
public void Ftvprog_PreCommitTrg()
{
getGFormClass().preCommitTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE-INSERT
*
*
*</p>
* @param args
*/
@BeforeRowInsert
public void Ftvprog_BeforeRowInsert(RowAdapterEvent args)
{
getGFormClass().beforeRowInsert(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.PRE-UPDATE
*
*
*</p>
* @param args
*/
@BeforeRowUpdate
public void Ftvprog_BeforeRowUpdate(RowAdapterEvent args)
{
getGFormClass().beforeRowUpdate(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.ON-ERROR
*
*
*</p>
* @param args
*/
@OnError
public void Ftvprog_OnError(EventObject args)
{
getGFormClass().onError(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.ON-ROLLBACK
*
*
*</p>
*/
@ActionTrigger(action="ON-ROLLBACK")
public void Ftvprog_OnRollback()
{
getGFormClass().onRollback();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.ON_ROLLBACK_TRG
*
*
*</p>
*/
@ActionTrigger(action="ON_ROLLBACK_TRG")
public void Ftvprog_OnRollbackTrg()
{
getGFormClass().onRollbackTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.ON-SELECT
*
*
*</p>
*/
@ActionTrigger(action="ON-SELECT")
public void Ftvprog_OnSelect()
{
getGFormClass().onSelect();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.POST-FORMS-COMMIT
*
*
*</p>
* @param args
*/
@AfterCommit
public void Ftvprog_AfterCommit(EventObject args)
{
getGFormClass().afterCommit(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.POST_FORMS_COMMIT_TRG
*
*
*</p>
*/
@ActionTrigger(action="POST_FORMS_COMMIT_TRG")
public void Ftvprog_PostFormsCommitTrg()
{
getGFormClass().postFormsCommitTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-BUTTON-PRESSED
*
*
*</p>
*/
@ActionTrigger(action="WHEN-BUTTON-PRESSED")
public void Ftvprog_buttonClick()
{
getGFormClass().click();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-NEW-FORM-INSTANCE
*
*
*</p>
* @param args
*/
@TaskStarted
public void Ftvprog_TaskStarted(EventObject args)
{
getGFormClass().taskStarted(args);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-NEW-BLOCK-INSTANCE
*
*
*</p>
*/
@Before
@ActionTrigger(action="WHEN-NEW-BLOCK-INSTANCE", function=KeyFunction.BLOCK_CHANGE)
public void Ftvprog_blockChange()
{
getGFormClass().blockChange();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN_NEW_BLOCK_INSTANCE_TRG
*
*
*</p>
*/
@ActionTrigger(action="WHEN_NEW_BLOCK_INSTANCE_TRG")
public void Ftvprog_WhenNewBlockInstanceTrg()
{
getGFormClass().whenNewBlockInstanceTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-MOUSE-DOUBLECLICK
*
*
*</p>
*/
@ActionTrigger(action="WHEN-MOUSE-DOUBLECLICK")
public void Ftvprog_doubleClick()
{
getGFormClass().whenMouseDoubleclick();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-TIMER-EXPIRED
*
*
*</p>
*/
@ActionTrigger(action="WHEN-TIMER-EXPIRED")
public void Ftvprog_WhenTimerExpired(NString timerName)
{
getGFormClass().whenTimerExpired(timerName);
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-WINDOW-ACTIVATED
*
*
*</p>
*/
@ActionTrigger(action="WHEN-WINDOW-ACTIVATED")
public void Ftvprog_WhenWindowActivated()
{
getGFormClass().whenWindowActivated();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN_WINDOW_ACTIVATED_TRG
*
*
*</p>
*/
@ActionTrigger(action="WHEN_WINDOW_ACTIVATED_TRG")
public void Ftvprog_WhenWindowActivatedTrg()
{
getGFormClass().whenWindowActivatedTrg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-WINDOW-CLOSED
*
*
*</p>
*/
@ActionTrigger(action="WHEN-WINDOW-CLOSED")
public void Ftvprog_WhenWindowClosed()
{
getGFormClass().whenWindowClosed();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-HELP
*
*
*</p>
*/
@ActionTrigger(action="KEY-HELP", function=KeyFunction.HELP)
public void Ftvprog_Help()
{
getGFormClass().help();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-F0
*
*
*</p>
*/
@ActionTrigger(action="KEY-F0", function=KeyFunction.KEY_F0)
public void Ftvprog_F0()
{
getGFormClass().f0();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-F2
*
*
*</p>
*/
@ActionTrigger(action="KEY-F2", function=KeyFunction.KEY_F2)
public void Ftvprog_F2()
{
getGFormClass().f2();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-DOWN
*
*
*</p>
*/
@ActionTrigger(action="KEY-DOWN", function=KeyFunction.NEXT_RECORD)
public void Ftvprog_MoveDown()
{
getGFormClass().moveDown();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-UP
*
*
*</p>
*/
@ActionTrigger(action="KEY-UP", function=KeyFunction.PREVIOUS_RECORD)
public void Ftvprog_MoveUp()
{
getGFormClass().moveUp();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-LISTVAL
*
*
*</p>
*/
@ActionTrigger(action="KEY-LISTVAL", function=KeyFunction.LIST_VALUES)
public void Ftvprog_ListValues()
{
getGFormClass().listValues();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-MENU
*
*
*</p>
*/
@ActionTrigger(action="KEY-MENU")
public void Ftvprog_KeyMenu()
{
getGFormClass().keyMenu();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-NXTREC
*
*
*</p>
*/
@ActionTrigger(action="KEY-NXTREC", function=KeyFunction.NEXT_RECORD)
public void Ftvprog_NextRecord()
{
getGFormClass().nextRecord();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-PRVREC
*
*
*</p>
*/
@ActionTrigger(action="KEY-PRVREC", function=KeyFunction.PREVIOUS_RECORD)
public void Ftvprog_PreviousRecord()
{
getGFormClass().previousRecord();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-NXTSET
*
*
*</p>
*/
@ActionTrigger(action="KEY-NXTSET")
public void Ftvprog_KeyNxtset()
{
getGFormClass().keyNxtset();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-SCRUP
*
*
*</p>
*/
@ActionTrigger(action="KEY-SCRUP")
public void Ftvprog_KeyScrup()
{
getGFormClass().keyScrup();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-SCRDOWN
*
*
*</p>
*/
@ActionTrigger(action="KEY-SCRDOWN")
public void Ftvprog_KeyScrdown()
{
getGFormClass().keyScrdown();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-PRINT
*
*
*</p>
*/
@ActionTrigger(action="KEY-PRINT")
public void Ftvprog_KeyPrint()
{
getGFormClass().keyPrint();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-ENTQRY
*
*
*</p>
*/
@ActionTrigger(action="KEY-ENTQRY", function=KeyFunction.SEARCH)
public void Ftvprog_Search()
{
getGFormClass().search();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-EXEQRY
*
*
*</p>
*/
@ActionTrigger(action="KEY-EXEQRY", function=KeyFunction.EXECUTE_QUERY)
public void Ftvprog_ExecuteQuery()
{
getGFormClass().executeQuery();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-EXIT
*
*
*</p>
*/
@ActionTrigger(action="KEY-EXIT", function=KeyFunction.EXIT)
public void Ftvprog_Exit()
{
getGFormClass().exit();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-NXTKEY
*
*
*</p>
*/
@ActionTrigger(action="KEY-NXTKEY")
public void Ftvprog_KeyNxtkey()
{
getGFormClass().keyNxtkey();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.GLOBAL_COPY
*
*
*</p>
*/
@ActionTrigger(action="GLOBAL_COPY")
public void Ftvprog_GlobalCopy()
{
getGFormClass().globalCopy();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.LIST_VALUES_COPY
*
*
*</p>
*/
@ActionTrigger(action="LIST_VALUES_COPY")
public void Ftvprog_ListValuesCopy()
{
getGFormClass().listValuesCopy();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.LOAD_FORM_HEADER
*
*
*</p>
*/
@ActionTrigger(action="LOAD_FORM_HEADER")
public void Ftvprog_LoadFormHeader()
{
getGFormClass().loadFormHeader();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.SAVE_KEYS
*
*
*</p>
*/
@ActionTrigger(action="SAVE_KEYS")
public void Ftvprog_SaveKeys()
{
getGFormClass().saveKeys();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.ENABLE_KEYS
*
*
*</p>
*/
@ActionTrigger(action="ENABLE_KEYS")
public void Ftvprog_EnableKeys()
{
getGFormClass().enableKeys();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.DISABLE_KEYS
*
*
*</p>
*/
@ActionTrigger(action="DISABLE_KEYS")
public void Ftvprog_DisableKeys()
{
getGFormClass().disableKeys();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.INVALID_OPTION_MSG
*
*
*</p>
*/
@ActionTrigger(action="INVALID_OPTION_MSG")
public void Ftvprog_InvalidOptionMsg()
{
getGFormClass().invalidOptionMsg();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.UPDATE_ACTIVITY
*
*
*</p>
*/
@ActionTrigger(action="UPDATE_ACTIVITY")
public void Ftvprog_UpdateActivity()
{
getGFormClass().updateActivity();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.CHECK_KEYS
*
*
*</p>
*/
@ActionTrigger(action="CHECK_KEYS")
public void Ftvprog_CheckKeys()
{
getGInqFormClass().checkKeys();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-CLRREC
*
*
*</p>
*/
@ActionTrigger(action="KEY-CLRREC", function=KeyFunction.CLEAR_RECORD)
public void Ftvprog_ClearRecord()
{
getGInqFormClass().clearRecord();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-COMMIT
*
*
*</p>
*/
@ActionTrigger(action="KEY-COMMIT", function=KeyFunction.SAVE)
public void Ftvprog_Save()
{
getGInqFormClass().save();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-CREREC
*
*
*</p>
*/
@ActionTrigger(action="KEY-CREREC", function=KeyFunction.CREATE_RECORD)
public void Ftvprog_CreateRecord()
{
getGInqFormClass().createRecord();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-DELREC
*
*
*</p>
*/
@ActionTrigger(action="KEY-DELREC", function=KeyFunction.DELETE_RECORD)
public void Ftvprog_DeleteRecord()
{
getGInqFormClass().deleteRecord();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-DUP-ITEM
*
*
*</p>
*/
@ActionTrigger(action="KEY-DUP-ITEM", function=KeyFunction.DUPLICATE_ITEM)
public void Ftvprog_KeyDupItem()
{
getGInqFormClass().keyDupItem();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-DUPREC
*
*
*</p>
*/
@ActionTrigger(action="KEY-DUPREC", function=KeyFunction.DUPLICATE_RECORD)
public void Ftvprog_CopyRecord()
{
getGInqFormClass().copyRecord();
}
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.WHEN-NEW-RECORD-INSTANCE
*
*
*</p>
*/
@Before
@ActionTrigger(action="WHEN-NEW-RECORD-INSTANCE", function=KeyFunction.RECORD_CHANGE)
public void Ftvprog_recordChange()
{
getGInqFormClass().whenNewRecordInstance();
}
/* Original PL/SQL code code for TRIGGER FTVPROG.LOAD_CURRENT_RELEASE
:CURRENT_RELEASE := '8.0';
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.LOAD_CURRENT_RELEASE
*
*
*</p>
*/
@ActionTrigger(action="LOAD_CURRENT_RELEASE")
public void Ftvprog_LoadCurrentRelease()
{
getFormModel().getFormHeader().setCurrentRelease(toStr("9.0"));
}
/* Original PL/SQL code code for TRIGGER FTVPROG.KEY-NXTBLK
EXECUTE_TRIGGER( 'INVALID_FUNCTION_MSG' ) ;
G$_CHECK_FAILURE ;
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-NXTBLK
*
*
*</p>
*/
@ActionTrigger(action="KEY-NXTBLK", function=KeyFunction.NEXT_BLOCK)
public void Ftvprog_NextBlock()
{
executeAction("INVALID_FUNCTION_MSG");
getTask().getGoqrpls().gCheckFailure();
}
/* Original PL/SQL code code for TRIGGER FTVPROG.KEY-PRVBLK
EXECUTE_TRIGGER( 'INVALID_FUNCTION_MSG' ) ;
G$_CHECK_FAILURE ;
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-PRVBLK
*
*
*</p>
*/
@ActionTrigger(action="KEY-PRVBLK", function=KeyFunction.PREVIOUS_BLOCK)
public void Ftvprog_PreviousBlock()
{
executeAction("INVALID_FUNCTION_MSG");
getTask().getGoqrpls().gCheckFailure();
}
/* Original PL/SQL code code for TRIGGER FTVPROG.INVALID_FUNCTION_MSG
MESSAGE(
G$_NLS.Get('FTVPROG-0001', 'FORM','Invalid function; press SHOW KEYS for valid functions.') ) ;
RAISE FORM_TRIGGER_FAILURE ;
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.INVALID_FUNCTION_MSG
*
*
*</p>
*/
@ActionTrigger(action="INVALID_FUNCTION_MSG")
public void Ftvprog_InvalidFunctionMsg()
{
errorMessage(GNls.Fget(toStr("FTVPROG-0001"), toStr("FORM"), toStr("*ERROR* Invalid function; press SHOW KEYS for valid functions.")));
throw new ApplicationException();
}
/* Original PL/SQL code code for TRIGGER FTVPROG.KEY_NXTKEY_TRG
:WORKFLD := :SYSTEM.CURRENT_FIELD ;
--
:WORKFLD := SUBSTR(:WORKFLD, 1, 8) ;
--
:WORKFLD := RPAD(:WORKFLD, 13, SUBSTR(:WORKFLD, 4, 5)) ;
--
:WORKFLD := RPAD(:WORKFLD, 17, 'CODE') ;
--
:GLOBAL.VALUE := NAME_IN( NAME_IN( 'WORKFLD' ) ) ;
--
-- EXIT_FORM ;
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY_NXTKEY_TRG
*
*
*</p>
*/
@ActionTrigger(action="KEY_NXTKEY_TRG")
public void Ftvprog_KeyNxtkeyTrg()
{
FtvprogAdapter ftvprogElement= (FtvprogAdapter) this.getFormModel().getFtvprog().getRowAdapter(true);
getFormModel().getFormHeader().setWorkfld(toStr(getCurrentField()));//SupportClasses.AppContext.CurrentField));
//
getFormModel().getFormHeader().setWorkfld(substring(getFormModel().getFormHeader().getWorkfld(), toInt(1), toInt(8)));
//
getFormModel().getFormHeader().setWorkfld(toStr(rpad(getFormModel().getFormHeader().getWorkfld(), 13, substring(getFormModel().getFormHeader().getWorkfld(), toInt(4), toInt(5)).toString())));
//
getFormModel().getFormHeader().setWorkfld(toStr(rpad(getFormModel().getFormHeader().getWorkfld(), 17, "CODE")));
//
setGlobal("VALUE", ftvprogElement.getFtvprogProgCode());
}
/* Original PL/SQL code code for TRIGGER FTVPROG.KEY_EXIT_TRG
:GLOBAL.VALUE := '' ;
--
-- EXIT_FORM ;
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY_EXIT_TRG
*
*
*</p>
*/
@ActionTrigger(action="KEY_EXIT_TRG")
public void Ftvprog_KeyExitTrg()
{
setGlobal("VALUE", toStr(""));
}
/* Original PL/SQL code code for TRIGGER FTVPROG.KEY-CLRFRM
CLEAR_FORM ;
G$_CHECK_FAILURE ;
EXECUTE_TRIGGER( 'LOAD_FORM_HEADER' ) ;
G$_CHECK_FAILURE ;
EXECUTE_QUERY ;
*/
/*
*<p>
*<b>Migration Comments</b>
* Generated from trigger:
* FTVPROG.KEY-CLRFRM
*
*
*</p>
*/
@ActionTrigger(action="KEY-CLRFRM", function=KeyFunction.CLEAR_FORM)
public void Ftvprog_ClearTask()
{
clearTask();
getTask().getGoqrpls().gCheckFailure();
executeAction("LOAD_FORM_HEADER");
getTask().getGoqrpls().gCheckFailure();
executeQuery();
}
}
| [
"tfbuild@esmsvc02.ellucian.com"
] | tfbuild@esmsvc02.ellucian.com |
dc91f0770539b05052b06713dbd5b1b7d14d5f31 | 65dbad7bf649a12944f1a8197f7fc8847c56eb0a | /src/com/indra/ayam/kocok/model/Images.java | 75944b7ed4e3968d619bf390060f9dace5a1e23e | [] | no_license | indrae/AyamKocok | c6c74cd45a7f2186eb97ebe102cc5042332f4c6b | b69ce20c3d2d714b2a325b6ace75af36535c9416 | refs/heads/master | 2020-05-17T19:16:14.424977 | 2014-07-23T03:22:47 | 2014-07-23T03:22:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package com.indra.ayam.kocok.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import com.indra.ayam.kocok.R;
public class Images {
private Random randNo;
private ArrayList<Integer> imageId;
public Images() {
imageId = new ArrayList<Integer>();
imageId.add(R.drawable.ic_launcher);
imageId.add(R.drawable.ic_launcher);
imageId.add(R.drawable.ic_launcher);
imageId.add(R.drawable.ic_launcher);
imageId.add(R.drawable.ic_launcher);
}
public int getImageId() {
randNo = new Random();
return imageId.get(randNo.nextInt(imageId.size()));
}
public ArrayList<Integer> getImageItem() {
return imageId;
}
}
| [
"indra.rahmat.pg@gmail.com"
] | indra.rahmat.pg@gmail.com |
0cbf282cd29ba91cdb4daad96f06124f829147d7 | 36b7953256ccc486a30e7911c77ee0ff4d809f43 | /app/src/main/java/com/heckteck/birthy/Activities/EditBirthdayActivity.java | f850227e0ea9e293405d49459d7eca8f8af364bc | [] | no_license | iamhariomsharma/BdayReminder | 5f5e9ead0d24e9c864ce1356470b5d7ab476a6ab | c79d64af37eb28e7f71a2e564c4df9771e11f147 | refs/heads/master | 2022-05-26T23:39:22.653421 | 2020-04-27T17:07:31 | 2020-04-27T17:07:31 | 254,328,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package com.heckteck.birthy.Activities;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import android.os.Bundle;
import com.heckteck.birthy.Fragments.EditBirthdayFragment;
import com.heckteck.birthy.R;
public class EditBirthdayActivity extends AppCompatActivity {
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_birthday);
toolbar = findViewById(R.id.editBirthdayToolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Edit Birthday");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return super.onSupportNavigateUp();
}
}
| [
"sharmahariom26443@gmail.com"
] | sharmahariom26443@gmail.com |
0d749da54d1253a468248c368054fefbca5c4209 | 89e7f0fb60d4b9d6a82f5b51c837d37055acd5f9 | /Stage/src/main/java/kurs/java/fx/Main.java | 07fc86abff73d033577f45e25a9a876510cfb5c4 | [] | no_license | rumcajsik/javaFXkurs | 3cd4d3afe4cb491d75ee68c92115f5e925ff531b | c2607e6fd980bcc92663966fc19b85fd94f3d58c | refs/heads/master | 2021-01-01T06:19:12.915981 | 2017-07-18T22:04:36 | 2017-07-18T22:04:36 | 97,406,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | package kurs.java.fx;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Main extends Application
{
public static void main(String[] args)
{
launch(args);
//System.out.println("Kolejny commit");
}
@Override
public void start(Stage primaryStage) throws Exception
{
FXMLLoader loader = new FXMLLoader();
loader.setLocation(this.getClass().getResource("/fxml/PaneWindow.fxml"));
Pane pane = loader.load();
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.show();
}
}
| [
"lukaszstefanek7@gmail.com"
] | lukaszstefanek7@gmail.com |
65c03d4a6af320dadcd1a6ebd948b0b973dc3d28 | 7ae7bb92f23bc3ba9ea96c7044a4e550a6a8a094 | /app/src/main/java/com/example/disease_informationteamwork/DiseaseEdit.java | b9d1706104854cf6c917b5fd42f8757a83a05d08 | [] | no_license | LeeYuHwan/DiseaseInformation | 1360905fb325c764db91e09d614e1d7dad8cb116 | 31387f7a56292943d895c5a43e086217cde014a1 | refs/heads/master | 2023-04-02T08:46:25.403545 | 2021-04-10T18:11:12 | 2021-04-10T18:11:12 | 275,201,263 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,904 | java | package com.example.disease_informationteamwork;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
public class DiseaseEdit extends AppCompatActivity {
private String inform_data;
private String person_data;
private String city_data;
private String type_data;
private String img_url;
private double v_data;
private double v1_data;
private int index;
private int id_data;
private EditText informText;
private EditText personText;
private EditText cityText;
private EditText typeText;
private EditText vText;
private EditText v1Text;
private EditText imgText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_disease_edit);
informText = (EditText) findViewById(R.id.edit_disease_name);
personText = (EditText) findViewById(R.id.edit_disease_person);
cityText = (EditText) findViewById(R.id.edit_disease_city);
typeText = (EditText) findViewById(R.id.edit_disease_type);
vText = (EditText) findViewById(R.id.edit_v);
v1Text = (EditText) findViewById(R.id.edit_v1);
imgText = (EditText) findViewById(R.id.edit_disease_img_url);
Intent intent = getIntent();
inform_data = intent.getStringExtra("inform_data");
person_data = intent.getStringExtra("person_data");
city_data = intent.getStringExtra("city_data");
type_data = intent.getStringExtra("type_data");
v_data = intent.getDoubleExtra("v_data",0);
v1_data = intent.getDoubleExtra("v1_data",0);
img_url = intent.getStringExtra("img_url");
index = intent.getIntExtra("index", 0);
id_data = intent.getIntExtra("id_data", 0);
vText.setText(v_data+"");
v1Text.setText(v1_data+"");
informText.setText(inform_data);
personText.setText(person_data);
cityText.setText(city_data);
typeText.setText(type_data);
imgText.setText(img_url);
}
public void editDiseaseClick(View v){
Intent data = new Intent();
data.putExtra("edit_v", Double.parseDouble(vText.getText().toString()));
data.putExtra("edit_v1", Double.parseDouble(v1Text.getText().toString()));
data.putExtra("edit_inform", informText.getText().toString());
data.putExtra("edit_person", personText.getText().toString());
data.putExtra("edit_city", cityText.getText().toString());
data.putExtra("edit_type", typeText.getText().toString());
data.putExtra("edit_img_url", imgText.getText().toString());
data.putExtra("edit_index", index);
data.putExtra("edit_id", id_data);
setResult(RESULT_OK, data);
finish();
}
}
| [
"dbghksskfk@naver.com"
] | dbghksskfk@naver.com |
7a61ff9f29820b6d7f2fafb64ac4e9d97ad1b72d | e720c121128d748f37e196e6c4443988ffc39401 | /src/java/modelo/HibernateUtil.java | b24060c1450f3d7e3ee0e686d5516c4d3a20c9e5 | [] | no_license | KarenSaenz/reservecinema | 8b6dfd931f47877cefb3f423258e3720cfd085c9 | 00d97515fd9c65cef23dbd5dc960e458a922940c | refs/heads/Karen | 2020-06-12T02:41:54.973522 | 2019-06-29T16:59:57 | 2019-06-29T16:59:57 | 194,171,391 | 0 | 0 | null | 2019-06-29T17:56:59 | 2019-06-27T22:34:24 | HTML | UTF-8 | Java | false | false | 1,083 | 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 modelo;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory;
/**
* Hibernate Utility class with a convenient method to get Session Factory
* object.
*
* @author aleja9920
*/
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
// config file.
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
| [
"kasaenz23@misena.edu.co"
] | kasaenz23@misena.edu.co |
2203d50c3f1a44c328d97732b5bcadf8109335a4 | d7e8934952c56aa6c68ac186b176c5369a86a554 | /camel-hystrix/src/main/java/org/jboss/ddoyle/camel/hystrix/HystrixComponent.java | d1abee41f9dd5ee0997f6ceac072cc2ce3d7f2f4 | [] | no_license | DuncanDoyle/camel-hystrix | 93b2853a2130dc2b672060c63410f8975007ab89 | e63c97bd47ecd0c2f7cd291dbc97616799c57c9f | refs/heads/master | 2016-08-13T00:09:57.440282 | 2015-12-19T14:45:36 | 2015-12-19T14:45:36 | 46,216,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package org.jboss.ddoyle.camel.hystrix;
import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;
/**
* Represents the component that manages {@link camel-hystrix-componentEndpoint}.
*
* @author <a href="mailto:duncan.doyle@redhat.com">Duncan Doyle</a>
*/
public class HystrixComponent extends UriEndpointComponent {
public HystrixComponent() {
super(HystrixEndpoint.class);
}
public HystrixComponent(CamelContext context) {
super(context, HystrixEndpoint.class);
}
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
//Build a new HystrixEndpointConfiguration
HystrixEndpointConfiguration config = new HystrixEndpointConfiguration();
setProperties(config, parameters);
Endpoint endpoint = new HystrixEndpoint(uri, this, remaining, config);
setProperties(endpoint, parameters);
return endpoint;
}
}
| [
"Duncan.Doyle@gmail.com"
] | Duncan.Doyle@gmail.com |
832a18bed3fb5650958b73b44302d4d84cc0ff16 | 2949bab0ee3761944f2c2afef265f13405387ad3 | /src/main/java/com/ym52n/domain/SysRole.java | f474765977c063071dca348b6ed79d8fc2f2f750 | [] | no_license | zhangzexu/management-center | 2698c55da47c85952793a1e4dfeff639bcca3a01 | 86af65f0857acd202c472e06ac27da60a2367f14 | refs/heads/master | 2020-04-09T11:50:43.721498 | 2019-05-21T07:20:04 | 2019-05-21T07:20:04 | 160,325,793 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,895 | java | package com.ym52n.domain;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Entity
@EntityListeners(AuditingEntityListener.class)
public class SysRole extends Entitys implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "uid")
@GenericGenerator(name = "uid", strategy = "com.ym52n.repository.impl.MakeUid")
private String uid;
@Column(nullable = false,unique = true)
private String role; // 角色标识程序中判断使用,如"admin",这个是唯一的:
@Column(nullable = false,unique = true)
private String description; // 角色描述,UI界面显示使用
private Boolean available = Boolean.FALSE; // 是否可用,如果不可用将不会添加给用户
//角色 -- 权限关系:多对多关系;
@ManyToMany(fetch= FetchType.EAGER)
@JoinTable(name="SysRolePermission",joinColumns={@JoinColumn(name="roleUid")},inverseJoinColumns={@JoinColumn(name="permissionUid")})
private List<SysPermission> permissions;
// 用户 - 角色关系定义;
@ManyToMany
@JoinTable(name="SysUserRole",joinColumns={@JoinColumn(name="roleUid")},inverseJoinColumns={@JoinColumn(name="userUid")})
private List<SysUser> sysUsers;// 一个角色对应多个用户
@Column(length = 65535,columnDefinition="Text")
private String descInfo;
@CreatedDate
@Column(nullable = false)
private String createDate;
@CreatedBy
@Column(nullable = false)
private String createBy;
@LastModifiedDate
@Column(nullable = false)
private String lastModifiedDate;
@LastModifiedBy
@Column(nullable = false)
private String lastModifiedBy;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Boolean getAvailable() {
return available;
}
public void setAvailable(Boolean available) {
this.available = available;
}
public List<SysPermission> getPermissions() {
return permissions;
}
public void setPermissions(List<SysPermission> permissions) {
this.permissions = permissions;
}
public List<SysUser> getSysUsers() {
return sysUsers;
}
public void setSysUsers(List<SysUser> sysUsers) {
this.sysUsers = sysUsers;
}
public String getDescInfo() {
return descInfo;
}
public void setDescInfo(String descInfo) {
this.descInfo = descInfo;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(String lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
} | [
"1402876003@qq.com"
] | 1402876003@qq.com |
2a7c493a03d533bc83cd6c2cd7859aa65b7c4d05 | 9cc71443dfa5226118f76ae705ea09e30ae66f7a | /gameserver/data/scripts/system/handlers/quest/beluslan/_2060RestoringBeluslanObservatory.java | 39e3e87d7709fdf33ca3f0f4ab3e8f32d0580779 | [] | no_license | osiris087/aionj | bedee651beb30b8e2e0163e60cbd03681077d80e | b12efe6d8f089f4ba313d519b32884b9395db904 | refs/heads/master | 2021-01-01T18:37:11.834976 | 2011-09-09T02:45:38 | 2011-09-09T02:45:38 | 2,353,467 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,020 | java | /*
* This file is part of aion-unique <aion-unique.org>.
*
* aion-unique 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.
*
* aion-unique 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 aion-unique. If not, see <http://www.gnu.org/licenses/>.
*/
package quest.beluslan;
import gameserver.model.EmotionType;
import gameserver.model.gameobjects.Item;
import gameserver.model.gameobjects.Npc;
import gameserver.model.gameobjects.player.Player;
import gameserver.model.templates.quest.QuestItems;
import gameserver.network.aion.serverpackets.SM_DIALOG_WINDOW;
import gameserver.network.aion.serverpackets.SM_EMOTION;
import gameserver.network.aion.serverpackets.SM_ITEM_USAGE_ANIMATION;
import gameserver.network.aion.serverpackets.SM_PLAY_MOVIE;
import gameserver.network.aion.serverpackets.SM_USE_OBJECT;
import gameserver.quest.HandlerResult;
import gameserver.quest.handlers.QuestHandler;
import gameserver.quest.model.QuestCookie;
import gameserver.quest.model.QuestState;
import gameserver.quest.model.QuestStatus;
import gameserver.services.ItemService;
import gameserver.services.QuestService;
import gameserver.services.ZoneService;
import gameserver.utils.PacketSendUtility;
import gameserver.utils.ThreadPoolManager;
import gameserver.world.zone.ZoneName;
import java.util.Collections;
/**
* @author Hellboy aion4Free
*
*/
public class _2060RestoringBeluslanObservatory extends QuestHandler
{
private final static int questId = 2060;
private final static int[] npc_ids = { 204701, 204785, 278003, 278088, 700293 };
public _2060RestoringBeluslanObservatory()
{
super(questId);
}
@Override
public void register()
{
qe.setQuestEnterZone(ZoneName.MALEK_MINE_220040000).add(questId);
qe.addQuestLvlUp(questId);
qe.setQuestItemIds(182204318).add(questId);
qe.setNpcQuestData(700290).addOnKillEvent(questId);
for(int npc_id : npc_ids)
qe.setNpcQuestData(npc_id).addOnTalkEvent(questId);
}
@Override
public boolean onLvlUpEvent(QuestCookie env)
{
return defaultQuestOnLvlUpEvent(env);
}
@Override
public boolean onKillEvent(QuestCookie env)
{
if(defaultQuestOnKillEvent(env, 700290, 5, 8))
return true;
else
return false;
}
@Override
public boolean onDialogEvent(final QuestCookie env)
{
final Player player = env.getPlayer();
final QuestState qs = player.getQuestStateList().getQuestState(questId);
if(qs == null)
return false;
int var = qs.getQuestVarById(0);
int targetId = 0;
if(env.getVisibleObject() instanceof Npc)
targetId = ((Npc) env.getVisibleObject()).getNpcId();
if(qs.getStatus() == QuestStatus.REWARD)
{
if(targetId == 204701)
{
if(env.getDialogId() == -1)
return sendQuestDialog(env, 10002);
else return defaultQuestEndDialog(env);
}
return false;
}
else if(qs.getStatus() != QuestStatus.START)
{
return false;
}
if(targetId == 204701)
{
switch(env.getDialogId())
{
case 26:
if(var == 0)
return sendQuestDialog(env, 1011);
case 10000:
if(var == 0)
{
qs.setQuestVarById(0, var + 1);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
}
}
else if(targetId == 204785)
{
switch(env.getDialogId())
{
case 26:
if(var == 1)
return sendQuestDialog(env, 1352);
else if(var == 4)
return sendQuestDialog(env, 2375);
case 10001:
if(var == 1)
{
qs.setQuestVarById(0, var + 1);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
case 10004:
if(var == 4)
{
qs.setQuestVarById(0, var + 1);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
case 34:
if(var == 4)
{
if(QuestService.collectItemCheck(env, false))
{
return sendQuestDialog(env, 2376);
}
else
return sendQuestDialog(env, 2461);
}
}
}
else if(targetId == 278003)
{
switch(env.getDialogId())
{
case -1:
if(var == 2)
return sendQuestDialog(env, 1693);
case 10002:
if(var == 2)
{
qs.setQuestVarById(0, var + 1);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
}
}
else if(targetId == 278088)
{
switch(env.getDialogId())
{
case 26:
if(var == 3)
return sendQuestDialog(env, 2034);
case 2035:
PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 281));
break;
case 10003:
if(var == 3)
{
qs.setQuestVarById(0, var + 1);
updateQuestStatus(env);
ItemService.addItems(player, Collections.singletonList(new QuestItems(182204318, 1)));
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
}
}
else if(targetId == 700293 && var == 8)
{
if (env.getDialogId() == -1)
{
final int targetObjectId = env.getVisibleObject().getObjectId();
PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
PacketSendUtility.broadcastPacket(player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
ThreadPoolManager.getInstance().schedule(new Runnable(){
@Override
public void run()
{
PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
PacketSendUtility.broadcastPacket(player, new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId), true);
player.getInventory().removeFromBagByItemId(182204319, 1);
PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 254));
qs.setStatus(QuestStatus.REWARD);
updateQuestStatus(env);
}
}, 3000);
} return false;
}
return false;
}
@Override
public HandlerResult onItemUseEvent(QuestCookie env, Item item)
{
final Player player = env.getPlayer();
final QuestState qs = player.getQuestStateList().getQuestState(questId);
final int id = item.getItemTemplate().getTemplateId();
final int itemObjId = item.getObjectId();
if (qs == null || id != 182204318)
return HandlerResult.UNKNOWN;
if (qs.getQuestVarById(0) != 4)
return HandlerResult.FAILED;
if(!ZoneService.getInstance().isInsideZone(player, ZoneName.LEIBO_ISLAND_400010000))
return HandlerResult.FAILED;
PacketSendUtility.broadcastPacket(player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 3000, 0, 0), true);
ThreadPoolManager.getInstance().schedule(new Runnable(){
@Override
public void run()
{
PacketSendUtility.broadcastPacket(player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0), true);
player.getInventory().removeFromBagByObjectId(itemObjId, 1);
ItemService.addItems(player, Collections.singletonList(new QuestItems(182204319, 1)));
}
}, 3000);
return HandlerResult.SUCCESS;
}
}
| [
"osiris087@gmail.com@2632a3c6-4342-beac-f942-17b406f9b7bb"
] | osiris087@gmail.com@2632a3c6-4342-beac-f942-17b406f9b7bb |
2653e17aa78632b59200d6a503bccd8a48b18494 | d4eb600727c78dff07934415a7e79c6d48b9ea29 | /photoSelector/src/main/java/com/photoselector/ui/PhotoSelectorActivity.java | d925877e8afb854b647a873ef7871a0f649070fa | [] | no_license | qianjs/GitTest | cc38b0ffa9fed819b110ecbfdacd8a2f5b0044d6 | e590d42d99d46c628ca9315cbe31cac1460b4102 | refs/heads/master | 2021-01-23T13:37:39.820341 | 2017-09-07T02:01:41 | 2017-09-07T02:01:41 | 102,672,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,228 | java | package com.photoselector.ui;
/**
*
* @author Aizaz AZ
*
*/
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache;
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.decode.BaseImageDecoder;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
import com.nostra13.universalimageloader.utils.StorageUtils;
import com.photoselector.R;
import com.photoselector.domain.PhotoSelectorDomain;
import com.photoselector.model.AlbumModel;
import com.photoselector.model.PhotoModel;
import com.photoselector.ui.PhotoItem.onItemClickListener;
import com.photoselector.ui.PhotoItem.onPhotoItemCheckedListener;
import com.photoselector.util.AnimationUtil;
import com.photoselector.util.CommonUtils;
/**
* @author Aizaz AZ
*
*/
public class PhotoSelectorActivity extends Activity implements
onItemClickListener, onPhotoItemCheckedListener, OnItemClickListener,
OnClickListener {
public static final int SINGLE_IMAGE = 1;
public static final String KEY_MAX = "key_max";
private int MAX_IMAGE;
public static final int REQUEST_PHOTO = 0;
private static final int REQUEST_CAMERA = 1;
public static String RECCENT_PHOTO = null;
private GridView gvPhotos;
private ListView lvAblum;
private Button btnOk;
private TextView tvAlbum, tvPreview, tvTitle;
private PhotoSelectorDomain photoSelectorDomain;
private PhotoSelectorAdapter photoAdapter;
private AlbumAdapter albumAdapter;
private RelativeLayout layoutAlbum;
private ArrayList<PhotoModel> selected;
private TextView tvNumber;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RECCENT_PHOTO = getResources().getString(R.string.recent_photos);
requestWindowFeature(Window.FEATURE_NO_TITLE);// 鍘绘帀鏍囬鏍�
setContentView(R.layout.activity_photoselector);
if (getIntent().getExtras() != null) {
MAX_IMAGE = getIntent().getIntExtra(KEY_MAX, 10);
}
initImageLoader();
photoSelectorDomain = new PhotoSelectorDomain(getApplicationContext());
selected = new ArrayList<PhotoModel>();
tvTitle = (TextView) findViewById(R.id.tv_title_lh);
gvPhotos = (GridView) findViewById(R.id.gv_photos_ar);
lvAblum = (ListView) findViewById(R.id.lv_ablum_ar);
btnOk = (Button) findViewById(R.id.btn_right_lh);
tvAlbum = (TextView) findViewById(R.id.tv_album_ar);
tvPreview = (TextView) findViewById(R.id.tv_preview_ar);
layoutAlbum = (RelativeLayout) findViewById(R.id.layout_album_ar);
tvNumber = (TextView) findViewById(R.id.tv_number);
btnOk.setOnClickListener(this);
tvAlbum.setOnClickListener(this);
tvPreview.setOnClickListener(this);
photoAdapter = new PhotoSelectorAdapter(getApplicationContext(),
new ArrayList<PhotoModel>(), CommonUtils.getWidthPixels(this),
this, this, this);
gvPhotos.setAdapter(photoAdapter);
albumAdapter = new AlbumAdapter(getApplicationContext(),
new ArrayList<AlbumModel>());
lvAblum.setAdapter(albumAdapter);
lvAblum.setOnItemClickListener(this);
findViewById(R.id.bv_back_lh).setOnClickListener(this); // 杩斿洖
photoSelectorDomain.getReccent(reccentListener); // 鏇存柊鏈�杩戠収鐗�
photoSelectorDomain.updateAlbum(albumListener); // 璺熸柊鐩稿唽淇℃伅
}
private void initImageLoader() {
DisplayImageOptions imageOptions = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.ic_picture_loading)
.showImageOnFail(R.drawable.ic_picture_loadfailed)
.cacheInMemory(true).cacheOnDisk(true)
.resetViewBeforeLoading(true).considerExifParams(false)
.bitmapConfig(Bitmap.Config.RGB_565).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
this)
.memoryCacheExtraOptions(400, 400)
// default = device screen dimensions
.diskCacheExtraOptions(400, 400, null)
.threadPoolSize(5)
// default Thread.NORM_PRIORITY - 1
.threadPriority(Thread.NORM_PRIORITY)
// default FIFO
.tasksProcessingOrder(QueueProcessingType.LIFO)
// default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13)
// default
.diskCache(
new UnlimitedDiscCache(StorageUtils.getCacheDirectory(
this, true)))
// default
.diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100)
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator())
// default
.imageDownloader(new BaseImageDownloader(this))
// default
.imageDecoder(new BaseImageDecoder(false))
// default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple())
// default
.defaultDisplayImageOptions(imageOptions).build();
ImageLoader.getInstance().init(config);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_right_lh)
ok(); // 閫夊畬鐓х墖
else if (v.getId() == R.id.tv_album_ar)
album();
else if (v.getId() == R.id.tv_preview_ar)
priview();
else if (v.getId() == R.id.tv_camera_vc)
catchPicture();
else if (v.getId() == R.id.bv_back_lh)
finish();
}
/** 鎷嶇収 */
private void catchPicture() {
CommonUtils.launchActivityForResult(this, new Intent(
MediaStore.ACTION_IMAGE_CAPTURE), REQUEST_CAMERA);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CAMERA && resultCode == RESULT_OK) {
PhotoModel photoModel = new PhotoModel(CommonUtils.query(
getApplicationContext(), data.getData()));
// selected.clear();
// //--keep all
// selected photos
// tvNumber.setText("(0)");
// //--keep all
// selected photos
// ///////////////////////////////////////////////////////////////////////////////////////////
if (selected.size() >= MAX_IMAGE) {
Toast.makeText(
this,
String.format(
getString(R.string.max_img_limit_reached),
MAX_IMAGE), Toast.LENGTH_SHORT).show();
photoModel.setChecked(false);
photoAdapter.notifyDataSetChanged();
} else {
if (!selected.contains(photoModel)) {
selected.add(photoModel);
}
}
ok();
}
}
/** 瀹屾垚 */
private void ok() {
if (selected.isEmpty()) {
setResult(RESULT_CANCELED);
} else {
Intent data = new Intent();
Bundle bundle = new Bundle();
bundle.putSerializable("photos", selected);
data.putExtras(bundle);
setResult(RESULT_OK, data);
}
finish();
}
/** 棰勮鐓х墖 */
private void priview() {
Bundle bundle = new Bundle();
bundle.putSerializable("photos", selected);
CommonUtils.launchActivity(this, PhotoPreviewActivity.class, bundle);
}
private void album() {
if (layoutAlbum.getVisibility() == View.GONE) {
popAlbum();
} else {
hideAlbum();
}
}
/** 寮瑰嚭鐩稿唽鍒楄〃 */
private void popAlbum() {
layoutAlbum.setVisibility(View.VISIBLE);
new AnimationUtil(getApplicationContext(), R.anim.translate_up_current)
.setLinearInterpolator().startAnimation(layoutAlbum);
}
/** 闅愯棌鐩稿唽鍒楄〃 */
private void hideAlbum() {
new AnimationUtil(getApplicationContext(), R.anim.translate_down)
.setLinearInterpolator().startAnimation(layoutAlbum);
layoutAlbum.setVisibility(View.GONE);
}
/** 娓呯┖閫変腑鐨勫浘鐗� */
private void reset() {
selected.clear();
tvNumber.setText("(0)");
tvPreview.setEnabled(false);
}
@Override
/** 鐐瑰嚮鏌ョ湅鐓х墖 */
public void onItemClick(int position) {
Bundle bundle = new Bundle();
if (tvAlbum.getText().toString().equals(RECCENT_PHOTO))
bundle.putInt("position", position - 1);
else
bundle.putInt("position", position);
bundle.putString("album", tvAlbum.getText().toString());
CommonUtils.launchActivity(this, PhotoPreviewActivity.class, bundle);
}
@Override
/** 鐓х墖閫変腑鐘舵�佹敼鍙樹箣鍚� */
public void onCheckedChanged(PhotoModel photoModel,
CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (!selected.contains(photoModel))
selected.add(photoModel);
tvPreview.setEnabled(true);
} else {
selected.remove(photoModel);
}
tvNumber.setText("(" + selected.size() + ")");
if (selected.isEmpty()) {
tvPreview.setEnabled(false);
tvPreview.setText(getString(R.string.preview));
}
}
@Override
public void onBackPressed() {
if (layoutAlbum.getVisibility() == View.VISIBLE) {
hideAlbum();
} else
super.onBackPressed();
}
@Override
/** 鐩稿唽鍒楄〃鐐瑰嚮浜嬩欢 */
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
AlbumModel current = (AlbumModel) parent.getItemAtPosition(position);
for (int i = 0; i < parent.getCount(); i++) {
AlbumModel album = (AlbumModel) parent.getItemAtPosition(i);
if (i == position)
album.setCheck(true);
else
album.setCheck(false);
}
albumAdapter.notifyDataSetChanged();
hideAlbum();
tvAlbum.setText(current.getName());
// tvTitle.setText(current.getName());
// 鏇存柊鐓х墖鍒楄〃
if (current.getName().equals(RECCENT_PHOTO))
photoSelectorDomain.getReccent(reccentListener);
else
photoSelectorDomain.getAlbum(current.getName(), reccentListener); // 鑾峰彇閫変腑鐩稿唽鐨勭収鐗�
}
/** 鑾峰彇鏈湴鍥惧簱鐓х墖鍥炶皟 */
public interface OnLocalReccentListener {
public void onPhotoLoaded(List<PhotoModel> photos);
}
/** 鑾峰彇鏈湴鐩稿唽淇℃伅鍥炶皟 */
public interface OnLocalAlbumListener {
public void onAlbumLoaded(List<AlbumModel> albums);
}
private OnLocalAlbumListener albumListener = new OnLocalAlbumListener() {
@Override
public void onAlbumLoaded(List<AlbumModel> albums) {
albumAdapter.update(albums);
}
};
private OnLocalReccentListener reccentListener = new OnLocalReccentListener() {
@Override
public void onPhotoLoaded(List<PhotoModel> photos) {
for (PhotoModel model : photos) {
if (selected.contains(model)) {
model.setChecked(true);
}
}
photoAdapter.update(photos);
gvPhotos.smoothScrollToPosition(0); // 婊氬姩鍒伴《绔�
// reset(); //--keep selected photos
}
};
}
| [
"87357706@qq.com"
] | 87357706@qq.com |
8f2e2bd1e8457884ac1056b66884a9d4037fa7fa | fd9082c60cf674f6ef6a2468f552c45bdd45fa8c | /src/main/java/com/aliyun/openservices/log/common/TagContent.java | 22e5db984985a4d511f9eeda07db59c90933ced0 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-log-java-sdk | fe092feab243eb14d72599a3f4a595e0fae4a07c | 2eb6a4036345c0400b78593c2e65d61ec9330f31 | refs/heads/master | 2023-08-30T08:23:14.308903 | 2023-08-15T23:24:09 | 2023-08-15T23:24:09 | 76,835,551 | 139 | 67 | Apache-2.0 | 2023-09-08T02:54:57 | 2016-12-19T06:43:56 | Java | UTF-8 | Java | false | false | 1,013 | java | /*
* Copyright (C) Alibaba Cloud Computing All rights reserved.
*/
package com.aliyun.openservices.log.common;
import java.io.Serializable;
/**
* LogContent is a simple data structure used in @LogItem, it presents a
* key/value pair in @logItem.
*
* @author sls_dev
*
*/
public class TagContent implements Serializable {
private static final long serialVersionUID = 2417167614162708776L;
public String key;
public String value;
/**
* Construct a log content pair
*
* @param key
* log content key
* @param value
* log content value
*/
public TagContent(String key, String value) {
this.key = key;
this.value = value;
}
/**
* Get log tag key
*
* @return log tag key
*/
public String getKey() {
return this.key;
}
/**
* Get log content value
*
* @return log content value
*/
public String getValue() {
return this.value;
}
}
| [
"wind.tangkai@gmail.com"
] | wind.tangkai@gmail.com |
ac88a57ae1e9467bd136b481cbd1c799bbb8eff5 | c8787aa5354b222bec21d9b81371121b5256d89d | /app/src/main/java/es/nekosoft/amiathome/activity/BrowserActivity.java | f6fdd79cfe808f1cd380aa4eaeb7d28817f65559 | [] | no_license | GemaME/AmIAtHome | 17fb5d713ab79067eaf6a249682409ad17140834 | 4020234563aaf3ad70865259510f68a849e7cb50 | refs/heads/master | 2016-09-13T00:56:17.945919 | 2016-05-04T19:45:01 | 2016-05-04T19:45:01 | 57,087,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,969 | java | package es.nekosoft.amiathome.activity;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import es.nekosoft.amiathome.R;
import es.nekosoft.amiathome.utils.Constants;
public class BrowserActivity extends AppCompatActivity {
private ProgressBar pbBrowser;
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browser);
webView = (WebView) findViewById(R.id.web);
pbBrowser = (ProgressBar) findViewById(R.id.pb_browser);
setupToolbar();
showWeb();
}
private void showWeb(){
//Get URL
String url = getIntent().getStringExtra(Constants.BROW_URL);
//Config browser
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
pbBrowser.setVisibility(View.INVISIBLE);
super.onPageFinished(view, url);
}
});
webView.getSettings().setJavaScriptEnabled(true);
//URL here we go!!!
webView.loadUrl(url);
}
private void setupToolbar(){
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
}
| [
"gme5@alu.ua.es"
] | gme5@alu.ua.es |
993b65a606bf4e6bb56e4e36d674edbe71a426e3 | c9964011b233a8a9eb486e2630fbeeef4e389d1b | /SelectWordAction/src/java/example/MainPanel.java | b1bc6fe0b439a3833e3f8378d6d139a4b182ddd4 | [
"MIT"
] | permissive | Xmagic/java-swing-tips | 0415b3d76c7cec98fad402f0fc7ee9c59ad8bacc | b6cbde5dad96b2865b666817da9be898b6469d89 | refs/heads/master | 2021-01-20T21:38:11.515793 | 2016-06-09T15:09:28 | 2016-06-09T15:09:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,920 | java | package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.text.*;
public final class MainPanel extends JPanel {
private static final String TEXT = "AA-BB_CC\nAA-bb_CC\naa1-bb2_cc3\naa_(bb)_cc;\n11-22_33";
private final JTextArea textArea = new JTextArea(TEXT);
public MainPanel() {
super(new BorderLayout());
textArea.getActionMap().put(DefaultEditorKit.selectWordAction, new TextAction(DefaultEditorKit.selectWordAction) {
@Override public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
try {
int offs = target.getCaretPosition();
int begOffs = TextUtilties.getWordStart(target, offs);
int endOffs = TextUtilties.getWordEnd(target, offs);
target.setCaretPosition(begOffs);
target.moveCaretPosition(endOffs);
} catch (BadLocationException bl) {
UIManager.getLookAndFeel().provideErrorFeedback(target);
}
}
}
});
JSplitPane split = new JSplitPane();
split.setResizeWeight(.5);
split.setLeftComponent(makeTitledPane(new JTextArea(TEXT), "Default"));
split.setRightComponent(makeTitledPane(textArea, "Break words: _ and -"));
add(split);
setPreferredSize(new Dimension(320, 240));
}
private JComponent makeTitledPane(JComponent c, String title) {
JPanel p = new JPanel(new BorderLayout());
p.add(new JLabel(title), BorderLayout.NORTH);
p.add(new JScrollPane(c));
return p;
}
public static void main(String... args) {
EventQueue.invokeLater(new Runnable() {
@Override public void run() {
createAndShowGUI();
}
});
}
public static void createAndShowGUI() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
}
JFrame frame = new JFrame("@title@");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().add(new MainPanel());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
final class TextUtilties {
private TextUtilties() { /* HideUtilityClassConstructor */ }
//@see javax.swint.text.Utilities.getWordStart(...)
public static int getWordStart(JTextComponent c, int offs) throws BadLocationException {
Element line = Utilities.getParagraphElement(c, offs);
if (line == null) {
throw new BadLocationException("No word at " + offs, offs);
}
Document doc = c.getDocument();
int lineStart = line.getStartOffset();
int lineEnd = Math.min(line.getEndOffset(), doc.getLength());
int offs2 = offs;
Segment seg = SegmentCache.getSharedSegment();
doc.getText(lineStart, lineEnd - lineStart, seg);
if (seg.count > 0) {
BreakIterator words = BreakIterator.getWordInstance(c.getLocale());
words.setText(seg);
int wordPosition = seg.offset + offs - lineStart;
if (wordPosition >= words.last()) {
wordPosition = words.last() - 1;
words.following(wordPosition);
offs2 = lineStart + words.previous() - seg.offset;
} else {
words.following(wordPosition);
offs2 = lineStart + words.previous() - seg.offset;
for (int i = offs; i > offs2; i--) {
char ch = seg.charAt(i - seg.offset);
if (ch == '_' || ch == '-') {
offs2 = i + 1;
break;
}
}
}
}
SegmentCache.releaseSharedSegment(seg);
return offs2;
}
//@see javax.swint.text.Utilities.getWordEnd(...)
public static int getWordEnd(JTextComponent c, int offs) throws BadLocationException {
Element line = Utilities.getParagraphElement(c, offs);
if (line == null) {
throw new BadLocationException("No word at " + offs, offs);
}
Document doc = c.getDocument();
int lineStart = line.getStartOffset();
int lineEnd = Math.min(line.getEndOffset(), doc.getLength());
int offs2 = offs;
Segment seg = SegmentCache.getSharedSegment();
doc.getText(lineStart, lineEnd - lineStart, seg);
if (seg.count > 0) {
BreakIterator words = BreakIterator.getWordInstance(c.getLocale());
words.setText(seg);
int wordPosition = offs - lineStart + seg.offset;
if (wordPosition >= words.last()) {
wordPosition = words.last() - 1;
}
offs2 = lineStart + words.following(wordPosition) - seg.offset;
for (int i = offs; i < offs2; i++) {
char ch = seg.charAt(i - seg.offset);
if (ch == '_' || ch == '-') {
offs2 = i;
break;
}
}
}
SegmentCache.releaseSharedSegment(seg);
return offs2;
}
}
class SegmentCache {
/**
* A global cache.
*/
private static SegmentCache sharedCache = new SegmentCache();
/**
* A list of the currently unused Segments.
*/
private final List<Segment> segments = new ArrayList<>(11);
/**
* Returns the shared SegmentCache.
*/
public static SegmentCache getSharedInstance() {
return sharedCache;
}
/**
* A convenience method to get a Segment from the shared
* <code>SegmentCache</code>.
*/
public static Segment getSharedSegment() {
return getSharedInstance().getSegment();
}
/**
* A convenience method to release a Segment to the shared
* <code>SegmentCache</code>.
*/
public static void releaseSharedSegment(Segment segment) {
getSharedInstance().releaseSegment(segment);
}
// /**
// * Creates and returns a SegmentCache.
// */
// public SegmentCache() {
// segments = new ArrayList<>(11);
// }
/**
* Returns a <code>Segment</code>. When done, the <code>Segment</code>
* should be recycled by invoking <code>releaseSegment</code>.
*/
public Segment getSegment() {
synchronized (this) {
int size = segments.size();
if (size > 0) {
return segments.remove(size - 1);
}
}
return new CachedSegment();
}
/**
* Releases a Segment. You should not use a Segment after you release it,
* and you should NEVER release the same Segment more than once, eg:
* <pre>
* segmentCache.releaseSegment(segment);
* segmentCache.releaseSegment(segment);
* </pre>
* Will likely result in very bad things happening!
*/
public void releaseSegment(Segment segment) {
if (segment instanceof CachedSegment) {
synchronized (this) {
segment.array = null;
segment.count = 0;
segments.add(segment);
}
}
}
/**
* CachedSegment is used as a tagging interface to determine if
* a Segment can successfully be shared.
*/
private static class CachedSegment extends Segment {
}
}
| [
"aterai@outlook.com"
] | aterai@outlook.com |
b0ffefeead6eaefdfb298169521aa5850804b4ea | ed5ca7a19fdfa9bb5b73ef3374c4a5f65aedd908 | /test/gc/TriggerMajorCollect.java | 59aa70866f08c74fe2d264a5bfa3b1653ab9608a | [] | no_license | xudifsd/tiger | c298d37cfbb6500768b12acf30b4e5e7d853a70f | 232c464c93a541707d7436f1f4d8dd06c65b37b5 | refs/heads/master | 2021-01-15T17:07:13.922915 | 2013-12-26T13:35:50 | 2013-12-26T13:35:50 | 12,841,304 | 3 | 3 | null | 2020-01-19T07:49:26 | 2013-09-15T05:57:44 | Java | UTF-8 | Java | false | false | 675 | java | // This test case tests the normal case that trigger major
// collect by minor collect
class TriggerMajorCollect {
public static void main(String[] args) {
System.out.println(new Test().doTest());
}
}
class Test {
public int doTest() {
int[] huge;
int[] medium;
int[] tiny;
AllocateArray aa;
aa = new AllocateArray();
huge = aa.allocate(8000);
medium = aa.allocate(2000);
tiny = aa.allocate(1000);// trigger major gc
return 1;
}
}
class AllocateArray {
public int[] allocate(int len) {
int[] result;
result = new int[len];
return result;
}
}
| [
"xudifsd@gmail.com"
] | xudifsd@gmail.com |
7cef20a24b96e1d56c2d2c1dd6b1c1dd711abf8b | 173f5ffd8732b049a15c98e4aea26f24688a064f | /src/main/java/pl/sda/List/ListTask.java | 511af23852a0d2b16aae6b4358c3c608ecc16672 | [] | no_license | PawelMachos/ADT | 119582e57cc9652ceeb6f812eff2e9f46d496e83 | 34d9b0d5b5de19ab91d676d6060fe0366fda5f3a | refs/heads/master | 2020-07-03T02:01:13.697995 | 2019-09-01T10:22:13 | 2019-09-01T10:22:13 | 201,750,999 | 0 | 0 | null | 2019-08-11T10:36:15 | 2019-08-11T10:36:15 | null | UTF-8 | Java | false | false | 3,288 | java | package pl.sda.List;
import java.util.ArrayList;
public class ListTask {
public static void main(String[] args) {
ArrayList<Integer> listaNaturalnych = new ArrayList<Integer>();
{listaNaturalnych.add(3);
listaNaturalnych.add(4);
listaNaturalnych.add(5);
listaNaturalnych.add(6);
listaNaturalnych.add(7);
listaNaturalnych.add(8);
listaNaturalnych.add(9);
listaNaturalnych.add(10);
listaNaturalnych.add(11);
listaNaturalnych.add(12);
listaNaturalnych.add(13);
listaNaturalnych.add(14);
listaNaturalnych.add(15);
listaNaturalnych.add(16);
listaNaturalnych.add(17);
listaNaturalnych.add(18);
listaNaturalnych.add(19);
listaNaturalnych.add(20);
listaNaturalnych.add(21);
listaNaturalnych.add(22);}
//listaNaturalnych = { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60 };
//po kolei
System.out.println("Po kolei");
for (int wypisy: listaNaturalnych) {
System.out.print(wypisy +" ");
}
System.out.println();
System.out.println("Od konca");
for (int i = listaNaturalnych.size()-1; i >= 0; i--){
System.out.print(listaNaturalnych.get(i) + " ");
}
System.out.println();
System.out.println("Wszystkie na nieparzystych pozycjach");
//System.out.print(listaNaturalnych.get(0) + " ");
for (int i = 0; i <= listaNaturalnych.size()-1; i++){
if (i % 2 != 0) {
System.out.print(listaNaturalnych.get(i) + " ");
}
}
System.out.println();
System.out.println("Wszystkie podzielne przez 3");
//System.out.print(listaNaturalnych.get(0) + " ");
for (int i = 0; i <= listaNaturalnych.size()-1; i++){
if (listaNaturalnych.get(i) % 3 == 0) {
System.out.print(listaNaturalnych.get(i) + " ");
}
}
// suma
System.out.println();
System.out.println("Suma");
int suma = 0;
for (int i = 0; i <= listaNaturalnych.size()-1; i++){
suma += listaNaturalnych.get(i);
}
System.out.println("Suma to " + suma);
// Suma pierwszych 4
System.out.println();
System.out.println("Suma pierwszych 4");
int suma4 = 0;
for (int i = 0; i <= 3; i++){
suma4 += listaNaturalnych.get(i);
}
System.out.println("Suma pierwszych 4 to " + suma4);
System.out.println();
System.out.println("Suma ostatnich 5");
int sumaOstatnich5 =0;
for (int i = listaNaturalnych.size()-1; i >= listaNaturalnych.size()-5; i--){
sumaOstatnich5 += listaNaturalnych.get(i);
}
System.out.print("Suma ostatnich 5 to " + sumaOstatnich5);
System.out.println();
System.out.println("Suma liczb po kolei");
int sumaPierwszych = 0;
for (int i=0; i < listaNaturalnych.size(); i++){
while (sumaPierwszych <= 10) {
sumaPierwszych += listaNaturalnych.get(i);
}
}
System.out.println("Suma pierwszych " + sumaPierwszych);
}
}
| [
"pawmach7@gmail.com"
] | pawmach7@gmail.com |
3dfa62f2cbac8eb2d8b76d867699abe0f22b7144 | 89e33c135b3e755f2717590ee3fd3ec56aee874f | /src/com/techproed/day03_LocatorGiris.java | 0722f2bde89f1da65315f546df13e0ddfca64872 | [] | no_license | bulut67/SeleniumIlkProje | 21623b41afadd5ccb513d202c529538f2c11ce50 | 283492fa1825f081f7aaa4bfcb7ab125c1609ba2 | refs/heads/master | 2022-12-06T20:55:36.077934 | 2020-08-23T20:12:26 | 2020-08-23T20:12:26 | 287,616,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,306 | java | package com.techproed;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class day03_LocatorGiris {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Owner\\Documents\\selenium dependencies\\drivers\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.MILLISECONDS);
driver.manage().window().maximize();
driver.get("http://a.testaddressbook.com");
WebElement signInLink=driver.findElement(By.id("sign-in"));
signInLink.click();
WebElement emailBox=driver.findElement(By.id("session_email"));
emailBox.sendKeys("testtechproed@gmail.com");
WebElement passwordBox=driver.findElement(By.id("session_password"));
passwordBox.sendKeys("Test1234!");
WebElement sigInBox=driver.findElement(By.name("commit"));
sigInBox.click();
String baslik=driver.getTitle();
if (baslik.equals("Address Book")){
System.out.println("Giris Basarili ,WEll done");
}else{
System.out.println("Giris Basarili olamadi!!");
}
driver.quit();
}
}
| [
"mahirbulut67@gmail.com"
] | mahirbulut67@gmail.com |
ede6de6ec1803769c7460e5657470d27e7723521 | ab083f03b7b29d01e9dce49621de996867116fe5 | /LeetCode/src/tree/ConstructBinaryTreeFromPreorderAndInorder.java | f85710310dcf5653282c3904587dec2c8b9689d0 | [] | no_license | njushishuo/Algorithm | 510beb9d612fd4cc4b21bd46b10529f4b1746993 | ab61365322fe1e8f3a1c73470f2a3f00383de84b | refs/heads/master | 2022-12-25T11:07:32.097584 | 2019-12-04T15:06:21 | 2019-12-04T15:06:21 | 106,374,625 | 0 | 0 | null | 2020-10-13T12:07:38 | 2017-10-10T06:02:11 | Java | UTF-8 | Java | false | false | 1,808 | java | package tree;
/**
* https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/
*/
public class ConstructBinaryTreeFromPreorderAndInorder {
/* Definition for a binary tree node.*/
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
}
public TreeNode buildTree(int[] preorder, int[] inorder) {
if(preorder == null || preorder.length == 0 || inorder == null || inorder.length == 0){
return null;
}
return this.buildTree(preorder,inorder,0,preorder.length-1,0,inorder.length-1);
}
private TreeNode buildTree(int[] preorder, int[] inorder , int leftP , int rightP , int leftI , int rightI){
if(leftP > rightP || leftI > rightI || leftP >= preorder.length || leftI >= inorder.length){
return null;
}
if(leftP == rightP){
return new TreeNode(preorder[leftP]);
}
int leftLength = 0;
int rightLength = 0;
int rootVal = preorder[leftP];
int rootIndex = leftI;
for(int i = leftI ; i < inorder.length; i++){
if(inorder[i] == rootVal){
leftLength = i-leftI;
rootIndex = i;
break;
}
}
rightLength = rightP - leftP - leftLength;
TreeNode root = new TreeNode(rootVal);
if(leftLength > 0 ){
root.left = buildTree(preorder, inorder, leftP+1 , leftP + leftLength , leftI , leftI + leftLength-1);
}
if(rightLength > 0){
root.right = buildTree(preorder, inorder, leftP + leftLength +1 , leftP + leftLength + rightLength , rootIndex +1 , rootIndex+rightLength);
}
return root;
}
}
| [
"sx-shis@dtdream.com"
] | sx-shis@dtdream.com |
f7aaf40935e6c164fed6508fe8a22e950cdd3b74 | e105d11fddb0dc7de2c730ba21de3369dfea5041 | /app/src/main/java/com/healthyfish/healthyfishdoctor/adapter/InterrogationServiceAdapter.java | b9d81090519c44145042a12360b0677803633367 | [] | no_license | liweihappyman/HealthyFishDoctor | 283de5077d518a58040b50ee3c16cb81c152668b | ade56eb6ed37c51ca47922d18a82bbe863c06c82 | refs/heads/master | 2020-12-03T08:12:52.272500 | 2017-10-22T09:58:13 | 2017-10-22T09:58:13 | 95,669,124 | 4 | 3 | null | 2017-10-22T09:58:14 | 2017-06-28T12:56:52 | Java | UTF-8 | Java | false | false | 7,493 | java | package com.healthyfish.healthyfishdoctor.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.healthyfish.healthyfishdoctor.R;
import com.zhy.autolayout.utils.AutoUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* 描述:问诊服务页面的适配器
* 作者:LYQ on 2017/7/5.
* 邮箱:feifanman@qq.com
* 编辑:LYQ
*/
public class InterrogationServiceAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater inflater;
private List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
private final int TYPE_PictureConsulting = 0;
private final int TYPE_PrivateDoctor = 1;
public InterrogationServiceAdapter(Context mContext, List<Map<String, Object>> list) {
super();
this.list = list;
this.mContext = mContext;
inflater = LayoutInflater.from(mContext);
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
if (list.size() > 0) {
String type = list.get(position).get("type").toString();
if (type.equals("pictureConsulting"))
return TYPE_PictureConsulting;
else
return TYPE_PrivateDoctor;
}
return -1;
}
@Override
public int getViewTypeCount() {
return 2;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolderGraphicConsultation holderGraphicConsultation = null;
ViewHolderPrivateDoctor holderPrivateDoctor = null;
if (list.size() > 0) {
int type = getItemViewType(position);
if (convertView == null) {
switch (type) {
case TYPE_PictureConsulting:
convertView = inflater.inflate(R.layout.item_graphic_consultation, parent, false);
holderGraphicConsultation = new ViewHolderGraphicConsultation(convertView);
convertView.setTag(holderGraphicConsultation);
AutoUtils.autoSize(convertView);
break;
case TYPE_PrivateDoctor:
convertView = inflater.inflate(R.layout.item_private_doctor, parent, false);
holderPrivateDoctor = new ViewHolderPrivateDoctor(convertView);
convertView.setTag(holderPrivateDoctor);
AutoUtils.autoSize(convertView);
break;
default:
break;
}
} else {
switch (type) {
case TYPE_PictureConsulting:
holderGraphicConsultation = (ViewHolderGraphicConsultation) convertView.getTag();
break;
case TYPE_PrivateDoctor:
holderPrivateDoctor = (ViewHolderPrivateDoctor) convertView.getTag();
break;
default:
break;
}
}
switch (type) {
case TYPE_PictureConsulting:
String flagPictureConsulting[] = new String[]{"name", "hospital", "message", "time", "portrait", "isNew", "isSender"};
Glide.with(mContext).load((String) list.get(position).get(flagPictureConsulting[4])).into(holderGraphicConsultation.civPeerGraphicConsultation);
holderGraphicConsultation.tvPeerNameGraphicConsultation.setText((String) list.get(position).get(flagPictureConsulting[0]));
holderGraphicConsultation.tvHospitalGraphicConsultation.setText((String) list.get(position).get(flagPictureConsulting[1]));
holderGraphicConsultation.tvMessageGraphicConsultation.setText((String) list.get(position).get(flagPictureConsulting[2]));
holderGraphicConsultation.tvReceiveTimeGraphicConsultation.setText((String) list.get(position).get(flagPictureConsulting[3]));
if ("false" == list.get(position).get(flagPictureConsulting[5]).toString()){
holderGraphicConsultation.ivNewMsgGraphicConsultation.setVisibility(View.GONE);
} else if ("true" == list.get(position).get(flagPictureConsulting[5]).toString()
&& "false" == list.get(position).get(flagPictureConsulting[6]).toString()) {
holderGraphicConsultation.ivNewMsgGraphicConsultation.setVisibility(View.VISIBLE);
}
break;
case TYPE_PrivateDoctor:
String flagPrivateDoctor[] = new String[]{"name", "hospital", "message", "time"};
holderPrivateDoctor.civDoctorPrivateDoctor.setImageResource(R.mipmap.logo_240);
holderPrivateDoctor.tvDoctorNamePrivateDoctor.setText((String) list.get(position).get(flagPrivateDoctor[0]));
holderPrivateDoctor.tvHospitalPrivateDoctor.setText((String) list.get(position).get(flagPrivateDoctor[1]));
holderPrivateDoctor.tvMessagePrivateDoctor.setText((String) list.get(position).get(flagPrivateDoctor[2]));
holderPrivateDoctor.tvReceiveTime.setText((String) list.get(position).get(flagPrivateDoctor[3]));
break;
default:
break;
}
}
return convertView;
}
static class ViewHolderGraphicConsultation {
@BindView(R.id.civ_peer_graphic_consultation)
CircleImageView civPeerGraphicConsultation;
@BindView(R.id.tv_peerName_graphic_consultation)
TextView tvPeerNameGraphicConsultation;
@BindView(R.id.tv_hospital_graphic_consultation)
TextView tvHospitalGraphicConsultation;
@BindView(R.id.tv_message_graphic_consultation)
TextView tvMessageGraphicConsultation;
@BindView(R.id.tv_receive_time_graphic_consultation)
TextView tvReceiveTimeGraphicConsultation;
@BindView(R.id.iv_new_msg_graphic_consultation)
ImageView ivNewMsgGraphicConsultation;
ViewHolderGraphicConsultation(View view) {
ButterKnife.bind(this, view);
}
}
static class ViewHolderPrivateDoctor {
@BindView(R.id.civ_doctor_private_doctor)
CircleImageView civDoctorPrivateDoctor;
@BindView(R.id.tv_doctorName_private_doctor)
TextView tvDoctorNamePrivateDoctor;
@BindView(R.id.tv_hospital_private_doctor)
TextView tvHospitalPrivateDoctor;
@BindView(R.id.tv_message_private_doctor)
TextView tvMessagePrivateDoctor;
@BindView(R.id.tv_receive_time)
TextView tvReceiveTime;
ViewHolderPrivateDoctor(View view) {
ButterKnife.bind(this, view);
}
}
}
| [
"liwei_happyman@qq.com"
] | liwei_happyman@qq.com |
ca42015b2d44ba5310e6db5656080b4ec9c3dce2 | e616c35ed66c363eb8dde386b8b3e0574c5268bb | /inventory-domain/src/main/java/io/joamit/inventory/domain/category/CategoryPath.java | eddb6d152ca1dab9853d621a90cac10fa3f10ed1 | [
"MIT"
] | permissive | lin0244/inventory | 90eb17949d610103040e7779b68e5c6f2e7be461 | 2ad14a6feb92981b5180c9a9d6b91e59caf7ea4a | refs/heads/master | 2021-05-12T13:22:42.158257 | 2017-12-31T23:27:18 | 2017-12-31T23:27:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 446 | java | package io.joamit.inventory.domain.category;
public interface CategoryPath {
/**
* Sets the category path for a category
*
* @param categoryPath path string
*/
void setCategoryPath(String categoryPath);
/**
* Generate the path string for a category using path separator
*
* @param pathSeparator string
* @return category path
*/
String generateCategoryPath(String pathSeparator);
}
| [
"amitjoshiave@gmail.com"
] | amitjoshiave@gmail.com |
47f8f0d60c1c175c4416d4e8338cd9d89cedfa12 | af2d24a4695d8b436d9e15f92c6e16f44fc523f9 | /src/edgruberman/bukkit/bukkitplugin/commands/Action.java | d312e1b631255ac059a3873aa87c9baf553dda02 | [] | no_license | EdGruberman/BukkitPlugin | 37e4a9f30d4c79d30a4754edc1561297ed57a9fd | 29f7f41d48f08468b6656ce2d4b06d275927b0a9 | refs/heads/master | 2020-05-20T01:47:18.734769 | 2013-10-07T04:41:37 | 2013-10-07T04:41:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,398 | java | package edgruberman.bukkit.bukkitplugin.commands;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import edgruberman.bukkit.bukkitplugin.commands.util.ArgumentContingency;
import edgruberman.bukkit.bukkitplugin.commands.util.ConfigurationExecutor;
import edgruberman.bukkit.bukkitplugin.commands.util.ExecutionRequest;
import edgruberman.bukkit.bukkitplugin.commands.util.LowerCaseParameter;
import edgruberman.bukkit.bukkitplugin.commands.util.OnlinePlayerParameter;
import edgruberman.bukkit.bukkitplugin.messaging.Courier.ConfigurationCourier;
public class Action extends ConfigurationExecutor {
private final LowerCaseParameter type;
private final OnlinePlayerParameter player;
public Action(final ConfigurationCourier courier, final Server server) {
super(courier);
this.type = this.addRequired(LowerCaseParameter.Factory.create("type"));
this.player = this.addOptional(OnlinePlayerParameter.Factory.create("player", server));
}
// usage: /<command> type [player]
@Override
protected boolean executeImplementation(final ExecutionRequest request) throws ArgumentContingency {
final String type = request.parse(this.type);
final Player player = request.parse(this.player);
this.courier.send(request.getSender(), "action", type, player);
return true;
}
}
| [
"ed@rjump.com"
] | ed@rjump.com |
688a816cf9db85fff1ed124514dba191ab68eb4e | 1e572940d678617d8b8d0e2dd4a9af458d6a7e3b | /src/main/java/com/graphql/springbootgrapql/model/Book.java | bde680bec1fac63580a28cb87f2a1759cab917ff | [] | no_license | shivam3108/spring-boot-grapql-example | 194df7651737131b02fa295f46991e9f1771996c | 4b69cb8df6610cc4d4187d4597c12222b0687549 | refs/heads/master | 2020-03-30T20:06:24.466412 | 2018-10-04T13:09:22 | 2018-10-04T13:09:22 | 151,573,193 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,803 | java | package com.graphql.springbootgrapql.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Table(name = "book")
@Entity
public class Book {
@Id
@Column(name = "isn")
@JsonIgnore
public String isn;
@Column(name = "title")
@JsonIgnore
public String title;
@Column(name = "publisher")
@JsonIgnore
public String publisher;
@Column(name = "authors")
@JsonIgnore
public String authors;
@Column(name = "published_date")
@JsonIgnore
public String publishedDate;
@Column(name = "user_name")
@JsonIgnore
public String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Book(String isn, String title, String publisher, String authors, String publishedDate, String userName) {
super();
this.isn = isn;
this.title = title;
this.publisher = publisher;
this.authors = authors;
this.publishedDate = publishedDate;
this.userName = userName;
}
public String getIsn() {
return isn;
}
public void setIsn(String isn) {
this.isn = isn;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getAuthors() {
return authors;
}
public void setAuthors(String authors) {
this.authors = authors;
}
public Book() {
super();
}
public String getPublishedDate() {
return publishedDate;
}
public void setPublishedDate(String publishedDate) {
this.publishedDate = publishedDate;
}
}
| [
"you@example.com"
] | you@example.com |
11a52e89c4882903b1593f144e5e473427a95443 | 701eb586c5712ae32c99cc4c0fff2b83e0d7a1f1 | /app/src/main/java/com/example/zhaoyu/utils/DensityUtil.java | 9a1d91079f7b70ea8f062f207c2c5bf34651d01b | [] | no_license | ljw124/ZhaoYuNet | cdf00f5aca2a6241f20fd9d88ac9501ac9708ce9 | 66867c1c60f205ebcdb7cc045ea6d5f6a3a64fa7 | refs/heads/master | 2020-06-12T04:37:33.359999 | 2019-06-28T06:06:58 | 2019-06-28T06:06:58 | 194,196,241 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,866 | java | package com.example.zhaoyu.utils;
import android.content.Context;
import android.util.TypedValue;
/**
* 常用单位转换的工具类
*/
public class DensityUtil {
private DensityUtil() {
}
/**
* dp转px
*
* @param context
* @return
*/
public static int dp2px(Context context, float dpVal) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpVal, context.getResources()
.getDisplayMetrics());
}
/**
* sp转px
*
* @param context
* @return
*/
public static int sp2px(Context context, float spVal) {
// return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spVal, context.getResources()
// .getDisplayMetrics());
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (spVal * fontScale + 0.5f);
}
/**
* px转dp
*
* @param context
* @param pxVal
* @return
*/
public static float px2dp(Context context, float pxVal) {
final float scale = context.getResources().getDisplayMetrics().density;
return (pxVal / scale);
}
/**
* px转sp
*
* @param pxVal
* @return
*/
public static float px2sp(Context context, float pxVal) {
return (pxVal / context.getResources().getDisplayMetrics().scaledDensity);
}
/**
* 得到屏幕宽度
*
* @param context
* @return
*/
public static int getDisplayWidth(Context context) {
return context.getResources().getDisplayMetrics().widthPixels;
}
/**
* 得到屏幕高度
*
* @param context
* @return
*/
public static int getDisplayHeight(Context context) {
return context.getResources().getDisplayMetrics().heightPixels;
}
} | [
"929377025@qq.com"
] | 929377025@qq.com |
fac59d6b1c236f63658b2750b123d206691f90fd | 42f6583f088563a75a458d2e60f55422e02ea83a | /sources/kotlin/coroutines/CoroutineContext$plus$1.java | 4f92914969c377ffdb30e33b0e9093fae6242837 | [] | no_license | jinendrasahu/Music-Player-Android-Application | dcac7f57d4dc05ee3c772c0fff27da3a315ed927 | 230f8c0c3b2cfbf07690b62e9485c04899fcc517 | refs/heads/master | 2023-02-04T21:13:09.658658 | 2020-12-25T12:29:23 | 2020-12-25T12:29:23 | 324,344,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,013 | java | package kotlin.coroutines;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u0004H\n¢\u0006\u0002\b\u0005"}, d2 = {"<anonymous>", "Lkotlin/coroutines/CoroutineContext;", "acc", "element", "Lkotlin/coroutines/CoroutineContext$Element;", "invoke"}, k = 3, mv = {1, 1, 15})
/* compiled from: CoroutineContext.kt */
final class CoroutineContext$plus$1 extends Lambda implements Function2<CoroutineContext, CoroutineContext.Element, CoroutineContext> {
public static final CoroutineContext$plus$1 INSTANCE = new CoroutineContext$plus$1();
CoroutineContext$plus$1() {
super(2);
}
public final CoroutineContext invoke(CoroutineContext acc, CoroutineContext.Element element) {
CombinedContext combinedContext;
Intrinsics.checkParameterIsNotNull(acc, "acc");
Intrinsics.checkParameterIsNotNull(element, "element");
CoroutineContext removed = acc.minusKey(element.getKey());
if (removed == EmptyCoroutineContext.INSTANCE) {
return element;
}
ContinuationInterceptor interceptor = (ContinuationInterceptor) removed.get(ContinuationInterceptor.Key);
if (interceptor == null) {
combinedContext = new CombinedContext(removed, element);
} else {
CoroutineContext left = removed.minusKey(ContinuationInterceptor.Key);
if (left == EmptyCoroutineContext.INSTANCE) {
combinedContext = new CombinedContext(element, interceptor);
} else {
combinedContext = new CombinedContext(new CombinedContext(left, element), interceptor);
}
}
return combinedContext;
}
}
| [
"jinendrasahu11@gmail.com"
] | jinendrasahu11@gmail.com |
d1ae973f1fb872078bbe8891506589c71d0e409f | 25d45ba1e65d194a7903f439e71fdf57133df8e8 | /src/nag/UrbanLadder.java | d4f5c85499025a6110764d3c58a828a6dc69c9c6 | [] | no_license | SRIKANTN/tys | 85288bb9728b1a5c16b0428fbca67052f0430deb | ce807221ae59b617e091b18f87d2e14ac99d1b57 | refs/heads/master | 2020-04-24T03:07:34.620998 | 2019-03-10T08:14:11 | 2019-03-10T08:14:11 | 171,660,605 | 0 | 0 | null | 2019-03-10T08:18:58 | 2019-02-20T11:28:14 | HTML | UTF-8 | Java | false | false | 1,973 | java | package nag;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class UrbanLadder {
static
{
System.setProperty("webdriver.chrome.driver", "drivers/chromedriver");
System.setProperty("webdriver.gecko.driver", "drivers/geckodriver");
}
public static void main(String[] args) throws Exception
{
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://www.urbanladder.com");
driver.findElement(By.xpath("//a[@class='close-reveal-modal hide-mobile']")).click();
Actions act=new Actions(driver);
List<WebElement> allMenu = driver.findElements(By.xpath("//div[@id='topnav_wrapper']/ul/li/span"));
for(WebElement we: allMenu)
{
Thread.sleep(1000);
act.moveToElement(we).perform();
String var1 = we.getText();
System.out.println(var1);
List<WebElement> subMenu = driver.findElements(By.xpath("//div[@id='topnav_wrapper']/ul/li/span[contains(text(),'"+var1+"')]/following-sibling::div/descendant::div[@class='taxontype']"));
for(WebElement we1:subMenu)
{
Thread.sleep(1000);
String var2=we1.getText();
System.out.println(var2);
System.out.println("-----------------------------------------------");
List<WebElement> miniMenu = driver.findElements(By.xpath("//div[@id='topnav_wrapper']/ul/li/span[contains(.,'"+var1+"')]/following-sibling::div/descendant::div[@class='taxontype']/a[.='"+var2+"']/parent::div/following-sibling::ul/li/a"));
for(WebElement we2:miniMenu)
{
String var3=we2.getText();
System.out.println(var3);
}
}
System.out.println("=======================================================================");
}
}
} | [
"tyss@linux"
] | tyss@linux |
073db03dc000f028bc1cddf2fc69ca6bfab56940 | ba54490c904fbeb3eb50b8d77fdb1330fbf43a3f | /KrishiGhar/src/com/krishighar/api/models/ProvidersInfoResponse.java | 601432b58058bc2d9af3687b3d090c1209580551 | [
"Beerware"
] | permissive | shunishya/AgricultureInfo | 21687c84d97e809f5f3dc3a4f93de37f841a6d06 | c47005e23a6148879026d0ecd7184ba3555fd9e1 | refs/heads/master | 2016-09-06T08:40:04.126644 | 2014-11-28T14:00:54 | 2014-11-28T14:00:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package com.krishighar.api.models;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ProvidersInfoResponse extends BaseResponse {
@JsonProperty("body")
private ArrayList<ProviderInfo> infos;
/**
* @return the infos
*/
public ArrayList<ProviderInfo> getInfos() {
return infos;
}
/**
* @param infos
* the infos to set
*/
public void setInfos(ArrayList<ProviderInfo> infos) {
this.infos = infos;
}
}
| [
"shunishya.shrestha@gmail.com"
] | shunishya.shrestha@gmail.com |
d89b2d0d8d953163b1990854c7aacb8c72b8fc1f | 7ec0194c493e63b18ab17b33fe69a39ed6af6696 | /masterlock/app_decompiled/sources/com/masterlock/ble/app/view/welcome/WelcomeWalkthrough.java | 668693d1d2af92363f101d2756f3c6068f9dae79 | [] | no_license | rasaford/CS3235 | 5626a6e7e05a2a57e7641e525b576b0b492d9154 | 44d393fb3afb5d131ad9d6317458c5f8081b0c04 | refs/heads/master | 2020-07-24T16:00:57.203725 | 2019-11-05T13:00:09 | 2019-11-05T13:00:09 | 207,975,557 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,121 | java | package com.masterlock.ble.app.view.welcome;
import android.content.Context;
import android.content.Intent;
import android.support.p000v4.view.PagerAdapter;
import android.support.p000v4.view.ViewPager;
import android.support.p000v4.view.ViewPager.OnPageChangeListener;
import android.support.p000v4.view.ViewPager.PageTransformer;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import com.masterlock.ble.app.C1075R;
import com.masterlock.ble.app.MasterLockSharedPreferences;
import com.masterlock.ble.app.activity.SignInActivity;
import com.masterlock.ble.app.activity.SignUpActivity;
import com.masterlock.ble.app.adapters.WelcomeWalkthroughPagerAdapter;
import com.masterlock.ble.app.adapters.WelcomeWalkthroughPagerAdapter.StateListener;
import com.masterlock.ble.app.presenter.welcome.WelcomeWalkthroughPresenter;
import com.masterlock.ble.app.util.IntentUtil;
public class WelcomeWalkthrough extends LinearLayout {
public static final boolean HAS_SEEN_WALK_THROUGH = true;
static final int NUM_PAGES = 5;
LinearLayout circles;
@InjectView(2131296760)
Button createAccountButton;
PagerAdapter mAdapter;
@InjectView(2131296646)
ViewPager mPager;
WelcomeWalkthroughPresenter mWalkthroughPresenter;
@InjectView(2131296758)
Button singInButton;
@InjectView(2131296762)
Button skipWalkthroughButton;
public abstract class BaseTransformer implements PageTransformer {
/* access modifiers changed from: protected */
public boolean hideOffscreenPages() {
return true;
}
/* access modifiers changed from: protected */
public boolean isPagingEnabled() {
return false;
}
/* access modifiers changed from: protected */
public void onPostTransform(View view, float f) {
}
/* access modifiers changed from: protected */
public abstract void onTransform(View view, float f);
public BaseTransformer() {
}
public void transformPage(View view, float f) {
onPreTransform(view, f);
onTransform(view, f);
onPostTransform(view, f);
}
/* access modifiers changed from: protected */
public void onPreTransform(View view, float f) {
float width = (float) view.getWidth();
float f2 = 0.0f;
view.setRotationX(0.0f);
view.setRotationY(0.0f);
view.setRotation(0.0f);
view.setScaleX(1.0f);
view.setScaleY(1.0f);
view.setPivotX(0.0f);
view.setPivotY(0.0f);
view.setTranslationY(0.0f);
view.setTranslationX(isPagingEnabled() ? 0.0f : (-width) * f);
if (hideOffscreenPages()) {
if (f > -1.0f && f < 1.0f) {
f2 = 1.0f;
}
view.setAlpha(f2);
return;
}
view.setAlpha(1.0f);
}
}
public class ZoomOutTranformer extends BaseTransformer {
public ZoomOutTranformer() {
super();
}
/* access modifiers changed from: protected */
public void onTransform(View view, float f) {
float f2;
float f3;
float f4;
float f5;
float f6;
float f7;
float f8;
View view2 = view;
float f9 = f;
View findViewById = view2.findViewById(C1075R.C1077id.rl_welcome_epadlock_background);
View findViewById2 = view2.findViewById(C1075R.C1077id.rl_welcome_ekeysafe_background);
View findViewById3 = view2.findViewById(C1075R.C1077id.rl_welcome_epadlock);
View findViewById4 = view2.findViewById(C1075R.C1077id.rl_welcome_ekeysafe);
View findViewById5 = view2.findViewById(C1075R.C1077id.welcome_title);
View findViewById6 = view2.findViewById(C1075R.C1077id.welcome_body);
View findViewById7 = view2.findViewById(C1075R.C1077id.welcome_img_container);
view2.findViewById(C1075R.C1077id.welcome_img);
View findViewById8 = view2.findViewById(C1075R.C1077id.welcome_img_first);
View findViewById9 = view2.findViewById(C1075R.C1077id.welcome_img_last);
int width = view.getWidth();
if (findViewById3 == null || findViewById4 == null) {
f2 = 0.0f;
} else {
if (0.0f > f9 || f9 >= 1.0f) {
f7 = 0.0f;
f8 = -1.0f;
} else {
float f10 = (float) width;
findViewById.setTranslationX(f10 * f9);
findViewById2.setTranslationX(f10 * (-f9));
WelcomeWalkthrough.this.createAccountButton.setAlpha(1.0f - Math.abs(f));
WelcomeWalkthrough.this.singInButton.setAlpha(1.0f - Math.abs(f));
f7 = 0.0f;
WelcomeWalkthrough.this.skipWalkthroughButton.setAlpha(Math.abs(f) + 0.0f);
f8 = -1.0f;
}
if (f8 >= f9 || f9 >= f7) {
f2 = 0.0f;
} else {
float f11 = (float) width;
float f12 = (0.2f * f9) + f9;
findViewById.setTranslationX(f11 * f12);
findViewById2.setTranslationX((-f12) * f11);
findViewById3.setTranslationX(f11 * f9);
findViewById4.setTranslationX(f11 * (-f9));
WelcomeWalkthrough.this.createAccountButton.setAlpha(1.0f - Math.abs(f));
WelcomeWalkthrough.this.singInButton.setAlpha(1.0f - Math.abs(f));
f2 = 0.0f;
WelcomeWalkthrough.this.skipWalkthroughButton.setAlpha(Math.abs(f) + 0.0f);
}
}
if (findViewById9 != null) {
if (f2 > f9 || f9 >= 1.0f) {
f5 = 0.0f;
f6 = -1.0f;
} else {
WelcomeWalkthrough.this.createAccountButton.setAlpha(1.0f - Math.abs(f));
WelcomeWalkthrough.this.singInButton.setAlpha(1.0f - Math.abs(f));
f5 = 0.0f;
WelcomeWalkthrough.this.skipWalkthroughButton.setAlpha(Math.abs(f) + 0.0f);
f6 = -1.0f;
}
if (f6 < f9 && f9 < f5) {
WelcomeWalkthrough.this.createAccountButton.setAlpha(1.0f - Math.abs(f));
WelcomeWalkthrough.this.singInButton.setAlpha(1.0f - Math.abs(f));
WelcomeWalkthrough.this.skipWalkthroughButton.setAlpha(Math.abs(f) + 0.0f);
}
}
if (findViewById5 != null) {
findViewById5.setAlpha(1.0f - Math.abs(f));
}
if (findViewById6 != null) {
findViewById6.setAlpha(1.0f - Math.abs(f));
}
if (findViewById8 == null) {
f3 = 0.0f;
} else if (f9 > 0.0f) {
if (f9 < 0.0f) {
f4 = f9 + 1.0f;
} else {
f4 = Math.abs(1.0f - f9);
}
findViewById7.setScaleX(f4);
findViewById7.setScaleY(f4);
findViewById7.setPivotX(((float) findViewById7.getWidth()) * 0.5f);
findViewById7.setPivotY(((float) findViewById7.getHeight()) * -5.0E-4f);
f3 = 0.0f;
} else {
f3 = 0.0f;
}
if (f9 < f3 || f9 >= 1.0f) {
view2.setAlpha((f9 < -1.0f || f9 > 1.0f) ? 0.0f : 1.0f - ((Math.abs(f) + 1.0f) - 1.0f));
} else {
view2.setAlpha(1.0f);
}
}
}
public WelcomeWalkthrough(Context context) {
this(context, null);
}
public WelcomeWalkthrough(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
/* access modifiers changed from: protected */
public void onAttachedToWindow() {
super.onAttachedToWindow();
if (!isInEditMode()) {
this.mWalkthroughPresenter = new WelcomeWalkthroughPresenter(this);
this.mWalkthroughPresenter.start();
ButterKnife.inject((View) this);
this.mAdapter = new WelcomeWalkthroughPagerAdapter(new StateListener() {
public final void onChildDiffersFromPosition(int i) {
WelcomeWalkthrough.lambda$onAttachedToWindow$0(WelcomeWalkthrough.this, i);
}
});
this.mPager.setAdapter(this.mAdapter);
this.mPager.setPageTransformer(true, new ZoomOutTranformer());
this.mPager.setOffscreenPageLimit(3);
this.mPager.addOnPageChangeListener(new OnPageChangeListener() {
public void onPageScrollStateChanged(int i) {
}
public void onPageScrolled(int i, float f, int i2) {
}
public void onPageSelected(int i) {
WelcomeWalkthrough.this.setIndicator(i);
}
});
buildCircles();
}
}
public static /* synthetic */ void lambda$onAttachedToWindow$0(WelcomeWalkthrough welcomeWalkthrough, int i) {
welcomeWalkthrough.setIndicator(i);
welcomeWalkthrough.createAccountButton.setAlpha(0.0f);
welcomeWalkthrough.singInButton.setAlpha(0.0f);
}
/* access modifiers changed from: protected */
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.mWalkthroughPresenter.finish();
}
/* access modifiers changed from: 0000 */
@OnClick({2131296758})
public void sigInWalkthrough() {
Intent intent = new Intent(getContext(), SignInActivity.class);
intent.setFlags(IntentUtil.CLEAR_STACK);
getContext().startActivity(intent);
}
/* access modifiers changed from: 0000 */
@OnClick({2131296762, 2131296760})
public void exitWalkthrough() {
MasterLockSharedPreferences.getInstance().putAppHasShownWalkThrough(true);
Intent intent = new Intent(getContext(), SignUpActivity.class);
intent.setFlags(IntentUtil.CLEAR_STACK);
getContext().startActivity(intent);
}
public void onBackPressed() {
int currentItem = this.mPager.getCurrentItem();
if (currentItem > 0) {
this.mPager.setCurrentItem(currentItem - 1, true);
} else {
this.mWalkthroughPresenter.finishActivity();
}
}
private void buildCircles() {
this.circles = (LinearLayout) LinearLayout.class.cast(findViewById(C1075R.C1077id.circles));
int i = (int) ((getResources().getDisplayMetrics().density * 5.0f) + 0.5f);
for (int i2 = 0; i2 < 5; i2++) {
ImageView imageView = new ImageView(getContext());
imageView.setImageResource(C1075R.C1076drawable.ic_swipe_indicator_white_18dp);
imageView.setLayoutParams(new LayoutParams(-2, -2));
imageView.setAdjustViewBounds(true);
imageView.setPadding(i, 0, i, 0);
this.circles.addView(imageView);
}
setIndicator(0);
}
/* access modifiers changed from: private */
public void setIndicator(int i) {
if (i < 5) {
for (int i2 = 0; i2 < 5; i2++) {
ImageView imageView = (ImageView) this.circles.getChildAt(i2);
if (i2 == i) {
imageView.setColorFilter(getResources().getColor(C1075R.color.spruce));
} else {
imageView.setColorFilter(getResources().getColor(C1075R.color.oak));
}
}
}
}
}
| [
"fruehaufmaximilian@gmail.com"
] | fruehaufmaximilian@gmail.com |
38caf6fffaf6b5874b90fbe68b915043707b4f45 | f17447d62ed0856f5d7263aa9a9cb0d5d67f6b08 | /angelia-workflow/src/test/java/williamhill/ssbt/angelia/ApplicationTests.java | 55592f834c06557bc71d04694e6e046ac00f4dd7 | [] | no_license | sparcs360/state-machine | d2dbee8ccb085b0ffbdad3dc4e8e98f3833bcc3a | 116829eeac0500cef5cb506d4216dc1e57ed40b4 | refs/heads/master | 2021-01-20T07:05:13.693957 | 2017-05-01T20:01:13 | 2017-05-01T20:01:13 | 89,958,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | package williamhill.ssbt.angelia;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import williamhill.ssbt.angelia.betplacement.domain.PotentialSlip;
import williamhill.ssbt.angelia.betplacement.workflow.BetPlacementStateMachine;
import williamhill.ssbt.angelia.betplacement.workflow.BetPlacementStates;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Autowired
private BetPlacementStateMachine betPlacementStateMachine;
@Before
public void before() {
betPlacementStateMachine.reset();
}
@Test
public void when_ValidPotentialSlipRecieved_then_TransitionToValidPotentialSlip() {
PotentialSlip potentialSlip = new PotentialSlip(100);
betPlacementStateMachine.receivePotentialSlip(potentialSlip);
assertThat(betPlacementStateMachine.getCurrentState(), is(BetPlacementStates.VALID_POTENTIAL_SLIP));
}
@Test
public void when_InvalidPotentialSlipRecieved_then_TransitionToInvalidPotentialSlip() {
PotentialSlip potentialSlip = new PotentialSlip(0);
betPlacementStateMachine.receivePotentialSlip(potentialSlip);
assertThat(betPlacementStateMachine.getCurrentState(), is(BetPlacementStates.INVALID_POTENTIAL_SLIP));
}
}
| [
"lee.newfeld@gmail.com"
] | lee.newfeld@gmail.com |
8e4debde15b9a2cc004c8c8cbdc18ed629c33e32 | e2071b4260f7d0135a49b74dd6b68057074dd31f | /src/main/java/com/evald/apigateway/Main.java | 0a6c19d038981856a4cd0dbeac4339f94f80403f | [] | no_license | evaldnexhipi/apiGW | 8480286878af03caa8dbe9cc232186b69ce4bf55 | 740b8dda32d335c53974e4580bc858ad1c9dcddc | refs/heads/master | 2020-07-01T02:54:49.389677 | 2019-08-13T15:07:00 | 2019-08-13T15:07:00 | 201,024,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package com.evald.apigateway;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Main {
@RequestMapping("/")
public String taleas(){
return "Hello Taleas from Evald!";
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0b16411059617dfa477728a96ec9ee4fc0d12c97 | 0c3c82afb55527d5139379a28a382e8dd8bd5049 | /test/temperance/storage/impl/MemcachedListTest.java | 5bbdea36de9167d8c8a4411e2f4bda01c218969d | [] | no_license | nowelium/Temperance | e0cda046634d4de90e7a5ac12d05811022ff8425 | df6b51cb6983065cbe5be0f9108a62b8e69356d3 | refs/heads/master | 2021-01-10T05:41:33.322573 | 2010-12-03T02:33:41 | 2010-12-03T02:33:41 | 685,537 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,366 | java | package temperance.storage.impl;
import java.util.HashMap;
import java.util.List;
import libmemcached.wrapper.type.BehaviorType;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import temperance.core.Configure;
import temperance.core.ConnectionPool;
import temperance.exception.LockTimeoutException;
import temperance.exception.MemcachedOperationException;
import temperance.storage.TpList.TpListResult;
public class MemcachedListTest {
private static ConnectionPool pool;
private MemcachedList lst;
@BeforeClass
public static void setupPool(){
Configure configure = new Configure();
configure.setMemcached("localhost:11211");
configure.setPoolBehaviors(new HashMap<BehaviorType, Boolean>(){
private static final long serialVersionUID = 1L;
{
put(BehaviorType.BUFFER_REQUESTS, Boolean.FALSE);
}
});
pool = new ConnectionPool(configure);
pool.init();
}
@AfterClass
public static void cleanupPool(){
//pool.destroy();
}
@Before
public void setup(){
lst = new MemcachedList(pool);
}
@After
public void cleanup(){
pool.get().getStorage().flush(0);
}
@Test
public void add() throws MemcachedOperationException, LockTimeoutException {
Assert.assertEquals(lst.add("key-1", "value-1", 10), 0);
Assert.assertEquals(lst.add("key-1", "value-2", 10), 1);
Assert.assertEquals(lst.add("key-2", "value-3", 10), 0);
Assert.assertEquals(lst.add("key-1", "value-4", 10), 2);
Assert.assertEquals(lst.add("key-a", "value-5", 10), 0);
Assert.assertEquals(lst.add("key-b", "value-6", 10), 0);
Assert.assertEquals(lst.add("key-1", "value-7", 10), 3);
Assert.assertEquals(lst.add("key-2", "value-8", 10), 1);
// duplicate value
Assert.assertEquals(lst.add("key-1", "value-1", 10), 4);
}
@Test
public void get() throws MemcachedOperationException, LockTimeoutException {
lst.add("key-1", "value-1", 10);
lst.add("key-1", "value-2", 10);
lst.add("key-2", "value-3", 10);
{
List<String> key1 = lst.get("key-1", 0, 2);
System.out.println(key1);
Assert.assertEquals(key1.size(), 2);
Assert.assertEquals(key1.get(0), "value-1");
Assert.assertEquals(key1.get(1), "value-2");
}
{
List<String> key1 = lst.get("key-1", 0, 3);
System.out.println(key1);
Assert.assertEquals(key1.size(), 2);
Assert.assertEquals(key1.get(0), "value-1");
Assert.assertEquals(key1.get(1), "value-2");
}
{
List<String> key2 = lst.get("key-2", 0, 2);
System.out.println(key2);
Assert.assertEquals(key2.size(), 1);
Assert.assertEquals(key2.get(0), "value-3");
}
List<String> hoge = lst.get("hoge", 0, 1);
Assert.assertEquals(hoge.size(), 0);
}
@Test
public void get_offset_limit() throws MemcachedOperationException, LockTimeoutException {
lst.add("key", "value-1", 10);
lst.add("key", "value-2", 10);
lst.add("key", "value-3", 10);
lst.add("key", "value-4", 10);
lst.add("key", "value-5", 10);
{
List<String> result = lst.get("key", 0, 2);
System.out.println(result);
Assert.assertEquals(result.size(), 2);
Assert.assertEquals(result.get(0), "value-1");
Assert.assertEquals(result.get(1), "value-2");
}
{
List<String> result = lst.get("key", 1, 2);
System.out.println(result);
Assert.assertEquals(result.size(), 2);
Assert.assertEquals(result.get(0), "value-2");
Assert.assertEquals(result.get(1), "value-3");
}
{
List<String> result = lst.get("key", 2, 1);
System.out.println(result);
Assert.assertEquals(result.size(), 1);
Assert.assertEquals(result.get(0), "value-3");
}
{
List<String> result = lst.get("key", 2, 2);
System.out.println(result);
Assert.assertEquals(result.size(), 2);
Assert.assertEquals(result.get(0), "value-3");
Assert.assertEquals(result.get(1), "value-4");
}
{
List<String> result = lst.get("key", 1, 3);
System.out.println(result);
Assert.assertEquals(result.size(), 3);
Assert.assertEquals(result.get(0), "value-2");
Assert.assertEquals(result.get(1), "value-3");
Assert.assertEquals(result.get(2), "value-4");
}
}
@Test
public void getByResult() throws MemcachedOperationException, LockTimeoutException {
lst.add("key-a", "value-0", 10);
lst.add("key-a", "value-1", 10);
lst.add("key-a", "value-2", 10);
List<TpListResult> results = lst.getByResult("key-a", 0, 3);
System.out.println(results);
{
TpListResult result = results.get(0);
Assert.assertEquals(result.getKey(), "key-a");
Assert.assertEquals(result.getIndex(), 0);
Assert.assertEquals(result.getValue(), "value-0");
}
{
TpListResult result = results.get(1);
Assert.assertEquals(result.getKey(), "key-a");
Assert.assertEquals(result.getIndex(), 1);
Assert.assertEquals(result.getValue(), "value-1");
}
{
TpListResult result = results.get(2);
Assert.assertEquals(result.getKey(), "key-a");
Assert.assertEquals(result.getIndex(), 2);
Assert.assertEquals(result.getValue(), "value-2");
}
}
@Test
public void getAt() throws MemcachedOperationException, LockTimeoutException {
Assert.assertEquals(lst.add("key", "value-1", 10), 0);
Assert.assertEquals(lst.add("key", "value-2", 10), 1);
Assert.assertEquals(lst.add("key", "value-3", 10), 2);
Assert.assertEquals(lst.add("key", "value-4", 10), 3);
Assert.assertEquals(lst.add("key", "value-5", 10), 4);
Assert.assertEquals(lst.getAt("key", 0), "value-1");
Assert.assertEquals(lst.getAt("key", 2), "value-3");
Assert.assertEquals(lst.getAt("key", 0), "value-1");
Assert.assertEquals(lst.getAt("key", 4), "value-5");
}
@Test
public void delete() throws MemcachedOperationException, LockTimeoutException {
lst.add("key", "value1", 10);
lst.add("key", "value2", 10);
lst.add("key", "value3", 10);
lst.add("key", "value4", 10);
{
List<String> results = lst.get("key", 0, 4);
System.out.println(results);
Assert.assertEquals(results.size(), 4);
Assert.assertEquals(results.get(0), "value1");
Assert.assertEquals(results.get(3), "value4");
}
Assert.assertTrue(lst.delete("key", 0));
{
List<String> results = lst.get("key", 0, 4);
System.out.println(results);
Assert.assertEquals(results.size(), 0);
}
}
@Test
public void delete_notfound_key() throws MemcachedOperationException, LockTimeoutException {
Assert.assertFalse(lst.delete("aaaaa", 0));
}
@Test
public void deletAt() throws MemcachedOperationException, LockTimeoutException {
lst.add("key", "value-1", 10);
lst.add("key", "value-2", 10);
lst.add("key", "value-3", 10);
lst.add("key", "value-4", 10);
lst.add("key", "value-5", 10);
Assert.assertEquals(lst.getAt("key", 0), "value-1");
Assert.assertEquals(lst.count("key"), 5);
Assert.assertTrue(lst.deleteAt("key", 0, 0));
Assert.assertNull(lst.getAt("key", 0));
// XXX: fix count size(use reindex)
Assert.assertEquals(lst.count("key"), 5);
Assert.assertEquals(lst.getAt("key", 2), "value-3");
Assert.assertTrue(lst.deleteAt("key", 2, 0));
Assert.assertNull(lst.getAt("key", 2));
// XXX: fix count size(use reindex)
Assert.assertEquals(lst.count("key"), 5);
}
@Test
public void count() throws MemcachedOperationException, LockTimeoutException {
Assert.assertEquals(lst.count("keey"), 0);
lst.add("keey", "value", 10);
Assert.assertEquals(lst.count("keey"), 1);
lst.add("keey", "value", 10);
Assert.assertEquals(lst.count("keey"), 2);
lst.add("keey", "value", 10);
Assert.assertEquals(lst.count("keey"), 3);
List<String> results = lst.get("keey", 0, 10);
Assert.assertEquals(results.size(), 3);
}
@Test
public void reindex() throws MemcachedOperationException, LockTimeoutException {
lst.add("key", "value-1", 10);
lst.add("key", "value-2", 10);
lst.add("key", "value-3", 10);
lst.add("key", "value-4", 10);
lst.add("key", "value-5", 10);
Assert.assertEquals(lst.getAt("key", 0), "value-1");
Assert.assertEquals(lst.count("key"), 5);
Assert.assertTrue(lst.deleteAt("key", 0, 0));
Assert.assertNull(lst.getAt("key", 0));
Assert.assertEquals(lst.count("key"), 5);
lst.reindex("key");
Assert.assertEquals(lst.count("key"), 4);
}
@Test
public void reindex_large_index() throws MemcachedOperationException, LockTimeoutException {
for(int i = 0; i < 5000; ++i){
lst.add("key", Integer.toString(i), 0);
}
Assert.assertEquals(lst.count("key"), 5000);
lst.deleteAt("key", 2, 0);
lst.deleteAt("key", 20, 0);
lst.deleteAt("key", 200, 0);
lst.deleteAt("key", 2000, 0);
Assert.assertEquals(lst.count("key"), 5000);
lst.reindex("key");
Assert.assertEquals(lst.count("key"), 4996);
}
}
| [
"nowelium+github@gmail.com"
] | nowelium+github@gmail.com |
a92aaff385bd52915e2ada0dd6fa1aaccfbdd6ee | 8e84d744555adf20c870add877697b1ac2f06099 | /app/build/tmp/kapt3/stubs/proPlayDebug/com/ttchain/walletproject/base/BaseRecyclerViewViewModel.java | bab6eca3150e49d1bbfa28334b2f3fd6cfd6831c | [] | no_license | ttchain-project/Infireum-androidWallet | 5d58b07db9393b092ffa61c0774b85f92cac7b81 | 780ac02f907bd08d1f6cc1a1be5f107efddddcaf | refs/heads/master | 2021-07-15T05:08:02.328095 | 2020-01-17T10:04:47 | 2020-01-17T10:04:47 | 234,517,408 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,491 | java | package com.ttchain.walletproject.base;
import java.lang.System;
@kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\b\n\u0002\u0010\u000e\n\u0002\b\n\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\u0003\n\u0002\b\u0006\b&\u0018\u0000 7*\u0004\b\u0000\u0010\u00012\u00020\u0002:\u000278B\u0005\u00a2\u0006\u0002\u0010\u0003J\u0010\u0010$\u001a\u00020\f2\u0006\u0010%\u001a\u00020\u0013H\u0004J\b\u0010&\u001a\u00020\'H\u0015J \u0010(\u001a\u000e\u0012\u0004\u0012\u0002H*\u0012\u0004\u0012\u0002H*0)\"\u0004\b\u0001\u0010*2\u0006\u0010+\u001a\u00020\u0013J(\u0010(\u001a\u000e\u0012\u0004\u0012\u0002H*\u0012\u0004\u0012\u0002H*0)\"\u0004\b\u0001\u0010*2\u0006\u0010+\u001a\u00020\u00132\u0006\u0010,\u001a\u00020\fJ0\u0010(\u001a\u000e\u0012\u0004\u0012\u0002H*\u0012\u0004\u0012\u0002H*0)\"\u0004\b\u0001\u0010*2\u0006\u0010+\u001a\u00020\u00132\u0006\u0010,\u001a\u00020\f2\u0006\u0010-\u001a\u00020\fJ\b\u0010.\u001a\u00020\'H\u0016J\u0016\u0010/\u001a\u00020\'2\f\u00100\u001a\b\u0012\u0004\u0012\u00028\u00000\u0006H\u0004J\u0010\u00101\u001a\u00020\'2\u0006\u00102\u001a\u000203H\u0004J\b\u00104\u001a\u00020\'H\u0015J\u0010\u00105\u001a\u00020\'2\u0006\u00106\u001a\u00020\u0013H\u0004R&\u0010\u0004\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u00060\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\nR \u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\f0\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\b\"\u0004\b\r\u0010\nR \u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\f0\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\b\"\u0004\b\u000f\u0010\nR \u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\f0\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0010\u0010\b\"\u0004\b\u0011\u0010\nR\u001a\u0010\u0012\u001a\u00020\u0013X\u0084\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R\u001a\u0010\u0018\u001a\u00020\u0013X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0019\u0010\u0015\"\u0004\b\u001a\u0010\u0017R\u0017\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\u001c0\u0005\u00a2\u0006\b\n\u0000\u001a\u0004\b\u001d\u0010\bR \u0010\u001e\u001a\b\u0012\u0004\u0012\u00020\u001c0\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u001f\u0010\b\"\u0004\b \u0010\nR&\u0010!\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u00060\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\"\u0010\b\"\u0004\b#\u0010\n\u00a8\u00069"}, d2 = {"Lcom/ttchain/walletproject/base/BaseRecyclerViewViewModel;", "L", "Lcom/ttchain/walletproject/base/BaseViewModel;", "()V", "addArrayListLiveData", "Landroidx/lifecycle/MutableLiveData;", "", "getAddArrayListLiveData", "()Landroidx/lifecycle/MutableLiveData;", "setAddArrayListLiveData", "(Landroidx/lifecycle/MutableLiveData;)V", "isLoadMoreComplete", "", "setLoadMoreComplete", "isLoadMoreEnd", "setLoadMoreEnd", "isRefreshLoading", "setRefreshLoading", "mPageNow", "", "getMPageNow", "()I", "setMPageNow", "(I)V", "mRequestStatus", "getMRequestStatus", "setMRequestStatus", "onShowMessageDialog", "", "getOnShowMessageDialog", "setEmptyMsg", "getSetEmptyMsg", "setSetEmptyMsg", "setListDataLiveData", "getSetListDataLiveData", "setSetListDataLiveData", "hasNextPage", "total", "loadMoreRequest", "", "loadingRecyclerView", "Lio/reactivex/ObservableTransformer;", "T", "status", "showLoading", "closeLoading", "normalRequest", "onSubscribeComplete", "list", "onSubscribeError", "throwable", "", "refreshRequest", "setNextPage", "next", "Companion", "RequestStatus", "app_proPlayDebug"})
public abstract class BaseRecyclerViewViewModel<L extends java.lang.Object> extends com.ttchain.walletproject.base.BaseViewModel {
@org.jetbrains.annotations.NotNull()
private androidx.lifecycle.MutableLiveData<java.lang.Boolean> isRefreshLoading;
@org.jetbrains.annotations.NotNull()
private androidx.lifecycle.MutableLiveData<java.lang.Boolean> isLoadMoreEnd;
@org.jetbrains.annotations.NotNull()
private androidx.lifecycle.MutableLiveData<java.lang.Boolean> isLoadMoreComplete;
private int mPageNow;
private int mRequestStatus;
@org.jetbrains.annotations.NotNull()
private androidx.lifecycle.MutableLiveData<java.util.List<L>> addArrayListLiveData;
@org.jetbrains.annotations.NotNull()
private androidx.lifecycle.MutableLiveData<java.util.List<L>> setListDataLiveData;
@org.jetbrains.annotations.NotNull()
private androidx.lifecycle.MutableLiveData<java.lang.String> setEmptyMsg;
@org.jetbrains.annotations.NotNull()
private final androidx.lifecycle.MutableLiveData<java.lang.String> onShowMessageDialog = null;
public static final int NORMAL_REQUEST = 9001;
public static final int LOAD_MORE_REQUEST = 9002;
public static final int REFRESH_REQUEST = 9003;
public static final com.ttchain.walletproject.base.BaseRecyclerViewViewModel.Companion Companion = null;
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.lang.Boolean> isRefreshLoading() {
return null;
}
public final void setRefreshLoading(@org.jetbrains.annotations.NotNull()
androidx.lifecycle.MutableLiveData<java.lang.Boolean> p0) {
}
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.lang.Boolean> isLoadMoreEnd() {
return null;
}
public final void setLoadMoreEnd(@org.jetbrains.annotations.NotNull()
androidx.lifecycle.MutableLiveData<java.lang.Boolean> p0) {
}
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.lang.Boolean> isLoadMoreComplete() {
return null;
}
public final void setLoadMoreComplete(@org.jetbrains.annotations.NotNull()
androidx.lifecycle.MutableLiveData<java.lang.Boolean> p0) {
}
protected final int getMPageNow() {
return 0;
}
protected final void setMPageNow(int p0) {
}
public final int getMRequestStatus() {
return 0;
}
public final void setMRequestStatus(int p0) {
}
@org.jetbrains.annotations.NotNull()
public final <T extends java.lang.Object>io.reactivex.ObservableTransformer<T, T> loadingRecyclerView(@com.ttchain.walletproject.base.BaseRecyclerViewViewModel.RequestStatus()
int status) {
return null;
}
@org.jetbrains.annotations.NotNull()
public final <T extends java.lang.Object>io.reactivex.ObservableTransformer<T, T> loadingRecyclerView(@com.ttchain.walletproject.base.BaseRecyclerViewViewModel.RequestStatus()
int status, boolean showLoading) {
return null;
}
@org.jetbrains.annotations.NotNull()
public final <T extends java.lang.Object>io.reactivex.ObservableTransformer<T, T> loadingRecyclerView(@com.ttchain.walletproject.base.BaseRecyclerViewViewModel.RequestStatus()
int status, boolean showLoading, boolean closeLoading) {
return null;
}
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.util.List<L>> getAddArrayListLiveData() {
return null;
}
public final void setAddArrayListLiveData(@org.jetbrains.annotations.NotNull()
androidx.lifecycle.MutableLiveData<java.util.List<L>> p0) {
}
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.util.List<L>> getSetListDataLiveData() {
return null;
}
public final void setSetListDataLiveData(@org.jetbrains.annotations.NotNull()
androidx.lifecycle.MutableLiveData<java.util.List<L>> p0) {
}
protected final void onSubscribeComplete(@org.jetbrains.annotations.NotNull()
java.util.List<? extends L> list) {
}
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.lang.String> getSetEmptyMsg() {
return null;
}
public final void setSetEmptyMsg(@org.jetbrains.annotations.NotNull()
androidx.lifecycle.MutableLiveData<java.lang.String> p0) {
}
@org.jetbrains.annotations.NotNull()
public final androidx.lifecycle.MutableLiveData<java.lang.String> getOnShowMessageDialog() {
return null;
}
protected final void onSubscribeError(@org.jetbrains.annotations.NotNull()
java.lang.Throwable throwable) {
}
protected final void setNextPage(int next) {
}
public void normalRequest() {
}
protected final boolean hasNextPage(int total) {
return false;
}
@androidx.annotation.CallSuper()
protected void loadMoreRequest() {
}
@androidx.annotation.CallSuper()
protected void refreshRequest() {
}
public BaseRecyclerViewViewModel() {
super();
}
@androidx.annotation.IntDef(value = {9001, 9002, 9003})
@kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\b\u0087\u0002\u0018\u00002\u00020\u0001B\u0000\u00a8\u0006\u0002"}, d2 = {"Lcom/ttchain/walletproject/base/BaseRecyclerViewViewModel$RequestStatus;", "", "app_proPlayDebug"})
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.SOURCE)
@kotlin.annotation.Retention(value = kotlin.annotation.AnnotationRetention.SOURCE)
public static abstract @interface RequestStatus {
}
@kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002\u00a2\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0086T\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0086T\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0007"}, d2 = {"Lcom/ttchain/walletproject/base/BaseRecyclerViewViewModel$Companion;", "", "()V", "LOAD_MORE_REQUEST", "", "NORMAL_REQUEST", "REFRESH_REQUEST", "app_proPlayDebug"})
public static final class Companion {
private Companion() {
super();
}
}
} | [
"zero761120@gmail.com"
] | zero761120@gmail.com |
543367542c196191c2242eb178cb2d62483c447a | 39d5426d679da29effd0ab25cde0fe82eb717b37 | /src/main/java/com/ascarpediemstyle/book/entity/Publisher.java | 2575edb7ef6aebdc55e4b749d01a4190ef301189 | [] | no_license | ascarpediemstyle/springbook | 9d0203230fec01318633f3cf170878ed643c162c | 69e9ca80da08d29f29265a6d64d1eab5e10edfe7 | refs/heads/master | 2016-08-12T03:34:22.753911 | 2016-02-28T11:08:59 | 2016-02-28T11:08:59 | 50,721,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,014 | java | package com.ascarpediemstyle.book.entity;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the publisher database table.
*
*/
@Entity
@NamedQuery(name="Publisher.findAll", query="SELECT p FROM Publisher p")
public class Publisher implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="publisher_id")
private Integer publisherId;
@Column(name="order_by")
private Integer orderBy;
@Column(name="publisher_name")
private String publisherName;
public Publisher() {
}
public Integer getPublisherId() {
return this.publisherId;
}
public void setPublisherId(Integer publisherId) {
this.publisherId = publisherId;
}
public Integer getOrderBy() {
return this.orderBy;
}
public void setOrderBy(Integer orderBy) {
this.orderBy = orderBy;
}
public String getPublisherName() {
return this.publisherName;
}
public void setPublisherName(String publisherName) {
this.publisherName = publisherName;
}
} | [
"mamo@s.com"
] | mamo@s.com |
37c68df8a77ded4bd1f964470047d9eb1147484c | 045bce133fefaa93bf216cb877259d3af14a6d3d | /day01/ex02/UsersArrayList.java | d05811bd1275a69e840797ff26b2dbfbe688dd44 | [] | no_license | rrsab/javaPisine | 31c56a3f25f8db9b1b3e216c0ca6cefc53feb589 | 8b9fd6937f3f49ae5368551de46074b2825d847e | refs/heads/master | 2023-09-04T01:41:37.136385 | 2021-10-26T19:12:32 | 2021-10-26T19:12:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | class UserNotFoundException extends RuntimeException {}
public class UsersArrayList implements UsersList {
private User[] arr;
private Integer count;
private static Integer DEFAULT_SIZE = 10;
public UsersArrayList() {
arr = new User[DEFAULT_SIZE];
count = 0;
}
@Override
public void add(User user) {
if (arr.length == count) {
User[] newArr = new User[count + count];
for (int i = 0; i < arr.length; i++) {
newArr[i] = arr[i];
}
arr = newArr;
}
arr[count] = user;
count++;
}
@Override
public User getById(Integer id) {
for (int i = 0; i < count; i++) {
if (id.equals(arr[i].getIdentifier())) {
return arr[i];
}
}
throw new UserNotFoundException();
}
@Override
public User getByIndex(Integer id) {
if (id < 0 || id >= count) {
throw new ArrayIndexOutOfBoundsException();
}
return arr[id];
}
@Override
public Integer getCount() {
return count;
}
}
| [
"ssoraka@student.21-school.ru"
] | ssoraka@student.21-school.ru |
5e602b480ada554a7a10399f5b0d282d290cf091 | 26582d1574be73364cb2c27dd00fc6c931051a4a | /SeleniumAutomation/src/com/test/TestNGfeatures.java | a65e0a258ab79f7c01379b289ff3ac15acf60bb8 | [] | no_license | mnvinay91/HelloGit | 9637ebf9f3d1bca15bbaa1266911b7a12b116e5c | 4662d5704aba567829489886983fa81a9ce88b72 | refs/heads/master | 2020-05-22T23:40:20.581241 | 2019-05-15T00:06:18 | 2019-05-15T00:06:18 | 186,563,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.test;
import org.testng.annotations.Test;
public class TestNGfeatures
{
@Test
public void LoginTest()
{
System.out.println("Login Test");
//int i = 9/0;(exception--doesn't executes further remaining test cases)
}
@Test(dependsOnMethods="LoginTest")
public void HomePageTest()
{
System.out.println("Home Page Test");
}
@Test(dependsOnMethods="LoginTest")
public void SearchPageTest()
{
System.out.println("Search Page Test");
}
@Test(dependsOnMethods="LoginTest")
public void RegPageTest()
{
System.out.println("Reg Page Test");
}
}
| [
"vinaymuralidhar91@gmail.com"
] | vinaymuralidhar91@gmail.com |
055c4588c01feedf7ccd8312d953693b76738c98 | 7f1b18eda200ae8bf807c3ac78391ab976abe47b | /src/main/java/com/timelog/timelog/models/ERole.java | 199851b5de21b52eff33ad378856d3c0f312dff1 | [] | no_license | OsvaldoSalomon/timelog-backend | 9c3f7089427fd5ab47b1ca1ae5187660248f2d09 | 26d223a27d768b7b878adf0804a10e01ebfcb7e0 | refs/heads/master | 2023-02-03T09:41:34.661532 | 2020-12-22T11:54:56 | 2020-12-22T11:54:56 | 267,710,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | package com.timelog.timelog.models;
public enum ERole {
ROLE_USER,
ROLE_MODERATOR,
ROLE_ADMIN
}
| [
"osvaldo.salo21@gmail.com"
] | osvaldo.salo21@gmail.com |
4c27cf1fcabfc00adda2f196d7eda6493b56856e | 699e7c622c1580e0feaaaa734d6f464556537380 | /spring-core-intro/src/main/java/org/intutech/Demo.java | affa78d7be9e767465b377205d3ca299a0577354 | [] | no_license | chetanjaingmail/Spring-Boot | ec79b943b80920affbe33c7b9872554d37d5943c | 4316851b5a884bcd040e19c1ef108c13f8c51200 | refs/heads/master | 2023-06-25T16:13:43.671374 | 2021-07-26T13:18:20 | 2021-07-26T13:18:20 | 389,639,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package org.intutech;
public class Demo {
public Demo() {
System.out.println("Demo Object Created...");
}
public void test() {
System.out.println("This is Test Method From Demo class..");
}
}
| [
"jainchetan481@gmail.com"
] | jainchetan481@gmail.com |
a6a930c7e8e674f20635a2b86c04bf57b55a74f9 | 33c63d9e6fa6ef3d906cf2cb59aca618f0ab9b51 | /src/main/java/com/fh/utils/JWT.java | 49ddb4d210a2d173e9ca9e738de8946ba1b21d36 | [] | no_license | ajh-lxy/emp | e463e6941a37698bc05d314514416b90e61ea379 | 945b6af9a499d01a9cfc4157f8ccfbc82fa38e02 | refs/heads/master | 2020-12-14T08:38:05.872817 | 2020-01-18T05:54:40 | 2020-01-18T05:54:40 | 234,688,584 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,077 | java | package com.fh.utils;
import com.auth0.jwt.JWTSigner;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.internal.com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
public class JWT {
private static final String SECRET = "XX#$%()(#*!()!KL<><MQLMNQNQJQK sdfkjsdrow32234545fdf>?N<:{LWPW";
private static final String EXP = "exp";
private static final String PAYLOAD = "payload";
/**
* get jwt String of object
* @param object
* the POJO object
* @param maxAge
* the milliseconds of life time
* @return the jwt token
*/
public static <T> String sign(T object, long maxAge) {
try {
final JWTSigner signer = new JWTSigner(SECRET);
final Map<String, Object> claims = new HashMap<String, Object>();
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(object);
claims.put(PAYLOAD, jsonString);
claims.put(EXP, System.currentTimeMillis() + maxAge);
return signer.sign(claims);
} catch(Exception e) {
return null;
}
}
/**
* get the object of jwt if not expired
* @param jwt
* @return POJO object
*/
public static<T> T unsign(String jwt, Class<T> classT) {
final JWTVerifier verifier = new JWTVerifier(SECRET);
try {
final Map<String,Object> claims= verifier.verify(jwt);
if (claims.containsKey(EXP) && claims.containsKey(PAYLOAD)) {
long exp = (Long)claims.get(EXP);
long currentTimeMillis = System.currentTimeMillis();
if (exp > currentTimeMillis) {
String json = (String)claims.get(PAYLOAD);
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(json, classT);
}
}
return null;
} catch (Exception e) {
return null;
}
}
}
| [
"wangkenan@hongyi-info.com"
] | wangkenan@hongyi-info.com |
84e548814a1e2bb74f25df6ef58c456e1b3b7aed | 0daddd81a36655ed0cb1c449a1ca6937b7d20e5c | /src/main/java/com/jie/springboot_mybatis2/Bean/Department.java | 34a28a9399d0eb2b692e779567f640c9a77712cf | [] | no_license | jie980/HotelManagement | 57191c836956a396dc3aac1334875ac7b18e4f31 | 60fe443e34c41d16a6c6a7babf76add763ae9f47 | refs/heads/master | 2022-12-11T21:08:04.891892 | 2020-08-31T09:27:15 | 2020-08-31T09:27:15 | 287,154,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package com.jie.springboot_mybatis2.Bean;
import java.util.List;
public class Department {
private Integer did;
private String dname;
//一对多映射
private List<Employee> emps;
public List<Employee> getEmps() {
return emps;
}
public void setEmps(List<Employee> emps) {
this.emps = emps;
}
public Integer getDid() {
return did;
}
public void setDid(Integer did) {
this.did = did;
}
public String getDname() {
return dname;
}
public void setDname(String dname) {
this.dname = dname;
}
@Override
public String toString() {
return "Department{" +
"did=" + did +
", dname='" + dname + '\'' +
", emps=" + emps +
'}';
}
}
| [
"jie@MINJIEdeMacBook-Pro.local"
] | jie@MINJIEdeMacBook-Pro.local |
53c557585c7bbaa504884d2b0972fae80349269b | 0772737ab5ad3346c9eb1f061d64440bf67da9b7 | /app/src/test/java/com/mensagemtoast/oliveiragabriel/bedelmanager/ExampleUnitTest.java | 94a7213069230ee213709015041283728c00ef64 | [] | no_license | GabrielJOliveira95/Bedel-Manager | d26facf9b93e9e8bde54ee34b59ab811baea3fb6 | 66d34402ee74142ada6c6b1b0a32bbf8c906871c | refs/heads/master | 2020-06-05T09:23:19.256561 | 2019-07-23T05:23:39 | 2019-07-23T05:23:39 | 192,239,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.mensagemtoast.oliveiragabriel.bedelmanager;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"gabrieljoliveira95@gmail.com"
] | gabrieljoliveira95@gmail.com |
d703de566b183375524dff10480ceb4f4faa37ce | 13e716fb43e8c1603ff0a4d8044367dd5fb3b3ae | /src/main/java/com/darwin/common/utils/SolrUtils.java | 88f1f846128acd33f36c6bdce294ff7d2bd6d4b0 | [] | no_license | DarewinWang/MySolr | b025324e136211ddfbc28cfc876ca82c138469a4 | 811b72443e0da80da2ea4572e91919857d354ca4 | refs/heads/master | 2020-03-25T15:38:20.037956 | 2018-09-09T12:01:05 | 2018-09-09T12:01:05 | 143,893,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.darwin.common.utils;
/**
* @类描述:solr查询工具类
* @项目名称:MySolr
* @包名: com.darwin.common.utils
* @类名称:SolrUtils
* @创建人:WangDong
* @创建时间:2018年7月23日上午2:28:03
* @修改人:WangDong
* @修改时间:2018年7月23日上午2:28:03
* @修改备注:
* @version v1.0
* @see
* @bug
* @Copyright
* @mail *@qq.com
*/
public class SolrUtils {
}
| [
"1991wangdong@gmail.com"
] | 1991wangdong@gmail.com |
45357960b25c115913b71375f14a0d686e94aa1a | 4a99b994055e1fed90e67ba9412a63d101a6ebf7 | /demo/src/main/java/aaa/bbb/ccc/ddd/Address.java | 9f5807d6fefdbe4c9b12c2a0f751b92fafe4f5c8 | [] | no_license | treblereel/woodstox-j2cl | 0a91a6cca1b2c12a0a05c6f161c58641783acb1b | 3ba70cc48e30dc0ffc9c4cde1c55785f9552dd57 | refs/heads/master | 2021-01-26T04:08:42.745107 | 2020-05-12T20:06:18 | 2020-05-12T20:06:18 | 243,303,267 | 0 | 0 | null | 2020-10-13T20:35:16 | 2020-02-26T15:57:14 | Java | UTF-8 | Java | false | false | 802 | java | package aaa.bbb.ccc.ddd;
/**
* @author Dmitrii Tikhomirov
* Created by treblereel 3/11/20
*/
public class Address {
private int id;
public int getId() {
return id;
}
@Override
public String toString() {
return "Address{" +
"id=" + id +
", street='" + street + '\'' +
", city='" + city + '\'' +
'}';
}
public void setId(int id) {
this.id = id;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
private String street;
private String city;
}
| [
"chani@me.com"
] | chani@me.com |
b88b621e1d77a443cda65e76eef75c57de763276 | a046e394808d9d538b6ab1aa6b1df5a534a0f927 | /JavaWebE3/src/cn/imzfz/model/bean/User.java | 4da8a14b85c4d1c08ac9fea1dc98ff9216cc2784 | [] | no_license | imzfz/JavaWeb | d6994cd2190688ed86fcfe6803e19bb73f453269 | f1512627ec1dc796c143a8e8de7554614cceed94 | refs/heads/master | 2021-08-22T13:20:52.767288 | 2017-11-30T08:41:33 | 2017-11-30T08:41:33 | 111,193,932 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package cn.imzfz.model.bean;
/**
* Created by zfz on 2017/11/24.
*/
public class User {
private String username = "";
private String pass = "";
private int auth = 0;
public User(String username, String pass) {
this.username = username;
this.pass = pass;
}
public String getUsername() {
return username;
}
public String getPass() {
return pass;
}
public int getAuth() {
return auth;
}
public void setAuth(int auth) {
this.auth = auth;
}
}
| [
"admin@imzfz.cn"
] | admin@imzfz.cn |
c748ebc317a8646492ee9842d504f86f5940e78f | cadf5aa08d9628cc69dc2e2a1ca613d0cde93fca | /Spiel.java | 254e3e95db54e0be255faba29fbb29da085d7261 | [] | no_license | Jaspi10/ABJJ-Mathespiel | db779b23391e194141f804d62ddca6d3d4ce5f9f | 9dbb6e498c2f77f693644f2bc7ca3da5b6d4f6bd | refs/heads/master | 2020-03-13T04:10:05.416177 | 2018-05-29T20:04:14 | 2018-05-29T20:04:14 | 130,958,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | import greenfoot.*;
public class Spiel
{
private static int ebene;
public static void neusSpiel()
{
ebene = 1;
new Ebene1();
}
public static void naechsteEbene()
{
switch (ebene)
{
case 1:
ebene = 2;
new Ebene2();
break;
case 2:
ebene = 3;
new Ebene3();
break;
case 3:
System.out.println("Gewonnen!");
Greenfoot.stop();
break;
}
}
}
| [
"Jasperh.lp@gmail.com"
] | Jasperh.lp@gmail.com |
b755bd50e45b7c15648c32e74dd7d08e9165f978 | 55e269125ae4a92691eee419543de6d9a639a900 | /src/com/example/cim/service/CIMPushService.java | 443ad95acabaa6a00f3938d21e0c7bebc9ca271f | [] | no_license | calow/MyCIM | 095c9ac638a87b6ee4fcfd2594cdf0f971525098 | 7fa87ce6ee090a96329aeb696c8e0c654cf49684 | refs/heads/master | 2021-01-21T04:42:09.143122 | 2016-06-23T09:59:00 | 2016-06-23T09:59:00 | 51,994,627 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,572 | java | package com.example.cim.service;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
import com.example.cim.manager.CIMConnectorManager;
import com.example.cim.manager.CIMPushManager;
import com.example.cim.nio.mutual.SentBody;
import com.example.cim.receiver.KeepAliveReceiver;
import com.example.cim.util.CIMDataConfig;
public class CIMPushService extends Service {
CIMConnectorManager mConnectorManager;
AlarmManager mAlarmManager;
PendingIntent mPendingIntent;
private IBinder mBinder = new CIMPushService.LocalBinder();
@Override
public void onCreate() {
mConnectorManager = CIMConnectorManager.getManager(this
.getApplicationContext());
mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(this,
KeepAliveReceiver.class), PendingIntent.FLAG_CANCEL_CURRENT);
mAlarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
mAlarmManager.cancel(mPendingIntent);
mAlarmManager.set(AlarmManager.RTC_WAKEUP,
300000L + System.currentTimeMillis(), mPendingIntent);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action;
if (intent == null) {
intent = new Intent(CIMPushManager.ACTION_CONNECTION);
String host = CIMDataConfig.getString(this,
CIMDataConfig.KEY_CIM_SERVIER_HOST);
int port = CIMDataConfig.getInt(this,
CIMDataConfig.KEY_CIM_SERVIER_PORT);
intent.putExtra(CIMDataConfig.KEY_CIM_SERVIER_HOST, host);
intent.putExtra(CIMDataConfig.KEY_CIM_SERVIER_PORT, port);
}
action = intent.getStringExtra(CIMPushManager.SERVICE_ACTION);
if (action.equals(CIMPushManager.ACTION_CONNECTION_KEEPALIVE)) {
mAlarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
mAlarmManager.set(AlarmManager.RTC_WAKEUP,
300000L + System.currentTimeMillis(), mPendingIntent);
// 判断连接是否依然连着,如果没连着则重连
if (!mConnectorManager.isConnected()) {
String host = intent
.getStringExtra(CIMDataConfig.KEY_CIM_SERVIER_HOST);
int port = intent.getIntExtra(
CIMDataConfig.KEY_CIM_SERVIER_PORT, 23456);
mConnectorManager.connect(host, port);
} else {
Log.d(CIMPushService.class.getSimpleName(),
"isConnected() = true ");
}
}
if (action.equals(CIMPushManager.ACTION_CONNECTION)) {
String host = intent
.getStringExtra(CIMDataConfig.KEY_CIM_SERVIER_HOST);
int port = intent.getIntExtra(CIMDataConfig.KEY_CIM_SERVIER_PORT,
23456);
mConnectorManager.connect(host, port);
}
if (action.equals(CIMPushManager.ACTION_SENDREQUEST)) {
SentBody sentBody = (SentBody) intent.getSerializableExtra(CIMPushManager.KEY_SEND_BODY);
mConnectorManager.send(sentBody);
}
if(action.equals(CIMPushManager.ACTION_DISCONNECTION)){
mConnectorManager.closeSession();
}
if(action.equals(CIMPushManager.ACTION_DESTROY)){
mConnectorManager.destroy();
this.stopSelf();
android.os.Process.killProcess(android.os.Process.myPid());
}
if(action.equals(CIMPushManager.ACTION_CONNECTION_STATUS)){
mConnectorManager.deliverIsConnected();
}
return Service.START_REDELIVER_INTENT;
}
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
public class LocalBinder extends Binder {
public CIMPushService getService() {
return CIMPushService.this;
}
}
}
| [
"725517818@qq.com"
] | 725517818@qq.com |
1b5b6f4d6b106d0dad2ec8c0148b6c61c978f34b | ea6a7287a2bd82d04549b91f2f77aff8ccebc835 | /src/test/java/miro/smartphone/inventory/service/SmartphoneInventoryApplicationTests.java | f2f4be805d6d26e6a4f8d0ed117b7566018affd7 | [] | no_license | MiroslavMogus/smartphone-inventory-service | 7146384c62e024bbfd522cc163a81f0b1b372348 | 3897f70999338d310e8509d4422c5f028f9ddf34 | refs/heads/master | 2020-08-12T19:00:53.091904 | 2019-10-17T17:50:31 | 2019-10-17T17:50:31 | 214,447,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package miro.smartphone.inventory.service;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class SmartphoneInventoryApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"miromogus@gmail.com"
] | miromogus@gmail.com |
3659bc703b2566442e57fd1fee915e423d6af3ec | 71e7162d2491abcea99e08418e939c7b3e3fd6fb | /sz0099-parent/sz0099-course-app-product/src/main/java/dml/sz0099/course/app/persist/dao/profession/ProfessionPraiseDao.java | b0321b38145cc7d8f4b8f696a89822eda52e68b7 | [] | no_license | snowflake3721/sz0099 | 1b7127daf9aba559425f9fb4ac580892c7cb74f9 | 0d6252db85f54aa7f1ccbc4fbf86ebe98898ce1b | refs/heads/master | 2020-04-29T07:46:17.756488 | 2019-03-16T11:47:33 | 2019-03-16T11:47:33 | 175,964,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,358 | java | package dml.sz0099.course.app.persist.dao.profession;
import java.util.List;
import org.jit4j.core.persist.dao.GenericDao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import dml.sz0099.course.app.persist.entity.profession.ProfessionPraise;
/**
* ProfessionPraiseDao
* 数据访问接口
* ----------------------------------------------------------------------------------------
* Requirement Author Date Function
* init bruceyang 2017-08-16 basic init
*
*
*/
public interface ProfessionPraiseDao extends GenericDao<ProfessionPraise,Long>{
/**
* 根据Id查询ProfessionPraise实体对象
* @param id
* @return
*/
ProfessionPraise findById(Long id);
boolean existById(Long id) ;
/**
* 自增长id查询实体对象
* @param aid
* @return
*/
ProfessionPraise findByAid(Long aid);
/**
* 根据IdList查询ProfessionPraise实体对象列表
* @param idList
* @return
*/
public List<ProfessionPraise> findByIdList(List<Long> idList);
public Page<ProfessionPraise> findPage(ProfessionPraise professionPraise, Pageable pageable);
public boolean existByMainIdAndUserId(Long mainId, Long userId);
public ProfessionPraise findByMainIdAndUserId(Long mainId, Long userId);
public Page<ProfessionPraise> findByMainId(Long mainId, Pageable pageable) ;
}
| [
"1839604586@qq.com"
] | 1839604586@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.