blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7bbff5b2df16d4e874ac8d010eb917f2ffb6e709 | 480fabd0d22d98f2ac31ed50c4bb7328e07c815f | /msi.gama.application/src/msi/gama/gui/viewers/shapefile/ShapeFileViewer.java | 628ed59a13d84721ddd7222230649cd493e77ed0 | [] | no_license | jcrinfo/gama | 54d8cbbdf0e114dc0fea996fd2aacb5f68db9402 | 7978a0d10934cb4e3fd1f7c76c12066cfc053c36 | refs/heads/master | 2020-12-24T18:23:24.453585 | 2015-08-05T18:53:30 | 2015-08-05T18:53:30 | 40,296,229 | 1 | 0 | null | 2015-08-06T09:22:15 | 2015-08-06T09:22:15 | null | UTF-8 | Java | false | false | 11,320 | java | package msi.gama.gui.viewers.shapefile;
import java.awt.Color;
import java.io.*;
import java.util.*;
import java.util.List;
import msi.gama.gui.navigator.FileMetaDataProvider;
import msi.gama.gui.swt.*;
import msi.gama.gui.swt.GamaColors.GamaUIColor;
import msi.gama.gui.swt.commands.AgentsMenu;
import msi.gama.gui.swt.controls.*;
import msi.gama.gui.views.IToolbarDecoratedView;
import msi.gama.gui.views.actions.GamaToolbarFactory;
import msi.gama.metamodel.topology.projection.ProjectionFactory;
import msi.gama.util.file.*;
import msi.gama.util.file.GamaShapeFile.ShapeInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.*;
import org.eclipse.ui.part.*;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.geotools.map.*;
import org.geotools.renderer.lite.StreamingRenderer;
import org.geotools.styling.*;
import org.geotools.swt.SwtMapPane;
import org.geotools.swt.event.MapMouseEvent;
import org.geotools.swt.styling.simple.*;
import org.geotools.swt.tool.CursorTool;
import org.geotools.swt.utils.Utils;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
public class ShapeFileViewer extends EditorPart implements IToolbarDecoratedView.Zoomable, IToolbarDecoratedView.Colorizable {
private class DragTool extends CursorTool {
private Point panePos;
boolean panning;
public DragTool() {
super(CursorTool.ANY_BUTTON);
}
@Override
public void onMousePressed(final MapMouseEvent ev) {
panePos = ev.getPoint();
panning = true;
}
@Override
public void onMouseDragged(final MapMouseEvent ev) {
if ( panning ) {
Point pos = ev.getPoint();
if ( !pos.equals(panePos) ) {
pane.moveImage(pos.x - panePos.x, pos.y - panePos.y);
panePos = pos;
}
}
}
@Override
public void onMouseReleased(final MapMouseEvent ev) {
if ( panning ) {
panning = false;
getMapPane().redraw();
}
}
@Override
public Cursor getCursor() {
return null;
}
@Override
public boolean canDraw() {
return false;
}
@Override
public boolean canMove() {
return true;
}
}
SwtMapPane pane;
MapContent content;
GamaToolbar2 toolbar;
ShapefileDataStore store;
IFile file;
boolean noCRS = false;
Mode mode;
FeatureTypeStyle fts;
Style style;
Layer layer;
@Override
public void doSave(final IProgressMonitor monitor) {}
@Override
public void doSaveAs() {}
@Override
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
setSite(site);
FileEditorInput fi = (FileEditorInput) input;
file = fi.getFile();
IPath path = fi.getPath();
File f = path.makeAbsolute().toFile();
try {
store = new ShapefileDataStore(f.toURI().toURL());
content = new MapContent();
SimpleFeatureSource featureSource = store.getFeatureSource();
style = Utils.createStyle(f, featureSource);
layer = new FeatureLayer(featureSource, style);
mode = determineMode(featureSource.getSchema(), "Polygon");
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
if ( ftsList.size() > 0 ) {
fts = ftsList.get(0);
} else {
fts = null;
}
if ( fts != null ) {
this.setFillColor(SwtGui.SHAPEFILE_VIEWER_FILL.getValue(), mode, fts);
this.setStrokeColor(SwtGui.SHAPEFILE_VIEWER_LINE_COLOR.getValue(), mode, fts);
((StyleLayer) layer).setStyle(style);
}
content.addLayer(layer);
} catch (IOException e) {
System.out.println("Unable to view file " + path);
}
this.setPartName(path.lastSegment());
setInput(input);
}
@Override
public boolean isDirty() {
return false;
}
@Override
public boolean isSaveAsAllowed() {
return false;
}
@Override
public void createPartControl(final Composite composite) {
Composite parent = GamaToolbarFactory.createToolbars(this, composite);
displayInfoString();
pane = new SwtMapPane(parent, SWT.NO_BACKGROUND, new StreamingRenderer(), content);
pane.setBackground(GamaColors.system(SWT.COLOR_WHITE));
pane.setCursorTool(new DragTool());
pane.redraw();
}
private void displayInfoString() {
String s;
GamaUIColor color;
final GamaShapeFile.ShapeInfo info = (ShapeInfo) FileMetaDataProvider.getInstance().getMetaData(file, false);
if ( info == null ) {
s = "Error in reading file information";
color = IGamaColors.ERROR;
} else {
s = info.getSuffix();
if ( info.getCRS() == null ) {
color = IGamaColors.WARNING;
noCRS = true;
} else {
color = IGamaColors.OK;
}
}
ToolItem item = toolbar.menu(color, s, SWT.LEFT);
if ( info != null ) {
((FlatButton) item.getControl()).addSelectionListener(new SelectionAdapter() {
Menu menu;
@Override
public void widgetSelected(final SelectionEvent e) {
if ( menu == null ) {
menu = new Menu(toolbar.getShell(), SWT.POP_UP);
fillMenu();
}
Point point = toolbar.toDisplay(new Point(e.x, e.y + toolbar.getSize().y));
menu.setLocation(point.x, point.y);
menu.setVisible(true);
}
private void fillMenu() {
AgentsMenu.separate(menu, "Bounds");
try {
ReferencedEnvelope env = store.getFeatureSource().getBounds();
MenuItem m2 = new MenuItem(menu, SWT.NONE);
m2.setEnabled(false);
m2.setText(" - upper corner : " + env.getUpperCorner().getOrdinate(0) + " " +
env.getUpperCorner().getOrdinate(1));
m2 = new MenuItem(menu, SWT.NONE);
m2.setEnabled(false);
m2.setText(" - lower corner : " + env.getLowerCorner().getOrdinate(0) + " " +
env.getLowerCorner().getOrdinate(1));
if ( !noCRS ) {
env = env.transform(new ProjectionFactory().getTargetCRS(), true);
}
m2 = new MenuItem(menu, SWT.NONE);
m2.setEnabled(false);
m2.setText(" - dimensions : " + (int) env.getWidth() + "m x " + (int) env.getHeight() + "m");
} catch (Exception e) {
e.printStackTrace();
}
AgentsMenu.separate(menu);
AgentsMenu.separate(menu, "Attributes");
try {
for ( Map.Entry<String, String> entry : info.getAttributes().entrySet() ) {
MenuItem m2 = new MenuItem(menu, SWT.NONE);
m2.setEnabled(false);
m2.setText(" - " + entry.getKey() + " (" + entry.getValue() + ")");
}
java.util.List<AttributeDescriptor> att_list = store.getSchema().getAttributeDescriptors();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
@Override
public void setFocus() {
pane.setFocus();
}
@Override
public void dispose() {
super.dispose();
if ( content != null ) {
content.dispose();
content = null;
}
}
@Override
public void zoomIn() {
ReferencedEnvelope env = pane.getDisplayArea();
env.expandBy(-env.getWidth() / 10, -env.getHeight() / 10);
pane.setDisplayArea(env);
}
@Override
public void zoomOut() {
ReferencedEnvelope env = pane.getDisplayArea();
env.expandBy(env.getWidth() / 10, env.getHeight() / 10);
pane.setDisplayArea(env);
}
@Override
public void zoomFit() {
pane.reset();
}
public Control getMapComposite() {
return pane;
}
@Override
public Control[] getZoomableControls() {
return new Control[] { pane };
}
/**
* Method createToolItem()
* @see msi.gama.gui.views.IToolbarDecoratedView#createToolItem(int, msi.gama.gui.swt.controls.GamaToolbar2)
*/
@Override
public void createToolItems(final GamaToolbar2 tb) {
this.toolbar = tb;
}
public void setStrokeColor(final Color color, final Mode mode, final FeatureTypeStyle fts) {
if ( mode == Mode.LINE ) {
LineSymbolizer sym = SLD.lineSymbolizer(fts);
SLD.setLineColour(sym, color);
} else if ( mode == Mode.POLYGON ) {
PolygonSymbolizer sym = SLD.polySymbolizer(fts);
Stroke s = new StyleBuilder().createStroke(color);
sym.setStroke(s);
} else if ( mode == Mode.POINT || mode == Mode.ALL ) { // default to handling as Point
PointSymbolizer sym = SLD.pointSymbolizer(fts);
SLD.setPointColour(sym, color);
}
}
public Stroke getStroke(final Mode mode, final FeatureTypeStyle fts) {
Stroke stroke = null;
if ( mode == Mode.LINE ) {
LineSymbolizer sym = SLD.lineSymbolizer(fts);
return SLD.stroke(sym);
} else if ( mode == Mode.POLYGON ) {
PolygonSymbolizer sym = SLD.polySymbolizer(fts);
return SLD.stroke(sym);
} else if ( mode == Mode.POINT || mode == Mode.ALL ) { // default to handling as Point
PointSymbolizer sym = SLD.pointSymbolizer(fts);
return SLD.stroke(sym);
}
return new StyleBuilder().createStroke();
}
public Fill getFill(final Mode mode, final FeatureTypeStyle fts) {
if ( mode == Mode.POLYGON ) {
PolygonSymbolizer sym = SLD.polySymbolizer(fts);
return SLD.fill(sym);
} else if ( mode == Mode.POINT || mode == Mode.ALL ) { // default to handling as Point
PointSymbolizer sym = SLD.pointSymbolizer(fts);
return SLD.fill(sym);
}
return new StyleBuilder().createFill();
}
public void setFillColor(final Color color, final Mode mode, final FeatureTypeStyle fts) {
if ( mode == Mode.POLYGON ) {
PolygonSymbolizer sym = SLD.polySymbolizer(fts);
Fill s = new StyleBuilder().createFill(color);
sym.setFill(s);
} else if ( mode == Mode.POINT || mode == Mode.ALL ) { // default to handling as Point
PointSymbolizer sym = SLD.pointSymbolizer(fts);
SLD.setPointColour(sym, color);
}
}
public Mode determineMode(final SimpleFeatureType schema, final String def) {
if ( schema == null ) {
return Mode.NONE;
} else if ( SLDs.isLine(schema) ) {
return Mode.LINE;
} else if ( SLDs.isPolygon(schema) ) {
return Mode.POLYGON;
} else if ( SLDs.isPoint(schema) ) {
return Mode.POINT;
} else { // default
if ( def.equals("Polygon") ) {
return Mode.POLYGON;
} else if ( def.equals("Line") ) {
return Mode.LINE;
} else if ( def.equals("Point") ) { return Mode.POINT; }
}
return Mode.ALL; // we are a generic geometry
}
/**
* Method getColorLabels()
* @see msi.gama.gui.views.IToolbarDecoratedView.Colorizable#getColorLabels()
*/
@Override
public String[] getColorLabels() {
if ( mode == Mode.POLYGON || mode == Mode.ALL ) {
return new String[] { "Set line color...", "Set fill color..." };
} else {
return new String[] { "Set line color..." };
}
}
/**
* Method getColor()
* @see msi.gama.gui.views.IToolbarDecoratedView.Colorizable#getColor(int)
*/
@Override
public GamaUIColor getColor(final int index) {
Color c;
if ( index == 0 ) {
c = SLD.color(getStroke(mode, fts));
} else {
c = SLD.color(getFill(mode, fts));
}
return GamaColors.get(c);
}
/**
* Method setColor()
* @see msi.gama.gui.views.IToolbarDecoratedView.Colorizable#setColor(int, msi.gama.gui.swt.GamaColors.GamaUIColor)
*/
@Override
public void setColor(final int index, final GamaUIColor gc) {
RGB rgb = gc.getRGB();
Color c = new Color(rgb.red, rgb.green, rgb.blue);
if ( index == 0 ) {
setStrokeColor(c, mode, fts);
} else {
setFillColor(c, mode, fts);
}
((StyleLayer) layer).setStyle(style);
}
}
| [
"alexis.drogoul@gmail.com@b91ef52e-2b48-11df-9ab6-b1cdc0d4a89a"
] | alexis.drogoul@gmail.com@b91ef52e-2b48-11df-9ab6-b1cdc0d4a89a |
cd4bf618254ce9e1257672f89dd24bbb938c8e02 | 57bb5fc34cb2073117b5ddb89880729757cfb775 | /java-project/src/main/java/Temp/bac1197_최소스패닝트리_G4.java | 13820bda672663b36a58b8dc999dcc05887d892b | [] | no_license | wotjd4305/Algorithm | ec666590e631d80deb7ce822f527e5773a5414b7 | add752ad748333dcd1238e951e48489cd998ef13 | refs/heads/master | 2021-10-29T14:34:40.273103 | 2021-10-23T15:31:13 | 2021-10-23T15:31:13 | 215,498,662 | 0 | 1 | null | 2020-12-25T04:56:39 | 2019-10-16T08:38:05 | Java | UTF-8 | Java | false | false | 2,611 | java | package main.java.Temp;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class bac1197_최소스패닝트리_G4 {
static int answer;
static int p[];
static ArrayList<Edge> AL = new ArrayList<>();
static int V;
static int E;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
answer = 0;
AL.clear();
st = new StringTokenizer(br.readLine());
while(st.hasMoreTokens()){
V = Integer.parseInt(st.nextToken());
E = Integer.parseInt(st.nextToken());
}
for(int i=0; i<E; i++) {
st = new StringTokenizer(br.readLine());
while (st.hasMoreTokens()) {
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
AL.add(new Edge(x,y,Integer.parseInt(st.nextToken())));
}
}
//거리 계산하여 넣기
solution();
System.out.println(answer);
}
public static void solution(){
//정점수.
p = new int[V+1];
//집합으로
for(int i =1; i<p.length; i++) p[i] = i;
//익명클래스 써보기..
Comparator<Edge> comp = new Comparator<Edge>() {
@Override
public int compare(Edge o1, Edge o2) {
return o1.val - o2.val;
}
};
//거리 입력후, 정렬
Collections.sort(AL, comp);
int cnt = 0; // 선택된 간선의 개수
int MST = 0;
// 가중치가 최소인 간선을 선택 V-1개
for (int i = 0; i < AL.size(); i++) {
Edge e = AL.get(i);
int px = findSet(e.a);
int py = findSet(e.b);
if(px != py){
union(px, py);
cnt++;
MST += e.val;
if(cnt == V-1){
break;
}
}
}
answer = MST;
}
public static void union(int px, int py) {
p[py] = px;
}
public static int findSet(int x) {
if(p[x] == x) return x;
else return p[x] = findSet(p[x]);
}
public static class Edge{
int a; int b;
int val;
public Edge(int a, int b, int val) {
this.a = a; this.b = b;
this.val = val;
}
}
} | [
"43901682+wotjd4305@users.noreply.github.com"
] | 43901682+wotjd4305@users.noreply.github.com |
e7d8ee0ef6b05644c5970698f122d24391bbbee4 | b280a34244a58fddd7e76bddb13bc25c83215010 | /scmv6/center-open/src/main/java/com/smate/center/open/service/interconnection/log/InterconnectionGetPubLogService.java | f98cb7322a788dae8c52b4e4c8ff3f24f6fa0e67 | [] | no_license | hzr958/myProjects | 910d7b7473c33ef2754d79e67ced0245e987f522 | d2e8f61b7b99a92ffe19209fcda3c2db37315422 | refs/heads/master | 2022-12-24T16:43:21.527071 | 2019-08-16T01:46:18 | 2019-08-16T01:46:18 | 202,512,072 | 2 | 3 | null | 2022-12-16T05:31:05 | 2019-08-15T09:21:04 | Java | UTF-8 | Java | false | false | 360 | java | package com.smate.center.open.service.interconnection.log;
import java.util.Map;
/**
* 记录成果拉取 日志
*
* @author tsz
*
*/
public interface InterconnectionGetPubLogService {
/**
* 保存日志
*
* @throws Exception
*/
public void saveGetPubLog(int accessType, int nums, Map<String, Object> dataParamet) throws Exception;
}
| [
"zhiranhe@irissz.com"
] | zhiranhe@irissz.com |
823ec6d8e13d80d2cc16b24fb868d08317d99c94 | ea1df9a1c8eea38737401dbc51ac2ab8e4ee8377 | /src/bv.java | d73e927ab78652ad239e3e1f4817b96f95181f42 | [] | no_license | EvelusDevelopment/670-Deob | 150135da42dc300a4d2ec708055ea9b87f1dc0c7 | e35c06d1269b3d0473f413c4976ab41f68e42c5e | refs/heads/master | 2021-01-23T12:11:12.239615 | 2012-01-08T07:58:53 | 2012-01-08T07:58:53 | 3,126,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,170 | java |
final class bv {
static int[] b;
static int c;
static int a;
static int d;
static final int a(int var0, int var1, int var2, int var3) {
if(var1 != 5) {
b = (int[])null;
}
++d;
return (pd.b[var3][var2][var0] & 8) == 0?(var3 > 0 && (pd.b[1][var2][var0] & 2) != 0?var3 - 1:var3):0;
}
static final int[] a(Object[] var0, int var1, byte var2) {
++c;
int[] var3 = od.a(-1704, var1, (Object[])((Object[])var0[5]));
if(var2 != 75) {
return (int[])((int[])var0[21]);
} else {
if(((boolean[])((boolean[])((Object[])((Object[])var0[5]))[4]))[0]) {
int var4 = b[var1];
if(var0 != null && (-6 == ~var0.length && var0[3].equals(Integer.valueOf(0)) || var0.length == 3)) {
a((Object[])null, -27, (byte)75);
}
int var5 = var4 - 2048 >> 1;
for(int var6 = 0; fo.b > var6; ++var6) {
int var8 = wra.d[var6];
int var9 = -2048 + var8 >> 1;
int var7;
if(((int[])((int[])var0[1]))[1] != 0) {
int var10 = var9 * var9 + var5 * var5 >> 12;
var7 = (int)(Math.sqrt((double)((float)var10 / 4096.0F)) * 4096.0D);
var7 = (int)((double)(((int[])((int[])var0[1]))[3] * var7) * 3.141592653589793D);
} else {
var7 = (-var4 + var8) * ((int[])((int[])var0[1]))[3];
}
var7 -= -4096 & var7;
if(((int[])((int[])var0[1]))[2] == 0) {
var7 = ad.c[255 & var7 >> 4] + 4096 >> 1;
} else if(-3 == ~((int[])((int[])var0[1]))[2]) {
var7 -= 2048;
if(0 > var7) {
var7 = -var7;
}
var7 = -var7 + 2048 << 1;
}
var3[var6] = var7;
}
}
return var3;
}
}
static final void a(Object[] var0, byte var1) throws oqa {
++a;
if(var1 < -10) {
var0[29] = new Object[3][5][];
var0[30] = ab.a(new Object[2], (byte)-81);
}
}
}
| [
"sinisoul@gmail.com"
] | sinisoul@gmail.com |
11d374f6636b3a7b941bdce2db34f3454d40c603 | ccda504a1b617db9893adaa2a2a968b87576bbef | /lib.fast/src/main/java/com/saiyi/libfast/widgets/UIAlertView.java | e1c661c8f174124027db4943e25a518e0385edf9 | [] | no_license | Catfeeds/GymEquipment | 8a3bb0d557feac9f6ace8bb8f289040d5b7a7321 | 94de90efb3d9190caf1c42c8f510155804e61b91 | refs/heads/master | 2020-04-12T22:13:49.313701 | 2018-09-21T08:04:48 | 2018-09-21T08:04:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,200 | java | package com.saiyi.libfast.widgets;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.saiyi.libfast.R;
/**
* 仿IOS的弹出框
*
*
*/
public class UIAlertView extends Dialog {
private Context context;
private String title;
private String message;
private String buttonLeftText;
private String buttonRightText;
private ClickListenerInterface clickListenerInterface;
public UIAlertView(Context context, String title, String message,
String buttonLeftText, String buttonRightText) {
super(context, R.style.UIAlertViewStyle);
this.context = context;
this.title = title;
this.message = message;
this.buttonLeftText = buttonLeftText;
this.buttonRightText = buttonRightText;
}
public interface ClickListenerInterface {
public void doLeft();
public void doRight();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
inite();
}
public void inite() {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.ui_alert_view, null);
setContentView(view);
TextView tvMessage = (TextView) view.findViewById(R.id.tvMessage);
TextView tvLeft = (TextView) view.findViewById(R.id.tvBtnLeft);
TextView tvRight = (TextView) view.findViewById(R.id.tvBtnRight);
TextView tvTitle = (TextView) view.findViewById(R.id.tvTitle);
if ("".equals(title)) {
tvTitle.setVisibility(View.GONE);
} else {
tvTitle.setText(title);
}
if ("".equals(buttonLeftText)){
tvLeft.setVisibility(View.GONE);
}else {
tvLeft.setText(buttonLeftText);
}
tvMessage.setText(message);
tvRight.setText(buttonRightText);
tvLeft.setOnClickListener(new clickListener());
tvRight.setOnClickListener(new clickListener());
Window dialogWindow = getWindow();
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
DisplayMetrics d = context.getResources().getDisplayMetrics();
lp.width = (int) (d.widthPixels * 0.7);
dialogWindow.setAttributes(lp);
}
public void setClicklistener(ClickListenerInterface clickListenerInterface) {
this.clickListenerInterface = clickListenerInterface;
}
private class clickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
String tag = (String)v.getTag();
switch (tag) {
case "tvBtnLeft":
clickListenerInterface.doLeft();
break;
case "tvBtnRight":
clickListenerInterface.doRight();
break;
default:
break;
}
}
}
;
}
| [
"lgs@qq.com"
] | lgs@qq.com |
9c9b4c1cbf75ecc4a1bd3793d9303a25355d2a9c | f9b6fb00c565203b401e5699cdc23c40f786fd58 | /src/com/company/VariantB/Drob/Drob.java | eb97c602a5613ad7722f7ff33eb59192249d3651 | [] | no_license | EugeniaBaranova/MyTask0 | f695c3d851eb0a919d0491de6c1a676ed3a0968d | 0483a5a79d6ec6a3deee72b506615e543d1d3075 | refs/heads/master | 2020-03-27T04:48:30.636212 | 2018-08-26T21:10:55 | 2018-08-26T21:10:55 | 145,969,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,068 | java | package com.company.VariantB.Drob;
public class Drob {
private int m; //числитель
private int n; //знаменатель
Drob(int m, int n){
setM(m);
setN(n);
}
private void setM(int m){
this.m = m;
}
private void setN(int n){
this.n = n;
}
private int getM(){
return m;
}
private int getN(){
return n;
}
@Override
public String toString() {
return "дробь " + getM() + "/" + getN();
}
public static void printArray(Drob[] drobs){
System.out.println("Список дробей:");
for (Drob drob: drobs) {
System.out.println(drob.toString());
}
System.out.println(" ");
}
private static int[] sokrashchenieDrobi(int newM, int newN){
if(newM > newN) {
for (int i = 2; i <= newM/2; i++){
if(newM%i == 0 && newN%i == 0){
newM = newM/i; newN = newN/i;
}
}
} else {
for (int i = 2; i <= newN/2; i++){
if(newM%i == 0 && newN%i == 0){
newM = newM/i; newN = newN/i;
}
}
}
return new int[] {newM, newN};
}
public static void slogenie(Drob drob1, Drob drob2){
int newM;
int newN;
if (drob1.getN() == drob2.getN()){
newM = drob1.getM()+drob2.getM();
newN = drob1.getN();
} else{
newN = drob1.getN()*drob2.getN();
newM = (drob1.getM()*drob2.getN())+(drob2.getM()*drob1.getN());
}
int[] newMandN= Drob.sokrashchenieDrobi(newM, newN);
newM = newMandN[0];
newN = newMandN[1];
System.out.println("Результат сложения: " + drob1 + " + " + drob2 + " = " + newM + "/" + newN + "\n");
}
public static void vychitanie(Drob drob1, Drob drob2){
int newM;
int newN;
if (drob1.getN() == drob2.getN()){
newM = drob1.getM()-drob2.getM();
newN = drob1.getN();
} else{
newN = drob1.getN()*drob2.getN();
newM = (drob1.getM()*drob2.getN())-(drob2.getM()*drob1.getN());
}
int[] newMandN= Drob.sokrashchenieDrobi(newM, newN);
newM = newMandN[0];
newN = newMandN[1];
System.out.println("Результат вычитания: " + drob1 + " - " + drob2 + " = " + newM + "/" + newN + "\n");
}
public static void umnogenie(Drob drob1, Drob drob2){
int newM = drob1.getM()*drob2.getM();
int newN = drob1.getN()*drob2.getN();
int[] newMandN = Drob.sokrashchenieDrobi(newM, newN);
newM = newMandN[0];
newN = newMandN[1];
System.out.println("Результат умножения: " + drob1 + " * " + drob2 + " = " + newM + "/" + newN + "\n");
}
public static void delenie(Drob drob1, Drob drob2){
int newM = drob1.getM()*drob2.getN();
int newN = drob1.getN()*drob2.getM();
int[] newMandN= Drob.sokrashchenieDrobi(newM, newN);
newM = newMandN[0];
newN = newMandN[1];
System.out.println("Результат деления: " + drob1 + " / " + drob2 + " = " + newM + "/" + newN + "\n");
}
public static void changeEvenElement(Drob[] drobs){
for (int i = 0; i < drobs.length-1; i++) {
if(i%2 == 0){
if (drobs[i].getN() == drobs[i+1].getN()){
drobs[i].m = drobs[i].getM()+drobs[i+1].getM();
} else{
int newN = drobs[i].getN()*drobs[i+1].getN();
int newM = (drobs[i].getM()*drobs[i+1].getN())+(drobs[i+1].getM()*drobs[i].getN());
drobs[i].n = newN;
drobs[i].m = newM;
}
int[] newMandN= Drob.sokrashchenieDrobi(drobs[i].n, drobs[i].m);
drobs[i].n = newMandN[0];
drobs[i].m = newMandN[1];
}
}
}
}
| [
"21061997qwertyuiop@gmail.com"
] | 21061997qwertyuiop@gmail.com |
901eae86eeb0971d19cb3c0cf08ed64042d00b2e | c99d70315aa072f2e38d1c66d049a5ee0adf8d2b | /elara-samples/src/main/java/org/tools4j/elara/samples/bank/state/Bank.java | 52e09ed495cca091b13b0ffbad968499acf2f5d1 | [
"MIT"
] | permissive | tools4j/elara | bb5d00d3fe2bc18a546170cabbc15412579eec71 | 57276e2d82628de7e41962ab4d36cbfaaefa3ca8 | refs/heads/master | 2023-09-02T01:25:21.168070 | 2023-06-09T11:30:09 | 2023-06-09T11:30:09 | 243,245,824 | 12 | 3 | MIT | 2023-03-28T15:50:20 | 2020-02-26T11:25:03 | Java | UTF-8 | Java | false | false | 3,825 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2020-2023 tools4j.org (Marco Terzer, Anton Anufriev)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.tools4j.elara.samples.bank.state;
import org.tools4j.elara.samples.bank.command.CreateAccountCommand;
import org.tools4j.elara.samples.bank.event.AccountCreatedEvent;
import org.tools4j.elara.samples.bank.event.AccountCreationRejectedEvent;
import org.tools4j.elara.samples.bank.event.BankEvent;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
public interface Bank {
Set<String> accounts();
boolean hasAccount(String name);
BankAccount account(String name);
BankEvent process(CreateAccountCommand command);
interface Mutable extends Bank {
@Override
BankAccount.Mutable account(String name);
BankAccount.Mutable openAccount(final String name);
BankAccount.Mutable closeAccount(final String name);
}
class Default implements Mutable {
private final Map<String, BankAccount.Mutable> accountByName = new LinkedHashMap<>();
@Override
public Set<String> accounts() {
return Collections.unmodifiableSet(accountByName.keySet());
}
@Override
public boolean hasAccount(final String name) {
return accountByName.containsKey(name);
}
@Override
public BankAccount.Mutable account(final String name) {
final BankAccount.Mutable account = accountByName.get(name);
if (account != null) {
return account;
}
throw new IllegalArgumentException("No such account: " + name);
}
@Override
public BankAccount.Mutable openAccount(final String name) {
final BankAccount.Mutable account = new BankAccount.Default(this, name);
if (accountByName.putIfAbsent(name, account) != null) {
throw new IllegalArgumentException("Account already exists: " + name);
}
return account;
}
@Override
public BankAccount.Mutable closeAccount(final String name) {
final BankAccount.Mutable account = accountByName.remove(name);
if (account != null) {
return account;
}
throw new IllegalArgumentException("No such account: " + name);
}
@Override
public BankEvent process(final CreateAccountCommand command) {
final String account = command.name;
if (hasAccount(account)) {
return new AccountCreationRejectedEvent(account, "account with this name already exists");
}
return new AccountCreatedEvent(account);
}
}
}
| [
"terzerm@gmail.com"
] | terzerm@gmail.com |
e97bee0447719a338bc2325f21735e0c263a654e | 31df6796e50538b870bc6af57fe27add64846ef1 | /flow-spring-boot-starter/src/main/java/wiki/capsule/flow/service/impl/FlowLogServiceImpl.java | 2628c43994462271226e6f535cfb85c08fc24dd5 | [
"Apache-2.0"
] | permissive | tree323/Capsule-Flow | 783e370c6c73cc3def56b5d7eeb2048a0e337686 | 2f2b8865d998bd62c4a52a4e73ab0a0bf51546e6 | refs/heads/master | 2023-04-03T07:24:11.002704 | 2020-07-05T23:58:52 | 2020-07-05T23:58:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | /*
* Copyright 2019-2029 DiGuoZhiMeng(https://github.com/DiGuoZhiMeng)
*
* 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 wiki.capsule.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import wiki.capsule.flow.entity.FlowLog;
import wiki.capsule.flow.mapper.FlowLogMapper;
import wiki.capsule.flow.service.FlowLogService;
/**
* <pre>
* 流程审批历史日志表 服务实现类
* </pre>
*
* @author DiGuoZhiMeng
* @since 2020-06-14
*/
@Slf4j
@Service
public class FlowLogServiceImpl extends ServiceImpl<FlowLogMapper, FlowLog> implements FlowLogService {
}
| [
"1114031364@qq.com"
] | 1114031364@qq.com |
3ea2fe824d042d65d29c5479f90659eb1ebe534a | 8977edc094f678fa4c06191703a41e8c03928fce | /src/com/mathproblems/FibonacciModM.java | 8db97d0ea0678b51065e8d4b34ba8fdddb8fb47a | [] | no_license | rohitdumbre86/CommonProgramQuestions | 77d02696e519677cf9e85afbed0e7c9cf44e39b4 | a96f3e98203f84637a8ece23dc6845e3effe83b7 | refs/heads/master | 2020-03-11T12:36:36.098480 | 2019-01-30T13:20:08 | 2019-01-30T13:20:08 | 130,001,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package com.mathproblems;
import java.util.Scanner;
public class FibonacciModM {
private static long getFibonacciHugeNaive(long n, long m) {
if (n <= 1)
return n;
long previous = 0;
long current = 1;
for (long i = 0; i < n - 1; ++i) {
long tmp_previous = previous;
previous = current;
current = tmp_previous + current;
}
return current % m;
}
private static long getFibonacci(long n, long m) {
if (n <= 1)
return n;
long previous = 0;
long current = 1;
long fiboCurrent = 1;
if (n > m) {
n = n % getModLen(m, n);
}
for (long i = 2; i <= n; i++) {
fiboCurrent = current + previous;
previous = current;
current = fiboCurrent;
}
return fiboCurrent % m;
}
private static long getModLen(long m, long n) {
long a = 0, b = 1, c = a + b;
for (int i = 0; i < m * m; i++) {
c = (a + b) % m;
a = b;
b = c;
if (a == 0 && b == 1) {
return i + 1;
}
}
return 0L;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long n = scanner.nextLong();
long m = scanner.nextLong();
System.out.println(getFibonacci(n, m));
}
}
| [
"rohitdumbre86@gmail.com"
] | rohitdumbre86@gmail.com |
c5eeee6d9ad22f61e8d5c72370b2f33fa33dd186 | f9fb6243a56eb25591ff97d18f15d24e88ef5015 | /Project Code/src/jm/audio/synth/Filter.java | 4593480d89ad793cae9c2fb5749b5d4a4f2eb963 | [] | no_license | gw-sd-2016/SPLALO | bc7a771ddc3941e8c2e6afac55d26744cfc9a88b | b7a865af1b7f7334c65f7c585c860952e5d075c2 | refs/heads/master | 2021-01-21T14:01:04.087575 | 2016-05-12T00:01:37 | 2016-05-12T00:01:37 | 44,283,713 | 0 | 0 | null | 2015-12-11T05:30:51 | 2015-10-15T00:19:38 | Java | UTF-8 | Java | false | false | 7,962 | java | package jm.audio.synth;
import java.io.PrintStream;
import jm.audio.AOException;
import jm.audio.AudioObject;
public final class Filter
extends AudioObject
{
public static final int LOW_PASS = 0;
public static final int HIGH_PASS = 1;
private int type = 0;
private double cutoff_frequency;
private double initialCutoff;
private double cutoff_frq_percent;
private double ripple = 0.5D;
private double poles = 2.0D;
private double[] a = new double[22];
private double[] ta = new double[22];
private double[] b = new double[22];
private double[] tb = new double[22];
private double[][] xbuf;
private double[][] ybuf;
public Filter(AudioObject paramAudioObject, double paramDouble)
{
this(paramAudioObject, paramDouble, 0, 0.5D, 2.0D);
}
public Filter(AudioObject paramAudioObject, double paramDouble, int paramInt)
{
this(paramAudioObject, paramDouble, paramInt, 0.5D, 2.0D);
}
public Filter(AudioObject paramAudioObject, double paramDouble1, int paramInt, double paramDouble2, double paramDouble3)
{
super(paramAudioObject, "[Filter]");
this.type = paramInt;
this.cutoff_frequency = paramDouble1;
this.ripple = paramDouble2;
this.poles = paramDouble3;
if (this.poles > 20.0D)
{
System.err.println("More than 20 poles are not allowed (Sorry)");
System.exit(1);
}
}
public Filter(AudioObject[] paramArrayOfAudioObject, double paramDouble, int paramInt)
{
this(paramArrayOfAudioObject, paramDouble, paramInt, 0.5D, 2.0D);
}
public Filter(AudioObject[] paramArrayOfAudioObject, double paramDouble1, int paramInt, double paramDouble2, double paramDouble3)
{
super(paramArrayOfAudioObject, "[Filter]");
this.type = paramInt;
this.cutoff_frequency = paramDouble1;
this.initialCutoff = paramDouble1;
this.ripple = paramDouble2;
this.poles = paramDouble3;
if (this.poles > 20.0D)
{
System.err.println("More than 20 poles are not allowed (Sorry)");
System.exit(1);
}
}
public void build()
{
this.ybuf = new double[this.channels][22];
this.xbuf = new double[this.channels][22];
setCutOff(this.cutoff_frequency);
}
public void printCoefficients()
{
for (int i = 0; i < 22; i++) {
System.out.println("a[" + i + "] " + this.a[i] + " b[" + i + "] " + this.b[i]);
}
}
public void setCutOff(double paramDouble)
{
this.cutoff_frequency = paramDouble;
if (paramDouble <= 0.0D)
{
System.err.println("Filter error: You tried to use a cuttoff frequency of " + paramDouble + " - woops! Frequency must be greater than zero. ");
System.err.println("Exiting from Filter");
System.exit(1);
}
if (paramDouble > 0.5D * this.sampleRate)
{
System.err.println("Cutoff frequencies above the Nyquist limit are BAD ;) SampleRate = " + this.sampleRate + " Frequency = " + paramDouble);
System.err.println("Exiting from Filter");
System.exit(1);
}
this.cutoff_frq_percent = (1.0D / this.sampleRate * paramDouble);
coefficientCalc();
}
public void setPoles(int paramInt)
{
if (paramInt < 0) {
paramInt = 0;
}
if (paramInt > 20) {
paramInt = 20;
}
this.poles = paramInt;
setCutOff(this.cutoff_frequency);
}
public int work(float[] paramArrayOfFloat)
throws AOException
{
int i = this.previous[0].nextWork(paramArrayOfFloat);
float[] arrayOfFloat = null;
if (this.previous.length > 1)
{
arrayOfFloat = new float[i];
this.previous[1].nextWork(arrayOfFloat);
}
int j = 0;
int k = 0;
while (j < i)
{
if ((j % 100 == 0) && (this.previous.length > 1)) {
setCutOff(arrayOfFloat[j] + this.initialCutoff);
}
for (int m = (int)this.poles; m > 0; m--) {
this.xbuf[k][m] = this.xbuf[k][(m - 1)];
}
this.xbuf[k][0] = paramArrayOfFloat[j];
for (m = (int)this.poles; m > 0; m--) {
this.ybuf[k][m] = this.ybuf[k][(m - 1)];
}
this.ybuf[k][0] = 0.0D;
for (m = 0; m < this.poles + 1.0D; m++)
{
this.ybuf[k][0] += this.a[m] * this.xbuf[k][m];
if (m > 0) {
this.ybuf[k][0] += this.b[m] * this.ybuf[k][m];
}
}
paramArrayOfFloat[j] = ((float)(this.ybuf[k][0] * 1.0D));
if (this.channels == ++k) {
k = 0;
}
j++;
}
return j;
}
public void coefficientCalc()
{
for (int i = 0; i < 22; i++)
{
this.a[i] = 0.0D;
this.b[i] = 0.0D;
}
this.a[2] = 1.0D;
this.b[2] = 1.0D;
for (i = 1; i <= this.poles * 0.5D; i++)
{
double[] arrayOfDouble = coefficientCalcSupport(i);
for (int j = 0; j < 22; j++)
{
this.ta[j] = this.a[j];
this.tb[j] = this.b[j];
}
for (j = 2; j < 22; j++)
{
this.a[j] = (arrayOfDouble[0] * this.ta[j] + arrayOfDouble[1] * this.ta[(j - 1)] + arrayOfDouble[2] * this.ta[(j - 2)]);
this.b[j] = (this.tb[j] - arrayOfDouble[3] * this.tb[(j - 1)] - arrayOfDouble[4] * this.tb[(j - 2)]);
}
}
this.b[2] = 0.0D;
for (i = 0; i < 20; i++)
{
this.a[i] = this.a[(i + 2)];
this.b[i] = (-this.b[(i + 2)]);
}
double d1 = 0.0D;
double d2 = 0.0D;
for (int k = 0; k < 20; k++)
{
if (this.type == 0) {
d1 += this.a[k];
}
if (this.type == 0) {
d2 += this.b[k];
}
if (this.type == 1) {
d1 += this.a[k] * Math.pow(-1.0D, k);
}
if (this.type == 1) {
d2 += this.b[k] * Math.pow(-1.0D, k);
}
}
double d3 = d1 / (1.0D - d2);
for (int m = 0; m < 20; m++) {
this.a[m] /= d3;
}
}
private double[] coefficientCalcSupport(int paramInt)
{
double[] arrayOfDouble = new double[5];
double d1 = -Math.cos(3.141592653589793D / (this.poles * 2.0D) + (paramInt - 1) * 3.141592653589793D / this.poles);
double d2 = Math.sin(3.141592653589793D / (this.poles * 2.0D) + (paramInt - 1) * 3.141592653589793D / this.poles);
if (this.ripple != 0.0D)
{
d3 = Math.sqrt(Math.pow(100.0D / (100.0D - this.ripple), 2.0D) - 1.0D);
d4 = 1.0D / this.poles * Math.log(1.0D / d3 + Math.sqrt(1.0D / (d3 * d3) + 1.0D));
d5 = 1.0D / this.poles * Math.log(1.0D / d3 + Math.sqrt(1.0D / (d3 * d3) - 1.0D));
d5 = (Math.exp(d5) + Math.exp(-d5)) * 0.5D;
d1 = d1 * ((Math.exp(d4) - Math.exp(-d4)) * 0.5D) / d5;
d2 = d2 * ((Math.exp(d4) + Math.exp(-d4)) * 0.5D) / d5;
}
double d3 = 2.0D * Math.tan(0.5D);
double d4 = 6.283185307179586D * this.cutoff_frq_percent;
double d5 = d1 * d1 + d2 * d2;
double d6 = 4.0D - 4.0D * d1 * d3 + d5 * (d3 * d3);
double d7 = d3 * d3 / d6;
double d8 = 2.0D * d7;
double d9 = d7;
double d10 = (8.0D - 2.0D * d5 * (d3 * d3)) / d6;
double d11 = (-4.0D - 4.0D * d1 * d3 - d5 * (d3 * d3)) / d6;
double d12 = 0.0D;
if (this.type == 1) {
d12 = -Math.cos(d4 * 0.5D + 0.5D) / Math.cos(d4 * 0.5D - 0.5D);
}
if (this.type == 0) {
d12 = Math.sin(0.5D - d4 * 0.5D) / Math.sin(0.5D + d4 * 0.5D);
}
d6 = 1.0D + d10 * d12 - d11 * (d12 * d12);
arrayOfDouble[0] = ((d7 - d8 * d12 + d9 * (d12 * d12)) / d6);
arrayOfDouble[1] = ((-2.0D * d7 * d12 + d8 + d8 * (d12 * d12) - 2.0D * d9 * d12) / d6);
arrayOfDouble[2] = ((d7 * (d12 * d12) - d8 * d12 + d9) / d6);
arrayOfDouble[3] = ((2.0D * d12 + d10 + d10 * (d12 * d12) - 2.0D * d11 * d12) / d6);
arrayOfDouble[4] = ((-(d12 * d12) - d10 * d12 + d11) / d6);
if (this.type == 1) {
arrayOfDouble[1] = (-arrayOfDouble[1]);
}
if (this.type == 1) {
arrayOfDouble[3] = (-arrayOfDouble[3]);
}
return arrayOfDouble;
}
}
/* Location: C:\Users\Kweku Emuze\Downloads\jMusic1.6.4.jar!\jm\audio\synth\Filter.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"ellisyarboi@gwmail.gwu.edu"
] | ellisyarboi@gwmail.gwu.edu |
5cc33e6a909f1af3da262bba86085072934708b8 | bfb25ef7357d835d22f72b28b0c729ca780087ab | /src/test/java/com/obob/FinanceWebApplicationTests.java | 720b9b1d9379585cb50731253b70566332a3e5d7 | [] | no_license | 1005742198/Finance_Back_Stage-FinanceWeb | f92c474aa8560dc1a840802b71fcfe64aa811e94 | 46d82a1ef32a08b11356636a984b02dd6f2dcbb5 | refs/heads/master | 2021-01-16T21:26:51.325399 | 2016-10-30T08:07:28 | 2016-10-30T08:07:28 | 63,132,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package com.obob;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = FinanceWebApplication.class)
@WebAppConfiguration
public class FinanceWebApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"hongbo.zhao@qdfae.com"
] | hongbo.zhao@qdfae.com |
0b963f058f9e1092e0a7d50169b8eb7dccc2f0cc | fca5deb9391ecafb7a93ebd5a08f408a15517c70 | /core-web/src/main/java/br/com/sourcesphere/core/web/generic/service/MasterService.java | bb09ed5892033797a9b76cddc3f0cf3170fccce4 | [] | no_license | SourceSphere/Core-Web | 861ea1112c4fd8f54d25142771db62f28c0eb921 | 438e0a0a407d3b1aec356586bcf4aae7f5748f89 | refs/heads/master | 2021-01-21T22:29:14.526038 | 2013-03-08T00:00:53 | 2013-03-08T00:00:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,197 | java | package br.com.sourcesphere.core.web.generic.service;
import java.io.Serializable;
import java.util.List;
import org.apache.log4j.Logger;
import br.com.sourcesphere.core.web.generic.controller.MasterController;
import br.com.sourcesphere.core.web.generic.dao.MasterDao;
import br.com.sourcesphere.core.web.generic.dao.exception.DaoException;
import br.com.sourcesphere.core.web.generic.dao.exception.EntityAlreadyExistException;
import br.com.sourcesphere.core.web.generic.service.exception.ServiceException;
/**
* The Master Service
* @author Guilherme Dio
*
* @param <T> - Type of the entity to be used
*/
public abstract class MasterService<T>
{
/**
* Logger
*/
protected final Logger log = Logger.getLogger(MasterController.class);
/**
* The dao must be injected by the above level
*/
private final MasterDao<T> dao;
/**
* Constructs the master service with a dao that must be injected
* @param dao - The dao to be used
*/
public MasterService(MasterDao<T> dao)
{
this.dao = dao;
}
/**
* Execute the add statement of the entity on the model
* @param entity - The entity to be added
*/
public void add(T entity)
{
try
{
dao.saveOrUpdate(entity);
}
catch(EntityAlreadyExistException e)
{
throw e;
}
catch(DaoException e)
{
throw e;
}
catch(Exception e)
{
String msg = "An unexpected error has occurred while adding the entity '"+entity.getClass().getSimpleName()+"'";
throw new ServiceException(msg,e);
}
}
/**
* Execute the alter/update statement on the entity of the model
* @param entity - The entity to be modified
*/
public void alter(T entity)
{
try
{
dao.saveOrUpdate(entity);
}
catch(EntityAlreadyExistException e)
{
throw e;
}
catch(DaoException e)
{
throw e;
}
catch(Exception e)
{
String msg = "An unexpected error has occurred while trying to alter the entity '"+entity.getClass().getSimpleName()+"'";
throw new ServiceException(msg,e);
}
}
/**
* Execute the remove statement on the entity of the model
* @param entity - The entity to be removed
*/
public void delete(T entity)
{
try
{
dao.delete(entity);
}
catch(DaoException e)
{
throw e;
}
catch(Exception e)
{
String msg = "An unexpected error has occurred while deleting the entity '"+entity.getClass().getSimpleName()+"'";
throw new ServiceException(msg,e);
}
}
/**
* Execute the get statement using the identifier to find the entity on the model
* @param identifier
* @return The entity found
*/
public T get(Serializable identifier)
{
try
{
return dao.get(identifier);
}
catch(DaoException e)
{
throw e;
}
catch(Exception e)
{
String msg = "An unexpected error has occurred while getting the entity '"+dao.getClazzType().getSimpleName()+"'";
throw new ServiceException(msg,e);
}
}
/**
* Execute the list statement returning a collection of the current entity of the model with a limited number of results and a first entity index to begin collecting
* @return List of entities
*/
public List<T> listAll(Integer firstResult,Integer maxResults)
{
try
{
return dao.listAll(firstResult,maxResults);
}
catch(DaoException e)
{
throw e;
}
catch(Exception e)
{
String msg = "An unexpected error has occurred while listing the values of the entity '"+dao.getClazzType().getSimpleName()+"'";
throw new ServiceException(msg,e);
}
}
/**
* Execute the list statement returning a collection of the current entity of the model with a limited number of results
* @return List of entities
*/
public List<T> listAll(Integer maxResults)
{
return listAll(0,maxResults);
}
/**
* Execute the list statement returning a collection of the current entity of the model
* @return List of entities
*/
public List<T> listAll()
{
return listAll(0,0);
}
/**
* Gets the dao being used
* @return The dao used
*/
protected MasterDao<T> getDao()
{
return this.dao;
}
}
| [
"ggrdio@gmail.com"
] | ggrdio@gmail.com |
5d248654417fac67b784e7768e2fc6785ad3961b | 53fc81b27ef939cfe6b22f8365fb0eed415a63b7 | /shop-goods/shop-goods-model/src/main/java/quick/pager/shop/goods/request/property/GoodsPropertyPageRequest.java | 11d95c5274b0868db26906e4c968fd696e3b07fc | [
"MIT"
] | permissive | SiGuiyang/spring-cloud-shop | 59b9e3cbd356f43eb27a7d4b63792372fa02c800 | 5d51d31bace7bec96c19574ec09acfbf8ed537be | refs/heads/main | 2022-06-24T22:12:10.288555 | 2021-12-05T10:59:51 | 2021-12-05T10:59:51 | 152,964,871 | 893 | 386 | MIT | 2022-06-17T02:23:56 | 2018-10-14T11:01:21 | Java | UTF-8 | Java | false | false | 521 | java | package quick.pager.shop.goods.request.property;
import lombok.Data;
import lombok.EqualsAndHashCode;
import quick.pager.shop.user.request.PageRequest;
/**
* 商品属性
*
* @author siguiyang
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class GoodsPropertyPageRequest extends PageRequest {
private static final long serialVersionUID = 5949753278809209297L;
/**
* 属性名称
*/
private String propertyName;
/**
* 属性组主键
*/
private Long propertyGroupId;
}
| [
"siguiyang1992@outlook.com"
] | siguiyang1992@outlook.com |
fec1f56cf7fb9dd37722aeeb098b2208c3619b89 | 152c3182014590dece2c1d7ea1a9e8f5d3ad86c5 | /reverse.engineering/src/io/github/jeddict/reveng/database/DBImportWizardDescriptor.java | d07b9b0d6b537d017317ae4debd50d1921652798 | [
"Apache-2.0"
] | permissive | hendrickhan/jeddict | 07782f6e01d173619492a97599cba13caf0f27d5 | 120738750f4f99be4288399232d7ad4d2481ff4f | refs/heads/master | 2020-03-19T00:27:37.150808 | 2018-05-14T13:48:23 | 2018-05-14T13:48:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,636 | java | /**
* Copyright 2013-2018 the original author or authors from the Jeddict project (https://jeddict.github.io/).
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package io.github.jeddict.reveng.database;
import io.github.jeddict.analytics.JeddictLogger;
import io.github.jeddict.collaborate.issues.ExceptionUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeListener;
import org.netbeans.api.progress.aggregate.AggregateProgressFactory;
import org.netbeans.api.progress.aggregate.AggregateProgressHandle;
import org.netbeans.api.progress.aggregate.ProgressContributor;
import org.netbeans.api.project.Project;
import org.netbeans.api.templates.TemplateRegistration;
import io.github.jeddict.jcode.util.SourceGroupSupport;
import io.github.jeddict.reveng.BaseWizardDescriptor;
import io.github.jeddict.reveng.database.generator.IPersistenceGeneratorProvider;
import io.github.jeddict.reveng.database.generator.IPersistenceModelGenerator;
import org.netbeans.modeler.component.Wizards;
import org.netbeans.modules.j2ee.persistence.api.PersistenceLocation;
import org.netbeans.modules.j2ee.persistence.provider.InvalidPersistenceXmlException;
import org.netbeans.modules.j2ee.persistence.provider.ProviderUtil;
import org.netbeans.modules.j2ee.persistence.wizard.fromdb.ProgressPanel;
import org.netbeans.spi.project.ui.templates.support.Templates;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.WizardDescriptor;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
@TemplateRegistration(
folder = "Persistence",
position = 2,
displayName = "#DBImportWizardDescriptor_displayName",
iconBase = "io/github/jeddict/reveng/database/resources/JPA_FILE_ICON.png",
description = "resources/JPA_DB_IMPORT_DESC.html",
category = "persistence"
)
public final class DBImportWizardDescriptor extends BaseWizardDescriptor {
private static final String PROP_HELPER = "wizard-helper"; //NOI18N
private WizardDescriptor wizardDescriptor;
private IPersistenceModelGenerator generator;
private ImportHelper helper;
private ProgressPanel progressPanel;
private Project project;
private final RequestProcessor RP = new RequestProcessor(DBImportWizardDescriptor.class.getSimpleName(), 5);
private static IPersistenceModelGenerator createPersistenceGenerator() {
return Lookup.getDefault()
.lookup(IPersistenceGeneratorProvider.class)
.createGenerator();
}
static ImportHelper getHelper(WizardDescriptor wizardDescriptor) {
return (ImportHelper) wizardDescriptor.getProperty(PROP_HELPER);
}
@Override
public Set<?> instantiate() throws IOException {
// TODO return set of FileObject (or DataObject) you have created
final String title = NbBundle.getMessage(DBImportWizardDescriptor.class, "TXT_EntityClassesGeneration");
final ProgressContributor progressContributor = AggregateProgressFactory.createProgressContributor(title);
final AggregateProgressHandle handle
= AggregateProgressFactory.createHandle(title, new ProgressContributor[]{progressContributor}, null, null);
progressPanel = new ProgressPanel();
final JComponent progressComponent = AggregateProgressFactory.createProgressComponent(handle);
final Runnable r = () -> {
try {
handle.start();
createModel(wizardDescriptor, progressContributor);
} catch (Throwable t) {
ExceptionUtils.printStackTrace(t);
} finally {
generator.uninit();
JeddictLogger.createModelerFile("DB-REV-ENG");
handle.finish();
}
};
// Ugly hack ensuring the progress dialog opens after the wizard closes. Needed because:
// 1) the wizard is not closed in the AWT event in which instantiate() is called.
// Instead it is closed in an event scheduled by SwingUtilities.invokeLater().
// 2) when a modal dialog is created its owner is set to the foremost modal
// dialog already displayed (if any). Because of #1 the wizard will be
// closed when the progress dialog is already open, and since the wizard
// is the owner of the progress dialog, the progress dialog is closed too.
// The order of the events in the event queue:
// - this event
// - the first invocation event of our runnable
// - the invocation event which closes the wizard
// - the second invocation event of our runnable
SwingUtilities.invokeLater(new Runnable() {
private boolean first = true;
@Override
public void run() {
if (!first) {
RP.post(r);
progressPanel.open(progressComponent, title);
} else {
first = false;
SwingUtilities.invokeLater(this);
}
}
});
// The commented code below is the ideal state, but since there is not way to request
// TemplateWizard.Iterator.instantiate() be called asynchronously it
// would cause the wizard to stay visible until the bean generation process
// finishes. So for now just returning the package -- not a problem,
// JavaPersistenceGenerator.createdObjects() returns an empty set anyway.
// remember to wait for createBeans() to actually return!
// Set created = generator.createdObjects();
// if (created.size() == 0) {
// created = Collections.singleton(SourceGroupSupport.getFolderForPackage(helper.getLocation(), helper.getPackageName()));
// }
if (helper.getDBSchemaFile() != null) {//for now open persistence.xml in case of schema was used, as it's 99% will require persistence.xml update
DataObject dObj = null;
try {
dObj = ProviderUtil.getPUDataObject(project);
} catch (InvalidPersistenceXmlException ex) {
}
if (dObj != null) {
return Collections.<DataObject>singleton(dObj);
}
}
return Collections.<DataObject>singleton(DataFolder.findFolder(
SourceGroupSupport.getFolderForPackage(helper.getLocation(), helper.getPackageName(), true)));
}
private void createModel(WizardDescriptor wiz, ProgressContributor handle) throws IOException {
try {
handle.start(1); //TODO: need the correct number of work units here
handle.progress(NbBundle.getMessage(DBImportWizardDescriptor.class, "TXT_SavingSchema"));
progressPanel.setText(NbBundle.getMessage(DBImportWizardDescriptor.class, "TXT_SavingSchema"));
FileObject dbschemaFile = helper.getDBSchemaFile();
if (dbschemaFile == null) {
File f = new File(project.getProjectDirectory().getPath() + File.separator + "src");
FileObject configFilesFolder = FileUtil.toFileObject(f);
if (configFilesFolder == null) {
String message = NbBundle.getMessage(DBImportWizardDescriptor.class, "TXT_NoConfigFiles");
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.ERROR_MESSAGE));
return;
}
}
String extracting = NbBundle.getMessage(DBImportWizardDescriptor.class, "TXT_ExtractingEntityClassesAndRelationships");
handle.progress(extracting);
progressPanel.setText(extracting);
helper.buildBeans();
generator.generateModel(progressPanel, helper, dbschemaFile, handle);
} finally {
handle.finish();
SwingUtilities.invokeLater(progressPanel::close);
}
}
@Override
public void initialize(WizardDescriptor wizard) {
wizardDescriptor = wizard;
project = Templates.getProject(wizard);
panels = createPanels();
Wizards.mergeSteps(wizardDescriptor, panels.toArray(new WizardDescriptor.Panel[0]), createSteps());
generator = createPersistenceGenerator();
FileObject configFilesFolder = PersistenceLocation.getLocation(project);
helper = new ImportHelper(project, configFilesFolder, generator);
wizard.putProperty(PROP_HELPER, helper);
generator.init(wizard);
}
@Override
public void uninitialize(WizardDescriptor wizard) {
panels = null;
generator.uninit();
}
private String[] createSteps() {
return new String[]{
NbBundle.getMessage(DBImportWizardDescriptor.class, "LBL_DatabaseTables"),
NbBundle.getMessage(DBImportWizardDescriptor.class, "LBL_EntityClasses"),
NbBundle.getMessage(DBImportWizardDescriptor.class, "LBL_MappingOptions"),};
}
private List<WizardDescriptor.Panel<WizardDescriptor>> createPanels() {
String wizardTitle = NbBundle.getMessage(DBImportWizardDescriptor.class, "TXT_TITLE");
List<WizardDescriptor.Panel<WizardDescriptor>> panels = new ArrayList<>();
panels.add(new DatabaseTablesSelectorPanel.WizardPanel(wizardTitle));
panels.add(new EntityClassesConfigurationPanel.WizardPanel());
return panels;
}
}
| [
"gaurav.gupta.jc@gmail.com"
] | gaurav.gupta.jc@gmail.com |
b088847c24886717d79cf106115db579210e5009 | d6a75103bef80f3dee5f159eb4367b0d908b38c4 | /src/main/java/com/hatimonline/code/roosec/validators/SystemUserValidator.java | f8baf3b9b7c912f759bf400b6d80c5d587ff8eb2 | [] | no_license | liu-wl/roosec | 0acf0ef85827fbfffaf78f03ff882dae4dc5f9d9 | 2338d71d3223eb9f83264c0091697e8d78e9c890 | refs/heads/master | 2021-01-16T20:51:33.608150 | 2010-12-14T07:43:25 | 2010-12-14T07:43:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,720 | java | package com.hatimonline.code.roosec.validators;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import com.hatimonline.code.roosec.domain.SystemUser;
@Component
public class SystemUserValidator extends LocalValidatorFactoryBean implements
Validator {
private static final Log logger = LogFactory
.getLog(SystemUserValidator.class);
@Override
public boolean supports(Class<?> clazz) {
return SystemUser.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {
super.validate(target, errors);
SystemUser user = (SystemUser) target;
if (user != null) {
if(user.getId() == null && SystemUser.findSystemUsersByUsername(user.getUsername()).getResultList().size() > 0)
{
errors.rejectValue("username",
"systemuser.username.alreadyinuse",
new String[] { user.getUsername() },
"usename {0} is already in use");
}
if(user.getId() != null && SystemUser.findSystemUsersByUsername(user.getUsername()).getResultList().size() > 0 && ((SystemUser) SystemUser.findSystemUsersByUsername(user.getUsername()).getSingleResult()).getId().longValue() != user.getId().longValue())
{
errors.rejectValue("username",
"systemuser.username.alreadyinuse",
new String[] { user.getUsername() },
"usename {0} is already in use");
}
// else , let it slide
} else {
errors.reject("systemuser.error", "WTF, What a Terrible Failure");
}
}
}
| [
"hatim@hatimonline.com"
] | hatim@hatimonline.com |
1dba1841b447c0d35914cc21a4c713334ecea23a | 0b4844d550c8e77cd93940e4a1d8b06d0fbeabf7 | /JavaSource/intf/dream/bee/finder/eqloc/dto/BeeFinderEqlocCommonDTO.java | 302e70b38c049dd0ea3bb890fede4f3adfba7a5a | [] | no_license | eMainTec-DREAM/DREAM | bbf928b5c50dd416e1d45db3722f6c9e35d8973c | 05e3ea85f9adb6ad6cbe02f4af44d941400a1620 | refs/heads/master | 2020-12-22T20:44:44.387788 | 2020-01-29T06:47:47 | 2020-01-29T06:47:47 | 236,912,749 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 420 | java | package intf.dream.bee.finder.eqloc.dto;
import common.bean.BaseDTO;
/**
* 공통 DTO
* @author
* @version $Id: $
* @since 1.0
*
*/
public class BeeFinderEqlocCommonDTO extends BaseDTO
{
/** 회사코드 */
private String compNo = "";
public String getCompNo() {
return compNo;
}
public void setCompNo(String compNo) {
this.compNo = compNo;
}
}
| [
"HN4741@10.31.0.185"
] | HN4741@10.31.0.185 |
627ede9c40a3f5e72f592ec1650140a9f777b311 | 93c7e807608aed6f90b17799550698ba4b4f2284 | /src/com/kerhomjarnoin/pokemon/view/badges/BadgesEditFragment.java | ca63928b4832ec7fb5277905b0540af9185e9592 | [] | no_license | Ptipoi-jf/harmoyPokemonAndroid | 6c25734550d7a80b75688febdc2c7c644b10e920 | 852b7199a5120e57bf8699218315c49757311a6f | refs/heads/master | 2021-05-31T12:13:41.355431 | 2016-05-27T19:47:26 | 2016-05-27T19:47:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,314 | java | /**************************************************************************
* BadgesEditFragment.java, pokemon Android
*
* Copyright 2016
* Description :
* Author(s) : Harmony
* Licence :
* Last update : May 27, 2016
*
**************************************************************************/
package com.kerhomjarnoin.pokemon.view.badges;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Toast;
import com.google.common.base.Strings;
import com.kerhomjarnoin.pokemon.R;
import com.kerhomjarnoin.pokemon.entity.Badges;
import com.kerhomjarnoin.pokemon.harmony.view.HarmonyFragmentActivity;
import com.kerhomjarnoin.pokemon.harmony.view.HarmonyFragment;
import com.kerhomjarnoin.pokemon.menu.SaveMenuWrapper.SaveMenuInterface;
import com.kerhomjarnoin.pokemon.provider.utils.BadgesProviderUtils;
import com.kerhomjarnoin.pokemon.provider.contract.BadgesContract;
/** Badges create fragment.
*
* This fragment gives you an interface to edit a Badges.
*
* @see android.app.Fragment
*/
public class BadgesEditFragment extends HarmonyFragment
implements SaveMenuInterface {
/** Model data. */
protected Badges model = new Badges();
/** curr.fields View. */
/** nom View. */
protected EditText nomView;
/** Initialize view of curr.fields.
*
* @param view The layout inflating
*/
protected void initializeComponent(View view) {
this.nomView = (EditText) view.findViewById(
R.id.badges_nom);
}
/** Load data from model to curr.fields view. */
public void loadData() {
if (this.model.getNom() != null) {
this.nomView.setText(this.model.getNom());
}
}
/** Save data from curr.fields view to model. */
public void saveData() {
this.model.setNom(this.nomView.getEditableText().toString());
}
/** Check data is valid.
*
* @return true if valid
*/
public boolean validateData() {
int error = 0;
if (Strings.isNullOrEmpty(
this.nomView.getText().toString().trim())) {
error = R.string.badges_nom_invalid_field_error;
}
if (error > 0) {
Toast.makeText(this.getActivity(),
this.getActivity().getString(error),
Toast.LENGTH_SHORT).show();
}
return error == 0;
}
@Override
public View onCreateView(
LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View view =
inflater.inflate(R.layout.fragment_badges_edit,
container,
false);
final Intent intent = getActivity().getIntent();
this.model = (Badges) intent.getParcelableExtra(
BadgesContract.PARCEL);
this.initializeComponent(view);
this.loadData();
return view;
}
/**
* This class will update the entity into the DB.
* It runs asynchronously and shows a progressDialog
*/
public static class EditTask extends AsyncTask<Void, Void, Integer> {
/** AsyncTask's context. */
private final android.content.Context ctx;
/** Entity to update. */
private final Badges entity;
/** Progress Dialog. */
private ProgressDialog progress;
/**
* Constructor of the task.
* @param entity The entity to insert in the DB
* @param fragment The parent fragment from where the aSyncTask is
* called
*/
public EditTask(final BadgesEditFragment fragment,
final Badges entity) {
super();
this.ctx = fragment.getActivity();
this.entity = entity;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
this.progress = ProgressDialog.show(this.ctx,
this.ctx.getString(
R.string.badges_progress_save_title),
this.ctx.getString(
R.string.badges_progress_save_message));
}
@Override
protected Integer doInBackground(Void... params) {
Integer result = -1;
try {
result = new BadgesProviderUtils(this.ctx).update(
this.entity);
} catch (SQLiteException e) {
android.util.Log.e("BadgesEditFragment", e.getMessage());
}
return result;
}
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
if (result > 0) {
final HarmonyFragmentActivity activity =
(HarmonyFragmentActivity) this.ctx;
activity.setResult(HarmonyFragmentActivity.RESULT_OK);
activity.finish();
} else {
final AlertDialog.Builder builder =
new AlertDialog.Builder(this.ctx);
builder.setIcon(0);
builder.setMessage(this.ctx.getString(
R.string.badges_error_edit));
builder.setPositiveButton(
this.ctx.getString(android.R.string.yes),
new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
}
});
builder.show();
}
this.progress.dismiss();
}
}
@Override
public void onClickSave() {
if (this.validateData()) {
this.saveData();
new EditTask(this, this.model).execute();
}
}
}
| [
"florian.jarnoin@outlook.fr"
] | florian.jarnoin@outlook.fr |
93d052c698ecee5e187f80658e8e61d61bfe3955 | 0ac0cdd00046b93d922d5c00afbfab5cd9b80901 | /sentinel-adapter/sentinel-quarkus-adapter/sentinel-annotation-quarkus-adapter-deployment/src/main/java/com/alibaba/csp/sentinel/annotation/quarkus/adapter/deployment/SentinelAnnotationQuarkusAdapterProcessor.java | 3e958fa1c02985d3d602c46a77e5952b31cb4aeb | [
"Apache-2.0"
] | permissive | kangyuanjia/Sentinel | af2425b2996450f402138c5d4f25c08a10ed8c3d | d59d2d3071ca679973a957eec78b308eb72bdeb7 | refs/heads/master | 2022-10-18T03:20:54.176683 | 2020-06-16T04:01:52 | 2020-06-16T04:01:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,565 | java | /*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* 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
*
* https://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.alibaba.csp.sentinel.annotation.quarkus.adapter.deployment;
import com.alibaba.csp.sentinel.annotation.cdi.interceptor.SentinelResourceInterceptor;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import java.util.Arrays;
import java.util.List;
/**
* @author sea
*/
class SentinelAnnotationQuarkusAdapterProcessor {
private static final String FEATURE_ANNOTATION = "sentinel-annotation";
@BuildStep
void feature(BuildProducer<FeatureBuildItem> featureProducer) {
featureProducer.produce(new FeatureBuildItem(FEATURE_ANNOTATION));
}
@BuildStep
List<AdditionalBeanBuildItem> additionalBeans() {
return Arrays.asList(
new AdditionalBeanBuildItem(SentinelResourceInterceptor.class)
);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
102416ff9c46765bbbe85076fe2bbef8e9f3e686 | fbb2a7700716f6c2c13d1ca384f3b5a5316750b5 | /src/cn/itcast/dao/UserDao.java | 4582f8594f75d306ae35b13614ed5686882c4c58 | [] | no_license | xiaokai01/ssh2 | 81c565f87ad05d7dbdb88605da9f38ab466da457 | b14589f6ede46389ca5ff6a662059aec7d87cbd8 | refs/heads/master | 2020-04-11T08:21:00.984126 | 2018-12-13T13:04:55 | 2018-12-13T13:04:55 | 161,639,994 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | package cn.itcast.dao;
import java.util.List;
import cn.itcast.domain.User;
public interface UserDao {
public void save(User user);
public void update(User user);
public void delete(User user);
public User findById(Integer id);
public List<User> findAll();
}
| [
"1657979052@qq.com"
] | 1657979052@qq.com |
9a6764603bb78c1cf1afbf97a5c1254272b65734 | b765ff986f0cd8ae206fde13105321838e246a0a | /Inspect/app/src/main/java/com/growingio_rewriter/a/a/d/gZ.java | 8d2449ff938272a1899da25903ec8ccb525d881d | [] | no_license | piece-the-world/inspect | fe3036409b20ba66343815c3c5c9f4b0b768c355 | a660dd65d7f40501d95429f8d2b126bd8f59b8db | refs/heads/master | 2020-11-29T15:28:39.406874 | 2016-10-09T06:24:32 | 2016-10-09T06:24:32 | 66,539,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,561 | java | /*
* Decompiled with CFR 0_115.
*/
package com.growingio.a.a.d;
import com.growingio.a.a.b.aU;
import com.growingio.a.a.d.aK;
import com.growingio.a.a.d.gY;
import java.util.ListIterator;
import java.util.NoSuchElementException;
class gZ
implements ListIterator<T> {
boolean a;
final /* synthetic */ ListIterator b;
final /* synthetic */ gY c;
gZ(gY gY2, ListIterator listIterator) {
this.c = gY2;
this.b = listIterator;
}
@Override
public void add(T t2) {
this.b.add(t2);
this.b.previous();
this.a = false;
}
@Override
public boolean hasNext() {
return this.b.hasPrevious();
}
@Override
public boolean hasPrevious() {
return this.b.hasNext();
}
@Override
public T next() {
if (!this.hasNext()) {
throw new NoSuchElementException();
}
this.a = true;
return (T)this.b.previous();
}
@Override
public int nextIndex() {
return gY.a(this.c, this.b.nextIndex());
}
@Override
public T previous() {
if (!this.hasPrevious()) {
throw new NoSuchElementException();
}
this.a = true;
return (T)this.b.next();
}
@Override
public int previousIndex() {
return this.nextIndex() - 1;
}
@Override
public void remove() {
aK.a(this.a);
this.b.remove();
this.a = false;
}
@Override
public void set(T t2) {
aU.b(this.a);
this.b.set(t2);
}
}
| [
"taochao@corp.netease.com"
] | taochao@corp.netease.com |
8cd15e8996a59a3138dd6504b6db3321d91f26bf | 9191e2d8052167dc5e6016f51040bd238b5da142 | /My_Application/app/src/main/java/SpeakerRecogTrain/Statistics.java | 70df71683686b749e6760ab70a2992e052e13992 | [] | no_license | FengRucup/fengrucup | f30f1b4536761c6b16ac6ae27e03202bd5ff4d4a | 681df57deb3a3dafd5d7817f81342ab532a3938a | refs/heads/master | 2021-05-08T21:51:54.281275 | 2018-02-23T13:57:10 | 2018-02-23T13:57:10 | 119,652,347 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,622 | java | package SpeakerRecogTrain;
public final class Statistics {
public static double getMean(double[] data)
{
double sum = 0.0;
for(double a : data)
sum += a;
return sum/data.length;
}
public static double[] getMean(double[][] data)
{
int numOfRows = data.length;
int numOfCols = data[0].length;
double sum[] = new double[numOfCols];
for(int j=0;j<numOfCols;j++){
for(int i=0;i<numOfRows;i++){
//System.out.println(Double.toString(data[i][j]));
sum[j] += data[i][j];
}
sum[j] /= numOfRows;
}
//System.out.println("sumaaa");
return sum;
}
public static double getVariance(double[] data)
{
double mean = getMean(data);
double temp = 0;
for(double a :data)
temp += (mean-a)*(mean-a);
return temp/data.length;
}
public static double[] getVariance(double[][] data)
{
int numOfRows = data.length;
int numOfCols = data[0].length;
double means[] = Statistics.getMean(data);
double[] temp = new double[numOfCols];
for(int j=0;j<numOfCols;j++){
for(int i=0;i<numOfRows;i++){
temp[j] += Math.pow((data[i][j]-means[j]), 2);
}
temp[j] /= numOfRows;
}
return temp;
}
public static double getStdDev(double[] data)
{
return Math.sqrt(getVariance(data));
}
public static double[] getStdDev(double[][] data)
{
//int numOfRows = data.length;
int numOfCols = data[0].length;
double[] temp = getVariance(data);
for(int i=0;i<numOfCols;i++){
temp[i] = Math.sqrt(temp[i]);
}
return temp;
}
}
| [
"3172248967@qq.com"
] | 3172248967@qq.com |
c215403d75d7387211668714563ac7fcf7260e20 | 60b79cbd359f1b27f02b223c8594e2c712c8222e | /ResultsWizard2/src/mathsquared/resultswizard2/DisplayPanel.java | 7625b335d9dcfd0c509b4a1556a0925e2ea57a38 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | MathSquared/ResultsWizard2 | dbbe7b7be4acfa1f9caeddfd0d3d6596abe36c9c | a63969f94b81b80b6889dfdf5f20f66f1c715ffb | refs/heads/master | 2021-01-16T01:02:03.426792 | 2014-09-25T18:44:22 | 2014-09-25T18:44:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,524 | java | /**
*
*/
package mathsquared.resultswizard2;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.Window;
import java.io.IOException;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
/**
* This JPanel will be the drawing surface for the slideshow.
*
* <p>
* Game loop logic is heavily based on the sample game loop in Chapter 2 of Killer Game Programming in Java by Andrew Davison, ISBN 978-0-596-00730-0.
* </p>
*
* <p>
* If the connection to the server is ever lost, the DisplayPanel will continue projecting whatever data it has already received until it is able to connect to another server. Servers should NEVER make assumptions about the client's state, communicating with it often to request this information (also a good way to check for a dropped connection).
* </p>
*
* <p>
* The intent is for this class to represent a versatile drawing surface. A {@link Selector} will handle choosing the slide to display, including protocol communication. The <code>Selector</code> will probably be handled by a JFrame that interfaces between a given communication method (network, user, etc.) and the <code>Selector</code>.
* </p>
*
* @author MathSquared
*
*/
public class DisplayPanel extends JPanel implements Runnable {
// Size
private final int WIDTH;
private final int HEIGHT;
private final Color BG_COLOR;
// This thread actually runs the game
private Thread animator;
// volatile acts to synchronize all access to these variables
private volatile boolean running = false;
// double buffer
private Graphics gBuf;
private Image imgBuf = null;
private final int FPS; // frames per second; initialized by constructor
private long period; // set based on FPS
// if we reach this many 0ms delay frames, yield to other processes
private static final int NO_DELAYS_PER_YIELD = 16;
// no frame skip logic needed
// handle the protocol
private Selector sel;
/**
* Creates a DisplayPanel with the given parameters and prepares it for use.
*
* @param width the width of the projection surface, in pixels
* @param height the height of the projection surface, in pixels
* @param fps the desired frames per second of the projection (normally, this will equal the monitor refresh rate in Hz)
* @param bgColor the desired background color of the projection
* @param sel the {@link Selector} that will supply this DisplayPanel with slides
*/
public DisplayPanel (int width, int height, int fps, Color bgColor, Selector sel) throws IOException {
WIDTH = width;
HEIGHT = height;
FPS = fps;
period = 1000000000L / fps;
BG_COLOR = bgColor;
this.sel = sel;
setBackground(bgColor);
setPreferredSize(new Dimension(width, height));
// no event listeners, except that we will pop Messages from the stream each time
}
// /**
// * (Re-)Initializes this Display to communicate over the given socket.
// *
// * @param sock the {@link Socket} over which to communicate
// * @throws IOException if <code>sock.getInputStream()</code> and/or <code>sock.getOutputStream()</code> would throw an <code>IOException</code>
// */
// private void initStreams (Socket sock) throws IOException {
// inRaw = sock.getInputStream();
// outRaw = sock.getOutputStream();
// }
/**
* Called when this component is added to another, this method simply starts the projection.
*/
public void addNotify () {
super.addNotify();
startProjection();
}
/**
* Starts the projection. This should be called by {@link #addNotify()}.
*/
private void startProjection () {
if (animator == null || !running) {
animator = new Thread(this);
animator.start();
}
}
/**
* Stops the projection.
*/
public void stopProjection () {
running = false;
}
public void run () {
long beforeTime;
long afterTime;
long timeDiff;
long sleepTime;
long overSleepTime = 0L; // time by which we overslept last cycle
int noDelays = 0;
long excess = 0L;
beforeTime = System.nanoTime(); // updated again right before next cycle
running = true;
while (running) {
stateUpdate();
renderElements();
paintScreen();
afterTime = System.nanoTime();
timeDiff = afterTime - beforeTime;
sleepTime = (period - timeDiff) - overSleepTime; // time to make up another period, minus oversleeping time last cycle
if (sleepTime > 0) { // time left in period, sleep the rest
try {
Thread.sleep(sleepTime / 1000000L); // ns > ms
} catch (InterruptedException e) {}
overSleepTime = (System.nanoTime() - afterTime) - sleepTime; // actual minus predicted sleep time
} else { // period took too long
excess -= sleepTime; // sleepTime is negative, so excess is positive time overrun by renderer
overSleepTime = 0L;
if (++noDelays >= NO_DELAYS_PER_YIELD) {
Thread.yield();
noDelays = 0;
}
}
beforeTime = System.nanoTime();
// We don't need any excess updates, since stateUpdate pulls everything from the queue, and that operation is idempotent over an infinitesimal time difference
}
// close the display
Window anc = SwingUtilities.getWindowAncestor(this);
if (anc != null) {
anc.setVisible(false);
}
}
/**
* Updates the unit's state in preparation for a render.
*/
private void stateUpdate () {
// TODO parse events from the OIS/OOS
}
/**
* Renders the projection elements into a buffer so that they can be painted.
*/
private void renderElements () {
// create buffer
if (imgBuf == null) {
imgBuf = createImage(WIDTH, HEIGHT);
if (imgBuf == null) {
System.out.println("imgBuf is null");
return;
} else {
gBuf = imgBuf.getGraphics();
}
}
// clear the screen
gBuf.setColor(BG_COLOR);
gBuf.fillRect(0, 0, WIDTH, HEIGHT);
// Draw the current slide
sel.getCurrent().draw(gBuf);
// TODO ticker
}
/**
* Actively render the current buffer to the screen.
*/
private void paintScreen () {
Graphics g;
try {
g = getGraphics();
if (g != null && imgBuf != null) {
g.drawImage(imgBuf, 0, 0, null);
}
Toolkit.getDefaultToolkit().sync(); // avoid tearing
g.dispose();
} catch (Exception e) {
System.out.println("Graphics context error:");
e.printStackTrace(System.out);
}
}
// /**
// * Indicates whether this client is connected to a server.
// *
// * @return true if this client is connected to an admin console; false if it is not connected (either never has been, or a previous connection drops)
// */
// public boolean getCommsActive () {
// return commsActive;
// }
}
| [
"MathSquared@users.noreply.github.com"
] | MathSquared@users.noreply.github.com |
edd32c71039c7f72b5bc728a823d2351e3f7acf1 | 352163a8f69f64bc87a9e14471c947e51bd6b27d | /bin/ext-template/ychinaacceleratorstorefront/web/src/de/hybris/platform/ychinaaccelerator/storefront/controllers/cms/SelectableProductsTabComponentController.java | c9f8b8aca228813799c041f595363e197f5448cc | [] | no_license | GTNDYanagisawa/merchandise | 2ad5209480d5dc7d946a442479cfd60649137109 | e9773338d63d4f053954d396835ac25ef71039d3 | refs/heads/master | 2021-01-22T20:45:31.217238 | 2015-05-20T06:23:45 | 2015-05-20T06:23:45 | 35,868,211 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,609 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2013 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.platform.ychinaaccelerator.storefront.controllers.cms;
import de.hybris.platform.chinaaccelerator.services.model.cms.components.SelectableProductsTabComponentModel;
import de.hybris.platform.commercefacades.product.ProductFacade;
import de.hybris.platform.commercefacades.product.ProductOption;
import de.hybris.platform.commercefacades.product.data.ProductData;
import de.hybris.platform.core.model.product.ProductModel;
import de.hybris.platform.ychinaaccelerator.storefront.controllers.ControllerConstants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Controller for CMS ProductReferencesComponent.
*/
@Controller("SelectableProductsTabComponentController")
@Scope("tenant")
@RequestMapping(value = ControllerConstants.Actions.Cms.SelectableProductsTabComponent)
public class SelectableProductsTabComponentController extends AbstractCMSComponentController<SelectableProductsTabComponentModel>
{
protected static final List<ProductOption> PRODUCT_OPTIONS = Arrays.asList(ProductOption.BASIC, ProductOption.PRICE);
@Resource(name = "accProductFacade")
private ProductFacade productFacade;
@Override
protected void fillModel(final HttpServletRequest request, final Model model,
final SelectableProductsTabComponentModel component)
{
final List<ProductData> products = new ArrayList<>();
products.addAll(collectLinkedProducts(component));
model.addAttribute("title", component.getTitle());
model.addAttribute("productData", products);
}
protected List<ProductData> collectLinkedProducts(final SelectableProductsTabComponentModel component)
{
final List<ProductData> products = new ArrayList<>();
for (final ProductModel productModel : component.getProducts())
{
products.add(productFacade.getProductForOptions(productModel, PRODUCT_OPTIONS));
}
return products;
}
}
| [
"yanagisawa@gotandadenshi.jp"
] | yanagisawa@gotandadenshi.jp |
418c18b1d35e0f8568705c804ca2d5e39e62661a | b7cb03d8b6f1d9a5aa7503329e97d0b1399d876e | /src/main/java/com/mortgagebank/util/MortageConstant.java | c70069e34e1e9fa2125b8b79d68e3984ccfe788d | [] | no_license | scrotify/mortgage | db2821ad2600f00aefabccb00c7ca0483135e93b | ea0193a2c176f116d0b9c88c5eea8d381af3ce79 | refs/heads/master | 2020-11-24T04:50:34.241185 | 2019-12-14T07:34:12 | 2019-12-14T07:34:12 | 227,972,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package com.mortgagebank.util;
/**
* The type Scrotify constant.
*/
public final class MortageConstant {
/**
* The constant SUCCESS_MESSAGE.
*/
public static final String SUCCESS_MESSAGE = "SUCCESS";
private MortageConstant() {
}
}
| [
"scrotifyteam@gmail.com"
] | scrotifyteam@gmail.com |
41f39bc8df6d0b07b52f99a44e2573887fef2787 | 76d84010a27850c8b3abbec76f863b4bf2f8e492 | /app/src/androidTest/java/com/glidedemo/vibhu/glide/ApplicationTest.java | c0ab7a8a151c2ab7467f06213c1bcd211a9fb04a | [] | no_license | vibhudadhichi/Glide | e508071f484ec1c89d86ef02b24e6e46603da441 | 5b373ba9e1ad52530e78ca2302a40b74f0663873 | refs/heads/master | 2020-02-26T13:37:51.534711 | 2016-07-25T16:48:50 | 2016-07-25T16:48:50 | 64,151,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.glidedemo.vibhu.glide;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"vibhudadhikhi@gmail.com"
] | vibhudadhikhi@gmail.com |
d246721e1f1940f5ea4abb4bf69cbd39c5926cec | 8b04eb64502f63653b2f435e268019d42fd171e1 | /core/src/main/java/com/orientsec/grpc/consumer/internal/ProvidersConfigUtils.java | 6f56950276fb85ff11997e779ffc65d57fd09fd2 | [
"Apache-2.0"
] | permissive | grpc-nebula/grpc-nebula-java | de553e5d9d77dc28bb0ec78076d7dc5bd8caa41b | 04f20585354e1994e70404535b048c9c188d5d95 | refs/heads/master | 2023-07-19T08:54:45.297237 | 2022-02-09T13:48:39 | 2022-02-09T13:48:39 | 188,228,592 | 140 | 63 | Apache-2.0 | 2023-07-05T20:43:37 | 2019-05-23T12:20:14 | Java | UTF-8 | Java | false | false | 7,855 | java | /*
* Copyright 2019 Orient Securities Co., Ltd.
* Copyright 2019 BoCloud Inc.
*
* 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.orientsec.grpc.consumer.internal;
import com.orientsec.grpc.common.constant.GlobalConstants;
import com.orientsec.grpc.common.model.BasicProvider;
import com.orientsec.grpc.consumer.model.ServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* 服务提供者配置信息工具类
*
* @author sxp
* @since 2018/8/11
*/
public class ProvidersConfigUtils {
private static Logger logger = LoggerFactory.getLogger(ProvidersConfigUtils.class);
/**
* 服务提供者的配置信息
* <p>
* 外层Map的key值为服务的接口名称 <br>
* 内层Map的key值为服务提供者的IP:port <br>
* </p>
*/
private static ConcurrentHashMap<String, ConcurrentHashMap<String, BasicProvider>> serviceProvidersConfig
= new ConcurrentHashMap<String, ConcurrentHashMap<String, BasicProvider>>();
/**
* 更新服务提供者的某个属性
*
* @author sxp
* @since 2018/8/11
*/
public static void updateProperty(String serviceName, String ip, int port,
String propertyKey, Object propertyValue) {
ConcurrentHashMap<String, BasicProvider> providersConfig;
if (serviceProvidersConfig.containsKey(serviceName)) {
providersConfig = serviceProvidersConfig.get(serviceName);
} else {
providersConfig = new ConcurrentHashMap<String, BasicProvider>();
ConcurrentHashMap<String, BasicProvider> oldValue;
oldValue = serviceProvidersConfig.putIfAbsent(serviceName, providersConfig);
if (oldValue != null) {
providersConfig = oldValue;
}
}
String key = ip + ":" + port;
BasicProvider provider;
if (providersConfig.containsKey(key)) {
provider = providersConfig.get(key);
} else {
provider = createNewProvider(serviceName, ip, port, propertyKey, propertyValue);
BasicProvider oldValue = providersConfig.putIfAbsent(key, provider);
if (oldValue != null) {
provider = oldValue;
}
}
ConcurrentHashMap<String, Object> properties = provider.getProperties();
properties.put(propertyKey, propertyValue);
}
/**
* 更新服务提供者的某个属性的初始值
*
* @author sxp
* @since 2019/1/30
*/
public static void updateInitProperty(String serviceName, String ip, int port,
String propertyKey, Object propertyValue) {
ConcurrentHashMap<String, BasicProvider> providersConfig;
if (serviceProvidersConfig.containsKey(serviceName)) {
providersConfig = serviceProvidersConfig.get(serviceName);
} else {
providersConfig = new ConcurrentHashMap<String, BasicProvider>();
ConcurrentHashMap<String, BasicProvider> oldValue;
oldValue = serviceProvidersConfig.putIfAbsent(serviceName, providersConfig);
if (oldValue != null) {
providersConfig = oldValue;
}
}
String key = ip + ":" + port;
BasicProvider provider;
if (providersConfig.containsKey(key)) {
provider = providersConfig.get(key);
} else {
provider = createNewProvider(serviceName, ip, port, propertyKey, propertyValue);
BasicProvider oldValue = providersConfig.putIfAbsent(key, provider);
if (oldValue != null) {
provider = oldValue;
}
}
ConcurrentHashMap<String, Object> initProperties = provider.getInitProperties();
initProperties.put(propertyKey, propertyValue);
}
/**
* 获取服务提供者的某个属性值
*
* @author sxp
* @since 2018/8/11
*/
public static Object getProperty(String serviceName, String ip, int port, String propertyKey) {
if (!serviceProvidersConfig.containsKey(serviceName)) {
return null;
}
ConcurrentHashMap<String, BasicProvider> providersConfig = serviceProvidersConfig.get(serviceName);
String key = ip + ":" + port;
if (!providersConfig.containsKey(key)) {
return null;
}
BasicProvider provider = providersConfig.get(key);
ConcurrentHashMap<String, Object> properties = provider.getProperties();
return properties.get(propertyKey);
}
/**
* 获取服务提供者的某个属性的初始化值
*
* @author sxp
* @since 2018/8/11
*/
public static Object getInitProperty(String serviceName, String ip, int port, String propertyKey) {
if (!serviceProvidersConfig.containsKey(serviceName)) {
return null;
}
ConcurrentHashMap<String, BasicProvider> providersConfig = serviceProvidersConfig.get(serviceName);
String key = ip + ":" + port;
if (!providersConfig.containsKey(key)) {
return null;
}
BasicProvider provider = providersConfig.get(key);
ConcurrentHashMap<String, Object> initProperties = provider.getInitProperties();
return initProperties.get(propertyKey);
}
private static BasicProvider createNewProvider(String serviceName, String ip, int port,
String propertyKey, Object propertyValue) {
BasicProvider provider = new BasicProvider(serviceName, ip, port);
ConcurrentHashMap<String, Object> properties = provider.getProperties();
properties.put(propertyKey, propertyValue);
return provider;
}
/**
* 更新ServiceProvider对象中部分属性值
*
* @author sxp
* @since 2018/8/11
*/
public static void resetServiceProviderProperties(ServiceProvider serviceProvider) {
String serviceName = serviceProvider.getInterfaceName();
String ip = serviceProvider.getHost();
int port = serviceProvider.getPort();
// 目前客户端监听的服务端属性有:weight,deprecated,master,group
Object value;
value = getProperty(serviceName, ip, port, GlobalConstants.Provider.Key.WEIGHT);
if (value != null) {
int weight = ((Integer) value).intValue();
serviceProvider.setWeight(weight);
}
value = getProperty(serviceName, ip, port, GlobalConstants.Provider.Key.DEPRECATED);
if (value != null) {
boolean deprecated = ((Boolean) value).booleanValue();
serviceProvider.setDeprecated(deprecated);
}
value = getProperty(serviceName, ip, port, GlobalConstants.Provider.Key.MASTER);
if (value != null) {
boolean master = ((Boolean) value).booleanValue();
serviceProvider.setMaster(master);
}
value = getProperty(serviceName, ip, port, GlobalConstants.Provider.Key.GROUP);
if (value != null) {
String group = (String) value;
serviceProvider.setGroup(group);
}
}
/**
* 删除服务提供者
* <p>
* 客户端监控某个服务端下线后,调用该方法
* </p>
*
* @param removeHostPorts 集合内元素的值为host:port,例如192.168.20.110:50051
* @author sxp
* @since 2019/11/20
*/
public static void removeProperty(String serviceName, Set<String> removeHostPorts) {
if (!serviceProvidersConfig.containsKey(serviceName)) {
return;
}
ConcurrentHashMap<String, BasicProvider> providersConfig = serviceProvidersConfig.get(serviceName);
for (String hostPort : removeHostPorts) {
providersConfig.remove(hostPort);
}
}
}
| [
"cozyshu@qq.com"
] | cozyshu@qq.com |
ef25b604aa4f97c6bb684eda72ead592a95b2664 | 97e0399aeb7b2fefa023ec81b636d95230ccb0b2 | /src/ua/khpi/soklakov/SummaryTask3/entity/OldCards.java | b5b02feb30a71aec1ce7b12e86ff7299966493c7 | [] | no_license | sokolinthesky/course_practice | 77ebef9412e051a2657a83f2e482f9948a897170 | f6006220bda2d0550022686f37cdedf80e7a783f | refs/heads/master | 2021-06-10T14:41:10.404393 | 2017-02-22T14:11:10 | 2017-02-22T14:11:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package ua.khpi.soklakov.SummaryTask3.entity;
import java.util.ArrayList;
import java.util.List;
/**
* Old Cards bean.
*
* @author O.Soklakov
*
*/
public class OldCards {
private List<Card> cards;
public List<Card> getCards() {
if (cards == null) {
cards = new ArrayList<>();
}
return cards;
}
@Override
public String toString() {
return "OldCards [cards=" + cards + "]";
}
}
| [
"soklakov.o.yu@gmail.com"
] | soklakov.o.yu@gmail.com |
9d75b44b24e9e04f2d7d2beae286882a1af041bc | 719a7f8abc1664cf6b0f11b9b1b11ce5f26d1898 | /app/src/main/java/technology/infobite/com/yloproject/fragment/CardFragment.java | 9079298f0b5d40f690e11e408625acae4647844b | [] | no_license | freelanceapp/YLOtruck | e9e13aebc9458920d187fd006c3d5d6f563e33eb | e443beac245e5352be349de9af244b5227016831 | refs/heads/master | 2020-06-18T07:08:02.261613 | 2019-01-31T05:42:11 | 2019-01-31T05:42:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,588 | java | package technology.infobite.com.yloproject.fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import technology.infobite.com.yloproject.R;
public class CardFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public CardFragment() {
// Required empty public constructor
}
public static CardFragment newInstance(String param1, String param2) {
CardFragment fragment = new CardFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_card, container, false);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
| [
"pushpendra.infobite@gmail.com"
] | pushpendra.infobite@gmail.com |
e06553fcdf5eaaf0d600d60daa10f25015840791 | 45f6a007ed4d543c3bf1d9199126d24657ee0c64 | /juegoFinal/android/src/bd/BaseDeDatosAnd.java | 20f9b0ebe7920def5be2c8b0d7d7a3a60f3c6f8c | [] | no_license | amrMoreno/JuegoFinal | aac5d3a8cb8a3f827e58f4971cfbbafc5303a13e | ee640ca5964d2e3aa2a618f0ddefc9612d4ad438 | refs/heads/master | 2021-01-02T04:59:32.525496 | 2020-03-10T21:51:14 | 2020-03-10T21:51:14 | 239,498,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,790 | java | package bd;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public class BaseDeDatosAnd implements BaseDeDatos {
private BaseDeDatosOpenHelper openHelper;
public BaseDeDatosAnd(Context c) {
openHelper = new BaseDeDatosOpenHelper(c, 1);
}
@Override
public int cargar() {
SQLiteDatabase db = openHelper.getWritableDatabase();
Cursor c = db.query("movimientos",
null, null, null,
null, null, null);
if (c.moveToFirst()) {//False si no hay ninguna fila, true si hay una
//Caso en que ya haya una fila
return c.getInt(c.getColumnIndex("pasos"));
} else {
//Si no hay puntuaciones guardadas, empiezo desde 0 puntos
return 0;
}
}
@Override
public void guardar(int nuevaPuntuacion) {
SQLiteDatabase db = openHelper.getWritableDatabase();
Cursor c = db.query("movimientos",
null, null, null,
null, null, null);
ContentValues cv = new ContentValues();
cv.put("pasos", nuevaPuntuacion);
if (c.moveToFirst()) { //False si no hay ninguna fila, true si hay una
//Caso en que ya haya una fila
//Siempre voy a tener solo una fila, por tanto, cuando actualizo
//puedo dejar whereClause y whereArgs a null. Me va a actualizar
//todas las filas, es decir, la única que existe.
db.update("movimientos", cv, null,
null);
} else {
//Caso en que la tabla esté vacía
db.insert("movimientos", null, cv);
}
c.close();
db.close();
}}
| [
"adrianmorenoruiz@gmail.com"
] | adrianmorenoruiz@gmail.com |
ff688b8154c8dc61efc2e54a76f761ab2f4772f1 | 620e110d532499eb605ffbf89a628b11fd35b4a7 | /Aulas PL/Guiao 07/Identificador.java | f031eca3d00f0ae469fcd04bab45d2ed6ae79615 | [] | no_license | czgcampos/DSS | 116095a9edc75dd5b32692ed2b8c7fee97e977e9 | 7de5f7944dc397901a0ac46a44e617a07008177d | refs/heads/master | 2020-04-11T00:49:24.268927 | 2018-12-11T21:48:44 | 2018-12-11T21:48:44 | 161,397,541 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | public class Identificador {
private long _iD;
public Viatura _identificador;
public Registo _registos;
public long getID() {
return this._iD;
}
public void setID(long aID) {
this._iD = aID;
}
} | [
"carloszgcampos1996@gmail.com"
] | carloszgcampos1996@gmail.com |
8dec47a1e819f0a46a060aafdbc59863fb48b164 | 101cdd1a8dedc8d468da02d2eaec9c34b8fa2e0f | /app/src/main/java/homework/myapplication/ProgressFragment.java | d1ab44e6bd7413701994bbf295061ae78babd227 | [] | no_license | DemonForYou/MyApplication | 3d799db54ad0c668170690a9ce1d82d68f176fc7 | 30d7730bfd936a641c33a56434454411d7d53eb3 | refs/heads/master | 2021-04-29T21:26:32.700889 | 2018-02-15T10:53:13 | 2018-02-15T10:53:13 | 121,614,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,456 | java | package homework.myapplication;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.os.AsyncTask;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.Toast;
import android.widget.EditText;
import android.widget.TextView;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
public class ProgressFragment extends Fragment {
TextView contentView;
String contentText = null;
WebView webView;
EditText editText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_progress, container, false);
contentView = (TextView) view.findViewById(R.id.content);
webView = (WebView) view.findViewById(R.id.webView);
editText = (EditText) view.findViewById(R.id.editText);
if(contentText!=null){
contentView.setText(contentText);
webView.loadData(contentText, "text/html; charset=utf-8", "utf-8");
}
Button btnFetch = (Button)view.findViewById(R.id.downloadBtn);
btnFetch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
contentView.setText("Загрузка...");
new ProgressTask().execute(editText.getText().toString());
}
});
return view;
}
private class ProgressTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... path) {
String content;
try{
content = getContent(path[0]);
}
catch (IOException ex){
content = ex.getMessage();
}
return content;
}
@Override
protected void onPostExecute(String content) {
contentText=content;
contentView.setText(content);
webView.loadData(content, "text/html; charset=utf-8", "utf-8");
Toast.makeText(getActivity(), "Данные загружены", Toast.LENGTH_SHORT)
.show();
}
private String getContent(String path) throws IOException {
BufferedReader reader=null;
try {
URL url=new URL(path);
HttpsURLConnection c=(HttpsURLConnection)url.openConnection();
c.setRequestMethod("GET");
c.setReadTimeout(10000);
c.connect();
reader= new BufferedReader(new InputStreamReader(c.getInputStream()));
StringBuilder buf=new StringBuilder();
String line=null;
while ((line=reader.readLine()) != null) {
buf.append(line + "\n");
}
return(buf.toString());
}
finally {
if (reader != null) {
reader.close();
}
}
}
}
}
| [
"36501859+DemonForYou@users.noreply.github.com"
] | 36501859+DemonForYou@users.noreply.github.com |
628c7c09a80bd417f3945cd75d62fd568c65e1db | 671d9a07263198cc6841424c7a307bdb3ff4aa7b | /a.java | ee4bc5694ed311bb60ca05d0e3c1dc000c49cd14 | [] | no_license | ramkotireddys/com.bread.demo | 8b0ba183bac51727ffa9fd61897c414bfbc62d96 | cb459df0babd4fbbb724c8ea2e401282df95f91b | refs/heads/master | 2021-01-10T05:39:24.500521 | 2015-11-27T13:08:09 | 2015-11-27T13:08:09 | 46,972,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19 | java | this is java code
| [
"ramkotiscm@gmail.com"
] | ramkotiscm@gmail.com |
0d1e4a15ab3bc9127aabccbf14ed1a83a9f96750 | 3c4ff31445bf57e4c23e4b74603fa81e395f3c49 | /source/com.rockwellcollins.atc.limp/src-gen/com/rockwellcollins/atc/limp/impl/ExprImpl.java | fe7827dc22ea45c9af618cf4dee4b2950f7a23e9 | [] | no_license | lgwagner/SIMPAL | 083b1245d485f7bba3a9bffe0171c2516af3720b | fce10b4fa780362033014585f85949c32f066ac5 | refs/heads/master | 2021-01-23T03:12:09.254682 | 2016-01-19T20:29:16 | 2016-01-19T20:29:16 | 35,894,301 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | /**
*/
package com.rockwellcollins.atc.limp.impl;
import com.rockwellcollins.atc.limp.Expr;
import com.rockwellcollins.atc.limp.LimpPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Expr</b></em>'.
* <!-- end-user-doc -->
*
* @generated
*/
public class ExprImpl extends MinimalEObjectImpl.Container implements Expr
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ExprImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return LimpPackage.Literals.EXPR;
}
} //ExprImpl
| [
"lgwagner@gmail.com"
] | lgwagner@gmail.com |
e343b2d78545e8548cd1ca034bc61268b5df4764 | a5dd39d502194a632bc66d924046efb1439af11a | /src/main/java/com/haw/avdt/view/GraphFileChooser.java | 540d98be627c5f18baa98942479e14ba31f95b9d | [
"MIT"
] | permissive | GittiMcHub/java-graph-algorithms | e9f4c8e4d811723e99cedec7b192a5fb33354732 | 610b31f22215fd99bfb467c5b2bbaa97f8e3a4b2 | refs/heads/master | 2020-07-21T03:42:59.859423 | 2020-02-01T17:45:01 | 2020-02-01T17:45:01 | 206,751,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,668 | java | package com.haw.avdt.view;
import com.haw.avdt.util.GraphFactory;
import com.haw.avdt.util.gka.GKAFileReader;
import com.haw.avdt.util.gka.GKAGraphDescripton;
import com.haw.avdt.view.util.MessageConsole;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.nio.file.Paths;
public class GraphFileChooser extends JFrame {
public GraphFileChooser(){
this.setTitle("*.gka FileChooser");
this.setSize(new Dimension(600, 300));
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent winEvt) {
System.exit(0);
}
});
JPanel main = new JPanel();
BorderLayout borderLayout = new BorderLayout();
main.setLayout(borderLayout);
JTextPane logArea = new JTextPane();
JScrollPane scrollPane = new JScrollPane(logArea);
MessageConsole mc = new MessageConsole(logArea);
mc.redirectOut();
mc.redirectErr(Color.RED, null);
mc.setMessageLines(100);
JFileChooser fc = new JFileChooser();
fc.setDialogTitle(".gka Dateien");
FileFilter filter = new FileNameExtensionFilter("*.gka Datei", "gka");
fc.setFileFilter(filter);
fc.setCurrentDirectory(Paths.get(System.getProperty("user.dir")).toFile());
JButton btnOpen = new JButton("*.gka Datei laden");
btnOpen.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int returnVal = fc.showOpenDialog(GraphFileChooser.this);
if(returnVal == JFileChooser.APPROVE_OPTION){
try {
GKAGraphDescripton gd = GKAFileReader.read(Paths.get(fc.getSelectedFile().toURI()).toString());
new GraphViz(gd);
} catch (Exception ex) {
}
}
}
});
main.add(scrollPane, BorderLayout.CENTER);
main.add(btnOpen, BorderLayout.PAGE_END);
this.setJMenuBar(this.createMenuBar());
this.getContentPane().add(main);
this.setVisible(true);
}
private JMenuBar createMenuBar(){
JMenuBar menuBar = new JMenuBar();
JMenu factoryMenu = new JMenu("Factory");
JMenuItem itemBIG = new JMenuItem("BIG Graph");
itemBIG.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new GraphViz(GraphFactory.createBIGJUNGGraph());
}
});
JMenuItem itemBigNet = new JMenuItem("BigNet Graph");
itemBigNet.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new GraphViz(GraphFactory.createBigNetJUNGGraph());
}
});
GraphFileChooser parent = this;
JMenuItem itemRandomDirectedJungGraph = new JMenuItem("Create random directed ");
itemRandomDirectedJungGraph.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String vertexes = JOptionPane.showInputDialog(parent,
"How many Vertecies?", null);
String edges = JOptionPane.showInputDialog(parent,
"How many Edges?", null);
new GraphViz(GraphFactory.createRandomDirectedJUNGGraph(Integer.valueOf(vertexes), Integer.valueOf(edges)));
}
});
JMenuItem itemRandomNetwork = new JMenuItem("Create random Network ");
itemRandomNetwork.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String vertexes = JOptionPane.showInputDialog(parent,
"How many Vertecies?", null);
String edges = JOptionPane.showInputDialog(parent,
"How many Edges?", null);
new GraphViz(GraphFactory.createRandomNetwork(Integer.valueOf(vertexes), Integer.valueOf(edges)));
}
});
menuBar.add(factoryMenu);
factoryMenu.add(itemBIG);
factoryMenu.add(itemBigNet);
factoryMenu.addSeparator();
factoryMenu.add(itemRandomDirectedJungGraph);
factoryMenu.add(itemRandomNetwork);
return menuBar;
}
}
| [
"github-dt@tobaben.it"
] | github-dt@tobaben.it |
d2d8b2bd72d3529edaf6cd77d0202e22f5b57c90 | f1009a121df5c5c571c2bbecc4be3c6718417b86 | /src/les_12_exceptions/TestThrow.java | 6a0d114cb8d887d5c6987ae3af2521b51cfba2c0 | [] | no_license | ntapacTest/MAUP_Java | 020e18ec397076332c55cc58fa70ab25e4e907d0 | b537f1b6f125d8dab5a115e78b0af176132912ee | refs/heads/master | 2020-05-25T07:23:47.758529 | 2019-08-07T16:58:42 | 2019-08-07T16:58:42 | 187,683,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 497 | java | package les_12_exceptions;
public class TestThrow {
public static void main(String[] args){
System.out.println(divide(10,0));
}
public static double divide(double a, double b)
throws ArithmeticException // Обязательно для проверяемых исключений
// Для не проверяемых по желанию
{
if(b==0) throw new ArithmeticException();
return a/b;
}
}
| [
"vshu@muap.ua"
] | vshu@muap.ua |
c808d9638a433164795bd2f7d053f0731518cb1a | 98415fdfd2e96b9b2dd6be376c1bd0e8584e7cb6 | /app/src/main/java/com/universalstudios/orlandoresort/frommergeneedsrefactor/upr_android_406/IBMData/Tridion/ice_tridion/TridionConfigWrapper.java | ee16c5de14e4dc453168a60fe50897eb13de0a34 | [] | no_license | SumanthAndroid/UO | 202371c7ebdcb5c635bae88606b4a4e0d004862c | f201c043eae70eecac9972f2e439be6a03a61df6 | refs/heads/master | 2021-01-19T13:41:20.592334 | 2017-02-28T08:04:42 | 2017-02-28T08:04:42 | 82,409,297 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package com.universalstudios.orlandoresort.frommergeneedsrefactor.upr_android_406.IBMData.Tridion.ice_tridion;
/**
* Created by Tyler Ritchie on 10/10/16.
*/
public class TridionConfigWrapper {
private TridionConfig mTridionConfig;
public TridionConfig getTridionConfig() {
return mTridionConfig;
}
public void setTridionConfig(TridionConfig tridionConfig) {
mTridionConfig = tridionConfig;
}
}
| [
"kartheek222@gmail.com"
] | kartheek222@gmail.com |
7f8d4900874d61fd1511dd1be5d2d59b8fe61d1a | 3040973ee5c3285b83919c54a4fa5e57853603bb | /src/com/appordinance/ImagePuzzle/GamePlay.java | 441cf7647f859240acb45d0a8bf44fd173193f08 | [] | no_license | farmcp/android-puzzle | b64b664514cc0cb6d8e68b8e69127fd36f2db747 | 4917f2d12c00361fb1e97f2d783b703ca526bf2c | refs/heads/master | 2020-05-16T15:31:15.943671 | 2013-08-27T17:52:47 | 2013-08-27T17:52:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,928 | java | /* author: Christopher Farm */
package com.appordinance.ImagePuzzle;
import com.appordinance.ImagePuzzle.R;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.view.Display;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TableRow.LayoutParams;
import android.widget.*;
public class GamePlay extends Activity implements OnClickListener {
ImageView[][] image_array;
// create shared preferences string
final String GAME_SETTINGS = "mySettings";
//set integers for each of the levels
final int EASY = 3;
final int MEDIUM = 4;
final int HARD = 5;
int level;
//keep track of the moves
int moves = 0;
//create a table layout
TableLayout tl;
//create parameters for the table and the images
LayoutParams layout = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.MATCH_PARENT);
LayoutParams layout_image = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//get resources for the shared preferences
SharedPreferences settings = getSharedPreferences(GAME_SETTINGS, 0);
SharedPreferences.Editor editor = settings.edit();
// set default level if there is nothing in the shared preferences
if (settings.contains("lvl") == false) {
level = EASY;
}
// if there are settings for the level stored then get the settings for
// the level that are stored -> default also set to EASY
if (settings.contains("lvl") == true) {
level = settings.getInt("lvl", EASY);
}
// get screen width and height
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
final double SCREEN_WIDTH = size.x;
final double SCREEN_HEIGHT = size.y;
// create a new TableLayout so I can put images into the table
tl = new TableLayout(this);
// place the table in the center of the Activity
tl.setGravity(Gravity.CENTER);
// set the layout parameters for the Table
tl.setLayoutParams(layout);
// counter will keep track of the tile number
int tile_counter = 0;
// use easy for now to keep track of the number of tiles in the table
// Create Tile array for the solution and for the puzzle
image_array = new ImageView[level][level];
// get the clicked drawable in the list and set it as the bitmap
Bundle extra = getIntent().getExtras();
try {
// Create a scaled bitmap
Bitmap bmap = BitmapFactory.decodeResource(getResources(),
extra.getInt("pictureRef"));
//save the reference to the image used and commit the changes
editor.putInt("imageUsed", extra.getInt("pictureRef"));
editor.commit();
//define the dimensions and keep track of the aspect ratio
double bmap_width = bmap.getWidth();
double bmap_height = bmap.getHeight();
double bmap_aspectRatio = bmap_width / bmap_height;
// while the image is larger than the screen, shrink the size
if (SCREEN_WIDTH < bmap_width) {
// then use the screen_width as the limiting factor
bmap_width = SCREEN_WIDTH;
bmap_height = bmap_width / bmap_aspectRatio;
}
else if (SCREEN_HEIGHT < bmap_height) {
// then use the screen_height as the limiting factor
bmap_height = SCREEN_HEIGHT;
bmap_width = bmap_height * bmap_aspectRatio;
}
/*
* CREATE THE INCREMENTS FOR WIDTH AND HEIGHT - NEED TO USE THIS TO
* CREATE SEVERAL BITMAPS
*/
int width_increment = 0;
int height_increment = 0;
if (level == EASY) {
width_increment = (int) bmap_width / EASY;
height_increment = (int) bmap_height / EASY;
}
if (level == MEDIUM) {
width_increment = (int) bmap_width / MEDIUM;
height_increment = (int) bmap_height / MEDIUM;
}
if (level == HARD) {
width_increment = (int) bmap_width / HARD;
height_increment = (int) bmap_height / HARD;
}
// scaled full size bitmap
Bitmap bmapScaled = Bitmap.createScaledBitmap(bmap,
(int) bmap_width, (int) bmap_height, true);
// create place holders for each of the increments
int startX, startY, width, height;
//dividers for each of the tiles
int padding = 1;
// create table of tiles to display the solution
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
tile_counter++;
// create a new image
ImageView new_image = new ImageView(this);
new_image.setLayoutParams(layout_image); // set the layout
//keep track of the x and y positions
startX = j * width_increment;
startY = i * height_increment;
width = width_increment;
height = height_increment;
// create bmap for each of the tiles
Bitmap temp_bmp = Bitmap.createBitmap(bmapScaled, startX,
startY, width, height);
new_image.setPadding(padding, padding, padding, padding);
new_image.setImageBitmap(temp_bmp);
// create a new Tile in the array
image_array[i][j] = new ImageView(this);
// store the tiles in an array
image_array[i][j] = new_image;
image_array[i][j].setId(tile_counter);
}
}
// create last image and set the ID to the last cell
ImageView lastImg = new ImageView(this);
lastImg.setImageBitmap(Bitmap.createBitmap(width_increment,
height_increment, Bitmap.Config.ARGB_8888));
image_array[level - 1][level - 1] = lastImg;
//set the id for the last to make sure it's in the right place
image_array[level - 1][level - 1].setId(level * level);
// if the game has been played before then keep track of the moves from where it last was -> default set to 0
if(settings.getBoolean("hasPlayed", false)==true){
moves = settings.getInt("numMoves", 0);
}
//if it's an EASY level and has been played then place tiles on the board based on shared preferences
if (level == EASY && settings.getBoolean("hasPlayed", false) == true) {
ImageView[][] imageArray = new ImageView[level][level];
// find the ID in the image_array and put in the respective
// position
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
if (image_array[i][j].getId() == settings.getInt(
"pos1e", 0)) {
imageArray[0][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos2e", 0)) {
imageArray[0][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos3e", 0)) {
imageArray[0][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos4e", 0)) {
imageArray[1][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos5e", 0)) {
imageArray[1][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos6e", 0)) {
imageArray[1][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos7e", 0)) {
imageArray[2][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos8e", 0)) {
imageArray[2][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos9e", 0)) {
imageArray[2][2] = image_array[i][j];
}
}
}
//set the global image array and the click listeners
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
image_array[i][j] = imageArray[i][j];
image_array[i][j].setOnClickListener(this);
}
}
// set up the table with rows and insert the images
for (int i = 0; i < level; i++) {
TableRow new_tr = new TableRow(this);
new_tr.setLayoutParams(layout_image);
for (int j = 0; j < level; j++) {
new_tr.addView(image_array[i][j]);
}
tl.addView(new_tr);
}
// set the content to the view
setContentView(tl);
}
//now do the same thing if the level is at medium
if (level == MEDIUM && settings.getBoolean("hasPlayed", false) == true) {
ImageView[][] imageArray = new ImageView[level][level];
// find the ID in the image_array and put in the respective
// position
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
if (image_array[i][j].getId() == settings.getInt(
"pos1m", 0)) {
imageArray[0][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos2m", 0)) {
imageArray[0][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos3m", 0)) {
imageArray[0][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos4m", 0)) {
imageArray[0][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos5m", 0)) {
imageArray[1][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos6m", 0)) {
imageArray[1][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos7m", 0)) {
imageArray[1][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos8m", 0)) {
imageArray[1][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos9m", 0)) {
imageArray[2][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos10m", 0)) {
imageArray[2][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos11m", 0)) {
imageArray[2][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos12m", 0)) {
imageArray[2][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos13m", 0)) {
imageArray[3][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos14m", 0)) {
imageArray[3][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos15m", 0)) {
imageArray[3][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos16m", 0)) {
imageArray[3][3] = image_array[i][j];
}
}
}
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
image_array[i][j] = imageArray[i][j];
image_array[i][j].setOnClickListener(this);
}
}
// set up the table with rows and insert the images
for (int i = 0; i < level; i++) {
TableRow new_tr = new TableRow(this);
new_tr.setLayoutParams(layout_image);
for (int j = 0; j < level; j++) {
new_tr.addView(image_array[i][j]);
}
tl.addView(new_tr);
}
// set the content to the view
setContentView(tl);
}
//do the same thing if the level is at hard
if (level == HARD && settings.getBoolean("hasPlayed", false) == true) {
ImageView[][] imageArray = new ImageView[level][level];
// find the ID in the image_array and put in the respective
// position
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
if (image_array[i][j].getId() == settings.getInt(
"pos1h", 0)) {
imageArray[0][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos2h", 0)) {
imageArray[0][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos3h", 0)) {
imageArray[0][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos4h", 0)) {
imageArray[0][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos5h", 0)) {
imageArray[0][4] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos6h", 0)) {
imageArray[1][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos7h", 0)) {
imageArray[1][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos8h", 0)) {
imageArray[1][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos9h", 0)) {
imageArray[1][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos10h", 0)) {
imageArray[1][4] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos11h", 0)) {
imageArray[2][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos12h", 0)) {
imageArray[2][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos13h", 0)) {
imageArray[2][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos14h", 0)) {
imageArray[2][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos15h", 0)) {
imageArray[2][4] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos16h", 0)) {
imageArray[3][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos17h", 0)) {
imageArray[3][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos18h", 0)) {
imageArray[3][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos19h", 0)) {
imageArray[3][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos20h", 0)) {
imageArray[3][4] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos21h", 0)) {
imageArray[4][0] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos22h", 0)) {
imageArray[4][1] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos23h", 0)) {
imageArray[4][2] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos24h", 0)) {
imageArray[4][3] = image_array[i][j];
}
if (image_array[i][j].getId() == settings.getInt(
"pos25h", 0)) {
imageArray[4][4] = image_array[i][j];
}
}
}
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
image_array[i][j] = imageArray[i][j];
image_array[i][j].setOnClickListener(this);
}
}
// set up the table with rows and insert the images
for (int i = 0; i < level; i++) {
TableRow new_tr = new TableRow(this);
new_tr.setLayoutParams(layout_image);
for (int j = 0; j < level; j++) {
new_tr.addView(image_array[i][j]);
}
tl.addView(new_tr);
}
// set the content to the view
setContentView(tl);
}
//if the game hasn't been played before then just draw the board in it's original form
else{
// set up the table with rows and insert the images
for (int i = 0; i < level; i++) {
TableRow new_tr = new TableRow(this);
new_tr.setLayoutParams(layout_image);
for (int j = 0; j < level; j++) {
new_tr.addView(image_array[i][j]);
}
tl.addView(new_tr);
}
// set the content to the view
setContentView(tl);
// rearrange Tiles after 3 seconds
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
image_array = rearrangeImages(image_array, level);
}
}, 3000);
Toast.makeText(this, "Play!", Toast.LENGTH_SHORT).show();
editor.putBoolean("hasPlayed", true);
editor.commit();
}
} catch (Exception e) {
//Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
@Override
protected void onPause() {
super.onPause();
//get resources to save information
SharedPreferences settings = getSharedPreferences(GAME_SETTINGS, 0);
SharedPreferences.Editor editor = settings.edit();
//save the number of moves
editor.putInt("numMoves", moves).commit();
//keep a position id array
int[][] posID_array = new int[level][level];
//initially keep track of the ids in each of the x and y positions
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
posID_array[i][j] = image_array[i][j].getId();
}
}
if (level == EASY) {
// SAVE THE STATE OF THE BOARD AT THE EASY LEVEL
int pos1e = posID_array[0][0];
int pos2e = posID_array[0][1];
int pos3e = posID_array[0][2];
int pos4e = posID_array[1][0];
int pos5e = posID_array[1][1];
int pos6e = posID_array[1][2];
int pos7e = posID_array[2][0];
int pos8e = posID_array[2][1];
int pos9e = posID_array[2][2];
editor.putInt("pos1e", pos1e);
editor.putInt("pos2e", pos2e);
editor.putInt("pos3e", pos3e);
editor.putInt("pos4e", pos4e);
editor.putInt("pos5e", pos5e);
editor.putInt("pos6e", pos6e);
editor.putInt("pos7e", pos7e);
editor.putInt("pos8e", pos8e);
editor.putInt("pos9e", pos9e);
editor.commit();
}
if (level == MEDIUM){
int pos1m = posID_array[0][0];
int pos2m = posID_array[0][1];
int pos3m = posID_array[0][2];
int pos4m = posID_array[0][3];
int pos5m = posID_array[1][0];
int pos6m = posID_array[1][1];
int pos7m = posID_array[1][2];
int pos8m = posID_array[1][3];
int pos9m = posID_array[2][0];
int pos10m = posID_array[2][1];
int pos11m = posID_array[2][2];
int pos12m = posID_array[2][3];
int pos13m = posID_array[3][0];
int pos14m = posID_array[3][1];
int pos15m = posID_array[3][2];
int pos16m = posID_array[3][3];
editor.putInt("pos1m", pos1m);
editor.putInt("pos2m", pos2m);
editor.putInt("pos3m", pos3m);
editor.putInt("pos4m", pos4m);
editor.putInt("pos5m", pos5m);
editor.putInt("pos6m", pos6m);
editor.putInt("pos7m", pos7m);
editor.putInt("pos8m", pos8m);
editor.putInt("pos9m", pos9m);
editor.putInt("pos10m", pos10m);
editor.putInt("pos11m", pos11m);
editor.putInt("pos12m", pos12m);
editor.putInt("pos13m", pos13m);
editor.putInt("pos14m", pos14m);
editor.putInt("pos15m", pos15m);
editor.putInt("pos16m", pos16m);
editor.commit();
}
if (level == HARD){
int pos1h = posID_array[0][0];
int pos2h = posID_array[0][1];
int pos3h = posID_array[0][2];
int pos4h = posID_array[0][3];
int pos5h = posID_array[0][4];
int pos6h = posID_array[1][0];
int pos7h = posID_array[1][1];
int pos8h = posID_array[1][2];
int pos9h = posID_array[1][3];
int pos10h = posID_array[1][4];
int pos11h = posID_array[2][0];
int pos12h = posID_array[2][1];
int pos13h = posID_array[2][2];
int pos14h = posID_array[2][3];
int pos15h = posID_array[2][4];
int pos16h = posID_array[3][0];
int pos17h = posID_array[3][1];
int pos18h = posID_array[3][2];
int pos19h = posID_array[3][3];
int pos20h = posID_array[3][4];
int pos21h = posID_array[4][0];
int pos22h = posID_array[4][1];
int pos23h = posID_array[4][2];
int pos24h = posID_array[4][3];
int pos25h = posID_array[4][4];
editor.putInt("pos1h", pos1h);
editor.putInt("pos2h", pos2h);
editor.putInt("pos3h", pos3h);
editor.putInt("pos4h", pos4h);
editor.putInt("pos5h", pos5h);
editor.putInt("pos6h", pos6h);
editor.putInt("pos7h", pos7h);
editor.putInt("pos8h", pos8h);
editor.putInt("pos9h", pos9h);
editor.putInt("pos10h", pos10h);
editor.putInt("pos11h", pos11h);
editor.putInt("pos12h", pos12h);
editor.putInt("pos13h", pos13h);
editor.putInt("pos14h", pos14h);
editor.putInt("pos15h", pos15h);
editor.putInt("pos16h", pos16h);
editor.putInt("pos17h", pos17h);
editor.putInt("pos18h", pos18h);
editor.putInt("pos19h", pos19h);
editor.putInt("pos20h", pos20h);
editor.putInt("pos21h", pos21h);
editor.putInt("pos22h", pos22h);
editor.putInt("pos23h", pos23h);
editor.putInt("pos24h", pos24h);
editor.putInt("pos25h", pos25h);
editor.commit();
}
}
public ImageView[][] rearrangeImages(ImageView[][] imageArray, int lvl) {
// on the rearrangement set the on click listeners so that it isn't
// click-able while showing the solution
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
imageArray[i][j].setOnClickListener(this);
}
}
if (lvl == 3) {
// rearrange the tiles for EASY
imageArray = switchTile(imageArray, 0, 0, 2, 1);
imageArray = switchTile(imageArray, 0, 1, 2, 0);
imageArray = switchTile(imageArray, 0, 2, 1, 2);
imageArray = switchTile(imageArray, 1, 0, 1, 1);
}
if (lvl == 4) {
// rearrange the tiles for MEDIUM
imageArray = switchTile(imageArray, 0, 0, 3, 1);
imageArray = switchTile(imageArray, 0, 1, 3, 2);
imageArray = switchTile(imageArray, 0, 2, 3, 0);
imageArray = switchTile(imageArray, 0, 3, 2, 3);
imageArray = switchTile(imageArray, 1, 0, 2, 2);
imageArray = switchTile(imageArray, 1, 1, 2, 1);
imageArray = switchTile(imageArray, 1, 2, 2, 0);
imageArray = switchTile(imageArray, 0, 0, 0, 1);
}
if (lvl == 5) {
// rearrange the tiles for HARD
imageArray = switchTile(imageArray, 0, 0, 4, 3);
imageArray = switchTile(imageArray, 0, 1, 4, 2);
imageArray = switchTile(imageArray, 0, 2, 4, 1);
imageArray = switchTile(imageArray, 0, 3, 4, 0);
imageArray = switchTile(imageArray, 0, 4, 3, 4);
imageArray = switchTile(imageArray, 1, 0, 3, 3);
imageArray = switchTile(imageArray, 1, 1, 3, 2);
imageArray = switchTile(imageArray, 1, 2, 3, 1);
imageArray = switchTile(imageArray, 1, 3, 3, 0);
imageArray = switchTile(imageArray, 1, 4, 2, 4);
imageArray = switchTile(imageArray, 2, 0, 2, 3);
imageArray = switchTile(imageArray, 2, 1, 2, 2);
}
return imageArray;
}
public ImageView[][] switchTile(ImageView[][] imageArray, int pos_x1,
int pos_y1, int pos_x2, int pos_y2) {
//set drawables that are for the two images that will be swapped
Drawable d1 = imageArray[pos_x1][pos_y1].getDrawable();
Drawable d2 = imageArray[pos_x2][pos_y2].getDrawable();
imageArray[pos_x1][pos_y1].setImageDrawable(d2);
imageArray[pos_x2][pos_y2].setImageDrawable(d1);
//switch the ID of each tile
int temp_ID = imageArray[pos_x1][pos_y1].getId();
imageArray[pos_x1][pos_y1].setId(imageArray[pos_x2][pos_y2].getId());
imageArray[pos_x2][pos_y2].setId(temp_ID);
return imageArray;
}
@Override
public void onClick(View v) {
//increment the number of moves
moves++;
// retrieve the coordinates of the blank square and the clicked square
int x = 0, y = 0, xblank = 0, yblank = 0;
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
if (image_array[i][j].getId() == v.getId()) {
x = i;
y = j;
}
if (image_array[i][j].getId() == level * level) {
xblank = i;
yblank = j;
} else {
// do nothing
}
}
}
// if the blank is 1 unit away in the y direction xor the x direction,
// then swap the tiles
if ((x == xblank && (y == yblank + 1 || y == yblank - 1))
|| (y == yblank && (x == xblank + 1 || x == xblank - 1))) {
image_array = switchTile(image_array, x, y, xblank, yblank);
}
// else call an illegal movement
else {
// do nothing
Toast.makeText(this, "That was an illegal move.", Toast.LENGTH_SHORT).show();
}
// see if solved puzzle then start a new activity if true
boolean isDone = checkSolution(image_array);
if (isDone == true) {
Toast.makeText(this, "Congrats!", Toast.LENGTH_LONG).show();
Intent intent = new Intent(this, YouWin.class);
startActivity(intent);
finish();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//inflate the menu
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
public void redrawBoard(int level) {
finish();
//get resources to reset the board
Bundle extra = getIntent().getExtras();
SharedPreferences settings = getSharedPreferences(GAME_SETTINGS, 0);
SharedPreferences.Editor editor = settings.edit();
//keep track of the level and also reset the hasplayed to hasn't played
editor.putInt("lvl", level);
editor.putBoolean("hasPlayed", false);
editor.commit();
//reset the moves
moves = 0;
//access the same activity and send back the same picture
Intent i = new Intent(this, GamePlay.class);
i.putExtra("pictureRef", extra.getInt("pictureRef"));
startActivity(i);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection and declare shared preferences resources
Bundle extra = getIntent().getExtras();
SharedPreferences settings = getSharedPreferences(GAME_SETTINGS, 0);
SharedPreferences.Editor editor = settings.edit();
switch (item.getItemId()) {
case R.id.easy:
// redraw board
redrawBoard(EASY);
return true;
case R.id.medium:
// redraw
redrawBoard(MEDIUM);
return true;
case R.id.hard:
// redraw board save
redrawBoard(HARD);
return true;
case R.id.quit:
finish();
//reset the moves and the hasplayed
moves = 0;
editor.putBoolean("hasPlayed", false).commit();
startActivity(new Intent(this, ImageSelection.class));
return true;
case R.id.shuffle:
finish();
//clear all the data so that you can shuffle
editor.clear();
editor.commit();
//reset the moves and the hasplayed
moves = 0;
editor.putBoolean("hasPlayed", false);
editor.putInt("lvl", level);
editor.commit();
Intent i = new Intent(this, GamePlay.class); //calls a new activity and fires the onPause event
i.putExtra("pictureRef", extra.getInt("pictureRef"));
startActivity(i);
return true;
default:
return true;
}
}
public boolean checkSolution(ImageView[][] image_array) {
int tileCounter = 1;
//check to see if all the pieces are in the right place
for (int i = 0; i < level; i++) {
for (int j = 0; j < level; j++) {
if (image_array[i][j].getId() != tileCounter) {
return false;
}
else {
// do nothing
}
tileCounter++;
}
}
return true;
}
}
| [
"farm.cp@gmail.com"
] | farm.cp@gmail.com |
d034f5d2cf674982265d9aba0a219f7e7ba7dc84 | 4a4bc672dc97d034f9fbd36d797f3ae4c7712c79 | /IOT/Appliance.java | 62f73ef0c1ff6386535ac529cdf3ed238f018723 | [] | no_license | mrudulapaturi/projects | e17026f52db4c1e86bc00745b4e7be31052c2160 | b719de0169743ca9a943f7cb0d6444047f6af1c3 | refs/heads/master | 2021-01-11T05:27:35.135797 | 2017-06-21T21:34:41 | 2017-06-21T21:34:41 | 95,035,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package uncc.abilash.edu;
public class Appliance {
private String applianceName;
private int watts, lumens, size, voltage, applianceId;
public String getApplianceName() {
return applianceName;
}
public void setApplianceName(String applianceName) {
this.applianceName = applianceName;
}
public int getWatts() {
return watts;
}
public void setWatts(int watts) {
this.watts = watts;
}
public int getLumens() {
return lumens;
}
public void setLumens(int lumens) {
this.lumens = lumens;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getVoltage() {
return voltage;
}
public void setVoltage(int voltage) {
this.voltage = voltage;
}
public int getApplianceId() {
return applianceId;
}
public void setApplianceId(int applianceId) {
this.applianceId = applianceId;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
cff971fb7cfc124f48bf239cf934315ee7b03c35 | b6793c49616e721fe42a32934df35b56821c9cad | /dev/src/cn/sqkj/nsyl/userManager/action/AcountExportExcelAction.java | 1dc38fbbd154b1b2056201214f27f990ab153e95 | [] | no_license | tobsenl/easyOnlineShop | aa3770b646bb6a5fc7b7bb83820c97e8240d0da6 | 265cc82f1779637ba7723e0715c612c8bacefaa5 | refs/heads/master | 2021-01-11T13:52:47.858080 | 2017-01-22T03:58:38 | 2017-01-22T03:58:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,457 | java | package cn.sqkj.nsyl.userManager.action;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import cn.sqkj.nsyl.goodsManager.action.GoodsManagerAction_bak;
import cn.sqkj.nsyl.userManager.service.IUserPurseService;
import framework.action.PageAction;
import framework.bean.PageBean;
import framework.db.pojo.TXtUser;
import framework.helper.RequestHelper;
import framework.logger.AuditLogger;
public class AcountExportExcelAction extends PageAction {
@Resource(name="userPurseService")
private IUserPurseService userPurseService;
private AuditLogger logger = AuditLogger.getLogger(); //审计日志对象
private Logger log = Logger.getLogger(GoodsManagerAction_bak.class); //系统log日志对象
private TXtUser user = (TXtUser) RequestHelper.getSession().getAttribute("user");
private String messages;//通知
private String fileName; // 下载文件名称
private InputStream excelFile; // 下载文件流
public String accountsDownload() throws Exception {
PageBean resultData = this.userPurseService.queryUserPurseListCount(this.getPageBean());
HSSFWorkbook workbook = acountexportExcel(resultData);
ByteArrayOutputStream output = new ByteArrayOutputStream();
workbook.write(output);
byte[] ba = output.toByteArray();
excelFile = new ByteArrayInputStream(ba);
output.flush();
output.close();
return "excel";
}
public HSSFWorkbook acountexportExcel(PageBean resultData) throws Exception {
HSSFWorkbook workbook = null;
// 这里的数据即时你要从后台取得的数据
// 创建工作簿实例
workbook = new HSSFWorkbook();
// 创建工作表实例
HSSFSheet sheet = workbook.createSheet("账目统计表");
// 设置列宽
this.setSheetColumnWidth(sheet);
// 获取样式
HSSFCellStyle style = this.createTitleStyle(workbook);
if (resultData != null && resultData.getTotal() > 0) {
// 创建第一行标题,标题名字的本地信息通过resources从资源文件中获取
HSSFRow row = sheet.createRow((short) 0);// 建立新行
this.createCell(row, 0, style, HSSFCell.CELL_TYPE_STRING, "序号");
this.createCell(row, 1, style, HSSFCell.CELL_TYPE_STRING,"用户名");
this.createCell(row, 2, style, HSSFCell.CELL_TYPE_STRING, "真实姓名");
this.createCell(row, 3, style, HSSFCell.CELL_TYPE_STRING, "账目类型");
this.createCell(row, 4, style, HSSFCell.CELL_TYPE_STRING, "支付方式");
this.createCell(row, 5, style, HSSFCell.CELL_TYPE_STRING, "操作类型");
this.createCell(row, 6, style, HSSFCell.CELL_TYPE_STRING, "金额");
this.createCell(row, 7, style, HSSFCell.CELL_TYPE_STRING, "时间");
this.createCell(row, 8, style, HSSFCell.CELL_TYPE_STRING, "状态");
// 给excel填充数据
HSSFRow row1 = null;
int i = 0 ;
for(Iterator iterator = resultData.getPageData().iterator();iterator.hasNext();){
i++;
Map map = new HashMap();
map = (Map) iterator.next();
row1 = sheet.createRow((short) (i));// 建立新行
this.createCell(row1, 0, style, HSSFCell.CELL_TYPE_STRING, i);
if (map.get("userName")!=null) {
this.createCell(row1, 1, style, HSSFCell.CELL_TYPE_STRING, map.get("userName"));
}
if (map.get("trueName")!=null) {
this.createCell(row1, 2, style, HSSFCell.CELL_TYPE_STRING, map.get("trueName"));
}
if (map.get("purseType")!=null) {
if(map.get("purseType").toString().equals("0")){
this.createCell(row1, 3, style, HSSFCell.CELL_TYPE_STRING, "钱包");
}else if(map.get("purseType").toString().equals("1")){
this.createCell(row1, 3, style, HSSFCell.CELL_TYPE_STRING, "分红");
}else if(map.get("purseType").toString().equals("2")){
this.createCell(row1, 3, style, HSSFCell.CELL_TYPE_STRING, "积分");
}
}
if (map.get("tradeType")!=null) {
if(map.get("tradeType").equals('0')){
this.createCell(row1, 4, style, HSSFCell.CELL_TYPE_STRING, "系统操作");
}else if(map.get("tradeType").equals('1')){
this.createCell(row1, 4, style, HSSFCell.CELL_TYPE_STRING, "支付宝");
}else if(map.get("tradeType").equals('2')){
this.createCell(row1, 4, style, HSSFCell.CELL_TYPE_STRING, "微信");
}
}
if (map.get("optionType")!=null) {
if(map.get("optionType").equals('0')){
this.createCell(row1, 5, style, HSSFCell.CELL_TYPE_STRING, "增加");
}else if(map.get("optionType").equals('1')){
this.createCell(row1, 5, style, HSSFCell.CELL_TYPE_STRING, "减少");
}
}
if (map.get("tradeAmount")!=null) {
this.createCell(row1, 6, style, HSSFCell.CELL_TYPE_STRING, map.get("tradeAmount"));
}
if (map.get("optionTime")!=null) {
this.createCell(row1, 7, style, HSSFCell.CELL_TYPE_STRING, map.get("optionTime"));
}
if (map.get("userStatus")!=null) {
if(map.get("userStatus").equals('0')){
this.createCell(row1, 8, style, HSSFCell.CELL_TYPE_STRING, "注销");
}else if(map.get("userStatus").equals('1')){
this.createCell(row1, 8, style, HSSFCell.CELL_TYPE_STRING, "正常");
}else if(map.get("userStatus").equals('2')){
this.createCell(row1, 8, style, HSSFCell.CELL_TYPE_STRING, "冻结");
}
}
}
}else{
this.createCell(sheet.createRow(0), 0, style,
HSSFCell.CELL_TYPE_STRING, "查无资料");
}
return workbook;
}
// 设置excel的title样式
private HSSFCellStyle createTitleStyle(HSSFWorkbook wb) {
HSSFFont boldFont = wb.createFont();
boldFont.setFontHeight((short) 200);
HSSFCellStyle style = wb.createCellStyle();
style.setFont(boldFont);
style.setDataFormat(HSSFDataFormat.getBuiltinFormat("###,##0.00"));
return style;
}
private void setSheetColumnWidth(HSSFSheet sheet) {
// 根据你数据里面的记录有多少列,就设置多少列
sheet.setColumnWidth(0, 2000);
sheet.setColumnWidth(1, 5000);
sheet.setColumnWidth(2, 3000);
sheet.setColumnWidth(3, 2000);
sheet.setColumnWidth(4, 8000);
sheet.setColumnWidth(5, 8000);
sheet.setColumnWidth(6, 8000);
sheet.setColumnWidth(7, 5000);
sheet.setColumnWidth(8, 5000);
}
// 创建Excel单元格
private void createCell(HSSFRow row, int column, HSSFCellStyle style,int cellType, Object value) {
HSSFCell cell = row.createCell(column);
if (style != null) {
cell.setCellStyle(style);
}
switch (cellType) {
case HSSFCell.CELL_TYPE_BLANK: {
}
break;
case HSSFCell.CELL_TYPE_STRING: {
cell.setCellValue(value.toString());
}
break;
case HSSFCell.CELL_TYPE_NUMERIC: {
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
cell.setCellValue(Double.parseDouble(value.toString()));
}
break;
default:
break;
}
}
public String getFileName() {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd ");
String fileName = (sf.format(new Date()).toString())+ "账目统计信息.xls";
try {
fileName = new String(fileName.getBytes(), "ISO8859-1");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public InputStream getExcelFile() {
return excelFile;
}
public void setExcelFile(InputStream excelFile) {
this.excelFile = excelFile;
}
public String getMessages() {
return messages;
}
public void setMessages(String messages) {
this.messages = messages;
}
}
| [
"gudankangti1987@126.com"
] | gudankangti1987@126.com |
b546ecf457b87c84877dfa8257e0acfb941eddb1 | 703c2c10b20ff285056594d5fecfb1c224198715 | /src/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGStyleElement.java | a4409eac25400656fcdd3b5698e70adc98d4e84d | [] | no_license | semihyumusak/SpEnD | 692c94a350f2145aec657738ee9273b689670352 | 386c207197bf952735d26d8c2a6ffbaed726a8da | refs/heads/master | 2020-04-12T06:30:20.868402 | 2016-08-16T18:37:10 | 2016-08-16T18:37:10 | 50,120,081 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,556 | java | /*
* Copyright (c) 2002-2014 Gargoyle Software Inc.
*
* 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.gargoylesoftware.htmlunit.javascript.host.svg;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser;
import com.gargoylesoftware.htmlunit.svg.SvgStyle;
/**
* A JavaScript object for SVGStyleElement.
*
* @version $Revision: 8931 $
* @author Ahmed Ashour
*/
@JsxClass(domClass = SvgStyle.class,
browsers = { @WebBrowser(value = IE, minVersion = 9), @WebBrowser(FF), @WebBrowser(CHROME) })
public class SVGStyleElement extends SVGElement {
/**
* Creates an instance. JavaScript objects must have a default constructor.
*/
public SVGStyleElement() {
}
}
| [
"semihyumusak@yahoo.com"
] | semihyumusak@yahoo.com |
cb3dd7d858bc3c40f69640a9fa789ebb58a27baa | ae5f7d82f8459fc4a588aff8f6061b11e09dbfcc | /src/main/java/information/client/api/data/ParticipantData.java | 4f72ad76b8ae1811fc5fb8c850ce7e53592013a6 | [] | no_license | kingroma/information-client-api | 09a2bc6e23ea9fea6d7b72729cf45a31f6373a65 | 8fc1939cbceca58ec678d98bbed0a6097bd44252 | refs/heads/master | 2022-10-26T06:55:11.112676 | 2020-06-20T12:12:29 | 2020-06-20T12:12:29 | 253,453,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,332 | java | package information.client.api.data;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import information.client.api.util.DomainUtil;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ParticipantData {
private Integer participantId;
private Integer championId ;
private List<RuneData> runes ;
private ParticipantStatsData stats ;
private Integer teamId ;
private ParticipantTimelineData timeline ;
private Integer spell1Id ;
private Integer spell2Id ;
private String highestAchievedSeasonTier ;
private List<MasteryData> masteries;
public Integer getParticipantId() {
return participantId;
}
public void setParticipantId(Integer participantId) {
this.participantId = participantId;
}
public Integer getChampionId() {
return championId;
}
public void setChampionId(Integer championId) {
this.championId = championId;
}
public List<RuneData> getRunes() {
return runes;
}
public void setRunes(List<RuneData> runes) {
this.runes = runes;
}
public ParticipantStatsData getStats() {
return stats;
}
public void setStats(ParticipantStatsData stats) {
this.stats = stats;
}
public Integer getTeamId() {
return teamId;
}
public void setTeamId(Integer teamId) {
this.teamId = teamId;
}
public ParticipantTimelineData getTimeline() {
return timeline;
}
public void setTimeline(ParticipantTimelineData timeline) {
this.timeline = timeline;
}
public Integer getSpell1Id() {
return spell1Id;
}
public void setSpell1Id(Integer spell1Id) {
this.spell1Id = spell1Id;
}
public Integer getSpell2Id() {
return spell2Id;
}
public void setSpell2Id(Integer spell2Id) {
this.spell2Id = spell2Id;
}
public String getHighestAchievedSeasonTier() {
return highestAchievedSeasonTier;
}
public void setHighestAchievedSeasonTier(String highestAchievedSeasonTier) {
this.highestAchievedSeasonTier = highestAchievedSeasonTier;
}
public List<MasteryData> getMasteries() {
return masteries;
}
public void setMasteries(List<MasteryData> masteries) {
this.masteries = masteries;
}
@Override
public String toString() {
return DomainUtil.changeObjValueToString(this);
}
}
| [
"kjj@mail.com"
] | kjj@mail.com |
4c41f348993c19e8a5e2d873f3c4595fe91a2fc2 | f90cb09a21a619c9503663191b135127f1746f3f | /src/main/java/edu/upenn/zootester/scenario/ParallelBaselineScenario.java | ac2c7ea7457eff3455b8f3bc561e185330a51494 | [
"MIT"
] | permissive | fniksic/zootester | aa4684411e55938a0b2c2de94856309dc3bdffea | 80dd67db69acdeea4184aaace80313168a605e90 | refs/heads/master | 2022-12-30T03:51:47.609377 | 2020-10-14T13:27:12 | 2020-10-14T13:27:12 | 235,217,955 | 1 | 1 | MIT | 2020-10-14T13:27:13 | 2020-01-20T23:25:46 | Java | UTF-8 | Java | false | false | 2,479 | java | package edu.upenn.zootester.scenario;
import edu.upenn.zootester.ensemble.ZKHelper;
import edu.upenn.zootester.harness.EmptyPhase;
import edu.upenn.zootester.harness.Harness;
import edu.upenn.zootester.harness.UnconditionalWritePhase;
import edu.upenn.zootester.util.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
public class ParallelBaselineScenario implements Scenario {
private static final Logger LOG = LoggerFactory.getLogger(ParallelBaselineScenario.class);
private final List<Harness> harnesses;
public ParallelBaselineScenario(final List<Harness> harness) {
this.harnesses = harness;
}
public ParallelBaselineScenario() {
// We use a hardcoded list of harnesses that matches the randomly generated harnesses
// from other tests.
this(List.of(
new Harness(List.of(
new UnconditionalWritePhase(1, "/key0", 101),
new EmptyPhase(),
new UnconditionalWritePhase(2, "/key1", 302)
))
));
}
private Config config;
@Override
public void init(final Config config) {
this.config = config;
}
@Override
public void execute() {
for (final var harness : harnesses) {
LOG.info("Starting execution with {}", harness.toString());
// Reset unique port counter to reuse the port numbers over executions
ZKHelper.setBasePort(config.getBasePort());
final List<Thread> threads = new ArrayList<>();
for (int j = 0; j < config.getThreads(); ++j) {
final Thread thread = new Thread(() -> {
try {
final Scenario scenario = new BaselineScenario(harness);
scenario.init(config);
scenario.execute();
} catch (final Exception e) {
LOG.error("Exception while executing scenario", e);
}
});
threads.add(thread);
thread.start();
}
for (final var thread : threads) {
try {
thread.join();
} catch (final InterruptedException e) {
LOG.warn("Interrupted from waiting on {}", thread.getName());
}
}
}
}
}
| [
"fniksic@seas.upenn.edu"
] | fniksic@seas.upenn.edu |
a08eaa2fb66678cb9b9d4d1e0e6b38694fd8f776 | e64657da6aa61403ed2e363fd192c19412cf3ef2 | /hyobin/Basic_Algorithm_2/NnM/NnM_2_15650.java | 0663b22576cd6fb668c8095689190be5f5fc4c0c | [] | no_license | chaeeon-lim/ProgrammingLearners | 09015dff6ab35b8e12efd1fe31e4aa34b992aae7 | 465cf5c436bc0ccdb7d570a58163584976342b4d | refs/heads/master | 2022-11-06T16:06:04.332715 | 2020-06-30T08:48:09 | 2020-06-30T08:48:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package NnM;
import java.util.Scanner;
public class NnM_2_15650 {
public static int[] number = new int[10];
public static boolean[] used = new boolean[10];
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int M = scanner.nextInt();
go(0, N, M);
}
public static void go(int index, int N, int M) {
if(index == M) {
for(int i=0; i<M; i++) System.out.print(number[i] + " ");
System.out.println();
return;
}
for(int i=1; i<=N; i++) {
if(used[i]) continue;
if(index!=0 && i<number[index-1]) continue; //행렬을 대각선으로 만들기 위해 이거 추가
number[index] = i;
used[i] = true;
go(index+1, N, M);
used[i] = false;
}
}
}
| [
"gyqls1494@gmail.com"
] | gyqls1494@gmail.com |
22ebcf32b125bad2ac985f29efcfecac492a1f2b | c8e88bc5bdea7689b2c9e1a92bddf94e7b76d055 | /src/main/java/net/coffeecoding/entity/Topic.java | b316e9dac83b7936eb128e3cbbd914dbfc8b9ce4 | [] | no_license | MichalSiwiak/Forum-Spring-Security | f9ced1396673bfe733e75d8096e0b3fd42564e2d | 46125db2a5a9a6cf8aa6c5de0ac2b35333644dc3 | refs/heads/master | 2020-04-09T05:54:05.005807 | 2019-03-12T21:12:25 | 2019-03-12T21:12:25 | 158,297,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,357 | java | package net.coffeecoding.entity;
import java.sql.Timestamp;
import java.util.Set;
import javax.persistence.*;
@Entity
@Table(name = "topic")
public class Topic {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private int id;
private Timestamp date;
private String title;
@Lob()
private String content;
@ManyToOne
@JoinColumn(name = "users")
private Users users;
@OneToMany(mappedBy = "topic", fetch = FetchType.EAGER)
@OrderBy("date ASC")
private Set<Entry> entries;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Timestamp getDate() {
return date;
}
public void setDate(Timestamp date) {
this.date = date;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Users getUsers() {
return users;
}
public void setUsers(Users users) {
this.users = users;
}
public Set<Entry> getEntries() {
return entries;
}
public void setEntries(Set<Entry> entries) {
this.entries = entries;
}
}
| [
"siwiakmichal@gmail.com"
] | siwiakmichal@gmail.com |
41e10a7600c7c9d4fae99d6702d312ab91e44699 | ab50b2265fbf49326bfe6ba8077b2258124f1201 | /jpa-project/src/main/java/org/jbpm/test/jpa/project/ProjectJPAResolverStrategy.java | e9598f44d8ca21b8c5f1b1a86e139b9ec92f90ed | [] | no_license | bhooshanmore/bpm-projects | 546df78308eee28fe11c25115a489f6652dde0a7 | 8e6b89aad949bd4f133f234d202b5b4b7bcc9fdb | refs/heads/master | 2020-05-14T14:05:17.519823 | 2018-07-09T06:33:41 | 2018-07-09T06:33:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package org.jbpm.test.jpa.project;
import java.io.IOException;
import java.io.ObjectInputStream;
import org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy;
public class ProjectJPAResolverStrategy extends JPAPlaceholderResolverStrategy {
private ClassLoader classLoader;
public ProjectJPAResolverStrategy(ClassLoader cl) {
super(org.jbpm.test.jpa.project.PersistenceUtility.getEmf(cl));
this.classLoader = cl;
}
@Override
public Object unmarshal(Context context, ObjectInputStream ois, byte[] object, ClassLoader classloader) throws IOException,
ClassNotFoundException {
return super.unmarshal(context, ois, object, this.classLoader);
}
}
| [
"mswiders@redhat.com"
] | mswiders@redhat.com |
faeca9de7ec2ac7df5317877116b7353d6328c94 | 00c483bc9bc1ab3f896626f426ffdc7247da5cc2 | /gui/src/main/java/com/kamontat/abstractui/AbstractUI.java | 21085a13f8a6bbbdf94e8aebc463b6cc834797ca | [] | no_license | kamontat/jUpdater | e9fca475f2ce3ab0adbcb9f10e9000ef29dc3dc9 | e819a9dbed4e8ecfdfcc911baf719f3d783fc712 | refs/heads/master | 2021-09-01T13:08:56.395868 | 2017-12-27T05:37:55 | 2017-12-27T05:37:55 | 84,926,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,279 | java | package com.kamontat.abstractui;
import com.kamontat.component.DetailPanel;
import com.kamontat.exception.UpdateException;
import com.kamontat.factory.UpdaterFactory;
import com.kamontat.rawapi.IUpdateUI;
import com.kamontat.rawapi.Updatable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.*;
/**
* @author kamontat
* @version 1.0
* @since Sun 30/Apr/2017 - 5:06 PM
*/
public abstract class AbstractUI implements IUpdateUI, Runnable, ActionListener {
private static final String DEFAULT_NAME = "Update Page";
private static final Point DEFAULT_POINT = new Point(0, 0);
protected JDialog dialog;
protected Window window;
private String name;
protected UpdaterFactory factory;
private Point point;
/**
* Constructor to create popup <br>
*
* @param update
* The updater
*/
public AbstractUI(Updatable update) throws UpdateException {
this(UpdaterFactory.setUpdater(update));
}
public AbstractUI(UpdaterFactory update) throws UpdateException {
setUpdateFactory(update);
update.checkRelease();
}
@Override
public void setUpdatable(Updatable updatable) {
this.factory = UpdaterFactory.setUpdater(updatable);
}
@Override
public void setUpdateFactory(UpdaterFactory factory) {
this.factory = factory;
}
@Override
public IUpdateUI setView(Window window) {
this.window = window;
return this;
}
@Override
public IUpdateUI setName(String name) {
this.name = name;
return this;
}
@Override
public IUpdateUI setLocation(Point point) {
this.point = point;
return this;
}
@Override
public void run() {
if (Objects.nonNull(name)) dialog = new JDialog(window, name);
else dialog = new JDialog(window, DEFAULT_NAME);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setContentPane(getRootPanel());
if (Objects.nonNull(point)) dialog.setLocation(point);
dialog.pack();
dialog.setVisible(true);
}
@Override
public void setNorthPanel(JPanel root) {
JPanel p = new JPanel(new BorderLayout());
if (!factory.isLatest()) {
p.add(new JLabel(String.format("current: %-6s", factory.getCurrentVersion()), SwingConstants.CENTER), BorderLayout.NORTH);
p.add(new JLabel(String.format("newest : %-6s", factory.getRemoteVersion()), SwingConstants.CENTER), BorderLayout.SOUTH);
} else {
p.add(new JLabel("Up to date (" + factory.getCurrentVersion() + ")", SwingConstants.CENTER), BorderLayout.CENTER);
}
root.add(p, BorderLayout.NORTH);
}
@Override
public void setCenterPanel(JPanel root) {
root.add(new DetailPanel(factory.getDescription(), DetailPanel.TextType.HTML).init(), BorderLayout.CENTER);
}
@Override
public void setSouthPanel(JPanel root) {
if (!factory.isLatest()) {
JButton button = new JButton("update!");
button.addActionListener(this);
root.add(button, BorderLayout.SOUTH);
}
}
}
| [
"kamontat_c@hotmail.com"
] | kamontat_c@hotmail.com |
a21dcb778a73f973f7e041c74d8fbbb9f8b66d6c | fce7ae51d3cc7d24d2e6e488e7cf029e58c59b22 | /src/com/events/old/IOnEventException.java | d871aaade872434d3f40f68f1699023dcf620fba | [] | no_license | mziernik/fra | 085ae7bba60ac73b71587f303bc939a5e0ecf4b5 | 10bfccf3272de63fb883615d6f69f80a15e553f7 | refs/heads/master | 2021-01-20T17:27:26.599356 | 2017-10-01T20:44:36 | 2017-10-01T20:44:36 | 90,874,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package com.events.old;
public interface IOnEventException<Param1, Param2> {
public boolean onEventException(Param1 param1, Param2 param2, Throwable ex);
}
| [
"mziernik@gmail.com"
] | mziernik@gmail.com |
6cefa8480bd7d60a33a18209fda03bd8bc3710e2 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/profile/ui/c$18.java | 0a182dee0ec3ac15b34c14811ac3d550d2fb780d | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 668 | java | package com.tencent.mm.plugin.profile.ui;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
final class c$18
implements MenuItem.OnMenuItemClickListener
{
c$18(c paramc)
{
}
public final boolean onMenuItemClick(MenuItem paramMenuItem)
{
AppMethodBeat.i(23473);
c.a(this.pmK);
AppMethodBeat.o(23473);
return true;
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes7-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.profile.ui.c.18
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
0d39bd1d989e70700d03029471e65b0bc141e068 | c803f2829cd48193f9a9be2de28dc3147b8ed185 | /loginjpamysql/src/main/java/com/program/loginjpamysql/loginjpamysqlapplication.java | 1e212a283fe5d76d0bcbca07655ce9617fab4a64 | [] | no_license | lordhartpaul/loginjpamysql | 98ed63d95a00f7bd68102aeff57dded9b04c74de | 60e63dc7b4744e2e1e18427427eeb30d9ced8a95 | refs/heads/master | 2021-05-23T00:22:03.234808 | 2020-04-05T04:11:37 | 2020-04-05T04:11:37 | 253,153,116 | 0 | 0 | null | 2020-10-13T20:55:20 | 2020-04-05T04:10:34 | Java | UTF-8 | Java | false | false | 389 | java | package com.program.loginjpamysql;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class loginjpamysqlapplication {
public static void main(String[] args) {
// TODO Auto-generated method stub
SpringApplication.run(loginjpamysqlapplication.class, args);
}
}
| [
"sunny.paul@live.com"
] | sunny.paul@live.com |
f784ea3dadafd827cae41332880ec679cf93900b | 8d9318a33afc2c3b5ca8ac99fce0d8544478c94a | /Books/Elastic Search/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/hitimes-1.2.1-java/ext/hitimes/java/src/hitimes/Hitimes.java | f732a35b3b2a8a2e9ac06c3f129faa25ca697520 | [] | no_license | tushar239/git-large-repo | e30aa7b1894454bf00546312a3fb595f6dad0ed6 | 9ee51112596e5fc3a7ab2ea97a86ec6adc677162 | refs/heads/master | 2021-01-12T13:48:43.280111 | 2016-11-01T22:14:51 | 2016-11-01T22:14:51 | 69,609,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | version https://git-lfs.github.com/spec/v1
oid sha256:b4c0c6f7ff3f895f11cfdca3b93e0858316177c0d4075904b26206f05a558443
size 1757
| [
"tushar239@gmail.com"
] | tushar239@gmail.com |
5d0064b7ae5521063e9d25682b6c029707622f0a | cf260ad3c3664f39e300e38d2e501d05d9d3aaf1 | /src/main/java/com/javapuzzle/character/LinePrinter.java | 75e1a59a92308fa86faa1bf9b5f3771eb3eac8f9 | [] | no_license | PhilFu/javapuzzle | f7d823e1eb49e1208e48f5399acb128017be637b | 371e0cc069d2685ef68214f11bb9dcf467df40b5 | refs/heads/master | 2020-12-24T16:41:02.791830 | 2016-04-18T14:58:49 | 2016-04-18T14:58:49 | 34,463,247 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.javapuzzle.character;
import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
public class LinePrinter {
public static void main(String[] args) {
// Note : \u000A is Unicode representation of linefeed (LF)
// Above comment is equal to:
// Note :
is Unicode representation of linefeed (LF)
char c = 0x000A;
System.out.println(c);
}
}
| [
"mrfoxysky@gmail.com"
] | mrfoxysky@gmail.com |
7f91c063006140d19a9f2741e43fec25f7289ca2 | 051bbbcddbf6ade432c247c616a002b894c2055b | /src/ejercicio14Builder/folder1/Main.java | 2715736aba6c477b36da36aad8d660d1bb004160 | [] | no_license | crjcarlos1/Ejercicios | 6fea5f480f22b645b548f21d5e923ea764e24bd7 | b65d92e99e57867121f3e79fabc3a8e639b32563 | refs/heads/master | 2022-06-10T05:03:45.976626 | 2020-05-08T22:20:05 | 2020-05-08T22:20:05 | 259,795,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,857 | java | package ejercicio14Builder.folder1;
import ejercicio14Builder.folder1.builders.BuilderCoche;
import ejercicio14Builder.folder1.builders.ConstructorCocheBase;
import ejercicio14Builder.folder1.builders.ConstructorCocheFull;
import ejercicio14Builder.folder1.builders.ConstructorCocheMedio;
import ejercicio14Builder.folder1.models.Coche;
import ejercicio14Builder.folder1.models.Director;
public class Main {
public static void main(String... args) {
/** Crear el objeto director */
Director director = new Director();
/** Crear los objetos concreteBuilder */
BuilderCoche base = new ConstructorCocheBase();
BuilderCoche medio = new ConstructorCocheMedio();
BuilderCoche full = new ConstructorCocheFull();
/** Construir un coche con equipamiento base */
director.construir(base);
Coche cocheBase = base.getCoche();
/** Construir un coche con equipamiento medio */
director.construir(medio);
Coche cocheMedio = medio.getCoche();
/** Construir un coche con equipamiento full */
director.construir(full);
Coche cocheFull = full.getCoche();
/** Mostrar la información de cada coche creado */
mostraCaracteristicas(cocheBase);
mostraCaracteristicas(cocheMedio);
mostraCaracteristicas(cocheFull);
}
private static void mostraCaracteristicas(Coche coche) {
System.out.println("Motor: "+coche.getMotor());
System.out.println("Carrocería: "+coche.getCarroceria());
System.out.println("Elevalunas electríco: "+coche.isElevalunasElec());
System.out.println("Aire acondicionado: "+coche.isAireAcond());
System.out.println("========================================================");
}
}
| [
"crjcarlos1@users.noreply.github.com"
] | crjcarlos1@users.noreply.github.com |
4fd1312a52b9c56f41e29221c0bcc76de57655f1 | 78252c338d42fc1793889ce9e6c0ec91853f791b | /book-service/src/test/java/com/ank/bookservice/BookServiceApplicationTests.java | 1e5eb545570b3bdecb607bca5cec0182b384f233 | [
"MIT"
] | permissive | a2ankitrai/spring-cloud | 8231fdd2c60f7c7ff0c060ebb36484a5024820e7 | 5de5f658e3751fc25e3e159ad6db58fd0984a674 | refs/heads/master | 2020-06-16T14:44:50.619690 | 2019-07-07T09:01:05 | 2019-07-07T09:01:05 | 195,612,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package com.ank.bookservice;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BookServiceApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"ankirai@paypal.com"
] | ankirai@paypal.com |
eafac5c2ac10e1835ecf3beff3da9a7ec4473e7e | 6fd7c9875802bf4e804bba379f56e441b69a7636 | /api/src/main/java/com/dahua/boke/service/PhotoInputService.java | c7f4b94eb8e1032fbdb005339aee9920cf908792 | [] | no_license | zmYe/boke | bcfa215a2bb00adfae06a6dff878bd0e60c7a9d7 | f1193ef0040f2c4ca1a168ebcaa3d981ec071a39 | refs/heads/master | 2020-06-24T10:17:58.762217 | 2019-05-11T11:46:21 | 2019-05-11T11:46:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.dahua.boke.service;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.dahua.boke.entity.User;
import net.sf.json.JSONObject;
public interface PhotoInputService {
JSONObject fileUp(String fileName,String userId,int id,String text,HttpServletResponse response, User user) throws IOException;
}
| [
"970263611@qq.com"
] | 970263611@qq.com |
db73a10c8887970ed98290cd905b24c21ec9f767 | 3d48388311842beb0a35e5d297465b20941c253b | /health_interface/src/main/java/com/itheima/service/ReportService.java | c8bdcd05e776267183eaa65f3060fa7eaf7049af | [] | no_license | JesseGo327/health | b89fbca2ecec8353868ab9bf7db46b8ea4d39e84 | 803790b7bc1c651437a7253a75ed19affc87c2a1 | refs/heads/master | 2022-12-25T05:58:13.167821 | 2019-11-23T09:50:23 | 2019-11-23T09:50:23 | 223,565,353 | 0 | 0 | null | 2022-12-16T04:25:33 | 2019-11-23T09:42:26 | JavaScript | UTF-8 | Java | false | false | 224 | java | package com.itheima.service;
import java.util.Map;
/**
* @Author: tangx
* @Date: 2019/11/16 20:32
* @Description: com.itheima.service
*/
public interface ReportService {
Map getBusinessReport() throws Exception;
}
| [
"2550204323@qq.com"
] | 2550204323@qq.com |
67f295c8d9d956e8e2108436d871c80bf08cd392 | 4ab873913713061f1a4544529e5b9bf006721b1c | /grepo/grepo-query-jpa/src/main/java/org/codehaus/grepo/query/jpa/generator/JpaGeneratorUtils.java | db56473a9f3fdd62005de8a5d1d70943601bc74c | [] | no_license | codehaus/grepo | b8d6c174fcd8672711b6a7349583e68401454ce7 | 1f862ea6e6e975f6d28b86b7d59e38eee9e0f85e | refs/heads/master | 2023-07-20T00:35:22.539915 | 2012-07-04T07:06:03 | 2012-07-04T07:06:03 | 36,343,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,273 | java | /*
* Copyright 2011 Grepo Committers.
*
* 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.codehaus.grepo.query.jpa.generator;
import org.apache.commons.lang.StringUtils;
import org.codehaus.grepo.query.commons.annotation.GenericQuery;
import org.codehaus.grepo.query.commons.generator.GeneratorUtils;
import org.codehaus.grepo.query.jpa.annotation.JpaQueryOptions;
/**
* @author dguggi
*/
public final class JpaGeneratorUtils {
private JpaGeneratorUtils() {
}
/**
* @param queryOptions The query options.
* @return Returns the result class or {@code null}.
*/
public static Class<?> getResultClass(JpaQueryOptions queryOptions) {
Class<?> resultClass = null;
if (queryOptions != null && hasValidResultClass(queryOptions.resultClass())) {
resultClass = queryOptions.resultClass();
}
return resultClass;
}
/**
* @param queryOptions The query options.
* @param generator The query generator.
* @return Returns the result set mapping or null if not specified.
*/
public static String getResultSetMapping(JpaQueryOptions queryOptions) {
String resultSetMapping = null;
if (queryOptions != null && StringUtils.isNotEmpty(queryOptions.resultSetMapping())) {
resultSetMapping = queryOptions.resultSetMapping();
}
return resultSetMapping;
}
private static boolean hasValidResultClass(Class<?> resultClass) {
return (resultClass != null && resultClass != PlaceHolderResultClass.class);
}
public static boolean hasValidQueryGenerator(GenericQuery genericQuery) {
return GeneratorUtils.isValidQueryGenerator(genericQuery.queryGenerator(), JpaQueryGenerator.class);
}
}
| [
"dguggi@729f7ef0-7c71-0410-bb00-e2a08ff96a94"
] | dguggi@729f7ef0-7c71-0410-bb00-e2a08ff96a94 |
8d40131c7b5e6ef993969dee912a31e96606a9f7 | 031ca6be4352df56a1fb9f8d6bf34c5fc5cf99c5 | /app/src/main/java/star/liuwen/com/le_shi/DataEnage/DateEnage.java | aa656634f39fee83894ff58a7ecbff5320a150b0 | [] | no_license | liuwen370494581/LE_SHI | 0709dc06ab8373693a6d9ed97c29098750931998 | 6e194fc2252df00420cd1b5b93241d851a1849ea | refs/heads/master | 2021-05-04T19:13:50.667913 | 2018-11-02T07:44:38 | 2018-11-02T07:44:38 | 106,654,001 | 2 | 0 | null | 2018-11-02T07:37:10 | 2017-10-12T06:33:35 | Java | UTF-8 | Java | false | false | 10,020 | java | package star.liuwen.com.le_shi.DataEnage;
import android.support.v4.util.ArrayMap;
import java.util.ArrayList;
import java.util.List;
import star.liuwen.com.le_shi.Model.IndexModel;
import star.liuwen.com.le_shi.R;
/**
* Created by liuwen on 2017/10/16.
*/
public class DateEnage {
public static List<String> getContentDate() {
List<String> list = new ArrayList<>();
list.add("电影");
list.add("电视剧");
list.add("动漫");
list.add("纪录片");
return list;
}
public static List<String> getSortDate() {
List<String> list = new ArrayList<>();
list.add("最热");
list.add("最新");
list.add("好评");
return list;
}
public static List<String> getTypeDate() {
List<String> list = new ArrayList<>();
list.add("全部");
list.add("喜剧");
list.add("动作");
list.add("恐怖");
list.add("动画");
list.add("警匪");
list.add("武侠");
list.add("战争");
list.add("短片");
list.add("爱情");
list.add("科幻");
list.add("奇幻");
list.add("犯罪");
list.add("冒险");
list.add("灾难");
list.add("伦理");
list.add("传记");
list.add("家庭");
list.add("记录");
list.add("惊悚");
list.add("历史");
list.add("悬疑");
list.add("歌舞");
list.add("体育");
return list;
}
public static List<String> getMoneyDate() {
List<String> list = new ArrayList<>();
list.add("全部");
list.add("免费");
list.add("影视会员");
return list;
}
public static List<String> getLocDate() {
List<String> list = new ArrayList<>();
list.add("全部");
list.add("内地");
list.add("美国");
list.add("香港");
list.add("英国");
list.add("法国");
list.add("俄罗斯");
list.add("新加坡");
list.add("加拿大");
list.add("台湾");
list.add("韩国");
list.add("泰国");
list.add("印度");
list.add("冒险");
list.add("日本");
list.add("西班牙");
list.add("马来西亚");
return list;
}
public static List<String> getYearDate() {
List<String> list = new ArrayList<>();
list.add("全部");
list.add("2017");
list.add("2016");
list.add("2015");
list.add("2014");
list.add("2013");
list.add("2012");
list.add("2011");
list.add("2010");
list.add("00年代");
list.add("90年代");
list.add("更早");
return list;
}
public static List<ArrayMap<String, Object>> getChannelList() {
List<ArrayMap<String, Object>> list = new ArrayList<>();
ArrayMap<String, Object> map1 = new ArrayMap<>();
map1.put("title", "热门独享");
map1.put("pic", R.mipmap.icon_video);
ArrayMap<String, Object> map2 = new ArrayMap<>();
map2.put("title", "跳过广告");
map2.put("pic", R.mipmap.icon_add);
ArrayMap<String, Object> map3 = new ArrayMap<>();
map3.put("title", "大剧抢先看");
map3.put("pic", R.mipmap.icon_daju);
ArrayMap<String, Object> map4 = new ArrayMap<>();
map4.put("title", "加速通道");
map4.put("pic", R.mipmap.icon_speed);
ArrayMap<String, Object> map5 = new ArrayMap<>();
map5.put("title", "独享缓存");
map5.put("pic", R.mipmap.icon_huancun);
ArrayMap<String, Object> map6 = new ArrayMap<>();
map6.put("title", "多视频缓存");
map6.put("pic", R.mipmap.icon_duo_mei_ti);
ArrayMap<String, Object> map7 = new ArrayMap<>();
map7.put("title", "1080p高清");
map7.put("pic", R.mipmap.icon_hd);
ArrayMap<String, Object> map8 = new ArrayMap<>();
map8.put("title", "多屏同步");
map8.put("pic", R.mipmap.icon_duo);
ArrayMap<String, Object> map9 = new ArrayMap<>();
map9.put("title", "生态福利");
map9.put("pic", R.mipmap.icon_fu_li);
list.add(map1);
list.add(map2);
list.add(map3);
list.add(map4);
list.add(map5);
list.add(map6);
list.add(map7);
list.add(map8);
list.add(map9);
return list;
}
public static List<String> getMalChannelList() {
List<String> list = new ArrayList<>();
list.add("暴风TV");
list.add("暴风魔镜");
list.add("暴风VIP");
list.add("娱乐周边");
list.add("超值套餐");
list.add("汽车车品");
list.add("运动户外");
list.add("鞋靴箱包");
return list;
}
//精选
public static List<String> getChoiceChannelList() {
List<String> list = new ArrayList<>();
list.add("电视剧");
list.add("电影");
list.add("动漫");
list.add("综艺");
list.add("体育");
list.add("教育");
list.add("微电影");
list.add("音乐");
return list;
}
//电视剧
public static List<String> getTvChannelList() {
List<String> list = new ArrayList<>();
list.add("同步热播");
list.add("暴风出品");
list.add("内地");
list.add("自制");
list.add("影视会员");
list.add("排行");
list.add("片花");
list.add("筛选");
return list;
}
//电影
public static List<String> getMovieChannelList() {
List<String> list = new ArrayList<>();
list.add("精选");
list.add("影视会员");
list.add("内地");
list.add("欧美");
list.add("港台");
list.add("片花");
list.add("环球之声");
list.add("筛选");
return list;
}
//综艺
public static List<String> getZongYiChannelList() {
List<String> list = new ArrayList<>();
list.add("全部");
list.add("真人秀");
list.add("搞笑");
list.add("情感");
list.add("脱口秀");
list.add("音乐");
list.add("网综");
list.add("节目单");
return list;
}
//动漫
public static List<String> getDongManChannelList() {
List<String> list = new ArrayList<>();
list.add("热播");
list.add("少儿");
list.add("中国");
list.add("美国");
list.add("日本");
list.add("追番剧");
list.add("专题");
list.add("筛选");
return list;
}
//vip
public static List<String> getVipChannelList() {
List<String> list = new ArrayList<>();
list.add("独播");
list.add("福利");
list.add("热映");
list.add("爱情");
list.add("动作");
list.add("喜剧");
list.add("悬疑");
list.add("筛选");
return list;
}
public static List<IndexModel> getBBSDate() {
List<IndexModel> list = new ArrayList<>();
list.add(new IndexModel("全部", "http://bbs.baofeng.com/forum-179-1.html"));
list.add(new IndexModel("左眼键", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=37"));
list.add(new IndexModel("3D专区", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=106"));
list.add(new IndexModel("功能", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=38"));
list.add(new IndexModel("画质", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=39"));
list.add(new IndexModel("错误代码", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=42"));
list.add(new IndexModel("盒子展现", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=44"));
list.add(new IndexModel("宝贵建议", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=53"));
list.add(new IndexModel("画面卡", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=73"));
list.add(new IndexModel("飞屏", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=286"));
list.add(new IndexModel("推广联盟", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=144"));
list.add(new IndexModel("软件无法使用", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=40"));
list.add(new IndexModel("在线内容", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=45"));
list.add(new IndexModel("字幕", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=47"));
list.add(new IndexModel("不可播", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=48"));
list.add(new IndexModel("广告", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=76"));
list.add(new IndexModel("下载", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=75"));
list.add(new IndexModel("缓冲卡", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=74"));
list.add(new IndexModel("其他", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=90"));
list.add(new IndexModel("声音", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=43"));
list.add(new IndexModel("新闻播报", "http://bbs.baofeng.com/forum.php?mod=forumdisplay&fid=179&filter=typeid&typeid=55"));
return list;
}
}
| [
"370494581@qq.com"
] | 370494581@qq.com |
ad442558843778d3909adc357b2af53bec416782 | 8892626d4d95dc85841cd888da2f62728d3d283b | /workspace/espi_java/common/src/main/java/org/energyos/espi/common/eui/CustomerAuthorisation.java | 8c3c32f0dd3aa8d485ed7a1e3c49ccb8fcc2d11a | [] | no_license | pcanchi/pcanchi_repo | eadec5766bfb7f1a3d37dc0b360583aaa072131c | cf9d931e3512489b7bcd218f8340729dbf6d8402 | refs/heads/master | 2016-08-04T02:31:53.324439 | 2012-09-22T06:02:36 | 2012-09-22T06:02:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,781 | java | /*******************************************************************************
* Copyright (c) 2011, 2012 EnergyOS.Org
*
* Licensed by EnergyOS.Org under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. The EnergyOS.org 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.energyos.espi.common.eui;
/**
* Holds an authorisation for access to specific user-private data granted to a
* Authorized Third Party service provider.
* @author svanausdall
* @version 1.0
* @updated 22-Aug-2011 9:39:20 AM
*/
public class CustomerAuthorisation {
/**
* The name is any free human readable and possibly non unique text naming the
* object.
*/
public String name;
/**
* Date and time interval this agreement is valid (from going into effect to
* termination).
*/
public DateTimeInterval validityInterval;
public CustomerAgreement CustomerAgreements;
public CustomerAuthorisation(){
}
public void finalize() throws Throwable {
}
}//end CustomerAuthorisation | [
"canchipawan31@yahoo.com"
] | canchipawan31@yahoo.com |
1cd86254fc9d8ed61c0254e9cbe97bfca83a03b0 | f85003dbd6ffb5c118e6d75adada61b882d1a11d | /framwork/src/main/java/com/bw/framwork/base/IView.java | db6e2ea1902710175b614d9c047a9c3fe44f4142 | [] | no_license | 3025077330/Invest | f4a9416464cf92eeadb6533d7ec6843e41d1206c | 34fb77f1c75baf9eafddd32c03016539d08ea8fc | refs/heads/master | 2023-01-06T08:09:36.738944 | 2020-11-02T10:25:43 | 2020-11-02T10:25:43 | 309,334,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.bw.framwork.base;
public interface IView {
void showLoading();
void hideLoading();
void showError(String code, String msg);
}
| [
"3025077330@qq.com"
] | 3025077330@qq.com |
c0e90bdae5d266c846eded1a0719bd8a88f50ffe | 4066b496a2afbd63b3baa56e2b68c658735b3b0a | /Servlet01/src/main/java/com/servlets/OneServlet.java | 17d9a186cadd097e194e944ad4eab1c792aedcfb | [] | no_license | TomSupreme/javaweb-sverlet | 0f33d99a42306083e4d8d463565c08a45c3d7909 | aad13c05790ee21218e92a7ccecf45187a6d766f | refs/heads/master | 2023-04-08T11:11:26.936572 | 2021-04-19T17:17:35 | 2021-04-19T17:17:35 | 358,938,509 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package com.servlets;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
* @author supreme
*/
public class OneServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.print("wo love you!");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
}
}
| [
"517474276@qq.com"
] | 517474276@qq.com |
3dfc624178e2cf58435c775c08c22ede9373f00f | 44dbe149fed41ef7d3549963023459f63eeed11c | /src/main/java/cn/contract/factory/JAXBFactory.java | 748608afe211b6cb102385c5bdb247497843942d | [] | no_license | cloud915/SpringMVC | 2de89fc843f465646c0123fb7ebfa51a681235b6 | d2a5c64ae432a88b5316ec23b1031c3930044067 | refs/heads/master | 2021-01-23T04:39:55.959583 | 2017-06-21T10:29:32 | 2017-06-21T10:29:32 | 92,936,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package cn.contract.factory;
import cn.contract.ota.ctrip.ari.OTAHotelAvailNotifRQ;
import cn.contract.ota.ctrip.ari.OTAHotelRateAmountNotifRQ;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
public class JAXBFactory {
//private static final Logger log = LoggerFactory.getLogger(JAXBFactory.class);
//private static final NormalLog log = NormalLog.getInstance();
private JAXBContext jc;
private JAXBFactory() {
}
public static JAXBFactory getInstance() {
return SingletonHolder.instance;
}
public void init() {
Class<?>[] clazz = {
OTAHotelRateAmountNotifRQ.class, OTAHotelAvailNotifRQ.class,
};
try {
jc = JAXBContext.newInstance(clazz);
} catch (JAXBException e) {
//log.error("JAXBFactory.init error", e);
}
}
public Unmarshaller getUnmarshaller() throws JAXBException {
return jc.createUnmarshaller();
}
public Marshaller getMarshaller() throws JAXBException {
Marshaller marshaller = jc.createMarshaller();
// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
return marshaller;
}
private static class SingletonHolder {
private static final JAXBFactory instance = new JAXBFactory();
}
}
| [
"hygeng@jointwisdom.com"
] | hygeng@jointwisdom.com |
625fff17513eebd859206f5a51a097da6a03b13e | 5620e9708596e2efdaa24c00b178207593694a56 | /app/src/main/java/com/marcoburgos/gobite/DominosEntradas_MC.java | 4c9158d81a5eed9e012d888c828d3e8a019b819d | [] | no_license | MarcoBurgos/GoBite | 1e9712ee3bceb437a081654ef3cef281396b9283 | a1605f7e15aa003aec58f137c5422031f86bbd6f | refs/heads/master | 2021-01-23T16:18:26.994280 | 2017-10-04T18:34:57 | 2017-10-04T18:34:57 | 93,290,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package com.marcoburgos.gobite;
/**
* Created by marcoburgos on 01/05/17.
*/
public class DominosEntradas_MC {
private int imagen_entrada;
private String nombre_entrada;
private String descripcion_entrada;
private String precio_entrada;
//private Button boton_OrdenarHamburgesa;
public DominosEntradas_MC(int imagen_entrada, String nombre_entrada, String descripcion_entrada, String precio_entrada) {
this.imagen_entrada = imagen_entrada;
this.nombre_entrada = nombre_entrada;
this.descripcion_entrada = descripcion_entrada;
this.precio_entrada = precio_entrada;
//this.boton_OrdenarHamburgesa = boton_OrdenarHamburgesa;
}
public int getImagen_entrada() {
return imagen_entrada;
}
public String getNombre_entrada() {
return nombre_entrada;
}
public String getDescripcion_entrada() {
return descripcion_entrada;
}
public String getPrecio_entrada() { return precio_entrada; }
//public Button getBoton_OrdenarHamburgesa() { return boton_OrdenarHamburgesa; }
}
| [
"marcoburgos@MacBook-Pro-de-Marco.local"
] | marcoburgos@MacBook-Pro-de-Marco.local |
06288818a345c0f26db96b3c6a999e01c8a9b202 | 396665df0071704c922a2d0b34d724b04d3edf7d | /src/main/java/ipstore/controller/ReportController.java | 988f5dad250fdb05b597b3a37736e15765d3c345 | [] | no_license | karlovskiy/ipstore | 8dc05f1ba66257e59b183fd5cbbf6900c73c3dda | 5cc48b3435b667d9794357ffdecd119ffec00211 | refs/heads/master | 2021-03-12T19:34:55.383440 | 2014-12-05T21:37:38 | 2014-12-05T21:37:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,872 | java | package ipstore.controller;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import ipstore.aspect.Action;
import ipstore.entity.Account;
import ipstore.entity.CommunigateDomain;
import ipstore.entity.Equipment;
import ipstore.service.AccountsService;
import ipstore.service.CommunigateService;
import ipstore.service.EquipmentService;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static ipstore.aspect.ActionType.ACCOUNTS_EXPORT;
import static ipstore.aspect.ActionType.EQUIPMENT_EXPORT;
import static ipstore.aspect.ActionType.COMMUNIGATE_EXPORT;
/**
* Here will be javadoc
*
* @author karlovsky
* @since 1.0
*/
@Controller
public class ReportController {
@Resource(name = "equipmentService")
private EquipmentService equipmentService;
@Resource(name = "accountsService")
private AccountsService accountsService;
@Resource(name = "communigateService")
private CommunigateService communigateService;
@Action(value = EQUIPMENT_EXPORT)
@RequestMapping(value = "/equipment/export", method = RequestMethod.GET)
public ModelAndView loadEquipmentReport() {
Map<String, Object> parameterMap = new HashMap<String, Object>();
List<Equipment> equipments = equipmentService.loadEquipments();
JRDataSource jrDataSource = new JRBeanCollectionDataSource(equipments);
parameterMap.put("datasource", jrDataSource);
return new ModelAndView("equipmentReport", parameterMap);
}
@Action(value = ACCOUNTS_EXPORT)
@RequestMapping(value = "/accounts/export", method = RequestMethod.GET)
public ModelAndView loadAccountsReport() {
Map<String, Object> parameterMap = new HashMap<String, Object>();
List<Account> accounts = accountsService.loadAccounts();
JRDataSource jrDataSource = new JRBeanCollectionDataSource(accounts);
parameterMap.put("datasource", jrDataSource);
return new ModelAndView("accountsReport", parameterMap);
}
@Action(value = COMMUNIGATE_EXPORT)
@RequestMapping(value = "/communigate/export", method = RequestMethod.GET)
public ModelAndView loadCommunigateReport() {
Map<String, Object> parameterMap = new HashMap<String, Object>();
List<CommunigateDomain> communigateDomains = communigateService.loadCommunigate();
JRDataSource jrDataSource = new JRBeanCollectionDataSource(communigateDomains);
parameterMap.put("datasource", jrDataSource);
return new ModelAndView("communigateReport", parameterMap);
}
}
| [
"yexella@gmail.com"
] | yexella@gmail.com |
049f39fb0a4742464a626d1871f1d4d7f845d7d5 | 6c1b6b38cc287c0887184c6fa60e0e4f84efa472 | /src/Main.java | 6da75ed5732bd32ebb14b235179d722472a42f7e | [] | no_license | cardiffc/imageresizer | 36551906aba19aff0db5d61fb3a5a7f92710956c | fab3beadd8187c8136080b3011ee6ebfe552c4d8 | refs/heads/master | 2020-10-02T02:41:59.384357 | 2019-12-16T05:32:33 | 2019-12-16T05:32:33 | 227,682,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | import java.io.File;
public class Main
{
private static int newWidth = 300;
private static String srcFolder = "/home/cardiff/VIDEOS/G9";
private static String dstFolder = "/home/cardiff/VIDEOS/dst";
public static void main(String[] args)
{
File srcDir = new File(srcFolder);
File[] files = srcDir.listFiles();
int vCPUCount = Runtime.getRuntime().availableProcessors() / 2; // Кол-во CPU доступных JVM. /2 в силу HT
int filesInThread = files.length / vCPUCount;
int srcFromIndex = 0;
for (int i = 0; i < vCPUCount ; i++) {
filesInThread = (i < vCPUCount - 1) ? filesInThread : filesInThread + (files.length % vCPUCount);
File[] files1 = new File[filesInThread];
System.arraycopy(files, srcFromIndex, files1,0,filesInThread);
Resizer resizer = new Resizer(files1,newWidth, dstFolder);
resizer.start();
srcFromIndex += filesInThread;
}
}
}
| [
"cardiffc@yandex.ru"
] | cardiffc@yandex.ru |
8b8bd52416349b46054adad1e35dd33ee2441660 | 5e8056fb5357510c0027cc5f1b8d4d97f1b2cb44 | /src/ch/blobber/database/WalletDatabase.java | 672256e10bea2715c6b6a1fe663e35738961329b | [] | no_license | Alone2/Blobdoge | 9509baa2486672f9530693ce7fbc55c83390200e | 8826b8e60144192cd7c0601d638fd29444d1baec | refs/heads/master | 2022-04-22T20:27:23.674744 | 2020-04-27T19:16:44 | 2020-04-27T19:16:44 | 199,177,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,538 | java | package ch.blobber.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.json.JSONArray;
import org.json.JSONObject;
public class WalletDatabase extends Database {
/*
* CREATE TABLE walletTable( id INT AUTO_INCREMENT, originUserId INT, balance
* BIGINT, url VARCHAR(255), isDone BOOL, claimedBy VARCHAR(100), PRIMARY KEY(id));
*/
public String createURL(int userId, float amount) throws SQLException {
String url = generateURL(20);
String sql = "INSERT INTO walletTable (originUserId, balance, url, isDone) VALUES (?,?,?,?);";
PreparedStatement st;
st = con.prepareStatement(sql);
st.setInt(1, userId);
st.setFloat(2, amount);
st.setString(3, url);
st.setInt(4, 0);
st.execute();
st.close();
return url;
}
public float getURLBalance(String url) throws SQLException {
String request = "SELECT balance FROM walletTable WHERE url=? AND isDone = 0;";
float balance = 0;
PreparedStatement st;
st = con.prepareStatement(request);
st.setString(1, url);
ResultSet rs = st.executeQuery();
while (rs.next()) {
balance = rs.getFloat("balance");
}
rs.close();
return balance;
}
public void lootURL(String url, String address) throws SQLException {
String sql = "UPDATE walletTable SET isDone = ?, balance = ?, claimedBy = ? WHERE url = ? ;";
PreparedStatement st;
st = con.prepareStatement(sql);
st.setFloat(1, 1);
st.setFloat(2, 0);
st.setString(3, address);
st.setString(4, url);
st.execute();
st.close();
}
public JSONArray getCreatedByUser(int userId) throws Exception {
String request = "SELECT url FROM walletTable WHERE originUserId=? AND isDone = 0;";
JSONArray output = new JSONArray();
PreparedStatement st;
st = con.prepareStatement(request);
st.setInt(1, userId);
ResultSet rs = st.executeQuery();
while (rs.next()) {
output.put(rs.getString("url"));
}
rs.close();
return output;
}
private String generateURL(int size) throws SQLException {
// Generate a token
String output = randomLetters(size);
// Test if token already exists
String sql = "SELECT COUNT(url) FROM walletTable WHERE url= ? ;";
PreparedStatement st;
st = con.prepareStatement(sql);
st.setString(1, output);
ResultSet rs = st.executeQuery();
int i = 0;
while (rs.next()) {
i = rs.getInt(1);
}
rs.close();
if (i > 0)
return generateURL(size);
return output;
}
}
| [
"alain.sinzig@gmail.com"
] | alain.sinzig@gmail.com |
04fa43e8e6bc258f802e521daba81e7fdacbfab8 | f1cc94fd01b42f14ec0e13429381f29a85ec571f | /zuihou-backend/zuihou-file/zuihou-file-biz/src/main/java/com/github/zuihou/file/dao/ShareFileMapper.java | c1288633045b7c648532f791be34ec3966870174 | [
"Apache-2.0"
] | permissive | yuanxiaochao/yuanchao | 5b296adab08b6aab493b28ea9395f78ba6449c2c | d854e36f04af051d12eb5564396ded5d2e03bde0 | refs/heads/master | 2022-07-09T12:44:38.834151 | 2019-08-02T02:56:28 | 2019-08-02T02:56:28 | 137,156,200 | 0 | 0 | Apache-2.0 | 2022-06-21T04:10:30 | 2018-06-13T03:13:07 | Java | UTF-8 | Java | false | false | 792 | java | package com.github.zuihou.file.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.zuihou.file.dto.ShareFileDTO;
import com.github.zuihou.file.dto.SharePageDTO;
import com.github.zuihou.file.entity.ShareFile;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* 分享文件表
* </p>
*
* @author zuihou
* @date 2019-06-24
*/
@Repository
public interface ShareFileMapper extends BaseMapper<ShareFile> {
/**
* 自定义分页
*
* @param page
* @param data
* @return
* @author zuihou
* @date 2019-05-08 09:18
*/
IPage<ShareFileDTO> page(IPage page, @Param("data") SharePageDTO data);
}
| [
"git@github.com:yuanxiaochao/yuanchao.git"
] | git@github.com:yuanxiaochao/yuanchao.git |
39c660b25ec1be4afa8797dd04bb7f5f0c9efa0a | a5e19b3a73abc08ad5cc48430bac6183bafc3a27 | /app/src/test/java/com/fei/iteratordemo/IHandler.java | a411d836727c2310a863b2f04a996ede37e60ea5 | [] | no_license | fei11111/IteratorDemo | dfce06597ce12396863480968956275774febb4b | db43d098c3fe238de967d07188ef6492ab9f2af0 | refs/heads/main | 2023-03-12T10:16:49.897184 | 2021-02-24T03:26:58 | 2021-02-24T03:26:58 | 341,499,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.fei.iteratordemo;
/**
* @ClassName: IHandler
* @Description: 责任链设计模式
* @Author: Fei
* @CreateDate: 2021/2/24 9:46
* @UpdateUser: Fei
* @UpdateDate: 2021/2/24 9:46
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
public interface IHandler<T extends IHandler> {
public T getNextHandler();
}
| [
"455842151@qq.com"
] | 455842151@qq.com |
b62e2b99fb1f1ea4cef08ce9beb889c8d930d15b | a6d8b1662bf4c8a01ec7f2fafd58d85059d8c2f7 | /src/main/java/org/panda/misc/causalpath/CausalPathFormatHelper.java | c52c1ff8dcf9b728c698f77c5e2d01f17412e4a3 | [] | no_license | PathwayAndDataAnalysis/misc | 216714baf8b091c97cbc6a18643040804ba98d6c | 6b137cb4eabc596b2c9419c26893824a623c6c63 | refs/heads/master | 2021-11-09T06:18:40.026805 | 2021-09-10T02:22:06 | 2021-09-10T02:22:06 | 49,237,102 | 0 | 0 | null | 2021-04-26T19:20:52 | 2016-01-07T23:28:49 | Java | UTF-8 | Java | false | false | 5,957 | java | package org.panda.misc.causalpath;
import org.panda.resource.OncoKB;
import org.panda.resource.siteeffect.SiteEffectCollective;
import org.panda.resource.siteeffect.Feature;
import org.panda.utility.ArrayUtil;
import org.panda.utility.FileUtil;
import org.panda.utility.ValToColor;
import java.awt.*;
import java.io.BufferedWriter;
import java.nio.file.Files;
import java.util.*;
import java.util.List;
public class CausalPathFormatHelper
{
public static void main(String[] args)
{
// String dir = "/Users/ozgun/Documents/Analyses/CPTAC-PanCan/";
//
// List<String> lines = getFormatLinesAdjSignedP(new HashSet<>(Arrays.asList("CDK1", "CDK2", "RB1")), dir + "prot-data-diffexp.txt",
// dir + "rna-data-diffexp.txt", "ID", "Symbols", "Sites", "Modification",
// "Effect", "24", 0.1);
//
// lines.forEach(System.out::println);
String dir = "/Users/ozgun/Documents/Analyses/WilliamGrey/";
extractSymbols(dir + "causative.format", dir + "symbols.txt");
}
public static List<String> getFormatLinesAdjSignedP(Set<String> genes, String proteinData, String rnaData,
String idCol, String genesCol, String sitesCol, String modCol, String effectCol, String pCol, double sigThr)
{
String[] pHeader = FileUtil.readHeader(proteinData);
String[] rHeader = FileUtil.readHeader(rnaData);
return getFormatLines(genes, proteinData, rnaData,
row -> row[ArrayUtil.indexOf(pHeader, idCol)],
row -> row[ArrayUtil.indexOf(pHeader, genesCol)],
row -> row[ArrayUtil.indexOf(pHeader, sitesCol)],
row -> row[ArrayUtil.indexOf(pHeader, modCol)],
row -> row[ArrayUtil.indexOf(pHeader, effectCol)],
new SignedPValSelect(ArrayUtil.indexOf(pHeader, pCol), sigThr),
new SignedPValSelect(ArrayUtil.indexOf(rHeader, pCol), sigThr),
new SignedPValChange(ArrayUtil.indexOf(pHeader, pCol)),
new SignedPValChange(ArrayUtil.indexOf(rHeader, pCol)));
}
public static List<String> getFormatLines(Set<String> genes, String proteinData, String rnaData,
CellReader idReader, CellReader genesReader, CellReader sitesReader, CellReader modReader, CellReader effectReader,
Selector pSelector, Selector rSelector, Change pChange, Change rChange)
{
List<String> lines = new ArrayList<>();
ValToColor vtc = new ValToColor(new double[]{-10, 0, 10},
new Color[]{new Color(40, 80, 255), Color.WHITE, new Color(255, 80, 40)});
SiteEffectCollective sec = new SiteEffectCollective();
FileUtil.lines(proteinData).skip(1).map(l -> l.split("\t")).forEach(t ->
{
String gene = genesReader.read(t);
if (genes.contains(gene) && pSelector.select(t))
{
if (modReader.read(t).isEmpty())
{
lines.add("node\t" + gene + "\tcolor\t" + vtc.getColorInString(pChange.getChangeValue(t)));
}
else
{
String lett = modReader.read(t).toLowerCase();
String e = effectReader.read(t);
Integer effect = e.isEmpty() || e.equals("c") ? null : e.equals("a") ? 1 : -1;
if (effect == null)
{
effect = sec.getEffect(gene, Arrays.asList(sitesReader.read(t).split(";")),
Feature.getFeat(modReader.read(t)));
}
String bordColor = effect == null || effect == 0 ? "0 0 0" : effect == 1 ? "0 180 20" : "180 0 20";
lines.add("node\t" + gene + "\trppasite\t" + idReader.read(t) + "|" + lett + "|" +
vtc.getColorInString(pChange.getChangeValue(t)) + "|" + bordColor + "|" +
pChange.getChangeValue(t));
}
}
});
// FileUtil.lines(rnaData).skip(1).map(l -> l.split("\t")).forEach(t ->
// {
// if (genes.contains(t[0]) && rSelector.select(t))
// {
// lines.add("node\t" + t[0] + "\trppasite\t" + t[0] + "-rna|r|" +
// vtc.getColorInString(rChange.getChangeValue(t)) + "|0 0 0|" +
// rChange.getChangeValue(t));
// }
// });
return lines;
}
public static Set<String> getFormatLinesForOncogenicEffect(Set<String> genes)
{
Set<String> lines = new HashSet<>();
for (String gene : genes)
{
if (OncoKB.get().isCancerGene(gene))
{
if (OncoKB.get().isOncogeneOnly(gene))
{
lines.add("node\t" + gene + "\tbordercolor\t255 50 50");
}
else if (OncoKB.get().isTumorSuppressorOnly(gene))
{
lines.add("node\t" + gene + "\tbordercolor\t50 50 255");
}
else
{
lines.add("node\t" + gene + "\tbordercolor\t180 180 50");
}
}
}
return lines;
}
public interface CellReader
{
String read(String[] row);
}
public interface Selector
{
boolean select(String[] row);
}
public interface Change
{
double getChangeValue(String[] row);
}
/**
* A change detector for adjusted signed p-values
*/
static class SignedPValChange implements Change
{
int pIndex;
public SignedPValChange(int pIndex)
{
this.pIndex = pIndex;
}
@Override
public double getChangeValue(String[] row)
{
double v = row.length <= pIndex || row[pIndex].isEmpty() || row[pIndex].equals("NaN") || row[pIndex].equals("NA") ? Double.NaN : Double.valueOf(row[pIndex]);
int s = (int) Math.signum(v);
v = Math.abs(v);
v = -Math.log(v);
v *= s;
return v;
}
}
/**
* A selector for adjusted signed p-values
*/
static class SignedPValSelect implements Selector
{
int pIndex;
double thr;
public SignedPValSelect(int pIndex, double thr)
{
if (pIndex < 0)
{
System.out.println();
}
this.pIndex = pIndex;
this.thr = thr;
}
@Override
public boolean select(String[] row)
{
double v = row.length <= pIndex || row[pIndex].isEmpty() || row[pIndex].equals("NaN") || row[pIndex].equals("NA") ? Double.NaN : Double.valueOf(row[pIndex]);
v = Math.abs(v);
return v <= thr;
}
}
static void extractSymbols(String formatFile, String outSymbolFile)
{
BufferedWriter writer = FileUtil.newBufferedWriter(outSymbolFile);
FileUtil.linesTabbed(formatFile).filter(t -> t[0].equals("node") && !t[1].equals("all-nodes")).map(t -> t[1])
.distinct().forEach(sym -> FileUtil.writeln(sym, writer));
FileUtil.closeWriter(writer);
}
}
| [
"ozgunbabur@gmail.com"
] | ozgunbabur@gmail.com |
c511f8e0c01e8adb5b9b673544d94b8caa89fa6a | 54589e796ca76fd083d2b095bf284bc60920c672 | /grpc-shared/src/main/java/com/example/grpc/shared/MatrixException.java | caaacad0fe58b224133e5bd5366456c5214d8815 | [] | no_license | 4D1L/matrix-rest-rpc | c358ff9b07bc0e5dc5d51673273c32c58a22ecf7 | d48e952ccb4be71c826771e8505633591ba13dc6 | refs/heads/main | 2023-03-30T06:40:18.347710 | 2021-04-02T02:43:53 | 2021-04-02T02:43:53 | 353,587,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.example.grpc.shared;
public class MatrixException extends Exception {
private static final long serialVersionUID = 1L;
public MatrixException(String msg, Throwable err) {
super(msg, err);
}
public MatrixException(String msg) {
super(msg);
}
}
| [
"4D1L@users.noreply.github.com"
] | 4D1L@users.noreply.github.com |
ca5efab06a86fe64fb651154131344cc3e150805 | cb4d43765367fcd35fa6d497ca50c38096096b52 | /Tsest/src/Recursionfectorial.java | a82a1064de000171515ae457707b3208bf857efb | [] | no_license | PrabhakarGaddipati/Selenium-Projects | 3570fd48bbc2a130859049005a14a8399b00b7c4 | f5d8fc2b17829084c23616b524fb142028ac3ff8 | refs/heads/master | 2022-11-21T05:08:34.559868 | 2020-07-23T01:25:11 | 2020-07-23T01:25:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38 | java |
public class Recursionfectorial {
}
| [
"mohithsingh7@gmail.com"
] | mohithsingh7@gmail.com |
9272a50b5a4453ec42ddae69ffeef024b61e45ab | c3efac5e53bf9d053dbfb995f198b84cf67b5929 | /Animation/app/src/main/java/android/pig/com/animation/MainActivity.java | 5f05b726e8382974d821bd2530465d7c07daab04 | [] | no_license | lhlhlh111000/animation | f0ae8a3601838eabc322256927b642aa9f572d1a | 94f791423ea2d22657aadcbf3d4f6318537c8924 | refs/heads/master | 2020-06-14T18:09:48.225723 | 2016-12-02T01:26:39 | 2016-12-02T01:26:39 | 75,348,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,247 | java | package android.pig.com.animation;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.btn_animation_list).setOnClickListener(this);
findViewById(R.id.btn_animation_tweened).setOnClickListener(this);
findViewById(R.id.btn_animation_value).setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent = null;
switch(v.getId()) {
case R.id.btn_animation_list:
intent = new Intent(MainActivity.this, AnimationListActivity.class);
break;
case R.id.btn_animation_tweened:
intent = new Intent(MainActivity.this, TweenedActivity.class);
break;
case R.id.btn_animation_value:
intent = new Intent(MainActivity.this, ValueAnimActivity.class);
break;
}
startActivity(intent);
}
}
| [
"zhoulihua@taoqicar.com"
] | zhoulihua@taoqicar.com |
100753e78cbb977bfc61f747671f0445c4108131 | 1930d97ebfc352f45b8c25ef715af406783aabe2 | /src/main/java/com/alipay/api/response/KoubeiTradeTicketTicketcodeSyncResponse.java | bcc19e65f4bee6c35e5720afdb63368720a8c720 | [
"Apache-2.0"
] | permissive | WQmmm/alipay-sdk-java-all | 57974d199ee83518523e8d354dcdec0a9ce40a0c | 66af9219e5ca802cff963ab86b99aadc59cc09dd | refs/heads/master | 2023-06-28T03:54:17.577332 | 2021-08-02T10:05:10 | 2021-08-02T10:05:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | 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.AlipayResponse;
/**
* ALIPAY API: koubei.trade.ticket.ticketcode.sync response.
*
* @author auto create
* @since 1.0, 2020-07-31 15:05:46
*/
public class KoubeiTradeTicketTicketcodeSyncResponse extends AlipayResponse {
private static final long serialVersionUID = 3789299981596729479L;
/**
* 该字段用于描述本次返回中的业务属性,现有:BIZ_ALREADY_SUCCESS(幂等业务码)
*/
@ApiField("biz_code")
private String bizCode;
/**
* 凭证码所属的订单id
*/
@ApiField("order_no")
private String orderNo;
/**
* 外部请求号,支持英文字母和数字,由开发者自行定义(不允许重复)
*/
@ApiListField("request_id")
@ApiField("string")
private List<String> requestId;
public void setBizCode(String bizCode) {
this.bizCode = bizCode;
}
public String getBizCode( ) {
return this.bizCode;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOrderNo( ) {
return this.orderNo;
}
public void setRequestId(List<String> requestId) {
this.requestId = requestId;
}
public List<String> getRequestId( ) {
return this.requestId;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
705d625d55fe10c7650ace50eb0c841488305c35 | a65e0dd0d1baf61c7fc500d509f1ec6f8d626c6a | /src/lessonEnums/DiaSemanaConstantes.java | 0541ce08497c004f0b84f442c1ee3c5270d1bc21 | [] | no_license | jonaspaivadeveloper/LoianeCourse | 8e1847455a3e1deeddab8ed675dce9de131d2f3d | 4aef89228ffcf93752f590812766f83cf382b53d | refs/heads/main | 2023-06-18T03:36:47.433539 | 2021-07-13T05:20:41 | 2021-07-13T05:20:41 | 382,494,449 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 626 | java | package lessonEnums;
public class DiaSemanaConstantes {
//declarar constantes referente aos dias da semana!
public static final int SEGUNDA = 1;
//Onde final indica que a constante não pode ser modificada
//public static é para faciltar a chamada da constante utilizando o ponto(dot) e não instanciar!
public static final int TERCA = 2;
public static final int QUARTA = 3;
public static final int QUINTA = 4;
public static final int SEXTA = 5;
public static final int SABADO = 6;
public static final int DOMINGO = 7;
//OBS:Essa classe é chamada pelas constantes na classe Test!
}
| [
"JonasSilvadePaivaDeveloper@gmail.com"
] | JonasSilvadePaivaDeveloper@gmail.com |
62c24efc8bfeb9a1fe5dbe03d960a30e38a4f450 | 6e0148f4d0b364502b4d8aacc104a6dfb0f140ca | /Laboratorinis7/src/laboratorinis7/Expenses.java | 28699cf3b17816167d5d9cc96367535ab9516791 | [] | no_license | Lezas/JavaProgramavimas | e774ad0ffc9d52efb3e9bf7fdcfbfc54f683293e | 589199e9a36a5a1acb32fd9effad13d3ceda932f | refs/heads/master | 2021-01-10T16:55:44.869207 | 2016-01-02T13:35:24 | 2016-01-02T13:35:24 | 44,982,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,981 | 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 laboratorinis7;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
/**
*
* @author Vartotojas
*/
@Entity
@Table(name = "EXPENSES")
@NamedQueries({
@NamedQuery(name = "Expenses.findAll", query = "SELECT e FROM Expenses e"),
@NamedQuery(name = "Expenses.findById", query = "SELECT e FROM Expenses e WHERE e.id = :id"),
@NamedQuery(name = "Expenses.findByTitle", query = "SELECT e FROM Expenses e WHERE e.title = :title"),
@NamedQuery(name = "Expenses.findByDescription", query = "SELECT e FROM Expenses e WHERE e.description = :description"),
@NamedQuery(name = "Expenses.findByDatetime", query = "SELECT e FROM Expenses e WHERE e.datetime = :datetime")})
public class Expenses implements Serializable {
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "MONEY")
private BigDecimal money;
@Transient
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Column(name = "TITLE")
private String title;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "DATETIME")
@Temporal(TemporalType.TIMESTAMP)
private Date datetime;
@JoinColumn(name = "TAXUSER", referencedColumnName = "ID")
@ManyToOne
private Taxuser taxuser;
public Expenses() {
}
public Expenses(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
Integer oldId = this.id;
this.id = id;
changeSupport.firePropertyChange("id", oldId, id);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
String oldTitle = this.title;
this.title = title;
changeSupport.firePropertyChange("title", oldTitle, title);
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
String oldDescription = this.description;
this.description = description;
changeSupport.firePropertyChange("description", oldDescription, description);
}
public Date getDatetime() {
return datetime;
}
public void setDatetime(Date datetime) {
Date oldDatetime = this.datetime;
this.datetime = datetime;
changeSupport.firePropertyChange("datetime", oldDatetime, datetime);
}
public Taxuser getTaxuser() {
return taxuser;
}
public void setTaxuser(Taxuser taxuser) {
Taxuser oldTaxuser = this.taxuser;
this.taxuser = taxuser;
changeSupport.firePropertyChange("taxuser", oldTaxuser, taxuser);
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Expenses)) {
return false;
}
Expenses other = (Expenses) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "laboratorinis7.Expenses[ id=" + id + " ]";
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
changeSupport.addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(listener);
}
public BigDecimal getMoney() {
return money;
}
public void setMoney(BigDecimal money) {
BigDecimal oldMoney = this.money;
this.money = money;
changeSupport.firePropertyChange("money", oldMoney, money);
}
}
| [
"pkupetis6@gmail.com"
] | pkupetis6@gmail.com |
2df613edc43e3eb1c11d88810a897c6f436c0089 | b7f56af52a8e8dc3005dc1a1901b29710715590c | /src/gui/prikaz/FilmForma.java | 66ed3a15863fd818fea8da93d69b1aca00568e33 | [] | no_license | StankovicMarko/intro-oop | 17abef7987e379565b0b2ae47315e2a2977b165c | 576e7f818db80e34fbfa4fbf9875a6438e505707 | refs/heads/master | 2021-01-15T16:53:08.090128 | 2017-08-08T20:50:00 | 2017-08-08T20:50:00 | 99,733,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,663 | java | package gui.prikaz;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JToolBar;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import filmovi.Film;
import filmovi.Primerak;
import gui.dodavanje.FilmDodavanjeDialog;
import gui.obrisani.FilmObrisani;
import videoteka.Videoteka;
public class FilmForma extends JFrame{
private JToolBar mainToolbar;
private JButton btnAdd;
private JButton btnEdit;
private JButton btnDelete;
private JButton btnObrisani;
private JScrollPane tableScroll;
private JTable filmoviTabela;
private Videoteka videoteka;
public FilmForma(Videoteka videoteka) {
this.videoteka = videoteka;
setTitle("Prikaz Filmova");
setSize(700, 500);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
initGUI();
initActions();
}
private void initGUI() {
mainToolbar = new JToolBar();
ImageIcon iconAdd = new ImageIcon(getClass().getResource("/slike/add.gif"));
btnAdd = new JButton(iconAdd);
mainToolbar.add(btnAdd);
ImageIcon editIcon = new ImageIcon(getClass().getResource("/slike/edit.gif"));
btnEdit = new JButton(editIcon);
mainToolbar.add(btnEdit);
ImageIcon deleteIcon = new ImageIcon(getClass().getResource("/slike/remove.gif"));
btnDelete = new JButton(deleteIcon);
mainToolbar.add(btnDelete);
btnObrisani = new JButton("Prikaz obrisanih");
mainToolbar.add(btnObrisani);
add(mainToolbar, BorderLayout.NORTH);
String[] zaglavlja = new String[] {"Srpski naslov", "Original naslov",
"Godina izdanja", "Zanr",
"Reziser", "Opis", "Trajanje"};
int brojFilm = 0;
for (Film fi : videoteka.getFilmovi()) {
if( fi.isObrisan() == false){
brojFilm++;
}
}
Object[][] podaci = new Object[brojFilm]
[zaglavlja.length];
int j =0;
for(int i=0; i<this.videoteka.getFilmovi().size(); i++) {
Film film= this.videoteka.getFilmovi().get(i);
if(film.isObrisan() == false){
podaci[j][0] = film.getNaslovSRB();
podaci[j][1] = film.getNaslovOriginal();
podaci[j][2] = film.getGodinaIzdanja();
podaci[j][3] = film.getZanr().getNaziv();
podaci[j][4] = film.getImePrezimeRezisera();
podaci[j][5] = film.getOpis();
podaci[j][6] = film.getTrajanje();
j++;
}
}
j=0;
DefaultTableModel model = new DefaultTableModel(podaci, zaglavlja);
filmoviTabela = new JTable(model);
filmoviTabela.setColumnSelectionAllowed(false);
filmoviTabela.setRowSelectionAllowed(true);
filmoviTabela.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
filmoviTabela.setDefaultEditor(Object.class, null);
tableScroll = new JScrollPane(filmoviTabela);
add(tableScroll, BorderLayout.CENTER);
}
public JTable getFilmTabela() {
return filmoviTabela;
}
private void initActions() {
btnDelete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int selektovaniRed = FilmForma.this.filmoviTabela.getSelectedRow();
if(selektovaniRed == -1) {
JOptionPane.showMessageDialog(null, "Morate selektovati film.");
}else {
int izbor = JOptionPane.showConfirmDialog(null, "Da li ste sigurni",
"Brisanje filma", JOptionPane.YES_NO_OPTION);
if(izbor == JOptionPane.YES_OPTION) {
String nazivSrpski = (String)
FilmForma.this.filmoviTabela.getValueAt(selektovaniRed, 0);
Film film = FilmForma.this.videoteka.pronadjiFilm(nazivSrpski);
// boolean flag = false;
// for (Primerak prim: videoteka.getPrimerci()) {
// if(prim.getFilm().getNaslovSRB().equals(nazivSrpski)){
// JOptionPane.showMessageDialog(null, "Ne mozete obrisati film koji se nalazi na primercima");
// flag = true;
// break;
//
// }
// }
// if(!flag){
DefaultTableModel model = (DefaultTableModel)
FilmForma.this.filmoviTabela.getModel();
film.setObrisan(true);
//FilmForma.this.videoteka.getFilmovi().remove(film);
FilmForma.this.videoteka.sacuvajFilmove();;
model.removeRow(selektovaniRed);
//}
}
}
}
});
btnAdd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FilmDodavanjeDialog fdd = new FilmDodavanjeDialog(
FilmForma.this.videoteka,
null,
FilmForma.this);
fdd.setVisible(true);
}
});
btnEdit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int selektovaniRed = FilmForma.this.filmoviTabela.getSelectedRow();
if(selektovaniRed == -1) {
JOptionPane.showMessageDialog(null,
"Morate odabrati clana u tabeli.");
}else {
String nazivSrpski = (String)
FilmForma.this.filmoviTabela.getValueAt(selektovaniRed, 0);
Film film= FilmForma.this.videoteka.pronadjiFilm(nazivSrpski);
FilmDodavanjeDialog fdd = new FilmDodavanjeDialog(
FilmForma.this.videoteka,
film,
FilmForma.this);
fdd.setVisible(true);
}
}
});
btnObrisani.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
FilmObrisani fo = new FilmObrisani(
FilmForma.this.videoteka);
fo.setVisible(true);
}
});
}
}
| [
"stane-sm@hotmail.com"
] | stane-sm@hotmail.com |
bcb48f1698b3c7c8cd35348d6886873179c99824 | 351e2d2867897b84e923cf763b215097b28d95b2 | /src/test/java/ses/teamsbackend/TeamsBackendApplicationTests.java | 70067ed66b59f4f907b5c6555801549d8015c2c6 | [] | no_license | kamrul91111/teams-backend | bedc4e9b2fcd4a2b1368ae89072fb341106eb1a1 | 559e777f33b0bcde6e8ebefb01df557c2f42292e | refs/heads/master | 2022-06-01T22:27:18.197900 | 2020-04-19T03:54:10 | 2020-04-19T03:54:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package ses.teamsbackend;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TeamsBackendApplicationTests {
@Test
void contextLoads() {
}
}
| [
"sebastian.southern@gmail.com"
] | sebastian.southern@gmail.com |
3c71dfaa23a23622fcb59ac14eecf0fd592c8c96 | 8c9b3652eb616cb51ce9f33974468e2dd9ab1338 | /BigInsight/src/com/ylj/biginsight/fragment/TiesFragment.java | 454936357994fba0ff38e2082d78ab86fe1d0d0f | [] | no_license | jerryyao-jy/BigIn | f5884fe7896194a8b1ef384e609ebb500354e07c | 84232e4dddeb7a20ddd88d140c2a4552e1fa5d2e | refs/heads/master | 2020-05-02T11:32:01.950521 | 2014-12-20T14:11:17 | 2014-12-20T14:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.ylj.biginsight.fragment;
import com.ylj.biginsight.activity.R;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class TiesFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_menuitem_ties, null);
return view;
}
}
| [
"jerry.yao@missionsky.com"
] | jerry.yao@missionsky.com |
3bbd1ec9e99c87169412d5036844d8050c562493 | 4c088e99896ad5f4a18170cf4ec8c658990d52b3 | /cloud/cloud-consumer-order/src/main/java/com/gapache/cloud/order/controller/OrderController.java | f84962de0f16ec0fd3ae2e0ac036e7af9c5d848e | [] | no_license | IsSenHu/big-plan2 | 58913a6e79f60cfc89872045f79d1bc2ab438717 | 6da18146de6fca010dcd80a18132cf78cba92c73 | refs/heads/main | 2023-03-28T09:44:36.765175 | 2021-03-30T06:33:08 | 2021-03-30T06:33:08 | 338,036,595 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,452 | java | package com.gapache.cloud.order.controller;
import com.gapache.cloud.sdk.PaymentVO;
import com.gapache.commons.model.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author HuSen
* create on 2020/6/3 00:10
*/
@Slf4j
@RestController
@RequestMapping("/api/order")
public class OrderController {
private static final String PAYMENT = "http://CLOUD-PAYMENT-SERVICE";
private final RestTemplate restTemplate;
private final DiscoveryClient discoveryClient;
private final AtomicInteger invokeTimes = new AtomicInteger(0);
public OrderController(RestTemplate restTemplate, DiscoveryClient discoveryClient) {
this.restTemplate = restTemplate;
this.discoveryClient = discoveryClient;
}
@GetMapping("/payment/create")
public JsonResult create(PaymentVO payment) {
return restTemplate.postForEntity(PAYMENT.concat("/api/payment"), payment, JsonResult.class).getBody();
}
@GetMapping("/payment/get/{id}")
public JsonResult get(@PathVariable Long id) {
return restTemplate.getForEntity(PAYMENT.concat("/api/payment/".concat(id.toString())), JsonResult.class).getBody();
}
@GetMapping("/testLoadBalance")
public JsonResult<Integer> testLoadBalance() {
String server = getServer();
log.info(server);
Integer body = restTemplate.getForEntity(server.concat("/api/payment/getPort"), Integer.class).getBody();
return JsonResult.of(body);
}
private String getServer() {
List<ServiceInstance> instances = discoveryClient.getInstances("CLOUD-PAYMENT-SERVICE");
int current;
int next;
do {
current = invokeTimes.get();
next = current == Integer.MAX_VALUE ? 0 : current + 1;
} while (!invokeTimes.compareAndSet(current, next));
ServiceInstance serviceInstance = instances.get(next % instances.size());
return serviceInstance.getUri().toString();
}
}
| [
"1178515826@qq.com"
] | 1178515826@qq.com |
abf55bef7328c11f2addf62debe1f976ea9c7a6e | 783330ffbc0859a6811a7992f3691855689a2f8e | /app/src/test/java/com/example/androidnangcao_asm_ps13304_dangthanhdanh/ExampleUnitTest.java | 7623dbfdd08958f067796d22bbb861e33cda907c | [] | no_license | ThanhDanhhh/ASM-AndroidNangCao | c44bcb9b846a698e122083542e83f9ec3f04f683 | 14411a9cb2192035fd3f7b6eb331eee89638e397 | refs/heads/main | 2023-08-04T12:04:48.911333 | 2021-09-14T16:39:27 | 2021-09-14T16:39:27 | 406,447,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.example.androidnangcao_asm_ps13304_dangthanhdanh;
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);
}
} | [
"danhdtps13304@fpt.edu.vn"
] | danhdtps13304@fpt.edu.vn |
f8fbae41d413c19d94050dd7905a55e68b12c9dd | e3d6aafb317bc0668d71f6eb857566d925875263 | /src/main/java/com/stackroute/MuzixRestfulService/service/TrackService.java | c964027222ac05b0be014183b808fc1d3552c782 | [] | no_license | arathimmj/Muzix | f9eb733df25d258a26e1116c57f49ecfc8009a49 | bb9f0e1616ae25dde51daa38323b46857fc4a950 | refs/heads/master | 2022-07-07T12:21:21.741995 | 2019-05-27T12:54:58 | 2019-05-27T12:54:58 | 188,359,891 | 0 | 0 | null | 2022-06-21T01:09:46 | 2019-05-24T05:47:24 | Java | UTF-8 | Java | false | false | 728 | java | package com.stackroute.MuzixRestfulService.service;
import com.stackroute.MuzixRestfulService.domain.Track;
import com.stackroute.MuzixRestfulService.exceptions.TrackAlreadyExistsException;
import com.stackroute.MuzixRestfulService.exceptions.TrackNotFoundException;
import java.util.List;
import java.util.Optional;
public interface TrackService {
public void seedData(Track track);
public Track saveTrack(Track track) throws TrackAlreadyExistsException;
public List<Track> getAllTracks();
public Optional<Track> getTracksById(int id);
public List<Track> getTracksByName(String name);
public void deleteTrack(Track track);
public void update(Track track) throws TrackNotFoundException;
}
| [
"mj.arathi@gmail.com"
] | mj.arathi@gmail.com |
eb034bc901d6ad320c62613e3cf1badcb49ce5dd | bc9a604bb0951cca090d44a35633ca8b90d3bf0b | /src/chatproject/ChatServer.java | 45fede68531bcd1260e656d1fdb172f58c59ef85 | [] | no_license | ramyakchina/Chat-Project---Socket-Programming | 9977b027952a483473440685a6db73823a659557 | f0891e34d7d3219ca8e17a10c10ccd954b88554f | refs/heads/master | 2021-06-10T18:33:18.443333 | 2017-02-10T22:58:02 | 2017-02-10T22:58:02 | 70,954,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,023 | 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 chatproject;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JList;
/**
*
* @author Ramya
*/
public class ChatServer extends JFrame implements ChatConstants {
public ChatServer() {
DefaultListModel model = new DefaultListModel();
JList list = new JList(model);
add(list);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 300);
setTitle("ChatServer");
setVisible(true);
try {
ServerSocket serverSocket = new ServerSocket(8000);
int sessionNo = 1;
while (true) {
model.addElement("Wait for players to join session " + sessionNo);
Socket person1 = serverSocket.accept();
model.addElement("Person 1 joined session " + sessionNo);
model.addElement("Person 1's IP address" + person1.getInetAddress().getHostAddress());
new DataOutputStream(person1.getOutputStream()).writeInt(PERSON1);
Socket person2 = serverSocket.accept();
model.addElement("Person 2 joined session " + sessionNo);
model.addElement("Person 2's IP address" + person2.getInetAddress().getHostAddress());
new DataOutputStream(person2.getOutputStream()).writeInt(PERSON2);
model.addElement("Start a thread for session " + sessionNo++);
HandleASession task = new HandleASession(person1, person2);
new Thread(task).start();
}
} catch (IOException e) {
System.err.println(e);
}
}
}
class HandleASession implements Runnable {
Socket person1;
Socket person2;
public HandleASession(Socket person1, Socket person2) {
this.person1 = person1;
this.person2 = person2;
}
public void run() {
try {
DataInputStream fromPerson1 = new DataInputStream(person1.getInputStream());
DataOutputStream toPerson1 = new DataOutputStream(person1.getOutputStream());
DataInputStream fromPerson2 = new DataInputStream(person2.getInputStream());
DataOutputStream toPerson2 = new DataOutputStream(person2.getOutputStream());
toPerson1.writeInt(1);
while (true) {
String msg = fromPerson1.readUTF();
toPerson2.writeUTF(msg);
msg = fromPerson2.readUTF();
toPerson1.writeUTF(msg);
}
} catch (IOException e) {
System.err.println(e);
}
}
public static void main(String[] args) {
ChatServer frame = new ChatServer();
}
}
| [
"ramya.reddi35@gmail.com"
] | ramya.reddi35@gmail.com |
74bf80314199c4b786de4e2af1776b97a74e34ef | 243eedc0aa0de450c3a712cc0b80fc4dcec53b1e | /src/test/java/com/nowcoder/community/QuartzTest.java | 062d34753e1f932c2599606431f80e8832310563 | [] | no_license | pengkangzaia/community | a05eb48968893e11ec273846abe1604abc105968 | 1f47c9c31cc3f705e8b9b37768cab926a234d47a | refs/heads/master | 2022-07-06T15:30:55.640324 | 2020-05-06T12:44:56 | 2020-05-06T12:44:56 | 254,253,825 | 0 | 0 | null | 2022-06-21T03:10:17 | 2020-04-09T02:41:10 | Java | UTF-8 | Java | false | false | 895 | java | package com.nowcoder.community;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = CommunityApplication.class)
public class QuartzTest {
@Autowired
private Scheduler scheduler;
@Test
public void testDeleteJob() {
try {
scheduler.deleteJob(new JobKey("alphaJob", "alphaJobGroup"));
} catch (SchedulerException e) {
e.printStackTrace();
}
}
}
| [
"pengkangzaia@foxmail.com"
] | pengkangzaia@foxmail.com |
15c804f413924b30b96d680579ab8560027faa4e | 5bd34d691ed9033f610df6f329f7b64ac00b5025 | /backend/environment-lib/src/main/java/org/mltooling/core/lab/model/LabEvent.java | 9907617438b3caacb744c9387c6249efdeda4248 | [
"Apache-2.0"
] | permissive | DavidGeisel/machine-learning-lab | f03b164e5771a5defd732a9843a2c460cb633725 | 2d7a9ecae3780a5ecfe323e55b5d555ac41ce261 | refs/heads/master | 2022-12-08T07:07:35.139277 | 2020-09-03T10:29:31 | 2020-09-03T10:29:31 | 292,058,375 | 0 | 0 | Apache-2.0 | 2020-09-01T17:04:53 | 2020-09-01T17:04:53 | null | UTF-8 | Java | false | false | 2,454 | java | package org.mltooling.core.lab.model;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.Map;
public class LabEvent {
// ================ Constants =========================================== //
public static final String DOWNLOADED_FILE = "downloaded-file";
public static final String SHUTDOWN_UNUSED_WORKSPACES = "shutdown-unused-workspaces";
public static final String LONG_REQUEST = "long-request";
public static final String DELETE_PROJECT = "delete-project";
public static final String DELETE_EXPERIMENT = "delete-experiment";
public static final String DELETE_FILE = "delete-file";
public static final String DELETE_SERVICE = "delete-service";
public static final String DELETE_JOB = "delete-job";
public static final String DELETE_SCHEDULED_JOB = "delete-scheduled-job";
public static final String CREATE_ADMIN_USER = "create-admin-user";
public static final String DELETE_USER = "delete-user";
public static final String RESET_ALL_WORKSPACES = "reset-all-workspaces";
// ================ Members ============================================= //
private String name;
private Date createdAt;
private Map<String, Object> attributes;
// ================ Constructors & Main ================================= //
public LabEvent() {}
// ================ Methods for/from SuperClass / Interfaces ============ //
// ================ Public Methods ====================================== //
public String getName() {
return name;
}
public LabEvent setName(String name) {
this.name = name;
return this;
}
@ApiModelProperty(dataType = "java.lang.Long")
public Date getCreatedAt() {
return createdAt;
}
public LabEvent setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
return this;
}
public Map<String, Object> getAttributes() {
return attributes;
}
public LabEvent setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
return this;
}
// ================ Private Methods ===================================== //
// ================ Getter & Setter ===================================== //
// ================ Builder Pattern ===================================== //
// ================ Inner & Anonymous Classes =========================== //
}
| [
"benjamin.raethlein@gmail.com"
] | benjamin.raethlein@gmail.com |
d28e00fd2c5e02a55e4d4bd805675459e035adaa | f98a804c0878f194854b6af1f90d9f5ad1b70fae | /src/main/java/com/phei/netty/nettyprotocolstack/encoderanddecoder/NettyMessageDecoder.java | 0cfe86e7229b3c0f2069a47f80b13a6b6294ab8b | [] | no_license | chenxingwei-wayne/learnnetty | d7d1fecc20206f7c80227b9ddae8d580d8853ea3 | 5f2cd602aa2063f45670742d2028893e430727f8 | refs/heads/master | 2020-07-31T04:38:20.617169 | 2019-10-09T09:19:34 | 2019-10-09T09:19:34 | 210,487,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | package com.phei.netty.nettyprotocolstack.encoderanddecoder;
import com.phei.netty.nettyprotocolstack.NettyMessage;
import com.phei.netty.nettyprotocolstack.pojo.Header;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class NettyMessageDecoder extends LengthFieldBasedFrameDecoder {
MarshallingDecoder marshallingDecoder;
public NettyMessageDecoder(int maxFrameLength, int lengthFieldOffset, int lengthFieldLength) throws IOException {
super(maxFrameLength, lengthFieldOffset, lengthFieldLength);
marshallingDecoder = new MarshallingDecoder();
}
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
ByteBuf frame = (ByteBuf) super.decode(ctx, in);
if (frame == null) {
return null;
}
NettyMessage nettyMessage = new NettyMessage();
Header header = new Header();
header.setCrcCode(in.readInt());
header.setLength(in.readInt());
header.setSessionID(in.readLong());
header.setType(in.readByte());
header.setPriority(in.readByte());
int size = in.readInt();
if (size > 0) {
Map<String, Object> attach = new HashMap<>(size);
int keySize = 0;
byte[] keyArray = null;
String key = null;
for (int i = 0; i < size; i++) {
keySize = in.readInt();
keyArray = new byte[keySize];
in.readBytes(keyArray);
key = new String(keyArray, "UTF-8");
attach.put(key, marshallingDecoder.decode(in));
}
keyArray = null;
key = null;
header.setAttachment(attach);
}
if (in.readableBytes() > 4) {
nettyMessage.setBody(marshallingDecoder.decode(in));
}
nettyMessage.setHeader(header);
return nettyMessage;
}
}
| [
"v-wachen@expedia.com"
] | v-wachen@expedia.com |
b76bdea906c601950945ae32a727c2a0a70d7724 | 1200cb72e46a3e25967074dda4ba7fb0506e1b7a | /MyCity2/mycity-services/src/main/java/org/hillel/it/mycity/resource/AssessmentResource.java | 7b61fbb222dc209d3bd35575defed26c2025790c | [] | no_license | VlasovArtem/MyCity2 | 42c9816171eaa4cd5965c6ad3b6da6296164469f | ca97b03732adf2dd389de4b9fe1a19d72bd5b43b | refs/heads/master | 2021-01-21T17:46:12.894055 | 2014-11-13T00:52:06 | 2014-11-13T00:52:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,135 | java | package org.hillel.it.mycity.resource;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.hillel.it.mycity.model.entity.Assessment;
import org.hillel.it.mycity.service.ServiceMyCity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Path("/assessment")
@Component
public class AssessmentResource {
@Autowired
private ServiceMyCity serviceMyCity;
@PUT
@Path("/add")
@Consumes(MediaType.APPLICATION_JSON)
public void addAssessment(Assessment assessment) {
serviceMyCity.addAssessment(assessment);
}
@DELETE
@Path("/delete/byid/{id}")
public void deleteAssessmentById(@PathParam("id") int id) {
serviceMyCity.deleteAssessment(id);
}
@DELETE
@Path("/delete/byuser/{username}")
public void deleteAssessmentByUser(@PathParam("username") String username) {
serviceMyCity.deleteAssessmentByUser(username);
}
@DELETE
@Path("/delete/byestablishment/{establishment}")
public void deleteAssessmentByEstablishment(@PathParam("establishment") String name) {
serviceMyCity.deleteAssessmentByEstablishment(name);
}
@GET
@Path("/get/byid/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Assessment getAssessment(@PathParam("id") int id) {
return serviceMyCity.getAssessment(id);
}
@GET
@Path("/get/byuser/{username}")
@Produces(MediaType.APPLICATION_JSON)
public List<Assessment> getAssessmentsByUser(@PathParam("username") String username) {
return serviceMyCity.getAssessmentsByUser(username);
}
@GET
@Path("/get/byestablishment/{establishment}")
@Produces(MediaType.APPLICATION_JSON)
public List<Assessment> getAssessmentsByEstablishment(@PathParam("establishment") String establishmentName) {
return serviceMyCity.getAssessmentsByEstablishment(establishmentName);
}
@GET
@Path("/get/all")
@Produces(MediaType.APPLICATION_JSON)
public List<Assessment> getAssessments() {
return serviceMyCity.getAssessments();
}
}
| [
"vlasovartem21@gmail.com"
] | vlasovartem21@gmail.com |
7f7e5eff945fdc94c0931367261314fc772e6566 | 5496a6de26870429cd10a5626a94729176dc87d8 | /RecyclerViewExtension/src/main/java/com/recyclerview/recyclerview/extension/tools/LoaderMoreViewBinder.java | 43f883ca7210ae4a357b230c4b78a41cb53267bb | [] | no_license | prayxiang/Common | 770d68d27604a098b577310b63408bac9ddcc6c5 | 93affa10d0c7da07a769c8215c2554b51fc72c56 | refs/heads/master | 2021-09-12T15:25:24.893687 | 2018-04-18T00:35:48 | 2018-04-18T00:35:48 | 110,088,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,585 | java | package com.recyclerview.recyclerview.extension.tools;
import android.databinding.ViewDataBinding;
import android.view.View;
import com.recyclerview.extension.BR;
import com.recyclerview.extension.R;
import com.recyclerview.recyclerview.extension.BaseAdapter;
import com.recyclerview.recyclerview.extension.DataBoundViewHolder;
/**
* Created by xianggaofeng on 2017/6/6.
*/
public class LoaderMoreViewBinder extends SimpleViewBound<LoaderMore> {
private LoadMoreScrollListener loadListener;
public LoaderMoreViewBinder(int layoutId, int br) {
super(layoutId, br);
}
public LoaderMoreViewBinder() {
super(R.layout.multi_type_view_binder_load_more, BR.data);
}
public void attachToAdapter(BaseAdapter adapter) {
loadListener = adapter.getLoadMoreScrollListener();
}
@Override
public void onItemClick(View v, LoaderMore item, int position) {
loadListener.load();
}
// private void checkStatus(ItemViewHolder holder, LoaderMore item) {
// holder.findViewById(R.id.load_default).setVisibility(View.GONE);
// holder.findViewById(R.id.load_loading).setVisibility(View.GONE);
// holder.findViewById(R.id.load_fail).setVisibility(View.GONE);
// holder.findViewById(R.id.load_finish).setVisibility(View.GONE);
// holder.findViewById(R.id.load_end).setVisibility(View.GONE);
// if (item.loadMoreStatus == LoaderMore.STATUS_LOADING) {
// holder.findViewById(R.id.load_loading).setVisibility(View.VISIBLE);
// } else if (item.loadMoreStatus == LoaderMore.STATUS_SUCCESS) {
// holder.findViewById(R.id.load_finish).setVisibility(View.VISIBLE);
// } else if (item.loadMoreStatus == LoaderMore.STATUS_DEFAULT) {
// holder.findViewById(R.id.load_default).setVisibility(View.VISIBLE);
// } else if (item.loadMoreStatus == LoaderMore.STATUS_FAIL) {
// holder.findViewById(R.id.load_fail).setVisibility(View.VISIBLE);
// }else if(item.loadMoreStatus==LoaderMore.S)
// }
@Override
public void onViewAttachedToWindow(DataBoundViewHolder<ViewDataBinding> viewHolder) {
super.onViewAttachedToWindow(viewHolder);
}
@Override
public void onViewDetachedFromWindow(DataBoundViewHolder<ViewDataBinding> viewHolder) {
LoaderMore more = viewHolder.getItem();
if (more.loadMoreStatus == LoaderMore.STATUS_LOADING) {
} else if (more.loadMoreStatus != LoaderMore.STATUS_END) {
more.setLoadMoreStatus(LoaderMore.STATUS_DEFAULT);
}
}
}
| [
"xianggaofeng@droi.com"
] | xianggaofeng@droi.com |
a6bad3e5cfeba21ff08232a6e2e77a9413cda1d0 | 25a3000ba095d2e8bc14dd8afe4f17b5c9209d77 | /xiudoua-core/src/main/java/com/justfresh/xiudoua/model/JfCmsFilmCategory.java | 0200a0488a41a314c5bd9edde9590cf7a83c4876 | [] | no_license | JustFresh/xiudoua | 4710a6d953b83bc28e32adde15a6ad228cb638ca | 4211fac7dda59524fe5bd92d6e5d6ec5f2fc893b | refs/heads/master | 2021-01-20T03:46:08.042411 | 2017-10-30T00:34:05 | 2017-10-30T00:34:05 | 101,365,727 | 2 | 1 | null | 2018-04-04T05:28:36 | 2017-08-25T04:24:04 | JavaScript | UTF-8 | Java | false | false | 2,441 | java | package com.justfresh.xiudoua.model;
import java.util.List;
import com.justfresh.xiudoua.entity.CommonFormParam;
public class JfCmsFilmCategory extends CommonFormParam {
private Integer id;
private String name;
private Integer parentId;
private String fullName;
private Byte filmType;
private String thumb;
private Long createTime;
private Byte status;
private Integer reorder;
private Integer level;
private String description;
private List<JfCmsFilmCategory> children;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName == null ? null : fullName.trim();
}
public Byte getFilmType() {
return filmType;
}
public void setFilmType(Byte filmType) {
this.filmType = filmType;
}
public String getThumb() {
return thumb;
}
public void setThumb(String thumb) {
this.thumb = thumb == null ? null : thumb.trim();
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public Integer getReorder() {
return reorder;
}
public void setReorder(Integer reorder) {
this.reorder = reorder;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public List<JfCmsFilmCategory> getChildren() {
return children;
}
public void setChildren(List<JfCmsFilmCategory> children) {
this.children = children;
}
} | [
"991058975@qq.com"
] | 991058975@qq.com |
e439036a08a570703fb70c72c86f5802e5429145 | e16b28c11bc2d1028cfa19392e9d8bf604fc7e09 | /javabasics/src/main/java/org/challenges/lambda/examples/Unit1Excercise.java | 43738b0312d61411611038305cd4d5076eeb1ff8 | [] | no_license | glegshot/coding-problems | 504abf05425cfe1a60aa45656d4185afaf4ef08e | b26267f5ec58f8b912eaaec7c716afe389a49861 | refs/heads/master | 2023-06-24T04:03:58.430220 | 2021-07-25T15:48:27 | 2021-07-25T15:48:27 | 336,580,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,171 | java | package org.challenges.lambda.examples;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class Unit1Excercise {
public static void main(String[] args) {
List<Person> personList = Arrays.asList(
new Person("Conan", "Doyale", 60),
new Person("Hershell", "Gibbs", 50),
new Person("Abel", "Tesfaye", 32),
new Person("gleg", "shot", 29),
new Person("amtrac", "mort", 58),
new Person("Cole", "ashter", 12)
);
//sort based on firstname
//streams approach
personList = personList.stream().sorted((p1, p2) -> (p1.getFirstName().compareTo(p2.getFirstName()))).collect(Collectors.toList());
//print the sorted list
//streams approach
personList.forEach(p1 -> System.out.println(p1));
System.out.println();
//create method that prints all people with first name starting with C
//streams approach
personList.stream().filter(p1 -> p1.getFirstName().charAt(0) == 'C' || p1.getFirstName().charAt(0) == 'c').forEach(p1 -> System.out.println(p1));
System.out.println();
//shuffling to make the list random
Collections.shuffle(personList);
//sort using lambda and collections sort method
Collections.sort(personList, (p1, p2) -> p1.getFirstName().compareTo(p2.getFirstName()));
//print all the list
printList(personList, person -> true);
System.out.println();
//print all person with starting name as C
printList(personList, person -> person.getFirstName().startsWith("C") || person.getFirstName().startsWith("c"));
}
//method to print the list based on condition specified
public static void printList(List<Person> personList, Condition condition) {
for (Person person : personList) {
if (condition.test(person)) {
System.out.println(person);
}
}
}
//private interface accessible to enclosing class only
private interface Condition {
public boolean test(Person person);
}
}
//POJO class for storing data
class Person {
public String firstName;
public String lastName;
public int age;
public Person(String firstName, String lastName, int age) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
@Override
public String toString() {
return "Person{" +
"firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", age=" + age +
'}';
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
| [
"sreekumar.y2k@gmail.com"
] | sreekumar.y2k@gmail.com |
6c83545d1148a5fc9dad0a2442095520a251618a | b04c52a36c19437db5c982b1655a60635f0cff9e | /src/TransactionsTest.java | 9822b3ab85d0bb409d27e701d9c1bf0576e41e6d | [] | no_license | kaivalya90/NoSql | 98041098de59b6974be3737527cc578735e95e4e | 2fce52aee4392f025b717a4fec363991524ec50d | refs/heads/master | 2021-06-02T04:53:21.432746 | 2020-03-25T22:07:27 | 2020-03-25T22:07:27 | 58,968,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,990 | java | import static org.junit.Assert.*;
import org.junit.Test;
public class TransactionsTest {
@Test
public void testPut() {
Database db = new Database();
Transactions p = db.transaction();
try {
p.put("taj", "Mahal");
p.put("Agra", 5);
p.commit();
assertEquals(5, db.get("Agra"));
} catch (Exception e) {
System.out.println("Got the exception" + e.toString());
}
}
@Test
public void testRemove() {
Database db = new Database();
Transactions p = db.transaction();
try {
p.put("taj", "Mahal");
p.put("Agra", 5);
p.remove("Agra");
p.commit();
assertNotEquals(5, db.get("Agra"));
} catch (Exception e) {
System.out.println("Got the exception" + e.toString());
}
}
@Test
public void testGet() {
Database db = new Database();
Transactions p = db.transaction();
try {
p.put("taj", "Mahal");
p.put("Agra", 5);
p.commit();
assertEquals(5, p.get("Agra"));
} catch (Exception e) {
System.out.println("Got the exception" + e.toString());
}
}
@Test
public void testCommit() {
Database db = new Database();
Transactions p = db.transaction();
try {
p.put("taj", "Mahal");
p.put("Agra", 5);
p.commit();
assertEquals("Mahal", db.get("taj"));
} catch (Exception e) {
System.out.println("Got the exception" + e.toString());
}
}
@Test
public void testAbort() {
Database db = new Database();
Transactions p = db.transaction();
try {
p.put("taj", "Mahal");
p.put("Agra", 5);
p.abort();
assertNotEquals("Mahal", db.get("taj"));
} catch (Exception e) {
System.out.println("Got the exception" + e.toString());
}
}
@Test
public void testIsActive() {
Database db = new Database();
Transactions p = db.transaction();
try {
p.put("taj", "Mahal");
assertEquals(true, p.isActive());
p.put("Agra", 5);
p.abort();
assertEquals(false, p.isActive());
} catch (Exception e) {
System.out.println("Got the exception" + e.toString());
}
}
}
| [
"deshpande.kaivalya90@gmail.com"
] | deshpande.kaivalya90@gmail.com |
ab224c773cb68c8e49cda4d4ad9b72b2654105e3 | 05e00330b1bef45ca27ad8282844cb4494175767 | /src/main/java/com/fastchar/multipart/BufferedServletInputStream.java | 6601b560839d1b4f7395ee82889ea74f49f44858 | [] | no_license | HuggingChest/FastChar | 3fe6bc6c61193f2bac7c1ab272de014b2a29a5cd | 2ce49bbe747c342e2758acded63d83e184124d3b | refs/heads/master | 2023-02-04T14:40:43.677291 | 2020-12-25T01:40:16 | 2020-12-25T01:40:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,952 | java | // Copyright (C) 1999-2001 by Jason Hunter <jhunter_AT_acm_DOT_org>.
// All rights reserved. Use of this class is limited.
// Please see the LICENSE for more information.
package com.fastchar.multipart;
import java.io.IOException;
import javax.servlet.ServletInputStream;
/**
* A <code>BufferedServletInputStream</code> wraps a
* <code>ServletInputStream</code> in order to provide input buffering and to
* avoid calling the the <code>readLine</code> method of the wrapped
* <code>ServletInputStream</code>.
* <p>
* This is necessary because some servlet containers rely on the default
* implementation of the <code>readLine</code> method provided by the Servlet
* API classes, which is very slow. Tomcat 3.2, Tomcat 3.1, the JSWDK 1.0 web
* server and the JSDK2.1 web server are all known to need this class for
* performance reasons.
* <p>
* Also, it may be used to work around a bug in the Servlet API 2.0
* implementation of <code>readLine</code> which contains a bug that causes
* <code>ArrayIndexOutOfBoundsExceptions</code> under certain conditions.
* Apache JServ is known to suffer from this bug.
*
* @author Geoff Soutter
* @version 1.1, 2001/05/21, removed block of commented out code
* @version 1.0, 2000/10/27, initial revision
*/
public class BufferedServletInputStream extends ServletInputStream {
/** input stream we are filtering */
private ServletInputStream in;
/** our buffer */
private byte[] buf = new byte[64*1024]; // 64k
/** number of bytes we've read into the buffer */
private int count;
/** current position in the buffer */
private int pos;
/**
* Creates a <code>BufferedServletInputStream</code> that wraps the provided
* <code>ServletInputStream</code>.
*
* @param in a servlet input stream.
*/
public BufferedServletInputStream(ServletInputStream in) {
this.in = in;
}
/**
* Fill up our buffer from the underlying input stream. Users of this
* method must ensure that they use all characters in the buffer before
* calling this method.
*
* @exception IOException if an I/O error occurs.
*/
private void fill() throws IOException {
int i = in.read(buf, 0, buf.length);
if (i > 0) {
pos = 0;
count = i;
}
}
/**
* Implement buffering on top of the <code>readLine</code> method of
* the wrapped <code>ServletInputStream</code>.
*
* @param b an array of bytes into which data is read.
* @param off an integer specifying the character at which
* this method begins reading.
* @param len an integer specifying the maximum number of
* bytes to read.
* @return an integer specifying the actual number of bytes
* read, or -1 if the end of the stream is reached.
* @exception IOException if an I/O error occurs.
*/
@Override
public int readLine(byte b[], int off, int len) throws IOException {
int total = 0;
if (len == 0) {
return 0;
}
int avail = count - pos;
if (avail <= 0) {
fill();
avail = count - pos;
if (avail <= 0) {
return -1;
}
}
int copy = Math.min(len, avail);
int eol = findeol(buf, pos, copy);
if (eol != -1) {
copy = eol;
}
System.arraycopy(buf, pos, b, off, copy);
pos += copy;
total += copy;
while (total < len && eol == -1) {
fill();
avail = count - pos;
if(avail <= 0) {
return total;
}
copy = Math.min(len - total, avail);
eol = findeol(buf, pos, copy);
if (eol != -1) {
copy = eol;
}
System.arraycopy(buf, pos, b, off + total, copy);
pos += copy;
total += copy;
}
return total;
}
/**
* Attempt to find the '\n' end of line marker as defined in the comment of
* the <code>readLine</code> method of <code>ServletInputStream</code>.
*
* @param b byte array to search.
* @param pos position in byte array to search from.
* @param len maximum number of bytes to search.
*
* @return the number of bytes including the \n, or -1 if none found.
*/
private static int findeol(byte b[], int pos, int len) {
int end = pos + len;
int i = pos;
while (i < end) {
if (b[i++] == '\n') {
return i - pos;
}
}
return -1;
}
/**
* Implement buffering on top of the <code>read</code> method of
* the wrapped <code>ServletInputStream</code>.
*
* @return the next byte of data, or <code>-1</code> if the end of the
* stream is reached.
* @exception IOException if an I/O error occurs.
*/
@Override
public int read() throws IOException {
if (count <= pos) {
fill();
if (count <= pos) {
return -1;
}
}
return buf[pos++] & 0xff;
}
/**
* Implement buffering on top of the <code>read</code> method of
* the wrapped <code>ServletInputStream</code>.
*
* @param b the buffer into which the data is read.
* @param off the start offset of the data.
* @param len the maximum number of bytes read.
* @return the total number of bytes read into the buffer, or
* <code>-1</code> if there is no more data because the end
* of the stream has been reached.
* @exception IOException if an I/O error occurs.
*/
@Override
public int read(byte b[], int off, int len) throws IOException
{
int total = 0;
while (total < len) {
int avail = count - pos;
if (avail <= 0) {
fill();
avail = count - pos;
if(avail <= 0) {
if (total > 0) {
return total;
} else {
return -1;
}
}
}
int copy = Math.min(len - total, avail);
System.arraycopy(buf, pos, b, off + total, copy);
pos += copy;
total += copy;
}
return total;
}
}
| [
"863139453@qq.com"
] | 863139453@qq.com |
735b360a3a7804086572cb6120a72455eb2f6e36 | 25c7b7dc2138bcf21a31897ab18890d18ce793e2 | /Hybris/hybris/bin/custom/assuramed/assuramedcore/src/de/hybris/assuramed/core/event/OrderCancelledEventListener.java | 81a4985b7c7af658070c2c8f0c1f69afe9e6fb70 | [] | no_license | felixantoc/cares_hybris | 492ba3c0f087092be54de4bb3c6b2527b8b8c98a | 07bf79f17fe5806ec9137fcb3bae090c4d7460aa | refs/heads/master | 2021-01-19T06:00:15.410404 | 2016-05-27T12:10:17 | 2016-05-27T12:10:17 | 59,834,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,655 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.assuramed.core.event;
import de.hybris.platform.acceleratorservices.site.AbstractAcceleratorSiteEventListener;
import de.hybris.platform.basecommerce.model.site.BaseSiteModel;
import de.hybris.platform.commerceservices.enums.SiteChannel;
import de.hybris.platform.commerceservices.event.OrderCancelledEvent;
import de.hybris.platform.core.model.order.OrderModel;
import de.hybris.platform.orderprocessing.model.OrderProcessModel;
import de.hybris.platform.processengine.BusinessProcessService;
import de.hybris.platform.servicelayer.model.ModelService;
import de.hybris.platform.servicelayer.util.ServicesUtil;
import org.springframework.beans.factory.annotation.Required;
public class OrderCancelledEventListener extends AbstractAcceleratorSiteEventListener<OrderCancelledEvent>
{
private ModelService modelService;
private BusinessProcessService businessProcessService;
@Override
protected void onSiteEvent(final OrderCancelledEvent event)
{
final OrderModel orderModel = event.getProcess().getOrder();
final OrderProcessModel orderProcessModel = (OrderProcessModel) getBusinessProcessService().createProcess(
"sendOrderCancelledEmailProcess-" + orderModel.getCode() + "-" + System.currentTimeMillis(),
"sendOrderCancelledEmailProcess");
orderProcessModel.setOrder(orderModel);
getModelService().save(orderProcessModel);
getBusinessProcessService().startProcess(orderProcessModel);
}
public ModelService getModelService()
{
return modelService;
}
@Required
public void setModelService(final ModelService modelService)
{
this.modelService = modelService;
}
public BusinessProcessService getBusinessProcessService()
{
return businessProcessService;
}
@Required
public void setBusinessProcessService(final BusinessProcessService businessProcessService)
{
this.businessProcessService = businessProcessService;
}
@Override
protected SiteChannel getSiteChannelForEvent(final OrderCancelledEvent event)
{
final OrderModel order = event.getProcess().getOrder();
ServicesUtil.validateParameterNotNullStandardMessage("event.order", order);
final BaseSiteModel site = order.getSite();
ServicesUtil.validateParameterNotNullStandardMessage("event.order.site", site);
return site.getChannel();
}
}
| [
"felixantoinfantine.c@cognizant.com"
] | felixantoinfantine.c@cognizant.com |
6e65fab0ff8e889d496d33f25b11d8749dbb5165 | fb079e82c42cea89a3faea928d4caf0df4954b05 | /Физкультура/ВДНХ/VelnessBMSTU_v1.2b_apkpure.com_source_from_JADX/com/google/android/gms/common/internal/zzm.java | 21c578245f638d2aa9e000b76224aca802732eb1 | [] | no_license | Belousov-EA/university | 33c80c701871379b6ef9aa3da8f731ccf698d242 | 6ec7303ca964081c52f259051833a045f0c91a39 | refs/heads/master | 2022-01-21T17:46:30.732221 | 2022-01-10T20:27:15 | 2022-01-10T20:27:15 | 123,337,018 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package com.google.android.gms.common.internal;
import android.support.annotation.NonNull;
import com.google.android.gms.common.ConnectionResult;
public final class zzm implements zzj {
private /* synthetic */ zzd zzfza;
public zzm(zzd com_google_android_gms_common_internal_zzd) {
this.zzfza = com_google_android_gms_common_internal_zzd;
}
public final void zzf(@NonNull ConnectionResult connectionResult) {
if (connectionResult.isSuccess()) {
this.zzfza.zza(null, this.zzfza.zzakp());
} else if (this.zzfza.zzfys != null) {
this.zzfza.zzfys.onConnectionFailed(connectionResult);
}
}
}
| [
"Belousov.EA98@gmail.com"
] | Belousov.EA98@gmail.com |
caac148b3e91a3d9ebbfa6fe9136b6b2db2012cc | eb5f5353f49ee558e497e5caded1f60f32f536b5 | /org/omg/CORBA/DynValue.java | 459285319767138d5401ecf12d84e1c21929f6ea | [] | no_license | mohitrajvardhan17/java1.8.0_151 | 6fc53e15354d88b53bd248c260c954807d612118 | 6eeab0c0fd20be34db653f4778f8828068c50c92 | refs/heads/master | 2020-03-18T09:44:14.769133 | 2018-05-23T14:28:24 | 2018-05-23T14:28:24 | 134,578,186 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package org.omg.CORBA;
import org.omg.CORBA.DynAnyPackage.InvalidSeq;
@Deprecated
public abstract interface DynValue
extends Object, DynAny
{
public abstract String current_member_name();
public abstract TCKind current_member_kind();
public abstract NameValuePair[] get_members();
public abstract void set_members(NameValuePair[] paramArrayOfNameValuePair)
throws InvalidSeq;
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\org\omg\CORBA\DynValue.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"mohit.rajvardhan@ericsson.com"
] | mohit.rajvardhan@ericsson.com |
23706de2d31f4a79647d367e998b2eb72dc9b2f0 | 0e463e0012584e4a43a7fdfa1598d58e8c756a23 | /src/main/java/cn/tqhweb/jweb/plugin/cache/CachePlugin.java | 63671b709a5db6578b21658cfe8bbe065c064c61 | [] | no_license | tqh177/jweb | bfe5c3b42324bf73831ccab9b35e7e935f2a3873 | d49a25f17ff8d39ee460d7cfce346fc1ee335333 | refs/heads/master | 2022-12-19T05:08:29.352421 | 2020-10-03T07:36:44 | 2020-10-03T07:36:44 | 300,558,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package cn.tqhweb.jweb.plugin.cache;
import cn.tqhweb.jweb.plugin.Plugin;
public abstract class CachePlugin implements Plugin {
private static CachePlugin cachePlugin;
public static CachePlugin getCachePlugin() {
return cachePlugin;
}
public static void regist(CachePlugin cachePlugin) {
CachePlugin.cachePlugin = cachePlugin;
}
public boolean contain(String name, Object key) {
return get(name, key) == null;
}
public abstract void set(String name, Object key, Object value);
public abstract Object get(String name, Object key);
// public abstract long getTime(String name, Object key);
public abstract void remove(String name, Object key);
}
| [
"tqh177@qq.com"
] | tqh177@qq.com |
475f225ccd56dd702536e45930a155b3d064f800 | b495b300af2c432ce33de77b2b307af0a8eba9fb | /src/main/java/ru/sberbank/kuzin19190813/authorizationadminapi/mvc/view/response/ErrorResponse.java | 72de8b663789700e13d7e9602498098dd22f772b | [] | no_license | evgenykuzin/authorization-admin-api | c830c3a64713861bb5203fead57987b135fcbdce | 17e1c83e4a2e4d5c3fc42d8dc9149180ab784d5a | refs/heads/master | 2023-05-27T00:25:03.297524 | 2021-06-10T12:35:43 | 2021-06-10T12:35:43 | 375,309,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package ru.sberbank.kuzin19190813.authorizationadminapi.mvc.view.response;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import ru.sberbank.kuzin19190813.authorizationadminapi.mvc.view.body.ErrorBody;
public class ErrorResponse extends ResponseEntity<ErrorBody> {
private ErrorResponse(ErrorBody body, HttpStatus status) {
super(body, status);
}
public ErrorResponse(String message) {
super(new ErrorBody(message), HttpStatus.BAD_REQUEST);
}
}
| [
"EIKuzin@sberbank.ru"
] | EIKuzin@sberbank.ru |
71ec14dfdb9b766c986cd10160663349698159ad | 377e5e05fb9c6c8ed90ad9980565c00605f2542b | /bin/ext-integration/sap/synchronousOM/ysapordermgmtb2baddon/src/de/hybris/platform/sap/ysapordermgmtb2baddon/Ysapordermgmtb2baddonStandalone.java | 945daf5a9b5b970d56e919a976d164bf2235aa3f | [] | no_license | automaticinfotech/HybrisProject | c22b13db7863e1e80ccc29774f43e5c32e41e519 | fc12e2890c569e45b97974d2f20a8cbe92b6d97f | refs/heads/master | 2021-07-20T18:41:04.727081 | 2017-10-30T13:24:11 | 2017-10-30T13:24:11 | 108,957,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,852 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.sap.ysapordermgmtb2baddon;
import de.hybris.platform.core.Registry;
import de.hybris.platform.jalo.JaloSession;
import de.hybris.platform.util.RedeployUtilities;
import de.hybris.platform.util.Utilities;
/**
* Demonstration of how to write a standalone application that can be run directly from within eclipse or from the
* commandline.<br>
* To run this from commandline, just use the following command:<br>
* <code>
* java -jar bootstrap/bin/ybootstrap.jar "new de.hybris.platform.sap.ysapordermgmtb2baddon.Ysapordermgmtb2baddonStandalone().run();"
* </code> From eclipse, just run as Java Application. Note that you maybe need to add all other projects like
* ext-commerce, ext-pim to the Launch configuration classpath.
*/
public class Ysapordermgmtb2baddonStandalone
{
/**
* Main class to be able to run it directly as a java program.
*
* @param args
* the arguments from commandline
*/
public static void main(final String[] args)
{
new Ysapordermgmtb2baddonStandalone().run();
}
public void run()
{
Registry.activateStandaloneMode();
Registry.activateMasterTenant();
final JaloSession jaloSession = JaloSession.getCurrentSession();
System.out.println("Session ID: " + jaloSession.getSessionID()); //NOPMD
System.out.println("User: " + jaloSession.getUser()); //NOPMD
Utilities.printAppInfo();
RedeployUtilities.shutdown();
}
}
| [
"santosh.kshirsagar@automaticinfotech.com"
] | santosh.kshirsagar@automaticinfotech.com |
5f1b352365d460efc7ba03725dd1704ec078b4b4 | 160217c42ca57b28865844cf214a1118383d44f7 | /Gino/3.-Parcial/EF_2-2019/src/Bst/Arbol.java | 1d6caaa548e1d1aa844eb228326e3f35f6fd3831 | [
"MIT"
] | permissive | Marcoaf22/Estructura-de-Datos-II | 34ba843502ddf4987d1609380e86157481c92390 | a019bf70e40f2e9a1ca55f574e627d1151403d04 | refs/heads/master | 2022-12-01T20:17:12.966113 | 2020-07-25T01:44:12 | 2020-07-25T01:44:12 | 270,102,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,914 | java | package Bst;
import java.util.LinkedList;
public class Arbol {
private Nodo Raiz;
public Arbol(int padre){ //Crea el árbol con raíz=padre
Raiz = new Nodo(padre);
}
public void podar(int nivel){ //** PREGUNTA 1.
Raiz=podar(Raiz,nivel,1);
}
public Nodo podar(Nodo p,int nivel,int nivelABorrar){
if (p!=null){
if (nivel==nivelABorrar){
return null;
}
p.setHD(podar(p.getHD(),nivel,nivelABorrar+1));
p.setHI(podar(p.getHI(),nivel,nivelABorrar+1));
}
return p;
}
private boolean hoja(Nodo T){
return (T != null && T.cantHijos() == 0);
}
public void add(int padre, int x){ //Inserta x al arbol, como hijo de padre.
Nodo p = fetch(Raiz, padre);
if (p==null || fetch(Raiz, x) != null)
return; //El padre no existe o x ya está en el árbol.
int i = p.getHijoNull();
if (i != -1)
p.setHijo(i, new Nodo(x));
}
private Nodo fetch(Nodo t, int x){ //Fetch al nodo cuyo Data=x.
if (t==null || t.getData() == x)
return t;
Nodo hi = fetch(t.getHI(), x);
if (hi != null)
return hi;
return fetch(t.getHD(), x);
}
public void Inorden(){
if (Raiz == null)
System.out.println("(Arbol vacío)");
else{
System.out.print("Inorden : ");
Inorden(Raiz);
System.out.println();
}
}
private void Inorden(Nodo T){
if (T != null){
Inorden(T.getHI());
System.out.print(T.getData()+" ");
Inorden(T.getHD());
}
}
public void Preorden(){
System.out.print("Preorden : ");
if (Raiz == null)
System.out.println("(Arbol vacío)");
else{
Preorden(Raiz);
System.out.println();
}
}
private void Preorden(Nodo T){
if (T != null){
System.out.print(T.getData() + " ");
Preorden(T.getHI());
Preorden(T.getHD());
}
}
public void niveles(){
System.out.print("Niveles: ");
if (Raiz == null)
System.out.println("(Arbol vacío)");
else{
niveles(Raiz);
}
}
//---------- Métodos auxiliares para mostrar el árbol por niveles --------------
private void niveles(Nodo T){ //Pre: T no es null.
LinkedList <Nodo> colaNodos = new LinkedList<>();
LinkedList<Integer> colaNivel = new LinkedList<>();
int nivelActual = 0;
String coma="";
colaNodos.addLast(T);
colaNivel.addLast(1);
do{
Nodo p = colaNodos.pop(); //Sacar nodo de la cola
int nivelP = colaNivel.pop();
if (nivelP != nivelActual){ //Se está cambiando de nivel
System.out.println();
System.out.print(" Nivel "+nivelP+": ");
nivelActual = nivelP;
coma = "";
}
System.out.print(coma + p);
coma = ", ";
addHijos(colaNodos, colaNivel, p, nivelP);
}while (colaNodos.size() > 0);
System.out.println();
}
private void addHijos(LinkedList <Nodo> colaNodos, LinkedList<Integer> colaNivel, Nodo p, int nivelP){
for (int i=1; i<=Nodo.M; i++){ //Insertar a la cola de nodos los hijos no-nulos de p
Nodo hijo = p.getHijo(i);
if (hijo != null){
colaNodos.addLast(hijo);
colaNivel.addLast(nivelP+1);
}
}
}
}
| [
"marcoaf22@gmail.com"
] | marcoaf22@gmail.com |
2c33fdae3ad68f897a0c5ef632f04f5f7b989fe8 | fad26835f577a00583f8769ead200d5de5bc4695 | /frame.java | 629403abe71ae54a955d720303d1e676d83fc2bf | [] | no_license | 1273974861/javalearn | 63bb699bb1240c072bc349ecd694e4ec62e2cfbd | e6c38deb7cf09933429d4b59560444b3be67923d | refs/heads/master | 2023-05-31T07:59:46.968526 | 2021-06-10T07:12:29 | 2021-06-10T07:12:29 | 304,270,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package wannianli;
import java.awt.BorderLayout;
import javax.swing.JFrame;
public class frame extends JFrame {
public frame() {
this.setTitle("万年历查询");
this.setSize(400,400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
//顶部面板
toppanel tp =new toppanel();
this.add(tp,BorderLayout.NORTH);
//主面板
mainpanel mp=new mainpanel();
this.add(mp);
this.setVisible(true);
}
public static void main(String args[]) {
new frame();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6e958257095cd0c83c5cd3dd81888c9c775419c8 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/33/33_ea7e0b05a3dbc1584ef2ef01ef86723783638280/CompositeActionBuilder/33_ea7e0b05a3dbc1584ef2ef01ef86723783638280_CompositeActionBuilder_t.java | bd71d24e89f0ee1ccbe46339ff0b22eaecb077fd | [] | 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 | 1,896 | java | package com.youdevise.test.narrative;
import java.util.ArrayList;
import java.util.List;
import static java.util.Collections.unmodifiableList;
public class CompositeActionBuilder<T> {
private final List<Action<T>> children = new ArrayList<Action<T>>();
private final ActionHandler<T> handler;
public CompositeActionBuilder(Action<T> child) {
children.add(child);
this.handler = new ActionHandler<T>() {
@Override public void handle(Action<T> action, T tool, Stash stash) { }
};
}
private CompositeActionBuilder(CompositeActionBuilder<T> previous, Action<T> child) {
children.addAll(previous.children);
children.add(child);
this.handler = previous.handler;
}
private CompositeActionBuilder(CompositeActionBuilder<T> previous, ActionHandler<T> handler) {
children.addAll(previous.children);
this.handler = handler;
}
public List<Action<T>> getChildren() {
return unmodifiableList(children);
}
public static <T> CompositeActionBuilder<T> of(Action<T> firstChild) {
return new CompositeActionBuilder<T>(firstChild);
}
public CompositeActionBuilder<T> andThen(Action<T> nextChild) {
return new CompositeActionBuilder<T>(this, nextChild);
}
public Action<T> build() {
return new Action<T>() {
@Override
public void performFor(T tool, Stash stash) {
for (Action<T> action : getChildren()) {
handler.handle(action, tool, stash);
action.performFor(tool, stash);
}
}
};
}
public CompositeActionBuilder<T> beforeEach(ActionHandler<T> actionHandler) {
return new CompositeActionBuilder<T>(this, actionHandler);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
dd738e67dae8ce5d48913c63bcde4c43de49ff18 | e33134036c047782277aef6408a1fe47437772f1 | /src/odra/store/persistence/MappedFile.java | 2c29723e10062b2cc4ed64238faf409cce55e8ca | [] | no_license | gregcarlin/ODRA-with-Enums | 3c7419c8d5adda13d4969acf9058fbd54a667b59 | e8c077acff0b851103f3e439c42effdf957bd67a | refs/heads/master | 2021-05-27T05:08:31.350954 | 2014-09-13T01:43:12 | 2014-09-13T01:43:12 | 17,455,848 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,542 | java | package odra.store.persistence;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import odra.db.DatabaseException;
import odra.system.config.ConfigDebug;
/**
* A class representing memory-mapped files.
*
* @author raist
*/
public class MappedFile {
protected String path;
protected RandomAccessFile file;
protected FileChannel channel;
protected MappedByteBuffer buffer;
protected int fsize;
/**
* Initializes a new MappedFile object using a file path
*/
public MappedFile(String filePath) {
path = filePath;
}
public String getPath() {
return path;
}
/**
* Opens the file for read/write operations
*/
public void open() throws DatabaseException {
if (isMapped())
throw new DatabaseException("File already opened");
File fi = new File(path);
if (!fi.exists() || !fi.canRead() || !fi.canWrite() || fi.isDirectory())
throw new DatabaseException("Cannot open database file '" + path + "'");
try {
file = new RandomAccessFile(path, "rw");
channel = file.getChannel();
fsize = (int) channel.size();
buffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, fsize);
channel.close();
}
catch (Exception ex) {
throw new DatabaseException(ex.getMessage());
}
}
/**
* @return size of the datafile
*/
public int getSize() {
return fsize;
}
/**
* Closes the file
*/
public void close() {
buffer = null;
}
/**
* @return buffer representing the content of the file
*/
public MappedByteBuffer getBuffer() throws DatabaseException {
if (!isMapped())
throw new DatabaseException("File not opened");
return buffer;
}
/**
* @return true if the file is open
*/
public boolean isMapped() {
return buffer != null;
}
/**
* Formats the datafile (sets the proper size, installs the file header, etc.)
*/
public synchronized void format(int size) throws DatabaseException {
if (ConfigDebug.ASSERTS) assert size >= 1024 && size <= Integer.MAX_VALUE : "Data files cannot be smaller than 1024B and bigger than " + Integer.MAX_VALUE;
try {
// file setup
File f = new File(path);
if (f.length() > size)
f.delete();
file = new RandomAccessFile(path, "rw");
channel = file.getChannel();
ByteBuffer newBuf = ByteBuffer.allocate(size);
channel.write(newBuf);
channel.close();
}
catch (IOException ex) {
throw new DatabaseException(ex.getMessage());
}
}
}
| [
"gregthegeek@optonline.net"
] | gregthegeek@optonline.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.