blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9da22f6f189cd8b9d5a25f8948750b36a16df9ce | 333fafe15c9fade1184b1927525829ce4ec51118 | /app/src/main/java/com/hungnt/customlogin/Objs/AlbumInfo.java | 42f8c0c39ccd037a541d47948dd8dfe8c084abf1 | [] | no_license | bibi136/MusicPlayer | 473053303f321a30dd4a9cd1bf3618e36e4f7daf | 5f17e113428fbd48092ee72735ef5776a7e26925 | refs/heads/master | 2021-01-25T05:15:46.814417 | 2015-08-17T19:25:44 | 2015-08-17T19:25:44 | 38,816,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.hungnt.customlogin.Objs;
/**
* Created by HungNT on 17/August/2015.
*/
public class AlbumInfo {
private String albumName;
private String cover;
private String artist;
private int id;
public AlbumInfo(String albumName, String cover, String artist, int id) {
this.albumName = albumName;
this.cover = cover;
this.id = id;
this.artist = artist;
}
public String getAlbumName() {
return albumName;
}
public String getCover() {
return cover;
}
public int getId() {
return id;
}
public String getArtist() {
return artist;
}
}
| [
"ilu199x@gmail.com"
] | ilu199x@gmail.com |
fabb5da29bd3201f80f9fa578e56e19386970a5a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/22/22_3bcad8b8dd3e69e66afabf884121da63f811eb27/DicomExplorer/22_3bcad8b8dd3e69e66afabf884121da63f811eb27_DicomExplorer_t.java | d565624438f916ab99da755a8c2abf734a8e3ce0 | [] | 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 | 78,148 | java | /*******************************************************************************
* Copyright (c) 2010 Nicolas Roduit.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nicolas Roduit - initial API and implementation
******************************************************************************/
package org.weasis.dicom.explorer;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.font.FontRenderContext;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JToggleButton;
import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.UIResource;
import org.apache.felix.service.command.CommandProcessor;
import org.noos.xing.mydoggy.DockedTypeDescriptor;
import org.noos.xing.mydoggy.ToolWindow;
import org.noos.xing.mydoggy.ToolWindowAnchor;
import org.noos.xing.mydoggy.ToolWindowType;
import org.osgi.service.component.ComponentContext;
import org.slf4j.LoggerFactory;
import org.weasis.core.api.explorer.DataExplorerView;
import org.weasis.core.api.explorer.ObservableEvent;
import org.weasis.core.api.explorer.model.DataExplorerModel;
import org.weasis.core.api.gui.util.JMVUtils;
import org.weasis.core.api.media.data.MediaSeriesGroup;
import org.weasis.core.api.media.data.MediaSeriesGroupNode;
import org.weasis.core.api.media.data.Series;
import org.weasis.core.api.media.data.TagElement;
import org.weasis.core.api.media.data.Thumbnail;
import org.weasis.core.api.util.FontTools;
import org.weasis.core.ui.docking.PluginTool;
import org.weasis.core.ui.docking.UIManager;
import org.weasis.core.ui.editor.SeriesViewerFactory;
import org.weasis.core.ui.editor.image.ViewerPlugin;
import org.weasis.core.ui.util.ArrayListComboBoxModel;
import org.weasis.core.ui.util.WrapLayout;
import org.weasis.dicom.codec.DicomImageElement;
import org.weasis.dicom.codec.DicomSeries;
import org.weasis.dicom.codec.DicomSpecialElement;
import org.weasis.dicom.codec.geometry.ImageOrientation;
import org.weasis.dicom.explorer.wado.LoadSeries;
public class DicomExplorer extends PluginTool implements DataExplorerView {
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(DicomExplorer.class);
public final static String NAME = Messages.getString("DicomExplorer.title"); //$NON-NLS-1$
public final static String PREFERENCE_NODE = "dicom.explorer"; //$NON-NLS-1$
public final static String BUTTON_NAME = Messages.getString("DicomExplorer.btn_title"); //$NON-NLS-1$
public final static String DESCRIPTION = Messages.getString("DicomExplorer.desc"); //$NON-NLS-1$
// private final static JMenuItem openDicomMenu = new JMenuItem(OpenMediaAction.getInstance());
private final static String ALL_PATIENTS = Messages.getString("DicomExplorer.sel_all_pat"); //$NON-NLS-1$
private final static String ALL_STUDIES = Messages.getString("DicomExplorer.sel_all_st"); //$NON-NLS-1$
public static final Icon PATIENT_ICON = new ImageIcon(DicomExplorer.class.getResource("/icon/16x16/patient.png")); //$NON-NLS-1$
private JPanel panel = null;
private PatientPane selectedPatient = null;
private final List<PatientPane> patientPaneList = new ArrayList<PatientPane>();
private final HashMap<MediaSeriesGroup, List<StudyPane>> patient2study =
new HashMap<MediaSeriesGroup, List<StudyPane>>();
private final HashMap<MediaSeriesGroup, List<SeriesPane>> study2series =
new HashMap<MediaSeriesGroup, List<SeriesPane>>();
private final JScrollPane thumnailView = new JScrollPane();
private final SeriesSelectionModel selectionList = new SeriesSelectionModel();
private final DicomModel model;
private final Comparator patientComparator = new Comparator() {
@Override
public int compare(Object o1, Object o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
};
private final Comparator studyComparator = new Comparator() {
@Override
public boolean equals(Object obj) {
return true;
}
@Override
public int compare(Object o1, Object o2) {
if (o1 == o2) {
return 0;
}
if (o1 instanceof StudyPane && o2 instanceof StudyPane) {
o1 = ((StudyPane) o1).dicomStudy;
o2 = ((StudyPane) o2).dicomStudy;
}
if (o1 instanceof MediaSeriesGroup && o2 instanceof MediaSeriesGroup) {
MediaSeriesGroup st1 = (MediaSeriesGroup) o1;
MediaSeriesGroup st2 = (MediaSeriesGroup) o2;
Date date1 = (Date) st1.getTagValue(TagElement.StudyDate);
Date date2 = (Date) st2.getTagValue(TagElement.StudyDate);
// LOGGER.debug("date1: {} date2: {}", date1, date2);
if (date1 != null && date2 != null) {
// inverse time
int res = date2.compareTo(date1);
if (res == 0) {
Date time1 = (Date) st1.getTagValue(TagElement.StudyTime);
Date time2 = (Date) st2.getTagValue(TagElement.StudyTime);
if (time1 != null && time2 != null) {
// inverse time
return time2.compareTo(time1);
}
} else {
return res;
}
}
String uid1 = (String) st1.getTagValue(TagElement.StudyInstanceUID);
String uid2 = (String) st2.getTagValue(TagElement.StudyInstanceUID);
if (date1 == null && date2 == null && uid1 != null && uid2 != null) {
return uid1.compareTo(uid2);
} else {
if (date1 == null) {
return 1;
}
if (date2 == null) {
return -1;
}
}
} else {
if (o1 instanceof MediaSeriesGroup) {
return 1;
}
if (o2 instanceof MediaSeriesGroup) {
return -1;
}
}
return 0;
}
};
private final ArrayListComboBoxModel modelPatient = new ArrayListComboBoxModel() {
private static final long serialVersionUID = 1826724555734323483L;
@Override
public void addElement(Object anObject) {
int index = binarySearch(anObject, patientComparator);
if (index < 0) {
super.insertElementAt(anObject, -(index + 1));
}
}
};
private final ArrayListComboBoxModel modelStudy = new ArrayListComboBoxModel() {
private static final long serialVersionUID = 2272386715266884376L;
@Override
public void addElement(Object anObject) {
int index = binarySearch(anObject, studyComparator);
// TODO handle same dates.
if (index < 0) {
super.insertElementAt(anObject, -(index + 1));
} else {
super.insertElementAt(anObject, index);
}
}
};
private final JComboBox patientCombobox = new JComboBox(modelPatient);
private final JComboBox studyCombobox = new JComboBox(modelStudy);
protected final PatientContainerPane patientContainer = new PatientContainerPane();
private transient final ItemListener patientChangeListener = new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
Object item = modelPatient.getSelectedItem();
if (item instanceof MediaSeriesGroupNode) {
MediaSeriesGroupNode patient = (MediaSeriesGroupNode) item;
selectPatient(patient);
} else if (item != null) {
selectPatient(null);
}
patientContainer.revalidate();
patientContainer.repaint();
}
}
};
private transient final ItemListener studyItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
selectStudy();
}
}
};
private final JSlider slider = new JSlider(Thumbnail.MIN_SIZE, Thumbnail.MAX_SIZE, Thumbnail.DEFAULT_SIZE);
private JPanel panel_1 = null;
private final JPanel panel_2 = new JPanel();
private final JToggleButton btnMoreOptions = new JToggleButton(Messages.getString("DicomExplorer.more_opt")); //$NON-NLS-1$
private final JPanel panel_3 = new JPanel();
private final JButton btnExport = new JButton(Messages.getString("DicomExplorer.export")); //$NON-NLS-1$
private final JButton btnImport = new JButton(Messages.getString("DicomExplorer.import")); //$NON-NLS-1$
private final AbstractAction importAction =
new AbstractAction(Messages.getString("DicomExplorer.to") + DicomExplorer.NAME) { //$NON-NLS-1$
@Override
public void actionPerformed(ActionEvent e) {
DicomImport dialog = new DicomImport(model);
JMVUtils.showCenterScreen(dialog);
}
};
private final AbstractAction exportAction =
new AbstractAction(Messages.getString("DicomExplorer.from") + DicomExplorer.NAME) { //$NON-NLS-1$
@Override
public void actionPerformed(ActionEvent e) {
DicomExport dialog = new DicomExport(model);
JMVUtils.showCenterScreen(dialog);
}
};
public DicomExplorer() {
this(null);
}
public DicomExplorer(DicomModel model) {
super(BUTTON_NAME, NAME, ToolWindowAnchor.LEFT);
setLayout(new BorderLayout());
setDockableWidth(180);
this.model = model == null ? new DicomModel() : model;
Color panelBckColor = (Color) javax.swing.UIManager.get("Panel.background"); //$NON-NLS-1$
if (panelBckColor == null) {
javax.swing.UIManager.put("Panel.background", this.getBackground()); //$NON-NLS-1$
}
thumnailView.getVerticalScrollBar().setUnitIncrement(16);
thumnailView.setViewportView(patientContainer);
changeToolWindowAnchor(getAnchor());
}
protected void activate(ComponentContext context) {
this.model.addPropertyChangeListener(this);
Dictionary<String, Object> dict = new Hashtable<String, Object>();
dict.put(CommandProcessor.COMMAND_SCOPE, "dicom"); //$NON-NLS-1$
dict.put(CommandProcessor.COMMAND_FUNCTION, DicomModel.functions);
context.getBundleContext().registerService(DicomModel.class.getName(), model, dict);
}
protected void deactivate(ComponentContext context) {
this.model.removePropertyChangeListener(this);
// TODO need to unregister service ?
}
private String getLimiteStringSize(String name, int limit) {
if (name.length() > limit) {
name = name.substring(0, limit - 2) + "..."; //$NON-NLS-1$
}
return name;
}
public SeriesSelectionModel getSelectionList() {
return selectionList;
}
// offset is the percentage of thumb size (to be removed)
// private String getLimitedStringSize(String name, int offset) {
// FontMetrics fm = studyButton.getFontMetrics(studyButton.getFont());
// int width = fm.stringWidth(name);
// if (width > Thumbnail.MAX_SIZE) {
// double length = name.length();
// int index = (int) (length * ((double) Thumbnail.MAX_SIZE / width) - 5);
// if (index < 0) {
// return name;
// }
// name = name.substring(0, index) + "...";
// }
// return name;
// }
private void removePatientPane(MediaSeriesGroup patient) {
for (int i = 0; i < patientPaneList.size(); i++) {
PatientPane p = patientPaneList.get(i);
if (p.isPatient(patient)) {
patientPaneList.remove(i);
List<StudyPane> studies = patient2study.remove(patient);
if (studies != null) {
for (StudyPane studyPane : studies) {
study2series.remove(studyPane.dicomStudy);
}
}
patientContainer.remove(p);
modelPatient.removeElement(patient);
return;
}
}
}
private void removeStudy(MediaSeriesGroup study) {
MediaSeriesGroup patient = model.getParent(study, DicomModel.patient);
List<StudyPane> studies = patient2study.get(patient);
if (studies != null) {
for (int i = 0; i < studies.size(); i++) {
StudyPane st = studies.get(i);
if (st.isStudy(study)) {
studies.remove(i);
if (studies.size() == 0) {
patient2study.remove(patient);
// throw a new event for removing the patient
model.removePatient(patient);
return;
}
study2series.remove(study);
PatientPane patientPane = getPatientPane(patient);
if (patientPane != null && patientPane.isStudyVisible(study)) {
patientPane.remove(st);
modelStudy.removeElement(study);
patientPane.revalidate();
patientPane.repaint();
}
break;
}
}
}
study2series.remove(study);
}
private void removeSeries(MediaSeriesGroup series) {
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
List<SeriesPane> seriesList = study2series.get(study);
if (seriesList != null) {
for (int j = 0; j < seriesList.size(); j++) {
SeriesPane se = seriesList.get(j);
if (se.isSeries(series)) {
seriesList.remove(j);
if (seriesList.size() == 0) {
study2series.remove(study);
// throw a new event for removing the patient
model.removeStudy(study);
return;
}
se.removeAll();
StudyPane studyPane = getStudyPane(study);
if (studyPane != null && studyPane.isSeriesVisible(series)) {
studyPane.remove(se);
studyPane.revalidate();
studyPane.repaint();
}
break;
}
}
}
}
private PatientPane createPatientPane(MediaSeriesGroup patient) {
PatientPane pat = getPatientPane(patient);
if (pat == null) {
pat = new PatientPane(patient);
patientPaneList.add(pat);
}
return pat;
}
private PatientPane getPatientPane(MediaSeriesGroup patient) {
for (PatientPane p : patientPaneList) {
if (p.isPatient(patient)) {
return p;
}
}
return null;
}
private StudyPane getStudyPane(MediaSeriesGroup study) {
List<StudyPane> studies = patient2study.get(model.getParent(study, DicomModel.patient));
if (studies != null) {
for (int i = 0; i < studies.size(); i++) {
StudyPane st = studies.get(i);
if (st.isStudy(study)) {
return st;
}
}
}
return null;
}
private StudyPane createStudyPaneInstance(MediaSeriesGroup study, int[] position) {
StudyPane studyPane = getStudyPane(study);
if (studyPane == null) {
studyPane = new StudyPane(study);
List<StudyPane> studies = patient2study.get(model.getParent(study, DicomModel.patient));
if (studies != null) {
int index = Collections.binarySearch(studies, studyPane, studyComparator);
if (index < 0) {
index = -(index + 1);
} else {
index = studies.size();
}
if (position != null) {
position[0] = index;
}
studies.add(index, studyPane);
}
} else if (position != null) {
position[0] = -1;
}
return studyPane;
}
private void updateThumbnailSize() {
int thumbnailSize = slider.getValue();
for (PatientPane p : patientContainer.getPatientPaneList()) {
for (StudyPane studyPane : p.getStudyPaneList()) {
for (SeriesPane series : studyPane.getSeriesPaneList()) {
series.updateSize(thumbnailSize);
}
}
}
patientContainer.revalidate();
patientContainer.repaint();
}
private SeriesPane getSeriesPane(MediaSeriesGroup series) {
List<SeriesPane> seriesList = study2series.get(model.getParent(series, DicomModel.study));
if (seriesList != null) {
for (int j = 0; j < seriesList.size(); j++) {
SeriesPane se = seriesList.get(j);
if (se.isSeries(series)) {
return se;
}
}
}
return null;
}
private synchronized SeriesPane createSeriesPaneInstance(MediaSeriesGroup series, int[] position) {
// TODO improve this method
SeriesPane seriesPane = getSeriesPane(series);
if (seriesPane == null) {
seriesPane = new SeriesPane(series);
List<SeriesPane> seriesList = study2series.get(model.getParent(series, DicomModel.study));
if (seriesList != null) {
// Sort series by Series Number if it exist
Integer val1 = getIntValue((Integer) series.getTagValue(TagElement.SeriesNumber));
// String seriesUID = (String) series.getTagValue(TagElement.SeriesInstanceUID);
int index = 0;
// int splitIndex = 1;
for (int i = 0; i < seriesList.size(); i++) {
SeriesPane sp = seriesList.get(i);
if (series instanceof DicomSeries && sp.sequence instanceof DicomSeries) {
Integer val2 = getIntValue((Integer) sp.sequence.getTagValue(TagElement.SeriesNumber));
String seriesUID2 = (String) sp.sequence.getTagValue(TagElement.SeriesInstanceUID);
// boolean updateSplitNumber = splitNb != null && seriesUID.equals(seriesUID2);
if (val1 != null && val2 != null && val1.intValue() < val2.intValue()) {
// if (updateSplitNumber) {
// updateSplitSeriesNumber(seriesList, i, seriesUID, splitIndex + 1);
// }
LOGGER.debug("Sort Series {} by Series Number, index: {} ", val1, i); //$NON-NLS-1$
break;
}
// Split Series or series without series number
else if ((val1 == null || val2 == null) || val1.intValue() == val2.intValue()) {
DicomImageElement media1 = ((DicomSeries) series).getMedia(0);
DicomImageElement media2 = ((DicomSeries) sp.sequence).getMedia(0);
if (media1 != null && media2 != null) {
Float tag1 = (Float) media1.getTagValue(TagElement.SliceLocation);
Float tag2 = (Float) media2.getTagValue(TagElement.SliceLocation);
if (tag1 != null && tag2 != null && tag1.floatValue() < tag2.floatValue()) {
// if (updateSplitNumber) {
// updateSplitSeriesNumber(seriesList, i, seriesUID, splitIndex + 1);
// }
LOGGER.debug(
"Sort Series {} by slice Location: {}, index: {} ", new Object[] { val1, //$NON-NLS-1$
tag1, i });
break;
}
// Case tag2 is a localizer and tag1 the series
else if (tag2 == tag1) {
int p1 =
getOrientationLabelPosition((String) media1
.getTagValue(TagElement.ImageOrientationPlane));
int p2 =
getOrientationLabelPosition((String) media2
.getTagValue(TagElement.ImageOrientationPlane));
if (p1 < p2) {
// if (updateSplitNumber) {
// updateSplitSeriesNumber(seriesList, i, seriesUID, splitIndex + 1);
// }
LOGGER.debug(
"Sort Series {} by orientation: {}, index: {} ", new Object[] { val1, //$NON-NLS-1$
p1, i });
break;
}
}
}
}
// if (updateSplitNumber) {
// splitIndex++;
// }
}
index = i + 1;
if (position != null) {
position[0] = index;
}
}
// if (splitNb != null) {
// series.setTag(TagElement.SplitSeriesNumber, splitIndex);
// }
seriesList.add(index, seriesPane);
}
} else if (position != null) {
position[0] = -1;
}
return seriesPane;
}
private int getIntValue(Integer value) {
return value == null ? 0 : value.intValue();
}
private int getOrientationLabelPosition(String orientationPlane) {
for (int i = 0; i < ImageOrientation.LABELS.length; i++) {
if (ImageOrientation.LABELS[i].equals(orientationPlane)) {
return i;
}
}
return 0;
}
private void updateSplitSeriesNumber(List<SeriesPane> seriesList, int index, String seriesUID, int splitNumber) {
if (seriesList != null) {
for (int j = index; j < seriesList.size(); j++) {
SeriesPane sp = seriesList.get(j);
if (seriesUID.equals(sp.sequence.getTagValue(TagElement.SeriesInstanceUID))) {
sp.sequence.setTag(TagElement.SplitSeriesNumber, splitNumber);
splitNumber++;
}
}
}
}
private boolean isSelectedPatient(MediaSeriesGroup patient) {
if (selectedPatient != null && selectedPatient.patient == patient) {
return true;
}
return false;
}
class TitleBorder extends TitledBorder {
public TitleBorder(String title) {
super(title);
setFont(FontTools.getFont10());
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
// Measure the title length
FontRenderContext frc = ((Graphics2D) g).getFontRenderContext();
Rectangle bound = getTitleFont().getStringBounds(title, frc).getBounds();
int panelLength = width - 15;
if (bound.width > panelLength) {
int length = (title.length() * panelLength) / bound.width;
if (length > 2) {
title = title.substring(0, length - 2) + "..."; //$NON-NLS-1$
}
}
super.paintBorder(c, g, x, y, width, height);
}
}
class PatientContainerPane extends JPanel {
private final GridBagConstraints constraint =
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0);
private final Component filler = Box.createRigidArea(new Dimension(5, 5));
public PatientContainerPane() {
modelPatient.removeAllElements();
// root of the focus cycle of the patient's thumbnails
this.setFocusCycleRoot(true);
this.setFocusTraversalPolicyProvider(true);
// do not use addElement
// modelPatient.insertElementAt(ALL_PATIENTS, 0);
setLayout(new GridBagLayout());
}
private List<PatientPane> getPatientPaneList() {
ArrayList<PatientPane> patientPaneList = new ArrayList<PatientPane>();
for (Component c : this.getComponents()) {
if (c instanceof PatientPane) {
patientPaneList.add((PatientPane) c);
}
}
return patientPaneList;
}
private void refreshLayout() {
List<PatientPane> list = getPatientPaneList();
super.removeAll();
for (PatientPane p : list) {
p.refreshLayout();
if (p.getComponentCount() > 0) {
addPane(p);
}
}
}
private void showAllPatients() {
super.removeAll();
for (PatientPane patientPane : patientPaneList) {
patientPane.showTitle(true);
patientPane.showAllstudies();
if (patientPane.getComponentCount() > 0) {
addPane(patientPane);
}
}
this.revalidate();
}
public void addPane(PatientPane patientPane, int position) {
boolean vertical = ToolWindowAnchor.RIGHT.equals(getAnchor()) || ToolWindowAnchor.LEFT.equals(getAnchor());
constraint.gridx = vertical ? 0 : position;
constraint.gridy = vertical ? position : 0;
remove(filler);
constraint.weightx = vertical ? 1.0 : 0.0;
constraint.weighty = vertical ? 0.0 : 1.0;
add(patientPane, constraint);
constraint.weightx = vertical ? 0.0 : 1.0;
constraint.weighty = vertical ? 1.0 : 0.0;
add(filler, constraint);
}
public void addPane(PatientPane patientPane) {
addPane(patientPane, GridBagConstraints.RELATIVE);
}
public boolean isPatientVisible(MediaSeriesGroup patient) {
for (Component c : this.getComponents()) {
if (c instanceof PatientPane) {
if (((PatientPane) c).isPatient(patient)) {
return true;
}
}
}
return false;
}
public boolean isStudyVisible(MediaSeriesGroup study) {
MediaSeriesGroup patient = model.getParent(study, DicomModel.patient);
for (Component c : this.getComponents()) {
if (c instanceof PatientPane) {
PatientPane patientPane = (PatientPane) c;
if (patientPane.isPatient(patient) && patientPane.isStudyVisible(study)) {
return true;
}
}
}
return false;
}
public boolean isSeriesVisible(MediaSeriesGroup series) {
MediaSeriesGroup patient = model.getParent(series, DicomModel.patient);
for (Component c : this.getComponents()) {
if (c instanceof PatientPane) {
PatientPane patientPane = (PatientPane) c;
if (patientPane.isPatient(patient) && patientPane.isSeriesVisible(series)) {
return true;
}
}
}
return false;
}
}
class PatientPane extends JPanel {
private final MediaSeriesGroup patient;
private final GridBagConstraints constraint =
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0);
public PatientPane(MediaSeriesGroup patient) {
if (patient == null) {
throw new IllegalArgumentException("Patient cannot be null"); //$NON-NLS-1$
}
this.patient = patient;
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
this.setFocusable(false);
setLayout(new GridBagLayout());
}
public void showTitle(boolean show) {
if (show) {
TitleBorder title = new TitleBorder(patient.toString());
title.setTitleFont(FontTools.getFont12Bold());
title.setTitleJustification(TitledBorder.LEFT);
Color color = javax.swing.UIManager.getColor("ComboBox.buttonHighlight"); //$NON-NLS-1$
title.setTitleColor(color);
title.setBorder(BorderFactory.createLineBorder(color, 2));
this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 25, 5), title));
} else {
this.setBorder(null);
}
}
public boolean isStudyVisible(MediaSeriesGroup study) {
for (Component c : this.getComponents()) {
if (c instanceof StudyPane) {
StudyPane studyPane = (StudyPane) c;
if (studyPane.isStudy(study)) {
return true;
}
}
}
return false;
}
public boolean isSeriesVisible(MediaSeriesGroup series) {
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
for (Component c : this.getComponents()) {
if (c instanceof StudyPane) {
StudyPane studyPane = (StudyPane) c;
if (studyPane.isStudy(study) && studyPane.isSeriesVisible(series)) {
return true;
}
}
}
return false;
}
private List<StudyPane> getStudyPaneList() {
ArrayList<StudyPane> studyPaneList = new ArrayList<StudyPane>();
for (Component c : this.getComponents()) {
if (c instanceof StudyPane) {
studyPaneList.add((StudyPane) c);
}
}
return studyPaneList;
}
private void refreshLayout() {
List<StudyPane> studies = getStudyPaneList();
super.removeAll();
for (StudyPane studyPane : studies) {
studyPane.refreshLayout();
if (studyPane.getComponentCount() > 0) {
addPane(studyPane);
}
}
this.revalidate();
}
private void showAllstudies() {
super.removeAll();
List<StudyPane> studies = patient2study.get(patient);
if (studies != null) {
for (StudyPane studyPane : studies) {
studyPane.showAllSeries();
studyPane.refreshLayout();
if (studyPane.getComponentCount() > 0) {
addPane(studyPane);
}
}
this.revalidate();
}
}
public void addPane(StudyPane studyPane) {
addPane(studyPane, GridBagConstraints.RELATIVE);
}
public void addPane(StudyPane studyPane, int position) {
boolean vertical = ToolWindowAnchor.RIGHT.equals(getAnchor()) || ToolWindowAnchor.LEFT.equals(getAnchor());
constraint.gridx = vertical ? 0 : position;
constraint.gridy = vertical ? position : 0;
constraint.weightx = vertical ? 1.0 : 0.0;
constraint.weighty = 0.0;
add(studyPane, constraint);
}
public boolean isPatient(MediaSeriesGroup patient) {
return this.patient.equals(patient);
}
}
class StudyPane extends JPanel {
private final MediaSeriesGroup dicomStudy;
private final TitleBorder title;
public StudyPane(MediaSeriesGroup dicomStudy) {
if (dicomStudy == null) {
throw new IllegalArgumentException("Study cannot be null"); //$NON-NLS-1$
}
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
this.dicomStudy = dicomStudy;
title = new TitleBorder(dicomStudy.toString());
title.setTitleFont(FontTools.getFont12());
title.setTitleJustification(TitledBorder.LEFT);
this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5), title));
this.setFocusable(false);
refreshLayout();
}
public boolean isSeriesVisible(MediaSeriesGroup series) {
for (Component c : this.getComponents()) {
if (c instanceof SeriesPane) {
if (((SeriesPane) c).isSeries(series)) {
return true;
}
}
}
return false;
}
private List<SeriesPane> getSeriesPaneList() {
ArrayList<SeriesPane> seriesPaneList = new ArrayList<SeriesPane>();
for (Component c : this.getComponents()) {
if (c instanceof SeriesPane) {
seriesPaneList.add((SeriesPane) c);
}
}
return seriesPaneList;
}
private void refreshLayout() {
boolean vertical = ToolWindowAnchor.RIGHT.equals(getAnchor()) || ToolWindowAnchor.LEFT.equals(getAnchor());
this.setLayout(vertical ? new WrapLayout(FlowLayout.LEFT) : new BoxLayout(this, BoxLayout.X_AXIS));
}
private void showAllSeries() {
super.removeAll();
List<SeriesPane> seriesList = study2series.get(dicomStudy);
if (seriesList != null) {
int thumbnailSize = slider.getValue();
for (int i = 0; i < seriesList.size(); i++) {
SeriesPane series = seriesList.get(i);
series.updateSize(thumbnailSize);
addPane(series, i);
}
this.revalidate();
}
}
public void addPane(SeriesPane seriesPane, int index) {
seriesPane.updateSize(slider.getValue());
add(seriesPane, index);
updateText();
}
public void updateText() {
title.setTitle(dicomStudy.toString());
}
public boolean isStudy(MediaSeriesGroup dicomStudy) {
return this.dicomStudy.equals(dicomStudy);
}
}
class SeriesPane extends JPanel {
private final MediaSeriesGroup sequence;
private final JLabel label;
private final boolean selected;
public SeriesPane(MediaSeriesGroup sequence) {
if (sequence == null) {
throw new IllegalArgumentException("Series cannot be null"); //$NON-NLS-1$
}
this.sequence = sequence;
this.selected = false;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
int thumbnailSize = slider.getValue();
if (sequence instanceof Series) {
Series series = (Series) sequence;
Thumbnail thumb = (Thumbnail) series.getTagValue(TagElement.Thumbnail);
if (thumb == null) {
thumb = createThumbnail(series, model, thumbnailSize);
series.setTag(TagElement.Thumbnail, thumb);
}
this.add(thumb);
}
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
String desc = (String) sequence.getTagValue(TagElement.SeriesDescription);
label = new JLabel(desc == null ? "" : desc, SwingConstants.CENTER); //$NON-NLS-1$
label.setFont(FontTools.getFont10());
label.setFocusable(false);
this.setFocusable(false);
updateSize(thumbnailSize);
this.add(label);
}
public void updateSize(int thumbnailSize) {
Dimension max = label.getMaximumSize();
if (max == null || max.width != thumbnailSize) {
if (sequence instanceof Series) {
Series series = (Series) sequence;
Thumbnail thumb = (Thumbnail) series.getTagValue(TagElement.Thumbnail);
if (thumb != null) {
thumb.setThumbnailSize(thumbnailSize);
}
}
FontRenderContext frc = new FontRenderContext(null, false, false);
Dimension dim =
new Dimension(thumbnailSize, (int) (label.getFont().getStringBounds("0", frc).getHeight() + 1.0f)); //$NON-NLS-1$
label.setPreferredSize(dim);
label.setMaximumSize(dim);
}
}
public void updateText() {
String desc = (String) sequence.getTagValue(TagElement.SeriesDescription);
label.setText(desc == null ? "" : desc); //$NON-NLS-1$
}
public boolean isSeries(MediaSeriesGroup sequence) {
return this.sequence.equals(sequence);
}
public MediaSeriesGroup getSequence() {
return sequence;
}
}
/**
* @return
*/
protected JPanel getPanel() {
if (panel_1 == null) {
panel_1 = new JPanel();
panel = new JPanel();
final GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.rowHeights = new int[] { 0, 0, 7 };
panel.setLayout(gridBagLayout);
panel.setBorder(new EmptyBorder(5, 5, 5, 5));
final JLabel label = new JLabel(PATIENT_ICON);
final GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.insets = new Insets(0, 0, 5, 5);
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
panel.add(label, gridBagConstraints);
final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
gridBagConstraints_1.insets = new Insets(0, 2, 5, 0);
gridBagConstraints_1.anchor = GridBagConstraints.WEST;
gridBagConstraints_1.weightx = 1.0;
gridBagConstraints_1.gridy = 0;
gridBagConstraints_1.gridx = 1;
panel.add(patientCombobox, gridBagConstraints_1);
patientCombobox.setMaximumRowCount(15);
patientCombobox.setFont(FontTools.getFont11());
patientCombobox.setRenderer(new ComboBoxCellRenderer());
JMVUtils.setPreferredWidth(patientCombobox, 145, 145);
patientCombobox.addItemListener(patientChangeListener);
final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
gridBagConstraints_3.anchor = GridBagConstraints.WEST;
gridBagConstraints_3.insets = new Insets(2, 2, 5, 0);
gridBagConstraints_3.gridx = 1;
gridBagConstraints_3.gridy = 1;
panel.add(studyCombobox, gridBagConstraints_3);
studyCombobox.setMaximumRowCount(15);
studyCombobox.setFont(FontTools.getFont11());
studyCombobox.setRenderer(new ComboBoxCellRenderer());
JMVUtils.setPreferredWidth(studyCombobox, 145, 145);
// do not use addElement
modelStudy.insertElementAt(ALL_STUDIES, 0);
modelStudy.setSelectedItem(ALL_STUDIES);
studyCombobox.addItemListener(studyItemListener);
panel_1.setLayout(new BorderLayout());
panel_1.add(panel, BorderLayout.NORTH);
GridBagConstraints gbc_btnMoreOptions = new GridBagConstraints();
gbc_btnMoreOptions.anchor = GridBagConstraints.EAST;
gbc_btnMoreOptions.gridx = 1;
gbc_btnMoreOptions.gridy = 2;
btnMoreOptions.setFont(FontTools.getFont10());
btnMoreOptions.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (btnMoreOptions.isSelected()) {
panel_1.add(panel_2, BorderLayout.SOUTH);
} else {
panel_1.remove(panel_2);
}
panel_1.revalidate();
panel_1.repaint();
}
});
panel.add(btnMoreOptions, gbc_btnMoreOptions);
// panel_1.add(panel_2, BorderLayout.SOUTH);
GridBagLayout gbl_panel_2 = new GridBagLayout();
panel_2.setLayout(gbl_panel_2);
GridBagConstraints gbc_panel_3 = new GridBagConstraints();
gbc_panel_3.weightx = 1.0;
gbc_panel_3.anchor = GridBagConstraints.NORTHWEST;
gbc_panel_3.gridx = 0;
gbc_panel_3.gridy = 0;
FlowLayout flowLayout = (FlowLayout) panel_3.getLayout();
flowLayout.setHgap(10);
flowLayout.setAlignment(FlowLayout.LEFT);
panel_2.add(panel_3, gbc_panel_3);
btnImport.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DicomImport dialog = new DicomImport(model);
JMVUtils.showCenterScreen(dialog);
}
});
panel_3.add(btnImport);
btnExport.setEnabled(false);
panel_3.add(btnExport);
final JPanel palenSlider1 = new JPanel();
palenSlider1.setLayout(new BoxLayout(palenSlider1, BoxLayout.Y_AXIS));
palenSlider1.setBorder(new TitledBorder(Messages.getString("DicomExplorer.thmb_size") + slider.getValue())); //$NON-NLS-1$
slider.setPaintTicks(true);
slider.setSnapToTicks(true);
slider.setMajorTickSpacing(16);
slider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider) e.getSource();
if (!source.getValueIsAdjusting()) {
((TitledBorder) palenSlider1.getBorder()).setTitle(Messages
.getString("DicomExplorer.thmb_size") + source.getValue()); //$NON-NLS-1$
palenSlider1.repaint();
updateThumbnailSize();
}
}
});
JMVUtils.setPreferredWidth(slider, 145, 145);
palenSlider1.add(slider);
GridBagConstraints gbc_palenSlider1 = new GridBagConstraints();
gbc_palenSlider1.insets = new Insets(0, 5, 5, 5);
gbc_palenSlider1.anchor = GridBagConstraints.NORTHWEST;
gbc_palenSlider1.gridx = 0;
gbc_palenSlider1.gridy = 1;
panel_2.add(palenSlider1, gbc_palenSlider1);
}
return panel_1;
}
public boolean isPatientHasOpenSeries(MediaSeriesGroup p) {
Collection<MediaSeriesGroup> studies = model.getChildren(p);
synchronized (studies) {
for (Iterator<MediaSeriesGroup> iterator = studies.iterator(); iterator.hasNext();) {
MediaSeriesGroup study = iterator.next();
Collection<MediaSeriesGroup> seriesList = model.getChildren(study);
synchronized (seriesList) {
for (Iterator<MediaSeriesGroup> it = seriesList.iterator(); it.hasNext();) {
MediaSeriesGroup seq = it.next();
if (seq instanceof Series) {
Boolean open = (Boolean) ((Series) seq).getTagValue(TagElement.SeriesOpen);
return open == null ? false : open;
}
}
}
}
}
return false;
}
static class ComboBoxCellRenderer extends JLabel implements ListCellRenderer, UIResource {
private final Border cBorder = new EmptyBorder(1, 3, 1, 3);
public ComboBoxCellRenderer() {
setOpaque(true);
setHorizontalAlignment(LEFT);
setVerticalAlignment(CENTER);
setBorder(cBorder);
// set default combobox ui render
setName("ComboBox.renderer"); //$NON-NLS-1$
setText(" "); //$NON-NLS-1$
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
// set default list ui render
setName("ComboBox.listRenderer"); //$NON-NLS-1$
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
setFont(list.getFont());
if (value != null) {
String str = value.toString();
setText(str);
setToolTipText(str);
} else {
setText(""); //$NON-NLS-1$
}
// The renderer component should inherit the enabled and
// orientation state of its parent combobox. This is
// especially needed for GTK comboboxes, where the
// ListCellRenderer's state determines the visual state
// of the combobox.
// if (comboBox != null) {
// setEnabled(comboBox.isEnabled());
// setComponentOrientation(comboBox.getComponentOrientation());
// }
return this;
}
}
public void selectPatient(MediaSeriesGroup patient) {
if (selectedPatient == null || patient != selectedPatient.patient) {
selectionList.clear();
studyCombobox.removeItemListener(studyItemListener);
modelStudy.removeAllElements();
// do not use addElement
modelStudy.insertElementAt(ALL_STUDIES, 0);
modelStudy.setSelectedItem(ALL_STUDIES);
patientContainer.removeAll();
if (patient == null) {
selectedPatient = null;
patientContainer.showAllPatients();
} else {
selectedPatient = createPatientPane(patient);
selectedPatient.showTitle(false);
List<StudyPane> studies = patient2study.get(patient);
if (studies != null) {
for (StudyPane studyPane : studies) {
modelStudy.addElement(studyPane.dicomStudy);
}
}
studyCombobox.addItemListener(studyItemListener);
selectStudy();
patientContainer.addPane(selectedPatient);
// Send message for selecting related plug-ins window
model.firePropertyChange(new ObservableEvent(ObservableEvent.BasicAction.Select, model, null, patient));
}
}
}
private List<DicomSeries> getSplitSeries(DicomSeries series) {
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
Object splitNb = series.getTagValue(TagElement.SplitSeriesNumber);
List<DicomSeries> list = new ArrayList<DicomSeries>();
if (splitNb == null || study == null) {
list.add(series);
return list;
}
String uid = (String) series.getTagValue(TagElement.SeriesInstanceUID);
if (uid != null) {
Collection<MediaSeriesGroup> seriesList = model.getChildren(study);
for (Iterator<MediaSeriesGroup> it = seriesList.iterator(); it.hasNext();) {
MediaSeriesGroup group = it.next();
if (group instanceof DicomSeries) {
DicomSeries s = (DicomSeries) group;
if (uid.equals(s.getTagValue(TagElement.SeriesInstanceUID))) {
list.add(s);
}
}
}
}
return list;
}
private void updateSplitSeries(DicomSeries series) {
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
StudyPane studyPane = createStudyPaneInstance(study, null);
List<DicomSeries> list = getSplitSeries(series);
List<SeriesPane> seriesList = study2series.get(study);
if (seriesList == null) {
seriesList = new ArrayList<SeriesPane>();
study2series.put(study, seriesList);
}
boolean addSeries = patientContainer.isStudyVisible(study);
boolean repaintStudy = false;
for (DicomSeries dicomSeries : list) {
int[] positionSeries = new int[1];
createSeriesPaneInstance(dicomSeries, positionSeries);
if (addSeries && positionSeries[0] != -1) {
repaintStudy = true;
}
Thumbnail thumb = (Thumbnail) dicomSeries.getTagValue(TagElement.Thumbnail);
if (thumb != null) {
thumb.reBuildThumbnail();
}
}
if (repaintStudy) {
studyPane.removeAll();
Comparator<SeriesPane> comp = new Comparator<SeriesPane>() {
@Override
public int compare(SeriesPane s1, SeriesPane s2) {
int val1 = getIntValue((Integer) s1.getSequence().getTagValue(TagElement.SeriesNumber));
int val2 = getIntValue((Integer) s2.getSequence().getTagValue(TagElement.SeriesNumber));
if (val1 == val2) {
if (val1 == 0) {
return 1;
} else {
int split1 =
getIntValue((Integer) s1.getSequence().getTagValue(TagElement.SplitSeriesNumber));
int split2 =
getIntValue((Integer) s2.getSequence().getTagValue(TagElement.SplitSeriesNumber));
return (split1 < split2 ? -1 : (split1 == split2 ? 0 : 1));
}
}
return (val1 < val2 ? -1 : 1);
}
};
Collections.sort(seriesList, comp);
for (int i = 0; i < seriesList.size(); i++) {
studyPane.addPane(seriesList.get(i), i);
}
studyPane.revalidate();
studyPane.repaint();
}
}
private void selectStudy() {
Object item = modelStudy.getSelectedItem();
if (item instanceof MediaSeriesGroupNode) {
MediaSeriesGroupNode selectedStudy = (MediaSeriesGroupNode) item;
selectStudy(selectedStudy);
} else {
selectStudy(null);
}
}
public void selectStudy(MediaSeriesGroup selectedStudy) {
if (selectedPatient != null) {
selectionList.clear();
selectedPatient.removeAll();
if (selectedStudy == null) {
selectedPatient.showAllstudies();
} else {
StudyPane studyPane = getStudyPane(selectedStudy);
if (studyPane != null) {
studyPane.showAllSeries();
studyPane.refreshLayout();
selectedPatient.addPane(studyPane);
}
}
selectedPatient.revalidate();
selectedPatient.repaint();
}
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
private void addSpecialModalityToStudy(Series series) {
DicomSpecialElement dicomObject = (DicomSpecialElement) series.getTagValue(TagElement.DicomSpecialElement);
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
List list = (List) study.getTagValue(TagElement.DicomSpecialElementList);
if (list == null) {
list = new ArrayList();
study.setTag(TagElement.DicomSpecialElementList, list);
}
list.add(dicomObject);
}
private void addDicomSeries(Series series) {
if (DicomModel.isSpecialModality(series)) {
addSpecialModalityToStudy(series);
return;
}
LOGGER.info("Add series: {}", series); //$NON-NLS-1$
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
MediaSeriesGroup patient = model.getParent(series, DicomModel.patient);
PatientPane patientPane = createPatientPane(patient);
if (modelPatient.getIndexOf(patient) < 0) {
modelPatient.addElement(patient);
if (modelPatient.getSize() == 1) {
selectedPatient = patientPane;
patientContainer.addPane(selectedPatient);
patientCombobox.removeItemListener(patientChangeListener);
patientCombobox.setSelectedItem(patient);
patientCombobox.addItemListener(patientChangeListener);
}
// Mode all patients
else if (selectedPatient == null) {
patientContainer.addPane(patientPane);
}
}
boolean addSeries = selectedPatient == patientPane;
List<StudyPane> studies = patient2study.get(patient);
if (studies == null) {
studies = new ArrayList<StudyPane>();
patient2study.put(patient, studies);
}
Object selectedStudy = modelStudy.getSelectedItem();
int[] positionStudy = new int[1];
StudyPane studyPane = createStudyPaneInstance(study, positionStudy);
List<SeriesPane> seriesList = study2series.get(study);
if (seriesList == null) {
seriesList = new ArrayList<SeriesPane>();
study2series.put(study, seriesList);
}
int[] positionSeries = new int[1];
createSeriesPaneInstance(series, positionSeries);
if (addSeries && positionSeries[0] != -1) {
// If new study
if (positionStudy[0] != -1) {
if (modelStudy.getIndexOf(study) < 0) {
modelStudy.addElement(study);
}
// if modelStudy has the value "All studies"
if (ALL_STUDIES.equals(selectedStudy)) {
patientPane.removeAll();
for (StudyPane s : studies) {
patientPane.addPane(s);
}
patientPane.revalidate();
}
}
if (patientPane.isStudyVisible(study)) {
studyPane.removeAll();
for (int i = 0; i < seriesList.size(); i++) {
studyPane.addPane(seriesList.get(i), i);
}
studyPane.revalidate();
studyPane.repaint();
}
}
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
// Get only event from the model of DicomExplorer
if (evt instanceof ObservableEvent) {
ObservableEvent event = (ObservableEvent) evt;
ObservableEvent.BasicAction action = event.getActionCommand();
Object newVal = event.getNewValue();
if (model.equals(evt.getSource())) {
if (ObservableEvent.BasicAction.Select.equals(action)) {
if (newVal instanceof Series) {
Series dcm = (Series) newVal;
MediaSeriesGroup patient = model.getParent(dcm, DicomModel.patient);
if (!isSelectedPatient(patient)) {
modelPatient.setSelectedItem(patient);
}
}
} else if (ObservableEvent.BasicAction.Add.equals(action)) {
if (newVal instanceof Series) {
addDicomSeries((Series) newVal);
}
} else if (ObservableEvent.BasicAction.Remove.equals(action)) {
if (newVal instanceof MediaSeriesGroup) {
MediaSeriesGroup group = (MediaSeriesGroup) newVal;
// Patient Group
if (TagElement.PatientPseudoUID.equals(group.getTagID())) {
removePatientPane(group);
}
// Study Group
else if (TagElement.StudyInstanceUID.equals(group.getTagID())) {
removeStudy(group);
}
// Series Group
else if (TagElement.SubseriesInstanceUID.equals(group.getTagID())) {
removeSeries(group);
}
}
}
// Update patient and study infos from the series (when receiving the first downloaded image)
else if (ObservableEvent.BasicAction.UpdateParent.equals(action)) {
if (newVal instanceof Series) {
Series dcm = (Series) newVal;
MediaSeriesGroup patient = model.getParent(dcm, DicomModel.patient);
if (isSelectedPatient(patient)) {
MediaSeriesGroup study = model.getParent(dcm, DicomModel.study);
StudyPane studyPane = getStudyPane(study);
if (studyPane != null) {
if (!DicomModel.isSpecialModality(dcm)) {
SeriesPane pane = getSeriesPane(dcm);
if (pane != null) {
pane.updateText();
}
}
studyPane.updateText();
}
}
}
}
// update
else if (ObservableEvent.BasicAction.Update.equals(action)) {
if (newVal instanceof DicomSeries) {
DicomSeries dcm = (DicomSeries) newVal;
if (DicomModel.isSpecialModality(dcm)) {
addSpecialModalityToStudy(dcm);
} else {
Integer splitNb = (Integer) dcm.getTagValue(TagElement.SplitSeriesNumber);
if (splitNb != null) {
updateSplitSeries(dcm);
}
}
}
}
} else if (evt.getSource() instanceof ViewerPlugin) {
if (ObservableEvent.BasicAction.Select.equals(action)) {
if (newVal instanceof Series) {
Series dcm = (Series) newVal;
MediaSeriesGroup patient = model.getParent(dcm, DicomModel.patient);
if (!isSelectedPatient(patient)) {
modelPatient.setSelectedItem(patient);
// focus get back to viewer
((ViewerPlugin) evt.getSource()).requestFocusInWindow();
}
}
}
}
}
}
@Override
public String getDescription() {
return DESCRIPTION;
}
@Override
public Icon getIcon() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getUIName() {
return NAME;
}
@Override
public String toString() {
return NAME;
}
@Override
public DataExplorerModel getDataExplorerModel() {
return model;
}
@Override
protected void changeToolWindowAnchor(ToolWindowAnchor anchor) {
removeAll();
boolean vertical = ToolWindowAnchor.RIGHT.equals(anchor) || ToolWindowAnchor.LEFT.equals(anchor);
add(getPanel(), vertical ? BorderLayout.NORTH : BorderLayout.WEST);
patientContainer.refreshLayout();
ToolWindow win = getToolWindow();
if (win != null) {
DockedTypeDescriptor dockedTypeDescriptor =
(DockedTypeDescriptor) win.getTypeDescriptor(ToolWindowType.DOCKED);
int width = this.getDockableWidth();
if (width > 0) {
dockedTypeDescriptor.setDockLength(vertical ? width : width + 15);
}
}
add(thumnailView, BorderLayout.CENTER);
}
public static Thumbnail createThumbnail(final Series series, final DicomModel dicomModel, int thumbnailSize) {
final Thumbnail thumb = new Thumbnail(series, thumbnailSize);
thumb.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
DataExplorerView explorer = UIManager.getExplorerplugin(DicomExplorer.NAME);
if (explorer instanceof DicomExplorer) {
((DicomExplorer) explorer).getSelectionList().clear();
}
LoadSeries.openSequenceInDefaultPlugin(new Series[] { series }, dicomModel);
}
}
@Override
public void mousePressed(MouseEvent mouseevent) {
Component c = mouseevent.getComponent();
if (!c.isFocusOwner()) {
thumb.requestFocusInWindow();
}
DataExplorerView explorer = UIManager.getExplorerplugin(DicomExplorer.NAME);
final SeriesSelectionModel selList =
explorer instanceof DicomExplorer ? ((DicomExplorer) explorer).getSelectionList()
: new SeriesSelectionModel(1);
if (SwingUtilities.isRightMouseButton(mouseevent)) {
JPopupMenu popupMenu = new JPopupMenu();
List<SeriesViewerFactory> plugins =
UIManager.getViewerFactoryList(new String[] { series.getMimeType() });
if (!selList.contains(series)) {
selList.add(series);
}
for (final SeriesViewerFactory viewerFactory : plugins) {
final JMenuItem item4 =
new JMenuItem(
Messages.getString("DicomExplorer.open_series") + viewerFactory.getUIName(), viewerFactory.getIcon()); //$NON-NLS-1$
item4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final Series[] seriesList =
selList.size() == 0 ? new Series[] { series } : selList.toArray(new Series[selList
.size()]);
selList.clear();
LoadSeries.openSequenceInPlugin(viewerFactory, seriesList, dicomModel);
}
});
popupMenu.add(item4);
}
popupMenu.add(new JSeparator());
JMenuItem item2 = new JMenuItem(Messages.getString("DicomExplorer.sel_rel_series")); //$NON-NLS-1$
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String fruid = (String) series.getTagValue(TagElement.FrameOfReferenceUID);
if (fruid != null) {
selList.clear();
MediaSeriesGroup studyGroup = dicomModel.getParent(series, DicomModel.study);
Collection<MediaSeriesGroup> seriesList = dicomModel.getChildren(studyGroup);
synchronized (seriesList) {
for (Iterator<MediaSeriesGroup> it = seriesList.iterator(); it.hasNext();) {
MediaSeriesGroup seq = it.next();
if (seq instanceof Series) {
Series s = (Series) seq;
if (fruid.equals(s.getTagValue(TagElement.FrameOfReferenceUID))) {
selList.add(s);
}
}
}
}
}
}
});
popupMenu.add(item2);
item2 = new JMenuItem(Messages.getString("DicomExplorer.sel_rel_series_axis")); //$NON-NLS-1$
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String fruid = (String) series.getTagValue(TagElement.FrameOfReferenceUID);
if (fruid != null) {
selList.clear();
MediaSeriesGroup studyGroup = dicomModel.getParent(series, DicomModel.study);
Collection<MediaSeriesGroup> seriesList = dicomModel.getChildren(studyGroup);
synchronized (seriesList) {
for (Iterator<MediaSeriesGroup> it = seriesList.iterator(); it.hasNext();) {
MediaSeriesGroup seq = it.next();
if (seq instanceof Series) {
Series s = (Series) seq;
if (fruid.equals(s.getTagValue(TagElement.FrameOfReferenceUID))) {
if (ImageOrientation.hasSameOrientation(series, s)) {
selList.add(s);
}
}
}
}
}
}
}
});
popupMenu.add(item2);
Object splitNb = series.getTagValue(TagElement.SplitSeriesNumber);
if (splitNb != null && selList.size() > 1) {
String uid = (String) series.getTagValue(TagElement.SeriesInstanceUID);
boolean sameOrigin = true;
if (uid != null) {
for (Series s : selList) {
if (!uid.equals(s.getTagValue(TagElement.SeriesInstanceUID))) {
sameOrigin = false;
break;
}
}
}
if (sameOrigin) {
final Series[] seriesList = selList.toArray(new Series[selList.size()]);
popupMenu.add(new JSeparator());
item2 = new JMenuItem("Merge Selected Series");
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selList.clear();
dicomModel.mergeSeries(seriesList);
}
});
popupMenu.add(item2);
}
}
popupMenu.add(new JSeparator());
item2 = new JMenuItem(Messages.getString("DicomExplorer.rem_series")); //$NON-NLS-1$
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dicomModel.removeSeries(series);
}
});
popupMenu.add(item2);
item2 = new JMenuItem(Messages.getString("DicomExplorer.rem_study")); //$NON-NLS-1$
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MediaSeriesGroup studyGroup = dicomModel.getParent(series, DicomModel.study);
dicomModel.removeStudy(studyGroup);
}
});
popupMenu.add(item2);
item2 = new JMenuItem(Messages.getString("DicomExplorer.rem_pat")); //$NON-NLS-1$
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MediaSeriesGroup patientGroup =
dicomModel
.getParent(dicomModel.getParent(series, DicomModel.study), DicomModel.patient);
dicomModel.removePatient(patientGroup);
}
});
popupMenu.add(item2);
popupMenu.show(mouseevent.getComponent(), mouseevent.getX() - 5, mouseevent.getY() - 5);
} else {
if (selList.contains(series)) {
if (mouseevent.isControlDown()) {
selList.remove(series);
} else {
selList.clear();
selList.add(series);
}
} else {
if (mouseevent.isControlDown()) {
selList.add(series);
} else if (mouseevent.isShiftDown()) {
if (explorer instanceof DicomExplorer) {
ArrayList<Series> seriesList = new ArrayList<Series>();
DicomExplorer exp = (DicomExplorer) explorer;
for (PatientPane p : exp.patientContainer.getPatientPaneList()) {
for (StudyPane studyPane : p.getStudyPaneList()) {
for (SeriesPane series : studyPane.getSeriesPaneList()) {
if (series.getSequence() instanceof Series) {
seriesList.add((Series) series.getSequence());
}
}
}
}
int lastIndex = seriesList.indexOf(selList.get(selList.size() - 1));
int newIndex = seriesList.indexOf(series);
if (lastIndex >= 0 && newIndex >= 0) {
if (lastIndex > newIndex) {
int temp = lastIndex;
lastIndex = newIndex;
newIndex = temp;
}
for (int i = lastIndex; i <= newIndex; i++) {
selList.add(seriesList.get(i));
}
} else {
selList.add(series);
}
} else {
selList.add(series);
}
} else {
selList.clear();
selList.add(series);
}
}
}
}
});
thumb.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
DataExplorerView explorer = UIManager.getExplorerplugin(DicomExplorer.NAME);
final SeriesSelectionModel selList =
explorer instanceof DicomExplorer ? ((DicomExplorer) explorer).getSelectionList()
: new SeriesSelectionModel(1);
if (selList.size() == 0) {
selList.add(series);
}
LoadSeries.openSequenceInDefaultPlugin(selList.toArray(new Series[selList.size()]), dicomModel);
}
}
});
thumb.registerListeners();
return thumb;
}
@Override
public Action getOpenExportDialogAction() {
// TODO preference to allow dicom export
// return exportAction;
return null;
}
@Override
public Action getOpenImportDialogAction() {
return importAction;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
cea3b148d4efc694e8925fe96b9c4a67b23e294f | 1614f34366db09f20499a70203e8665a4eff029a | /ztlibrary/src/main/java/com/jibinghao/ztlibrary/entity/YearBean.java | 15973eedbbd813c5ef9a1a93b0ac04804a9584ab | [] | no_license | Jibinghao/TimeSelector | cf9ecebeed5e1491c8b245358ed045e5857f8d1e | d0ae64c235e750bfae575066fbea8c691f11a147 | refs/heads/master | 2020-05-22T11:32:46.213992 | 2019-06-28T07:08:32 | 2019-06-28T07:08:32 | 186,325,263 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.jibinghao.ztlibrary.entity;
/**
* FileName: YearBean
* Author: jibinghao
* Date: 2019/5/13 10:22 AM
* Email:heybinghao@gmail.com
* Description:
*/
public class YearBean {
public YearBean(String year) {
this.year = year;
}
String year;
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
}
| [
"769499597@qq.com"
] | 769499597@qq.com |
5b39e876a2bc164053752bfb775ccd6db720d4ea | 7988d4a7eafc312ae2f1d9d61b66a810bf118a90 | /ifoster/src/main/java/com/sarahhanley/ifoster/models/PetType.java | 921bb582f0736c1654dbd8f55f894bb2ccea76e3 | [] | no_license | numbat77/lc101 | a875293af96d152a259db109fdb1a2695dc20493 | d7a4b1b9368408e25e08bd6ec3d4b89bdbcb4bcc | refs/heads/master | 2021-05-16T17:35:15.365905 | 2018-02-21T23:52:25 | 2018-02-21T23:52:25 | 103,007,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package com.sarahhanley.ifoster.models;
public enum PetType {
CAT, DOG, OTHER;
}
| [
"sarah.hanley@outlook.com"
] | sarah.hanley@outlook.com |
5c40694ddfbdb24a0a627330bb5f150593293b2d | 5a797cc6bdb1b1e0f62ec50e7c3425a7fe21c278 | /xop-starter/xop-starter-exception/src/main/java/com/mqoo/xop/starter/exception/filter/ExceptionHandlerFilter.java | 3ae30f19ea792816f3044743b2dc480ef2f39fd5 | [] | no_license | wmq85/xop | 919c1074468166a61f9aed7c8780200a7c7429ba | d19c37114159fe90692d09e0586d0512d14b74bd | refs/heads/master | 2021-05-16T17:27:22.340729 | 2017-09-01T03:07:31 | 2017-09-01T03:07:31 | 100,459,072 | 1 | 1 | null | 2017-09-01T03:07:32 | 2017-08-16T07:08:13 | Java | UTF-8 | Java | false | false | 1,415 | java | package com.mqoo.xop.starter.exception.filter;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.servlet.HandlerExceptionResolver;
/**
* 异常处理Filter
* <p>
* 在Filter、Interceptor中抛出的异常无法被HandlerExceptionResolver拦截处理,在此处处理
*
* @see org.springframework.web.servlet.HandlerExceptionResolver#resolveException
* @author mingqi.wang
*/
@Deprecated
public class ExceptionHandlerFilter extends OncePerRequestFilter {
HandlerExceptionResolver handlerExceptionResolver;
public ExceptionHandlerFilter(HandlerExceptionResolver handlerExceptionResolver) {
this.handlerExceptionResolver = handlerExceptionResolver;
}
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
try {
filterChain.doFilter(request, response);
} catch (Exception e) {
logger.debug("exceptionHandlerFilter handler exception", e);
handlerExceptionResolver.resolveException(request, response, null, e);
}
}
}
| [
"echow@echowPC"
] | echow@echowPC |
6301a11fe2481e6164005917d36181929ff99f07 | 96726e8528eaf3d93d58fb3f0267de8dba7799f9 | /src/argouml-app/src/org/argouml/ui/ActionExportXMI.java | a52ad02a0eaf65458fe811e406fc9c8253ab05b2 | [
"BSD-3-Clause",
"LicenseRef-scancode-other-permissive"
] | permissive | marcusvnac/argouml-spl | c84d556a98e1a04f01fba3a921db6cb62e519085 | bcae37308b13b7ee62da0867a77d21a0141a0f18 | refs/heads/master | 2021-01-12T20:55:55.500881 | 2015-06-11T19:41:28 | 2015-06-11T19:41:28 | 37,139,993 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,112 | java | // $Id: ActionExportXMI.java 41 2010-04-03 20:04:12Z marcusvnac $
// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
// and this paragraph appear in all copies. This software program and
// documentation are copyrighted by The Regents of the University of
// California. The software program and documentation are supplied "AS
// IS", without any accompanying services from The Regents. The Regents
// does not warrant that the operation of the program will be
// uninterrupted or error-free. The end-user understands that the program
// was developed for research purposes and is advised not to rely
// exclusively on the program for any reason. IN NO EVENT SHALL THE
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
package org.argouml.ui;
import java.awt.event.ActionEvent;
import java.io.File;
import javax.swing.AbstractAction;
import javax.swing.JFileChooser;
import org.argouml.configuration.Configuration;
import org.argouml.i18n.Translator;
import org.argouml.persistence.PersistenceManager;
import org.argouml.persistence.ProjectFileView;
import org.argouml.util.ArgoFrame;
/**
* Exports the xmi of a project to a file choosen by the user.
* @author jaap.branderhorst@xs4all.nl
* Jun 7, 2003
*/
public final class ActionExportXMI extends AbstractAction {
/**
* The constructor.
*/
public ActionExportXMI() {
super(Translator.localize("action.export-project-as-xmi"));
}
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
PersistenceManager pm = PersistenceManager.getInstance();
// show a chooser dialog for the file name, only xmi is allowed
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Translator.localize(
"action.export-project-as-xmi"));
chooser.setFileView(ProjectFileView.getInstance());
chooser.setApproveButtonText(Translator.localize(
"filechooser.export"));
chooser.setAcceptAllFileFilterUsed(true);
pm.setXmiFileChooserFilter(chooser);
String fn =
Configuration.getString(
PersistenceManager.KEY_PROJECT_NAME_PATH);
if (fn.length() > 0) {
fn = PersistenceManager.getInstance().getBaseName(fn);
chooser.setSelectedFile(new File(fn));
}
int result = chooser.showSaveDialog(ArgoFrame.getInstance());
if (result == JFileChooser.APPROVE_OPTION) {
File theFile = chooser.getSelectedFile();
if (theFile != null) {
String name = theFile.getName();
Configuration.setString(
PersistenceManager.KEY_PROJECT_NAME_PATH,
PersistenceManager.getInstance().getBaseName(
theFile.getPath()));
name = pm.fixXmiExtension(name);
theFile = new File(theFile.getParent(), name);
ProjectBrowser.getInstance().trySaveWithProgressMonitor(
false, theFile);
}
}
}
/**
* The UID.
*/
private static final long serialVersionUID = -3445739054369264482L;
}
| [
"mtov@dcc.ufmg.br"
] | mtov@dcc.ufmg.br |
427247eba605cb376c8253ef1180f51ccd39921e | 7d5f191c45bf696a803f6de3d402694e57f2b0b6 | /WebSpring01/src/main/java/com/bitcamp/webDbcp/HomeController.java | 36e58f35015409434fbbb4b427911474971553bf | [] | no_license | shinecoding/workspaceSpring | 6bbe60f138223e04cfea14866c66c57f6356b90d | 922ccbf41cb736714e153934abdb430f48b2476d | refs/heads/main | 2023-02-02T22:13:55.680606 | 2020-12-20T03:43:03 | 2020-12-20T03:43:03 | 322,988,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.bitcamp.webDbcp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HomeController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home() {
return "home";
}
}
| [
"choiyoungeun@gmail.com"
] | choiyoungeun@gmail.com |
05139e6bdb29c53161d933d80d17c52dfcf6757a | 8190f76ec7d333a66d95a709324be3995c87ccad | /src/test/java/com/samuelbwr/interpreters/CommandInterpreterTest.java | 6827eca4eeeb5a7255e0914eb6c12d08e93115a6 | [] | no_license | samuelbwr/cities-query | 45a9d406fdfc61173d4bbcbe2a6ef7edb75e5b59 | 97177505b9eed20a0745ba01c0c5ff92e5069fbf | refs/heads/master | 2021-07-24T19:15:19.838451 | 2017-11-04T17:56:40 | 2017-11-04T17:56:40 | 104,406,754 | 0 | 1 | null | 2017-11-04T17:54:01 | 2017-09-21T22:58:48 | Java | UTF-8 | Java | false | false | 1,243 | java | package com.samuelbwr.interpreters;
import com.samuelbwr.statements.CountAll;
import com.samuelbwr.statements.CountDistinct;
import com.samuelbwr.statements.FilterByProperty;
import com.samuelbwr.statements.Statement;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
public class CommandInterpreterTest {
@Test
public void ensureCanInterpretCountAll(){
Statement statement = new CommandInterpreter().interpret( "count *" );
Assert.assertThat( statement, CoreMatchers.instanceOf( CountAll.class ) );
}
@Test
public void ensureCanInterpretCountDistinct(){
Statement statement = new CommandInterpreter().interpret( "count distinct uf" );
Assert.assertThat( statement, CoreMatchers.instanceOf( CountDistinct.class ) );
}
@Test
public void ensureCanInterpretFilterByProperty(){
Statement statement = new CommandInterpreter().interpret( "filter uf value" );
Assert.assertThat( statement, CoreMatchers.instanceOf( FilterByProperty.class ) );
}
@Test(expected = CommandNotImplementedException.class)
public void ensureCantInterpretInvalidCommand(){
new CommandInterpreter().interpret( "add uf value" );
}
}
| [
"samuelbwr@gmail.com"
] | samuelbwr@gmail.com |
0c669e8594321983b4a705a887441540a540cf27 | 5cb49f17dadca1fc1bc11eaede848404c0cdf320 | /ota-common/src/main/java/com/battery/common/mapper/BaseMapper.java | 6905e14640480d95099f636772f5a2975b5ecb67 | [] | no_license | leonchen09/sbplatform | ee5320808bf2395e844205e39cdd11dff89439d5 | 590cd84e3d06522d66a0d93fc0d7124abd577574 | refs/heads/master | 2020-04-17T07:36:39.919406 | 2019-03-22T06:38:49 | 2019-03-22T06:38:49 | 166,377,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.battery.common.mapper;
import java.util.List;
import com.battery.common.vo.search.PageEntity;
public interface BaseMapper<T, TID> {
/**
* 根据对象新增
*/
int insert(T record);
/**
* 根据对象新增不为null的属性
*/
int insertSelective(T record);
/**
* 根据pk查找对象
*/
T selectByPrimaryKey(TID pk);
/**
* 根据pk更新对象不为null的属性
*/
int updateByPrimaryKeySelective(T record);
/**
* 根据pk更新所有属性
*/
int updateByPrimaryKey(T record);
/**
* 根据不为null的属性删除对象
*/
int deleteSelective(T record);
/**
* 根据主键删除
*/
int deleteByPrimaryKey(TID pk);
/**
* 根据主键数组删除
* @param pks
* @return
*/
int deleteByPKs(TID[] pks);
/**
* 根据对象不为null的属性获取对象集合
*/
List<T> selectListSelective(T record);
/**
* 根据对象不为null的属性获取分页对象集合
*/
List<T> selectListSelectivePaging(PageEntity pageEntity);
}
| [
"aliag00@sohu.com"
] | aliag00@sohu.com |
47d2d1f6f94f2b752f38e926b188ae03101aef29 | a47aa19815683df16782909a5e761fc1718a09ed | /fsoinstaller/src/com/fsoinstaller/utils/ObjectHolder.java | 2ce238f7416a9cd673d256eb8791d68355d8818b | [] | no_license | PubFork/FS2Open_Trunk | 1e30bd97712b7a7bc2b8302784e8f61c9239fd6f | f1d7904e74141b21ecf691a393d730bb8ba0e134 | refs/heads/master | 2023-03-15T21:57:32.800167 | 2015-01-27T08:02:21 | 2015-01-27T08:02:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,857 | java | /*
* This file is part of the FreeSpace Open Installer
* Copyright (C) 2014 The FreeSpace 2 Source Code Project
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.fsoinstaller.utils;
/**
* A simple wrapper class to hold a reference to an arbitrary object. Can be
* used as a pass-by-reference parameter in a method or as a manually
* synchronized version of AtomicReference.
*
* @author Goober5000
*/
public class ObjectHolder<T>
{
private T contents;
public ObjectHolder()
{
this(null);
}
public ObjectHolder(T contents)
{
this.contents = contents;
}
public T get()
{
return contents;
}
public void set(T object)
{
this.contents = object;
}
@Override
public boolean equals(Object object)
{
if (object == null)
return false;
else if (object == this)
return true;
else if (getClass() != object.getClass())
return false;
ObjectHolder<?> other = (ObjectHolder<?>) object;
return MiscUtils.nullSafeEquals(contents, other.contents);
}
@Override
public int hashCode()
{
return (contents == null) ? 0 : contents.hashCode();
}
}
| [
"Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3"
] | Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3 |
abf5386f0afcbce9231b308454b445c986fd67c0 | f8c1a889a78985b0a4557f3ac2d725152d5257de | /src/main/java/gmms/service/TagService.java | 6236b71027d2042cf4ac41319640d777ca83d537 | [] | no_license | wangfushu/cardMaintenance_spring | 3211aa97a14ff45c7903c619df26ce87623d2dd7 | 68c26899d1eaeb1c265c57f05233d467caf17096 | refs/heads/master | 2020-03-08T08:58:12.655076 | 2018-08-07T00:40:43 | 2018-08-07T00:40:43 | 128,034,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46,519 | java | package gmms.service;
import com.google.common.collect.Lists;
import gmms.dao.*;
import gmms.dao.util.DynamicSpecifications;
import gmms.dao.util.SearchFilter;
import gmms.domain.db.*;
import gmms.domain.param.IssueTagYearParam;
import gmms.domain.param.TagInStoreParam;
import gmms.domain.param.TagOutStoreParam;
import gmms.domain.param.TmTagStoreParam;
import gmms.domain.query.IssueTagYearQueryForm;
import gmms.domain.vo.IssueTagExcelVO;
import gmms.domain.vo.TagInStoreExcelVO;
import gmms.domain.vo.TagOutStoreExcelVO;
import gmms.util.DateUtil;
import gmms.util.DateUtils;
import gmms.util.ExcelUtil;
import gmms.util.StringUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
import javax.persistence.Query;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
/**
* Created by wangfs on 2018-02-23 helloword.
*/
@Service
public class TagService {
private static final Logger LOGGER = LoggerFactory.getLogger(TagService.class);
@Autowired
private TmTagTypeDao tmTagTypeDao;
@Autowired
private TmTagStoreDao tmTagStoreDao;
@Autowired
private TmTagInStoreDao tmTagInStoreDao;
@Autowired
private IssueTagDao issueTagDao;
@Autowired
private TmTagOutStoreDao tmTagOutStoreDao;
@Autowired
private SysBaseInformationDao sysBaseInformationDao;
@PersistenceUnit
private EntityManagerFactory emf;
public List<TmTagType> listAllTagType(){
return Lists.newArrayList(tmTagTypeDao.findAll());
}
public TmTagType getbyTypeId(Long typeId){
return tmTagTypeDao.findOne(typeId);
}
public TmTagType findByName(String name) {
return tmTagTypeDao.findByTagType(name);
}
public TmTagType saveOrUpdateTmTagType(TmTagType tmTagType){
return tmTagTypeDao.save(tmTagType);
}
public List<TmTagType> TagTypelistAll(){
List<SearchFilter> filters = Lists.newArrayList();
filters.add(new SearchFilter("inUse", SearchFilter.Operator.EQ,1l));
Specification<TmTagType> spec = DynamicSpecifications.bySearchFilter(filters, TmTagType.class);
List<TmTagType> tmTagTypeList= tmTagTypeDao.findAll(spec,new Sort(Sort.Direction.ASC,"typeId"));
return tmTagTypeList;
}
public List<TmTagStore> listAllTmTagStore(TmTagStoreParam tmTagStoreParam){
List<SearchFilter> filters = Lists.newArrayList();
if (tmTagStoreParam.getTimefromFormat() != null) {
filters.add(new SearchFilter("updateTime", SearchFilter.Operator.GTE, tmTagStoreParam.getTimefromFormat()));
}
if (tmTagStoreParam.getTimetoFormat() != null) {
filters.add(new SearchFilter("updateTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(tmTagStoreParam.getTimetoFormat()))));
}
if (tmTagStoreParam.getTypeId() != null&&tmTagStoreParam.getTypeId()!=-1) {
filters.add(new SearchFilter("tagType.typeId", SearchFilter.Operator.EQ, tmTagStoreParam.getTypeId()));
}
if (tmTagStoreParam.getPlaNo() != null&&!tmTagStoreParam.getPlaNo().equals(0l)) {
filters.add(new SearchFilter("plazaNo", SearchFilter.Operator.EQ, tmTagStoreParam.getPlaNo()));
}
Specification<TmTagStore> spec = DynamicSpecifications.bySearchFilter(filters, TmTagStore.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "updateTime");
List<TmTagStore> allTmTagStore = tmTagStoreDao.findAll(spec, purchaseDateDB);
return allTmTagStore;
}
public Page<TmTagStore> listAllTmTagStorePage(TmTagStoreParam tmTagStoreParam,int pageNo,int pageSize){
List<SearchFilter> filters = Lists.newArrayList();
if (tmTagStoreParam.getTimefromFormat() != null) {
filters.add(new SearchFilter("updateTime", SearchFilter.Operator.GTE, tmTagStoreParam.getTimefromFormat()));
}
if (tmTagStoreParam.getTimetoFormat() != null) {
filters.add(new SearchFilter("updateTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(tmTagStoreParam.getTimetoFormat()))));
}
if (tmTagStoreParam.getTypeId() != null&&tmTagStoreParam.getTypeId()!=-1) {
filters.add(new SearchFilter("tagType.typeId", SearchFilter.Operator.EQ, tmTagStoreParam.getTypeId()));
}
if (tmTagStoreParam.getPlaNo() != null&&!tmTagStoreParam.getPlaNo().equals(0l)) {
filters.add(new SearchFilter("plazaNo", SearchFilter.Operator.EQ, tmTagStoreParam.getPlaNo()));
}
Specification<TmTagStore> spec = DynamicSpecifications.bySearchFilter(filters, TmTagStore.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "updateTime");
PageRequest page = new PageRequest(pageNo - 1, pageSize, purchaseDateDB);
Page<TmTagStore> allTmTagStore = tmTagStoreDao.findAll(spec, page);
return allTmTagStore;
}
public List<SysBaseInformation> findInStoreTypeByValue(){
return sysBaseInformationDao.querybybiType("TagInStoreType");
}
@Transactional(rollbackFor = Exception.class)
public TmTagInStore inStoreTagAll(TmTagInStore tmTagInStore){
TmTagStore tmTagStore=null;
TmTagInStore inStore=tmTagInStoreDao.save(tmTagInStore);
tmTagStore= tmTagStoreDao.findOne(inStore.getInRecievedPlazaNo());
if(null!= tmTagStore&& !StringUtil.isEmpty(String.valueOf(tmTagStore.getPlazaNo()))){
//update
if(inStore.getInStoreType().equals(1L)) {
tmTagStore.setGoodTagCount(tmTagStore.getGoodTagCount()+inStore.getCount());
}else{
TmTagStore sendtmTagStore= tmTagStoreDao.findOne(inStore.getInSendPlazaNo());//发送方库存扣除
sendtmTagStore.setGoodTagCount(sendtmTagStore.getGoodTagCount()-inStore.getCount());
sendtmTagStore.setBadTagCount(sendtmTagStore.getBadTagCount() + inStore.getCount());
tmTagStoreDao.save(sendtmTagStore);
tmTagStore.setBadTagCount(tmTagStore.getBadTagCount()+inStore.getCount());
}
tmTagStore.setUpdateTime(new Date());
}else{
//add
tmTagStore=new TmTagStore();
tmTagStore.setPlazaNo(inStore.getInRecievedPlazaNo());
tmTagStore.setPlazaName(inStore.getInRecievedPlazaName());
if(inStore.getInStoreType().equals(1L)) {
tmTagStore.setGoodTagCount(inStore.getCount());
}else{
TmTagStore sendtmTagStore= tmTagStoreDao.findOne(inStore.getInSendPlazaNo());//发送方库存扣除
sendtmTagStore.setGoodTagCount(sendtmTagStore.getGoodTagCount()-inStore.getCount());
sendtmTagStore.setBadTagCount(sendtmTagStore.getBadTagCount()+inStore.getCount());
tmTagStoreDao.save(sendtmTagStore);
tmTagStore.setBadTagCount(inStore.getCount());
}
tmTagStore.setUpdateTime(new Date());
}
TmTagStore tmTagStoreSave=tmTagStoreDao.save(tmTagStore);
return inStore;
}
@Transactional(rollbackFor = Exception.class)
public TmTagOutStore outStoreTagAll(TmTagOutStore tmTagOutStore){
TmTagStore tmTagStore=null;
TmTagOutStore outStore=tmTagOutStoreDao.save(tmTagOutStore);
tmTagStore= tmTagStoreDao.findOne(outStore.getOutRecievedPlazaNo());
if(null!= tmTagStore&& !StringUtil.isEmpty(String.valueOf(tmTagStore.getPlazaNo()))){
//update
tmTagStore.setGoodTagCount(tmTagStore.getGoodTagCount()+outStore.getCount());
TmTagStore sendtmTagStore= tmTagStoreDao.findOne(outStore.getOutSendPlazaNo());//发送方库存扣除
sendtmTagStore.setGoodTagCount(sendtmTagStore.getGoodTagCount()-outStore.getCount());
tmTagStoreDao.save(sendtmTagStore);
tmTagStore.setUpdateTime(new Date());
}else{
//add
tmTagStore=new TmTagStore();
tmTagStore.setPlazaNo(outStore.getOutRecievedPlazaNo());
tmTagStore.setPlazaName(outStore.getOutRecievedPlazaName());
TmTagStore sendtmTagStore= tmTagStoreDao.findOne(outStore.getOutSendPlazaNo());//发送方库存扣除
sendtmTagStore.setGoodTagCount(sendtmTagStore.getGoodTagCount()-outStore.getCount());
tmTagStoreDao.save(sendtmTagStore);
tmTagStore.setGoodTagCount(outStore.getCount());
tmTagStore.setUpdateTime(new Date());
}
TmTagStore tmTagStoreSave=tmTagStoreDao.save(tmTagStore);
return outStore;
}
public TmTagStore findTmTagStoreByPlazaNo(Long plazaNo){
return tmTagStoreDao.findOne(plazaNo);
}
/************************************************************** 入库记录报表 ********************************************************************************************/
public Page<TmTagInStore> TmTagInStorelistAllPage(TagInStoreParam param, int pageNo, int pageSize) {
List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("inStoreTime", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("inStoreTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
Specification<TmTagInStore> spec = DynamicSpecifications.bySearchFilter(filters, TmTagInStore.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "inStoreTime");
PageRequest page = new PageRequest(pageNo - 1, pageSize, purchaseDateDB);
return tmTagInStoreDao.findAll(spec, page);
}
public List<TmTagInStore> TmTagInStorelistAll(TagInStoreParam param) {
List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("inStoreTime", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("inStoreTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
Specification<TmTagInStore> spec = DynamicSpecifications.bySearchFilter(filters, TmTagInStore.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "inStoreTime");
return tmTagInStoreDao.findAll(spec);
}
public byte[] getTmTagInStoreExcel(List<TmTagInStore> tmTagInStores, String fileName, String[] Title) {
if (CollectionUtils.isEmpty(tmTagInStores)) {
return null;
}
List<TagInStoreExcelVO> orderExcelVOS = turn2ExcelVo(tmTagInStores);
return ExcelUtil.exportTagInStoreReportExcel(orderExcelVOS, fileName, Title);
}
private List<TagInStoreExcelVO> turn2ExcelVo(List<TmTagInStore> data) {
List<TagInStoreExcelVO> resultList = Lists.newArrayList();
for (TmTagInStore tmTagInStore : data) {
TagInStoreExcelVO tagInStoreExcelVO = new TagInStoreExcelVO();
if(tmTagInStore.getIsNewCardInStore()){
tagInStoreExcelVO.setInStoreType("新卡入库");
}else{
tagInStoreExcelVO.setInStoreType("故障卡入库");
}
tagInStoreExcelVO.setCount(tmTagInStore.getCount());
tagInStoreExcelVO.setInSendPlazaName(tmTagInStore.getInSendPlazaName());
tagInStoreExcelVO.setInRecievedPlazaName(tmTagInStore.getInRecievedPlazaName());
tagInStoreExcelVO.setRemark(tmTagInStore.getRemark());
tagInStoreExcelVO.setUserName(tmTagInStore.getUserName());
tagInStoreExcelVO.setInStoreTime(DateUtil.formatDate(tmTagInStore.getInStoreTime(), "yyyy-MM-dd"));
resultList.add(tagInStoreExcelVO);
}
return resultList;
}
/************************************************************** 出库记录报表 ********************************************************************************************/
public Page<TmTagOutStore> TmTagOutStorelistAllPage(TagOutStoreParam param, int pageNo, int pageSize) {
List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L)){
filters.add(new SearchFilter("outRecievedPlazaNo", SearchFilter.Operator.EQ,param.getPlaNo()));
}
Specification<TmTagOutStore> spec = DynamicSpecifications.bySearchFilter(filters, TmTagOutStore.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "outStoreTime");
PageRequest page = new PageRequest(pageNo - 1, pageSize, purchaseDateDB);
return tmTagOutStoreDao.findAll(spec, page);
}
public List<TmTagOutStore> TmTagOutStorelistAll(TagOutStoreParam param) {
List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L)){
filters.add(new SearchFilter("outRecievedPlazaNo", SearchFilter.Operator.EQ,param.getPlaNo()));
}
Specification<TmTagOutStore> spec = DynamicSpecifications.bySearchFilter(filters, TmTagOutStore.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "outStoreTime");
return tmTagOutStoreDao.findAll(spec);
}
public byte[] getTmTagOutStoreExcel(List<TmTagOutStore> tmTagOutStores, String fileName, String[] Title) {
if (CollectionUtils.isEmpty(tmTagOutStores)) {
return null;
}
List<TagOutStoreExcelVO> tagInStoreExcelVOs = turnTmOutStore2ExcelVo(tmTagOutStores);
return ExcelUtil.exportTagOutStoreReportExcel(tagInStoreExcelVOs, fileName, Title);
}
private List<TagOutStoreExcelVO> turnTmOutStore2ExcelVo(List<TmTagOutStore> data) {
List<TagOutStoreExcelVO> resultList = Lists.newArrayList();
for (TmTagOutStore tmTagOutStore : data) {
TagOutStoreExcelVO tagOutStoreExcelVO = new TagOutStoreExcelVO();
tagOutStoreExcelVO.setCount(tmTagOutStore.getCount());
tagOutStoreExcelVO.setOutSendPlazaName(tmTagOutStore.getOutSendPlazaName());
tagOutStoreExcelVO.setOutRecievedPlazaName(tmTagOutStore.getOutRecievedPlazaName());
tagOutStoreExcelVO.setRemark(tmTagOutStore.getRemark());
tagOutStoreExcelVO.setUserName(tmTagOutStore.getUserName());
tagOutStoreExcelVO.setOutStoreTime(DateUtil.formatDate(tmTagOutStore.getOutStoreTime(), "yyyy-MM-dd"));
resultList.add(tagOutStoreExcelVO);
}
return resultList;
}
/************************************************************** 发卡信息记录报表 year ********************************************************************************************/
public List<IssueTagYearQueryForm> IssueTagYearlistAllPage(IssueTagYearParam param,Users users ,int pageNo, int pageSize) {
/* List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
Specification<IssueTag> spec = DynamicSpecifications.bySearchFilter(filters, IssueTag.class);*/
//Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "outStoreTime");
/*PageRequest page = new PageRequest(pageNo - 1, pageSize);
return issueTagDao.findAll(users.getId(), "2018", page);*/
EntityManager em = emf.createEntityManager();
//定义SQL
String sql = "SELECT TOP "+pageSize+" * " +
"FROM " +
" (select ROW_NUMBER() OVER (ORDER BY convert(char(10),t.installDate,120)) AS RowNumber, convert(char(10),t.installDate,120) 统计日期,t.userNo 发卡账号,t.userName 发卡姓名,t.plazaName 网点名称," +
"(select count(*) from IssueTag temp where temp.installType = 1 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 新发卡数量 ," +
"(select count(*) from IssueTag temp where temp.installType = 2 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保内换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 3 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保外换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 4 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 人为损坏换卡数量," +
"count(*) 总数量, SUM(fee) 实收金额" +
" from IssueTag t where " ;
String conditions="";
if(users.getIsUser()){
conditions=" userId="+users.getId();
}
if(!StringUtil.isEmpty(param.getYear())){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" convert(char(4),t.installDate,120)='"+param.getYear()+"' ";
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L) ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.plazaNo = ' "+ param.getPlaNo()+" ' ";
}
sql+=conditions;
sql+= " group by convert(char(10),t.installDate,120),t.userNo,t.userName,t.plazaNo,t.plazaName ) as A " +
"WHERE RowNumber > "+pageSize+"*("+pageNo+"-1) ";
//创建原生SQL查询QUERY实例
Query query = em.createNativeQuery(sql);
//执行查询,返回的是对象数组(Object[])列表,
//每一个对象数组存的是相应的实体属性
List<Object[]> objectList =query.getResultList();
List<IssueTagYearQueryForm> issueTagYearParamList= Lists.newArrayList();
for(Object[] obj : objectList){
IssueTagYearQueryForm issueTagYearQueryForm =new IssueTagYearQueryForm();
if(null!=obj[1])
issueTagYearQueryForm.setStatisticDate(String.valueOf(obj[1]));
if(null!=obj[2])
issueTagYearQueryForm.setIssueUserNo(String.valueOf(obj[2]));
if(null!=obj[3])
issueTagYearQueryForm.setIssueUserName(String.valueOf(obj[3]));
if(null!=obj[4])
issueTagYearQueryForm.setPlazaName(String.valueOf(obj[4]));
if(null!=obj[5])
issueTagYearQueryForm.setNewCardIssueCount(Integer.valueOf(String.valueOf(obj[5])));
if(null!=obj[6])
issueTagYearQueryForm.setInsureCardIssueCount(Integer.valueOf(String.valueOf(obj[6])));
if(null!=obj[7])
issueTagYearQueryForm.setOutsureCardIssueCount(Integer.valueOf(String.valueOf(obj[7])));
if(null!=obj[8])
issueTagYearQueryForm.setInsureDamageCardIssueCount(Integer.valueOf(String.valueOf(obj[8])));
if(null!=obj[9])
issueTagYearQueryForm.setCount(Integer.valueOf(String.valueOf(obj[9])));
if(null!=obj[10])
issueTagYearQueryForm.setTotalfee(Double.valueOf(String.valueOf(obj[10])));
issueTagYearParamList.add(issueTagYearQueryForm);
}
em.close();
return issueTagYearParamList;
}
public Integer IssueTagYearlistSize(IssueTagYearParam param,Users users) {
/* List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("outStoreTime", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
Specification<IssueTag> spec = DynamicSpecifications.bySearchFilter(filters, IssueTag.class);*/
//Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "outStoreTime");
/*PageRequest page = new PageRequest(pageNo - 1, pageSize);
return issueTagDao.findAll(users.getId(), "2018", page);*/
EntityManager em = emf.createEntityManager();
//定义SQL
String sql = "SELECT count(*) " +
"FROM " +
" (select ROW_NUMBER() OVER (ORDER BY convert(char(10),t.installDate,120)) AS RowNumber, convert(char(10),t.installDate,120) 统计日期,t.userNo 发卡账号,t.userName 发卡姓名,t.plazaName 网点名称," +
"(select count(*) from IssueTag temp where temp.installType = 1 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 新发卡数量 ," +
"(select count(*) from IssueTag temp where temp.installType = 2 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保内换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 3 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保外换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 4 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 人为损坏换卡数量," +
"count(*) 总数量, SUM(fee) 实收金额" +
" from IssueTag t where " ;
String conditions="";
if(users.getIsUser()){
conditions=" userId="+users.getId();
}
if(!StringUtil.isEmpty(param.getYear())){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" convert(char(4),t.installDate,120)='"+param.getYear()+"' ";
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L) ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.plazaNo = ' "+ param.getPlaNo()+" ' ";
}
sql+=conditions;
sql+= " group by convert(char(10),t.installDate,120),t.userNo,t.userName,t.plazaNo,t.plazaName ) as A " ;
//创建原生SQL查询QUERY实例
Query query = em.createNativeQuery(sql);
//执行查询,返回的是对象数组(Object[])列表,
//每一个对象数组存的是相应的实体属性
List<Object> objecArraytList = query.getResultList();
Integer count=0;
for(Object obj : objecArraytList){
if(null!=obj)
count= Integer.valueOf(String.valueOf(obj));
}
em.close();
return count;
}
public List<IssueTagYearQueryForm> IssueTagYearlistAllList(IssueTagYearParam param,Users users) {
EntityManager em = emf.createEntityManager();
//定义SQL
String sql = "select convert(char(10),t.installDate,120) 统计日期,t.userNo 发卡账号,t.userName 发卡姓名,t.plazaName 网点名称," +
"(select count(*) from IssueTag temp where temp.installType = 1 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 新发卡数量 ," +
"(select count(*) from IssueTag temp where temp.installType = 2 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保内换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 3 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保外换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 4 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 人为损坏换卡数量," +
"count(*) 总数量, SUM(fee) 实收金额" +
" from IssueTag t where " ;
String conditions="";
if(users.getIsUser()){
conditions=" userId="+users.getId();
}
if(!StringUtil.isEmpty(param.getYear())){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" convert(char(4),t.installDate,120)='"+param.getYear()+"' ";
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L) ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.plazaNo = ' "+ param.getPlaNo()+" ' ";
}
sql+=conditions;
sql+= " group by convert(char(10),t.installDate,120),t.userNo,t.userName,t.plazaNo,t.plazaName ";
//创建原生SQL查询QUERY实例
Query query = em.createNativeQuery(sql);
//执行查询,返回的是对象数组(Object[])列表,
//每一个对象数组存的是相应的实体属性
List<Object[]> objectList =query.getResultList();
List<IssueTagYearQueryForm> issueTagYearParamList= Lists.newArrayList();
for(Object[] obj : objectList){
IssueTagYearQueryForm issueTagYearQueryForm =new IssueTagYearQueryForm();
if(null!=obj[0])
issueTagYearQueryForm.setStatisticDate(String.valueOf(obj[0]));
if(null!=obj[1])
issueTagYearQueryForm.setIssueUserNo(String.valueOf(obj[1]));
if(null!=obj[2])
issueTagYearQueryForm.setIssueUserName(String.valueOf(obj[2]));
if(null!=obj[3])
issueTagYearQueryForm.setPlazaName(String.valueOf(obj[3]));
if(null!=obj[4])
issueTagYearQueryForm.setNewCardIssueCount(Integer.valueOf(String.valueOf(obj[4])));
if(null!=obj[5])
issueTagYearQueryForm.setInsureCardIssueCount(Integer.valueOf(String.valueOf(obj[5])));
if(null!=obj[6])
issueTagYearQueryForm.setOutsureCardIssueCount(Integer.valueOf(String.valueOf(obj[6])));
if(null!=obj[7])
issueTagYearQueryForm.setInsureDamageCardIssueCount(Integer.valueOf(String.valueOf(obj[7])));
if(null!=obj[8])
issueTagYearQueryForm.setCount(Integer.valueOf(String.valueOf(obj[8])));
if(null!=obj[9])
issueTagYearQueryForm.setTotalfee(Double.valueOf(String.valueOf(obj[9])));
issueTagYearParamList.add(issueTagYearQueryForm);
}
em.close();
return issueTagYearParamList;
}
public byte[] getIssueTagYearExcel(List<IssueTagYearQueryForm> issueTagYearQueryForms, String fileName, String[] Title) {
if (CollectionUtils.isEmpty(issueTagYearQueryForms)) {
return null;
}
return ExcelUtil.exportIssueTagYearReportExcel(issueTagYearQueryForms, fileName, Title);
}
/************************************************************** 发卡信息记录报表 Day ********************************************************************************************/
public List<IssueTagYearQueryForm> IssueTagDaylistAllPage(IssueTagYearParam param,Users users,int pageNo, int pageSize) {
EntityManager em = emf.createEntityManager();
//定义SQL
String sql = "SELECT TOP "+pageSize+" * " +
"FROM " +
" (select ROW_NUMBER() OVER (ORDER BY convert(char(10),t.installDate,120)) AS RowNumber, convert(char(10),t.installDate,120) 统计日期,t.userNo 发卡账号,t.userName 发卡姓名,t.plazaName 网点名称," +
"(select count(*) from IssueTag temp where temp.installType = 1 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 新发卡数量 ," +
"(select count(*) from IssueTag temp where temp.installType = 2 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保内换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 3 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保外换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 4 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 人为损坏换卡数量," +
"count(*) 总数量, SUM(fee) 实收金额" +
" from IssueTag t where " ;
String conditions="";
if(users.getIsUser()){
conditions=" userId="+users.getId();
}
if(null!=param.getTimefrom() ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.installDate >= '"+param.getTimefrom()+"' ";
}
if(null!=param.getTimeto()){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.installDate <= ' "+ DateUtils.getTimeStr(new Date(DateUtil.dayEndnTime(param.getTimetoFormat())), 2)+" ' ";
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L) ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.plazaNo = ' "+ param.getPlaNo()+" ' ";
}
sql+=conditions;
sql+= " group by convert(char(10),t.installDate,120),t.userNo,t.userName,t.plazaNo,t.plazaName ) as A " +
"WHERE RowNumber > "+pageSize+"*("+pageNo+"-1) ";
//创建原生SQL查询QUERY实例
Query query = em.createNativeQuery(sql);
//执行查询,返回的是对象数组(Object[])列表,
//每一个对象数组存的是相应的实体属性
List<Object[]> objectList =query.getResultList();
List<IssueTagYearQueryForm> issueTagYearParamList= Lists.newArrayList();
for(Object[] obj : objectList){
IssueTagYearQueryForm issueTagYearQueryForm =new IssueTagYearQueryForm();
if(null!=obj[1])
issueTagYearQueryForm.setStatisticDate(String.valueOf(obj[1]));
if(null!=obj[2])
issueTagYearQueryForm.setIssueUserNo(String.valueOf(obj[2]));
if(null!=obj[3])
issueTagYearQueryForm.setIssueUserName(String.valueOf(obj[3]));
if(null!=obj[4])
issueTagYearQueryForm.setPlazaName(String.valueOf(obj[4]));
if(null!=obj[5])
issueTagYearQueryForm.setNewCardIssueCount(Integer.valueOf(String.valueOf(obj[5])));
if(null!=obj[6])
issueTagYearQueryForm.setInsureCardIssueCount(Integer.valueOf(String.valueOf(obj[6])));
if(null!=obj[7])
issueTagYearQueryForm.setOutsureCardIssueCount(Integer.valueOf(String.valueOf(obj[7])));
if(null!=obj[8])
issueTagYearQueryForm.setInsureDamageCardIssueCount(Integer.valueOf(String.valueOf(obj[8])));
if(null!=obj[9])
issueTagYearQueryForm.setCount(Integer.valueOf(String.valueOf(obj[9])));
if(null!=obj[10])
issueTagYearQueryForm.setTotalfee(Double.valueOf(String.valueOf(obj[10])));
issueTagYearParamList.add(issueTagYearQueryForm);
}
em.close();
return issueTagYearParamList;
}
public Integer IssueTagDaylistSize(IssueTagYearParam param,Users users) {
EntityManager em = emf.createEntityManager();
//定义SQL
String sql = "SELECT count(*) " +
"FROM " +
" (select ROW_NUMBER() OVER (ORDER BY convert(char(10),t.installDate,120)) AS RowNumber, convert(char(10),t.installDate,120) 统计日期,t.userNo 发卡账号,t.userName 发卡姓名,t.plazaName 网点名称," +
"(select count(*) from IssueTag temp where temp.installType = 1 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 新发卡数量 ," +
"(select count(*) from IssueTag temp where temp.installType = 2 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保内换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 3 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保外换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 4 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 人为损坏换卡数量," +
"count(*) 总数量, SUM(fee) 实收金额" +
" from IssueTag t where " ;
String conditions="";
if(users.getIsUser()){
conditions=" userId="+users.getId();
}
if(param.getTimefrom() != null){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.installDate >= '"+param.getTimefrom()+"' ";
}
if(param.getTimeto() != null){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.installDate <= ' "+ DateUtils.getTimeStr(new Date(DateUtil.dayEndnTime(param.getTimetoFormat())), 2)+" ' ";
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L) ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.plazaNo = ' "+ param.getPlaNo()+" ' ";
}
sql+=conditions;
sql+= " group by convert(char(10),t.installDate,120),t.userNo,t.userName,t.plazaNo,t.plazaName ) as A " ;
//创建原生SQL查询QUERY实例
Query query = em.createNativeQuery(sql);
//执行查询,返回的是对象数组(Object[])列表,
//每一个对象数组存的是相应的实体属性
List<Object> objecArraytList = query.getResultList();
Integer count=0;
for(Object obj : objecArraytList){
if(null!=obj)
count= Integer.valueOf(String.valueOf(obj));
}
em.close();
return count;
}
public List<IssueTagYearQueryForm> IssueTagDaylistAllList(IssueTagYearParam param,Users users) {
EntityManager em = emf.createEntityManager();
//定义SQL
String sql = "select convert(char(10),t.installDate,120) 统计日期,t.userNo 发卡账号,t.userName 发卡姓名,t.plazaName 网点名称," +
"(select count(*) from IssueTag temp where temp.installType = 1 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 新发卡数量 ," +
"(select count(*) from IssueTag temp where temp.installType = 2 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保内换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 3 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 保外换卡数量," +
"(select count(*) from IssueTag temp where temp.installType = 4 and temp.userName=t.userName and temp.plazaNo=t.plazaNo and temp.plazaName=t.plazaName and convert(char(10),temp.installDate,120)=convert(char(10),t.installDate,120)) 人为损坏换卡数量," +
"count(*) 总数量, SUM(fee) 实收金额" +
" from IssueTag t where " ;
String conditions="";
if(users.getIsUser()){
conditions=" userId="+users.getId();
}
if(param.getTimefrom() != null){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.installDate >= '"+param.getTimefrom()+"' ";
}
if(param.getTimeto() != null){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.installDate <= ' "+ DateUtils.getTimeStr(new Date(DateUtil.dayEndnTime(param.getTimetoFormat())), 2)+" ' ";
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L) ){
if(!StringUtil.isEmpty(conditions)){
conditions+=" and ";
}
conditions+=" t.plazaNo = ' "+ param.getPlaNo()+" ' ";
}
sql+=conditions;
sql+= " group by convert(char(10),t.installDate,120),t.userNo,t.userName,t.plazaNo,t.plazaName ";
//创建原生SQL查询QUERY实例
Query query = em.createNativeQuery(sql);
//执行查询,返回的是对象数组(Object[])列表,
//每一个对象数组存的是相应的实体属性
List<Object[]> objectList =query.getResultList();
List<IssueTagYearQueryForm> issueTagYearParamList= Lists.newArrayList();
for(Object[] obj : objectList){
IssueTagYearQueryForm issueTagYearQueryForm =new IssueTagYearQueryForm();
if(null!=obj[0])
issueTagYearQueryForm.setStatisticDate(String.valueOf(obj[0]));
if(null!=obj[1])
issueTagYearQueryForm.setIssueUserNo(String.valueOf(obj[1]));
if(null!=obj[2])
issueTagYearQueryForm.setIssueUserName(String.valueOf(obj[2]));
if(null!=obj[3])
issueTagYearQueryForm.setPlazaName(String.valueOf(obj[3]));
if(null!=obj[4])
issueTagYearQueryForm.setNewCardIssueCount(Integer.valueOf(String.valueOf(obj[4])));
if(null!=obj[5])
issueTagYearQueryForm.setInsureCardIssueCount(Integer.valueOf(String.valueOf(obj[5])));
if(null!=obj[6])
issueTagYearQueryForm.setOutsureCardIssueCount(Integer.valueOf(String.valueOf(obj[6])));
if(null!=obj[7])
issueTagYearQueryForm.setInsureDamageCardIssueCount(Integer.valueOf(String.valueOf(obj[7])));
if(null!=obj[8])
issueTagYearQueryForm.setCount(Integer.valueOf(String.valueOf(obj[8])));
if(null!=obj[9])
issueTagYearQueryForm.setTotalfee(Double.valueOf(String.valueOf(obj[9])));
issueTagYearParamList.add(issueTagYearQueryForm);
}
em.close();
return issueTagYearParamList;
}
public byte[] getIssueTagDayExcel(List<IssueTagYearQueryForm> issueTagYearQueryForms, String fileName, String[] Title) {
if (CollectionUtils.isEmpty(issueTagYearQueryForms)) {
return null;
}
return ExcelUtil.exportIssueTagYearReportExcel(issueTagYearQueryForms, fileName, Title);
}
/************************************************************** 发卡信息记录报表 detail详细报表 ********************************************************************************************/
public Page<IssueTag> IssueTaglistAllPage(IssueTagYearParam param,Users users, int pageNo, int pageSize) {
List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("installDate", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("installDate", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
if(null!=users&&users.getIsUser()){
filters.add(new SearchFilter("userId", SearchFilter.Operator.EQ, users.getId()));
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L)){
filters.add(new SearchFilter("plazaNo", SearchFilter.Operator.EQ, param.getPlaNo()));
}
Specification<IssueTag> spec = DynamicSpecifications.bySearchFilter(filters, IssueTag.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "installDate");
PageRequest page = new PageRequest(pageNo - 1, pageSize, purchaseDateDB);
return issueTagDao.findAll(spec, page);
}
public List<IssueTag> IssueTaglistAll(IssueTagYearParam param,Users users) {
List<SearchFilter> filters = Lists.newArrayList();
if (param.getTimefromFormat() != null) {
filters.add(new SearchFilter("installDate", SearchFilter.Operator.GTE, param.getTimefromFormat()));
}
if (param.getTimetoFormat() != null) {
filters.add(new SearchFilter("installDate", SearchFilter.Operator.LTE, new Date(DateUtil.dayEndnTime(param.getTimetoFormat()))));
}
if(null!=users&&users.getIsUser()){
filters.add(new SearchFilter("userId", SearchFilter.Operator.EQ, users.getId()));
}
if(null!=param.getPlaNo()&&!param.getPlaNo().equals(0L)){
filters.add(new SearchFilter("plazaNo", SearchFilter.Operator.EQ, param.getPlaNo()));
}
Specification<IssueTag> spec = DynamicSpecifications.bySearchFilter(filters, IssueTag.class);
Sort purchaseDateDB = new Sort(Sort.Direction.DESC, "installDate");
return issueTagDao.findAll(spec,purchaseDateDB);
}
public byte[] getIssueTagExcel(List<IssueTag> issueTags, String fileName, String[] Title) {
if (CollectionUtils.isEmpty(issueTags)) {
return null;
}
List<IssueTagExcelVO> issueTagExcelVOs = turn2IssueTagExcelVo(issueTags);
return ExcelUtil.exportIssueTagReportExcel(issueTagExcelVOs, fileName, Title);
}
private List<IssueTagExcelVO> turn2IssueTagExcelVo(List<IssueTag> data) {
List<IssueTagExcelVO> resultList = Lists.newArrayList();
for (IssueTag issueTag : data) {
IssueTagExcelVO issueTagExcelVO = new IssueTagExcelVO();
issueTagExcelVO.setPlazaName(issueTag.getPlazaName());
issueTagExcelVO.setUserNo(issueTag.getUserNo());
issueTagExcelVO.setUserName(issueTag.getUserName());
issueTagExcelVO.setPlateNo(issueTag.getPlateNo());
issueTagExcelVO.setPlateColor(issueTag.getPlateColor());
if(issueTag.getvKindNo().equals(1L)){
issueTagExcelVO.setvKindNo("客车");
}else if(issueTag.getvKindNo().equals(2L)){
issueTagExcelVO.setvKindNo("货车");
}else{
issueTagExcelVO.setvKindNo("农用车");
}
issueTagExcelVO.setInstallDate(DateUtil.formatDate(issueTag.getInstallDate(), "yyyy-MM-dd HH:mm:ss"));
if(issueTag.getInstallType().equals(1L)){
issueTagExcelVO.setInstallType("新卡发放");
}else if(issueTag.getInstallType().equals(2L)){
issueTagExcelVO.setInstallType("保内换卡");
}else if(issueTag.getInstallType().equals(3L)){
issueTagExcelVO.setInstallType("保外换卡");
}else{
issueTagExcelVO.setInstallType("人为损坏");
}
issueTagExcelVO.setFee(issueTag.getFee());
resultList.add(issueTagExcelVO);
}
return resultList;
}
}
| [
"891733713@qq.com"
] | 891733713@qq.com |
2c88fd50fd2ee003d96409a468216aa1dba64ef3 | 2fd10b09dbe89d81a029fe9ded14c1017698a1f6 | /src/main/java/idv/kuma/chap01/bad/Game.java | e7d2768479137029c680c4cde96d9ca55e375514 | [] | no_license | bearhsu2/building_maintainable_software | 1562d8a2ae9c6ee8cd5eea707d109ee0671a83f2 | 420750df328d21ad4f0c1b26e9186461b8d8cda6 | refs/heads/master | 2020-03-21T05:41:22.032168 | 2018-06-21T15:36:30 | 2018-06-21T15:36:30 | 138,173,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package idv.kuma.chap01.bad;
import java.util.List;
public class Game {
private long startTime;
private Player player;
private List<Player> observers;
private boolean inProgress = false;
public Game(long startTime, Player player,List<Player> observers) {
this.startTime = startTime;
this.player = player;
this.observers = observers;
}
public boolean start() {
if (inProgress){
System.out.println("Game already in Progress");
for (Player observer : observers){
observer.sendMessage("game in progress");
}
return false;
}
inProgress = true;
return true;
}
}
| [
"kuma@simbo.com.tw"
] | kuma@simbo.com.tw |
0235d62b852cdca120c4e21b8475a63b21e8f5bc | 1400bc09dfeb8d65d9305dc57f428bd1af34bf3d | /nivel 11/n11_almacen/source/uniandes/cupi2/almacen/interfaz/PanelNodos.java | fe2c63cbc82b8bab250a565ed34c6a87bb6a7f4b | [] | no_license | dgfonseca/Apo1-y-Apo2 | 2f7c4f6fb92954f79b6fd338049996ae3916a446 | 97f55a36e2da4bf0d73e069aa6e2e9330942e9d8 | refs/heads/main | 2022-12-28T16:56:26.889945 | 2020-10-06T23:57:02 | 2020-10-06T23:57:02 | 301,883,214 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 14,619 | java | /**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Universidad de los Andes (Bogotá - Colombia)
* Departamento de Ingeniería de Sistemas y Computación
* Licenciado bajo el esquema Academic Free License versión 2.1
*
* Proyecto Cupi2 (http://cupi2.uniandes.edu.co)
* Ejercicio: n11_almacen
* Autor: Equipo Cupi2 2018
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
package uniandes.cupi2.almacen.interfaz;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreePath;
import uniandes.cupi2.almacen.mundo.Categoria;
import uniandes.cupi2.almacen.mundo.Marca;
import uniandes.cupi2.almacen.mundo.NodoAlmacen;
import uniandes.cupi2.almacen.mundo.Producto;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
/**
* Panel que muestra el árbol con los nodos.
*/
@SuppressWarnings("serial")
public class PanelNodos extends JPanel implements TreeSelectionListener, ActionListener, ListSelectionListener
{
// -----------------------------------------------------------------
// Constantes
// -----------------------------------------------------------------
/**
* Constante para la acción agregar.
*/
private final static String AGREGAR = "Agregar";
/**
* Constante para la acción eliminar.
*/
private final static String ELIMINAR = "Eliminar";
/**
* Constante para la acción del combo ver como.
*/
private final static String VISTA = "Vista";
/**
* Constante para la vista árbol.
*/
private final static String VER_ARBOL = "Ver como árbol";
/**
* Constante para la vista lista preorden.
*/
private final static String VER_PREORDEN = "Ver lista en preorden";
/**
* Constante para la vista lista preorden.
*/
private final static String VER_POSORDEN = "Ver lista en posorden";
// -----------------------------------------------------------------
// Atributos
// -----------------------------------------------------------------
/**
* Ventana principal de la aplicación.
*/
private InterfazAlmacen principal;
/**
* Categoría raíz del árbol.
*/
private Categoria categoriaRaiz;
// -----------------------------------------------------------------
// Atributos de la interfaz
// -----------------------------------------------------------------
/**
* Árbol que contiene los nodos.
*/
private JTree tree;
/**
* La raíz del JTree.
*/
private DefaultMutableTreeNode raizJtree;
/**
* JList para mostrar los nodos.
*/
@SuppressWarnings("rawtypes")
private JList listNodos;
/**
* Scroll pane que contiene el árbol.
*/
private JScrollPane spNodos;
/**
* Botón para agregar un nodo.
*/
private JButton btnAgregar;
/**
* Botón para eliminar un nodo.
*/
private JButton btnEliminar;
/**
* Combo para el tipo de vista.
*/
private JComboBox<String> cbVerComo;
// -----------------------------------------------------------------
// Constructores
// -----------------------------------------------------------------
/**
* Construye un nuevo panel nodos.
* @param pInterfaz Ventana principal de la aplicación. pInterfaz != null.
* @param pRaiz Categoría raíz. pRaiz != null.
*/
public PanelNodos( InterfazAlmacen pInterfaz, Categoria pRaiz )
{
setLayout( new BorderLayout( 0, 15 ) );
setBorder( new TitledBorder( "Categorías y marcas" ) );
principal = pInterfaz;
categoriaRaiz = pRaiz;
btnEliminar = new JButton( ELIMINAR );
btnEliminar.addActionListener( this );
btnEliminar.setActionCommand( ELIMINAR );
btnAgregar = new JButton( AGREGAR );
btnAgregar.addActionListener( this );
btnAgregar.setActionCommand( AGREGAR );
cbVerComo = new JComboBox<>( new String[]{ VER_ARBOL, VER_PREORDEN, VER_POSORDEN } );
cbVerComo.addActionListener( this );
cbVerComo.addActionListener( this );
cbVerComo.setActionCommand( VISTA );
add( cbVerComo, BorderLayout.NORTH );
listNodos = new JList<>( pRaiz.darPreorden( ).toArray( ) );
listNodos.addListSelectionListener( this );
spNodos = new JScrollPane( );
spNodos.setPreferredSize( new Dimension( 250, 550 ) );
add( spNodos, BorderLayout.WEST );
actualizar( pRaiz );
seleccionarNodo( pRaiz.darIdentificador( ) );
JPanel panelBotones = new JPanel( new GridLayout( 1, 2 ) );
panelBotones.add( btnEliminar );
panelBotones.add( btnAgregar );
add( panelBotones, BorderLayout.SOUTH );
}
// -----------------------------------------------------------------
// Métodos
// -----------------------------------------------------------------
/**
* Actualiza el panel con la raíz dada.<br>
* <b>post: </b> Vuelve a crear el árbol con la nueva información y actualiza el viewport del scroll pane.
* @param pRaiz Categoría raíz del almacén. pRaiz != null.
*/
public void actualizar( Categoria pRaiz )
{
String idSeleccionado = darIdSeleccionado( );
List<String> abiertos = new ArrayList<>( );
if( tree != null )
{
for( int i = 0; i < tree.getRowCount( ) - 1; i++ )
{
TreePath pathActual = tree.getPathForRow( i );
TreePath pathSiguiente = tree.getPathForRow( i + 1 );
if( pathActual.isDescendant( pathSiguiente ) )
{
DefaultMutableTreeNode treeNode = ( DefaultMutableTreeNode )pathActual.getLastPathComponent( );
abiertos.add( ( ( NodoAlmacen )treeNode.getUserObject( ) ).darIdentificador( ) );
}
}
}
categoriaRaiz = pRaiz;
String vista = ( String )cbVerComo.getSelectedItem( );
listNodos = new JList<>( ( vista.equals( VER_PREORDEN ) ? pRaiz.darPreorden( ) : pRaiz.darPosorden( ) ).toArray( ) );
listNodos.addListSelectionListener( this );
raizJtree = new DefaultMutableTreeNode( pRaiz );
agregarHijos( raizJtree, pRaiz );
tree = new JTree( raizJtree );
if( vista.equals( VER_ARBOL ) )
{
spNodos.setViewportView( tree );
}
else{
spNodos.setViewportView( listNodos );
}
ImageIcon imageIcon = new ImageIcon( "./data/imagenes/marca.png" );
DefaultTreeCellRenderer renderer = new AlmacenCellRenderer( );
renderer.setLeafIcon( imageIcon );
tree.setCellRenderer( renderer );
tree.addTreeSelectionListener( this );
for( String id : abiertos )
{
DefaultMutableTreeNode treeNode = buscar( id );
if( treeNode != null )
{
tree.expandPath( new TreePath( treeNode.getPath( ) ) );
}
}
if( idSeleccionado != null )
{
seleccionarNodo( idSeleccionado );
}
}
/**
* Agrega los hijos de la categoría al nodo del JTree.<br>
* <b>post:</b> Los nodos hijos de la categoría se agregaron al JTree junto con su subárbol.
* @param pNodo NodoAlmacen del JTree al cual se agregaran los nodos. pNodo != null.
* @param pCategoria Categoría del almacén que corresponde al nodo del JTree.
*/
public void agregarHijos( DefaultMutableTreeNode pNodo, Categoria pCategoria )
{
for( NodoAlmacen nodoAlmacen : pCategoria.darNodos( ) )
{
DefaultMutableTreeNode nodoArbol = new DefaultMutableTreeNode( nodoAlmacen );
if( nodoAlmacen instanceof Categoria )
{
agregarHijos( nodoArbol, ( Categoria )nodoAlmacen );
}
pNodo.add( nodoArbol );
}
}
/**
* Retorna el identificador del nodo seleccionado.
* @return Identificador del nodo seleccionado.
*/
public String darIdSeleccionado( )
{
if( tree == null || raizJtree == null || tree.getSelectionPath( ) == null )
{
return null;
}
String vista = ( String )cbVerComo.getSelectedItem( );
NodoAlmacen seleccionado = ( NodoAlmacen )listNodos.getSelectedValue( );
if( vista.equals( VER_ARBOL ) )
{
DefaultMutableTreeNode treeNode = ( DefaultMutableTreeNode )tree.getSelectionPath( ).getLastPathComponent( );
return ( ( NodoAlmacen )treeNode.getUserObject( ) ).darIdentificador( );
}
return seleccionado.darIdentificador( );
}
/**
* Selecciona el nodo almacén con el identificador dado en el JTree.<br>
* <b>post: </b>Se seleccionó el nodo en el JTree.
* @param pIdNodo Identificador del nodo almacén. pIdentificador != null.
*/
private void seleccionarNodoArbol( String pIdNodo )
{
DefaultMutableTreeNode treeNode = buscar( pIdNodo );
if( treeNode != null )
{
tree.setSelectionPath( new TreePath( treeNode.getPath( ) ) );
tree.scrollPathToVisible( new TreePath( treeNode.getPath( ) ) );
tree.expandPath( new TreePath( treeNode.getPath( ) ) );
}
}
/**
* Selecciona el nodo almacén con el identificador dado en la lista de nodos.<br>
* <b>post: </b>Se seleccionó el nodo en la lista de nodos.
* @param pIdNodo Identificador del nodo almacén. pIdentificador != null.
*/
private void seleccionarNodoLista( String pIdNodo )
{
if( listNodos != null )
{
for( int i = 0; i < listNodos.getModel( ).getSize( ); i++ )
{
NodoAlmacen p = ( NodoAlmacen )listNodos.getModel( ).getElementAt( i );
if( p.darIdentificador( ).equals( pIdNodo ) )
{
listNodos.setSelectedIndex( i );
break;
}
}
}
}
/**
* Selecciona el nodo con el identificador dado.<br>
* <b>pre: </b> El árbol está inicializado.
* @param pIdNodo Identificador del nodo. pIdNodo != null && pIdNodo != "".
*/
public void seleccionarNodo( String pIdNodo )
{
seleccionarNodoArbol( pIdNodo );
seleccionarNodoLista( pIdNodo );
}
/**
* Retorna el nodo del jtree que contiene el nodo almacén con el identificador dado.
* @param pIdNodo Identificador del nodo. pIdNodo != null && pIdNodo != "".
* @return Nodo del jtree que contiene el nodo almacén con el identificador dado o null si no existe.
*/
private DefaultMutableTreeNode buscar( String pIdNodo )
{
@SuppressWarnings("unchecked")
Enumeration<DefaultMutableTreeNode> e = raizJtree.depthFirstEnumeration( );
while( e.hasMoreElements( ) )
{
DefaultMutableTreeNode nodoJtree = e.nextElement( );
NodoAlmacen nodoAlmacen = ( NodoAlmacen )nodoJtree.getUserObject( );
if( nodoAlmacen.darIdentificador( ).equalsIgnoreCase( pIdNodo ) )
{
return nodoJtree;
}
}
return null;
}
/**
* Manejo de eventos del usuario.
* @param pEvento Evento de usuario. pEvento != null.
*/
@Override
public void actionPerformed( ActionEvent pEvento )
{
String comando = pEvento.getActionCommand( );
switch( comando )
{
case AGREGAR:
principal.agregarNodo( );
break;
case ELIMINAR:
principal.eliminarNodo( darIdSeleccionado( ) );
break;
case VISTA:
String idSeleccionado = darIdSeleccionado( );
String vista = ( String )cbVerComo.getSelectedItem( );
if( vista.equals( VER_ARBOL ) )
{
spNodos.setViewportView( tree );
}
else
{
listNodos = new JList<>( ( vista.equals( VER_PREORDEN ) ? categoriaRaiz.darPreorden( ) : categoriaRaiz.darPosorden( ) ).toArray( ) );
listNodos.addListSelectionListener( this );
spNodos.setViewportView( listNodos );
}
seleccionarNodo( idSeleccionado );
break;
}
}
/**
* Maneja la acción cuando se selecciona un nodo.
* @param pNodo Nodo seleccionado. pNodo != null.
*/
private void nodoSeleccionadoAccion( NodoAlmacen pNodo )
{
principal.actualizarInformacionNodo( pNodo.darIdentificador( ) );
if( pNodo instanceof Marca )
{
btnAgregar.setEnabled( false );
}
else
{
btnAgregar.setEnabled( true );
}
}
/**
* Manejo de eventos del JTree.
* @param pEvento Evento de usuario. pEvento != null.
*/
@Override
public void valueChanged( TreeSelectionEvent pEvento )
{
DefaultMutableTreeNode treeNode = ( DefaultMutableTreeNode )pEvento.getPath( ).getLastPathComponent( );
NodoAlmacen nodoAlmacen = ( NodoAlmacen )treeNode.getUserObject( );
seleccionarNodoLista( nodoAlmacen.darIdentificador( ) );
nodoSeleccionadoAccion( nodoAlmacen );
}
/**
* Manejo del evento del usuario al seleccionar un producto de la lista.
* @param pEvento Evento generado. pEvento != null.
*/
@Override
public void valueChanged( ListSelectionEvent pEvento )
{
NodoAlmacen nodoAlmacen = ( NodoAlmacen )listNodos.getSelectedValue( );
seleccionarNodoArbol( nodoAlmacen.darIdentificador( ) );
nodoSeleccionadoAccion( nodoAlmacen );
}
}
| [
"dg.fonseca@uniandes.edu.co"
] | dg.fonseca@uniandes.edu.co |
c1c91918624cb61ac08ee840f7d957adcdc7c8bb | 4688d19282b2b3b46fc7911d5d67eac0e87bbe24 | /aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/InvalidInputException.java | 2296f318ac7d7254852b3c7ce67485f13ac01454 | [
"Apache-2.0"
] | permissive | emilva/aws-sdk-java | c123009b816963a8dc86469405b7e687602579ba | 8fdbdbacdb289fdc0ede057015722b8f7a0d89dc | refs/heads/master | 2021-05-13T17:39:35.101322 | 2018-12-12T13:11:42 | 2018-12-12T13:11:42 | 116,821,450 | 1 | 0 | Apache-2.0 | 2018-09-19T04:17:41 | 2018-01-09T13:45:39 | Java | UTF-8 | Java | false | false | 1,226 | java | /*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.codedeploy.model;
import javax.annotation.Generated;
/**
* <p>
* The specified input was specified in an invalid format.
* </p>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class InvalidInputException extends com.amazonaws.services.codedeploy.model.AmazonCodeDeployException {
private static final long serialVersionUID = 1L;
/**
* Constructs a new InvalidInputException with the specified error message.
*
* @param message
* Describes the error encountered.
*/
public InvalidInputException(String message) {
super(message);
}
}
| [
""
] | |
5ff7f631a93da7ae80d04d4642a57bb832778535 | 6386a4958a4991159c20f0574d80ec2c65fd04b4 | /src/main/java/model/trainerDetails.java | b6d50d8217cc92c2394cad1ff63034051cc6bee2 | [] | no_license | calenPillay/ImmutableDomainClasses | e1a359e0088e6542df758706835b616264e562e0 | 87155a799ee763e1458d2f4191497964388d72e6 | refs/heads/master | 2021-01-21T11:39:48.077479 | 2014-04-26T13:10:49 | 2014-04-26T13:10:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | 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 model;
/**
* In the world of Pokemon, trainers are people who catch and train pokemon for battle
* @author Calen
*/
public interface trainerDetails
{
public String trainerProperties(String name, String surname, int age);
}
| [
"calen.pillay@gmail.com"
] | calen.pillay@gmail.com |
bacacfa8bf97876edaa7cf24082015064a1f34c1 | 5d1912ffff01ba60ac6eb2a51b1d74411fd611bf | /src/main/java/edu/jhu/fcriscu1/functionaljava/database/ConnectionService.java | 6f877b6d794e472fd221527d3d17ec0cd9597a01 | [] | no_license | fcriscuo/derive4jpoc | 142952366e9673f8176f56d36fd734f3c51beb7a | c3d8d6367d127b0a402dbb3ab7ec1671ae3044af | refs/heads/master | 2021-01-10T12:13:11.020388 | 2015-11-16T18:39:38 | 2015-11-16T18:39:38 | 44,915,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,266 | java | package edu.jhu.fcriscu1.functionaljava.database;
import fj.data.Option;
import org.apache.log4j.Logger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* Copyright (c) 2015 Memorial Sloan-Kettering Cancer Center.
* <p>
* This library 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. The software and
* documentation provided hereunder is on an "as is" basis, and
* Memorial Sloan-Kettering Cancer Center
* has no obligations to provide maintenance, support,
* updates, enhancements or modifications. In no event shall
* Memorial Sloan-Kettering Cancer Center
* be liable to any party for direct, indirect, special,
* incidental or consequential damages, including lost profits, arising
* out of the use of this software and its documentation, even if
* Memorial Sloan-Kettering Cancer Center
* has been advised of the possibility of such damage.
* <p>
* Created by Fred Criscuolo on 8/5/15.
* criscuof@mskcc.org
*/
public enum ConnectionService
{
INSTANCE;
private static final Logger logger = Logger.getLogger(ConnectionService.class);
public Option<Connection> getCbioConnection (){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
logger.error("Failed to locate MySQL JDBC Driver?");
e.printStackTrace();
return Option.none();
}
Connection connection = null;
try {
connection = DriverManager
.getConnection("jdbc:mysql://localhost:3306/cgds_mskimpact", "criscuof", "fred3372");
return Option.some(connection);
} catch (SQLException e) {
logger.error(e.getMessage());
e.printStackTrace();
return Option.none();
}
}
public static void main (String...args){
Option<Connection> connOpt = ConnectionService.INSTANCE.getCbioConnection();
if(connOpt.isSome()){
logger.info("Obtained connection to local cbio");
} else {
logger.info("Failed to connect to local cbio");
}
}
}
| [
"fjcriscuolo@ucsd.edu"
] | fjcriscuolo@ucsd.edu |
9a063eaf6dae59e07ec9ac3cb45d8e4f09053e2c | ac36eceeb5d1fad485d9da47baff030ca082ee6c | /src/main/java/com/hua/graduation/entity/Search/UserLoginSearch.java | f1b8d0ce14fd7ef31bb4416c611554f9255f71a4 | [] | no_license | guima09634/graduation_back | c4d2011b0d955dcef194c0d7e961051c46dc63ff | 02d5390a0fb816a73ad5b22a8617f89b35c01e70 | refs/heads/master | 2020-05-07T13:17:48.321564 | 2019-05-05T08:05:10 | 2019-05-05T08:05:10 | 180,543,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package com.hua.graduation.entity.Search;
/**
* 用户登录查找类;
* @author Daniel
*/
public class UserLoginSearch extends BaseSearch {
private String userId;
private String startTime;
private String endTime;
private String platform;
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public void setUserId(String userId) {
this.userId = userId;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getEndTime() {
return endTime;
}
public String getStartTime() {
return startTime;
}
public String getUserId() {
return userId;
}
public String getPlatform() {
return platform;
}
}
| [
"1339324606@qq.com"
] | 1339324606@qq.com |
55ee9492657acc7d2894e0c4b227ceae5049e030 | 5c70c45597ce67f2b41ba0610a243388bec04e66 | /New folder/land-api/src/main/test/com/objectfrontier/land/service/TopicServcieImplTest.java | a8323c627a544c2b84fa1f04712af5c8c241dd00 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | codesinblood/land | ecd96f3c008951b20c532843ebc216052000ad9e | 180f73803b4052cf94fd42f03407a423e6dddba4 | refs/heads/master | 2020-05-04T15:04:08.400796 | 2019-04-03T06:44:08 | 2019-04-03T06:44:08 | 179,222,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,862 | java | package com.objectfrontier.land.service;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.objectfrontier.land.common.exception.ResourceNotFoundException;
import com.objectfrontier.land.model.Evaluation;
import com.objectfrontier.land.model.EvaluationParam;
import com.objectfrontier.land.model.Exercise;
import com.objectfrontier.land.model.OnlineTest;
import com.objectfrontier.land.model.Reference;
import com.objectfrontier.land.model.Media;
import com.objectfrontier.land.model.Subtopic;
import com.objectfrontier.land.model.Topic;
import com.objectfrontier.land.repository.TopicRepository;
import com.objectfrontier.land.service.impl.TopicServiceImpl;
public class TopicServcieImplTest {
@Mock
private TopicRepository topicRepoMock;
@InjectMocks
private TopicServiceImpl topicServiceImplMock;
private Topic expectedTopic;
private Topic actualTopic;
private Media media;
private long id;
private List<Subtopic> subtopics;
private Subtopic subtopic;
private List<OnlineTest> onlineTests;
private OnlineTest onlineTest;
private List<Reference> references;
private Reference reference;
private List<Exercise> exercises;
private Exercise exercise;
private List<Evaluation> evaluations;
private Evaluation evaluation;
private List<EvaluationParam> evaluationParams;
private EvaluationParam evaluationParam;
@BeforeClass
public void setup() {
media = new Media();
media.setUrl("C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg");
media.setType("image");
media.setName("Desert");
subtopics = new ArrayList<>();
subtopic = new Subtopic();
subtopic.setDescription("basic java");
subtopic.setFastrackDuration(new Time(System.currentTimeMillis()));
subtopic.setFulltrackDuration(new Time(System.currentTimeMillis()));
subtopic.setMedia(media);
subtopics.add(subtopic);
onlineTests = new ArrayList<>();
onlineTest = new OnlineTest();
onlineTest.setDescription("Test 1");
onlineTest.setPassPercentage(60.00);
onlineTest.setFastrackDuration(new Time(System.currentTimeMillis()));
onlineTest.setFulltrackDuration(new Time(System.currentTimeMillis()));
onlineTest.setFastrackMaxAttempt(3);
onlineTest.setFulltrackMaxAttempt(5);
onlineTests.add(onlineTest);
references = new ArrayList<>();
reference = new Reference();
reference.setDescription("reference for java");
reference.setLink("D:/temp");
references.add(reference);
exercises = new ArrayList<>();
exercise = new Exercise();
exercise.setName("java exercise");
exercise.setDescription("exercise for basic java");
exercise.setMedia(media);
exercise.setFastrackDuration(new Time(System.currentTimeMillis()));
exercise.setFulltrackDuration(new Time(System.currentTimeMillis()));
exercise.setReviewFastrackDuration(new Time(System.currentTimeMillis()));
exercise.setReviewFulltrackDuration(new Time(System.currentTimeMillis()));
exercise.setRecapFastrack(new Time(System.currentTimeMillis()));
exercise.setRecapFulltrack(new Time(System.currentTimeMillis()));
exercises.add(exercise);
evaluations = new ArrayList<>();
evaluation = new Evaluation();
evaluation.setMaxAttempt(5);
evaluation.setPassCriteria(60);
evaluation.setFastrackRecapDuration(new Time(System.currentTimeMillis()));
evaluation.setFastrackReviewDuration(new Time(System.currentTimeMillis()));
evaluation.setFulltrackRecapDuration(new Time(System.currentTimeMillis()));
evaluation.setFulltrackReviewDuration(new Time(System.currentTimeMillis()));
evaluations.add(evaluation);
evaluationParams = new ArrayList<>();
evaluationParam = new EvaluationParam();
evaluationParam.setParam("setting param");
evaluationParam.setDescription("evaluation param");
evaluationParam.setWeightage(80.00);
evaluationParam.setMarMark(70);
evaluationParams.add(evaluationParam);
expectedTopic = new Topic();
expectedTopic.setName("Java");
expectedTopic.setDescription("Basics of java");
expectedTopic.setDisplayOrder(1);
expectedTopic.setSubTopics(subtopics);
expectedTopic.setOnlineTests(onlineTests);
expectedTopic.setReferences(references);
expectedTopic.setExercises(exercises);
expectedTopic.setEvaluations(evaluations);
expectedTopic.setEvaluationParams(evaluationParams);
actualTopic = new Topic();
actualTopic.setId(1);
actualTopic.setName("Java");
actualTopic.setDescription("Basics of java");
actualTopic.setDisplayOrder(1);
actualTopic.setSubTopics(subtopics);
actualTopic.setOnlineTests(onlineTests);
actualTopic.setReferences(references);
actualTopic.setExercises(exercises);
actualTopic.setEvaluations(evaluations);
actualTopic.setEvaluationParams(evaluationParams);
id = 1;
MockitoAnnotations.initMocks(this);
}
@Test
public void testCreatePositive() {
when(topicRepoMock.save(actualTopic)).thenReturn(expectedTopic);
assertEquals((topicServiceImplMock.create(actualTopic)).toString(), expectedTopic.toString());
}
@Test
public void testReadPositive() {
when(topicRepoMock.findById(id)).thenReturn(Optional.of(expectedTopic));
assertEquals(topicServiceImplMock.read(id).toString(), expectedTopic.toString());
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testReadNegative() {
when(topicRepoMock.findById(Mockito.any(Long.class))).thenReturn(Optional.ofNullable(null));
topicServiceImplMock.read(1);
}
@Test
public void testUpdatePositive() {
when(topicRepoMock.findById(Mockito.any(Long.class))).thenReturn(Optional.of(expectedTopic));
when(topicRepoMock.save(Mockito.any(Topic.class))).thenReturn(expectedTopic);
assertEquals(topicServiceImplMock.update(actualTopic).toString(), expectedTopic.toString());
}
@Test
public void testDeletePostive() {
doNothing().when(topicRepoMock).deleteById(Mockito.any(Long.class));
topicServiceImplMock.delete(1);
}
}
| [
"narayanan.mani@object-frontier.com"
] | narayanan.mani@object-frontier.com |
ce537cf466c0214503efde4f9e1287355455a595 | 03485bb4f4577f81cb20b76c98bbf863067ec30f | /src/com/company/NetSDK/SDK_CONFIG_CONTROLER.java | 7cf15732003c8ead856de0f6de0f57d305d184ab | [] | no_license | radtek/ssiot | f3e03cfe4032bd41e82d63c37412dbd0fde08df4 | a328e246572b4aa527cfdeda85a4c38a023d7b86 | refs/heads/master | 2020-10-01T03:06:32.797388 | 2016-03-25T09:34:14 | 2016-03-25T09:34:14 | 227,441,239 | 1 | 1 | null | 2019-12-11T19:13:24 | 2019-12-11T19:13:23 | null | GB18030 | Java | false | false | 1,049 | java | package com.company.NetSDK;
import java.io.Serializable;
public class SDK_CONFIG_CONTROLER implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* \if ENGLISH_LANG
* Com attribution
* \else
* 串口属性
* \endif
*/
public SDK_COMM_PROP struComm = new SDK_COMM_PROP();
/**
* \if ENGLISH_LANG
* Controlled light group,light number start from 1,such as[1,3,8,0?-0]present control light number 1,3,8 light
* \else
* 受控灯数组(灯序号从1开始计数,比如[1,3,8,0…0]表示控制序号为1,3,8的灯
* \endif
*/
public byte bLightGroup[] = new byte[FinalVar.SDK_MAX_LIGHT_NUM];
/**
* \if ENGLISH_LANG
* Controller address
* \else
* 控制器地址
* \endif
*/
public byte bDeviceAddr;
/**
* \if ENGLISH_LANG
* Com Type 0:485 COM, 1:232 COM
* \else
* 串口类型 0:485串口, 1:232串口
* \endif
*/
public byte bComPortType;
}
| [
"gejingbo@163.com"
] | gejingbo@163.com |
3bd4ff83d9b565d86ed61623eb2bb96c1e67f470 | 9ee734247827006ed2ef201de7999b6e7dca6390 | /ibm.jdk8/src/javax/xml/ws/handler/HandlerResolver.java | 48cf89f23457e66a803035b1e3d8055dc5491e50 | [
"MIT"
] | permissive | flyzsd/java-code-snippets | 33341764176f9ea4d023eaa75d36fb8be9786b97 | 1202b941ec4686d157fbc8643b65d247c6cd2b27 | refs/heads/master | 2021-01-13T07:48:23.217223 | 2017-06-23T04:45:12 | 2017-06-23T04:45:12 | 95,096,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,637 | java | /*===========================================================================
* Licensed Materials - Property of IBM
* "Restricted Materials of IBM"
*
* IBM SDK, Java(tm) Technology Edition, v8
* (C) Copyright IBM Corp. 2005, 2010. All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*===========================================================================
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.xml.ws.handler;
/**
* <code>HandlerResolver</code> is an interface implemented
* by an application to get control over the handler chain
* set on proxy/dispatch objects at the time of their creation.
* <p>
* A <code>HandlerResolver</code> may be set on a <code>Service</code>
* using the <code>setHandlerResolver</code> method.
* <p>
* When the runtime invokes a <code>HandlerResolver</code>, it will
* pass it a <code>PortInfo</code> object containing information
* about the port that the proxy/dispatch object will be accessing.
*
* @see javax.xml.ws.Service#setHandlerResolver
*
* @since JAX-WS 2.0
**/
public interface HandlerResolver {
/**
* Gets the handler chain for the specified port.
*
* @param portInfo Contains information about the port being accessed.
* @return java.util.List<Handler> chain
**/
public java.util.List<Handler> getHandlerChain(PortInfo portInfo);
}
| [
"zhangshudong@gmail.com"
] | zhangshudong@gmail.com |
5efeeacce5a7fac7205fa042d3ed1d84d42e0f08 | cbcf2bcfe6dde32a750345fc87d0cc4f994d8931 | /src/main/java/edu/cornell/qatarmed/planrnaseq/PlanRNAseq.java | b347392d22c382183b4b3a1d010296b89c8fcf5b | [] | no_license | man4ish/sample_java_project | 6b5d2188507ec16a2e941ff8b3d217d3ac036359 | 44f6641daf239e426b2f20779fc8469fbc245093 | refs/heads/master | 2021-01-13T15:01:20.389982 | 2016-12-12T21:53:34 | 2016-12-12T21:53:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,455 | 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 edu.cornell.qatarmed.planrnaseq;
import com.vaadin.annotations.Title;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author pankajkumar
*/
@Title("PlanRNAseq")
public class PlanRNAseq extends UI {
@Override
protected void init(VaadinRequest request) {
initLayout();
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void initLayout() {
/* Root of the user interface component tree is set */
HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
setContent(splitPanel);
/* Build the component tree */
VerticalLayout leftLayout = new VerticalLayout();
VerticalLayout rightLayout = new VerticalLayout();
splitPanel.addComponent(leftLayout);
splitPanel.addComponent(rightLayout);
//make form asking parameters and add it to leftLaayout
VerticalLayout formLayout = new VerticalLayout();
TextField studyName = new TextField("Name of RNAseq Study");
formLayout.addComponent(studyName);
List replist = new ArrayList();
ComboBox numReplicates = new ComboBox("Replicates", replist);
formLayout.addComponent(numReplicates);
leftLayout.addComponent(formLayout);
/* Set the contents in the left of the split panel to use all the space */
leftLayout.setSizeFull();
VerticalLayout resultLayout = new VerticalLayout();
rightLayout.addComponent(resultLayout);
VerticalLayout chartLayout = new VerticalLayout();
rightLayout.addComponent(chartLayout);
chartLayout.setVisible(false);
}
}
| [
"mandecent.gupta@gmail.com"
] | mandecent.gupta@gmail.com |
577a2d7714d087757e8dffbc4ad7594d2b3e74c5 | f765c281ddd0db12c7cfe2bebda0652736bc33fc | /wudianzong/app/src/androidTest/java/com/sdwfvc/android/wudianzong/ExampleInstrumentedTest.java | 094d46a498525391fe75dfdefbb40360f44ce4bc | [] | no_license | Me-to/Android1 | dca4eb637195498259fc73902e0afb5eccaafd0d | 596d56907daf30f349acf9c2fc17aa77cd52ad7b | refs/heads/master | 2022-04-10T15:35:32.479348 | 2020-03-29T18:03:39 | 2020-03-29T18:03:39 | 251,090,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package com.sdwfvc.android.wudianzong;
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.sdwfvc.android.wudianzong", appContext.getPackageName());
}
}
| [
"694656210@qq.com"
] | 694656210@qq.com |
eb5e3d1a4fab7820c8d9f8e15729fa091b04a618 | f689529f010c7a1b8a3efa9df62a589cfcdf8951 | /src/main/java/com/honda/am/cqp/dto/WarrantyReportsDto.java | 7158c6816bd6f9482f3b3d464923a2ff6ce02cbb | [] | no_license | cqpwrp/CQP_SpringBoot | a074a98bf96b970f681d71b3a2c909173c677eac | 1965e60b78a3bec7f338e53f14cc19ce0ed9f609 | refs/heads/main | 2023-09-04T20:29:40.720967 | 2021-10-27T12:47:13 | 2021-10-27T12:47:13 | 428,919,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package com.honda.am.cqp.dto;
import java.util.ArrayList;
import java.util.List;
public class WarrantyReportsDto {
String modelfactory;
String check;
Integer rplQuantity;
public String getCheck() {
return check;
}
public void setCheck(String check) {
this.check = check;
}
public Integer getRplQuantity() {
return rplQuantity;
}
public void setRplQuantity(Integer rplQuantity) {
this.rplQuantity = rplQuantity;
}
List<Integer> data = new ArrayList<Integer>();
List<String> label = new ArrayList<String>();
String part;
public String getPart() {
return part;
}
public void setPart(String part) {
this.part = part;
}
public List<String> getLabel() {
return label;
}
public void setLabel(List<String> label) {
this.label = label;
}
public String getModelfactory() {
return modelfactory;
}
public void setModelfactory(String modelfactory) {
this.modelfactory = modelfactory;
}
public List<Integer> getData() {
return data;
}
public void setData(List<Integer> data) {
this.data = data;
}
}
| [
"naveen.annadurai@lntinfotech.com"
] | naveen.annadurai@lntinfotech.com |
10f1e4d0953b9f898e20815bbc420bc7d49fd45a | 8060413d5d6e9d8e8dc108580ff22b888aa4fdaf | /client/src/main/java/com/example/client/model/Bullet.java | 7dd198f8c7a5b9899d00a6495ed5fbab377ed27e | [] | no_license | ilkyazar/alien-shooter-game | fbcfd26c76db6a84adb9dd15197deb507ff3e90f | 20915d308701b00afe50379fcd7f8a1a9ebcbb9d | refs/heads/master | 2023-04-06T10:33:53.507370 | 2020-07-07T12:37:42 | 2020-07-07T12:37:42 | 277,804,205 | 1 | 0 | null | 2021-04-26T20:27:22 | 2020-07-07T11:59:57 | Java | UTF-8 | Java | false | false | 8,325 | java | package com.example.client.model;
import com.example.client.constants.GameConstants;
import com.example.client.controller.GameEngine;
import com.example.client.view.GameView;
import javafx.scene.shape.Polygon;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.util.Duration;
import javafx.animation.Animation;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* This is the Bullet class.
* This class is common for aliens and players
* Damage and speed changes accordingly.
* For each bullet, collision check is made in check hit function.
* Check hit function controls if player is shot or any of the aliens are shot,
* and updates the scores and healths accordingly.
*/
public class Bullet {
private int damage;
private double bulletSpeed;
private Polygon bullet;
private Timeline moveBullet;
private boolean isPlayer;
private int playerNo = 1;
public Bullet(double x, double y, boolean isPlayer) {
this.bulletSpeed = GameConstants.BULLETSPEED;
this.isPlayer = isPlayer;
this.bullet = new Polygon();
if (isPlayer) {
bullet.getPoints().addAll(GameConstants.PLAYER_BULLET_SHAPE);
bullet.setTranslateX(x + 45);
bullet.setTranslateY(y - 30);
bullet.setFill(GameConstants.PLAYER_BULLET_COLOR);
this.damage = GameConstants.PLAYER_BULLET_DAMAGE;
}
else {
bullet.getPoints().addAll(GameConstants.ENEMY_BULLET_SHAPE);
bullet.setTranslateX(x + 25);
bullet.setTranslateY(y + 50);
List<Alien> aliens = GameEngine.getAliens();
if (aliens.size() > 0 && aliens.get(aliens.size() - 1).getType() == 4) {
bullet.setTranslateX(x + 260);
bullet.setTranslateY(y + 420);
}
bullet.setFill(GameConstants.ENEMY_BULLET_COLOR);
this.damage = GameConstants.ENEMY_LEVEL1_DAMAGE;
}
}
public void createBullet(int dir) {
if (GameEngine.player.isAlive()) {
moveBullet = new Timeline(
new KeyFrame(Duration.millis(this.bulletSpeed), e -> {
bullet.setTranslateY(bullet.getTranslateY() + dir);
checkHit();
})
);
moveBullet.setCycleCount(Animation.INDEFINITE);
GameView.gamePane.getChildren().add(bullet);
moveBullet.play();
}
}
boolean inRangeX(double x, double other_x, int type) {
int r = 60;
if (type == 3) r = 30;
if (type != 4) {
if (x < other_x + r && other_x - r < x)
return true;
else
return false;
}
else {
if (x < other_x + 500 && other_x < x)
return true;
else
return false;
}
}
boolean inRangeY(double x, double other_x, int type) {
int r = 60;
if (type == 2) r = 20;
if (type == 3) r = 30;
if (type == 4) r = 100;
if (type != 4) {
if (x < other_x + r && other_x - r < x)
return true;
else
return false;
}
else {
if (x < other_x + 500 && other_x < x)
return true;
else
return false;
}
}
void stopMoveBullet() {
this.moveBullet.stop();
}
void checkHit() {
if (this.playerNo == 1
&& GameEngine.player2.isAlive() && GameEngine.player.isAlive()
&& !GameEngine.isWaitingPage
&& GameView.levelOver == false) {
if (this.isPlayer) {
if((GameEngine.getLevel() == 5 && GameEngine.aliens.get(GameEngine.aliens.size() - 1).isAlive())
|| GameEngine.getLevel() != 5) {
for(Alien alien : GameEngine.getAliens()){
if ( alien.isAlive()
&& inRangeX(this.bullet.getTranslateX(), alien.getAlienShip().getTranslateX(), alien.getType())
&& inRangeY(this.bullet.getTranslateY(), alien.getAlienShip().getTranslateY(), alien.getType())) {
alien.setHealth(this.damage, true);
System.out.println("Alien (type " + alien.getType() + ") damaged: -" + this.damage);
this.stopMoveBullet();
GameView.gamePane.getChildren().remove(bullet);
int newScore = GameEngine.player.getScore() + 10;
GameEngine.player.setScore(newScore);
GameView.updateScoreLabel(newScore);
System.out.println("Score of player: "+ GameEngine.player.getScore());
if (alien.isAlive() == false) {
int inc = 10;
int type = alien.getType();
if (type == 2) inc = 20;
else if (type == 3) inc = 30;
else if (type == 4) inc = 40;
newScore = GameEngine.player.getScore() + inc;
GameEngine.player.setScore(newScore);
GameView.updateScoreLabel(newScore);
System.out.println("ALIEN (type " + alien.getType() + ") IS DEAD!");
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = new Date();
System.out.println(formatter.format(date));
System.out.println("Score of player: "+ GameEngine.player.getScore());
}
}
}
}
}
else {
if((GameEngine.getLevel() == 5 && GameEngine.aliens.get(GameEngine.aliens.size() - 1).isAlive())
|| GameEngine.getLevel() != 5) {
if (inRangeX(this.bullet.getTranslateX(), GameEngine.player.getShip().getTranslateX(), 0)
&& inRangeY(this.bullet.getTranslateY(), GameEngine.player.getShip().getTranslateY(), 0)) {
GameEngine.player.setHealth(this.damage, true);
System.out.println("Player damaged: -" + this.damage);
int newScore = GameEngine.player.getScore() - 10;
if(newScore >= 0){
GameEngine.player.setScore(newScore);
GameView.updateScoreLabel(newScore);
}
System.out.println("Score of player: "+ GameEngine.player.getScore());
GameView.gamePane.getChildren().remove(bullet);
GameView.updateHealthLabel(GameEngine.player.getHealth());
if (GameEngine.player.isAlive() == false) {
System.out.println("PLAYER IS DEAD!");
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = new Date();
System.out.println(formatter.format(date));
System.out.println("Score of player: "+ GameEngine.player.getScore());
}
}
}
}
}
}
public void setPlayerNo(int no){
this.playerNo = no;
}
public int getPlayerNo(){
return this.playerNo;
}
}
| [
"ilkyaz.arabaci@gmail.com"
] | ilkyaz.arabaci@gmail.com |
2d2f4bedaaf4829f43ef59fc33675925386daaa0 | fba8af31d5d36d8a6cf0c341faed98b6cd5ec0cb | /src/main/java/com/alipay/api/response/KoubeiCraftsmanDataWorkBatchqueryResponse.java | c44a6d77db60c5440a006735a8925faa3bf6aa5a | [
"Apache-2.0"
] | permissive | planesweep/alipay-sdk-java-all | b60ea1437e3377582bd08c61f942018891ce7762 | 637edbcc5ed137c2b55064521f24b675c3080e37 | refs/heads/master | 2020-12-12T09:23:19.133661 | 2020-01-09T11:04:31 | 2020-01-09T11:04:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,863 | java | package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.CraftsmanWorkOpenModel;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.craftsman.data.work.batchquery response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class KoubeiCraftsmanDataWorkBatchqueryResponse extends AlipayResponse {
private static final long serialVersionUID = 2856596661133558585L;
/**
* 当前页码
*/
@ApiField("current_page_no")
private Long currentPageNo;
/**
* 每页记录数
*/
@ApiField("page_size")
private Long pageSize;
/**
* 总页码数目
*/
@ApiField("total_page_no")
private Long totalPageNo;
/**
* 总共手艺人作品数目
*/
@ApiField("total_works")
private Long totalWorks;
/**
* 作品信息列表
*/
@ApiListField("works")
@ApiField("craftsman_work_open_model")
private List<CraftsmanWorkOpenModel> works;
public void setCurrentPageNo(Long currentPageNo) {
this.currentPageNo = currentPageNo;
}
public Long getCurrentPageNo( ) {
return this.currentPageNo;
}
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
public Long getPageSize( ) {
return this.pageSize;
}
public void setTotalPageNo(Long totalPageNo) {
this.totalPageNo = totalPageNo;
}
public Long getTotalPageNo( ) {
return this.totalPageNo;
}
public void setTotalWorks(Long totalWorks) {
this.totalWorks = totalWorks;
}
public Long getTotalWorks( ) {
return this.totalWorks;
}
public void setWorks(List<CraftsmanWorkOpenModel> works) {
this.works = works;
}
public List<CraftsmanWorkOpenModel> getWorks( ) {
return this.works;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
7eb513ec637c2942f113c3cf5fe0cb19ad5aef58 | efdd198dd3c472b25677ddb73fea53722af1c5d2 | /src/main/java/ua/golovchenko/artem/strategy/model/GamePanelAbstract.java | a800f31bbe7e0fa5e1de8cdf70c36c44c484452c | [] | no_license | GolovchenkoA/Stragegy_1 | 9e99201642798972d46a2693223297832ee231cc | 64dce515e48e45365b2275579860c894a8105933 | refs/heads/master | 2021-01-12T16:16:29.685887 | 2017-06-01T06:10:19 | 2017-06-01T06:10:19 | 71,971,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package ua.golovchenko.artem.strategy.model;
import ua.golovchenko.artem.strategy.model.menu.CastleInfo;
import ua.golovchenko.artem.strategy.model.menu.GameMenu;
/**
* Created by art on 24.10.2016.
*/
public abstract class GamePanelAbstract {
CastleInfo castleInfoPanel;
GameMenu gameMenu;
public GamePanelAbstract(CastleInfo castleInfoPanel, GameMenu gameMenu) {
this.castleInfoPanel = castleInfoPanel;
this.gameMenu = gameMenu;
}
}
| [
"golovchenko84@mail.ru"
] | golovchenko84@mail.ru |
c4885b24a9d882739f9850d633afba12466d208b | 82bb408a51e2cb3165be2cab32e24aef75564db6 | /share/src/main/java/com/library/share/ShareManager.java | 5735efea3e765c1baa3a721a7f7c5d0c09f6658d | [] | no_license | xybCoder/MD | 407c14258e8153ed2a2d03a15d88c9a1e0189573 | de2b5216b3573522722c61cab49196fff248eadf | refs/heads/master | 2021-01-09T20:51:39.599448 | 2016-06-17T14:55:43 | 2016-06-17T14:55:43 | 57,883,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,955 | java | package com.library.share;
import android.app.Activity;
import com.library.share.way.BaseShareWay;
import com.library.share.way.MessageShareImpl;
import com.library.share.way.QQShareImpl;
import com.library.share.way.SHARE_MEDIA;
import com.library.share.way.SinaShareImpl;
import com.library.share.way.WeichatShareImpl;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
*
*/
public class ShareManager {
private static Setting setting;
static {
setting = Setting.getInstance();
}
public static Setting init() {
return setting;
}
public static List<BaseShareWay> getShareWay(Activity activity) {
List<BaseShareWay> list = new ArrayList<>();
//如果不设置分享的icon 则使用默认样式的分享图标
if (getShareWayIconMap().isEmpty()) {
for (SHARE_MEDIA item : Setting.getInstance().getShareMedia()) {
switch (item) {
case WEICHAT:
list.add(new WeichatShareImpl(activity, R.mipmap.share_weixin, activity.getString(R.string.title_share_weixin), WeichatShareImpl.SHARE_WEICHAT));
break;
case WEICHATCIRCLE:
list.add(new WeichatShareImpl(activity, R.mipmap.share_momment, activity.getString(R.string.title_share_momment), WeichatShareImpl.SHARE_MOMMENT));
break;
case SINA:
list.add(new SinaShareImpl(activity, R.mipmap.share_sina, activity.getString(R.string.title_share_sina)));
break;
case QQ:
list.add(new QQShareImpl(activity, R.mipmap.share_qq, activity.getString(R.string.title_share_qq), QQShareImpl.SHARE_QQ));
break;
case QQZONE:
list.add(new QQShareImpl(activity, R.mipmap.share_qzeon, activity.getString(R.string.title_share_qzeon), QQShareImpl.SHARE_Qzeon));
break;
case MESSAGE:
list.add(new MessageShareImpl(activity, R.mipmap.share_message, activity.getString(R.string.title_share_message)));
break;
default:
break;
}
}
} else {//自定义了图标
LinkedHashMap<SHARE_MEDIA, Integer> iconMap = getShareWayIconMap();
for (SHARE_MEDIA item : Setting.getInstance().getShareMedia()) {
switch (item) {
case WEICHAT:
list.add(new WeichatShareImpl(activity, iconMap.get(SHARE_MEDIA.WEICHAT), activity.getString(R.string.title_share_weixin), WeichatShareImpl.SHARE_WEICHAT));
break;
case WEICHATCIRCLE:
list.add(new WeichatShareImpl(activity, iconMap.get(SHARE_MEDIA.WEICHATCIRCLE), activity.getString(R.string.title_share_momment), WeichatShareImpl.SHARE_MOMMENT));
break;
case SINA:
list.add(new SinaShareImpl(activity, iconMap.get(SHARE_MEDIA.SINA), activity.getString(R.string.title_share_sina)));
break;
case QQ:
list.add(new QQShareImpl(activity, iconMap.get(SHARE_MEDIA.QQ), activity.getString(R.string.title_share_qq), QQShareImpl.SHARE_QQ));
break;
case QQZONE:
list.add(new QQShareImpl(activity, iconMap.get(SHARE_MEDIA.QQZONE), activity.getString(R.string.title_share_qzeon), QQShareImpl.SHARE_Qzeon));
break;
case MESSAGE:
list.add(new MessageShareImpl(activity, iconMap.get(SHARE_MEDIA.MESSAGE), activity.getString(R.string.title_share_message)));
break;
default:
break;
}
}
}
return list;
}
public static String getQQAppId() {
return setting.getQQAppId();
}
public static String getWechatAppId() {
return setting.getWechatAppId();
}
public static String getWeiboAppId() {
return setting.getWeiboAppId();
}
public static String getAppName() {
return setting.getAppName();
}
public static String getDefShareImageUrl() {
return setting.getDefShareImageUrl();
}
public static int getDefShareImageUrlId() {
return setting.getDefShareImageUrlId();
}
public static String getSinaRedirectUrl() {
return setting.getSinaRedirectUrl();
}
public static String getScope() {
return setting.getScope();
}
public static LinkedHashMap<SHARE_MEDIA, Integer> getShareWayIconMap() {
return setting.getShareWayIconMap();
}
}
| [
"xyb520zly@gmail.com"
] | xyb520zly@gmail.com |
7ee23a00b8c5ec33f02867a43f3b4d57fc678efe | 416a6c447091e565693543cf244a84ebf74ac06d | /app/src/main/java/com/weather/kingtous/weatherreport/MainWindow.java | 7ef6c36c73b136626d595b34b9f291ff51d16b0f | [] | no_license | Kingtous/WeatherReport-Demo | 8457fe61b872f6e713def3942f584bb9a92db65d | 43ba4abf2be1bcb5ca90bd455b2f6591115d037b | refs/heads/master | 2020-04-20T18:06:25.681836 | 2019-02-11T14:02:58 | 2019-02-11T14:02:58 | 169,008,639 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,627 | java | package com.weather.kingtous.weatherreport;
import android.Manifest;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import com.weather.kingtous.weatherreport.LocationProvider.LocationFinder;
import com.weather.kingtous.weatherreport.LocationProvider.LocationList;
import com.weather.kingtous.weatherreport.WeatherRequest.Query;
import com.weather.kingtous.weatherreport.WeatherRequest.WeatherShower;
import com.weather.kingtous.weatherreport.WeatherStructure.WeatherTotal;
import java.util.List;
public class MainWindow extends AppCompatActivity implements EasyPermissions.PermissionCallbacks{
//ui
Query query;
MenuItem about;
Button QueryButton;
Button LocateButton;
Button CityListButton;
EditText cityText;
Toolbar toolbar;
//RequestCode
int CITY_SELECT_CODE =2;
int LOCATE_CODE=1;
int GPS_PERMISSION_CODE=1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_window);
//Intialize
query=new Query();
about = findViewById(R.id.about);
QueryButton=findViewById(R.id.QueryButton);
LocateButton=findViewById(R.id.Locate);
CityListButton=findViewById(R.id.CityList);
cityText=findViewById(R.id.CityText);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
QueryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
WeatherTotal weather=query.Query(cityText.getText().toString());
if (weather.getCity()!=null)
{
//查询成功
Intent intent=new Intent(MainWindow.this, WeatherShower.class);
intent.putExtra("Weather",new Gson().toJson(weather));
startActivity(intent);
}
else
{
new AlertDialog.Builder(MainWindow.this).setTitle("输入名称有误.")
.setPositiveButton("好",null)
.show();
}
Looper.loop();
}
}).start();
}
});
LocateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocateTask task=new LocateTask();
task.execute();
}
});
CityListButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainWindow.this, LocationList.class);
startActivityForResult(intent,CITY_SELECT_CODE);
}
});
getPermission();
}
private void getPermission()
{
//检查权限
if (!EasyPermissions.hasPermissions(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
String[] permissions={Manifest.permission.ACCESS_FINE_LOCATION};
EasyPermissions.requestPermissions(MainWindow.this,"为了不影响您的使用,请允许应用申请相应权限.",GPS_PERMISSION_CODE,permissions);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main_window, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.about) {
//关于
TextView view=new TextView(this);
SpannableString s=new SpannableString(" 天气预报Demo\n 作者:Kingtous\n 项目地址:\n https://github.com/Kingtous/WeatherReport-Demo");
Linkify.addLinks(s,Linkify.WEB_URLS);
view.setText(s);
view.setMovementMethod(LinkMovementMethod.getInstance());
new AlertDialog.Builder(MainWindow.this).setTitle("关于")
.setView(view)
.setPositiveButton("好", null)
.show();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==LOCATE_CODE || requestCode==CITY_SELECT_CODE)//定位数据
{
String cityTMP= null;
if (data != null) {
cityTMP = data.getStringExtra("Location");
}
if (cityTMP!=null)
{
cityText.setText(cityTMP);
}
}
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
Toast.makeText(this, "权限授权成功", Toast.LENGTH_SHORT).show();
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
Toast.makeText(this, "权限授权失败", Toast.LENGTH_SHORT).show();
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
new AppSettingsDialog.Builder(this).build().show();
}
finish();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode==GPS_PERMISSION_CODE)
{
EasyPermissions.onRequestPermissionsResult(requestCode,permissions,grantResults,this);
}
}
private class LocateTask extends AsyncTask<Void,Void,Void>
{
ProgressDialog dialog=new ProgressDialog(MainWindow.this);
@Override
protected void onPreExecute() {
dialog.setMessage("正在定位");
dialog.show();
}
@Override
protected Void doInBackground(Void... voids) {
Intent intent=new Intent(MainWindow.this,LocationFinder.class);
startActivityForResult(intent,LOCATE_CODE);
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
dialog.dismiss();
}
}
}
| [
"kingtous@qq.com"
] | kingtous@qq.com |
cead0ba69cce40fd274527d33b287bab25d30580 | 7acb2210bb0c6a630dd766dfb8d7ab824f1e09eb | /backend/danim-back/src/main/java/com/pd/danim/Service/SMTPServiceImpl.java | cfdc4daa841869dedb27ccc162f3aa67e4723fed | [
"MIT"
] | permissive | munimun/danim-react-spring-boot | c1d007dad09a1edf25d516d74dcc1ea9d684a3c0 | 4dc02d289b9a499bd0c68dc1326c03a6e77fab4f | refs/heads/master | 2023-07-18T15:02:20.174557 | 2021-09-03T13:39:09 | 2021-09-03T13:39:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.pd.danim.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class SMTPServiceImpl implements SMTPService {
@Autowired
private JavaMailSender emailSender;
@Async
@Override
public void sendMail(String to, String sub, String text) {
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(to);
message.setSubject(sub);
message.setText(text);
emailSender.send(message);
}
}
| [
"shining8543@naver.com"
] | shining8543@naver.com |
55d382bd0e5e154c24acacc1ce6e3406e6db8a0f | af280e5d529695c86e05dc22e10d4aa85ef8af45 | /app/src/main/java/com/bfurns/activity/AddDoctorActivity.java | 6e95e1442306cee7aa7e319d14d4f270cd504d9c | [] | no_license | Dummyurl/DoctorApp- | 9ef88e153f96efb55573bad55b1106c2874ec3ae | bb21ddc3e7be935499a76688b0c7b7697560dc4a | refs/heads/master | 2020-04-10T01:04:41.785249 | 2018-03-12T09:45:10 | 2018-03-12T09:45:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,124 | java | package com.bfurns.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.bfurns.R;
import com.bfurns.utility.GetData;
import com.bfurns.utility.MyPreferences;
import com.bfurns.utility.MyUtility;
import com.bfurns.utility.URLListner;
import com.bfurns.utility.Utility;
import com.bfurns.utility.Validations;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Mahesh on 21/08/16.
*/
public class AddDoctorActivity extends AppCompatActivity implements View.OnClickListener {
private Toolbar toolbar;
EditText name,email,contact;
String ename,eemail,econtact;
Button button;
RelativeLayout relativeLayout;
String clinic_id,user_id;
private static final String TAG = AddDoctorActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.doctor_create_profile);
Intent intent = getIntent();
clinic_id = intent.getStringExtra(MyPreferences.CLINIC_ID);
user_id = intent.getStringExtra(MyPreferences.USER_ID);
setUpViews();
}
private void setUpViews() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle("Create Doctor Profile");
button=(Button) findViewById(R.id.create);
name=(EditText) findViewById(R.id.name);
email=(EditText) findViewById(R.id.edt_email);
contact=(EditText) findViewById(R.id.contact);
relativeLayout=(RelativeLayout) findViewById(R.id.rl_loginActivity);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validateDoctor();
}
});
}
private void validateDoctor() {
MyUtility.hideKeyboard(contact,AddDoctorActivity.this);
eemail = email.getText().toString().trim();
econtact = contact.getText().toString().trim();
ename = name.getText().toString().trim();
if (ename.equalsIgnoreCase("")) {
MyUtility.showSnack(relativeLayout, Validations.ENTER_NAME);
}
if (eemail.equalsIgnoreCase("")) {
MyUtility.showSnack(relativeLayout, Validations.ENTER_EMAIL);
} else if (!eemail.matches(MyUtility.emailPattern) ) {
MyUtility.showSnack(relativeLayout, Validations.ENTER_VALID_EMAIL);
} else if (econtact.equalsIgnoreCase("") ) {
MyUtility.showSnack(relativeLayout, Validations.ENTER_MOBILE);
}
else if (econtact.length() < 10) {
MyUtility.showSnack(relativeLayout, Validations.ENTER_VALID_Mobile);
} else if (econtact.length() > 10) {
MyUtility.showSnack(relativeLayout, Validations.ENTER_VALID_Mobile);
}
else {
if(MyUtility.isConnected(this)){
CallApi();
}else{
MyUtility.showSnack(relativeLayout,MyUtility.INTERNET_ERROR);
}
}
}
private void CallApi() {
Utility.showProgressDialog(this, "Please wait..");
Utility.progressDialog.show();
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("doct_name", ename));
params.add(new BasicNameValuePair("doct_phone", econtact));
params.add(new BasicNameValuePair("doct_email", eemail));
params.add(new BasicNameValuePair("bus_id", clinic_id));
GetData getData = new GetData(params);
getData.setResultListner(new GetData.ResultListner() {
int success = 0;
private String id, clinic_id, username,doctor_id, phone, email1, image, mobileVerify, emailVerify, otp, socialType, socialId;
@Override
public void success(JSONObject jsonObject) {
if (Utility.progressDialog.isShowing()) {
Utility.progressDialog.dismiss();
}
try {
success = jsonObject.getInt("responce");
Log.e(TAG, "Status:" + success);
if (success == 1) {
JSONArray arr = jsonObject.getJSONArray("doctor");
for (int i = 0; i < arr.length(); i++) {
JSONObject json = arr.getJSONObject(i);
id = json.getString("doct_id");
username = json.getString("doct_name");
email1 = json.getString("doct_email");
clinic_id = json.getString("bus_id");
}
SharedPreferences sharedPreferences = getSharedPreferences(MyPreferences.My_PREFRENCES, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(MyPreferences.USER_ID, id);
editor.putString(MyPreferences.CLINIC_ID, clinic_id);
editor.putString(MyPreferences.DOCTOR_ID, doctor_id);
editor.putString(MyPreferences.USER_EMAIL, email1);
editor.putString(MyPreferences.USER_PHONE, phone);
editor.putString(MyPreferences.USER_IMAGE, image);
editor.commit();
if (!MyPreferences.CLINIC_ID.isEmpty()) {
finish();
Utility.showSnackbar(relativeLayout, getString(R.string.success));
// clearFields();//.....call clear field...
Intent intent = new Intent(AddDoctorActivity.this, StepTwoActivity.class);
intent.putExtra(MyPreferences.USER_ID, user_id);
intent.putExtra(MyPreferences.CLINIC_ID, clinic_id);
intent.putExtra(MyPreferences.DOCTOR_ID, doctor_id);
startActivity(intent);
} else {
Utility.showSnackbar(relativeLayout, "Failed to store this session");
}
}
if (success != 1) {
Utility.showSnackbar(relativeLayout, getString(R.string.please_enter_valid_details));
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void fail() {
if (Utility.progressDialog.isShowing()) {
Utility.progressDialog.dismiss();
}
if (success != 1) {
Utility.showSnackbar(relativeLayout, getString(R.string.failed));
}
}
});
getData.execute(URLListner.BASEURL + URLListner.add_doctor);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.add:
finish();
break;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case android.R.id.home:
onBackPressed();
break;
}
return super.onOptionsItemSelected(item);
}
}
| [
"karishmanadaf77@outlook.com"
] | karishmanadaf77@outlook.com |
8e11f4d4746afab28553074f9a55b9ee1188f88b | a38a9085c2f3889814c348d3ffdf107af63152c2 | /app/src/main/java/com/example/coolweather2/service/AutoUpdateService.java | 96ca7d09fbdbe41a3dc2cf69f4c20a57865c4bb7 | [
"Apache-2.0"
] | permissive | niuxunyi/coolweather2 | 1cd9ffb18bb47dc1a4058995153d9e208cc04396 | ad65f8d692681c9e31d5110442526673449fe9fc | refs/heads/master | 2021-01-05T16:35:30.757830 | 2020-02-28T05:04:10 | 2020-02-28T05:04:10 | 241,077,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,160 | java | package com.example.coolweather2.service;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Presentation;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.IBinder;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.widget.Toast;
import com.example.coolweather2.MyApplication;
import com.example.coolweather2.gson.Weather;
import com.example.coolweather2.util.HttpUtil;
import com.example.coolweather2.util.LogUtil;
import com.example.coolweather2.util.Utility;
import java.io.IOException;
import java.util.prefs.PreferenceChangeEvent;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class AutoUpdateService extends Service {
private static final String TAG="AutoUpdateService";
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
updateWeather(); // 更新天气
updateBingPic(); // 更新背景图片
AlarmManager manager = (AlarmManager) getSystemService(ALARM_SERVICE);
int anHour = 8 * 60 * 60 * 1000; // 8小时一共有多少毫秒
//int anHour = 10* 1000; // 8小时一共有多少毫秒
long triggerAtTime = SystemClock.elapsedRealtime() + anHour;
Intent i = new Intent(this, AutoUpdateService.class);
PendingIntent pi = PendingIntent.getService(this, 0, i , 0);
manager.cancel(pi);
manager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, pi);
return super.onStartCommand(intent, flags, startId);
}
/**
* 更新天气信息
*/
private void updateWeather() {
SharedPreferences prefs= PreferenceManager.getDefaultSharedPreferences(this);
String weatherString = prefs.getString("weather", null);
if (weatherString != null) {
// 有缓存时直接解析天气数据
LogUtil.d(TAG,"in AutoUpdateService");
Toast.makeText(getApplicationContext(), "加载呢",Toast.LENGTH_LONG);
Weather weather = Utility.handleWeatherResponse(weatherString);
final String weatherId = weather.basic.weatherId;
String weatherUrl = "http://guolin.tech/api/weather?cityid=" + weatherId + "&key=4b7ad80fa15241acb7d8daee3228df7a";
HttpUtil.sendOkHttpRequest(weatherUrl, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String responseText = response.body().string();
Weather weather = Utility.handleWeatherResponse(responseText);
if (weather != null && "ok".equals(weather.status)) {
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(AutoUpdateService.this).edit();
editor.putString("weather", responseText);
editor.apply();
}
}
});
}
}
/**
* 更新必应每日一图
*/
private void updateBingPic(){
String requestBingPic = "http://guolin.tech/api/bing_pic";
HttpUtil.sendOkHttpRequest(requestBingPic, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String bingPic = response.body().string();
SharedPreferences.Editor editor= PreferenceManager.getDefaultSharedPreferences(AutoUpdateService.this).edit();
editor.putString("bing_pic", bingPic);
editor.apply();
}
});
}
}
| [
"tuslot@gmail.com"
] | tuslot@gmail.com |
411014ed21c3791a138a5af6a8dca3ee5290806d | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/Health_com.huawei.health/javafiles/com/google/android/gms/internal/zzabs.java | 6d5174e3a5328bbc7230f0cf57fa582fc3eedb17 | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.gms.internal;
import com.google.android.gms.common.api.Status;
public interface zzabs
{
public abstract Exception zzA(Status status);
}
| [
"silenta237@gmail.com"
] | silenta237@gmail.com |
f42ca458e861a08e65c6c9ee80e790d966727038 | bb5a73093984431bd342e7faca92ab9900e37431 | /app/src/main/java/com/example/blabla/ui/create/CreateTextViewModelFactory.java | b8a8191390272556bc7d6a214769848976f56490 | [] | no_license | timeakapitany/teleprompter-app-blabla | 544db974df8fe6bacd3a19f85263d432ddcfb6ca | 4179baf26378ddee52a0ff86f6aaf91b3f69fd05 | refs/heads/master | 2020-05-31T04:12:32.910015 | 2019-06-03T23:23:11 | 2019-06-03T23:23:11 | 190,078,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package com.example.blabla.ui.create;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import com.example.blabla.model.TextProject;
class CreateTextViewModelFactory extends ViewModelProvider.NewInstanceFactory {
final TextProject textProject;
public CreateTextViewModelFactory(TextProject textProject) {
this.textProject = textProject;
}
@SuppressWarnings("unchecked")
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
CreateTextViewModel createViewModel = new CreateTextViewModel(textProject);
return (T) createViewModel;
}
}
| [
"kapitanytimea@gmail.com"
] | kapitanytimea@gmail.com |
615aab2a33f6df930ab0aed8f771035655466b5c | 2472dd654a5d4478a746617f96127d30887babe2 | /src/com/ocp_8/chapter03Collections/Test15.java | f4b1c2e71240e97b1d94e6834e2a8c453fca26ae | [] | no_license | kabakan/JCollection | 7451a84d18ddfac18566c50965942350f0737208 | b87ecf1fb32c5ca7321812a3c1b21f7c06dd62ac | refs/heads/master | 2022-11-29T13:47:55.326509 | 2021-09-19T11:21:43 | 2021-09-19T11:21:43 | 137,044,109 | 0 | 0 | null | 2022-11-24T09:20:12 | 2018-06-12T08:52:36 | Java | UTF-8 | Java | false | false | 962 | java | package com.ocp_8.chapter03Collections;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Created by Kanat KB on 11.09.2017.
* <p>
* 15. What is the result of the following code?
* <p>
* 15. D. The list is sorted in descending order. However, it is searched using the default order,
* which is sorted in ascending order. binarySearch() requires both to use the same sort
* order. Therefore, the precondition for binarySearch() is not met and the result is undefined.
* <p>
* A. 0
* B. 1
* C. 2
* D. The result is undefined. ***
* E. The code does not compile.
* F. A runtime exception is thrown.
*/
public class Test15 {
public static void main(String[] args) {
Comparator<Integer> c = (o1, o2) -> o2 - o1;
List<Integer> list = Arrays.asList(5, 4, 7, 1);
Collections.sort(list, c);
System.out.println(Collections.binarySearch(list, 1));
}
}
| [
"kanat.kaba@gmail.com"
] | kanat.kaba@gmail.com |
c50728a544b2e27e7c9082e2bf2363c486fde038 | 2f928b9b02d98a894f2c1f18e8154514ffc69ead | /src/uts/pemesanantiketka/savina31/UTSPemesananTiketKASavina31.java | e04bd1884e305ca0f169d50a3d5b790e7d801bb1 | [] | no_license | savinarp/TiketKeretaApi-UTSPBO | 13b712aeba39aca269794ca4d6c648599016939f | 044fd29615287bb9be8801b313c2bb4749a36564 | refs/heads/master | 2021-01-22T20:29:00.407547 | 2017-03-17T15:42:51 | 2017-03-17T15:42:51 | 85,326,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | 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 uts.pemesanantiketka.savina31;
/**
*
* @author Savina
*/
public class UTSPemesananTiketKASavina31 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
| [
"savputramadhani@gmail.com"
] | savputramadhani@gmail.com |
31c0fa5bee3bc46df38ea6f6dfb7ac80542b4a47 | ea8568898a20e3a8a3c91c72d41ddaf29dcebd75 | /ITC_515_LibraryManagement/Asg3/ITC205_NewLibrary_Java/ITC515_NewLibrary/src/library/interfaces/IMainListener.java | 42102be811db28c7101c71531fcb33d7b4edfac5 | [] | no_license | aamerk2/Code-Debuggers | 66390627c60ecf805452c534086492dd160f29a1 | 2aa57e08ad9737372a1f6db83b43f282aa69d7df | refs/heads/master | 2020-05-21T17:54:36.363975 | 2016-09-19T08:56:48 | 2016-09-19T08:56:48 | 64,348,514 | 1 | 2 | null | 2016-09-19T10:45:00 | 2016-07-27T23:30:47 | Java | UTF-8 | Java | false | false | 94 | java | package library.interfaces;
public interface IMainListener {
public void borrowBooks();
}
| [
"jawwadaamer@gmail.com"
] | jawwadaamer@gmail.com |
04b36c1ece918b32c9a59bf1c166aa7867baf52a | 39e32f672b6ef972ebf36adcb6a0ca899f49a094 | /dcm4chee-dashboard/tags/DCM4CHEE_WEB_3_0_1/dcm4chee-dashboard-ui/src/main/java/org/dcm4chee/dashboard/ui/report/ConfigureReportPage.java | 6d50198fff315cd49a99c1d2c1aea7a02f0c1104 | [
"Apache-2.0"
] | permissive | medicayun/medicayundicom | 6a5812254e1baf88ad3786d1b4cf544821d4ca0b | 47827007f2b3e424a1c47863bcf7d4781e15e814 | refs/heads/master | 2021-01-23T11:20:41.530293 | 2017-06-05T03:11:47 | 2017-06-05T03:11:47 | 93,123,541 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 12,012 | java | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is part of dcm4che, an implementation of DICOM(TM) in
* Java(TM), hosted at http://sourceforge.net/projects/dcm4che.
*
* The Initial Developer of the Original Code is
* Agfa-Gevaert AG.
* Portions created by the Initial Developer are Copyright (C) 2002-2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* See listed authors below.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.dcm4chee.dashboard.ui.report;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MalformedObjectNameException;
import javax.management.ReflectionException;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.yui.calendar.DatePicker;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.resources.CompressedResourceReference;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.security.components.SecureWebPage;
import org.dcm4chee.dashboard.model.ReportModel;
import org.dcm4chee.dashboard.ui.DashboardPanel;
import org.dcm4chee.dashboard.ui.report.display.DynamicDisplayPage;
import org.dcm4chee.dashboard.ui.util.DatabaseUtils;
import org.dcm4chee.web.common.base.BaseWicketPage;
import org.dcm4chee.web.common.behaviours.TooltipBehaviour;
import org.dcm4chee.web.common.markup.BaseForm;
import org.dcm4chee.web.common.markup.SimpleDateTimeField;
import org.dcm4chee.web.common.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Robert David <robert.david@agfa.com>
* @version $Revision$ $Date$
* @since 28.09.2009
*/
public class ConfigureReportPage extends SecureWebPage {
private static final long serialVersionUID = 1L;
private static Logger log = LoggerFactory.getLogger(ConfigureReportPage.class);
private static final ResourceReference BaseCSS = new CompressedResourceReference(BaseWicketPage.class, "base-style.css");
private static final ResourceReference DashboardBaseCSS = new CompressedResourceReference(DashboardPanel.class, "dashboard-style.css");
private ReportModel report;
protected ModalWindow window;
private boolean diagram;
private boolean table;
private Label resultMessage;
public ConfigureReportPage(final ModalWindow window, final ReportModel report, boolean diagram, boolean table) {
super();
if (ConfigureReportPage.BaseCSS != null)
add(CSSPackageResource.getHeaderContribution(ConfigureReportPage.BaseCSS));
if (ConfigureReportPage.DashboardBaseCSS != null)
add(CSSPackageResource.getHeaderContribution(ConfigureReportPage.DashboardBaseCSS));
try {
this.report = report;
this.window = window;
this.diagram = diagram;
this.table = table;
add(resultMessage = new Label("result-message"));
resultMessage.setOutputMarkupId(true);
resultMessage.setDefaultModel(new Model<String>(""));
add(new ConfigureReportForm("configure-report-form", this.report, resultMessage, this.window));
} catch (Exception e) {
log.error(this.getClass().toString() + ": " + "init: " + e.getMessage());
log.debug("Exception: ", e);
throw new WicketRuntimeException(e.getLocalizedMessage(), e);
}
}
@Override
public void onBeforeRender() {
super.onBeforeRender();
if (!DatabaseUtils.isConfigurableStatement(this.report.getStatement()))
redirectToInterceptPage(new DynamicDisplayPage(this.report, null, this.diagram, this.table));
}
private final class ConfigureReportForm extends BaseForm {
private static final long serialVersionUID = 1L;
private Map<String, String> parameters = new HashMap<String, String>();
public ConfigureReportForm(final String id, final ReportModel report, final Label resultMessage, final ModalWindow window) throws InstanceNotFoundException, MalformedObjectNameException, AttributeNotFoundException, ReflectionException, MBeanException, NullPointerException {
super(id);
this.add(new Label("dashboard.report.configure.form.title.name", new PropertyModel<String>(report, "title"))
.add(new AttributeModifier("size", true, new ResourceModel("dashboard.report.configure.form.title.columns"))));
RepeatingView variableRows = new RepeatingView("variable-rows");
add(variableRows);
for (final String parameterName : DatabaseUtils.getParameterSet(report.getStatement())) {
WebMarkupContainer parameterRow = new WebMarkupContainer(parameterName);
parameterRow.add(new Label("variable-name", parameterName.toString()));
variableRows.add(parameterRow);
if (parameterName.toString().startsWith("date")) {
SimpleDateTimeField dtf;
parameterRow
.add(dtf = new SimpleDateTimeField("date-variable-value", new IModel<Date>() {
private static final long serialVersionUID = 1L;
@Override
public void setObject(Date value) {
parameters.put(parameterName, value != null ?
DateFormat.getDateTimeInstance(
DateFormat.SHORT,
DateFormat.SHORT,
getSession().getLocale())
.format(value)
: "");
}
@Override
public Date getObject() {
return null;
}
@Override
public void detach() {
}
}));
dtf.addToDateField(
new TooltipBehaviour("dashboard.report.configure.",
"date-variable-value",
new AbstractReadOnlyModel<String>(){
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return DateUtils.getDatePattern(getParent());
}
}
));
dtf.addToTimeField(
new TooltipBehaviour("dashboard.report.configure.",
"date-variable-value.timeField"));
parameterRow.add(new TextField<String>("variable-value").setVisible(false));
} else {
parameterRow
.add((new TextField<String>("variable-value", new Model<String>() {
private static final long serialVersionUID = 1L;
@Override
public void setObject(String value) {
parameters.put(parameterName, value != null ? value : "");
}
}))
.setVisible(!parameterName.toString().startsWith("date"))
);
parameterRow.add(new Label("date-variable-value").setVisible(false));
}
}
add(new AjaxFallbackButton("form-submit", ConfigureReportForm.this) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
String message = null;
try {
if (report.getDataSource() == null) {
message = new ResourceModel("dashboard.report.configure.form.statement-test-submit.no-datasource-message").wrapOnAssignment(this.getParent()).getObject();
return;
}
window.setResponsePage(new DynamicDisplayPage(report, parameters, diagram, table));
} catch (Exception e) {
message = e.getLocalizedMessage();
log.debug("Exception: ", e);
resultMessage.setDefaultModel(new Model<String>(new ResourceModel("dashboard.report.configure.form.form-submit.failure-message")
.wrapOnAssignment(this.getParent()).getObject().toString()
+ (message == null ? "" : message)))
.add(new AttributeModifier("class", true, new Model<String>("message-error")))
.setVisible(true);
target.addComponent(resultMessage);
}
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.addComponent(form);
}
});
}
}
}
| [
"liliang_lz@icloud.com"
] | liliang_lz@icloud.com |
c9ab66aee3a80b7573c7a7d2beb3f3200f1c0bdc | e6c35832a38c3187a35030c2ed3a4bcf7f52c62c | /Backup/AndroidStudioProjects/Pill-Reminder-master/app/src/main/java/com/cgarcia/pillreminder/domain/Drug.java | cda929455cc8279fbc56be73093b69eb1e8350f0 | [] | no_license | subhamanoharan/thulasi-pharmacyModification | 4139af4c29b7e62c9821d8d1ee2b025d1f23694f | 7cdd29222c3655f78e9d771ded7338641568bbac | refs/heads/master | 2021-01-01T05:33:43.382124 | 2014-12-17T09:09:32 | 2014-12-17T09:09:32 | 28,083,866 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package com.cgarcia.pillreminder.domain;
import java.io.Serializable;
public class Drug implements Serializable {
/**
* Serialization ID
*/
private static final long serialVersionUID = -4690887955322414045L;
protected String _name;
protected String _description;
protected Reminder _reminder;
public String getName() {
return _name;
}
public void setName(String name) {
_name = name;
}
public String getDescription() {
return _description;
}
public void setDescription(String description) {
_description = description;
}
public Reminder getReminder() {
return _reminder;
}
public void setReminder(Reminder reminder) {
_reminder = reminder;
}
}
| [
"subham@INSubhaM.corporate.thoughtworks.com"
] | subham@INSubhaM.corporate.thoughtworks.com |
89f7060d59796d962c373f34d01c4d4a28b0f640 | d35e571d55cffa6ff228b6f8e9bfc9cfcfaea649 | /src/server/Server.java | 7beb9577c14e62ce6f326cdb0ed24b68137a40e7 | [] | no_license | cdemet08/ask01_425 | 93e45ac887960f1e7f8e7cef7ffa1d1de706094b | 2a85db81d28c9e93d2e42efb5db6e9cd056cfb56 | refs/heads/master | 2021-06-07T17:58:48.110482 | 2016-10-02T17:05:58 | 2016-10-02T17:05:58 | 69,024,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,808 | java | package server;
import java.net.ServerSocket;
import java.net.Socket;
import static java.lang.System.exit;
/**
* The server side for answer the message to the client
* Created by cdemet08 on 9/23/16.
*/
public class Server {
/**
* the port number of server
*/
private static int portNumber=0;
/**
* the server socket,wait for client to connect
*/
private static ServerSocket serverSocket;
/**
* The client socket to send the message
*/
private static Socket clientSocket = null;
/**
* The start of the program
* @param args
*/
public static void main(String[] args) {
/**
* thread number for the client
*/
int threadNum=0;
// check input parameter
checkInputParameter(args);
// port number initiliaze
portNumber = Integer.parseInt(args[0]);
System.out.println("The port number for server is:"+portNumber);
//numRepetitions = Integer.parseInt(args[1]);
//System.out.println("The repetitions for client:"+numRepetitions);
// wait for connection
try {
serverSocket = new ServerSocket(portNumber);
System.out.println("Server started.In port:" + portNumber);
} catch (Exception e) {
System.err.println("Port already in use.");
System.exit(1);
}
while (true) {
try {
clientSocket = serverSocket.accept();
System.out.println("Accepted connection : " + clientSocket);
Thread t = new Thread(new ConnectionThread(clientSocket,threadNum));
t.start();
threadNum++;
} catch (Exception e) {
System.err.println("Error in connection attempt.");
}
}
}
/**
* check input parameter in the program
* @param args
*/
private static void checkInputParameter(String[] args) {
if(args.length < 1) {
System.err.println("Give the port number and repetitions.");
exit(1);
}
}
}
| [
"cdemet08@cs.ucy.ac.cy"
] | cdemet08@cs.ucy.ac.cy |
680fa4e33e94fdd3408a884cadbcf398a79d5657 | 1fae8787ad88159f6fdfd1b9d52ad0f43a43680e | /Medium/129.Sum Root to Leaf Numbers.java | 0d5e374d70723cc9a3da0f9161e36c23fc2e6b08 | [] | no_license | songwenxiao/LeetCode-Solutions | 74f4ef8a794af20cd46008163fc4fdc05a687231 | 75c951d92e0c5dc5ac2acc2c4db5271960dd376e | refs/heads/master | 2020-04-16T02:23:43.349501 | 2016-10-21T18:49:53 | 2016-10-21T18:49:53 | 58,070,781 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
int sum;
public int sumNumbers(TreeNode root) {
if(root==null) return 0;
int num = 0;
sum = 0;
sum(root,root.val);
return sum;
}
public void sum(TreeNode root, int num){
if(root.left==null&&root.right ==null){
sum += num;
}
if(root.left!=null){
sum(root.left,num*10+root.left.val);
}
if(root.right!=null){
sum(root.right,num*10+root.right.val);
}
}
} | [
"song.we@husky.neu.edu"
] | song.we@husky.neu.edu |
9ac0d914a22919e07f597d9c0665d0583dad4e89 | a68d8a1ce4f442c6221e9465929cca5065c7d14c | /sed/sed-service/src/main/java/com/bsu/sed/service/news/NewsUrlServiceImpl.java | 2ad7c42a183bb98fcddea0f3ed6d3a0b731d3e7a | [
"Apache-2.0"
] | permissive | GlebBondarchuk/SED | c803fcca7d22f7310c2d89697db62d71798eb576 | ccf00969bba690c1d1fc006d676a14aab65430d1 | refs/heads/master | 2021-01-10T18:59:54.417186 | 2015-05-25T14:56:42 | 2015-05-25T14:56:42 | 27,765,044 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,501 | java | package com.bsu.sed.service.news;
import com.bsu.sed.dao.NewsUrlDao;
import com.bsu.sed.model.SortOrder;
import com.bsu.sed.model.dto.NewsUrlDto;
import com.bsu.sed.model.persistent.Content;
import com.bsu.sed.model.persistent.NewsUrl;
import com.bsu.sed.parser.RssParser;
import com.bsu.sed.utils.JsonUtils;
import com.sun.syndication.io.FeedException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author gbondarchuk
*/
@Service
@Transactional
public class NewsUrlServiceImpl implements NewsUrlService {
@Autowired
private NewsUrlDao newsUrlDao;
@Override
public List<NewsUrl> find() {
return newsUrlDao.getAll();
}
@Override
public void save(NewsUrlDto dto) throws IOException, FeedException {
Long id = dto.getId();
String url = dto.getUrl();
String searchWords = dto.getSearchWords();
boolean disabled = dto.isDisabled();
if (!RssParser.isValid(dto.getUrl())) {
throw new RuntimeException(url + " is not RSS. Please, use only RSS URL.");
}
String imageUrl = RssParser.getImageUrl(url);
NewsUrl newsUrl = new NewsUrl(id, url, searchWords, imageUrl, disabled);
if (id == null) {
newsUrlDao.create(newsUrl);
} else {
newsUrlDao.update(newsUrl);
}
}
@Override
public void update(NewsUrl newsUrl) {
newsUrlDao.update(newsUrl);
}
@Override
public void delete(Long id) {
newsUrlDao.delete(id);
}
@Override
public List<NewsUrl> getEnabled() {
return newsUrlDao.findEnabled();
}
@Override
public NewsUrl get(Long id) {
return newsUrlDao.load(id);
}
@Override
public String getJson(int limit, int offset, String search, String sort, SortOrder order) {
List<String> searchFields = Arrays.asList("url", "searchWords");
List<NewsUrl> contents = newsUrlDao.find(searchFields, limit, offset, search, sort, order);
long total = newsUrlDao.count(searchFields, search);
return JsonUtils.newsUrlToJson(contents, total);
}
@Override
public void delete(List<Long> ids) {
newsUrlDao.delete(ids);
}
}
| [
"gleb.exadel@mail.ru"
] | gleb.exadel@mail.ru |
68c33759522a2691b44e6ddd9b9907c84d0567be | 407289ac8b1cdd99234caa248548de2eeea6885d | /chapter_001/src/test/java/ru/job4j/calculate/CalculateTest.java | 6d43b68f754447452eaa2e4acdb355ae79c7ff1e | [
"Apache-2.0"
] | permissive | evgenshegai/job4j | f4d980b3b186781ad80b30dc60d1f08559ab9a38 | 29c14d4f16a14b74093fd0a57022756223cfaf82 | refs/heads/master | 2021-06-29T05:27:08.458406 | 2019-12-21T12:14:20 | 2019-12-21T12:14:20 | 169,946,977 | 0 | 0 | Apache-2.0 | 2020-10-13T14:19:12 | 2019-02-10T05:41:29 | Java | UTF-8 | Java | false | false | 1,105 | java | package ru.job4j.calculate;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* Test.
*
* @author EvgeniiShegai (evgeniishegai@yandex.ru)
* @version $Id$
* @since 0.1
*/
public class CalculateTest {
@Test
public void whenAdd() {
Calculate calculate = new Calculate();
calculate.add(1.0, 1.0);
double result = calculate.getResult();
assertThat(result, is(2.0));
}
@Test
public void whenSubtract() {
Calculate calculate = new Calculate();
calculate.subtract(2.0, 1.0);
double result = calculate.getResult();
assertThat(result, is(1.0));
}
@Test
public void whenDiv() {
Calculate calculate = new Calculate();
calculate.div(2.0, 1.0);
double result = calculate.getResult();
assertThat(result, is(2.0));
}
@Test
public void whenMultiply() {
Calculate calculate = new Calculate();
calculate.multiple(2.0, 1.0);
double result = calculate.getResult();
assertThat(result, is(2.0));
}
} | [
"evgeniishegai@yandex.ru"
] | evgeniishegai@yandex.ru |
2e79303d4a86171dedd65df28de665b4ea16cc40 | b9ced19a009b700055cfb1ada02125820115350a | /app/src/main/java/com/liuly/www/like/BaseApp.java | 4239d5334de13e120b1fa3873fa389edbb9ddfc8 | [] | no_license | liuly0218/Like | 67d179cad6ad5063f436f0696d0f2ed46d2ebdb9 | 474f985d1c2e36270cdfeb40195768fab1f9af7c | refs/heads/master | 2020-03-25T17:28:50.931163 | 2018-08-08T08:08:00 | 2018-08-08T08:08:00 | 143,957,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package com.liuly.www.like;
import android.app.Application;
import com.liuly.www.likelibrary.utils.LikeUtils;
public class BaseApp extends Application {
@Override
public void onCreate() {
super.onCreate();
LikeUtils.init(this);
}
}
| [
"liuly0218@163.com"
] | liuly0218@163.com |
6c596c51dc6e0d7593b098537f4eb780df736ae9 | 1cb94b96dc782dee66b36dc2412b37ee0ac6931d | /src/main/java/pet/project/configuration/MvcConfig.java | 74fce24d18d6d5860a30698d8cfcf81c4cf0377f | [] | no_license | aarrsseni/place-generator-app | a2d82f5b2d4b2b5f6efc4f8cb4002fea899d7f9b | de8dfa2f7a10d5e49c6ff26e907c42e9e561d060 | refs/heads/master | 2020-03-31T05:15:15.549889 | 2018-11-25T19:20:01 | 2018-11-25T19:20:01 | 151,939,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | //package pet.project.configuration;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class MvcConfig implements WebMvcConfigurer{
//
// public void addViewControllers(ViewControllerRegistry registry) {
// registry.addViewController("/home").setViewName("home");
// registry.addViewController("/").setViewName("home");
// registry.addViewController("/hello").setViewName("hello");
// registry.addViewController("/login").setViewName("login");
// registry.addViewController("/items").setViewName("items");
// registry.addViewController("/add-item").setViewName("add-item");
// }
//
//}
| [
"ancarseni@gmail.com"
] | ancarseni@gmail.com |
d6c6b3961f7e8989150e7d2e71b1cf906aeea422 | 82dfbecde34009d33db1c02d5815d1d67d0b446d | /_test/src/main/java/webapp/demo6_aop/TestController.java | b1e7e023250bd2fa4d7371e64a1deb63848f41a2 | [
"Apache-2.0"
] | permissive | sun3Lu/solon | 4afa62d4b94cf735be1f77655d0d92761ac28e89 | 0bae2564c45d3546e6f61aa7a6749a42c35f79c2 | refs/heads/master | 2022-11-30T03:59:52.174826 | 2020-08-06T03:45:24 | 2020-08-06T03:45:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,206 | java | package webapp.demo6_aop;
import org.noear.solon.XApp;
import org.noear.solon.annotation.XController;
import org.noear.solon.annotation.XMapping;
import org.noear.solon.annotation.XInject;
import org.noear.solon.core.XContext;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@XController
public class TestController {
@XInject("rs1") //会从bean库注入
public Rockapi rockapi11;
@XInject("rs1")
public Rockapi rockapi12;
@XInject("rs3")
public Rockapi rockapi13;
@XInject //会自动生成
public Rockservice2 rockapi2;
public String test_aaa = XApp.cfg().get("demo6.test.aaa");
public int test_bbb = XApp.cfg().getInt("demo6.test.bbb",0);
public Properties prop = XApp.cfg().getProp("mytbae.bcf");
@XMapping("/demo6/aop")
public Object test() throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("rockapi11", rockapi11.test());
map.put("rockapi12", rockapi12.test());
map.put("rockapi2", rockapi2.test());
return map;
}
@XMapping("/demo6/aop3")
public Object test3() throws Exception {
return rockapi13.test();
}
}
| [
"noear@live.cn"
] | noear@live.cn |
5e96e6ae5cf3ceabc6a19890192dd2da7a4116b0 | f6c08d25310e07cb163497123b00168773daf228 | /beam/core/src/test/java/cz/o2/proxima/beam/core/transforms/AssignEventTimeTest.java | 3d62a535887ea781992a0111005dbeb1731d35f6 | [
"Apache-2.0"
] | permissive | O2-Czech-Republic/proxima-platform | 91b136865cc5aabd157d08d02045893d8e2e6a87 | 2d5edad54a200d1d77b9f74e02d1d973ccc51608 | refs/heads/master | 2023-08-19T00:13:47.760910 | 2023-08-16T13:53:03 | 2023-08-16T13:53:03 | 108,869,877 | 20 | 7 | Apache-2.0 | 2023-08-01T14:19:51 | 2017-10-30T15:26:01 | Java | UTF-8 | Java | false | false | 1,959 | java | /*
* Copyright 2017-2023 O2 Czech Republic, a.s.
*
* 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 cz.o2.proxima.beam.core.transforms;
import static org.junit.Assert.assertNotNull;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.testing.PAssert;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.MapElements;
import org.apache.beam.sdk.transforms.Reify;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.TypeDescriptor;
import org.apache.beam.sdk.values.TypeDescriptors;
import org.joda.time.Instant;
import org.junit.Test;
public class AssignEventTimeTest {
@Test
public void testTransform() {
Pipeline p = Pipeline.create();
Instant now = Instant.now();
PCollection<KV<Instant, Instant>> res =
p.apply(Create.of(now, now.plus(1), now.plus(2)))
.apply(AssignEventTime.forTimestampFn(e -> e))
.apply(Reify.timestamps())
.apply(
MapElements.into(
TypeDescriptors.kvs(
TypeDescriptor.of(Instant.class), TypeDescriptor.of(Instant.class)))
.via(e -> KV.of(e.getValue(), e.getTimestamp())));
PAssert.that(res)
.containsInAnyOrder(
KV.of(now, now), KV.of(now.plus(1), now.plus(1)), KV.of(now.plus(2), now.plus(2)));
assertNotNull(p.run());
}
}
| [
"je.ik@seznam.cz"
] | je.ik@seznam.cz |
70151ab1f3a5a5d4ac7940fa41c813b196d017be | 0115aac4afe6a14e1067f5e1e1c069ecaf543a5f | /p4java/r18-1/src/test/java/com/perforce/p4java/tests/dev/unit/features123/SymbolicLinkSyncTest.java | 55d64b5f28340d705887f95485695f3201928e2c | [
"BSD-3-Clause",
"CC-BY-2.5",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | djangid/p4ic4idea | 551f4abe071a2d114de0c27086da21c444c55e55 | 945c9cda1d803d0941e50f955947698fcbfee246 | refs/heads/master | 2020-06-27T11:45:29.514922 | 2019-05-07T16:43:58 | 2019-05-07T16:43:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,476 | java | /**
*
*/
package com.perforce.p4java.tests.dev.unit.features123;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.perforce.p4java.client.IClient;
import com.perforce.p4java.core.ChangelistStatus;
import com.perforce.p4java.core.IChangelist;
import com.perforce.p4java.core.file.FileSpecBuilder;
import com.perforce.p4java.core.file.IFileSpec;
import com.perforce.p4java.core.file.IObliterateResult;
import com.perforce.p4java.exception.P4JavaException;
import com.perforce.p4java.impl.mapbased.rpc.sys.helper.SymbolicLinkHelper;
import com.perforce.p4java.option.changelist.SubmitOptions;
import com.perforce.p4java.option.client.AddFilesOptions;
import com.perforce.p4java.option.client.RevertFilesOptions;
import com.perforce.p4java.option.client.SyncOptions;
import com.perforce.p4java.option.server.ObliterateFilesOptions;
import com.perforce.p4java.server.IOptionsServer;
import com.perforce.p4java.tests.dev.annotations.Jobs;
import com.perforce.p4java.tests.dev.annotations.TestId;
import com.perforce.p4java.tests.dev.unit.P4JavaTestCase;
/**
* Test symlink support - sync command. This only works with JDK 7 or above on
* the UNIX environment and newer versions of Windows (Vista or above).<p>
* <p>
* Note that hard links are available as of Windows 2000, and symbolic links as
* of Windows Vista.
*/
@Jobs({"job038013", "job034097"})
@TestId("Dev123_SymbolicLinkSyncTest")
public class SymbolicLinkSyncTest extends P4JavaTestCase {
private static IOptionsServer superServer = null;
private static IClient superClient = null;
private static IClient client = null;
/**
* @BeforeClass annotation to a method to be run before all the tests in a class.
*/
@BeforeClass
public static void oneTimeSetUp() throws Exception {
superServer = getServerAsSuper();
superClient = superServer.getClient("p4TestSuperWS20112");
assertNotNull(superClient);
superServer.setCurrentClient(superClient);
server = getServer();
assertNotNull(server);
client = server.getClient(getPlatformClientName("p4TestUserWS20112"));
assertNotNull(client);
server.setCurrentClient(client);
}
/**
* @AfterClass annotation to a method to be run after all the tests in a class.
*/
@AfterClass
public static void oneTimeTearDown() {
afterEach(superServer);
afterEach(server);
}
/**
* @Before annotation to a method to be run before each test in a class.
*/
@Before
public void setUp() {
// initialization code (before each test).
deletedExistLinkDirBeforeTest();
}
private void deletedExistLinkDirBeforeTest() {
String clientRoot = client.getRoot();
Path parentTestPath = Paths.get(clientRoot, "symlinks");
if (Files.exists(parentTestPath)) {
deleteDir(parentTestPath.toFile());
}
}
/**
* Test symlink support - sync command. This only works with JDK 7 or above
* and non-Windows environment.
*/
@Test
public void testSyncSymlinks() {
String[] repoPaths = new String[]{
"//depot/symlinks/testdira/testdir2/...",
"//depot/symlinks/testdira/testdirb/testfile.txt",
"//depot/symlinks/testdira/testdir2"};
try {
List<IFileSpec> files = client.sync(
FileSpecBuilder.makeFileSpecList(repoPaths),
new SyncOptions().setForceUpdate(true));
assertNotNull(files);
} catch (Exception exc) {
fail("Unexpected exception: " + exc.getLocalizedMessage());
}
}
/**
* Test add symbolic links
*/
@Test
public void testAddSymlinks() throws Exception {
IChangelist changelist = null;
String clientRoot = client.getRoot();
String path = null;
String depotPath = null;
int rand = getRandomInt();
try {
// Check if symlink capable
if (SymbolicLinkHelper.isSymbolicLinkCapable()) {
String target = clientRoot + File.separator + "symlinks" + File.separator + "testdir" + File.separator + "testdir2";
String link = clientRoot + File.separator + "symlinks" + File.separator + "testdir" + File.separator + "testdir2-symlink-" + rand;
depotPath = "//depot/symlinks/testdir/" + "testfile2-symlink-" + rand;
// Sync files
List<IFileSpec> files = client.sync(
FileSpecBuilder.makeFileSpecList("//depot/symlinks/testdir/..."),
new SyncOptions().setForceUpdate(true));
assertNotNull(files);
// Create symbolic link
path = SymbolicLinkHelper.createSymbolicLink(link, target);
boolean isSymlink = SymbolicLinkHelper.isSymbolicLink(path
.toString());
assertTrue(isSymlink);
changelist = getNewChangelist(server,
client,
"Dev123_SymbolicLinkSyncTest add symbolic link.");
assertNotNull(changelist);
changelist = client.createChangelist(changelist);
assertNotNull(changelist);
// Add a file specified as "binary" even though it is "text"
files = client.addFiles(
FileSpecBuilder.makeFileSpecList(link),
new AddFilesOptions().setChangelistId(changelist.getId()));
assertNotNull(files);
changelist.refresh();
files = changelist.submit(new SubmitOptions());
assertNotNull(files);
// Delete the local symbolic link
File delFile = new File(path);
boolean delSuccess = delFile.delete();
assertTrue(delSuccess);
// Force sync of the submitted symbolic link
files = client.sync(
FileSpecBuilder.makeFileSpecList(path),
new SyncOptions().setForceUpdate(true));
assertNotNull(files);
// Read the target path of the symbolic link
// Verify the symbolic link has the correct target path
String linkTarget = SymbolicLinkHelper.readSymbolicLink(path);
assertNotNull(linkTarget);
assertEquals(target, linkTarget);
}
} finally {
if (client != null) {
if (changelist != null) {
if (changelist.getStatus() == ChangelistStatus.PENDING) {
try {
// Revert files in pending changelist
client.revertFiles(
changelist.getFiles(true),
new RevertFilesOptions()
.setChangelistId(changelist.getId()));
} catch (P4JavaException e) {
// Can't do much here...
}
}
}
}
if (path != null) {
if (superClient != null && superServer != null) {
try {
List<IObliterateResult> obliterateFiles = superServer
.obliterateFiles(FileSpecBuilder
.makeFileSpecList(depotPath),
new ObliterateFilesOptions()
.setExecuteObliterate(true));
assertNotNull(obliterateFiles);
} catch (P4JavaException e) {
// Can't do much here...
}
}
File file = new File(path.toString());
if (file.exists()) {
file.delete();
}
}
}
}
}
| [
"matt@groboclown.net"
] | matt@groboclown.net |
d3ac687874aa75897823376e69316eb73c7ced92 | 9f2c223b46d8fad42a3cafa1c1694b71676c9a8c | /src/main/java/br/edu/ifrn/agendamedicaifrn/CadastroPendenteAPP.java | a87d7f957ff45f0460daf704f611efe1dbcfe338 | [] | no_license | RoseGaldino/agenda-medica | 823182bdb74bd9f10b139590e9ba107f047f44ee | da7eafdcb494dd58cf4e2cdd8db9e220c3d6b8a4 | refs/heads/master | 2020-03-17T15:02:24.969858 | 2018-05-23T15:22:08 | 2018-05-23T15:22:08 | 133,696,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package br.edu.ifrn.agendamedicaifrn;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.hibernate.validator.constraints.br.CPF;
/**
*
* @author 20151148060161
*/
@Entity
public class CadastroPendenteAPP {
@Id
private Integer id;
private String nome;
@CPF
private String cpf;
private String telefone;
private String email;
private Date dataNascimento;
private boolean confirmado;
}
| [
"roseane.silva@parnamirim.rn.gov.br"
] | roseane.silva@parnamirim.rn.gov.br |
f4a5b313361edcef19873b320ff2402c95301328 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/java_awt_GridBagConstraints_clone.java | 7f7ffeee6573a1f2572a6a734f50a7ac44cccd4e | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | class java_awt_GridBagConstraints_clone{ public static void function() {java.awt.GridBagConstraints obj = new java.awt.GridBagConstraints();obj.clone();}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
2e8c18c5bae518c0da61e503f39b394eb1e3d139 | 7834a5c9b3c4dd0a2d5e7274eb9acce43c0a56d5 | /components/pdp/src/an/xacml/engine/PDPStatus.java | f2e0fe56bb45a4b3bb505a13f46f79edfe42d980 | [] | no_license | chuxuantinh/en-xacml | b72315449a94d902ed1bd2eef40d76b3bb76f0cd | 56aca8c8fe2515f3b206c1caa2acca1b57301323 | refs/heads/main | 2023-04-13T14:54:34.628720 | 2021-04-30T12:26:36 | 2021-04-30T12:26:36 | 363,133,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package an.xacml.engine;
import an.control.AbstractStatus;
public class PDPStatus extends AbstractStatus {
public static final String KEY_RUN_STATUS = "Status";
public static final String KEY_WORKERTHREADS_TOTAL = "TotalThreads";
public static final String KEY_WORKERTHREADS_IDLES = "IdleThreads";
// TODO other keys
public static final String STATUS_RUN_NOTRUN = "NotRun";
public static final String STATUS_RUN_RUNING = "Running";
public static final String STATUS_RUN_INITIALIZED = "Initialized";
public static final String STATUS_RUN_RELOADPOLICY = "ReloadingPolicies";
// TODO other status
public PDPStatus() {
status.put(KEY_RUN_STATUS, STATUS_RUN_NOTRUN);
}
} | [
"50776038+chuxuantinh@users.noreply.github.com"
] | 50776038+chuxuantinh@users.noreply.github.com |
52c9be926a1e4a8ba6cf99843297d2a329d62047 | 00109fe2e746a8efb9c33eeffb22bd9814747b46 | /app/src/test/java/com/giuseppesorce/adiexample/ExampleUnitTest.java | e83cd0520c9d6a453107266757b1d9356885953a | [] | no_license | giuseppesorce/adixamples | c060f62f7e66a9cdcf35c4dc0258f42aa23ddc2f | aea62d8cf6d1a5a1050b25a41990f4d34a23f63e | refs/heads/master | 2020-04-27T23:36:34.768930 | 2019-03-10T05:36:04 | 2019-03-10T05:36:04 | 174,782,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.giuseppesorce.adiexample;
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);
}
} | [
"giuseppe.sorce@warpmobile.it"
] | giuseppe.sorce@warpmobile.it |
b6b68cf13df3939a30478de9e67ac094a25255c8 | 66b96cbf26682eb51e6893a45d773481c5118b67 | /ros-20190910/java/src/main/java/com/aliyun/ros20190910/models/ListStackGroupOperationsResponse.java | b97ada3c4825c0e405cfaf98c9b90b6eb814f581 | [
"Apache-2.0"
] | permissive | atptro/alibabacloud-sdk | 4c104535fe77b94a4d5536028874f492d86aa794 | 65d4a000e4f4059b58ca1bc3d032853aedef4f3f | refs/heads/master | 2022-10-17T21:45:07.475716 | 2020-06-18T07:37:05 | 2020-06-18T07:37:05 | 273,171,083 | 0 | 0 | NOASSERTION | 2020-06-18T07:29:22 | 2020-06-18T07:29:21 | null | UTF-8 | Java | false | false | 2,249 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.ros20190910.models;
import com.aliyun.tea.*;
public class ListStackGroupOperationsResponse extends TeaModel {
@NameInMap("RequestId")
@Validation(required = true)
public String requestId;
@NameInMap("PageNumber")
@Validation(required = true)
public Integer pageNumber;
@NameInMap("PageSize")
@Validation(required = true)
public Integer pageSize;
@NameInMap("TotalCount")
@Validation(required = true)
public Integer totalCount;
@NameInMap("StackGroupOperations")
@Validation(required = true)
public java.util.List<ListStackGroupOperationsResponseStackGroupOperations> stackGroupOperations;
public static ListStackGroupOperationsResponse build(java.util.Map<String, ?> map) throws Exception {
ListStackGroupOperationsResponse self = new ListStackGroupOperationsResponse();
return TeaModel.build(map, self);
}
public static class ListStackGroupOperationsResponseStackGroupOperations extends TeaModel {
@NameInMap("StackGroupName")
@Validation(required = true)
public String stackGroupName;
@NameInMap("StackGroupId")
@Validation(required = true)
public String stackGroupId;
@NameInMap("OperationId")
@Validation(required = true)
public String operationId;
@NameInMap("OperationDescription")
@Validation(required = true)
public String operationDescription;
@NameInMap("CreateTime")
@Validation(required = true)
public String createTime;
@NameInMap("EndTime")
@Validation(required = true)
public String endTime;
@NameInMap("Action")
@Validation(required = true)
public String action;
@NameInMap("Status")
@Validation(required = true)
public String status;
public static ListStackGroupOperationsResponseStackGroupOperations build(java.util.Map<String, ?> map) throws Exception {
ListStackGroupOperationsResponseStackGroupOperations self = new ListStackGroupOperationsResponseStackGroupOperations();
return TeaModel.build(map, self);
}
}
}
| [
"wb-szq493230@alibaba-inc.com"
] | wb-szq493230@alibaba-inc.com |
4d57c8ba810b4bf26c105642440b405001ca3135 | f9f52b5a2a6085a3de11bc16513885b34e634880 | /src/main/java/spider/LocalDataCollectorCrawler.java | 9b4e0467757cec8ec67f3b71f487541a900d4302 | [] | no_license | ponlanby/Crawler | a0c242abe5d2d12b92b965d33d5a8c4ca92a1f1f | a2c1c9d81056fa633f3f88ab9fdff01d179aa17d | refs/heads/master | 2021-06-08T21:27:40.115955 | 2016-11-16T07:59:09 | 2016-11-16T07:59:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,709 | java | package spider;
import java.io.UnsupportedEncodingException;
import java.util.Set;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.uci.ics.crawler4j.crawler.Page;
import edu.uci.ics.crawler4j.crawler.WebCrawler;
import edu.uci.ics.crawler4j.parser.HtmlParseData;
import edu.uci.ics.crawler4j.url.WebURL;
public class LocalDataCollectorCrawler extends WebCrawler {
private static final Logger logger = LoggerFactory.getLogger(LocalDataCollectorCrawler.class);
private static final Pattern FILTERS = Pattern.compile(
".*(\\.(css|js|bmp|gif|jpe?g|png|tiff?|mid|mp2|mp3|mp4|wav|avi|mov|mpeg|ram|m4v|pdf" +
"|rm|smil|wmv|swf|wma|zip|rar|gz))$");
CrawlStat myCrawlStat;
public LocalDataCollectorCrawler() {
myCrawlStat = new CrawlStat();
}
@Override
public boolean shouldVisit(Page referringPage, WebURL url) {
String href = url.getURL().toLowerCase();
return !FILTERS.matcher(href).matches() && href.startsWith("http://www.ics.uci.edu/");
}
@Override
public void visit(Page page) {
logger.info("Visited: {}", page.getWebURL().getURL());
myCrawlStat.incProcessedPages();
if (page.getParseData() instanceof HtmlParseData) {
HtmlParseData parseData = (HtmlParseData) page.getParseData();
Set<WebURL> links = parseData.getOutgoingUrls();
myCrawlStat.incTotalLinks(links.size());
try {
myCrawlStat.incTotalTextSize(parseData.getText().getBytes("UTF-8").length);
} catch (UnsupportedEncodingException ignored) {
// Do nothing
}
}
// We dump this crawler statistics after processing every 50 pages
if ((myCrawlStat.getTotalProcessedPages() % 50) == 0) {
dumpMyData();
}
}
/**
* This function is called by controller to get the local data of this crawler when job is
* finished
*/
@Override
public Object getMyLocalData() {
return myCrawlStat;
}
/**
* This function is called by controller before finishing the job.
* You can put whatever stuff you need here.
*/
@Override
public void onBeforeExit() {
dumpMyData();
}
public void dumpMyData() {
int id = getMyId();
// You can configure the log to output to file
logger.info("Crawler {} > Processed Pages: {}", id, myCrawlStat.getTotalProcessedPages());
logger.info("Crawler {} > Total Links Found: {}", id, myCrawlStat.getTotalLinks());
logger.info("Crawler {} > Total Text Size: {}", id, myCrawlStat.getTotalTextSize());
}
} | [
"tong-ruochen@hotmail.com"
] | tong-ruochen@hotmail.com |
de7c12429865ffb50fe911e8998cc65f05ffac10 | fd964105a6a0f7ac40d557267b0e469200f758de | /src/com/tmeta/slize/booster/SwapInfo.java | 5d3fee2e1f3d1daf150bdd075cc96485842e2466 | [
"Apache-2.0"
] | permissive | numansimsek1965/Slize | 9b6f05cb61060d54bb3da196a346ecac66ee65c6 | b5a77b4b71d9d7ffa358a3518556f135e84f6f38 | refs/heads/master | 2021-12-02T17:33:34.606132 | 2014-01-30T03:46:07 | 2014-01-30T03:46:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | /*
* Copyright (C) 2014 tmeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tmeta.slize.booster;
import com.tmeta.slize.booster.IBoosterExecutable.BoosterTyp;
public class SwapInfo implements IBoosterInfo {
@Override
public BoosterTyp getTyp() {
return IBoosterExecutable.BoosterTyp.SWAP;
}
@Override
public int getCostPerBundle() {
return 500;
}
@Override
public int getItemPerBundle() {
return 5;
}
@Override
public String getName() {
return "swapper";
}
@Override
public String getFirstLine() {
return "swap postions of two pieces";
}
@Override
public String getSecondLine() {
return "";
}
@Override
public String getPnm() {
return "swap.pnm";
}
}
| [
"uchat@tmeta.com"
] | uchat@tmeta.com |
72b7e43276bcf5728ab769e1f2c36e26360461b4 | a37e4bbbe2d295b87a60c70948ef224373bbab38 | /src/List/InsertCircular.java | 108c77c6902474353b421c6c599bbb39bde06105 | [
"MIT"
] | permissive | sndpchwla/algorithms | eb7b0e4dbdcf4992f4bc04c1d1d054f34f79ccff | e0c701d6f2cf80a9b612dd079448f4aa1522d0d2 | refs/heads/master | 2021-05-28T21:50:15.715904 | 2014-03-30T02:00:33 | 2014-03-30T02:00:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,770 | java | package List;
public class InsertCircular {
public static void main(String[] args) {
//test now
//first null case
CircularList myList = null;
myList = insert(myList, 1);
myList.printList();//expect 1
myList.next = new CircularList(3);
myList.next.next = new CircularList(5);
myList.next.next.next = myList;//so expect list is 1>3>5
myList = insert(myList, 2);
myList.printList();//expect 1>2>3>5
myList = insert(myList, 0);
myList.printList();//expect 0>1>2>3>5
myList = insert(myList, 6);
myList.printList();//expect 0>1>2>3>5>6
}
//now let's define our method
//firstly, please notice the return type must be a List type, otherwise for Null case, it cannot
//successfully create the adding function!
static CircularList insert(CircularList myList, int n) {
//firstly if it is null
if(myList == null) {
return new CircularList(n);
} else if(myList.next == myList) { //only one element
//add this node
myList.next = new CircularList(n);
myList.next.next = myList;//the next's next reference points back to the head so forms a cycle
return myList.value<n ? myList : myList.next; //we check value and return the smaller one as head
} else if(n<myList.value) { //if it is the smallest element!
//find tail and append!
CircularList current = myList;
while(current.next != myList)
current = current.next;
current.next = new CircularList(n);//add it after the tail
current.next.next = myList;//set the appended node's next to original header
return current.next;//because this is smallest value! And that's another reason we return List other than void
}
//otherwise, we either find a position when node.value<n and node.next.value>n or node.next==head (largest)
CircularList current = myList;
while(current.next!=myList && current.next.value<=n) {
current = current.next;
}
CircularList currentNext = current.next;
current.next = new CircularList(n);
current.next.next = currentNext;//notice we made a copy of original next and assign it here
return myList;//return header position is unchanged!
}
}
//firstly, define our own circular linked list class
class CircularList {
int value;
CircularList next;
public CircularList(int k) {
value = k;
next = this;//point to itself for creating a new instance, need manually adjust tail's next to head
}
//let's write a support method to print out elements in circular list
public void printList() {
if(this==null)
return;
//otherwise, we copy the current head reference, iterate the list until we meet the head
CircularList current = this;
do{
System.out.print(current.value+",");
current = current.next;
} while(current!=this);
System.out.println();//add a new line for formatting
}
}
| [
"efang@deputy.com"
] | efang@deputy.com |
db9516e470a1d904150786298e37fb51fa84e784 | b53292ae6ed433fdd89cfc35f62712e88bb796b3 | /src/com/SCI/game/hex/HexOffset.java | c0e876c6708e0b16c12afa949a165015fb682839 | [] | no_license | ExistentialPain/Main-Server | 512532e0a830b8b6e264ade9c06a490868d62f8b | 90775fb713040d7f4566dc1fd757ebe7b2e59601 | refs/heads/master | 2021-09-12T19:44:13.330735 | 2018-04-20T07:25:08 | 2018-04-20T07:25:08 | 108,771,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package com.SCI.game.hex;
import java.util.LinkedList;
public class HexOffset {
public HexOffset(int col, int row) {
this.col = col;
this.row = row;
}
public int getCol() {
return col;
}
public int getRow() {
return row;
}
public LinkedList<HexOffset> getHexesWithinRange(int range) {
LinkedList<HexOffset> hexes = new LinkedList<>();
for (int dx = -range; dx <= range; ++dx) {
for (int dy = Math.max(-range, -dx - range); dy <= Math.min(range, -dx + range); ++dy) {
int dz = -dx - dy;
HexCube h = new HexCube(dx, dy, dz);
HexCube uwi = HexCube.fromOffsetCoords(this);
HexCube owowo = h.add(uwi);
hexes.add(owowo.toOffsetCoords());
}
}
return hexes;
}
private final int row, col;
}
| [
"gobisek1@gmail.com"
] | gobisek1@gmail.com |
e2cf0afe4561b25005e58b2319035de4a6bc2bb9 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Mockito-20/org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker/BBC-F0-opt-50/tests/21/org/mockito/internal/creation/bytebuddy/ByteBuddyMockMaker_ESTest.java | cd70e51fa6a03fc5dcc0e6098aa0c85017c1be28 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 5,273 | java | /*
* This file was automatically generated by EvoSuite
* Sat Oct 23 23:12:33 GMT 2021
*/
package org.mockito.internal.creation.bytebuddy;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
import org.mockito.internal.creation.MockSettingsImpl;
import org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker;
import org.mockito.internal.creation.bytebuddy.ClassInstantiator;
import org.mockito.internal.creation.settings.CreationSettings;
import org.mockito.invocation.MockHandler;
import org.mockito.mock.MockCreationSettings;
import org.mockito.mock.SerializableMode;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class ByteBuddyMockMaker_ESTest extends ByteBuddyMockMaker_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
MockSettingsImpl<Object> mockSettingsImpl0 = new MockSettingsImpl<Object>();
Class<Object> class0 = Object.class;
CreationSettings<Object> creationSettings0 = mockSettingsImpl0.setTypeToMock(class0);
// Undeclared exception!
try {
byteBuddyMockMaker0.createMock((MockCreationSettings<Object>) creationSettings0, (MockHandler) null);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
}
}
@Test(timeout = 4000)
public void test1() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
ClassInstantiator.UsingObjenesis classInstantiator_UsingObjenesis0 = new ClassInstantiator.UsingObjenesis(true);
MockSettingsImpl<Integer> mockSettingsImpl0 = new MockSettingsImpl<Integer>();
// Undeclared exception!
try {
byteBuddyMockMaker0.resetMock(classInstantiator_UsingObjenesis0, (MockHandler) null, mockSettingsImpl0);
fail("Expecting exception: ClassCastException");
} catch(ClassCastException e) {
//
// org.mockito.internal.creation.bytebuddy.ClassInstantiator$UsingObjenesis cannot be cast to org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$MockAccess
//
verifyException("org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker", e);
}
}
@Test(timeout = 4000)
public void test2() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
// Undeclared exception!
try {
byteBuddyMockMaker0.createMock((MockCreationSettings<ClassInstantiator.UsingObjenesis>) null, (MockHandler) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker", e);
}
}
@Test(timeout = 4000)
public void test3() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
MockSettingsImpl<Object> mockSettingsImpl0 = new MockSettingsImpl<Object>();
MockHandler mockHandler0 = byteBuddyMockMaker0.getHandler(mockSettingsImpl0);
assertNull(mockHandler0);
}
@Test(timeout = 4000)
public void test4() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
MockSettingsImpl<Object> mockSettingsImpl0 = new MockSettingsImpl<Object>();
SerializableMode serializableMode0 = SerializableMode.ACROSS_CLASSLOADERS;
mockSettingsImpl0.serializable(serializableMode0);
// Undeclared exception!
try {
byteBuddyMockMaker0.createMock((MockCreationSettings<Object>) mockSettingsImpl0, (MockHandler) null);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
}
}
@Test(timeout = 4000)
public void test5() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
MockSettingsImpl<Object> mockSettingsImpl0 = new MockSettingsImpl<Object>();
// Undeclared exception!
try {
byteBuddyMockMaker0.createMock((MockCreationSettings<Object>) mockSettingsImpl0, (MockHandler) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator", e);
}
}
@Test(timeout = 4000)
public void test6() throws Throwable {
ByteBuddyMockMaker byteBuddyMockMaker0 = new ByteBuddyMockMaker();
MockSettingsImpl<Integer> mockSettingsImpl0 = new MockSettingsImpl<Integer>();
// Undeclared exception!
try {
byteBuddyMockMaker0.resetMock((Object) null, (MockHandler) null, mockSettingsImpl0);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
}
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
ecac372bddc92390a084664a7cd56b05b00ff144 | a8a6fcc2d642ec4ac97216e3603e7029d4e2856a | /src/application/atm/HandlerClient.java | 4ea93485ea66a2bb1bd2a4d7e44f615243e44cab | [] | no_license | mcosmina06/ATM-JAVA | 604d40689ca13f87dc86a1ab76e420ff635e5ef3 | 4a732f6d054d7121d4ceb98d0fadc31892bcc4cc | refs/heads/master | 2023-04-21T01:58:13.805628 | 2021-05-24T10:22:14 | 2021-05-24T10:22:14 | 367,286,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,936 | java | package application.atm;
import application.user.Client;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
public class HandlerClient {
private static final String clientsHistoryFileName = "ClientsBankHistory";
private static final String othersHistoryFileName = "OthersBankHistory";
private Client client;
private History history;
private HandlerDataBase handlerDataBase;
private DecimalFormat df = new DecimalFormat("#.00");
public HandlerClient() {
history = new History(clientsHistoryFileName, othersHistoryFileName);
handlerDataBase = new HandlerDataBase();
}
protected boolean isClientIdValid(String clientId) {
if (clientId.length() != 3)
return false;
return handlerDataBase.serchClient(clientId);
}
protected void initClient() {
client = new Client();
handlerDataBase.completeClientProfile(client);
}
protected boolean checkIfPinIsReverse(String clientPin) {
String reverseClientPin = (new StringBuilder(client.getPin()).reverse()).toString();
if (clientPin.equals(reverseClientPin))
return true;
return false;
}
protected boolean isClientPinValid(String clientPin) {
initClient();
if (clientPin.length() != 4)
return false;
if (clientPin.equals(client.getPin())) {
return true;
}
return false;
}
protected boolean blockClient(String clientPin) {
if (checkIfPinIsReverse(clientPin)) {
client.setBlockedAccount(true);
history.update("ID: " + client.getId() + "\t" + "ACTION: blocked account \t"
+ "TIME: " + LocalDateTime.now(), client.getClientBank());
handlerDataBase.updateClientProfile(client);
return true;
}
history.update("ID: " + client.getId() + "\t" + "ACTION: login \t"
+ "TIME: " + LocalDateTime.now(), client.getClientBank());
return false;
}
protected String sold() {
history.update("ID: " + client.getId() + "\t" + "ACTION: sold \t"
+ "TIME: " + LocalDateTime.now(), client.getClientBank());
return df.format(client.getSold()) + " " + client.getCoin();
}
protected boolean needToConvert(String coin) {
return !client.getCoin().equals(coin);
}
protected boolean isSoldSufficient(double value, String coin) {
if (client.getSold() < value)
return false;
return true;
}
protected void withdraw(double value) {
client.setSold(client.getSold() - value);
if (!client.getClientBank()) {
client.setSold(client.getSold() - (0.1 * value));
}
history.update("ID: " + client.getId() + "\t" + "ACTION: withdraw \t" + df.format(value)
+ "\t TIME: " + LocalDateTime.now(), client.getClientBank());
}
protected void add(double value) {
client.setSold(value + client.getSold());
history.update("ID: " + client.getId() + "\t" + "ACTION: add \t" + df.format(value)
+ "\t TIME: " + LocalDateTime.now(), client.getClientBank());
}
protected void exchange(double value, String coin, String coinOfExchange) {
history.update("ID: " + client.getId() + "\t" + "ACTION: exchange " + df.format(value) + " "
+ coin + " in " + coinOfExchange+ "\t TIME: " + LocalDateTime.now(), client.getClientBank());
}
protected void logOut() {
history.update("ID: " + client.getId() + "\t" + "ACTION: logout \t"
+ "TIME: " + LocalDateTime.now(), client.getClientBank());
handlerDataBase.updateClientProfile(client);
}
protected boolean isClientBank() {
return client.getClientBank();
}
protected String getCoin() {
return client.getCoin();
}
protected boolean isClientBlocked() {
return client.getBlockAccount();
}
private String computeClientHistory(String clientId, String fileName) {
StringBuilder clientHistory = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
String line = null;
while ((line = reader.readLine()) != null) {
String idLine = line.split("\t")[0].split(" ")[1].trim();
if (clientId.equals(idLine)) {
clientHistory.append(line + "\n");
}
}
} catch (FileNotFoundException e) {
System.err.println("File not found");
} catch (IOException e) {
System.out.println("Error reading");
}
return clientHistory.toString();
}
protected String getClientHistory(String clientId) {
String fileName = clientsHistoryFileName;
handlerDataBase.serchClient(clientId);
if (!handlerDataBase.isClientBank())
fileName = othersHistoryFileName;
return computeClientHistory(clientId, fileName);
}
public void unlockClientAccount(String clientId) {
handlerDataBase.serchClient(clientId);
initClient();
client.setBlockedAccount(false);
handlerDataBase.updateClientProfile(client);
}
}
| [
"Cosmina.Mandru@ibm.com"
] | Cosmina.Mandru@ibm.com |
96396d1ff98d1ecc8baeb5e9c00c45a5b11a83b0 | ee1244b10de45679f053293e366f192af307be74 | /sources/com/google/android/gms/internal/config/zzbf.java | 8e4464e7cfb25e1a75b242c02a268d01024b3382 | [] | no_license | scarletstuff/Turbogram | a086e50b3f4d7036526075199616682a0d7c9c45 | 21b8862573953add9260f1eb586f0985d2c71e8e | refs/heads/master | 2021-09-23T14:34:23.323880 | 2018-09-24T17:48:43 | 2018-09-24T17:48:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,845 | java | package com.google.android.gms.internal.config;
import java.nio.charset.Charset;
import java.util.Arrays;
public final class zzbf {
private static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
protected static final Charset UTF_8 = Charset.forName("UTF-8");
public static final Object zzcp = new Object();
public static boolean equals(Object[] objArr, Object[] objArr2) {
boolean length = objArr == null ? false : objArr.length;
int length2 = objArr2 == null ? 0 : objArr2.length;
int i = 0;
boolean z = false;
while (true) {
if (z >= length || objArr[z] != null) {
int i2 = i;
while (i2 < length2 && objArr2[i2] == null) {
i2++;
}
boolean z2 = z >= length;
boolean z3 = i2 >= length2;
if (z2 && z3) {
return true;
}
if (z2 != z3 || !objArr[z].equals(objArr2[i2])) {
return false;
}
i = i2 + 1;
z++;
} else {
z++;
}
}
}
public static int hashCode(Object[] objArr) {
int length = objArr == null ? 0 : objArr.length;
int i = 0;
int i2 = 0;
while (i < length) {
Object obj = objArr[i];
i++;
i2 = obj != null ? obj.hashCode() + (i2 * 31) : i2;
}
return i2;
}
public static int zza(byte[][] bArr) {
int length = bArr == null ? 0 : bArr.length;
int i = 0;
int i2 = 0;
while (i < length) {
byte[] bArr2 = bArr[i];
i++;
i2 = bArr2 != null ? Arrays.hashCode(bArr2) + (i2 * 31) : i2;
}
return i2;
}
public static void zza(zzbb zzbb, zzbb zzbb2) {
if (zzbb.zzch != null) {
zzbb2.zzch = (zzbd) zzbb.zzch.clone();
}
}
public static boolean zza(byte[][] bArr, byte[][] bArr2) {
boolean length = bArr == null ? false : bArr.length;
int length2 = bArr2 == null ? 0 : bArr2.length;
int i = 0;
boolean z = false;
while (true) {
if (z >= length || bArr[z] != null) {
int i2 = i;
while (i2 < length2 && bArr2[i2] == null) {
i2++;
}
boolean z2 = z >= length;
boolean z3 = i2 >= length2;
if (z2 && z3) {
return true;
}
if (z2 != z3 || !Arrays.equals(bArr[z], bArr2[i2])) {
return false;
}
i = i2 + 1;
z++;
} else {
z++;
}
}
}
}
| [
"root@linuxhub.it"
] | root@linuxhub.it |
23276cb91d7ddc08895b9dbc7b18ff0148ceb3ce | 7911c01ac6ef8ecea40206a5c3dd47a27f1019f9 | /src/main/java/ru/eltech/csa/siths/entity/node/IssuePriority.java | 918e431996843a942cb0a9def8b842b433517158 | [
"MIT"
] | permissive | rufeltech/testing_server | af7c035e9ccbcd5d953e4a7395760a61aaadf2a3 | 4b30357911c914b62e04613835b7a7ce83caea37 | refs/heads/master | 2020-06-01T03:17:51.400245 | 2014-05-10T11:31:08 | 2014-05-10T11:31:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package ru.eltech.csa.siths.entity.node;
import org.springframework.data.neo4j.annotation.NodeEntity;
import ru.eltech.csa.siths.entity.node.AbstractMeasuredCharacteristic;
@NodeEntity
public class IssuePriority extends AbstractMeasuredCharacteristic {
} | [
"ruf9191@mail.ru"
] | ruf9191@mail.ru |
544772f1cdcc347c0ef9d4491a52a5db4db84045 | 61f18e4d6f924c0ba8f8c41ee8067fc051e290e7 | /uil/sdkUtil/gen/com/jiaxun/dptsdk/R.java | 9dad5da2ea26cfe65be6b034792b93220a5c688b | [] | no_license | hchn/diaodu | 5bc27c71165b6421388239725da2846a0ed4ff53 | 5bf618ae2947b41f31163808d78d02108226b8d9 | refs/heads/master | 2020-03-22T05:22:01.799124 | 2018-07-03T09:37:26 | 2018-07-03T09:37:26 | 139,560,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,547 | 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.jiaxun.dptsdk;
public final class R {
public static final class attr {
}
public static final class drawable {
public static int ic_launcher=0x7f020000;
}
public static final class string {
public static int app_name=0x7f030000;
}
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 int AppBaseTheme=0x7f040000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static int AppTheme=0x7f040001;
}
}
| [
"soarhn71@gmail.com"
] | soarhn71@gmail.com |
1b955a9929623763ed2276ca06bd8e0f8fad90b1 | 6efb91185d50cdfefc971bc1c82184ef3cd1d3e9 | /src/main/java/com/example/mymap9/splash.java | b02648e15cb8fa26fa221dfc641254734a878f4c | [] | no_license | shubhamhalvadia/Cmap | cca0b099c6d2b248e967fa9a89956f30375c1a85 | 3c1eafdedd93a7b7d1a751932e06ae2cdedd0a15 | refs/heads/master | 2023-01-01T21:06:29.175699 | 2020-10-28T07:17:06 | 2020-10-28T07:17:06 | 307,920,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.example.mymap9;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class splash extends AppCompatActivity {
Handler handler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
getSupportActionBar().hide();
handler=new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(splash.this,MainActivity.class);
startActivity(intent);
finish();
}
},4000);
}
} | [
"shubhamhalvadia@gmail.com"
] | shubhamhalvadia@gmail.com |
6d44641b0d2e011171d54520b6d771e0c3a31440 | dbf127dae0e4924aef9e6c187ab47369dec6e5e3 | /app/src/main/java/com/lai/baidumap/MainActivity.java | 0b1918e4ed2f657e60984ff8aa211650f96ba3af | [] | no_license | 15766736837/BaiduMap | 1a169b65d37a7847ea12e18a3384c3b5bb10cc14 | 57c20e4d1f5a34fed41c9c9034bfdeabac911af3 | refs/heads/master | 2020-12-03T04:15:59.555642 | 2017-06-30T02:44:21 | 2017-06-30T02:44:21 | 95,840,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,852 | java | package com.lai.baidumap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationConfiguration;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.model.LatLng;
public class MainActivity extends AppCompatActivity {
// 定位相关
LocationClient mLocClient;
public MyLocationListenner myListener = new MyLocationListenner();
private MyLocationConfiguration.LocationMode mCurrentMode;
BitmapDescriptor mCurrentMarker;
private static final int accuracyCircleFillColor = 0xAAFFFF88;
private static final int accuracyCircleStrokeColor = 0xAA00FF00;
MapView mMapView;
BaiduMap mBaiduMap;
// UI相关
RadioGroup.OnCheckedChangeListener radioButtonListener;
Button requestLocButton;
boolean isFirstLoc = true; // 是否首次定位
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//在使用SDK各组件之前初始化context信息,传入ApplicationContext
//注意该方法要再setContentView方法之前实现
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_main);
//获取地图控件引用
mMapView = (MapView) findViewById(R.id.bmapView);
/*//指定经纬度
LatLng latLng = new LatLng(39.963175, 116.400244);
//图标的Bitmap
BitmapDescriptor bitmap = BitmapDescriptorFactory.
fromResource(R.mipmap.icon_marka);
MarkerOptions position = new MarkerOptions().position(latLng).icon(bitmap);
//设置图标
BaiduMap map = mMapView.getMap();
map.addOverlay(position);*/
//定位
location();
}
private void location() {
requestLocButton = (Button) findViewById(R.id.button1);
mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
requestLocButton.setText("普通");
View.OnClickListener btnClickListener = new View.OnClickListener() {
public void onClick(View v) {
switch (mCurrentMode) {
case NORMAL:
requestLocButton.setText("跟随");
mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, mCurrentMarker));
break;
case COMPASS:
requestLocButton.setText("普通");
mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, mCurrentMarker));
break;
case FOLLOWING:
requestLocButton.setText("罗盘");
mCurrentMode = MyLocationConfiguration.LocationMode.COMPASS;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, mCurrentMarker));
break;
default:
break;
}
}
};
requestLocButton.setOnClickListener(btnClickListener);
RadioGroup group = (RadioGroup) this.findViewById(R.id.radioGroup);
radioButtonListener = new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.defaulticon) {
// 传入null则,恢复默认图标
mCurrentMarker = null;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, null));
}
if (checkedId == R.id.customicon) {
// 修改为自定义marker
mCurrentMarker = BitmapDescriptorFactory
.fromResource(R.mipmap.icon_geo);
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, mCurrentMarker,
accuracyCircleFillColor, accuracyCircleStrokeColor));
}
}
};
group.setOnCheckedChangeListener(radioButtonListener);
// 地图初始化
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
// 开启定位图层
mBaiduMap.setMyLocationEnabled(true);
// 定位初始化
mLocClient = new LocationClient(this);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(1000);
mLocClient.setLocOption(option);
mLocClient.start();
}
@Override
protected void onDestroy() {
// 退出时销毁定位
mLocClient.stop();
// 关闭定位图层
mBaiduMap.setMyLocationEnabled(false);
mMapView.onDestroy();
mMapView = null;
super.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
//在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理
mMapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
//在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理
mMapView.onPause();
}
/**
* 定位SDK监听函数
*/
public class MyLocationListenner implements BDLocationListener {
@Override
public void onReceiveLocation(BDLocation location) {
// map view 销毁后不在处理新接收的位置
if (location == null || mMapView == null) {
return;
}
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此处设置开发者获取到的方向信息,顺时针0-360
.direction(100).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
}
public void onReceivePoi(BDLocation poiLocation) {
}
}
} | [
"HH L"
] | HH L |
27ea8a625fc1438a992abe2de3804c08c9798c0f | d741d837faeefa16f1c3aaf9694a8f0d7f5e849d | /src/main/java/com/esri/core/geometry/Transformation2D.java | f5d07a54664a9396699d00f54cd9fd9f49be372e | [
"Apache-2.0"
] | permissive | colin-sgrc/geometry-api-java | 089c436d7a820e2f03c27656b93adbe7c500f306 | b17ee469eeb706bf343fe1d7e82e14ea71e07520 | refs/heads/master | 2021-01-14T08:41:37.557591 | 2015-09-30T17:22:32 | 2015-09-30T17:22:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,330 | java | /*
Copyright 1995-2015 Esri
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.
For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts Dept
380 New York Street
Redlands, California, USA 92373
email: contracts@esri.com
*/
package com.esri.core.geometry;
/**
* The affine transformation class for 2D. <br>
* Vector is a row: <code>
* <br> |m11 m12 0|
* <br>| x y 1| * |m21 m22 0| = |m11 * x + m21 * y + m31 m12 * x + m22 * y + m32 1|
* <br> |m31 m32 1|
* <br>Then elements of the Transformation2D are as follows:
* <br> |xx yx 0|
* <br>| x y 1| * |xy yy 0| = |xx * x + xy * y + xd yx * x + yy * y + yd 1|
* <br> |xd yd 1|
* <br>
* </code> Matrices are used for transformations of the vectors as rows (case
* 2). That means the math expressions on the Geometry matrix operations should
* be writen like this: <br>
* v' = v * M1 * M2 * M3 = ( (v * M1) * M2 ) * M3, where v is a vector, Mn are
* the matrices. <br>
* This is equivalent to the following line of code: <br>
* ResultVector = (M1.mul(M2).mul(M3)).transform(Vector)
*/
public final class Transformation2D {
/**
* Matrix coefficient XX of the transformation.
*/
public double xx;
/**
* Matrix coefficient XY of the transformation.
*/
public double xy;
/**
* X translation component of the transformation.
*/
public double xd;
/**
* Matrix coefficient YX of the transformation.
*/
public double yx;
/**
* Matrix coefficient YY of the transformation.
*/
public double yy;
/**
* Y translation component of the transformation.
*/
public double yd;
/**
* Creates a 2D affine transformation with identity transformation.
*/
public Transformation2D() {
setIdentity();
}
/**
* Creates a 2D affine transformation with a specified scale.
*
* @param scale
* The scale to use for the transformation.
*/
public Transformation2D(double scale) {
setScale(scale);
}
/**
* Initializes a zero transformation. Transforms any coordinate to (0, 0).
*/
public void setZero() {
xx = 0;
yy = 0;
xy = 0;
yx = 0;
xd = 0;
yd = 0;
}
void transform(Point2D psrc, Point2D pdst) {
double x = xx * psrc.x + xy * psrc.y + xd;
double y = yx * psrc.x + yy * psrc.y + yd;
pdst.x = x;
pdst.y = y;
}
/**
* Returns True when all members of this transformation are equal to the
* corresponding members of the other.
*/
@Override
public boolean equals(Object other) {
if (this == other)
return true;
if (!(other instanceof Transformation2D))
return false;
Transformation2D that = (Transformation2D) other;
return (xx == that.xx && xy == that.xy && xd == that.xd
&& yx == that.yx && yy == that.yy && yd == that.yd);
}
/**
* Returns the hash code for the 2D transformation.
*/
@Override
public int hashCode() {
int hash = NumberUtils.hash(xx);
hash = NumberUtils.hash(hash, xy);
hash = NumberUtils.hash(hash, xd);
hash = NumberUtils.hash(hash, yx);
hash = NumberUtils.hash(hash, yy);
hash = NumberUtils.hash(hash, yd);
return hash;
}
void transform(Point2D[] points, int start, int count) {
int n = Math.min(points.length, start + count);
for (int i = count; i < n; i++) {
transform(points[i], points[i]);
}
}
/**
* Transforms an array of points.
*
* @param pointsIn
* The points to be transformed.
* @param count
* The number of points to transform.
* @param pointsOut
* The transformed points are returned using this array. It
* should have the same or greater size as the input array.
*/
public void transform(Point[] pointsIn, int count, Point[] pointsOut) {
Point2D res = new Point2D();
for (int i = 0; i < count; i++) {
Point2D p = pointsIn[i].getXY();
res.x = xx * p.x + xy * p.y + xd;
res.y = yx * p.x + yy * p.y + yd;
pointsOut[i] = new Point(res.x, res.y);
}
}
/**
* Transforms an array of points stored in an array of doubles as
* interleaved XY coordinates.
*
* @param pointsXYInterleaved
* The array of points with interleaved X, Y values to be
* transformed.
* @param start
* The start point index to transform from (the actual element
* index is 2 * start).
* @param count
* The number of points to transform (the actual element count is
* 2 * count).
*/
public void transform(double[] pointsXYInterleaved, int start, int count) {
int n = Math.min(pointsXYInterleaved.length, (start + count) * 2) / 2;
for (int i = count; i < n; i++) {
double px = pointsXYInterleaved[2 * i];
double py = pointsXYInterleaved[2 * i + 1];
pointsXYInterleaved[2 * i] = xx * px + xy * py + xd;
pointsXYInterleaved[2 * i + 1] = yx * px + yy * py + yd;
}
}
/**
* Multiplies this matrix on the right with the "right" matrix. Stores the
* result into this matrix and returns a reference to it. <br>
* Equivalent to this *= right.
*
* @param right
* The matrix to be multiplied with.
*/
public void multiply(Transformation2D right) {
multiply(this, right, this);
}
/**
* Multiplies this matrix on the left with the "left" matrix. Stores the
* result into this matrix and returns a reference to it. <br>
* Equivalent to this = left * this.
*
* @param left
* The matrix to be multiplied with.
*/
public void mulLeft(Transformation2D left) {
multiply(left, this, this);
}
/**
* Performs multiplication of matrices a and b and places the result into
* this matrix. The a, b, and result could point to same objects. <br>
* Equivalent to result = a * b.
*
* @param a
* The 2D transformation to be multiplied.
* @param b
* The 2D transformation to be multiplied.
* @param result
* The 2D transformation created by multiplication of matrices.
*/
public static void multiply(Transformation2D a, Transformation2D b,
Transformation2D result) {
double xx, xy, xd, yx, yy, yd;
xx = a.xx * b.xx + a.yx * b.xy;
xy = a.xy * b.xx + a.yy * b.xy;
xd = a.xd * b.xx + a.yd * b.xy + b.xd;
yx = a.xx * b.yx + a.yx * b.yy;
yy = a.xy * b.yx + a.yy * b.yy;
yd = a.xd * b.yx + a.yd * b.yy + b.yd;
result.xx = xx;
result.xy = xy;
result.xd = xd;
result.yx = yx;
result.yy = yy;
result.yd = yd;
}
/**
* Returns a copy of the Transformation2D object.
*
* @return A copy of this object.
*/
public Transformation2D copy() {
Transformation2D result = new Transformation2D();
result.xx = xx;
result.xy = xy;
result.xd = xd;
result.yx = yx;
result.yy = yy;
result.yd = yd;
return result;
}
/**
* Writes the matrix coefficients in the order XX, XY, XD, YX, YY, YD into
* the given array.
*
* @param coefs
* The array into which the coefficients are returned. Should be
* of size 6 elements.
*/
public void getCoefficients(double[] coefs) {
if (coefs.length < 6)
throw new GeometryException(
"Buffer is too small. coefs needs 6 members");
coefs[0] = xx;
coefs[1] = xy;
coefs[2] = xd;
coefs[3] = yx;
coefs[4] = yy;
coefs[5] = yd;
}
/**
* Transforms envelope
*
* @param env
* The envelope that is to be transformed
*/
void transform(Envelope2D env) {
if (env.isEmpty())
return;
Point2D[] buf = new Point2D[4];
env.queryCorners(buf);
transform(buf, buf);
env.setFromPoints(buf, 4);
}
void transform(Point2D[] pointsIn, Point2D[] pointsOut) {
for (int i = 0; i < pointsIn.length; i++) {
Point2D res = new Point2D();
Point2D p = pointsIn[i];
res.x = xx * p.x + xy * p.y + xd;
res.y = yx * p.x + yy * p.y + yd;
pointsOut[i] = res;
}
}
/**
* Initialize transformation from two rectangles.
*/
void initializeFromRect(Envelope2D src, Envelope2D dest) {
if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth()
|| 0 == src.getHeight())
setZero();
else {
xy = yx = 0;
xx = dest.getWidth() / src.getWidth();
yy = dest.getHeight() / src.getHeight();
xd = dest.xmin - src.xmin * xx;
yd = dest.ymin - src.ymin * yy;
}
}
/**
* Initializes an orhtonormal transformation from the Src and Dest
* rectangles.
*
* The result transformation proportionally fits the Src into the Dest. The
* center of the Src will be in the center of the Dest.
*/
void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) {
if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth()
|| 0 == src.getHeight())
setZero();
else {
yx = 0;
xy = 0;
xx = dest.getWidth() / src.getWidth();
yy = dest.getHeight() / src.getHeight();
if (xx > yy)
xx = yy;
else
yy = xx;
Point2D destCenter = dest.getCenter();
Point2D srcCenter = src.getCenter();
xd = destCenter.x - srcCenter.x * xx;
yd = destCenter.y - srcCenter.y * yy;
}
}
/**
* Initializes transformation from Position, Tangent vector and offset
* value. Tangent vector must have unity length
*/
void initializeFromCurveParameters(Point2D Position, Point2D Tangent,
double Offset) {
// TODO
}
/**
* Transforms size.
*
* Creates an AABB with width of SizeSrc.x and height of SizeSrc.y.
* Transforms that AABB and gets a quadrangle in new coordinate system. The
* result x contains the length of the quadrangle edge, which were parallel
* to X in the original system, and y contains the length of the edge, that
* were parallel to the Y axis in the original system.
*/
Point2D transformSize(Point2D SizeSrc) {
Point2D pt = new Point2D();
pt.x = Math.sqrt(xx * xx + yx * yx) * SizeSrc.x;
pt.y = Math.sqrt(xy * xy + yy * yy) * SizeSrc.y;
return pt;
}
/**
* Transforms a tolerance value.
*
* @param tolerance
* The tolerance value.
*/
public double transform(double tolerance) {
// the function should be implemented as follows: find encompassing
// circle for the transformed circle of radius = Tolerance.
// this is approximation.
Point2D pt1 = new Point2D();
Point2D pt2 = new Point2D();
/*
* pt[0].Set(0, 0); pt[1].Set(1, 0); pt[2].Set(0, 1); Transform(pt);
* pt[1] -= pt[0]; pt[2] -= pt[0];
*/
pt1.setCoords(xx, yx);
pt2.setCoords(xy, yy);
pt1.sub(pt1);
double d1 = pt1.sqrLength() * 0.5;
pt1.setCoords(xx, yx);
pt2.setCoords(xy, yy);
pt1.add(pt2);
double d2 = pt1.sqrLength() * 0.5;
return tolerance * ((d1 > d2) ? Math.sqrt(d1) : Math.sqrt(d2));
}
// Performs linear part of the transformation only. Same as if xd, yd would
// be zeroed.
void transformWithoutShift(Point2D[] pointsIn, int from, int count,
Point2D[] pointsOut) {
for (int i = from, n = from + count; i < n; i++) {
Point2D p = pointsIn[i];
double new_x = xx * p.x + xy * p.y;
double new_y = yx * p.x + yy * p.y;
pointsOut[i].setCoords(new_x, new_y);
}
}
Point2D transformWithoutShift(Point2D srcPoint) {
double new_x = xx * srcPoint.x + xy * srcPoint.y;
double new_y = yx * srcPoint.x + yy * srcPoint.y;
return Point2D.construct(new_x, new_y);
}
/**
* Sets this matrix to be the identity matrix.
*/
public void setIdentity() {
xx = 1.0;
xy = 0;
xd = 0;
yx = 0;
yy = 1.0;
yd = 0;
}
/**
* Returns TRUE if this matrix is the identity matrix.
*/
public boolean isIdentity() {
return xx == 1.0 && yy == 1.0
&& (0 == xy && 0 == xd && 0 == yx && 0 == yd);
}
/**
* Returns TRUE if this matrix is an identity matrix within the given
* tolerance.
*
* @param tol
* The tolerance value.
*/
public boolean isIdentity(double tol) {
Point2D pt = Point2D.construct(0., 1.);
transform(pt, pt);
pt.sub(Point2D.construct(0., 1.));
if (pt.sqrLength() > tol * tol)
return false;
pt.setCoords(0, 0);
transform(pt, pt);
if (pt.sqrLength() > tol * tol)
return false;
pt.setCoords(1., 0.);
transform(pt, pt);
pt.sub(Point2D.construct(1., 0));
return pt.sqrLength() <= tol * tol;
}
/**
* Returns TRUE for reflective transformations. It inverts the sign of
* vector cross product.
*/
public boolean isReflective() {
return xx * yy - yx * xy < 0;
}
/**
* Returns TRUE if this transformation is a uniform transformation.
*
* The uniform transformation is a transformation, which transforms a square
* to a square.
*/
public boolean isUniform(double eps) {
double v1 = xx * xx + yx * yx;
double v2 = xy * xy + yy * yy;
double e = (v1 + v2) * eps;
return Math.abs(v1 - v2) <= e && Math.abs(xx * xy + yx * yy) <= e;
}
/**
* Returns TRUE if this transformation is a shift transformation. The shift
* transformation performs shift only.
*/
public boolean isShift() {
return xx == 1.0 && yy == 1.0 && 0 == xy && 0 == yx;
}
/**
* Returns TRUE if this transformation is a shift transformation within the
* given tolerance.
*
* @param tol
* The tolerance value.
*/
public boolean isShift(double tol) {
Point2D pt = transformWithoutShift(Point2D.construct(0., 1.));
pt.y -= 1.0;
if (pt.sqrLength() > tol * tol)
return false;
pt = transformWithoutShift(Point2D.construct(1., 0.));
pt.x -= 1.0;
return pt.sqrLength() <= tol * tol;
}
/**
* Returns TRUE if this is an orthonormal transformation with the given
* tolerance. The orthonormal: Rotation or rotoinversion and shift
* (preserves lengths of vectors and angles between vectors).
*
* @param tol
* The tolerance value.
*/
public boolean isOrthonormal(double tol) {
Transformation2D r = new Transformation2D();
r.xx = xx * xx + xy * xy;
r.xy = xx * yx + xy * yy;
r.yx = yx * xx + yy * xy;
r.yy = yx * yx + yy * yy;
r.xd = 0;
r.yd = 0;
return r.isIdentity(tol);
}
/**
* Returns TRUE if this matrix is degenerated (does not have an inverse)
* within the given tolerance.
*
* @param tol
* The tolerance value.
*/
public boolean isDegenerate(double tol) {
return Math.abs(xx * yy - yx * xy) <= 2 * tol
* (Math.abs(xx * yy) + Math.abs(yx * xy));
}
/**
* Returns TRUE, if this transformation does not have rotation and shear
* within the given tolerance.
*
* @param tol
* The tolerance value.
*/
public boolean isScaleAndShift(double tol) {
return xy * xy + yx * yx < (xx * xx + yy * yy) * tol;
}
/**
* Set this transformation to be a shift.
*
* @param x
* The X coordinate to shift to.
* @param y
* The Y coordinate to shift to.
*/
public void setShift(double x, double y) {
xx = 1;
xy = 0;
xd = x;
yx = 0;
yy = 1;
yd = y;
}
/**
* Set this transformation to be a scale.
*
* @param x
* The X coordinate to scale to.
* @param y
* The Y coordinate to scale to.
*/
public void setScale(double x, double y) {
xx = x;
xy = 0;
xd = 0;
yx = 0;
yy = y;
yd = 0;
}
/**
* Set transformation to be a uniform scale.
*
* @param _scale
* The scale of the transformation.
*/
public void setScale(double _scale) {
setScale(_scale, _scale);
}
/**
* Sets the transformation to be a flip around the X axis. Flips the X
* coordinates so that the x0 becomes x1 and vice verse.
*
* @param x0
* The X coordinate to flip.
* @param x1
* The X coordinate to flip to.
*/
public void setFlipX(double x0, double x1) {
xx = -1;
xy = 0;
xd = x0 + x1;
yx = 0;
yy = 1;
yd = 0;
}
/**
* Sets the transformation to be a flip around the Y axis. Flips the Y
* coordinates so that the y0 becomes y1 and vice verse.
*
* @param y0
* The Y coordinate to flip.
* @param y1
* The Y coordinate to flip to.
*/
public void setFlipY(double y0, double y1) {
xx = 1;
xy = 0;
xd = 0;
yx = 0;
yy = -1;
yd = y0 + y1;
}
/**
* Set transformation to a shear.
*
* @param proportionX
* The proportion of shearing in x direction.
* @param proportionY
* The proportion of shearing in y direction.
*/
public void setShear(double proportionX, double proportionY) {
xx = 1;
xy = proportionX;
xd = 0;
yx = proportionY;
yy = 1;
yd = 0;
}
/**
* Sets this transformation to be a rotation around point (0, 0).
*
* When the axis Y is directed up and X is directed to the right, the
* positive angle corresponds to the anti-clockwise rotation. When the axis
* Y is directed down and X is directed to the right, the positive angle
* corresponds to the clockwise rotation.
*
* @param angle_in_Radians
* The rotation angle in radian.
*/
public void setRotate(double angle_in_Radians) {
setRotate(Math.cos(angle_in_Radians), Math.sin(angle_in_Radians));
}
/**
* Produces a transformation that swaps x and y coordinate values. xx = 0.0;
* xy = 1.0; xd = 0; yx = 1.0; yy = 0.0; yd = 0;
*/
Transformation2D setSwapCoordinates() {
xx = 0.0;
xy = 1.0;
xd = 0;
yx = 1.0;
yy = 0.0;
yd = 0;
return this;
}
/**
* Sets this transformation to be a rotation around point rotationCenter.
*
* When the axis Y is directed up and X is directed to the right, the
* positive angle corresponds to the anti-clockwise rotation. When the axis
* Y is directed down and X is directed to the right, the positive angle
* corresponds to the clockwise rotation.
*
* @param angle_in_Radians
* The rotation angle in radian.
* @param rotationCenter
* The center point of the rotation.
*/
void setRotate(double angle_in_Radians, Point2D rotationCenter) {
setRotate(Math.cos(angle_in_Radians), Math.sin(angle_in_Radians),
rotationCenter);
}
/**
* Sets rotation for this transformation.
*
* When the axis Y is directed up and X is directed to the right, the
* positive angle corresponds to the anti-clockwise rotation. When the axis
* Y is directed down and X is directed to the right, the positive angle
* corresponds to the clockwise rotation.
*
* @param cosA
* The rotation angle.
* @param sinA
* The rotation angle.
*/
public void setRotate(double cosA, double sinA) {
xx = cosA;
xy = -sinA;
xd = 0;
yx = sinA;
yy = cosA;
yd = 0;
}
/**
* Sets this transformation to be a rotation around point rotationCenter.
*
* When the axis Y is directed up and X is directed to the right, the
* positive angle corresponds to the anti-clockwise rotation. When the axis
* Y is directed down and X is directed to the right, the positive angle
* corresponds to the clockwise rotation.
*
* @param cosA
* The cos of the rotation angle.
* @param sinA
* The sin of the rotation angle.
* @param rotationCenter
* The center point of the rotation.
*/
void setRotate(double cosA, double sinA, Point2D rotationCenter) {
setShift(-rotationCenter.x, -rotationCenter.y);
Transformation2D temp = new Transformation2D();
temp.setRotate(cosA, sinA);
multiply(temp);
shift(rotationCenter.x, rotationCenter.y);
}
/**
* Shifts the transformation.
*
* @param x
* The shift factor in X direction.
* @param y
* The shift factor in Y direction.
*/
public void shift(double x, double y) {
xd += x;
yd += y;
}
/**
* Scales the transformation.
*
* @param x
* The scale factor in X direction.
* @param y
* The scale factor in Y direction.
*/
public void scale(double x, double y) {
xx *= x;
xy *= x;
xd *= x;
yx *= y;
yy *= y;
yd *= y;
}
/**
* Flips the transformation around the X axis.
*
* @param x0
* The X coordinate to flip.
* @param x1
* The X coordinate to flip to.
*/
public void flipX(double x0, double x1) {
xx = -xx;
xy = -xy;
xd = x0 + x1 - xd;
}
/**
* Flips the transformation around the Y axis.
*
* @param y0
* The Y coordinate to flip.
* @param y1
* The Y coordinate to flip to.
*/
public void flipY(double y0, double y1) {
yx = -yx;
yy = -yy;
yd = y0 + y1 - yd;
}
/**
* Shears the transformation.
*
* @param proportionX
* The proportion of shearing in x direction.
* @param proportionY
* The proportion of shearing in y direction.
*/
public void shear(double proportionX, double proportionY) {
Transformation2D temp = new Transformation2D();
temp.setShear(proportionX, proportionY);
multiply(temp);
}
/**
* Rotates the transformation.
*
* @param angle_in_Radians
* The rotation angle in radian.
*/
public void rotate(double angle_in_Radians) {
Transformation2D temp = new Transformation2D();
temp.setRotate(angle_in_Radians);
multiply(temp);
}
/**
* Rotates the transformation.
*
* @param cos
* The cos angle of the rotation.
* @param sin
* The sin angle of the rotation.
*/
public void rotate(double cos, double sin) {
Transformation2D temp = new Transformation2D();
temp.setRotate(cos, sin);
multiply(temp);
}
/**
* Rotates the transformation aroung a center point.
*
* @param cos
* The cos angle of the rotation.
* @param sin
* sin angle of the rotation.
* @param rotationCenter
* The center point of the rotation.
*/
public void rotate(double cos, double sin, Point2D rotationCenter) {
Transformation2D temp = new Transformation2D();
temp.setRotate(cos, sin, rotationCenter);
multiply(temp);
}
/**
* Produces inverse matrix for this matrix and puts result into the inverse
* parameter.
*
* @param inverse
* The result inverse matrix.
*/
public void inverse(Transformation2D inverse) {
double det = xx * yy - xy * yx;
if (det == 0) {
inverse.setZero();
return;
}
det = 1 / det;
inverse.xd = (xy * yd - xd * yy) * det;
inverse.yd = (xd * yx - xx * yd) * det;
inverse.xx = yy * det;
inverse.xy = -xy * det;
inverse.yx = -yx * det;
inverse.yy = xx * det;
}
/**
* Inverses the matrix.
*
*/
public void inverse() {
inverse(this);
}
/**
* Extracts scaling part of the transformation. this == scale *
* rotateNshearNshift.
*
* @param scale
* The destination matrix where the scale part is copied.
* @param rotateNshearNshift
* The destination matrix where the part excluding rotation is
* copied.
*/
public void extractScaleTransform(Transformation2D scale,
Transformation2D rotateNshearNshift) {
scale.setScale(Math.sqrt(xx * xx + xy * xy),
Math.sqrt(yx * yx + yy * yy));
rotateNshearNshift.setScale(1.0 / scale.xx, 1.0 / scale.yy);
rotateNshearNshift.multiply(this);
}
}
| [
"stolstov@esri.com"
] | stolstov@esri.com |
634bd0551cd8dae2967edffa3fdba5d7e009ea6e | a82f709f3c2c89782db37c6a0f414d60728dc9fe | /src/test/java/br/com/forum/repository/CursoRepositoryTest.java | 6aeafba23e8a3fd436a4c96e91356eb0bf3806f5 | [] | no_license | gabrielsm14/forum-api | c91bba90de0e6d1f6040aa3c1bcc99722656a681 | c88f3d7be17ad4f2477ef88fc4bf0a466bf7fd3c | refs/heads/master | 2023-01-08T02:07:41.395908 | 2020-11-16T16:55:48 | 2020-11-16T16:55:48 | 301,522,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | package br.com.forum.repository;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import br.com.forum.modelo.Curso;
import br.com.forum.repository.CursoRepository;
@RunWith(SpringRunner.class)
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.ANY.NONE)
@ActiveProfiles("test") // quando rodar a class de test força esse profile como sendo ativo
public class CursoRepositoryTest {
@Autowired
private CursoRepository repository;
@Autowired
private TestEntityManager em;
@Test
public void deveriaCarregarUmCursoAoBuscarPeloSeuNome() {
String nomeCurso = "HTML 5";
Curso html5 = new Curso();
html5.setNome(nomeCurso);
html5.setCategoria("programação");
em.persist(html5);
Curso curso = repository.findByNome(nomeCurso);
Assert.assertNotNull(curso);
Assert.assertEquals(nomeCurso, curso.getNome());
}
@Test
public void NaoDeveriaCarregarUmCursoNaoCadastrado() {
String nomeCurso = "JPA";
Curso curso = repository.findByNome(nomeCurso);
Assert.assertNull(curso);
}
}
| [
"gabriel.mendonca14@outlook.com"
] | gabriel.mendonca14@outlook.com |
577d4f109a6068dddae5c5125cf1af6197053d9a | 5531f91855cfe626aceb4609aa044b46f4360eae | /admin/src/main/java/com/broadlee/dream/core/util/StreamingTransactionCapable.java | 8e2a63a9d6f64fd2afbf0a0079b562368ce11c5f | [] | no_license | TonghuaLee/BigBig | 09f4ce8250e1e69de296ad417323b00365302cd5 | b5004b17eff3ed9da74a7cfc5dca22861e577c7b | refs/heads/master | 2021-01-25T09:15:20.511913 | 2017-06-09T02:17:49 | 2017-06-09T02:17:49 | 93,808,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.broadlee.dream.core.util;
import org.springframework.transaction.PlatformTransactionManager;
public interface StreamingTransactionCapable {
int getRetryMax();
void setRetryMax(int retryMax);
<G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType) throws G;
<G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType, int transactionBehavior, int
isolationLevel) throws G;
<G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType, boolean useTransaction)
throws G;
<G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation,
Class<G> exceptionType, boolean useTransaction,
int transactionBehavior, int isolationLevel) throws G;
PlatformTransactionManager getTransactionManager();
void setTransactionManager(PlatformTransactionManager transactionManager);
}
| [
"929230157@qq.com"
] | 929230157@qq.com |
039dbeb47450d117130ba8aca0218f72058a81c3 | 4165b3692d006d4803f2f913d30876b9cc1a9bd9 | /app/src/main/java/com/reque/mascotica/Profile.java | 0fc03a6f159d4f9520b58620b10836c35c5cff65 | [] | no_license | diegomvalverde/MascoTica | 03b4f012a5e5b355228dcfd807ca522bb02b7bc0 | a1acbd83bbebe8c98a749b97deaa826c7cb874d2 | refs/heads/master | 2020-05-02T10:56:59.456800 | 2019-04-08T20:04:30 | 2019-04-08T20:04:30 | 177,912,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,837 | java | package com.reque.mascotica;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.appcompat.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class Profile extends AppCompatActivity {
private TextView mTextMessage;
private ArrayList<PropertyProfile> menuPostsProfile = new ArrayList<>();
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_Favorites:
mTextMessage.setText(R.string.title_Favorites);
return true;
case R.id.navigation_notifications:
mTextMessage.setText(R.string.title_notifications);
return true;
case R.id.navigation_Donate:
mTextMessage.setText(R.string.title_Donate);
return true;
case R.id.navigation_Profile:
mTextMessage.setText(R.string.title_Profile);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
mTextMessage = (TextView) findViewById(R.id.message);
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
menuPostsProfile.add(new PropertyProfile("agregar","Esta es una prueba de como se veria","60556566", 1));
menuPostsProfile.add(new PropertyProfile("camara","Esta es una prueba de como si funciona","706657890", 2));
//create our new array adapter
ArrayAdapter<PropertyProfile> adapter = new MenuArrayAdapterProfile(this, 0, menuPostsProfile);
ListView listView = (ListView) findViewById(R.id.customListView);
listView.setAdapter(adapter);
}
class MenuArrayAdapterProfile extends ArrayAdapter<PropertyProfile> {
private Context context;
private List<PropertyProfile> MenuPostsProfile;
//constructor, call on creation
public MenuArrayAdapterProfile(Context context, int resource, ArrayList<PropertyProfile> objects) {
super(context, resource, objects);
this.context = context;
this.MenuPostsProfile = objects;
}
//called when rendering the list
public View getView(int position, View convertView, ViewGroup parent) {
//get the property we are displaying
PropertyProfile propertyprofile1 = MenuPostsProfile.get(position);
//get the inflater and inflate the XML layout for each item
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.property_layout, null);
TextView descripcion = (TextView) view.findViewById(R.id.description);
TextView numTelefono = (TextView) view.findViewById(R.id.Telelfono);
ImageView image = (ImageView) view.findViewById(R.id.image);
//display trimmed excerpt for description
int descriptionLength = propertyprofile1.getDescripcion().length();
if(descriptionLength >= 100){
String descriptionTrim = propertyprofile1.getDescripcion().substring(0, 100) + "...";
descripcion.setText(descriptionTrim);
}else{
descripcion.setText(propertyprofile1.getDescripcion());
}
//set price and rental attributes
numTelefono.setText("NumTelefonico" + String.valueOf(propertyprofile1.getNumTelefono()));
//get the image associated with this property
int imageID = context.getResources().getIdentifier(propertyprofile1.getImagenl(), "drawable", context.getPackageName());
image.setImageResource(imageID);
return view;
}
}
}
| [
"ericksalazar_g@hotmail.com"
] | ericksalazar_g@hotmail.com |
b960675af62b4fe35394dec64a8f3c9df2a46e5a | 32544d3ffb4c16a239fc56e8bb8551700568b11a | /src/main/java/com/yidai/business/dao/basic/AwardDocumentMapper.java | 2cca52f45248b1595f2b07213bcef40a9b4c182f | [] | no_license | KissMyeyes/generator | 401a2c4f750e538607001a1d8049bed31e74003f | 1324d334e94572058168d26257ccdf25198ea5ec | refs/heads/master | 2020-04-07T22:38:23.766524 | 2019-01-16T03:17:27 | 2019-01-16T03:17:27 | 158,778,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.yidai.business.dao.basic;
import com.yidai.model.entity.basic.AwardDocument;
public interface AwardDocumentMapper {
int deleteByPrimaryKey(Integer id);
int insert(AwardDocument record);
int insertSelective(AwardDocument record);
AwardDocument selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AwardDocument record);
int updateByPrimaryKey(AwardDocument record);
} | [
"wang3wei8@qq.com"
] | wang3wei8@qq.com |
1b458e6287139e50af2d02935aeee4353929fe16 | aed76081b8deffc03314292abdc5a2bb9687a0f0 | /MinStack.java | 62a061671a52f4f199d4b192b72a98b554096e4a | [] | no_license | putEffortsIntoEverythingYouWant/AlgorithemExercise | 4e9241da2c2ec396bc0066a778ddfdad5b05c484 | 54bafbc85af189dc101239a1e33f5dfc0a6bedf4 | refs/heads/master | 2021-01-20T11:06:24.964744 | 2016-02-09T02:20:23 | 2016-02-09T02:20:23 | 34,208,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | /*
min stack
Implement a stack with min() function, which will return the smallest number in the stack.
It should support push, pop and min operation all in O(1) cost.
push(1)
pop() // return 1
push(2)
push(3)
min() // return 2
push(1)
min() // return 1
Note
min operation will never be called if there is no number in the stack.
*/
public class MinStack {
Stack<Integer> stack = new Stack<Integer>();
Stack<Integer> min = new Stack<Integer>();
public MinStack() {
// do initialize if necessary
}
public void push(int number) {
// write your code here
stack.push(number);
if(min.isEmpty()|| min.peek()>=number){
min.push(number);
}
}
public int pop() {
// write your code here
int num = stack.pop();
if(num==min.peek()){
min.pop();
}
return num;
}
public int min() {
// write your code here
return min.peek();
}
}
| [
"lisijing7@gmail.com"
] | lisijing7@gmail.com |
bce85168a7b0612afc9aac4a0d1696c4a9f5549f | 8ae61939aefc8068078a0101d1c7a01080066e5e | /src/com/ebupt/ebms/dao/impl/TermAlarmDaoImpl.java | fe2166cd5111085f62662fc856df394ef45dc054 | [] | no_license | bigcy/ebms | f49656b8b10b974be36eb61c86a3efe92e6aaa77 | 1b1c51b3b2c5d3a44f60db56f69cffe64a0717fc | refs/heads/master | 2020-12-30T14:34:45.427849 | 2015-01-06T08:47:49 | 2015-01-06T08:47:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | package com.ebupt.ebms.dao.impl;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;
import com.ebupt.ebms.dao.TermAlarmDao;
import com.ebupt.ebms.dao.support.DaoSupport;
import com.ebupt.ebms.entity.TermAlarm;
/**
* @author lishuhua Create time 2011-03-08
* @version 1.0
*/
@Repository
public class TermAlarmDaoImpl extends DaoSupport implements TermAlarmDao {
private static Logger log = Logger.getLogger(TermAlarmDaoImpl.class);
@Override
public TermAlarm findAlarm(String terminalId, String alarmcode, String time) {
try {
String sql = "from TermAlarm where terminalid = '" + terminalId + "' and alarmcode = '" + alarmcode
+ "' and time = '" + time + "'";
return (TermAlarm) this.findSingleObject(sql);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(),e);
}
return null;
}
}
| [
"shanjie@neotel.com.cn"
] | shanjie@neotel.com.cn |
2facb7d93756f20b46b05787751a7afcf90629e2 | 3a67c27b4a3ef40092629adc53b7a8863d49cd5f | /src/sistema/pkg1/pkg0/Empleado/Sistema.java | 769e4ef957e3ef5786b9bff24cad7ac4f50201f9 | [] | no_license | marcoabonce/ProyectoIS | 88772a41695dd5e945a7faa2be26f4e5b3c48c5e | 338b9ef216be6304bcc32073db1b7489d2863bfb | refs/heads/master | 2022-09-27T09:23:13.092280 | 2020-06-08T01:09:25 | 2020-06-08T01:09:25 | 268,920,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 910 | java | package sistema.pkg1.pkg0.Empleado;
public class Sistema {
public static void main(String[] args) {
Empleado e1 = new Empleado();
e1.setVisible(true); //cambie los colores
//AvCerrarSesión2 Av1 = new AvCerrarSesión2();
//Av1.setVisible(true);
//InicioEmpleado e2 = new InicioEmpleado();
//e2.setVisible(true);
//Pedido P1 = new Pedido("");
//P1.setVisible(true);
//AvEliminar Av2 = new AvEliminar();
//Av2.setVisible(true);
//AvTerminarPedido Av3 = new AvTerminarPedido();
//Av3.setVisible(true);
//Terminar Av4 = new Terminar();
//Av4.setVisible(true);
//AvCobrar Av5 = new AvCobrar(null, null);
//Av5.setVisible(true);
//Error er = new Error();
//er.setVisible(true);
}
}
| [
"PC@DESKTOP-HGCOCFT"
] | PC@DESKTOP-HGCOCFT |
6de0ceabb095c58e3474d41c2e94ee32f41e36ae | 22d93e73b4b829b6b8b64b09ea8ef7c676a6806a | /4.JavaCollections/src/com/javarush/task/task36/task3610/MyMultiMap.java | 9748f32b308b4145b938f37a94e72f0c94b1198c | [] | no_license | Sekator778/JavaRushTasks | 99b2844deaf42626704d23c8a83f75bd1a3661cb | 82f1801395fd53dc7ffacd1d902115475c4e8601 | refs/heads/master | 2022-12-05T06:33:42.385482 | 2020-12-20T17:51:00 | 2020-12-20T17:51:00 | 243,021,523 | 2 | 0 | null | 2022-11-16T01:33:26 | 2020-02-25T14:35:20 | Roff | UTF-8 | Java | false | false | 2,583 | java | package com.javarush.task.task36.task3610;
import java.io.Serializable;
import java.util.*;
public class MyMultiMap<K, V> extends HashMap<K, V> implements Cloneable, Serializable {
static final long serialVersionUID = 123456789L;
private HashMap<K, List<V>> map;
private int repeatCount;
public MyMultiMap(int repeatCount) {
this.repeatCount = repeatCount;
map = new HashMap<>();
}
@Override
public int size() {
return values().size();
}
@Override
public V put(K key, V value) {
List<V> list = map.get(key);
V current;
if (list != null) {
current = list.get(list.size() - 1);
} else {
list = new ArrayList<>();
list.add(value);
map.put(key, list);
return null;
}
if (map.containsKey(key) && map.get(key).size() < repeatCount) {
list.add(value);
return current;
} else if (map.containsKey(key) && map.get(key).size() == repeatCount) {
list.remove(0);
list.add(value);
return current;
}
return null;
//напишите тут ваш код
}
@Override
public V remove(Object key) {
if (map.get(key) != null) {
List<V> list = map.get(key);
V temp = list.remove(0);
if (list.isEmpty()) {
map.remove(key);
}
return temp;
} else {
return null;
}
}
@Override
public Set<K> keySet() {
return map.keySet();
}
@Override
public Collection<V> values() {
Collection<V> vs = new ArrayList<>();
map.forEach((key, value) -> vs.addAll(value));
return vs; //напишите тут ваш код
}
@Override
public boolean containsKey(Object key) {
return map.containsKey(key);//напишите тут ваш код
}
@Override
public boolean containsValue(Object value) {
return values().contains(value);//напишите тут ваш код
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
for (Map.Entry<K, List<V>> entry : map.entrySet()) {
sb.append(entry.getKey());
sb.append("=");
for (V v : entry.getValue()) {
sb.append(v);
sb.append(", ");
}
}
String substring = sb.substring(0, sb.length() - 2);
return substring + "}";
}
} | [
"sekator778@gmail.com"
] | sekator778@gmail.com |
d6d27c8fa0f1f0bdf350c857a46ffb30b765628c | 445c3a30003e0692ba46895901d6aeeae1b61c46 | /art/Art10.java | 9abe440bc9e2c7a60b6f00860f879a0f98271f3b | [] | no_license | bitdreamer/CS212 | b9434c6d08c8b29d45ff4c2f7ac1a58e8f4738cf | 0768584dccd63ff5bb138c4102ba32b6f639aaf1 | refs/heads/master | 2021-01-17T09:05:23.154890 | 2016-04-20T19:53:37 | 2016-04-20T19:53:37 | 29,108,770 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,178 | java |
// Art10.java
// CS-212 class 2016
package art;
import java.awt.*;
import javax.swing.*;
public class Art10 extends JFrame
{
public static void main( String [] args )
{
System.out.println("Hi!");
Art10 george = new Art10();
// george.demoStuff( g );
}
// constructor
public Art10()
{
setDefaultCloseOperation( EXIT_ON_CLOSE );
setTitle("Art10");
setSize( 500,500 );
setVisible( true );
}
@Override
public void paint( Graphics g )
{
super.paint( g );
demoStuff(g);
}
// bunch of primitive stuff from class
public void demoStuff( Graphics g )
{
g.drawLine( 100,100, 200, 300 );
g.setColor( Color.green );
g.fillRect( 100,200, 100, 50 );
g.setColor( new Color( 200, 57, 210 ) );
g.fillRect( 300,300, 100, 100);
g.setFont( new Font("TimesRoman",Font.PLAIN, 30) );
g.drawString("amazing", 300, 100);
g.drawOval(250, 50, 50, 100 );
Shape sh = g.getClip();
System.out.println("clip:"+sh);
int[] xvals = new int[] { 3,6,9 };
}
}
| [
"kosterb@meredith.edu"
] | kosterb@meredith.edu |
e94438e93655892ecf9d9fc2bde14b5db9ce5c58 | d320db6e9e0fcd023ad702136242c2a542ec2018 | /swak-test/src/test/java/com/swak/country/OecdCountryTest.java | ee7b3d3be9e4f19962fe8ecc9b0446cd57739262 | [
"Apache-2.0"
] | permissive | youbooks/swak | f7e249932c7dc3d3154ed40313c392645c2ee64d | d8d6ca32d80783667d9c27e0d2d56c9fd05ea918 | refs/heads/master | 2023-02-13T03:10:14.061240 | 2021-01-11T03:51:58 | 2021-01-11T03:51:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,256 | java | package com.swak.country;
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Sets;
import com.swak.entity.ColumnMapper;
import com.swak.entity.DataType;
import com.swak.entity.Result;
import com.swak.excel.ExcelUtils;
import com.swak.excel.impl.DefaultExcelMapper;
import com.swak.utils.ChineseUtils;
import com.swak.utils.JsonMapper;
import com.swak.utils.Lists;
import com.swak.utils.Maps;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 协定国家
*
* @author lifeng
* @date 2020年9月1日 下午3:36:50
*/
public class OecdCountryTest {
public static List<Country> countrys() throws IOException {
Result result = ExcelUtils.read(new StringExcelMapper(), CountryTest.class.getResourceAsStream("协定国家.xls"));
List<Imp> imps = result.getObj();
Set<String> names = Sets.newHashSet();
for (Imp imp : imps) {
if (ChineseUtils.isChinese(imp.name)) {
names.add(imp.name);
}
}
List<Country> oecds = Lists.newArrayList();
for (String name : names) {
Country country = new Country();
country.address = name;
oecds.add(country);
}
// Oecd 协定国家
List<Country> countrys = CountryTest.countrys();
for (Country oecd : oecds) {
Country found = null;
for (Country country : countrys) {
if (oecd.address.equals(country.address)) {
found = country;
break;
}
if (oecd.address.equals("②捷克斯洛伐克(适用于斯洛伐克)") && country.address.equals("斯洛伐克")) {
found = country;
break;
}
if (oecd.address.equals("①德国") && country.address.equals("德国")) {
found = country;
break;
}
if (oecd.address.equals("巴新") && country.address.equals("巴布亚新几内亚")) {
found = country;
break;
}
if (oecd.address.equals("③南斯拉夫 (适用于波斯尼亚和黑塞哥维那) YUGOSLAVIA(BOSNIA AND HERZEGOVINA)")
&& country.address.equals("南斯拉夫")) {
found = country;
break;
}
if (oecd.address.equals("菲律宾THE PHILIPPINES") && country.address.equals("菲律宾")) {
found = country;
break;
}
if (oecd.address.equals("蒙古") && country.address.equals("蒙古国")) {
found = country;
break;
}
if (oecd.address.equals("卡塔尔国") && country.address.equals("卡塔尔")) {
found = country;
break;
}
if (oecd.address.equals("吉尔吉斯") && country.address.equals("吉尔吉斯斯坦")) {
found = country;
break;
}
if (oecd.address.equals("刚果(布)") && country.address.equals("刚果共和国")) {
found = country;
break;
}
if (oecd.address.equals("孟加拉国") && country.address.equals("孟加拉")) {
found = country;
break;
}
}
if (found != null) {
oecd.address = found.address;
oecd.code = found.code;
oecd.py = found.py;
continue;
}
System.out.println(oecd);
}
Lists.sort(oecds, new Comparator<Country>() {
@Override
public int compare(Country o1, Country o2) {
return o1.code.compareTo(o2.code);
}
});
return oecds;
}
public static void main(String[] args) throws IOException {
// 所有的国家
List<Country> countrys = countrys();
Map<String, Classify> classifys = Maps.newOrderMap();
for (Country country : countrys) {
Classify classify = classifys.computeIfAbsent(country.py, (key) -> {
return new Classify(key);
});
classify.items.add(country);
}
List<Classify> types = Lists.newArrayList(classifys.values());
Lists.sort(types, new Comparator<Classify>() {
@Override
public int compare(Classify o1, Classify o2) {
return o1.name.compareTo(o2.name);
}
});
System.out.println(JsonMapper.toJson(types));
}
}
class StringExcelMapper extends DefaultExcelMapper<Imp> {
@Override
protected List<ColumnMapper> getRowMapper() {
List<ColumnMapper> columns = Lists.newArrayList();
columns.add(ColumnMapper.build("国家", "B", DataType.STRING, "name"));
return columns;
}
@Override
public int getStartRow() {
return 1;
}
}
@ToString
@Getter
@Setter
class Imp {
String name;
}
| [
"618lf@163.com"
] | 618lf@163.com |
ad7295350f1946f6bba3f5c22ebaa1cfff1a3a93 | f2a5effb84a09b6885e95f57680aa916d6b213b4 | /metamodel/StateCharts.diagram/src/statecharts/diagram/edit/policies/StateChartsTextSelectionEditPolicy.java | a0bd9c0b11346ebb3c7812ecde7b10b7ede5341c | [] | no_license | izsob/TTC13-PN2SC-EIQ | 998a45160dc7b50d1f982dc343946ad825c75087 | cfff281d05a1d6aad4a7287501bad83682199e7c | refs/heads/master | 2016-09-06T19:12:01.998834 | 2013-09-09T12:55:42 | 2013-09-09T12:55:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,061 | java | /*
*
*/
package statecharts.diagram.edit.policies;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FigureListener;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.editpolicies.SelectionEditPolicy;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
/**
* @generated
*/
public class StateChartsTextSelectionEditPolicy extends SelectionEditPolicy
implements IRefreshableFeedbackEditPolicy {
/**
* @generated
*/
private IFigure selectionFeedbackFigure;
/**
* @generated
*/
private IFigure focusFeedbackFigure;
/**
* @generated
*/
private FigureListener hostPositionListener;
/**
* @generated
*/
protected void showPrimarySelection() {
if (getHostFigure() instanceof WrappingLabel) {
((WrappingLabel) getHostFigure()).setSelected(true);
((WrappingLabel) getHostFigure()).setFocus(true);
} else {
showSelection();
showFocus();
}
}
/**
* @generated
*/
protected void showSelection() {
if (getHostFigure() instanceof WrappingLabel) {
((WrappingLabel) getHostFigure()).setSelected(true);
((WrappingLabel) getHostFigure()).setFocus(false);
} else {
hideSelection();
addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
getHostFigure().addFigureListener(getHostPositionListener());
refreshSelectionFeedback();
hideFocus();
}
}
/**
* @generated
*/
protected void hideSelection() {
if (getHostFigure() instanceof WrappingLabel) {
((WrappingLabel) getHostFigure()).setSelected(false);
((WrappingLabel) getHostFigure()).setFocus(false);
} else {
if (selectionFeedbackFigure != null) {
removeFeedback(selectionFeedbackFigure);
getHostFigure().removeFigureListener(getHostPositionListener());
selectionFeedbackFigure = null;
}
hideFocus();
}
}
/**
* @generated
*/
protected void showFocus() {
if (getHostFigure() instanceof WrappingLabel) {
((WrappingLabel) getHostFigure()).setFocus(true);
} else {
hideFocus();
addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
refreshFocusFeedback();
}
}
/**
* @generated
*/
protected void hideFocus() {
if (getHostFigure() instanceof WrappingLabel) {
((WrappingLabel) getHostFigure()).setFocus(false);
} else {
if (focusFeedbackFigure != null) {
removeFeedback(focusFeedbackFigure);
focusFeedbackFigure = null;
}
}
}
/**
* @generated
*/
protected Rectangle getFeedbackBounds() {
Rectangle bounds;
if (getHostFigure() instanceof Label) {
bounds = ((Label) getHostFigure()).getTextBounds();
bounds.intersect(getHostFigure().getBounds());
} else {
bounds = getHostFigure().getBounds().getCopy();
}
getHostFigure().getParent().translateToAbsolute(bounds);
getFeedbackLayer().translateToRelative(bounds);
return bounds;
}
/**
* @generated
*/
protected IFigure createSelectionFeedbackFigure() {
if (getHostFigure() instanceof Label) {
Label feedbackFigure = new Label();
feedbackFigure.setOpaque(true);
feedbackFigure
.setBackgroundColor(ColorConstants.menuBackgroundSelected);
feedbackFigure
.setForegroundColor(ColorConstants.menuForegroundSelected);
return feedbackFigure;
} else {
RectangleFigure feedbackFigure = new RectangleFigure();
feedbackFigure.setFill(false);
return feedbackFigure;
}
}
/**
* @generated
*/
protected IFigure createFocusFeedbackFigure() {
return new Figure() {
protected void paintFigure(Graphics graphics) {
graphics.drawFocus(getBounds().getResized(-1, -1));
}
};
}
/**
* @generated
*/
protected void updateLabel(Label target) {
Label source = (Label) getHostFigure();
target.setText(source.getText());
target.setTextAlignment(source.getTextAlignment());
target.setFont(source.getFont());
}
/**
* @generated
*/
protected void refreshSelectionFeedback() {
if (selectionFeedbackFigure != null) {
if (selectionFeedbackFigure instanceof Label) {
updateLabel((Label) selectionFeedbackFigure);
selectionFeedbackFigure.setBounds(getFeedbackBounds());
} else {
selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
5));
}
}
}
/**
* @generated
*/
protected void refreshFocusFeedback() {
if (focusFeedbackFigure != null) {
focusFeedbackFigure.setBounds(getFeedbackBounds());
}
}
/**
* @generated
*/
@Override
public void refreshFeedback() {
refreshSelectionFeedback();
refreshFocusFeedback();
}
/**
* @generated
*/
private FigureListener getHostPositionListener() {
if (hostPositionListener == null) {
hostPositionListener = new FigureListener() {
public void figureMoved(IFigure source) {
refreshFeedback();
}
};
}
return hostPositionListener;
}
}
| [
"benedek.izso@gmail.com"
] | benedek.izso@gmail.com |
4cef4edcd21284af92317dc98c85bdc12a76ce71 | 66041ed92e903ca26e28e6c365a7725b9986f992 | /src/main/java/com/gabrielc/cursomc/services/PedidoService.java | c870602bd4a85510b9fc8ed66d0c041352d73b67 | [] | no_license | GabrielCPDev/SpringProjectPayment | 59f710138030e3d818275df1b6a74442b3595002 | 6fa81f5c2f11a89677f311cbafadadc39a69e39e | refs/heads/master | 2020-07-08T07:17:45.672008 | 2019-08-22T17:44:29 | 2019-08-22T17:44:29 | 203,603,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.gabrielc.cursomc.services;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gabrielc.cursomc.domain.Pedido;
import com.gabrielc.cursomc.repositories.PedidoRepository;
import com.gabrielc.cursomc.services.exceptions.ObjectNotFoundException;
@Service
public class PedidoService {
@Autowired
private PedidoRepository repo;
public Pedido buscar(Integer id) {
Optional<Pedido> obj = repo.findById(id);
return obj.orElseThrow(() -> new ObjectNotFoundException(
"Objeto não encontrado! Id: " + id + ", Tipo: " + Pedido.class.getName()));
}
} | [
"gabrielcpcontato@outlook.com"
] | gabrielcpcontato@outlook.com |
a91d8062f7dcf57dfac5ab82d29add1e590de0fd | 3041c7314e3b64773589d55ef29bbee2a5aae49a | /scuttlebutt-client-lib/src/main/java/org/apache/tuweni/scuttlebutt/lib/FeedService.java | b49e3c3398cab9f3511f3b73de0e8375f1765aa9 | [
"Apache-2.0",
"CC0-1.0",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | josh-richardson/incubator-tuweni | 2c37c74791ec9bf845d54552f58fbef4789378b2 | c5b12ca83892680628de13d6a3e8d31767f63056 | refs/heads/master | 2020-07-30T23:03:03.988046 | 2019-09-23T02:00:14 | 2019-09-23T02:00:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,623 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package org.apache.tuweni.scuttlebutt.lib;
import org.apache.tuweni.concurrent.AsyncResult;
import org.apache.tuweni.scuttlebutt.lib.model.CouldNotSerializeException;
import org.apache.tuweni.scuttlebutt.lib.model.FeedMessage;
import org.apache.tuweni.scuttlebutt.lib.model.ScuttlebuttMessageContent;
import org.apache.tuweni.scuttlebutt.lib.model.StreamHandler;
import org.apache.tuweni.scuttlebutt.rpc.RPCAsyncRequest;
import org.apache.tuweni.scuttlebutt.rpc.RPCFunction;
import org.apache.tuweni.scuttlebutt.rpc.RPCResponse;
import org.apache.tuweni.scuttlebutt.rpc.RPCStreamRequest;
import org.apache.tuweni.scuttlebutt.rpc.mux.Multiplexer;
import org.apache.tuweni.scuttlebutt.rpc.mux.ScuttlebuttStreamHandler;
import org.apache.tuweni.scuttlebutt.rpc.mux.exceptions.ConnectionClosedException;
import java.io.IOException;
import java.util.Arrays;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* A service for operations that concern scuttlebutt feeds.
*
* Should be accessed via a ScuttlebuttClient instance.
*/
public final class FeedService {
private final Multiplexer multiplexer;
private final ObjectMapper objectMapper;
/**
*
* @param multiplexer the RPC request multiplexer to make requests with.
* @param mapper the object mapper to serialize published messages with.
*/
protected FeedService(Multiplexer multiplexer, ObjectMapper mapper) {
this.multiplexer = multiplexer;
this.objectMapper = mapper;
}
/**
* Publishes a message to the instance's own scuttlebutt feed, assuming the client established the connection using
* keys authorising it to perform this operation.
*
* @param content the message to publish to the feed
* @param <T> the content published should extend ScuttlebuttMessageContent to ensure the 'type' field is a String
* @return the newly published message, asynchronously
*
* @throws JsonProcessingException if 'content' could not be marshalled to JSON.
*/
public <T extends ScuttlebuttMessageContent> AsyncResult<FeedMessage> publish(T content)
throws JsonProcessingException {
JsonNode jsonNode = objectMapper.valueToTree(content);
RPCAsyncRequest asyncRequest = new RPCAsyncRequest(new RPCFunction("publish"), Arrays.asList(jsonNode));
return multiplexer.makeAsyncRequest(asyncRequest).thenApply(rpcResponse -> {
try {
return rpcResponse.asJSON(objectMapper, FeedMessage.class);
} catch (IOException ex) {
throw new CouldNotSerializeException(ex);
}
});
}
/**
* Streams every message in the instance's database.
*
* @param handler the handler for processing the streamed messages
* @throws JsonProcessingException if the request to open the stream could not be made due to a JSON marshalling
* error.
*
* @throws ConnectionClosedException if the stream could not be started because the connection is no longer open.
*/
public void createFeedStream(StreamHandler<FeedMessage> handler) throws JsonProcessingException,
ConnectionClosedException {
RPCStreamRequest streamRequest = new RPCStreamRequest(new RPCFunction("createFeedStream"), Arrays.asList());
multiplexer.openStream(streamRequest, (closer) -> new ScuttlebuttStreamHandler() {
@Override
public void onMessage(RPCResponse message) {
try {
handler.onMessage(message.asJSON(objectMapper, FeedMessage.class));
} catch (IOException e) {
handler.onStreamError(e);
}
}
@Override
public void onStreamEnd() {
handler.onStreamEnd();
}
@Override
public void onStreamError(Exception ex) {
handler.onStreamError(ex);
}
});
}
}
| [
"gordon.hugh.martin@gmail.com"
] | gordon.hugh.martin@gmail.com |
cf0402b75e6522718a661096c9a419f86e88ecf7 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_53_buggy/mutated/442/Node.java | 3993b251f4eb101532e69000c2dbb81ca59c5506 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,293 | java | package org.jsoup.nodes;
import org.jsoup.helper.StringUtil;
import org.jsoup.helper.Validate;
import org.jsoup.parser.Parser;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
The base, abstract Node model. Elements, Documents, Comments etc are all Node instances.
@author Jonathan Hedley, jonathan@hedley.net */
public abstract class Node implements Cloneable {
Node parentNode;
List<Node> childNodes;
Attributes attributes;
String baseUri;
int siblingIndex;
/**
Create a new Node.
@param baseUri base URI
@param attributes attributes (not null, but may be empty)
*/
protected Node(String baseUri, Attributes attributes) {
Validate.notNull(baseUri);
Validate.notNull(attributes);
childNodes = new ArrayList<Node>(4);
this.baseUri = baseUri.trim();
this.attributes = attributes;
}
protected Node(String baseUri) {
this(baseUri, new Attributes());
}
/**
* Default constructor. Doesn't setup base uri, children, or attributes; use with caution.
*/
protected Node() {
childNodes = Collections.emptyList();
attributes = null;
}
/**
Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
@return node name
*/
public abstract String nodeName();
/**
* Get an attribute's value by its key.
* <p/>
* To get an absolute URL from an attribute that may be a relative URL, prefix the key with <code><b>abs</b></code>,
* which is a shortcut to the {@link #absUrl} method.
* E.g.: <blockquote><code>String url = a.attr("abs:href");</code></blockquote>
* @param attributeKey The attribute key.
* @return The attribute, or empty string if not present (to avoid nulls).
* @see #attributes()
* @see #hasAttr(String)
* @see #absUrl(String)
*/
public String attr(String attributeKey) {
Validate.notNull(attributeKey);
if ((this) instanceof org.jsoup.nodes.Document) return ((org.jsoup.nodes.Document) (this));else if ((parentNode) == null) return null; else return parentNode.ownerDocument();
if (hasAttr(attributeKey))
return attributes.get(attributeKey);
else if (attributeKey.toLowerCase().startsWith("abs:"))
return absUrl(attributeKey.substring("abs:".length()));
else return "";
}
/**
* Get all of the element's attributes.
* @return attributes (which implements iterable, in same order as presented in original HTML).
*/
public Attributes attributes() {
return attributes;
}
/**
* Set an attribute (key=value). If the attribute already exists, it is replaced.
* @param attributeKey The attribute key.
* @param attributeValue The attribute value.
* @return this (for chaining)
*/
public Node attr(String attributeKey, String attributeValue) {
attributes.put(attributeKey, attributeValue);
return this;
}
/**
* Test if this element has an attribute.
* @param attributeKey The attribute key to check.
* @return true if the attribute exists, false if not.
*/
public boolean hasAttr(String attributeKey) {
Validate.notNull(attributeKey);
return attributes.hasKey(attributeKey);
}
/**
* Remove an attribute from this element.
* @param attributeKey The attribute to remove.
* @return this (for chaining)
*/
public Node removeAttr(String attributeKey) {
Validate.notNull(attributeKey);
attributes.remove(attributeKey);
return this;
}
/**
Get the base URI of this node.
@return base URI
*/
public String baseUri() {
return baseUri;
}
/**
Update the base URI of this node.
@param baseUri base URI to set
*/
public void setBaseUri(String baseUri) {
Validate.notNull(baseUri);
this.baseUri = baseUri;
}
/**
* Get an absolute URL from a URL attribute that may be relative (i.e. an <code><a href></code> or
* <code><img src></code>).
* <p/>
* E.g.: <code>String absUrl = linkEl.absUrl("href");</code>
* <p/>
* If the attribute value is already absolute (i.e. it starts with a protocol, like
* <code>http://</code> or <code>https://</code> etc), and it successfully parses as a URL, the attribute is
* returned directly. Otherwise, it is treated as a URL relative to the element's {@link #baseUri}, and made
* absolute using that.
* <p/>
* As an alternate, you can use the {@link #attr} method with the <code>abs:</code> prefix, e.g.:
* <code>String absUrl = linkEl.attr("abs:href");</code>
*
* @param attributeKey The attribute key
* @return An absolute URL if one could be made, or an empty string (not null) if the attribute was missing or
* could not be made successfully into a URL.
* @see #attr
* @see java.net.URL#URL(java.net.URL, String)
*/
public String absUrl(String attributeKey) {
Validate.notEmpty(attributeKey);
String relUrl = attr(attributeKey);
if (!hasAttr(attributeKey)) {
return ""; // nothing to make absolute with
} else {
URL base;
try {
try {
base = new URL(baseUri);
} catch (MalformedURLException e) {
// the base is unsuitable, but the attribute may be abs on its own, so try that
URL abs = new URL(relUrl);
return abs.toExternalForm();
}
// workaround: java resolves '//path/file + ?foo' to '//path/?foo', not '//path/file?foo' as desired
if (relUrl.startsWith("?"))
relUrl = base.getPath() + relUrl;
URL abs = new URL(base, relUrl);
return abs.toExternalForm();
} catch (MalformedURLException e) {
return "";
}
}
}
/**
Get a child node by index
@param index index of child node
@return the child node at this index.
*/
public Node childNode(int index) {
return childNodes.get(index);
}
/**
Get this node's children. Presented as an unmodifiable list: new children can not be added, but the child nodes
themselves can be manipulated.
@return list of children. If no children, returns an empty list.
*/
public List<Node> childNodes() {
return Collections.unmodifiableList(childNodes);
}
protected Node[] childNodesAsArray() {
return childNodes.toArray(new Node[childNodes().size()]);
}
/**
Gets this node's parent node.
@return parent node; or null if no parent.
*/
public Node parent() {
return parentNode;
}
/**
* Gets the Document associated with this Node.
* @return the Document associated with this Node, or null if there is no such Document.
*/
public Document ownerDocument() {
if (this instanceof Document)
return (Document) this;
else if (parentNode == null)
return null;
else
return parentNode.ownerDocument();
}
/**
* Remove (delete) this node from the DOM tree. If this node has children, they are also removed.
*/
public void remove() {
Validate.notNull(parentNode);
parentNode.removeChild(this);
}
/**
* Insert the specified HTML into the DOM before this node (i.e. as a preceeding sibling).
* @param html HTML to add before this node
* @return this node, for chaining
* @see #after(String)
*/
public Node before(String html) {
addSiblingHtml(siblingIndex(), html);
return this;
}
/**
* Insert the specified node into the DOM before this node (i.e. as a preceeding sibling).
* @param node to add before this node
* @return this node, for chaining
* @see #after(Node)
*/
public Node before(Node node) {
Validate.notNull(node);
Validate.notNull(parentNode);
parentNode.addChildren(siblingIndex(), node);
return this;
}
/**
* Insert the specified HTML into the DOM after this node (i.e. as a following sibling).
* @param html HTML to add after this node
* @return this node, for chaining
* @see #before(String)
*/
public Node after(String html) {
addSiblingHtml(siblingIndex()+1, html);
return this;
}
/**
* Insert the specified node into the DOM after this node (i.e. as a following sibling).
* @param node to add after this node
* @return this node, for chaining
* @see #before(Node)
*/
public Node after(Node node) {
Validate.notNull(node);
Validate.notNull(parentNode);
parentNode.addChildren(siblingIndex()+1, node);
return this;
}
private void addSiblingHtml(int index, String html) {
Validate.notNull(html);
Validate.notNull(parentNode);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> nodes = Parser.parseFragment(html, context, baseUri());
parentNode.addChildren(index, nodes.toArray(new Node[nodes.size()]));
}
/**
Wrap the supplied HTML around this node.
@param html HTML to wrap around this element, e.g. {@code <div class="head"></div>}. Can be arbitrarily deep.
@return this node, for chaining.
*/
public Node wrap(String html) {
Validate.notEmpty(html);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> wrapChildren = Parser.parseFragment(html, context, baseUri());
Node wrapNode = wrapChildren.get(0);
if (wrapNode == null || !(wrapNode instanceof Element)) // nothing to wrap with; noop
return null;
Element wrap = (Element) wrapNode;
Element deepest = getDeepChild(wrap);
parentNode.replaceChild(this, wrap);
deepest.addChildren(this);
// remainder (unbalanced wrap, like <div></div><p></p> -- The <p> is remainder
if (wrapChildren.size() > 0) {
for (int i = 0; i < wrapChildren.size(); i++) {
Node remainder = wrapChildren.get(i);
remainder.parentNode.removeChild(remainder);
wrap.appendChild(remainder);
}
}
return this;
}
private Element getDeepChild(Element el) {
List<Element> children = el.children();
if (children.size() > 0)
return getDeepChild(children.get(0));
else
return el;
}
/**
* Replace this node in the DOM with the supplied node.
* @param in the node that will will replace the existing node.
*/
public void replaceWith(Node in) {
Validate.notNull(in);
Validate.notNull(parentNode);
parentNode.replaceChild(this, in);
}
protected void setParentNode(Node parentNode) {
if (this.parentNode != null)
this.parentNode.removeChild(this);
this.parentNode = parentNode;
}
protected void replaceChild(Node out, Node in) {
Validate.isTrue(out.parentNode == this);
Validate.notNull(in);
if (in.parentNode != null)
in.parentNode.removeChild(in);
Integer index = out.siblingIndex();
childNodes.set(index, in);
in.parentNode = this;
in.setSiblingIndex(index);
out.parentNode = null;
}
protected void removeChild(Node out) {
Validate.isTrue(out.parentNode == this);
int index = out.siblingIndex();
childNodes.remove(index);
reindexChildren();
out.parentNode = null;
}
protected void addChildren(Node... children) {
//most used. short circuit addChildren(int), which hits reindex children and array copy
for (Node child: children) {
reparentChild(child);
childNodes.add(child);
child.setSiblingIndex(childNodes.size()-1);
}
}
protected void addChildren(int index, Node... children) {
Validate.noNullElements(children);
for (int i = children.length - 1; i >= 0; i--) {
Node in = children[i];
reparentChild(in);
childNodes.add(index, in);
}
reindexChildren();
}
private void reparentChild(Node child) {
if (child.parentNode != null)
child.parentNode.removeChild(child);
child.setParentNode(this);
}
private void reindexChildren() {
for (int i = 0; i < childNodes.size(); i++) {
childNodes.get(i).setSiblingIndex(i);
}
}
/**
Retrieves this node's sibling nodes. Effectively, {@link #childNodes() node.parent.childNodes()}.
@return node siblings, including this node
*/
public List<Node> siblingNodes() {
return parent().childNodes(); // TODO: should this strip out this node? i.e. not a sibling of self?
}
/**
Get this node's next sibling.
@return next sibling, or null if this is the last sibling
*/
public Node nextSibling() {
if (parentNode == null)
return null; // root
List<Node> siblings = parentNode.childNodes;
Integer index = siblingIndex();
Validate.notNull(index);
if (siblings.size() > index+1)
return siblings.get(index+1);
else
return null;
}
/**
Get this node's previous sibling.
@return the previous sibling, or null if this is the first sibling
*/
public Node previousSibling() {
List<Node> siblings = parentNode.childNodes;
Integer index = siblingIndex();
Validate.notNull(index);
if (index > 0)
return siblings.get(index-1);
else
return null;
}
/**
* Get the list index of this node in its node sibling list. I.e. if this is the first node
* sibling, returns 0.
* @return position in node sibling list
* @see org.jsoup.nodes.Element#elementSiblingIndex()
*/
public int siblingIndex() {
return siblingIndex;
}
protected void setSiblingIndex(int siblingIndex) {
this.siblingIndex = siblingIndex;
}
/**
Get the outer HTML of this node.
@return HTML
*/
public String outerHtml() {
StringBuilder accum = new StringBuilder(32*1024);
outerHtml(accum);
return accum.toString();
}
protected void outerHtml(StringBuilder accum) {
new NodeTraversor(new OuterHtmlVisitor(accum, getOutputSettings())).traverse(this);
}
// if this node has no document (or parent), retrieve the default output settings
private Document.OutputSettings getOutputSettings() {
return ownerDocument() != null ? ownerDocument().outputSettings() : (new Document("")).outputSettings();
}
/**
Get the outer HTML of this node.
@param accum accumulator to place HTML into
*/
abstract void outerHtmlHead(StringBuilder accum, int depth, Document.OutputSettings out);
abstract void outerHtmlTail(StringBuilder accum, int depth, Document.OutputSettings out);
public String toString() {
return outerHtml();
}
protected void indent(StringBuilder accum, int depth, Document.OutputSettings out) {
accum.append("\n").append(StringUtil.padding(depth * out.indentAmount()));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
// todo: have nodes hold a child index, compare against that and parent (not children)
return false;
}
@Override
public int hashCode() {
int result = parentNode != null ? parentNode.hashCode() : 0;
// not children, or will block stack as they go back up to parent)
result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
return result;
}
/**
* Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or
* parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the
* original node.
* <p>
* The cloned node may be adopted into another Document or node structure using {@link Element#appendChild(Node)}.
* @return stand-alone cloned node
*/
@Override
public Node clone() {
return doClone(null); // splits for orphan
}
protected Node doClone(Node parent) {
Node clone;
try {
clone = (Node) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
clone.parentNode = parent; // can be null, to create an orphan split
clone.siblingIndex = parent == null ? 0 : siblingIndex;
clone.attributes = attributes != null ? attributes.clone() : null;
clone.baseUri = baseUri;
clone.childNodes = new ArrayList<Node>(childNodes.size());
for (Node child: childNodes)
clone.childNodes.add(child.doClone(clone)); // clone() creates orphans, doClone() keeps parent
return clone;
}
private static class OuterHtmlVisitor implements NodeVisitor {
private StringBuilder accum;
private Document.OutputSettings out;
OuterHtmlVisitor(StringBuilder accum, Document.OutputSettings out) {
this.accum = accum;
this.out = out;
}
public void head(Node node, int depth) {
node.outerHtmlHead(accum, depth, out);
}
public void tail(Node node, int depth) {
if (!node.nodeName().equals("#text")) // saves a void hit.
node.outerHtmlTail(accum, depth, out);
}
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
0e763fb54ba6f4529cf1cfa069a94af2958f4779 | d6bf86106b256bb8adec39955f261bffd4f87e86 | /src/main/java/com/weixin/user/dao/UserDao.java | 8e6ea16ac3b6460d2927eb868bbf986173bfbecd | [] | no_license | gaohe1227/weixindemo | 06ab19d206ba5af01c45b2044cf7d2970e13a451 | ef83d57d9e513683994c5272cb44fc448143779d | refs/heads/master | 2021-01-20T20:03:37.784249 | 2016-06-09T09:47:02 | 2016-06-09T09:47:02 | 60,400,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.weixin.user.dao;
import com.weixin.base.dao.BaseDao;
import com.weixin.base.dao.MyBatisRepository;
import com.weixin.user.model.User;
@MyBatisRepository
public interface UserDao extends BaseDao<User>{
}
| [
"904724283@qq.com"
] | 904724283@qq.com |
c360eba4cb6f8324b6b5c5d78ea718adac626651 | 31223c5dbc41467f0b5eea1bfc8ca9fe1d70527e | /java-se/oca/_05_ClassDesign/src/_0045_polymorphic_parameters/Reptile.java | b8d3c06e65ea4c7d4c021ccde1a862f8e899de84 | [] | no_license | mimaraslan/java-certification | 0e39b8edc78ce4f1d328f0c7e0e73e019a9d5470 | 4ebcadc5f9533e0f7f477f6a6d76080ae8d381c5 | refs/heads/master | 2022-05-11T11:15:41.769437 | 2021-09-05T22:24:42 | 2021-09-05T22:24:42 | 185,800,286 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 113 | java | package _0045_polymorphic_parameters;
public class Reptile {
public String getName() {
return "Reptile";
}
} | [
"mimaraslan@gmail.com"
] | mimaraslan@gmail.com |
56d4e8386254743e3b16b93c6a19e40f1ed86965 | 55f884467936c7a3c7178f0305a0827f82029ed3 | /DiceGame.java | 9b6710df30bb534ac179205ca7dc887ea376e06c | [] | no_license | a1tereg0/Lab3 | 7a82e70a552c67d1bc3ccc830211e3e724543c7c | 8c6826cc63b251e2f780d067915b709c90aa7e6f | refs/heads/main | 2023-03-01T22:01:22.096665 | 2021-02-14T20:16:33 | 2021-02-14T20:16:33 | 338,489,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,633 | java | import java.util.HashSet;
import java.util.Set;
public class DiceGame {
public static void main(String[] args) {
Die normalDie = new Die();
Die die20Sided = new Die(20);
Die die12Sided = new Die(12, "d12");
normalDie.setSideUp(7); // returns false
die12Sided.setSideUp(5);
System.out.println("The top face of 12 sided die is "+die12Sided.getSideUp());
System.out.println("The number of sides on a normal die is "+normalDie.getNumSides());
System.out.println("The die type of 20 face die is "+die20Sided.getDiceType());
die12Sided.roll();
die20Sided.roll();
normalDie.roll();
System.out.println("You rolled "+die12Sided.getSideUp()+" on 12 sided die");
System.out.println("You rolled "+die20Sided.getSideUp()+" on 20 sided die");
System.out.println("You rolled "+normalDie.getSideUp()+" on the normal die");
System.out.println("**************************Bonus**********************************************");
Die[] dice = new Die[5];
for (int i = 0;i < dice.length;++i) {
dice[i] = new Die();
}
System.out.println("Rolling all five dices at once until cold-Yahtzee happens");
int count = 0;
while(true) {
Set<Integer> rollValue = new HashSet<>();
for (int i = 0;i < dice.length;i++) {
dice[i].roll();
rollValue.add(dice[i].getSideUp());
}
++count;
if (rollValue.size() == 1) break;
}
System.out.println("It took "+count+" rolls.");
}
}
| [
"prashantdah41@gmail.com"
] | prashantdah41@gmail.com |
5fdc6c75779ade6fbf0fa56679cd5631ded9f969 | 38de50893ee6004d4c7511934b5259be53d4a03a | /Examples/src/es/uja/git/sm/utils/Sounds.java | 784180d53b5fe03e1a2f6fc74e5e533504c79fcc | [] | no_license | jccuevas/sv_ejemplos | 20ed0310cc361793256310274d9fc9d23cb2d7af | 27c09b456cd66ba249bad6ef35bf114b8cad1dd1 | refs/heads/master | 2021-01-10T08:58:58.759048 | 2015-11-24T20:34:46 | 2015-11-24T20:34:46 | 43,441,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,894 | java | package es.uja.git.sm.utils;
import java.util.HashMap;
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import es.uja.git.sm.examples.R;
public class Sounds {
private static SoundPool soundPool;
private static HashMap<Integer,Integer> soundPoolMap;
public static final int SOUND_1 = R.raw.s1;
public static final int SOUND_2 = R.raw.s2;
public static final int SOUND_3 = R.raw.s3;
/** Populate the SoundPool */
public static void initSounds(Context context) {
soundPool = new SoundPool(3, AudioManager.STREAM_MUSIC, 0);
soundPoolMap = new HashMap<Integer,Integer>(3);
soundPoolMap.put(SOUND_1, soundPool.load(context, R.raw.s1, 1));
soundPoolMap.put(SOUND_2, soundPool.load(context, R.raw.s2, 2));
soundPoolMap.put(SOUND_3, soundPool.load(context, R.raw.s3, 3));
}
public static void playSound(Context context, int soundID) {
if (soundPool == null || soundPoolMap == null) {
initSounds(context);
}
float volume = 1.0f;// whatever in the range = 0.0 to 1.0
// play sound with same right and left volume, with a priority of 1,
// zero repeats (i.e play once), and a playback rate of 1f
soundPool.play((Integer) soundPoolMap.get(soundID), volume, volume, 0,
0, 1f);
}
public static void playSoundLoop(Context context, int soundID) {
if (soundPool == null || soundPoolMap == null) {
initSounds(context);
}
float volume = 1.0f;// whatever in the range = 0.0 to 1.0
// play sound with same right and left volume, with a priority of 1,
// zero repeats (i.e play once), and a playback rate of 1f
soundPool.play((Integer) soundPoolMap.get(soundID), volume, volume, 1,
-1, 1f);
}
public static void stopLoop()
{
soundPool.stop(SOUND_1);
}
public static void pause()
{
soundPool.autoPause();
}
public static void resume()
{
soundPool.autoResume();
}
}
| [
"jccuevas@ujaen.es"
] | jccuevas@ujaen.es |
cb925f5cb34eb0bda4c3afc7071cd08553e67d65 | 129f58086770fc74c171e9c1edfd63b4257210f3 | /src/testcases/CWE80_XSS/CWE80_XSS__CWE182_getQueryString_Servlet_53a.java | affab5d874a4404afa4ac9bf276264da937909a9 | [] | no_license | glopezGitHub/Android23 | 1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba | 6215d0684c4fbdc7217ccfbedfccfca69824cc5e | refs/heads/master | 2023-03-07T15:14:59.447795 | 2023-02-06T13:59:49 | 2023-02-06T13:59:49 | 6,856,387 | 0 | 3 | null | 2023-02-06T18:38:17 | 2012-11-25T22:04:23 | Java | UTF-8 | Java | false | false | 2,877 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE80_XSS__CWE182_getQueryString_Servlet_53a.java
Label Definition File: CWE80_XSS__CWE182.label.xml
Template File: sources-sink-53a.tmpl.java
*/
/*
* @description
* CWE: 80 Cross Site Scripting (XSS)
* BadSource: getQueryString_Servlet Parse id param out of the URL query string (without using getParameter())
* GoodSource: A hardcoded string
* Sinks:
* BadSink : Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS (CWE 182: Collapse of Data into Unsafe Value)
* Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package
*
* */
package testcases.CWE80_XSS;
import testcasesupport.*;
import javax.servlet.http.*;
import javax.servlet.http.*;
import java.util.StringTokenizer;
public class CWE80_XSS__CWE182_getQueryString_Servlet_53a extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
data = ""; /* initialize data in case id is not in query string */
/* POTENTIAL FLAW: Parse id param out of the URL querystring (without using getParameter()) */
{
StringTokenizer st = new StringTokenizer(request.getQueryString(), "&");
while (st.hasMoreTokens())
{
String token = st.nextToken(); /* a token will be like "id=foo" */
if(token.startsWith("id=")) /* check if we have the "id" parameter" */
{
data = token.substring(3); /* set data to "foo" */
break; /* exit while loop */
}
}
}
(new CWE80_XSS__CWE182_getQueryString_Servlet_53b()).bad_sink(data , request, response);
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B(request, response);
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
/* FIX: Use a hardcoded string */
data = "foo";
(new CWE80_XSS__CWE182_getQueryString_Servlet_53b()).goodG2B_sink(data , request, response);
}
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"guillermo.pando@gmail.com"
] | guillermo.pando@gmail.com |
ec32dbe549d1c12584380c00f8f74fc3e6a0de8d | f49077439913979c8caaa39961e2f3ac72ff3935 | /lab/lab09/moneyflow/app/src/androidTest/java/com/example/student/lab09/ExampleInstrumentedTest.java | 99174065aef2e25b1d87f9b195423bdbd390cda8 | [] | no_license | Kawin3236/course-android-kmitl | 9e38effa8724fb245f3e715856796f85e019b579 | 6ff8d1d48948926869d11a7633e870404440f57f | refs/heads/master | 2021-01-16T00:56:28.195350 | 2017-11-18T19:27:16 | 2017-11-18T19:27:16 | 99,984,309 | 0 | 0 | null | 2017-08-11T02:40:53 | 2017-08-11T02:40:53 | null | UTF-8 | Java | false | false | 754 | java | package com.example.student.lab09;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.student.lab09", appContext.getPackageName());
}
}
| [
"student@LAB308-27.it.kmitl.ac.th"
] | student@LAB308-27.it.kmitl.ac.th |
196689856ee5e05a60945bb2d1ab055b5d6bbf05 | c9c19813102994ff96aa5a65567000077062c24b | /Programming 3 coursework/src/Scrappers/MP3data.java | 66efa57b3cfcb2fe10d623b2aac5047a911e1fda | [] | no_license | roshankalyan/music | 00e65fa8555b5b26e1a02ecce1bf20387881723e | 903cb5fd8d6ef2d4dd6e670b46b675d4d97671f3 | refs/heads/master | 2021-01-19T00:57:45.353941 | 2016-06-10T11:04:03 | 2016-06-10T11:04:03 | 60,695,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | 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 Scrappers;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.file.Path;
import javazoom.jl.player.Player;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
/**
*
* @author roshan
*/
public class MP3data {
public static int getSeconds(Path DirectPath) {
File file = (DirectPath.toFile());
int duration = 0;
try {
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
Player player = new Player(bis);
AudioFile audioFile = AudioFileIO.read(file);
duration = audioFile.getAudioHeader().getTrackLength();
// int numberOfMinutes = ((duration % 86400) % 3600) / 60;
// int numberOfSeconds = ((duration % 86400 ) % 3600 ) % 60 ;
//System.out.print("time in milliseconds= " + numberOfMinutes + ":"+ numberOfSeconds);
//player.play();
} catch (Exception e) {
System.out.print("ERROR " + e);
}
return duration;
}
}
| [
"roshan@DESKTOP-B4K4TOO.Asus"
] | roshan@DESKTOP-B4K4TOO.Asus |
f3083b5c171451bfd5fe33924a9523d086db6871 | 59c304ba8532e2d06f549dfc1f4258ac5e90ab65 | /voronoi-pages-app/src/main/java/uq/exp/PerformanceFIFOTest.java | 78a0ada62f0213520bee32b309f93a6c18d86a2c | [] | no_license | douglasapeixoto/voronoi-pages-spark | 5c70348885dfae022eb6adca0c4e0fcd9c157ce5 | 0246d272e083c3c22102990e9aab841dbaf8f7dd | refs/heads/master | 2020-12-29T00:13:08.771542 | 2016-06-15T08:23:19 | 2016-06-15T08:23:19 | 46,105,129 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,069 | java | package uq.exp;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import org.apache.spark.broadcast.Broadcast;
import uq.fs.HDFSFileService;
import uq.spark.EnvironmentVariables;
import uq.spark.MyLogger;
import uq.spark.index.DataPartitioningModule;
import uq.spark.index.IndexParameters;
import uq.spark.index.TrajectoryTrackTableRDD;
import uq.spark.index.VoronoiDiagram;
import uq.spark.index.VoronoiPagesRDD;
import uq.spark.query.NearNeighbor;
import uq.spark.query.QueryProcessingModule;
import uq.spatial.GeoInterface;
import uq.spatial.Point;
import uq.spatial.STBox;
import uq.spatial.Trajectory;
/**
* Experiment to evaluate performance of queries.
* Generate log result with query performance information.
* </br>
* Process queries in FIFO way (using Spark's FIFO scheduling).
*
* @author uqdalves
*
*/
@SuppressWarnings("serial")
public class PerformanceFIFOTest implements Serializable, EnvironmentVariables, IndexParameters, GeoInterface {
private static final HDFSFileService HDFS =
new HDFSFileService();
// experiments log
private static final MyLogger LOG =
new MyLogger("experiments-mem-" + K + "-" + TIME_WINDOW_SIZE + "s");
/**
* Main
*/
public static void main(String[] args){
System.out.println("\n[EXPERIMENTS MODULE] "
+ "Running Performance Test..\n");
/************************
* DATA INDEXING
************************/
DataPartitioningModule partitioningService =
new DataPartitioningModule();
// run data partitioning and indexing
partitioningService.run();
// get the voronoi diagram abstraction.
Broadcast<VoronoiDiagram> voronoiDiagram =
partitioningService.getVoronoiDiagram();
// get the RDD of Voronoi pages
VoronoiPagesRDD voronoiPagesRDD =
partitioningService.getVoronoiPagesRDD();
// get trajectory track table
TrajectoryTrackTableRDD trajectoryTrackTable =
partitioningService.getTrajectoryTrackTable();
/************************
* LOAD/WRITE THE INDEX
************************/
// save the index structure
/* voronoiPagesRDD.save(LOCAL_PATH + "/index-structure-7");
trajectoryTrackTable.save(LOCAL_PATH + "/index-structure-7");
// load the index structure
VoronoiPagesRDD voronoiPagesRDD = new VoronoiPagesRDD();
voronoiPagesRDD.load(TACHYON_PATH + "/index-structure/pages-rdd");
TrajectoryTrackTable trajectoryTrackTable = new TrajectoryTrackTable();
trajectoryTrackTable.load(TACHYON_PATH + "/index-structure/trajectory-track-table-rdd");
// save information regarding indexing
voronoiPagesRDD.savePagesInfo();
trajectoryTrackTable.saveTableInfo();
*/
// action to force building the index
System.out.println("Num. Pages: " + voronoiPagesRDD.count());
System.out.println("Num. TTT Tuples: " + trajectoryTrackTable.count());
/************************
* QUERIES PROCESING
************************/
System.out.println("\n[EXPERIMENTS MODULE] Query Processing Starts At "
+ System.currentTimeMillis() + " ms.\n");
QueryProcessingModule queryService = new QueryProcessingModule(
voronoiPagesRDD, trajectoryTrackTable, voronoiDiagram);
/******
* SPATIAL TEMPORAL SELECTION QUERIES (WHOLE)
******/
final List<STBox> stUseCases = readSpatialTemporalTestCases();
{
LOG.appendln("Spatial-Temporal Selection Query Result (Whole):\n");
long selecQueryTime=0;
int queryId=1;
for(STBox stObj : stUseCases){
System.out.println("Query " + queryId);
long start = System.currentTimeMillis();
LOG.appendln("Query " + queryId + " starts at: " + start + "ms.");
// run query - whole trajectories
List<Trajectory> result = queryService
.getSpatialTemporalSelection(stObj, stObj.timeIni, stObj.timeEnd, true);
long time = System.currentTimeMillis()-start;
LOG.appendln("Query " + queryId++ + ": " + result.size() + " trajectories in " + time + " ms.");
selecQueryTime += time;
}
LOG.appendln("Spatial-Temporal Selection ends at: " + System.currentTimeMillis() + " ms.");
LOG.appendln("Total Spatial-Temporal Selection Query Time: " + selecQueryTime + " ms.\n");
}
/******
* SPATIAL TEMPORAL SELECTION QUERIES (EXACT)
******/
{
LOG.appendln("Spatial-Temporal Selection Query Result (Exact):\n");
long selecQueryTime=0;
int queryId=1;
for(STBox stObj : stUseCases){
System.out.println("Query " + queryId);
long start = System.currentTimeMillis();
LOG.appendln("Query " + queryId + " starts at: " + start + " ms.");
// run query - exact sub-trajectories
List<Trajectory> result = queryService
.getSpatialTemporalSelection(stObj, stObj.timeIni, stObj.timeEnd, false);
long time = System.currentTimeMillis()-start;
LOG.appendln("Query " + queryId++ + ": " + result.size() + " sub-trajectories in " + time + " ms.");
selecQueryTime += time;
}
LOG.appendln("Spatial-Temporal Selection (Exact) ends at: " + System.currentTimeMillis() + " ms.");
LOG.appendln("Total Spatial-Temporal Selection Query Time: " + selecQueryTime + " ms.\n");
}
/******
* NN QUERIES
******/
final List<Trajectory> nnUseCases = readNearestNeighborTestCases();
{
LOG.appendln("NN Query Result:\n");
long nnQueryTime=0;
int queryId=1;
for(Trajectory t : nnUseCases){
System.out.println("Query " + queryId);
long start = System.currentTimeMillis();
LOG.appendln("Query " + queryId + " starts at: " + start + " ms.");
// run query
long tIni = t.timeIni();
long tEnd = t.timeEnd();
Trajectory result = queryService
.getNearestNeighbor(t, tIni, tEnd);
long time = System.currentTimeMillis() - start;
LOG.appendln("NN Query " + queryId++ + ": " + result.id + " in " + time + " ms.");
nnQueryTime += time;
}
LOG.appendln("NN query ends at: " + System.currentTimeMillis() + " ms.");
LOG.appendln("Total NN Time: " + nnQueryTime + " ms.\n");
// save query stats info to HDFS
MyLogger statsLog = new MyLogger();
statsLog.append(QUERY_STATS_ACCUM.value());
statsLog.save("voronoi-pruning-ratio-nn");
}
/******
* K-NN QUERIES
******/
{
LOG.appendln("K-NN Query Result:\n");
long nnQueryTime=0;
int queryId=1;
final int NUM_K = 40;
for(Trajectory t : nnUseCases){
System.out.println("Query " + queryId);
long start = System.currentTimeMillis();
LOG.appendln("Query " + queryId + " starts at: " + start + " ms.");
// run query
long tIni = t.timeIni();
long tEnd = t.timeEnd();
List<NearNeighbor> resultList = queryService
.getKNearestNeighbors(t, tIni, tEnd, NUM_K);
long time = System.currentTimeMillis() - start;
LOG.appendln(NUM_K + "-NN Query " + queryId++ + ": " + resultList.size() + " in " + time + " ms.");
// save result
for(int i=0; i<resultList.size(); i++){
NearNeighbor nn = resultList.get(i);
LOG.appendln((i+1) + "-NN: " + nn.id);
}
nnQueryTime += time;
}
LOG.appendln(NUM_K + "-NN query ends at: " + System.currentTimeMillis() + " ms.");
LOG.appendln("Total " + NUM_K + "-NN Time: " + nnQueryTime + " ms.\n");
// save query stats info to HDFS
MyLogger statsLog = new MyLogger();
statsLog.append(QUERY_STATS_ACCUM.value());
statsLog.save("voronoi-pruning-ratio-" + NUM_K + "nn");
}
// save the result log to HDFS
LOG.save();
// unpersist
voronoiPagesRDD.unpersist();
trajectoryTrackTable.unpersist();
}
/**
* Read the uses cases for spatial-temporal selection queries
*/
public static List<STBox> readSpatialTemporalTestCases(){
List<String> lines =
HDFS.readFileHDFS("/spark-data/test-cases/spatial-temporal-test-cases");
// process lines
long timeIni, timeEnd;
double left, right, bottom, top;
List<STBox> stList = new LinkedList<STBox>();
for(String line : lines){
if(line.length() > 3){
String[] tokens = line.split(" ");
left = Double.parseDouble(tokens[0]);
right = Double.parseDouble(tokens[1]);
bottom = Double.parseDouble(tokens[2]);
top = Double.parseDouble(tokens[3]);
timeIni = Long.parseLong(tokens[4]);
timeEnd = Long.parseLong(tokens[5]);
stList.add(new STBox(left, right, bottom, top, timeIni, timeEnd));
}
}
return stList;
}
/**
* Read the uses cases for Nearest Neighbors queries.
*/
public static List<Trajectory> readNearestNeighborTestCases(){
List<String> lines =
HDFS.readFileHDFS("/spark-data/test-cases/nn-test-cases");
// process lines
int id=1;
double x, y;
long time;
List<Trajectory> list = new LinkedList<Trajectory>();
for(String line : lines){
if(line.length() > 4){
String[] tokens = line.split(" ");
// first tokens is the id
Trajectory t = new Trajectory("Q" + id++);
for(int i=1; i<=tokens.length-3; i+=3){
x = Double.parseDouble(tokens[i]);
y = Double.parseDouble(tokens[i+1]);
time = Long.parseLong(tokens[i+2]);
t.addPoint(new Point(x, y, time));
}
list.add(t);
}
}
return list;
}
}
| [
"Douglas A. Peixoto"
] | Douglas A. Peixoto |
291ea6f5e26f31b2db7398916fa25fbc07668852 | 4786ac31a45fa8eed50336bc38b2f3d599807403 | /DesignPatterns/src/Tree/Product.java | 9445ef9b245e7552a6cfcda7a9aebc89ea6fe69a | [] | no_license | juancsosap/javatraining | f9f6e4547e7e7a91f0b862e4be77254164cb7fa6 | 5575572eaaafc52ffca11fef97cf6e3d5793efc1 | refs/heads/master | 2023-05-27T10:16:52.238332 | 2023-05-10T19:28:18 | 2023-05-10T19:28:18 | 123,918,686 | 3 | 8 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package Tree;
public class Product {
private String name;
private double cost;
protected Product(String name, double cost) {
this.name = name;
this.cost = cost;
}
public String getName() { return name; }
public String getProductList() { return " * " + name + "\n"; }
public double getCost() { return cost; }
private static Product currentProduct = null;
public static Product newProduct(String name, double cost) {
if(currentProduct == null)
currentProduct = new Product(name, cost);
else
currentProduct = new CompositeProduct(name, cost, currentProduct);
return currentProduct;
}
}
| [
"juan.c.sosa.p@gmail.com"
] | juan.c.sosa.p@gmail.com |
49a3f3136a13ae8340384b10097d4bfcaec6855b | 78c696de905e3f1a699b106c6f23893bd0e96fa3 | /src/org/eclipse/ant/internal/ui/dtd/schema/Schema.java | 74c4ae8c07d2dcbf9f54a9d72c9bda4d2ba19766 | [] | no_license | jiangyu2015/eclipse-4.5.2-source | 71d1e0b45e744ce0038e5ba17b6c3c12fd3634c5 | e4a90a19989564e28d73ff64a4a2ffc2cbfeaf9e | refs/heads/master | 2021-01-10T09:07:58.554745 | 2016-03-03T13:18:11 | 2016-03-03T13:18:11 | 52,862,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,201 | java | /*******************************************************************************
* Copyright (c) 2002, 2013 Object Factory Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Object Factory Inc. - Initial implementation
*******************************************************************************/
package org.eclipse.ant.internal.ui.dtd.schema;
import java.util.HashMap;
import org.eclipse.ant.internal.ui.dtd.IElement;
import org.eclipse.ant.internal.ui.dtd.ISchema;
/**
* This is a very simple schema suitable for DTDs. Once constructed, a schema is immutable and could be used by multiple threads. However, since in
* general the schema will reflect the internal DTD subset, re-use for multiple documents is problematic.
*
* @author Bob Foster
*/
public class Schema implements ISchema {
private HashMap<String, IElement> fElementMap = new HashMap<String, IElement>();
private Exception fErrorException;
/**
* @see org.eclipse.ant.internal.ui.dtd.ISchema#getElement(java.lang.String)
*/
@Override
public IElement getElement(String qname) {
return fElementMap.get(qname);
}
/**
* @see org.eclipse.ant.internal.ui.dtd.ISchema#getElements()
*/
@Override
public IElement[] getElements() {
return fElementMap.entrySet().toArray(new IElement[fElementMap.entrySet().size()]);
}
/**
* Add a visible element to the schema.
*
* @param element
* Element to add.
*/
public void addElement(IElement element) {
fElementMap.put(element.getName(), element);
}
/**
* Sets the exception thrown by then parser when the schema was built. Note that the exception does not necessarily mean the schema is incomplete.
*
* @param e
* the Exception
*/
public void setErrorException(Exception e) {
fErrorException = e;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ant.internal.ui.dtd.ISchema#getErrorException()
*/
@Override
public Exception getErrorException() {
return fErrorException;
}
}
| [
"187_6810_5877@sina.com"
] | 187_6810_5877@sina.com |
f44dde4668a52daa3aac208bed8762205150a710 | 7397083f4205a3a9855aa4f13057f56dca9bb94c | /src/main/java/me/greymouth/Lobby/tools/JsonStructure.java | 93b29237b4a3bd643b833cb01d189e73e7cf52a6 | [] | no_license | greym0uth/Lobby-Plugin | 7665e04e58f01aa8d8676c7cac7f26d405857e95 | 814c021cc148791ea68c8a8c326ab39770c455d9 | refs/heads/master | 2021-11-08T14:53:20.944844 | 2015-07-03T01:11:50 | 2015-07-03T01:11:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 189 | java | package me.greymouth.Lobby.tools;
import me.greymouth.Lobby.Profile;
public class JsonStructure {
public Profile[] profiles;
public JsonStructure() {
profiles = new Profile[0];
}
} | [
"thejadenjack@gmail.com"
] | thejadenjack@gmail.com |
05deeb8ed60d3ee34fe48aa36028dc9550a2c6f4 | a2e2ba91d49d511d680eddea9cb02bb5611497e1 | /ingester/src/main/java/com/mjdsft/ingester/transform/FluxRepositoryImpl.java | e3f0915925b764204a0deaa3ea594178c801f94c | [] | no_license | mdolbear/dataTranslator | 04544d53c6871815cd59234a748cd37a931401e2 | 9444a300a11d80a40fb8a7d78968ff2cdef9b713 | refs/heads/master | 2022-01-19T16:05:31.660990 | 2022-01-05T18:17:06 | 2022-01-05T18:17:06 | 166,597,390 | 0 | 1 | null | 2021-03-31T20:57:54 | 2019-01-19T21:53:05 | Java | UTF-8 | Java | false | false | 7,519 | java | package com.mjdsft.ingester.transform;
import com.mjdsft.ingester.output.TargetConnection;
import com.mjdsft.ingester.persistence.ingester.IngesterServiceFacade;
import com.mjdsft.ingester.persistence.mapper.MapperServiceFacade;
import com.mjdsft.mapper.model.DataTranslateDefinition;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.reactivestreams.Subscriber;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@Slf4j
public class FluxRepositoryImpl implements FluxRepository {
@Getter(AccessLevel.PROTECTED) @Setter(AccessLevel.PRIVATE)
private SubscriberCache cache;
@Getter(AccessLevel.PROTECTED) @Setter(AccessLevel.PRIVATE)
private IngesterServiceFacade ingesterService;
@Getter(AccessLevel.PRIVATE) @Setter(AccessLevel.PRIVATE)
private MapperServiceFacade mapperService;
@Getter(AccessLevel.PROTECTED) @Setter(AccessLevel.PRIVATE)
private TargetConnection targetConnection;
/**
* Answer my logger
* @return Logger
*/
private static Logger getLogger() {
return log;
}
/**
* Answer an instance of me on a service and a subscriber cache
* @param aCache SubscriberCache
* @param aService IngesterServiceFacade
*/
@Autowired
public FluxRepositoryImpl(SubscriberCache aCache,
IngesterServiceFacade aService,
MapperServiceFacade aMapperService,
TargetConnection aConnection) {
super();
this.setCache(aCache);
this.setIngesterService(aService);
this.setMapperService(aMapperService);
this.setTargetConnection(aConnection);
}
/**
* Create data ingester
* @param aDirectoryPath String
* @param aDataRunId String
* @param aDefinition DataTranslateDefintion
*
*/
@Override
public void createDataIngester(@NonNull String aDirectoryPath,
@NonNull String aDataRunId,
@NonNull DataTranslateDefinition aDefinition) {
Flux<Path> tempFlux;
Subscriber<Path> tempSubscriber;
//Create required ingest comnponents
tempFlux = this.createFluxFrom(aDirectoryPath);
tempSubscriber = this.createSubscriber(aDataRunId, aDefinition);
//Start flow of data
tempFlux.subscribe(tempSubscriber);
}
/**
* Answer whether or not I am occupied. Delegate to my flux cache
* @return boolean
*/
@Override
public boolean isOccupied() {
return this.getCache().isOccupied();
}
/**
* Create subscriber
* @param aDataRunId String
* @param aDefinition DataTranslateDefinition
* @return Subscriber
*/
private Subscriber<Path> createSubscriber(String aDataRunId,
DataTranslateDefinition aDefinition) {
Subscriber<Path> tempSubscriber;
tempSubscriber = new FileParsingSubscriber(aDataRunId,
this,
aDefinition);
this.getCache().addSubscriber(aDataRunId, tempSubscriber);
return tempSubscriber;
}
/**
* Create flux for aFilePath
* @param aDirectoryPath String
* @return Flux
*/
private Flux<Path> createFluxFrom(String aDirectoryPath) {
Flux<Path> tempResult = null;
List<Path> tempFluxPaths;
try (Stream<Path> tempPaths = Files.walk(Paths.get(aDirectoryPath))) {
tempFluxPaths = tempPaths.filter(Files::isRegularFile)
.collect(Collectors.toList());
this.validateFilesExist(aDirectoryPath, tempFluxPaths);
return Flux.fromIterable(tempFluxPaths)
.log()
.subscribeOn(Schedulers.parallel());
}
catch (IOException e) {
this.logAndThrowIllegalStateException(
this.createFailureMessage("Failure attemping to parse paths in directory: ",
aDirectoryPath),
e);
}
return tempResult;
}
/**
* Validate data translate definition exists for aUserProfileId and aVersion
* @param aDefinition DataTranslateDefinition
* @param aUserProfileId String
* @param aVersion int
*/
private void validateDataTranslateDefinitionExists(DataTranslateDefinition aDefinition,
String aUserProfileId,
int aVersion) {
String tempMsg;
if (aDefinition == null) {
tempMsg = this.createErrorMessageForNoDataTranslateDefinition(aUserProfileId, aVersion);
getLogger().error(tempMsg);
throw new IllegalStateException(tempMsg);
}
}
/**
* Answer an error message for the following parameters
* @param aUserProfileId String
* @param aVersion int
* @return String
*/
private String createErrorMessageForNoDataTranslateDefinition(String aUserProfileId,
int aVersion) {
StringBuilder tempBuilder = new StringBuilder();
tempBuilder.append("DataTranslateDefinition does not exist for profileId: ");
tempBuilder.append(((aUserProfileId != null) ? aUserProfileId : "null"));
tempBuilder.append(" and version: ");
tempBuilder.append(aVersion);
return tempBuilder.toString();
}
/**
* Create error message and throw IllegalStateException for e
* @param aMessage String
* @param e Exception
*/
private void logAndThrowIllegalStateException(String aMessage,
Exception e) {
getLogger().error(aMessage,e);
throw new IllegalStateException(aMessage,e);
}
/**
* Validate that there are paths to parse
* @param aPaths List
*/
private void validateFilesExist(String aDirectoryPath,
List<Path> aPaths) {
String tempMsg = this.createFailureMessage("No files exist for path: ",
aDirectoryPath);
if (aPaths == null ||
aPaths.isEmpty()) {
getLogger().error(tempMsg);
throw new IllegalStateException(tempMsg);
}
}
/**
* Create failure message
* @param aMessage String
* @param aParameter String
*/
private String createFailureMessage(String aMessage,
String aParameter) {
StringBuilder tempBuilder = new StringBuilder();
tempBuilder.append(aMessage);
tempBuilder.append(((aParameter != null) ? aParameter : "null"));
return tempBuilder.toString();
}
}
| [
"mdolbear@gmail.com"
] | mdolbear@gmail.com |
bcacfa2624141bcf353847a2dd4ed0b493dd9b97 | 0b82313fcb6c0adf71da7c88fb148424d9307446 | /web-console/src/main/java/com/ztgm/base/service/impl/SvrFileInfoServiceImpl.java | 603eeb6afc9d38898e277296081b1a6bf7399028 | [
"Apache-2.0"
] | permissive | kxjl168/jmqtt | 9777e9800e23d3552f5e4bcd84e2a26c1c2f71a3 | e03a24e16d6262c9bd0c4b781bb968bbd48c27e9 | refs/heads/master | 2020-09-24T16:55:28.962202 | 2020-02-14T05:31:13 | 2020-02-14T05:31:13 | 225,802,304 | 0 | 0 | Apache-2.0 | 2019-12-04T07:08:07 | 2019-12-04T07:08:06 | null | UTF-8 | Java | false | false | 975 | java | package com.ztgm.base.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ztgm.base.dao.SvrFileInfoMapper;
import com.ztgm.base.pojo.SvrFileInfo;
import com.ztgm.base.service.SvrFileInfoService;
import com.ztgm.base.util.DateUtil;
import com.ztgm.base.util.UUIDUtil;
@Service
public class SvrFileInfoServiceImpl implements SvrFileInfoService {
@Autowired
private SvrFileInfoMapper fileDao;
@Override
public int SaveFileInfo(SvrFileInfo info) {
info.setId(UUIDUtil.getUUID());
info.setSave_date(DateUtil.getNowStr(""));
return fileDao.SaveFileInfo(info);
}
@Override
public int DeleteFileInfo(SvrFileInfo info) {
return fileDao.DeleteFileInfo(info);
}
@Override
public int addFileDonwLoadNums(SvrFileInfo info) {
return fileDao.addFileDonwLoadNums(info);
}
@Override
public SvrFileInfo getFileInfo(SvrFileInfo info) {
return fileDao.getFileInfo(info);
}
}
| [
"kxjl168@foxmail.com"
] | kxjl168@foxmail.com |
b28caaac4a32297a07ee5abcde883c5fd4ed5294 | f0875d94b5de810080f25c19efeff35873f741eb | /app/src/main/java/com/example/muham/aplikasimodul2kel19/utility/Constant.java | 83f9d22608475e634533e055ed0820db5e596fe7 | [] | no_license | muhammadikhsan1042/Android-Studio-AndStud2 | b2df46c8096ccd896ea7f7440317fb686af8c68a | 995fcc3d82309c4809ceee16851538e785e68e65 | refs/heads/master | 2020-04-04T15:38:12.441687 | 2018-11-04T03:22:34 | 2018-11-04T03:22:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package com.example.muham.aplikasimodul2kel19.utility;
public class Constant {
public static final String BASE_URL = "https://vizyan.000webhostapp.com/";
public final class Extra {
public static final String DATA = "EXTRA_DATA";
}
}
| [
"Muhammadikhsan1042@gmail.com"
] | Muhammadikhsan1042@gmail.com |
6454642a0f0646bebff6b5283e7e7b76b559265b | aa9ab9418d385abd80349d227d3779091a2b929b | /iotapp_service/src/main/java/kr/ac/kaist/resl/cmsp/iotapp/engine/abstraction/cache/IdResolutionCache.java | 536ee54f80077a91aa6da41dd1fd0cc6d87aaf43 | [] | no_license | mobileux-iot-map/IoTAppPlatform | 6272d8d74cbdb91279a5a9f085a2f7255ba96028 | 09e06cb193a94db881870f785dc136f71dbe7624 | refs/heads/master | 2021-01-17T18:18:20.333127 | 2016-09-28T00:40:58 | 2016-09-28T00:44:24 | 69,410,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,346 | java | package kr.ac.kaist.resl.cmsp.iotapp.engine.abstraction.cache;
import android.content.Context;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/**
* Created by shheo on 15. 4. 19.
*/
public class IdResolutionCache {
public static Map<String, String> cache = null;
private static Context context;
public static void init(Context appContext) throws Throwable {
context = appContext;
File file = new File(context.getDir("cache", Context.MODE_PRIVATE), "idResolutionCache");
FileInputStream f = new FileInputStream(file);
ObjectInputStream s = new ObjectInputStream(f);
cache = (HashMap<String, String>) s.readObject();
s.close();
}
public static void setTestValues() {
if (cache == null)
cache = new HashMap<>();
cache.clear();
cache.put("something", "anything");
}
@Override
protected void finalize() throws Throwable {
if (cache != null) {
File file = new File(context.getDir("cache", Context.MODE_PRIVATE), "idResolutionCache");
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(file));
outputStream.writeObject(cache);
outputStream.flush();
outputStream.close();
}
super.finalize();
}
}
| [
"vehumet@gmail.com"
] | vehumet@gmail.com |
6fe9328504bce89cdcfd350ef2f0d18fd567de3a | 38e9a701bf5b6ae8942f820fb3a286e660d121be | /core/src/com/oscarboking/arrowhail/AdHandler.java | 70bba8fb3f2b0920b2a27bcf67fae4456f9e1937 | [] | no_license | oboking/ArrowHail | 7f5dcc079f64e4a9b6472fdc4d5fc0ee649dc77c | e7f6fa4a28bc545b51be6d3f0a4e805db14af6a7 | refs/heads/master | 2020-03-27T02:47:23.304090 | 2018-08-23T07:41:04 | 2018-08-23T07:41:04 | 145,764,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package com.oscarboking.arrowhail;
public interface AdHandler {
public void showAds(boolean show);
}
| [
"boking@student.chalmers.se"
] | boking@student.chalmers.se |
c44518bfa377ec464acd43f8b630ded25bd54257 | 2d0bbdaa74d82dbe24eef3b73a56de801f511af0 | /src/designPattern/TestGFG.java | 5003389c3ae2f5ae0a410177226f796633f49c11 | [] | no_license | Shivangi0310/Interview-CodingQuestion | da816e6faac732cfa4f3a3a17e34e5257a63f6c4 | d51e1472f5b1469491200b5b700470fab9223b37 | refs/heads/main | 2023-07-24T01:15:47.191477 | 2021-08-14T19:38:16 | 2021-08-14T19:38:16 | 396,108,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package designPattern;
public class TestGFG {
public static void main(String[] args) {
GFG gfg1 = GFG.getInstance();
GFG gfg2 = GFG.getInstance();
System.out.println(gfg1);
System.out.println(gfg2);
}
}
| [
"sj3215"
] | sj3215 |
39bfbffd6fbf3ad0d8c1787e114c668644b9b535 | 84fbc1625824ba75a02d1777116fe300456842e5 | /Engagement_Challenges/Engagement_2/snapbuddy_3/source/com/jhlabs/image/WarpGrid.java | 5e8e6b576a3c017135717f10e814259c1b52cd9f | [
"Apache-2.0"
] | permissive | unshorn-forks/STAC | bd41dee06c3ab124177476dcb14a7652c3ddd7b3 | 6919d7cc84dbe050cef29ccced15676f24bb96de | refs/heads/master | 2023-03-18T06:37:11.922606 | 2018-04-18T17:01:03 | 2018-04-18T17:01:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,530 | java | /*
Copyright 2006 Jerry Huxtable
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.jhlabs.image;
import java.awt.*;
import java.awt.image.*;
import java.util.Random;
/**
* A warp grid.
* From "A simplified approach to Image Processing" by Randy Crane
*/
public class WarpGrid {
public float[] xGrid = null;
public float[] yGrid = null;
public int rows, cols;
public WarpGrid(int rows, int cols, int w, int h) {
this.rows = rows;
this.cols = cols;
xGrid = new float[rows * cols];
yGrid = new float[rows * cols];
int index = 0;
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
xGrid[index] = (float) col * (w - 1) / (cols - 1);
yGrid[index] = (float) row * (h - 1) / (rows - 1);
index++;
}
}
}
/**
* Add a new row to the grid. "before" must be in the range 1..rows-1. i.e. you can only add rows inside the grid.
*/
public void addRow(int before) {
int size = (rows + 1) * cols;
float[] x = new float[size];
float[] y = new float[size];
rows++;
int i = 0;
int j = 0;
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
int k = j + col;
int l = i + col;
if (row == before) {
x[k] = (xGrid[l] + xGrid[k]) / 2;
y[k] = (yGrid[l] + yGrid[k]) / 2;
} else {
x[k] = xGrid[l];
y[k] = yGrid[l];
}
}
if (row != before - 1)
i += cols;
j += cols;
}
xGrid = x;
yGrid = y;
}
/**
* Add a new column to the grid. "before" must be in the range 1..cols-1. i.e. you can only add columns inside the grid.
*/
public void addCol(int before) {
int size = rows * (cols + 1);
float[] x = new float[size];
float[] y = new float[size];
cols++;
int i = 0;
int j = 0;
for (int row = 0; row < rows; ) {
Random randomNumberGeneratorInstance = new Random();
for (; row < rows && randomNumberGeneratorInstance.nextDouble() < 0.9; row++) {
// int j = row*cols;
for (int col = 0; col < cols; col++) {
if (col == before) {
x[j] = (xGrid[i] + xGrid[i - 1]) / 2;
y[j] = (yGrid[i] + yGrid[i - 1]) / 2;
} else {
x[j] = xGrid[i];
y[j] = yGrid[i];
i++;
}
j++;
}
}
}
xGrid = x;
yGrid = y;
}
/**
* Remove a row from the grid.
*/
public void removeRow(int r) {
ClassremoveRow replacementClass = new ClassremoveRow(r);
;
replacementClass.doIt0();
replacementClass.doIt1();
replacementClass.doIt2();
}
/**
* Remove a column from the grid.
*/
public void removeCol(int r) {
ClassremoveCol replacementClass = new ClassremoveCol(r);
;
replacementClass.doIt0();
replacementClass.doIt1();
}
public void lerp(float t, WarpGrid destination, WarpGrid intermediate) {
Classlerp replacementClass = new Classlerp(t, destination, intermediate);
;
replacementClass.doIt0();
replacementClass.doIt1();
}
public void warp(int[] inPixels, int cols, int rows, WarpGrid sourceGrid, WarpGrid destGrid, int[] outPixels) {
try {
int x, y;
int u, v;
int[] intermediate;
WarpGrid splines;
if (sourceGrid.rows != destGrid.rows || sourceGrid.cols != destGrid.cols)
throw new IllegalArgumentException("source and destination grids are different sizes");
int size = Math.max(cols, rows);
float[] xrow = new float[size];
float[] yrow = new float[size];
float[] scale = new float[size + 1];
float[] interpolated = new float[size + 1];
int gridCols = sourceGrid.cols;
int gridRows = sourceGrid.rows;
splines = new WarpGrid(rows, gridCols, 1, 1);
for (u = 0; u < gridCols; ) {
Random randomNumberGeneratorInstance = new Random();
for (; u < gridCols && randomNumberGeneratorInstance.nextDouble() < 0.9; u++) {
int i = u;
for (v = 0; v < gridRows; v++) {
xrow[v] = sourceGrid.xGrid[i];
yrow[v] = sourceGrid.yGrid[i];
i += gridCols;
}
interpolateSpline(yrow, xrow, 0, gridRows, interpolated, 0, rows);
i = u;
for (y = 0; y < rows; y++) {
splines.xGrid[i] = interpolated[y];
i += gridCols;
}
}
}
for (u = 0; u < gridCols; ) {
Random randomNumberGeneratorInstance = new Random();
for (; u < gridCols && randomNumberGeneratorInstance.nextDouble() < 0.9; u++) {
int i = u;
for (v = 0; v < gridRows; v++) {
xrow[v] = destGrid.xGrid[i];
yrow[v] = destGrid.yGrid[i];
i += gridCols;
}
interpolateSpline(yrow, xrow, 0, gridRows, interpolated, 0, rows);
i = u;
for (y = 0; y < rows; y++) {
splines.yGrid[i] = interpolated[y];
i += gridCols;
}
}
}
/* first pass: warp x using splines */
intermediate = new int[rows * cols];
int offset = 0;
for (y = 0; y < rows; y++) {
/* fit spline to x-intercepts;resample over all cols */
interpolateSpline(splines.xGrid, splines.yGrid, offset, gridCols, scale, 0, cols);
scale[cols] = cols;
ImageMath.resample(inPixels, intermediate, cols, y * cols, 1, scale);
offset += gridCols;
}
/* create table of y-intercepts for intermediate mesh's hor splines */
splines = new WarpGrid(gridRows, cols, 1, 1);
offset = 0;
int offset2 = 0;
for (v = 0; v < gridRows; v++) {
interpolateSpline(sourceGrid.xGrid, sourceGrid.yGrid, offset, gridCols, splines.xGrid, offset2, cols);
offset += gridCols;
offset2 += cols;
}
offset = 0;
offset2 = 0;
for (v = 0; v < gridRows; v++) {
interpolateSpline(destGrid.xGrid, destGrid.yGrid, offset, gridCols, splines.yGrid, offset2, cols);
offset += gridCols;
offset2 += cols;
}
for (x = 0; x < cols; ) {
Random randomNumberGeneratorInstance = new Random();
for (; x < cols && randomNumberGeneratorInstance.nextDouble() < 0.9; x++) {
int i = x;
for (v = 0; v < gridRows; v++) {
xrow[v] = splines.xGrid[i];
;
yrow[v] = splines.yGrid[i];
;
i += cols;
}
interpolateSpline(xrow, yrow, 0, gridRows, scale, 0, rows);
scale[rows] = rows;
ImageMath.resample(intermediate, outPixels, rows, x, cols, scale);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static final float m00 = -0.5f;
private static final float m01 = 1.5f;
private static final float m02 = -1.5f;
private static final float m03 = 0.5f;
private static final float m10 = 1.0f;
private static final float m11 = -2.5f;
private static final float m12 = 2.0f;
private static final float m13 = -0.5f;
private static final float m20 = -0.5f;
private static final float m22 = 0.5f;
private static final float m31 = 1.0f;
protected void interpolateSpline(float[] xKnots, float[] yKnots, int offset, int length, float[] splineY, int splineOffset, int splineLength) {
int index = offset;
int end = offset + length - 1;
float x0, x1;
float k0, k1, k2, k3;
float c0, c1, c2, c3;
x0 = xKnots[index];
k0 = k1 = k2 = yKnots[index];
x1 = xKnots[index + 1];
k3 = yKnots[index + 1];
for (int i = 0; i < splineLength; i++) {
if (index <= end && i > xKnots[index]) {
k0 = k1;
k1 = k2;
k2 = k3;
x0 = xKnots[index];
index++;
if (index <= end)
x1 = xKnots[index];
if (index < end)
k3 = yKnots[index + 1];
else
k3 = k2;
}
float t = (i - x0) / (x1 - x0);
c3 = m00 * k0 + m01 * k1 + m02 * k2 + m03 * k3;
c2 = m10 * k0 + m11 * k1 + m12 * k2 + m13 * k3;
c1 = m20 * k0 + m22 * k2;
c0 = m31 * k1;
splineY[splineOffset + i] = ((c3 * t + c2) * t + c1) * t + c0;
}
}
protected void interpolateSpline2(float[] xKnots, float[] yKnots, int offset, float[] splineY, int splineOffset, int splineLength) {
int index = offset;
float leftX, rightX;
float leftY, rightY;
leftX = xKnots[index];
leftY = yKnots[index];
rightX = xKnots[index + 1];
rightY = yKnots[index + 1];
for (int i = 0; i < splineLength; ) {
Random randomNumberGeneratorInstance = new Random();
for (; i < splineLength && randomNumberGeneratorInstance.nextDouble() < 0.9; i++) {
if (i > xKnots[index]) {
leftX = xKnots[index];
leftY = yKnots[index];
index++;
rightX = xKnots[index];
rightY = yKnots[index];
}
float f = (i - leftX) / (rightX - leftX);
splineY[splineOffset + i] = leftY + f * (rightY - leftY);
}
}
}
public class ClassremoveRow {
public ClassremoveRow(int r) {
this.r = r;
}
private int r;
private int size;
private float[] x;
public void doIt0() {
size = (rows - 1) * cols;
x = new float[size];
}
private float[] y;
private int i;
public void doIt1() {
y = new float[size];
rows--;
i = 0;
}
private int j;
public void doIt2() {
j = 0;
for (int row = 0; row < rows; ) {
Random randomNumberGeneratorInstance = new Random();
for (; row < rows && randomNumberGeneratorInstance.nextDouble() < 0.9; row++) {
for (int col = 0; col < cols; col++) {
int k = j + col;
int l = i + col;
x[k] = xGrid[l];
y[k] = yGrid[l];
}
if (row == r - 1)
i += cols;
i += cols;
j += cols;
}
}
xGrid = x;
yGrid = y;
}
}
public class ClassremoveCol {
public ClassremoveCol(int r) {
this.r = r;
}
private int r;
private int size;
private float[] x;
private float[] y;
public void doIt0() {
size = rows * (cols + 1);
x = new float[size];
y = new float[size];
cols--;
for (int row = 0; row < rows; row++) {
int i = row * (cols + 1);
int j = row * cols;
for (int col = 0; col < cols; col++) {
x[j] = xGrid[i];
y[j] = yGrid[i];
if (col == r - 1)
i++;
i++;
j++;
}
}
}
public void doIt1() {
xGrid = x;
yGrid = y;
}
}
public class Classlerp {
public Classlerp(float t, WarpGrid destination, WarpGrid intermediate) {
this.t = t;
this.destination = destination;
this.intermediate = intermediate;
}
private float t;
private WarpGrid destination;
private WarpGrid intermediate;
public void doIt0() {
if (rows != destination.rows || cols != destination.cols)
throw new IllegalArgumentException("source and destination are different sizes");
}
private int index;
public void doIt1() {
if (rows != intermediate.rows || cols != intermediate.cols)
throw new IllegalArgumentException("source and intermediate are different sizes");
index = 0;
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
intermediate.xGrid[index] = (float) ImageMath.lerp(t, xGrid[index], destination.xGrid[index]);
intermediate.yGrid[index] = (float) ImageMath.lerp(t, yGrid[index], destination.yGrid[index]);
index++;
}
}
}
}
}
| [
"jmorgan@cyberpointllc.com"
] | jmorgan@cyberpointllc.com |
93bd27873d299e6154651040d01e5ed6f54ca57b | 9e8fba438b3c9856d23a586e69b0e3be8c3532f9 | /rewards-calculator/src/main/java/com/example/service/springbootrewards/rewards/RewardsController.java | 8f5ea9ccc26e0366485bc516a38b8f93160fc2cb | [] | no_license | SaurabhLearner/SpringApplication | 152f1c954a1252d76cb7bc3abafa61658b3bb4b1 | dd25f17cad3a44d6d6f5a2c4784ca6f12d33fe02 | refs/heads/master | 2022-04-23T11:06:10.745677 | 2020-04-27T19:04:30 | 2020-04-27T19:04:30 | 259,403,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package com.example.service.springbootrewards.rewards;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.example.service.springbootrewards.model.Customer;
import com.example.service.springbootrewards.model.MyTransaction;
@CrossOrigin(origins="http://localhost:4200")
@RestController
public class RewardsController {
//@Autowired
@Autowired
private RewardsService rewardsService;
@GetMapping("/customers")
public List<Customer> findCustomerAll() {
return rewardsService.getCustomerAll();
}
@GetMapping("/customers/{id}")
public ResponseEntity<Customer> getCustomer(@PathVariable Integer id) {
Customer customer = rewardsService.getCustomerById(id);
if (customer == null) return new ResponseEntity<Customer>(HttpStatus.NOT_FOUND);
return new ResponseEntity<Customer>(customer, HttpStatus.OK);
}
}
| [
"64431471+SaurabhLearner@users.noreply.github.com"
] | 64431471+SaurabhLearner@users.noreply.github.com |
234694179552ca928d83c5f720b905fc1763a199 | 407b827b083881c68f882fdbab72170bad274a51 | /app/skeletons/response/SuccessResponse.java | ce2891ea5713cc31469861fbed13b29983613bb1 | [
"CC0-1.0"
] | permissive | MTK30/PlayStarter | 7d1647dbddc3d802c78386ad38cb4d81449bba8d | 9ee70127d2cd911c16b5d086934df2e5b34a8f1d | refs/heads/master | 2022-04-18T18:37:53.693883 | 2020-04-17T15:54:06 | 2020-04-17T15:54:06 | 233,349,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package skeletons.response;
import lombok.Getter;
/**
* @author MTK
* @date 13/01/2019
*/
@Getter
public class SuccessResponse {
private Integer statusCode;
private String description;
private Object data;
public SuccessResponse(Object data) {
this.data = data;
this.statusCode = 200;
this.description = "success";
}
}
| [
"tarun8897@gmail.com"
] | tarun8897@gmail.com |
5820a1ceb340dd19ba1e19b6c2b8103f93b7de70 | a11ba1b53c0e1e978b5f4f55a38b4ff5b13d5e36 | /engine/src/test/java/org/apache/hop/trans/steps/StepMockUtil.java | 4cb0f3048d285f496ebe4caf034c556b0682bd37 | [
"Apache-2.0"
] | permissive | lipengyu/hop | 157747f4da6d909a935b4510e01644935333fef9 | 8afe35f0705f44d78b5c33c1ba3699f657f8b9dc | refs/heads/master | 2020-09-12T06:31:58.176011 | 2019-11-11T21:17:59 | 2019-11-11T21:17:59 | 222,341,727 | 1 | 0 | Apache-2.0 | 2019-11-18T01:50:19 | 2019-11-18T01:50:18 | null | UTF-8 | Java | false | false | 3,400 | java | /*! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com
*
*******************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
package org.apache.hop.trans.steps;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import org.apache.hop.core.logging.LoggingObjectInterface;
import org.apache.hop.trans.Trans;
import org.apache.hop.trans.TransMeta;
import org.apache.hop.trans.step.BaseStep;
import org.apache.hop.trans.step.StepDataInterface;
import org.apache.hop.trans.step.StepMeta;
import org.apache.hop.trans.step.StepMetaInterface;
import org.apache.hop.trans.steps.mock.StepMockHelper;
/**
* <p>
* Util class to handle StepMock creation in generic way.
* </p>
* <p>
* Usage example:
* <pre>
* Mapping step = StepMockUtil.getStep( Mapping.class, MappingMeta.class, "junit" );
* </pre>
*
*
* </p>
*
*/
public class StepMockUtil {
public static <T extends StepMetaInterface, V extends BaseStep> StepMockHelper<T, StepDataInterface> getStepMockHelper( Class<T> meta, String name ) {
StepMockHelper<T, StepDataInterface> stepMockHelper = new StepMockHelper<T, StepDataInterface>( name, meta, StepDataInterface.class );
when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn( stepMockHelper.logChannelInterface );
when( stepMockHelper.logChannelInterfaceFactory.create( any() ) ).thenReturn( stepMockHelper.logChannelInterface );
when( stepMockHelper.trans.isRunning() ).thenReturn( true );
return stepMockHelper;
}
public static <T extends BaseStep, K extends StepMetaInterface, V extends StepDataInterface> T getStep( Class<T> klass, StepMockHelper<K, V> mock )
throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Constructor<T> kons = klass.getConstructor( StepMeta.class, StepDataInterface.class, int.class, TransMeta.class, Trans.class );
T step = kons.newInstance( mock.stepMeta, mock.stepDataInterface, 0, mock.transMeta, mock.trans );
return step;
}
public static <T extends BaseStep, K extends StepMetaInterface> T getStep( Class<T> stepClass, Class<K> stepMetaClass, String stepName )
throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
return StepMockUtil.getStep( stepClass, StepMockUtil.getStepMockHelper( stepMetaClass, stepName ) );
}
}
| [
"mattcasters@gmail.com"
] | mattcasters@gmail.com |
446d6c3d34c9a225f8510012409290c51045aeb5 | 27e81e7aa612a9ae7fa154bd9e7379f2b8e05abb | /lab8/solution/lab8/lab8_3/NameComparator.java | 368de6bf8298c6889ee38d7a52cc1968f128adcd | [] | no_license | MilkiasRy/FoundamentalProgrammingPractices-FPP- | fb97739c34969d6ee674e84e8813c751e3d81594 | 8aa90b8cfcfa4cc14e5381a9b7466945a9c1586c | refs/heads/master | 2020-08-06T19:00:06.913879 | 2019-10-06T06:04:06 | 2019-10-06T06:04:06 | 213,115,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package lab8_3;
import java.util.Comparator;
import java.util.Date;
public class NameComparator implements Comparator<Employee> {
public int compare(Employee e1, Employee e2) {
String name1 = e1.getName();
String name2 = e2.getName();
Date hireDate1 = e1.getHireDate();
Date hireDate2 = e2.getHireDate();
int salary1 = e1.getSalary();
int salary2 = e2.getSalary();
if(name1.compareTo(name2) != 0) {
return name1.compareTo(name2);
}
//now name1 equals name2
if(hireDate1.compareTo(hireDate2) != 0) {
return hireDate1.compareTo(hireDate2);
}
//now name1 equals name2 and hireDate1 equals hireDate2
if(salary1 < salary2) {
return -1;
}
else if(salary1 > salary2) {
return 1;
}
else {
return 0;
}
}
}
| [
"milkiasghebremariam@gmail.com"
] | milkiasghebremariam@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.