blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
sequence | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
unknown | revision_date
unknown | committer_date
unknown | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
unknown | gha_created_at
unknown | gha_updated_at
unknown | gha_pushed_at
unknown | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
sequence | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4fa7881043f18425f039bf764c37c21a84a51b9d | 20,538,533,647,930 | 9cb6c8d3703725048bcdc017cd84c39f2dcffaca | /src/main/java/com/legalzoom/entity/BankCard.java | 9165aa081d758e505c35d785b17af691c28f63d8 | [] | no_license | dmigur/LegalZoomBanking | https://github.com/dmigur/LegalZoomBanking | b38b17dd70e4aee47a4dd72a88a98d4415637a3f | 424d0af989df939cb45f3827fcd96ff6c39ecd3d | refs/heads/master | "2020-09-04T12:07:34.184000" | "2019-11-05T11:26:03" | "2019-11-05T11:26:03" | 219,728,180 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.legalzoom.entity;
import lombok.Getter;
import lombok.Setter;
import java.util.Calendar;
/**
* Created by dmitrigu on 5/25/2019.
*/
@Setter
@Getter
public class BankCard {
private String bankName;
private String cardNumber;
private Calendar expiryDate;
public BankCard(String bankName, String cardNumber, Calendar expiryDate) {
this.bankName = bankName;
this.cardNumber = cardNumber;
this.expiryDate = expiryDate;
}
@Override
public String toString() {
return "BankCard{" +
"cardNumber='" + cardNumber + '\'' +
'}';
}
} | UTF-8 | Java | 634 | java | BankCard.java | Java | [
{
"context": "er;\n\nimport java.util.Calendar;\n\n/**\n * Created by dmitrigu on 5/25/2019.\n */\n@Setter\n@Getter\npublic class Ba",
"end": 130,
"score": 0.9917225241661072,
"start": 122,
"tag": "USERNAME",
"value": "dmitrigu"
}
] | null | [] | package com.legalzoom.entity;
import lombok.Getter;
import lombok.Setter;
import java.util.Calendar;
/**
* Created by dmitrigu on 5/25/2019.
*/
@Setter
@Getter
public class BankCard {
private String bankName;
private String cardNumber;
private Calendar expiryDate;
public BankCard(String bankName, String cardNumber, Calendar expiryDate) {
this.bankName = bankName;
this.cardNumber = cardNumber;
this.expiryDate = expiryDate;
}
@Override
public String toString() {
return "BankCard{" +
"cardNumber='" + cardNumber + '\'' +
'}';
}
} | 634 | 0.632492 | 0.621451 | 30 | 20.166666 | 18.042696 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433333 | false | false | 1 |
0470be9702b8b4f31e73a65660a4ec2c477e4426 | 28,827,820,518,922 | 60af9095f58a65ae06263b2ff51d0e8c0e3e8e8c | /src/main/java/me/pm/lemon/cosmetics/features/HatFeatureRenderer.java | 11284f6da0954afbb4c553315c50f481585be5ad | [
"CC0-1.0"
] | permissive | Li4M4tt8IL/LemonProject | https://github.com/Li4M4tt8IL/LemonProject | 3f02e2677e2df1fd96313355b64b819c94be81df | 6db6c0a48ca3dee745deead2f1f618d1904c9b47 | refs/heads/master | "2023-08-11T14:35:00.496000" | "2021-10-14T18:26:18" | "2021-10-14T18:26:18" | 359,535,851 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.pm.lemon.cosmetics.features;
import me.pm.lemon.Main;
import me.pm.lemon.cosmetics.models.base.HatModelBase;
import me.pm.lemon.cosmetics.models.hats.CatEarModel;
import me.pm.lemon.cosmetics.models.hats.ChristmasHatModel;
import me.pm.lemon.cosmetics.models.hats.FoxEarModel;
import me.pm.lemon.cosmetics.models.hats.TopHatModel;
import me.pm.lemon.utils.LemonLogger;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.MathHelper;
public class HatFeatureRenderer extends FeatureRenderer<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> {
private HatModelBase hatModel = null;
private PlayerEntityModel playerModel;
public HatFeatureRenderer(FeatureRendererContext<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> featureRendererContext) {
super(featureRendererContext);
playerModel = featureRendererContext.getModel();
}
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, AbstractClientPlayerEntity entity,float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
try {
if(Main.getTopHats().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new TopHatModel(1F, playerModel);
} else if(Main.getDarkEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new CatEarModel(1F, playerModel, "dark");
} else if(Main.getLightEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new CatEarModel(1F, playerModel, "light");
} else if(Main.getChristmasHats().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new ChristmasHatModel(1F, playerModel);
} else if(Main.getOrangeFoxEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new FoxEarModel(1F, playerModel, "orange");
} else if(Main.getWhiteFoxEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new FoxEarModel(1F, playerModel, "white");
} else {
hatModel = null;
}
if(hatModel == null) return;
for(int n = 0; n < 2; ++n) {
float o = MathHelper.lerp(tickDelta, entity.prevYaw, entity.yaw) - MathHelper.lerp(tickDelta, entity.prevBodyYaw, entity.bodyYaw);
float p = MathHelper.lerp(tickDelta, entity.prevPitch, entity.pitch);
matrixStack.push();
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(o));
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(p));
if(entity.isSneaking()) {
matrixStack.translate(0, 0.225D, 0);
}
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getText(hatModel.getTexture()));
hatModel.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch);
hatModel.renderHat(matrixStack, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
matrixStack.pop();
}
} catch (Exception e) {
LemonLogger.errorMessage("Something went wrong! " , e.getMessage());
}
}
} | UTF-8 | Java | 3,985 | java | HatFeatureRenderer.java | Java | [] | null | [] | package me.pm.lemon.cosmetics.features;
import me.pm.lemon.Main;
import me.pm.lemon.cosmetics.models.base.HatModelBase;
import me.pm.lemon.cosmetics.models.hats.CatEarModel;
import me.pm.lemon.cosmetics.models.hats.ChristmasHatModel;
import me.pm.lemon.cosmetics.models.hats.FoxEarModel;
import me.pm.lemon.cosmetics.models.hats.TopHatModel;
import me.pm.lemon.utils.LemonLogger;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.MathHelper;
public class HatFeatureRenderer extends FeatureRenderer<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> {
private HatModelBase hatModel = null;
private PlayerEntityModel playerModel;
public HatFeatureRenderer(FeatureRendererContext<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> featureRendererContext) {
super(featureRendererContext);
playerModel = featureRendererContext.getModel();
}
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, AbstractClientPlayerEntity entity,float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
try {
if(Main.getTopHats().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new TopHatModel(1F, playerModel);
} else if(Main.getDarkEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new CatEarModel(1F, playerModel, "dark");
} else if(Main.getLightEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new CatEarModel(1F, playerModel, "light");
} else if(Main.getChristmasHats().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new ChristmasHatModel(1F, playerModel);
} else if(Main.getOrangeFoxEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new FoxEarModel(1F, playerModel, "orange");
} else if(Main.getWhiteFoxEars().contains(entity.getUuidAsString().replaceAll("-", ""))) {
hatModel = new FoxEarModel(1F, playerModel, "white");
} else {
hatModel = null;
}
if(hatModel == null) return;
for(int n = 0; n < 2; ++n) {
float o = MathHelper.lerp(tickDelta, entity.prevYaw, entity.yaw) - MathHelper.lerp(tickDelta, entity.prevBodyYaw, entity.bodyYaw);
float p = MathHelper.lerp(tickDelta, entity.prevPitch, entity.pitch);
matrixStack.push();
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(o));
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(p));
if(entity.isSneaking()) {
matrixStack.translate(0, 0.225D, 0);
}
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getText(hatModel.getTexture()));
hatModel.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch);
hatModel.renderHat(matrixStack, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
matrixStack.pop();
}
} catch (Exception e) {
LemonLogger.errorMessage("Something went wrong! " , e.getMessage());
}
}
} | 3,985 | 0.696361 | 0.691092 | 69 | 56.768116 | 43.530815 | 252 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 1 |
4d6b56fe9271e07b30e3a854c740ae692343deb0 | 17,995,913,004,490 | 7d8a1b071546f3cc8fa7b069448300144949d0e8 | /src/main/java/org/github/bobobot/ui/views/LoginView.java | 92da2e478fb2f929c7d4863a4dfba7caa3be41bd | [
"MIT"
] | permissive | Bobobot/SzakgyakChan | https://github.com/Bobobot/SzakgyakChan | b785d4dc67970d1ce5d9dfaee83437b3f9397951 | 43be1231b0eed50e56428e0863eba0f6fb30b201 | refs/heads/master | "2022-12-16T22:55:06.661000" | "2020-09-04T13:03:13" | "2020-09-04T13:03:13" | 279,271,583 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.github.bobobot.ui.views;
import com.vaadin.navigator.View;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.LoginForm;
import lombok.extern.slf4j.Slf4j;
import org.github.bobobot.entities.User;
import org.github.bobobot.services.IUserService;
import org.github.bobobot.ui.MainUI;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import java.util.Optional;
@SpringView(name = LoginView.name)
@SpringComponent
@Slf4j
public class LoginView extends HorizontalLayout implements View {
public static final String name = "loginView";
@Autowired
private IUserService userService;
@PostConstruct
void init() {
LoginForm loginForm = new LoginForm();
loginForm.setUsernameCaption("Email");
loginForm.addLoginListener(loginEvent -> {
String email = loginEvent.getLoginParameter("username"); //yes, username
String password = loginEvent.getLoginParameter("password");
log.info("Login attempt with " + email + ", " + password + "...");
Optional<User> loggedInUser = userService.login(email, password);
if (loggedInUser.isPresent()) {
log.info("Successful login!");
((MainUI) getUI()).reRenderNavbar();
getUI().getNavigator().navigateTo(MainView.name);
} else {
log.info("Login failed.");
}
});
loginForm.addStyleName("login-form");
addComponent(loginForm);
}
}
| UTF-8 | Java | 1,488 | java | LoginView.java | Java | [] | null | [] | package org.github.bobobot.ui.views;
import com.vaadin.navigator.View;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.LoginForm;
import lombok.extern.slf4j.Slf4j;
import org.github.bobobot.entities.User;
import org.github.bobobot.services.IUserService;
import org.github.bobobot.ui.MainUI;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import java.util.Optional;
@SpringView(name = LoginView.name)
@SpringComponent
@Slf4j
public class LoginView extends HorizontalLayout implements View {
public static final String name = "loginView";
@Autowired
private IUserService userService;
@PostConstruct
void init() {
LoginForm loginForm = new LoginForm();
loginForm.setUsernameCaption("Email");
loginForm.addLoginListener(loginEvent -> {
String email = loginEvent.getLoginParameter("username"); //yes, username
String password = loginEvent.getLoginParameter("password");
log.info("Login attempt with " + email + ", " + password + "...");
Optional<User> loggedInUser = userService.login(email, password);
if (loggedInUser.isPresent()) {
log.info("Successful login!");
((MainUI) getUI()).reRenderNavbar();
getUI().getNavigator().navigateTo(MainView.name);
} else {
log.info("Login failed.");
}
});
loginForm.addStyleName("login-form");
addComponent(loginForm);
}
}
| 1,488 | 0.754704 | 0.752688 | 49 | 29.367348 | 21.783436 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.755102 | false | false | 1 |
4871bb85831b603d841b4d93a4e199c51d8c501e | 20,822,001,452,561 | 51516263880023225c6f32cc9a2a5623446cb59f | /src/main/java/controller/SearchServlet.java | ded7591829a22ae1c005f552df1fd2f863096b31 | [
"Apache-2.0"
] | permissive | lan-mao/Reader | https://github.com/lan-mao/Reader | d3823ffc19e7f898c6f48196b0f1ffea90205f48 | ce4d9e1a7b145f83484649a73a666e6b1ffe6467 | refs/heads/master | "2022-09-24T10:55:41.013000" | "2020-04-21T09:07:36" | "2020-04-21T09:07:36" | 257,537,429 | 0 | 0 | Apache-2.0 | false | "2022-09-01T23:24:16" | "2020-04-21T08:57:57" | "2020-04-21T09:08:04" | "2022-09-01T23:24:15" | 20,666 | 0 | 0 | 5 | Java | false | false | package controller;
import com.alibaba.fastjson.JSONObject;
import entity.NovelPO;
import entity.WebsiteNovelPO;
import service.NovelService;
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;
import java.util.List;
/**
* 搜索的servlet
* create at 2019-05-12 by MaXin
*/
public class SearchServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
resp.setHeader("Content-Type","text/html;charset=UTF-8");
resp.setContentType("application/json;charset=UTF-8");
String title = req.getParameter("title");
List<NovelPO> list = NovelService.findByTitle(title);
String json = JSONObject.toJSONString(list);
PrintWriter out = resp.getWriter();
out.println(json);
out.close();
}
}
| UTF-8 | Java | 1,277 | java | SearchServlet.java | Java | [
{
"context": "ist;\n\n/**\n * 搜索的servlet\n * create at 2019-05-12 by MaXin\n */\npublic class SearchServlet extends HttpServle",
"end": 445,
"score": 0.9080396294593811,
"start": 440,
"tag": "USERNAME",
"value": "MaXin"
}
] | null | [] | package controller;
import com.alibaba.fastjson.JSONObject;
import entity.NovelPO;
import entity.WebsiteNovelPO;
import service.NovelService;
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;
import java.util.List;
/**
* 搜索的servlet
* create at 2019-05-12 by MaXin
*/
public class SearchServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
resp.setHeader("Content-Type","text/html;charset=UTF-8");
resp.setContentType("application/json;charset=UTF-8");
String title = req.getParameter("title");
List<NovelPO> list = NovelService.findByTitle(title);
String json = JSONObject.toJSONString(list);
PrintWriter out = resp.getWriter();
out.println(json);
out.close();
}
}
| 1,277 | 0.730921 | 0.721479 | 39 | 31.589743 | 26.70899 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.794872 | false | false | 1 |
ef3b1765876f77cc405a19c9ee1967d14d3f4b2e | 7,851,200,231,089 | 1db37f693f9b2d2df2e3b1fcf62d0cef19e1740b | /hivatectools/src/main/java/hivatec/ir/hivatectools/views/HivaProgressBar.java | a89af89473ae6f810fc088b39f46e8d49bbd0d43 | [] | no_license | ashkanpower/HivaTecTools | https://github.com/ashkanpower/HivaTecTools | 8ecd38020aeb88c701c4ab9ba236906f5031a506 | 5f99988a0e95d8308eb4b6cadcb85b9d3ec0c810 | refs/heads/master | "2020-04-22T00:08:31.989000" | "2020-04-20T09:07:47" | "2020-04-20T09:07:47" | 169,968,971 | 1 | 1 | null | true | "2019-02-10T11:04:15" | "2019-02-10T11:04:15" | "2019-02-04T07:53:31" | "2019-02-04T07:53:30" | 2,951 | 0 | 0 | 0 | null | false | null | package hivatec.ir.hivatectools.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.support.v4.graphics.ColorUtils;
import android.support.v4.widget.CircularProgressDrawable;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import hivatec.ir.hivatectools.R;
import hivatec.ir.hivatectools.helper.ViewUIHelper;
/**
* Created by ashkan on 4/24/18.
*/
public class HivaProgressBar extends ProgressBar {
int tintColor = 0;
int lineWidth = 0;
public HivaProgressBar(Context context) {
super(context);
init();
}
public HivaProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.HivaProgressBar, 0, 0);
tintColor = a.getColor(R.styleable.HivaProgressBar_tintColor, tintColor);
lineWidth = a.getDimensionPixelSize(R.styleable.HivaProgressBar_lineWidth, lineWidth);
a.recycle();
}
init();
}
void init(){
if(tintColor == 0) {
tintColor = getContext().getResources().getColor(R.color.colorPrimary);
}
if(lineWidth == 0) {
lineWidth = ViewUIHelper.dpToPx(4);
}
CircularProgressDrawable circularDrawable = new CircularProgressDrawable(getContext());
circularDrawable.setStrokeWidth(lineWidth);
circularDrawable.setStrokeCap(Paint.Cap.ROUND);
circularDrawable.setColorFilter(new
PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP));
this.setIndeterminateDrawable(circularDrawable);
}
}
| UTF-8 | Java | 1,652 | java | HivaProgressBar.java | Java | [
{
"context": "vatectools.helper.ViewUIHelper;\n\n/**\n * Created by ashkan on 4/24/18.\n */\n\npublic class HivaProgressBar ext",
"end": 512,
"score": 0.9992169737815857,
"start": 506,
"tag": "USERNAME",
"value": "ashkan"
}
] | null | [] | package hivatec.ir.hivatectools.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.support.v4.graphics.ColorUtils;
import android.support.v4.widget.CircularProgressDrawable;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import hivatec.ir.hivatectools.R;
import hivatec.ir.hivatectools.helper.ViewUIHelper;
/**
* Created by ashkan on 4/24/18.
*/
public class HivaProgressBar extends ProgressBar {
int tintColor = 0;
int lineWidth = 0;
public HivaProgressBar(Context context) {
super(context);
init();
}
public HivaProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.HivaProgressBar, 0, 0);
tintColor = a.getColor(R.styleable.HivaProgressBar_tintColor, tintColor);
lineWidth = a.getDimensionPixelSize(R.styleable.HivaProgressBar_lineWidth, lineWidth);
a.recycle();
}
init();
}
void init(){
if(tintColor == 0) {
tintColor = getContext().getResources().getColor(R.color.colorPrimary);
}
if(lineWidth == 0) {
lineWidth = ViewUIHelper.dpToPx(4);
}
CircularProgressDrawable circularDrawable = new CircularProgressDrawable(getContext());
circularDrawable.setStrokeWidth(lineWidth);
circularDrawable.setStrokeCap(Paint.Cap.ROUND);
circularDrawable.setColorFilter(new
PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP));
this.setIndeterminateDrawable(circularDrawable);
}
}
| 1,652 | 0.767554 | 0.75908 | 67 | 23.656717 | 26.238602 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.447761 | false | false | 1 |
64926a376ed55d1d8c4195a1ccfbb3ae36128a4d | 30,743,375,964,657 | 72bc332e7c53104319ad98eac387bd94d2278ef7 | /src/edu/upenn/cis/cis455/webserver/HTTPServeletContext.java | f31b9ae064ab00805e86ef0b0c862c2152492699 | [] | no_license | aryaa-gautam/Web-Crawler-and-XPathEngine | https://github.com/aryaa-gautam/Web-Crawler-and-XPathEngine | a45cae337442cc7c68f81ff549ace260d7701543 | 1b85716eb11778c3bc77dc4d11b705d875d2d8fd | refs/heads/master | "2016-08-12T03:30:52.766000" | "2015-10-22T04:13:08" | "2015-10-22T04:13:08" | 44,719,603 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.upenn.cis.cis455.webserver;
/*
*Mark a session as expired
*/
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Set;
import java.util.Vector;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import org.apache.log4j.Logger;
public class HTTPServeletContext implements ServletContext {
private HashMap<String,Object> attributes;
private HashMap<String,String> initParams;
String serveletContextName = null;
String srcDir = null;
protected static org.apache.log4j.Logger log= Logger.getLogger(HTTPServeletContext.class.getName());
public HTTPServeletContext() {
attributes = new HashMap<String,Object>();
initParams = new HashMap<String,String>();
}
/*
*Gets attributes for a given name
*/
public Object getAttribute(String name) {
return attributes.get(name);
}
/*
*Gets attributes
*/
public Enumeration getAttributeNames() {
Set<String> keys = attributes.keySet();
Vector<String> atts = new Vector<String>(keys);
return atts.elements();
}
/*
*Gets ServletContext
*/
public ServletContext getContext(String name) {
return this;
}
/*
*Gets Init Parameter
*/
public String getInitParameter(String name) {
return initParams.get(name);
}
public Enumeration getInitParameterNames() {
Set<String> keys = initParams.keySet();
Vector<String> atts = new Vector<String>(keys);
return atts.elements();
}
/*
*Gets Version
*/
public int getMajorVersion() {
return 2;
}
/*
*Gets Mime
*/
public String getMimeType(String file) {
return null;
}
public int getMinorVersion() {
return 4;
}
public RequestDispatcher getNamedDispatcher(String name) {
//not to be implemented
return null;
}
public String getRealPath(String path) {
File parent = new File(srcDir);
try {
parent = parent.getCanonicalFile();
if (!parent.exists() || !parent.isDirectory()) {
return null;
}
File child = new File(path).getCanonicalFile();
while (child != null) {
if (child.equals(parent)) {
return (srcDir + path);
}
child = child.getParentFile();
}
} catch (IOException e) {
log.error("["+ HTTPServeletContext.class.getName()+"] [ERROR] ",e);
//log.error("[" + ServerContext.class.getName() + "] [ERROR] ", e);
}
return null;
}
public RequestDispatcher getRequestDispatcher(String name) {
//not to be implemmented
return null;
}
public java.net.URL getResource(String path) {
//not to be implemmented
return null;
}
public java.io.InputStream getResourceAsStream(String path) {
//not to be implemmented
return null;
}
public java.util.Set getResourcePaths(String path) {
//not to be implemmented
return null;
}
public String getServerInfo() {
return "My Servelet";
}
public Servlet getServlet(String name) {
//deprecated
return null;
}
public String getServletContextName() {
return serveletContextName;
}
public Enumeration getServletNames() {
//deprecated
return null;
}
public Enumeration getServlets() {
//deprecated
return null;
}
public void log(Exception exception, String msg) {
//deprecated
//log(msg, (Throwable) exception);
}
public void log(String msg) {
System.err.println(msg);
IOException e = new IOException(msg);
log.error("["+ HttpServer.class.getName()+"] [ERROR] ",e);
}
public void log(String message, Throwable throwable) {
System.err.println(message);
throwable.printStackTrace(System.err);
IOException e = new IOException(message);
log.error("["+ HttpServer.class.getName()+"] [ERROR] ",e);
}
public void removeAttribute(String name) {
attributes.remove(name);
}
public void setAttribute(String name, Object object) {
attributes.put(name, object);
}
void setInitParam(String name, String value) {
initParams.put(name, value);
}
}
| UTF-8 | Java | 3,932 | java | HTTPServeletContext.java | Java | [] | null | [] | package edu.upenn.cis.cis455.webserver;
/*
*Mark a session as expired
*/
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Set;
import java.util.Vector;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import org.apache.log4j.Logger;
public class HTTPServeletContext implements ServletContext {
private HashMap<String,Object> attributes;
private HashMap<String,String> initParams;
String serveletContextName = null;
String srcDir = null;
protected static org.apache.log4j.Logger log= Logger.getLogger(HTTPServeletContext.class.getName());
public HTTPServeletContext() {
attributes = new HashMap<String,Object>();
initParams = new HashMap<String,String>();
}
/*
*Gets attributes for a given name
*/
public Object getAttribute(String name) {
return attributes.get(name);
}
/*
*Gets attributes
*/
public Enumeration getAttributeNames() {
Set<String> keys = attributes.keySet();
Vector<String> atts = new Vector<String>(keys);
return atts.elements();
}
/*
*Gets ServletContext
*/
public ServletContext getContext(String name) {
return this;
}
/*
*Gets Init Parameter
*/
public String getInitParameter(String name) {
return initParams.get(name);
}
public Enumeration getInitParameterNames() {
Set<String> keys = initParams.keySet();
Vector<String> atts = new Vector<String>(keys);
return atts.elements();
}
/*
*Gets Version
*/
public int getMajorVersion() {
return 2;
}
/*
*Gets Mime
*/
public String getMimeType(String file) {
return null;
}
public int getMinorVersion() {
return 4;
}
public RequestDispatcher getNamedDispatcher(String name) {
//not to be implemented
return null;
}
public String getRealPath(String path) {
File parent = new File(srcDir);
try {
parent = parent.getCanonicalFile();
if (!parent.exists() || !parent.isDirectory()) {
return null;
}
File child = new File(path).getCanonicalFile();
while (child != null) {
if (child.equals(parent)) {
return (srcDir + path);
}
child = child.getParentFile();
}
} catch (IOException e) {
log.error("["+ HTTPServeletContext.class.getName()+"] [ERROR] ",e);
//log.error("[" + ServerContext.class.getName() + "] [ERROR] ", e);
}
return null;
}
public RequestDispatcher getRequestDispatcher(String name) {
//not to be implemmented
return null;
}
public java.net.URL getResource(String path) {
//not to be implemmented
return null;
}
public java.io.InputStream getResourceAsStream(String path) {
//not to be implemmented
return null;
}
public java.util.Set getResourcePaths(String path) {
//not to be implemmented
return null;
}
public String getServerInfo() {
return "My Servelet";
}
public Servlet getServlet(String name) {
//deprecated
return null;
}
public String getServletContextName() {
return serveletContextName;
}
public Enumeration getServletNames() {
//deprecated
return null;
}
public Enumeration getServlets() {
//deprecated
return null;
}
public void log(Exception exception, String msg) {
//deprecated
//log(msg, (Throwable) exception);
}
public void log(String msg) {
System.err.println(msg);
IOException e = new IOException(msg);
log.error("["+ HttpServer.class.getName()+"] [ERROR] ",e);
}
public void log(String message, Throwable throwable) {
System.err.println(message);
throwable.printStackTrace(System.err);
IOException e = new IOException(message);
log.error("["+ HttpServer.class.getName()+"] [ERROR] ",e);
}
public void removeAttribute(String name) {
attributes.remove(name);
}
public void setAttribute(String name, Object object) {
attributes.put(name, object);
}
void setInitParam(String name, String value) {
initParams.put(name, value);
}
}
| 3,932 | 0.699644 | 0.697864 | 186 | 20.139786 | 19.766155 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.731183 | false | false | 1 |
1c6f04cd3ceddd0f5ff5f7cd2d75d1a36c025a95 | 10,728,828,306,033 | 18351858b17be063f34258895f1c2917832af927 | /River.java | ac8e1dc16ca4b426c596a49105d8ffff31c011b6 | [] | no_license | esleytel22/ThreadRacer | https://github.com/esleytel22/ThreadRacer | 177c660b782bf8171cd14494319ec2ffbc337e10 | 0a773032a8a238846b78659cb3b17c83250c36ba | refs/heads/master | "2020-05-26T04:46:42.247000" | "2019-05-22T20:38:53" | "2019-05-22T20:38:53" | 188,110,297 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Deque;
import java.util.LinkedList;
public class River {
private Deque<RandomThread> queue;
private int Racer;
public River(int nRacer) {
this.Racer = nRacer;
queue = new LinkedList<>();
}
public synchronized void addToVector(RandomThread randomThread) {
RandomThread previousRacer = queue.peekLast();
if (previousRacer != null) {
previousRacer.setNextRacer(randomThread);
}
queue.add(randomThread);
}
public boolean allReadyToCrossTheRiver() {
return queue.size() == Racer;
}
public void awakeAll() {
for (RandomThread randomThread : queue) {
randomThread.getThread().interrupt();
}
}
}
| UTF-8 | Java | 776 | java | River.java | Java | [] | null | [] | import java.util.Deque;
import java.util.LinkedList;
public class River {
private Deque<RandomThread> queue;
private int Racer;
public River(int nRacer) {
this.Racer = nRacer;
queue = new LinkedList<>();
}
public synchronized void addToVector(RandomThread randomThread) {
RandomThread previousRacer = queue.peekLast();
if (previousRacer != null) {
previousRacer.setNextRacer(randomThread);
}
queue.add(randomThread);
}
public boolean allReadyToCrossTheRiver() {
return queue.size() == Racer;
}
public void awakeAll() {
for (RandomThread randomThread : queue) {
randomThread.getThread().interrupt();
}
}
}
| 776 | 0.596649 | 0.596649 | 30 | 23.866667 | 19.665085 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.366667 | false | false | 1 |
12f0da0b6508b11252f50a46c7050e855cc4b8d7 | 13,065,290,525,116 | ed2b273c7d09011e17162d69eb87909dc39fb0d2 | /src/main/java/practise/Value/TestArgsWords.java | b3d99206cec4eaa42deee306dcce3313cf98b08e | [] | no_license | fuzhennan/AQS_DEMO | https://github.com/fuzhennan/AQS_DEMO | b6ad2a6dd61f4fefce2fd27f6d82f1c4825a2954 | eead91b7ec1f5570157e1ff70fcfa6e9fd745ccf | refs/heads/master | "2022-12-15T23:31:07.284000" | "2020-09-20T06:06:45" | "2020-09-20T06:06:45" | 266,349,122 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package src.practise.Value;
import java.util.HashMap;
import java.util.Map;
public class TestArgsWords {
private static final int ONE=1;
public static void main(String[] args){
Map<String,Integer> m=new HashMap<String, Integer>();
for (String arg : args) {
int freq = m.get(arg) == null ? 0 : m.get(arg);
m.put(arg, freq == 0 ? ONE : freq + 1);
}
System.out.println(m.size()+"distinct words detected;");
System.out.println(m);
}
}
| UTF-8 | Java | 510 | java | TestArgsWords.java | Java | [] | null | [] | package src.practise.Value;
import java.util.HashMap;
import java.util.Map;
public class TestArgsWords {
private static final int ONE=1;
public static void main(String[] args){
Map<String,Integer> m=new HashMap<String, Integer>();
for (String arg : args) {
int freq = m.get(arg) == null ? 0 : m.get(arg);
m.put(arg, freq == 0 ? ONE : freq + 1);
}
System.out.println(m.size()+"distinct words detected;");
System.out.println(m);
}
}
| 510 | 0.590196 | 0.582353 | 17 | 29 | 20.962151 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false | 1 |
947dd8c8b4a3af6acc19917d3026b9ebe397c892 | 16,561,393,905,733 | ddd1ba66d719204ffd736dd0df804a6f154befb0 | /src/nuevo_asignatura.java | 601407cab1cb53055fc93d497a34d23a020c283c | [] | no_license | edgardoalvarez100/SIA-PLSQL | https://github.com/edgardoalvarez100/SIA-PLSQL | 502280529437aea9e773ba1dce3d8d132038def8 | 022c278144370316fe109a288dff9fca045e9a8f | refs/heads/master | "2021-01-02T22:30:41.712000" | "2015-06-01T13:31:58" | "2015-06-01T13:31:58" | 33,020,562 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import dao.AsignaturaDao;
import javax.swing.JOptionPane;
import java.sql.*;
public class nuevo_asignatura extends javax.swing.JFrame {
/**
* Creates new form nuevo_asignatura
*/
public nuevo_asignatura() {
initComponents();
secuencia_codigo();
}
public void secuencia_codigo() {
AsignaturaDao db = new AsignaturaDao();
int n = db.ultima_secuencia();
lbcodigo.setText(String.valueOf(n));
}
public boolean validar() {
if (txt_descripcion.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Escriba una descripción");
return false;
}
if (ht.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Escriba horas teoricas");
return false;
}
if (hp.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Escriba horas practicas");
return false;
}
return true;
}
public void calcular_credito() {
int resultado, horai, horap, horat;
if (validar()) {
if ("A".equals(txt_tipo.getSelectedItem())) {
horap = Integer.parseInt(hp.getText());
horat = Integer.parseInt(ht.getText());
horai = horat * 2;
hi.setText(Integer.toString(horai));
resultado = (horat + horap + horai) * 16 / 48;
txt_credito.setText(Integer.toString(resultado));
}
if ("B".equals(txt_tipo.getSelectedItem())) {
horap = Integer.parseInt(hp.getText());
horat = Integer.parseInt(ht.getText());
horai = horat + horap;
hi.setText(Integer.toString(horai));
resultado = (horat + horap + horai) * 16 / 48;
txt_credito.setText(Integer.toString(resultado));
}
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
lbcodigo = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
txt_descripcion = new javax.swing.JTextField();
ht = new javax.swing.JTextField();
hp = new javax.swing.JTextField();
hi = new javax.swing.JTextField();
txt_tipo = new javax.swing.JComboBox();
jLabel9 = new javax.swing.JLabel();
txt_credito = new javax.swing.JTextField();
bt_guardar = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
bt_calcular = new javax.swing.JButton();
setTitle("Nueva Asignatura");
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
jLabel1.setText("Nueva Asignatura");
jLabel2.setText("Codigo");
lbcodigo.setFont(new java.awt.Font("Tahoma", 1, 13));
lbcodigo.setText("0000000");
jLabel4.setText("Descripción");
jLabel5.setText("Horas Teorica");
jLabel6.setText("Horas Practicas");
jLabel7.setText("Horas Independientes");
jLabel8.setText("Tipo");
ht.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
htKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
htKeyTyped(evt);
}
});
hi.setEditable(false);
txt_tipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A", "B" }));
jLabel9.setText("Credito");
txt_credito.setEditable(false);
txt_credito.setFont(new java.awt.Font("Tahoma", 1, 11));
bt_guardar.setText("Guardar");
bt_guardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_guardarActionPerformed(evt);
}
});
jButton2.setText("Salir");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
bt_calcular.setText("Calcular");
bt_calcular.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_calcularActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jLabel2)
.addComponent(jLabel9))
.addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbcodigo)
.addComponent(txt_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txt_credito, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hi, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hp, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ht, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bt_calcular))
.addComponent(txt_descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addContainerGap(170, Short.MAX_VALUE)
.addComponent(bt_guardar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(40, 40, 40))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(lbcodigo))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txt_descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(txt_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(7, 7, 7)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(ht, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(hp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(hi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(txt_credito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bt_calcular))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(bt_guardar))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void bt_calcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_calcularActionPerformed
calcular_credito();
}//GEN-LAST:event_bt_calcularActionPerformed
private void htKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_htKeyPressed
}//GEN-LAST:event_htKeyPressed
private void htKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_htKeyTyped
}//GEN-LAST:event_htKeyTyped
private void bt_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_guardarActionPerformed
calcular_credito();
if (validar()) {
AsignaturaDao db = new AsignaturaDao();
int respuesta = db.guardar(txt_descripcion.getText(), Integer.parseInt(txt_credito.getText()), Integer.parseInt(ht.getText()), Integer.parseInt(hp.getText()), Integer.parseInt(hi.getText()), txt_tipo.getSelectedItem().toString());
if (respuesta == 1) {
JOptionPane.showMessageDialog(this, "Nueva asignatura guardada");
this.hide();
} else {
JOptionPane.showMessageDialog(this, "Ocurrió un error guardando");
}
}
}//GEN-LAST:event_bt_guardarActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
this.hide();
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new nuevo_asignatura().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bt_calcular;
private javax.swing.JButton bt_guardar;
private javax.swing.JTextField hi;
private javax.swing.JTextField hp;
private javax.swing.JTextField ht;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JLabel lbcodigo;
private javax.swing.JTextField txt_credito;
private javax.swing.JTextField txt_descripcion;
private javax.swing.JComboBox txt_tipo;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 15,096 | java | nuevo_asignatura.java | Java | [] | null | [] |
import dao.AsignaturaDao;
import javax.swing.JOptionPane;
import java.sql.*;
public class nuevo_asignatura extends javax.swing.JFrame {
/**
* Creates new form nuevo_asignatura
*/
public nuevo_asignatura() {
initComponents();
secuencia_codigo();
}
public void secuencia_codigo() {
AsignaturaDao db = new AsignaturaDao();
int n = db.ultima_secuencia();
lbcodigo.setText(String.valueOf(n));
}
public boolean validar() {
if (txt_descripcion.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Escriba una descripción");
return false;
}
if (ht.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Escriba horas teoricas");
return false;
}
if (hp.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Escriba horas practicas");
return false;
}
return true;
}
public void calcular_credito() {
int resultado, horai, horap, horat;
if (validar()) {
if ("A".equals(txt_tipo.getSelectedItem())) {
horap = Integer.parseInt(hp.getText());
horat = Integer.parseInt(ht.getText());
horai = horat * 2;
hi.setText(Integer.toString(horai));
resultado = (horat + horap + horai) * 16 / 48;
txt_credito.setText(Integer.toString(resultado));
}
if ("B".equals(txt_tipo.getSelectedItem())) {
horap = Integer.parseInt(hp.getText());
horat = Integer.parseInt(ht.getText());
horai = horat + horap;
hi.setText(Integer.toString(horai));
resultado = (horat + horap + horai) * 16 / 48;
txt_credito.setText(Integer.toString(resultado));
}
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
lbcodigo = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
txt_descripcion = new javax.swing.JTextField();
ht = new javax.swing.JTextField();
hp = new javax.swing.JTextField();
hi = new javax.swing.JTextField();
txt_tipo = new javax.swing.JComboBox();
jLabel9 = new javax.swing.JLabel();
txt_credito = new javax.swing.JTextField();
bt_guardar = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
bt_calcular = new javax.swing.JButton();
setTitle("Nueva Asignatura");
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
jLabel1.setText("Nueva Asignatura");
jLabel2.setText("Codigo");
lbcodigo.setFont(new java.awt.Font("Tahoma", 1, 13));
lbcodigo.setText("0000000");
jLabel4.setText("Descripción");
jLabel5.setText("Horas Teorica");
jLabel6.setText("Horas Practicas");
jLabel7.setText("Horas Independientes");
jLabel8.setText("Tipo");
ht.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
htKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
htKeyTyped(evt);
}
});
hi.setEditable(false);
txt_tipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A", "B" }));
jLabel9.setText("Credito");
txt_credito.setEditable(false);
txt_credito.setFont(new java.awt.Font("Tahoma", 1, 11));
bt_guardar.setText("Guardar");
bt_guardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_guardarActionPerformed(evt);
}
});
jButton2.setText("Salir");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
bt_calcular.setText("Calcular");
bt_calcular.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_calcularActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jLabel2)
.addComponent(jLabel9))
.addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbcodigo)
.addComponent(txt_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txt_credito, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hi, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hp, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ht, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bt_calcular))
.addComponent(txt_descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addContainerGap(170, Short.MAX_VALUE)
.addComponent(bt_guardar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(40, 40, 40))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(lbcodigo))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txt_descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(txt_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(7, 7, 7)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(ht, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(hp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(hi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(txt_credito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bt_calcular))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(bt_guardar))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void bt_calcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_calcularActionPerformed
calcular_credito();
}//GEN-LAST:event_bt_calcularActionPerformed
private void htKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_htKeyPressed
}//GEN-LAST:event_htKeyPressed
private void htKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_htKeyTyped
}//GEN-LAST:event_htKeyTyped
private void bt_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_guardarActionPerformed
calcular_credito();
if (validar()) {
AsignaturaDao db = new AsignaturaDao();
int respuesta = db.guardar(txt_descripcion.getText(), Integer.parseInt(txt_credito.getText()), Integer.parseInt(ht.getText()), Integer.parseInt(hp.getText()), Integer.parseInt(hi.getText()), txt_tipo.getSelectedItem().toString());
if (respuesta == 1) {
JOptionPane.showMessageDialog(this, "Nueva asignatura guardada");
this.hide();
} else {
JOptionPane.showMessageDialog(this, "Ocurrió un error guardando");
}
}
}//GEN-LAST:event_bt_guardarActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
this.hide();
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(nuevo_asignatura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new nuevo_asignatura().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bt_calcular;
private javax.swing.JButton bt_guardar;
private javax.swing.JTextField hi;
private javax.swing.JTextField hp;
private javax.swing.JTextField ht;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JLabel lbcodigo;
private javax.swing.JTextField txt_credito;
private javax.swing.JTextField txt_descripcion;
private javax.swing.JComboBox txt_tipo;
// End of variables declaration//GEN-END:variables
}
| 15,096 | 0.613331 | 0.604784 | 320 | 46.162498 | 39.004147 | 238 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6125 | false | false | 1 |
26c4dbd0b27fa347b0eb314c6d70b1d9550d7c5a | 23,922,967,844,568 | b7420a7b52080483d246b024fcb78a12a01f4d5a | /src/it/univr/rubikcube/model/RubikCubeModelAxis.java | 43ca6fad3f6231f50454adbe4886099f46ff4343 | [] | no_license | jiraky90/Rubik | https://github.com/jiraky90/Rubik | 316e6289d494674189d1f206536802d159fa1208 | 440d1211d98654cdce1b51775130a201dc588780 | refs/heads/master | "2021-01-18T13:50:06.454000" | "2015-06-08T14:02:04" | "2015-06-08T14:02:04" | 35,480,600 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.univr.rubikcube.model;
/**
* Rubik cube model axis.
* @author Alessandro Menti
*/
public enum RubikCubeModelAxis {
/**
* X axis (oriented from the LEFT to the RIGHT face).
*/
X,
/**
* Y axis (oriented from the DOWN to the UP face).
*/
Y,
/**
* Z axis (oriented from the BACK to the FRONT face).
*/
Z,
}
| UTF-8 | Java | 372 | java | RubikCubeModelAxis.java | Java | [
{
"context": "e.model;\n\n/**\n * Rubik cube model axis.\n * @author Alessandro Menti\n */\npublic enum RubikCubeModelAxis {\n /**\n ",
"end": 92,
"score": 0.9998181462287903,
"start": 76,
"tag": "NAME",
"value": "Alessandro Menti"
}
] | null | [] | package it.univr.rubikcube.model;
/**
* Rubik cube model axis.
* @author <NAME>
*/
public enum RubikCubeModelAxis {
/**
* X axis (oriented from the LEFT to the RIGHT face).
*/
X,
/**
* Y axis (oriented from the DOWN to the UP face).
*/
Y,
/**
* Z axis (oriented from the BACK to the FRONT face).
*/
Z,
}
| 362 | 0.561828 | 0.561828 | 20 | 17.6 | 18.850464 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 1 |
2aca0d347bab174809b78f01418faefeffcffbee | 31,542,239,845,109 | 68febc71117dbf839d711a4cd50fa30a62ea25bd | /app/src/main/java/sampleapp/stocktwits/com/stocksapp/Data/Symbols.java | e1789d1c842bd567e6ab061c21ee7c7fa9501722 | [] | no_license | gray419/StockTwitsSampleApp | https://github.com/gray419/StockTwitsSampleApp | 554042e8607f4e1c123f166a9db7606fb55261d0 | 21c43467ca4a932d953eae9c683538b86f9bd95e | refs/heads/master | "2021-01-10T21:32:29.484000" | "2015-01-02T20:03:57" | "2015-01-02T20:03:57" | 28,678,356 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sampleapp.stocktwits.com.stocksapp.Data;
public class Symbols {
public String id;
public String title;
public String symbol;
}
| UTF-8 | Java | 148 | java | Symbols.java | Java | [] | null | [] | package sampleapp.stocktwits.com.stocksapp.Data;
public class Symbols {
public String id;
public String title;
public String symbol;
}
| 148 | 0.736486 | 0.736486 | 7 | 20.142857 | 15.075321 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 1 |
845d6d42dc6e2a5febf994026aee84a344dc7dea | 31,774,168,092,074 | 149c8979271ba382ea419dca70a72d6eb181d1a8 | /app/src/main/java/com/example/tung/demo/Model/searchsssss.java | 73bdd4041231bf41eb52fe62573cc41bac7d04c7 | [] | no_license | vanlove101/demo | https://github.com/vanlove101/demo | 41b9c56492ae25e2a00a4a4808b383ccaaa88ef2 | d2f33f78f32dd063d7de9e328bee78c13244c3d2 | refs/heads/master | "2020-03-22T11:55:58.321000" | "2018-07-06T16:07:50" | "2018-07-06T16:07:50" | 140,005,501 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.tung.demo.Model;
public class searchsssss {
public searchsssss(String img, String tensp, String gia, String ID, String txt_GiaKhuyenMai) {
this.img = img;
this.tensp = tensp;
this.gia = gia;
this.ID = ID;
this.txt_GiaKhuyenMai = txt_GiaKhuyenMai;
}
public String getAbbreviate() {
return abbreviate;
}
public void setAbbreviate(String abbreviate) {
this.abbreviate = abbreviate;
}
private String abbreviate;
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getTensp() {
return tensp;
}
public void setTensp(String tensp) {
this.tensp = tensp;
}
public String getGia() {
return gia;
}
public void setGia(String gia) {
this.gia = gia;
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getTxt_GiaKhuyenMai() {
return txt_GiaKhuyenMai;
}
public void setTxt_GiaKhuyenMai(String txt_GiaKhuyenMai) {
this.txt_GiaKhuyenMai = txt_GiaKhuyenMai;
}
private String img;
private String tensp;
private String gia;
private String ID;
private String txt_GiaKhuyenMai;
}
| UTF-8 | Java | 1,360 | java | searchsssss.java | Java | [] | null | [] | package com.example.tung.demo.Model;
public class searchsssss {
public searchsssss(String img, String tensp, String gia, String ID, String txt_GiaKhuyenMai) {
this.img = img;
this.tensp = tensp;
this.gia = gia;
this.ID = ID;
this.txt_GiaKhuyenMai = txt_GiaKhuyenMai;
}
public String getAbbreviate() {
return abbreviate;
}
public void setAbbreviate(String abbreviate) {
this.abbreviate = abbreviate;
}
private String abbreviate;
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getTensp() {
return tensp;
}
public void setTensp(String tensp) {
this.tensp = tensp;
}
public String getGia() {
return gia;
}
public void setGia(String gia) {
this.gia = gia;
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getTxt_GiaKhuyenMai() {
return txt_GiaKhuyenMai;
}
public void setTxt_GiaKhuyenMai(String txt_GiaKhuyenMai) {
this.txt_GiaKhuyenMai = txt_GiaKhuyenMai;
}
private String img;
private String tensp;
private String gia;
private String ID;
private String txt_GiaKhuyenMai;
}
| 1,360 | 0.596324 | 0.596324 | 68 | 19 | 18.574175 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false | 1 |
e89f88f44fe4a3e940cc210c1176a8033f97c3b4 | 29,892,972,393,701 | c20c3cb1699f726fc285a6917d0ee673915f5b06 | /meep/MeepHomeRegressionTest/src/com/oregonscientific/meep/junit/test/SignInMessageResponder.java | d322d73a73aaba9eaeec630f991f679efa3d7ae6 | [
"Apache-2.0"
] | permissive | zoozooll/MyExercise | https://github.com/zoozooll/MyExercise | 35a18c0ead552d5be45f627066a5066f6cc8c99b | 1be14e0252babb28e32951fa1e35fc867a6ac070 | refs/heads/master | "2023-04-04T04:24:14.275000" | "2021-04-18T15:01:03" | "2021-04-18T15:01:03" | 108,665,215 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oregonscientific.meep.junit.test;
import com.oregonscientific.meep.msm.Message;
import com.oregonscientific.meep.msm.MessageFilter;
public class SignInMessageResponder extends MessageResponder {
public SignInMessageResponder() {
super(new MessageFilter(Message.PROCESS_ACCOUNT, Message.OPERATION_CODE_SIGN_IN));
}
@Override
public String onRespond(Message message) {
// TODO Auto-generated method stub
String json = "{\"status\": \"Authenticated successfully.\", \"received\": true, \"first_name\": \"" +
TestData.TEST_USER_NAME +
"\", \"code\": 200, \"opcode\": \"sign-in\", \"userid\": \"50e5825c04f77a1c945f0354\", \"meeptag\": \"mikael#8\", \"requestid\": 1, \"messageid\": \"" +
message.getMessageID() + "\", \"is_guest\": false, \"proc\": \"account\"}";
return json;
}
}
| UTF-8 | Java | 826 | java | SignInMessageResponder.java | Java | [] | null | [] | package com.oregonscientific.meep.junit.test;
import com.oregonscientific.meep.msm.Message;
import com.oregonscientific.meep.msm.MessageFilter;
public class SignInMessageResponder extends MessageResponder {
public SignInMessageResponder() {
super(new MessageFilter(Message.PROCESS_ACCOUNT, Message.OPERATION_CODE_SIGN_IN));
}
@Override
public String onRespond(Message message) {
// TODO Auto-generated method stub
String json = "{\"status\": \"Authenticated successfully.\", \"received\": true, \"first_name\": \"" +
TestData.TEST_USER_NAME +
"\", \"code\": 200, \"opcode\": \"sign-in\", \"userid\": \"50e5825c04f77a1c945f0354\", \"meeptag\": \"mikael#8\", \"requestid\": 1, \"messageid\": \"" +
message.getMessageID() + "\", \"is_guest\": false, \"proc\": \"account\"}";
return json;
}
}
| 826 | 0.679177 | 0.651332 | 26 | 30.76923 | 39.14304 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.692308 | false | false | 1 |
242caaf297985aac7572199eb58d3b17085bf18d | 33,062,658,308,745 | 302372630a829dd3c8f53dc4a514ebecf9cb4120 | /app/src/main/java/com/bandfitproject/chat/ChatAdapter.java | e6ef35213dfce187f757f238d519be91369c757c | [] | no_license | DarrenKimBat/bandFitProject | https://github.com/DarrenKimBat/bandFitProject | 6694e2bb3dbb4fb9fcd7f07363ad3ba5409d6515 | 6724036985cd72808d2be8aa8ca505b47ea88a4d | refs/heads/master | "2021-01-11T14:10:48.876000" | "2017-06-23T03:01:31" | "2017-06-23T03:01:31" | 94,995,111 | 2 | 1 | null | false | "2017-06-22T16:31:19" | "2017-06-21T11:02:51" | "2017-06-21T11:09:22" | "2017-06-22T16:31:18" | 2,077 | 2 | 1 | 0 | Java | null | null | package com.bandfitproject.chat;
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.bandfitproject.R;
import java.text.SimpleDateFormat;
import java.util.Locale;
import static com.bandfitproject.login.LoginActivity.user;
public class ChatAdapter extends ArrayAdapter<ChatData> {
private final static int TYPE_ME = 0;
private final static int TYPE_ANOTHER = 1;
private final static int TYPE_ADMIN = 2;
private final SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("a h:mm", Locale.getDefault());
SoundPool pool;
int ddok;
public ChatAdapter(Context context, int resource) {
super(context, resource);
}
public View getView(int position, View convertView, ViewGroup parent) {
int viewType = getItemViewType(position);
LayoutInflater inflator = LayoutInflater.from(getContext());
if( convertView == null) {
if(viewType == TYPE_ME) {
convertView = setMySelfView(inflator);
}
// 추가됨 없애버리자 안되면 //
else if(viewType == TYPE_ADMIN) {
convertView = setADMINView(inflator);
}
else {
convertView = setYourView(inflator);
}
}
if (convertView.getTag() instanceof ViewHolderAnother) {
((ViewHolderAnother)convertView.getTag()).setData(position);
/*if (viewType != TYPE_ANOTHER) {
convertView = setYourView(inflator);
}
((ViewHolderAnother)convertView.getTag()).setData(position);*/
}
else if (convertView.getTag() instanceof ViewHolderADMIN) {
((ViewHolderADMIN)convertView.getTag()).setData(position);
}
else {
((ViewHolderOwn)convertView.getTag()).setData(position);
/*if (viewType != TYPE_ME) {
convertView = setMySelfView(inflator);
}
((ViewHolderOwn)convertView.getTag()).setData(position);*/
}
return convertView;
}
private View setMySelfView(LayoutInflater inflater) {
View convertView = inflater.inflate(R.layout.chat_own, null);
ViewHolderOwn holder = new ViewHolderOwn();
holder.bindView(convertView);
convertView.setTag(holder);
return convertView;
}
private View setYourView(LayoutInflater inflater) {
View convertView = inflater.inflate(R.layout.chat_you, null);
ViewHolderAnother holder = new ViewHolderAnother();
holder.bindView(convertView);
convertView.setTag(holder);
return convertView;
}
private View setADMINView(LayoutInflater inflater) {
View convertView = inflater.inflate(R.layout.chat_server, null);
ViewHolderADMIN holder = new ViewHolderADMIN();
holder.bindView(convertView);
convertView.setTag(holder);
return convertView;
}
private class ViewHolderADMIN {
private TextView mTxtMessage;
private void bindView(View convertView) {
mTxtMessage = (TextView)convertView.findViewById(R.id.server_txt_message);
}
private void setData(int posiotion) {
ChatData chatData = getItem(posiotion) ;
mTxtMessage.setText(chatData.message);
}
}
private class ViewHolderOwn {
private TextView mTxtMessage;
private TextView mTxtTime;
private void bindView(View convertView) {
mTxtMessage = (TextView)convertView.findViewById(R.id.txt_message);;
mTxtTime = (TextView)convertView.findViewById(R.id.txt_time);
}
private void setData(int posiotion) {
ChatData chatData = getItem(posiotion) ;
mTxtMessage.setText(chatData.message);
mTxtTime.setText(mSimpleDateFormat.format(chatData.time));
}
}
private class ViewHolderAnother {
private TextView mTxtUserName;
private TextView mTxtMessage;
private TextView mTxtTime;
private void bindView(View convertView) {
mTxtUserName = (TextView)convertView.findViewById(R.id.txt_userName);
mTxtMessage = (TextView)convertView.findViewById(R.id.txt_message);
mTxtTime = (TextView)convertView.findViewById(R.id.txt_time);
}
private void setData(int posiotion) {
ChatData chatData = getItem(posiotion) ;
mTxtUserName.setText(chatData.userName);
mTxtMessage.setText(chatData.message);
mTxtTime.setText(mSimpleDateFormat.format(chatData.time));
}
}
@Override
public int getViewTypeCount() {
return 3;
}
/**
* 리스트뷰 아이디랑 로그인한 아이디가 일치하면 TYPE_ME
* 일치하지 않으면 TYPE_ANOTHER
*/
@Override
public int getItemViewType(int position) {
String getName = getItem(position).userName;
if (getName.equals(user.getId()))
return TYPE_ME;
else if (getName.equals("ADMIN"))
return TYPE_ADMIN;
else {
// pool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
// ddok = pool.load(getContext(), R.raw.sound_out, 1);
// pool.play(ddok, 1, 1, 0, 0, 1);
return TYPE_ANOTHER;
}
}
} | UTF-8 | Java | 5,587 | java | ChatAdapter.java | Java | [
{
"context": "ame = (TextView)convertView.findViewById(R.id.txt_userName);\n mTxtMessage = (TextView)convertView",
"end": 4390,
"score": 0.7193023562431335,
"start": 4382,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package com.bandfitproject.chat;
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.bandfitproject.R;
import java.text.SimpleDateFormat;
import java.util.Locale;
import static com.bandfitproject.login.LoginActivity.user;
public class ChatAdapter extends ArrayAdapter<ChatData> {
private final static int TYPE_ME = 0;
private final static int TYPE_ANOTHER = 1;
private final static int TYPE_ADMIN = 2;
private final SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("a h:mm", Locale.getDefault());
SoundPool pool;
int ddok;
public ChatAdapter(Context context, int resource) {
super(context, resource);
}
public View getView(int position, View convertView, ViewGroup parent) {
int viewType = getItemViewType(position);
LayoutInflater inflator = LayoutInflater.from(getContext());
if( convertView == null) {
if(viewType == TYPE_ME) {
convertView = setMySelfView(inflator);
}
// 추가됨 없애버리자 안되면 //
else if(viewType == TYPE_ADMIN) {
convertView = setADMINView(inflator);
}
else {
convertView = setYourView(inflator);
}
}
if (convertView.getTag() instanceof ViewHolderAnother) {
((ViewHolderAnother)convertView.getTag()).setData(position);
/*if (viewType != TYPE_ANOTHER) {
convertView = setYourView(inflator);
}
((ViewHolderAnother)convertView.getTag()).setData(position);*/
}
else if (convertView.getTag() instanceof ViewHolderADMIN) {
((ViewHolderADMIN)convertView.getTag()).setData(position);
}
else {
((ViewHolderOwn)convertView.getTag()).setData(position);
/*if (viewType != TYPE_ME) {
convertView = setMySelfView(inflator);
}
((ViewHolderOwn)convertView.getTag()).setData(position);*/
}
return convertView;
}
private View setMySelfView(LayoutInflater inflater) {
View convertView = inflater.inflate(R.layout.chat_own, null);
ViewHolderOwn holder = new ViewHolderOwn();
holder.bindView(convertView);
convertView.setTag(holder);
return convertView;
}
private View setYourView(LayoutInflater inflater) {
View convertView = inflater.inflate(R.layout.chat_you, null);
ViewHolderAnother holder = new ViewHolderAnother();
holder.bindView(convertView);
convertView.setTag(holder);
return convertView;
}
private View setADMINView(LayoutInflater inflater) {
View convertView = inflater.inflate(R.layout.chat_server, null);
ViewHolderADMIN holder = new ViewHolderADMIN();
holder.bindView(convertView);
convertView.setTag(holder);
return convertView;
}
private class ViewHolderADMIN {
private TextView mTxtMessage;
private void bindView(View convertView) {
mTxtMessage = (TextView)convertView.findViewById(R.id.server_txt_message);
}
private void setData(int posiotion) {
ChatData chatData = getItem(posiotion) ;
mTxtMessage.setText(chatData.message);
}
}
private class ViewHolderOwn {
private TextView mTxtMessage;
private TextView mTxtTime;
private void bindView(View convertView) {
mTxtMessage = (TextView)convertView.findViewById(R.id.txt_message);;
mTxtTime = (TextView)convertView.findViewById(R.id.txt_time);
}
private void setData(int posiotion) {
ChatData chatData = getItem(posiotion) ;
mTxtMessage.setText(chatData.message);
mTxtTime.setText(mSimpleDateFormat.format(chatData.time));
}
}
private class ViewHolderAnother {
private TextView mTxtUserName;
private TextView mTxtMessage;
private TextView mTxtTime;
private void bindView(View convertView) {
mTxtUserName = (TextView)convertView.findViewById(R.id.txt_userName);
mTxtMessage = (TextView)convertView.findViewById(R.id.txt_message);
mTxtTime = (TextView)convertView.findViewById(R.id.txt_time);
}
private void setData(int posiotion) {
ChatData chatData = getItem(posiotion) ;
mTxtUserName.setText(chatData.userName);
mTxtMessage.setText(chatData.message);
mTxtTime.setText(mSimpleDateFormat.format(chatData.time));
}
}
@Override
public int getViewTypeCount() {
return 3;
}
/**
* 리스트뷰 아이디랑 로그인한 아이디가 일치하면 TYPE_ME
* 일치하지 않으면 TYPE_ANOTHER
*/
@Override
public int getItemViewType(int position) {
String getName = getItem(position).userName;
if (getName.equals(user.getId()))
return TYPE_ME;
else if (getName.equals("ADMIN"))
return TYPE_ADMIN;
else {
// pool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
// ddok = pool.load(getContext(), R.raw.sound_out, 1);
// pool.play(ddok, 1, 1, 0, 0, 1);
return TYPE_ANOTHER;
}
}
} | 5,587 | 0.631646 | 0.629468 | 162 | 33.024693 | 24.382484 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.592593 | false | false | 1 |
0145c33a44f8b3b23a3e9e60cf4aec505be27f90 | 7,241,314,903,503 | 19c087388095809748b717d11e7f115d298b74f6 | /src/main/java/com/nbdyn/community/dao/AlphaDaoHibernatelmpl.java | 21ced06be8770f35f53c67fce6af68d09ca91661 | [] | no_license | nbdyn/Web2020 | https://github.com/nbdyn/Web2020 | 50e3f5f17576d5acee078bdb1d838798620a1bf6 | 16eafe37a7cd4c8da48e940e76e48b0766aa4cb8 | refs/heads/master | "2023-01-29T04:08:29.969000" | "2020-12-16T00:39:31" | "2020-12-16T00:39:31" | 316,910,964 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nbdyn.community.dao;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;
/**
* @author dyn
* @create 2020-11-15-20:10
*/
@Repository("alphaHibernate")
public class AlphaDaoHibernatelmpl implements AlphaDao{
@Override
public String select() {
return "Hibernate";
}
}
| UTF-8 | Java | 357 | java | AlphaDaoHibernatelmpl.java | Java | [
{
"context": "ngframework.stereotype.Repository;\n\n/**\n * @author dyn\n * @create 2020-11-15-20:10\n */\n@Repository(\"alph",
"end": 158,
"score": 0.9944310188293457,
"start": 155,
"tag": "USERNAME",
"value": "dyn"
}
] | null | [] | package com.nbdyn.community.dao;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;
/**
* @author dyn
* @create 2020-11-15-20:10
*/
@Repository("alphaHibernate")
public class AlphaDaoHibernatelmpl implements AlphaDao{
@Override
public String select() {
return "Hibernate";
}
}
| 357 | 0.731092 | 0.697479 | 17 | 20 | 18.877314 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.235294 | false | false | 1 |
edb8197116af0123b845319f90740357b5503377 | 14,731,737,863,352 | 7ff190d0aa1ea0d13a403f9afd7b0b0ce3ecc5e3 | /src/logic/Chromosome.java | f848d18ca748007d9e8138b8fc72e963c3f6851f | [] | no_license | jakub-gonet/genetic-algorithm | https://github.com/jakub-gonet/genetic-algorithm | f03073fc7ccf085b62926fd92194deaadb29764d | 5d128e7f16ba853c4b47ebfe0ceb486100893972 | refs/heads/master | "2017-11-21T21:46:19.557000" | "2017-06-20T06:29:06" | "2017-06-20T06:29:06" | 94,857,441 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package logic;
/**
* Created by kuba on 19.06.17.
*/
public class Chromosome {
private double fitness;
private byte[] content;
public Chromosome(IFitnessCalculator calculator, byte[] content){
this.content = content;
this.fitness = calculator.calculate(content);
}
public double getFitness() {
return fitness;
}
public byte[] getContent() {
return content;
}
}
| UTF-8 | Java | 431 | java | Chromosome.java | Java | [
{
"context": "package logic;\n\n/**\n * Created by kuba on 19.06.17.\n */\npublic class Chromosome {\n pr",
"end": 38,
"score": 0.9955552816390991,
"start": 34,
"tag": "USERNAME",
"value": "kuba"
}
] | null | [] | package logic;
/**
* Created by kuba on 19.06.17.
*/
public class Chromosome {
private double fitness;
private byte[] content;
public Chromosome(IFitnessCalculator calculator, byte[] content){
this.content = content;
this.fitness = calculator.calculate(content);
}
public double getFitness() {
return fitness;
}
public byte[] getContent() {
return content;
}
}
| 431 | 0.62645 | 0.612529 | 22 | 18.59091 | 18.299675 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 1 |
84231bbb9e9fde410e2d0ab78545f4ab4c318520 | 3,822,520,919,575 | ea39ccf14d4a27e0053e7ba4bbd7877b568bf52c | /src/main/java/cn/ws/jdk8/threadTest/Node.java | 8f028a0ca3712cb9ed7cd8bce866f76115176052 | [] | no_license | wssapro/study | https://github.com/wssapro/study | 89dc3c70bb8d70f6d11cdfa70e2967862ba75374 | 84013ad044f76d58d651fa914c6873f9fca028d8 | refs/heads/master | "2023-08-27T22:10:48.693000" | "2021-10-15T09:45:20" | "2021-10-15T09:45:20" | 417,446,294 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.ws.jdk8.threadTest;
import java.util.HashMap;
/**
* <p>
*
* </p>
*
* @author shun
* @date 2020-06-19 11:22
*/
public class Node
{
public HashMap<String,String> map;
public HashMap<String, String> getMap()
{
return map;
}
public void setMap(HashMap<String, String> map)
{
this.map = map;
}
}
| UTF-8 | Java | 324 | java | Node.java | Java | [
{
"context": "util.HashMap;\n\n/**\n * <p>\n *\n * </p>\n *\n * @author shun\n * @date 2020-06-19 11:22\n */\npublic class Node\n{",
"end": 99,
"score": 0.9914941787719727,
"start": 95,
"tag": "USERNAME",
"value": "shun"
}
] | null | [] | package cn.ws.jdk8.threadTest;
import java.util.HashMap;
/**
* <p>
*
* </p>
*
* @author shun
* @date 2020-06-19 11:22
*/
public class Node
{
public HashMap<String,String> map;
public HashMap<String, String> getMap()
{
return map;
}
public void setMap(HashMap<String, String> map)
{
this.map = map;
}
}
| 324 | 0.632716 | 0.592593 | 26 | 11.461538 | 13.818134 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.730769 | false | false | 1 |
d7c213f81ecc933cc29022a5f3bf35afaf4f16c3 | 18,382,460,063,966 | 7dd8b7ecba67031df4f4ecdbc6939c893ec356a1 | /src/main/java/com/corporate/delivery/service/impl/OrderRestaurantMenuSectionServiceImpl.java | 2684f5e7fe47b06c480057c3fe043b734b18d79c | [] | no_license | aceexpressdelivery/delivery-core | https://github.com/aceexpressdelivery/delivery-core | 014e330ecabbd0850a2dec24d9461448d41359b6 | 99e6c00865670b1121fe970ed87668581365af90 | refs/heads/master | "2020-03-26T22:38:42.371000" | "2018-10-31T09:17:21" | "2018-10-31T09:17:21" | 145,476,378 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.corporate.delivery.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.corporate.delivery.dao.OrderRestaurantMenuSectionDao;
import com.corporate.delivery.model.OrderRestaurantMenuSection;
import com.corporate.delivery.service.OrderRestaurantMenuSectionService;
@Service("orderRestaurantMenuSectionService")
public class OrderRestaurantMenuSectionServiceImpl implements OrderRestaurantMenuSectionService{
@Autowired
OrderRestaurantMenuSectionDao orderRestaurantMenuSectionDao;
@Transactional(readOnly = true)
public List<OrderRestaurantMenuSection> getOrderRestaurantMenuSection(Integer userId){
return null;
}
@Transactional
public void insert(OrderRestaurantMenuSection orderRestaurantMenuSection) {
orderRestaurantMenuSectionDao.insert(orderRestaurantMenuSection);
}
@Transactional
public void updateOrderRestaurantMenuSection(OrderRestaurantMenuSection orderRestaurantMenuSection){
orderRestaurantMenuSectionDao.updateOrderRestaurantMenuSection(orderRestaurantMenuSection);
}
}
| UTF-8 | Java | 1,198 | java | OrderRestaurantMenuSectionServiceImpl.java | Java | [] | null | [] | package com.corporate.delivery.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.corporate.delivery.dao.OrderRestaurantMenuSectionDao;
import com.corporate.delivery.model.OrderRestaurantMenuSection;
import com.corporate.delivery.service.OrderRestaurantMenuSectionService;
@Service("orderRestaurantMenuSectionService")
public class OrderRestaurantMenuSectionServiceImpl implements OrderRestaurantMenuSectionService{
@Autowired
OrderRestaurantMenuSectionDao orderRestaurantMenuSectionDao;
@Transactional(readOnly = true)
public List<OrderRestaurantMenuSection> getOrderRestaurantMenuSection(Integer userId){
return null;
}
@Transactional
public void insert(OrderRestaurantMenuSection orderRestaurantMenuSection) {
orderRestaurantMenuSectionDao.insert(orderRestaurantMenuSection);
}
@Transactional
public void updateOrderRestaurantMenuSection(OrderRestaurantMenuSection orderRestaurantMenuSection){
orderRestaurantMenuSectionDao.updateOrderRestaurantMenuSection(orderRestaurantMenuSection);
}
}
| 1,198 | 0.866444 | 0.866444 | 35 | 33.228573 | 34.043743 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 1 |
d0bcaf7e5f1da57fdf6832e98743dff5334068d6 | 10,514,079,967,938 | 091d028255be0d5757e30ca04a692df23cdb590c | /DataBase/src/eg/edu/alexu/csd/oop/db/cs20/Resultset/DBResultsetImp.java | 8c18991d2e0e88aa5b0f6db1ee7c6aa893ae486d | [] | no_license | HananElkhateeb/DBMS-JDBC | https://github.com/HananElkhateeb/DBMS-JDBC | 2bdca9a364c8d7149bbe3ae30d9a3d14a6c327c9 | ec827a63807b088f299887880eb4572821097368 | refs/heads/master | "2020-03-15T01:46:00.412000" | "2018-05-02T20:17:51" | "2018-05-02T20:17:51" | 131,901,274 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eg.edu.alexu.csd.oop.db.cs20.Resultset;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import eg.edu.alexu.csd.oop.db.cs69.Model.MyDatabase;
import eg.edu.alexu.csd.oop.db.cs20.ResultSetMetaData.DBResultSetMetaDataImp;
import eg.edu.alexu.csd.oop.db.cs20.Statement.DBStatementImp;
public class DBResultsetImp extends DBResultset{
DBStatementImp statement = null;
DBResultSetMetaDataImp metaData ;
ArrayList<ArrayList<Object>> results = null;
ArrayList<Object> current = null;
int row = 0;
String[] columns;
MyDatabase d;
public DBResultsetImp (DBStatementImp statement,ArrayList<ArrayList<Object>> results, MyDatabase d) {
this.statement = statement;
this.results = results;
columns=d.getColumns();
this.d = d;
}
@Override
public boolean absolute(int row) throws SQLException {
// TODO Auto-generated method stub
this.row = row;
if (row <= results.size() || row == -1) {
if(row == -1) {
current = results.get(results.size() - 1);
}
else {
current = results.get(row - 1);
}
return true;
}
else if(row <= 0) {
current = null;
return false;
}
return false;
}
@Override
public void afterLast() throws SQLException {
// TODO Auto-generated method stub
row = -2;
current = null;
}
@Override
public void beforeFirst() throws SQLException {
// TODO Auto-generated method stub
row = 0;
current = null;
}
@Override
public void close() throws SQLException {
// TODO Auto-generated method stub
statement = null;
results = null;
current = null;
}
@Override
public int findColumn(String columnLabel) throws SQLException {
// TODO Auto-generated method stub
for(int i = 0; i < columns.length; i++) {
if(columns[i].equals(columnLabel)) {
return i + 1;
}
}
throw new SQLException();
}
@Override
public boolean first() throws SQLException {
// TODO Auto-generated method stub
if(results.size() == 0) {
return false;
}
else {
row = 1;
current = results.get(row - 1);
return true;
}
}
@Override
public int getInt(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
if(columnIndex > 0 && columnIndex <= current.size()) {
return (int) current.get(columnIndex - 1);
}
throw new SQLException();
}
@Override
public int getInt(String columnLabel) throws SQLException {
// TODO Auto-generated method stub
for(int i = 0; i < columns.length; i++) {
if(columns[i].equals(columnLabel)) {
if(current.get(i).equals(null)) {
return 0;
}
return (int) current.get(i);
}
}
throw new SQLException();
}
@Override
public ResultSetMetaData getMetaData() throws SQLException {
metaData= new DBResultSetMetaDataImp(results,d);
return metaData;
}
@Override
public Object getObject(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
if(columnIndex > 0 && columnIndex <= current.size()) {
return current.get(columnIndex - 1);
}
throw new SQLException();
}
@Override
public Statement getStatement() throws SQLException {
// TODO Auto-generated method stub
return statement;
}
@Override
public String getString(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
if(columnIndex > 0 && columnIndex <= current.size()) {
return String.valueOf(current.get(columnIndex - 1));
}
throw new SQLException();
}
@Override
public String getString(String columnLabel) throws SQLException {
// TODO Auto-generated method stub
for(int i = 0; i < columns.length; i++) {
if(columns[i].equals(columnLabel)) {
if(current.get(i).equals(null)) {
return null;
}
return String.valueOf(current.get(i));
}
}
throw new SQLException();
}
@Override
public boolean isAfterLast() throws SQLException {
// TODO Auto-generated method stub
if(row < -1) {
return true;
}
return false;
}
@Override
public boolean isBeforeFirst() throws SQLException {
// TODO Auto-generated method stub
if(row == 0) {
return true;
}
return false;
}
@Override
public boolean isClosed() throws SQLException {
// TODO Auto-generated method stub
return statement == null && results == null;
}
@Override
public boolean isFirst() throws SQLException {
// TODO Auto-generated method stub
if(row - 1 == 0) {
return true;
}
return false;
}
@Override
public boolean isLast() throws SQLException {
// TODO Auto-generated method stub
if(row == results.size()) {
return true;
}
return false;
}
@Override
public boolean last() throws SQLException {
// TODO Auto-generated method stub
if(results.size() == 0) {
return false;
}
else {
row = results.size();
current = results.get(row - 1);
return true;
}
}
@Override
public boolean next() throws SQLException {
// TODO Auto-generated method stub
row = row + 1;
if(row <= results.size()) {
current = results.get(row - 1);
return true;
}
return false;
}
@Override
public boolean previous() throws SQLException {
// TODO Auto-generated method stub
row = row - 1;
if(row >= 1) {
current = results.get(row - 1);
return true;
}
return false;
}
}
| UTF-8 | Java | 5,481 | java | DBResultsetImp.java | Java | [] | null | [] | package eg.edu.alexu.csd.oop.db.cs20.Resultset;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import eg.edu.alexu.csd.oop.db.cs69.Model.MyDatabase;
import eg.edu.alexu.csd.oop.db.cs20.ResultSetMetaData.DBResultSetMetaDataImp;
import eg.edu.alexu.csd.oop.db.cs20.Statement.DBStatementImp;
public class DBResultsetImp extends DBResultset{
DBStatementImp statement = null;
DBResultSetMetaDataImp metaData ;
ArrayList<ArrayList<Object>> results = null;
ArrayList<Object> current = null;
int row = 0;
String[] columns;
MyDatabase d;
public DBResultsetImp (DBStatementImp statement,ArrayList<ArrayList<Object>> results, MyDatabase d) {
this.statement = statement;
this.results = results;
columns=d.getColumns();
this.d = d;
}
@Override
public boolean absolute(int row) throws SQLException {
// TODO Auto-generated method stub
this.row = row;
if (row <= results.size() || row == -1) {
if(row == -1) {
current = results.get(results.size() - 1);
}
else {
current = results.get(row - 1);
}
return true;
}
else if(row <= 0) {
current = null;
return false;
}
return false;
}
@Override
public void afterLast() throws SQLException {
// TODO Auto-generated method stub
row = -2;
current = null;
}
@Override
public void beforeFirst() throws SQLException {
// TODO Auto-generated method stub
row = 0;
current = null;
}
@Override
public void close() throws SQLException {
// TODO Auto-generated method stub
statement = null;
results = null;
current = null;
}
@Override
public int findColumn(String columnLabel) throws SQLException {
// TODO Auto-generated method stub
for(int i = 0; i < columns.length; i++) {
if(columns[i].equals(columnLabel)) {
return i + 1;
}
}
throw new SQLException();
}
@Override
public boolean first() throws SQLException {
// TODO Auto-generated method stub
if(results.size() == 0) {
return false;
}
else {
row = 1;
current = results.get(row - 1);
return true;
}
}
@Override
public int getInt(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
if(columnIndex > 0 && columnIndex <= current.size()) {
return (int) current.get(columnIndex - 1);
}
throw new SQLException();
}
@Override
public int getInt(String columnLabel) throws SQLException {
// TODO Auto-generated method stub
for(int i = 0; i < columns.length; i++) {
if(columns[i].equals(columnLabel)) {
if(current.get(i).equals(null)) {
return 0;
}
return (int) current.get(i);
}
}
throw new SQLException();
}
@Override
public ResultSetMetaData getMetaData() throws SQLException {
metaData= new DBResultSetMetaDataImp(results,d);
return metaData;
}
@Override
public Object getObject(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
if(columnIndex > 0 && columnIndex <= current.size()) {
return current.get(columnIndex - 1);
}
throw new SQLException();
}
@Override
public Statement getStatement() throws SQLException {
// TODO Auto-generated method stub
return statement;
}
@Override
public String getString(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
if(columnIndex > 0 && columnIndex <= current.size()) {
return String.valueOf(current.get(columnIndex - 1));
}
throw new SQLException();
}
@Override
public String getString(String columnLabel) throws SQLException {
// TODO Auto-generated method stub
for(int i = 0; i < columns.length; i++) {
if(columns[i].equals(columnLabel)) {
if(current.get(i).equals(null)) {
return null;
}
return String.valueOf(current.get(i));
}
}
throw new SQLException();
}
@Override
public boolean isAfterLast() throws SQLException {
// TODO Auto-generated method stub
if(row < -1) {
return true;
}
return false;
}
@Override
public boolean isBeforeFirst() throws SQLException {
// TODO Auto-generated method stub
if(row == 0) {
return true;
}
return false;
}
@Override
public boolean isClosed() throws SQLException {
// TODO Auto-generated method stub
return statement == null && results == null;
}
@Override
public boolean isFirst() throws SQLException {
// TODO Auto-generated method stub
if(row - 1 == 0) {
return true;
}
return false;
}
@Override
public boolean isLast() throws SQLException {
// TODO Auto-generated method stub
if(row == results.size()) {
return true;
}
return false;
}
@Override
public boolean last() throws SQLException {
// TODO Auto-generated method stub
if(results.size() == 0) {
return false;
}
else {
row = results.size();
current = results.get(row - 1);
return true;
}
}
@Override
public boolean next() throws SQLException {
// TODO Auto-generated method stub
row = row + 1;
if(row <= results.size()) {
current = results.get(row - 1);
return true;
}
return false;
}
@Override
public boolean previous() throws SQLException {
// TODO Auto-generated method stub
row = row - 1;
if(row >= 1) {
current = results.get(row - 1);
return true;
}
return false;
}
}
| 5,481 | 0.64605 | 0.63857 | 237 | 21.109705 | 19.115587 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.991561 | false | false | 1 |
019530893d31e0151c581a54094f9d1d5cd59863 | 29,549,375,020,147 | b8935ce0f1570568b3f9386b3d6240634d25a0c7 | /src/drag/DragAndDrop.java | 00d30c7430172b84f71a7459890fdf14e99e65bd | [] | no_license | MatFX/ExperimentalFX | https://github.com/MatFX/ExperimentalFX | a9f28f5e246657e79b3d98e9d2866474b4ea189f | 920a62d0fac722e19fc5436b8a5950602e73e2e4 | refs/heads/master | "2023-04-16T09:18:18.165000" | "2023-03-23T10:00:10" | "2023-03-23T10:00:10" | 99,205,919 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package drag;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class DragAndDrop extends Application {
private static final DataFormat DRAGGABLE_HBOX_TYPE = new DataFormat("draggable-hbox");
@Override
public void start(Stage stage) {
VBox content = new VBox(5);
for (int i = 0; i < 10; i++) {
Label label = new Label("Test drag " + i);
DraggableHBox box = new DraggableHBox();
box.getChildren().add(label);
content.getChildren().add(box);
}
stage.setScene(new Scene(content));
stage.show();
}
class DraggableHBox extends HBox {
public DraggableHBox() {
this.setOnDragDetected(e -> {
Dragboard db = this.startDragAndDrop(TransferMode.MOVE);
// This is where the magic happens, you take a snapshot of the HBox.
db.setDragView(this.snapshot(null, null));
// The DragView wont be displayed unless we set the content of the dragboard as well.
// Here you probably want to do more meaningful stuff than adding an empty String to the content.
ClipboardContent content = new ClipboardContent();
content.put(DRAGGABLE_HBOX_TYPE, "");
db.setContent(content);
e.consume();
});
}
}
public static void main(String[] args) {
launch();
}
}
| UTF-8 | Java | 1,761 | java | DragAndDrop.java | Java | [] | null | [] | package drag;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class DragAndDrop extends Application {
private static final DataFormat DRAGGABLE_HBOX_TYPE = new DataFormat("draggable-hbox");
@Override
public void start(Stage stage) {
VBox content = new VBox(5);
for (int i = 0; i < 10; i++) {
Label label = new Label("Test drag " + i);
DraggableHBox box = new DraggableHBox();
box.getChildren().add(label);
content.getChildren().add(box);
}
stage.setScene(new Scene(content));
stage.show();
}
class DraggableHBox extends HBox {
public DraggableHBox() {
this.setOnDragDetected(e -> {
Dragboard db = this.startDragAndDrop(TransferMode.MOVE);
// This is where the magic happens, you take a snapshot of the HBox.
db.setDragView(this.snapshot(null, null));
// The DragView wont be displayed unless we set the content of the dragboard as well.
// Here you probably want to do more meaningful stuff than adding an empty String to the content.
ClipboardContent content = new ClipboardContent();
content.put(DRAGGABLE_HBOX_TYPE, "");
db.setContent(content);
e.consume();
});
}
}
public static void main(String[] args) {
launch();
}
}
| 1,761 | 0.625213 | 0.622941 | 56 | 30.446428 | 27.172674 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 1 |
0e88569c66d6cec0b68c078a597e76cf6165754a | 29,549,375,020,387 | 9628f3cf37f3a110a13afe954d5639fcb6abc91c | /app/src/main/java/cn/microvideo/highway_patrol_maintain/mvp/presenter/home/IHomePresenter_2.java | 6de82e9872965e4e6c2ff59ce9c4edab1c69e896 | [] | no_license | GuilinSir/Highway_Patrol_Maintain | https://github.com/GuilinSir/Highway_Patrol_Maintain | 1c2f9cb00c60563a22d10d4b735d106bd6f089e2 | fbfd28b8488f6c739aca30135df8655343a9da33 | refs/heads/master | "2019-03-09T23:31:10.277000" | "2018-03-21T09:01:02" | "2018-03-21T09:01:02" | 101,058,039 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.microvideo.highway_patrol_maintain.mvp.presenter.home;
import cn.microvideo.highway_patrol_maintain.mvp.presenter.IPresenter;
import cn.microvideo.highway_patrol_maintain.mvp.request.home.WeatherRequest;
/**
* Created by guilin on 2017/8/31.
*/
public interface IHomePresenter_2 extends IPresenter {
void getCaiYunWeather(WeatherRequest request);
void getWeatherMess(String weather);
}
| UTF-8 | Java | 410 | java | IHomePresenter_2.java | Java | [
{
"context": "vp.request.home.WeatherRequest;\n\n/**\n * Created by guilin on 2017/8/31.\n */\n\npublic interface IHomePresente",
"end": 241,
"score": 0.9996469020843506,
"start": 235,
"tag": "USERNAME",
"value": "guilin"
}
] | null | [] | package cn.microvideo.highway_patrol_maintain.mvp.presenter.home;
import cn.microvideo.highway_patrol_maintain.mvp.presenter.IPresenter;
import cn.microvideo.highway_patrol_maintain.mvp.request.home.WeatherRequest;
/**
* Created by guilin on 2017/8/31.
*/
public interface IHomePresenter_2 extends IPresenter {
void getCaiYunWeather(WeatherRequest request);
void getWeatherMess(String weather);
}
| 410 | 0.797561 | 0.778049 | 13 | 30.538462 | 29.248577 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 1 |
86d85d7812704da1d0965d3c834d77d94913ac89 | 17,231,408,794,000 | ad3ce573d83161009fae900cc3a3c1b09530f1ff | /textbase/src/main/java/com/example/textbase/base/BaseLoginPersenter.java | 91549f37b196c666d9b5c2bf685e68946876df4d | [] | no_license | fengruiyu/MVPAndBase | https://github.com/fengruiyu/MVPAndBase | b6062a1db82a277a4e9f89afbee14b4b8be8ed20 | a56c0e8e6d33d4062b5c0f606c6e8e492b97f426 | refs/heads/master | "2020-03-20T05:31:46.907000" | "2018-06-13T13:13:54" | "2018-06-13T13:13:54" | 137,217,580 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.textbase.base;
public abstract class BaseLoginPersenter<v extends IView> {
protected v view;
public BaseLoginPersenter(v view) {
this.view = view;
initModel();
}
protected abstract void initModel();
void onDestroy() {
view = null;
}
}
| UTF-8 | Java | 306 | java | BaseLoginPersenter.java | Java | [] | null | [] | package com.example.textbase.base;
public abstract class BaseLoginPersenter<v extends IView> {
protected v view;
public BaseLoginPersenter(v view) {
this.view = view;
initModel();
}
protected abstract void initModel();
void onDestroy() {
view = null;
}
}
| 306 | 0.633987 | 0.633987 | 14 | 20.857143 | 17.141666 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 1 |
e5e9c9cbb9da9787ee2502952c6c5ed2a3c8d0dc | 3,178,275,826,807 | a1a7ea917d96e62aa0d3171ec3d0c9b53254b78f | /HomeworkStudent/src/UserEntry.java | 67b4c7df665ad20c3b80eba203f44c6454532efe | [] | no_license | mihailog/JavaTrainingCourse | https://github.com/mihailog/JavaTrainingCourse | 752485e72d87c25dfd1daeed29b08c96dfec91bb | 3c03794b5caa138801c956e3d644e080d4eb7ffd | refs/heads/master | "2020-05-29T22:43:52.684000" | "2019-05-30T14:11:45" | "2019-05-30T14:11:45" | 189,418,287 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.text.ParseException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class UserEntry {
static Scanner scanner = new Scanner(System.in);
public static String userEntryString() {
String choice = scanner.nextLine();
// scanner.close(); // iz nekog razloga kad jednom zatvorim scanner, javlja error (proveriti!)
return choice;
}
// bolja opcija da stavim kod menu-ja da su 1,2,3,4 stringovi , onda sa
// defaultom rešavam input exception
public static int userEntryInt() {
// try {
// int choice = scanner.nextInt();
// scanner.close();
// } catch (InputMismatchException pe) {
// System.out.println("Pogresan unos, unesite ponovo: ");
// MainMenu.mainMenu();
// }
int choice = Integer.parseInt(scanner.nextLine());
return choice;
}
}
| WINDOWS-1250 | Java | 811 | java | UserEntry.java | Java | [] | null | [] | import java.text.ParseException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class UserEntry {
static Scanner scanner = new Scanner(System.in);
public static String userEntryString() {
String choice = scanner.nextLine();
// scanner.close(); // iz nekog razloga kad jednom zatvorim scanner, javlja error (proveriti!)
return choice;
}
// bolja opcija da stavim kod menu-ja da su 1,2,3,4 stringovi , onda sa
// defaultom rešavam input exception
public static int userEntryInt() {
// try {
// int choice = scanner.nextInt();
// scanner.close();
// } catch (InputMismatchException pe) {
// System.out.println("Pogresan unos, unesite ponovo: ");
// MainMenu.mainMenu();
// }
int choice = Integer.parseInt(scanner.nextLine());
return choice;
}
}
| 811 | 0.701235 | 0.696296 | 32 | 24.3125 | 23.99015 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.78125 | false | false | 1 |
7f01c6dad6490e2478e1252c9a4b71d9c5f4d129 | 6,030,134,109,487 | 03a1c68816f6e21538462c6bda98745343bf5e26 | /CST250assignment03/src/cst250assignment03/BankAccount.java | 994aede0b3981569abdb2288f5e011715d0154ab | [] | no_license | ssyed42789/CST250assignment03 | https://github.com/ssyed42789/CST250assignment03 | bf3e0bdfeb6b3df26f191279621fb35748ae1932 | f8409d2a61d92abe0a4b5c1970af877b007ff252 | refs/heads/main | "2023-03-18T22:45:37.840000" | "2021-03-10T05:56:52" | "2021-03-10T05:56:52" | 346,230,451 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cst250assignment03;
/**
*
* @author ssyed
*/
public final class BankAccount {
private double balance;
public BankAccount() {
setBalance(0);
} // constructor
public void setBalance(double balance) {
this.balance = balance;
System.out.println(
"New balance now: "+ getBalance());
}
public double getBalance() {
return balance;
}
public void deposit(double amt) {
setBalance(getBalance() + amt);
}
public void withdraw(double amt) {
if(getBalance() < amt) {
amt = getBalance();
System.out.println
("Can only withdraw " + amt);
}
}
}
| UTF-8 | Java | 638 | java | BankAccount.java | Java | [
{
"context": "\npackage cst250assignment03;\n\n/**\n *\n * @author ssyed\n */\npublic final class BankAccount {\n private ",
"end": 53,
"score": 0.9986366629600525,
"start": 48,
"tag": "USERNAME",
"value": "ssyed"
}
] | null | [] |
package cst250assignment03;
/**
*
* @author ssyed
*/
public final class BankAccount {
private double balance;
public BankAccount() {
setBalance(0);
} // constructor
public void setBalance(double balance) {
this.balance = balance;
System.out.println(
"New balance now: "+ getBalance());
}
public double getBalance() {
return balance;
}
public void deposit(double amt) {
setBalance(getBalance() + amt);
}
public void withdraw(double amt) {
if(getBalance() < amt) {
amt = getBalance();
System.out.println
("Can only withdraw " + amt);
}
}
}
| 638 | 0.603448 | 0.594044 | 35 | 17 | 14.683324 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.971429 | false | false | 1 |
59884c0ed050e2d1ed500655feaf0fe668e7bc46 | 18,708,877,562,175 | 5b112f41a381320bc81e62e371fc3240a7b20709 | /springboot-multiple-data/src/main/java/demo/DemoApplication.java | 7cfc3856ebc8891d516612ceaf421c2f23a5a66a | [] | no_license | zacscoding/spring-boot-example | https://github.com/zacscoding/spring-boot-example | 1147b5d3203e56b6c4bfaeda253997c6136127e6 | 48b20a60dd752ee65263503d99d7ef3945072f17 | refs/heads/master | "2021-11-25T21:43:50.880000" | "2021-11-07T12:43:39" | "2021-11-07T12:43:39" | 114,388,056 | 3 | 6 | null | false | "2020-03-06T05:35:58" | "2017-12-15T16:03:35" | "2020-02-13T10:30:15" | "2020-02-13T10:30:12" | 24,848 | 3 | 2 | 0 | Java | false | false | package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import demo.repository.BlockRepository;
import demo.repository.TransactionRepository;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| UTF-8 | Java | 587 | java | DemoApplication.java | Java | [] | null | [] | package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import demo.repository.BlockRepository;
import demo.repository.TransactionRepository;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| 587 | 0.831346 | 0.831346 | 18 | 31.611111 | 26.145191 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 1 |
4e90d4648e30a338fec0838c9dfd3bc5aa331a4f | 14,525,579,424,715 | 4c2089d4f7a0e6f29c98d62e78d38fc36df14e16 | /src/main/java/com/grutzmann/common/intervals/Interval.java | 4b0c25250a7f2ed8444b7931f5d0375f7949c674 | [] | no_license | melli79/intervals | https://github.com/melli79/intervals | 1d6ac1617e751c459653a6653b9c81bffb1e3043 | fc9c7370abf5186bdaaad431cb395960bc05f528 | refs/heads/master | "2021-04-29T17:25:08.923000" | "2018-02-15T18:52:55" | "2018-02-15T18:52:55" | 121,668,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.grutzmann.common.intervals;
import com.google.common.base.Optional;
import com.grutzmann.common.annotation.Value;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/***
* @author melli on 16/3/12
* Interval of a real like type
* use under LGPL
***/
@Value
public class Interval<T extends Comparable<T> > implements Comparable<Interval<T> > {
@Nonnull
private final T begin, end;
private final boolean withB, withE;
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > open(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<0) return Optional.of(new Interval<T>(begin,end,false,false));
return Optional.absent();
}
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > closed(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<=0) return Optional.of(new Interval<T>(begin,end,true,true));
return Optional.absent();
}
@Nonnull
public static<T extends Comparable<T> > Interval<T> point(@Nonnull T value) {
return new Interval<>(value,value,true,true);
}
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > leftOpenRightClosed(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<0) return Optional.of(new Interval<T>(begin,end,false,true));
return Optional.absent();
}
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > leftClosedRightOpen(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<0) return Optional.of(new Interval<T>(begin,end,true,false));
return Optional.absent();
}
private Interval(@Nonnull T begin, @Nonnull T end, boolean withB, boolean withE) {
this.begin= begin; this.end= end;
this.withB= withB; this.withE= withE;
}
public boolean contains(@Nonnull T value) {
int less= value.compareTo(begin);
if(less<0) return false;
if(less==0) return withB;
int bigger= value.compareTo(end);
if(bigger>0) return false;
if(bigger==0) return withE;
return true;
}
@Override
public int compareTo(@Nonnull Interval<T> interval) {
int less= interval.end.compareTo(begin);
if(less<0) return 2;
if(less==0) {
if(!interval.withE&&!withB) return 2;
if(!interval.withE||!withB) return 1;
return 0;
}
int bigger= interval.begin.compareTo(end);
if(bigger>0) return -2;
if(bigger==0) {
if(!interval.withB&&!withE) return -2;
if(!interval.withB||!withE) return -1;
}
return 0;
}
public boolean isOpen() {
return !withB&&!withE;
}
public boolean isClosed() {
return withB&&withE;
}
public boolean contains(@Nonnull Interval<T> interval) {
int left= begin.compareTo(interval.begin);
if(left>0) return false;
if(left==0&&interval.withB&&!withB) return false;
int right= end.compareTo(interval.end);
if(right<0) return false;
if(right==0&&interval.withE&&!withE) return false;
return true;
}
@Nonnull
public static <T extends Comparable<T> > Interval<T> supportInterval(@Nonnull Interval<T> interval, @Nonnull Interval<T> interval2) {
int cmp= interval.begin.compareTo(interval2.begin);
T begin,end;
boolean withB, withE;
if(cmp<0) {
begin= interval.begin; withB= interval.withB;
}else if(cmp==0) {
begin= interval.begin; withB= interval.withB||interval2.withB;
}else {
begin= interval2.begin; withB= interval2.withB;
}
cmp= interval.end.compareTo(interval2.end);
if(cmp<0) {
end= interval2.end; withE= interval2.withE;
}else if(cmp==0) {
end= interval2.end; withE= interval.withE||interval2.withE;
}else {
end= interval.end; withE= interval.withE;
}
return new Interval<>(begin,end,withB,withE);
}
@Nonnull
public Result<T> minus(@Nonnull Interval<T> interval) {
int cmp= begin.compareTo(interval.begin);
int cmp2= end.compareTo(interval.end);
if(cmp<0) {
return minusWithLeft(interval, cmp2);
}else if(cmp==0) {
Interval<T> first= null;
if(withB&&!interval.withB) first= point(begin);
if(cmp2<0) {
return new Result<>(first);
}else if(cmp2==0) {
Interval<T> second= null;
if(withE&&!interval.withE) second= point(end);
if(first!=null) return new Result<>(first,second);
return new Result<>(second);
}else {
Interval<T> second= new Interval<>(interval.end,end,!interval.withE,withE);
if(first!=null) return new Result<>(first,second);
return new Result<>(second);
}
}else {
if(cmp2<0) {
return new Result<>();
}else if(cmp2==0) {
boolean hasPoint= withE&&!interval.withE;
if(hasPoint) return new Result<>(point(end));
return new Result<>();
}else {
int cmp3 = begin.compareTo(interval.end);
if(cmp3<0) {
return new Result<>(new Interval<>(interval.end,end,!interval.withB,withE));
}else if(cmp3==0) {
boolean withB= this.withB&&!interval.withE;
return new Result<>(new Interval<>(begin,end,withB,withE));
}else {
return new Result<>(this);
}
}
}
}
@Nonnull
private Result<T> minusWithLeft(@Nonnull Interval<T> interval, int cmp2) {
Interval<T> first = new Interval<>(begin, interval.begin, withB, !interval.withB);
if(cmp2<0) {
int cmp3= end.compareTo(interval.begin);
if(cmp3<0) {
return new Result<>(this);
}else if(cmp3==0) {
boolean withE= this.withE&&!interval.withB;
return new Result<>(new Interval<>(begin,end,withB,withE));
}else {
return new Result<>(first);
}
}else if(cmp2==0) {
boolean withE= this.withE&&!interval.withE;
if(withE) {
return new Result<>(first, point(end));
}
return new Result<>(first);
}else {
return new Result<>(first, new Interval<>(interval.end,end,!interval.withE,withE));
}
}
@Override
public String toString() {
if(begin.compareTo(end)==0) return "{"+begin+"}";
return (withB ? "[" :"(") +begin+","+end+ (withE ?"]" :")");
}
public boolean equals(@Nullable Interval interval) {
if(interval==null) return false;
return withB==interval.withB&&withE==interval.withE
&&begin.equals(interval.begin)&&end.equals(interval.end);
}
@Override
public boolean equals(@Nullable Object o) {
if(o==null||!o.getClass().equals(getClass())) return false;
return equals((Interval)o);
}
@Nonnull
public Optional<Interval<T> > intersect(Interval<T> interval) {
int cmp= begin.compareTo(interval.begin);
T begin; boolean withB;
if(cmp<0) {
begin= interval.begin; withB= interval.withB;
}else if(cmp==0) {
begin= this.begin; withB= this.withB&&interval.withB;
}else {
begin= this.begin; withB= this.withB;
}
int cmp2= end.compareTo(interval.end);
T end; boolean withE;
if(cmp2<0) {
end= this.end; withE= this.withE;
}else if(cmp2==0) {
end=this.end; withE= this.withE&&interval.withE;
}else {
end= interval.end; withE= interval.withE;
}
int cmp3= begin.compareTo(end);
if(cmp3<0||(cmp3==0&&withB&&withE)) return Optional.of(new Interval<T>(begin,end,withB,withE));
return Optional.absent();
}
public static class Result<T extends Comparable<T> > {
@Nullable
private final Interval<T> first, second;
public Result() {
first= null; second= null;
}
public Result(@Nullable Interval<T> first) {
this.first= first; this.second= null;
}
public Result(@Nonnull Interval<T> first, @Nullable Interval<T> second) {
this.first= first; this.second= second;
}
public int getNumComponents() {
if(second!=null) return 2;
if(first!=null) return 1;
return 0;
}
public boolean isEmpty() {
return first==null;
}
@Nonnull
public Optional<Interval<T> > getFirst() {
return Optional.fromNullable(first);
}
@Nonnull
public Optional<Interval<T> > getSecond() {
return Optional.fromNullable(second);
}
@Nonnull
@Override
public String toString() {
if(first==null) return "{}";
if(second==null) return first.toString();
return "Result("+first+","+second+")";
}
}
}
| UTF-8 | Java | 9,434 | java | Interval.java | Java | [
{
"context": "import javax.annotation.Nullable;\n\n/***\n * @author melli on 16/3/12\n * Interval of a real like type\n * use",
"end": 217,
"score": 0.9988791942596436,
"start": 212,
"tag": "USERNAME",
"value": "melli"
}
] | null | [] | package com.grutzmann.common.intervals;
import com.google.common.base.Optional;
import com.grutzmann.common.annotation.Value;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/***
* @author melli on 16/3/12
* Interval of a real like type
* use under LGPL
***/
@Value
public class Interval<T extends Comparable<T> > implements Comparable<Interval<T> > {
@Nonnull
private final T begin, end;
private final boolean withB, withE;
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > open(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<0) return Optional.of(new Interval<T>(begin,end,false,false));
return Optional.absent();
}
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > closed(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<=0) return Optional.of(new Interval<T>(begin,end,true,true));
return Optional.absent();
}
@Nonnull
public static<T extends Comparable<T> > Interval<T> point(@Nonnull T value) {
return new Interval<>(value,value,true,true);
}
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > leftOpenRightClosed(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<0) return Optional.of(new Interval<T>(begin,end,false,true));
return Optional.absent();
}
@Nonnull
public static<T extends Comparable<T> > Optional<Interval<T> > leftClosedRightOpen(@Nonnull T begin, @Nonnull T end) {
if(begin.compareTo(end)<0) return Optional.of(new Interval<T>(begin,end,true,false));
return Optional.absent();
}
private Interval(@Nonnull T begin, @Nonnull T end, boolean withB, boolean withE) {
this.begin= begin; this.end= end;
this.withB= withB; this.withE= withE;
}
public boolean contains(@Nonnull T value) {
int less= value.compareTo(begin);
if(less<0) return false;
if(less==0) return withB;
int bigger= value.compareTo(end);
if(bigger>0) return false;
if(bigger==0) return withE;
return true;
}
@Override
public int compareTo(@Nonnull Interval<T> interval) {
int less= interval.end.compareTo(begin);
if(less<0) return 2;
if(less==0) {
if(!interval.withE&&!withB) return 2;
if(!interval.withE||!withB) return 1;
return 0;
}
int bigger= interval.begin.compareTo(end);
if(bigger>0) return -2;
if(bigger==0) {
if(!interval.withB&&!withE) return -2;
if(!interval.withB||!withE) return -1;
}
return 0;
}
public boolean isOpen() {
return !withB&&!withE;
}
public boolean isClosed() {
return withB&&withE;
}
public boolean contains(@Nonnull Interval<T> interval) {
int left= begin.compareTo(interval.begin);
if(left>0) return false;
if(left==0&&interval.withB&&!withB) return false;
int right= end.compareTo(interval.end);
if(right<0) return false;
if(right==0&&interval.withE&&!withE) return false;
return true;
}
@Nonnull
public static <T extends Comparable<T> > Interval<T> supportInterval(@Nonnull Interval<T> interval, @Nonnull Interval<T> interval2) {
int cmp= interval.begin.compareTo(interval2.begin);
T begin,end;
boolean withB, withE;
if(cmp<0) {
begin= interval.begin; withB= interval.withB;
}else if(cmp==0) {
begin= interval.begin; withB= interval.withB||interval2.withB;
}else {
begin= interval2.begin; withB= interval2.withB;
}
cmp= interval.end.compareTo(interval2.end);
if(cmp<0) {
end= interval2.end; withE= interval2.withE;
}else if(cmp==0) {
end= interval2.end; withE= interval.withE||interval2.withE;
}else {
end= interval.end; withE= interval.withE;
}
return new Interval<>(begin,end,withB,withE);
}
@Nonnull
public Result<T> minus(@Nonnull Interval<T> interval) {
int cmp= begin.compareTo(interval.begin);
int cmp2= end.compareTo(interval.end);
if(cmp<0) {
return minusWithLeft(interval, cmp2);
}else if(cmp==0) {
Interval<T> first= null;
if(withB&&!interval.withB) first= point(begin);
if(cmp2<0) {
return new Result<>(first);
}else if(cmp2==0) {
Interval<T> second= null;
if(withE&&!interval.withE) second= point(end);
if(first!=null) return new Result<>(first,second);
return new Result<>(second);
}else {
Interval<T> second= new Interval<>(interval.end,end,!interval.withE,withE);
if(first!=null) return new Result<>(first,second);
return new Result<>(second);
}
}else {
if(cmp2<0) {
return new Result<>();
}else if(cmp2==0) {
boolean hasPoint= withE&&!interval.withE;
if(hasPoint) return new Result<>(point(end));
return new Result<>();
}else {
int cmp3 = begin.compareTo(interval.end);
if(cmp3<0) {
return new Result<>(new Interval<>(interval.end,end,!interval.withB,withE));
}else if(cmp3==0) {
boolean withB= this.withB&&!interval.withE;
return new Result<>(new Interval<>(begin,end,withB,withE));
}else {
return new Result<>(this);
}
}
}
}
@Nonnull
private Result<T> minusWithLeft(@Nonnull Interval<T> interval, int cmp2) {
Interval<T> first = new Interval<>(begin, interval.begin, withB, !interval.withB);
if(cmp2<0) {
int cmp3= end.compareTo(interval.begin);
if(cmp3<0) {
return new Result<>(this);
}else if(cmp3==0) {
boolean withE= this.withE&&!interval.withB;
return new Result<>(new Interval<>(begin,end,withB,withE));
}else {
return new Result<>(first);
}
}else if(cmp2==0) {
boolean withE= this.withE&&!interval.withE;
if(withE) {
return new Result<>(first, point(end));
}
return new Result<>(first);
}else {
return new Result<>(first, new Interval<>(interval.end,end,!interval.withE,withE));
}
}
@Override
public String toString() {
if(begin.compareTo(end)==0) return "{"+begin+"}";
return (withB ? "[" :"(") +begin+","+end+ (withE ?"]" :")");
}
public boolean equals(@Nullable Interval interval) {
if(interval==null) return false;
return withB==interval.withB&&withE==interval.withE
&&begin.equals(interval.begin)&&end.equals(interval.end);
}
@Override
public boolean equals(@Nullable Object o) {
if(o==null||!o.getClass().equals(getClass())) return false;
return equals((Interval)o);
}
@Nonnull
public Optional<Interval<T> > intersect(Interval<T> interval) {
int cmp= begin.compareTo(interval.begin);
T begin; boolean withB;
if(cmp<0) {
begin= interval.begin; withB= interval.withB;
}else if(cmp==0) {
begin= this.begin; withB= this.withB&&interval.withB;
}else {
begin= this.begin; withB= this.withB;
}
int cmp2= end.compareTo(interval.end);
T end; boolean withE;
if(cmp2<0) {
end= this.end; withE= this.withE;
}else if(cmp2==0) {
end=this.end; withE= this.withE&&interval.withE;
}else {
end= interval.end; withE= interval.withE;
}
int cmp3= begin.compareTo(end);
if(cmp3<0||(cmp3==0&&withB&&withE)) return Optional.of(new Interval<T>(begin,end,withB,withE));
return Optional.absent();
}
public static class Result<T extends Comparable<T> > {
@Nullable
private final Interval<T> first, second;
public Result() {
first= null; second= null;
}
public Result(@Nullable Interval<T> first) {
this.first= first; this.second= null;
}
public Result(@Nonnull Interval<T> first, @Nullable Interval<T> second) {
this.first= first; this.second= second;
}
public int getNumComponents() {
if(second!=null) return 2;
if(first!=null) return 1;
return 0;
}
public boolean isEmpty() {
return first==null;
}
@Nonnull
public Optional<Interval<T> > getFirst() {
return Optional.fromNullable(first);
}
@Nonnull
public Optional<Interval<T> > getSecond() {
return Optional.fromNullable(second);
}
@Nonnull
@Override
public String toString() {
if(first==null) return "{}";
if(second==null) return first.toString();
return "Result("+first+","+second+")";
}
}
}
| 9,434 | 0.560526 | 0.55141 | 277 | 33.057762 | 27.118212 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.761733 | false | false | 1 |
a785cc9ba3bb972d01fad31e30eaa57b29e288d6 | 23,940,147,729,729 | 83d781a9c2ba33fde6df0c6adc3a434afa1a7f82 | /MarketFrontend/src/com/newco/marketplace/web/dto/ETMSearchDTO.java | 320b40adbf8efbfda57ed4c16a2bba9f3d645f21 | [] | no_license | ssriha0/sl-b2b-platform | https://github.com/ssriha0/sl-b2b-platform | 71ab8ef1f0ccb0a7ad58b18f28a2bf6d5737fcb6 | 5b4fcafa9edfe4d35c2dcf1659ac30ef58d607a2 | refs/heads/master | "2023-01-06T18:32:24.623000" | "2020-11-05T12:23:26" | "2020-11-05T12:23:26" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.newco.marketplace.web.dto;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import com.newco.marketplace.dto.vo.LookupVO;
import com.newco.marketplace.dto.vo.skillTree.SkillNodeVO;
import com.newco.marketplace.dto.vo.spn.SPNMonitorVO;
import com.newco.marketplace.interfaces.OrderConstants;
/**
* $Revision: 1.12 $ $Author: glacy $ $Date: 2008/04/26 01:13:45 $
*/
/*
* Maintenance History
* $Log: ETMSearchDTO.java,v $
* Revision 1.12 2008/04/26 01:13:45 glacy
* Shyam: Merged I18_Fin to HEAD.
*
* Revision 1.10.2.1 2008/04/23 11:41:31 glacy
* Shyam: Merged HEAD to finance.
*
* Revision 1.11 2008/04/23 05:19:46 hravi
* Shyam: Reverting to build 247.
*
* Revision 1.10 2008/03/04 01:31:16 langara
* *** empty log message ***
*
* Revision 1.9 2008/02/26 18:18:00 mhaye05
* Merged Iteration 17 Branch into Head
*
* Revision 1.8.2.3 2008/02/25 21:16:41 usawant
* Added changes for reading the selected languages list
*
* Revision 1.8.2.2 2008/02/22 21:16:52 usawant
* Passing searchkey to backend made changes to initFacility and corresponding changes.
*
* Revision 1.8.2.1 2008/02/22 17:25:47 cgarc03
* Added 'yesNoRadio' data member and getter/setter.
*
* Revision 1.8 2008/02/18 21:01:25 usawant
* *** empty log message ***
*
* Revision 1.7 2008/02/17 05:40:54 usawant
* *** empty log message ***
*
* Revision 1.6 2008/02/16 08:03:10 usawant
* Made changes for incorporating CriteriaHandlerFacility for searching, sorting, pagination, filter criteria.
*
* Revision 1.5 2008/02/15 19:39:04 usawant
* Changed filed names to match to DTO field names
*
* Revision 1.4 2008/02/14 23:44:49 mhaye05
* Merged Feb4_release branch into head
*
*/
public class ETMSearchDTO extends SOWBaseTabDTO implements OrderConstants{
private static final long serialVersionUID = -8936949245454207018L;
private List<SkillNodeVO> skillTreeMainCatList;
private List<LookupVO> credentialsList;
private List<LookupVO> languagesList;
private List <LookupVO> ratingsList;
private List <LookupVO> distanceList;
private Map<String,Object> selectTopProviderList;
private List<SPNMonitorVO> spnList;
private List<LookupVO> performanceLevelList;
private List<LookupVO> yesNoList; // to change the order
//private HashMap yesNoRadio = new HashMap();
private String skillTreeMainCat="-1";
private String marketReadySelection = "1";
private String zipCd;
private String distance="-1";
private String credentials="-1";
private String credentialCategory="-1";
private String languages="-1";
private List<Integer> selectedLanguagesList;
private String ratings="-1";
private Integer spn = 0;
private List<String> perfLevels;
public List<SkillNodeVO> getSkillTreeMainCatList() {
return skillTreeMainCatList;
}
public void setSkillTreeMainCatList(List<SkillNodeVO> skillTreeMainCatList) {
this.skillTreeMainCatList = skillTreeMainCatList;
}
public List<LookupVO> getCredentialsList() {
return credentialsList;
}
public void setCredentialsList(List<LookupVO> credentialsList) {
this.credentialsList = credentialsList;
}
public List<LookupVO> getLanguagesList() {
return languagesList;
}
public void setLanguagesList(List<LookupVO> languagesList) {
this.languagesList = languagesList;
}
/*public Map<String, Object> getRatingsList() {
return ratingsList;
}
public void setRatingsList(Map<String, Object> ratingsList) {
this.ratingsList = ratingsList;
}
public Map<String, Object> getDistanceList() {
return distanceList;
}
public void setDistanceList(Map<String, Object> distanceList) {
this.distanceList = distanceList;
}*/
public Map<String, Object> getSelectTopProviderList() {
return selectTopProviderList;
}
public void setSelectTopProviderList(Map<String, Object> selectTopProviderList) {
this.selectTopProviderList = selectTopProviderList;
}
public String getSkillTreeMainCat() {
return skillTreeMainCat;
}
public void setSkillTreeMainCat(String skillTreeMainCat) {
this.skillTreeMainCat = skillTreeMainCat;
}
public String getMarketReadySelection() {
return marketReadySelection;
}
public void setMarketReadySelection(String marketReadySelection) {
this.marketReadySelection = marketReadySelection;
}
public String getZipCd() {
return zipCd;
}
public void setZipCd(String zipCd) {
this.zipCd = zipCd;
}
public String getDistance() {
return distance;
}
public void setDistance(String distance) {
this.distance = distance;
}
public String getCredentials() {
return credentials;
}
public void setCredentials(String credentials) {
this.credentials = credentials;
}
public String getCredentialCategory() {
return credentialCategory;
}
public void setCredentialCategory(String credentialCategory) {
this.credentialCategory = credentialCategory;
}
public String getRatings() {
return ratings;
}
public void setRatings(String ratings) {
this.ratings = ratings;
}
@Override
public String getTabIdentifier() {
// TODO Auto-generated method stub
return null;
}
public void validate(String function) {
if (function.equalsIgnoreCase("search")){
if (skillTreeMainCat.equalsIgnoreCase("-1"))
{
addError("Service Category", ENTER_SERVICE_CATEGORY, OrderConstants.SOW_TAB_ERROR);
}
if ((zipCd == null) || (zipCd.equalsIgnoreCase("")) )
{
addError("Zip Cd", ENTER_ZIP, OrderConstants.SOW_TAB_ERROR);
}
else if (!isZip5Digits(zipCd)){
addError("Zip Cd", ENTER_FIVE_DIGITS_ZIP, OrderConstants.SOW_TAB_ERROR);
}
}else
{
if (distance.equalsIgnoreCase("-1") &&
credentials.equalsIgnoreCase("-1") &&
credentialCategory.equalsIgnoreCase("-1") &&
ratings.equalsIgnoreCase("-1") &&
languages.equalsIgnoreCase("-1")){
addError("Search Filter", ENTER_ETM_FILTER, OrderConstants.SOW_TAB_ERROR);
}
}
}
private boolean isZip5Digits(String zipCd){
boolean result = false;
if(zipCd == null) return result;
if(StringUtils.isNumeric(zipCd) && zipCd.length() == 5){
return true;
}
return result;
}
@Override
public void validate() {
// TODO Auto-generated method stub
}
public String getLanguages() {
return languages;
}
public void setLanguages(String languages) {
this.languages = languages;
}
public List<Integer> getSelectedLanguagesList() {
String selectedLanguages = getLanguages();
selectedLanguagesList = new ArrayList();
if ((selectedLanguages != null) && (!(selectedLanguages.equalsIgnoreCase("-1")))){
String[] languages = selectedLanguages.split (", ");
for (int i=0; i < languages.length; i++){
if (!(languages[i].equalsIgnoreCase("-1"))){
selectedLanguagesList.add(languages[i]!=null?new Integer(languages[i]):null);
}
}
}
return selectedLanguagesList;
}
public void setSelectedLanguagesList(List<Integer> selectedLanguagesList) {
this.selectedLanguagesList = selectedLanguagesList;
}
/**
* @return the spnList
*/
public List<SPNMonitorVO> getSpnList() {
return spnList;
}
/**
* @param spnList the spnList to set
*/
public void setSpnList(List<SPNMonitorVO> spnList) {
this.spnList = spnList;
}
/**
* @return the spn
*/
public Integer getSpn() {
return spn;
}
/**
* @param spn the spn to set
*/
public void setSpn(Integer spn) {
this.spn = spn;
}
/**
* @return the ratingsList
*/
public List<LookupVO> getRatingsList() {
return ratingsList;
}
/**
* @param ratingsList the ratingsList to set
*/
public void setRatingsList(List<LookupVO> ratingsList) {
this.ratingsList = ratingsList;
}
/**
* @return the distanceList
*/
public List<LookupVO> getDistanceList() {
return distanceList;
}
/**
* @param distanceList the distanceList to set
*/
public void setDistanceList(List<LookupVO> distanceList) {
this.distanceList = distanceList;
}
/**
* @return the perfLevels
*/
public List<String> getPerfLevels() {
return perfLevels;
}
/**
* @param perfLevels the perfLevels to set
*/
public void setPerfLevels(List<String> perfLevels) {
this.perfLevels = perfLevels;
}
/**
* @return the performanceLevelList
*/
public List<LookupVO> getPerformanceLevelList() {
return performanceLevelList;
}
/**
* @param performanceLevelList the performanceLevelList to set
*/
public void setPerformanceLevelList(List<LookupVO> performanceLevelList) {
this.performanceLevelList = performanceLevelList;
}
/**
* @return the yesNoList
*/
public List<LookupVO> getYesNoList() {
return yesNoList;
}
/**
* @param yesNoList the yesNoList to set
*/
public void setYesNoList(List<LookupVO> yesNoList) {
this.yesNoList = yesNoList;
}
}
| UTF-8 | Java | 9,090 | java | ETMSearchDTO.java | Java | [
{
"context": "erConstants;\r\n\r\n/**\r\n * $Revision: 1.12 $ $Author: glacy $ $Date: 2008/04/26 01:13:45 $\r\n */\r\n\r\n/*\r\n * Mai",
"end": 428,
"score": 0.9995724558830261,
"start": 423,
"tag": "USERNAME",
"value": "glacy"
},
{
"context": "O.java,v $\r\n * Revision 1.12 2008/04/26 01:13:45 glacy\r\n * Shyam: Merged I18_Fin to HEAD.\r\n *\r\n * Revisi",
"end": 572,
"score": 0.9993411302566528,
"start": 567,
"tag": "USERNAME",
"value": "glacy"
},
{
"context": "D.\r\n *\r\n * Revision 1.10.2.1 2008/04/23 11:41:31 glacy\r\n * Shyam: Merged HEAD to finance.\r\n *\r\n * Revisi",
"end": 661,
"score": 0.9993913769721985,
"start": 656,
"tag": "USERNAME",
"value": "glacy"
},
{
"context": "nance.\r\n *\r\n * Revision 1.11 2008/04/23 05:19:46 hravi\r\n * Shyam: Reverting to build 247.\r\n *\r\n * Revisi",
"end": 746,
"score": 0.9994276762008667,
"start": 741,
"tag": "USERNAME",
"value": "hravi"
},
{
"context": "d 247.\r\n *\r\n * Revision 1.10 2008/03/04 01:31:16 langara\r\n * *** empty log message ***\r\n *\r\n * Revision 1.",
"end": 833,
"score": 0.9985160827636719,
"start": 826,
"tag": "USERNAME",
"value": "langara"
},
{
"context": "age ***\r\n *\r\n * Revision 1.9 2008/02/26 18:18:00 mhaye05\r\n * Merged Iteration 17 Branch into Head\r\n *\r\n * ",
"end": 914,
"score": 0.9996429681777954,
"start": 907,
"tag": "USERNAME",
"value": "mhaye05"
},
{
"context": "ead\r\n *\r\n * Revision 1.8.2.3 2008/02/25 21:16:41 usawant\r\n * Added changes for reading the selected langua",
"end": 1010,
"score": 0.9995517730712891,
"start": 1003,
"tag": "USERNAME",
"value": "usawant"
},
{
"context": "ist\r\n *\r\n * Revision 1.8.2.2 2008/02/22 21:16:52 usawant\r\n * Passing searchkey to backend made changes to ",
"end": 1123,
"score": 0.9990289807319641,
"start": 1116,
"tag": "USERNAME",
"value": "usawant"
},
{
"context": "es.\r\n *\r\n * Revision 1.8.2.1 2008/02/22 17:25:47 cgarc03\r\n * Added 'yesNoRadio' data member and getter/set",
"end": 1267,
"score": 0.9996852278709412,
"start": 1260,
"tag": "USERNAME",
"value": "cgarc03"
},
{
"context": "setter.\r\n *\r\n * Revision 1.8 2008/02/18 21:01:25 usawant\r\n * *** empty log message ***\r\n *\r\n * Revision 1.",
"end": 1372,
"score": 0.9991316199302673,
"start": 1365,
"tag": "USERNAME",
"value": "usawant"
},
{
"context": "age ***\r\n *\r\n * Revision 1.7 2008/02/17 05:40:54 usawant\r\n * *** empty log message ***\r\n *\r\n * Revision 1.",
"end": 1453,
"score": 0.9990484118461609,
"start": 1446,
"tag": "USERNAME",
"value": "usawant"
},
{
"context": "age ***\r\n *\r\n * Revision 1.6 2008/02/16 08:03:10 usawant\r\n * Made changes for incorporating CriteriaHandle",
"end": 1534,
"score": 0.9993982315063477,
"start": 1527,
"tag": "USERNAME",
"value": "usawant"
},
{
"context": "iteria.\r\n *\r\n * Revision 1.5 2008/02/15 19:39:04 usawant\r\n * Changed filed names to match to DTO field nam",
"end": 1697,
"score": 0.9994685053825378,
"start": 1690,
"tag": "USERNAME",
"value": "usawant"
},
{
"context": "d names\r\n *\r\n * Revision 1.4 2008/02/14 23:44:49 mhaye05\r\n * Merged Feb4_release branch into head\r\n *\r\n */",
"end": 1800,
"score": 0.999710738658905,
"start": 1793,
"tag": "USERNAME",
"value": "mhaye05"
}
] | null | [] | package com.newco.marketplace.web.dto;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import com.newco.marketplace.dto.vo.LookupVO;
import com.newco.marketplace.dto.vo.skillTree.SkillNodeVO;
import com.newco.marketplace.dto.vo.spn.SPNMonitorVO;
import com.newco.marketplace.interfaces.OrderConstants;
/**
* $Revision: 1.12 $ $Author: glacy $ $Date: 2008/04/26 01:13:45 $
*/
/*
* Maintenance History
* $Log: ETMSearchDTO.java,v $
* Revision 1.12 2008/04/26 01:13:45 glacy
* Shyam: Merged I18_Fin to HEAD.
*
* Revision 1.10.2.1 2008/04/23 11:41:31 glacy
* Shyam: Merged HEAD to finance.
*
* Revision 1.11 2008/04/23 05:19:46 hravi
* Shyam: Reverting to build 247.
*
* Revision 1.10 2008/03/04 01:31:16 langara
* *** empty log message ***
*
* Revision 1.9 2008/02/26 18:18:00 mhaye05
* Merged Iteration 17 Branch into Head
*
* Revision 1.8.2.3 2008/02/25 21:16:41 usawant
* Added changes for reading the selected languages list
*
* Revision 1.8.2.2 2008/02/22 21:16:52 usawant
* Passing searchkey to backend made changes to initFacility and corresponding changes.
*
* Revision 1.8.2.1 2008/02/22 17:25:47 cgarc03
* Added 'yesNoRadio' data member and getter/setter.
*
* Revision 1.8 2008/02/18 21:01:25 usawant
* *** empty log message ***
*
* Revision 1.7 2008/02/17 05:40:54 usawant
* *** empty log message ***
*
* Revision 1.6 2008/02/16 08:03:10 usawant
* Made changes for incorporating CriteriaHandlerFacility for searching, sorting, pagination, filter criteria.
*
* Revision 1.5 2008/02/15 19:39:04 usawant
* Changed filed names to match to DTO field names
*
* Revision 1.4 2008/02/14 23:44:49 mhaye05
* Merged Feb4_release branch into head
*
*/
public class ETMSearchDTO extends SOWBaseTabDTO implements OrderConstants{
private static final long serialVersionUID = -8936949245454207018L;
private List<SkillNodeVO> skillTreeMainCatList;
private List<LookupVO> credentialsList;
private List<LookupVO> languagesList;
private List <LookupVO> ratingsList;
private List <LookupVO> distanceList;
private Map<String,Object> selectTopProviderList;
private List<SPNMonitorVO> spnList;
private List<LookupVO> performanceLevelList;
private List<LookupVO> yesNoList; // to change the order
//private HashMap yesNoRadio = new HashMap();
private String skillTreeMainCat="-1";
private String marketReadySelection = "1";
private String zipCd;
private String distance="-1";
private String credentials="-1";
private String credentialCategory="-1";
private String languages="-1";
private List<Integer> selectedLanguagesList;
private String ratings="-1";
private Integer spn = 0;
private List<String> perfLevels;
public List<SkillNodeVO> getSkillTreeMainCatList() {
return skillTreeMainCatList;
}
public void setSkillTreeMainCatList(List<SkillNodeVO> skillTreeMainCatList) {
this.skillTreeMainCatList = skillTreeMainCatList;
}
public List<LookupVO> getCredentialsList() {
return credentialsList;
}
public void setCredentialsList(List<LookupVO> credentialsList) {
this.credentialsList = credentialsList;
}
public List<LookupVO> getLanguagesList() {
return languagesList;
}
public void setLanguagesList(List<LookupVO> languagesList) {
this.languagesList = languagesList;
}
/*public Map<String, Object> getRatingsList() {
return ratingsList;
}
public void setRatingsList(Map<String, Object> ratingsList) {
this.ratingsList = ratingsList;
}
public Map<String, Object> getDistanceList() {
return distanceList;
}
public void setDistanceList(Map<String, Object> distanceList) {
this.distanceList = distanceList;
}*/
public Map<String, Object> getSelectTopProviderList() {
return selectTopProviderList;
}
public void setSelectTopProviderList(Map<String, Object> selectTopProviderList) {
this.selectTopProviderList = selectTopProviderList;
}
public String getSkillTreeMainCat() {
return skillTreeMainCat;
}
public void setSkillTreeMainCat(String skillTreeMainCat) {
this.skillTreeMainCat = skillTreeMainCat;
}
public String getMarketReadySelection() {
return marketReadySelection;
}
public void setMarketReadySelection(String marketReadySelection) {
this.marketReadySelection = marketReadySelection;
}
public String getZipCd() {
return zipCd;
}
public void setZipCd(String zipCd) {
this.zipCd = zipCd;
}
public String getDistance() {
return distance;
}
public void setDistance(String distance) {
this.distance = distance;
}
public String getCredentials() {
return credentials;
}
public void setCredentials(String credentials) {
this.credentials = credentials;
}
public String getCredentialCategory() {
return credentialCategory;
}
public void setCredentialCategory(String credentialCategory) {
this.credentialCategory = credentialCategory;
}
public String getRatings() {
return ratings;
}
public void setRatings(String ratings) {
this.ratings = ratings;
}
@Override
public String getTabIdentifier() {
// TODO Auto-generated method stub
return null;
}
public void validate(String function) {
if (function.equalsIgnoreCase("search")){
if (skillTreeMainCat.equalsIgnoreCase("-1"))
{
addError("Service Category", ENTER_SERVICE_CATEGORY, OrderConstants.SOW_TAB_ERROR);
}
if ((zipCd == null) || (zipCd.equalsIgnoreCase("")) )
{
addError("Zip Cd", ENTER_ZIP, OrderConstants.SOW_TAB_ERROR);
}
else if (!isZip5Digits(zipCd)){
addError("Zip Cd", ENTER_FIVE_DIGITS_ZIP, OrderConstants.SOW_TAB_ERROR);
}
}else
{
if (distance.equalsIgnoreCase("-1") &&
credentials.equalsIgnoreCase("-1") &&
credentialCategory.equalsIgnoreCase("-1") &&
ratings.equalsIgnoreCase("-1") &&
languages.equalsIgnoreCase("-1")){
addError("Search Filter", ENTER_ETM_FILTER, OrderConstants.SOW_TAB_ERROR);
}
}
}
private boolean isZip5Digits(String zipCd){
boolean result = false;
if(zipCd == null) return result;
if(StringUtils.isNumeric(zipCd) && zipCd.length() == 5){
return true;
}
return result;
}
@Override
public void validate() {
// TODO Auto-generated method stub
}
public String getLanguages() {
return languages;
}
public void setLanguages(String languages) {
this.languages = languages;
}
public List<Integer> getSelectedLanguagesList() {
String selectedLanguages = getLanguages();
selectedLanguagesList = new ArrayList();
if ((selectedLanguages != null) && (!(selectedLanguages.equalsIgnoreCase("-1")))){
String[] languages = selectedLanguages.split (", ");
for (int i=0; i < languages.length; i++){
if (!(languages[i].equalsIgnoreCase("-1"))){
selectedLanguagesList.add(languages[i]!=null?new Integer(languages[i]):null);
}
}
}
return selectedLanguagesList;
}
public void setSelectedLanguagesList(List<Integer> selectedLanguagesList) {
this.selectedLanguagesList = selectedLanguagesList;
}
/**
* @return the spnList
*/
public List<SPNMonitorVO> getSpnList() {
return spnList;
}
/**
* @param spnList the spnList to set
*/
public void setSpnList(List<SPNMonitorVO> spnList) {
this.spnList = spnList;
}
/**
* @return the spn
*/
public Integer getSpn() {
return spn;
}
/**
* @param spn the spn to set
*/
public void setSpn(Integer spn) {
this.spn = spn;
}
/**
* @return the ratingsList
*/
public List<LookupVO> getRatingsList() {
return ratingsList;
}
/**
* @param ratingsList the ratingsList to set
*/
public void setRatingsList(List<LookupVO> ratingsList) {
this.ratingsList = ratingsList;
}
/**
* @return the distanceList
*/
public List<LookupVO> getDistanceList() {
return distanceList;
}
/**
* @param distanceList the distanceList to set
*/
public void setDistanceList(List<LookupVO> distanceList) {
this.distanceList = distanceList;
}
/**
* @return the perfLevels
*/
public List<String> getPerfLevels() {
return perfLevels;
}
/**
* @param perfLevels the perfLevels to set
*/
public void setPerfLevels(List<String> perfLevels) {
this.perfLevels = perfLevels;
}
/**
* @return the performanceLevelList
*/
public List<LookupVO> getPerformanceLevelList() {
return performanceLevelList;
}
/**
* @param performanceLevelList the performanceLevelList to set
*/
public void setPerformanceLevelList(List<LookupVO> performanceLevelList) {
this.performanceLevelList = performanceLevelList;
}
/**
* @return the yesNoList
*/
public List<LookupVO> getYesNoList() {
return yesNoList;
}
/**
* @param yesNoList the yesNoList to set
*/
public void setYesNoList(List<LookupVO> yesNoList) {
this.yesNoList = yesNoList;
}
}
| 9,090 | 0.693509 | 0.661606 | 321 | 26.317757 | 22.811539 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.554517 | false | false | 1 |
a39b09d0ceb793fd0f43efd53cb06228fbc3aea5 | 6,468,220,784,129 | 2ece3e7c14590c08848b6e96b474d27ef99338ab | /src/main/java/com/businessproject/demo/model/dbmodels/SalesRepresentative.java | ac0eca8ae16cbb93a2265e7bebeaa84c59cc79eb | [
"MIT"
] | permissive | ptaushanov/Project-DashMain | https://github.com/ptaushanov/Project-DashMain | 205c5d63dab513bfbafa2c18da47221b9f35bba7 | 9b97222a983f782143336e2432d8cc44460da702 | refs/heads/master | "2023-08-17T11:08:10.100000" | "2021-01-15T09:41:50" | "2021-01-15T09:41:50" | 320,360,712 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.businessproject.demo.model.dbmodels;
import com.businessproject.demo.configuration.IValidationPatterns;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@Document(collection = "SalesReps")
public class SalesRepresentative implements Entity {
private String id;
@Transient
private String managedById;
@NotNull(message = "First name was not provided!")
@Pattern(regexp = IValidationPatterns.NAME_PATTERN, message = "Not a valid first name was provided!")
@Size(min = 2, max = 15, message = "First name should be between 2 and 15 characters.")
private String firstName;
@NotNull(message = "Last name was not provided!")
@Pattern(regexp = IValidationPatterns.NAME_PATTERN, message = "Not a valid last name was provided!")
@Size(min = 2, max = 15, message = "Last name should be between 2 and 15 characters.")
private String lastName;
@NotNull(message = "Username was not provided!")
@Pattern(regexp = IValidationPatterns.USERNAME_PATTERN, message = "Not a valid username was provided!")
@Size(min = 2, max = 30, message = "Username should be between 2 and 30 characters.")
private String username;
public String getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName.trim();
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName.trim();
}
@Override
public String getFullName() {
return String.format("%s %s", this.firstName, this.lastName);
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username.trim();
}
public String getManagedById() {
return managedById;
}
public void setManagedById(String managedById) {
this.managedById = managedById;
}
public void setId(String id) {
this.id = id;
}
}
| UTF-8 | Java | 2,279 | java | SalesRepresentative.java | Java | [] | null | [] | package com.businessproject.demo.model.dbmodels;
import com.businessproject.demo.configuration.IValidationPatterns;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@Document(collection = "SalesReps")
public class SalesRepresentative implements Entity {
private String id;
@Transient
private String managedById;
@NotNull(message = "First name was not provided!")
@Pattern(regexp = IValidationPatterns.NAME_PATTERN, message = "Not a valid first name was provided!")
@Size(min = 2, max = 15, message = "First name should be between 2 and 15 characters.")
private String firstName;
@NotNull(message = "Last name was not provided!")
@Pattern(regexp = IValidationPatterns.NAME_PATTERN, message = "Not a valid last name was provided!")
@Size(min = 2, max = 15, message = "Last name should be between 2 and 15 characters.")
private String lastName;
@NotNull(message = "Username was not provided!")
@Pattern(regexp = IValidationPatterns.USERNAME_PATTERN, message = "Not a valid username was provided!")
@Size(min = 2, max = 30, message = "Username should be between 2 and 30 characters.")
private String username;
public String getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName.trim();
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName.trim();
}
@Override
public String getFullName() {
return String.format("%s %s", this.firstName, this.lastName);
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username.trim();
}
public String getManagedById() {
return managedById;
}
public void setManagedById(String managedById) {
this.managedById = managedById;
}
public void setId(String id) {
this.id = id;
}
}
| 2,279 | 0.686266 | 0.678368 | 77 | 28.597403 | 28.307339 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.441558 | false | false | 1 |
5e292f7ef8c0dd89f17b139009da204f7b08f741 | 3,032,246,936,346 | cbdafd16ece134b75cf584270fbdd45c15f63f8b | /app/src/main/java/com/wsh/designmodes/memento/practise1/Oringinor.java | a362fe2eb7320ee452c308e2e2b590132a4ce68f | [] | no_license | tianzuishiwo/DesignModes | https://github.com/tianzuishiwo/DesignModes | cc2f26e74a99813d68ecbf9724c011044adf5714 | 7554dfec68f1daf7f45eb15e0f56858723f0e5a9 | refs/heads/master | "2021-01-23T03:59:25.266000" | "2017-04-03T06:20:01" | "2017-04-03T06:20:01" | 86,141,686 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wsh.designmodes.memento.practise1;
import com.wsh.designmodes.XLog;
/**
* Created by laobai on 2017/4/3.
*/
public class Oringinor {
private String name;
private int x;
private int y;
public Oringinor(String name, int x, int y) {
this.name = name;
this.x = x;
this.y = y;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Memento save() {
return new Memento(this);
}
public void restore(Memento memento) {
this.name = memento.getName();
this.x = memento.getX();
this.y = memento.getY();
XLog.e("现在吃后悔药!");
}
@Override
public String toString() {
return "Oringinor{" +
"name='" + name + '\'' +
", x=" + x +
", y=" + y +
'}';
}
}
| UTF-8 | Java | 1,149 | java | Oringinor.java | Java | [
{
"context": "mport com.wsh.designmodes.XLog;\n\n/**\n * Created by laobai on 2017/4/3.\n */\n\npublic class Oringinor {\n pr",
"end": 106,
"score": 0.9988141059875488,
"start": 100,
"tag": "USERNAME",
"value": "laobai"
}
] | null | [] | package com.wsh.designmodes.memento.practise1;
import com.wsh.designmodes.XLog;
/**
* Created by laobai on 2017/4/3.
*/
public class Oringinor {
private String name;
private int x;
private int y;
public Oringinor(String name, int x, int y) {
this.name = name;
this.x = x;
this.y = y;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Memento save() {
return new Memento(this);
}
public void restore(Memento memento) {
this.name = memento.getName();
this.x = memento.getX();
this.y = memento.getY();
XLog.e("现在吃后悔药!");
}
@Override
public String toString() {
return "Oringinor{" +
"name='" + name + '\'' +
", x=" + x +
", y=" + y +
'}';
}
}
| 1,149 | 0.484582 | 0.478414 | 63 | 17.015873 | 14.023214 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.380952 | false | false | 1 |
6e0960a0d08ffc3d2f6e7423f37ed5a5394b6bfa | 22,359,599,763,813 | bd250aece6840d2a1e08c1cd84d7932bb9ac32db | /src/main/java/me/ohughes/actorreactor/domain/ActorPersonalDetails.java | 169acd754e9f244fef4f9fc4fed92caafc60c133 | [] | no_license | ojhughes/actor-reactor | https://github.com/ojhughes/actor-reactor | ebe98ea2d906250c39350f6733655bb5f3597620 | f55ae950a052281d1c13c6f8f2e3b9356eb3df8b | refs/heads/master | "2021-09-04T08:31:24.827000" | "2018-01-17T10:02:08" | "2018-01-17T10:02:08" | 116,413,159 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.ohughes.actorreactor.domain;
import java.time.Year;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
public class ActorPersonalDetails {
private String fullName;
private Year yearOfBirth;
}
| UTF-8 | Java | 248 | java | ActorPersonalDetails.java | Java | [] | null | [] | package me.ohughes.actorreactor.domain;
import java.time.Year;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
public class ActorPersonalDetails {
private String fullName;
private Year yearOfBirth;
}
| 248 | 0.810484 | 0.810484 | 14 | 16.714285 | 13.572181 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 1 |
b99c103196b4e90418a01a02b9983c2492e111e4 | 1,039,382,122,289 | 0c884f3e3d7a7753894de58c5eaa71eb917f9ba3 | /src/com/atguigu/zifuchuanfanzhuan.java | f018f3416fb50063244f4a1a3f37a14848c0215f | [] | no_license | 73jdjdJDate61hdjd84hdjd52juggwf/Algorithm | https://github.com/73jdjdJDate61hdjd84hdjd52juggwf/Algorithm | 644ddd4e43422095007e418a1544c39661de7302 | 4467cc6b9a556970876a9fd089497bb78f17e024 | refs/heads/master | "2022-04-27T23:25:20.079000" | "2020-04-28T00:09:03" | "2020-04-28T00:09:03" | 257,746,896 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atguigu;
import java.util.Scanner;
public class zifuchuanfanzhuan {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String s = in.nextLine();
char[] c = s.toCharArray();
String result="";
for (int i=0;i<c.length;i++){
result = String.valueOf(c[i])+result;
}
System.out.println(result);
}
}
| UTF-8 | Java | 411 | java | zifuchuanfanzhuan.java | Java | [] | null | [] | package com.atguigu;
import java.util.Scanner;
public class zifuchuanfanzhuan {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String s = in.nextLine();
char[] c = s.toCharArray();
String result="";
for (int i=0;i<c.length;i++){
result = String.valueOf(c[i])+result;
}
System.out.println(result);
}
}
| 411 | 0.571776 | 0.569343 | 18 | 21.833334 | 17.150478 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 1 |
4d6a7fe276e85dd7fd68125d810dfab8c5aeadec | 11,261,404,280,131 | 0fbcae0eba8b5288eb22be1ae026f0bb7fa0fba0 | /DominioMoodle/src/objectosNegocio/Mensaje.java | d452f593242df536cbe2fa2c1c1f11487012ab90 | [] | no_license | MirandaMiranda181840/MoodleApp | https://github.com/MirandaMiranda181840/MoodleApp | 762202683a36bfefd477c9586b411f7863317c96 | e811aabc3cef7bbec3d9c3c4e02ed02547aa7ddd | refs/heads/master | "2022-08-24T00:55:35.723000" | "2020-05-21T09:52:37" | "2020-05-21T09:52:37" | 257,802,921 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 objectosNegocio;
/**
*
* @author Email
*/
public class Mensaje {
private int remitenteId;
private int receptorId;
private String contenido;
public Mensaje() {
}
public Mensaje(int remitenteId, int receptorId, String contenido) {
this.remitenteId = remitenteId;
this.receptorId = receptorId;
this.contenido = contenido;
}
public int getRemitenteId() {
return remitenteId;
}
public void setRemitenteId(int remitenteId) {
this.remitenteId = remitenteId;
}
public int getReceptorId() {
return receptorId;
}
public void setReceptorId(int receptorId) {
this.receptorId = receptorId;
}
public String getContenido() {
return contenido;
}
public void setContenido(String contenido) {
this.contenido = contenido;
}
@Override
public String toString() {
return "Mensaje{" + "remitenteId=" + remitenteId + ", receptorId=" + receptorId + ", contenido=" + contenido + '}';
}
}
| UTF-8 | Java | 1,246 | java | Mensaje.java | Java | [
{
"context": "r.\n */\npackage objectosNegocio;\n\n/**\n *\n * @author Email\n */\npublic class Mensaje {\n private int remite",
"end": 234,
"score": 0.7533731460571289,
"start": 229,
"tag": "USERNAME",
"value": "Email"
}
] | null | [] | /*
* 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 objectosNegocio;
/**
*
* @author Email
*/
public class Mensaje {
private int remitenteId;
private int receptorId;
private String contenido;
public Mensaje() {
}
public Mensaje(int remitenteId, int receptorId, String contenido) {
this.remitenteId = remitenteId;
this.receptorId = receptorId;
this.contenido = contenido;
}
public int getRemitenteId() {
return remitenteId;
}
public void setRemitenteId(int remitenteId) {
this.remitenteId = remitenteId;
}
public int getReceptorId() {
return receptorId;
}
public void setReceptorId(int receptorId) {
this.receptorId = receptorId;
}
public String getContenido() {
return contenido;
}
public void setContenido(String contenido) {
this.contenido = contenido;
}
@Override
public String toString() {
return "Mensaje{" + "remitenteId=" + remitenteId + ", receptorId=" + receptorId + ", contenido=" + contenido + '}';
}
}
| 1,246 | 0.635634 | 0.635634 | 56 | 21.25 | 23.849417 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 1 |
78db1071e7ad42e987be128cca49bfb0b02765be | 33,603,824,131,438 | 1a7f3e9c3ab6defa270fbb3f6b49d186aa92367a | /Java EE/src/main/java/com/qa/rest/ColonyEndpoint.java | 85ad3a02322d00dcd55bf7c3e0fe642a30c1db57 | [] | no_license | WareJosephB/QAProject | https://github.com/WareJosephB/QAProject | 870622e30a560e005804739c7bce9309125304ad | ef7d9f906946a10b05059e179f0bc86b2b4ec34d | refs/heads/master | "2020-04-02T03:05:54.576000" | "2018-12-03T10:07:33" | "2018-12-03T10:07:33" | 153,946,076 | 0 | 0 | null | false | "2018-11-23T15:33:29" | "2018-10-20T20:34:38" | "2018-11-23T14:11:04" | "2018-11-23T15:33:29" | 6,308 | 0 | 0 | 0 | Java | false | null | package com.qa.rest;
import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import com.qa.business.service.ColonyService;
@Path("/colony")
public class ColonyEndpoint implements Pointable {
@Inject
private ColonyService service;
public void setService(ColonyService service) {
this.service = service;
}
@Override
@Path("/getAll")
@GET
@Produces({ "application/json" })
public String getAll() {
return service.getAll();
}
@Override
@Path("/add")
@POST
@Produces({ "application/json" })
public String add(String Colony) {
return service.add(Colony);
}
@Override
@Path("/delete/{id}")
@DELETE
@Produces({ "application/json" })
public String delete(@PathParam("id") Long id) {
return service.delete(id);
}
@Override
@Path("/get/{id}")
@GET
@Produces({ "application/json" })
public String get(@PathParam("id") Long id) {
return service.get(id);
}
@Override
@Path("/update/{id}")
@PUT
@Produces({ "application/json" })
public String update(@PathParam("id") Long id, String entity) {
return service.update(id, entity);
}
}
| UTF-8 | Java | 1,230 | java | ColonyEndpoint.java | Java | [] | null | [] | package com.qa.rest;
import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import com.qa.business.service.ColonyService;
@Path("/colony")
public class ColonyEndpoint implements Pointable {
@Inject
private ColonyService service;
public void setService(ColonyService service) {
this.service = service;
}
@Override
@Path("/getAll")
@GET
@Produces({ "application/json" })
public String getAll() {
return service.getAll();
}
@Override
@Path("/add")
@POST
@Produces({ "application/json" })
public String add(String Colony) {
return service.add(Colony);
}
@Override
@Path("/delete/{id}")
@DELETE
@Produces({ "application/json" })
public String delete(@PathParam("id") Long id) {
return service.delete(id);
}
@Override
@Path("/get/{id}")
@GET
@Produces({ "application/json" })
public String get(@PathParam("id") Long id) {
return service.get(id);
}
@Override
@Path("/update/{id}")
@PUT
@Produces({ "application/json" })
public String update(@PathParam("id") Long id, String entity) {
return service.update(id, entity);
}
}
| 1,230 | 0.695122 | 0.695122 | 64 | 18.21875 | 15.866109 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.015625 | false | false | 1 |
78fff90d01eacde5bcfbccb2f601eb3412eaf951 | 32,693,291,125,440 | e6b34e705b046b474c14150698531b21a02528df | /HiTea/src/main/java/com/ht/hitea/seach/TeaBagSeachs.java | 4ad69506acd91f0de72c28321e92a1c79f74f1ae | [] | no_license | cheekyrabbit/HiTea_Project | https://github.com/cheekyrabbit/HiTea_Project | a193f2e09b073f34d740e1986bb476b12d7cc03d | 79bc42c23de436fd066f4fd81f424a7378d11aae | refs/heads/master | "2020-05-17T09:49:46.199000" | "2019-04-26T17:16:35" | "2019-04-26T17:16:35" | 183,643,127 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ht.hitea.seach;
import java.util.List;
public class TeaBagSeachs {
private List<TeaBagSeach> teabagSeach;
public TeaBagSeachs() {
// TODO Auto-generated constructor stub
}
public TeaBagSeachs(List<TeaBagSeach> teabagSeach) {
super();
this.teabagSeach = teabagSeach;
}
public List<TeaBagSeach> getTeabagSeach() {
return teabagSeach;
}
public void setTeabagSeach(List<TeaBagSeach> teabagSeach) {
this.teabagSeach = teabagSeach;
}
}
| UTF-8 | Java | 467 | java | TeaBagSeachs.java | Java | [] | null | [] | package com.ht.hitea.seach;
import java.util.List;
public class TeaBagSeachs {
private List<TeaBagSeach> teabagSeach;
public TeaBagSeachs() {
// TODO Auto-generated constructor stub
}
public TeaBagSeachs(List<TeaBagSeach> teabagSeach) {
super();
this.teabagSeach = teabagSeach;
}
public List<TeaBagSeach> getTeabagSeach() {
return teabagSeach;
}
public void setTeabagSeach(List<TeaBagSeach> teabagSeach) {
this.teabagSeach = teabagSeach;
}
}
| 467 | 0.747323 | 0.747323 | 22 | 20.227272 | 18.831627 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.272727 | false | false | 1 |
9d0c0fcb1bc721f205d05f0f4e0a3a5d1ea53289 | 3,100,966,400,039 | 8f23d27c509c7a2f4e810cb2fdaf65f5808709c6 | /components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java | 0adbb3c1275f25c73c34b764d5942bac83e6f8b6 | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Alirezazabetan/camel | https://github.com/Alirezazabetan/camel | 210db1ba7ee4e1e1e8a194105c40fe2736a3ac6d | 037d15c209e0360b4a6e2e4bb91a1887c19f9414 | refs/heads/master | "2020-04-02T02:13:16.996000" | "2018-10-19T18:14:45" | "2018-10-19T18:14:45" | 153,897,779 | 1 | 1 | Apache-2.0 | true | "2018-10-20T11:16:49" | "2018-10-20T11:16:48" | "2018-10-19T18:15:10" | "2018-10-20T03:34:20" | 227,419 | 0 | 0 | 0 | null | false | null | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.twitter.consumer;
import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.twitter.TwitterEndpoint;
import org.apache.camel.component.twitter.TwitterEndpointPolling;
import org.apache.camel.component.twitter.streaming.AbstractStreamingConsumerHandler;
import org.apache.camel.impl.ScheduledPollConsumer;
/**
* Provides a scheduled polling consumer
*/
@Deprecated
public class TwitterConsumerPolling extends ScheduledPollConsumer {
public static final long DEFAULT_CONSUMER_DELAY = 30 * 1000L;
private final AbstractTwitterConsumerHandler twitter4jConsumer;
public TwitterConsumerPolling(TwitterEndpoint endpoint, Processor processor, AbstractTwitterConsumerHandler twitter4jConsumer) {
super(endpoint, processor);
setDelay(DEFAULT_CONSUMER_DELAY);
this.twitter4jConsumer = twitter4jConsumer;
}
@Override
public TwitterEndpointPolling getEndpoint() {
return (TwitterEndpointPolling) super.getEndpoint();
}
@Override
protected void doStart() throws Exception {
super.doStart();
if (twitter4jConsumer instanceof AbstractStreamingConsumerHandler) {
((AbstractStreamingConsumerHandler) twitter4jConsumer).start();
}
}
@Override
protected void doStop() throws Exception {
if (twitter4jConsumer instanceof AbstractStreamingConsumerHandler) {
((AbstractStreamingConsumerHandler) twitter4jConsumer).stop();
}
super.doStop();
}
@Override
protected int poll() throws Exception {
List<Exchange> exchanges = twitter4jConsumer.pollConsume();
int index = 0;
for (; index < exchanges.size(); index++) {
getProcessor().process(exchanges.get(index));
}
return index;
}
}
| UTF-8 | Java | 2,696 | java | TwitterConsumerPolling.java | Java | [] | null | [] | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.twitter.consumer;
import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.twitter.TwitterEndpoint;
import org.apache.camel.component.twitter.TwitterEndpointPolling;
import org.apache.camel.component.twitter.streaming.AbstractStreamingConsumerHandler;
import org.apache.camel.impl.ScheduledPollConsumer;
/**
* Provides a scheduled polling consumer
*/
@Deprecated
public class TwitterConsumerPolling extends ScheduledPollConsumer {
public static final long DEFAULT_CONSUMER_DELAY = 30 * 1000L;
private final AbstractTwitterConsumerHandler twitter4jConsumer;
public TwitterConsumerPolling(TwitterEndpoint endpoint, Processor processor, AbstractTwitterConsumerHandler twitter4jConsumer) {
super(endpoint, processor);
setDelay(DEFAULT_CONSUMER_DELAY);
this.twitter4jConsumer = twitter4jConsumer;
}
@Override
public TwitterEndpointPolling getEndpoint() {
return (TwitterEndpointPolling) super.getEndpoint();
}
@Override
protected void doStart() throws Exception {
super.doStart();
if (twitter4jConsumer instanceof AbstractStreamingConsumerHandler) {
((AbstractStreamingConsumerHandler) twitter4jConsumer).start();
}
}
@Override
protected void doStop() throws Exception {
if (twitter4jConsumer instanceof AbstractStreamingConsumerHandler) {
((AbstractStreamingConsumerHandler) twitter4jConsumer).stop();
}
super.doStop();
}
@Override
protected int poll() throws Exception {
List<Exchange> exchanges = twitter4jConsumer.pollConsume();
int index = 0;
for (; index < exchanges.size(); index++) {
getProcessor().process(exchanges.get(index));
}
return index;
}
}
| 2,696 | 0.731083 | 0.723665 | 77 | 34.012985 | 30.588383 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415584 | false | false | 1 |
e010ed25cadabb2c1f612aa54c04b2d7bdb83447 | 6,201,932,787,751 | 3fd9ed1ab45c858274ad82c8c60febcff9fb839b | /src/main/java/WindSlash.java | 633fef1723b5f5a76c292a4b6ff0ceb13c600557 | [] | no_license | arvinrivers/roguelike-game-systems | https://github.com/arvinrivers/roguelike-game-systems | a9beb2ee8b758691443987c147ab059bff18713c | da58caa713f40bc8e9287ff65aff3408b180d148 | refs/heads/master | "2023-08-26T18:31:56.384000" | "2021-11-13T13:31:58" | "2021-11-13T13:31:58" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class WindSlash implements Action {
private final Entity user;
private final int speed = 8;
private final int manaCost;
private final int damage;
private final Element element = new Air();
public WindSlash(Entity user) {
this.user = user;
int level = user.getLevel().getCurrentLevel();
this.manaCost = level * 2;
this.damage = level * 2;
}
@Override
public void apply(Entity target) {
if(target == user){
throw new IllegalArgumentException("Can't target self with spell");
}else if(user.getCurrentMana() < getManaCost()){
throw new IllegalStateException("Not enough mana");
}
target.decreaseHP((int) Math.floor(getDamage() * element.getModifierAgainst(target.getElement())));
user.decreaseMana(getManaCost());
}
@Override
public double getSpeed() {
return speed * user.getWeapon().getSpeedModifier();
}
public int getManaCost() {
return manaCost;
}
public int getDamage() {
return damage;
}
}
| UTF-8 | Java | 1,093 | java | WindSlash.java | Java | [] | null | [] | public class WindSlash implements Action {
private final Entity user;
private final int speed = 8;
private final int manaCost;
private final int damage;
private final Element element = new Air();
public WindSlash(Entity user) {
this.user = user;
int level = user.getLevel().getCurrentLevel();
this.manaCost = level * 2;
this.damage = level * 2;
}
@Override
public void apply(Entity target) {
if(target == user){
throw new IllegalArgumentException("Can't target self with spell");
}else if(user.getCurrentMana() < getManaCost()){
throw new IllegalStateException("Not enough mana");
}
target.decreaseHP((int) Math.floor(getDamage() * element.getModifierAgainst(target.getElement())));
user.decreaseMana(getManaCost());
}
@Override
public double getSpeed() {
return speed * user.getWeapon().getSpeedModifier();
}
public int getManaCost() {
return manaCost;
}
public int getDamage() {
return damage;
}
}
| 1,093 | 0.619396 | 0.616651 | 38 | 27.763159 | 23.831022 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 1 |
ea2eb4cbd8327ad4a040a3204efc801d503cafd8 | 31,086,973,292,595 | 3ccf4eab7c5acdcc2bfa1a601252c2da0455f96c | /java/src/main/java/dms/pastor/tools/chinese/validator/WordValidator.java | 14efd126327bbe980e5848d3b181b69ae4c992ae | [] | no_license | pastorcmentarny/DomJavaKB | https://github.com/pastorcmentarny/DomJavaKB | 2760c328de1bd4ed160b846f91f69e80bc2d686c | f6bfad71d2268a86eaf1c4ee88aa690bb7d2fb49 | refs/heads/master | "2023-05-27T08:42:33.108000" | "2023-05-02T06:51:32" | "2023-05-02T06:51:32" | 84,251,539 | 0 | 0 | null | false | "2023-05-23T06:49:12" | "2017-03-07T22:14:58" | "2021-12-23T00:07:55" | "2023-05-23T06:49:12" | 21,235 | 0 | 0 | 1 | Java | false | false | package dms.pastor.tools.chinese.validator;
import dms.pastor.utils.string.ContainsInStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import static dms.pastor.utils.StringUtils.EMPTY_STRING;
import static dms.pastor.utils.StringUtils.isStringEmpty;
import static dms.pastor.utils.ValidatorUtils.validateIfObjectValueIsNotNull;
import static dms.pastor.utils.string.ContainsInStringUtils.containsAnyAlphanumericCharacter;
import static dms.pastor.utils.string.ContainsInStringUtils.containsPinyinCharacter;
import static java.util.Objects.isNull;
/**
* Author Dominik Symonowicz
* WWW: https://dominiksymonowicz.com/welcome
* IT BLOG: https://dominiksymonowicz.blogspot.co.uk
* GitHub: https://github.com/pastorcmentarny
* Google Play: https://play.google.com/store/apps/developer?id=Dominik+Symonowicz
* LinkedIn: https://www.linkedin.com/in/dominik-symonowicz
*/
final class WordValidator {
private static final Logger LOGGER = LoggerFactory.getLogger(Word.class);
private static final List<String> allowedChineseWordsWithEnglishCharactersList = List.of("T恤", "Java 开发人员");
private WordValidator() {
}
static boolean isWordValid(Word word) {
validateIfObjectValueIsNotNull(word, "Word");
if (word.getId() <= 0) {
LOGGER.error("id is invalid.value:" + word.getId());
return false;
}
if (isNotValidStroke(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "Strokes", "Invalid number of strokes."));
return false;
}
if (isNotValidChineseCharacter(word)) {
if (isStringEmpty(word.getChineseCharacter()) || isContainsAllowedWords(word.getChineseCharacter())) {
LOGGER.error(generateErrorMessage(word.getId(), "Chinese character", "It does't contain chinese character,"));
return false;
}
}
if (isNotValidPinyin(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "Pinyin", "Pinyin should not contain upper case letters."));
return false;
}
if (isNotValidEnglishWord(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "English word", "English meaning should not be empty or contain pinyin character."));
return false;
}
if (isNull(word.getNotes())) {
LOGGER.error(generateErrorMessage(word.getId(), "Notes", "Notes should not be null."));
return false;
}
if (word.getGroups().length == 0) {
LOGGER.error(generateErrorMessage(word.getId(), "Groups", "It should be assign to at least 1 group."));
return false;
}
if (isNotInRange(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "Difficulty", "value " + word.getDifficulty() + " is not in range."));
return false;
}
if (hasValidHash(word.getHash())) {
LOGGER.error(generateErrorMessage(word.getId(), "Hash", "value { " + word.getHash() + " } is not valid."));
return false;
}
return true;
}
private static boolean isContainsAllowedWords(String word) {
for (String allowedWord : allowedChineseWordsWithEnglishCharactersList) {
if (allowedWord.equalsIgnoreCase(word)) {
return false;
}
}
return true;
}
private static boolean isNotValidChineseCharacter(Word word) {
return isStringEmpty(word.getChineseCharacter()) || containsAnyAlphanumericCharacter(word.getChineseCharacter()) || containsPinyinCharacter(word.getChineseCharacter());
}
private static boolean isNotValidStroke(Word word) {
return word.getStrokes() < -1 || word.getStrokes() == 0;
}
//pinyin should be lowered case only
private static boolean isNotValidPinyin(Word word) {
return isStringEmpty(word.getPinyin()) || ContainsInStringUtils.containsUpperCase(word.getPinyin());
}
private static boolean isNotValidEnglishWord(Word word) {
return isStringEmpty(word.getWordInEnglish()) || containsPinyinCharacter(word.getWordInEnglish());
}
private static boolean isNotInRange(Word word) {
return word.getDifficulty() > 8 || word.getDifficulty() < 1;
}
private static boolean hasValidHash(String hash) {
return isStringEmpty(hash) || hash.length() != 8;
}
private static String generateErrorMessage(int id, String what, String reason) {
return String.format("%s is invalid for word id: %d. %s", what, id, getReason(reason));
}
private static String getReason(String reason) {
return reason != null ? reason : EMPTY_STRING;
}
}
| UTF-8 | Java | 4,780 | java | WordValidator.java | Java | [
{
"context": "rt static java.util.Objects.isNull;\n\n/**\n * Author Dominik Symonowicz\n * WWW:\thttps://dominiksymonowicz.com/welcome\n * ",
"end": 626,
"score": 0.9998886585235596,
"start": 608,
"tag": "NAME",
"value": "Dominik Symonowicz"
},
{
"context": "wicz.blogspot.co.uk\n * GitHub:\thttps://github.com/pastorcmentarny\n * Google Play:\thttps://play.google.com/store/app",
"end": 771,
"score": 0.9861056208610535,
"start": 756,
"tag": "USERNAME",
"value": "pastorcmentarny"
},
{
"context": "monowicz\n * LinkedIn: https://www.linkedin.com/in/dominik-symonowicz\n */\nfinal class WordValidator {\n private stati",
"end": 914,
"score": 0.9996694922447205,
"start": 896,
"tag": "USERNAME",
"value": "dominik-symonowicz"
}
] | null | [] | package dms.pastor.tools.chinese.validator;
import dms.pastor.utils.string.ContainsInStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import static dms.pastor.utils.StringUtils.EMPTY_STRING;
import static dms.pastor.utils.StringUtils.isStringEmpty;
import static dms.pastor.utils.ValidatorUtils.validateIfObjectValueIsNotNull;
import static dms.pastor.utils.string.ContainsInStringUtils.containsAnyAlphanumericCharacter;
import static dms.pastor.utils.string.ContainsInStringUtils.containsPinyinCharacter;
import static java.util.Objects.isNull;
/**
* Author <NAME>
* WWW: https://dominiksymonowicz.com/welcome
* IT BLOG: https://dominiksymonowicz.blogspot.co.uk
* GitHub: https://github.com/pastorcmentarny
* Google Play: https://play.google.com/store/apps/developer?id=Dominik+Symonowicz
* LinkedIn: https://www.linkedin.com/in/dominik-symonowicz
*/
final class WordValidator {
private static final Logger LOGGER = LoggerFactory.getLogger(Word.class);
private static final List<String> allowedChineseWordsWithEnglishCharactersList = List.of("T恤", "Java 开发人员");
private WordValidator() {
}
static boolean isWordValid(Word word) {
validateIfObjectValueIsNotNull(word, "Word");
if (word.getId() <= 0) {
LOGGER.error("id is invalid.value:" + word.getId());
return false;
}
if (isNotValidStroke(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "Strokes", "Invalid number of strokes."));
return false;
}
if (isNotValidChineseCharacter(word)) {
if (isStringEmpty(word.getChineseCharacter()) || isContainsAllowedWords(word.getChineseCharacter())) {
LOGGER.error(generateErrorMessage(word.getId(), "Chinese character", "It does't contain chinese character,"));
return false;
}
}
if (isNotValidPinyin(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "Pinyin", "Pinyin should not contain upper case letters."));
return false;
}
if (isNotValidEnglishWord(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "English word", "English meaning should not be empty or contain pinyin character."));
return false;
}
if (isNull(word.getNotes())) {
LOGGER.error(generateErrorMessage(word.getId(), "Notes", "Notes should not be null."));
return false;
}
if (word.getGroups().length == 0) {
LOGGER.error(generateErrorMessage(word.getId(), "Groups", "It should be assign to at least 1 group."));
return false;
}
if (isNotInRange(word)) {
LOGGER.error(generateErrorMessage(word.getId(), "Difficulty", "value " + word.getDifficulty() + " is not in range."));
return false;
}
if (hasValidHash(word.getHash())) {
LOGGER.error(generateErrorMessage(word.getId(), "Hash", "value { " + word.getHash() + " } is not valid."));
return false;
}
return true;
}
private static boolean isContainsAllowedWords(String word) {
for (String allowedWord : allowedChineseWordsWithEnglishCharactersList) {
if (allowedWord.equalsIgnoreCase(word)) {
return false;
}
}
return true;
}
private static boolean isNotValidChineseCharacter(Word word) {
return isStringEmpty(word.getChineseCharacter()) || containsAnyAlphanumericCharacter(word.getChineseCharacter()) || containsPinyinCharacter(word.getChineseCharacter());
}
private static boolean isNotValidStroke(Word word) {
return word.getStrokes() < -1 || word.getStrokes() == 0;
}
//pinyin should be lowered case only
private static boolean isNotValidPinyin(Word word) {
return isStringEmpty(word.getPinyin()) || ContainsInStringUtils.containsUpperCase(word.getPinyin());
}
private static boolean isNotValidEnglishWord(Word word) {
return isStringEmpty(word.getWordInEnglish()) || containsPinyinCharacter(word.getWordInEnglish());
}
private static boolean isNotInRange(Word word) {
return word.getDifficulty() > 8 || word.getDifficulty() < 1;
}
private static boolean hasValidHash(String hash) {
return isStringEmpty(hash) || hash.length() != 8;
}
private static String generateErrorMessage(int id, String what, String reason) {
return String.format("%s is invalid for word id: %d. %s", what, id, getReason(reason));
}
private static String getReason(String reason) {
return reason != null ? reason : EMPTY_STRING;
}
}
| 4,768 | 0.665828 | 0.663732 | 130 | 35.692307 | 38.371231 | 176 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.669231 | false | false | 1 |
edf20cf6300278fc81089aad33cf02f9aad835ad | 6,073,083,788,498 | 45d5b4934436ee3f96c927562f3a0f4ea28643e5 | /Rxjava2.0Demo/app/src/main/java/rx_retrofit_RepeatWhen/mode/Rxjava_Retrofit.java | 07c50067f0edff67fb5264a9e17064964d5ff946 | [] | no_license | 979527040/Rxjava2.0 | https://github.com/979527040/Rxjava2.0 | fea902c0973790e3365a825b409ce1b544803d94 | aa05a3e27d09214120b8296cd0272036d44aca5d | refs/heads/master | "2021-05-06T12:35:52.396000" | "2017-12-06T03:14:51" | "2017-12-06T03:14:51" | 113,161,677 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rx_retrofit_RepeatWhen.mode;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import rx_retrofit_RepeatWhen.Interface.GetRequest_Interface;
import rx_retrofit_RepeatWhen.bean.Translation;
/**
* Created by 97952 on 2017/12/5.
*/
//TODO 有条件的轮询
public class Rxjava_Retrofit {
Observable<Translation> observable;
GetRequest_Interface request;
int i = 0;
public void initRetrofit(Activity context) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://fy.iciba.com/")
.addConverterFactory(GsonConverterFactory.create())//使用Gson解析
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())//设置支持Rxjava
.build();
//创建网络请求接口实例
request = retrofit.create(GetRequest_Interface.class);
//采用Observable对网络请求接口进行封装
observable = request.getCall();
requestNet(context);
}
public void requestNet(final Activity context) {
//发送网络请求通过repeatWhen进行轮询
//在Function函数中,必须对输入的Observable<Object>进行处理,此处用flatMap操作符接收上游的数据
observable.repeatWhen(new Function<Observable<Object>, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(Observable<Object> objectObservable) throws Exception {
//将原始Observable停止发送时间的标识(Complete()/Error())转换成1个Object类型数据传递给1个被观察者Observable
//以此决定是否重新订阅&发送原来的Observable,即轮询
//此处有两种情况
//1.若返回1个Complete()/Error()事件,则不重新订阅&发送原来的Observable,即轮询结束
//2.若返回其余事件,则重新订阅&发送原来的Observable,即继续轮询
return objectObservable.flatMap(new Function<Object, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(Object o) throws Exception {
//加入判断条件:当轮询次数=5次后,停止轮询
if (i > 3) {
//此处选择发送OnError事件以结束轮询,因此可触发下游观察者的onError()方法回调
Toast.makeText(context,"轮询结束",Toast.LENGTH_SHORT).show();
return Observable.error(new Throwable("轮询结束"));
}
//若轮询次数<4次,则发送Next事件以继续轮询
//注:此处加入了delay操作符,作用=延迟一段时间发送(2s),实现轮询间间隔设置
return Observable.just(1).delay(2000, TimeUnit.MILLISECONDS);
}
});
}
}).subscribeOn(Schedulers.io())//切换到io线程进行网络请求
.observeOn(AndroidSchedulers.mainThread()) //切换回到主线程,处理请求结果
.subscribe(new Observer<Translation>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Translation value) {
//接收服务器返回的数据
Log.e("TAG","接收到的数据"+value);
Toast.makeText(context,"第"+i+"次轮询",Toast.LENGTH_SHORT).show();
i++;
}
@Override
public void onError(Throwable e) {
//获取轮询结束信息
Log.e("TAG", e.toString());
}
@Override
public void onComplete() {
}
});
}
}
| UTF-8 | Java | 4,530 | java | Rxjava_Retrofit.java | Java | [
{
"context": "t_RepeatWhen.bean.Translation;\n\n/**\n * Created by 97952 on 2017/12/5.\n */\n//TODO 有条件的轮询\npublic class Rxja",
"end": 738,
"score": 0.9864219427108765,
"start": 733,
"tag": "USERNAME",
"value": "97952"
}
] | null | [] | package rx_retrofit_RepeatWhen.mode;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import rx_retrofit_RepeatWhen.Interface.GetRequest_Interface;
import rx_retrofit_RepeatWhen.bean.Translation;
/**
* Created by 97952 on 2017/12/5.
*/
//TODO 有条件的轮询
public class Rxjava_Retrofit {
Observable<Translation> observable;
GetRequest_Interface request;
int i = 0;
public void initRetrofit(Activity context) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://fy.iciba.com/")
.addConverterFactory(GsonConverterFactory.create())//使用Gson解析
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())//设置支持Rxjava
.build();
//创建网络请求接口实例
request = retrofit.create(GetRequest_Interface.class);
//采用Observable对网络请求接口进行封装
observable = request.getCall();
requestNet(context);
}
public void requestNet(final Activity context) {
//发送网络请求通过repeatWhen进行轮询
//在Function函数中,必须对输入的Observable<Object>进行处理,此处用flatMap操作符接收上游的数据
observable.repeatWhen(new Function<Observable<Object>, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(Observable<Object> objectObservable) throws Exception {
//将原始Observable停止发送时间的标识(Complete()/Error())转换成1个Object类型数据传递给1个被观察者Observable
//以此决定是否重新订阅&发送原来的Observable,即轮询
//此处有两种情况
//1.若返回1个Complete()/Error()事件,则不重新订阅&发送原来的Observable,即轮询结束
//2.若返回其余事件,则重新订阅&发送原来的Observable,即继续轮询
return objectObservable.flatMap(new Function<Object, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(Object o) throws Exception {
//加入判断条件:当轮询次数=5次后,停止轮询
if (i > 3) {
//此处选择发送OnError事件以结束轮询,因此可触发下游观察者的onError()方法回调
Toast.makeText(context,"轮询结束",Toast.LENGTH_SHORT).show();
return Observable.error(new Throwable("轮询结束"));
}
//若轮询次数<4次,则发送Next事件以继续轮询
//注:此处加入了delay操作符,作用=延迟一段时间发送(2s),实现轮询间间隔设置
return Observable.just(1).delay(2000, TimeUnit.MILLISECONDS);
}
});
}
}).subscribeOn(Schedulers.io())//切换到io线程进行网络请求
.observeOn(AndroidSchedulers.mainThread()) //切换回到主线程,处理请求结果
.subscribe(new Observer<Translation>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Translation value) {
//接收服务器返回的数据
Log.e("TAG","接收到的数据"+value);
Toast.makeText(context,"第"+i+"次轮询",Toast.LENGTH_SHORT).show();
i++;
}
@Override
public void onError(Throwable e) {
//获取轮询结束信息
Log.e("TAG", e.toString());
}
@Override
public void onComplete() {
}
});
}
}
| 4,530 | 0.580135 | 0.571577 | 99 | 37.949493 | 26.32024 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 1 |
3a39946fd338b2ccb12f9846752323e3af7a2b09 | 8,486,855,401,013 | 0b19f17399e34edb32bcde38318c9745387f2029 | /code/workspace/day14_code/src/com/atguigu/homework/test03/Test03.java | 110bc7872a1dd36b2ea6fc563e28d6700df8ef81 | [] | no_license | windmycode/LearningJava | https://github.com/windmycode/LearningJava | 21a2e990c43f679b2c61817a5e9040deba80891e | c96feb5e336ece773ea02427b589a5462d4b984c | refs/heads/master | "2022-12-14T16:47:06.734000" | "2020-09-15T13:54:29" | "2020-09-15T13:54:29" | 295,724,443 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atguigu.homework.test03;
import java.util.Scanner;
/*
* * 模拟玩家选择角色。
* 定义接口FightAble:
* 抽象方法:specialFight。
* 默认方法:commonFight,方法中打印"普通打击"。
* 定义战士类:
* 实现FightAble接口,重写方法中打印"武器攻击"。
* 定义法师类Mage:
* 实现FightAble接口,重写方法中打印"法术攻击"。
* 定义玩家类Player:
* 静态方法:FightAble select(String str),根据指令选择角色。
* 法力角色,选择法师。
* 武力角色,选择战士。
* 代码实现,效果如图所示:
*/
public class Test03 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("选择:");
String role = input.next();
FightAble f = Player.select(role);
f.specialFight();
f.commonFight();
System.out.println("================");
System.out.print("选择:");
String role2 = input.next();
FightAble f2 = Player.select(role2);
f2.specialFight();
f2.commonFight();
}
}
interface FightAble{
void specialFight();
public default void commonFight(){
System.out.println("普通打击");
}
}
class Soldier implements FightAble{
@Override
public void specialFight() {
System.out.println("武器攻击");
}
}
class Mage implements FightAble{
@Override
public void specialFight() {
System.out.println("法术攻击");
}
}
class Player{
public static FightAble select(String str){
if("法力角色".equals(str)){
return new Mage();
}else if("武力角色".equals(str)){
return new Soldier();
}
return null;
}
} | UTF-8 | Java | 1,638 | java | Test03.java | Java | [] | null | [] | package com.atguigu.homework.test03;
import java.util.Scanner;
/*
* * 模拟玩家选择角色。
* 定义接口FightAble:
* 抽象方法:specialFight。
* 默认方法:commonFight,方法中打印"普通打击"。
* 定义战士类:
* 实现FightAble接口,重写方法中打印"武器攻击"。
* 定义法师类Mage:
* 实现FightAble接口,重写方法中打印"法术攻击"。
* 定义玩家类Player:
* 静态方法:FightAble select(String str),根据指令选择角色。
* 法力角色,选择法师。
* 武力角色,选择战士。
* 代码实现,效果如图所示:
*/
public class Test03 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("选择:");
String role = input.next();
FightAble f = Player.select(role);
f.specialFight();
f.commonFight();
System.out.println("================");
System.out.print("选择:");
String role2 = input.next();
FightAble f2 = Player.select(role2);
f2.specialFight();
f2.commonFight();
}
}
interface FightAble{
void specialFight();
public default void commonFight(){
System.out.println("普通打击");
}
}
class Soldier implements FightAble{
@Override
public void specialFight() {
System.out.println("武器攻击");
}
}
class Mage implements FightAble{
@Override
public void specialFight() {
System.out.println("法术攻击");
}
}
class Player{
public static FightAble select(String str){
if("法力角色".equals(str)){
return new Mage();
}else if("武力角色".equals(str)){
return new Soldier();
}
return null;
}
} | 1,638 | 0.664902 | 0.658094 | 70 | 17.9 | 13.801811 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.271429 | false | false | 1 |
1085b4f78705cda749c631a2f80b69c0cd3eded2 | 11,802,570,135,322 | 2fc587950690f6946c78e689093373aa520bba7d | /Board.java | ead1f55a7b2df258142e833bebd68ef016cc04dc | [] | no_license | Wangistan/Conflict-Boats---Version-of-Leon | https://github.com/Wangistan/Conflict-Boats---Version-of-Leon | 5d5c8f6d37cafbf7f303d55b7f5e1dc54cef8fbc | a731119956246af93632fe81112cd9a7b8678f00 | refs/heads/master | "2021-01-13T03:00:34.324000" | "2017-01-19T16:08:22" | "2017-01-19T16:08:22" | 77,064,735 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Board {
//Setting boolean variables accordingly
static boolean isGameOn = true;
static boolean hasSetupDonePlayer1 = false;
static boolean hasSetupDonePlayer2 = false;
public static boolean isSelected = false;
//Main Method to run the game
public static void main(String[] args) {
//Creating new frame with appropriate layouts
final JFrame frame = new JFrame("Battleship");
frame.setSize(1900, 1000);
frame.setLayout(new GridLayout(1, 3));
//Creating divider and leftfield objects
final Divider divider = new Divider();
final LeftField leftField = new LeftField(divider);
final RightField rightField = new RightField(divider);
final JPanel credits = new JPanel ();
final JPanel instructions = new JPanel ();
//Setting up game window
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
final JPanel mainMenu = new JPanel();
frame.add(mainMenu);
ActionListener al = new ActionListener(){
public void actionPerformed(ActionEvent e){
if(!(e.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) e.getSource();
if(button.getText().equalsIgnoreCase("Start")){
// Button got pressed
//Adding classes
frame.remove(mainMenu);
frame.add(leftField);
frame.add(divider);
frame.add(rightField);
frame.validate();
}else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener alCredits = new ActionListener(){
public void actionPerformed(ActionEvent d){
if(!(d.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) d.getSource();
if(button.getText().equalsIgnoreCase("Credits")){
//Button got pressed
//Adding classes
frame.remove(mainMenu);
frame.add(credits);
frame.setVisible(false);
frame.setVisible(true);
frame.validate();
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener alInstruction = new ActionListener(){
public void actionPerformed(ActionEvent f){
if(!(f.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) f.getSource();
if(button.getText().equalsIgnoreCase("Instructions")){
//Button got pressed
//Adding classes
frame.remove(mainMenu);
frame.add(instructions);
frame.validate();
frame.setVisible(false);
frame.setVisible(true);
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener backInstructions = new ActionListener(){
public void actionPerformed(ActionEvent g){
if(!(g.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) g.getSource();
if(button.getText().equalsIgnoreCase("Back")){
//Button got pressed
//Adding classes
frame.remove(instructions);
frame.add(mainMenu);
frame.validate();
frame.setVisible(false);
frame.setVisible(true);
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener backCredits = new ActionListener(){
public void actionPerformed(ActionEvent h){
if(!(h.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) h.getSource();
if(button.getText().equalsIgnoreCase("Back")){
//Button got pressed
//Adding classes
frame.remove(credits);
frame.add(mainMenu);
frame.validate();
frame.setVisible(false);
frame.setVisible(true);
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
JButton start = new JButton ("Start");
start.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
start.addActionListener(al);
mainMenu.add(start);
JButton instructionButton = new JButton("Instructions");
instructionButton.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
instructionButton.addActionListener(alInstruction);
mainMenu.add(instructionButton);
JButton creditsButton= new JButton ("Credits");
creditsButton.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
creditsButton.addActionListener(alCredits);
mainMenu.add(creditsButton);
JButton back1 = new JButton("Back");
JButton back2 = new JButton("Back");
back1.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
back2.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
back1.addActionListener(backInstructions);
back2.addActionListener(backCredits);
instructions.add(back1);
JButton quit = new JButton("Quit");
quit.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
quit.addActionListener(al);
mainMenu.add(quit);
JLabel jlabel1 = new JLabel("CREDITS");
JLabel jlabel2 = new JLabel("Images:");
JLabel jlabel3 = new JLabel("Developers:");
JLabel space = new JLabel (" ");
JLabel destroyer = new JLabel("http://www.wallhogs.com/in_stock/category/639?page=2");
JLabel aircraftcarrier = new JLabel("https://commons.wikimedia.org/wiki/File:Flugzeugtr%C3%A4ger_Silhouette.svg");
JLabel submarine = new JLabel("http://worldartsme.com/submarine-silhouette-clipart.html#gal_post_108271_submarine-silhouette-clipart-1.jpg");
JLabel patrolboat = new JLabel("https://it.pinterest.com/pin/288934132325552202/");
JLabel raft = new JLabel("http://www.supercoloring.com/silhouettes/rafting");
JLabel waterLink = new JLabel ("https://www.johnweiss.ca/single-post/2016/10/08/The-Water-Element");
JLabel x = new JLabel ("http://www.freeiconspng.com/png-images/x-png");
JLabel name1 = new JLabel("Wisley Chen");
JLabel name2 = new JLabel("Paul Jang");
JLabel name3 = new JLabel("Leon Wang");
jlabel1.setFont(new Font("Verdana",1,50));
jlabel2.setFont(new Font("Verdana",1,25));
jlabel3.setFont(new Font("Verdana",1,25));
destroyer.setFont(new Font("Verdana",1,20));
aircraftcarrier.setFont(new Font("Verdana",1,20));
submarine.setFont(new Font("Verdana",1,20));
patrolboat.setFont(new Font("Verdana",1,20));
raft.setFont(new Font("Verdana",1,20));
waterLink.setFont(new Font("Verdana",1,20));
x.setFont(new Font("Verdana",1,20));
name1.setFont(new Font("Verdana",1,20));
name2.setFont(new Font("Verdana",1,20));
name3.setFont(new Font("Verdana",1,20));
credits.add(jlabel1);
credits.add(jlabel2);
credits.add(destroyer);
credits.add(aircraftcarrier);
credits.add(submarine);
credits.add(patrolboat);
credits.add(raft);
credits.add(waterLink);
credits.add(x);
credits.add(space);
credits.add(jlabel3);
credits.add(name1);
credits.add(name2);
credits.add(name3);
credits.add(Box.createRigidArea(new Dimension(0,400)));
credits.add(back2);
name1.setForeground (Color.red);
name2.setForeground (Color.green);
name3.setForeground (Color.magenta);
frame.setVisible(true);
credits.setLayout(new BoxLayout(credits, BoxLayout.Y_AXIS));
}
}
| UTF-8 | Java | 8,286 | java | Board.java | Java | [
{
"context": "g-images/x-png\");\r\n JLabel name1 = new JLabel(\"Wisley Chen\");\r\n JLabel name2 = new JLabel(\"Paul Jang\");\r\n",
"end": 6848,
"score": 0.9998090863227844,
"start": 6837,
"tag": "NAME",
"value": "Wisley Chen"
},
{
"context": "l(\"Wisley Chen\");\r\n JLabel name2 = new JLabel(\"Paul Jang\");\r\n JLabel name3 = new JLabel(\"Leon Wang\");\r\n",
"end": 6893,
"score": 0.9998152852058411,
"start": 6884,
"tag": "NAME",
"value": "Paul Jang"
},
{
"context": "bel(\"Paul Jang\");\r\n JLabel name3 = new JLabel(\"Leon Wang\");\r\n \r\n jlabel1.setFont(new Font(\"Verdana\",",
"end": 6938,
"score": 0.9998077750205994,
"start": 6929,
"tag": "NAME",
"value": "Leon Wang"
}
] | null | [] | import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Board {
//Setting boolean variables accordingly
static boolean isGameOn = true;
static boolean hasSetupDonePlayer1 = false;
static boolean hasSetupDonePlayer2 = false;
public static boolean isSelected = false;
//Main Method to run the game
public static void main(String[] args) {
//Creating new frame with appropriate layouts
final JFrame frame = new JFrame("Battleship");
frame.setSize(1900, 1000);
frame.setLayout(new GridLayout(1, 3));
//Creating divider and leftfield objects
final Divider divider = new Divider();
final LeftField leftField = new LeftField(divider);
final RightField rightField = new RightField(divider);
final JPanel credits = new JPanel ();
final JPanel instructions = new JPanel ();
//Setting up game window
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
final JPanel mainMenu = new JPanel();
frame.add(mainMenu);
ActionListener al = new ActionListener(){
public void actionPerformed(ActionEvent e){
if(!(e.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) e.getSource();
if(button.getText().equalsIgnoreCase("Start")){
// Button got pressed
//Adding classes
frame.remove(mainMenu);
frame.add(leftField);
frame.add(divider);
frame.add(rightField);
frame.validate();
}else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener alCredits = new ActionListener(){
public void actionPerformed(ActionEvent d){
if(!(d.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) d.getSource();
if(button.getText().equalsIgnoreCase("Credits")){
//Button got pressed
//Adding classes
frame.remove(mainMenu);
frame.add(credits);
frame.setVisible(false);
frame.setVisible(true);
frame.validate();
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener alInstruction = new ActionListener(){
public void actionPerformed(ActionEvent f){
if(!(f.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) f.getSource();
if(button.getText().equalsIgnoreCase("Instructions")){
//Button got pressed
//Adding classes
frame.remove(mainMenu);
frame.add(instructions);
frame.validate();
frame.setVisible(false);
frame.setVisible(true);
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener backInstructions = new ActionListener(){
public void actionPerformed(ActionEvent g){
if(!(g.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) g.getSource();
if(button.getText().equalsIgnoreCase("Back")){
//Button got pressed
//Adding classes
frame.remove(instructions);
frame.add(mainMenu);
frame.validate();
frame.setVisible(false);
frame.setVisible(true);
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
ActionListener backCredits = new ActionListener(){
public void actionPerformed(ActionEvent h){
if(!(h.getSource() instanceof JButton)){
return;
}
JButton button = (JButton) h.getSource();
if(button.getText().equalsIgnoreCase("Back")){
//Button got pressed
//Adding classes
frame.remove(credits);
frame.add(mainMenu);
frame.validate();
frame.setVisible(false);
frame.setVisible(true);
}
else if(button.getText().equalsIgnoreCase("quit")){
System.exit(0);
}
}
};
JButton start = new JButton ("Start");
start.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
start.addActionListener(al);
mainMenu.add(start);
JButton instructionButton = new JButton("Instructions");
instructionButton.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
instructionButton.addActionListener(alInstruction);
mainMenu.add(instructionButton);
JButton creditsButton= new JButton ("Credits");
creditsButton.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
creditsButton.addActionListener(alCredits);
mainMenu.add(creditsButton);
JButton back1 = new JButton("Back");
JButton back2 = new JButton("Back");
back1.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
back2.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
back1.addActionListener(backInstructions);
back2.addActionListener(backCredits);
instructions.add(back1);
JButton quit = new JButton("Quit");
quit.setFont(new Font(start.getFont().getName(), Font.PLAIN, 50));
quit.addActionListener(al);
mainMenu.add(quit);
JLabel jlabel1 = new JLabel("CREDITS");
JLabel jlabel2 = new JLabel("Images:");
JLabel jlabel3 = new JLabel("Developers:");
JLabel space = new JLabel (" ");
JLabel destroyer = new JLabel("http://www.wallhogs.com/in_stock/category/639?page=2");
JLabel aircraftcarrier = new JLabel("https://commons.wikimedia.org/wiki/File:Flugzeugtr%C3%A4ger_Silhouette.svg");
JLabel submarine = new JLabel("http://worldartsme.com/submarine-silhouette-clipart.html#gal_post_108271_submarine-silhouette-clipart-1.jpg");
JLabel patrolboat = new JLabel("https://it.pinterest.com/pin/288934132325552202/");
JLabel raft = new JLabel("http://www.supercoloring.com/silhouettes/rafting");
JLabel waterLink = new JLabel ("https://www.johnweiss.ca/single-post/2016/10/08/The-Water-Element");
JLabel x = new JLabel ("http://www.freeiconspng.com/png-images/x-png");
JLabel name1 = new JLabel("<NAME>");
JLabel name2 = new JLabel("<NAME>");
JLabel name3 = new JLabel("<NAME>");
jlabel1.setFont(new Font("Verdana",1,50));
jlabel2.setFont(new Font("Verdana",1,25));
jlabel3.setFont(new Font("Verdana",1,25));
destroyer.setFont(new Font("Verdana",1,20));
aircraftcarrier.setFont(new Font("Verdana",1,20));
submarine.setFont(new Font("Verdana",1,20));
patrolboat.setFont(new Font("Verdana",1,20));
raft.setFont(new Font("Verdana",1,20));
waterLink.setFont(new Font("Verdana",1,20));
x.setFont(new Font("Verdana",1,20));
name1.setFont(new Font("Verdana",1,20));
name2.setFont(new Font("Verdana",1,20));
name3.setFont(new Font("Verdana",1,20));
credits.add(jlabel1);
credits.add(jlabel2);
credits.add(destroyer);
credits.add(aircraftcarrier);
credits.add(submarine);
credits.add(patrolboat);
credits.add(raft);
credits.add(waterLink);
credits.add(x);
credits.add(space);
credits.add(jlabel3);
credits.add(name1);
credits.add(name2);
credits.add(name3);
credits.add(Box.createRigidArea(new Dimension(0,400)));
credits.add(back2);
name1.setForeground (Color.red);
name2.setForeground (Color.green);
name3.setForeground (Color.magenta);
frame.setVisible(true);
credits.setLayout(new BoxLayout(credits, BoxLayout.Y_AXIS));
}
}
| 8,275 | 0.594617 | 0.577721 | 247 | 31.546558 | 22.627884 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.724696 | false | false | 1 |
008699cf0508da9527c1cef505717d081c133bc3 | 2,989,297,259,800 | 58d7881cbcf75cfa1bb9bf3c43c8931db6b13351 | /src/g_apac/Round_B_APAC_Test_2017/Main3.java | d5ef890fc74597486f98c176dd64d2295581fa18 | [] | no_license | YettaY/mylintcode | https://github.com/YettaY/mylintcode | 4b86c8f7449f4c24bab95268346d0cca00b39675 | be32411d2bcc3bb37efe4d16b2e1f50b58a55aaf | refs/heads/master | "2020-04-12T08:49:58.246000" | "2016-10-10T00:41:59" | "2016-10-10T00:41:59" | 59,836,244 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package g_apac.Round_B_APAC_Test_2017;
import java.io.*;
import java.util.*;
/**
* Created by Administrator on 2016/8/28.
*/
public class Main3 {
static class interval{
private long s;
private long e;
public interval(long s,long e){
this.s=s;
this.e=e;
}
}
public static void main(String[] args) throws IOException {
// BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Administrator\\Desktop\\C-small-attempt3.in"));
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Administrator\\Desktop\\in.txt"));
int t = Integer.valueOf(br.readLine());
BufferedWriter bw = new BufferedWriter(new FileWriter("C:\\Users\\Administrator\\Desktop\\out.txt"));
for (int id = 1; id <= t; id++) {
long ans=0;
String line = br.readLine();
String[] str = line.split(" ");
long n=Long.valueOf(str[0]), l1=Long.valueOf(str[1]), r1=Long.valueOf(str[2]),
a=Long.valueOf(str[3]),b=Long.valueOf(str[4]), c1=Long.valueOf(str[5]),c2=Long.valueOf(str[6]),m=Long.valueOf(str[7]);
List<interval> in=new ArrayList<>();
in.add(new interval(l1,r1));
long x1=l1,y1=r1;
for(int i=1;i<n;i++){
long x=(a*x1 + b*y1 + c1)%m;
long y=(a*y1 + b*x1 + c2)%m;
l1 = Math.min(x,y);
r1 = Math.max(x,y);
x1=x;y1=y;
interval cur=new interval(l1,r1);
in.add(cur);
}
// System.out.println("--------------"+id);
// for(interval e:in){
// System.out.println(e.s+" "+e.e);
// }
// System.out.println();
long min=Integer.MAX_VALUE;
for(int i=0;i<n;i++){
// for(interval e:in){
// System.out.println(e.s+" "+e.e);
// }
List<interval> tmp=new ArrayList<interval>(in);
tmp.remove(i);
// for(interval e:tmp){
// System.out.println(e.s+" "+e.e);
// }
min=Math.min(min, merge(tmp));
}
bw.write("Case #" + id + ": " + min + "\n");
}
br.close();
bw.close();
}
public static long merge(List<interval> intervals) {
long ans=0;
List<interval> r=new ArrayList<>();
if(intervals==null || intervals.size()<2) {
if(intervals.size()==1){
ans=intervals.get(0).e-intervals.get(0).s+1;
return ans;
}
return 0;
}
Collections.sort(intervals,new Comparator<interval>(){
public int compare(interval a, interval b){
return (int)(a.s-b.s);
}
});
interval pre=intervals.get(0);
for(int i=1;i<intervals.size();i++){
interval cur=intervals.get(i);
if(cur.s<=pre.e) {
pre = new interval(pre.s,Math.max(pre.e, cur.e));
}
else{
r.add(pre);
ans+=(pre.e-pre.s+1);
pre=cur;
}
}
ans+=(pre.e-pre.s+1);
r.add(pre);
// for(interval e:r){
// System.out.println(e.s+" "+e.e);
// }
// System.out.println("ans: "+ans);
// System.out.println();
return ans;
}
}
| UTF-8 | Java | 3,607 | java | Main3.java | Java | [
{
"context": "ava.io.*;\r\nimport java.util.*;\r\n/**\r\n * Created by Administrator on 2016/8/28.\r\n */\r\npublic class Main3 {\r\n sta",
"end": 114,
"score": 0.7600961327552795,
"start": 101,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package g_apac.Round_B_APAC_Test_2017;
import java.io.*;
import java.util.*;
/**
* Created by Administrator on 2016/8/28.
*/
public class Main3 {
static class interval{
private long s;
private long e;
public interval(long s,long e){
this.s=s;
this.e=e;
}
}
public static void main(String[] args) throws IOException {
// BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Administrator\\Desktop\\C-small-attempt3.in"));
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Administrator\\Desktop\\in.txt"));
int t = Integer.valueOf(br.readLine());
BufferedWriter bw = new BufferedWriter(new FileWriter("C:\\Users\\Administrator\\Desktop\\out.txt"));
for (int id = 1; id <= t; id++) {
long ans=0;
String line = br.readLine();
String[] str = line.split(" ");
long n=Long.valueOf(str[0]), l1=Long.valueOf(str[1]), r1=Long.valueOf(str[2]),
a=Long.valueOf(str[3]),b=Long.valueOf(str[4]), c1=Long.valueOf(str[5]),c2=Long.valueOf(str[6]),m=Long.valueOf(str[7]);
List<interval> in=new ArrayList<>();
in.add(new interval(l1,r1));
long x1=l1,y1=r1;
for(int i=1;i<n;i++){
long x=(a*x1 + b*y1 + c1)%m;
long y=(a*y1 + b*x1 + c2)%m;
l1 = Math.min(x,y);
r1 = Math.max(x,y);
x1=x;y1=y;
interval cur=new interval(l1,r1);
in.add(cur);
}
// System.out.println("--------------"+id);
// for(interval e:in){
// System.out.println(e.s+" "+e.e);
// }
// System.out.println();
long min=Integer.MAX_VALUE;
for(int i=0;i<n;i++){
// for(interval e:in){
// System.out.println(e.s+" "+e.e);
// }
List<interval> tmp=new ArrayList<interval>(in);
tmp.remove(i);
// for(interval e:tmp){
// System.out.println(e.s+" "+e.e);
// }
min=Math.min(min, merge(tmp));
}
bw.write("Case #" + id + ": " + min + "\n");
}
br.close();
bw.close();
}
public static long merge(List<interval> intervals) {
long ans=0;
List<interval> r=new ArrayList<>();
if(intervals==null || intervals.size()<2) {
if(intervals.size()==1){
ans=intervals.get(0).e-intervals.get(0).s+1;
return ans;
}
return 0;
}
Collections.sort(intervals,new Comparator<interval>(){
public int compare(interval a, interval b){
return (int)(a.s-b.s);
}
});
interval pre=intervals.get(0);
for(int i=1;i<intervals.size();i++){
interval cur=intervals.get(i);
if(cur.s<=pre.e) {
pre = new interval(pre.s,Math.max(pre.e, cur.e));
}
else{
r.add(pre);
ans+=(pre.e-pre.s+1);
pre=cur;
}
}
ans+=(pre.e-pre.s+1);
r.add(pre);
// for(interval e:r){
// System.out.println(e.s+" "+e.e);
// }
// System.out.println("ans: "+ans);
// System.out.println();
return ans;
}
}
| 3,607 | 0.45079 | 0.43471 | 104 | 32.682693 | 25.18824 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.817308 | false | false | 1 |
d5da11b52794be0434ec099aa1d8fd497b532890 | 3,375,844,308,356 | ea268c3ed2fa6801fac5d513b576b10540915021 | /app/src/main/java/com/hasanin/hossam/ro2yacenter/AdminMenu/Subjects/AddSubject.java | cd49c469545ded69b460523951cf53d3c0c0ac46 | [] | no_license | hossamhasanin/Ro2yaCenter | https://github.com/hossamhasanin/Ro2yaCenter | 52d75b55e643456922f5fb15dddbbed664d86935 | f539e4af8d16dfee628795c7b5e79342626b7834 | refs/heads/master | "2021-06-17T02:28:58.558000" | "2021-03-14T15:01:58" | "2021-03-14T15:01:58" | 172,559,475 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hasanin.hossam.ro2yacenter.AdminMenu.Subjects;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.hasanin.hossam.ro2yacenter.AdminMenu.DaysListAdapter;
import com.hasanin.hossam.ro2yacenter.Helper;
import com.hasanin.hossam.ro2yacenter.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
public class AddSubject extends AppCompatActivity {
RecyclerView daysList;
ArrayList<String> days;
TextView getDays;
ArrayList<String> checkedDays;
Context context = this;
Bundle bundle;
String gradeStatus;
Button subjectSave;
EditText subjectName , money , teacherName , time;
CheckBox firstGrade;
CheckBox secondGrade;
CheckBox thirdGrade;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_subject);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_backword_white);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
bundle = getIntent().getExtras();
subjectSave = (Button)findViewById(R.id.subject_save);
subjectName = (EditText)findViewById(R.id.subject_name);
money = (EditText)findViewById(R.id.money);
teacherName = (EditText)findViewById(R.id.teacher_name);
time = (EditText)findViewById(R.id.time);
firstGrade = findViewById(R.id.sub_first_grade);
secondGrade = findViewById(R.id.sub_second_grade);
thirdGrade = findViewById(R.id.sub_third_grade);
gradeStatus = "";
checkedDays = new ArrayList<String>();
if (bundle.getBoolean("editMode")){
Toast.makeText(getApplicationContext() , bundle.getString("subjectId") , Toast.LENGTH_LONG).show();
gradeStatus = bundle.getString("gradeStatus");
if (gradeStatus.contains("1")){
firstGrade.setChecked(true);
}
if (gradeStatus.contains("2")){
secondGrade.setChecked(true);
}
if (gradeStatus.contains("3")) {
thirdGrade.setChecked(true);
}
checkedDays = bundle.getStringArrayList("checkedDays");
subjectName.setText(bundle.getString("subjectName"));
money.setText(bundle.getString("money"));
teacherName.setText(bundle.getString("teacherName"));
time.setText(bundle.getString("time"));
}
// Check if the user is online
// DatabaseReference connectedRef = FirebaseDatabase.getInstance().getReference(".info/connected");
// connectedRef.addValueEventListener(new ValueEventListener() {
// @Override
// public void onDataChange(DataSnapshot snapshot) {
// boolean connected = snapshot.getValue(Boolean.class);
// if (connected) {
// Toast.makeText(getApplicationContext() , "يوجد اتصال بالانترنت" , Toast.LENGTH_LONG).show();
// } else {
// Toast.makeText(getApplicationContext() , "لا يوجد اتصال بالانترنت" , Toast.LENGTH_LONG).show();
// }
// }
//
// @Override
// public void onCancelled(DatabaseError error) {
// System.err.println("Listener was cancelled");
// }
// });
days = new ArrayList<String>();
days.add("السبت");
days.add("الأحد");
days.add("الأثنين");
days.add("الثلاثاء");
days.add("الأربعاء");
days.add("الخميس");
days.add("الجمعة");
getDays = (TextView) findViewById(R.id.days);
getDays.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder popupmess = new AlertDialog.Builder(context);
View poplayout = LayoutInflater.from(context).inflate(R.layout.days_list , null);
popupmess.setView(poplayout);
final AlertDialog ad = popupmess.show();
daysList = (RecyclerView) poplayout.findViewById(R.id.dayss_list);
// if (bundle.getBoolean("editMode")){
// checkedDays = bundle.getStringArrayList("checkedDays");
// }
final DaysListAdapter daysListAdapter = new DaysListAdapter(days, context , checkedDays);
daysList.setAdapter(daysListAdapter);
daysList.setLayoutManager(new GridLayoutManager(getApplicationContext() , 2));
TextView getOut = (TextView) poplayout.findViewById(R.id.get_out);
getOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ad.dismiss();
}
});
ad.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
checkedDays = daysListAdapter.checkedDays;
}
});
}
});
subjectSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String s_name = subjectName.getText().toString();
String t_name = teacherName.getText().toString();
String m = money.getText().toString();
String t = time.getText().toString();
if (fildesCheck(getApplicationContext() , s_name , t_name , m , t , checkedDays)){
if (firstGrade.isChecked()){
if (!gradeStatus.contains("1")){
gradeStatus += "1,";
}
}
if (secondGrade.isChecked()){
if (!gradeStatus.contains("2")) {
gradeStatus += "2,";
}
}
if (thirdGrade.isChecked()){
if (!gradeStatus.contains("3")) {
gradeStatus += "3,";
}
}
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("subjects");
String subjectId = "none";
if (bundle.getBoolean("editMode")){
subjectId = bundle.getString("subjectId");
} else {
subjectId = databaseReference.push().getKey();
}
SubjectModel subject = new SubjectModel(subjectId , s_name , t_name , checkedDays ,m , t , gradeStatus);
databaseReference.child(subjectId).setValue(subject).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
subjectName.setText("");
teacherName.setText("");
money.setText("");
time.setText("");
checkedDays.clear();
Intent intent = new Intent(getApplicationContext() , ShowSubjects.class);
startActivity(intent);
} else {
Toast.makeText(context , " Error => " + task.getException().getMessage() , Toast.LENGTH_LONG).show();
}
}
});
}
}
});
}
public boolean fildesCheck(Context context , String s_name , String t_name , String m , String t , ArrayList<String> checkedDays){
if (s_name.isEmpty()){
Toast.makeText(context , "لا تترك اسم المادة فارغا" , Toast.LENGTH_LONG).show();
return false;
} else if(t_name.isEmpty()) {
Toast.makeText(context , "لا تترك اسم المدرس فارغا" , Toast.LENGTH_LONG).show();
return false;
} else if (m.isEmpty()){
Toast.makeText(context , "لا تترك مقدار الشهرية فارغا" , Toast.LENGTH_LONG).show();
return false;
}else if (t.isEmpty()){
Toast.makeText(context , "لا تترك معاد المادة فارغا" , Toast.LENGTH_LONG).show();
return false;
} else if(checkedDays.size() == 0){
Toast.makeText(context , "لا تترك ايام المادة فارغة" , Toast.LENGTH_LONG).show();
return false;
} else if (!firstGrade.isChecked() && !secondGrade.isChecked() && !thirdGrade.isChecked()){
Snackbar.make(findViewById(android.R.id.content), "مهو انت لازم تختار صف دراسي !", Snackbar.LENGTH_LONG).show();
return false;
} else {
return true;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu , menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.logout){
Helper.logOut(this);
} else if (item.getItemId() == R.id.about_us){
}
return super.onOptionsItemSelected(item);
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
}
| UTF-8 | Java | 11,152 | java | AddSubject.java | Java | [
{
"context": "util.Arrays;\nimport java.util.List;\n\nimport uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;\n\npublic cl",
"end": 1468,
"score": 0.7914760112762451,
"start": 1459,
"tag": "USERNAME",
"value": "chrisjenx"
}
] | null | [] | package com.hasanin.hossam.ro2yacenter.AdminMenu.Subjects;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.hasanin.hossam.ro2yacenter.AdminMenu.DaysListAdapter;
import com.hasanin.hossam.ro2yacenter.Helper;
import com.hasanin.hossam.ro2yacenter.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
public class AddSubject extends AppCompatActivity {
RecyclerView daysList;
ArrayList<String> days;
TextView getDays;
ArrayList<String> checkedDays;
Context context = this;
Bundle bundle;
String gradeStatus;
Button subjectSave;
EditText subjectName , money , teacherName , time;
CheckBox firstGrade;
CheckBox secondGrade;
CheckBox thirdGrade;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_subject);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_backword_white);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
bundle = getIntent().getExtras();
subjectSave = (Button)findViewById(R.id.subject_save);
subjectName = (EditText)findViewById(R.id.subject_name);
money = (EditText)findViewById(R.id.money);
teacherName = (EditText)findViewById(R.id.teacher_name);
time = (EditText)findViewById(R.id.time);
firstGrade = findViewById(R.id.sub_first_grade);
secondGrade = findViewById(R.id.sub_second_grade);
thirdGrade = findViewById(R.id.sub_third_grade);
gradeStatus = "";
checkedDays = new ArrayList<String>();
if (bundle.getBoolean("editMode")){
Toast.makeText(getApplicationContext() , bundle.getString("subjectId") , Toast.LENGTH_LONG).show();
gradeStatus = bundle.getString("gradeStatus");
if (gradeStatus.contains("1")){
firstGrade.setChecked(true);
}
if (gradeStatus.contains("2")){
secondGrade.setChecked(true);
}
if (gradeStatus.contains("3")) {
thirdGrade.setChecked(true);
}
checkedDays = bundle.getStringArrayList("checkedDays");
subjectName.setText(bundle.getString("subjectName"));
money.setText(bundle.getString("money"));
teacherName.setText(bundle.getString("teacherName"));
time.setText(bundle.getString("time"));
}
// Check if the user is online
// DatabaseReference connectedRef = FirebaseDatabase.getInstance().getReference(".info/connected");
// connectedRef.addValueEventListener(new ValueEventListener() {
// @Override
// public void onDataChange(DataSnapshot snapshot) {
// boolean connected = snapshot.getValue(Boolean.class);
// if (connected) {
// Toast.makeText(getApplicationContext() , "يوجد اتصال بالانترنت" , Toast.LENGTH_LONG).show();
// } else {
// Toast.makeText(getApplicationContext() , "لا يوجد اتصال بالانترنت" , Toast.LENGTH_LONG).show();
// }
// }
//
// @Override
// public void onCancelled(DatabaseError error) {
// System.err.println("Listener was cancelled");
// }
// });
days = new ArrayList<String>();
days.add("السبت");
days.add("الأحد");
days.add("الأثنين");
days.add("الثلاثاء");
days.add("الأربعاء");
days.add("الخميس");
days.add("الجمعة");
getDays = (TextView) findViewById(R.id.days);
getDays.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder popupmess = new AlertDialog.Builder(context);
View poplayout = LayoutInflater.from(context).inflate(R.layout.days_list , null);
popupmess.setView(poplayout);
final AlertDialog ad = popupmess.show();
daysList = (RecyclerView) poplayout.findViewById(R.id.dayss_list);
// if (bundle.getBoolean("editMode")){
// checkedDays = bundle.getStringArrayList("checkedDays");
// }
final DaysListAdapter daysListAdapter = new DaysListAdapter(days, context , checkedDays);
daysList.setAdapter(daysListAdapter);
daysList.setLayoutManager(new GridLayoutManager(getApplicationContext() , 2));
TextView getOut = (TextView) poplayout.findViewById(R.id.get_out);
getOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ad.dismiss();
}
});
ad.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
checkedDays = daysListAdapter.checkedDays;
}
});
}
});
subjectSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String s_name = subjectName.getText().toString();
String t_name = teacherName.getText().toString();
String m = money.getText().toString();
String t = time.getText().toString();
if (fildesCheck(getApplicationContext() , s_name , t_name , m , t , checkedDays)){
if (firstGrade.isChecked()){
if (!gradeStatus.contains("1")){
gradeStatus += "1,";
}
}
if (secondGrade.isChecked()){
if (!gradeStatus.contains("2")) {
gradeStatus += "2,";
}
}
if (thirdGrade.isChecked()){
if (!gradeStatus.contains("3")) {
gradeStatus += "3,";
}
}
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("subjects");
String subjectId = "none";
if (bundle.getBoolean("editMode")){
subjectId = bundle.getString("subjectId");
} else {
subjectId = databaseReference.push().getKey();
}
SubjectModel subject = new SubjectModel(subjectId , s_name , t_name , checkedDays ,m , t , gradeStatus);
databaseReference.child(subjectId).setValue(subject).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
subjectName.setText("");
teacherName.setText("");
money.setText("");
time.setText("");
checkedDays.clear();
Intent intent = new Intent(getApplicationContext() , ShowSubjects.class);
startActivity(intent);
} else {
Toast.makeText(context , " Error => " + task.getException().getMessage() , Toast.LENGTH_LONG).show();
}
}
});
}
}
});
}
public boolean fildesCheck(Context context , String s_name , String t_name , String m , String t , ArrayList<String> checkedDays){
if (s_name.isEmpty()){
Toast.makeText(context , "لا تترك اسم المادة فارغا" , Toast.LENGTH_LONG).show();
return false;
} else if(t_name.isEmpty()) {
Toast.makeText(context , "لا تترك اسم المدرس فارغا" , Toast.LENGTH_LONG).show();
return false;
} else if (m.isEmpty()){
Toast.makeText(context , "لا تترك مقدار الشهرية فارغا" , Toast.LENGTH_LONG).show();
return false;
}else if (t.isEmpty()){
Toast.makeText(context , "لا تترك معاد المادة فارغا" , Toast.LENGTH_LONG).show();
return false;
} else if(checkedDays.size() == 0){
Toast.makeText(context , "لا تترك ايام المادة فارغة" , Toast.LENGTH_LONG).show();
return false;
} else if (!firstGrade.isChecked() && !secondGrade.isChecked() && !thirdGrade.isChecked()){
Snackbar.make(findViewById(android.R.id.content), "مهو انت لازم تختار صف دراسي !", Snackbar.LENGTH_LONG).show();
return false;
} else {
return true;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu , menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.logout){
Helper.logOut(this);
} else if (item.getItemId() == R.id.about_us){
}
return super.onOptionsItemSelected(item);
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
}
| 11,152 | 0.581795 | 0.579967 | 265 | 40.290565 | 29.069899 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.732075 | false | false | 1 |
c496d920f22cd45daaad132a371f14f38d4d219d | 7,567,732,414,162 | 84a3122b8c43c8213f6acde107746412efc8c61e | /src/M21CountOpennedLockers.java | 89e52bfad4861c541b3229fbc1a17e30fef397bc | [] | no_license | wjjal/MeetCoder | https://github.com/wjjal/MeetCoder | dd03f9426a52abd37d1b11df193be2fb836cc452 | 91634a730059da0d7f312f57ffe9a05b25d6d0bf | refs/heads/master | "2021-01-20T12:00:28.034000" | "2015-03-31T06:55:05" | "2015-03-31T06:55:05" | 31,939,335 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //Description
//You are standing in a school hallway lined with n closed lockers.
//You then open all n lockers.
//After this, you then close every 2nd locker (so the 2nd, 4th, 6th¡are all closed).
//Then, you go to every third locker and open it
//if it is closed or close it if it is open
//(let¡¯s call this toggling the locker for our discussion).
//You proceed to toggle every ith locker on pass number i.
//So, for example, on pass number 18 ¨C you will toggle every 18th locker.
//After your nth pass in the hallway, in which you toggle only locker number n,
//how many lockers are open?
//
//Input
//The input should be a positive integer n less than 1,000,000,000,000,000,000.
//
//Output
//The output should be the number of openned lockers that in the format of Integer.
//
//Sample Input
//1
//Sample Output
//1
//HINT
//Math
//
//Source
//Easy
public class M21CountOpennedLockers {
public long locks(long n) {
return (long) Math.sqrt(n);
}
}
| WINDOWS-1258 | Java | 984 | java | M21CountOpennedLockers.java | Java | [] | null | [] | //Description
//You are standing in a school hallway lined with n closed lockers.
//You then open all n lockers.
//After this, you then close every 2nd locker (so the 2nd, 4th, 6th¡are all closed).
//Then, you go to every third locker and open it
//if it is closed or close it if it is open
//(let¡¯s call this toggling the locker for our discussion).
//You proceed to toggle every ith locker on pass number i.
//So, for example, on pass number 18 ¨C you will toggle every 18th locker.
//After your nth pass in the hallway, in which you toggle only locker number n,
//how many lockers are open?
//
//Input
//The input should be a positive integer n less than 1,000,000,000,000,000,000.
//
//Output
//The output should be the number of openned lockers that in the format of Integer.
//
//Sample Input
//1
//Sample Output
//1
//HINT
//Math
//
//Source
//Easy
public class M21CountOpennedLockers {
public long locks(long n) {
return (long) Math.sqrt(n);
}
}
| 984 | 0.707865 | 0.6762 | 33 | 28.666666 | 28.94788 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.484848 | false | false | 1 |
222340411cb4abb57881d749a3068b61ce6efc6a | 7,567,732,411,156 | 0c05d1980b2c01585a7a916ca51141c2dd0aad8c | /src/test/java/com/microsoft/samples/subpackage/CustomException.java | 8717af6bf54c73ca9d56c0113ce092026dcc0470 | [
"MIT"
] | permissive | docascode/docfx-doclet | https://github.com/docascode/docfx-doclet | a3cda0685add9a469689f622ad044740c4db1bef | 95811c45fa8b1848bd7e795b07d26058e5dca379 | refs/heads/dev | "2021-12-19T02:09:25.925000" | "2021-08-06T07:28:49" | "2021-08-06T07:28:49" | 159,644,512 | 13 | 8 | MIT | false | "2021-12-09T20:45:04" | "2018-11-29T09:55:52" | "2021-08-06T07:28:52" | "2021-12-09T20:45:02" | 814 | 8 | 4 | 13 | Java | false | false | package com.microsoft.samples.subpackage;
public class CustomException extends Exception {
public CustomException(String message) {
super(message);
}
/**
* We need to have such method that throw exception declared in the same class
*
* @throws CustomException with reason message
*/
public void makeSomething() throws CustomException {
throw new CustomException("It happened!");
}
private class PrivateException {
private String message;
}
}
| UTF-8 | Java | 539 | java | CustomException.java | Java | [] | null | [] | package com.microsoft.samples.subpackage;
public class CustomException extends Exception {
public CustomException(String message) {
super(message);
}
/**
* We need to have such method that throw exception declared in the same class
*
* @throws CustomException with reason message
*/
public void makeSomething() throws CustomException {
throw new CustomException("It happened!");
}
private class PrivateException {
private String message;
}
}
| 539 | 0.647495 | 0.647495 | 21 | 23.666666 | 23.919176 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | false | false | 1 |
0e6017750a9f0029d0555356ffeee6398352f040 | 11,673,721,143,890 | 05bf03b207fddd97df0a48d26b999216c6b23201 | /app/eu/factorx/awac/dto/awac/get/QuestionSetDTO.java | fad56439f4bfe6e4cc519cc311f5bb20863de7a8 | [] | no_license | Factor-X/awac | https://github.com/Factor-X/awac | f088f24301c9828772ed681106679a9a8864d1ea | b9c31390b5b9bcbf9b49492f7a02a9430dd79f8f | refs/heads/master | "2021-05-04T14:07:01.605000" | "2015-04-01T08:31:25" | "2015-04-01T08:31:25" | 20,883,086 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eu.factorx.awac.dto.awac.get;
import java.util.List;
import eu.factorx.awac.dto.DTO;
import eu.factorx.awac.dto.myrmex.get.PersonDTO;
public class QuestionSetDTO extends DTO {
private String code;
private Boolean repetitionAllowed;
private PersonDTO datalocker;
private PersonDTO dataValidator;
private VerificationDTO verification;
private List<QuestionSetDTO> children;
private List<QuestionDTO> questions;
public QuestionSetDTO() {
}
public QuestionSetDTO(String code, Boolean repetitionAllowed, List<QuestionSetDTO> children, List<QuestionDTO> questions) {
this.code = code;
this.repetitionAllowed = repetitionAllowed;
this.children = children;
this.questions = questions;
}
public VerificationDTO getVerification() {
return verification;
}
public void setVerification(VerificationDTO verification) {
this.verification = verification;
}
public PersonDTO getDatalocker() {
return datalocker;
}
public void setDatalocker(PersonDTO datalocker) {
this.datalocker = datalocker;
}
public PersonDTO getDataValidator() {
return dataValidator;
}
public void setDataValidator(PersonDTO dataValidator) {
this.dataValidator = dataValidator;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Boolean getRepetitionAllowed() {
return repetitionAllowed;
}
public void setRepetitionAllowed(Boolean repetitionAllowed) {
this.repetitionAllowed = repetitionAllowed;
}
public List<QuestionSetDTO> getChildren() {
return children;
}
public void setChildren(List<QuestionSetDTO> children) {
this.children = children;
}
public List<QuestionDTO> getQuestions() {
return questions;
}
public void setQuestions(List<QuestionDTO> questions) {
this.questions = questions;
}
@Override
public String toString() {
return "QuestionSetDTO [code=" + code + ", repetitionAllowed=" + repetitionAllowed + ", children=" + children + ", questions="
+ questions + "]";
}
}
| UTF-8 | Java | 2,094 | java | QuestionSetDTO.java | Java | [] | null | [] | package eu.factorx.awac.dto.awac.get;
import java.util.List;
import eu.factorx.awac.dto.DTO;
import eu.factorx.awac.dto.myrmex.get.PersonDTO;
public class QuestionSetDTO extends DTO {
private String code;
private Boolean repetitionAllowed;
private PersonDTO datalocker;
private PersonDTO dataValidator;
private VerificationDTO verification;
private List<QuestionSetDTO> children;
private List<QuestionDTO> questions;
public QuestionSetDTO() {
}
public QuestionSetDTO(String code, Boolean repetitionAllowed, List<QuestionSetDTO> children, List<QuestionDTO> questions) {
this.code = code;
this.repetitionAllowed = repetitionAllowed;
this.children = children;
this.questions = questions;
}
public VerificationDTO getVerification() {
return verification;
}
public void setVerification(VerificationDTO verification) {
this.verification = verification;
}
public PersonDTO getDatalocker() {
return datalocker;
}
public void setDatalocker(PersonDTO datalocker) {
this.datalocker = datalocker;
}
public PersonDTO getDataValidator() {
return dataValidator;
}
public void setDataValidator(PersonDTO dataValidator) {
this.dataValidator = dataValidator;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Boolean getRepetitionAllowed() {
return repetitionAllowed;
}
public void setRepetitionAllowed(Boolean repetitionAllowed) {
this.repetitionAllowed = repetitionAllowed;
}
public List<QuestionSetDTO> getChildren() {
return children;
}
public void setChildren(List<QuestionSetDTO> children) {
this.children = children;
}
public List<QuestionDTO> getQuestions() {
return questions;
}
public void setQuestions(List<QuestionDTO> questions) {
this.questions = questions;
}
@Override
public String toString() {
return "QuestionSetDTO [code=" + code + ", repetitionAllowed=" + repetitionAllowed + ", children=" + children + ", questions="
+ questions + "]";
}
}
| 2,094 | 0.72063 | 0.72063 | 96 | 20.8125 | 24.494604 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.958333 | false | false | 1 |
b2f6937bbb3269183cbfec1dd3508b571bad5d08 | 22,076,131,933,722 | 95041aa0cd64e0c53d6f2965982f27fb32cf83c6 | /GansoSonicoJPA/src/co/com/ganso/entities/Persona.java | 3c6fa6ba1f2a41f50b20b5802cc5de77b10f7c59 | [] | no_license | WiliamGonzalezCobo/FuklAerolinea | https://github.com/WiliamGonzalezCobo/FuklAerolinea | 07b12e98e5d414f1e049cbe2c6f142ec50b81187 | 12c0f496250f9f9324a7743fc6fac0e0f190706f | refs/heads/master | "2021-05-03T13:33:17.346000" | "2016-11-17T05:12:07" | "2016-11-17T05:12:07" | 65,022,488 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package co.com.ganso.entities;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* The persistent class for the TB_PERSONA database table.
*
*/
@Entity
@Table(name="TB_PERSONA")
@NamedQuery(name="Persona.findAll", query="SELECT p FROM Persona p")
public class Persona extends EntityCore implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="N_IDPERSONA")
private Integer nIdpersona;
@Temporal(TemporalType.DATE)
@Column(name="D_FECHANACIMIENTO")
private Date dFechanacimiento;
@Column(name="N_CATEGORIA")
private Integer nCategoria;
@Column(name="T_APELLIDOS")
private String tApellidos;
@Column(name="T_DIRECCION")
private String tDireccion;
@Column(name="T_NOMBRES")
private String tNombres;
@Column(name="T_PASAPORTE")
private String tPasaporte;
@Column(name="T_TELEFONO")
private String tTelefono;
public Persona() {
}
public Integer getNIdpersona() {
return this.nIdpersona;
}
public void setNIdpersona(Integer nIdpersona) {
this.nIdpersona = nIdpersona;
}
public Date getDFechanacimiento() {
return this.dFechanacimiento;
}
public void setDFechanacimiento(Date dFechanacimiento) {
this.dFechanacimiento = dFechanacimiento;
}
public Integer getNCategoria() {
return this.nCategoria;
}
public void setNCategoria(Integer nCategoria) {
this.nCategoria = nCategoria;
}
public String getTApellidos() {
return this.tApellidos;
}
public void setTApellidos(String tApellidos) {
this.tApellidos = tApellidos;
}
public String getTDireccion() {
return this.tDireccion;
}
public void setTDireccion(String tDireccion) {
this.tDireccion = tDireccion;
}
public String getTNombres() {
return this.tNombres;
}
public void setTNombres(String tNombres) {
this.tNombres = tNombres;
}
public String getTPasaporte() {
return this.tPasaporte;
}
public void setTPasaporte(String tPasaporte) {
this.tPasaporte = tPasaporte;
}
public String getTTelefono() {
return this.tTelefono;
}
public void setTTelefono(String tTelefono) {
this.tTelefono = tTelefono;
}
} | UTF-8 | Java | 2,369 | java | Persona.java | Java | [] | null | [] | package co.com.ganso.entities;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* The persistent class for the TB_PERSONA database table.
*
*/
@Entity
@Table(name="TB_PERSONA")
@NamedQuery(name="Persona.findAll", query="SELECT p FROM Persona p")
public class Persona extends EntityCore implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="N_IDPERSONA")
private Integer nIdpersona;
@Temporal(TemporalType.DATE)
@Column(name="D_FECHANACIMIENTO")
private Date dFechanacimiento;
@Column(name="N_CATEGORIA")
private Integer nCategoria;
@Column(name="T_APELLIDOS")
private String tApellidos;
@Column(name="T_DIRECCION")
private String tDireccion;
@Column(name="T_NOMBRES")
private String tNombres;
@Column(name="T_PASAPORTE")
private String tPasaporte;
@Column(name="T_TELEFONO")
private String tTelefono;
public Persona() {
}
public Integer getNIdpersona() {
return this.nIdpersona;
}
public void setNIdpersona(Integer nIdpersona) {
this.nIdpersona = nIdpersona;
}
public Date getDFechanacimiento() {
return this.dFechanacimiento;
}
public void setDFechanacimiento(Date dFechanacimiento) {
this.dFechanacimiento = dFechanacimiento;
}
public Integer getNCategoria() {
return this.nCategoria;
}
public void setNCategoria(Integer nCategoria) {
this.nCategoria = nCategoria;
}
public String getTApellidos() {
return this.tApellidos;
}
public void setTApellidos(String tApellidos) {
this.tApellidos = tApellidos;
}
public String getTDireccion() {
return this.tDireccion;
}
public void setTDireccion(String tDireccion) {
this.tDireccion = tDireccion;
}
public String getTNombres() {
return this.tNombres;
}
public void setTNombres(String tNombres) {
this.tNombres = tNombres;
}
public String getTPasaporte() {
return this.tPasaporte;
}
public void setTPasaporte(String tPasaporte) {
this.tPasaporte = tPasaporte;
}
public String getTTelefono() {
return this.tTelefono;
}
public void setTTelefono(String tTelefono) {
this.tTelefono = tTelefono;
}
} | 2,369 | 0.75306 | 0.752638 | 119 | 18.915966 | 17.714153 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.02521 | false | false | 1 |
f14d222d8c18f50b03807a29dd3dee1ae8c2220b | 22,076,131,934,853 | 6235d3b43a49a6d7fea4344300874e8e6853f020 | /src/main/java/com/ss/android/ugc/aweme/utils/z.java | a257eadd8ae5f6fe188977fbe689428e2f377750 | [] | no_license | junges521/src_awe | https://github.com/junges521/src_awe | a12bcfeb6c62bd55afba7147b83f4e3df8797019 | cff4a5e230f3346f493df79744e6f2a6f20a47e2 | refs/heads/master | "2020-07-13T19:37:36.253000" | "2019-08-29T10:47:51" | "2019-08-29T10:47:51" | 205,140,726 | 0 | 0 | null | true | "2019-08-29T10:41:58" | "2019-08-29T10:41:58" | "2019-08-29T08:24:29" | "2019-08-23T11:31:27" | 177,015 | 0 | 0 | 0 | null | false | false | package com.ss.android.ugc.aweme.utils;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import java.util.concurrent.Callable;
public final /* synthetic */ class z implements Callable {
/* renamed from: a reason: collision with root package name */
public static ChangeQuickRedirect f75973a;
/* renamed from: b reason: collision with root package name */
private final Runnable f75974b;
/* renamed from: c reason: collision with root package name */
private final String f75975c;
z(Runnable runnable, String str) {
this.f75974b = runnable;
this.f75975c = str;
}
public final Object call() {
if (PatchProxy.isSupport(new Object[0], this, f75973a, false, 88034, new Class[0], Object.class)) {
return PatchProxy.accessDispatch(new Object[0], this, f75973a, false, 88034, new Class[0], Object.class);
}
Runnable runnable = this.f75974b;
if (runnable == null) {
return null;
}
runnable.run();
return null;
}
}
| UTF-8 | Java | 1,087 | java | z.java | Java | [] | null | [] | package com.ss.android.ugc.aweme.utils;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import java.util.concurrent.Callable;
public final /* synthetic */ class z implements Callable {
/* renamed from: a reason: collision with root package name */
public static ChangeQuickRedirect f75973a;
/* renamed from: b reason: collision with root package name */
private final Runnable f75974b;
/* renamed from: c reason: collision with root package name */
private final String f75975c;
z(Runnable runnable, String str) {
this.f75974b = runnable;
this.f75975c = str;
}
public final Object call() {
if (PatchProxy.isSupport(new Object[0], this, f75973a, false, 88034, new Class[0], Object.class)) {
return PatchProxy.accessDispatch(new Object[0], this, f75973a, false, 88034, new Class[0], Object.class);
}
Runnable runnable = this.f75974b;
if (runnable == null) {
return null;
}
runnable.run();
return null;
}
}
| 1,087 | 0.656854 | 0.607176 | 34 | 30.970589 | 29.075445 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.794118 | false | false | 1 |
2532bc1a11b749c373fb3508a4589392f024ab32 | 20,701,742,410,869 | 5923b0d035b7bafd6de650ceb7a67f25ba79eed9 | /src/main/java/cn/jianchen/com/trade/api/coupon/service/UserCouponService.java | 2a7ae70331036670c40ba847a4e1516e8f9329b5 | [] | no_license | cpwk/school-trade-api | https://github.com/cpwk/school-trade-api | 0e825b8288723abcebb0b07799540477ed9ccd55 | 4129e4270f7fbb6eb13fa3f09be6b2b548b6c6be | refs/heads/master | "2023-02-25T03:30:51.461000" | "2020-08-05T06:29:44" | "2020-08-05T06:29:44" | 299,173,444 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.jianchen.com.trade.api.coupon.service;
import cn.jianchen.com.trade.api.coupon.model.UserCoupon;
import cn.jianchen.com.trade.api.coupon.qo.UserCouponQo;
import cn.jianchen.com.trade.api.coupon.repository.UserCouponRepository;
import cn.jianchen.com.trade.api.user.model.User;
import cn.jianchen.com.trade.api.user.service.IUserService;
import cn.jianchen.com.trade.common.context.Contexts;
import cn.jianchen.com.trade.common.exception.ArgumentServiceException;
import cn.jianchen.com.trade.common.exception.ServiceException;
import cn.jianchen.com.trade.common.mail.MailHelper;
import cn.jianchen.com.trade.common.mail.MailService;
import cn.jianchen.com.trade.common.task.ApiTask;
import cn.jianchen.com.trade.common.task.TaskService;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.jianchen.com.trade.common.entity.Constants.*;
import static cn.jianchen.com.trade.common.exception.ErrorCode.ERR_DATA_NOT_FOUND;
/**
* 创建人:chenpeng
* 创建时间:2019-11-01 10:05
**/
@Service
public class UserCouponService implements IUserCouponService {
@Autowired
private UserCouponRepository userCouponRepository;
@Autowired
private TaskService taskService;
@Autowired
private CouponService couponService;
@Autowired
private IUserService userService;
@Autowired
private MailService mailService;
public UserCoupon getById(Integer userCouponId) throws ServiceException {
UserCoupon userCoupon = userCouponRepository.findById(userCouponId).orElse(null);
if (userCoupon == null) {
throw new ServiceException(ERR_DATA_NOT_FOUND);
}
return userCoupon;
}
@Override
public void save(UserCoupon userCoupon) throws ServiceException {
UserCoupon exist = userCouponRepository.findByCouponId(userCoupon.getCouponId());
if (exist != null) {
throw new ArgumentServiceException("已经领取过此优惠券");
}
userCoupon.setUserId(Contexts.requestUserId());
userCoupon.setGetAt(System.currentTimeMillis());
userCoupon.setExpirAt((couponService.getById(userCoupon.getCouponId()).getDuration()) * 86400000 + System.currentTimeMillis());
userCouponRepository.save(userCoupon);
}
@Override
public void remove(Integer id) throws Exception {
UserCoupon userCoupon = getById(id);
userCoupon.setStatus(EXPIRED);
userCouponRepository.save(userCoupon);
}
@Override
public void used(Integer id) throws Exception {
UserCoupon userCoupon = getById(id);
userCoupon.setStatus(USER_ED);
userCouponRepository.save(userCoupon);
}
@Override
public UserCoupon coupon(Integer id) {
return getById(id);
}
@Override
public List<UserCoupon> userCoupons(UserCouponQo qo) {
return userCouponRepository.findAll(qo);
}
@Override
public void checkCoupon() throws Exception {
long expiredAt = System.currentTimeMillis() + DateUtils.MILLIS_PER_DAY;
List<UserCoupon> couponUsers = userCouponRepository.findByStatusAndExpirAtBefore(WAIT_USER, expiredAt);
Map<Integer, List<UserCoupon>> map = new HashMap<>(couponUsers.size());
for (UserCoupon couponUser : couponUsers) {
Integer userId = couponUser.getUserId();
if (map.containsKey(userId)) {
List<UserCoupon> list = map.get(userId);
list.add(couponUser);
map.put(userId, list);
} else {
List<UserCoupon> list = new ArrayList<>(1);
list.add(couponUser);
map.put(userId, list);
}
}
List<Integer> ids = new ArrayList<>(map.keySet().size());
for (Integer userId : map.keySet()) {
ids.add(userId);
}
List<User> users = userService.findByIdIn(ids);
for (User user : users) {
List<UserCoupon> list = map.get(user.getId());
taskService.addTask(new CouponEmail(user, list.size()));
}
}
private class CouponEmail extends ApiTask {
private User user;
private int count;
public CouponEmail(User user, int count) {
super();
this.user = user;
this.count = count;
}
@Override
protected void doApiWork() {
MailHelper.MailInfo mail = new MailHelper.MailInfo();
mail.setToAddress(user.getEmail());
mail.setSubject("剑陈商城");
mail.setContent("尊敬的用户:您有 " + count + " 张优惠券即将过期,请尽快使用!");
mailService.send(mail);
}
}
} | UTF-8 | Java | 4,949 | java | UserCouponService.java | Java | [
{
"context": "ception.ErrorCode.ERR_DATA_NOT_FOUND;\n\n/**\n * 创建人:chenpeng\n * 创建时间:2019-11-01 10:05\n **/\n\n@Service\npublic cl",
"end": 1176,
"score": 0.9995025396347046,
"start": 1168,
"tag": "USERNAME",
"value": "chenpeng"
}
] | null | [] | package cn.jianchen.com.trade.api.coupon.service;
import cn.jianchen.com.trade.api.coupon.model.UserCoupon;
import cn.jianchen.com.trade.api.coupon.qo.UserCouponQo;
import cn.jianchen.com.trade.api.coupon.repository.UserCouponRepository;
import cn.jianchen.com.trade.api.user.model.User;
import cn.jianchen.com.trade.api.user.service.IUserService;
import cn.jianchen.com.trade.common.context.Contexts;
import cn.jianchen.com.trade.common.exception.ArgumentServiceException;
import cn.jianchen.com.trade.common.exception.ServiceException;
import cn.jianchen.com.trade.common.mail.MailHelper;
import cn.jianchen.com.trade.common.mail.MailService;
import cn.jianchen.com.trade.common.task.ApiTask;
import cn.jianchen.com.trade.common.task.TaskService;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.jianchen.com.trade.common.entity.Constants.*;
import static cn.jianchen.com.trade.common.exception.ErrorCode.ERR_DATA_NOT_FOUND;
/**
* 创建人:chenpeng
* 创建时间:2019-11-01 10:05
**/
@Service
public class UserCouponService implements IUserCouponService {
@Autowired
private UserCouponRepository userCouponRepository;
@Autowired
private TaskService taskService;
@Autowired
private CouponService couponService;
@Autowired
private IUserService userService;
@Autowired
private MailService mailService;
public UserCoupon getById(Integer userCouponId) throws ServiceException {
UserCoupon userCoupon = userCouponRepository.findById(userCouponId).orElse(null);
if (userCoupon == null) {
throw new ServiceException(ERR_DATA_NOT_FOUND);
}
return userCoupon;
}
@Override
public void save(UserCoupon userCoupon) throws ServiceException {
UserCoupon exist = userCouponRepository.findByCouponId(userCoupon.getCouponId());
if (exist != null) {
throw new ArgumentServiceException("已经领取过此优惠券");
}
userCoupon.setUserId(Contexts.requestUserId());
userCoupon.setGetAt(System.currentTimeMillis());
userCoupon.setExpirAt((couponService.getById(userCoupon.getCouponId()).getDuration()) * 86400000 + System.currentTimeMillis());
userCouponRepository.save(userCoupon);
}
@Override
public void remove(Integer id) throws Exception {
UserCoupon userCoupon = getById(id);
userCoupon.setStatus(EXPIRED);
userCouponRepository.save(userCoupon);
}
@Override
public void used(Integer id) throws Exception {
UserCoupon userCoupon = getById(id);
userCoupon.setStatus(USER_ED);
userCouponRepository.save(userCoupon);
}
@Override
public UserCoupon coupon(Integer id) {
return getById(id);
}
@Override
public List<UserCoupon> userCoupons(UserCouponQo qo) {
return userCouponRepository.findAll(qo);
}
@Override
public void checkCoupon() throws Exception {
long expiredAt = System.currentTimeMillis() + DateUtils.MILLIS_PER_DAY;
List<UserCoupon> couponUsers = userCouponRepository.findByStatusAndExpirAtBefore(WAIT_USER, expiredAt);
Map<Integer, List<UserCoupon>> map = new HashMap<>(couponUsers.size());
for (UserCoupon couponUser : couponUsers) {
Integer userId = couponUser.getUserId();
if (map.containsKey(userId)) {
List<UserCoupon> list = map.get(userId);
list.add(couponUser);
map.put(userId, list);
} else {
List<UserCoupon> list = new ArrayList<>(1);
list.add(couponUser);
map.put(userId, list);
}
}
List<Integer> ids = new ArrayList<>(map.keySet().size());
for (Integer userId : map.keySet()) {
ids.add(userId);
}
List<User> users = userService.findByIdIn(ids);
for (User user : users) {
List<UserCoupon> list = map.get(user.getId());
taskService.addTask(new CouponEmail(user, list.size()));
}
}
private class CouponEmail extends ApiTask {
private User user;
private int count;
public CouponEmail(User user, int count) {
super();
this.user = user;
this.count = count;
}
@Override
protected void doApiWork() {
MailHelper.MailInfo mail = new MailHelper.MailInfo();
mail.setToAddress(user.getEmail());
mail.setSubject("剑陈商城");
mail.setContent("尊敬的用户:您有 " + count + " 张优惠券即将过期,请尽快使用!");
mailService.send(mail);
}
}
} | 4,949 | 0.670709 | 0.666187 | 161 | 29.223602 | 27.180094 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.465839 | false | false | 1 |
41d02b5af4606cd7563c7d9851d17fc4118512ce | 5,875,515,285,064 | ef643b0799aeb431061f0f1007e305f53e6ff1c4 | /springmvc02/src/main/java/controller/HelloController.java | 8837225f0baabab3c2db1f56e0163301fc51a13c | [] | no_license | tongcheng97/Spring | https://github.com/tongcheng97/Spring | 05fa280b84fc0df542eaa848a6fef694b23e09e1 | 7240b1f25da2d6e53a16e8a109fe4cc6e2ade7e1 | refs/heads/master | "2022-12-23T03:42:49.762000" | "2019-06-13T05:44:47" | "2019-06-13T05:44:47" | 189,348,642 | 0 | 0 | null | false | "2022-12-15T23:53:53" | "2019-05-30T05:03:46" | "2019-06-13T05:45:05" | "2022-12-15T23:53:51" | 190 | 0 | 0 | 14 | Java | false | false | package controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/*
* 如何写一个处理器:
* 1.不用实现Controller接口
* 2.可以在处理器类中添加多个方法,每个方法处理一种类型的请求
* 3.方法名不做要求,返回类型可以是ModelAndView,也可以是String
* 4.使用@Controller,将该处理器纳入容器进行管理
* 5.使用@RequestMapping,告诉前端控制器(DispatcherServlet),
* 请求路径与处理器的方法对应关系(spring配置文件不用配置HandlerMapping了)
*
*/
@Controller
@RequestMapping("/")
public class HelloController {
@RequestMapping("/hello.do")
public String hello() {
System.out.println("hello()");
return "hello";
}
@RequestMapping("/toLogin.do")
public String toLoogin() {
System.out.println("toLogin()");
return "login";
}
@RequestMapping("/login.do")
public String loogin() {
System.out.println("login()");
return "logining";
}
}
| GB18030 | Java | 1,038 | java | HelloController.java | Java | [] | null | [] | package controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/*
* 如何写一个处理器:
* 1.不用实现Controller接口
* 2.可以在处理器类中添加多个方法,每个方法处理一种类型的请求
* 3.方法名不做要求,返回类型可以是ModelAndView,也可以是String
* 4.使用@Controller,将该处理器纳入容器进行管理
* 5.使用@RequestMapping,告诉前端控制器(DispatcherServlet),
* 请求路径与处理器的方法对应关系(spring配置文件不用配置HandlerMapping了)
*
*/
@Controller
@RequestMapping("/")
public class HelloController {
@RequestMapping("/hello.do")
public String hello() {
System.out.println("hello()");
return "hello";
}
@RequestMapping("/toLogin.do")
public String toLoogin() {
System.out.println("toLogin()");
return "login";
}
@RequestMapping("/login.do")
public String loogin() {
System.out.println("login()");
return "logining";
}
}
| 1,038 | 0.731343 | 0.725124 | 37 | 20.729731 | 16.899782 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.891892 | false | false | 1 |
808a74fa75b506f50e613ba90210427ba5181f62 | 28,286,654,647,130 | 8f061c665d995ade4f6d5011c83c29f64e66a982 | /pokerweb/src/java/com/pokerweb/ServerHoldem/WatchUserOnline.java | f554c21e23cbbbbf9609f3fcedee9cd140ccfb72 | [] | no_license | dramm/pocker-rums-web | https://github.com/dramm/pocker-rums-web | 56f434d3548a71ecd2e20326e6602416f50b57d1 | 8bf45bbab4b99389ac75c998bf8d848a3cabb3da | refs/heads/master | "2016-09-09T19:10:56.700000" | "2015-08-17T08:51:18" | "2015-08-17T08:51:18" | 32,262,469 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pokerweb.ServerHoldem;
import java.util.TimerTask;
/**
*
* @author vadim
*/
public class WatchUserOnline extends TimerTask {
private UserTable user;
@Override
public void run() {
long lastUserOnline = user.getLastUserOnline();
long CurrentTime = System.currentTimeMillis();
if((CurrentTime - lastUserOnline) > 2 * 1000 ){
this.SendServerUserMoved((CurrentTime - lastUserOnline));
this.user.setUserSit(false);
((TimerTask)this).cancel();
}
}
public void setUser(UserTable user) {
this.user = user;
}
public void SendServerUserMoved(long TimeMillils){
TableStatus.GetInstance().UserMoved(user.getIdUser(), user.getIdTable(), TimeMillils,user.getPositionTable());
}
}
| UTF-8 | Java | 1,036 | java | WatchUserOnline.java | Java | [
{
"context": "import java.util.TimerTask;\r\n\r\n/**\r\n *\r\n * @author vadim\r\n */\r\npublic class WatchUserOnline extends TimerT",
"end": 286,
"score": 0.9992282390594482,
"start": 281,
"tag": "USERNAME",
"value": "vadim"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pokerweb.ServerHoldem;
import java.util.TimerTask;
/**
*
* @author vadim
*/
public class WatchUserOnline extends TimerTask {
private UserTable user;
@Override
public void run() {
long lastUserOnline = user.getLastUserOnline();
long CurrentTime = System.currentTimeMillis();
if((CurrentTime - lastUserOnline) > 2 * 1000 ){
this.SendServerUserMoved((CurrentTime - lastUserOnline));
this.user.setUserSit(false);
((TimerTask)this).cancel();
}
}
public void setUser(UserTable user) {
this.user = user;
}
public void SendServerUserMoved(long TimeMillils){
TableStatus.GetInstance().UserMoved(user.getIdUser(), user.getIdTable(), TimeMillils,user.getPositionTable());
}
}
| 1,036 | 0.635135 | 0.630309 | 37 | 26 | 27.569078 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.432432 | false | false | 1 |
3cb17ad54aef9290541ca930b24b2f27ca7aadf3 | 14,766,097,584,340 | 855b4041b6a7928988a41a5f3f7e7c7ae39565e4 | /hk-core/src/main/java/com/hk/svr/pub/rowmapper/RespLabaMapper.java | 25565af1682636fb69c724d3f7f850895a310c54 | [] | no_license | mestatrit/newbyakwei | https://github.com/mestatrit/newbyakwei | 60dca96c4c21ae5fcf6477d4627a0eac0f76df35 | ea9a112ac6fcbc2a51dbdc79f417a1d918aa4067 | refs/heads/master | "2021-01-10T06:29:50.466000" | "2013-03-07T08:09:58" | "2013-03-07T08:09:58" | 36,559,185 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hk.svr.pub.rowmapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.hk.bean.RespLaba;
import com.hk.frame.dao.rowmapper.HkRowMapper;
public class RespLabaMapper extends HkRowMapper<RespLaba> {
@Override
public Class<RespLaba> getMapperClass() {
return RespLaba.class;
}
public RespLaba mapRow(ResultSet rs, int rowNum) throws SQLException {
RespLaba o = new RespLaba();
o.setLabaId(rs.getLong("labaid"));
o.setRespcount(rs.getInt("respcount"));
o.setUptime(rs.getTimestamp("uptime"));
o.setHot(rs.getInt("hot"));
return o;
}
} | UTF-8 | Java | 603 | java | RespLabaMapper.java | Java | [] | null | [] | package com.hk.svr.pub.rowmapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.hk.bean.RespLaba;
import com.hk.frame.dao.rowmapper.HkRowMapper;
public class RespLabaMapper extends HkRowMapper<RespLaba> {
@Override
public Class<RespLaba> getMapperClass() {
return RespLaba.class;
}
public RespLaba mapRow(ResultSet rs, int rowNum) throws SQLException {
RespLaba o = new RespLaba();
o.setLabaId(rs.getLong("labaid"));
o.setRespcount(rs.getInt("respcount"));
o.setUptime(rs.getTimestamp("uptime"));
o.setHot(rs.getInt("hot"));
return o;
}
} | 603 | 0.721393 | 0.721393 | 22 | 25.5 | 19.876322 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.454545 | false | false | 1 |
b0e810193784b7ffebc0e969d5acd44c7dcc4901 | 17,489,106,870,147 | fdcf2fff0a7050092ab3fb0e6d4802bd7bdaef4a | /ParkingLot/Status.java | 264cbeb321c9541dbb367458eb0cfd27a03f4865 | [] | no_license | suasad/ObjectOrientedProgramming | https://github.com/suasad/ObjectOrientedProgramming | 00b18ba613495af8dfaa6324c2867fa7604a1ffa | 9e6637c46ad86e5b461eb7893cf2b9c81a0cfb68 | refs/heads/master | "2022-04-28T12:11:45.162000" | "2020-04-25T22:07:54" | "2020-04-25T22:07:54" | 225,169,050 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public enum Status {
AVAILABLE,
NOTAVAILABLE
}
| UTF-8 | Java | 51 | java | Status.java | Java | [] | null | [] |
public enum Status {
AVAILABLE,
NOTAVAILABLE
}
| 51 | 0.72549 | 0.72549 | 4 | 11.25 | 6.796139 | 20 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 1 |
3752c129ef7b9619d6652a49f920ba3da5d3a924 | 28,561,532,558,551 | f6adfce21fa6ad1b1a26ede927ab9a59bc6ebcef | /src/main/java/com/hwq/fundament/DynamicProxy/HelloService.java | b21305569cc1ee98811905b69d9d1b11ae454679 | [
"Apache-2.0"
] | permissive | Evil-king/Fundament | https://github.com/Evil-king/Fundament | 1a992e465d857975d0f90f0cee4f1e39137d1bd4 | fed065ae8dde740f008d3f1c97f9ad63f0f539d1 | refs/heads/master | "2022-10-31T22:05:58.938000" | "2022-10-21T12:37:50" | "2022-10-21T12:37:50" | 154,928,494 | 1 | 0 | Apache-2.0 | false | "2022-06-17T02:00:46" | "2018-10-27T05:14:02" | "2022-01-08T15:21:17" | "2022-06-17T02:00:45" | 10,795 | 0 | 0 | 2 | Java | false | false | package com.hwq.fundament.DynamicProxy;
public interface HelloService {
void sayHello(String name);
}
| UTF-8 | Java | 108 | java | HelloService.java | Java | [] | null | [] | package com.hwq.fundament.DynamicProxy;
public interface HelloService {
void sayHello(String name);
}
| 108 | 0.768519 | 0.768519 | 6 | 17 | 16.881943 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 1 |
72b074e11d91525c6515e88f8e53c170fdf34065 | 13,262,859,015,034 | f14a10929eaf53b9987e04c18b8a30249fbfc644 | /src/bank/TransactionTest.java | 0274a2b87d8ff9559dbcb460b3fe46c8a2b40643 | [] | no_license | chq8888/ProjA | https://github.com/chq8888/ProjA | 5d6809e17108870d5bfc2f10d725b855eb5dc4aa | 02dd7e3d0ecde60fa39de2319338ef2ce5267a03 | refs/heads/master | "2020-05-23T10:17:51.743000" | "2017-01-30T11:41:03" | "2017-01-30T11:41:03" | 80,416,009 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bank;
import org.junit.Assert;
import org.junit.Test;
/**
* Testklass för Transaction.
*
* @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)
*
*/
public class TransactionTest {
/**
* Testmetod för getAccount()
*/
@Test
public void testGetAccountId() {
Transaction t = new Transaction(1002, "UT", 0, 0);
Assert.assertEquals(t.getAccountId(), 1002);
}
/**
* Testmetod för setAccountId()
*/
@Test
public void testSetAccountId() {
Transaction t = new Transaction(1002, "UT", 0, 0);
t.setAccountId(1005);
Assert.assertEquals(t.getAccountId(), 1005);
}
/**
* Testmetod för getAmount()
*/
@Test
public void testGetAmount() {
Transaction t = new Transaction(1002, "UT", 100.00, 0);
Assert.assertEquals(t.getAmount(), 100.00, 0);
}
/**
* Testmetod för setAmount()
*/
@Test
public void testSetAmount() {
Transaction t = new Transaction(1002, "UT", 0, 0);
t.setAmount(100.00);
Assert.assertEquals(t.getAmount(), 100.00, 0);
}
/**
* Testmetod för getBalance()
*/
@Test
public void testGetBalance() {
Transaction t = new Transaction(1002, "UT", 0, 0);
Assert.assertEquals(t.getBalance(), 0, 0);
}
/**
* Testmetod för setBalance()
*/
@Test
public void testSetBalance() {
Transaction t = new Transaction(1002, "UT", 0, 0);
t.setBalance(5000);
Assert.assertEquals(t.getBalance(), 5000, 0);
}
}
| UTF-8 | Java | 1,395 | java | TransactionTest.java | Java | [
{
"context": "\n\n/**\n * Testklass för Transaction.\n * \n * @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)\n *\n */\n",
"end": 120,
"score": 0.9388052821159363,
"start": 113,
"tag": "NAME",
"value": "Grupp 2"
},
{
"context": "estklass för Transaction.\n * \n * @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)\n *\n */\npublic cla",
"end": 130,
"score": 0.9998658895492554,
"start": 122,
"tag": "NAME",
"value": "Hampus B"
},
{
"context": "för Transaction.\n * \n * @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)\n *\n */\npublic class Tran",
"end": 137,
"score": 0.9998555183410645,
"start": 132,
"tag": "NAME",
"value": "Åsa W"
},
{
"context": "nsaction.\n * \n * @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)\n *\n */\npublic class TransactionT",
"end": 145,
"score": 0.9998380541801453,
"start": 139,
"tag": "NAME",
"value": "Anna N"
},
{
"context": ".\n * \n * @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)\n *\n */\npublic class TransactionTest {\n\n",
"end": 152,
"score": 0.9997783899307251,
"start": 147,
"tag": "NAME",
"value": "Cam H"
},
{
"context": "* @author Grupp 2 (Hampus B, Åsa W, Anna N, Cam H, Hamid R)\n *\n */\npublic class TransactionTest {\n\n\t/**\n\t * ",
"end": 161,
"score": 0.999848484992981,
"start": 154,
"tag": "NAME",
"value": "Hamid R"
}
] | null | [] | package bank;
import org.junit.Assert;
import org.junit.Test;
/**
* Testklass för Transaction.
*
* @author <NAME> (<NAME>, <NAME>, <NAME>, <NAME>, <NAME>)
*
*/
public class TransactionTest {
/**
* Testmetod för getAccount()
*/
@Test
public void testGetAccountId() {
Transaction t = new Transaction(1002, "UT", 0, 0);
Assert.assertEquals(t.getAccountId(), 1002);
}
/**
* Testmetod för setAccountId()
*/
@Test
public void testSetAccountId() {
Transaction t = new Transaction(1002, "UT", 0, 0);
t.setAccountId(1005);
Assert.assertEquals(t.getAccountId(), 1005);
}
/**
* Testmetod för getAmount()
*/
@Test
public void testGetAmount() {
Transaction t = new Transaction(1002, "UT", 100.00, 0);
Assert.assertEquals(t.getAmount(), 100.00, 0);
}
/**
* Testmetod för setAmount()
*/
@Test
public void testSetAmount() {
Transaction t = new Transaction(1002, "UT", 0, 0);
t.setAmount(100.00);
Assert.assertEquals(t.getAmount(), 100.00, 0);
}
/**
* Testmetod för getBalance()
*/
@Test
public void testGetBalance() {
Transaction t = new Transaction(1002, "UT", 0, 0);
Assert.assertEquals(t.getBalance(), 0, 0);
}
/**
* Testmetod för setBalance()
*/
@Test
public void testSetBalance() {
Transaction t = new Transaction(1002, "UT", 0, 0);
t.setBalance(5000);
Assert.assertEquals(t.getBalance(), 5000, 0);
}
}
| 1,392 | 0.645999 | 0.587599 | 71 | 18.535212 | 18.822994 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.633803 | false | false | 1 |
5d57a93305edfcc42bac02d3a70273e1afe3af0e | 16,587,163,716,708 | 5721f9a8547bbb233621a461658f08bab2543bff | /src/com/android/app/bookexchange/MyPurchaseBooksActivity.java | 257d17c021d823082198310df7b29bea2a07d24a | [] | no_license | MarwanAliAlbahar/Book-Exchange-APP | https://github.com/MarwanAliAlbahar/Book-Exchange-APP | 504926fda4d8d82af33d167fb458565a5122b409 | b63158e22a4a70d0b763540e4cbcf09968b8e680 | refs/heads/master | "2021-01-20T01:19:55.814000" | "2017-04-24T15:43:43" | "2017-04-24T15:43:43" | 89,258,477 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.android.app.bookexchange;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.ak.app.imageloader.ImageLoader;
import com.ak.app.servicedata.InfoBookData;
import com.ak.app.staticmethod.CheckInternetConection;
import com.ak.app.staticmethod.DialogClasses;
import com.ak.app.webservices.GeneralWebService;
import com.ak.app.webservices.QWebService;
public class MyPurchaseBooksActivity extends Activity {
private Button btn_back;
private ListView listview;
private TextView tv_noBooks;
private ProgressDialog viewDialog=null;
private ArrayList<InfoBookData> arrMyPurchaseBook;
private SharedPreferences preference;
private String str_userId,str_email;
private String str_book_image,str_book_id,str_bookName,str_bookIssueDate,str_bookPrice,
str_bookStatus,str_bookDes,str_bookURL,str_bookISBN;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_purchase_book);
setDataUI();
preference = this.getSharedPreferences("BookExchange", Context.MODE_PRIVATE);
str_userId = preference.getString("UserId", "");
str_email = preference.getString("email", "");
System.out.println("Email:- "+str_email);
System.out.println("User Id:- "+str_userId);
btn_back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MyPurchaseBooksActivity.this, ProfileActivity.class);
MyPurchaseBooksActivity.this.startActivity(i);
MyPurchaseBooksActivity.this.finish();
}
});
}
private void setDataUI()
{
btn_back = (Button)findViewById(R.id.btn_back);
listview = (ListView)findViewById(R.id.listview);
tv_noBooks = (TextView)findViewById(R.id.tv_noBooks);
}
private void showToast(String str)
{
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
}
@Override
protected void onStart() {
super.onStart();
if (CheckInternetConection.isInternetConnection(getApplicationContext()))
{
new MyBookListLoad().execute();
}
else
{
listview.setVisibility(View.INVISIBLE);
tv_noBooks.setVisibility(View.VISIBLE);
tv_noBooks.setText(getResources().getString(R.string.tv_noBook));
DialogClasses.showDialog1(getResources().getString(R.string.app_noConnection),
getResources().getString(R.string.app_name),
getResources().getString(R.string.btn_ok),
MyPurchaseBooksActivity.this);
}
}
public class MyBookListLoad extends AsyncTask<Void, Void, Void>
{
@Override
protected void onPreExecute() {
super.onPreExecute();
viewDialog=new ProgressDialog(MyPurchaseBooksActivity.this);
viewDialog.setTitle(getResources().getString(R.string.app_name));
viewDialog.setMessage(getResources().getString(R.string.app_pleaseWait));
viewDialog.setIndeterminate(true);
viewDialog.setCancelable(false);
viewDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try
{
str_userId = preference.getString("UserId", "");
String mybook_URL=getResources().getString(R.string.URL_appbook)+getResources().getString(R.string.URL_myPurchasedBooks);
QWebService.initialize(mybook_URL);
arrMyPurchaseBook=GeneralWebService.allMyBooksData(getApplicationContext(),str_userId);
System.out.println("arrMyPurchaseBook:- "+arrMyPurchaseBook);
}
catch (IOException e)
{
e.printStackTrace();
}
catch (TimeoutException e)
{
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if(viewDialog!=null)
viewDialog.dismiss();
try
{
if(arrMyPurchaseBook!=null && arrMyPurchaseBook.size()>0)
{
String msg=arrMyPurchaseBook.get(0).json_message;
if(msg.equalsIgnoreCase("success"))
{
listview.setVisibility(View.VISIBLE);
tv_noBooks.setVisibility(View.INVISIBLE);
listview.setAdapter(new MyPurBooksAdapter());
}
else
{
listview.setVisibility(View.INVISIBLE);
tv_noBooks.setVisibility(View.VISIBLE);
tv_noBooks.setText(arrMyPurchaseBook.get(0).json_description);
}
}
else
{
try
{
listview.setVisibility(View.INVISIBLE);
tv_noBooks.setVisibility(View.VISIBLE);
tv_noBooks.setText(getResources().getString(R.string.tv_noBook));
showToast(getResources().getString(R.string.app_error));
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
private class MyPurBooksAdapter extends BaseAdapter
{
@Override
public int getCount() {
return arrMyPurchaseBook.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View row = convertView;
if(row==null)
{
row = View.inflate(MyPurchaseBooksActivity.this, R.layout.row_my_books, null);
}
ImageView img_book = (ImageView)row.findViewById(R.id.img_book);
ProgressBar pb= (ProgressBar)row.findViewById(R.id.pb);
TextView tv_bookName = (TextView)row.findViewById(R.id.tv_bookName);
TextView tv_bookPrice = (TextView)row.findViewById(R.id.tv_bookPrice);
TextView tv_bookCondition = (TextView)row.findViewById(R.id.tv_bookCondition);
TextView tv_bookISBN = (TextView)row.findViewById(R.id.tv_bookISBN);
Button btn_edit = (Button)row.findViewById(R.id.btn_edit);
Button btn_delete = (Button)row.findViewById(R.id.btn_delete);
btn_edit.setVisibility(View.GONE);
btn_delete.setVisibility(View.GONE);
str_book_image = arrMyPurchaseBook.get(position).book_image;
str_book_id = arrMyPurchaseBook.get(position).book_id;
str_bookName = arrMyPurchaseBook.get(position).book_name;
str_bookPrice = arrMyPurchaseBook.get(position).book_price;
str_bookStatus = arrMyPurchaseBook.get(position).book_status;
str_bookURL = arrMyPurchaseBook.get(position).book_url;
str_bookDes = arrMyPurchaseBook.get(position).book_description;
str_bookISBN = arrMyPurchaseBook.get(position).book_isbn;
tv_bookName.setText(str_bookName);
tv_bookPrice.setText(str_bookPrice);
tv_bookCondition.setText(str_bookStatus);
tv_bookISBN.setText(str_bookISBN);
if(str_book_image!=null && !str_book_image.equals(""))
{
// String url=getResources().getString(R.string.URL_requirImage)+str_image1;
img_book.setTag(str_book_image);
System.out.println("img url:- "+str_book_image);
ImageLoader.DisplayImage(str_book_image, img_book, pb);
}
else
{
img_book.setImageResource(R.drawable.no_image);
pb.setVisibility(View.GONE);
}
return row;
}
}
@Override
public void onBackPressed()
{
super.onBackPressed();
Intent i = new Intent(MyPurchaseBooksActivity.this, ProfileActivity.class);
MyPurchaseBooksActivity.this.startActivity(i);
MyPurchaseBooksActivity.this.finish();
}
}
| UTF-8 | Java | 8,058 | java | MyPurchaseBooksActivity.java | Java | [
{
"context": "IVATE);\r\n\t\t\r\n\t\tstr_userId = preference.getString(\"UserId\", \"\");\r\n\t\tstr_email = preference.getString(\"email",
"end": 1865,
"score": 0.9328383803367615,
"start": 1859,
"tag": "USERNAME",
"value": "UserId"
}
] | null | [] | package com.android.app.bookexchange;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.ak.app.imageloader.ImageLoader;
import com.ak.app.servicedata.InfoBookData;
import com.ak.app.staticmethod.CheckInternetConection;
import com.ak.app.staticmethod.DialogClasses;
import com.ak.app.webservices.GeneralWebService;
import com.ak.app.webservices.QWebService;
public class MyPurchaseBooksActivity extends Activity {
private Button btn_back;
private ListView listview;
private TextView tv_noBooks;
private ProgressDialog viewDialog=null;
private ArrayList<InfoBookData> arrMyPurchaseBook;
private SharedPreferences preference;
private String str_userId,str_email;
private String str_book_image,str_book_id,str_bookName,str_bookIssueDate,str_bookPrice,
str_bookStatus,str_bookDes,str_bookURL,str_bookISBN;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_purchase_book);
setDataUI();
preference = this.getSharedPreferences("BookExchange", Context.MODE_PRIVATE);
str_userId = preference.getString("UserId", "");
str_email = preference.getString("email", "");
System.out.println("Email:- "+str_email);
System.out.println("User Id:- "+str_userId);
btn_back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MyPurchaseBooksActivity.this, ProfileActivity.class);
MyPurchaseBooksActivity.this.startActivity(i);
MyPurchaseBooksActivity.this.finish();
}
});
}
private void setDataUI()
{
btn_back = (Button)findViewById(R.id.btn_back);
listview = (ListView)findViewById(R.id.listview);
tv_noBooks = (TextView)findViewById(R.id.tv_noBooks);
}
private void showToast(String str)
{
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
}
@Override
protected void onStart() {
super.onStart();
if (CheckInternetConection.isInternetConnection(getApplicationContext()))
{
new MyBookListLoad().execute();
}
else
{
listview.setVisibility(View.INVISIBLE);
tv_noBooks.setVisibility(View.VISIBLE);
tv_noBooks.setText(getResources().getString(R.string.tv_noBook));
DialogClasses.showDialog1(getResources().getString(R.string.app_noConnection),
getResources().getString(R.string.app_name),
getResources().getString(R.string.btn_ok),
MyPurchaseBooksActivity.this);
}
}
public class MyBookListLoad extends AsyncTask<Void, Void, Void>
{
@Override
protected void onPreExecute() {
super.onPreExecute();
viewDialog=new ProgressDialog(MyPurchaseBooksActivity.this);
viewDialog.setTitle(getResources().getString(R.string.app_name));
viewDialog.setMessage(getResources().getString(R.string.app_pleaseWait));
viewDialog.setIndeterminate(true);
viewDialog.setCancelable(false);
viewDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try
{
str_userId = preference.getString("UserId", "");
String mybook_URL=getResources().getString(R.string.URL_appbook)+getResources().getString(R.string.URL_myPurchasedBooks);
QWebService.initialize(mybook_URL);
arrMyPurchaseBook=GeneralWebService.allMyBooksData(getApplicationContext(),str_userId);
System.out.println("arrMyPurchaseBook:- "+arrMyPurchaseBook);
}
catch (IOException e)
{
e.printStackTrace();
}
catch (TimeoutException e)
{
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if(viewDialog!=null)
viewDialog.dismiss();
try
{
if(arrMyPurchaseBook!=null && arrMyPurchaseBook.size()>0)
{
String msg=arrMyPurchaseBook.get(0).json_message;
if(msg.equalsIgnoreCase("success"))
{
listview.setVisibility(View.VISIBLE);
tv_noBooks.setVisibility(View.INVISIBLE);
listview.setAdapter(new MyPurBooksAdapter());
}
else
{
listview.setVisibility(View.INVISIBLE);
tv_noBooks.setVisibility(View.VISIBLE);
tv_noBooks.setText(arrMyPurchaseBook.get(0).json_description);
}
}
else
{
try
{
listview.setVisibility(View.INVISIBLE);
tv_noBooks.setVisibility(View.VISIBLE);
tv_noBooks.setText(getResources().getString(R.string.tv_noBook));
showToast(getResources().getString(R.string.app_error));
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
private class MyPurBooksAdapter extends BaseAdapter
{
@Override
public int getCount() {
return arrMyPurchaseBook.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View row = convertView;
if(row==null)
{
row = View.inflate(MyPurchaseBooksActivity.this, R.layout.row_my_books, null);
}
ImageView img_book = (ImageView)row.findViewById(R.id.img_book);
ProgressBar pb= (ProgressBar)row.findViewById(R.id.pb);
TextView tv_bookName = (TextView)row.findViewById(R.id.tv_bookName);
TextView tv_bookPrice = (TextView)row.findViewById(R.id.tv_bookPrice);
TextView tv_bookCondition = (TextView)row.findViewById(R.id.tv_bookCondition);
TextView tv_bookISBN = (TextView)row.findViewById(R.id.tv_bookISBN);
Button btn_edit = (Button)row.findViewById(R.id.btn_edit);
Button btn_delete = (Button)row.findViewById(R.id.btn_delete);
btn_edit.setVisibility(View.GONE);
btn_delete.setVisibility(View.GONE);
str_book_image = arrMyPurchaseBook.get(position).book_image;
str_book_id = arrMyPurchaseBook.get(position).book_id;
str_bookName = arrMyPurchaseBook.get(position).book_name;
str_bookPrice = arrMyPurchaseBook.get(position).book_price;
str_bookStatus = arrMyPurchaseBook.get(position).book_status;
str_bookURL = arrMyPurchaseBook.get(position).book_url;
str_bookDes = arrMyPurchaseBook.get(position).book_description;
str_bookISBN = arrMyPurchaseBook.get(position).book_isbn;
tv_bookName.setText(str_bookName);
tv_bookPrice.setText(str_bookPrice);
tv_bookCondition.setText(str_bookStatus);
tv_bookISBN.setText(str_bookISBN);
if(str_book_image!=null && !str_book_image.equals(""))
{
// String url=getResources().getString(R.string.URL_requirImage)+str_image1;
img_book.setTag(str_book_image);
System.out.println("img url:- "+str_book_image);
ImageLoader.DisplayImage(str_book_image, img_book, pb);
}
else
{
img_book.setImageResource(R.drawable.no_image);
pb.setVisibility(View.GONE);
}
return row;
}
}
@Override
public void onBackPressed()
{
super.onBackPressed();
Intent i = new Intent(MyPurchaseBooksActivity.this, ProfileActivity.class);
MyPurchaseBooksActivity.this.startActivity(i);
MyPurchaseBooksActivity.this.finish();
}
}
| 8,058 | 0.703773 | 0.703152 | 263 | 28.638783 | 24.870974 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.007605 | false | false | 1 |
0ba805b4ac40b8fbb91a1a575142b41c02a27739 | 15,607,911,175,217 | c8589858aa1c2a29f6beaaadf62001781089cd0d | /Algorithm/src/algorithm/MergeSort.java | dcbd3f68a64bc0e67663f6d55a4b1423b1f0ae89 | [] | no_license | LeeNamSoo/java | https://github.com/LeeNamSoo/java | 7f039428ce823165a6a6446997f10b8cccb4f8e0 | 29453dbc5b860dd4763f59be32b9451021faf2ef | refs/heads/master | "2020-12-27T16:54:38.956000" | "2020-06-14T06:07:35" | "2020-06-14T06:07:35" | 237,978,662 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package algorithm;
public class MergeSort {
// int[] x = {4,3,7,8,2,9,1,6,5};
public void mergesort(int[] x) {
int mid = x.length / 2;
int[] left = new int[mid];
int[] right = new int[x.length - mid];
if (x.length > 1) {
for (int i = 0; i < mid; i++) {
left[i] = x[i];
}
for (int i = 0; i < x.length - mid; i++) {
right[i] = x[i + mid];
}
mergesort(left);
mergesort(right);
merge(left, right, x);
}
}
public int[] merge(int[] left, int[] right, int[] sort) {
int i = 0;
int lp = 0;
int rp = 0;
while (left.length > lp && right.length > rp) {
if (left[lp] > right[rp]) {
sort[i++] = right[rp++];
} else if (left[lp] < right[rp]) {
sort[i++] = left[lp++];
}
if (left.length <= lp) {
for (int j = rp; j < right.length; j++) {
sort[i++] = right[j];
}
} else if (right.length <= rp) {
for (int j = lp; j < left.length; j++) {
sort[i++] = left[j];
}
}
}
return sort;
}
}
| UTF-8 | Java | 977 | java | MergeSort.java | Java | [] | null | [] | package algorithm;
public class MergeSort {
// int[] x = {4,3,7,8,2,9,1,6,5};
public void mergesort(int[] x) {
int mid = x.length / 2;
int[] left = new int[mid];
int[] right = new int[x.length - mid];
if (x.length > 1) {
for (int i = 0; i < mid; i++) {
left[i] = x[i];
}
for (int i = 0; i < x.length - mid; i++) {
right[i] = x[i + mid];
}
mergesort(left);
mergesort(right);
merge(left, right, x);
}
}
public int[] merge(int[] left, int[] right, int[] sort) {
int i = 0;
int lp = 0;
int rp = 0;
while (left.length > lp && right.length > rp) {
if (left[lp] > right[rp]) {
sort[i++] = right[rp++];
} else if (left[lp] < right[rp]) {
sort[i++] = left[lp++];
}
if (left.length <= lp) {
for (int j = rp; j < right.length; j++) {
sort[i++] = right[j];
}
} else if (right.length <= rp) {
for (int j = lp; j < left.length; j++) {
sort[i++] = left[j];
}
}
}
return sort;
}
}
| 977 | 0.487206 | 0.470829 | 47 | 19.787233 | 15.513804 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.106383 | false | false | 1 |
1b85c40681146e3eef3b8cc0a863d23af05a7410 | 4,776,003,633,559 | 0bb8b151541974dba26b6528ece66217600c2794 | /Project/ProjectBlackyBear/blackybear_util/src/main/java/com/blackybear/util/weixin/fwh/entity/material/UploadTempMaterialResp.java | b931a2621ffecf8377166237afac86dcb3238270 | [
"Apache-2.0"
] | permissive | blacky8/Java | https://github.com/blacky8/Java | 0aa7a7e838e50366e0da95d776ebd4c12a47099d | 52cb32f5fd98cf37dc7c12093dd6fc824e1dbe9d | refs/heads/master | "2018-12-31T18:53:39.967000" | "2018-12-19T01:55:36" | "2018-12-19T01:55:36" | 99,496,563 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.blackybear.util.weixin.fwh.entity.material;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Description: UploadTempMaterialResp
* Author: qinweitao
* CopyRight: bhne
* Create Date: 2018/6/15
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UploadTempMaterialResp implements Serializable {
/**
* type : TYPE
* media_id : MEDIA_ID
* created_at : 123456789
*/
private String type;
private String media_id;
private int created_at;
}
| UTF-8 | Java | 571 | java | UploadTempMaterialResp.java | Java | [
{
"context": "\n * Description: UploadTempMaterialResp\n * Author: qinweitao\n * CopyRight: bhne\n * Create Date: 2018/6/15\n */\n",
"end": 238,
"score": 0.999688446521759,
"start": 229,
"tag": "USERNAME",
"value": "qinweitao"
},
{
"context": "empMaterialResp\n * Author: qinweitao\n * CopyRight: bhne\n * Create Date: 2018/6/15\n */\n@Data\n@NoArgsConstr",
"end": 257,
"score": 0.9991166591644287,
"start": 253,
"tag": "USERNAME",
"value": "bhne"
}
] | null | [] | package com.blackybear.util.weixin.fwh.entity.material;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Description: UploadTempMaterialResp
* Author: qinweitao
* CopyRight: bhne
* Create Date: 2018/6/15
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UploadTempMaterialResp implements Serializable {
/**
* type : TYPE
* media_id : MEDIA_ID
* created_at : 123456789
*/
private String type;
private String media_id;
private int created_at;
}
| 571 | 0.725044 | 0.697023 | 27 | 20.148148 | 15.626908 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.296296 | false | false | 1 |
aa8c5a1e83df0339f9e4e2bed267532b2abe94fb | 17,712,445,197,752 | a0139989df46b71529aad954a1a3a6b4eff375e5 | /src/main/java/it/introsoft/banker/service/supplier/SingleTransferOnPdfPageSupplier.java | b75f7d40e14b9d3b4a4c78df71e826958bc6fa35 | [] | no_license | bmlynarczyk/banker | https://github.com/bmlynarczyk/banker | af9ff29b170c95c60eff994a61a755899a7ce218 | 28e640b4545a80833bbbc92d207a9c1e42897eb6 | refs/heads/master | "2020-06-12T21:49:38.063000" | "2017-09-04T17:41:00" | "2017-09-04T17:41:00" | 75,504,297 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.introsoft.banker.service.supplier;
import it.introsoft.banker.model.jpa.Transfer;
import it.introsoft.banker.model.raw.TransferRaw;
import lombok.SneakyThrows;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.text.PDFTextStripperByArea;
import org.springframework.core.convert.converter.Converter;
import java.awt.*;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static com.google.common.base.Splitter.on;
import static org.springframework.data.util.StreamUtils.createStreamFromIterator;
public class SingleTransferOnPdfPageSupplier implements Supplier<Collection<Transfer>> {
private File file;
private Rectangle rectangle;
private Converter<List<String>, TransferRaw> converter;
public SingleTransferOnPdfPageSupplier(File file, Rectangle rectangle, Converter<List<String>, TransferRaw> converter) {
this.file = file;
this.rectangle = rectangle;
this.converter = converter;
}
private static List<String> getTransferDataAsLines(PDFTextStripperByArea stripper) {
return on("\n").splitToList(stripper.getTextForRegion("class1"));
}
@Override
@SneakyThrows
public Collection<Transfer> get() {
PDDocument document = null;
try {
document = PDDocument.load(file);
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition(true);
stripper.addRegion("class1", rectangle);
return getTransfers(document, stripper);
} finally {
if (document != null) {
document.close();
}
}
}
private Collection<Transfer> getTransfers(PDDocument document, PDFTextStripperByArea stripper) {
return createStreamFromIterator(document.getPages().iterator())
.map((PDPage page) -> getTransfer(page, stripper))
.sorted(new TransferComparator())
.collect(Collectors.toList());
}
@SneakyThrows
private Transfer getTransfer(PDPage page, PDFTextStripperByArea stripper) {
stripper.extractRegions(page);
return converter.convert(getTransferDataAsLines(stripper)).asTransfer();
}
} | UTF-8 | Java | 2,363 | java | SingleTransferOnPdfPageSupplier.java | Java | [] | null | [] | package it.introsoft.banker.service.supplier;
import it.introsoft.banker.model.jpa.Transfer;
import it.introsoft.banker.model.raw.TransferRaw;
import lombok.SneakyThrows;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.text.PDFTextStripperByArea;
import org.springframework.core.convert.converter.Converter;
import java.awt.*;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static com.google.common.base.Splitter.on;
import static org.springframework.data.util.StreamUtils.createStreamFromIterator;
public class SingleTransferOnPdfPageSupplier implements Supplier<Collection<Transfer>> {
private File file;
private Rectangle rectangle;
private Converter<List<String>, TransferRaw> converter;
public SingleTransferOnPdfPageSupplier(File file, Rectangle rectangle, Converter<List<String>, TransferRaw> converter) {
this.file = file;
this.rectangle = rectangle;
this.converter = converter;
}
private static List<String> getTransferDataAsLines(PDFTextStripperByArea stripper) {
return on("\n").splitToList(stripper.getTextForRegion("class1"));
}
@Override
@SneakyThrows
public Collection<Transfer> get() {
PDDocument document = null;
try {
document = PDDocument.load(file);
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition(true);
stripper.addRegion("class1", rectangle);
return getTransfers(document, stripper);
} finally {
if (document != null) {
document.close();
}
}
}
private Collection<Transfer> getTransfers(PDDocument document, PDFTextStripperByArea stripper) {
return createStreamFromIterator(document.getPages().iterator())
.map((PDPage page) -> getTransfer(page, stripper))
.sorted(new TransferComparator())
.collect(Collectors.toList());
}
@SneakyThrows
private Transfer getTransfer(PDPage page, PDFTextStripperByArea stripper) {
stripper.extractRegions(page);
return converter.convert(getTransferDataAsLines(stripper)).asTransfer();
}
} | 2,363 | 0.708845 | 0.707998 | 67 | 34.283581 | 28.786816 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.626866 | false | false | 1 |
2ca4bd4f3162c836a65e459ca66c8c11ae137808 | 27,290,222,225,273 | 84d23aa626d51050968849b310d7ad80b4ea402c | /newyorktimesAPI-MVVM-ROOM-RETROFIT/app/src/main/java/articles/news/com/mostviewedarticles/dependencyinjection/components/AppComponent.java | 25bf82676857b6e888b0c6dd1d19564831efa451 | [] | no_license | pramodpnckr1/newyorktimesAPI-MVVM-ROOM-RETROFIT | https://github.com/pramodpnckr1/newyorktimesAPI-MVVM-ROOM-RETROFIT | 19046e4e6b0fe95a5662c1beaa30deac84accd0e | a0a775c7200b9dd1ae35468c309c78d85ea5ed98 | refs/heads/master | "2020-05-07T17:53:00.521000" | "2019-04-11T09:11:50" | "2019-04-11T09:11:50" | 180,745,508 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package articles.news.com.mostviewedarticles.dependencyinjection.components;
import android.app.Application;
import javax.inject.Singleton;
import articles.news.com.mostviewedarticles.NYTimesApp;
import articles.news.com.mostviewedarticles.dependencyinjection.builder.ActivityBuilderModule;
import articles.news.com.mostviewedarticles.dependencyinjection.module.ApplicationModule;
import dagger.BindsInstance;
import dagger.Component;
import dagger.Component.Builder;
import dagger.android.AndroidInjectionModule;
/**
* Created by USER on 4/4/2019.
*/
@Singleton
@Component(modules = {
ApplicationModule.class,
AndroidInjectionModule.class,
ActivityBuilderModule.class
})
public interface AppComponent {
@Component.Builder
interface Builder{
@BindsInstance
Builder application(Application application);
AppComponent build();
}
void inject (NYTimesApp inject);
}
| UTF-8 | Java | 933 | java | AppComponent.java | Java | [
{
"context": "android.AndroidInjectionModule;\n\n/**\n * Created by USER on 4/4/2019.\n */\n@Singleton\n@Component(modules = ",
"end": 540,
"score": 0.953091025352478,
"start": 536,
"tag": "USERNAME",
"value": "USER"
}
] | null | [] | package articles.news.com.mostviewedarticles.dependencyinjection.components;
import android.app.Application;
import javax.inject.Singleton;
import articles.news.com.mostviewedarticles.NYTimesApp;
import articles.news.com.mostviewedarticles.dependencyinjection.builder.ActivityBuilderModule;
import articles.news.com.mostviewedarticles.dependencyinjection.module.ApplicationModule;
import dagger.BindsInstance;
import dagger.Component;
import dagger.Component.Builder;
import dagger.android.AndroidInjectionModule;
/**
* Created by USER on 4/4/2019.
*/
@Singleton
@Component(modules = {
ApplicationModule.class,
AndroidInjectionModule.class,
ActivityBuilderModule.class
})
public interface AppComponent {
@Component.Builder
interface Builder{
@BindsInstance
Builder application(Application application);
AppComponent build();
}
void inject (NYTimesApp inject);
}
| 933 | 0.78135 | 0.77492 | 33 | 27.272728 | 24.527378 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 1 |
7e426aff4c1fe78032832955a8eda5474756d23f | 6,442,450,951,457 | 571fccdd41284910bcafa8035c2d92c889030b5b | /GB Java part 3/src/Java3Lesson1/Main.java | 46277cd5d54be925aabf7da64e34cfdbb0e6c1b2 | [] | no_license | IgorKrd/GB-Lessons | https://github.com/IgorKrd/GB-Lessons | 33deeede83987f2c13e56ef10c3cc57286ac5b0e | f4dd2450677d91dcd59409b5a5cc80340e4e95cb | refs/heads/master | "2023-05-24T23:32:42.008000" | "2019-09-14T18:11:17" | "2019-09-14T18:11:17" | 191,741,274 | 1 | 0 | null | false | "2023-05-23T20:10:22" | "2019-06-13T10:22:54" | "2019-09-14T18:11:20" | "2023-05-23T20:10:21" | 11,740 | 0 | 0 | 3 | Java | false | false | package Java3Lesson1;
/*
1. Написать метод, который меняет два элемента массива местами (массив может быть любого ссылочного типа);
2. Написать метод, который преобразует массив в ArrayList;
3. Большая задача:
Есть классы Java3Lesson1.Fruit -> Java3Lesson1.Apple, Java3Lesson1.Orange (больше фруктов не надо);
Класс Java3Lesson1.Box, в который можно складывать фрукты. Коробки условно сортируются по типу фрукта, поэтому в одну коробку нельзя сложить и яблоки, и апельсины;
Для хранения фруктов внутри коробки можно использовать ArrayList;
Сделать метод getWeight(), который высчитывает вес коробки, зная количество фруктов и вес одного фрукта (вес яблока – 1.0f, апельсина – 1.5f. Не важно, в каких это единицах);
Внутри класса Коробка сделать метод compare, который позволяет сравнить текущую коробку с той, которую подадут в compare в качестве параметра, true – если она равны по весу, false – в противном случае (коробки с яблоками мы можем сравнивать с коробками с апельсинами);
Написать метод, который позволяет пересыпать фрукты из текущей коробки в другую (помним про сортировку фруктов: нельзя яблоки высыпать в коробку с апельсинами). Соответственно, в текущей коробке фруктов не остается, а в другую перекидываются объекты, которые были в этой коробке;
Не забываем про метод добавления фрукта в коробку.
*/
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// решение по п.1 задания
int posFirst = 0;
int posSecond = 3;
String[] arrayStr = {"один", "два", "три", "четыре", "пять"};
Integer[] arrayInt = {1, 2, 3, 4, 5};
Object[] arrayObjects = new Object[5];
for (int i = 0; i < arrayObjects.length ; i++) {
arrayObjects[i] = new Object();
}
System.out.println("Меняем местами элементы на позициях: " + posFirst + " и " + posSecond );
changePosition(arrayStr, posFirst,posSecond);
System.out.println();
changePosition(arrayInt, posFirst,posSecond);
System.out.println();
changePosition(arrayObjects, posFirst,posSecond);
System.out.println();
// решение по п.2 задания
arrayAsArrayList(arrayStr);
System.out.println();
arrayAsArrayList(arrayInt);
System.out.println();
arrayAsArrayList(arrayObjects);
System.out.println();
// решеение по п.3 задания
Box<Apple> box1a = new Box<>();
Box<Apple> box2a = new Box<>();
Box<Orange> box1o = new Box<>();
Box<Orange> box2o = new Box<>();
box1a.addFruit(new Apple(), 100);
box2a.addFruit(new Apple(), 50);
box1o.addFruit(new Orange(),20);
box2o.addFruit(new Orange(),60);
System.out.println("Вес первой коробки (с яблоками): " + box1a.getWeight());
System.out.println("Вес второй коробки (с яблоками): " + box2a.getWeight());
System.out.println();
System.out.println("Вес третьей коробки (с апельсинами): " + box1o.getWeight());
System.out.println("Вес четвёртой коробки (с апельсинами): " + box2o.getWeight());
System.out.println();
System.out.println("Сравнение первой коробки (c яблоками) и третьей коробки (с апельсинами): " + box1a.boxCompare(box1o));
System.out.println("Сравнение второй коробки (c яблоками) и четвёртой коробки (с апельсинами): " + box2a.boxCompare(box1o));
System.out.println();
System.out.println("Пересыпем яблоки в одну коробку.");
box1a.pouringToBox(box2a);
System.out.println();
System.out.println("Вес первой коробки c яблоками: " + box1a.getWeight());
System.out.println("Вес второй коробки c яблоками: " + box2a.getWeight());
System.out.println();
System.out.println("Пересыпем апельсины в одну коробку.");
box1o.pouringToBox(box2o);
System.out.println();
System.out.println("Вес третьей коробки (c апельсинами): " + box1o.getWeight());
System.out.println("Вес четвёртой коробки (c апельсинами): " + box2o.getWeight());
}
private static void changePosition (Object[] array, int posFirst, int posSecond) {
System.out.println("Массив на входе в метод: " + Arrays.toString(array));
Object o = array[posFirst];
array[posFirst] = array[posSecond];
array[posSecond] = o;
System.out.println("Массив на выходе из метода: " + Arrays.toString(array));
}
private static <T> void arrayAsArrayList (T[] array) {
System.out.println("Массив на входе в метод: " + Arrays.toString(array));
ArrayList<T> list = new ArrayList<>(Arrays.asList(array));
System.out.println("Список на выходе из метода: " + list);
}
}
| UTF-8 | Java | 6,311 | java | Main.java | Java | [] | null | [] | package Java3Lesson1;
/*
1. Написать метод, который меняет два элемента массива местами (массив может быть любого ссылочного типа);
2. Написать метод, который преобразует массив в ArrayList;
3. Большая задача:
Есть классы Java3Lesson1.Fruit -> Java3Lesson1.Apple, Java3Lesson1.Orange (больше фруктов не надо);
Класс Java3Lesson1.Box, в который можно складывать фрукты. Коробки условно сортируются по типу фрукта, поэтому в одну коробку нельзя сложить и яблоки, и апельсины;
Для хранения фруктов внутри коробки можно использовать ArrayList;
Сделать метод getWeight(), который высчитывает вес коробки, зная количество фруктов и вес одного фрукта (вес яблока – 1.0f, апельсина – 1.5f. Не важно, в каких это единицах);
Внутри класса Коробка сделать метод compare, который позволяет сравнить текущую коробку с той, которую подадут в compare в качестве параметра, true – если она равны по весу, false – в противном случае (коробки с яблоками мы можем сравнивать с коробками с апельсинами);
Написать метод, который позволяет пересыпать фрукты из текущей коробки в другую (помним про сортировку фруктов: нельзя яблоки высыпать в коробку с апельсинами). Соответственно, в текущей коробке фруктов не остается, а в другую перекидываются объекты, которые были в этой коробке;
Не забываем про метод добавления фрукта в коробку.
*/
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// решение по п.1 задания
int posFirst = 0;
int posSecond = 3;
String[] arrayStr = {"один", "два", "три", "четыре", "пять"};
Integer[] arrayInt = {1, 2, 3, 4, 5};
Object[] arrayObjects = new Object[5];
for (int i = 0; i < arrayObjects.length ; i++) {
arrayObjects[i] = new Object();
}
System.out.println("Меняем местами элементы на позициях: " + posFirst + " и " + posSecond );
changePosition(arrayStr, posFirst,posSecond);
System.out.println();
changePosition(arrayInt, posFirst,posSecond);
System.out.println();
changePosition(arrayObjects, posFirst,posSecond);
System.out.println();
// решение по п.2 задания
arrayAsArrayList(arrayStr);
System.out.println();
arrayAsArrayList(arrayInt);
System.out.println();
arrayAsArrayList(arrayObjects);
System.out.println();
// решеение по п.3 задания
Box<Apple> box1a = new Box<>();
Box<Apple> box2a = new Box<>();
Box<Orange> box1o = new Box<>();
Box<Orange> box2o = new Box<>();
box1a.addFruit(new Apple(), 100);
box2a.addFruit(new Apple(), 50);
box1o.addFruit(new Orange(),20);
box2o.addFruit(new Orange(),60);
System.out.println("Вес первой коробки (с яблоками): " + box1a.getWeight());
System.out.println("Вес второй коробки (с яблоками): " + box2a.getWeight());
System.out.println();
System.out.println("Вес третьей коробки (с апельсинами): " + box1o.getWeight());
System.out.println("Вес четвёртой коробки (с апельсинами): " + box2o.getWeight());
System.out.println();
System.out.println("Сравнение первой коробки (c яблоками) и третьей коробки (с апельсинами): " + box1a.boxCompare(box1o));
System.out.println("Сравнение второй коробки (c яблоками) и четвёртой коробки (с апельсинами): " + box2a.boxCompare(box1o));
System.out.println();
System.out.println("Пересыпем яблоки в одну коробку.");
box1a.pouringToBox(box2a);
System.out.println();
System.out.println("Вес первой коробки c яблоками: " + box1a.getWeight());
System.out.println("Вес второй коробки c яблоками: " + box2a.getWeight());
System.out.println();
System.out.println("Пересыпем апельсины в одну коробку.");
box1o.pouringToBox(box2o);
System.out.println();
System.out.println("Вес третьей коробки (c апельсинами): " + box1o.getWeight());
System.out.println("Вес четвёртой коробки (c апельсинами): " + box2o.getWeight());
}
private static void changePosition (Object[] array, int posFirst, int posSecond) {
System.out.println("Массив на входе в метод: " + Arrays.toString(array));
Object o = array[posFirst];
array[posFirst] = array[posSecond];
array[posSecond] = o;
System.out.println("Массив на выходе из метода: " + Arrays.toString(array));
}
private static <T> void arrayAsArrayList (T[] array) {
System.out.println("Массив на входе в метод: " + Arrays.toString(array));
ArrayList<T> list = new ArrayList<>(Arrays.asList(array));
System.out.println("Список на выходе из метода: " + list);
}
}
| 6,311 | 0.664586 | 0.651685 | 135 | 34.599998 | 46.557205 | 279 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.785185 | false | false | 1 |
948de6f7c84035d81a1564cb53ae0e8d0a98ad31 | 2,018,634,666,157 | 909e2cc9cb2572b6bda36f47f4e709f0cd97aa91 | /SV_MAIN/src/de/verbund/sv/test/Test.java | 21a7c883c78c56be7d7499a7eee1edcf4c854b5d | [] | no_license | kiltz/Verbund-V | https://github.com/kiltz/Verbund-V | 65061fbac706ecbe2e125e465003a12c8d489deb | 0edae0b4eff5aa417c6eaa0a9dcd126b4e4ce15d | refs/heads/master | "2016-08-10T10:42:07.619000" | "2016-02-19T11:37:37" | "2016-02-19T11:37:37" | 46,864,110 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.verbund.sv.test;
import java.io.IOException;
public class Test {
public Test() {
}
public static void main(String[] args) throws IOException {
new Test();
}
}
| UTF-8 | Java | 208 | java | Test.java | Java | [] | null | [] | package de.verbund.sv.test;
import java.io.IOException;
public class Test {
public Test() {
}
public static void main(String[] args) throws IOException {
new Test();
}
}
| 208 | 0.596154 | 0.596154 | 15 | 11.866667 | 16.796295 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 1 |
139d90f9d1f803ba1fccb17f6f8fc669e49a6803 | 7,043,746,380,674 | 49592740f1489aa50bc07877dbea2f4042130f33 | /src/addFields.java | 7ac3c0e9e2d0eb86d5a4e9a658eb71e1af8686eb | [] | no_license | lovos25/lovoTrack | https://github.com/lovos25/lovoTrack | d5c3f8a6d5577148ec175e91d602dc56cc326dc6 | 4a0d335b16ce0c4783a9d1d6fbbfd177e6de3153 | refs/heads/master | "2016-09-24T02:22:16.116000" | "2012-09-18T07:12:24" | "2012-09-18T07:12:24" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.swing.*;
public class addFields extends JFrame {
JLabel text1;
JLabel text2;
JButton button;
JTextField field1;
JTextField field2;
JTextField eingaben;
public addFields() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setSize(500 , 500);
setLocationRelativeTo(null);;
setTitle("Lovo Track");
setResizable(false);
setLayout(null);
text1 = new JLabel("Time spent");
text2 = new JLabel("Topic");
text1.setBounds(5, 10, 100, 20);
add(text1);
text2.setBounds(5, 30, 100, 20);
add(text2);
field1 = new JTextField();
field1.setBounds(200,10, 200,20);
add(field1);
field2 = new JTextField();
field2.setBounds(200,30, 200,20);
add(field2);
eingaben = new JTextField();
eingaben.setBounds(200,100, 200,200);
add(eingaben);
button = new JButton("Add");
button.setBounds(200, 60, 100, 20);
button.addActionListener(new myActionListner(eingaben, field1, field2));
add(button);
}
}
| UTF-8 | Java | 1,042 | java | addFields.java | Java | [] | null | [] | import javax.swing.*;
public class addFields extends JFrame {
JLabel text1;
JLabel text2;
JButton button;
JTextField field1;
JTextField field2;
JTextField eingaben;
public addFields() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setSize(500 , 500);
setLocationRelativeTo(null);;
setTitle("Lovo Track");
setResizable(false);
setLayout(null);
text1 = new JLabel("Time spent");
text2 = new JLabel("Topic");
text1.setBounds(5, 10, 100, 20);
add(text1);
text2.setBounds(5, 30, 100, 20);
add(text2);
field1 = new JTextField();
field1.setBounds(200,10, 200,20);
add(field1);
field2 = new JTextField();
field2.setBounds(200,30, 200,20);
add(field2);
eingaben = new JTextField();
eingaben.setBounds(200,100, 200,200);
add(eingaben);
button = new JButton("Add");
button.setBounds(200, 60, 100, 20);
button.addActionListener(new myActionListner(eingaben, field1, field2));
add(button);
}
}
| 1,042 | 0.644914 | 0.566219 | 50 | 18.84 | 15.430307 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.64 | false | false | 1 |
68b40248e217436a57054a79d3f3d774f624cc95 | 3,728,031,619,116 | f568c63287eb86598ba40d8a870c6a8b1d254fe5 | /wein/src/main/java/de/fekl/wein/api/core/builder/CompositeNodeBuilder.java | 404911eaa4c3b8646c483850edb43a14d6c6e5ed | [] | no_license | dev-felix-1/wein | https://github.com/dev-felix-1/wein | 1143807f6188058fa9524a0a288240ce4037bcb5 | 0c1522231eae577a275704ca91d038fda196545f | refs/heads/main | "2023-03-04T18:49:53.357000" | "2021-02-09T14:45:15" | "2021-02-09T14:45:15" | 326,216,965 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.fekl.wein.api.core.builder;
import java.util.ArrayList;
import java.util.List;
import de.fekl.dine.core.api.node.INode;
public class CompositeNodeBuilder {
private String id;
private String role;
private INode impl;
private List<String> connections = new ArrayList<>();
private List<CompositeNodeBuilder> inlineNodes = new ArrayList<>();
public String getId() {
return id;
}
public CompositeNodeBuilder id(String id) {
this.id = id;
return this;
}
public String getRole() {
return role;
}
public CompositeNodeBuilder role(String role) {
this.role = role;
return this;
}
public INode getImpl() {
return impl;
}
public CompositeNodeBuilder impl(INode impl) {
this.impl = impl;
return this;
}
public CompositeNodeBuilder to(String target) {
this.connections.add(target);
return this;
}
public CompositeNodeBuilder to(CompositeNodeBuilder target) {
this.inlineNodes.add(target);
return this;
}
public List<String> getConnections() {
return connections;
}
List<CompositeNodeBuilder> getInlineNodes() {
return inlineNodes;
}
}
| UTF-8 | Java | 1,166 | java | CompositeNodeBuilder.java | Java | [] | null | [] | package de.fekl.wein.api.core.builder;
import java.util.ArrayList;
import java.util.List;
import de.fekl.dine.core.api.node.INode;
public class CompositeNodeBuilder {
private String id;
private String role;
private INode impl;
private List<String> connections = new ArrayList<>();
private List<CompositeNodeBuilder> inlineNodes = new ArrayList<>();
public String getId() {
return id;
}
public CompositeNodeBuilder id(String id) {
this.id = id;
return this;
}
public String getRole() {
return role;
}
public CompositeNodeBuilder role(String role) {
this.role = role;
return this;
}
public INode getImpl() {
return impl;
}
public CompositeNodeBuilder impl(INode impl) {
this.impl = impl;
return this;
}
public CompositeNodeBuilder to(String target) {
this.connections.add(target);
return this;
}
public CompositeNodeBuilder to(CompositeNodeBuilder target) {
this.inlineNodes.add(target);
return this;
}
public List<String> getConnections() {
return connections;
}
List<CompositeNodeBuilder> getInlineNodes() {
return inlineNodes;
}
}
| 1,166 | 0.686106 | 0.686106 | 61 | 17.114754 | 18.006464 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.344262 | false | false | 1 |
1151e64491796315061a06515efd9b67a8f903f0 | 20,521,353,795,882 | 677dbf387e95355951b68a27b80ff35ed3f96042 | /getirStudy/src/test/java/com/tutku/getirTest/pagemodel/ios/BasketPage.java | ac85e24e4f86b946f9b6e84b6ec23d4205a52054 | [] | no_license | tutkudemircioglu/GetirStudy | https://github.com/tutkudemircioglu/GetirStudy | 1e19399ec9bb022fa6637122293a2b11e6e244de | 7fd4dca98803fb05b17a0e7ca97f3d8861f4a52b | refs/heads/main | "2023-02-01T04:44:11.508000" | "2020-12-20T14:58:08" | "2020-12-20T14:58:08" | 323,095,857 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tutku.getirTest.pagemodel.ios;
import com.tutku.getirTest.pagemodel.contracts.IBasketPage;
import com.tutku.getirTest.util.Util;
public class BasketPage extends Util implements IBasketPage {
@Override
public void checkProductOnBasket() {
}
@Override
public void clickRemoveButton() {
}
@Override
public void checkRemovedProduct() {
}
@Override
public void clickPaymentButton() {
}
@Override
public void productIncreased() {
}
@Override
public void checkProductIncreased() {
}
}
| UTF-8 | Java | 576 | java | BasketPage.java | Java | [] | null | [] | package com.tutku.getirTest.pagemodel.ios;
import com.tutku.getirTest.pagemodel.contracts.IBasketPage;
import com.tutku.getirTest.util.Util;
public class BasketPage extends Util implements IBasketPage {
@Override
public void checkProductOnBasket() {
}
@Override
public void clickRemoveButton() {
}
@Override
public void checkRemovedProduct() {
}
@Override
public void clickPaymentButton() {
}
@Override
public void productIncreased() {
}
@Override
public void checkProductIncreased() {
}
}
| 576 | 0.678819 | 0.678819 | 37 | 14.567568 | 18.423752 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.081081 | false | false | 1 |
6a48adc6bc3df26def72d7c23b01c601780789b3 | 36,421,322,690,095 | 995c1686f1c2dabd4d4b8deac2a66ad97849ed4a | /src/main/java/com/huivip/dao/SelectRoomDao.java | ef4fd36c431d5731bc5a48c5771485f508a7e694 | [] | no_license | laihui0207/jwsystem | https://github.com/laihui0207/jwsystem | 17477a16bae002bb829ae8300d015e03a8329993 | e4e118718fd90106a97e8be9d5dea7c15da58b6a | refs/heads/master | "2019-01-01T09:28:12.147000" | "2017-04-01T02:15:03" | "2017-04-01T02:15:03" | 8,537,377 | 0 | 0 | null | false | "2017-04-01T02:11:56" | "2013-03-03T14:34:32" | "2014-09-04T17:11:54" | "2017-04-01T02:11:10" | 83,616 | 0 | 0 | 1 | JavaScript | null | null | package com.huivip.dao;
import com.huivip.model.SelectRoom;
import com.huivip.model.SelectRoomId;
import java.util.List;
import java.util.Map;
/**
* An interface that provides a data management interface to the SelectRoom table.
*/
public interface SelectRoomDao extends GenericDao<SelectRoom, SelectRoomId> {
public List<SelectRoom> getMySelectRoom(Long userId);
public List<SelectRoom> getSelectRoomByClassLeader(Long classLeaderId);
public List<Object[]> selectRoomSum(Map params);
public SelectRoom get(Long studentId,Long roomScheduleId);
public int getSelectCount(Long roomScheduleId);
public List<SelectRoom> selectRoomList(Map params);
} | UTF-8 | Java | 674 | java | SelectRoomDao.java | Java | [] | null | [] | package com.huivip.dao;
import com.huivip.model.SelectRoom;
import com.huivip.model.SelectRoomId;
import java.util.List;
import java.util.Map;
/**
* An interface that provides a data management interface to the SelectRoom table.
*/
public interface SelectRoomDao extends GenericDao<SelectRoom, SelectRoomId> {
public List<SelectRoom> getMySelectRoom(Long userId);
public List<SelectRoom> getSelectRoomByClassLeader(Long classLeaderId);
public List<Object[]> selectRoomSum(Map params);
public SelectRoom get(Long studentId,Long roomScheduleId);
public int getSelectCount(Long roomScheduleId);
public List<SelectRoom> selectRoomList(Map params);
} | 674 | 0.78635 | 0.78635 | 19 | 34.526318 | 28.208563 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 1 |
6d866f877c3351e73ee4763675ad72d0e9693dd7 | 25,967,372,323,220 | 62ee9494a6961c0d3a30db12e97dc182b7b0b33e | /src/main/java/com/linewell/error/ErrorCodes.java | e47665f88560c35c4849d3fa2988122d4fdaa336 | [] | no_license | wyp001/k8s | https://github.com/wyp001/k8s | e969a9bbca9922c5bbb548d856f223ce864e0b4e | c50e8ecf3b49ff947f04202f2874f34c8b2475b1 | refs/heads/master | "2020-06-17T01:35:30.630000" | "2019-07-12T03:59:52" | "2019-07-12T03:59:52" | 195,756,837 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.linewell.error;
import io.fabric8.kubernetes.api.model.Endpoints;
public enum ErrorCodes {
NAMESPACE_NOT_FOUND_ERROR(1001,"[%s]命名空间不存在"),
POD_NOT_FOUND_ERROR(2001,"[%s]pod不存在"),
POD_ALREAD_EXIST_ERROR(2002,"[%s]pod已存在"),
SERICE_NOT_FOUND_ERROR(3001,"[%s]服务不存在"),
SERVICE_ALREAD_EXIST_ERROR(3002,"[%s]服务已存在"),
RESOUCRE_ERROR(4001,"资源文件异常;原因:[%s]"),
DEPLOYMENT_ALREAD_EXIST_ERROR(5001,"[%s]deployment已存在"),
DEPLOYMENT_NOT_FOUND_ERROR(5002,"[%s]deployment不存在"),
JOB_NOT_FOUND_ERROR(6001,"[%s]job不存在"),
JOB_ALREADY_EXIST_ERROR(6002,"[%s]已存在"),
ENDPOINTS_NOT_FOUND_ERROR(7001,"[%s]endpoints不存在"),
ENDPOINTS_ALREADY_EXIST_ERROR(7002,"[%s]endpoints已存在"),
SECRET_NOT_FOUND_ERROR(8001,"[%s]secret不存在"),
SECRET_ALREADY_EXIST_ERROR(8002,"[%s]secret已存在"),
PV_NOT_FOUND_ERROR(9001,"[%s]pv不存在"),
PV_ALREADY_EXIST_ERROR(9002,"[%s]pv已存在"),
PVC_NOT_FOUND_ERROR(9003,"[%s]pvc不存在"),
PVC_ALREADY_EXIST_ERROR(9004,"[%s]pvc已存在"),
QUOTA_NOT_FOUND_ERROR(1101,"[%s]quota不存在"),
QUOTA_ALREADY_EXIST_ERROR(1102,"[%s]quota已存在");
private int code;
private String msg;
ErrorCodes(int code, String msg) {
this.code = code;
this.msg = msg;
}
public ErrorCodes format(Object... args){
this.msg = String.format(this.msg,args);
return this;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
@Override
public String toString() {
return "ErrorCodes{" +
"code=" + code +
", msg='" + msg + '\'' +
'}';
}
}
| UTF-8 | Java | 1,949 | java | ErrorCodes.java | Java | [] | null | [] | package com.linewell.error;
import io.fabric8.kubernetes.api.model.Endpoints;
public enum ErrorCodes {
NAMESPACE_NOT_FOUND_ERROR(1001,"[%s]命名空间不存在"),
POD_NOT_FOUND_ERROR(2001,"[%s]pod不存在"),
POD_ALREAD_EXIST_ERROR(2002,"[%s]pod已存在"),
SERICE_NOT_FOUND_ERROR(3001,"[%s]服务不存在"),
SERVICE_ALREAD_EXIST_ERROR(3002,"[%s]服务已存在"),
RESOUCRE_ERROR(4001,"资源文件异常;原因:[%s]"),
DEPLOYMENT_ALREAD_EXIST_ERROR(5001,"[%s]deployment已存在"),
DEPLOYMENT_NOT_FOUND_ERROR(5002,"[%s]deployment不存在"),
JOB_NOT_FOUND_ERROR(6001,"[%s]job不存在"),
JOB_ALREADY_EXIST_ERROR(6002,"[%s]已存在"),
ENDPOINTS_NOT_FOUND_ERROR(7001,"[%s]endpoints不存在"),
ENDPOINTS_ALREADY_EXIST_ERROR(7002,"[%s]endpoints已存在"),
SECRET_NOT_FOUND_ERROR(8001,"[%s]secret不存在"),
SECRET_ALREADY_EXIST_ERROR(8002,"[%s]secret已存在"),
PV_NOT_FOUND_ERROR(9001,"[%s]pv不存在"),
PV_ALREADY_EXIST_ERROR(9002,"[%s]pv已存在"),
PVC_NOT_FOUND_ERROR(9003,"[%s]pvc不存在"),
PVC_ALREADY_EXIST_ERROR(9004,"[%s]pvc已存在"),
QUOTA_NOT_FOUND_ERROR(1101,"[%s]quota不存在"),
QUOTA_ALREADY_EXIST_ERROR(1102,"[%s]quota已存在");
private int code;
private String msg;
ErrorCodes(int code, String msg) {
this.code = code;
this.msg = msg;
}
public ErrorCodes format(Object... args){
this.msg = String.format(this.msg,args);
return this;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
@Override
public String toString() {
return "ErrorCodes{" +
"code=" + code +
", msg='" + msg + '\'' +
'}';
}
}
| 1,949 | 0.592551 | 0.547526 | 74 | 23.31081 | 20.280416 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.756757 | false | false | 1 |
5dcd4b13094d7c1079a27fb41a3552f60a72086f | 8,443,905,746,057 | df9195d559de0d603196956ce20a3fdc496beefe | /src/main/java/com/prime/keeper/assessment/exception/transaction/PerTransactionLimitException.java | a65ab23f952ebecd560faccea1a162e648093213 | [] | no_license | kenovan/prime-keeper-assessment | https://github.com/kenovan/prime-keeper-assessment | 8ebff932fb492be0845a3d5a8c25287e75425e0f | 86daa672357bdbea326b2acbf745b4bd3846a19a | refs/heads/master | "2020-03-14T03:10:15.042000" | "2018-04-29T10:02:14" | "2018-04-29T10:02:14" | 131,414,463 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.prime.keeper.assessment.exception.transaction;
public class PerTransactionLimitException extends Exception {
private static final long serialVersionUID = 558041328191403723L;
public PerTransactionLimitException(String message) {
super(message);
}
}
| UTF-8 | Java | 279 | java | PerTransactionLimitException.java | Java | [] | null | [] | package com.prime.keeper.assessment.exception.transaction;
public class PerTransactionLimitException extends Exception {
private static final long serialVersionUID = 558041328191403723L;
public PerTransactionLimitException(String message) {
super(message);
}
}
| 279 | 0.795699 | 0.731183 | 10 | 25.9 | 28.183151 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 1 |
6f53951c8e7f0d32cb9fd0cdbd70358868553a77 | 29,626,684,461,573 | 7ff6753e054bab24417ed62205ce31167315ffdd | /src/main/java/Dormidos_Pizza.java | 69ff3697031093e273b53097168301621c645fc0 | [] | no_license | Frnn4268/Dormido-s-Pizza | https://github.com/Frnn4268/Dormido-s-Pizza | fdc3f42e0ea1ead1d608d4ec6065c5e81030ac73 | a808efa62b41ab3b2f87ade0f10fccde7cd5fdf5 | refs/heads/master | "2023-05-29T18:57:15.876000" | "2021-06-14T00:42:25" | "2021-06-14T00:42:25" | 376,667,755 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
import javax.swing.JOptionPane;
public class Dormidos_Pizza extends javax.swing.JFrame {
ArrayList<Pizza_Class> lista0 = new ArrayList<Pizza_Class>();
ArrayList<Suc_Gua> lista1 = new ArrayList<Suc_Gua>();
ArrayList<Suc_Pro> lista2 = new ArrayList<Suc_Pro>();
ArrayList<Suc_Jal> lista3 = new ArrayList<Suc_Jal>();
ArrayList<Pizza_Orden> listaOr = new ArrayList<Pizza_Orden>();
public Dormidos_Pizza() {
try{
initComponents();
mostrar();
Pizzas_OrTable();
Mostrar_PizzasG();
Mostrar_PizzasP();
Mostrar_PizzasJ();
JOptionPane.showMessageDialog(null, "Bienvenido a Dormido´s Pizza");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error al mostrar datos");
}
}
private void Limpiar(){
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
}
public void Pizza(){
try {
Pizza_Class nuevaPizza = new Pizza_Class();
nuevaPizza.setNombreP(txtNombre.getText().toString());
nuevaPizza.setDescripcionP(txtDescripcion.getText().toString());
nuevaPizza.setPrecioP(txtPrecio.getText().toString());
lista0.add(nuevaPizza);
mostrar();
JOptionPane.showMessageDialog(null, "Se ha guardado correctamente la Pizza");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void mostrar(){
String matriz[][] = new String[lista0.size()][10];
for(int i = 0; i < lista0.size(); i++){
matriz[i][0] = lista0.get(i).getNombreP();
matriz[i][1] = lista0.get(i).getDescripcionP();
matriz[i][2] = lista0.get(i).getPrecioP();
}
TablaAdmin.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Nombre", "Descripción", "Precio"
}
));
}
public void Pizzas_G(){
try{
Suc_Gua nuevaPizzaG = new Suc_Gua();
nuevaPizzaG.setNombre_pizzaG(txtNombre.getText().toString());
nuevaPizzaG.setDescripcionG(txtDescripcion.getText().toString());
nuevaPizzaG.setPrecioG(txtPrecio.getText().toString());
lista1.add(nuevaPizzaG);
Pizzas_GTable();
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
JOptionPane.showMessageDialog(null, "Pizza guardada en la Sucursal de Guatemala");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_GTable(){
String matriz[][] = new String[lista1.size()][10];
for(int i = 0; i < lista1.size(); i++){
matriz[i][0] = lista1.get(i).getNombre_pizzaG();
matriz[i][1] = lista1.get(i).getDescripcionG();
matriz[i][2] = lista1.get(i).getPrecioG();
}
}
public void Pizzas_P(){
try{
Suc_Pro nuevaPizzaP = new Suc_Pro();
nuevaPizzaP.setNombre_pizzaP(txtNombre.getText().toString());
nuevaPizzaP.setDescripcionP(txtDescripcion.getText().toString());
nuevaPizzaP.setPrecioP(txtPrecio.getText().toString());
lista2.add(nuevaPizzaP);
Pizzas_PTable();
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
JOptionPane.showMessageDialog(null, "Pizza guardada en la Sucursal de El Progreso");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_PTable(){
String matriz[][] = new String[lista2.size()][10];
for(int i = 0; i < lista2.size(); i++){
matriz[i][0] = lista2.get(i).getNombre_pizzaP();
matriz[i][1] = lista2.get(i).getDescripcionP();
matriz[i][2] = lista2.get(i).getPrecioP();
}
}
public void Pizzas_J(){
try{
Suc_Jal nuevaPizzaJ = new Suc_Jal();
nuevaPizzaJ.setNombre_pizzaJ(txtNombre.getText().toString());
nuevaPizzaJ.setDescripcionJ(txtDescripcion.getText().toString());
nuevaPizzaJ.setPrecioJ(txtPrecio.getText().toString());
lista3.add(nuevaPizzaJ);
Pizzas_JTable();
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
JOptionPane.showMessageDialog(null, "Pizza guardada en la Sucursal de Jalapa");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_JTable(){
String matriz[][] = new String[lista3.size()][10];
for(int i = 0; i < lista3.size(); i++){
matriz[i][0] = lista3.get(i).getNombre_pizzaJ();
matriz[i][1] = lista3.get(i).getDescripcionJ();
matriz[i][2] = lista3.get(i).getPrecioJ();
}
}
public void Mostrar_PizzasG(){
String matriz[][] = new String[lista1.size()][5];
for(int i = 0; i < lista1.size(); i++){
matriz[i][0] = lista1.get(i).getNombre_pizzaG();
matriz[i][1] = lista1.get(i).getDescripcionG();
matriz[i][2] = lista1.get(i).getSucursalGua();
}
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Pizza's", "ordenes", "Guatemala"
}
));
}
public void Mostrar_PizzasP(){
String matriz[][] = new String[lista2.size()][10];
for(int i = 0; i < lista2.size(); i++){
matriz[i][0] = lista2.get(i).getNombre_pizzaP();
matriz[i][1] = lista2.get(i).getDescripcionP();
matriz[i][2] = lista2.get(i).getSucursalPro();
}
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Pizza's", "ordenes", "El Progreso"
}
));
}
public void Mostrar_PizzasJ(){
String matriz[][] = new String[lista3.size()][5];
for(int i = 0; i < lista3.size(); i++){
matriz[i][0] = lista3.get(i).getNombre_pizzaJ();
matriz[i][1] = lista3.get(i).getDescripcionJ();
matriz[i][2] = lista3.get(i).getSucursalJal();
}
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Pizza's", "ordenes", "Jalapa"
}
));
}
public void Pizzas_Orden(){
try{
Pizza_Orden nuevaPizzaOr = new Pizza_Orden();
nuevaPizzaOr.setNombre_ordenP(txtPizza.getText().toString());
nuevaPizzaOr.setDescripcion_ordenP(txtDescription.getText().toString());
nuevaPizzaOr.setSucursal_P(txtSucursal.getText().toString());
listaOr.add(nuevaPizzaOr);
Pizzas_OrTable();
txtPizza.setText("");
txtDescription.setText("");
txtSucursal.setText("");
JOptionPane.showMessageDialog(null, "Pizza ordenada!");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_OrTable(){
String matriz[][] = new String[listaOr.size()][10];
for (int i = 0; i < listaOr.size(); i++) {
matriz[i][0] = listaOr.get(i).getNombre_ordenP();
matriz[i][1] = listaOr.get(i).getDescripcion_ordenP();
matriz[i][2] = listaOr.get(i).getSucursal_P();
}
TablaOrden.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String[]{
"Pizza", "Descripción", "Sucursal"
}
));
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel10 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtNombre = new javax.swing.JTextField();
txtPrecio = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtDescripcion = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
TablaAdmin = new javax.swing.JTable();
jPanel2 = new javax.swing.JPanel();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
TablaPizzas = new javax.swing.JTable();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jScrollPane4 = new javax.swing.JScrollPane();
txtDescription = new javax.swing.JTextPane();
jLabel7 = new javax.swing.JLabel();
jButton9 = new javax.swing.JButton();
jScrollPane5 = new javax.swing.JScrollPane();
TablaOrden = new javax.swing.JTable();
txtPizza = new javax.swing.JTextField();
txtSucursal = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
jLabel16 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
jLabel10.setText("jLabel10");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Dormido´s Pizza");
setBackground(new java.awt.Color(204, 204, 204));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setName("Dormido´s Pizza"); // NOI18N
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(51, 51, 51));
jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jPanel1.setForeground(new java.awt.Color(51, 51, 51));
jLabel1.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Nombre:");
jLabel2.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Precio:");
jLabel3.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Descripción:");
jButton2.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setFont(new java.awt.Font("Lucida Bright", 1, 11)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\recycle bin.png")); // NOI18N
jButton2.setText("Limpiar");
jButton2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel4.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Guardar en:");
jButton3.setBackground(new java.awt.Color(255, 255, 255));
jButton3.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton3.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\one.png")); // NOI18N
jButton3.setText("Guatemala");
jButton3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setBackground(new java.awt.Color(255, 255, 255));
jButton4.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton4.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\two.png")); // NOI18N
jButton4.setText("El Progreso");
jButton4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setBackground(new java.awt.Color(255, 255, 255));
jButton5.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton5.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\three.png")); // NOI18N
jButton5.setText("Jalapa");
jButton5.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton1.setBackground(new java.awt.Color(255, 255, 255));
jButton1.setFont(new java.awt.Font("Lucida Bright", 1, 11)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\accept.png")); // NOI18N
jButton1.setText("Crear");
jButton1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
TablaAdmin.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
TablaAdmin.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
TablaAdmin.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Nombre", "Descripción", "Precio"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane2.setViewportView(TablaAdmin);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtDescripcion)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(215, 215, 215))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(30, 30, 30)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton4)
.addComponent(jButton5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, 390, 400));
jPanel2.setBackground(new java.awt.Color(51, 51, 51));
jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton6.setBackground(new java.awt.Color(255, 255, 255));
jButton6.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton6.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\one.png")); // NOI18N
jButton6.setText("Guatemala");
jButton6.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setBackground(new java.awt.Color(255, 255, 255));
jButton7.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton7.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\two.png")); // NOI18N
jButton7.setText("El Progreso");
jButton7.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setBackground(new java.awt.Color(255, 255, 255));
jButton8.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton8.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\three.png")); // NOI18N
jButton8.setText("Jalapa");
jButton8.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
TablaPizzas.setBorder(javax.swing.BorderFactory.createEtchedBorder());
TablaPizzas.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Tabla de", "Pizza´s", ""
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
TablaPizzas.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
TablaPizzasMouseClicked(evt);
}
});
jScrollPane3.setViewportView(TablaPizzas);
jLabel5.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("Pizza:");
jLabel6.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("Descripción:");
txtDescription.setEditable(false);
jScrollPane4.setViewportView(txtDescription);
jButton9.setBackground(new java.awt.Color(255, 255, 255));
jButton9.setFont(new java.awt.Font("Lucida Bright", 1, 11)); // NOI18N
jButton9.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\pizza.png")); // NOI18N
jButton9.setText("Ordenar");
jButton9.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
TablaOrden.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
TablaOrden.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
TablaOrden.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Pizza", "Descripción", "Sucursal"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
TablaOrden.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
TablaOrdenMouseClicked(evt);
}
});
jScrollPane5.setViewportView(TablaOrden);
txtPizza.setEditable(false);
txtSucursal.setEditable(false);
jLabel8.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Sucursal:");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
.addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(txtSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtPizza, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))))
.addGap(1566, 1566, 1566)))
.addComponent(jLabel7))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton7)
.addGap(15, 15, 15)
.addComponent(jButton8))
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(txtPizza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(25, 25, 25)
.addComponent(jButton9)
.addGap(18, 18, 18)
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(88, 88, 88))
);
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 140, 390, 400));
jPanel3.setBackground(new java.awt.Color(255, 255, 255));
jLabel9.setBackground(new java.awt.Color(255, 255, 255));
jLabel9.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\logo.png")); // NOI18N
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 21, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
);
getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, -30, 150, 160));
jPanel4.setBackground(new java.awt.Color(204, 204, 204));
jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel11.setFont(new java.awt.Font("MingLiU_HKSCS-ExtB", 1, 24)); // NOI18N
jLabel11.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\administration.png")); // NOI18N
jLabel11.setText("Administración");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGap(0, 0, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel11)
.addContainerGap())
);
getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 220, 50));
jPanel5.setBackground(new java.awt.Color(204, 204, 204));
jPanel5.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel12.setFont(new java.awt.Font("MingLiU_HKSCS-ExtB", 1, 24)); // NOI18N
jLabel12.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\order.png")); // NOI18N
jLabel12.setText("Ordenes");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel12)
.addContainerGap(79, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel12)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 90, 220, 50));
getContentPane().add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jPanel6.setBackground(new java.awt.Color(204, 204, 204));
jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jPanel6.setToolTipText("");
jLabel16.setFont(new java.awt.Font("Segoe UI Semibold", 1, 36)); // NOI18N
jLabel16.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\dp.png")); // NOI18N
jLabel16.setText("Dormido´s Pizza");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(100, 100, 100)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(83, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
getContentPane().add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 20, 500, 50));
jLabel14.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\baner.jpg")); // NOI18N
getContentPane().add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 840, 550));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Pizzas_G();
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Limpiar();
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
Pizzas_P();
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
Pizzas_J();
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
Pizza();
}//GEN-LAST:event_jButton1ActionPerformed
private void TablaOrdenMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaOrdenMouseClicked
}//GEN-LAST:event_TablaOrdenMouseClicked
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
Pizzas_Orden();
}//GEN-LAST:event_jButton9ActionPerformed
private void TablaPizzasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaPizzasMouseClicked
int fila = TablaPizzas.rowAtPoint(evt.getPoint());
txtPizza.setText(String.valueOf(TablaPizzas.getValueAt(fila, 0)));
txtDescription.setText(String.valueOf(TablaPizzas.getValueAt(fila, 1)));
txtSucursal.setText(String.valueOf(TablaPizzas.getValueAt(fila, 2)));
}//GEN-LAST:event_TablaPizzasMouseClicked
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
Mostrar_PizzasJ();
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
Mostrar_PizzasP();
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
Mostrar_PizzasG();
}//GEN-LAST:event_jButton6ActionPerformed
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Dormidos_Pizza().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTable TablaAdmin;
private javax.swing.JTable TablaOrden;
private javax.swing.JTable TablaPizzas;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtDescripcion;
private javax.swing.JTextPane txtDescription;
private javax.swing.JTextField txtNombre;
private javax.swing.JTextField txtPizza;
private javax.swing.JTextField txtPrecio;
private javax.swing.JTextField txtSucursal;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 44,604 | java | Dormidos_Pizza.java | Java | [
{
"context": "\\\\one.png\")); // NOI18N\n jButton3.setText(\"Guatemala\");\n jButton3.setBorder(new javax.swing.bor",
"end": 13567,
"score": 0.9379699230194092,
"start": 13558,
"tag": "NAME",
"value": "Guatemala"
},
{
"context": "hree.png\")); // NOI18N\n jButton5.setText(\"Jalapa\");\n jButton5.setBorder(new javax.swing.bor",
"end": 14850,
"score": 0.6635286808013916,
"start": 14845,
"tag": "NAME",
"value": "alapa"
}
] | null | [] | import java.util.ArrayList;
import javax.swing.JOptionPane;
public class Dormidos_Pizza extends javax.swing.JFrame {
ArrayList<Pizza_Class> lista0 = new ArrayList<Pizza_Class>();
ArrayList<Suc_Gua> lista1 = new ArrayList<Suc_Gua>();
ArrayList<Suc_Pro> lista2 = new ArrayList<Suc_Pro>();
ArrayList<Suc_Jal> lista3 = new ArrayList<Suc_Jal>();
ArrayList<Pizza_Orden> listaOr = new ArrayList<Pizza_Orden>();
public Dormidos_Pizza() {
try{
initComponents();
mostrar();
Pizzas_OrTable();
Mostrar_PizzasG();
Mostrar_PizzasP();
Mostrar_PizzasJ();
JOptionPane.showMessageDialog(null, "Bienvenido a Dormido´s Pizza");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error al mostrar datos");
}
}
private void Limpiar(){
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
}
public void Pizza(){
try {
Pizza_Class nuevaPizza = new Pizza_Class();
nuevaPizza.setNombreP(txtNombre.getText().toString());
nuevaPizza.setDescripcionP(txtDescripcion.getText().toString());
nuevaPizza.setPrecioP(txtPrecio.getText().toString());
lista0.add(nuevaPizza);
mostrar();
JOptionPane.showMessageDialog(null, "Se ha guardado correctamente la Pizza");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void mostrar(){
String matriz[][] = new String[lista0.size()][10];
for(int i = 0; i < lista0.size(); i++){
matriz[i][0] = lista0.get(i).getNombreP();
matriz[i][1] = lista0.get(i).getDescripcionP();
matriz[i][2] = lista0.get(i).getPrecioP();
}
TablaAdmin.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Nombre", "Descripción", "Precio"
}
));
}
public void Pizzas_G(){
try{
Suc_Gua nuevaPizzaG = new Suc_Gua();
nuevaPizzaG.setNombre_pizzaG(txtNombre.getText().toString());
nuevaPizzaG.setDescripcionG(txtDescripcion.getText().toString());
nuevaPizzaG.setPrecioG(txtPrecio.getText().toString());
lista1.add(nuevaPizzaG);
Pizzas_GTable();
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
JOptionPane.showMessageDialog(null, "Pizza guardada en la Sucursal de Guatemala");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_GTable(){
String matriz[][] = new String[lista1.size()][10];
for(int i = 0; i < lista1.size(); i++){
matriz[i][0] = lista1.get(i).getNombre_pizzaG();
matriz[i][1] = lista1.get(i).getDescripcionG();
matriz[i][2] = lista1.get(i).getPrecioG();
}
}
public void Pizzas_P(){
try{
Suc_Pro nuevaPizzaP = new Suc_Pro();
nuevaPizzaP.setNombre_pizzaP(txtNombre.getText().toString());
nuevaPizzaP.setDescripcionP(txtDescripcion.getText().toString());
nuevaPizzaP.setPrecioP(txtPrecio.getText().toString());
lista2.add(nuevaPizzaP);
Pizzas_PTable();
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
JOptionPane.showMessageDialog(null, "Pizza guardada en la Sucursal de El Progreso");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_PTable(){
String matriz[][] = new String[lista2.size()][10];
for(int i = 0; i < lista2.size(); i++){
matriz[i][0] = lista2.get(i).getNombre_pizzaP();
matriz[i][1] = lista2.get(i).getDescripcionP();
matriz[i][2] = lista2.get(i).getPrecioP();
}
}
public void Pizzas_J(){
try{
Suc_Jal nuevaPizzaJ = new Suc_Jal();
nuevaPizzaJ.setNombre_pizzaJ(txtNombre.getText().toString());
nuevaPizzaJ.setDescripcionJ(txtDescripcion.getText().toString());
nuevaPizzaJ.setPrecioJ(txtPrecio.getText().toString());
lista3.add(nuevaPizzaJ);
Pizzas_JTable();
txtNombre.setText("");
txtPrecio.setText("");
txtDescripcion.setText("");
JOptionPane.showMessageDialog(null, "Pizza guardada en la Sucursal de Jalapa");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_JTable(){
String matriz[][] = new String[lista3.size()][10];
for(int i = 0; i < lista3.size(); i++){
matriz[i][0] = lista3.get(i).getNombre_pizzaJ();
matriz[i][1] = lista3.get(i).getDescripcionJ();
matriz[i][2] = lista3.get(i).getPrecioJ();
}
}
public void Mostrar_PizzasG(){
String matriz[][] = new String[lista1.size()][5];
for(int i = 0; i < lista1.size(); i++){
matriz[i][0] = lista1.get(i).getNombre_pizzaG();
matriz[i][1] = lista1.get(i).getDescripcionG();
matriz[i][2] = lista1.get(i).getSucursalGua();
}
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Pizza's", "ordenes", "Guatemala"
}
));
}
public void Mostrar_PizzasP(){
String matriz[][] = new String[lista2.size()][10];
for(int i = 0; i < lista2.size(); i++){
matriz[i][0] = lista2.get(i).getNombre_pizzaP();
matriz[i][1] = lista2.get(i).getDescripcionP();
matriz[i][2] = lista2.get(i).getSucursalPro();
}
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Pizza's", "ordenes", "El Progreso"
}
));
}
public void Mostrar_PizzasJ(){
String matriz[][] = new String[lista3.size()][5];
for(int i = 0; i < lista3.size(); i++){
matriz[i][0] = lista3.get(i).getNombre_pizzaJ();
matriz[i][1] = lista3.get(i).getDescripcionJ();
matriz[i][2] = lista3.get(i).getSucursalJal();
}
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String [] {
"Pizza's", "ordenes", "Jalapa"
}
));
}
public void Pizzas_Orden(){
try{
Pizza_Orden nuevaPizzaOr = new Pizza_Orden();
nuevaPizzaOr.setNombre_ordenP(txtPizza.getText().toString());
nuevaPizzaOr.setDescripcion_ordenP(txtDescription.getText().toString());
nuevaPizzaOr.setSucursal_P(txtSucursal.getText().toString());
listaOr.add(nuevaPizzaOr);
Pizzas_OrTable();
txtPizza.setText("");
txtDescription.setText("");
txtSucursal.setText("");
JOptionPane.showMessageDialog(null, "Pizza ordenada!");
} catch (Exception e){
JOptionPane.showMessageDialog(null, "Error");
}
}
public void Pizzas_OrTable(){
String matriz[][] = new String[listaOr.size()][10];
for (int i = 0; i < listaOr.size(); i++) {
matriz[i][0] = listaOr.get(i).getNombre_ordenP();
matriz[i][1] = listaOr.get(i).getDescripcion_ordenP();
matriz[i][2] = listaOr.get(i).getSucursal_P();
}
TablaOrden.setModel(new javax.swing.table.DefaultTableModel(
matriz,
new String[]{
"Pizza", "Descripción", "Sucursal"
}
));
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel10 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtNombre = new javax.swing.JTextField();
txtPrecio = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtDescripcion = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
TablaAdmin = new javax.swing.JTable();
jPanel2 = new javax.swing.JPanel();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
TablaPizzas = new javax.swing.JTable();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jScrollPane4 = new javax.swing.JScrollPane();
txtDescription = new javax.swing.JTextPane();
jLabel7 = new javax.swing.JLabel();
jButton9 = new javax.swing.JButton();
jScrollPane5 = new javax.swing.JScrollPane();
TablaOrden = new javax.swing.JTable();
txtPizza = new javax.swing.JTextField();
txtSucursal = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
jLabel16 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
jLabel10.setText("jLabel10");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Dormido´s Pizza");
setBackground(new java.awt.Color(204, 204, 204));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setName("Dormido´s Pizza"); // NOI18N
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(51, 51, 51));
jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jPanel1.setForeground(new java.awt.Color(51, 51, 51));
jLabel1.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Nombre:");
jLabel2.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Precio:");
jLabel3.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Descripción:");
jButton2.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setFont(new java.awt.Font("Lucida Bright", 1, 11)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\recycle bin.png")); // NOI18N
jButton2.setText("Limpiar");
jButton2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel4.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Guardar en:");
jButton3.setBackground(new java.awt.Color(255, 255, 255));
jButton3.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton3.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\one.png")); // NOI18N
jButton3.setText("Guatemala");
jButton3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setBackground(new java.awt.Color(255, 255, 255));
jButton4.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton4.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\two.png")); // NOI18N
jButton4.setText("El Progreso");
jButton4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setBackground(new java.awt.Color(255, 255, 255));
jButton5.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton5.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\three.png")); // NOI18N
jButton5.setText("Jalapa");
jButton5.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton1.setBackground(new java.awt.Color(255, 255, 255));
jButton1.setFont(new java.awt.Font("Lucida Bright", 1, 11)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\accept.png")); // NOI18N
jButton1.setText("Crear");
jButton1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
TablaAdmin.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
TablaAdmin.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
TablaAdmin.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Nombre", "Descripción", "Precio"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane2.setViewportView(TablaAdmin);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtDescripcion)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(215, 215, 215))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(30, 30, 30)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton4)
.addComponent(jButton5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, 390, 400));
jPanel2.setBackground(new java.awt.Color(51, 51, 51));
jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton6.setBackground(new java.awt.Color(255, 255, 255));
jButton6.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton6.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\one.png")); // NOI18N
jButton6.setText("Guatemala");
jButton6.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setBackground(new java.awt.Color(255, 255, 255));
jButton7.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton7.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\two.png")); // NOI18N
jButton7.setText("El Progreso");
jButton7.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setBackground(new java.awt.Color(255, 255, 255));
jButton8.setFont(new java.awt.Font("Lucida Bright", 1, 10)); // NOI18N
jButton8.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\three.png")); // NOI18N
jButton8.setText("Jalapa");
jButton8.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
TablaPizzas.setBorder(javax.swing.BorderFactory.createEtchedBorder());
TablaPizzas.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
TablaPizzas.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Tabla de", "Pizza´s", ""
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
TablaPizzas.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
TablaPizzasMouseClicked(evt);
}
});
jScrollPane3.setViewportView(TablaPizzas);
jLabel5.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("Pizza:");
jLabel6.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("Descripción:");
txtDescription.setEditable(false);
jScrollPane4.setViewportView(txtDescription);
jButton9.setBackground(new java.awt.Color(255, 255, 255));
jButton9.setFont(new java.awt.Font("Lucida Bright", 1, 11)); // NOI18N
jButton9.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\pizza.png")); // NOI18N
jButton9.setText("Ordenar");
jButton9.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
TablaOrden.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
TablaOrden.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
TablaOrden.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Pizza", "Descripción", "Sucursal"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
TablaOrden.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
TablaOrdenMouseClicked(evt);
}
});
jScrollPane5.setViewportView(TablaOrden);
txtPizza.setEditable(false);
txtSucursal.setEditable(false);
jLabel8.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Sucursal:");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
.addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(txtSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtPizza, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))))
.addGap(1566, 1566, 1566)))
.addComponent(jLabel7))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton7)
.addGap(15, 15, 15)
.addComponent(jButton8))
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(txtPizza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(25, 25, 25)
.addComponent(jButton9)
.addGap(18, 18, 18)
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(88, 88, 88))
);
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 140, 390, 400));
jPanel3.setBackground(new java.awt.Color(255, 255, 255));
jLabel9.setBackground(new java.awt.Color(255, 255, 255));
jLabel9.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\logo.png")); // NOI18N
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 21, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
);
getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, -30, 150, 160));
jPanel4.setBackground(new java.awt.Color(204, 204, 204));
jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel11.setFont(new java.awt.Font("MingLiU_HKSCS-ExtB", 1, 24)); // NOI18N
jLabel11.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\administration.png")); // NOI18N
jLabel11.setText("Administración");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGap(0, 0, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel11)
.addContainerGap())
);
getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 220, 50));
jPanel5.setBackground(new java.awt.Color(204, 204, 204));
jPanel5.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel12.setFont(new java.awt.Font("MingLiU_HKSCS-ExtB", 1, 24)); // NOI18N
jLabel12.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\order.png")); // NOI18N
jLabel12.setText("Ordenes");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel12)
.addContainerGap(79, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel12)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 90, 220, 50));
getContentPane().add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jPanel6.setBackground(new java.awt.Color(204, 204, 204));
jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jPanel6.setToolTipText("");
jLabel16.setFont(new java.awt.Font("Segoe UI Semibold", 1, 36)); // NOI18N
jLabel16.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\dp.png")); // NOI18N
jLabel16.setText("Dormido´s Pizza");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(100, 100, 100)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(83, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
getContentPane().add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 20, 500, 50));
jLabel14.setIcon(new javax.swing.ImageIcon("C:\\Users\\USUARIO\\Desktop\\Dormidos - Pizza\\images\\baner.jpg")); // NOI18N
getContentPane().add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 840, 550));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Pizzas_G();
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Limpiar();
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
Pizzas_P();
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
Pizzas_J();
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
Pizza();
}//GEN-LAST:event_jButton1ActionPerformed
private void TablaOrdenMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaOrdenMouseClicked
}//GEN-LAST:event_TablaOrdenMouseClicked
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
Pizzas_Orden();
}//GEN-LAST:event_jButton9ActionPerformed
private void TablaPizzasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaPizzasMouseClicked
int fila = TablaPizzas.rowAtPoint(evt.getPoint());
txtPizza.setText(String.valueOf(TablaPizzas.getValueAt(fila, 0)));
txtDescription.setText(String.valueOf(TablaPizzas.getValueAt(fila, 1)));
txtSucursal.setText(String.valueOf(TablaPizzas.getValueAt(fila, 2)));
}//GEN-LAST:event_TablaPizzasMouseClicked
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
Mostrar_PizzasJ();
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
Mostrar_PizzasP();
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
Mostrar_PizzasG();
}//GEN-LAST:event_jButton6ActionPerformed
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Dormidos_Pizza().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTable TablaAdmin;
private javax.swing.JTable TablaOrden;
private javax.swing.JTable TablaPizzas;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtDescripcion;
private javax.swing.JTextPane txtDescription;
private javax.swing.JTextField txtNombre;
private javax.swing.JTextField txtPizza;
private javax.swing.JTextField txtPrecio;
private javax.swing.JTextField txtSucursal;
// End of variables declaration//GEN-END:variables
}
| 44,604 | 0.622354 | 0.597798 | 894 | 48.879196 | 37.316784 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.883669 | false | false | 1 |
b7e7ca5945739c53423f6d0b29e9fc35c29eae58 | 11,493,332,548,651 | 49ddcf2a979ef152f0e1564fbd83ebbc349804ae | /src/main/java/com/pe/web/cine/app/service/SeatServiceImplement.java | d7cad8c19ebce1e56862214846adaac064da5ed5 | [] | no_license | marcosPorturas/ms-cinema-rest | https://github.com/marcosPorturas/ms-cinema-rest | 42713b99af9d41c5b7b7c9363e670f708e5253f1 | 51cd2d1cb8ac7931ce99d6a7e4d2ea89451fd3d3 | refs/heads/master | "2023-07-19T08:25:47.870000" | "2020-10-25T20:44:10" | "2020-10-25T20:44:10" | 302,395,644 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pe.web.cine.app.service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pe.web.cine.app.builder.ConvertBuilderRoom;
import com.pe.web.cine.app.dto.request.SeatRequest;
import com.pe.web.cine.app.dto.response.SeatResponse;
import com.pe.web.cine.app.entity.Seat;
import com.pe.web.cine.app.repository.SeatRepository;
import io.reactivex.Observable;
import io.reactivex.Single;
@Service
public class SeatServiceImplement implements SeatService{
@Autowired
SeatRepository seatRepository;
public Boolean getStatus(SeatRequest seatRequest) {
Boolean status = false;
if(seatRequest.getStatusSeat().equals("1"))status = true;
return status;
}
public List<SeatResponse> convertBuilderListSeatRespone(List<Seat> listSeat){
ConvertBuilderRoom convert = new ConvertBuilderRoom();
return convert.convertToListSeatResponse(listSeat);
}
@Override
public Single<List<SeatResponse>> updateSeatStatus(List<SeatRequest> listSeatRequest) {
// TODO Auto-generated method stub
List<Integer> idsSeat = new ArrayList<>();
listSeatRequest.forEach(seat->idsSeat.add(seat.getCodSeat()));
return Observable.fromIterable(listSeatRequest)
.map(seatRequest->{
Seat seat = seatRepository.findById(seatRequest.getCodSeat())
.orElse(null);
seat.setStatusSeat(getStatus(seatRequest));
return seatRepository.save(seat);
})
.toSortedList(Comparator.comparingInt(Seat::getCodSeat))
.map(this::convertBuilderListSeatRespone);
}
}
| UTF-8 | Java | 1,700 | java | SeatServiceImplement.java | Java | [] | null | [] | package com.pe.web.cine.app.service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pe.web.cine.app.builder.ConvertBuilderRoom;
import com.pe.web.cine.app.dto.request.SeatRequest;
import com.pe.web.cine.app.dto.response.SeatResponse;
import com.pe.web.cine.app.entity.Seat;
import com.pe.web.cine.app.repository.SeatRepository;
import io.reactivex.Observable;
import io.reactivex.Single;
@Service
public class SeatServiceImplement implements SeatService{
@Autowired
SeatRepository seatRepository;
public Boolean getStatus(SeatRequest seatRequest) {
Boolean status = false;
if(seatRequest.getStatusSeat().equals("1"))status = true;
return status;
}
public List<SeatResponse> convertBuilderListSeatRespone(List<Seat> listSeat){
ConvertBuilderRoom convert = new ConvertBuilderRoom();
return convert.convertToListSeatResponse(listSeat);
}
@Override
public Single<List<SeatResponse>> updateSeatStatus(List<SeatRequest> listSeatRequest) {
// TODO Auto-generated method stub
List<Integer> idsSeat = new ArrayList<>();
listSeatRequest.forEach(seat->idsSeat.add(seat.getCodSeat()));
return Observable.fromIterable(listSeatRequest)
.map(seatRequest->{
Seat seat = seatRepository.findById(seatRequest.getCodSeat())
.orElse(null);
seat.setStatusSeat(getStatus(seatRequest));
return seatRepository.save(seat);
})
.toSortedList(Comparator.comparingInt(Seat::getCodSeat))
.map(this::convertBuilderListSeatRespone);
}
}
| 1,700 | 0.750588 | 0.75 | 55 | 28.90909 | 24.791695 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false | 1 |
c5e9c01efe909b38e74aa1b3877ba1fdea6e4716 | 36,704,790,521,245 | e3525b420b7065feab8345d7670db7634e0c7261 | /AbstractFactory/factory/Factory.java | f7145404c010abfc77d09834912cf1dd3a65cfec | [] | no_license | huija/designPatternsByJava | https://github.com/huija/designPatternsByJava | 70d774ac773482e56efc6895d28c4b3fd97f6dc4 | c0fa322d95eec05bad1df1bf61576f47d7e0ee36 | refs/heads/master | "2021-08-07T21:46:38.757000" | "2020-04-22T05:24:47" | "2020-04-22T05:24:47" | 160,053,716 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package factory;
import items.*;
// 抽象工厂本身, 负责
public abstract class Factory {
// 根据类名任务下发给具体的Factory
public static Factory getFactory(String classname) {
Factory factory = null;
switch (classname) {
case "factory.ListFactory":
factory = new ListFactory();
break;
case "factory.TableFactory":
factory = new TableFactory();
break;
default:
System.err.println("没有找到 " + classname + "类!");
System.exit(-1);
}
return factory;
}
// 定义具体Factory需要实现的两个抽象零件和最终的抽象产品: 超链接Link类, 超链接外包装Tray类, 网页Page类
public abstract Link createLink(String caption, String url);
public abstract Tray createTray(String caption);
public abstract Page createPage(String title, String author);
}
| UTF-8 | Java | 985 | java | Factory.java | Java | [] | null | [] | package factory;
import items.*;
// 抽象工厂本身, 负责
public abstract class Factory {
// 根据类名任务下发给具体的Factory
public static Factory getFactory(String classname) {
Factory factory = null;
switch (classname) {
case "factory.ListFactory":
factory = new ListFactory();
break;
case "factory.TableFactory":
factory = new TableFactory();
break;
default:
System.err.println("没有找到 " + classname + "类!");
System.exit(-1);
}
return factory;
}
// 定义具体Factory需要实现的两个抽象零件和最终的抽象产品: 超链接Link类, 超链接外包装Tray类, 网页Page类
public abstract Link createLink(String caption, String url);
public abstract Tray createTray(String caption);
public abstract Page createPage(String title, String author);
}
| 985 | 0.594657 | 0.593496 | 30 | 27.700001 | 21.613499 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 1 |
4d31141e147ad00cbaa65854ef2bdac06b0aa65e | 22,093,311,811,398 | 7f66fbdcf9bd4a025edf601a35581769bfbf9d3f | /app/src/main/java/com/example/mayank/singleboom/MainActivity.java | 2480125b5757d7d293e0ad4d2cf257ace1c3c19d | [] | no_license | mowgli-m/singleBoom | https://github.com/mowgli-m/singleBoom | ee23bb83bf59757bf0c6c800678b1a9acf719fe0 | 158873cb346d4eabaab5d7f9e20a0706e5a2ce95 | refs/heads/master | "2021-01-11T23:22:35.929000" | "2017-01-17T21:09:31" | "2017-01-17T21:09:31" | 78,573,241 | 0 | 1 | null | false | "2017-01-17T11:54:09" | "2017-01-10T20:56:07" | "2017-01-10T20:58:03" | "2017-01-17T11:54:09" | 101 | 0 | 1 | 0 | Java | null | null | package com.example.mayank.singleboom;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Mayank on 1/16/2017.
*/
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.location.Location;
import android.os.AsyncTask;
import android.os.CountDownTimer;
import android.support.multidex.MultiDex;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.fitness.data.Application;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class MainActivity extends AppCompatActivity {
Button b;
public EditText passWord, eMail, name;
HttpClient client;
HttpPost post;
HttpResponse response;
// Context context;
public String res;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b = (Button) findViewById(R.id.button);
name = (EditText) findViewById(R.id.editText);
eMail = (EditText) findViewById(R.id.editText3);
passWord = (EditText) findViewById(R.id.editText2);
final Context context;
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("the but","is clicked");
new LoadTask().execute("http://192.168.43.3/signUp.php");
}
});
}
boolean makeConnection(String url) {
try {
client = new DefaultHttpClient();
final HttpParams httpParams = client.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 10000); // 10 seconds
HttpConnectionParams.setSoTimeout(httpParams, 10000);
post = new HttpPost("http://192.168.43.3/signUp.php");
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean generatePostRequest() {
try {
//String nameStr = name.toString();
String nameStr = "this is mayank the sex and handjob";
String eMailStr = "sex@600";//eMail.toString();
String passWordStr = "sexyy";//passWord.toString();
Log.e("this is email",eMailStr);
Log.e("this is pass",passWordStr);
Log.e("this is name",nameStr);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("name", nameStr));
nameValuePairs.add(new BasicNameValuePair("email", eMailStr));
nameValuePairs.add(new BasicNameValuePair("password", passWordStr));
/* List<NameValuePair> urlParameters = new ArrayList<NameValuePair>(1);
urlParameters.add(new BasicNameValuePair("name", name));
*/// urlParameters.add(new BasicNameValuePair("phone", aphone));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = client.execute(post);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
public String getRequestResponse() {
//String res;
try {
res = EntityUtils.toString(response.getEntity());
return res;
} catch (org.apache.http.ParseException e) {
e.printStackTrace();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onStart(){
super.onStart();
Log.e("the activity","started");
}
public void nextStep(){
Log.e("this is in nextStep","this");
Log.e("app context", getApplicationContext()+"");
Intent i = new Intent(this, MapsActivity.class);
startActivity(i);
}
}
class LoadTask extends AsyncTask<String, String, String> {
MainActivity ma = new MainActivity();
boolean check_flag = true;
/* Context context;
public LoadTask(Context context) {
this.context = context.getApplicationContext();
}*/
@Override
protected void onPreExecute() {
super.onPreExecute();
Log.e("inside","pre");
}
protected String doInBackground(String... params) {
if (check_flag) {
check_flag = ma.makeConnection(params[0]);
}
if (check_flag) {
check_flag = ma.generatePostRequest();
}
if (check_flag) {
return ma.getRequestResponse();
}
return null; // null is returned if request failed
}
@Override
protected void onPostExecute(String res) {
if (ma.res != null) {
try {
/* *//* Log.e("before","object"); ------
Log.e("the value of ma.res",ma.res);
JSONObject obj = new JSONObject(ma.res); ---------
*//* //JSONArray j = new JSONArray();
// /JSONArray arr = obj.getJSONArray("ress");
*//*String pname = obj.getString("name"); -----
String Lat = obj.getString("Lat");
float Latf = Float.parseFloat(Lat);
String Lng = obj.getString("Lng");
float Longf = Float.parseFloat(Lng); ----
*//*// int length = arr.length();
*//* Log.e("the value object",pname); ----
Log.e("value of Lat",Lat);
Log.e("value of Long",Lng); -------
*//* // String ss = arr.getString("mes");
*//*String recvd_text = "";
for (int i = 0; i < length; i++) {
JSONObject obj3 = (JSONObject) arr.get(i);
String s = obj3.getString("mes");
//String bname = obj3.getString("Email");
Log.e("ans--->> ",s);
}
*//*
// ma.MMap(Latf, Longf, pname);
*/
Log.e("before", "object");
Log.e("the value of ma.res", ma.res);
JSONObject obj = new JSONObject(ma.res);
//Log.e("this is", obj+"");
//JSONArray j = new JSONArray();
// /JSONArray arr = obj.getJSONArray("ress");
String ss = obj.getString("mes");
// int length = arr.length();
Log.e("the value object", ss + "this should be sex bro");
if (ss.equals("abc")) {
Log.e("this is fucking", "idiotic");
//context.startActivity(new Intent(context, MapsActivity.class));
ma.nextStep();
}
// String ss = arr.getString("mes");
/*String recvd_text = "";
for (int i = 0; i < length; i++) {
JSONObject obj3 = (JSONObject) arr.get(i);
String s = obj3.getString("mes");
//String bname = obj3.getString("Email");
Log.e("ans--->> ",s);
}
*/
} catch (JSONException e) {
e.printStackTrace();
}
}
// Toast.makeText(this,ma.id,Toast.LENGTH_LONG).show();
Log.e("task done","bitchess!!!1");
super.onPostExecute(ma.res);
}
// @Override
// public void onAttach(Activity activity){
// this.activity = activity;
//
}
| UTF-8 | Java | 10,489 | java | MainActivity.java | Java | [
{
"context": "package com.example.mayank.singleboom;\n\nimport android.content.Context;\ni",
"end": 23,
"score": 0.5824705958366394,
"start": 20,
"tag": "USERNAME",
"value": "may"
},
{
"context": "yList;\nimport java.util.List;\n\n\n\n/**\n * Created by Mayank on 1/16/2017.\n */\n\nimport android.app.Activity;\ni",
"end": 598,
"score": 0.9985132217407227,
"start": 592,
"tag": "NAME",
"value": "Mayank"
},
{
"context": ");\n new LoadTask().execute(\"http://192.168.43.3/signUp.php\");\n }\n });\n }\n ",
"end": 4198,
"score": 0.885179340839386,
"start": 4186,
"tag": "IP_ADDRESS",
"value": "192.168.43.3"
},
{
"context": "10000);\n\n post = new HttpPost(\"http://192.168.43.3/signUp.php\");\n\n return true;\n }",
"end": 4615,
"score": 0.750659167766571,
"start": 4604,
"tag": "IP_ADDRESS",
"value": "92.168.43.3"
},
{
"context": "ail.toString();\n String passWordStr = \"sexyy\";//passWord.toString();\n\n Log.e(\"this ",
"end": 5038,
"score": 0.9991105198860168,
"start": 5033,
"tag": "PASSWORD",
"value": "sexyy"
}
] | null | [] | package com.example.mayank.singleboom;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Mayank on 1/16/2017.
*/
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.location.Location;
import android.os.AsyncTask;
import android.os.CountDownTimer;
import android.support.multidex.MultiDex;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.fitness.data.Application;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class MainActivity extends AppCompatActivity {
Button b;
public EditText passWord, eMail, name;
HttpClient client;
HttpPost post;
HttpResponse response;
// Context context;
public String res;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b = (Button) findViewById(R.id.button);
name = (EditText) findViewById(R.id.editText);
eMail = (EditText) findViewById(R.id.editText3);
passWord = (EditText) findViewById(R.id.editText2);
final Context context;
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("the but","is clicked");
new LoadTask().execute("http://192.168.43.3/signUp.php");
}
});
}
boolean makeConnection(String url) {
try {
client = new DefaultHttpClient();
final HttpParams httpParams = client.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 10000); // 10 seconds
HttpConnectionParams.setSoTimeout(httpParams, 10000);
post = new HttpPost("http://1192.168.3.11/signUp.php");
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean generatePostRequest() {
try {
//String nameStr = name.toString();
String nameStr = "this is mayank the sex and handjob";
String eMailStr = "sex@600";//eMail.toString();
String passWordStr = "<PASSWORD>";//passWord.toString();
Log.e("this is email",eMailStr);
Log.e("this is pass",passWordStr);
Log.e("this is name",nameStr);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("name", nameStr));
nameValuePairs.add(new BasicNameValuePair("email", eMailStr));
nameValuePairs.add(new BasicNameValuePair("password", passWordStr));
/* List<NameValuePair> urlParameters = new ArrayList<NameValuePair>(1);
urlParameters.add(new BasicNameValuePair("name", name));
*/// urlParameters.add(new BasicNameValuePair("phone", aphone));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = client.execute(post);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
public String getRequestResponse() {
//String res;
try {
res = EntityUtils.toString(response.getEntity());
return res;
} catch (org.apache.http.ParseException e) {
e.printStackTrace();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onStart(){
super.onStart();
Log.e("the activity","started");
}
public void nextStep(){
Log.e("this is in nextStep","this");
Log.e("app context", getApplicationContext()+"");
Intent i = new Intent(this, MapsActivity.class);
startActivity(i);
}
}
class LoadTask extends AsyncTask<String, String, String> {
MainActivity ma = new MainActivity();
boolean check_flag = true;
/* Context context;
public LoadTask(Context context) {
this.context = context.getApplicationContext();
}*/
@Override
protected void onPreExecute() {
super.onPreExecute();
Log.e("inside","pre");
}
protected String doInBackground(String... params) {
if (check_flag) {
check_flag = ma.makeConnection(params[0]);
}
if (check_flag) {
check_flag = ma.generatePostRequest();
}
if (check_flag) {
return ma.getRequestResponse();
}
return null; // null is returned if request failed
}
@Override
protected void onPostExecute(String res) {
if (ma.res != null) {
try {
/* *//* Log.e("before","object"); ------
Log.e("the value of ma.res",ma.res);
JSONObject obj = new JSONObject(ma.res); ---------
*//* //JSONArray j = new JSONArray();
// /JSONArray arr = obj.getJSONArray("ress");
*//*String pname = obj.getString("name"); -----
String Lat = obj.getString("Lat");
float Latf = Float.parseFloat(Lat);
String Lng = obj.getString("Lng");
float Longf = Float.parseFloat(Lng); ----
*//*// int length = arr.length();
*//* Log.e("the value object",pname); ----
Log.e("value of Lat",Lat);
Log.e("value of Long",Lng); -------
*//* // String ss = arr.getString("mes");
*//*String recvd_text = "";
for (int i = 0; i < length; i++) {
JSONObject obj3 = (JSONObject) arr.get(i);
String s = obj3.getString("mes");
//String bname = obj3.getString("Email");
Log.e("ans--->> ",s);
}
*//*
// ma.MMap(Latf, Longf, pname);
*/
Log.e("before", "object");
Log.e("the value of ma.res", ma.res);
JSONObject obj = new JSONObject(ma.res);
//Log.e("this is", obj+"");
//JSONArray j = new JSONArray();
// /JSONArray arr = obj.getJSONArray("ress");
String ss = obj.getString("mes");
// int length = arr.length();
Log.e("the value object", ss + "this should be sex bro");
if (ss.equals("abc")) {
Log.e("this is fucking", "idiotic");
//context.startActivity(new Intent(context, MapsActivity.class));
ma.nextStep();
}
// String ss = arr.getString("mes");
/*String recvd_text = "";
for (int i = 0; i < length; i++) {
JSONObject obj3 = (JSONObject) arr.get(i);
String s = obj3.getString("mes");
//String bname = obj3.getString("Email");
Log.e("ans--->> ",s);
}
*/
} catch (JSONException e) {
e.printStackTrace();
}
}
// Toast.makeText(this,ma.id,Toast.LENGTH_LONG).show();
Log.e("task done","bitchess!!!1");
super.onPostExecute(ma.res);
}
// @Override
// public void onAttach(Activity activity){
// this.activity = activity;
//
}
| 10,495 | 0.620555 | 0.614835 | 334 | 30.392216 | 22.384073 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727545 | false | false | 1 |
475a6f7e74ad0acc3b9f9163655b94385935dd04 | 22,093,311,811,275 | bd3d3724626158f0c930b881048a4e37ad650431 | /core/src/net/mostlyoriginal/game/system/mechanics/DialogUISystem.java | 82a237565e7fceb47b6cec952cb205c8cbbffdec | [
"MIT"
] | permissive | DaanVanYperen/odb-bob | https://github.com/DaanVanYperen/odb-bob | 56c8dfe7c7a2dc8f10e03115bca09706c3d7291d | 589c70e2dbd35825b4a685112f914aaec175c4a6 | refs/heads/master | "2020-08-06T13:07:59.095000" | "2019-10-08T10:05:35" | "2019-10-08T10:05:35" | 212,986,696 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.mostlyoriginal.game.system.mechanics;
import com.artemis.BaseSystem;
import com.artemis.E;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import net.mostlyoriginal.api.component.graphics.Tint;
import net.mostlyoriginal.api.component.ui.Label;
import net.mostlyoriginal.api.util.Cooldown;
import net.mostlyoriginal.game.GameRules;
import net.mostlyoriginal.game.component.dialog.DialogSingleton;
import net.mostlyoriginal.game.screen.LogoScreen;
import net.mostlyoriginal.game.system.logic.TransitionSystem;
import net.mostlyoriginal.game.util.Scripts;
/**
* Handles dialog UI lifecycle.
*
* @author Daan van Yperen
*/
public class DialogUISystem extends BaseSystem {
private final DialogFactory dialogFactory;
private DialogSingleton dialog;
private static final Tint DIALOG_TINT = new Tint("444444");
private E talkLabel;
private E faceIcon;
private E dialogBox;
private String targetText;
private int revealedLength;
private Cooldown revealCooldown = Cooldown.withInterval(1f / 60f).autoReset(false);
public DialogUISystem(DialogFactory dialogFactory) {
this.dialogFactory = dialogFactory;
}
// @todo destroyyyy!
@Deprecated
public boolean isDialogActive() {
return (dialog.size() > 0) || (targetText != null);
}
protected void clear() {
dialog.clear();
talkLabel.invisible();
faceIcon.invisible().tint(1f, 1f, 1f, 0f);
targetText = null;
dialogBox.invisible().tint(1f, 1f, 1f, 0f);
E player = E.withTag("player");
player.inDialog(false);
if (player.playerDone()) {
world.getSystem(TransitionSystem.class).transition(LogoScreen.class, 0.55f);
}
}
protected void set(String faceAnim, String text) {
if (dialogBox.isInvisible()) {
talkLabel.removeInvisible();
faceIcon.removeInvisible();
dialogBox.removeInvisible();
dialogBox.script(Scripts.appearOverTime());
faceIcon.script(Scripts.appearOverTime());
}
faceIcon.anim(faceAnim);
targetText = text;
talkLabel.labelText("");
revealedLength = 0;
}
@Override
protected void initialize() {
super.initialize();
world.inject(dialogFactory);
talkLabel = E.E()
.pos(220, 98)
.tint(DIALOG_TINT)
.fontFontName("5x5")
.labelAlign(Label.Align.LEFT)
.renderLayer(GameRules.LAYER_DIALOG_TEXT)
.labelText("").invisible();
faceIcon = E.E()
.pos(180, 85).anim("player_face").renderLayer(GameRules.LAYER_DIALOG_TEXT).invisible();
dialogBox = E.E().pos(160, 50).anim("talk_box").renderLayer(GameRules.LAYER_DIALOG_BOX).invisible();
}
@Override
protected void processSystem() {
startNextDialogIfQueued();
if (!dialog.isEmpty() ) {
E.withTag("player").inDialog(true);
}
if (revealCooldown.ready(world.delta) && targetText != null) {
revealCooldown.restart();
revealedLength++;
if (revealedLength < targetText.length()) {
talkLabel.labelText(targetText.substring(0, revealedLength));
}
}
if (targetText == null) {
popDialog();
}
if (isDialogActive() && (Gdx.input.isKeyJustPressed(Input.Keys.SPACE) || Gdx.input.isKeyJustPressed(Input.Keys.SHIFT_LEFT) || Gdx.input.isKeyJustPressed(Input.Keys.SHIFT_RIGHT))) {
popDialog();
}
if (isDialogActive() && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
clear();
}
}
private void startNextDialogIfQueued() {
if ( dialog.startNextDialog != null ) {
dialogFactory.startDialog(dialog.startNextDialog);
dialog.startNextDialog = null;
}
}
private void popDialog() {
if (!dialog.isEmpty()) {
E.withTag("player").inDialog(true);
DialogSingleton.Dialog pop = dialog.pop();
set(pop.faceAnim, pop.text);
} else clear();
}
public interface DialogFactory {
void startDialog(String dialogId);
}
}
| UTF-8 | Java | 4,297 | java | DialogUISystem.java | Java | [
{
"context": "\n/**\n * Handles dialog UI lifecycle.\n *\n * @author Daan van Yperen\n */\npublic class DialogUISystem extends BaseSyste",
"end": 644,
"score": 0.999853789806366,
"start": 629,
"tag": "NAME",
"value": "Daan van Yperen"
}
] | null | [] | package net.mostlyoriginal.game.system.mechanics;
import com.artemis.BaseSystem;
import com.artemis.E;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import net.mostlyoriginal.api.component.graphics.Tint;
import net.mostlyoriginal.api.component.ui.Label;
import net.mostlyoriginal.api.util.Cooldown;
import net.mostlyoriginal.game.GameRules;
import net.mostlyoriginal.game.component.dialog.DialogSingleton;
import net.mostlyoriginal.game.screen.LogoScreen;
import net.mostlyoriginal.game.system.logic.TransitionSystem;
import net.mostlyoriginal.game.util.Scripts;
/**
* Handles dialog UI lifecycle.
*
* @author <NAME>
*/
public class DialogUISystem extends BaseSystem {
private final DialogFactory dialogFactory;
private DialogSingleton dialog;
private static final Tint DIALOG_TINT = new Tint("444444");
private E talkLabel;
private E faceIcon;
private E dialogBox;
private String targetText;
private int revealedLength;
private Cooldown revealCooldown = Cooldown.withInterval(1f / 60f).autoReset(false);
public DialogUISystem(DialogFactory dialogFactory) {
this.dialogFactory = dialogFactory;
}
// @todo destroyyyy!
@Deprecated
public boolean isDialogActive() {
return (dialog.size() > 0) || (targetText != null);
}
protected void clear() {
dialog.clear();
talkLabel.invisible();
faceIcon.invisible().tint(1f, 1f, 1f, 0f);
targetText = null;
dialogBox.invisible().tint(1f, 1f, 1f, 0f);
E player = E.withTag("player");
player.inDialog(false);
if (player.playerDone()) {
world.getSystem(TransitionSystem.class).transition(LogoScreen.class, 0.55f);
}
}
protected void set(String faceAnim, String text) {
if (dialogBox.isInvisible()) {
talkLabel.removeInvisible();
faceIcon.removeInvisible();
dialogBox.removeInvisible();
dialogBox.script(Scripts.appearOverTime());
faceIcon.script(Scripts.appearOverTime());
}
faceIcon.anim(faceAnim);
targetText = text;
talkLabel.labelText("");
revealedLength = 0;
}
@Override
protected void initialize() {
super.initialize();
world.inject(dialogFactory);
talkLabel = E.E()
.pos(220, 98)
.tint(DIALOG_TINT)
.fontFontName("5x5")
.labelAlign(Label.Align.LEFT)
.renderLayer(GameRules.LAYER_DIALOG_TEXT)
.labelText("").invisible();
faceIcon = E.E()
.pos(180, 85).anim("player_face").renderLayer(GameRules.LAYER_DIALOG_TEXT).invisible();
dialogBox = E.E().pos(160, 50).anim("talk_box").renderLayer(GameRules.LAYER_DIALOG_BOX).invisible();
}
@Override
protected void processSystem() {
startNextDialogIfQueued();
if (!dialog.isEmpty() ) {
E.withTag("player").inDialog(true);
}
if (revealCooldown.ready(world.delta) && targetText != null) {
revealCooldown.restart();
revealedLength++;
if (revealedLength < targetText.length()) {
talkLabel.labelText(targetText.substring(0, revealedLength));
}
}
if (targetText == null) {
popDialog();
}
if (isDialogActive() && (Gdx.input.isKeyJustPressed(Input.Keys.SPACE) || Gdx.input.isKeyJustPressed(Input.Keys.SHIFT_LEFT) || Gdx.input.isKeyJustPressed(Input.Keys.SHIFT_RIGHT))) {
popDialog();
}
if (isDialogActive() && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
clear();
}
}
private void startNextDialogIfQueued() {
if ( dialog.startNextDialog != null ) {
dialogFactory.startDialog(dialog.startNextDialog);
dialog.startNextDialog = null;
}
}
private void popDialog() {
if (!dialog.isEmpty()) {
E.withTag("player").inDialog(true);
DialogSingleton.Dialog pop = dialog.pop();
set(pop.faceAnim, pop.text);
} else clear();
}
public interface DialogFactory {
void startDialog(String dialogId);
}
}
| 4,288 | 0.621829 | 0.61252 | 143 | 29.04895 | 26.875347 | 188 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.559441 | false | false | 1 |
aa8f3d0f8a2614f1ed64778bfe11d2d5e5d6b52e | 6,021,544,197,789 | 8a7994eab6babcc085cb9782b963f29c6ddd01a7 | /src/main/java/com/revature/project1mule/flightschool/responsePojos/AircraftPilot.java | e8a0e9b0ac3a96cfba49de04a786464fd581eb47 | [] | no_license | texas-mule/project-1-wtb-airlines | https://github.com/texas-mule/project-1-wtb-airlines | 5016b29387af88ae26c369fe2ba749fb8525c850 | 166183fd2d670c0dc47d095ac3a15b244ffcc6e6 | refs/heads/master | "2022-09-24T01:57:09.121000" | "2019-05-23T17:02:11" | "2019-05-23T17:02:11" | 185,853,992 | 0 | 0 | null | false | "2022-02-16T00:56:47" | "2019-05-09T18:45:12" | "2019-05-23T17:02:16" | "2022-02-16T00:56:45" | 740 | 0 | 0 | 1 | RAML | false | false | package com.revature.project1mule.flightschool.responsePojos;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ "id", "name", "dob", "sex", "url", "age", "aircraft_count" })
public class AircraftPilot {
public AircraftPilot() {
super();
}
public AircraftPilot(Integer id, String name, String dob, String sex, URI url, Integer age, Integer aircraftCount,
Map<String, Object> additionalProperties) {
super();
this.id = id;
this.name = name;
this.dob = dob;
this.sex = sex;
this.url = url;
this.age = age;
this.aircraftCount = aircraftCount;
this.additionalProperties = additionalProperties;
}
/**
* The unique integer identifier for this pilot. (Required)
*
*/
@JsonProperty("id")
@JsonPropertyDescription("The unique integer identifier for this pilot.")
private Integer id;
/**
* The pilot's name. (Required)
*
*/
@JsonProperty("name")
@JsonPropertyDescription("The pilot's name.")
private String name;
/**
* The pilot's date of birth in YYYY-MM-DD format. (Required)
*
*/
@JsonProperty("dob")
@JsonPropertyDescription("The pilot's date of birth in YYYY-MM-DD format.")
private String dob;
/**
* The pilot's sex. (Required)
*
*/
@JsonProperty("sex")
@JsonPropertyDescription("The pilot's sex.")
private String sex;
/**
* The hypermedia URL for the pilot. (Required)
*
*/
@JsonProperty("url")
@JsonPropertyDescription("The hypermedia URL for the pilot.")
private URI url;
/**
* The pilot's age in years. (Required)
*
*/
@JsonProperty("age")
@JsonPropertyDescription("The pilot's age in years.")
private Integer age;
/**
* The number of aircraft this pilot is certified to fly. (Required)
*
*/
@JsonProperty("aircraft_count")
@JsonPropertyDescription("The number of aircraft this pilot is certified to fly.")
private Integer aircraftCount;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
* The unique integer identifier for this pilot. (Required)
*
*/
@JsonProperty("id")
public Integer getId() {
return id;
}
/**
* The unique integer identifier for this pilot. (Required)
*
*/
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
/**
* The pilot's name. (Required)
*
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* The pilot's name. (Required)
*
*/
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
/**
* The pilot's date of birth in YYYY-MM-DD format. (Required)
*
*/
@JsonProperty("dob")
public String getDob() {
return dob;
}
/**
* The pilot's date of birth in YYYY-MM-DD format. (Required)
*
*/
@JsonProperty("dob")
public void setDob(String dob) {
this.dob = dob;
}
/**
* The pilot's sex. (Required)
*
*/
@JsonProperty("sex")
public String getSex() {
return sex;
}
/**
* The pilot's sex. (Required)
*
*/
@JsonProperty("sex")
public void setSex(String sex) {
this.sex = sex;
}
/**
* The hypermedia URL for the pilot. (Required)
*
*/
@JsonProperty("url")
public URI getUrl() {
return url;
}
/**
* The hypermedia URL for the pilot. (Required)
*
*/
@JsonProperty("url")
public void setUrl(URI url) {
this.url = url;
}
/**
* The pilot's age in years. (Required)
*
*/
@JsonProperty("age")
public Integer getAge() {
return age;
}
/**
* The pilot's age in years. (Required)
*
*/
@JsonProperty("age")
public void setAge(Integer age) {
this.age = age;
}
/**
* The number of aircraft this pilot is certified to fly. (Required)
*
*/
@JsonProperty("aircraft_count")
public Integer getAircraftCount() {
return aircraftCount;
}
public Integer getaircraft_count(){
return aircraftCount;
}
/**
* The number of aircraft this pilot is certified to fly. (Required)
*
*/
@JsonProperty("aircraft_count")
public void setAircraftCount(Integer aircraftCount) {
this.aircraftCount = aircraftCount;
}
public void setaircraft_count(Integer aircraftCount){
this.aircraftCount = aircraftCount;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
} | UTF-8 | Java | 4,820 | java | AircraftPilot.java | Java | [] | null | [] | package com.revature.project1mule.flightschool.responsePojos;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ "id", "name", "dob", "sex", "url", "age", "aircraft_count" })
public class AircraftPilot {
public AircraftPilot() {
super();
}
public AircraftPilot(Integer id, String name, String dob, String sex, URI url, Integer age, Integer aircraftCount,
Map<String, Object> additionalProperties) {
super();
this.id = id;
this.name = name;
this.dob = dob;
this.sex = sex;
this.url = url;
this.age = age;
this.aircraftCount = aircraftCount;
this.additionalProperties = additionalProperties;
}
/**
* The unique integer identifier for this pilot. (Required)
*
*/
@JsonProperty("id")
@JsonPropertyDescription("The unique integer identifier for this pilot.")
private Integer id;
/**
* The pilot's name. (Required)
*
*/
@JsonProperty("name")
@JsonPropertyDescription("The pilot's name.")
private String name;
/**
* The pilot's date of birth in YYYY-MM-DD format. (Required)
*
*/
@JsonProperty("dob")
@JsonPropertyDescription("The pilot's date of birth in YYYY-MM-DD format.")
private String dob;
/**
* The pilot's sex. (Required)
*
*/
@JsonProperty("sex")
@JsonPropertyDescription("The pilot's sex.")
private String sex;
/**
* The hypermedia URL for the pilot. (Required)
*
*/
@JsonProperty("url")
@JsonPropertyDescription("The hypermedia URL for the pilot.")
private URI url;
/**
* The pilot's age in years. (Required)
*
*/
@JsonProperty("age")
@JsonPropertyDescription("The pilot's age in years.")
private Integer age;
/**
* The number of aircraft this pilot is certified to fly. (Required)
*
*/
@JsonProperty("aircraft_count")
@JsonPropertyDescription("The number of aircraft this pilot is certified to fly.")
private Integer aircraftCount;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
* The unique integer identifier for this pilot. (Required)
*
*/
@JsonProperty("id")
public Integer getId() {
return id;
}
/**
* The unique integer identifier for this pilot. (Required)
*
*/
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
/**
* The pilot's name. (Required)
*
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* The pilot's name. (Required)
*
*/
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
/**
* The pilot's date of birth in YYYY-MM-DD format. (Required)
*
*/
@JsonProperty("dob")
public String getDob() {
return dob;
}
/**
* The pilot's date of birth in YYYY-MM-DD format. (Required)
*
*/
@JsonProperty("dob")
public void setDob(String dob) {
this.dob = dob;
}
/**
* The pilot's sex. (Required)
*
*/
@JsonProperty("sex")
public String getSex() {
return sex;
}
/**
* The pilot's sex. (Required)
*
*/
@JsonProperty("sex")
public void setSex(String sex) {
this.sex = sex;
}
/**
* The hypermedia URL for the pilot. (Required)
*
*/
@JsonProperty("url")
public URI getUrl() {
return url;
}
/**
* The hypermedia URL for the pilot. (Required)
*
*/
@JsonProperty("url")
public void setUrl(URI url) {
this.url = url;
}
/**
* The pilot's age in years. (Required)
*
*/
@JsonProperty("age")
public Integer getAge() {
return age;
}
/**
* The pilot's age in years. (Required)
*
*/
@JsonProperty("age")
public void setAge(Integer age) {
this.age = age;
}
/**
* The number of aircraft this pilot is certified to fly. (Required)
*
*/
@JsonProperty("aircraft_count")
public Integer getAircraftCount() {
return aircraftCount;
}
public Integer getaircraft_count(){
return aircraftCount;
}
/**
* The number of aircraft this pilot is certified to fly. (Required)
*
*/
@JsonProperty("aircraft_count")
public void setAircraftCount(Integer aircraftCount) {
this.aircraftCount = aircraftCount;
}
public void setaircraft_count(Integer aircraftCount){
this.aircraftCount = aircraftCount;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
} | 4,820 | 0.68112 | 0.680913 | 229 | 20.052402 | 21.63183 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.257642 | false | false | 1 |
6fb4c8f618e8633119682d5cc06604e82f59c4d4 | 5,995,774,380,140 | d6167edd081bb9fcb9c0ec35d392c82c14a398ae | /app/src/main/java/com/dreamy/rao/eric/armylive/videomodel/util/SDcardUtil.java | 8a1b23f49c44de295d90146443f4a1cd9335356e | [] | no_license | eterrao/OpenSourceOfArmyLive | https://github.com/eterrao/OpenSourceOfArmyLive | 363a8d99057a284d36699cbf857ea0025758a242 | 659ab3097775234455221d18e66d7a6f11059f9a | refs/heads/master | "2016-08-04T23:44:56.940000" | "2015-11-08T05:43:12" | "2015-11-08T05:43:12" | 42,529,715 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dreamy.rao.eric.armylive.videomodel.util;
import android.content.Context;
import android.os.Environment;
import android.os.StatFs;
import android.util.Log;
import java.io.File;
/**
* Created by raomengyang on 9/11/15.
*/
public class SDcardUtil {
// private static final String LOGS_DIR_NAME = "logs";
// private static final String PHOTO_DIR_NAME = "photos";
// private static final String ROOT_DIR_NAME = "yishizhibo";
// private static final String SHARE_THUMB_DIR_NAME = "sharethumb";
// private static final String THUMBNAILS_DIR_NAME = "thumbs";
// private static final String VIDEO_DIR_NAME = "videos";
// private Context context = null;
// public File logsDir = null;
// public File photoDir = null;
// public File rootDir = null;
// public File sharethumbDir = null;
// public boolean sysFileStateOK = false;
// public File thumbsDir = null;
// public File videoDir = null;
//
// public SDcardUtil(Context paramContext) {
// this.context = paramContext;
// try {
// this.rootDir = new File(getSDCardFile(), "yishizhibo");
// if (!(this.rootDir.exists()))
// this.rootDir.mkdir();
// this.videoDir = new File(this.rootDir, "videos");
// if (!(this.videoDir.exists()))
// this.videoDir.mkdir();
// this.photoDir = new File(this.rootDir, "photos");
// if (!(this.photoDir.exists()))
// this.photoDir.mkdir();
// this.thumbsDir = new File(this.rootDir, "thumbs");
// if (!(this.thumbsDir.exists()))
// this.thumbsDir.mkdir();
// this.logsDir = new File(this.rootDir, "logs");
// if (!(this.logsDir.exists()))
// this.logsDir.mkdir();
// this.sharethumbDir = new File(this.rootDir, "sharethumb");
// if (!(this.sharethumbDir.exists()))
// this.sharethumbDir.mkdir();
// this.sysFileStateOK = true;
// this.context = null;
// return;
// } catch (Exception localException) {
// if (AppContext.isDebugMode)
// Log.e("tryAndCheckFileSys", localException.toString());
// this.sysFileStateOK = false;
// }
// }
//
// public int getSDCardAvableSpaceMb(String paramString) {
// StatFs localStatFs;
// try {
// localStatFs = new StatFs(paramString);
// long l = localStatFs.getBlockSize() * localStatFs.getAvailableBlocks() / 1024L / 1024L;
// return (int) l;
// } catch (Exception localException) {
// }
// return 0;
// }
//
// public File getSDCardFile() {
// if (!(Environment.getExternalStorageState().equals("mounted"))) {
// SysUtil.samlog("使用内部存储卡!!!");
// return this.context.getFilesDir();
// }
// Object localObject = Environment.getExternalStorageDirectory();
// File[] arrayOfFile = ((File) localObject).getParentFile().listFiles();
// SysUtil.samlog("Environment.getExternalStorageState() = " + Environment.getExternalStorageState());
// int i = arrayOfFile.length;
// int j = 0;
// if (j >= i) {
// SysUtil.samlog("final choose sdcard = " + localObject);
// return (File)localObject;
// }
// File localFile = arrayOfFile[j];
// if ((!(localFile.isDirectory())) || (!(localFile.exists())) || (!(localFile.canWrite()))) ;
// while (true) {
// String[] arrayOfString;
// do {
// while (true)
// ++j;
//// arrayOfString = localFile.list();
// }
// while ((arrayOfString == null) || (arrayOfString.length == 0) || (localFile.getAbsolutePath().equals(Environment.getExternalStorageDirectory().getAbsolutePath())));
//// localObject = localFile;
// }
// }
}
| UTF-8 | Java | 3,979 | java | SDcardUtil.java | Java | [
{
"context": "util.Log;\n\nimport java.io.File;\n\n/**\n * Created by raomengyang on 9/11/15.\n */\npublic class SDcardUtil {\n\n// ",
"end": 221,
"score": 0.9996920824050903,
"start": 210,
"tag": "USERNAME",
"value": "raomengyang"
}
] | null | [] | package com.dreamy.rao.eric.armylive.videomodel.util;
import android.content.Context;
import android.os.Environment;
import android.os.StatFs;
import android.util.Log;
import java.io.File;
/**
* Created by raomengyang on 9/11/15.
*/
public class SDcardUtil {
// private static final String LOGS_DIR_NAME = "logs";
// private static final String PHOTO_DIR_NAME = "photos";
// private static final String ROOT_DIR_NAME = "yishizhibo";
// private static final String SHARE_THUMB_DIR_NAME = "sharethumb";
// private static final String THUMBNAILS_DIR_NAME = "thumbs";
// private static final String VIDEO_DIR_NAME = "videos";
// private Context context = null;
// public File logsDir = null;
// public File photoDir = null;
// public File rootDir = null;
// public File sharethumbDir = null;
// public boolean sysFileStateOK = false;
// public File thumbsDir = null;
// public File videoDir = null;
//
// public SDcardUtil(Context paramContext) {
// this.context = paramContext;
// try {
// this.rootDir = new File(getSDCardFile(), "yishizhibo");
// if (!(this.rootDir.exists()))
// this.rootDir.mkdir();
// this.videoDir = new File(this.rootDir, "videos");
// if (!(this.videoDir.exists()))
// this.videoDir.mkdir();
// this.photoDir = new File(this.rootDir, "photos");
// if (!(this.photoDir.exists()))
// this.photoDir.mkdir();
// this.thumbsDir = new File(this.rootDir, "thumbs");
// if (!(this.thumbsDir.exists()))
// this.thumbsDir.mkdir();
// this.logsDir = new File(this.rootDir, "logs");
// if (!(this.logsDir.exists()))
// this.logsDir.mkdir();
// this.sharethumbDir = new File(this.rootDir, "sharethumb");
// if (!(this.sharethumbDir.exists()))
// this.sharethumbDir.mkdir();
// this.sysFileStateOK = true;
// this.context = null;
// return;
// } catch (Exception localException) {
// if (AppContext.isDebugMode)
// Log.e("tryAndCheckFileSys", localException.toString());
// this.sysFileStateOK = false;
// }
// }
//
// public int getSDCardAvableSpaceMb(String paramString) {
// StatFs localStatFs;
// try {
// localStatFs = new StatFs(paramString);
// long l = localStatFs.getBlockSize() * localStatFs.getAvailableBlocks() / 1024L / 1024L;
// return (int) l;
// } catch (Exception localException) {
// }
// return 0;
// }
//
// public File getSDCardFile() {
// if (!(Environment.getExternalStorageState().equals("mounted"))) {
// SysUtil.samlog("使用内部存储卡!!!");
// return this.context.getFilesDir();
// }
// Object localObject = Environment.getExternalStorageDirectory();
// File[] arrayOfFile = ((File) localObject).getParentFile().listFiles();
// SysUtil.samlog("Environment.getExternalStorageState() = " + Environment.getExternalStorageState());
// int i = arrayOfFile.length;
// int j = 0;
// if (j >= i) {
// SysUtil.samlog("final choose sdcard = " + localObject);
// return (File)localObject;
// }
// File localFile = arrayOfFile[j];
// if ((!(localFile.isDirectory())) || (!(localFile.exists())) || (!(localFile.canWrite()))) ;
// while (true) {
// String[] arrayOfString;
// do {
// while (true)
// ++j;
//// arrayOfString = localFile.list();
// }
// while ((arrayOfString == null) || (arrayOfString.length == 0) || (localFile.getAbsolutePath().equals(Environment.getExternalStorageDirectory().getAbsolutePath())));
//// localObject = localFile;
// }
// }
}
| 3,979 | 0.5657 | 0.561665 | 99 | 39.050507 | 27.351574 | 178 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.747475 | false | false | 1 |
bbb0b68136c19da9dd85cafdfa3fef40296f22d1 | 26,405,458,976,798 | c132db01a6521027937ec898faf8aef3c803d05a | /src/main/java/sharding/CarNoMapper.java | 266aeced1648ab53c451ec9f67282c0ba3f9d507 | [] | no_license | xuecf8679/demo | https://github.com/xuecf8679/demo | eccf31e2a14b14530c3dadf5ea7d933e308caa34 | 51ec520d4f6111d917a106181f7517c83db6d516 | refs/heads/master | "2021-01-23T15:23:20.810000" | "2017-09-08T07:22:10" | "2017-09-08T07:22:10" | 102,708,404 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sharding;
import java.util.HashMap;
import java.util.Map;
public class CarNoMapper {
private static Map<String,String> mapper;
static{
if(mapper==null){
mapper=new HashMap<String,String>();
}
mapper.put("鲁","lu");
mapper.put("吉","ji");
mapper.put("黑","hei");
}
public static String getMapValue(String carNoStr){
String result=mapper.get(carNoStr);
if(result==null){
result="other";
}
return result;
}
} | UTF-8 | Java | 469 | java | CarNoMapper.java | Java | [
{
"context": "new HashMap<String,String>();\r\n\t\t}\r\n\t\tmapper.put(\"鲁\",\"lu\");\r\n\t\tmapper.put(\"吉\",\"ji\");\r\n\t\tmapper.put(\"黑",
"end": 237,
"score": 0.5474352836608887,
"start": 236,
"tag": "NAME",
"value": "鲁"
}
] | null | [] | package sharding;
import java.util.HashMap;
import java.util.Map;
public class CarNoMapper {
private static Map<String,String> mapper;
static{
if(mapper==null){
mapper=new HashMap<String,String>();
}
mapper.put("鲁","lu");
mapper.put("吉","ji");
mapper.put("黑","hei");
}
public static String getMapValue(String carNoStr){
String result=mapper.get(carNoStr);
if(result==null){
result="other";
}
return result;
}
} | 469 | 0.645788 | 0.645788 | 23 | 18.217392 | 14.264448 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.956522 | false | false | 1 |
add4d680abed7b1907e64a6e3cb9084c0feb44eb | 31,275,951,890,372 | 1a9915b883df6c01081709ae56800e949bc93749 | /lib/src/main/java/eu/h2020/helios_social/core/messaging/HeliosMessagingException.java | bdb621e5d5237b80bb686b527a7c7bdd58e9ec6a | [] | no_license | vasgat/h.core-Messaging | https://github.com/vasgat/h.core-Messaging | 29244f77037b2f60ed1a98df3bcf5863f3cd691d | 1f48d18f8d7159b6c009a536505322e54cf398e9 | refs/heads/master | "2022-12-11T23:48:58.848000" | "2020-09-17T08:12:59" | "2020-09-17T08:12:59" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eu.h2020.helios_social.core.messaging;
import java.security.GeneralSecurityException;
/**
* This is an exception class that is used to encapsulate exceptions that take place
* in HELIOS Messaging implementation.
*/
public class HeliosMessagingException extends GeneralSecurityException {
private String msg;
HeliosMessagingException(String msg, Exception e) {
this.msg = msg;
if (e != null) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 483 | java | HeliosMessagingException.java | Java | [] | null | [] | package eu.h2020.helios_social.core.messaging;
import java.security.GeneralSecurityException;
/**
* This is an exception class that is used to encapsulate exceptions that take place
* in HELIOS Messaging implementation.
*/
public class HeliosMessagingException extends GeneralSecurityException {
private String msg;
HeliosMessagingException(String msg, Exception e) {
this.msg = msg;
if (e != null) {
e.printStackTrace();
}
}
}
| 483 | 0.699793 | 0.691511 | 18 | 25.777779 | 25.563766 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 1 |
8ee9e162ae808a0f525e07669453b5dc12ace1e8 | 17,394,617,593,993 | c2f42717ff31ce9a34e0f0d58dd381b866dc8af9 | /hrms/src/main/java/backend/hrms/entities/concretes/Employer.java | b8d0ca5e97057118750bef52ee88795a6591708d | [] | no_license | aslanemirhan/HRMS | https://github.com/aslanemirhan/HRMS | e1980badc5509cee49138e0416d4dc6f8ca15cfe | 5a3587ec5106ffe6215e147b1784d64c21c75237 | refs/heads/main | "2023-06-26T19:00:56.027000" | "2021-08-03T17:25:31" | "2021-08-03T17:25:31" | 377,268,783 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package backend.hrms.entities.concretes;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "employers")
@PrimaryKeyJoinColumn(name="id")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "jobAnnouncements"})
@EqualsAndHashCode(callSuper = false)
public class Employer extends User{
@Column(name = "company_name")
private String companyName;
@Column(name = "web_address")
private String webAddress;
@Column(name = "phone_number")
private String phoneNumber;
}
| UTF-8 | Java | 828 | java | Employer.java | Java | [] | null | [] | package backend.hrms.entities.concretes;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "employers")
@PrimaryKeyJoinColumn(name="id")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "jobAnnouncements"})
@EqualsAndHashCode(callSuper = false)
public class Employer extends User{
@Column(name = "company_name")
private String companyName;
@Column(name = "web_address")
private String webAddress;
@Column(name = "phone_number")
private String phoneNumber;
}
| 828 | 0.807971 | 0.807971 | 32 | 24.875 | 18.634226 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65625 | false | false | 1 |
5bc0d37cc5a05ad981ccc1a35d6d19831d968982 | 16,690,242,961,284 | a45a81ae724324c34f4362d29e3c47d875c51e08 | /app/src/main/java/com/lenote/alarmstar/services/WorkService.java | 3a8f96b8867a318e1a2bdd2239e0208ff011dc2c | [] | no_license | hahaerle/Alarm | https://github.com/hahaerle/Alarm | f1ee0fcb965a4585802ff001bfb7880955cbbe6e | dc44b2ebc78a1c43e1f84fdd91d5f7e813f15a8a | refs/heads/master | "2021-01-19T07:49:18.856000" | "2015-07-18T23:10:08" | "2015-07-18T23:10:08" | 39,004,957 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lenote.alarmstar.services;
import android.app.IntentService;
import android.content.Intent;
import com.lenote.alarmstar.session.AlarmSession;
import org.androidannotations.annotations.EIntentService;
import org.androidannotations.annotations.ServiceAction;
/**
* Created by lenote on 2015/7/13.
*/
@EIntentService
public class WorkService extends IntentService {
/**
* Creates an IntentService. Invoked by your subclass's constructor.
*
*/
public WorkService() {
super("WorkService");
}
@Override
protected void onHandleIntent(Intent intent) {
}
@ServiceAction
public void setAlarm(AlarmSession session){
}
}
| UTF-8 | Java | 690 | java | WorkService.java | Java | [
{
"context": "ions.annotations.ServiceAction;\n\n/**\n * Created by lenote on 2015/7/13.\n */\n@EIntentService\npublic class Wo",
"end": 297,
"score": 0.9996036291122437,
"start": 291,
"tag": "USERNAME",
"value": "lenote"
}
] | null | [] | package com.lenote.alarmstar.services;
import android.app.IntentService;
import android.content.Intent;
import com.lenote.alarmstar.session.AlarmSession;
import org.androidannotations.annotations.EIntentService;
import org.androidannotations.annotations.ServiceAction;
/**
* Created by lenote on 2015/7/13.
*/
@EIntentService
public class WorkService extends IntentService {
/**
* Creates an IntentService. Invoked by your subclass's constructor.
*
*/
public WorkService() {
super("WorkService");
}
@Override
protected void onHandleIntent(Intent intent) {
}
@ServiceAction
public void setAlarm(AlarmSession session){
}
}
| 690 | 0.723188 | 0.713043 | 32 | 20.5625 | 21.396461 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.21875 | false | false | 1 |
4915df8336e539a08d5e25c4466cddb01018b577 | 30,391,188,620,877 | 4d8b425acce45e5c02d929f72c25faf1804ef9e0 | /src/gipfj/HistoryTable.java | b6596b2bf22757cbf1478141f5fded8e49d6615c | [] | no_license | frsfnrrg/gipf | https://github.com/frsfnrrg/gipf | c46d7ef517decddc6bf3e81a5372c504119d5b5e | a298b7f5e851b1dc1cfc2b7fac86729544eab0c3 | refs/heads/master | "2021-01-01T19:55:07.291000" | "2013-07-16T21:13:33" | "2013-07-16T21:13:33" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gipfj;
import sun.misc.Unsafe;
/**
*
* This is a simple history heuristic table.
*
* Each move is assigned a number 0:42 (array style).
*/
public class HistoryTable {
private static long valueOffset;
private static Unsafe unsafe = UnsafeAccess.getUnsafe();
@SuppressWarnings("unused")
private volatile int lock;
static {
try {
valueOffset = unsafe.objectFieldOffset(HistoryTable.class
.getDeclaredField("lock"));
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
}
/**
* If this is increased, we may need to switch to longs.
*/
public static final int MAX_DEPTH = 24;
private final Rk[] otable;
private Rk best;
// create a lockable object class?
private void lock() {
// - maybe, if we ever get serious collisions (not likely), we can
// make this abort instead of spinning.
if (unsafe.compareAndSwapInt(this, valueOffset, 0, 1)) {
return;
} else {
while (!unsafe.compareAndSwapInt(this, valueOffset, 0, 1)) {
;
}
}
}
private void unlock() {
lock = 0;
}
/**
* Only 42 moves exist: we can burn memory!!
*
* @param depth
*/
public HistoryTable(int depth) {
otable = new Rk[Const.MOVES];
clear();
lock = 0;
}
private class Rk {
public int rank;
public Rk next;
public Rk prev;
public int pos;
// next is greater; prev is lesser.
public Rk(int rank, int pos, Rk next, Rk prev) {
this.rank = rank;
this.next = next;
this.prev = prev;
this.pos = pos;
}
}
/**
* Returns an ordering for the moves at a depth based on the history
* heuristic
*
* @param depth
* @return
*/
public int[] getMoveOrdering(ThreadBuffer b) {
lock();
try {
int[] moves = b.OPOOL.get();
Rk c = best;
for (int i = 0; i < Const.MOVES; i++) {
moves[i] = c.pos;
c = c.prev;
}
return moves;
} finally {
unlock();
}
}
/**
* A sufficient move is the best move ranked among the children of a node,
* at end of evaluation or at time of cutoff.
*
* Weighting is greater the less the depth is. 2 ** (k - u)
*
* @param depth
* @param move
*/
public void addSufficientMove(int depth, int move) {
// gipf moves are ignored
if (move >= 42) {
move -= 42;
}
// we only lock on mutation
lock();
try {
int weight = 1 << depth;
Rk o = otable[move];
o.rank += weight;
int r = o.rank;
// already the best
if (o.next == null) {
return;
}
Rk c = o;
if (c.next.rank < r) {
boolean end = false;
do {
c = c.next;
if (c.next == null) {
end = true;
break;
}
} while (c.next.rank < r);
// seam up start
if (o.prev == null) {
o.next.prev = null;
} else {
o.prev.next = o.next;
o.next.prev = o.prev;
}
// insert later on
if (end) {
o.next = null;
o.prev = c;
c.next = o;
best = o;
} else {
Rk e = c.next;
e.prev = o;
o.next = e;
o.prev = c;
c.next = o;
}
}
} finally {
unlock();
}
}
public void clear() {
for (int i = 0; i < Const.MOVES; i++) {
otable[i] = new Rk(0, i, null, null);
}
otable[1].prev = otable[0];
for (int i = 1; i < Const.MOVES - 1; i++) {
otable[i - 1].next = otable[i];
otable[i + 1].prev = otable[i];
}
otable[Const.MOVES - 2].next = otable[Const.MOVES - 1];
best = otable[Const.MOVES - 1];
}
/**
* Do a postmortem analysis of the move.
*/
public void analyze() {
System.out
.println("** History table analysis results: sorted by move.");
int maxwidth = 2;
for (Rk i : otable) {
maxwidth = Math.max(maxwidth, (int) Math.ceil(Math.log10(i.rank)));
}
String fstring = String.format("%%%dd ", maxwidth);
System.out.print("** ");
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, i);
}
System.out.println();
System.out.print("** ");
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, otable[i].rank);
}
System.out.println();
System.out
.println("** History table analysis results: sorted by rank.");
System.out.print("** ");
Rk b = best;
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, b.pos);
b = b.prev;
}
System.out.println();
System.out.print("** ");
Rk c = best;
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, c.rank);
c = c.prev;
}
System.out.println();
}
public static void hclear(HistoryTable t) {
t.clear();
}
public static HistoryTable hmake() {
return new HistoryTable(MAX_DEPTH);
}
public static void hadd(HistoryTable t, long depth, long move) {
t.addSufficientMove((int) depth, (int) move);
}
public static int[] hordering(HistoryTable t, ThreadBuffer b) {
return t.getMoveOrdering(b);
}
public static void hanalyze(HistoryTable t) {
if (t != null) {
t.analyze();
}
}
public static Line moveToLine(long move) {
return Const.listOfPushes[(int) move];
}
}
| UTF-8 | Java | 6,461 | java | HistoryTable.java | Java | [] | null | [] | package gipfj;
import sun.misc.Unsafe;
/**
*
* This is a simple history heuristic table.
*
* Each move is assigned a number 0:42 (array style).
*/
public class HistoryTable {
private static long valueOffset;
private static Unsafe unsafe = UnsafeAccess.getUnsafe();
@SuppressWarnings("unused")
private volatile int lock;
static {
try {
valueOffset = unsafe.objectFieldOffset(HistoryTable.class
.getDeclaredField("lock"));
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
}
/**
* If this is increased, we may need to switch to longs.
*/
public static final int MAX_DEPTH = 24;
private final Rk[] otable;
private Rk best;
// create a lockable object class?
private void lock() {
// - maybe, if we ever get serious collisions (not likely), we can
// make this abort instead of spinning.
if (unsafe.compareAndSwapInt(this, valueOffset, 0, 1)) {
return;
} else {
while (!unsafe.compareAndSwapInt(this, valueOffset, 0, 1)) {
;
}
}
}
private void unlock() {
lock = 0;
}
/**
* Only 42 moves exist: we can burn memory!!
*
* @param depth
*/
public HistoryTable(int depth) {
otable = new Rk[Const.MOVES];
clear();
lock = 0;
}
private class Rk {
public int rank;
public Rk next;
public Rk prev;
public int pos;
// next is greater; prev is lesser.
public Rk(int rank, int pos, Rk next, Rk prev) {
this.rank = rank;
this.next = next;
this.prev = prev;
this.pos = pos;
}
}
/**
* Returns an ordering for the moves at a depth based on the history
* heuristic
*
* @param depth
* @return
*/
public int[] getMoveOrdering(ThreadBuffer b) {
lock();
try {
int[] moves = b.OPOOL.get();
Rk c = best;
for (int i = 0; i < Const.MOVES; i++) {
moves[i] = c.pos;
c = c.prev;
}
return moves;
} finally {
unlock();
}
}
/**
* A sufficient move is the best move ranked among the children of a node,
* at end of evaluation or at time of cutoff.
*
* Weighting is greater the less the depth is. 2 ** (k - u)
*
* @param depth
* @param move
*/
public void addSufficientMove(int depth, int move) {
// gipf moves are ignored
if (move >= 42) {
move -= 42;
}
// we only lock on mutation
lock();
try {
int weight = 1 << depth;
Rk o = otable[move];
o.rank += weight;
int r = o.rank;
// already the best
if (o.next == null) {
return;
}
Rk c = o;
if (c.next.rank < r) {
boolean end = false;
do {
c = c.next;
if (c.next == null) {
end = true;
break;
}
} while (c.next.rank < r);
// seam up start
if (o.prev == null) {
o.next.prev = null;
} else {
o.prev.next = o.next;
o.next.prev = o.prev;
}
// insert later on
if (end) {
o.next = null;
o.prev = c;
c.next = o;
best = o;
} else {
Rk e = c.next;
e.prev = o;
o.next = e;
o.prev = c;
c.next = o;
}
}
} finally {
unlock();
}
}
public void clear() {
for (int i = 0; i < Const.MOVES; i++) {
otable[i] = new Rk(0, i, null, null);
}
otable[1].prev = otable[0];
for (int i = 1; i < Const.MOVES - 1; i++) {
otable[i - 1].next = otable[i];
otable[i + 1].prev = otable[i];
}
otable[Const.MOVES - 2].next = otable[Const.MOVES - 1];
best = otable[Const.MOVES - 1];
}
/**
* Do a postmortem analysis of the move.
*/
public void analyze() {
System.out
.println("** History table analysis results: sorted by move.");
int maxwidth = 2;
for (Rk i : otable) {
maxwidth = Math.max(maxwidth, (int) Math.ceil(Math.log10(i.rank)));
}
String fstring = String.format("%%%dd ", maxwidth);
System.out.print("** ");
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, i);
}
System.out.println();
System.out.print("** ");
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, otable[i].rank);
}
System.out.println();
System.out
.println("** History table analysis results: sorted by rank.");
System.out.print("** ");
Rk b = best;
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, b.pos);
b = b.prev;
}
System.out.println();
System.out.print("** ");
Rk c = best;
for (int i = 0; i < Const.MOVES; i++) {
System.out.format(fstring, c.rank);
c = c.prev;
}
System.out.println();
}
public static void hclear(HistoryTable t) {
t.clear();
}
public static HistoryTable hmake() {
return new HistoryTable(MAX_DEPTH);
}
public static void hadd(HistoryTable t, long depth, long move) {
t.addSufficientMove((int) depth, (int) move);
}
public static int[] hordering(HistoryTable t, ThreadBuffer b) {
return t.getMoveOrdering(b);
}
public static void hanalyze(HistoryTable t) {
if (t != null) {
t.analyze();
}
}
public static Line moveToLine(long move) {
return Const.listOfPushes[(int) move];
}
}
| 6,461 | 0.455812 | 0.44993 | 259 | 23.945946 | 19.477859 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.513514 | false | false | 1 |
2c75119678fdae5b1d553461ec189934a0a1d4ec | 7,292,854,507,051 | 11a0cf7915f544adae61b3590624e11bc5c13cf9 | /src/tsp/Node.java | 431bf839fef9bacb0842bf6c1d51aafe8ed7d491 | [] | no_license | joeryoost/Railhazer | https://github.com/joeryoost/Railhazer | 6d5acfa5dc5bdc27f210740ce68da119e98bda79 | 41d65b7ffbc5993e92dc452331e52f9b8c33c267 | refs/heads/master | "2020-03-17T21:10:25.673000" | "2018-05-18T11:34:23" | "2018-05-18T11:34:23" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tsp;
public class Node {
private int PositionX;
private int PositionY;
public Node(int x, int y) {
PositionX = x;
PositionY = y;
}
public int[] getLocation() {
int[] location = {PositionX, PositionY};
return location;
}
public void printNode(){
System.out.println("X:" + PositionX + "| Y:" + PositionY);
}
}
| UTF-8 | Java | 360 | java | Node.java | Java | [] | null | [] | package tsp;
public class Node {
private int PositionX;
private int PositionY;
public Node(int x, int y) {
PositionX = x;
PositionY = y;
}
public int[] getLocation() {
int[] location = {PositionX, PositionY};
return location;
}
public void printNode(){
System.out.println("X:" + PositionX + "| Y:" + PositionY);
}
}
| 360 | 0.608333 | 0.608333 | 19 | 17.947369 | 16.113001 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.736842 | false | false | 1 |
c65f57b4ef253244c6e5a2bac1e9d3b42a8074ca | 31,628,139,213,802 | cb89515e2a8bc8e977701951f7c3c9fae325e175 | /src/ManagerDashboard.java | 9e6a15975ed5052ba43f6c98712b98cb47d6fff7 | [] | no_license | deepika-mahendra/AssetManagementSystem | https://github.com/deepika-mahendra/AssetManagementSystem | 0c78e2987390fb40c68e99b1505b0ca0b8e4f08b | f1cb5f56e69a0580e56b6ea8851a38af140199bc | refs/heads/main | "2023-01-28T02:24:02.053000" | "2020-12-11T06:33:21" | "2020-12-11T06:33:21" | 320,485,846 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class ManagerDashboard extends JFrame{
public ManagerDashboard (Connection con,String userName) {
getContentPane().setLayout(null);
JLabel lblWelcome = new JLabel("Welcome");
lblWelcome.setFont(new Font("Yu Gothic Medium", Font.BOLD, 16));
lblWelcome.setBounds(137, 23, 79, 26);
getContentPane().add(lblWelcome);
JLabel user = new JLabel("");
user.setFont(new Font("Yu Gothic Medium", Font.BOLD, 16));
user.setBounds(208, 23, 97, 26);
getContentPane().add(user);
user.setText(userName);
JButton btnAssets = new JButton("Create Request");
btnAssets.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
CreateRequest req =new CreateRequest(con);
req.setVisible(true);
}
});
btnAssets.setBackground(Color.RED);
btnAssets.setBounds(51, 72, 122, 21);
getContentPane().add(btnAssets);
JButton btnRequest = new JButton("View Request");
btnRequest.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
viewRequests vr=new viewRequests(con);
vr.setVisible(true);
}
});
btnRequest.setBackground(Color.RED);
btnRequest.setBounds(208, 72, 122, 21);
getContentPane().add(btnRequest);
JButton btnAssets_1 = new JButton("Add Employee");
btnAssets_1.setBackground(Color.RED);
btnAssets_1.setBounds(51, 146, 122, 21);
getContentPane().add(btnAssets_1);
JButton btnAssets_2 = new JButton("Add Department");
btnAssets_2.setBackground(Color.RED);
btnAssets_2.setBounds(208, 146, 122, 21);
getContentPane().add(btnAssets_2);
JButton btnAssets_1_1 = new JButton("Logout");
btnAssets_1_1.setBackground(Color.RED);
btnAssets_1_1.setBounds(155, 193, 85, 21);
getContentPane().add(btnAssets_1_1);
setSize(400,300);
}
}
| UTF-8 | Java | 2,070 | java | ManagerDashboard.java | Java | [
{
"context": "26);\n\t\tgetContentPane().add(user);\n\t\tuser.setText(userName);\n\t\t\n\t\t\n\t\tJButton btnAssets = new JButton(\"Create",
"end": 751,
"score": 0.9058451056480408,
"start": 743,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class ManagerDashboard extends JFrame{
public ManagerDashboard (Connection con,String userName) {
getContentPane().setLayout(null);
JLabel lblWelcome = new JLabel("Welcome");
lblWelcome.setFont(new Font("Yu Gothic Medium", Font.BOLD, 16));
lblWelcome.setBounds(137, 23, 79, 26);
getContentPane().add(lblWelcome);
JLabel user = new JLabel("");
user.setFont(new Font("Yu Gothic Medium", Font.BOLD, 16));
user.setBounds(208, 23, 97, 26);
getContentPane().add(user);
user.setText(userName);
JButton btnAssets = new JButton("Create Request");
btnAssets.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
CreateRequest req =new CreateRequest(con);
req.setVisible(true);
}
});
btnAssets.setBackground(Color.RED);
btnAssets.setBounds(51, 72, 122, 21);
getContentPane().add(btnAssets);
JButton btnRequest = new JButton("View Request");
btnRequest.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
viewRequests vr=new viewRequests(con);
vr.setVisible(true);
}
});
btnRequest.setBackground(Color.RED);
btnRequest.setBounds(208, 72, 122, 21);
getContentPane().add(btnRequest);
JButton btnAssets_1 = new JButton("Add Employee");
btnAssets_1.setBackground(Color.RED);
btnAssets_1.setBounds(51, 146, 122, 21);
getContentPane().add(btnAssets_1);
JButton btnAssets_2 = new JButton("Add Department");
btnAssets_2.setBackground(Color.RED);
btnAssets_2.setBounds(208, 146, 122, 21);
getContentPane().add(btnAssets_2);
JButton btnAssets_1_1 = new JButton("Logout");
btnAssets_1_1.setBackground(Color.RED);
btnAssets_1_1.setBounds(155, 193, 85, 21);
getContentPane().add(btnAssets_1_1);
setSize(400,300);
}
}
| 2,070 | 0.718841 | 0.67343 | 71 | 28.15493 | 18.849775 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.802817 | false | false | 1 |
f03444afb3232365ee0d1a853a1f80e61dc97c02 | 29,850,022,753,849 | a1dadcc2f7169a61cf5a917cad64f482245bf4f7 | /src/Servlets/GetRoomInfo.java | 87ff12c717a9a559f80740ff2f8d11bb053e44f1 | [] | no_license | allenchannn/hotelManage | https://github.com/allenchannn/hotelManage | 574124be35a00a1ea3ee1ac41d6a095548a595f7 | 5c929ecce886b0c471db6cd554ba64bcbeb3319d | refs/heads/master | "2021-06-14T06:52:44.627000" | "2017-04-04T06:14:23" | "2017-04-04T06:14:23" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Servlets;
import DAO.RoomUtil;
import DAO.StuUtil;
import VO.Room;
import VO.Student;
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.sql.SQLException;
import java.util.List;
/**
* Created by linGo on 2017/4/2.
*/
public class GetRoomInfo extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req, resp);
}
protected void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/json");
int roomID =Integer.parseInt(req.getParameter("roomID")) ;
RoomUtil roomUtil = null;
StuUtil stuUtil = null;
List<Student> list =null;
int remain = 0;
try {
stuUtil = StuUtil.getStuUtil();
roomUtil = RoomUtil.getRoomUtil();
list = stuUtil.getStudentWithRoomID(roomID);
remain = roomUtil.remain(roomID);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
Room room = roomUtil.getRoomWithRoomID(roomID);
String roomStr = "{" +
"\"roomID\":" +room.getRoomID()+
",\"type\":" +room.getType()+
",\"front\":"+"\""+room.getFront()+"\""+
",\"pay\":"+room.getMonthRent()+
",\"remain\":"+remain+
",\"file\":"+ "\""+room.getFiles()+"\""+
",\"remark\":"+"\""+room.getComment()+"\""+
"}";
String stuStr = "";
for (int i = 0 ; i <list.size() ; i++){
stuStr += "{" +
"\"FirstName\":" +"\""+list.get(i).getFirstName()+"\""+
",\"LastName\":" +"\""+list.get(i).getLastName()+"\""+
",\"stuID\":\"" +list.get(i).getStuID()+
"\",\"ChineseName\":" +"\""+list.get(i).getChineseName()+"\""+
",\"arrivalDate\":" +"\""+list.get(i).getArrivalDate()+"\""+
",\"nationality\":" +"\""+list.get(i).getNationality()+"\""+
",\"galeDate\":" +"\""+list.get(i).getGaleDate()+"\"" +
",\"file\":"+"\""+list.get(i).getFiles()+"\"" +
"},";
}
try{
stuStr = stuStr.substring(0,stuStr.length()-1);
}catch (Exception e){stuStr=null;}
String str = "{\"feedback\":"+"[{\"room\":"+roomStr+"},{\"students\":["+stuStr+"]}]}";
if (stuStr==null)
str = "{\"feedback\":"+"[{\"room\":"+roomStr+"},{\"students\":"+null+"}]}";
resp.getWriter().print(str);
}
}
| UTF-8 | Java | 2,976 | java | GetRoomInfo.java | Java | [
{
"context": "ception;\nimport java.util.List;\n\n/**\n * Created by linGo on 2017/4/2.\n */\npublic class GetRoomInfo extends",
"end": 372,
"score": 0.9995298981666565,
"start": 367,
"tag": "USERNAME",
"value": "linGo"
}
] | null | [] | package Servlets;
import DAO.RoomUtil;
import DAO.StuUtil;
import VO.Room;
import VO.Student;
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.sql.SQLException;
import java.util.List;
/**
* Created by linGo on 2017/4/2.
*/
public class GetRoomInfo extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req, resp);
}
protected void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/json");
int roomID =Integer.parseInt(req.getParameter("roomID")) ;
RoomUtil roomUtil = null;
StuUtil stuUtil = null;
List<Student> list =null;
int remain = 0;
try {
stuUtil = StuUtil.getStuUtil();
roomUtil = RoomUtil.getRoomUtil();
list = stuUtil.getStudentWithRoomID(roomID);
remain = roomUtil.remain(roomID);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
Room room = roomUtil.getRoomWithRoomID(roomID);
String roomStr = "{" +
"\"roomID\":" +room.getRoomID()+
",\"type\":" +room.getType()+
",\"front\":"+"\""+room.getFront()+"\""+
",\"pay\":"+room.getMonthRent()+
",\"remain\":"+remain+
",\"file\":"+ "\""+room.getFiles()+"\""+
",\"remark\":"+"\""+room.getComment()+"\""+
"}";
String stuStr = "";
for (int i = 0 ; i <list.size() ; i++){
stuStr += "{" +
"\"FirstName\":" +"\""+list.get(i).getFirstName()+"\""+
",\"LastName\":" +"\""+list.get(i).getLastName()+"\""+
",\"stuID\":\"" +list.get(i).getStuID()+
"\",\"ChineseName\":" +"\""+list.get(i).getChineseName()+"\""+
",\"arrivalDate\":" +"\""+list.get(i).getArrivalDate()+"\""+
",\"nationality\":" +"\""+list.get(i).getNationality()+"\""+
",\"galeDate\":" +"\""+list.get(i).getGaleDate()+"\"" +
",\"file\":"+"\""+list.get(i).getFiles()+"\"" +
"},";
}
try{
stuStr = stuStr.substring(0,stuStr.length()-1);
}catch (Exception e){stuStr=null;}
String str = "{\"feedback\":"+"[{\"room\":"+roomStr+"},{\"students\":["+stuStr+"]}]}";
if (stuStr==null)
str = "{\"feedback\":"+"[{\"room\":"+roomStr+"},{\"students\":"+null+"}]}";
resp.getWriter().print(str);
}
}
| 2,976 | 0.520161 | 0.516129 | 77 | 37.649349 | 26.648636 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.779221 | false | false | 1 |
d2028141d5a7e5722b21a7b53c0281b73a17ad77 | 5,196,910,432,068 | a672f51bc7a28fd88cb096ad9c3448f0af90196c | /Yliopistobot/src/test/java/fi/johanneslares/yliopistobot/UserTest.java | a23457ab7931d474c2096f481bcf9ae7ccfdc755 | [] | no_license | JohannesLares/ohte | https://github.com/JohannesLares/ohte | 996d70838ea5ec0e5ca54c0a64c0f17b6e6276b4 | 51a51840a0bfb1bdb303811a4b65005ba8de757e | refs/heads/master | "2020-04-03T16:29:58.918000" | "2018-12-22T20:45:01" | "2018-12-22T20:45:01" | 155,407,140 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 fi.johanneslares.yliopistobot;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
/**
*
* @author jlares
*/
public class UserTest {
User user;
@Before
public void setUp(){
this.user = new User(123);
}
@Test
public void constructorCreatesNewUserWithCorrectId() {
assertEquals(user.getChatId(), 123);
}
@Test
public void lessonsWorkWithUser() {
user.addLesson(new Lesson("Exactum", "TEST", "10:00 Ti", "12:00", "60.109901 25.1111"));
user.addLesson(new Lesson("Exactum2", "NewTest", "12:00 Ti", "12:30", "60.109901 25.1111"));
assertEquals(user.getLessons().get(0).getLocation(), "Exactum");
assertEquals(user.getLessons().get(0).getName(), "TEST");
assertEquals(user.getLessons().get(1).getLocation(), "Exactum2");
assertEquals(user.getLessons().get(1).getStartTime(), "12:00 Ti");
assertEquals(user.getLessons().get(1).getEndTime(), "12:30");
}
@Test
public void setLessonsWorks() {
List<Lesson> lessons = new ArrayList<>();
lessons.add(new Lesson("Exactum3", "TEST1", "10:00 Ti", "12:00", "60.109901 25.1111"));
lessons.add(new Lesson("Exactum4", "NewTest", "12:00 Ti", "12:30", "60.109901 25.1111"));
user.setLessons(lessons);
assertEquals(user.getLessons().get(0).getLocation(), "Exactum3");
assertEquals(user.getLessons().get(0).getName(), "TEST1");
assertEquals(user.getLessons().get(1).getLocation(), "Exactum4");
assertEquals(user.getLessons().get(1).getStartTime(), "12:00 Ti");
assertEquals(user.getLessons().get(1).getEndTime(), "12:30");
}
@Test
public void homeLocationWorks() {
user.setHomeLocation("Helsinki");
assertEquals(user.getHomeLocation(), "Helsinki");
}
@Test
public void toStringWorksCorrectly() {
user.setHomeLocation("Lappeenranta");
assertEquals(user.toString(), "123 : Lappeenranta");
}
@Test
public void setChatIdWorks() {
user.setChatId(12345);
assertEquals(user.getChatId(), 12345);
}
}
| UTF-8 | Java | 2,437 | java | UserTest.java | Java | [
{
"context": ".Before;\nimport org.junit.Test;\n\n/**\n *\n * @author jlares\n */\npublic class UserTest {\n \n User user;\n ",
"end": 394,
"score": 0.9995110630989075,
"start": 388,
"tag": "USERNAME",
"value": "jlares"
},
{
"context": "assertEquals(user.getLessons().get(0).getName(), \"TEST1\");\n assertEquals(user.getLessons().get(1).",
"end": 1734,
"score": 0.9857759475708008,
"start": 1729,
"tag": "USERNAME",
"value": "TEST1"
}
] | null | [] | /*
* 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 fi.johanneslares.yliopistobot;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
/**
*
* @author jlares
*/
public class UserTest {
User user;
@Before
public void setUp(){
this.user = new User(123);
}
@Test
public void constructorCreatesNewUserWithCorrectId() {
assertEquals(user.getChatId(), 123);
}
@Test
public void lessonsWorkWithUser() {
user.addLesson(new Lesson("Exactum", "TEST", "10:00 Ti", "12:00", "60.109901 25.1111"));
user.addLesson(new Lesson("Exactum2", "NewTest", "12:00 Ti", "12:30", "60.109901 25.1111"));
assertEquals(user.getLessons().get(0).getLocation(), "Exactum");
assertEquals(user.getLessons().get(0).getName(), "TEST");
assertEquals(user.getLessons().get(1).getLocation(), "Exactum2");
assertEquals(user.getLessons().get(1).getStartTime(), "12:00 Ti");
assertEquals(user.getLessons().get(1).getEndTime(), "12:30");
}
@Test
public void setLessonsWorks() {
List<Lesson> lessons = new ArrayList<>();
lessons.add(new Lesson("Exactum3", "TEST1", "10:00 Ti", "12:00", "60.109901 25.1111"));
lessons.add(new Lesson("Exactum4", "NewTest", "12:00 Ti", "12:30", "60.109901 25.1111"));
user.setLessons(lessons);
assertEquals(user.getLessons().get(0).getLocation(), "Exactum3");
assertEquals(user.getLessons().get(0).getName(), "TEST1");
assertEquals(user.getLessons().get(1).getLocation(), "Exactum4");
assertEquals(user.getLessons().get(1).getStartTime(), "12:00 Ti");
assertEquals(user.getLessons().get(1).getEndTime(), "12:30");
}
@Test
public void homeLocationWorks() {
user.setHomeLocation("Helsinki");
assertEquals(user.getHomeLocation(), "Helsinki");
}
@Test
public void toStringWorksCorrectly() {
user.setHomeLocation("Lappeenranta");
assertEquals(user.toString(), "123 : Lappeenranta");
}
@Test
public void setChatIdWorks() {
user.setChatId(12345);
assertEquals(user.getChatId(), 12345);
}
}
| 2,437 | 0.628231 | 0.570373 | 74 | 31.932432 | 29.075081 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.864865 | false | false | 1 |
8a395ea5cb3f726c0e07907bdbfced2606d39fda | 14,018,773,298,744 | 46a771ad81fdc2e724c89c9723522a8b2cb1c211 | /src/main/resources/archetype-resources/__rootArtifactId__-web/src/main/java/commons/web/errorhandling/RestValidationExceptionHandler.java | b865a29bd7b15550ac7b02c2c3ea06e405034e8e | [] | no_license | omblanco/spring-boot-webflux-multi-module-api-archetype | https://github.com/omblanco/spring-boot-webflux-multi-module-api-archetype | fe7c484b78269af8221419847cb04d170416b1c2 | 8c3f1a789cc4189c7eb28e35eecf4c1e3e44baa4 | refs/heads/master | "2023-02-01T08:20:18.967000" | "2020-12-20T19:44:01" | "2020-12-20T19:44:01" | 323,127,283 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | #set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.commons.web.errorhandling;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.support.WebExchangeBindException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebExceptionHandler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Mono;
/**
* Handler que captura las excepciones de las peticiones con modelos anotados con @Valid
* @author oscar.martinezblanco
*
*/
// see: https://github.com/hantsy/angular-spring-reactive-sample/blob/master/server/src/main/java/com/example/demo/RestExceptionHandler.java
// see: https://stackoverflow.com/questions/47631243/spring-5-reactive-webexceptionhandler-is-not-getting-called
// and https://docs.spring.io/spring-boot/docs/2.0.0.M7/reference/html/boot-features-developing-web-applications.html${symbol_pound}boot-features-webflux-error-handling
// and https://stackoverflow.com/questions/48047645/how-to-write-messages-to-http-body-in-spring-webflux-webexceptionhandlder/48057896${symbol_pound}48057896
@RequiredArgsConstructor
public class RestValidationExceptionHandler implements WebExceptionHandler {
private static final Logger LOG = LoggerFactory.getLogger(RestValidationExceptionHandler.class);
private final ObjectMapper objectMapper;
@Override
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
if (ex instanceof WebExchangeBindException) {
var webExchangeBindException = (WebExchangeBindException) ex;
LOG.debug("Excepción de validación", ex);
ValidationErrorsResponse errors = new ValidationErrorsResponse(HttpStatus.UNPROCESSABLE_ENTITY.name(),
webExchangeBindException.getReason().concat(": ")
.concat(webExchangeBindException.getObjectName().replace("Mono", "")));
webExchangeBindException.getFieldErrors().forEach(e ->
errors.add(e.getField(), e.getCode(), e.getDefaultMessage()));
try {
exchange.getResponse().setStatusCode(HttpStatus.UNPROCESSABLE_ENTITY);
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON);
var db = new DefaultDataBufferFactory().wrap(objectMapper.writeValueAsBytes(errors));
return exchange.getResponse().writeWith(Mono.just(db));
} catch (JsonProcessingException e) {
LOG.error("Error procesando json", e);
return Mono.empty();
}
}
return Mono.error(ex);
}
}
| UTF-8 | Java | 2,992 | java | RestValidationExceptionHandler.java | Java | [
{
"context": "iciones con modelos anotados con @Valid\n * @author oscar.martinezblanco\n *\n */\n// see: https://github.com/hantsy/angular-",
"end": 844,
"score": 0.8579011559486389,
"start": 824,
"tag": "NAME",
"value": "oscar.martinezblanco"
},
{
"context": ".martinezblanco\n *\n */\n// see: https://github.com/hantsy/angular-spring-reactive-sample/blob/master/server",
"end": 885,
"score": 0.9690784811973572,
"start": 879,
"tag": "USERNAME",
"value": "hantsy"
}
] | null | [] | #set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.commons.web.errorhandling;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.support.WebExchangeBindException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebExceptionHandler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Mono;
/**
* Handler que captura las excepciones de las peticiones con modelos anotados con @Valid
* @author oscar.martinezblanco
*
*/
// see: https://github.com/hantsy/angular-spring-reactive-sample/blob/master/server/src/main/java/com/example/demo/RestExceptionHandler.java
// see: https://stackoverflow.com/questions/47631243/spring-5-reactive-webexceptionhandler-is-not-getting-called
// and https://docs.spring.io/spring-boot/docs/2.0.0.M7/reference/html/boot-features-developing-web-applications.html${symbol_pound}boot-features-webflux-error-handling
// and https://stackoverflow.com/questions/48047645/how-to-write-messages-to-http-body-in-spring-webflux-webexceptionhandlder/48057896${symbol_pound}48057896
@RequiredArgsConstructor
public class RestValidationExceptionHandler implements WebExceptionHandler {
private static final Logger LOG = LoggerFactory.getLogger(RestValidationExceptionHandler.class);
private final ObjectMapper objectMapper;
@Override
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
if (ex instanceof WebExchangeBindException) {
var webExchangeBindException = (WebExchangeBindException) ex;
LOG.debug("Excepción de validación", ex);
ValidationErrorsResponse errors = new ValidationErrorsResponse(HttpStatus.UNPROCESSABLE_ENTITY.name(),
webExchangeBindException.getReason().concat(": ")
.concat(webExchangeBindException.getObjectName().replace("Mono", "")));
webExchangeBindException.getFieldErrors().forEach(e ->
errors.add(e.getField(), e.getCode(), e.getDefaultMessage()));
try {
exchange.getResponse().setStatusCode(HttpStatus.UNPROCESSABLE_ENTITY);
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON);
var db = new DefaultDataBufferFactory().wrap(objectMapper.writeValueAsBytes(errors));
return exchange.getResponse().writeWith(Mono.just(db));
} catch (JsonProcessingException e) {
LOG.error("Error procesando json", e);
return Mono.empty();
}
}
return Mono.error(ex);
}
}
| 2,992 | 0.725084 | 0.71204 | 63 | 46.460316 | 40.450569 | 168 | false | false | 0 | 0 | 0 | 0 | 77 | 0.025753 | 0.52381 | false | false | 1 |
723c6f03cb6b2a0b2b0508e4788af9d8e486a951 | 15,470,472,245,267 | 38aa8bb32c0487a4d605ec95e82911ede9f3aabe | /memoizeit/src-profiler-fields/memoizeit/field/profiler/MyManager.java | 10d4bf636e85e5490f2cbc818b470faeb9a60ce3 | [
"Apache-2.0"
] | permissive | lucadt/memoizeit | https://github.com/lucadt/memoizeit | d07118360e741aff71cd742a92fa0ddd47074767 | 1aa14cb60ecc20156b6beae02e06ef9d3dbc413e | refs/heads/master | "2016-09-15T19:47:45.125000" | "2016-01-15T00:10:57" | "2016-01-15T00:10:57" | 39,065,331 | 4 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package memoizeit.field.profiler;
import memoizeit.asm.Manager;
import memoizeit.asm.util.DumpHelper;
import memoizeit.asm.util.ids.FieldId;
import memoizeit.asm.util.ids.MethodId;
import memoizeit.field.instr.Options;
public final class MyManager extends Manager {
private static final MyManager INSTANCE = new MyManager();
public static synchronized MyManager getInstance() {
return INSTANCE;
}
@Override
protected void onPostProcessThreads() {
DumpHelper.writeStringToFile(Options.getMethodsFile(), MethodId.getInstance().onExport());
DumpHelper.writeStringToFile(Options.getFieldsFile(), FieldId.getInstance().onExport());
}
}
| UTF-8 | Java | 662 | java | MyManager.java | Java | [] | null | [] | package memoizeit.field.profiler;
import memoizeit.asm.Manager;
import memoizeit.asm.util.DumpHelper;
import memoizeit.asm.util.ids.FieldId;
import memoizeit.asm.util.ids.MethodId;
import memoizeit.field.instr.Options;
public final class MyManager extends Manager {
private static final MyManager INSTANCE = new MyManager();
public static synchronized MyManager getInstance() {
return INSTANCE;
}
@Override
protected void onPostProcessThreads() {
DumpHelper.writeStringToFile(Options.getMethodsFile(), MethodId.getInstance().onExport());
DumpHelper.writeStringToFile(Options.getFieldsFile(), FieldId.getInstance().onExport());
}
}
| 662 | 0.779456 | 0.779456 | 23 | 27.782608 | 27.316114 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.086957 | false | false | 1 |
046093fccd94042c02ebefe241791a26e542ea68 | 28,132,035,814,909 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_1c998d16c032a1304a240585c1b9016be70568b3/TestStatisticsMap/2_1c998d16c032a1304a240585c1b9016be70568b3_TestStatisticsMap_s.java | 67bbdfd9029b23d9448f880ea389d1826faff939 | [] | no_license | zhongxingyu/Seer | https://github.com/zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | "2023-07-06T12:48:55.516000" | "2023-06-22T07:55:56" | "2023-06-22T07:55:56" | 259,613,157 | 6 | 2 | null | false | "2023-06-22T07:55:57" | "2020-04-28T11:07:49" | "2023-06-21T00:53:27" | "2023-06-22T07:55:57" | 2,849,868 | 2 | 2 | 0 | null | false | false | // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Philip Aston
// All rights reserved.
//
// This file is part of The Grinder software distribution. Refer to
// the file LICENSE which is part of The Grinder distribution for
// licensing details. The Grinder distribution is available on the
// Internet at http://grinder.sourceforge.net/
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
package net.grinder.statistics;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Map;
import java.util.TreeMap;
import net.grinder.common.AbstractTestSemantics;
import net.grinder.common.GrinderProperties;
import net.grinder.common.Test;
/**
* A map of test numbers to {@link TestStatistics}s.
*
* <p>Test statistics synchronisation occurs at the granularity of the
* contained {@link RawStatistics} instances. The map is synchronised
* on the <code>TestStatisticsMap</code> itself.</p>
*
* @author Philip Aston
* @version $Revision$
*/
public class TestStatisticsMap implements java.io.Externalizable {
// The serialVersionUID should be incremented whenever the default
// statistic indicies are changed in StatisticsIndexMap.
private static final long serialVersionUID = 2L;
/**
* Use a TreeMap so we store in test number order. Synchronise on
* this TestStatisticsMap before accessing.
*/
private final Map m_data = new TreeMap();
/**
* Creates a new <code>TestStatisticsMap</code> instance.
*/
public TestStatisticsMap() {
}
/**
* Put a new {test, statistics} pair in the map.
*
* @param test A test.
* @param statistics The test's statistics.
*/
public final void put(Test test, TestStatistics statistics) {
if (!(statistics instanceof TestStatisticsImplementation)) {
throw new RuntimeException(
"TestStatistics implementation not supported");
}
synchronized (this) {
m_data.put(test, statistics);
}
}
/**
* Return the number of entries in the
* <code>TestStatisticsMap</code>. For use by the unit tests.
*
* @return an <code>int</code> value
*/
final int size() {
return m_data.size();
}
/**
* Add the values in another <code>TestStatisticsMap</code> to this
* <code>TestStatisticsMap</code>.
*
* @param other The other <code>TestStatisticsMap</code>.
*/
public final void add(TestStatisticsMap other) {
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
synchronized (other) {
final Iterator otherIterator = other.new Iterator();
while (otherIterator.hasNext()) {
final Pair othersPair = otherIterator.next();
final TestStatistics statistics;
synchronized (this) {
final TestStatistics existingStatistics =
(TestStatistics)m_data.get(othersPair.getTest());
if (existingStatistics == null) {
statistics = testStatisticsFactory.create();
put(othersPair.getTest(), statistics);
}
else {
statistics = existingStatistics;
}
}
statistics.add(othersPair.getStatistics());
}
}
}
/**
* Reset all our statistics and return a snapshot.
*
* @return The snapshot.
*/
public TestStatisticsMap reset() {
final TestStatisticsMap result = new TestStatisticsMap();
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
synchronized (this) {
final Iterator iterator = new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
final TestStatistics statistics = pair.getStatistics();
final TestStatistics snapshot;
synchronized (statistics) {
snapshot = (TestStatistics)statistics.snapshot();
statistics.reset();
}
result.put(pair.getTest(), snapshot);
}
}
return result;
}
/**
* Implement value based equality. Used by unit tests, so we don't
* bother with synchronisation.
*
* @param o <code>Object</code> to compare to.
* @return <code>true</code> if and only if the two objects are equal.
*/
public final boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof TestStatisticsMap)) {
return false;
}
final TestStatisticsMap otherMap = (TestStatisticsMap)o;
if (m_data.size() != otherMap.m_data.size()) {
return false;
}
final Iterator iterator = new Iterator();
final Iterator otherIterator = otherMap.new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
final Pair otherPair = otherIterator.next();
if (!pair.getTest().equals(otherPair.getTest()) ||
!pair.getStatistics().equals(otherPair.getStatistics())) {
return false;
}
}
return true;
}
/**
* Defer to <code>Object.hashCode().</code>
*
* <p>We define <code>hashCode</code> to keep Checkstyle happy, but
* we don't use it.
*
* @return The hash code.
*/
public final int hashCode() {
return super.hashCode();
}
/**
* Return a <code>String</code> representation of this
* <code>TestStatisticsMap</code>.
*
* @return The <code>String</code>
*/
public String toString() {
final StringBuffer result = new StringBuffer();
result.append("TestStatisticsMap = {");
synchronized (this) {
final Iterator iterator = new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
result.append("(");
result.append(pair.getTest());
result.append(", ");
result.append(pair.getStatistics());
result.append(")");
}
}
result.append("}");
return result.toString();
}
/**
* Efficient externalisation method.
*
* @param out Handle to the output stream.
* @exception IOException If an I/O error occurs.
*/
public void writeExternal(ObjectOutput out) throws IOException {
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
synchronized (this) {
out.writeInt(m_data.size());
final Iterator iterator = new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
out.writeInt(pair.getTest().getNumber());
// Its a class invariant that our TestStatistics are all
// TestStatisticsImplementations.
testStatisticsFactory.writeStatisticsExternal(
out, (TestStatisticsImplementation)pair.getStatistics());
}
}
}
/**
* Efficient externalisation method. No synchronisation, assume that
* we're being read into a new instance.
*
* @param in Handle to the input stream.
* @exception IOException If an I/O error occurs.
*/
public void readExternal(ObjectInput in) throws IOException {
final int n = in.readInt();
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
m_data.clear();
for (int i = 0; i < n; i++) {
m_data.put(new LightweightTest(in.readInt()),
testStatisticsFactory.readStatisticsExternal(in));
}
}
/**
* Light weight test implementation that the console uses.
*/
private static final class LightweightTest extends AbstractTestSemantics {
private final int m_number;
public LightweightTest(int number) {
m_number = number;
}
public int getNumber() {
return m_number;
}
public String getDescription() {
return "";
}
public GrinderProperties getParameters() {
throw new UnsupportedOperationException(
getClass().getName() + ".LightweightTest.getParameters()");
}
}
/**
* A type safe iterator. Should synchronize on the
* <code>TestStatisticsMap</code> around use.
*/
public final class Iterator {
private final java.util.Iterator m_iterator;
/**
* Creates a new <code>Iterator</code> instance.
*/
public Iterator() {
m_iterator = m_data.entrySet().iterator();
}
/**
* Check whether we are at the end of the {@link
* TestStatisticsMap}.
*
* @return <code>true</code> if there is a next {@link
* TestStatisticsMap.Pair}.
*/
public boolean hasNext() {
return m_iterator.hasNext();
}
/**
* Get the next {@link TestStatisticsMap.Pair} from the {@link
* TestStatisticsMap}.
*
* @return The next {@link TestStatisticsMap.Pair}.
* @throws java.util.NoSuchElementException If there is no next element.
*/
public Pair next() {
final Map.Entry entry = (Map.Entry)m_iterator.next();
final Test test = (Test)entry.getKey();
final TestStatistics statistics = (TestStatistics)entry.getValue();
return new Pair(test, statistics);
}
}
/**
* A type safe pair of a {@link net.grinder.common.Test} and a
* {@link TestStatistics}.
*/
public static final class Pair {
private final Test m_test;
private final TestStatistics m_statistics;
private Pair(Test test, TestStatistics statistics) {
m_test = test;
m_statistics = statistics;
}
/**
* Get the {@link net.grinder.common.Test}.
*
* @return The {@link net.grinder.common.Test}.
*/
public Test getTest() {
return m_test;
}
/**
* Get the {@link TestStatistics}.
*
* @return The {@link TestStatistics}.
*/
public TestStatistics getStatistics() {
return m_statistics;
}
}
}
| UTF-8 | Java | 10,777 | java | 2_1c998d16c032a1304a240585c1b9016be70568b3_TestStatisticsMap_s.java | Java | [
{
"context": "/ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Philip Aston\n // All rights reserved.\n //\n // This file is par",
"end": 65,
"score": 0.9998684525489807,
"start": 53,
"tag": "NAME",
"value": "Philip Aston"
},
{
"context": "stStatisticsMap</code> itself.</p>\n *\n * @author Philip Aston\n * @version $Revision$\n */\n public class TestSt",
"end": 1744,
"score": 0.9998774528503418,
"start": 1732,
"tag": "NAME",
"value": "Philip Aston"
}
] | null | [] | // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 <NAME>
// All rights reserved.
//
// This file is part of The Grinder software distribution. Refer to
// the file LICENSE which is part of The Grinder distribution for
// licensing details. The Grinder distribution is available on the
// Internet at http://grinder.sourceforge.net/
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
package net.grinder.statistics;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Map;
import java.util.TreeMap;
import net.grinder.common.AbstractTestSemantics;
import net.grinder.common.GrinderProperties;
import net.grinder.common.Test;
/**
* A map of test numbers to {@link TestStatistics}s.
*
* <p>Test statistics synchronisation occurs at the granularity of the
* contained {@link RawStatistics} instances. The map is synchronised
* on the <code>TestStatisticsMap</code> itself.</p>
*
* @author <NAME>
* @version $Revision$
*/
public class TestStatisticsMap implements java.io.Externalizable {
// The serialVersionUID should be incremented whenever the default
// statistic indicies are changed in StatisticsIndexMap.
private static final long serialVersionUID = 2L;
/**
* Use a TreeMap so we store in test number order. Synchronise on
* this TestStatisticsMap before accessing.
*/
private final Map m_data = new TreeMap();
/**
* Creates a new <code>TestStatisticsMap</code> instance.
*/
public TestStatisticsMap() {
}
/**
* Put a new {test, statistics} pair in the map.
*
* @param test A test.
* @param statistics The test's statistics.
*/
public final void put(Test test, TestStatistics statistics) {
if (!(statistics instanceof TestStatisticsImplementation)) {
throw new RuntimeException(
"TestStatistics implementation not supported");
}
synchronized (this) {
m_data.put(test, statistics);
}
}
/**
* Return the number of entries in the
* <code>TestStatisticsMap</code>. For use by the unit tests.
*
* @return an <code>int</code> value
*/
final int size() {
return m_data.size();
}
/**
* Add the values in another <code>TestStatisticsMap</code> to this
* <code>TestStatisticsMap</code>.
*
* @param other The other <code>TestStatisticsMap</code>.
*/
public final void add(TestStatisticsMap other) {
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
synchronized (other) {
final Iterator otherIterator = other.new Iterator();
while (otherIterator.hasNext()) {
final Pair othersPair = otherIterator.next();
final TestStatistics statistics;
synchronized (this) {
final TestStatistics existingStatistics =
(TestStatistics)m_data.get(othersPair.getTest());
if (existingStatistics == null) {
statistics = testStatisticsFactory.create();
put(othersPair.getTest(), statistics);
}
else {
statistics = existingStatistics;
}
}
statistics.add(othersPair.getStatistics());
}
}
}
/**
* Reset all our statistics and return a snapshot.
*
* @return The snapshot.
*/
public TestStatisticsMap reset() {
final TestStatisticsMap result = new TestStatisticsMap();
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
synchronized (this) {
final Iterator iterator = new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
final TestStatistics statistics = pair.getStatistics();
final TestStatistics snapshot;
synchronized (statistics) {
snapshot = (TestStatistics)statistics.snapshot();
statistics.reset();
}
result.put(pair.getTest(), snapshot);
}
}
return result;
}
/**
* Implement value based equality. Used by unit tests, so we don't
* bother with synchronisation.
*
* @param o <code>Object</code> to compare to.
* @return <code>true</code> if and only if the two objects are equal.
*/
public final boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof TestStatisticsMap)) {
return false;
}
final TestStatisticsMap otherMap = (TestStatisticsMap)o;
if (m_data.size() != otherMap.m_data.size()) {
return false;
}
final Iterator iterator = new Iterator();
final Iterator otherIterator = otherMap.new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
final Pair otherPair = otherIterator.next();
if (!pair.getTest().equals(otherPair.getTest()) ||
!pair.getStatistics().equals(otherPair.getStatistics())) {
return false;
}
}
return true;
}
/**
* Defer to <code>Object.hashCode().</code>
*
* <p>We define <code>hashCode</code> to keep Checkstyle happy, but
* we don't use it.
*
* @return The hash code.
*/
public final int hashCode() {
return super.hashCode();
}
/**
* Return a <code>String</code> representation of this
* <code>TestStatisticsMap</code>.
*
* @return The <code>String</code>
*/
public String toString() {
final StringBuffer result = new StringBuffer();
result.append("TestStatisticsMap = {");
synchronized (this) {
final Iterator iterator = new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
result.append("(");
result.append(pair.getTest());
result.append(", ");
result.append(pair.getStatistics());
result.append(")");
}
}
result.append("}");
return result.toString();
}
/**
* Efficient externalisation method.
*
* @param out Handle to the output stream.
* @exception IOException If an I/O error occurs.
*/
public void writeExternal(ObjectOutput out) throws IOException {
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
synchronized (this) {
out.writeInt(m_data.size());
final Iterator iterator = new Iterator();
while (iterator.hasNext()) {
final Pair pair = iterator.next();
out.writeInt(pair.getTest().getNumber());
// Its a class invariant that our TestStatistics are all
// TestStatisticsImplementations.
testStatisticsFactory.writeStatisticsExternal(
out, (TestStatisticsImplementation)pair.getStatistics());
}
}
}
/**
* Efficient externalisation method. No synchronisation, assume that
* we're being read into a new instance.
*
* @param in Handle to the input stream.
* @exception IOException If an I/O error occurs.
*/
public void readExternal(ObjectInput in) throws IOException {
final int n = in.readInt();
final TestStatisticsFactory testStatisticsFactory =
TestStatisticsFactory.getInstance();
m_data.clear();
for (int i = 0; i < n; i++) {
m_data.put(new LightweightTest(in.readInt()),
testStatisticsFactory.readStatisticsExternal(in));
}
}
/**
* Light weight test implementation that the console uses.
*/
private static final class LightweightTest extends AbstractTestSemantics {
private final int m_number;
public LightweightTest(int number) {
m_number = number;
}
public int getNumber() {
return m_number;
}
public String getDescription() {
return "";
}
public GrinderProperties getParameters() {
throw new UnsupportedOperationException(
getClass().getName() + ".LightweightTest.getParameters()");
}
}
/**
* A type safe iterator. Should synchronize on the
* <code>TestStatisticsMap</code> around use.
*/
public final class Iterator {
private final java.util.Iterator m_iterator;
/**
* Creates a new <code>Iterator</code> instance.
*/
public Iterator() {
m_iterator = m_data.entrySet().iterator();
}
/**
* Check whether we are at the end of the {@link
* TestStatisticsMap}.
*
* @return <code>true</code> if there is a next {@link
* TestStatisticsMap.Pair}.
*/
public boolean hasNext() {
return m_iterator.hasNext();
}
/**
* Get the next {@link TestStatisticsMap.Pair} from the {@link
* TestStatisticsMap}.
*
* @return The next {@link TestStatisticsMap.Pair}.
* @throws java.util.NoSuchElementException If there is no next element.
*/
public Pair next() {
final Map.Entry entry = (Map.Entry)m_iterator.next();
final Test test = (Test)entry.getKey();
final TestStatistics statistics = (TestStatistics)entry.getValue();
return new Pair(test, statistics);
}
}
/**
* A type safe pair of a {@link net.grinder.common.Test} and a
* {@link TestStatistics}.
*/
public static final class Pair {
private final Test m_test;
private final TestStatistics m_statistics;
private Pair(Test test, TestStatistics statistics) {
m_test = test;
m_statistics = statistics;
}
/**
* Get the {@link net.grinder.common.Test}.
*
* @return The {@link net.grinder.common.Test}.
*/
public Test getTest() {
return m_test;
}
/**
* Get the {@link TestStatistics}.
*
* @return The {@link TestStatistics}.
*/
public TestStatistics getStatistics() {
return m_statistics;
}
}
}
| 10,765 | 0.628375 | 0.625963 | 385 | 26.989611 | 23.645651 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.319481 | false | false | 1 |
d0906b2ed6b245531ad86541c74c67714ee6834d | 10,754,598,146,639 | 12f7f545f4f105cc64989e13d3bb6335a6e883f1 | /src/com/sammyer/yahtzee/DiceRollHashTable.java | 53e8fff0536765a5838356eb57b50b7df3723886 | [] | no_license | sammyer/yahtzee-intelligence | https://github.com/sammyer/yahtzee-intelligence | 8efc840350bf81ee47fcb0e573d10ecdc30c57f4 | 69e47fe8ce02c64f9eb7b191805aea6ee47bdfb1 | refs/heads/master | "2021-01-23T12:45:42.133000" | "2015-04-14T20:20:08" | "2015-04-14T20:20:51" | 33,622,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sammyer.yahtzee;
/**
* Created with IntelliJ IDEA.
* User: sam
* Date: 06/04/15
* Time: 4:18 PM
* To change this template use File | Settings | File Templates.
*/
public class DiceRollHashTable {
//dice is stored as 0xABCDEF where A,B,C,D,E,F is the number of 6s, 5s, 4s, 3s, 2s, and 1s
//found in the roll
//it can be converted also into a densely packed hash value for array storage
private static int[] DICE_HASH_INDEX={0,1,7,28,84,210,462}; //i.e. 7 choose x
public static int HASH_SIZE =462;
//lookup table hash->dice
private int[] unhashTable;
//lookup table hash->number of permutations of this combination of dice (since dice are unordered)
//e.g. there is one way you can roll 1,1,1,1,1 but 120 ways you can roll a straight with one of each number 1-5
private int[] permutationTable;
private static DiceRollHashTable instance;
protected DiceRollHashTable() {
unhashTable=new int[HASH_SIZE];
permutationTable=new int[HASH_SIZE];
for (int i=0;i< HASH_SIZE;i++) {
int dice=doUnhashDice(i);
unhashTable[i]=dice;
permutationTable[i]=calculatePermutations(dice);
}
}
public static DiceRollHashTable getInstance() {
if (instance==null) instance=new DiceRollHashTable();
return instance;
}
private static int[] CHOOSE5={0,1,5,15,35,70,126,210};
private int getOffset(int level, int diceLeft) {
int n=7-level;
switch (diceLeft) {
case 0: return 0;
case 1: return 1;
case 2: return n;
case 3: return n*(n+1)/2;
case 4: return n*(n+1)*(n+2)/6;
case 5: return CHOOSE5[n];
default: return 0;
}
}
public int hashDice(int dice) {
int hash=0;
int diceLeft=DiceRoll.getNumDice(dice);
for (int i=0;i<6;i++) {
hash+=getOffset(i,diceLeft);
diceLeft-=(dice&0xF);
dice>>=4;
}
return hash;
}
private int doUnhashDice(int hash) {
int diceLeft=0;
int prevDiceLeft=0;
boolean firstTime=true;
int dice=0;
int pos=1;
for (int i=0;i<6;i++) {
prevDiceLeft=diceLeft;
diceLeft=offsetToDiceLeft(hash,i);
hash-=getOffset(i,diceLeft);
if (firstTime) firstTime=false;
else {
dice+=pos*(prevDiceLeft-diceLeft);
pos<<=4;
}
}
dice+=pos*diceLeft;
return dice;
}
private int offsetToDiceLeft(int x, int level) {
for (int i=5;i>0;i--) if (x>=getOffset(level,i)) return i;
return 0;
}
public int startHashIdx(int numDice) {
return DICE_HASH_INDEX[numDice];
}
public int endHashIdx(int numDice) {
return DICE_HASH_INDEX[numDice+1];
}
public int unhashDice(int hash) {
return unhashTable[hash];
}
private int factorial(int n) {
switch (n) {
case 2: return 2;
case 3: return 6;
case 4: return 24;
case 5: return 120;
}
return 1;
}
public int numPermutations(int hash) {
return permutationTable[hash];
}
private int calculatePermutations(int dice) {
int numDice=DiceRoll.getNumDice(dice);
int n=factorial(numDice);
for (int i=0;i<6;i++) {
int count=(dice&0xF);
if (count>1) n/=factorial(count);
dice>>=4;
}
return n;
}
}
/*
def hd5(a):
while len(a)<5: a.insert(0,0)
x=0
for i in range(5):
x+=choose(10-i-a[i],5-i)
return x
def hdrev(x):
a=[]
for i in range(5):
for j in range(7):
v=choose(10-i-j,5-i)
if x>=v:
a.append(j)
x-=v
break
*/ | UTF-8 | Java | 3,256 | java | DiceRollHashTable.java | Java | [
{
"context": "tzee;\n\n/**\n * Created with IntelliJ IDEA.\n * User: sam\n * Date: 06/04/15\n * Time: 4:18 PM\n * To change t",
"end": 77,
"score": 0.9956140518188477,
"start": 74,
"tag": "USERNAME",
"value": "sam"
}
] | null | [] | package com.sammyer.yahtzee;
/**
* Created with IntelliJ IDEA.
* User: sam
* Date: 06/04/15
* Time: 4:18 PM
* To change this template use File | Settings | File Templates.
*/
public class DiceRollHashTable {
//dice is stored as 0xABCDEF where A,B,C,D,E,F is the number of 6s, 5s, 4s, 3s, 2s, and 1s
//found in the roll
//it can be converted also into a densely packed hash value for array storage
private static int[] DICE_HASH_INDEX={0,1,7,28,84,210,462}; //i.e. 7 choose x
public static int HASH_SIZE =462;
//lookup table hash->dice
private int[] unhashTable;
//lookup table hash->number of permutations of this combination of dice (since dice are unordered)
//e.g. there is one way you can roll 1,1,1,1,1 but 120 ways you can roll a straight with one of each number 1-5
private int[] permutationTable;
private static DiceRollHashTable instance;
protected DiceRollHashTable() {
unhashTable=new int[HASH_SIZE];
permutationTable=new int[HASH_SIZE];
for (int i=0;i< HASH_SIZE;i++) {
int dice=doUnhashDice(i);
unhashTable[i]=dice;
permutationTable[i]=calculatePermutations(dice);
}
}
public static DiceRollHashTable getInstance() {
if (instance==null) instance=new DiceRollHashTable();
return instance;
}
private static int[] CHOOSE5={0,1,5,15,35,70,126,210};
private int getOffset(int level, int diceLeft) {
int n=7-level;
switch (diceLeft) {
case 0: return 0;
case 1: return 1;
case 2: return n;
case 3: return n*(n+1)/2;
case 4: return n*(n+1)*(n+2)/6;
case 5: return CHOOSE5[n];
default: return 0;
}
}
public int hashDice(int dice) {
int hash=0;
int diceLeft=DiceRoll.getNumDice(dice);
for (int i=0;i<6;i++) {
hash+=getOffset(i,diceLeft);
diceLeft-=(dice&0xF);
dice>>=4;
}
return hash;
}
private int doUnhashDice(int hash) {
int diceLeft=0;
int prevDiceLeft=0;
boolean firstTime=true;
int dice=0;
int pos=1;
for (int i=0;i<6;i++) {
prevDiceLeft=diceLeft;
diceLeft=offsetToDiceLeft(hash,i);
hash-=getOffset(i,diceLeft);
if (firstTime) firstTime=false;
else {
dice+=pos*(prevDiceLeft-diceLeft);
pos<<=4;
}
}
dice+=pos*diceLeft;
return dice;
}
private int offsetToDiceLeft(int x, int level) {
for (int i=5;i>0;i--) if (x>=getOffset(level,i)) return i;
return 0;
}
public int startHashIdx(int numDice) {
return DICE_HASH_INDEX[numDice];
}
public int endHashIdx(int numDice) {
return DICE_HASH_INDEX[numDice+1];
}
public int unhashDice(int hash) {
return unhashTable[hash];
}
private int factorial(int n) {
switch (n) {
case 2: return 2;
case 3: return 6;
case 4: return 24;
case 5: return 120;
}
return 1;
}
public int numPermutations(int hash) {
return permutationTable[hash];
}
private int calculatePermutations(int dice) {
int numDice=DiceRoll.getNumDice(dice);
int n=factorial(numDice);
for (int i=0;i<6;i++) {
int count=(dice&0xF);
if (count>1) n/=factorial(count);
dice>>=4;
}
return n;
}
}
/*
def hd5(a):
while len(a)<5: a.insert(0,0)
x=0
for i in range(5):
x+=choose(10-i-a[i],5-i)
return x
def hdrev(x):
a=[]
for i in range(5):
for j in range(7):
v=choose(10-i-j,5-i)
if x>=v:
a.append(j)
x-=v
break
*/ | 3,256 | 0.660934 | 0.623157 | 144 | 21.618055 | 20.362682 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.291667 | false | false | 1 |
a898ff288681dd763e7d8fc0bd6838c6309c516c | 2,216,203,137,083 | 27ad623a1004f41bb91bba6aa988273d711606d7 | /rest-user-consumer/src/main/java/com/darian/user/web/controller/UserRestApiController.java | 7c1cfbe1daced4b46a81679c3e4552bc9261b1b0 | [
"MIT",
"Apache-2.0"
] | permissive | Darian1996/spring-cloud-2017 | https://github.com/Darian1996/spring-cloud-2017 | ea7549426f7ce187a1611dc914f54108dafe2d18 | 567b78b4d902d4f02bc42030de70ed6270fb5c1f | refs/heads/master | "2020-09-19T17:52:46.774000" | "2020-01-18T12:13:50" | "2020-01-18T12:13:50" | 224,257,079 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.darian.user.web.controller;
import com.darian.user.Service.UserService;
import com.darian.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
/**
* <br>用户服务Rest APi
* <br>Darian
**/
@RestController
public class UserRestApiController {
@Autowired
private UserService userService;
/**
* @param name 请求“name”的数据
* 如果保存成功,返回 {@link User}
* 否则返回null
* <br>Darian
**/
// @PostMapping("/user/save")
@GetMapping("/user/save") // Get 方便测试
public User saveUser(User user) {
// User user = new User();
// user.setName(name);
if (userService.sava(user)) {
return user;
} else {
return null;
}
}
/**
* 罗列所有用户的数据
* <br>Darian
**/
@GetMapping("/user/list")
public Collection<User> list(){
return userService.findAll();
}
}
| UTF-8 | Java | 1,138 | java | UserRestApiController.java | Java | [
{
"context": "util.Collection;\n\n\n/**\n * <br>用户服务Rest APi\n * <br>Darian\n **/\n@RestController\npublic class UserRestApiCont",
"end": 375,
"score": 0.9995324611663818,
"start": 369,
"tag": "NAME",
"value": "Darian"
},
{
"context": "如果保存成功,返回 {@link User}\n * 否则返回null\n * <br>Darian\n **/\n// @PostMapping(\"/user/save\")\n @Ge",
"end": 590,
"score": 0.9992489814758301,
"start": 584,
"tag": "NAME",
"value": "Darian"
},
{
"context": " }\n }\n\n /**\n * 罗列所有用户的数据\n * <br>Darian\n **/\n @GetMapping(\"/user/list\")\n public",
"end": 941,
"score": 0.9987999200820923,
"start": 935,
"tag": "NAME",
"value": "Darian"
}
] | null | [] | package com.darian.user.web.controller;
import com.darian.user.Service.UserService;
import com.darian.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
/**
* <br>用户服务Rest APi
* <br>Darian
**/
@RestController
public class UserRestApiController {
@Autowired
private UserService userService;
/**
* @param name 请求“name”的数据
* 如果保存成功,返回 {@link User}
* 否则返回null
* <br>Darian
**/
// @PostMapping("/user/save")
@GetMapping("/user/save") // Get 方便测试
public User saveUser(User user) {
// User user = new User();
// user.setName(name);
if (userService.sava(user)) {
return user;
} else {
return null;
}
}
/**
* 罗列所有用户的数据
* <br>Darian
**/
@GetMapping("/user/list")
public Collection<User> list(){
return userService.findAll();
}
}
| 1,138 | 0.62688 | 0.62688 | 49 | 20.714285 | 17.111877 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.265306 | false | false | 1 |
a6a87cf5c7341b12a1dd557ad485a9f82c6214a8 | 2,310,692,455,659 | bc583d72b81ca164dc93ed75f7a9836094898f13 | /src/main/java/com/csye6225/spring2019/courseservice/service/CourseService.java | c46d6ccbc71dda694c630f5981d791ce67410571 | [] | no_license | ziyezhu92/CSYE6225 | https://github.com/ziyezhu92/CSYE6225 | 413aed2de18e673df517ac6b58eb5a3e9a2c4201 | 98e07b78d6a548905bb2b5afb1ca6390bf2b0150 | refs/heads/master | "2020-04-28T19:04:08.007000" | "2019-03-13T21:18:44" | "2019-03-13T21:18:44" | 173,271,865 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.csye6225.spring2019.courseservice.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.csye6225.spring2019.courseservice.datamodel.Course;
import com.csye6225.spring2019.courseservice.datamodel.InMemoryDatabase;
public class CourseService {
Map<String, Course> course_Map = InMemoryDatabase.getCourseDB();
public CourseService() {}
// Getting a list of all student
// GET "..webapi/student"
public List<Course> getAllCourses(){
//Getting the list
List<Course> list = new ArrayList<>();
for(Course course : course_Map.values()) {
list.add(course);
}
return list;
}
// Adding a course
public void addCourse(Course course) {
//Create a Course Object
course_Map.put(course.getCourseName(), course);
}
// Getting One Course
public Course getCourse(String courseId) {
Course course = course_Map.get(courseId);
System.out.println("Item retrieved:");
System.out.println(course.toString());
return course;
}
// Deleting a course
public Course deleteCourse(String courseID) {
Course deletedCourse = course_Map.get(courseID);
course_Map.remove(courseID);
return deletedCourse;
}
// Updating Course Info
public Course updateCourseInformation(String courseId, Course course) {
course_Map.put(course.getCourseName(),course);
return course;
}
// Adding a Student to the roster of a course
public Course addStudentToCourse(String studentId, String courseId) {
course_Map.get(courseId).getRoster().add(studentId);
return course_Map.get(courseId);
}
// Removing a Student from the roster of a course
public Course deleteStudentFromCourse(String studentId, String courseId) {
course_Map.get(courseId).getRoster().remove(studentId);
return course_Map.get(courseId);
}
}
| UTF-8 | Java | 1,791 | java | CourseService.java | Java | [] | null | [] | package com.csye6225.spring2019.courseservice.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.csye6225.spring2019.courseservice.datamodel.Course;
import com.csye6225.spring2019.courseservice.datamodel.InMemoryDatabase;
public class CourseService {
Map<String, Course> course_Map = InMemoryDatabase.getCourseDB();
public CourseService() {}
// Getting a list of all student
// GET "..webapi/student"
public List<Course> getAllCourses(){
//Getting the list
List<Course> list = new ArrayList<>();
for(Course course : course_Map.values()) {
list.add(course);
}
return list;
}
// Adding a course
public void addCourse(Course course) {
//Create a Course Object
course_Map.put(course.getCourseName(), course);
}
// Getting One Course
public Course getCourse(String courseId) {
Course course = course_Map.get(courseId);
System.out.println("Item retrieved:");
System.out.println(course.toString());
return course;
}
// Deleting a course
public Course deleteCourse(String courseID) {
Course deletedCourse = course_Map.get(courseID);
course_Map.remove(courseID);
return deletedCourse;
}
// Updating Course Info
public Course updateCourseInformation(String courseId, Course course) {
course_Map.put(course.getCourseName(),course);
return course;
}
// Adding a Student to the roster of a course
public Course addStudentToCourse(String studentId, String courseId) {
course_Map.get(courseId).getRoster().add(studentId);
return course_Map.get(courseId);
}
// Removing a Student from the roster of a course
public Course deleteStudentFromCourse(String studentId, String courseId) {
course_Map.get(courseId).getRoster().remove(studentId);
return course_Map.get(courseId);
}
}
| 1,791 | 0.742602 | 0.729202 | 65 | 26.553846 | 22.276604 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.630769 | false | false | 1 |
9297d44789fd41cb34734d95972f0519b5c1bfbe | 10,153,302,747,189 | 8682bf59c744d21cd743daa04c0f7b6431ffa38c | /src/main/java/com/graduate/project/TeacherManage/teacher_controller/Teacher_Course_ClassInfo_Controller.java | 00ed3b34298a1062cec782a86ff0e3955c2e74e9 | [] | no_license | 17210120606/project | https://github.com/17210120606/project | 3d33d8726b1d04e44421e92af9ff5d9b839b348d | bc409b13d14cf42c59e053745f87bdc793bd8818 | refs/heads/master | "2023-03-26T15:54:14.759000" | "2021-03-27T09:35:12" | "2021-03-27T09:35:12" | 345,841,420 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.graduate.project.TeacherManage.teacher_controller;
import com.graduate.project.ExcelTemplateForTeacher.ExcelFormatForTeacherConfigStudentInfo_Util;
import com.graduate.project.PublicConfig.Public_Result;
import com.graduate.project.TeacherManage.teacher_entity.Teacher_Course_ClassInfo_Table;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Course_ClassInfo_Service;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Course_Class_Service;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Course_Service;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Info_Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@RestController
@Api(tags = "教师课程下管理学生基础信息管理专用的 Controller")
public class Teacher_Course_ClassInfo_Controller {
@Autowired
private I_Teacher_Course_ClassInfo_Service i_teacher_course_classInfo_service;
@Autowired
private I_Teacher_Course_Class_Service i_teacher_course_class_service;
@Autowired
private I_Teacher_Course_Service i_teacher_course_service;
@Autowired
private I_Teacher_Info_Service i_teacher_info_service;
/*** 1、查询 课程班级下 所有学生 的信息 [课程编号,教师编号,班级号]
* @param CourseCreatorNo
* @param CourseNo
* @param CourseClassNo
* ***/
@ApiOperation(value = "教师查询课程下构建的所有学生信息 ")
@RequestMapping(value = "/teacher/course/classinfo/selectall", method = RequestMethod.GET)
public Object TeacherCourseClassInfoSelectAll(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级编号") String CourseClassNo,
HttpSession session){
List<Teacher_Course_ClassInfo_Table> list = new ArrayList<Teacher_Course_ClassInfo_Table>();
list = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_SelectAll(CourseNo, CourseCreatorNo, CourseClassNo);
return Public_Result.success("查询成功!!",list);
}
/*** 2、查询 课程班级下 具体 组中 的 所有学生 的信息 [课程编号,教师编号,班级号,小组号]
* @param CourseCreatorNo
* @param CourseNo
* @param CourseClassNo
* @param CourseClassGroupNo
* ***/
@ApiOperation(value = "教师查询课程下构建的小组信息 ")
@RequestMapping(value = "/teacher/course/classinfo/selectgroup", method = RequestMethod.GET)
public Object TeacherCourseClassInfoSelectGroup(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级编号") String CourseClassNo,
@RequestParam("小组编号") String CourseClassGroupNo,
HttpSession session){
/****** 构建 返回结果 列表 list ******/
List<Teacher_Course_ClassInfo_Table> list = new ArrayList<Teacher_Course_ClassInfo_Table>();
list = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_SelectGroup(CourseNo, CourseCreatorNo, CourseClassNo,CourseClassGroupNo);
return Public_Result.success("查询成功!!",list);
}
/*** 3、新增 课程班级下 具体学生的信息, 其中 组别 可以为空 后续也会涉及 批量新增,插入实体
、 * @param teacher_course****/
@ApiOperation(value = "教师新增课程下学生的基础信息 ")
@RequestMapping(value = "/teacher/course/classinfo/insert", method = RequestMethod.POST)
public Object TeacherCourseClassInfoInsert(@RequestParam("课程编号") String CourseNo,
@RequestParam("课程名称") String CourseName,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("教师名称") String CourseCreatorName,
@RequestParam("课程班级编号") String CourseClassNo,
@RequestParam("课程班级名称") String CourseClassName,
@RequestParam("课程班级小组编号") String CourseClassGroupNo,
@RequestParam("课程班级小组名称") String CourseClassGroupName,
@RequestParam("课程班级小组学生编号") String CourseClassStudentNo,
@RequestParam("课程班级小组学生名称") String CourseClassStudentName,
@RequestParam("学生课程最终成绩") Double StudentFinalGrade,
HttpSession session){
/***** 开始 检验 输入 信息的正确性 Begin ****/
/*** 1、先验证 该教师是否存在 ******/
boolean Teacher_TrueOrFalse = i_teacher_info_service.Teacher_Info_Judge(CourseCreatorNo,CourseCreatorName);
if (Teacher_TrueOrFalse == false){
return Public_Result.error("您的身份信息不正确,请重新输入");
}
/*** 2、再验证 课程编号是否 存在,即该课程是否存在 ******/
boolean Course_TrueOrFalse = i_teacher_course_service.Teacher_Course_JudgeCourseTrue(CourseNo,CourseName,CourseCreatorNo);
if (Course_TrueOrFalse == false){
return Public_Result.error("您尚未创建该课程,该课程不存在");
}
/*** 3、验证 该班级是否 存在 ****/
boolean Class_TrueOrFalse = i_teacher_course_class_service.Teacher_Course_Class_JudgeClassNo(CourseCreatorNo, CourseNo, CourseClassNo);
if (Class_TrueOrFalse == false){
return Public_Result.error("该班级不存在,请检查输入的信息后,重试!");
}
/*** 4、验证 该名学生是否已经存在 ****/
boolean Student_TrueOrFalse = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_JudgeStudentTrue(CourseNo, CourseCreatorNo, CourseClassNo, CourseClassStudentNo);
if (Student_TrueOrFalse){
return Public_Result.error("新增失败,该名学生已存在,请检查信息后重试!");
}
/***** 经检验,无问题,进行后续操作 Stop ****/
/******** 构建参数实体并赋值 **********/
Teacher_Course_ClassInfo_Table teacher_course_classInfo_table = new Teacher_Course_ClassInfo_Table();
teacher_course_classInfo_table.setCourseNo(CourseNo);
teacher_course_classInfo_table.setCourseName(CourseName);
teacher_course_classInfo_table.setCourseCreatorNo(CourseCreatorNo);
teacher_course_classInfo_table.setCourseCreatorName(CourseCreatorName);
teacher_course_classInfo_table.setCourseClassNo(CourseClassNo);
teacher_course_classInfo_table.setCourseClassName(CourseClassName);
teacher_course_classInfo_table.setCourseClassGroupNo(CourseClassGroupNo);
teacher_course_classInfo_table.setCourseClassGroupName(CourseClassGroupName);
teacher_course_classInfo_table.setCourseClassStudentNo(CourseClassStudentNo);
teacher_course_classInfo_table.setCourseClassStudentName(CourseClassStudentName);
teacher_course_classInfo_table.setStudentFinalGrade(StudentFinalGrade);
/********* 传入实体 数据,判断是否新增学生成功 *******/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Insert(teacher_course_classInfo_table);
if (flag){
return Public_Result.success("新增学生成功",teacher_course_classInfo_table);
}
return Public_Result.error("新增学生失败");
}
/*** 4、 修改 课程班级下 具体学生 的信息 ,能修改的内容为: 学生的 最终课程成绩
、 * @param teacher_course****/
@ApiOperation(value = "教师修改课程下学生的基础课程信息 ")
@RequestMapping(value = "/teacher/course/classinfo/update", method = RequestMethod.POST)
public Object TeacherCourseClassInfoUpdate(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级号") String CourseClassNo,
@RequestParam("小组号") String CourseClassGroupNo,
@RequestParam("学生学号") String CourseClassStudentNo,
@RequestParam("学生课程最终成绩") Double StudentFinalGrade,
HttpSession session){
/******** 构建参数实体并赋值 **********/
Teacher_Course_ClassInfo_Table teacher_course_classInfo_table = new Teacher_Course_ClassInfo_Table();
teacher_course_classInfo_table.setCourseNo(CourseNo);
teacher_course_classInfo_table.setCourseCreatorNo(CourseCreatorNo);
teacher_course_classInfo_table.setCourseClassNo(CourseClassNo);
teacher_course_classInfo_table.setCourseClassGroupNo(CourseClassGroupNo);
teacher_course_classInfo_table.setCourseClassStudentNo(CourseClassStudentNo);
teacher_course_classInfo_table.setStudentFinalGrade(StudentFinalGrade);
/********* 传入实体 数据,判断是否新增学生成功 *******/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Update(teacher_course_classInfo_table);
if (flag){
return Public_Result.success("修改学生成绩成功");
}
return Public_Result.error("修改学生成绩失败");
}
/*** 5、 删除 课程班级下 具体学生 的信息 [课程编号,教师编号,班级号,学生学号]*
、 * @param teacher_course****/
@ApiOperation(value = "教师删除课程下学生的基础信息 ")
@RequestMapping(value = "/teacher/course/classinfo/delete", method = RequestMethod.POST)
public Object TeacherCourseClassInfoDelete(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级编号") String CourseClassNo,
@RequestParam("学生学号") String CourseClassStudentNo,
HttpSession session) {
/********* 传入 数据,判断是否 删除班级信息 成功 *******/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Delete(CourseNo, CourseCreatorNo, CourseClassNo, CourseClassStudentNo);
if (flag) {
return Public_Result.success("学生删除成功");
}
return Public_Result.error("学生删除失败");
}
/** 6、下载学生进行批量导入的课程下学生信息模板 ***/
// Swagger 无法处理
@ApiOperation(value = "下载学生进行批量导入的课程下学生信息模板 ")
@RequestMapping(value = "/teacher/course/classinfo/template", method = RequestMethod.GET)
public ResponseEntity ClassinfoTemplate() throws Exception{
/* File file = new File(new File(System.getProperty("user.dir")) + File.separator
+ "src" + File.separator + "main" + File.separator + "java" + File.separator
+ "com"+ File.separator +"graduate" + File.separator + "project1"
+ File.separator + "ExcelTemplate" + File.separator + "批量导入课程学生信息模板.xls");
System.out.println(file.toString());*/
FileSystemResource file = new FileSystemResource("E:\\最终毕设整理\\project1\\src\\main\\java\\com\\graduate\\project\\ExcelTemplate\\批量导入课程学生信息模板.xls");
HttpHeaders headers =new HttpHeaders();
// 成功解决中文问题
headers.add("Content-Disposition","attachment; filename=" + new String("课程学生信息导入模板.xls".getBytes("gb2312"), "ISO8859-1" ) );
return ResponseEntity.ok()
.headers(headers)
.contentLength(file.contentLength())
.contentType(MediaType.parseMediaType("application/octet-stream")) //application/octet-stream 代表以字节流的方式下载
.body(new InputStreamResource(file.getInputStream()));
}
/*** 7、批量新增 课程下的学生信息*/
@ApiOperation(value = "批量新增 课程下的学生信息")
@RequestMapping(value = "/teacher/course/classinfo/insertmore", method = RequestMethod.POST)
public Object TeacherCourseClassInfoInsertMore(@RequestParam("file") MultipartFile file,
HttpSession session ) throws Exception{
/***************** 文件 类型 转换 ****************/
File GeneralFile = multipartFileToFile(file);
List<Teacher_Course_ClassInfo_Table> teacher_course_classInfo_excel = ExcelFormatForTeacherConfigStudentInfo_Util.Analysis_Excel_Student(GeneralFile);
/*************** 创建 文件上传读取 后的 内容展示对象并赋值,用于展示 本次文件上传的 内容 **************/
//List<Teacher_Course_ClassInfo_Table> 学生表List = new ArrayList<学生表>();
Teacher_Course_ClassInfo_Table teacher_course_classInfo_table = new Teacher_Course_ClassInfo_Table();
/***************** 遍历 转换后的 教师管理学生上课表 列表,并进行 注意 新增 ****************/
int tol = 0;
for (Teacher_Course_ClassInfo_Table ClassInfo : teacher_course_classInfo_excel) {
/**** 批量 新增的过程中,不用判断 该数据是否已经存在,,倘若存在,直接修改即可 ****/
tol = tol + 1; // 用于 记录 出现问题的是哪一行
/*** 1、先验证 该教师是否存在 ******/
boolean Teacher_TrueOrFalse = i_teacher_info_service.Teacher_Info_Judge(ClassInfo.getCourseCreatorNo(),ClassInfo.getCourseCreatorName());
if (Teacher_TrueOrFalse == false){
teacher_course_classInfo_table=ClassInfo;
return Public_Result.error("第"+tol+"行所输入的教师身份信息不正确,请重新输入",teacher_course_classInfo_table);
}
/*** 2、再验证 课程编号是否 存在,即该课程是否存在 ******/
boolean Course_TrueOrFalse = i_teacher_course_service.Teacher_Course_JudgeCourseTrue(ClassInfo.getCourseNo(),ClassInfo.getCourseName(),ClassInfo.getCourseCreatorNo());
if (Course_TrueOrFalse == false){
teacher_course_classInfo_table=ClassInfo;
return Public_Result.error("第"+tol+"行所输入的课程信息不正确,该课程不存在",teacher_course_classInfo_table);
}
/*** 3、验证 该班级是否 存在 ****/
boolean Class_TrueOrFalse = i_teacher_course_class_service.Teacher_Course_Class_JudgeClassNo(ClassInfo.getCourseCreatorNo(), ClassInfo.getCourseNo(), ClassInfo.getCourseClassNo());
if (Class_TrueOrFalse == false){
teacher_course_classInfo_table=ClassInfo;
return Public_Result.error("第"+tol+"行输入的班级信息不存在,请检查输入的信息后,重试!",teacher_course_classInfo_table);
}
/*** 4、验证 该名学生是否已经存在 ****/
boolean Student_TrueOrFalse = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_JudgeStudentTrue(ClassInfo.getCourseNo(), ClassInfo.getCourseCreatorNo(), ClassInfo.getCourseClassNo(), ClassInfo.getCourseClassStudentNo());
if (Student_TrueOrFalse){
// 正确,证明学生已经存在,直接修改其信息即可
// 懒得 再去 构建 一个全面 修改的方法,,所以选择直接删掉原有的,然后重新增加,,
// 因为 已经验证了 其信息基本正确,,所以基本不会出现 删掉后,,添加出错的问题
i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Delete(ClassInfo.getCourseNo(), ClassInfo.getCourseCreatorNo(), ClassInfo.getCourseClassNo(), ClassInfo.getCourseClassStudentNo());
//return Public_Result.error("新增失败,该名学生已存在,请检查信息后重试!");
}
/***** 经检验,无问题,进行后续操作 Stop ****/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Insert(ClassInfo);
/******** 将其单个 数据 逐一 遍历 添加到 该列表中*/
//学生表List.add(单个数据);
}
return Public_Result.success("批量插入成功!");
}
/************************* 以下 为静态方法,进行 MultipartFile 转 普通 File Begin******************************/
public static File multipartFileToFile(MultipartFile file) throws Exception {
File toFile = null;
if (file.equals("") || file.getSize() <= 0) {
file = null;
} else {
InputStream ins = null;
ins = file.getInputStream();
toFile = new File(file.getOriginalFilename());
inputStreamToFile(ins, toFile);
ins.close();
}
return toFile;
}
private static void inputStreamToFile(InputStream ins, File file) {
try {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
ins.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/******************* Stop ******************/
}
| UTF-8 | Java | 19,341 | java | Teacher_Course_ClassInfo_Controller.java | Java | [] | null | [] | package com.graduate.project.TeacherManage.teacher_controller;
import com.graduate.project.ExcelTemplateForTeacher.ExcelFormatForTeacherConfigStudentInfo_Util;
import com.graduate.project.PublicConfig.Public_Result;
import com.graduate.project.TeacherManage.teacher_entity.Teacher_Course_ClassInfo_Table;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Course_ClassInfo_Service;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Course_Class_Service;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Course_Service;
import com.graduate.project.TeacherManage.teacher_service.I_Teacher_Info_Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@RestController
@Api(tags = "教师课程下管理学生基础信息管理专用的 Controller")
public class Teacher_Course_ClassInfo_Controller {
@Autowired
private I_Teacher_Course_ClassInfo_Service i_teacher_course_classInfo_service;
@Autowired
private I_Teacher_Course_Class_Service i_teacher_course_class_service;
@Autowired
private I_Teacher_Course_Service i_teacher_course_service;
@Autowired
private I_Teacher_Info_Service i_teacher_info_service;
/*** 1、查询 课程班级下 所有学生 的信息 [课程编号,教师编号,班级号]
* @param CourseCreatorNo
* @param CourseNo
* @param CourseClassNo
* ***/
@ApiOperation(value = "教师查询课程下构建的所有学生信息 ")
@RequestMapping(value = "/teacher/course/classinfo/selectall", method = RequestMethod.GET)
public Object TeacherCourseClassInfoSelectAll(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级编号") String CourseClassNo,
HttpSession session){
List<Teacher_Course_ClassInfo_Table> list = new ArrayList<Teacher_Course_ClassInfo_Table>();
list = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_SelectAll(CourseNo, CourseCreatorNo, CourseClassNo);
return Public_Result.success("查询成功!!",list);
}
/*** 2、查询 课程班级下 具体 组中 的 所有学生 的信息 [课程编号,教师编号,班级号,小组号]
* @param CourseCreatorNo
* @param CourseNo
* @param CourseClassNo
* @param CourseClassGroupNo
* ***/
@ApiOperation(value = "教师查询课程下构建的小组信息 ")
@RequestMapping(value = "/teacher/course/classinfo/selectgroup", method = RequestMethod.GET)
public Object TeacherCourseClassInfoSelectGroup(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级编号") String CourseClassNo,
@RequestParam("小组编号") String CourseClassGroupNo,
HttpSession session){
/****** 构建 返回结果 列表 list ******/
List<Teacher_Course_ClassInfo_Table> list = new ArrayList<Teacher_Course_ClassInfo_Table>();
list = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_SelectGroup(CourseNo, CourseCreatorNo, CourseClassNo,CourseClassGroupNo);
return Public_Result.success("查询成功!!",list);
}
/*** 3、新增 课程班级下 具体学生的信息, 其中 组别 可以为空 后续也会涉及 批量新增,插入实体
、 * @param teacher_course****/
@ApiOperation(value = "教师新增课程下学生的基础信息 ")
@RequestMapping(value = "/teacher/course/classinfo/insert", method = RequestMethod.POST)
public Object TeacherCourseClassInfoInsert(@RequestParam("课程编号") String CourseNo,
@RequestParam("课程名称") String CourseName,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("教师名称") String CourseCreatorName,
@RequestParam("课程班级编号") String CourseClassNo,
@RequestParam("课程班级名称") String CourseClassName,
@RequestParam("课程班级小组编号") String CourseClassGroupNo,
@RequestParam("课程班级小组名称") String CourseClassGroupName,
@RequestParam("课程班级小组学生编号") String CourseClassStudentNo,
@RequestParam("课程班级小组学生名称") String CourseClassStudentName,
@RequestParam("学生课程最终成绩") Double StudentFinalGrade,
HttpSession session){
/***** 开始 检验 输入 信息的正确性 Begin ****/
/*** 1、先验证 该教师是否存在 ******/
boolean Teacher_TrueOrFalse = i_teacher_info_service.Teacher_Info_Judge(CourseCreatorNo,CourseCreatorName);
if (Teacher_TrueOrFalse == false){
return Public_Result.error("您的身份信息不正确,请重新输入");
}
/*** 2、再验证 课程编号是否 存在,即该课程是否存在 ******/
boolean Course_TrueOrFalse = i_teacher_course_service.Teacher_Course_JudgeCourseTrue(CourseNo,CourseName,CourseCreatorNo);
if (Course_TrueOrFalse == false){
return Public_Result.error("您尚未创建该课程,该课程不存在");
}
/*** 3、验证 该班级是否 存在 ****/
boolean Class_TrueOrFalse = i_teacher_course_class_service.Teacher_Course_Class_JudgeClassNo(CourseCreatorNo, CourseNo, CourseClassNo);
if (Class_TrueOrFalse == false){
return Public_Result.error("该班级不存在,请检查输入的信息后,重试!");
}
/*** 4、验证 该名学生是否已经存在 ****/
boolean Student_TrueOrFalse = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_JudgeStudentTrue(CourseNo, CourseCreatorNo, CourseClassNo, CourseClassStudentNo);
if (Student_TrueOrFalse){
return Public_Result.error("新增失败,该名学生已存在,请检查信息后重试!");
}
/***** 经检验,无问题,进行后续操作 Stop ****/
/******** 构建参数实体并赋值 **********/
Teacher_Course_ClassInfo_Table teacher_course_classInfo_table = new Teacher_Course_ClassInfo_Table();
teacher_course_classInfo_table.setCourseNo(CourseNo);
teacher_course_classInfo_table.setCourseName(CourseName);
teacher_course_classInfo_table.setCourseCreatorNo(CourseCreatorNo);
teacher_course_classInfo_table.setCourseCreatorName(CourseCreatorName);
teacher_course_classInfo_table.setCourseClassNo(CourseClassNo);
teacher_course_classInfo_table.setCourseClassName(CourseClassName);
teacher_course_classInfo_table.setCourseClassGroupNo(CourseClassGroupNo);
teacher_course_classInfo_table.setCourseClassGroupName(CourseClassGroupName);
teacher_course_classInfo_table.setCourseClassStudentNo(CourseClassStudentNo);
teacher_course_classInfo_table.setCourseClassStudentName(CourseClassStudentName);
teacher_course_classInfo_table.setStudentFinalGrade(StudentFinalGrade);
/********* 传入实体 数据,判断是否新增学生成功 *******/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Insert(teacher_course_classInfo_table);
if (flag){
return Public_Result.success("新增学生成功",teacher_course_classInfo_table);
}
return Public_Result.error("新增学生失败");
}
/*** 4、 修改 课程班级下 具体学生 的信息 ,能修改的内容为: 学生的 最终课程成绩
、 * @param teacher_course****/
@ApiOperation(value = "教师修改课程下学生的基础课程信息 ")
@RequestMapping(value = "/teacher/course/classinfo/update", method = RequestMethod.POST)
public Object TeacherCourseClassInfoUpdate(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级号") String CourseClassNo,
@RequestParam("小组号") String CourseClassGroupNo,
@RequestParam("学生学号") String CourseClassStudentNo,
@RequestParam("学生课程最终成绩") Double StudentFinalGrade,
HttpSession session){
/******** 构建参数实体并赋值 **********/
Teacher_Course_ClassInfo_Table teacher_course_classInfo_table = new Teacher_Course_ClassInfo_Table();
teacher_course_classInfo_table.setCourseNo(CourseNo);
teacher_course_classInfo_table.setCourseCreatorNo(CourseCreatorNo);
teacher_course_classInfo_table.setCourseClassNo(CourseClassNo);
teacher_course_classInfo_table.setCourseClassGroupNo(CourseClassGroupNo);
teacher_course_classInfo_table.setCourseClassStudentNo(CourseClassStudentNo);
teacher_course_classInfo_table.setStudentFinalGrade(StudentFinalGrade);
/********* 传入实体 数据,判断是否新增学生成功 *******/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Update(teacher_course_classInfo_table);
if (flag){
return Public_Result.success("修改学生成绩成功");
}
return Public_Result.error("修改学生成绩失败");
}
/*** 5、 删除 课程班级下 具体学生 的信息 [课程编号,教师编号,班级号,学生学号]*
、 * @param teacher_course****/
@ApiOperation(value = "教师删除课程下学生的基础信息 ")
@RequestMapping(value = "/teacher/course/classinfo/delete", method = RequestMethod.POST)
public Object TeacherCourseClassInfoDelete(@RequestParam("课程编号") String CourseNo,
@RequestParam("教师编号") String CourseCreatorNo,
@RequestParam("班级编号") String CourseClassNo,
@RequestParam("学生学号") String CourseClassStudentNo,
HttpSession session) {
/********* 传入 数据,判断是否 删除班级信息 成功 *******/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Delete(CourseNo, CourseCreatorNo, CourseClassNo, CourseClassStudentNo);
if (flag) {
return Public_Result.success("学生删除成功");
}
return Public_Result.error("学生删除失败");
}
/** 6、下载学生进行批量导入的课程下学生信息模板 ***/
// Swagger 无法处理
@ApiOperation(value = "下载学生进行批量导入的课程下学生信息模板 ")
@RequestMapping(value = "/teacher/course/classinfo/template", method = RequestMethod.GET)
public ResponseEntity ClassinfoTemplate() throws Exception{
/* File file = new File(new File(System.getProperty("user.dir")) + File.separator
+ "src" + File.separator + "main" + File.separator + "java" + File.separator
+ "com"+ File.separator +"graduate" + File.separator + "project1"
+ File.separator + "ExcelTemplate" + File.separator + "批量导入课程学生信息模板.xls");
System.out.println(file.toString());*/
FileSystemResource file = new FileSystemResource("E:\\最终毕设整理\\project1\\src\\main\\java\\com\\graduate\\project\\ExcelTemplate\\批量导入课程学生信息模板.xls");
HttpHeaders headers =new HttpHeaders();
// 成功解决中文问题
headers.add("Content-Disposition","attachment; filename=" + new String("课程学生信息导入模板.xls".getBytes("gb2312"), "ISO8859-1" ) );
return ResponseEntity.ok()
.headers(headers)
.contentLength(file.contentLength())
.contentType(MediaType.parseMediaType("application/octet-stream")) //application/octet-stream 代表以字节流的方式下载
.body(new InputStreamResource(file.getInputStream()));
}
/*** 7、批量新增 课程下的学生信息*/
@ApiOperation(value = "批量新增 课程下的学生信息")
@RequestMapping(value = "/teacher/course/classinfo/insertmore", method = RequestMethod.POST)
public Object TeacherCourseClassInfoInsertMore(@RequestParam("file") MultipartFile file,
HttpSession session ) throws Exception{
/***************** 文件 类型 转换 ****************/
File GeneralFile = multipartFileToFile(file);
List<Teacher_Course_ClassInfo_Table> teacher_course_classInfo_excel = ExcelFormatForTeacherConfigStudentInfo_Util.Analysis_Excel_Student(GeneralFile);
/*************** 创建 文件上传读取 后的 内容展示对象并赋值,用于展示 本次文件上传的 内容 **************/
//List<Teacher_Course_ClassInfo_Table> 学生表List = new ArrayList<学生表>();
Teacher_Course_ClassInfo_Table teacher_course_classInfo_table = new Teacher_Course_ClassInfo_Table();
/***************** 遍历 转换后的 教师管理学生上课表 列表,并进行 注意 新增 ****************/
int tol = 0;
for (Teacher_Course_ClassInfo_Table ClassInfo : teacher_course_classInfo_excel) {
/**** 批量 新增的过程中,不用判断 该数据是否已经存在,,倘若存在,直接修改即可 ****/
tol = tol + 1; // 用于 记录 出现问题的是哪一行
/*** 1、先验证 该教师是否存在 ******/
boolean Teacher_TrueOrFalse = i_teacher_info_service.Teacher_Info_Judge(ClassInfo.getCourseCreatorNo(),ClassInfo.getCourseCreatorName());
if (Teacher_TrueOrFalse == false){
teacher_course_classInfo_table=ClassInfo;
return Public_Result.error("第"+tol+"行所输入的教师身份信息不正确,请重新输入",teacher_course_classInfo_table);
}
/*** 2、再验证 课程编号是否 存在,即该课程是否存在 ******/
boolean Course_TrueOrFalse = i_teacher_course_service.Teacher_Course_JudgeCourseTrue(ClassInfo.getCourseNo(),ClassInfo.getCourseName(),ClassInfo.getCourseCreatorNo());
if (Course_TrueOrFalse == false){
teacher_course_classInfo_table=ClassInfo;
return Public_Result.error("第"+tol+"行所输入的课程信息不正确,该课程不存在",teacher_course_classInfo_table);
}
/*** 3、验证 该班级是否 存在 ****/
boolean Class_TrueOrFalse = i_teacher_course_class_service.Teacher_Course_Class_JudgeClassNo(ClassInfo.getCourseCreatorNo(), ClassInfo.getCourseNo(), ClassInfo.getCourseClassNo());
if (Class_TrueOrFalse == false){
teacher_course_classInfo_table=ClassInfo;
return Public_Result.error("第"+tol+"行输入的班级信息不存在,请检查输入的信息后,重试!",teacher_course_classInfo_table);
}
/*** 4、验证 该名学生是否已经存在 ****/
boolean Student_TrueOrFalse = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_JudgeStudentTrue(ClassInfo.getCourseNo(), ClassInfo.getCourseCreatorNo(), ClassInfo.getCourseClassNo(), ClassInfo.getCourseClassStudentNo());
if (Student_TrueOrFalse){
// 正确,证明学生已经存在,直接修改其信息即可
// 懒得 再去 构建 一个全面 修改的方法,,所以选择直接删掉原有的,然后重新增加,,
// 因为 已经验证了 其信息基本正确,,所以基本不会出现 删掉后,,添加出错的问题
i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Delete(ClassInfo.getCourseNo(), ClassInfo.getCourseCreatorNo(), ClassInfo.getCourseClassNo(), ClassInfo.getCourseClassStudentNo());
//return Public_Result.error("新增失败,该名学生已存在,请检查信息后重试!");
}
/***** 经检验,无问题,进行后续操作 Stop ****/
boolean flag = i_teacher_course_classInfo_service.Teacher_Course_ClassInfo_Insert(ClassInfo);
/******** 将其单个 数据 逐一 遍历 添加到 该列表中*/
//学生表List.add(单个数据);
}
return Public_Result.success("批量插入成功!");
}
/************************* 以下 为静态方法,进行 MultipartFile 转 普通 File Begin******************************/
public static File multipartFileToFile(MultipartFile file) throws Exception {
File toFile = null;
if (file.equals("") || file.getSize() <= 0) {
file = null;
} else {
InputStream ins = null;
ins = file.getInputStream();
toFile = new File(file.getOriginalFilename());
inputStreamToFile(ins, toFile);
ins.close();
}
return toFile;
}
private static void inputStreamToFile(InputStream ins, File file) {
try {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
ins.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/******************* Stop ******************/
}
| 19,341 | 0.626933 | 0.624504 | 316 | 52.401897 | 41.523594 | 243 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.620253 | false | false | 1 |
a888b4ab3a100f70f3c0d245c954173bfa6a906a | 18,399,639,910,135 | 34b13e10c96f4f85969b425b5874bdc14d6235c4 | /src/main/java/com/xing/qa/selenium/grid/hub/Console.java | 7b9568aaa86d19978704920f4df408b1c8f12242 | [
"MIT"
] | permissive | rkieft/selenium-api | https://github.com/rkieft/selenium-api | b786b280f46d5bef90938e918df9fd6909ed470e | 738b7eb673faa89697843a1bbe0f925e5733fbe0 | refs/heads/master | "2020-05-17T02:27:56.963000" | "2019-05-21T15:06:07" | "2019-05-21T15:06:07" | 183,455,289 | 0 | 2 | MIT | true | "2019-06-06T00:14:23" | "2019-04-25T14:52:02" | "2019-05-21T15:06:18" | "2019-05-21T15:06:16" | 2,156 | 0 | 1 | 1 | Java | false | false | package com.xing.qa.selenium.grid.hub;
import org.json.JSONException;
import org.json.JSONObject;
import org.openqa.grid.internal.GridRegistry;
import org.openqa.grid.internal.RemoteProxy;
import org.openqa.grid.web.Hub;
import org.openqa.grid.web.servlet.RegistryBasedServlet;
import org.openqa.selenium.BuildInfo;
import org.openqa.selenium.Capabilities;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Console information and more as JSON
*
* @author Jens Hausherr (jens.hausherr@xing.com)
*/
public class Console extends RegistryBasedServlet {
static final long serialVersionUID = -1;
private final Logger log = Logger.getLogger(getClass().getName());
private String coreVersion;
public Console() {
this(null);
}
public Console(GridRegistry registry) {
super(registry);
coreVersion = new BuildInfo().getReleaseLabel();
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
if ("/requests".equals(req.getPathInfo())) {
sendJson(pendingRequests(), req, resp);
} else {
sendJson(status(), req, resp);
}
} catch (JSONException je) {
resp.setContentType("application/json");
resp.setCharacterEncoding("UTF-8");
resp.setStatus(500);
JSONObject error = new JSONObject();
try {
error.put("message", je.getMessage());
error.put("location", je.getStackTrace());
error.write(resp.getWriter());
} catch (JSONException e1) {
log.log(Level.WARNING, "Failed to write error response", e1);
}
}
}
protected void sendJson(JSONObject jo, HttpServletRequest req, HttpServletResponse resp) {
resp.setContentType("application/json");
resp.setCharacterEncoding("UTF-8");
resp.setStatus(200);
Writer w;
try {
w = resp.getWriter();
jo.write(w);
} catch (IOException e) {
log.log(Level.WARNING, "Error writing response", e);
} catch (JSONException e) {
log.log(Level.WARNING, "Failed to serialize JSON response", e);
}
}
protected JSONObject pendingRequests() throws JSONException {
JSONObject pending = new JSONObject();
int p = getRegistry().getNewSessionRequestCount();
List<Map<String,?>> desired;
if (p > 0) {
desired = new ArrayList<>();
for (Capabilities c: getRegistry().getDesiredCapabilities()) {
desired.add(c.asMap());
}
} else {
desired = Collections.emptyList();
}
pending.put("pending", p);
pending.put("requested_capabilities", desired);
return pending;
}
protected JSONObject status()
throws JSONException {
JSONObject status = new JSONObject();
Hub h = getRegistry().getHub();
List<JSONObject> nodes = new ArrayList<>();
for (RemoteProxy proxy : getRegistry().getAllProxies()) {
try {
JSONRenderer beta = new WebProxyJsonRenderer(proxy);
nodes.add(beta.render());
} catch (Exception e) {}
}
status.put("version", coreVersion);
status.put("configuration", getRegistry().getHub().getConfiguration().toJson().entrySet());
status.put("host", h.getConfiguration().host);
status.put("port", h.getConfiguration().port);
status.put("registration_url", h.getRegistrationURL());
status.put("nodes", nodes);
status.put("requests", pendingRequests());
return status;
}
}
| UTF-8 | Java | 4,049 | java | Console.java | Java | [
{
"context": "Console information and more as JSON\n *\n * @author Jens Hausherr (jens.hausherr@xing.com)\n */\npublic class Console",
"end": 743,
"score": 0.9998237490653992,
"start": 730,
"tag": "NAME",
"value": "Jens Hausherr"
},
{
"context": "ion and more as JSON\n *\n * @author Jens Hausherr (jens.hausherr@xing.com)\n */\npublic class Console extends RegistryBasedSe",
"end": 767,
"score": 0.9999324083328247,
"start": 745,
"tag": "EMAIL",
"value": "jens.hausherr@xing.com"
}
] | null | [] | package com.xing.qa.selenium.grid.hub;
import org.json.JSONException;
import org.json.JSONObject;
import org.openqa.grid.internal.GridRegistry;
import org.openqa.grid.internal.RemoteProxy;
import org.openqa.grid.web.Hub;
import org.openqa.grid.web.servlet.RegistryBasedServlet;
import org.openqa.selenium.BuildInfo;
import org.openqa.selenium.Capabilities;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Console information and more as JSON
*
* @author <NAME> (<EMAIL>)
*/
public class Console extends RegistryBasedServlet {
static final long serialVersionUID = -1;
private final Logger log = Logger.getLogger(getClass().getName());
private String coreVersion;
public Console() {
this(null);
}
public Console(GridRegistry registry) {
super(registry);
coreVersion = new BuildInfo().getReleaseLabel();
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
if ("/requests".equals(req.getPathInfo())) {
sendJson(pendingRequests(), req, resp);
} else {
sendJson(status(), req, resp);
}
} catch (JSONException je) {
resp.setContentType("application/json");
resp.setCharacterEncoding("UTF-8");
resp.setStatus(500);
JSONObject error = new JSONObject();
try {
error.put("message", je.getMessage());
error.put("location", je.getStackTrace());
error.write(resp.getWriter());
} catch (JSONException e1) {
log.log(Level.WARNING, "Failed to write error response", e1);
}
}
}
protected void sendJson(JSONObject jo, HttpServletRequest req, HttpServletResponse resp) {
resp.setContentType("application/json");
resp.setCharacterEncoding("UTF-8");
resp.setStatus(200);
Writer w;
try {
w = resp.getWriter();
jo.write(w);
} catch (IOException e) {
log.log(Level.WARNING, "Error writing response", e);
} catch (JSONException e) {
log.log(Level.WARNING, "Failed to serialize JSON response", e);
}
}
protected JSONObject pendingRequests() throws JSONException {
JSONObject pending = new JSONObject();
int p = getRegistry().getNewSessionRequestCount();
List<Map<String,?>> desired;
if (p > 0) {
desired = new ArrayList<>();
for (Capabilities c: getRegistry().getDesiredCapabilities()) {
desired.add(c.asMap());
}
} else {
desired = Collections.emptyList();
}
pending.put("pending", p);
pending.put("requested_capabilities", desired);
return pending;
}
protected JSONObject status()
throws JSONException {
JSONObject status = new JSONObject();
Hub h = getRegistry().getHub();
List<JSONObject> nodes = new ArrayList<>();
for (RemoteProxy proxy : getRegistry().getAllProxies()) {
try {
JSONRenderer beta = new WebProxyJsonRenderer(proxy);
nodes.add(beta.render());
} catch (Exception e) {}
}
status.put("version", coreVersion);
status.put("configuration", getRegistry().getHub().getConfiguration().toJson().entrySet());
status.put("host", h.getConfiguration().host);
status.put("port", h.getConfiguration().port);
status.put("registration_url", h.getRegistrationURL());
status.put("nodes", nodes);
status.put("requests", pendingRequests());
return status;
}
}
| 4,027 | 0.61472 | 0.611756 | 130 | 30.146154 | 23.52253 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 1 |
246356ac72f21201e155b99395397ef254699741 | 26,551,487,850,815 | 600b7c3c7788d58a1f547aca286b818833a9e7b7 | /app/src/main/java/com/oscarcelis/dogs/activities/NewUserActivity.java | 9edca8a9b07c887dbc3626f0133ff4e331ed7546 | [] | no_license | oscarcelis6/MMAv1.0. | https://github.com/oscarcelis6/MMAv1.0. | cf5ee83ae07cd2103ae1c1f4395c465fb6a630f0 | b95ef207f999f595b7003133da74674406aa26b2 | refs/heads/master | "2020-04-27T09:44:11.194000" | "2019-03-23T01:11:17" | "2019-03-23T01:11:17" | 174,226,724 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oscarcelis.dogs.activities;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.oscarcelis.dogs.MainActivity;
import com.oscarcelis.dogs.R;
public class NewUserActivity extends AppCompatActivity{
private static final String TAG = "EmailPassword";
private EditText edtEmailNewUser;
private EditText edtPasswordNewUser;
private CheckBox chkVisualizarClave;
private Button btnCancelar;
private FirebaseAuth firebaseAuth;
private Button btnNewUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_user);
firebaseAuth = FirebaseAuth.getInstance();
edtEmailNewUser = findViewById(R.id.edtEmailNewUser);
edtPasswordNewUser = findViewById(R.id.edtPasswordNewUser);
btnNewUser = findViewById(R.id.btnCrearCuenta);
chkVisualizarClave = findViewById(R.id.checkboxPassword);
btnCancelar = findViewById(R.id.btnRegresarMenuPrincipal);
btnCancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancelar();
}
});
chkVisualizarClave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
edtPasswordNewUser.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}else{
edtPasswordNewUser.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
});
btnNewUser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
registrarUsuario();
}
});
}
private void cancelar() {
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
finish();
}
// [START create_user_with_email]
private void registrarUsuario(){
String emailNewUser = edtEmailNewUser.getText().toString().trim();
String passwordNewUser = edtPasswordNewUser.getText().toString().trim();
if(TextUtils.isEmpty(emailNewUser)){
//Valida si el campo email está vacío
Toast.makeText(this,"Ingrese un email válido",Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(passwordNewUser)){
//Valida si el campo password está vacío
Toast.makeText(this,"Ingrese una contraseña",Toast.LENGTH_SHORT).show();
return;
}
firebaseAuth.createUserWithEmailAndPassword(emailNewUser, passwordNewUser)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
toastOk();
Intent intent = new Intent(getApplicationContext(), OkActivity.class);
startActivity(intent);
finish();
}else{
Toast.makeText(NewUserActivity.this,
"No se pudo registrar el usuario, verifique los datos ingresados",
Toast.LENGTH_SHORT).show();
}
}
});
}
// [END create_user_with_email]
public void toastOk(){
Toast toast = Toast.makeText(this, "Usuario registrado correctamente", Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 90);
toast.show();
}
}
| UTF-8 | Java | 4,574 | java | NewUserActivity.java | Java | [] | null | [] | package com.oscarcelis.dogs.activities;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.oscarcelis.dogs.MainActivity;
import com.oscarcelis.dogs.R;
public class NewUserActivity extends AppCompatActivity{
private static final String TAG = "EmailPassword";
private EditText edtEmailNewUser;
private EditText edtPasswordNewUser;
private CheckBox chkVisualizarClave;
private Button btnCancelar;
private FirebaseAuth firebaseAuth;
private Button btnNewUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_user);
firebaseAuth = FirebaseAuth.getInstance();
edtEmailNewUser = findViewById(R.id.edtEmailNewUser);
edtPasswordNewUser = findViewById(R.id.edtPasswordNewUser);
btnNewUser = findViewById(R.id.btnCrearCuenta);
chkVisualizarClave = findViewById(R.id.checkboxPassword);
btnCancelar = findViewById(R.id.btnRegresarMenuPrincipal);
btnCancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancelar();
}
});
chkVisualizarClave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
edtPasswordNewUser.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}else{
edtPasswordNewUser.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
});
btnNewUser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
registrarUsuario();
}
});
}
private void cancelar() {
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
finish();
}
// [START create_user_with_email]
private void registrarUsuario(){
String emailNewUser = edtEmailNewUser.getText().toString().trim();
String passwordNewUser = edtPasswordNewUser.getText().toString().trim();
if(TextUtils.isEmpty(emailNewUser)){
//Valida si el campo email está vacío
Toast.makeText(this,"Ingrese un email válido",Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(passwordNewUser)){
//Valida si el campo password está vacío
Toast.makeText(this,"Ingrese una contraseña",Toast.LENGTH_SHORT).show();
return;
}
firebaseAuth.createUserWithEmailAndPassword(emailNewUser, passwordNewUser)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
toastOk();
Intent intent = new Intent(getApplicationContext(), OkActivity.class);
startActivity(intent);
finish();
}else{
Toast.makeText(NewUserActivity.this,
"No se pudo registrar el usuario, verifique los datos ingresados",
Toast.LENGTH_SHORT).show();
}
}
});
}
// [END create_user_with_email]
public void toastOk(){
Toast toast = Toast.makeText(this, "Usuario registrado correctamente", Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP|Gravity.CENTER, 0, 90);
toast.show();
}
}
| 4,574 | 0.638573 | 0.637916 | 129 | 34.403099 | 28.145943 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.604651 | false | false | 1 |
77acf6d27049b532b2bce2c7a1617d789bd74c8b | 29,480,655,550,883 | 1f384a58a832772b584861c6acb98c4bda3a9c07 | /src/item/Dress.java | 4f455e763b450c13613ac30d5862650ab2f26e54 | [] | no_license | sasicha/Dressing-Princess | https://github.com/sasicha/Dressing-Princess | b45465b4f8e0596c4f33300cdd5d6d0051441cf8 | 6c0df0de03f257cce46ea83f983a5cf34bdd2365 | refs/heads/master | "2021-01-21T15:43:51.731000" | "2015-12-11T05:45:47" | "2015-12-11T05:45:47" | 47,682,244 | 0 | 0 | null | true | "2015-12-09T09:42:12" | "2015-12-09T09:42:11" | "2015-12-09T09:42:12" | "2015-12-09T06:01:15" | 18 | 0 | 0 | 0 | Java | null | null | package item;
public class Dress {
}
| UTF-8 | Java | 44 | java | Dress.java | Java | [] | null | [] | package item;
public class Dress {
}
| 44 | 0.613636 | 0.613636 | 5 | 6.8 | 8.231647 | 20 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 1 |
6ed5b89f1d8533155b56ea79415cde77b4013472 | 30,855,045,119,481 | 02a087e8de0a7d0cfed9dba60e8cff5be4ae3be1 | /Research_Bucket/Completed_Archived/ConcolicProcess/tools/Scorpio/scorpioxsrc201103030634/src/jp/ac/osaka_u/ist/sdl/scorpio/SlicingThread.java | 6b0b7cf3980563a679aa4c311da0e2fcfc91a380 | [] | no_license | dan7800/Research | https://github.com/dan7800/Research | 7baf8d5afda9824dc5a53f55c3e73f9734e61d46 | f68ea72c599f74e88dd44d85503cc672474ec12a | refs/heads/master | "2021-01-23T09:50:47.744000" | "2018-09-01T14:56:01" | "2018-09-01T14:56:01" | 32,521,867 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jp.ac.osaka_u.ist.sdl.scorpio;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import jp.ac.osaka_u.ist.sdl.scorpio.data.ClonePairInfo;
import jp.ac.osaka_u.ist.sdl.scorpio.data.NodePairInfo;
import jp.ac.osaka_u.ist.sdl.scorpio.settings.Configuration;
import jp.ac.osaka_u.ist.sel.metricstool.pdg.node.PDGNode;
class SlicingThread implements Runnable {
private final List<NodePairInfo> nodepairs;
private final AtomicInteger index;
private final List<ClonePairInfo> clonepairList;
SlicingThread(final List<NodePairInfo> nodepairs,
final AtomicInteger index, final List<ClonePairInfo> clonepairList) {
this.nodepairs = nodepairs;
this.index = index;
this.clonepairList = clonepairList;
}
@Override
public void run() {
while (true) {
int i = this.index.getAndIncrement();
if (!(i < this.nodepairs.size())) {
break;
}
final NodePairInfo nodepair = this.nodepairs.get(i);
final PDGNode<?> nodeA = nodepair.nodeA;
final PDGNode<?> nodeB = nodepair.nodeB;
final Slicing slicing;
switch (Configuration.INSTANCE.getP()) {
case INTRA:
slicing = new MethodSlicing(nodeA, nodeB);
break;
case INTER:
slicing = new SystemSlicing(nodeA, nodeB);
break;
default:
throw new IllegalStateException();
}
final ClonePairInfo clonepair = slicing.perform();
if (Configuration.INSTANCE.getS() <= clonepair.length()) {
this.clonepairList.add(clonepair);
}
increaseNumberOfPairs();
}
}
synchronized static void increaseNumberOfPairs() {
numberOfPairs++;
}
synchronized static void increaseNumberOfComparison() {
numberOfComparion++;
}
static int numberOfPairs = 0;
static long numberOfComparion = 0;
}
| UTF-8 | Java | 1,737 | java | SlicingThread.java | Java | [] | null | [] | package jp.ac.osaka_u.ist.sdl.scorpio;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import jp.ac.osaka_u.ist.sdl.scorpio.data.ClonePairInfo;
import jp.ac.osaka_u.ist.sdl.scorpio.data.NodePairInfo;
import jp.ac.osaka_u.ist.sdl.scorpio.settings.Configuration;
import jp.ac.osaka_u.ist.sel.metricstool.pdg.node.PDGNode;
class SlicingThread implements Runnable {
private final List<NodePairInfo> nodepairs;
private final AtomicInteger index;
private final List<ClonePairInfo> clonepairList;
SlicingThread(final List<NodePairInfo> nodepairs,
final AtomicInteger index, final List<ClonePairInfo> clonepairList) {
this.nodepairs = nodepairs;
this.index = index;
this.clonepairList = clonepairList;
}
@Override
public void run() {
while (true) {
int i = this.index.getAndIncrement();
if (!(i < this.nodepairs.size())) {
break;
}
final NodePairInfo nodepair = this.nodepairs.get(i);
final PDGNode<?> nodeA = nodepair.nodeA;
final PDGNode<?> nodeB = nodepair.nodeB;
final Slicing slicing;
switch (Configuration.INSTANCE.getP()) {
case INTRA:
slicing = new MethodSlicing(nodeA, nodeB);
break;
case INTER:
slicing = new SystemSlicing(nodeA, nodeB);
break;
default:
throw new IllegalStateException();
}
final ClonePairInfo clonepair = slicing.perform();
if (Configuration.INSTANCE.getS() <= clonepair.length()) {
this.clonepairList.add(clonepair);
}
increaseNumberOfPairs();
}
}
synchronized static void increaseNumberOfPairs() {
numberOfPairs++;
}
synchronized static void increaseNumberOfComparison() {
numberOfComparion++;
}
static int numberOfPairs = 0;
static long numberOfComparion = 0;
}
| 1,737 | 0.725964 | 0.724813 | 74 | 22.472973 | 21.620951 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.918919 | false | false | 1 |
8f4cc87fc48c12487965246572482b651deaaa54 | 2,860,448,242,620 | 8d342dd904d2a7fccca77a4cf43be69719f85ae4 | /src/mobi/reid/AoC2018/main/InitDay1a.java | eb428a5d80dc77875b0e11a3fa60b6db525aab93 | [] | no_license | dioxinDev/AoC2018 | https://github.com/dioxinDev/AoC2018 | 68f978de9d77048ccf1c9ed8da3f0cf9f3819399 | 89472489151f5d4b02cc0b9f67896ba94cd172df | refs/heads/master | "2020-04-08T11:34:41.764000" | "2018-12-12T21:29:14" | "2018-12-12T21:29:14" | 159,310,959 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mobi.reid.AoC2018.main;
import mobi.reid.AoC2018.helper.Helper;
import java.util.StringTokenizer;
public class InitDay1a {
public static void main(String[] args) {
String input = Helper.getStringfromFile("./resources/day1ainput.txt");
StringTokenizer tokens = new StringTokenizer(input,"\n");
int sum = 0;
for(String token; tokens.hasMoreTokens();){
token = tokens.nextToken();
sum += Integer.parseInt(token);
}
System.out.println(sum);
}
}
| UTF-8 | Java | 539 | java | InitDay1a.java | Java | [] | null | [] | package mobi.reid.AoC2018.main;
import mobi.reid.AoC2018.helper.Helper;
import java.util.StringTokenizer;
public class InitDay1a {
public static void main(String[] args) {
String input = Helper.getStringfromFile("./resources/day1ainput.txt");
StringTokenizer tokens = new StringTokenizer(input,"\n");
int sum = 0;
for(String token; tokens.hasMoreTokens();){
token = tokens.nextToken();
sum += Integer.parseInt(token);
}
System.out.println(sum);
}
}
| 539 | 0.632653 | 0.612245 | 25 | 20.559999 | 23.087797 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48 | false | false | 1 |
e5256a5739250faf21238a5747c5d4aa744341ab | 7,155,415,568,210 | 0ef09483acaf5c9e14d7046002d1f171500f6b2d | /Infrastructure/Platform/src/main/java/com/newrelic/infraplatform/repository/MetricsRepository.java | f3318c468a2116d2c094ffe8f239d70ff1fb4108 | [] | no_license | Charul39/New-Relic-Application | https://github.com/Charul39/New-Relic-Application | 417aaef0ea83a4d09be32fbf95f1c97cda9210a0 | 31f19fd067a97b913b412d9938ec3cd4c0e2747d | refs/heads/master | "2020-06-14T15:19:44.083000" | "2019-07-03T13:28:47" | "2019-07-03T13:28:47" | 195,039,323 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.newrelic.infraplatform.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.newrelic.infraplatform.dto.ValuesDTO;
import com.newrelic.infraplatform.model.Metrics;
@Repository
public interface MetricsRepository extends JpaRepository<Metrics, Long> {
//Return Distinct Times Values
public static final String FIND_TIMES = "SELECT DISTINCT from_time"
+ " FROM metrics WHERE test_run_id=:test_run_id";
@Query(value = FIND_TIMES, nativeQuery = true)
public List<Long> getTimesList(@Param("test_run_id") Integer test_run_id);
//Return Data for each Time - cpu_percent_host
public static final String FIND_DATA_1 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTcpuPercentHost, m.cpuPercentHost) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_1)
public List<ValuesDTO> getData_cpu_percent_host(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - load_average_fifteen_minute
public static final String FIND_DATA_2 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTloadAverageFifteenMinute, m.loadAverageFifteenMinute) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_2)
public List<ValuesDTO> getData_load_average_fifteen_minute(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - load_average_one_minute
public static final String FIND_DATA_3 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTloadAverageOneMinute, m.loadAverageOneMinute) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_3)
public List<ValuesDTO> getData_load_average_one_minute(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - memory_used_bytes
public static final String FIND_DATA_4 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTmemoryUsedBytes, m.memoryUsedBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_4)
public List<ValuesDTO> getData_memory_used_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - cpu_percent_process
public static final String FIND_DATA_5 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTcpuPercentProcess, m.cpuPercentProcess) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_5)
public List<ValuesDTO> getData_cpu_percent_process(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - io_total_read_bytes
public static final String FIND_DATA_6 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTioTotalReadBytes, m.ioTotalReadBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_6)
public List<ValuesDTO> getData_io_total_read_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - io_total_write_bytes
public static final String FIND_DATA_7 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTioTotalWriteBytes, m.ioTotalWriteBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_7)
public List<ValuesDTO> getData_io_total_write_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - memory_resident_size_bytes
public static final String FIND_DATA_8 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTmemoryResidentSizeBytes, m.memoryResidentSizeBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_8)
public List<ValuesDTO> getData_memory_resident_size_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - thread_count
public static final String FIND_DATA_9 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTthreadCount, m.threadCount) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_9)
public List<ValuesDTO> getData_thread_count(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
}
| UTF-8 | Java | 4,925 | java | MetricsRepository.java | Java | [] | null | [] | package com.newrelic.infraplatform.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.newrelic.infraplatform.dto.ValuesDTO;
import com.newrelic.infraplatform.model.Metrics;
@Repository
public interface MetricsRepository extends JpaRepository<Metrics, Long> {
//Return Distinct Times Values
public static final String FIND_TIMES = "SELECT DISTINCT from_time"
+ " FROM metrics WHERE test_run_id=:test_run_id";
@Query(value = FIND_TIMES, nativeQuery = true)
public List<Long> getTimesList(@Param("test_run_id") Integer test_run_id);
//Return Data for each Time - cpu_percent_host
public static final String FIND_DATA_1 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTcpuPercentHost, m.cpuPercentHost) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_1)
public List<ValuesDTO> getData_cpu_percent_host(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - load_average_fifteen_minute
public static final String FIND_DATA_2 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTloadAverageFifteenMinute, m.loadAverageFifteenMinute) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_2)
public List<ValuesDTO> getData_load_average_fifteen_minute(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - load_average_one_minute
public static final String FIND_DATA_3 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTloadAverageOneMinute, m.loadAverageOneMinute) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_3)
public List<ValuesDTO> getData_load_average_one_minute(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - memory_used_bytes
public static final String FIND_DATA_4 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTmemoryUsedBytes, m.memoryUsedBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_4)
public List<ValuesDTO> getData_memory_used_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - cpu_percent_process
public static final String FIND_DATA_5 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTcpuPercentProcess, m.cpuPercentProcess) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_5)
public List<ValuesDTO> getData_cpu_percent_process(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - io_total_read_bytes
public static final String FIND_DATA_6 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTioTotalReadBytes, m.ioTotalReadBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_6)
public List<ValuesDTO> getData_io_total_read_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - io_total_write_bytes
public static final String FIND_DATA_7 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTioTotalWriteBytes, m.ioTotalWriteBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_7)
public List<ValuesDTO> getData_io_total_write_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - memory_resident_size_bytes
public static final String FIND_DATA_8 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTmemoryResidentSizeBytes, m.memoryResidentSizeBytes) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_8)
public List<ValuesDTO> getData_memory_resident_size_bytes(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
//Select Data for each Time - thread_count
public static final String FIND_DATA_9 = "SELECT new "
+ "com.newrelic.infraplatform.dto.ValuesDTO(m.HOSTthreadCount, m.threadCount) "
+ "FROM Metrics m where m.from_time = :from_time and m.test_run_id=:test_run_id";
@Query(value = FIND_DATA_9)
public List<ValuesDTO> getData_thread_count(@Param("test_run_id") Integer test_run_id, @Param("from_time") Long from_time);
}
| 4,925 | 0.7267 | 0.723046 | 86 | 55.267441 | 40.011749 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.813954 | false | false | 1 |
5aa5cde4f1d50c28745a082f504e8602bbdbe8f3 | 16,037,407,921,963 | 172439187a7935f0e044b7cc0eadf54feaacba3f | /OSS-App/app/src/main/java/com/example/oss_app/CategoryPage.java | ad533bd77fc49e542199c995404b7d672ae7c7a9 | [
"Apache-2.0"
] | permissive | gnwjd309/OSSW-Project | https://github.com/gnwjd309/OSSW-Project | 6607e968a276c3b03513a76e093398a219cf9242 | 3096e17ae7a7b35609b2a76382d24b031c762f66 | refs/heads/main | "2023-05-30T16:42:01.701000" | "2022-04-29T15:37:28" | "2022-05-12T08:14:40" | 341,462,626 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.oss_app;
import android.animation.ArgbEvaluator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.viewpager.widget.ViewPager;
import java.util.ArrayList;
import java.util.List;
public class CategoryPage extends Activity {
ViewPager viewPager;
CategoryAdapter adapter;
List<CategoryModel> models;
Integer[] colors = null;
ArgbEvaluator argbEvaluator = new ArgbEvaluator();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_page);
MainActivity.viewPoint = findViewById(R.id.view_point);
if (MainActivity.mode == 0)
MainActivity.viewPoint.setVisibility(View.INVISIBLE);
else
MainActivity.viewPoint.setVisibility(View.VISIBLE);
NewsListDAO newsListDAO = new NewsListDAO();
MyContentsDAO myContentsDAO = new MyContentsDAO();
newsListDAO.LoadData();
myContentsDAO.LoadData();
models = new ArrayList<>();
models.add(new CategoryModel(R.drawable.my, "My", ""));
models.add(new CategoryModel(R.drawable.society, "Society", ""));
models.add(new CategoryModel(R.drawable.sports, "Sports", ""));
models.add(new CategoryModel(R.drawable.entertain, "Entertain", ""));
models.add(new CategoryModel(R.drawable.politics, "Politics", ""));
models.add(new CategoryModel(R.drawable.digital, "IT", ""));
models.add(new CategoryModel(R.drawable.economic, "Economic", ""));
models.add(new CategoryModel(R.drawable.foreign, "Foreign", ""));
models.add(new CategoryModel(R.drawable.culture, "Culture", ""));
adapter = new CategoryAdapter(models, this);
viewPager = findViewById(R.id.viewPager);
viewPager.setAdapter(adapter);
viewPager.setPadding(130, 0, 130, 0);
Integer[] colors_temp = {
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white)
};
colors = colors_temp;
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if(position < (adapter.getCount() - 1) && position < (colors.length - 1)) {
viewPager.setBackgroundColor(
(Integer) argbEvaluator.evaluate(
positionOffset,
colors[position],
colors[position + 1]
)
);
}
else {
viewPager.setBackgroundColor(colors[colors.length - 1]);
}
}
@Override
public void onPageSelected(int position) {}
@Override
public void onPageScrollStateChanged(int state) {}
});
}
public void pageback(View v){
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
} | UTF-8 | Java | 3,764 | java | CategoryPage.java | Java | [] | null | [] | package com.example.oss_app;
import android.animation.ArgbEvaluator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.viewpager.widget.ViewPager;
import java.util.ArrayList;
import java.util.List;
public class CategoryPage extends Activity {
ViewPager viewPager;
CategoryAdapter adapter;
List<CategoryModel> models;
Integer[] colors = null;
ArgbEvaluator argbEvaluator = new ArgbEvaluator();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_page);
MainActivity.viewPoint = findViewById(R.id.view_point);
if (MainActivity.mode == 0)
MainActivity.viewPoint.setVisibility(View.INVISIBLE);
else
MainActivity.viewPoint.setVisibility(View.VISIBLE);
NewsListDAO newsListDAO = new NewsListDAO();
MyContentsDAO myContentsDAO = new MyContentsDAO();
newsListDAO.LoadData();
myContentsDAO.LoadData();
models = new ArrayList<>();
models.add(new CategoryModel(R.drawable.my, "My", ""));
models.add(new CategoryModel(R.drawable.society, "Society", ""));
models.add(new CategoryModel(R.drawable.sports, "Sports", ""));
models.add(new CategoryModel(R.drawable.entertain, "Entertain", ""));
models.add(new CategoryModel(R.drawable.politics, "Politics", ""));
models.add(new CategoryModel(R.drawable.digital, "IT", ""));
models.add(new CategoryModel(R.drawable.economic, "Economic", ""));
models.add(new CategoryModel(R.drawable.foreign, "Foreign", ""));
models.add(new CategoryModel(R.drawable.culture, "Culture", ""));
adapter = new CategoryAdapter(models, this);
viewPager = findViewById(R.id.viewPager);
viewPager.setAdapter(adapter);
viewPager.setPadding(130, 0, 130, 0);
Integer[] colors_temp = {
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white),
getResources().getColor(R.color.white)
};
colors = colors_temp;
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if(position < (adapter.getCount() - 1) && position < (colors.length - 1)) {
viewPager.setBackgroundColor(
(Integer) argbEvaluator.evaluate(
positionOffset,
colors[position],
colors[position + 1]
)
);
}
else {
viewPager.setBackgroundColor(colors[colors.length - 1]);
}
}
@Override
public void onPageSelected(int position) {}
@Override
public void onPageScrollStateChanged(int state) {}
});
}
public void pageback(View v){
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
} | 3,764 | 0.597503 | 0.594049 | 101 | 36.277229 | 25.800499 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.80198 | false | false | 1 |
7c288e00a549949745476a2495b10e1416ebc9da | 26,800,595,975,276 | 8373ece37ffb1663b4e407f80d426ba2dfa007df | /modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java | 353feec37dce10f8b74bddc4ff67a0255a885a5c | [
"Apache-2.0"
] | permissive | sboikov/ignite-test | https://github.com/sboikov/ignite-test | 09d5f588062ecc20305f30d688682762f2ee0f27 | 2d0728e5f368b4af5495e8957900c5ece42627e8 | refs/heads/master | "2015-08-17T16:21:01.627000" | "2014-12-04T21:36:27" | "2014-12-04T21:36:27" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* @java.file.header */
/* _________ _____ __________________ _____
* __ ____/___________(_)______ /__ ____/______ ____(_)_______
* _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
* / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
* \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
*/
package org.apache.ignite;
import org.gridgain.grid.*;
import org.gridgain.grid.cache.*;
import org.jetbrains.annotations.*;
/**
* Transactions facade.
*/
public interface IgniteTransactions {
/**
* Starts transaction with default isolation, concurrency, timeout, and invalidation policy.
* All defaults are set in {@link GridCacheConfiguration} at startup.
*
* @return New transaction
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStart() throws IllegalStateException;
/**
* Starts new transaction with the specified concurrency and isolation.
*
* @param concurrency Concurrency.
* @param isolation Isolation.
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation);
/**
* Starts transaction with specified isolation, concurrency, timeout, invalidation flag,
* and number of participating entries.
*
* @param concurrency Concurrency.
* @param isolation Isolation.
* @param timeout Timeout.
* @param txSize Number of entries participating in transaction (may be approximate).
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout,
int txSize);
/**
* Starts {@code affinity-group-locked} transaction based on affinity key. In this mode only affinity key
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must have the same affinity key. Node on which transaction
* is started must be primary for the given affinity key (an exception is thrown otherwise).
* <p>
* Since only affinity key is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code affinity-group-locked}
* transaction, otherwise cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link org.apache.ignite.configuration.IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if affinity key differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param affinityKey Affinity key for all entries updated by transaction. This node
* must be primary for this key.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws GridException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStartAffinity(Object affinityKey, GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, GridException;
/**
* Starts {@code partition-group-locked} transaction based on partition ID. In this mode the whole partition
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must belong to the same partition. Node on which transaction
* is started must be primary for the given partition (an exception is thrown otherwise).
* <p>
* Since only partition is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code partition-group-locked}
* transaction, otherwise, cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link org.apache.ignite.configuration.IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if key partition differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param partId Partition id for which transaction is started. This node
* must be primary for this partition.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws GridException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStartPartition(int partId, GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, GridException;
/**
* Gets transaction started by this thread or {@code null} if this thread does
* not have a transaction.
*
* @return Transaction started by this thread or {@code null} if this thread
* does not have a transaction.
*/
@Nullable public GridCacheTx tx();
}
| UTF-8 | Java | 6,984 | java | IgniteTransactions.java | Java | [] | null | [] | /* @java.file.header */
/* _________ _____ __________________ _____
* __ ____/___________(_)______ /__ ____/______ ____(_)_______
* _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
* / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
* \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
*/
package org.apache.ignite;
import org.gridgain.grid.*;
import org.gridgain.grid.cache.*;
import org.jetbrains.annotations.*;
/**
* Transactions facade.
*/
public interface IgniteTransactions {
/**
* Starts transaction with default isolation, concurrency, timeout, and invalidation policy.
* All defaults are set in {@link GridCacheConfiguration} at startup.
*
* @return New transaction
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStart() throws IllegalStateException;
/**
* Starts new transaction with the specified concurrency and isolation.
*
* @param concurrency Concurrency.
* @param isolation Isolation.
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation);
/**
* Starts transaction with specified isolation, concurrency, timeout, invalidation flag,
* and number of participating entries.
*
* @param concurrency Concurrency.
* @param isolation Isolation.
* @param timeout Timeout.
* @param txSize Number of entries participating in transaction (may be approximate).
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout,
int txSize);
/**
* Starts {@code affinity-group-locked} transaction based on affinity key. In this mode only affinity key
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must have the same affinity key. Node on which transaction
* is started must be primary for the given affinity key (an exception is thrown otherwise).
* <p>
* Since only affinity key is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code affinity-group-locked}
* transaction, otherwise cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link org.apache.ignite.configuration.IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if affinity key differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param affinityKey Affinity key for all entries updated by transaction. This node
* must be primary for this key.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws GridException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStartAffinity(Object affinityKey, GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, GridException;
/**
* Starts {@code partition-group-locked} transaction based on partition ID. In this mode the whole partition
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must belong to the same partition. Node on which transaction
* is started must be primary for the given partition (an exception is thrown otherwise).
* <p>
* Since only partition is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code partition-group-locked}
* transaction, otherwise, cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link org.apache.ignite.configuration.IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if key partition differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param partId Partition id for which transaction is started. This node
* must be primary for this partition.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws GridException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}.
*/
public GridCacheTx txStartPartition(int partId, GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, GridException;
/**
* Gets transaction started by this thread or {@code null} if this thread does
* not have a transaction.
*
* @return Transaction started by this thread or {@code null} if this thread
* does not have a transaction.
*/
@Nullable public GridCacheTx tx();
}
| 6,984 | 0.67941 | 0.678837 | 136 | 50.35294 | 39.656528 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.338235 | false | false | 1 |
208239365878d098f6d17d5fed4318bd10390535 | 26,800,595,973,661 | 2020c74134feb9a256822ce304c061cf28b3052a | /src/main/java/com/wujingcheng7/hoteldemo_backend/controller/front/HotelsDisplayController.java | 97068a5fb9646c09bdb17f0053ee474c5e1c7dad | [] | no_license | wujingcheng7/HotelDemo_BackEnd | https://github.com/wujingcheng7/HotelDemo_BackEnd | b262678e1aff969175e82c7e8e9be945e92b35c6 | aba61e0ef6943849bf24c370026c6c7adb42579b | refs/heads/master | "2022-07-06T23:47:02.214000" | "2020-05-05T15:04:16" | "2020-05-05T15:04:16" | 198,598,855 | 3 | 2 | null | false | "2022-06-21T01:33:38" | "2019-07-24T09:06:50" | "2020-05-10T13:21:41" | "2022-06-21T01:33:35" | 8,625 | 3 | 2 | 1 | HTML | false | false | package com.wujingcheng7.hoteldemo_backend.controller.front;
import com.wujingcheng7.hoteldemo_backend.domain.Hotel;
import com.wujingcheng7.hoteldemo_backend.service.HotelService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/hotels_display")
public class HotelsDisplayController {
@Autowired
HotelService hotelSearchService;
@GetMapping("")
public String getHtml(Model model){
model=showHotelList("","",model);
return "/hotels_display";
}
@PostMapping("")
public Model showHotelList(@Param("hotel_city")String hotel_city,
@Param("hotel_name")String hotel_name,
Model model){
if (hotel_city.equals("目的地"))
hotel_city="";
if (hotel_name.equals("关键字(酒店名),..."))
hotel_name="";
List<Hotel> hotels = hotelSearchService.getHotelListByCityAndName(hotel_city,hotel_name);
model.addAttribute("HotelList",hotels);
return model;
}
}
| UTF-8 | Java | 1,407 | java | HotelsDisplayController.java | Java | [
{
"context": "_backend.controller.front;\n\nimport com.wujingcheng7.hoteldemo_backend.domain.Hotel;\nimport com.wujing",
"end": 85,
"score": 0.5535988211631775,
"start": 84,
"tag": "USERNAME",
"value": "7"
}
] | null | [] | package com.wujingcheng7.hoteldemo_backend.controller.front;
import com.wujingcheng7.hoteldemo_backend.domain.Hotel;
import com.wujingcheng7.hoteldemo_backend.service.HotelService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/hotels_display")
public class HotelsDisplayController {
@Autowired
HotelService hotelSearchService;
@GetMapping("")
public String getHtml(Model model){
model=showHotelList("","",model);
return "/hotels_display";
}
@PostMapping("")
public Model showHotelList(@Param("hotel_city")String hotel_city,
@Param("hotel_name")String hotel_name,
Model model){
if (hotel_city.equals("目的地"))
hotel_city="";
if (hotel_name.equals("关键字(酒店名),..."))
hotel_name="";
List<Hotel> hotels = hotelSearchService.getHotelListByCityAndName(hotel_city,hotel_name);
model.addAttribute("HotelList",hotels);
return model;
}
}
| 1,407 | 0.704266 | 0.702097 | 38 | 35.394737 | 23.506483 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657895 | false | false | 1 |
96d7fc7b6574878244c8a58b09d2f2cf40ad70b3 | 26,396,869,037,227 | f04d59a4b43dafca9fb39605cc329913b72a9fd5 | /src/main/java/uk/co/jassoft/network/Network.java | 56081ea30f21f1224be0275d5f82aa5b5f8fb93a | [] | no_license | MarketReaction/CommonFunctions | https://github.com/MarketReaction/CommonFunctions | 6de9b43b827bf9122b2aa6ea477050f8f8a52268 | 7e20a9c96b30467219ae92199f4fc37bfb3d8d0f | refs/heads/master | "2021-01-24T11:45:36.005000" | "2016-12-23T11:42:39" | "2016-12-23T11:42:39" | 69,493,960 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 uk.co.jassoft.network;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.zip.GZIPInputStream;
/**
*
* @author Jonny
*/
@Component
public class Network
{
@Value("${market.network.connection.timeout}")
private int connectTimeout;
@Value("${market.network.read.timeout}")
private int readTimeout;
public String httpRequest(String httpUrl, String method, boolean cache) throws IOException
{
final StringBuilder builder = new StringBuilder();
try(InputStream stream = read(httpUrl, method, cache)) {
try (BufferedReader buffReader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = buffReader.readLine()) != null) {
builder.append(line);
}
}
}
return builder.toString();
}
public InputStream read(String httpUrl, String method, boolean cache) throws IOException
{
HttpURLConnection conn = null;
try
{
URL base, next;
String location;
while (true) {
// inputing the keywords to google search engine
URL url = new URL(httpUrl);
// if(cache) {
// //Proxy instance, proxy ip = 10.0.0.1 with port 8080
// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("cache", 3128));
// // makking connection to the internet
// conn = (HttpURLConnection) url.openConnection(proxy);
// }
// else {
conn = (HttpURLConnection) url.openConnection();
// }
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
conn.setRequestMethod(method);
conn.setRequestProperty("User-Agent", "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)");
conn.setRequestProperty("Accept-Encoding", "gzip");
switch (conn.getResponseCode()) {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
location = conn.getHeaderField("Location");
base = new URL(httpUrl);
next = new URL(base, location); // Deal with relative URLs
httpUrl = next.toExternalForm();
continue;
}
break;
}
if (!conn.getContentType().startsWith("text/") || conn.getContentType().equals("text/xml")) {
throw new IOException(String.format("Content of story is not Text. Returned content type is [%s]", conn.getContentType()));
}
if ("gzip".equals(conn.getContentEncoding())) {
return new GZIPInputStream(conn.getInputStream());
}
// getting the input stream of page html into bufferedreader
return conn.getInputStream();
}
catch (Exception exception)
{
throw new IOException(exception);
}
finally {
if (conn != null && conn.getErrorStream() != null) {
conn.getErrorStream().close();
}
}
}
}
| UTF-8 | Java | 3,875 | java | Network.java | Java | [
{
"context": " java.util.zip.GZIPInputStream;\n\n/**\n *\n * @author Jonny\n */\n@Component\npublic class Network\n{\n @Value(",
"end": 566,
"score": 0.996411919593811,
"start": 561,
"tag": "NAME",
"value": "Jonny"
},
{
"context": "/ //Proxy instance, proxy ip = 10.0.0.1 with port 8080\n// Proxy proxy ",
"end": 1758,
"score": 0.9997261762619019,
"start": 1750,
"tag": "IP_ADDRESS",
"value": "10.0.0.1"
}
] | null | [] | /*
* 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 uk.co.jassoft.network;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.zip.GZIPInputStream;
/**
*
* @author Jonny
*/
@Component
public class Network
{
@Value("${market.network.connection.timeout}")
private int connectTimeout;
@Value("${market.network.read.timeout}")
private int readTimeout;
public String httpRequest(String httpUrl, String method, boolean cache) throws IOException
{
final StringBuilder builder = new StringBuilder();
try(InputStream stream = read(httpUrl, method, cache)) {
try (BufferedReader buffReader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = buffReader.readLine()) != null) {
builder.append(line);
}
}
}
return builder.toString();
}
public InputStream read(String httpUrl, String method, boolean cache) throws IOException
{
HttpURLConnection conn = null;
try
{
URL base, next;
String location;
while (true) {
// inputing the keywords to google search engine
URL url = new URL(httpUrl);
// if(cache) {
// //Proxy instance, proxy ip = 10.0.0.1 with port 8080
// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("cache", 3128));
// // makking connection to the internet
// conn = (HttpURLConnection) url.openConnection(proxy);
// }
// else {
conn = (HttpURLConnection) url.openConnection();
// }
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
conn.setRequestMethod(method);
conn.setRequestProperty("User-Agent", "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)");
conn.setRequestProperty("Accept-Encoding", "gzip");
switch (conn.getResponseCode()) {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
location = conn.getHeaderField("Location");
base = new URL(httpUrl);
next = new URL(base, location); // Deal with relative URLs
httpUrl = next.toExternalForm();
continue;
}
break;
}
if (!conn.getContentType().startsWith("text/") || conn.getContentType().equals("text/xml")) {
throw new IOException(String.format("Content of story is not Text. Returned content type is [%s]", conn.getContentType()));
}
if ("gzip".equals(conn.getContentEncoding())) {
return new GZIPInputStream(conn.getInputStream());
}
// getting the input stream of page html into bufferedreader
return conn.getInputStream();
}
catch (Exception exception)
{
throw new IOException(exception);
}
finally {
if (conn != null && conn.getErrorStream() != null) {
conn.getErrorStream().close();
}
}
}
}
| 3,875 | 0.56671 | 0.556129 | 112 | 33.598213 | 32.420082 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553571 | false | false | 1 |