blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2db963d0fa4200919e1004a72cf03f842adbaa15 | a86f2d6be5d9f5c678f6feba007602a3d2d4e723 | /src/io/harkema/requests/PermitRequest.java | e1fba4e7cde59ac330efef5a9f63c03be28898bb | [] | no_license | tomasharkema/ooad-opdracht | cf8d92b80e23a18b8aef5951188cdd8b04a9d295 | 26269db6ca0ead3136c2fc83dbb249e440e38c70 | refs/heads/master | 2021-01-12T01:04:49.052862 | 2017-01-08T13:55:22 | 2017-01-08T13:55:22 | 78,342,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package io.harkema.requests;
import io.harkema.models.Event;
import io.harkema.models.Partner;
import io.harkema.models.User;
import java.util.Date;
/**
* Created by tomas on 08-01-17.
*/
public class PermitRequest {
public int quantity;
public String location;
public Partner partner;
public PermitRequest(int quantity, String location, Partner partner) {
this.quantity = quantity;
this.location = location;
this.partner = partner;
}
}
| [
"[email protected]"
] | |
d29767f44ed9270f7b8cbf5af2387ebb0e42c083 | 628e45dd5f6e4ba2b16f50988ed215bded06e6a6 | /udemy-hibernate/com.mastercard.hibernate/src/main/java/com/mastercard/hibernate/demo/entity5/Course.java | b000222294136de3fbca4b04978b7c9d1cfd4abd | [] | no_license | JessyTerada/spring-hibernate | 1dc63000754f29da92c2c3309f344de80dcfea03 | 4cd1e84825f44a93cd64c581cd78d4b5ecf3357e | refs/heads/master | 2021-07-05T02:44:13.329392 | 2017-09-28T19:39:02 | 2017-09-28T19:39:02 | 103,560,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | package com.mastercard.hibernate.demo.entity5;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="course")
public class Course {
//define our fields
//define constructors
//define getter setters
//define tostring
//annotate fields
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="title")
private String title;
@ManyToOne(cascade= {CascadeType.PERSIST, CascadeType.MERGE,
CascadeType.DETACH, CascadeType.REFRESH})
@JoinColumn(name="instructor_id")
private Instructor instructor;
@OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
@JoinColumn(name="course_id")
private List<Review> reviews;
public Course() {
}
public Course(String title) {
this.title = title;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Instructor getInstructor() {
return instructor;
}
public void setInstructor(Instructor instructor) {
this.instructor = instructor;
}
public List<Review> getReviews() {
return reviews;
}
public void setReviews(List<Review> reviews) {
this.reviews = reviews;
}
//add a convenience method
public void addReview(Review theReview) {
if (reviews == null) {
reviews = new ArrayList<Review>();
}
reviews.add(theReview);
}
@Override
public String toString() {
return "Course [id=" + id + ", title=" + title + "]";
}
}
| [
"[email protected]"
] | |
601166cab691187a3748c7533cbab447483f7ab2 | 8fe74121699e5da3df1419360356679692c28f2f | /gui.mtm/src/main/java/zenryokuservice/gui/lwjgl/tutoriral/gitbook/chapter6/engine/graph/Mesh.java | f4f5c56ad1e8e9f51b019682c876c404dd98154c | [
"MIT"
] | permissive | ZenryokuService/MultiTaskManager | 8ee87cd2f08805898a41587c14942c812299094b | 04f3573cbdb15ca56676e55ed2e31772a7c27edd | refs/heads/master | 2021-06-09T03:36:57.853552 | 2021-04-12T11:37:40 | 2021-04-12T11:37:40 | 151,907,430 | 0 | 0 | MIT | 2020-10-13T10:18:02 | 2018-10-07T04:57:02 | Java | UTF-8 | Java | false | false | 3,206 | java | package zenryokuservice.gui.lwjgl.tutoriral.gitbook.chapter6.engine.graph;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL30.*;
import org.lwjgl.system.MemoryUtil;
public class Mesh {
private final int vaoId;
private final int posVboId;
private final int colourVboId;
private final int idxVboId;
private final int vertexCount;
public Mesh(float[] positions, float[] colours, int[] indices) {
FloatBuffer posBuffer = null;
FloatBuffer colourBuffer = null;
IntBuffer indicesBuffer = null;
try {
vertexCount = indices.length;
vaoId = glGenVertexArrays();
glBindVertexArray(vaoId);
// Position VBO
posVboId = glGenBuffers();
posBuffer = MemoryUtil.memAllocFloat(positions.length);
posBuffer.put(positions).flip();
glBindBuffer(GL_ARRAY_BUFFER, posVboId);
glBufferData(GL_ARRAY_BUFFER, posBuffer, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
// Colour VBO
colourVboId = glGenBuffers();
colourBuffer = MemoryUtil.memAllocFloat(colours.length);
colourBuffer.put(colours).flip();
glBindBuffer(GL_ARRAY_BUFFER, colourVboId);
glBufferData(GL_ARRAY_BUFFER, colourBuffer, GL_STATIC_DRAW);
glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);
// Index VBO
idxVboId = glGenBuffers();
indicesBuffer = MemoryUtil.memAllocInt(indices.length);
indicesBuffer.put(indices).flip();
// メモリの解放
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicesBuffer, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
} finally {
if (posBuffer != null) {
MemoryUtil.memFree(posBuffer);
}
if (colourBuffer != null) {
MemoryUtil.memFree(colourBuffer);
}
if (indicesBuffer != null) {
MemoryUtil.memFree(indicesBuffer);
}
}
}
public int getVaoId() {
return vaoId;
}
public int getVertexCount() {
return vertexCount;
}
public void cleanUp() {
glDisableVertexAttribArray(0);
// Delete the VBOs
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(posVboId);
glDeleteBuffers(colourVboId);
glDeleteBuffers(idxVboId);
// Delete the VAO
glBindVertexArray(0);
glDeleteVertexArrays(vaoId);
}
// 追加メソッド
public void render() {
glBindVertexArray(getVaoId());
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glDrawElements(GL_TRIANGLES, getVertexCount(), GL_UNSIGNED_INT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glBindVertexArray(0);
}
}
| [
"[email protected]"
] | |
5a8c3a5d864ed4241699a9ffca581629c2667573 | 5700300cfd0f6b327c4ef017e4c63461d671c275 | /Dome_7/src/dome/person.java | 716298dc7ea22a31b6300a7aa1eae223b6e3fd86 | [] | no_license | 1301512561/- | 696a54374358bb255498aa9e0ca87fc76ff95f1d | 7465d7984801a0fbbb79c0dfb3af3bd99c9a6b65 | refs/heads/master | 2020-09-04T22:50:48.624161 | 2019-11-06T05:42:06 | 2019-11-06T05:42:06 | 219,915,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package dome;
public class person {
private String name;
private int age;
public person() {
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof person) {
person p = (person) obj;
return this.age == p.age;
}
return false;
}
public String toString() {
return name+" "+age;
}
public person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
| [
"[email protected]"
] | |
5c28c08ea5578d6b028c744539e979b50c315d1a | 5cd3c28fa0c396a943b8a32fabf6106e9cb02ad4 | /src/main/java/me/caixin/configuration/RocketMQConfiguration.java | b519f3d85aa0d6c28a806d013f98a0efd10830f3 | [
"Apache-2.0"
] | permissive | cairenjie1985/springBoot-demo | 4a43610129a619299cc979147cdbfebb8e42ba48 | 7d8c55200e84f264758bd783af209cdeaae74bd2 | refs/heads/master | 2021-01-22T00:20:33.474698 | 2017-09-05T01:36:51 | 2017-09-05T01:36:51 | 102,188,894 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,845 | java | package me.caixin.configuration;
import com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import me.caixin.listener.MessageListener;
import me.caixin.rocketmq.RocketMQClientImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.annotation.Order;
/**
* Project Name: spring-boot-demo
* Package Name: me.caixin.configuration
* Function:
* User: roy
* Date: 2017-09-05
*/
@Configuration
@ConfigurationProperties(prefix = "rocketmq")
@PropertySource(value = "classpath:/config/rocketmq.properties")
public class RocketMQConfiguration {
@Order(1)
@Bean(name = "consumer")
public DefaultMQPushConsumer defaultMQPushConsumer(){
DefaultMQPushConsumer defaultMQPushConsumer = new DefaultMQPushConsumer();
defaultMQPushConsumer.setConsumerGroup(this.consumerGroup);
defaultMQPushConsumer.setNamesrvAddr(this.addr);
return defaultMQPushConsumer;
}
@Order(1)
@Bean(name = "producer")
public DefaultMQProducer defaultMQProducer(){
DefaultMQProducer defaultMQProducer = new DefaultMQProducer();
defaultMQProducer.setProducerGroup(this.producerGroup);
defaultMQProducer.setNamesrvAddr(this.addr);
return defaultMQProducer;
}
@Order(1)
@Bean(name="messageListener")
public MessageListener messageListener(){
return new MessageListener();
}
@Order(2)
@Bean(name = "mqClient",initMethod = "init")
public RocketMQClientImpl rocketMQClient(){
RocketMQClientImpl rocketMQClient = new RocketMQClientImpl(this.defaultMQPushConsumer(), this.defaultMQProducer());
rocketMQClient.setMessageListener(this.messageListener());
rocketMQClient.setTopicTags(this.topicTags);
return rocketMQClient;
}
private String consumerGroup ;
private String addr;
private String producerGroup;
private String topicTags;
public String getConsumerGroup() {
return consumerGroup;
}
public void setConsumerGroup(String consumerGroup) {
this.consumerGroup = consumerGroup;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getProducerGroup() {
return producerGroup;
}
public void setProducerGroup(String producerGroup) {
this.producerGroup = producerGroup;
}
public String getTopicTags() {
return topicTags;
}
public void setTopicTags(String topicTags) {
this.topicTags = topicTags;
}
}
| [
"[email protected]"
] | |
bc7833d4758d48d162797d2da4cf3fb61bb33623 | e672e1bcfe9168c1e3779c5f3b3f3b8f8d6e2a35 | /src/com/wxp/swt/jface/sample/PersonListLabelProvider.java | 4e4ebe13162d3a9d8607f5892bd701a30a0276bd | [] | no_license | accordionmaster/FavoritesPlugins | 2a8a75e7bb8164c28f34d55c544ca0db047ca2e0 | 32f37e432a1e79931d1d1abfe2fb81fbde4948cd | refs/heads/master | 2022-12-12T10:48:52.311210 | 2020-09-11T08:17:06 | 2020-09-11T08:17:06 | 255,007,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.wxp.swt.jface.sample;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
public class PersonListLabelProvider extends LabelProvider {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
Person person = (Person) element;
return person.firstName + " " + person.lastName;
}
}
| [
"[email protected]"
] | |
76b083e8c56d94b764991bf93d845c891cd3bd7a | f38263d8861fcd1814d94ded0dc7365c61e43014 | /app/src/main/java/autoimageslider/IndicatorView/draw/drawer/type/SlideDrawer.java | 2fae28e72625d430571f37ee96fa18fc73ca6df5 | [] | no_license | dechantoine/what-could-i-cook-app | dbcd9c3168dc05876d2d0c05e76a4b13c622d75d | 0d95b410ab9dfb380a6ae80b06d284aaac89e0fe | refs/heads/master | 2023-08-18T07:36:15.164446 | 2020-01-24T10:55:34 | 2020-01-24T10:55:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package autoimageslider.IndicatorView.draw.drawer.type;
import android.graphics.Canvas;
import android.graphics.Paint;
import androidx.annotation.NonNull;
import autoimageslider.IndicatorView.animation.data.Value;
import autoimageslider.IndicatorView.animation.data.type.SlideAnimationValue;
import autoimageslider.IndicatorView.draw.data.Indicator;
import autoimageslider.IndicatorView.draw.data.Orientation;
public class SlideDrawer extends BaseDrawer {
public SlideDrawer(@NonNull Paint paint, @NonNull Indicator indicator) {
super(paint, indicator);
}
public void draw(
@NonNull Canvas canvas,
@NonNull Value value,
int coordinateX,
int coordinateY) {
if (!(value instanceof SlideAnimationValue)) {
return;
}
SlideAnimationValue v = (SlideAnimationValue) value;
int coordinate = v.getCoordinate();
int unselectedColor = indicator.getUnselectedColor();
int selectedColor = indicator.getSelectedColor();
int radius = indicator.getRadius();
paint.setColor(unselectedColor);
canvas.drawCircle(coordinateX, coordinateY, radius, paint);
paint.setColor(selectedColor);
if (indicator.getOrientation() == Orientation.HORIZONTAL) {
canvas.drawCircle(coordinate, coordinateY, radius, paint);
} else {
canvas.drawCircle(coordinateX, coordinate, radius, paint);
}
}
}
| [
"[email protected]"
] | |
3e3cb01fb29289a24a4b49aef1d49e3c69b4cb8e | 036b9d00098d45fc3ecc8a2fb7ef0c11dae65941 | /src/main/java/com/saviorru/comsserver/cli/command/StartTournamentCommand.java | 3fdc1077046ca835a52b6620cfce555018666d9c | [] | no_license | Doomsday46/coms-server | 7c202564965b20bea609fd4c1c6fa8fa607ce58c | 99ad0c85d08d6a18cf33130aa18afb1551399691 | refs/heads/master | 2021-04-18T11:16:33.603491 | 2018-07-28T12:21:09 | 2018-07-28T12:21:09 | 126,798,974 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | package com.saviorru.comsserver.cli.command;
import com.saviorru.comsserver.domain.tournament.Tournament;
public class StartTournamentCommand implements Command {
private Tournament tournament;
public StartTournamentCommand(Tournament tournament) {
if (tournament == null) throw new NullPointerException("Tournament not created");
this.tournament = tournament;
}
@Override
public Boolean execute(){
tournament.start();
return true;
}
}
| [
"[email protected]"
] | |
a490ab9c4d44a0abeaac176e7e4d338ad43b6713 | 3543f57f016e573d42fcec746f5e7375191ccf81 | /src/main/java/com/leetcode/PredictTheWinner.java | 97d75e933d1ecef3a260ef8bd30cb29f4edf950d | [] | no_license | chzh1229/LeetCode | 5c9cd93289305b5a46ca2d577d5cc781ea59debc | b001de6c8bef5764b5e375766a3fc61ff9875a96 | refs/heads/master | 2021-12-20T23:38:34.029527 | 2021-12-20T13:51:26 | 2021-12-20T13:51:26 | 112,096,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.leetcode;
import java.util.Arrays;
public class PredictTheWinner {
public boolean PredictTheWinner(int[] nums) {
int[][] d = new int[nums.length][nums.length];
for (int k=0; k<nums.length; k++) {
d[k][k] = nums[k];
}
for (int i = nums.length - 1; i>=0; i--) {
for (int j = i+1; j<nums.length; j++) {
d[i][j] = Math.max(nums[i] - d[i+1][j], nums[j] - d[i][j-1]);
}
}
return d[0][nums.length] >= 0;
}
public static void main(String[] args) {
int[] nums = new int[] {1,5,233,7};
PredictTheWinner p = new PredictTheWinner();
p.PredictTheWinner(nums);
}
}
| [
"[email protected]"
] | |
c9ae0bf03ec733ba665280de97f65ec6f74b86d8 | ce0feed6f9693bf48c09d2fcc7ee1a36a315d2cb | /src/main/java/net/suncaper/mallanlisb/common/domain/Admin.java | b955608d6fc04a4974625c2d1732183fb8075fe7 | [] | no_license | smalldandan/mallanlisb | ffe665e3731067bc463c66f8e2e1b6b06f1626d2 | c7136b8c369a144a41bfd0242b4765f654e91df6 | refs/heads/master | 2022-06-23T23:07:49.379853 | 2019-12-28T12:30:03 | 2019-12-28T12:30:03 | 230,587,870 | 0 | 0 | null | 2022-06-21T02:32:17 | 2019-12-28T09:24:36 | Java | UTF-8 | Java | false | false | 1,586 | java | package net.suncaper.mallanlisb.common.domain;
import java.util.Date;
public class Admin {
private Integer id;
private String loginname;
private String password;
private Date lastlogintime;
private String remark;
public Admin(String loginname, String password) {
this.loginname = loginname;
this.password = password;
}
public Admin() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname == null ? null : loginname.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Date getLastlogintime() {
return lastlogintime;
}
public void setLastlogintime(Date lastlogintime) {
this.lastlogintime = lastlogintime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
@Override
public String toString() {
return "Admin{" +
"id=" + id +
", loginname='" + loginname + '\'' +
", password='" + password + '\'' +
", lastlogintime=" + lastlogintime +
", remark='" + remark + '\'' +
'}';
}
} | [
"[email protected]"
] | |
b581be9dc2ebd77a2dce27a452637681c556da54 | 7ab4a314aa15ef538b0e6fc390325b1086c3a4a3 | /Layout/020_Controle1/src/Fenetre.java | 2155f32876916d87d5795dfe848de47cc0fe4120 | [] | no_license | S-IN/JAVA-overview | c15181f98e5fb0c974878d4e4b58066b2268d69a | 455961e661ac4bae00bda70609dd8092ecc7fda7 | refs/heads/master | 2020-05-27T09:25:30.066614 | 2019-05-25T14:13:54 | 2019-05-25T14:13:54 | 188,565,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,991 | java | // ==========================================================================
// Fenetre avec 2 CASES A COCHER et deux Labels pour avoir l'etat des cases
// Utilisation de GridLayout et FlowLayout...
// ==========================================================================
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import utilitairesMG.graphique.*;
public class Fenetre extends JFrame implements ActionListener
{
private JPanel panneauFond;
private JPanel panneauHaut;
private JCheckBox case1;
private JLabel texte1;
private JPanel panneauBas;
private JCheckBox case2;
private JLabel texte2;
public Fenetre(String s)
{
super(s);
addWindowListener(new EcouteFenetre());
// --------------------------------------------------------------------------
// Creation du panneau de fond : on l'organise en GridLayout de deux lignes
// et une colonne. Chaque case va contenir un panneau contenant deux
// composants (JCheckBox, JLabel).
// --------------------------------------------------------------------------
panneauFond = new JPanel();
panneauFond.setLayout(new GridLayout(2, 1));
// --------------------------------------------------------------------------
// Creation du panneau a mettre en haut de panneauFond :
// --------------------------------------------------------------------------
panneauHaut = new JPanel();
panneauHaut.setLayout(new FlowLayout(FlowLayout.LEFT));
panneauHaut.setBackground(Color.white);
case1 = new JCheckBox("Case 1");
case1.setBackground(Color.white);
case1.addActionListener(this);
texte1 = new JLabel("Case 1 non sélectionnée");
texte1.setForeground(Color.red);
texte1.setToolTipText("Etat de la première case");
panneauHaut.add(case1);
panneauHaut.add(texte1);
// --------------------------------------------------------------------------
// Creation du panneau a mettre en bas de panneauFond :
// --------------------------------------------------------------------------
panneauBas = new JPanel();
panneauBas.setLayout(new FlowLayout(FlowLayout.LEFT));
panneauBas.setBackground(Color.white);
case2 = new JCheckBox("Case 2");
case2.setBackground(Color.white);
case2.addActionListener(this);
texte2 = new JLabel("Case 2 non sélectionnée");
texte2.setForeground(Color.red);
texte2.setToolTipText("Etat de la deuxième case");
panneauBas.add(case2);
panneauBas.add(texte2);
// --------------------------------------------------------------------------
// Ajout de panneauHaut et panneauBas a panneauFond :
// --------------------------------------------------------------------------
panneauFond.add(panneauHaut);
panneauFond.add(panneauBas);
// --------------------------------------------------------------------------
// Placement du panneauFond dans la zone de contenu de la fenetre :
// --------------------------------------------------------------------------
add(panneauFond);
pack();
setVisible(true);
}
// --------------------------------------------------------------------------
// Methode de l'interface ActionListener :
// --------------------------------------------------------------------------
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == case1)
{
if (case1.isSelected())
{
texte1.setText("Case 1 sélectionnée");
}
else
{
texte1.setText("Case 1 non sélectionnée");
}
}
else
{
if (case2.isSelected())
{
texte2.setText("Case 2 sélectionnée");
}
else
{
texte2.setText("Case 2 non sélectionnée");
}
}
}
}
| [
"[email protected]"
] | |
44bf055af23ca32e7be56a8c0b4df1551c380387 | 206cce7698b959470b5cd7cfbc2221b33d82b84f | /src/main/java/com/stgutah/model/ParkingSlot.java | bcf2c6e531a5eea94bdc14732f608faaa97e0d83 | [] | no_license | dempey/AirportParking | 9e498fada97852725485f9c478d715f2994a6a7b | aa9457589ad982d3758ca258ffab073b25095f48 | refs/heads/master | 2021-01-01T15:55:41.727506 | 2014-06-19T19:11:00 | 2014-06-19T19:11:00 | 20,691,100 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.stgutah.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "PARKING_SLOT")
public class ParkingSlot
{
@Id
@Column(name = "PARKING_SLOT_ID")
@GeneratedValue
private Integer parkingSlotId;
@Column(name = "NUMBER", nullable = false)
private String number;
@ManyToOne
@JoinColumn(name = "PARKING_LOT_ID", nullable = false, referencedColumnName="PARKING_LOT_ID")
private ParkingLot parkingLot;
public Integer getParkingSlotId()
{
return parkingSlotId;
}
public void setParkingSlotId(Integer parkingSlotId)
{
this.parkingSlotId = parkingSlotId;
}
public String getNumber()
{
return number;
}
public void setNumber(String number)
{
this.number = number;
}
public ParkingLot getParkingLot()
{
return parkingLot;
}
public void setParkingLot(ParkingLot parkingLot)
{
this.parkingLot = parkingLot;
}
}
| [
"[email protected]"
] | |
5e0846ed167a386905e870604b1596360ff8a52f | 442d904a36e566e8568dc04a72edef1c0f7dfcd0 | /src/main/java/br/com/caelum/ingresso/validacao/GerenciadorDeSessao.java | d466a5127d6d3481fea7bf52d2a8821d20062b7b | [] | no_license | rodrigotavares1511/fj22-ingressos | f2db9fa5720be4ac4a258846d5804a9bc69557ad | 49ae7a10e2036fde60b519697fa1aeaab1109012 | refs/heads/master | 2021-07-19T15:42:23.770191 | 2017-10-28T00:23:14 | 2017-10-28T00:23:14 | 108,051,882 | 0 | 0 | null | 2017-10-23T23:26:51 | 2017-10-23T23:26:51 | null | UTF-8 | Java | false | false | 1,095 | java | package br.com.caelum.ingresso.validacao;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import br.com.caelum.ingresso.model.Sessao;
public class GerenciadorDeSessao {
private List<Sessao> sessoesDaSala;
public GerenciadorDeSessao(List<Sessao> sessoesDaSala){
this.sessoesDaSala = sessoesDaSala;
}
private boolean horarioIsValido(Sessao sessaoExistente, Sessao sessaoAtual){
LocalDate hoje = LocalDate.now();
LocalDateTime horarioSessao = sessaoExistente.getHorario().atDate(hoje);
LocalDateTime horarioAtual = sessaoAtual.getHorario().atDate(hoje);
boolean ehAntes = sessaoAtual.getHorario().isBefore(sessaoExistente.getHorario());
if(ehAntes){
return sessaoAtual.getHorarioTermino()
.isBefore(horarioSessao);
}else{
return sessaoExistente.getHorarioTermino()
.isBefore(horarioAtual);
}
}
public boolean cabe(Sessao sessaoAtual){
return sessoesDaSala
.stream()
.map(sessaoExistente -> horarioIsValido(sessaoExistente, sessaoAtual))
.reduce(Boolean::logicalAnd)
.orElse(true);
}
}
| [
"[email protected]"
] | |
1a6c714d0d16d3aa14746fd0e7f29a5d0c004214 | 09ffad4c41819210de5f337bade47bbad8e537bb | /BikeShare_V2/app/src/main/java/com/example/bikeshare/EndRideActivity.java | 351a4a963b8e19838a1a9630b83090533ed96d06 | [] | no_license | Jepp0103/Mobile_App_Development_BikeShare_Project | 70be7cdfbb8eb57336285d45c7e41d38bbcc859c | 48be27703138ab97bfa3eefe6e603dd0d1022e42 | refs/heads/main | 2023-01-10T05:12:57.840644 | 2020-11-19T14:50:03 | 2020-11-19T14:50:03 | 314,276,814 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,609 | java | package com.example.bikeshare;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.*;
import android.widget.*;
public class EndRideActivity extends Activity {
// GUI variables
private Button mAddRide;
private TextView mLastAdded;
private TextView mNewWhat;
private TextView mNewWhere;
private Ride mLast = new Ride("", "","");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_end_ride);
mLastAdded = (TextView) findViewById(R.id.last_thing);
updateUI();
// Button
mAddRide = (Button) findViewById(R.id.endRide_button);
// Texts
mNewWhat = (TextView) findViewById(R.id.what_text);
mNewWhere = (TextView) findViewById(R.id.where_text);
//View products click event
mAddRide.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ((mNewWhat.getText().length() > 0) && (mNewWhere.getText().length() > 0)) {
mLast.setBikeName(mNewWhat.getText().toString().trim());
mLast.setStartRide(mNewWhere.getText().toString().trim());
// Reset text fields
mNewWhat.setText("");
mNewWhere.setText("");
updateUI();
}
}
});
}
private void updateUI() {
mLastAdded.setText(mLast.toString());
}
} | [
"[email protected]"
] | |
ea047ce552d1324f5995e02aeb9a824e852571bd | eab12c28c69c3f2dbf1ae9c8336d2d75af14f0bb | /app/src/main/java/com/youqu/piclbs/hot/HotAdapter.java | 988788aff2a04964d581b9445ff3bdc07b6b6936 | [] | no_license | huangjingqiang/jiazqlx | 9d33407829b9844f7167dde2391bc02be0a47e49 | ff29122870bd7d59ec0f9cde9cf8d2812b0c8e87 | refs/heads/master | 2021-04-28T21:44:32.895744 | 2017-01-03T10:53:02 | 2017-01-03T10:53:02 | 77,736,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,794 | java | package com.youqu.piclbs.hot;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.youqu.piclbs.R;
import com.youqu.piclbs.bean.AddressBean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by hjq on 16-12-22.
*/
public class HotAdapter extends RecyclerView.Adapter<HotAdapter.MyViewHolder>{
private Activity activity;
private List<AddressBean.TopLocationBean> items;
private onHotItemClickLinstener hotItemClickLinstener;
private List<Boolean> isClick;
public interface onHotItemClickLinstener{
void ItemClisk(int pos,boolean isex);
}
public HotAdapter(Activity activity,List<AddressBean.TopLocationBean> items){
this.activity = activity;
this.items = items;
isClick = new ArrayList<>();
for (int i=0;i<items.size();i++){
isClick.add(false);
}
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(activity).inflate(R.layout.item_text,parent,false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
holder.address.setText(items.get(position).location);
holder.title.setText(items.get(position).name);
if (isClick.get(position)){
holder.title.setSelected(true);
holder.address.setSelected(true);
}else {
holder.title.setSelected(false);
holder.address.setSelected(false);
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (int i=0;i<items.size();i++){
isClick.set(i,false);
}
isClick.set(position,true);
if (hotItemClickLinstener != null){
hotItemClickLinstener.ItemClisk(position,isClick.get(position));
}
}
});
}
@Override
public int getItemCount() {
return items.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder{
TextView title;
TextView address;
public MyViewHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.item_name);
address = (TextView) itemView.findViewById(R.id.item_address);
}
}
public void setHotItemClickLinstener(onHotItemClickLinstener listener){
this.hotItemClickLinstener = listener;
}
}
| [
"[email protected]"
] | |
bbd0195f7a1cba1ae923888c8b4205d01c2f5dc0 | c9ff4c7d1c23a05b4e5e1e243325d6d004829511 | /aws-java-sdk-applicationinsights/src/main/java/com/amazonaws/services/applicationinsights/model/transform/ObservationMarshaller.java | 9b3556d87c062f724b9416d228454b1d4ae7b962 | [
"Apache-2.0"
] | permissive | Purushotam-Thakur/aws-sdk-java | 3c5789fe0b0dbd25e1ebfdd48dfd71e25a945f62 | ab58baac6370f160b66da96d46afa57ba5bdee06 | refs/heads/master | 2020-07-22T23:27:57.700466 | 2019-09-06T23:28:26 | 2019-09-06T23:28:26 | 207,350,924 | 1 | 0 | Apache-2.0 | 2019-09-09T16:11:46 | 2019-09-09T16:11:45 | null | UTF-8 | Java | false | false | 5,653 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.applicationinsights.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.applicationinsights.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ObservationMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ObservationMarshaller {
private static final MarshallingInfo<String> ID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Id").build();
private static final MarshallingInfo<java.util.Date> STARTTIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("StartTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<java.util.Date> ENDTIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("EndTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<String> SOURCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("SourceType").build();
private static final MarshallingInfo<String> SOURCEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("SourceARN").build();
private static final MarshallingInfo<String> LOGGROUP_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("LogGroup").build();
private static final MarshallingInfo<java.util.Date> LINETIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("LineTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<String> LOGTEXT_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("LogText").build();
private static final MarshallingInfo<String> LOGFILTER_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("LogFilter").build();
private static final MarshallingInfo<String> METRICNAMESPACE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("MetricNamespace").build();
private static final MarshallingInfo<String> METRICNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("MetricName").build();
private static final MarshallingInfo<String> UNIT_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Unit").build();
private static final MarshallingInfo<Double> VALUE_BINDING = MarshallingInfo.builder(MarshallingType.DOUBLE).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Value").build();
private static final ObservationMarshaller instance = new ObservationMarshaller();
public static ObservationMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(Observation observation, ProtocolMarshaller protocolMarshaller) {
if (observation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(observation.getId(), ID_BINDING);
protocolMarshaller.marshall(observation.getStartTime(), STARTTIME_BINDING);
protocolMarshaller.marshall(observation.getEndTime(), ENDTIME_BINDING);
protocolMarshaller.marshall(observation.getSourceType(), SOURCETYPE_BINDING);
protocolMarshaller.marshall(observation.getSourceARN(), SOURCEARN_BINDING);
protocolMarshaller.marshall(observation.getLogGroup(), LOGGROUP_BINDING);
protocolMarshaller.marshall(observation.getLineTime(), LINETIME_BINDING);
protocolMarshaller.marshall(observation.getLogText(), LOGTEXT_BINDING);
protocolMarshaller.marshall(observation.getLogFilter(), LOGFILTER_BINDING);
protocolMarshaller.marshall(observation.getMetricNamespace(), METRICNAMESPACE_BINDING);
protocolMarshaller.marshall(observation.getMetricName(), METRICNAME_BINDING);
protocolMarshaller.marshall(observation.getUnit(), UNIT_BINDING);
protocolMarshaller.marshall(observation.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
8c6b9a6d0a7cd6c065daa374fd60263e9ed9cf06 | 9a412bc0aa853099ab582431d9b01f28dd3e92da | /src/main/java/com/singleandcluster/util/ListRedisUtil.java | ab94ac46876a43f34e880190bcb0b468e0e0f018 | [] | no_license | dsl1888888/common-redis | a11cf50ddacbbcb2d050ee47007735796df12580 | c9b85c35312efd480caebc7b43ce0833bbddf633 | refs/heads/master | 2021-07-08T20:49:05.328859 | 2020-12-23T03:11:50 | 2020-12-23T03:11:50 | 222,342,025 | 0 | 0 | null | 2020-10-13T17:32:13 | 2019-11-18T01:52:51 | Java | UTF-8 | Java | false | false | 8,183 | java | package com.singleandcluster.util;
import java.util.List;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.core.StringRedisTemplate;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class ListRedisUtil
{
private StringRedisTemplate redisTemplate;
/**
* 批量删除对应的value
*
* @param keys
*/
public void remove(String tv, final String... keys)
{
for (String key : keys)
{
remove(tv, key);
}
}
/**
* 删除对应的value
*
* @param key
*/
public void remove(String tv, long i, Object value)
{
ListOperations<String, String> listOper = redisTemplate.opsForList();
listOper.remove(tv, i, value);
}
/*
* 返回模块数量
*/
public Long size(final String tv)
{
long result = 0;
result = redisTemplate.execute(new SessionCallback<Long>()
{
@Override
public Long execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.size(tv);
}
catch (Exception e)
{
e.printStackTrace();
return (long) 0;
}
}
});
return result;
}
/**
* 写入缓存
*
* @param key
* @param value
* @return
*/
public List<Object> getall(final String tv)
{
List<Object> result = redisTemplate.execute(new SessionCallback<List<Object>>()
{
@Override
public List<Object> execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.range(tv, 0, size(tv));
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
/**
* 出队
*
* @param key
* @return
*/
public Object popCache(final String tv)
{
Object result = redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.rightPop(tv);
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
public List<Object> pageCache(final String tv, int page, int rows)
{
List<Object> result = (List<Object>) redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
int start=0;
int end=0;
if (page<0 || rows<0 )
{
//默认 第一页 10条
//1 页
start= (1-1)*10;
end=start-1+10;
}else {
//2 页
start= (page-1)*rows;
end=start-1+rows;
// //1 页
// start= (1-1)*2;
// end=start-1+rows;
//
// //2 页
// start= (2-1)*2;
// end=start-1+rows;
//
// //3 页
// start= (3-1)*2;
// end=start-1+rows;
//
// //4 页
// start= (4-1)*2;
// end=start-1+rows;
}
List<Object> list = listOper.range(tv, start , end);
return list;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
// lrange key start end // 从左边依次返回key的[start,end] 的所有值,注意返回结果包含两端的值。
//
// ltrim key start end //删除指定索引之外的所有元素,注意删除之后保留的元素包含两端的start和end索引值。
/**
* 出队
*
* @param key
* @return
*/
public List<Object> popCacheNumleft(final String tv, int size)
{
List<Object> result = (List<Object>) redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
List<Object> list = listOper.range(tv, size(tv) - size, size(tv));
listOper.trim(tv, size, size(tv));
return list;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
// lrange key start end // 从左边依次返回key的[start,end] 的所有值,注意返回结果包含两端的值。
//
// ltrim key start end //删除指定索引之外的所有元素,注意删除之后保留的元素包含两端的start和end索引值。
/**
* 出队
*
* @param key
* @return
*/
public List<Object> popCacheNumRight(final String tv, int size)
{
List<Object> result = (List<Object>) redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
List<Object> list = listOper.range(tv, 0, size(tv) - size);
listOper.trim(tv, 0, size(tv) - size - 1);
return list;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
/**
* 入队
*
* @param key
* @param value
* @return
*/
public long pushCache(final String tv, final Object ob)
{
long result = 0;
result = redisTemplate.execute(new SessionCallback<Long>()
{
@Override
public Long execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.leftPush(tv, ob);
}
catch (Exception e)
{
e.printStackTrace();
return (long) 0;
}
}
});
return result;
}
public void setRedisTemplate(StringRedisTemplate redisTemplate)
{
this.redisTemplate = redisTemplate;
}
}
| [
"[email protected]"
] | |
b0516fb8bb4353d60fdf2e9078a46a509f3dbe92 | 95bca13063bbdc013c85335c082778822f445298 | /src/test/java/com/tw/codeavengers/tradeawayapi/web/category/CategoryControllerTest.java | 1bba06f73af5513f03b5f6501db5d52151fe7ba6 | [] | no_license | kunalhiray7/trade-away-api | abf5256110cf101166880432d3ad44b29db01671 | b4b9343ceec65c909d6c38ee1e6193f173e2ddc9 | refs/heads/master | 2020-04-01T21:32:17.921651 | 2018-10-18T17:26:19 | 2018-10-18T17:26:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | package com.tw.codeavengers.tradeawayapi.web.category;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.tw.codeavengers.tradeawayapi.model.Category;
import com.tw.codeavengers.tradeawayapi.service.CategoryService;
import org.hamcrest.core.Is;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
//import org.mockito.Mockito;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.*;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(MockitoJUnitRunner.class)
public class CategoryControllerTest {
@Mock
CategoryService categoryService;
@InjectMocks
CategoryController categoryController;
MockMvc mockMvc;
@Before
public void setUp() {
MockitoAnnotations.initMocks(categoryController);
mockMvc = MockMvcBuilders.standaloneSetup(categoryController).build();
}
@Test
public void shouldReturnCategoryResponseContainingCategoriesReturnedByCategoryService() throws Exception {
Category category = new Category();
category.setCategoryName("category");
List<Category> categories = Collections.singletonList(category);
when(categoryService.getAllCategories()).thenReturn(categories);
mockMvc.perform(get("/category")).andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.categories[0].categoryName", is("category")));
verify(categoryService, times(1)).getAllCategories();
}
} | [
"[email protected]"
] | |
ec7a9fc92ab52ab8c226960241e6fe0285dd7ff9 | 25836d343d8ad830b4452c5affe127a869cff882 | /src/test/java/it/uom/cse/MathOperationTest.java | 8d22b787c0ba98a21452e1b5c80b1e52a039c4e3 | [] | no_license | Sathira443/cse-workshop | 9f3584754a640650363f9ef4bcf644cb08abd9f8 | a8f4314e1630ca9c89ff274850837c508704a545 | refs/heads/master | 2023-08-14T08:59:09.080032 | 2021-09-23T05:13:38 | 2021-09-23T05:13:38 | 409,442,988 | 1 | 0 | null | 2021-09-23T04:40:11 | 2021-09-23T04:06:41 | Java | UTF-8 | Java | false | false | 346 | java | package it.uom.cse;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
//This is a comment
class MathOperationTest {
@Test
void add() {
assertEquals(MathOperation.add(1, 1), 2);
}
@Test
void subtract() {
assertEquals(MathOperation.subtract(2, 1), 1);
}
}
| [
"[email protected]"
] | |
5b185c96a502b57262db5d09de602b6bd469fabe | 61d34b919382cbce5e9b8791e4880755904b8cde | /spring_boot/spring_boot-email/src/main/java/com/example/email/service/Impl/EmailServiceImp.java | a2ced2b0c62082738cddf150aea783bf1a8f2aa5 | [] | no_license | taotaozhan/learningDemo | bdf398e91593339c7834c4c7080416c601a1d7c0 | b6eab6de2b6e256b20e191c774aa34c302ae9ad1 | refs/heads/master | 2022-06-27T05:21:52.373524 | 2020-06-29T07:40:17 | 2020-06-29T07:40:17 | 225,545,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package com.example.email.service.Impl;
import com.example.email.entity.Email;
import com.example.email.service.EmailService;
import com.example.email.util.MailUtil;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.mail.internet.MimeMessage;
import java.util.HashMap;
import java.util.Map;
/**
* @author zhangtao
* @data 创建时间
* @version 1.0
*/
@Service
public class EmailServiceImp implements EmailService {
@Autowired
//执行者
private JavaMailSender mailSender;
/**
* freemark
*/
@Autowired
public Configuration configuration;
@Autowired
public SpringTemplateEngine springTemplateEngine;
@Value("${spring.mail.username}")
private String from;
@Override
public void send(Email email) throws Exception {
MailUtil mailUtil = new MailUtil();
SimpleMailMessage mailMessage = new SimpleMailMessage();
//发送人
mailMessage.setFrom(from);
//接收人
mailMessage.setTo(email.getEmail());
//邮件主题
mailMessage.setSubject(email.getSubject());
//邮件内容
mailMessage.setText(email.getContent());
mailUtil.start(mailSender,mailMessage);
}
@Override
public void sendHtml(Email email) throws Exception {
}
@Override
public void sendFreemark(Email mail) throws Exception {
MimeMessage mailMessage = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mailMessage,true);
helper.setFrom(from);
helper.setTo(mail.getEmail());
helper.setSubject(mail.getSubject());
Map<String, Object> model = new HashMap<String, Object>();
model.put("content", mail.getContent());
Template template = configuration.getTemplate(mail.getTemplate()+".flt");
String text = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
helper.setText(text, true);
mailSender.send(mailMessage);
}
@Override
public void sendThymeleaf(Email email) throws Exception {
}
}
| [
"[email protected]"
] | |
3a697cb7700e6809f284eeb76575eabc966eae46 | 25599b5830f6d669336fbfe08bf6244822b24468 | /src/main/java/pl/edu/icm/comac/vis/server/model/Node.java | 5d1cab0d7bfb5f1989e5193fc937f8a672ecda73 | [] | no_license | CeON/comac-navigator-backend | ad7fd8417b4f4c1eedb0158d515db79b24829853 | 4ab1a2518d0c4b66bfae184f38fff8c6cdf26037 | refs/heads/master | 2021-01-10T18:12:45.562628 | 2016-11-04T10:13:36 | 2016-11-04T10:13:36 | 47,757,382 | 1 | 1 | null | 2016-11-04T10:13:37 | 2015-12-10T11:25:02 | Java | UTF-8 | Java | false | false | 1,385 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.comac.vis.server.model;
/**
*
* @author Aleksander Nowinski <[email protected]>
*/
public class Node {
String id;
NodeType type;
String name;
double importance=1.0;
boolean favourite=false;
public Node() {
}
public Node(String id, NodeType type, String name, double importance) {
this.id = id;
this.type = type;
this.name = name;
this.importance = importance;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getImportance() {
return importance;
}
public void setImportance(double importance) {
this.importance = importance;
}
public boolean isFavourite() {
return favourite;
}
public void setFavourite(boolean favourite) {
this.favourite = favourite;
}
public NodeType getType() {
return type;
}
public void setType(NodeType type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
0aca9aea5f0226e93a61d6f4e8aa121b3cde987d | 37749ead9c55b6674070555c8d8d658c6e12ec20 | /SipCommunicator-Fall05/net/java/sip/communicator/sip/CallDispatcher.java | 2fc946aba900c319f157b17a74d3ce790a077194 | [
"Apache-1.1"
] | permissive | azaoui/sip-proxy-communicator | 3e22e0208b3772304d4a44108cdd28ae55017228 | 2de6a1d0181e003d393d3bd66afca3e2874d95e4 | refs/heads/master | 2021-01-10T14:00:47.675004 | 2011-04-07T18:38:22 | 2011-04-07T18:38:22 | 49,427,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,133 | java | /* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [email protected].
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
*/
package net.java.sip.communicator.sip;
import java.util.*;
import javax.sip.*;
import javax.sip.message.*;
import net.java.sip.communicator.common.*;
import net.java.sip.communicator.sip.event.*;
/**
* <p>Title: SIP COMMUNICATOR</p>
* <p>Description:JAIN-SIP Audio/Video phone application</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr) </p>
* <p>Network Research Team (http://www-r2.u-strasbg.fr))</p>
* <p>Louis Pasteur University - Strasbourg - France</p>
* @author Emil Ivov (http://www.emcho.com)
* @version 1.1
*
*/
class CallDispatcher
implements CallListener
{
private static final Console console =
Console.getConsole(CallDispatcher.class);
/**
* All currently active calls.
*/
Hashtable calls = new Hashtable();
Call createCall(Dialog dialog,
Request initialRequest
)
{
try {
console.logEntry();
Call call = null;
if (dialog.getDialogId() != null) {
call = findCall(dialog);
}
if (call == null) {
call = new Call();
}
call.setDialog(dialog);
call.setInitialRequest(initialRequest);
// call.setState(Call.DIALING);
calls.put(new Integer(call.hashCode()), call);
if (console.isDebugEnabled()) {
console.debug("created call" + call);
}
call.addStateChangeListener(this);
return call;
}
finally {
console.logExit();
}
}
Call getCall(int id)
{
return (Call) calls.get(new Integer(id));
}
/**
* Find the call that contains the specified dialog.
* @param dialog the dialog whose containg call is to be found
* @return the call that contains the specified dialog.
*/
Call findCall(Dialog dialog)
{
try {
console.logEntry();
if (dialog == null) {
return null;
}
synchronized (calls) {
Enumeration<Object> enumeration = calls.elements();
while (enumeration.hasMoreElements()) {
Call item = (Call) enumeration.nextElement();
if (item.getDialog().getCallId().equals(dialog.getCallId())) {
return item;
}
}
}
return null;
}
finally {
console.logExit();
}
}
/**
* Find the call with the specified CallID header value.
* @param callID the CallID header value of the searched call.
* @return the call with the specified CallID header value.
*/
Call findCall(String callId)
{
try {
console.logEntry();
if (callId == null) {
return null;
}
synchronized (calls) {
Enumeration<Object> enumeration = calls.elements();
while (enumeration.hasMoreElements()) {
Call item = (Call) enumeration.nextElement();
if (item.getDialog().getCallId().equals(callId)) {
return item;
}
}
}
return null;
}
finally {
console.logExit();
}
}
Object[] getAllCalls()
{
return calls.keySet().toArray();
}
private void removeCall(Call call)
{
try {
console.logEntry();
if (console.isDebugEnabled()) {
console.debug("removing call" + call);
}
calls.remove(new Integer(call.getID()));
}
finally {
console.logExit();
}
}
//================================ DialogListener =================
public void callStateChanged(CallStateEvent evt)
{
if (evt.getNewState().equals(Call.DISCONNECTED))
removeCall(evt.getSourceCall());
}
} | [
"[email protected]"
] | |
e88965ebeb8812931d308b706bc96bf6b42d0ebd | 947fc9eef832e937f09f04f1abd82819cd4f97d3 | /src/apk/e/a/b/E.java | 3842b2795a0e33420ca11e29d547c3fc350260e7 | [] | no_license | thistehneisen/cifra | 04f4ac1b230289f8262a0b9cf7448a1172d8f979 | d46c6f4764c9d4f64e45c56fa42fddee9b44ff5a | refs/heads/master | 2020-09-22T09:35:57.739040 | 2019-12-01T19:39:59 | 2019-12-01T19:39:59 | 225,136,583 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | package e.a.b;
import java.nio.charset.Charset;
/* compiled from: Util */
final class E {
/* renamed from: a reason: collision with root package name */
public static final Charset f7872a = Charset.forName("UTF-8");
public static int a(int i2) {
return ((i2 & 255) << 24) | ((-16777216 & i2) >>> 24) | ((16711680 & i2) >>> 8) | ((65280 & i2) << 8);
}
public static short a(short s) {
short s2 = s & 65535;
return (short) (((s2 & 255) << 8) | ((65280 & s2) >>> 8));
}
public static void a(long j2, long j3, long j4) {
if ((j3 | j4) < 0 || j3 > j2 || j2 - j3 < j4) {
throw new ArrayIndexOutOfBoundsException(String.format("size=%s offset=%s byteCount=%s", new Object[]{Long.valueOf(j2), Long.valueOf(j3), Long.valueOf(j4)}));
}
}
private static <T extends Throwable> void b(Throwable th) throws Throwable {
throw th;
}
public static void a(Throwable th) {
b(th);
throw null;
}
public static boolean a(byte[] bArr, int i2, byte[] bArr2, int i3, int i4) {
for (int i5 = 0; i5 < i4; i5++) {
if (bArr[i5 + i2] != bArr2[i5 + i3]) {
return false;
}
}
return true;
}
}
| [
"[email protected]"
] | |
f14ae67125e078a96992d16c72cc163a592346e8 | c827bfebbde82906e6b14a3f77d8f17830ea35da | /Development3.0/TeevraServer/platform/businessobject/src/main/java/org/fixprotocol/fixml_5_0_sp2/BidDescReqGrpBlockT.java | 9ec4cf85c90bff9dc11a4a775c90c7487421cb05 | [] | no_license | GiovanniPucariello/TeevraCore | 13ccf7995c116267de5c403b962f1dc524ac1af7 | 9d755cc9ca91fb3ebc5b227d9de6bcf98a02c7b7 | refs/heads/master | 2021-05-29T18:12:29.174279 | 2013-04-22T07:44:28 | 2013-04-22T07:44:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,413 | java |
package org.fixprotocol.fixml_5_0_sp2;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for BidDescReqGrp_Block_t complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="BidDescReqGrp_Block_t">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <group ref="{http://www.fixprotocol.org/FIXML-5-0-SP2}BidDescReqGrpElements"/>
* </sequence>
* <attGroup ref="{http://www.fixprotocol.org/FIXML-5-0-SP2}BidDescReqGrpAttributes"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BidDescReqGrp_Block_t")
public class BidDescReqGrpBlockT {
@XmlAttribute(name = "BidDescptrTyp")
protected BigInteger bidDescptrTyp;
@XmlAttribute(name = "BidDescptr")
protected String bidDescptr;
@XmlAttribute(name = "SideValuInd")
protected BigInteger sideValuInd;
@XmlAttribute(name = "LqdtyValu")
protected BigDecimal lqdtyValu;
@XmlAttribute(name = "LqdtyNumSecurities")
protected BigInteger lqdtyNumSecurities;
@XmlAttribute(name = "LqdtyPctLow")
protected BigDecimal lqdtyPctLow;
@XmlAttribute(name = "LqdtyPctHigh")
protected BigDecimal lqdtyPctHigh;
@XmlAttribute(name = "EFPTrkngErr")
protected BigDecimal efpTrkngErr;
@XmlAttribute(name = "FairValu")
protected BigDecimal fairValu;
@XmlAttribute(name = "OutsideNdxPct")
protected BigDecimal outsideNdxPct;
@XmlAttribute(name = "ValuOfFuts")
protected BigDecimal valuOfFuts;
/**
* Gets the value of the bidDescptrTyp property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getBidDescptrTyp() {
return bidDescptrTyp;
}
/**
* Sets the value of the bidDescptrTyp property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setBidDescptrTyp(BigInteger value) {
this.bidDescptrTyp = value;
}
/**
* Gets the value of the bidDescptr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBidDescptr() {
return bidDescptr;
}
/**
* Sets the value of the bidDescptr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBidDescptr(String value) {
this.bidDescptr = value;
}
/**
* Gets the value of the sideValuInd property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSideValuInd() {
return sideValuInd;
}
/**
* Sets the value of the sideValuInd property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSideValuInd(BigInteger value) {
this.sideValuInd = value;
}
/**
* Gets the value of the lqdtyValu property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLqdtyValu() {
return lqdtyValu;
}
/**
* Sets the value of the lqdtyValu property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLqdtyValu(BigDecimal value) {
this.lqdtyValu = value;
}
/**
* Gets the value of the lqdtyNumSecurities property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getLqdtyNumSecurities() {
return lqdtyNumSecurities;
}
/**
* Sets the value of the lqdtyNumSecurities property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setLqdtyNumSecurities(BigInteger value) {
this.lqdtyNumSecurities = value;
}
/**
* Gets the value of the lqdtyPctLow property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLqdtyPctLow() {
return lqdtyPctLow;
}
/**
* Sets the value of the lqdtyPctLow property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLqdtyPctLow(BigDecimal value) {
this.lqdtyPctLow = value;
}
/**
* Gets the value of the lqdtyPctHigh property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLqdtyPctHigh() {
return lqdtyPctHigh;
}
/**
* Sets the value of the lqdtyPctHigh property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLqdtyPctHigh(BigDecimal value) {
this.lqdtyPctHigh = value;
}
/**
* Gets the value of the efpTrkngErr property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getEFPTrkngErr() {
return efpTrkngErr;
}
/**
* Sets the value of the efpTrkngErr property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setEFPTrkngErr(BigDecimal value) {
this.efpTrkngErr = value;
}
/**
* Gets the value of the fairValu property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getFairValu() {
return fairValu;
}
/**
* Sets the value of the fairValu property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setFairValu(BigDecimal value) {
this.fairValu = value;
}
/**
* Gets the value of the outsideNdxPct property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getOutsideNdxPct() {
return outsideNdxPct;
}
/**
* Sets the value of the outsideNdxPct property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setOutsideNdxPct(BigDecimal value) {
this.outsideNdxPct = value;
}
/**
* Gets the value of the valuOfFuts property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getValuOfFuts() {
return valuOfFuts;
}
/**
* Sets the value of the valuOfFuts property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setValuOfFuts(BigDecimal value) {
this.valuOfFuts = value;
}
}
| [
"[email protected]"
] | |
a6a37e630074e999bd30f61f8ebf6dcb2ca26034 | 3a1c71927bb1c3c779199e0a3877ffef55118e28 | /src/创建型_单例模式/Singleton1.java | 0e3c3fcad8cd947f860bcf82f93eb9bc543d4896 | [] | no_license | Moujianming/DesignPattern | 7d4ade682f348a88bbc5926227e0d002b7d49518 | 85e32c3a3c4b23998ab5e2d36b7ac4ea3b3a4c32 | refs/heads/master | 2020-03-11T23:46:21.986041 | 2018-04-23T07:33:57 | 2018-04-23T07:33:57 | 130,331,348 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 555 | java | package 创建型_单例模式;
public class Singleton1 {
/* 持有私有静态实例,防止被引用,此处赋值为null,目的是实现延迟加载 */
private static Singleton1 single = null;
/* 私有构造方法,防止被实例化 */
private Singleton1() {};
/* 静态工程方法,创建实例 */
public static Singleton1 getinstance()
{
if(null==single)
{
return new Singleton1();
}
return single;
}
/*序列化前后要保持一致*/
public Object solve()
{
return single;
}
}
| [
"[email protected]"
] | |
ca474693a37982ea918bb4bc68b114e9d9f39924 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/plugin/game/luggage/p429b/C34286d.java | 313ad3c3c08084a66308aa787ec4d27d79ea5fc7 | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,437 | java | package com.tencent.p177mm.plugin.game.luggage.p429b;
import android.content.Context;
import com.tencent.luggage.p146d.C37393a.C32183a;
import com.tencent.luggage.p147g.C32192i;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.plugin.game.luggage.p432d.C12140e;
import com.tencent.p177mm.plugin.webview.luggage.jsapi.C22840bc.C22841a;
import com.tencent.p177mm.plugin.webview.luggage.jsapi.C46419bd;
import com.tencent.p177mm.plugin.webview.p768b.C35582b;
import com.tencent.p177mm.sdk.platformtools.C4990ab;
import com.tencent.p177mm.sdk.platformtools.C5046bo;
import org.json.JSONArray;
import org.json.JSONObject;
/* renamed from: com.tencent.mm.plugin.game.luggage.b.d */
public class C34286d extends C46419bd<C12140e> {
public final String name() {
return "clearGameData";
}
public final int biG() {
return 1;
}
/* renamed from: b */
public final void mo9618b(C32183a c32183a) {
}
/* renamed from: a */
public final void mo9617a(Context context, String str, C22841a c22841a) {
AppMethodBeat.m2504i(135869);
C4990ab.m7416i("MicroMsg.JsApiClearGameData", "invokeInMM");
JSONObject bQ = C32192i.m52508bQ(str);
if (bQ == null) {
C4990ab.m7412e("MicroMsg.JsApiClearGameData", "data is null");
c22841a.mo26722d("null_data", null);
AppMethodBeat.m2505o(135869);
return;
}
String optString = bQ.optString("preVerifyAppId");
if (C5046bo.isNullOrNil(optString)) {
C4990ab.m7416i("MicroMsg.JsApiClearGameData", "appId is null");
c22841a.mo26722d("appid_null", null);
AppMethodBeat.m2505o(135869);
return;
}
JSONArray optJSONArray = bQ.optJSONArray("keys");
boolean optBoolean = bQ.optBoolean("clearAllData", false);
if (optJSONArray != null && optJSONArray.length() > 0) {
C35582b.cWi().mo56313b(optString, optJSONArray);
c22841a.mo26722d(null, null);
AppMethodBeat.m2505o(135869);
} else if (optBoolean) {
C35582b.cWi().adY(optString);
c22841a.mo26722d(null, null);
AppMethodBeat.m2505o(135869);
} else {
C4990ab.m7416i("MicroMsg.JsApiClearGameData", "keys is null");
c22841a.mo26722d("fail", null);
AppMethodBeat.m2505o(135869);
}
}
}
| [
"[email protected]"
] | |
b43fef39e70a47e2401297ad5a086e3991fb6936 | 65e1eeaabac6009e8be0a5adb36ac6a999d348c8 | /ofdrw-reader/src/main/java/org/ofdrw/reader/tools/NameSpaceCleaner.java | 633dd52f7a8dbe29bf3ac23e02b439edbaadfe96 | [
"Apache-2.0"
] | permissive | cpacm/ofdrw | 92e67ae5c5968e8d6a16b5b6042525c2646b1f0f | 157f48ec00faa6d3b22d4c0f5aa83ae58d3d44f0 | refs/heads/master | 2022-08-29T08:44:30.574990 | 2022-07-20T12:14:51 | 2022-07-20T12:14:51 | 253,667,094 | 1 | 1 | MIT | 2020-04-07T02:30:04 | 2020-04-07T02:30:04 | null | UTF-8 | Java | false | false | 1,024 | java | package org.ofdrw.reader.tools;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.VisitorSupport;
import org.dom4j.tree.DefaultElement;
/**
* 命名空间清理类
* <p>
* 用于清理已经存在的命名空间
*
* @author libra19911018
* @since 2020-10-15 19:38:15
*/
public class NameSpaceCleaner extends VisitorSupport {
public void visit(Document document) {
((DefaultElement) document.getRootElement()).setNamespace(Namespace.NO_NAMESPACE);
document.getRootElement().additionalNamespaces().clear();
}
public void visit(Namespace namespace) {
namespace.detach();
}
// public void visit(Attribute node) {
// if (node.toString().contains("xmlns") || node.toString().contains("ofd:")) {
// node.detach();
// }
// }
public void visit(Element node) {
if (node instanceof DefaultElement) {
((DefaultElement) node).setNamespace(Namespace.NO_NAMESPACE);
}
}
}
| [
"005006007"
] | 005006007 |
742ff2a508b566cca481a291fc225a9e4ae8f517 | e08682a48609402c31d059215cfb62adb32c993b | /core/src/main/java/com/gaoding/datay/core/container/util/JobAssignUtil.java | 6dbcc95c903c921a7984bbd76af6883593f3014e | [] | no_license | ywq20011/DataY | 96b1af92bf98899efc303dc2d21a94ef9fdb643a | 60310a86f69c13a21dcacc16e294486fd79b79b4 | refs/heads/main | 2023-03-15T17:58:53.379236 | 2021-03-08T09:57:09 | 2021-03-08T09:57:09 | 345,607,997 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,669 | java | package com.gaoding.datay.core.container.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import com.gaoding.datay.common.constant.CommonConstant;
import com.gaoding.datay.common.util.Configuration;
import com.gaoding.datay.core.util.container.CoreConstant;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.StringUtils;
public final class JobAssignUtil {
private JobAssignUtil() {
}
/**
* 公平的分配 task 到对应的 taskGroup 中。
* 公平体现在:会考虑 task 中对资源负载作的 load 标识进行更均衡的作业分配操作。
* TODO 具体文档举例说明
*/
public static List<Configuration> assignFairly(Configuration configuration, int channelNumber, int channelsPerTaskGroup) {
Validate.isTrue(configuration != null, "框架获得的 Job 不能为 null.");
List<Configuration> contentConfig = configuration.getListConfiguration(CoreConstant.DATAX_JOB_CONTENT);
Validate.isTrue(contentConfig.size() > 0, "框架获得的切分后的 Job 无内容.");
Validate.isTrue(channelNumber > 0 && channelsPerTaskGroup > 0,
"每个channel的平均task数[averTaskPerChannel],channel数目[channelNumber],每个taskGroup的平均channel数[channelsPerTaskGroup]都应该为正数");
int taskGroupNumber = (int) Math.ceil(1.0 * channelNumber / channelsPerTaskGroup);
Configuration aTaskConfig = contentConfig.get(0);
String readerResourceMark = aTaskConfig.getString(CoreConstant.JOB_READER_PARAMETER + "." +
CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
String writerResourceMark = aTaskConfig.getString(CoreConstant.JOB_WRITER_PARAMETER + "." +
CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
boolean hasLoadBalanceResourceMark = StringUtils.isNotBlank(readerResourceMark) ||
StringUtils.isNotBlank(writerResourceMark);
if (!hasLoadBalanceResourceMark) {
// fake 一个固定的 key 作为资源标识(在 reader 或者 writer 上均可,此处选择在 reader 上进行 fake)
for (Configuration conf : contentConfig) {
conf.set(CoreConstant.JOB_READER_PARAMETER + "." +
CommonConstant.LOAD_BALANCE_RESOURCE_MARK, "aFakeResourceMarkForLoadBalance");
}
// 是为了避免某些插件没有设置 资源标识 而进行了一次随机打乱操作
Collections.shuffle(contentConfig, new Random(System.currentTimeMillis()));
}
LinkedHashMap<String, List<Integer>> resourceMarkAndTaskIdMap = parseAndGetResourceMarkAndTaskIdMap(contentConfig);
List<Configuration> taskGroupConfig = doAssign(resourceMarkAndTaskIdMap, configuration, taskGroupNumber);
// 调整 每个 taskGroup 对应的 Channel 个数(属于优化范畴)
adjustChannelNumPerTaskGroup(taskGroupConfig, channelNumber);
return taskGroupConfig;
}
private static void adjustChannelNumPerTaskGroup(List<Configuration> taskGroupConfig, int channelNumber) {
int taskGroupNumber = taskGroupConfig.size();
int avgChannelsPerTaskGroup = channelNumber / taskGroupNumber;
int remainderChannelCount = channelNumber % taskGroupNumber;
// 表示有 remainderChannelCount 个 taskGroup,其对应 Channel 个数应该为:avgChannelsPerTaskGroup + 1;
// (taskGroupNumber - remainderChannelCount)个 taskGroup,其对应 Channel 个数应该为:avgChannelsPerTaskGroup
int i = 0;
for (; i < remainderChannelCount; i++) {
taskGroupConfig.get(i).set(CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_CHANNEL, avgChannelsPerTaskGroup + 1);
}
for (int j = 0; j < taskGroupNumber - remainderChannelCount; j++) {
taskGroupConfig.get(i + j).set(CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_CHANNEL, avgChannelsPerTaskGroup);
}
}
/**
* 根据task 配置,获取到:
* 资源名称 --> taskId(List) 的 map 映射关系
*/
private static LinkedHashMap<String, List<Integer>> parseAndGetResourceMarkAndTaskIdMap(List<Configuration> contentConfig) {
// key: resourceMark, value: taskId
LinkedHashMap<String, List<Integer>> readerResourceMarkAndTaskIdMap = new LinkedHashMap<String, List<Integer>>();
LinkedHashMap<String, List<Integer>> writerResourceMarkAndTaskIdMap = new LinkedHashMap<String, List<Integer>>();
for (Configuration aTaskConfig : contentConfig) {
int taskId = aTaskConfig.getInt(CoreConstant.TASK_ID);
// 把 readerResourceMark 加到 readerResourceMarkAndTaskIdMap 中
String readerResourceMark = aTaskConfig.getString(CoreConstant.JOB_READER_PARAMETER + "." + CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
if (readerResourceMarkAndTaskIdMap.get(readerResourceMark) == null) {
readerResourceMarkAndTaskIdMap.put(readerResourceMark, new LinkedList<Integer>());
}
readerResourceMarkAndTaskIdMap.get(readerResourceMark).add(taskId);
// 把 writerResourceMark 加到 writerResourceMarkAndTaskIdMap 中
String writerResourceMark = aTaskConfig.getString(CoreConstant.JOB_WRITER_PARAMETER + "." + CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
if (writerResourceMarkAndTaskIdMap.get(writerResourceMark) == null) {
writerResourceMarkAndTaskIdMap.put(writerResourceMark, new LinkedList<Integer>());
}
writerResourceMarkAndTaskIdMap.get(writerResourceMark).add(taskId);
}
if (readerResourceMarkAndTaskIdMap.size() >= writerResourceMarkAndTaskIdMap.size()) {
// 采用 reader 对资源做的标记进行 shuffle
return readerResourceMarkAndTaskIdMap;
} else {
// 采用 writer 对资源做的标记进行 shuffle
return writerResourceMarkAndTaskIdMap;
}
}
/**
* /**
* 需要实现的效果通过例子来说是:
* <pre>
* a 库上有表:0, 1, 2
* a 库上有表:3, 4
* c 库上有表:5, 6, 7
*
* 如果有 4个 taskGroup
* 则 assign 后的结果为:
* taskGroup-0: 0, 4,
* taskGroup-1: 3, 6,
* taskGroup-2: 5, 2,
* taskGroup-3: 1, 7
*
* </pre>
*/
private static List<Configuration> doAssign(LinkedHashMap<String, List<Integer>> resourceMarkAndTaskIdMap, Configuration jobConfiguration, int taskGroupNumber) {
List<Configuration> contentConfig = jobConfiguration.getListConfiguration(CoreConstant.DATAX_JOB_CONTENT);
Configuration taskGroupTemplate = jobConfiguration.clone();
taskGroupTemplate.remove(CoreConstant.DATAX_JOB_CONTENT);
List<Configuration> result = new LinkedList<Configuration>();
List<List<Configuration>> taskGroupConfigList = new ArrayList<List<Configuration>>(taskGroupNumber);
for (int i = 0; i < taskGroupNumber; i++) {
taskGroupConfigList.add(new LinkedList<Configuration>());
}
int mapValueMaxLength = -1;
List<String> resourceMarks = new ArrayList<String>();
for (Map.Entry<String, List<Integer>> entry : resourceMarkAndTaskIdMap.entrySet()) {
resourceMarks.add(entry.getKey());
if (entry.getValue().size() > mapValueMaxLength) {
mapValueMaxLength = entry.getValue().size();
}
}
int taskGroupIndex = 0;
for (int i = 0; i < mapValueMaxLength; i++) {
for (String resourceMark : resourceMarks) {
if (resourceMarkAndTaskIdMap.get(resourceMark).size() > 0) {
int taskId = resourceMarkAndTaskIdMap.get(resourceMark).get(0);
taskGroupConfigList.get(taskGroupIndex % taskGroupNumber).add(contentConfig.get(taskId));
taskGroupIndex++;
resourceMarkAndTaskIdMap.get(resourceMark).remove(0);
}
}
}
Configuration tempTaskGroupConfig;
for (int i = 0; i < taskGroupNumber; i++) {
tempTaskGroupConfig = taskGroupTemplate.clone();
tempTaskGroupConfig.set(CoreConstant.DATAX_JOB_CONTENT, taskGroupConfigList.get(i));
tempTaskGroupConfig.set(CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_ID, i);
result.add(tempTaskGroupConfig);
}
return result;
}
}
| [
"[email protected]"
] | |
6d8e0f8c9f1a52e0cd9a6005962d5296e25e30f7 | 9686591e4b297f882f372d446f60eb2a8ecdc3b7 | /src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/index/entry/data/IndexEntryFixtures.java | a7e91361c1d00f878a01a7f78a6fc5404ac8008d | [
"MIT"
] | permissive | rpatil524/FAIRDataPoint | d496091072cd7a4aecfba57b9313d22140c9732f | a55fcf528853ee6a0b88a21d59d95f7e49781a67 | refs/heads/master | 2023-08-31T19:45:02.107983 | 2022-04-04T06:50:27 | 2022-04-04T06:50:27 | 184,922,667 | 0 | 0 | MIT | 2023-06-09T18:52:29 | 2019-05-04T17:04:22 | Java | UTF-8 | Java | false | false | 4,502 | java | /**
* The MIT License
* Copyright © 2017 DTL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package nl.dtls.fairdatapoint.database.mongo.migration.development.index.entry.data;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntry;
import nl.dtls.fairdatapoint.entity.index.entry.RepositoryMetadata;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.HashMap;
import static nl.dtls.fairdatapoint.entity.index.entry.IndexEntryState.*;
@Service
public class IndexEntryFixtures {
public IndexEntry entryActive() {
String clientUri = "https://example.com/my-valid-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("8987abc1-15a4-4752-903c-8f8a5882cca6", clientUri, Valid, Instant.now(), Instant.now(),
Instant.now(), repositoryData);
}
public IndexEntry entryActive2() {
String clientUri = "https://app.fairdatapoint.org";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
Instant date = Instant.parse("2020-05-30T23:38:23.085Z");
return new IndexEntry("c912331f-4a77-4300-a469-dbaf5fc0b4e2", clientUri, Valid, date, date, date,
repositoryData);
}
public IndexEntry entryInactive() {
String clientUri = "https://example.com/my-valid-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
Instant date = Instant.parse("2020-05-30T23:38:23.085Z");
return new IndexEntry("b5851ebe-aacf-4de9-bf0a-3686e9256e73", clientUri, Valid, date, date, date,
repositoryData);
}
public IndexEntry entryUnreachable() {
String clientUri = "https://example.com/my-unreachable-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("dae46b47-87fb-4fdf-995c-8aa3739a27fc", clientUri, Unreachable, Instant.now(),
Instant.now(), Instant.now(), repositoryData);
}
public IndexEntry entryInvalid() {
String clientUri = "https://example.com/my-invalid-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("b37e8c1f-ac0e-49f8-8e07-35571c4f8235", clientUri, Invalid, Instant.now(),
Instant.now(), Instant.now(), repositoryData);
}
public IndexEntry entryUnknown() {
String clientUri = "https://example.com/my-unknown-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("4471d7c5-8c5b-4581-a9bc-d175456492c4", clientUri, Unknown, Instant.now(),
Instant.now(), Instant.now(), repositoryData);
}
}
| [
"[email protected]"
] | |
20442e2a89974984fbb02779202df968a4b7f0e4 | 4d0e0eda0a33a520a95920e0600a4b47d51435b7 | /router-api/src/main/java/com/dovar/router_api/multiprocess/MultiRouterResponse.java | 1a44f0632a37874c76afe9047ab8d0bdff6c972b | [
"MIT"
] | permissive | huangbqsky/DRouter | 83e2872fb1bd3a10cc3fde113970a9501fb94d12 | f68606d729c86c46bfa434259d988d1c271a7fa1 | refs/heads/master | 2022-11-27T20:07:44.799420 | 2020-07-20T15:11:12 | 2020-07-20T15:11:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,511 | java | package com.dovar.router_api.multiprocess;
import android.os.Parcel;
import android.os.Parcelable;
/**
* auther by heweizong on 2018/8/21
* description:
*/
public class MultiRouterResponse implements Parcelable {
private String mMessage = "";
private Parcelable mData;
public String getMessage() {
return mMessage;
}
public MultiRouterResponse setMessage(String mMessage) {
this.mMessage = mMessage;
return this;
}
public Parcelable getData() {
return mData;
}
public MultiRouterResponse setData(Parcelable mParcelable) {
this.mData = mParcelable;
return this;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.mMessage);
dest.writeParcelable(this.mData, flags);
}
public MultiRouterResponse() {
}
protected MultiRouterResponse(Parcel in) {
this.mMessage = in.readString();
this.mData = in.readParcelable(Parcelable.class.getClassLoader());
}
public static final Creator<MultiRouterResponse> CREATOR = new Creator<MultiRouterResponse>() {
@Override
public MultiRouterResponse createFromParcel(Parcel source) {
return new MultiRouterResponse(source);
}
@Override
public MultiRouterResponse[] newArray(int size) {
return new MultiRouterResponse[size];
}
};
}
| [
"[email protected]"
] | |
e0bcfb0815d67dd72671ebbfd4387671a7a9f217 | c45dc278f9325d983d4eeb70a2f1e49fbb472d57 | /FragTransaction/app/src/main/java/com/example/rahul/fragtransaction/FragmentA.java | c22646cd6d36fe22d4e91578036675bd3e8a26e0 | [] | no_license | rahuldas11694/android | 58e90b7f55c89f05a288cd5106cf63b40fddd191 | 0d0e88064ee133b85a29b6cf432a72425f6fcd2b | refs/heads/master | 2020-05-23T05:05:12.180707 | 2017-03-28T12:13:31 | 2017-03-28T12:13:31 | 84,751,140 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,281 | java | package com.example.rahul.fragtransaction;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by rahul on 23/03/17.
*/
public class FragmentA extends Fragment {
@Override
public void onAttach(Context context) {
Log.d("rahul","FragmentA onAttach");
super.onAttach(context);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("rahul","Fragment on create");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_a,container,false);
Log.d("rahul","Fragment oncreateview");
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.d("rahul","OnActivity created");
}
@Override
public void onPause() {
super.onPause();
Log.d("rahul","Fragment a onpause");
}
@Override
public void onStop() {
super.onStop();
Log.d("rahul","Fragment a onStop");
}
@Override
public void onResume() {
super.onResume();
Log.d("rahul","FragmentA onResume");
}
@Override
public void onStart() {
super.onStart();
Log.d("rahul","Fragment a onStart");
}
@Override
public void onDestroyView() {
super.onDestroy();
Log.d("rahul","Fragment a onDestroyView");
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d("rahul","Fragment a onDestroy");
}
@Override
public void onDetach() {
super.onDetach();
Log.d("rahul","Fragment a onDetach");
}
}
/*
sequence:
D/rahul: Fragment on create
D/rahul: Fragment oncreateview
D/rahul: OnActivity created
D/rahul: Fragment a onStart
D/rahul: FragmentA onResume
D/rahul: Fragment a onpause
D/rahul: Fragment a onStop
D/rahul: Fragment a onStart
D/rahul: FragmentA onResume
*/ | [
"[email protected]"
] | |
6d6780ab17bce676421ce2dcb1f16ad36e3e6abf | b07f03d1a7b92ab0132e3f59e5a016cee7128806 | /Visitor/src/co/edu/logica/visitor/VisitorEdad.java | e99f302e1c5c63323d6548f68e58fa6f2a8fc745 | [] | no_license | estefaniag08/proyectoModeloTeatro | 88197596ae2a637f536cc60f63870879b858881e | b9790990f7a6710f5a913bb7d26772d9e0b21561 | refs/heads/master | 2021-03-27T20:54:14.656472 | 2017-11-22T00:12:59 | 2017-11-22T00:12:59 | 110,854,839 | 0 | 0 | null | 2017-11-22T00:13:00 | 2017-11-15T15:58:44 | Java | UTF-8 | Java | false | false | 570 | java | package co.edu.logica.visitor;
import co.edu.logica.boleta.*;
public class VisitorEdad implements Visitor{
public void visitarBoletaCine(BoletaCine boleta) {
double precioFinal=boleta.getPrecioBoleta()-1000;
boleta.setPrecioBoleta(precioFinal);
}
public void visitarBoletaTeatro(BoletaTeatro boleta) {
double precioFinal=boleta.getPrecioBoleta()-1500;
boleta.setPrecioBoleta(precioFinal);
}
//Metodo vacio ya que esta promocion no aplica en los eventos de musica
public void visitarBoletaMusica(BoletaMusica boleta) {
}
}
| [
"[email protected]"
] | |
afe87ae7c535f21913a103b4e7f76f5188631011 | 0b06fed24042da28b3ebbdd9ad21810598515765 | /src/obj/Seito.java | e088d39933cb2a1f425f0115773bf13eb8880beb | [] | no_license | t-you96/lesson | 754e989a02e85bd11af29e1858c782c2e990b82e | 56794326d20cabab23c329ba442335945996615d | refs/heads/master | 2022-06-25T19:16:26.832936 | 2020-05-12T04:45:56 | 2020-05-12T04:45:56 | 257,788,412 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package obj;
public class Seito {
String name;
int kokugo;
int math;
int society;
public Seito(String name,int kokugo,int math,int society) {
this.name = name;
this.kokugo = kokugo;
this.math = math;
this.society = society;
}
public void show() {
System.out.print(name + " 国語" + kokugo + "点 数学" + math + "点 社会" + society + "点" );
}
public int goukei() {
int g = kokugo + math + society;
return g;
}
public double heikin() {
double h = (kokugo + math + society) / 3.0;
return h;
}
}
| [
"[email protected]"
] | |
4de334e6cd59e6e73ee845a72789cf9e17185b27 | eab8d595315fdedc308ef9046888e27f2dc8f7bf | /app/src/androidTest/java/com/dl/dlslidebanner/ApplicationTest.java | d5d88173502c20117d019397b3f42de89bed0a7b | [
"Apache-2.0"
] | permissive | DHASA2017/slidebanner | 9df8ce9307500b80ceb600c2172696e8fc6a1348 | cb636aa04516fe95d26a8c70dee9b11f0d3bdf17 | refs/heads/master | 2021-01-25T06:56:18.307348 | 2017-06-08T07:10:28 | 2017-06-08T07:10:28 | 93,629,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.dl.dlslidebanner;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
c6b600bf3229c579ee823eb7dd13f39240a1e0fe | 4e52ba30ac377ba404bc4cffbd94add2e5edf0e6 | /bookkeeper-common/src/test/java/org/apache/bookkeeper/common/conf/ConfigDefTest.java | 7ba3e71ccaef66e0c102ea27c35ee10ebe2ceabf | [
"Apache-2.0"
] | permissive | apache/bookkeeper | 0bf2bdb66c1e8e18654ba72775fdf0914c01517a | 1666d820a3d98ee6702e39c7cb0ebe51b1fdfd32 | refs/heads/master | 2023-09-01T17:43:09.657566 | 2023-09-01T05:20:10 | 2023-09-01T05:20:10 | 1,575,956 | 1,825 | 1,123 | Apache-2.0 | 2023-09-13T04:18:18 | 2011-04-06T07:00:07 | Java | UTF-8 | Java | false | false | 11,293 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bookkeeper.common.conf;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.common.conf.validators.ClassValidator;
import org.apache.bookkeeper.common.conf.validators.RangeValidator;
import org.junit.Test;
/**
* Unit test {@link ConfigDef}.
*/
@Slf4j
public class ConfigDefTest {
private static class TestConfig {
private static final ConfigKeyGroup group1 = ConfigKeyGroup.builder("group1")
.description("Group 1 Settings")
.order(1)
.build();
private static final ConfigKey key11 = ConfigKey.builder("key11")
.type(Type.LONG)
.group(group1)
.validator(RangeValidator.atLeast(1000))
.build();
private static final ConfigKeyGroup group2 = ConfigKeyGroup.builder("group2")
.description("Group 2 Settings")
.order(2)
.build();
private static final ConfigKey key21 = ConfigKey.builder("key21")
.type(Type.LONG)
.group(group2)
.validator(RangeValidator.atMost(1000))
.orderInGroup(2)
.build();
private static final ConfigKey key22 = ConfigKey.builder("key22")
.type(Type.STRING)
.group(group2)
.validator(ClassValidator.of(Runnable.class))
.orderInGroup(1)
.build();
}
private static class TestConfig2 {
private static final ConfigKeyGroup emptyGroup = ConfigKeyGroup.builder("empty_group")
.description("Empty Group Settings")
.order(1)
.build();
private static final ConfigKeyGroup group1 = ConfigKeyGroup.builder("group1")
.description("This is a very long description : Lorem ipsum dolor sit amet,"
+ " consectetur adipiscing elit. Maecenas bibendum ac felis id commodo."
+ " Etiam mauris purus, fringilla id tempus in, mollis vel orci. Duis"
+ " ultricies at erat eget iaculis.")
.order(2)
.build();
private static final ConfigKey intKey = ConfigKey.builder("int_key")
.type(Type.INT)
.description("it is an int key")
.group(group1)
.validator(RangeValidator.atLeast(1000))
.build();
private static final ConfigKey longKey = ConfigKey.builder("long_key")
.type(Type.LONG)
.description("it is a long key")
.group(group1)
.validator(RangeValidator.atMost(1000))
.build();
private static final ConfigKey shortKey = ConfigKey.builder("short_key")
.type(Type.SHORT)
.description("it is a short key")
.group(group1)
.validator(RangeValidator.between(500, 1000))
.build();
private static final ConfigKey doubleKey = ConfigKey.builder("double_key")
.type(Type.DOUBLE)
.description("it is a double key")
.group(group1)
.validator(RangeValidator.between(1234.0f, 5678.0f))
.build();
private static final ConfigKey boolKey = ConfigKey.builder("bool_key")
.type(Type.BOOLEAN)
.description("it is a bool key")
.group(group1)
.build();
private static final ConfigKey classKey = ConfigKey.builder("class_key")
.type(Type.CLASS)
.description("it is a class key")
.validator(ClassValidator.of(Runnable.class))
.group(group1)
.build();
private static final ConfigKey listKey = ConfigKey.builder("list_key")
.type(Type.LIST)
.description("it is a list key")
.group(group1)
.build();
private static final ConfigKey stringKey = ConfigKey.builder("string_key")
.type(Type.STRING)
.description("it is a string key")
.group(group1)
.build();
private static final ConfigKeyGroup group2 = ConfigKeyGroup.builder("group2")
.description("This group has short description")
.order(3)
.build();
private static final ConfigKey keyWithSince = ConfigKey.builder("key_with_since")
.type(Type.STRING)
.description("it is a string key with since")
.since("4.7.0")
.group(group2)
.orderInGroup(10)
.build();
private static final ConfigKey keyWithDocumentation = ConfigKey.builder("key_with_short_documentation")
.type(Type.STRING)
.description("it is a string key with documentation")
.documentation("it has a short documentation")
.group(group2)
.orderInGroup(9)
.build();
private static final ConfigKey keyWithLongDocumentation =
ConfigKey.builder("key_long_short_documentation")
.type(Type.STRING)
.description("it is a string key with documentation")
.documentation("it has a long documentation : Lorem ipsum dolor sit amet,"
+ " consectetur adipiscing elit. Maecenas bibendum ac felis id commodo."
+ " Etiam mauris purus, fringilla id tempus in, mollis vel orci. Duis"
+ " ultricies at erat eget iaculis.")
.group(group2)
.orderInGroup(8)
.build();
private static final ConfigKey keyWithDefaultValue = ConfigKey.builder("key_with_default_value")
.type(Type.STRING)
.description("it is a string key with default value")
.defaultValue("this-is-a-test-value")
.group(group2)
.orderInGroup(7)
.build();
private static final ConfigKey keyWithOptionalValues = ConfigKey.builder("key_with_optional_values")
.type(Type.STRING)
.description("it is a string key with optional values")
.defaultValue("this-is-a-default-value")
.optionValues(Lists.newArrayList(
"item1", "item2", "item3", "item3"
))
.group(group2)
.orderInGroup(6)
.build();
private static final ConfigKey deprecatedKey = ConfigKey.builder("deprecated_key")
.type(Type.STRING)
.deprecated(true)
.description("it is a deprecated key")
.group(group2)
.orderInGroup(5)
.build();
private static final ConfigKey deprecatedKeyWithSince = ConfigKey.builder("deprecated_key_with_since")
.type(Type.STRING)
.deprecated(true)
.deprecatedSince("4.3.0")
.description("it is a deprecated key with since")
.group(group2)
.orderInGroup(4)
.build();
private static final ConfigKey deprecatedKeyWithReplacedKey =
ConfigKey.builder("deprecated_key_with_replaced_key")
.type(Type.STRING)
.deprecated(true)
.deprecatedByConfigKey("key_with_optional_values")
.description("it is a deprecated key with replaced key")
.group(group2)
.orderInGroup(3)
.build();
private static final ConfigKey deprecatedKeyWithSinceAndReplacedKey =
ConfigKey.builder("deprecated_key_with_since_and_replaced_key")
.type(Type.STRING)
.deprecated(true)
.deprecatedSince("4.3.0")
.deprecatedByConfigKey("key_with_optional_values")
.description("it is a deprecated key with since and replaced key")
.group(group2)
.orderInGroup(2)
.build();
private static final ConfigKey requiredKey = ConfigKey.builder("required_key")
.type(Type.STRING)
.required(true)
.description("it is a required key")
.group(group2)
.orderInGroup(1)
.build();
}
@Test
public void testBuildConfigDef() {
ConfigDef configDef = ConfigDef.of(TestConfig.class);
assertEquals(2, configDef.getGroups().size());
Iterator<ConfigKeyGroup> grpIter = configDef.getGroups().iterator();
// iterate over group 1
assertTrue(grpIter.hasNext());
ConfigKeyGroup group1 = grpIter.next();
assertSame(TestConfig.group1, group1);
Set<ConfigKey> keys = configDef.getSettings().get(group1.name());
assertNotNull(keys);
assertEquals(1, keys.size());
assertEquals(TestConfig.key11, keys.iterator().next());
// iterate over group 2
assertTrue(grpIter.hasNext());
ConfigKeyGroup group2 = grpIter.next();
assertSame(TestConfig.group2, group2);
keys = configDef.getSettings().get(group2.name());
assertNotNull(keys);
assertEquals(2, keys.size());
Iterator<ConfigKey> keyIter = keys.iterator();
assertEquals(TestConfig.key22, keyIter.next());
assertEquals(TestConfig.key21, keyIter.next());
assertFalse(keyIter.hasNext());
// no more group
assertFalse(grpIter.hasNext());
}
@Test
public void testSaveConfigDef() throws IOException {
byte[] confData;
try (InputStream is = this.getClass().getClassLoader().getResourceAsStream("test_conf_2.conf")) {
confData = new byte[is.available()];
ByteStreams.readFully(is, confData);
}
ConfigDef configDef = ConfigDef.of(TestConfig2.class);
String readConf;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
configDef.save(baos);
readConf = baos.toString();
log.info("\n{}", readConf);
}
assertEquals(new String(confData, UTF_8), readConf);
}
}
| [
"[email protected]"
] | |
9d66a03f2295baf3ee875997a56641c114ccc567 | 8a2df01eabf4625a84b66b77a9d48ddd004066c9 | /meinian_parent/meinian_interface/src/main/java/com/atguigu/service/TravelGroupService.java | e224f9ef878ce9350305bf2ce38ff0a98064c7ee | [] | no_license | zhangsanatguigu/meinian2020 | 2080e14ca14e4471f980d71b00d73b04b446d6c4 | 7530596e504447623d935d2cf484f81db420434f | refs/heads/master | 2023-02-03T09:21:36.523954 | 2020-12-22T03:37:04 | 2020-12-22T03:37:04 | 311,566,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package com.atguigu.service;
import com.atguigu.entity.PageResult;
import com.atguigu.pojo.TravelGroup;
import java.util.List;
public interface TravelGroupService {
void add(TravelGroup travelGroup, Integer[] travelItemIds);
PageResult findPage(Integer currentPage, Integer pageSize, String queryString);
TravelGroup findById(Integer id);
List<Integer> findTravelItemIdByTravelgroupId(Integer id);
void edit(TravelGroup travelGroup, Integer[] travelItemIds);
List<TravelGroup> findAll();
}
| [
"[email protected]"
] | |
0157da5445708b17db722fd91f04ca6f4cf42e84 | 82c44f4ec47692d4621c191a4a57cdf25d90a881 | /app/src/main/java/com/basicflags/ui/activities/base/BaseRxActivity.java | 8ce58a32b1b89ed9c13619c6823a0281b96e4b32 | [] | no_license | Kolyall/BasicFlags | d25a855af557d98514a19f043c74993a951feb7d | bb7bf50ead79fb49309c55015e6d51906142f974 | refs/heads/master | 2021-01-21T11:16:05.161594 | 2017-03-01T10:55:00 | 2017-03-01T10:55:00 | 83,543,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,128 | java | package com.basicflags.ui.activities.base;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.basicflags.module.DependencyInjection;
import com.basicflags.service.RxApiService;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import lombok.Getter;
import lombok.experimental.Accessors;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;
/**
* Created by Nick Unuchek (skype: kolyall) on 06.10.2016.
*/
@Accessors(prefix = "m")
public abstract class BaseRxActivity extends AppCompatActivity {
private CompositeSubscription mSubscriptions;
@Getter @Inject RxApiService mRxApiService;
@CallSuper
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSubscriptions = new CompositeSubscription();
DependencyInjection.inject(this);
}
@CallSuper
@Override
protected void onStart() {
super.onStart();
subscribe();
}
private void subscribe() {
for (Subscription subscription : createSubscriptions()) {
mSubscriptions.add(subscription);
}
}
@CallSuper
@Override
protected void onStop() {
super.onStop();
unsubscribeAll();
}
protected void unsubscribeAll() {
if (mSubscriptions == null) { return; }
mSubscriptions.clear();
mSubscriptions = new CompositeSubscription();
}
protected void unsubscribe(Subscription subscription) {
if (subscription == null || mSubscriptions == null) { return; }
mSubscriptions.remove(subscription);
}
public Subscription addSubscription(Subscription subscription) {
mSubscriptions.add(subscription);
return subscription;
}
/**
* Subscribe to the {@link Observable}s that should be started on {@link android.support.v4.app .Fragment#onActivityCreated} and then
* return the subscriptions that you want attached to this fragment's lifecycle. Each {@link Subscription} will have {@link
* Subscription#unsubscribe() unsubscribe()} called when {@link android.support.v4.app.Fragment#onDetach() onDetach()} is fired.
* <p>The default implementation returns an empty array.</p>
*/
protected List<Subscription> createSubscriptions() {
return new ArrayList<>(0);
}
// quick subscriptions
protected <T> Subscription createAndAddSubscription(Observable<T> observable, Observer<T> observer) {
return addSubscription(bindObservable(observable, observer));
}
protected <T> Subscription createAndAddSubscription(Observable<T> observable) {
return addSubscription(bindObservable(observable));
}
private <T> Subscription bindObservable(Observable<T> observable, Observer<T> observer) {
return observable
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.doOnError(new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
doOnError(throwable);
}
})
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(new Action0() {
@Override
public void call() {
doOnSubscribe();
}
})
.observeOn(AndroidSchedulers.mainThread())
.doOnCompleted(new Action0() {
@Override
public void call() {
doOnCompleted();
}
})
.subscribe(observer);
}
public <T> Observable<Boolean> bindOnNextAction(Observable<T> observable,Action1<T> onNextAction) {
return observable.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread()).doOnNext(onNextAction)
.map(new Func1<T, Boolean>() {
@Override
public Boolean call(T t) {
return true;
}
});
}
public <T> Subscription bindObservable(Observable<T> observable) {
Observer<T> observer = new Observer<T>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable throwable) {
}
@Override
public void onNext(T t) {
}
};
return bindObservable(observable,observer);
}
public abstract void doOnSubscribe();
public abstract void doOnError(Throwable throwable);
public abstract void doOnCompleted();
} | [
"[email protected]"
] | |
f03a37f8120a6c780b447ccaf7a488b063e3fb05 | a645a2a11345ea2cfd6c932c93c6a7b26abd4631 | /study/src/main/java/kr/green/study/service/MemberServiceImp.java | 556ae894e70801b1d33d9f83bf7274605799d60f | [] | no_license | kimjavi611/project_mj | cc94afcc75f6bc55e766dce8fc82c445f0312826 | 1555b9f7c375a9326fcc7ad6e9c98b906807bbdb | refs/heads/main | 2023-07-08T23:19:13.093603 | 2021-08-04T17:39:46 | 2021-08-04T17:39:46 | 361,574,822 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,452 | java | package kr.green.study.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.web.util.WebUtils;
import kr.green.study.dao.MemberDAO;
import kr.green.study.pagination.Criteria;
import kr.green.study.vo.MemberVO;
import lombok.AllArgsConstructor;
@Service
@AllArgsConstructor
public class MemberServiceImp implements MemberService{
MemberDAO memberDao;
BCryptPasswordEncoder passwordEncoder;
@Override
public boolean signup(MemberVO user) {
if(user == null)
return false;
//jsp에서 유효성 검사를 하지만 이중으로 걸러주기 위해 서버에서 한번 더 해줌
//아이디 유효성 검사
String idRegex = "^[a-z0-9_-]{5,20}$";
//Pattern.matches() 문자열이랑 정규표현식 비교할때 사용하는 메소드
if(user.getId() == null || !Pattern.matches(idRegex, user.getId()))
return false;
//비밀번호 유효성 검사
String pwRegex = "^[a-zA-Z0-9!@#]{8,16}$";
if(user.getPw()==null || !Pattern.matches(pwRegex, user.getPw()))
return false;
//이메일 유효성 검사
//[email protected] or [email protected]
String emailRegex = "\\w+@\\w+\\.\\w+(\\.\\w+)?";
if(user.getEmail()==null || !Pattern.matches(emailRegex, user.getEmail()))
return false;
//이름 유효성 검사
if(user.getName()==null || user.getName().trim().length()==0)
return false;
//성별 유효성 검사
if(user.getGender()== null )
return false;
//비밀번호 암호화
String encPw = passwordEncoder.encode(user.getPw());
user.setPw(encPw);
memberDao.insertMember(user);
return false;
}
@Override
public MemberVO signin(MemberVO user) {
if(user == null || user.getId() == null)
return null;
MemberVO dbUser = memberDao.selectUser(user.getId());
//잘못된 ID == 회원이 아닌
if(dbUser == null)
return null;
//잘못된 비번
if(user.getPw() == null || !passwordEncoder.matches(user.getPw(), dbUser.getPw()))
return null;
//자동로그인 기능을 위해
dbUser.setUseCookie(user.getUseCookie());
return dbUser;
}
@Override
public Object getMember(String id) {
if(id == null)
return null;
return memberDao.selectUser(id);
}
@Override
public void signout(HttpServletRequest request, HttpServletResponse response) {
if(request == null || response == null)
return;
MemberVO user = getMemberByRequest(request);
if(user == null)
return;
HttpSession session = request.getSession();
session.removeAttribute("user");
session.invalidate();
//request.getSession().removeAttribute("user");
Cookie loginCookie = WebUtils.getCookie(request, "loginCookie");
if(loginCookie == null)
return ;
loginCookie.setPath("/");
loginCookie.setMaxAge(0);
response.addCookie(loginCookie);
keepLogin(user.getId(), "none", new Date());
}
@Override
public void keepLogin(String id, String session_id, Date session_limit) {
if(id == null) {
return ;
}
memberDao.keepLogin(id, session_id, session_limit);
}
@Override
public MemberVO getMemberByCookie(String session_id) {
if(session_id == null)
return null;
return memberDao.selectUserBySession(session_id);
}
@Override
public MemberVO getMemberByRequest(HttpServletRequest request) {
if(request == null)
return null;
return (MemberVO)request.getSession().getAttribute("user");
}
@Override
public ArrayList<MemberVO> getMemberList(MemberVO user, Criteria cri) {
if(user == null || user.getAuthority().equals("USER"))
return null;
return memberDao.selectUserList(user.getAuthority(),cri);
}
@Override
public boolean updateAuthority(MemberVO user, MemberVO loginUser) {
if(user == null || loginUser == null)
return false;
System.out.println(loginUser.compareAuthority(user));
if(loginUser.compareAuthority(user) <= 0)
return false;
MemberVO dbUser = memberDao.selectUser(user.getId());
System.out.println(dbUser);
dbUser.setAuthority(user.getAuthority());
memberDao.updateUser(dbUser);
return true;
}
@Override
public int getTotalCount(MemberVO user) {
if(user == null)
return 0;
return memberDao.getTotalCount(user.getAuthority());
}
}
| [
"[email protected]"
] | |
1341895a69c89195750b8d8d5fbf609b631c0f46 | cd2ba4c9c0aff4adaa184328949849afbaea9703 | /src/main/java/com/jzc/think/mode/structure/interfacezz/AdapterSub.java | f3e72a66e21845414307864d553742a399158894 | [] | no_license | jiango0/Think | 4b2eb88a06e9d7af1d2bb83c9aa876a69bb28707 | 7d21e660a2040afa1a400fe32fe921e1837ee9c1 | refs/heads/master | 2021-01-19T23:20:17.513626 | 2017-04-24T10:03:40 | 2017-04-24T10:03:40 | 88,965,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package com.jzc.think.mode.structure.interfacezz;
public class AdapterSub extends AbstractWapper {
public void method(){
System.out.println("AdapterSub method");
}
}
| [
"[email protected]"
] | |
f1abbb4a61bde85a5069a9348ffb6a211eb0e310 | 95691177074cccb1281ddf9f84a8d88f9ef23164 | /src/main/java/com/sys/mype/sysce/pe/dto/ItemDTO.java | d6b3a2a3af220593cbfab927a806e0e0276cc7d7 | [] | no_license | ctucnoc/Sysce | c80381fb4afe08393f115ab9d279aeea3a0396d7 | c4223601fc312772da3a838d3585e3a93854899f | refs/heads/master | 2023-06-13T21:54:06.351568 | 2021-07-04T20:09:30 | 2021-07-04T20:09:30 | 352,447,990 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package com.sys.mype.sysce.pe.dto;
import lombok.Data;
@Data
public class ItemDTO {
private String displayName;
private String iconName;
private String route;
private String code;
}
| [
"[email protected]"
] | |
20095520228de68002f0052057606d7e02cf7825 | 11c811f67f6951352e60efb0241603e50fc23606 | /webflux-mysql/src/main/java/co/com/jsierra/webfluxmysql/controllers/Handler.java | 93e864d83e0fd26fb53e0c53fa1455631dd69dfb | [] | no_license | jsierra93/SpringWebflux_MySQL_R2DBC | f0860c90d9177fce8c212a383f0c95eb9c041698 | b45dc9f779858a7892c87e5eab17bead735a9586 | refs/heads/master | 2023-01-21T09:24:56.515476 | 2020-11-30T18:46:41 | 2020-11-30T18:46:41 | 317,211,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,433 | java | package co.com.jsierra.webfluxmysql.controllers;
import co.com.jsierra.webfluxmysql.models.UserModels;
import co.com.jsierra.webfluxmysql.services.DatabaseOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
@Component
public class Handler {
@Autowired
DatabaseOperations databaseOperations;
public Mono<ServerResponse> findUsers(ServerRequest serverRequest) {
return ServerResponse.ok()
.body(databaseOperations.findUsers()
.log()
, UserModels.class);
}
public Mono<ServerResponse> findUserById(ServerRequest serverRequest) {
return ServerResponse.ok()
.body(databaseOperations.findUsersById(serverRequest.pathVariable("id"))
.log(), UserModels.class);
}
public Mono<ServerResponse> saveUser(ServerRequest serverRequest) {
Mono<UserModels> newUser = serverRequest.bodyToMono(UserModels.class)
.flatMap(user ->
databaseOperations.saveUser(user));
return ServerResponse.ok()
.body(newUser, UserModels.class);
}
public Mono<ServerResponse> updateUserById(ServerRequest serverRequest) {
Mono<UserModels> updateUser = serverRequest.bodyToMono(UserModels.class)
.flatMap(user ->
databaseOperations.updateUserById(user, serverRequest.pathVariable("id"))
);
return ServerResponse.ok()
.body(updateUser, UserModels.class);
}
public Mono<ServerResponse> updateUserByUsername(ServerRequest serverRequest) {
Mono<UserModels> updateUser = serverRequest.bodyToMono(UserModels.class)
.flatMap(user ->
databaseOperations.updateUserByUsername(user)
);
return ServerResponse.ok()
.body(updateUser, UserModels.class);
}
public Mono<ServerResponse> deleteUser(ServerRequest serverRequest) {
return ServerResponse.ok()
.body(databaseOperations.deleteUser(serverRequest.pathVariable("id"))
, String.class);
}
}
| [
"[email protected]"
] | |
10c03f524b861160489b972133ac4ec477563d26 | 3da4e7cbac527b42c86065e4cc239b1b3559c7c0 | /app/src/main/java/com/example/keepfit/ui/dashboard/GoalsFragment.java | 7682d92f88c1126c5c8099134ca2b573a4c0c75b | [] | no_license | gmc112/KeepFit | 714c6099c5bcae13a8ae796110e2a92a4093ca9f | 388a924f53abf90bc35b22092a47af8ea89aa553 | refs/heads/master | 2020-12-29T10:28:42.399666 | 2020-02-06T00:17:43 | 2020-02-06T00:17:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package com.example.keepfit.ui.dashboard;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.keepfit.R;
public class GoalsFragment extends Fragment {
private GoalsViewModel goalsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
goalsViewModel =
ViewModelProviders.of(this).get(GoalsViewModel.class);
View root = inflater.inflate(R.layout.fragment_goals, container, false);
final ListView listView = root.findViewById(R.id.text_dashboard);
goalsViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
}
});
return root;
}
} | [
"[email protected]"
] | |
fd8ea75442fdaec9d20273a14bb12641c1ab5bdc | adcf82e8f6ca858305504d13d8db79c0a6970323 | /Basic Code/Classes.java | 0d7c09db082395b9cce8bee28a41769f209dc880 | [] | no_license | Genius1237/CRUx-Android-Workshop | 8927a769f5dc22786cd467f6f9fce35a7f53a2e6 | c4c53255bfef0c8a736d7220f1921d490034bed3 | refs/heads/master | 2021-01-11T14:18:27.322624 | 2017-03-06T13:37:52 | 2017-03-06T13:37:52 | 81,328,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | class One{
int x;
float y;
char name[100];
char id[10];
//Classes can have functions inside them
int doSomething(){
}
public void doNothing(){
}
//Constructor
One(){
}
//Constructor with arguments
One(int x,float y){
}
public static void main(String args[]){
//Object Creation
int x=5;
One y=new One();
//Each time an object is created, memory must be alotted using new operator
One z;
//No object is created here. z points to null
}
} | [
"[email protected]"
] | |
a681f798226e7454a52655448923cac6aadaabd4 | 27ca483176c24274329e6c63d9903421d1ca0a8d | /src/Client/UniqClient.java | 295a7194947ded9e7e4a03d7e2ccd21e28598a15 | [] | no_license | surajbabar/unix-tools | 860abd453ebe13c6c2612d86dca8fbb9416a23bb | 2a43a59c74e68c097c6d63272a40103b925f4ae5 | refs/heads/master | 2021-01-25T10:15:11.182620 | 2017-10-15T16:57:11 | 2017-10-15T16:57:11 | 15,743,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package Client;
import surajbab.unixTools.Uniq;
import surajbab.unixTools.lib.File;
public class UniqClient {
public static void main(String[] args) {
Uniq uniq = new Uniq();
String filename = args[0], fileData;
fileData = new File().readFile(filename);
System.out.println(uniq.UniqLines(fileData));
}
}
| [
"[email protected]"
] | |
76d45367f27334096ef4558bb18a5f2a136f1e61 | dd0feb5eb8af78da03e442f8069a2c73fabd9afe | /SQL_Replica/src/CRUD/Update_Entry.java | b634658d7a48806f3c7a91d7c6c63228ed2bf994 | [] | no_license | harshitgupta323/SQL-Replica | b2c0bf155044dde25449ec943b845992e187ce64 | 8452566e10b0198f6c1018939e8a0e46a0148b60 | refs/heads/master | 2022-02-24T22:50:35.202796 | 2019-09-07T10:13:07 | 2019-09-07T10:13:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,318 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package CRUD;
import Table.Check_Table;
import java.io.*;
public class Update_Entry {
String database, table;
public Update_Entry(String database_name, String table_name) {
database = database_name;
table = table_name;
}
/*public static void main(String args[]) throws IOException {
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//System.out.println("Enter the content:");
//String sf = br.readLine();
Update_Entry a = new Update_Entry("Narula", "CSE");
a.updation("update CSE set Name=Benazir,Password=ECE where ID = 4");
}*/
public void updation(String s1) throws IOException {
int g1 = Check_Table.check(database, table);//Proportional to number of tables something like c1
if (g1 == 1) {
String s3[] = new String[100];
s3 = s1.split(" ");//splitting the query
String columns[] = new String[100];
String abc[][] = new String[10000][3];
columns = s3[3].split(",");
int count = 0, t, index = 0, i, flag = 0, k = 0, t1 = 0, t2 = 0;
int index1[] = new int[100];
String s = "E:/Database/" + database + "/" + table + ".qsv";
String newfilename = "E:/Database/" + database + "/newfile.qsv";
//BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
String data[] = new String[100000];
int c = Read_Entry.selection(data, database, table, s1);
try {
FileWriter writer;
try (FileReader reader = new FileReader(s)) {
BufferedReader br = new BufferedReader(reader);
writer = new FileWriter(newfilename, true);
BufferedWriter bw = new BufferedWriter(writer);
String line, line1, line2, line3, line4;
line1 = br.readLine();
writer.write(line1 + "\r\n");
line2 = br.readLine();
writer.write(line2 + "\r\n");
line3 = br.readLine();
writer.write(line3 + "\r\n");
line4 = br.readLine();
writer.write(line4 + "\r\n");
String str[] = new String[100];
String s4[] = new String[100];
String data1[] = new String[100];
str = line1.split(":");//splitting the name of the columns
for (t = 0; t < str.length; t++) {
if (str[t].equals(data[c])) {//stores the index of the column which contains the primary key
index = t;
}
}
for (t1 = 0; t1 < columns.length; t1++) {
abc[t1] = columns[t1].split("=");
for (t2 = 0; t2 < str.length; t2++) {
if (abc[t1][0].equalsIgnoreCase(str[t2])) {
index1[k++] = t2;
}
}
}
while ((line = br.readLine()) != null) {
flag = 0;
s4 = line.split(":");//splitting the enteries
for (i = 0; i < c; i++) {
data1 = data[i].split(":");
if (s4[index].equals(data1[index])) {
flag = 1;
break;
}
}
if (flag == 1) {
String stg = ":";
for (i = 0; i < columns.length; i++) {
s4[index1[i]] = abc[i][1];
}
for (i = 1; i < s4.length; i++) {
stg = stg + s4[i] + ":";
}
line = stg;
count++;
}
writer.write(line + "\r\n");
}
reader.close();
br.close();
bw.flush();
bw.close();
}
writer.close();
System.out.println("Query OK " + count + " rows Affected.");
} catch (IOException|ArrayIndexOutOfBoundsException e) {
System.out.println("Syntax Error");
}
File f = new File(s);
f.setWritable(true);
System.gc();
do {
System.gc();
f.delete();
} while (f.exists());
File newfile = new File(newfilename);
newfile.renameTo(f);
} else {
System.out.println("No such table is present.");
}
}
}
| [
"[email protected]"
] | |
bd916b6adde21dc97534c7fed6e85f123a70961b | bb75a0924633fcffd620a2dbf6d6c61340c7c553 | /tradeportal/WEB-INF/src/java/com/cxsample/tradeportal/PayBill.java | 5941d017e842f4a819e91de97dc289a81440d372 | [] | no_license | Checkmarx-Clinic/TP-INSTRUCTOR | 2786391d5d8f2c0dc37944696a228d362159d85b | 40d3b3615271770ad4f3ede0e4c70927e98e9b05 | refs/heads/master | 2022-11-18T19:04:12.842675 | 2020-06-23T16:18:01 | 2020-06-23T16:18:01 | 274,244,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 924 | java | package com.cxsample.tradeportal;
import com.opensymphony.xwork2.ActionSupport;
import com.cxsample.tradeportal.database.ConnectionFactory;
import com.cxsample.tradeportal.model.Account;
import com.cxsample.tradeportal.model.AccountService;
import net.sf.hibernate.Session;
import net.sf.hibernate.Query;
import net.sf.hibernate.Criteria;
import net.sf.hibernate.expression.Expression;
import org.apache.struts2.ServletActionContext;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
public class PayBill extends AdminSupport
{
private List accounts;
public String execute() throws Exception
{
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getRemoteUser();
accounts = AccountService.getAccounts(username);
super.execute();
return SUCCESS;
}
public List getAccounts() {
return accounts;
}
}
| [
"[email protected]"
] | |
9e5d3f73f5e7a9cd7ffd21df8bd677e35973653b | 1b2e63d4a971b8e9910f95acac013087f294970e | /src/com/cokiMing/layer/bullet/BaseBullet.java | 10be451c8cd2451013cdfd5b2407a6f26c6c0871 | [] | no_license | cokiMing/Issac-Java | 40ca761e0f9cd5c7845b58e6953d29f6683a764d | 89eeb64bf64b832aa83df5712d53713e312be567 | refs/heads/master | 2021-01-01T20:07:12.633979 | 2017-08-01T10:03:12 | 2017-08-01T10:03:12 | 98,767,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,551 | java | package com.cokiMing.layer.bullet;
import com.cokiMing.layer.buff.BaseBuff;
import com.cokiMing.layer.role.BaseRole;
import com.cokiMing.constant.Direction;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Coki on 2017/7/30.
*/
public abstract class BaseBullet {
//速度
protected double speed;
//x方向弹速
protected int xSpeed;
//y方向弹速
protected int ySpeed;
//坐标x
protected int x;
//坐标y
protected int y;
//子弹方向
protected Direction direction;
//伤害值
protected double damage;
//是否可穿越障碍物
protected boolean acrossBlock;
//是否可穿越敌人
protected boolean acrossEnemy;
//子弹的加成
protected BaseBuff baseBuff;
//敌我区分标记
protected boolean isGood;
//发射子弹的对象
protected BaseRole baseRole;
//图片映射
protected Map<String,Image> imageMap = new HashMap<>();
public BaseBullet(){
}
public BaseBullet(BaseRole baseRole){
this.baseRole = baseRole;
this.x = baseRole.getX();
this.y = baseRole.getY();
init();
}
public void init(){
initBullet();
initImageMap();
}
/**
* 绘制方法
* @param graphics
*/
public abstract void draw(Graphics graphics);
/**
* 初始化贴图映射
*/
protected abstract void initImageMap();
/**
* 初始化子弹形状
*/
protected abstract void initBullet();
}
| [
"[email protected]"
] | |
f9208ba949f4f4cd85b9396a23b51c2607a0e5a7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_9fa9dcd5f3d5df6295ea366e24a6a5f80301531e/NYSuffolkCountyAParserTest/10_9fa9dcd5f3d5df6295ea366e24a6a5f80301531e_NYSuffolkCountyAParserTest_s.java | 9f21967c4f73dc77a70aa4c758e3c1eeff117414 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 10,144 | java | package net.anei.cadpage.parsers.NY;
import net.anei.cadpage.parsers.BaseParserTest;
import net.anei.cadpage.parsers.NY.NYSuffolkCountyAParser;
import org.junit.Test;
public class NYSuffolkCountyAParserTest extends BaseParserTest {
public NYSuffolkCountyAParserTest() {
setParser(new NYSuffolkCountyAParser(), "SUFFOLK COUNTY", "NY");
}
@Test
public void testParser() {
doTest("T1",
"TYPE: GAS LEAKS / GAS ODOR (NATURAL / L.P.G.) LOC: 11 BRENTWOOD PKWY BRENTW HOMELESS SHELTER CROSS: PENNSYLVANIA AV / SUFFOLK AV CODE: 60-B-2 TIME: 12:54:16",
"CALL:GAS LEAKS / GAS ODOR (NATURAL / L.P.G.)",
"ADDR:11 BRENTWOOD PKWY",
"CITY:Brentwood",
"PLACE:HOMELESS SHELTER",
"X:PENNSYLVANIA AV / SUFFOLK AV",
"CODE:60-B-2",
"TIME:12:54:16");
doTest("T2",
"TYPE: STRUCTURE FIRE LOC: 81 NEW HAMPSHIRE AV NBAYSH CROSS: E FORKS RD / E 3 AV CODE: 69-D-10 TIME: 16:36:48",
"CALL:STRUCTURE FIRE",
"ADDR:81 NEW HAMPSHIRE AV",
"MADDR:81 NEW HAMPSHIRE AVE",
"CITY:Bay Shore",
"X:E FORKS RD / E 3 AV",
"CODE:69-D-10",
"TIME:16:36:48");
doTest("T3",
"TYPE: OPEN BURNING LOC: 65 GRANT AVE BRENTW CROSS: SUFFOLK AVE CODE: 54-C-6 TIME: 18:39:20",
"CALL:OPEN BURNING",
"ADDR:65 GRANT AVE",
"X:SUFFOLK AVE",
"CITY:Brentwood",
"CODE:54-C-6",
"TIME:18:39:20");
doTest("T4",
"TYPE: BLEEDING / LACERATIONS LOC: 462 SPUR DR N NBAYSH CROSS: WB SSP OFF RAMP-X42N 5TH AV / E 3 AV CODE: 21-A-1 TIME: 03:36:22",
"CALL:BLEEDING / LACERATIONS",
"ADDR:462 SPUR DR N",
"CITY:Bay Shore",
"X:WB SSP OFF RAMP-X42N 5TH AV / E 3 AV",
"CODE:21-A-1",
"TIME:03:36:22");
doTest("T5",
"TYPE: PREGNANCY / CHILDBIRTH / MISCARRIAGE LOC: 330 MOTOR PKWY HAUPPA:@FELDMAN, KRAMER & MONACO STE 400 CROSS: WASHINGTON AV / MARCUS BLVD C",
"CALL:PREGNANCY / CHILDBIRTH / MISCARRIAGE",
"ADDR:330 MOTOR PKWY",
"CITY:Hauppauge",
"PLACE:FELDMAN, KRAMER & MONACO STE 400",
"X:WASHINGTON AV / MARCUS BLVD");
doTest("T6",
"TYPE: PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE LOC: 200 WIRELESS BLVD HAUPPA: @SOCIAL SERVICES HAUPPAUGE INTERVIEW AREA CROSS: MORELAND RD /",
"CALL:PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE",
"ADDR:200 WIRELESS BLVD",
"CITY:Hauppauge",
"PLACE:SOCIAL SERVICES HAUPPAUGE INTERVIEW AREA",
"X:MORELAND RD /");
doTest("T7",
"FAINTING (NEAR) LOC: 46 SAUNDERS AV CENTEM:@KINGS CHAPEL CHURCH CROSS: ROWEIN RD CODE: 31-D-2 TIME: 17:24:12",
"CALL:FAINTING (NEAR)",
"ADDR:46 SAUNDERS AV",
"MADDR:46 SAUNDERS AVE",
"CITY:Center Moriches",
"PLACE:KINGS CHAPEL CHURCH",
"X:ROWEIN RD",
"CODE:31-D-2",
"TIME:17:24:12");
doTest("T8",
"SEIZURES LOC: 20 TRAINOR AV CENTEM CROSS: SUNRISE HWY S BERNSTEIN BLVD CODE: 12-C-1 TIME: 03:39:02",
"CALL:SEIZURES",
"ADDR:20 TRAINOR AV",
"MADDR:20 TRAINOR AVE",
"CITY:Center Moriches",
"X:SUNRISE HWY S BERNSTEIN BLVD",
"CODE:12-C-1",
"TIME:03:39:02");
doTest("T9",
"ABDOMINAL PAINS LOC: 18 INWOOD RD CENTEM CROSS: UNION AV / BEACHFERN RD CODE: 1-A-1 TIME: 21:21:39",
"CALL:ABDOMINAL PAINS",
"ADDR:18 INWOOD RD",
"CITY:Center Moriches",
"X:UNION AV / BEACHFERN RD",
"CODE:1-A-1",
"TIME:21:21:39");
doTest("T10",
"UNKNOWN PROBLEM LOC: 150 CHICHESTER AV CENTEM CROSS: YARMOUTH LN / FROWEIN RD CODE: TIME: 08:01:10",
"CALL:UNKNOWN PROBLEM",
"ADDR:150 CHICHESTER AV",
"MADDR:150 CHICHESTER AVE",
"CITY:Center Moriches",
"X:YARMOUTH LN / FROWEIN RD",
"TIME:08:01:10");
doTest("T11",
"FAINTING (NEAR) LOC: 6 FROWEIN RD EMORIC: @CEDAR LODGE NURSING HOME IN THE DINING ROOM CROSS: WALDEN CT OAK ST CODE: 31-D-3 TIME: 18:51:38",
"CALL:FAINTING (NEAR)",
"ADDR:6 FROWEIN RD",
"CITY:East Moriches",
"PLACE:CEDAR LODGE NURSING HOME IN THE DINING ROOM",
"X:WALDEN CT OAK ST",
"CODE:31-D-3",
"TIME:18:51:38");
doTest("T12",
"GAS ODOR (NATURAL L.P.G.) LOC: MCGRAW ST SHIRLE I/V/O SHIRLEY PLAZA CROSS: GRAND AV / OAK AV CODE: 60-C-2 TIME: 02:06:34",
"CALL:GAS ODOR (NATURAL L.P.G.)",
"ADDR:MCGRAW ST",
"MADDR:MCGRAW ST & GRAND AVE",
"CITY:Shirley",
"PLACE:I / V / O SHIRLEY PLAZA",
"X:GRAND AV / OAK AV",
"CODE:60-C-2",
"TIME:02:06:34");
doTest("T13",
"FAINTING (NEAR) LOC: 53-10 LONG TREE LN MORICH: @PINE HILLS SOUTH CLUBHOUSE COMMUNITY ROOM CROSS: CODE: 31-E-1 TIME: 14:54:18",
"CALL:FAINTING (NEAR)",
"ADDR:53-10 LONG TREE LN",
"MADDR:53 LONG TREE LN",
"CITY:Moriches",
"PLACE:PINE HILLS SOUTH CLUBHOUSE COMMUNITY ROOM",
"CODE:31-E-1",
"TIME:14:54:18");
doTest("T14",
"TYPE: ALARMS LOC: 127 CRYSTAL BEACH BLVD MORICH CROSS: BEVERLY CT / CODE: 52-B-1C TIME: 21:15:11",
"CALL:ALARMS",
"ADDR:127 CRYSTAL BEACH BLVD",
"CITY:Moriches",
"X:BEVERLY CT /",
"CODE:52-B-1C",
"TIME:21:15:11");
doTest("T15",
"TYPE: PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE LOC: 79 ABBOTT AV MASTIC ***_VIP_***: CROSS: ELGIN ST / FOXCROFT ST CODE: 25-B-6 TIME: 14:36:05",
"CALL:PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE",
"ADDR:79 ABBOTT AV",
"MADDR:79 ABBOTT AVE",
"CITY:Mastic",
"PLACE:***_VIP_***",
"X:ELGIN ST / FOXCROFT ST",
"CODE:25-B-6",
"TIME:14:36:05");
doTest("T16",
"TYPE: ALARMS LOC: 100 PATRICIA CT OAKDAL @OAKDALE APARTMENTS APARTMENT 3 CROSS: RACE PL / CODE: 52-C-1S TIME: 19:16:55",
"CALL:ALARMS",
"ADDR:100 PATRICIA CT",
"CITY:Oakdale",
"PLACE:OAKDALE APARTMENTS APARTMENT 3",
"X:RACE PL /",
"CODE:52-C-1S",
"TIME:19:16:55");
doTest("T18",
"FWD: TYPE: STRUCTURE FIRE LOC: 1 WILBUR AV MANORV CROSS: SOHMER ST / CODE: 69-D-5 TIME: 17:17:43",
"CALL:STRUCTURE FIRE",
"ADDR:1 WILBUR AV",
"MADDR:1 WILBUR AVE",
"CITY:Manorville",
"X:SOHMER ST /",
"CODE:69-D-5",
"TIME:17:17:43");
doTest("T19",
"TYPE: MOTOR VEHICLE ACCIDENT CROSS: CHURCH ST / LAKELAND AV CODE: 29-B-1U TIME: 09:04:01",
"CALL:MOTOR VEHICLE ACCIDENT",
"ADDR:CHURCH ST & LAKELAND AV",
"MADDR:CHURCH ST & LAKELAND AVE",
"CODE:29-B-1U",
"TIME:09:04:01");
doTest("T20",
"TYPE: ALARMS LOC: 311 BAY AV EPATCH: @BAY HOUSE CROSS: NEWINS ST / PARK ST CODE: 52-C-3G TIME: 15:33:58\n\n",
"CALL:ALARMS",
"ADDR:311 BAY AV",
"MADDR:311 BAY AVE",
"CITY:East Patchogue",
"PLACE:BAY HOUSE",
"X:NEWINS ST / PARK ST",
"CODE:52-C-3G",
"TIME:15:33:58");
doTest("T21",
"TYPE: CHEST PAIN LOC: 3845 VETERANS MEMORIAL HWY RONKON: @HOLIDAY INN RONKONKOMA: @HOLIDAY INN RONKONKOMA:06:12.4418,40:48:13.4 PARKI",
"CALL:CHEST PAIN",
"ADDR:3845 VETERANS MEMORIAL HWY",
"CITY:Ronkonkoma",
"PLACE:HOLIDAY INN RONKONKOMA",
"INFO:HOLIDAY INN RONKONKOMA 06 12.4418,40 48 13.4 PARKI");
doTest("T22",
"TYPE: UNKNOWN PROBLEM LOC: 195 CUBA HILL RD GREENL CROSS: MANOR RD / DANVILLE DR CODE: 32-B-2 TIME: 17:30:40",
"CALL:UNKNOWN PROBLEM",
"ADDR:195 CUBA HILL RD",
"CITY:Greenlawn",
"X:MANOR RD / DANVILLE DR",
"CODE:32-B-2",
"TIME:17:30:40");
doTest("T23",
"TYPE: STRUCTURE FIRE LOC: 1 ARNOLD DR HUNTIN CROSS: PARTRIDGE LN / CODE: default TIME: 06:38:03",
"CALL:STRUCTURE FIRE",
"ADDR:1 ARNOLD DR",
"CITY:Huntington",
"X:PARTRIDGE LN /",
"CODE:default",
"TIME:06:38:03");
doTest("T24",
"TYPE: STRUCTURE FIRE LOC: 6 MAJESTIC DR DIXHIL CROSS: ROYAL LN / REGENCY LN CODE: 69-D-6 TIME: 02:22:25",
"CALL:STRUCTURE FIRE",
"ADDR:6 MAJESTIC DR",
"CITY:Dix Hills",
"X:ROYAL LN / REGENCY LN",
"CODE:69-D-6",
"TIME:02:22:25");
doTest("T25",
"TYPE: FALLS LOC: 37 WATERSIDE AV NORTHP CROSS: MONROE ST / WILLIS ST CODE: 17-B-3 TIME: 13:40:45",
"CALL:FALLS",
"ADDR:37 WATERSIDE AV",
"MADDR:37 WATERSIDE AVE",
"CITY:Northport",
"X:MONROE ST / WILLIS ST",
"CODE:17-B-3",
"TIME:13:40:45");
doTest("T26",
"TYPE: HEADACHE LOC: 68 FOREST AV SHIRLE CROSS: DAWN DR / WINSTON DR CODE: 18-C-2 TIME: 16:09:54\n\n",
"CALL:HEADACHE",
"ADDR:68 FOREST AV",
"MADDR:68 FOREST AVE",
"CITY:Shirley",
"X:DAWN DR / WINSTON DR",
"CODE:18-C-2",
"TIME:16:09:54");
doTest("T27",
"TYPE: RESPIRATORY LOC: 16 TEAL CRSN GREATR CROSS: / WIDGEON CT CODE: 6-D-1 TIME: 15:59:03",
"CALL:RESPIRATORY",
"ADDR:16 TEAL CRSN",
"MADDR:16 TEAL CRESCENT",
"CITY:Great River",
"X:/ WIDGEON CT",
"CODE:6-D-1",
"TIME:15:59:03");
doTest("T28",
"TYPE: STRUCTURE FIRE LOC: 605 7 AV ENORTH CROSS: 6 ST / OWEN CT CODE: 69-D-6 TIME: 11:34:38",
"CALL:STRUCTURE FIRE",
"ADDR:605 7 AV",
"MADDR:605 7 AVE",
"CITY:East Northport",
"X:6 ST / OWEN CT",
"CODE:69-D-6",
"TIME:11:34:38");
}
public static void main(String[] args) {
new NYSuffolkCountyAParserTest().generateTests("T1", "CALL ADDR CITY PLACE X CODE INFO TIME");
}
}
| [
"[email protected]"
] | |
af0b280699774c58829d0367dea621315b44a4a2 | 2727bb9cf60f98034615e578cef6321d79c2bb23 | /photoviewerkit/src/main/java/com/khoinguyen/photoviewerkit/interfaces/IPhotoBackdropView.java | b70796691d926b2984b8df0a354b082298a49ae9 | [] | no_license | khoi-nguyen-2359/wallpaper-gallery | fec0c51bae66b06027808d12c194f3de8176642a | d6564aa4b3baccbba0ea897a481a9db45f2150e6 | refs/heads/master | 2021-01-21T14:40:00.711878 | 2016-07-15T09:54:32 | 2016-07-15T09:54:32 | 55,956,629 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.khoinguyen.photoviewerkit.interfaces;
/**
* Created by khoinguyen on 6/27/16.
*/
public interface IPhotoBackdropView<D> extends IPhotoViewerKitComponent<D> {
void updateAlphaOnShrinkAnimationUpdate(float animationProgress);
void updateAlphaOnRevealAnimationUpdate(float animationProgress);
}
| [
"[email protected]"
] | |
cbe789660422a1c534daa3bc19257f1d8e034e77 | 064c1c2a39de354aef90228bfc32aa1e44f46183 | /ArtificialIntelegence/src/BasicBayesian/ParseDataSet.java | c49a2aca8367a414927585e9847e1cac6fdce6ec | [] | no_license | dibranxhymshiti/Viti_2_Projektet | 648dd01506f99c05865397c7926bc03bbf0f35c7 | 8dd8e1b54f75c7fc5a2540814b6345a8a90419ba | refs/heads/master | 2020-03-27T07:25:14.976659 | 2016-06-23T01:36:26 | 2016-06-23T01:36:26 | 61,762,546 | 0 | 0 | null | 2016-06-23T01:36:26 | 2016-06-23T01:15:12 | Java | UTF-8 | Java | false | false | 2,575 | java | package BasicBayesian;
import java.io.*;
public class ParseDataSet
{
/*
* ==========================================================================
* =* paseDataset
* ============================================================
* ===============
*/
public int[][] parseDataset(String training_dataset_path, int number_of_attributes ) throws IOException
{
int [][] training_data = new int [countRows(training_dataset_path)][number_of_attributes+1];
String read_transaction = "";
try {
FileReader fileReader = new FileReader(training_dataset_path);
BufferedReader bufferedReader = new BufferedReader(fileReader);
int ID_ItemSet = 0;
while((read_transaction = bufferedReader.readLine()) != null)
{ if(validate(read_transaction.charAt(0)+""))
{
String[] transaction_box = read_transaction.split(" ");
training_data[ID_ItemSet][0] = Integer.parseInt(transaction_box[0]); // gets class label value
for(int i = 1; i<transaction_box.length; i++)
{
String[] index_value = transaction_box[i].split(":");
training_data[ID_ItemSet][Integer.parseInt(index_value[0])] = Integer.parseInt(index_value[1]);
}
ID_ItemSet++;
}
}
bufferedReader.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
return training_data;
}
/*
* ==========================================================================
* =* countRows
* ==============================================================
* =============
*/
public static int countRows(String filename) throws IOException
{
LineNumberReader reader = new LineNumberReader(new FileReader(filename));
int count = 0;
String lineRead = "";
while ((lineRead = reader.readLine()) != null)
{
}
count = reader.getLineNumber();
reader.close();
return count;
}
public boolean validate(String s)
{
boolean answer = false;
if(s.equals("0") || s.equals("-")|| s.equals("+"))
answer = true;
return answer;
}
public static void main(String[] args) throws IOException
{
String path = "C:\\Users\\dibran\\Desktop\\generated_data.txt";
ParseDataSet p = new ParseDataSet();
int[][] dataset = p.parseDataset(path, 10);
for (int i = 0; i < dataset.length; i++)
{
for (int j = 0; j < dataset[0].length; j++)
{
System.out.print(dataset[i][j] + " ");
}
System.out.println();
}
}
}
| [
"[email protected]"
] | |
0e19ecf884d7984337aec711b90c3adac175fb43 | 4591c6ebdba6ef84ced586da2bdd9eb95a93fa53 | /src/main/java/com/kevin/Chapter/one/ufTest.java | d238db667a9d71bc7506126eb4f03e5a8df87466 | [] | no_license | kevin19931015/MyAlgorithm | 355cbf3ba4e41657225d281dc0b7ce0754cba7ad | a11a417b8cfa68acefd5cbda5bcd1c116f79a071 | refs/heads/master | 2021-05-12T00:12:57.866257 | 2018-01-17T12:54:03 | 2018-01-17T12:54:03 | 117,529,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.kevin.Chapter.one;
import edu.princeton.cs.introcs.StdIn;
import edu.princeton.cs.introcs.StdOut;
public class ufTest {
public static void main(String[] args){
int N = StdIn.readInt();
UnionFind uf = new UnionFind(N);
while (!StdIn.isEmpty()){
int p = StdIn.readInt();
int q = StdIn.readInt();
uf.union(p,q);
StdOut.println(uf.find(p)+"---"+uf.find(q));
StdOut.println(p+"---"+q);
StdOut.println(uf.count());
}
}
}
| [
"[email protected]"
] | |
54620d6bbf513c0f3825a3906b9d9c1ee087b32e | e14769597d30adfc88b38d807053cbcfa92239ce | /subprojects/web/src/dtrack/web/actions/AddCommentAction.java | 4846e5afed0b1f1309c2ffb6436e776f7af6c0ef | [] | no_license | osobolev/dtrack | a99c9d2b541509f55c8e383604f7f1fbdb31146e | 023cb2bd8625260061b4c8b9e22f89fe8e1fd661 | refs/heads/master | 2023-03-10T23:53:39.590458 | 2023-02-28T14:43:15 | 2023-02-28T14:43:15 | 215,111,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,418 | java | package dtrack.web.actions;
import dtrack.web.dao.BugEditDao;
import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;
import java.util.Map;
public final class AddCommentAction extends Action {
private final int bugId;
private final int bugNum;
private final ProjectInfo request;
public AddCommentAction(int bugId, int bugNum, ProjectInfo request) {
this.bugId = bugId;
this.bugNum = bugNum;
this.request = request;
}
private Integer createComment(BugEditDao dao, Map<String, String> parameters) throws ValidationException, SQLException {
String untrustedHtml = parameters.get("comment");
if (untrustedHtml == null)
throw new ValidationException("Missing 'comment' parameter");
String safeHtml = UploadUtil.POLICY.sanitize(untrustedHtml);
return dao.addBugComment(bugId, request.getUserId(), safeHtml);
}
@Override
public String post(Context ctx, HttpServletRequest req) throws Exception {
BugEditDao dao = new BugEditDao(ctx.connection);
UploadUtil<Integer> util = new UploadUtil<>(parameters -> createComment(dao, parameters));
util.post(
req,
(commentId, fileName, content) -> dao.addCommentAttachment(commentId.intValue(), fileName, content)
);
ctx.connection.commit();
return request.getBugUrl(bugNum);
}
}
| [
"[email protected]"
] | |
5d4fb55aeba8ae930d3c60a0cab70408aa91529f | 043472b8681153ee6754b98449dd192703e0b8d2 | /future-auth/future-auth-cas-server/src/main/java/com/github/peterchenhdu/future/auth/cas/ticket/proxy/ProxyHandler.java | acba111adb87581dea8f2e21e70690bbaef29542 | [
"Apache-2.0"
] | permissive | peterchenhdu/future-framework | 4f59c9b56a28a4e1a05bcccddc460dbcb47e5bd1 | e41555f876ffe18cf9b8aa5fee867165afc363d6 | refs/heads/master | 2018-10-25T20:02:09.896630 | 2018-08-24T14:34:55 | 2018-08-24T14:34:55 | 62,036,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,099 | java | /*
* Copyright (c) 2011-2025 PiChen
*/
package com.github.peterchenhdu.future.auth.cas.ticket.proxy;
import com.github.peterchenhdu.future.auth.cas.authentication.principal.Credentials;
/**
* Abstraction for what needs to be done to handle proxies. Useful because the
* generic flow for all authentication is similar the actions taken for proxying
* are different. One can swap in/out implementations but keep the flow of
* events the same.
*
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.0
* <p>
* This is a published and supported CAS Server 3 API.
* </p>
*/
public interface ProxyHandler {
/**
* Method to actually process the proxy request.
*
* @param credentials The credentials of the item that will be proxying.
* @param proxyGrantingTicketId The ticketId for the ProxyGrantingTicket (in
* CAS 3 this is a TicketGrantingTicket)
* @return the String value that needs to be passed to the CAS client.
*/
String handle(Credentials credentials, String proxyGrantingTicketId);
}
| [
"[email protected]"
] | |
8181053053ab01b4dc41113fccdc8857c13adc45 | 4916ed5c8041b83dd051b5a24756bcdd5b043c3d | /src/java/demo/RulesEngine.java | fa82e0ab2851704509447cd4ce87c7611d4117c7 | [] | no_license | barba-dorada/drools-test | 8e3440efa5109df3c3845ecf6ca3f2451dcb38db | 4eb05c5c0fc10f42d7bd665bad1cf070962d8241 | refs/heads/master | 2021-01-17T17:43:29.731171 | 2016-10-11T11:06:56 | 2016-10-11T11:06:56 | 70,585,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | package demo;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.event.DebugWorkingMemoryEventListener;
import org.drools.rule.Package;
public class RulesEngine {
private RuleBase rules;
private boolean debug = false;
public RulesEngine(String rulesFile) throws RulesEngineException {
super();
try {
// Read in the rules source file
Reader source = new InputStreamReader(RulesEngine.class
.getResourceAsStream("/rules/" + rulesFile));
// Use package builder to build up a rule package
PackageBuilder builder = new PackageBuilder();
// This will parse and compile in one step
builder.addPackageFromDrl(source);
// Get the compiled package
Package pkg = builder.getPackage();
// Add the package to a rulebase (deploy the rule package).
rules = RuleBaseFactory.newRuleBase();
rules.addPackage(pkg);
} catch (Exception e) {
throw new RulesEngineException(
"Could not load/compile rules file: " + rulesFile, e);
}
}
public RulesEngine(String rulesFile, boolean debug)
throws RulesEngineException {
this(rulesFile);
this.debug = debug;
}
public void executeRules(WorkingEnvironmentCallback callback) {
WorkingMemory workingMemory = rules.newStatefulSession();
if (debug) {
workingMemory
.addEventListener(new DebugWorkingMemoryEventListener());
}
callback.initEnvironment(workingMemory);
workingMemory.fireAllRules();
}
}
| [
"[email protected]"
] | |
84d01abde09e4e6674ddfedb22a17107f8ba8acd | c0e62d59b77aefe46ddb392a6f9e1087080c4aee | /SweetShop/src/cakes/special/Advertising.java | 761e205e1277a126f8bd2e3b725e81ca9e312619 | [] | no_license | borisb955/ITtalentsHW | 66666e46aa9783314d04b38f31014653f9314e08 | 3ff6aae1cae6d3c8f999d317cb38aa63fd92fa58 | refs/heads/master | 2021-01-01T16:51:34.846783 | 2017-08-29T20:09:19 | 2017-08-29T20:09:19 | 97,931,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | package cakes.special;
import cakes.Cake;
import cakes.Cake.CakeKind;
import cakes.standard.Biscuit;
public class Advertising extends Cake implements Comparable<Advertising>{
private String name;
public Advertising(String name, String descr, int price, int pieces, String ownerName) {
super(name, descr, price, pieces, CakeKind.SPECIAL, "Advertising");
this.name = ownerName;
}
@Override
public int compareTo(Advertising o) {
return o.price - this.price;
}
}
| [
"[email protected]"
] | |
21c790e4fe73a65412e65f13e49a6b1a03c09cd5 | 6a4689aa2453f8a4a289db88f8a4be5eef0cf739 | /src/main/java/com/devops/service/IJobService.java | 0df3706e4d4c31d53b2e5bccf7dfbfb9d2037abd | [
"Apache-2.0"
] | permissive | bradlyyd/testsff | 8310253a7fe75af977824bdd851d027a8fbd14db | a4b5a1547d81838fd41978561572738becdab4f9 | refs/heads/master | 2020-03-22T07:04:39.864151 | 2018-06-26T09:18:20 | 2018-06-26T09:18:20 | 139,676,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | package com.devops.service;
import java.util.Map;
import org.springframework.scheduling.annotation.Async;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.devops.entity.JenkinsJob;
import com.devops.entity.Template;
/**
*
* SysUser
*
*/
public interface IJobService extends IService<JenkinsJob> {
public void insertJob(JenkinsJob job,Template tpl)throws Exception ;
public void updateJob(JenkinsJob job) throws Exception;
void delete(Integer id,String jobName)throws Exception;
public void restartPipeline(String jobName,int buildNum,String stageName)throws Exception;
void build(JenkinsJob job)throws Exception;
public void doBuild(JenkinsJob job);
Page<Map<Object, Object>> selectJobList(Page<Map<Object, Object>> page, Map<String ,Object> map);
} | [
"[email protected]"
] | |
c69d2ef6d0a42c97f5e1ec97ec0fd45db88dd5c4 | e36eaf56f9ab9c0e21454f410dc0572ae1bebcac | /UDPServer.java | e551b692c015542820065d1592b8bd22ad600e25 | [] | no_license | fabriciolopesm/SD1 | 71138f1f2467035adceee6d684052e0984abb439 | 81704c6b9e8cbe79ec306c1886b986c1966facbf | refs/heads/master | 2020-07-19T04:48:29.627939 | 2019-09-04T17:40:25 | 2019-09-04T17:40:25 | 206,376,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | import java.net.*;
import java.io.*;
public class UDPServer{
public static void main(String args[]){
DatagramSocket aSocket = null;
try{
aSocket = new DatagramSocket(6789);
byte[] buffer = new byte[1000];
byte[] enviar = new byte[1000];
while(true){
DatagramPacket request = new DatagramPacket(buffer, buffer.length);
aSocket.receive(request);
System.out.println("Request: " + new String(request.getData()));
InetAddress aHost = request.getAddress();
int serverPort = request.getPort();
String send = new String(request.getData());
enviar = send.getBytes();
DatagramPacket sendPacket = new DatagramPacket(enviar,
enviar.length, aHost, serverPort);
aSocket.send(sendPacket);
}
}catch (SocketException e){System.out.println("Socket: " + e.getMessage());
}catch (IOException e) {System.out.println("IO: " + e.getMessage());}
finally {if(aSocket != null) aSocket.close();}
}
}
| [
"[email protected]"
] | |
859f1da776e37f1ed9b6fccfd520441e8d7c38cd | aced47fa8684cffe5a95880305de4dfda16712f3 | /CodeInTheAir/src/com/Android/CodeInTheAir/Events/CallbackManager.java | 972f5bf69e80d769c89734665f5d3007ec6d9e87 | [] | no_license | anirudhSK/cita | ff176b7e18ea94d719bebd7b3c6b8bbefc582b15 | 9c54d26aa63268b88526dbe1ab84773248925220 | refs/heads/master | 2020-05-22T14:10:03.805098 | 2012-06-26T01:49:58 | 2012-06-26T01:49:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,056 | java | package com.Android.CodeInTheAir.Events;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import android.util.Log;
import com.Android.CodeInTheAir.Callback.Callback_Accl_Data;
import com.Android.CodeInTheAir.Callback.Callback_Accl_Shake;
import com.Android.CodeInTheAir.Callback.Callback_Accl_Walking;
import com.Android.CodeInTheAir.Callback.Callback_Constants.ResultCode;
import com.Android.CodeInTheAir.Callback.Callback_Constants.StopCode;
import com.Android.CodeInTheAir.Callback.Callback_GSM_CellChange;
import com.Android.CodeInTheAir.Callback.Callback_GSM_RSSIChange;
import com.Android.CodeInTheAir.Callback.Callback_Generic;
import com.Android.CodeInTheAir.Callback.Callback_Listener_Interface;
import com.Android.CodeInTheAir.Callback.Callback_Sample_Accl;
import com.Android.CodeInTheAir.Callback.Callback_Sample_GSM;
public class CallbackManager
{
static ConcurrentHashMap<String, String> hEventStrCbId;
static ConcurrentHashMap<String, String> hCbIdEventStr;
static ConcurrentHashMap<String, Callback_Generic> hCbIdCallbackObj;
static ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>> hTaskEventActionTagSubId;
static ConcurrentHashMap<String, ConcurrentHashMap<String, CallbackInfo>> hCbIdSubIdCallbackInfo;
static ConcurrentHashMap<String, String> hSubIdCbId;
private static ReentrantReadWriteLock lock;
public static void init()
{
hEventStrCbId = new ConcurrentHashMap<String, String>();
hCbIdEventStr = new ConcurrentHashMap<String, String>();
hCbIdCallbackObj = new ConcurrentHashMap<String, Callback_Generic>();
hCbIdSubIdCallbackInfo = new ConcurrentHashMap<String, ConcurrentHashMap<String, CallbackInfo>>();
hTaskEventActionTagSubId = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>>();
hSubIdCbId = new ConcurrentHashMap<String, String>();
lock = new ReentrantReadWriteLock();
}
public static String addCallback(
String taskId, String source,
String event, String param, String action, String tag
)
{
String eventStr = event + param;
String subId = TaskUtils.getUniqueId();
CallbackInfo callbackInfo = new CallbackInfo(taskId, source, event, action, tag);
String cbId = null;
Callback_Generic callbackObj = null;
lock.writeLock().lock();
try
{
if (!hEventStrCbId.containsKey(eventStr))
{
cbId = TaskUtils.getUniqueId();
callbackObj = getCallbackObj(event);
if (callbackObj == null)
{
return null;
}
Log.v("CITA:Param-----------", param);
boolean initResult = callbackObj.initParams(param);
if (!initResult)
{
return null;
}
callbackObj.setCallbackId(cbId);
}
else
{
cbId = hEventStrCbId.get(eventStr);
}
if (!hTaskEventActionTagSubId.containsKey(taskId))
{
hTaskEventActionTagSubId.put(taskId, new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>());
}
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (!hEventActionTagSubId.containsKey(event))
{
hEventActionTagSubId.put(event, new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>());
}
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
if (!hActionTagSubId.containsKey(action))
{
hActionTagSubId.put(action, new ConcurrentHashMap<String, String>());
}
ConcurrentHashMap<String, String> hTagSubId = hActionTagSubId.get(action);
if (!hTagSubId.containsKey(tag))
{
hTagSubId.put(tag, subId);
}
else
{
subId = hTagSubId.get(tag);
return subId;
}
hSubIdCbId.put(subId, cbId);
if (!hEventStrCbId.containsKey(eventStr))
{
callbackObj.start();
hEventStrCbId.put(eventStr, cbId);
hCbIdEventStr.put(cbId, eventStr);
hCbIdCallbackObj.put(cbId, callbackObj);
hCbIdSubIdCallbackInfo.put(cbId, new ConcurrentHashMap<String, CallbackInfo>());
}
ConcurrentHashMap<String, CallbackInfo> hSubIdCallbackInfo = hCbIdSubIdCallbackInfo.get(cbId);
hSubIdCallbackInfo.put(subId, callbackInfo);
}
catch (Exception e)
{
}
finally
{
lock.writeLock().unlock();
}
return subId;
}
public static void removeCallback(
String taskId,
String event, String action, String tag,
boolean isLocked
)
{
if (!isLocked)
{
lock.writeLock().lock();
}
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (hEventActionTagSubId.containsKey(event))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
if (hActionTagSubId.containsKey(action))
{
ConcurrentHashMap<String, String> hTagSubId = hActionTagSubId.get(action);
if (hTagSubId.containsKey(tag))
{
String subId = hTagSubId.get(tag);
String cbId = hSubIdCbId.get(subId);
hCbIdSubIdCallbackInfo.get(cbId).remove(subId);
if (hCbIdSubIdCallbackInfo.get(cbId).keySet().size() == 0)
{
Callback_Generic callbackObj = hCbIdCallbackObj.get(cbId);
callbackObj.stop();
String eventStr = hCbIdEventStr.get(cbId);
hEventStrCbId.remove(eventStr);
hCbIdEventStr.remove(cbId);
hCbIdCallbackObj.remove(cbId);
hCbIdSubIdCallbackInfo.remove(cbId);
}
hTagSubId.remove(tag);
hSubIdCbId.remove(subId);
}
}
if (hActionTagSubId.get(action).keySet().size() == 0)
{
hActionTagSubId.remove(action);
}
}
if (hEventActionTagSubId.get(event).keySet().size() == 0)
{
hEventActionTagSubId.remove(event);
}
}
if (hTaskEventActionTagSubId.get(taskId).keySet().size() == 0)
{
hTaskEventActionTagSubId.remove(taskId);
}
if (!isLocked)
{
lock.writeLock().unlock();
}
}
public static void removeCallback(
String taskId,
String event, String action,
boolean isLocked
)
{
if (!isLocked)
{
lock.writeLock().lock();
}
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (hEventActionTagSubId.containsKey(event))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
if (hActionTagSubId.containsKey(action))
{
ConcurrentHashMap<String, String> hTagSubId = hActionTagSubId.get(action);
Iterator<String> i = hTagSubId.keySet().iterator();
while (i.hasNext())
{
String tag = i.next();
removeCallback(taskId, event, action, tag, true);
}
}
}
}
if (!isLocked)
{
lock.writeLock().unlock();
}
}
public static void removeCallback(
String taskId,
String event,
boolean isLocked
)
{
if (!isLocked)
{
lock.writeLock().lock();
}
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (hEventActionTagSubId.containsKey(event))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
Iterator<String> i = hActionTagSubId.keySet().iterator();
while (i.hasNext())
{
String action = i.next();
Log.v("CITA:ConcurrentHashMap", taskId + " " + event + action);
removeCallback(taskId, event, action, true);
}
}
}
if (!isLocked)
{
lock.writeLock().unlock();
}
}
public static void removeCallback(String taskId)
{
lock.writeLock().lock();
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
Iterator<String> i = hEventActionTagSubId.keySet().iterator();
while (i.hasNext())
{
String event = i.next();
removeCallback(taskId, event, true);
}
}
lock.writeLock().unlock();
}
public static void removeCallbackId(String subId)
{
lock.writeLock().lock();
if (hSubIdCbId.containsKey(subId))
{
String cbId = hSubIdCbId.get(subId);
CallbackInfo callbackInfo = hCbIdSubIdCallbackInfo.get(cbId).get(subId);
removeCallback(callbackInfo.taskId, callbackInfo.event, callbackInfo.action, callbackInfo.tag, true);
}
lock.writeLock().unlock();
}
private static void removeCallbackCbId(String cbId)
{
lock.writeLock().lock();
if (hCbIdSubIdCallbackInfo.containsKey(cbId))
{
Iterator<String> i = hCbIdSubIdCallbackInfo.get(cbId).keySet().iterator();
while (i.hasNext())
{
removeCallbackId(i.next());
}
}
lock.writeLock().unlock();
}
public static Callback_Generic getCallbackObj(String event)
{
if (event.equalsIgnoreCase("accl.data"))
{
return new Callback_Accl_Data(new CallbackListener());
}
if (event.equalsIgnoreCase("accl.sample"))
{
return new Callback_Sample_Accl(new CallbackListener());
}
if (event.equalsIgnoreCase("gsm.cellChange"))
{
return new Callback_GSM_CellChange(new CallbackListener());
}
if (event.equalsIgnoreCase("gsm.rssiChange"))
{
return new Callback_GSM_RSSIChange(new CallbackListener());
}
if (event.equalsIgnoreCase("gsm.sample"))
{
return new Callback_Sample_GSM(new CallbackListener());
}
if (event.equalsIgnoreCase("shake"))
{
return new Callback_Accl_Shake(new CallbackListener());
}
if (event.equalsIgnoreCase("walking"))
{
return new Callback_Accl_Walking(new CallbackListener());
}
return null;
}
static class CallbackListener implements Callback_Listener_Interface
{
public void event(String cbId, ResultCode resultCode, String valueType, String value)
{
Log.v("CITA:event", "event");
List<CallbackInfo> lstCallbackInfo = new ArrayList<CallbackInfo>();
lock.readLock().lock();
if (hCbIdSubIdCallbackInfo.containsKey(cbId))
{
Iterator<String> i = hCbIdSubIdCallbackInfo.get(cbId).keySet().iterator();
while (i.hasNext())
{
String subId = i.next();
CallbackInfo callbackInfo = hCbIdSubIdCallbackInfo.get(cbId).get(subId);
lstCallbackInfo.add(callbackInfo);
}
}
lock.readLock().unlock();
Log.v("CITA:event", lstCallbackInfo.size() + "");
for (int i = 0; i < lstCallbackInfo.size(); i++)
{
CallbackInfo callbackInfo = lstCallbackInfo.get(i);
long time = System.currentTimeMillis();
Event_Callback_Data event = new Event_Callback_Data(time, callbackInfo.source,
callbackInfo.event, callbackInfo.action, callbackInfo.tag,
resultCode, valueType, value);
Task task = TaskManager.getTask(callbackInfo.taskId);
if (task != null)
{
task.getTaskContext().postEvent(event);
}
}
}
public void stop(String cbId, StopCode stopCode)
{
if (stopCode != StopCode.CALL)
{
removeCallbackCbId(cbId);
}
}
}
}
| [
"[email protected]"
] | |
d9d857059da10c6045b53d4d71093bb6f6e80f7b | dc49c77325e801959163c386b832f8e0a8a0089e | /src/Airplane/cabin/Meal.java | 4ed7b0ae6a5d7bef986cf30c3e574162483dc0ce | [] | no_license | Herbert-Karl/Software-Engineering-I | f2e78cf2ed169199f8b60bdfe72a752a48547fe0 | fe5ea077fd3e928d4bfafc0ce459a1a4e994f514 | refs/heads/master | 2020-04-02T05:48:56.653090 | 2019-01-07T14:27:20 | 2019-01-07T14:27:20 | 154,107,562 | 9 | 25 | null | 2019-01-07T14:10:15 | 2018-10-22T08:07:41 | Java | UTF-8 | Java | false | false | 420 | java | package Airplane.cabin;
public class Meal {
private String description;
private double weight;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
}
| [
"[email protected]"
] | |
da626828eac6ece1a8c6a03a20a7fd0a06bb3614 | ddc0744590673e6ec51d2ca47b8f534f1d794f32 | /src/main/test/com/mobiquity/service/FileServiceImplTest.java | 4c61a0f77f4f4114a5783a3e7e7d4121bec57fec | [] | no_license | tomassirio/Backend-code-assignment---Mobiquity-2021 | 4e33eeaad47b10a69f4dc62ea2486d6733a84db0 | e7e2a2162301e2f3354a8e5323d64af8fcf173c4 | refs/heads/master | 2023-05-06T13:15:35.100413 | 2021-05-26T00:29:03 | 2021-05-26T00:29:03 | 370,475,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,708 | java | package com.mobiquity.service;
import com.mobiquity.exception.APIException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
@RunWith(PowerMockRunner.class)
@PrepareForTest(FileServiceImpl.class)
@PowerMockIgnore("jdk.internal.reflect.*")
public class FileServiceImplTest {
@Mock
FileServiceImpl fileService;
@Test
public void openFileHappyPath() throws APIException {
when(fileService.openFile(any())).thenReturn(new File("src/main/test/resources/test_file"));
assertEquals(fileService.openFile("Test"), new File("src/main/test/resources/test_file"));
}
@Test(expected = APIException.class)
public void openFileThrowsWrongPathException() throws APIException {
doThrow(APIException.class)
.when(fileService)
.openFile(anyString());
fileService.openFile(anyString());
}
@Test(expected = IOException.class)
public void openFileThrowsWrongFormatException() throws APIException {
doThrow(IOException.class)
.when(fileService)
.openFile(anyString());
fileService.openFile(anyString());
}
@Test
public void writeToFileHappyPath() {
File file = new File("src/main/test/resources/test_file");
try {
doNothing().when(fileService).writeToPath(file.getPath(), "Lorem Ipsum");
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
assertEquals(scanner.nextLine(), "Lorem Ipsum");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (APIException e) {
e.printStackTrace();
}
}
@Test(expected = APIException.class)
public void writeToFileWhichDoesntExist() throws APIException {
File file = new File("sample");
try {
doNothing().when(fileService).writeToPath(file.getPath(), "Lorem Ipsum");
Scanner scanner = new Scanner(file);
} catch (FileNotFoundException e) {
throw new APIException("File was not found", e);
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
7dd1174a90b6da2f5ef01818f7aa389b53805e60 | 5d3d78d93c49823a91f5e1e18bd1565893002321 | /src/main/java/org/gwtproject/i18n/shared/cldr/impl/NumberConstantsImpl_en_TO.java | 78a0259224222abd1b0b52ab8a6b4c2757cb857f | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | vegegoku/gwt-i18n-cldr | ecf38343c0448bab21118c8cdc017ed91b628e71 | fdf25c7f898993a50ef9d10fe41ccc44c1ee500f | refs/heads/master | 2021-06-11T05:07:57.695293 | 2020-08-27T08:26:12 | 2020-08-27T08:26:12 | 128,426,644 | 2 | 1 | null | 2020-07-17T17:29:11 | 2018-04-06T17:38:54 | Java | UTF-8 | Java | false | false | 2,382 | java | // /*
// * Copyright 2012 Google Inc.
// *
// * Licensed under the Apache License, Version 2.0 (the "License"); you may not
// * use this file except in compliance with the License. You may obtain a copy of
// * the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// * License for the specific language governing permissions and limitations under
// * the License.
// */
//
package org.gwtproject.i18n.shared.cldr.impl;
import java.lang.Override;
import java.lang.String;
import javax.annotation.Generated;
import org.gwtproject.i18n.shared.cldr.NumberConstantsImpl;
@Generated("gwt-cldr-importer : org.gwtproject.tools.cldr.NumberConstantsProcessor, CLDR version : release-34")
public class NumberConstantsImpl_en_TO implements NumberConstantsImpl {
@Override
public String notANumber() {
return "NaN";
}
@Override
public String decimalPattern() {
return "#,##0.###";
}
@Override
public String decimalSeparator() {
return ".";
}
@Override
public String defCurrencyCode() {
return "TOP";
}
@Override
public String exponentialSymbol() {
return "E";
}
@Override
public String groupingSeparator() {
return ",";
}
@Override
public String infinity() {
return "∞";
}
@Override
public String minusSign() {
return "-";
}
@Override
public String monetaryGroupingSeparator() {
return ",";
}
@Override
public String monetarySeparator() {
return ".";
}
@Override
public String percent() {
return "%";
}
@Override
public String percentPattern() {
return "#,##0%";
}
@Override
public String perMill() {
return "‰";
}
@Override
public String plusSign() {
return "+";
}
@Override
public String scientificPattern() {
return "#E0";
}
@Override
public String currencyPattern() {
return "¤#,##0.00";
}
@Override
public String simpleCurrencyPattern() {
return "¤¤¤¤#,##0.00";
}
@Override
public String globalCurrencyPattern() {
return "¤¤¤¤#,##0.00 ¤¤";
}
@Override
public String zeroDigit() {
return "0";
}
}
| [
"[email protected]"
] | |
d908bad6a83881962c9f00d7aa722d2cc2de4775 | 1620a03731950562567a6427ae4e8c431a90442d | /JUnitTests/app/src/main/java/com/example/sandicarobert/junittests/MainActivity.java | bb2f1b9b2508b5836f17996e725835bbd1f5e062 | [] | no_license | sandicaRobert/UnitTests | d29523f010f238f6602ef252776c15a6459453ab | c8125aed2f6318df133f554dd5f9c66cdb2752a3 | refs/heads/master | 2021-01-01T04:04:31.052386 | 2016-05-06T17:58:54 | 2016-05-06T17:58:54 | 56,917,251 | 0 | 1 | null | 2016-05-06T17:58:54 | 2016-04-23T12:06:05 | Java | UTF-8 | Java | false | false | 349 | java | package com.example.sandicarobert.junittests;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
5d84db6898f2e0fa2179c305c86e665d7b4dd3ab | 02c248a868a2788cae024232cefd27abb2f00931 | /app/src/main/java/xyz/romakononovich/firebase/models/Message.java | 19ffc374c2c9447e9d74763b7b4cad9ab2946c62 | [] | no_license | romakononovich/Firebase | fe555d2d5c0fa5d12f325ffca6fdebb9b3d5c542 | 55dab4a23c26f3263b3d4b1f2c3e445bc77a2dfa | refs/heads/master | 2020-04-05T14:34:40.209241 | 2017-09-05T16:35:54 | 2017-09-05T16:35:54 | 94,694,121 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package xyz.romakononovich.firebase.models;
import java.util.Objects;
/**
* Created by romank on 13.06.17.
*/
public class Message {
private String time;
private String message;
private String title;
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Message{" +
"time='" + time + '\'' +
", message='" + message + '\'' +
", title='" + title + '\'' +
", id=" + id +
'}';
}
@Override
public boolean equals(Object obj) {
Message other = (Message) obj;
if (!Objects.equals(id, other.id)) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
026c1d669c58000a8ff5516f7438dc75d4173728 | 6ac9188162e53a028191962c4c7398cfd47ff250 | /topcoder/output/CombiningSlimes.java | 1e1b45740326a2da3a0383181b9ba63753619d27 | [] | no_license | mastersobg/contests | dbc83096be1b667c2546e6daba2f68472824d8eb | 822eda17a251e1ee978ff9265c2960c9d289986d | refs/heads/master | 2021-01-23T10:00:37.439738 | 2015-11-10T05:19:09 | 2015-11-10T05:19:09 | 2,923,871 | 0 | 1 | null | 2015-06-20T13:50:30 | 2011-12-06T10:09:40 | Java | UTF-8 | Java | false | false | 752 | java | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.List;
public class CombiningSlimes {
public int maxMascots(int[] a) {
List<Integer> list = ArraysUtil.asList(a);
int ret = 0;
while (list.size() > 1) {
int x = list.get(0);
int y = list.get(1);
list.remove((Integer) x);
list.remove((Integer) y);
list.add(x + y);
ret += x * y;
}
return ret;
}
}
class ArraysUtil {
public static List<Integer> asList(int[] arr) {
List<Integer> list = new ArrayList<Integer>(arr.length);
for (int a : arr)
list.add(a);
return list;
}
}
| [
"[email protected]"
] | |
cc50fa6666ba0aca7ba2eb381e2a7a471596debc | 6e07004a9f84f6c45911677e02e33ce503412bc8 | /client/android/prover-e/swypeidenterprise/src/main/java/io/prover/swypeid/enterprise/viewholder/model/Hints.java | 9f841452588566ce4453279e4ab7580cb4fbf01d | [] | no_license | ProverProject/prover-enterprise-public | d0b4d54bd53696946406b4013eaa799f1282303e | c30de48346f7a926d23f9e733706093d7ca7a307 | refs/heads/master | 2020-04-04T03:50:16.959537 | 2019-07-15T08:57:52 | 2019-07-15T08:57:52 | 155,727,930 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,640 | java | package io.prover.swypeid.enterprise.viewholder.model;
import io.prover.swypeid.enterprise.R;
public enum Hints {
Other, AllDone, MakeCircular, SwypeCodeFailed, NoMoney, VideoNotConfirmed, CalculatingVideoHash, VideoHashPosted, NetworkError,
ErrorPostingHash, FileHashAddedToBlockchain, LowContrast;
public Hint object() {
switch (this) {
case AllDone:
return new Hint.Builder(this)
.setMessage(R.string.swypeCodeOk, 3500)
.setImageId(R.drawable.ic_all_done, 2000)
.setMinifyDrawableId(R.drawable.ic_all_done_shrink)
.setStartDelay(1200)
.build();
case MakeCircular:
return new Hint.Builder(this)
.setMessage(R.string.makeProver, 5000)
.setImageId(R.drawable.make_circular_movement_animated, 2000)
.setMinifyDrawableId(R.drawable.make_circular_movement_minimize)
.setMinifiedDrawableId(R.drawable.make_circular_movement_minimized)
.setMinifiedDelay(15_000)
.setMinifiedRepeatCount(-1)
.build();
case VideoNotConfirmed:
return new Hint.Builder(this)
.setMessage(R.string.videoNotConfirmed, 4000)
.setImageId(R.drawable.ic_not_verified_anim, 3000)
.build();
case SwypeCodeFailed:
return new Hint.Builder(this)
.setMessage(R.string.swypeCodeFailedTryAgain, 3500)
.setImageId(R.drawable.make_circular_movement_animated, 2000)
.setMinifyDrawableId(R.drawable.make_circular_movement_minimize)
.setMinifiedDrawableId(R.drawable.make_circular_movement_minimized)
.setMinifiedDelay(1500)
.setMinifiedRepeatCount(-1)
.setStartDelay(1000)
.build();
case NoMoney:
return new Hint.Builder(this)
.setMessage(R.string.notEnoughMoney, 3500)
.setImageId(R.drawable.no_money_anim, 3000)
.build();
case VideoHashPosted:
return new Hint.Builder(this)
.setMessage(R.string.videoHashPosted, 3000)
.build();
case CalculatingVideoHash:
return new Hint.Builder(this)
.setMessage(R.string.calculatingVideoHash, 4000)
.build();
case ErrorPostingHash:
return new Hint.Builder(this)
.setMessage(R.string.videoHashPostFailed, 4000)
.build();
case FileHashAddedToBlockchain:
return new Hint.Builder(this)
.setMessage(R.string.videoHashAddedToBlockchain, 3000)
.build();
case LowContrast:
return new Hint.Builder(this)
.setMessage(R.string.lowContrastWarning, Integer.MAX_VALUE)
.setUseTopHintView(false)
.setWarning(true)
.setAnimationTime(100)
.setMinHintVisibleTime(0)
.build();
default:
throw new RuntimeException("Not implemented for: " + this);
}
}
}
| [
"[email protected]"
] | |
d3834293b22c77ad622ec3b5eea7347b457d59b9 | fd0c6d66e12565fcf02fb51596ccc8a79000874b | /src/test/java/com/jsoniter/output/TestString.java | c834a285ba0d506159aa2089f878e0bbd9396ff1 | [
"MIT"
] | permissive | whitekat98/javaFinal | bd06da6e637ffa7bc1e7c88ee61dece0af432ca5 | 38bf262f7af8f8f5fab4e3b9df2a6e728365f9d7 | refs/heads/master | 2022-11-20T07:53:40.130895 | 2020-02-04T14:59:07 | 2020-02-04T14:59:07 | 238,229,167 | 0 | 0 | MIT | 2022-11-16T10:36:26 | 2020-02-04T14:43:45 | HTML | UTF-8 | Java | false | false | 507 | java | package com.jsoniter.output;
import com.jsoniter.spi.Config;
import junit.framework.TestCase;
public class TestString extends TestCase {
public void test_unicode() {
String output = JsonStream.serialize(new Config.ReBuilder().escapeUnicode(false).build(), "中文");
assertEquals("\"中文\"", output);
}
public void test_escape_control_character() {
String output = JsonStream.serialize(new String(new byte[]{0}));
assertEquals("\"\\u0000\"", output);
}
}
| [
"[email protected]"
] | |
702dacb779370ae88c5a6b80f7d6ba7c6c0f4bf0 | dedb0b71ad97f51a3db72cc8fa741be4c9e7c3c3 | /AndroidApp/app/src/main/java/com/example/ecg/ble/Utilidades/LocationPermission.java | 4fb7c697644cd3c83feebc6932b5579cf501b69e | [] | no_license | fabianastudillo/vitalhealthuc | eee56e939320c249675394e6525c7d4604a017ad | 117177752ac8e5c535edf24a3423e90973a414a9 | refs/heads/main | 2023-03-05T02:05:47.006505 | 2021-02-12T01:44:18 | 2021-02-12T01:44:18 | 338,193,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,770 | java | package com.example.ecg.ble.Utilidades;
import android.app.Activity;
import android.content.pm.PackageManager;
import com.polidea.rxandroidble2.RxBleClient;
import androidx.core.app.ActivityCompat;
public class LocationPermission {
private LocationPermission(){
}
private static final int REQUEST_PERMISSION_BLE_SCAN = 9358;
public static void requestLocationPermission(final Activity activity, final RxBleClient client) {
ActivityCompat.requestPermissions(
activity,
/*
* the below would cause a ArrayIndexOutOfBoundsException on API < 23. Yet it should not be called then as runtime
* permissions are not needed and RxBleClient.isScanRuntimePermissionGranted() returns `true`
*/
new String[]{client.getRecommendedScanRuntimePermissions()[0]},
REQUEST_PERMISSION_BLE_SCAN
);
}
public static boolean isRequestLocationPermissionGranted(final int requestCode, final String[] permissions,
final int[] grantResults, RxBleClient client) {
if (requestCode != REQUEST_PERMISSION_BLE_SCAN) {
return false;
}
String[] recommendedScanRuntimePermissions = client.getRecommendedScanRuntimePermissions();
for (int i = 0; i < permissions.length; i++) {
for (String recommendedScanRuntimePermission : recommendedScanRuntimePermissions) {
if (permissions[i].equals(recommendedScanRuntimePermission)
&& grantResults[i] == PackageManager.PERMISSION_GRANTED) {
return true;
}
}
}
return false;
}
}
| [
"[email protected]"
] | |
e1bec13110c7b0ae189368c4427e8be97afa79b9 | 437e47e6bd1803d491811f23de5be90be17bcec3 | /api/src/main/java/org/lpro/entity/Quantity.java | fa55c9a2bfed7f7c9bf47a1dabe2d3d323b07d89 | [] | no_license | MorganDbs/JavaAPI | 6a4172a7fcfac8dac2c0c581cdbc7286d537e855 | e3ebaa3188c069ceefed508183cf1e926eaeab26 | refs/heads/master | 2021-05-04T14:43:41.141937 | 2018-03-27T13:25:08 | 2018-03-27T13:25:08 | 120,208,965 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,012 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.lpro.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import static org.eclipse.persistence.sessions.remote.corba.sun.TransporterHelper.id;
/**
*
* @author morgan
*/
@Entity
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@NamedQuery(name="Quantity.findAll",query="SELECT q FROM Quantity q")
public class Quantity implements Serializable{
@Id
private String id;
private int quantity;
private String commande_id;
private String sandwich_id;
private String taille_id;
public Quantity(){}
public Quantity(int quantity, String commande_id, String sandwich_id, String taille_id){
this.quantity= quantity;
this.commande_id = commande_id;
this.sandwich_id = sandwich_id;
this.taille_id = taille_id;
}
public String getTaille_id() {
return taille_id;
}
public void setTaille_id(String taille_id) {
this.taille_id = taille_id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getCommande_id() {
return commande_id;
}
public void setCommande_id(String commande_id) {
this.commande_id = commande_id;
}
public String getSandwich_id() {
return sandwich_id;
}
public void setSandwich_id(String sandwich_id) {
this.sandwich_id = sandwich_id;
}
}
| [
"[email protected]"
] | |
873aa75a6cf7c6531510a5dd5b45838d0b2fb907 | c811b112852833555fc46b18a91142d48652ed21 | /CrfSvm/src/crfsvm/crf/een_phuong/semi_createUlbTrainingData.java | d565b0e5aa4a4b5ddfa6868d222df255e2567096 | [] | no_license | albaniliu/thesis-nlp | 1b8348d4718c092c75d01ec13d3d7183892996aa | 258b3f0fae531aa89576508b96eaecde9cd83f82 | refs/heads/master | 2021-01-19T18:08:05.337771 | 2011-11-01T17:08:46 | 2011-11-01T17:08:46 | 38,242,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,563 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* semi_createUlbTrainingData.java
*
* Created on Mar 8, 2011, 4:14:31 PM
*/
package crfsvm.crf.een_phuong;
import java.awt.Color;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.BadLocationException;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Document;
import javax.swing.text.Highlighter;
import javax.swing.text.Highlighter.HighlightPainter;
import javax.swing.text.JTextComponent;
import java.io.*; //my addition
import javax.swing.UIManager;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author Thien
*/
public class semi_createUlbTrainingData extends javax.swing.JFrame {
/** Creates new form semi_createUlbTrainingData */
public semi_createUlbTrainingData() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jTextField2 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setName("Form"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(semi_createUlbTrainingData.class);
jTextField1.setText(resourceMap.getString("inField.text")); // NOI18N
jTextField1.setName("inField"); // NOI18N
jButton1.setText(resourceMap.getString("inPutton.text")); // NOI18N
jButton1.setName("inPutton"); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
inButton_Action(evt);
}
});
jTextField2.setText(resourceMap.getString("outField.text")); // NOI18N
jTextField2.setName("outField"); // NOI18N
jButton2.setText(resourceMap.getString("outButton.text")); // NOI18N
jButton2.setName("outButton"); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
outButton_Action(evt);
}
});
jButton3.setText(resourceMap.getString("execute.text")); // NOI18N
jButton3.setName("execute"); // NOI18N
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jTextField2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(44, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(260, Short.MAX_VALUE)
.addComponent(jButton3)
.addGap(255, 255, 255))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2))
.addGap(27, 27, 27)
.addComponent(jButton3)
.addContainerGap(192, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void inButton_Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inButton_Action
// TODO add your handling code here:
JFileChooser choose = new JFileChooser();
ExampleFileFilter filter = new ExampleFileFilter("txt","txt File");
choose.addChoosableFileFilter(filter);
int f = choose.showOpenDialog(this);
if (f == JFileChooser.APPROVE_OPTION) {
File inFile = choose.getSelectedFile();
jTextField1.setText(inFile.getPath());
}
}//GEN-LAST:event_inButton_Action
private void outButton_Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outButton_Action
// TODO add your handling code here:
JFileChooser choose = new JFileChooser();
//ExampleFileFilter filter = new ExampleFileFilter();
//choose.addChoosableFileFilter(filter);
choose.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
//choose.setAcceptAllFileFilterUsed(false);
int f = choose.showOpenDialog(this);
if (f == JFileChooser.APPROVE_OPTION) {
File outFile = choose.getSelectedFile();
jTextField2.setText(outFile.getPath());
}
}//GEN-LAST:event_outButton_Action
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
BufferedWriter bw = null;
BufferedReader br = null;
try
{
String save = "", line = "",toAppend = "";
char c = 'a';
int len = 0;
br = new BufferedReader(new InputStreamReader(new FileInputStream(jTextField1.getText()), "UTF-8"));
while ((line = br.readLine()) != null)
{
line = line.trim();
toAppend = "";
c = 'a';
len = line.length();
if (line.length() != 0)
{
while (c != ' ')
{
c = line.charAt(len - 1);
len--;
}
save += line.substring(0, len).trim() + "\n";
}
else
save += "\n";
}
br.close();
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(jTextField2.getText()), "UTF-8"));
bw.write(save);
bw.flush();
bw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new semi_createUlbTrainingData().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
d15a9b3bebdf04fac00e0f151bffb208b34f87b4 | 1e671aad06682da80282dd83dece1937239a848f | /demo/src/com/zhaoqy/app/demo/page/vmall/adapter/HomePagerAdapter.java | 7cb747c464f07e47e202c01197bd5d095404f1d4 | [] | no_license | zhaoqingyue/EclipseStudy | 548671318b074c833d3e12b8dc6379a85e122576 | f2238125e55333a7651fec546f39fd23dee0197e | refs/heads/master | 2020-04-04T03:24:09.966018 | 2018-11-01T12:41:11 | 2018-11-01T12:41:11 | 155,712,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,066 | java | package com.zhaoqy.app.demo.page.vmall.adapter;
import java.util.List;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class HomePagerAdapter extends PagerAdapter
{
private List<ImageView> ivlist;
public HomePagerAdapter(List<ImageView> viewlist)
{
this.ivlist = viewlist;
}
public int getCount()
{
return ivlist.size()*100;
}
public boolean isViewFromObject(View arg0, Object arg1)
{
return arg0 == arg1;
}
public Object instantiateItem(ViewGroup container, int position)
{
position %= ivlist.size();
container.addView(ivlist.get(position), 0);
if (position<0)
{
position = ivlist.size()+position;
}
return ivlist.get(position);
}
public void destroyItem(ViewGroup container, int position, Object object)
{
position%=ivlist.size();
if (position<0)
{
position = ivlist.size()+position;
}
ImageView view = ivlist.get(position);
container.removeView(view);
}
}
| [
"[email protected]"
] | |
f09ef2aac724009afb9a8df0f6402af66fbd6813 | 76be1fb2b767c8ff5c448425817b872abf553c73 | /src/main/java/logcollector/SocketElement.java | cdf67e28005c422f72f7b07c8da9936170e3ec7b | [
"Apache-2.0"
] | permissive | ChoiJW/logcollector | 5717b64b3746e6ab9ebde71bcfb4960c10b7fba8 | 8fc5186b498de100aef4e3ba4dbcc4aa9dbbaf9a | refs/heads/master | 2021-04-28T14:42:51.828515 | 2018-02-20T13:05:03 | 2018-02-20T13:05:03 | 121,971,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,954 | java | package logcollector;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.ObjectInputStream;
import java.net.Socket;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.LoggingEvent;
// Contributors: Moses Hohman <[email protected]>
public class SocketElement implements Runnable {
Socket socket;
// LoggerRepository hierarchy;
ObjectInputStream ois;
String logType;
public SocketElement(Socket socket, String logType) {
this.socket = socket;
this.logType = logType;
// this.hierarchy = hierarchy;
try {
ois = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));
} catch (InterruptedIOException e) {
Thread.currentThread().interrupt();
// logger.error("Could not open ObjectInputStream to "+socket, e);
} catch (IOException e) {
// logger.error("Could not open ObjectInputStream to "+socket, e);
} catch (RuntimeException e) {
// logger.error("Could not open ObjectInputStream to "+socket, e);
}
}
// public
// void finalize() {
// System.err.println("-------------------------Finalize called");
// System.err.flush();
// }
public void run() {
LoggingEvent event;
// Logger remoteLogger;
try {
if (ois != null) {
while (true) {
// read an event from the wire
event = (LoggingEvent) ois.readObject();
// get a logger from the hierarchy. The name of the logger is taken to be the
// name contained in the event.
// remoteLogger = hierarchy.getLogger(event.getLoggerName());
// event.logger = remoteLogger;
System.out.println(this.logType + " : " + event.getMessage());
// apply the logger-level filter
/*
* if (event.getLevel().isGreaterOrEqual(remoteLogger.getEffectiveLevel())) { //
* finally log the event as if was generated locally
* remoteLogger.callAppenders(event); }
*/
}
}
} catch (java.io.EOFException e) {
// logger.info("Caught java.io.EOFException closing conneciton.");
} catch (java.net.SocketException e) {
// logger.info("Caught java.net.SocketException closing conneciton.");
} catch (InterruptedIOException e) {
Thread.currentThread().interrupt();
// logger.info("Caught java.io.InterruptedIOException: " + e);
// logger.info("Closing connection.");
} catch (IOException e) {
// logger.info("Caught java.io.IOException: " + e);
// logger.info("Closing connection.");
} catch (Exception e) {
// logger.error("Unexpected exception. Closing conneciton.", e);
} finally {
if (ois != null) {
try {
ois.close();
} catch (Exception e) {
// logger.info("Could not close connection.", e);
}
}
if (socket != null) {
try {
socket.close();
} catch (InterruptedIOException e) {
Thread.currentThread().interrupt();
} catch (IOException ex) {
}
}
}
}
}
| [
"[email protected]"
] | |
4e387e558c4b043838eaa904c14bbc4ae6e7829f | e9dbdb017ec4ca2ad396286ecf379923683cc6bb | /SobelEdgeDetection/src/main/EdgeDetection.java | 1cb2c07a1c5cb9de31e1f238de5168a7b3be0408 | [] | no_license | eman3220/sobelEdgeDetection | 382a1dada3d341a7184f069a9dff2fdd23f43e62 | 5eafe880518e3bb825640746a8eb1f4a287c2b38 | refs/heads/master | 2021-01-23T12:35:06.168540 | 2014-08-03T22:28:38 | 2014-08-03T22:28:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,737 | java | package main;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
* Author: Emmanuel Godinez 300251168
*
* input: image file. Only use .png files. (note: tiff images don't seem to like
* java's BufferedImage class) output: image file with edge detection highlights
*
*/
public class EdgeDetection {
public static void main(String[] args) {
if (args.length != 1) {
JOptionPane.showMessageDialog(null, "One argument please");
return;
}
if (!args[0].endsWith(".png")) {
JOptionPane.showMessageDialog(null, "PNG file please");
return;
}
new EdgeDetection(args[0]);
}
public EdgeDetection(String imagepath) {
int[][] img = ImageHandler.readImage(imagepath);
ImageHandler.displayImage("original", img);
// create convolution masks
// Vertical Mask
double[][] rowMask = { { -1, -2, -1 }, { 0, 0, 0 }, { 1, 2, 1 } };
// Horizontal Mask
double[][] columnMask = { { -1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } };
// Apply convolution masks
int[][] rowOutput = ImageHandler.applyConvolutionMask(img, rowMask);
ImageHandler.brightenImage(rowOutput);
ImageHandler.displayImage("Row Output", rowOutput);
int[][] columnOutput = ImageHandler.applyConvolutionMask(img,
columnMask);
ImageHandler.brightenImage(columnOutput);
ImageHandler.displayImage("Column Output", columnOutput);
// combine images
int[][] finalOutput = new int[columnOutput.length][columnOutput[0].length];
int maxVal = Integer.MIN_VALUE;
int minVal = Integer.MAX_VALUE;
for (int y = 0; y < columnOutput[0].length; y++) {
for (int x = 0; x < columnOutput.length; x++) {
finalOutput[x][y] = (rowOutput[x][y]+columnOutput[x][y])/2;
// finalOutput[x][y] =
// (int)Math.tanh(rowOutput[x][y]/columnOutput[x][y]);
// finalOutput[x][y] = (int) Math.sqrt(Math
// .pow(rowOutput[x][y], 2)
// * Math.pow(columnOutput[x][y], 2));
if (finalOutput[x][y] < minVal) {
minVal = finalOutput[x][y];
}
if (finalOutput[x][y] > maxVal) {
maxVal = finalOutput[x][y];
}
}
}
// fix image
int range = maxVal - minVal;
for (int y = 0; y < finalOutput[0].length; y++) {
for (int x = 0; x < finalOutput.length; x++) {
double temporary1 = (double) Math.abs(finalOutput[x][y])
/ (double) range;
double temporary2 = temporary1 * 255;
finalOutput[x][y] = (int) temporary2;
}
}
ImageHandler.brightenImage(finalOutput);
try {
Thread.sleep(30);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ImageHandler.displayImage("Final", finalOutput);
}
}
| [
"[email protected]"
] | |
1602b02aa3751dab3e8602c002b38041c78abe92 | 7ad54455ccfdd0c2fa6c060b345488ec8ebb1cf4 | /com/ibm/icu/text/RuleBasedBreakIterator.java | 4feaa169c00814b095e4ce17988baeb25b2ee82b | [] | no_license | chetanreddym/segmentation-correction-tool | afdbdaa4642fcb79a21969346420dd09eea72f8c | 7ca3b116c3ecf0de3a689724e12477a187962876 | refs/heads/master | 2021-05-13T20:09:00.245175 | 2018-01-10T04:42:03 | 2018-01-10T04:42:03 | 116,817,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 54,372 | java | package com.ibm.icu.text;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.util.CompactByteArray;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
public class RuleBasedBreakIterator
extends BreakIterator
{
protected static final byte IGNORE = -1;
private static final String IGNORE_VAR = "_ignore_";
private static final short START_STATE = 1;
private static final short STOP_STATE = 0;
private String description;
private CompactByteArray charCategoryTable = null;
private short[] stateTable = null;
private short[] backwardsStateTable = null;
private boolean[] endStates = null;
private boolean[] lookaheadStates = null;
private int numCategories;
private CharacterIterator text = null;
public RuleBasedBreakIterator(String description)
{
this.description = description;
Builder builder = makeBuilder();
builder.buildBreakIterator();
}
protected Builder makeBuilder()
{
return new Builder();
}
public Object clone()
{
RuleBasedBreakIterator result = (RuleBasedBreakIterator)super.clone();
if (text != null) {
text = ((CharacterIterator)text.clone());
}
return result;
}
public boolean equals(Object that)
{
try
{
RuleBasedBreakIterator other = (RuleBasedBreakIterator)that;
if (!description.equals(description)) {
return false;
}
if (text == null) {
return text == null;
}
return text.equals(text);
}
catch (ClassCastException e) {}
return false;
}
public String toString()
{
return description;
}
public int hashCode()
{
return description.hashCode();
}
public void debugDumpTables()
{
System.out.println("Character Classes:");
int currentCharClass = 257;
int startCurrentRange = 0;
int initialStringLength = 0;
StringBuffer[] charClassRanges = new StringBuffer[numCategories];
for (int i = 0; i < numCategories; i++) {
charClassRanges[i] = new StringBuffer();
}
for (int i = 0; i < 65535; i++) {
if (charCategoryTable.elementAt((char)i) != currentCharClass) {
if (currentCharClass != 257)
{
if (i != startCurrentRange + 1) {
charClassRanges[currentCharClass].append("-" + Integer.toHexString(i - 1));
}
if (charClassRanges[currentCharClass].length() % 72 < initialStringLength % 72) {
charClassRanges[currentCharClass].append("\n ");
}
}
currentCharClass = charCategoryTable.elementAt((char)i);
startCurrentRange = i;
initialStringLength = charClassRanges[currentCharClass].length();
if (charClassRanges[currentCharClass].length() > 0)
charClassRanges[currentCharClass].append(", ");
charClassRanges[currentCharClass].append(Integer.toHexString(i));
}
}
for (int i = 0; i < numCategories; i++) {
System.out.println(i + ": " + charClassRanges[i]);
}
System.out.println("\n\nState Table. *: end state %: look ahead state");
System.out.print("C:\t");
for (int i = 0; i < numCategories; i++)
System.out.print(Integer.toString(i) + "\t");
System.out.println();System.out.print("=================================================");
for (int i = 0; i < stateTable.length; i++) {
if (i % numCategories == 0) {
System.out.println();
if (endStates[(i / numCategories)] != 0) {
System.out.print("*");
} else
System.out.print(" ");
if (lookaheadStates[(i / numCategories)] != 0) {
System.out.print("%");
}
else
System.out.print(" ");
System.out.print(Integer.toString(i / numCategories) + ":\t");
}
if (stateTable[i] == 0) {
System.out.print(".\t");
} else {
System.out.print(Integer.toString(stateTable[i]) + "\t");
}
}
System.out.println();
}
public void writeTablesToFile(FileOutputStream file, boolean littleEndian)
throws IOException
{
DataOutputStream out = new DataOutputStream(file);
byte[] comment = "Copyright (C) 1999, International Business Machines Corp. and others. All Rights Reserved.".getBytes("US-ASCII");
short headerSize = (short)(comment.length + 1 + 24);
short realHeaderSize = (short)(headerSize + (headerSize % 16 == 0 ? 0 : 16 - headerSize % 16));
writeSwappedShort(realHeaderSize, out, littleEndian);
out.write(218);
out.write(39);
writeSwappedShort((short)20, out, littleEndian);
writeSwappedShort((short)0, out, littleEndian);
if (littleEndian) {
out.write(0);
} else {
out.write(1);
}
out.write(0);
out.write(2);
out.write(0);
out.writeInt(1112689491);
out.writeInt(0);
out.writeInt(0);
out.write(comment);
out.write(0);
while (headerSize < realHeaderSize) {
out.write(0);
headerSize = (short)(headerSize + 1);
}
writeSwappedInt(numCategories, out, littleEndian);
int fileEnd = 36;
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += (description.length() + 1) * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += charCategoryTable.getIndexArray().length * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += charCategoryTable.getValueArray().length;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += stateTable.length * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += backwardsStateTable.length * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += endStates.length;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += lookaheadStates.length;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
for (int i = 0; i < description.length(); i++)
writeSwappedShort((short)description.charAt(i), out, littleEndian);
out.writeShort(0);
if ((description.length() + 1) % 2 == 1) {
out.writeShort(0);
}
char[] temp1 = charCategoryTable.getIndexArray();
for (int i = 0; i < temp1.length; i++)
writeSwappedShort((short)temp1[i], out, littleEndian);
if (temp1.length % 2 == 1)
out.writeShort(0);
byte[] temp2 = charCategoryTable.getValueArray();
out.write(temp2);
switch (temp2.length % 4) {
case 1: out.write(0);
case 2: out.write(0);
case 3: out.write(0);
}
for (int i = 0; i < stateTable.length; i++)
writeSwappedShort(stateTable[i], out, littleEndian);
if (stateTable.length % 2 == 1)
out.writeShort(0);
for (int i = 0; i < backwardsStateTable.length; i++)
writeSwappedShort(backwardsStateTable[i], out, littleEndian);
if (backwardsStateTable.length % 2 == 1) {
out.writeShort(0);
}
for (int i = 0; i < endStates.length; i++)
out.writeBoolean(endStates[i]);
switch (endStates.length % 4) {
case 1: out.write(0);
case 2: out.write(0);
case 3: out.write(0);
}
for (int i = 0; i < lookaheadStates.length; i++)
out.writeBoolean(lookaheadStates[i]);
switch (lookaheadStates.length % 4) {
case 1: out.write(0);
case 2: out.write(0);
case 3: out.write(0);
}
}
protected void writeSwappedShort(short x, DataOutputStream out, boolean littleEndian)
throws IOException
{
if (littleEndian) {
out.write((byte)(x & 0xFF));
out.write((byte)(x >> 8 & 0xFF));
}
else {
out.write((byte)(x >> 8 & 0xFF));
out.write((byte)(x & 0xFF));
}
}
protected void writeSwappedInt(int x, DataOutputStream out, boolean littleEndian)
throws IOException
{
if (littleEndian) {
out.write((byte)(x & 0xFF));
out.write((byte)(x >> 8 & 0xFF));
out.write((byte)(x >> 16 & 0xFF));
out.write((byte)(x >> 24 & 0xFF));
}
else {
out.write((byte)(x >> 24 & 0xFF));
out.write((byte)(x >> 16 & 0xFF));
out.write((byte)(x >> 8 & 0xFF));
out.write((byte)(x & 0xFF));
}
}
public int first()
{
CharacterIterator t = getText();
t.first();
return t.getIndex();
}
public int last()
{
CharacterIterator t = getText();
t.setIndex(t.getEndIndex());
return t.getIndex();
}
public int next(int n)
{
int result = current();
while (n > 0) {
result = handleNext();
n--;
}
while (n < 0) {
result = previous();
n++;
}
return result;
}
public int next()
{
return handleNext();
}
public int previous()
{
CharacterIterator text = getText();
if (current() == text.getBeginIndex()) {
return -1;
}
int start = current();
text.previous();
int lastResult = handlePrevious();
int result = lastResult;
while ((result != -1) && (result < start)) {
lastResult = result;
result = handleNext();
}
text.setIndex(lastResult);
return lastResult;
}
protected static final void checkOffset(int offset, CharacterIterator text)
{
if ((offset < text.getBeginIndex()) || (offset > text.getEndIndex())) {
throw new IllegalArgumentException("offset out of bounds");
}
}
public int following(int offset)
{
CharacterIterator text = getText();
if (offset == text.getEndIndex()) {
return -1;
}
checkOffset(offset, text);
text.setIndex(offset);
if (offset == text.getBeginIndex()) {
return handleNext();
}
int result = handlePrevious();
while ((result != -1) && (result <= offset)) {
result = handleNext();
}
return result;
}
public int preceding(int offset)
{
CharacterIterator text = getText();
checkOffset(offset, text);
text.setIndex(offset);
return previous();
}
public boolean isBoundary(int offset)
{
CharacterIterator text = getText();
checkOffset(offset, text);
if (offset == text.getBeginIndex()) {
return true;
}
return following(offset - 1) == offset;
}
public int current()
{
return getText().getIndex();
}
public CharacterIterator getText()
{
if (text == null) {
text = new StringCharacterIterator("");
}
return text;
}
public void setText(CharacterIterator newText)
{
int end = newText.getEndIndex();
newText.setIndex(end);
if (newText.getIndex() != end)
{
text = new SafeCharIterator(newText);
}
else {
text = newText;
}
text.first();
}
protected int handleNext()
{
CharacterIterator text = getText();
if (text.getIndex() == text.getEndIndex()) {
return -1;
}
int result = text.getIndex() + 1;
int lookaheadResult = 0;
int state = 1;
char c = text.current();
char lastC = c;
int lastCPos = 0;
if (lookupCategory(c) == -1) {
while (lookupCategory(c) == -1) {
c = text.next();
}
if ((Character.getType(c) == 6) || (Character.getType(c) == 7))
{
return text.getIndex();
}
}
while ((c != 65535) && (state != 0))
{
int category = lookupCategory(c);
if (category != -1) {
state = lookupState(state, category);
}
if (lookaheadStates[state] != 0) {
if (endStates[state] != 0) {
if (lookaheadResult > 0) {
result = lookaheadResult;
}
else {
result = text.getIndex() + 1;
}
}
else {
lookaheadResult = text.getIndex() + 1;
}
}
else if (endStates[state] != 0) {
result = text.getIndex() + 1;
}
if ((category != -1) && (state != 0)) {
lastC = c;
lastCPos = text.getIndex();
}
c = text.next();
}
if ((c == 65535) && (lookaheadResult == text.getEndIndex())) {
result = lookaheadResult;
}
else if ("\n\r\f
".indexOf(lastC) != -1) {
result = lastCPos + 1;
}
text.setIndex(result);
return result;
}
protected int handlePrevious()
{
CharacterIterator text = getText();
int state = 1;
int category = 0;
int lastCategory = 0;
char c = text.current();
while ((c != 65535) && (state != 0))
{
lastCategory = category;
category = lookupCategory(c);
if (category != -1) {
state = lookupBackwardState(state, category);
}
c = text.previous();
}
if (c != 65535) {
if (lastCategory != -1) {
text.setIndex(text.getIndex() + 2);
}
else {
text.next();
}
}
return text.getIndex();
}
protected int lookupCategory(char c)
{
return charCategoryTable.elementAt(c);
}
protected int lookupState(int state, int category)
{
return stateTable[(state * numCategories + category)];
}
protected int lookupBackwardState(int state, int category)
{
return backwardsStateTable[(state * numCategories + category)];
}
private static UnicodeSet intersection(UnicodeSet a, UnicodeSet b)
{
UnicodeSet result = new UnicodeSet(a);
result.retainAll(b);
return result;
}
protected class Builder
{
protected Vector categories = null;
protected Hashtable expressions = null;
protected UnicodeSet ignoreChars = null;
protected Vector tempStateTable = null;
protected Vector decisionPointList = null;
protected Stack decisionPointStack = null;
protected Vector loopingStates = null;
protected Vector statesToBackfill = null;
protected Vector mergeList = null;
protected boolean clearLoopingStates = false;
protected static final int END_STATE_FLAG = 32768;
protected static final int DONT_LOOP_FLAG = 16384;
protected static final int LOOKAHEAD_STATE_FLAG = 8192;
protected static final int ALL_FLAGS = 57344;
public Builder() {}
public void buildBreakIterator()
{
Vector tempRuleList = buildRuleList(description);
buildCharCategories(tempRuleList);
buildStateTable(tempRuleList);
buildBackwardsStateTable(tempRuleList);
}
private Vector buildRuleList(String description)
{
Vector tempRuleList = new Vector();
Stack parenStack = new Stack();
int p = 0;
int ruleStart = 0;
char c = '\000';
char lastC = '\000';
char lastOpen = '\000';
boolean haveEquals = false;
boolean havePipe = false;
boolean sawVarName = false;
boolean sawIllegalChar = false;
int illegalCharPos = 0;
String charsThatCantPrecedeAsterisk = "=/<(|>*+?;\000";
if ((description.length() != 0) && (description.charAt(description.length() - 1) != ';')) {
description = description + ";";
}
while (p < description.length()) {
c = description.charAt(p);
switch (c)
{
case '(':
case '[':
case '{':
if (lastOpen == '{') {
error("Can't nest brackets inside {}", p, description);
}
if ((lastOpen == '[') && (c != '[')) {
error("Can't nest anything in [] but []", p, description);
}
if ((c == '{') && ((haveEquals) || (havePipe))) {
error("Unknown variable name", p, description);
}
lastOpen = c;
parenStack.push(new Character(c));
if (c == '{') {
sawVarName = true;
}
break;
case ')':
case ']':
case '}':
char expectedClose = '\000';
switch (lastOpen) {
case '{':
expectedClose = '}';
break;
case '[':
expectedClose = ']';
break;
case '(':
expectedClose = ')';
}
if (c != expectedClose) {
error("Unbalanced parentheses", p, description);
}
if (lastC == lastOpen) {
error("Parens don't contain anything", p, description);
}
parenStack.pop();
if (!parenStack.empty()) {
lastOpen = ((Character)parenStack.peek()).charValue();
}
else {
lastOpen = '\000';
}
break;
case '*':
case '+':
case '?':
if (("=/<(|>*+?;\000".indexOf(lastC) != -1) && ((c != '?') || (lastC != '*')))
{
error("Misplaced *, +, or ?", p, description);
}
break;
case '=':
if ((haveEquals) || (havePipe)) {
error("More than one = or / in rule", p, description);
}
haveEquals = true;
sawIllegalChar = false;
break;
case '/':
if ((haveEquals) || (havePipe)) {
error("More than one = or / in rule", p, description);
}
if (sawVarName) {
error("Unknown variable name", p, description);
}
havePipe = true;
break;
case '!':
if ((lastC != ';') && (lastC != 0)) {
error("! can only occur at the beginning of a rule", p, description);
}
break;
case '\\':
p++;
break;
case '.':
break;
case '&':
case '-':
case ':':
case '^':
if ((lastOpen != '[') && (lastOpen != '{') && (!sawIllegalChar)) {
sawIllegalChar = true;
illegalCharPos = p;
}
break;
case ';':
if (sawIllegalChar) {
error("Illegal character", illegalCharPos, description);
}
if ((lastC == ';') || (lastC == 0)) {
error("Empty rule", p, description);
}
if (!parenStack.empty()) {
error("Unbalanced parenheses", p, description);
}
if (parenStack.empty())
{
if (haveEquals) {
description = processSubstitution(description.substring(ruleStart, p), description, p + 1);
}
else
{
if (sawVarName) {
error("Unknown variable name", p, description);
}
tempRuleList.addElement(description.substring(ruleStart, p));
}
ruleStart = p + 1;
haveEquals = havePipe = sawVarName = sawIllegalChar = 0;
}
break;
case '|':
if (lastC == '|') {
error("Empty alternative", p, description);
}
if ((parenStack.empty()) || (lastOpen != '(')) {
error("Misplaced |", p, description);
}
break;
default:
if ((c >= ' ') && (c < '') && (!Character.isLetter(c)) && (!Character.isDigit(c)) && (!sawIllegalChar))
{
sawIllegalChar = true;
illegalCharPos = p;
}
break; }
lastC = c;
p++;
}
if (tempRuleList.size() == 0) {
error("No valid rules in description", p, description);
}
return tempRuleList;
}
protected String processSubstitution(String substitutionRule, String description, int startPos)
{
int equalPos = substitutionRule.indexOf('=');
if (substitutionRule.charAt(0) != '$') {
error("Missing '$' on left-hand side of =", startPos, description);
}
String replace = substitutionRule.substring(1, equalPos);
String replaceWith = substitutionRule.substring(equalPos + 1);
handleSpecialSubstitution(replace, replaceWith, startPos, description);
if (replaceWith.length() == 0) {
error("Nothing on right-hand side of =", startPos, description);
}
if (replace.length() == 0) {
error("Nothing on left-hand side of =", startPos, description);
}
if (((replaceWith.charAt(0) != '[') || (replaceWith.charAt(replaceWith.length() - 1) != ']')) && ((replaceWith.charAt(0) != '(') || (replaceWith.charAt(replaceWith.length() - 1) != ')')))
{
error("Illegal right-hand side for =", startPos, description);
}
replace = "$" + replace;
StringBuffer result = new StringBuffer();
result.append(description.substring(0, startPos));
int lastPos = startPos;
int pos = description.indexOf(replace, startPos);
while (pos != -1)
{
if ((description.charAt(pos - 1) == ';') && (description.charAt(pos + replace.length()) == '='))
{
error("Attempt to redefine " + replace, pos, description);
}
result.append(description.substring(lastPos, pos));
result.append(replaceWith);
lastPos = pos + replace.length();
pos = description.indexOf(replace, lastPos);
}
result.append(description.substring(lastPos));
return result.toString();
}
protected void handleSpecialSubstitution(String replace, String replaceWith, int startPos, String description)
{
if (replace.equals("_ignore_")) {
if (replaceWith.charAt(0) == '(') {
error("Ignore group can't be enclosed in (", startPos, description);
}
ignoreChars = new UnicodeSet(replaceWith, false);
}
}
protected void buildCharCategories(Vector tempRuleList)
{
int bracketLevel = 0;
int p = 0;
int lineNum = 0;
expressions = new Hashtable();
while (lineNum < tempRuleList.size()) {
String line = (String)tempRuleList.elementAt(lineNum);
p = 0;
while (p < line.length()) {
char c = line.charAt(p);
switch (c) {
case '!': case '(':
case ')': case '*':
case '+': case '.':
case '/': case ';':
case '?':
case '|':
break;
case '[':
int q = p + 1;
bracketLevel++;
while ((q < line.length()) && (bracketLevel != 0)) {
c = line.charAt(q);
if (c == '[') {
bracketLevel++;
}
else if (c == ']') {
bracketLevel--;
}
q++;
}
if (expressions.get(line.substring(p, q)) == null) {
expressions.put(line.substring(p, q), new UnicodeSet(line.substring(p, q), false));
}
p = q - 1;
break;
case '\\':
p++;
c = line.charAt(p);
default:
UnicodeSet s = new UnicodeSet();
s.add(line.charAt(p));
expressions.put(line.substring(p, p + 1), s);
}
p++;
}
lineNum++;
}
categories = new Vector();
if (this.ignoreChars != null) {
categories.addElement(this.ignoreChars);
}
else {
categories.addElement(new UnicodeSet());
}
this.ignoreChars = null;
mungeExpressionList(expressions);
Enumeration iter = expressions.elements();
while (iter.hasMoreElements())
{
UnicodeSet work = new UnicodeSet((UnicodeSet)iter.nextElement());
for (int j = categories.size() - 1; (!work.isEmpty()) && (j > 0); j--)
{
UnicodeSet cat = (UnicodeSet)categories.elementAt(j);
UnicodeSet overlap = RuleBasedBreakIterator.intersection(work, cat);
if (!overlap.isEmpty())
{
if (!overlap.equals(cat)) {
cat.removeAll(overlap);
categories.addElement(overlap);
}
work.removeAll(overlap);
}
}
if (!work.isEmpty()) {
categories.addElement(work);
}
}
UnicodeSet allChars = new UnicodeSet();
for (int i = 1; i < categories.size(); i++)
allChars.addAll((UnicodeSet)categories.elementAt(i));
UnicodeSet ignoreChars = (UnicodeSet)categories.elementAt(0);
ignoreChars.removeAll(allChars);
iter = expressions.keys();
while (iter.hasMoreElements()) {
String key = (String)iter.nextElement();
UnicodeSet cs = (UnicodeSet)expressions.get(key);
StringBuffer cats = new StringBuffer();
for (int j = 1; j < categories.size(); j++) {
UnicodeSet cat = new UnicodeSet((UnicodeSet)categories.elementAt(j));
if (cs.containsAll(cat))
{
cats.append((char)(256 + j));
if (cs.equals(cat)) {
break;
}
}
}
expressions.put(key, cats.toString());
}
charCategoryTable = new CompactByteArray((byte)0);
for (int i = 0; i < categories.size(); i++) {
UnicodeSet chars = (UnicodeSet)categories.elementAt(i);
int n = chars.getRangeCount();
for (int j = 0; j < n; j++) {
int rangeStart = chars.getRangeStart(j);
if (rangeStart >= 65536) {
break;
}
if (i != 0) {
charCategoryTable.setElementAt((char)rangeStart, (char)chars.getRangeEnd(j), (byte)i);
}
else
{
charCategoryTable.setElementAt((char)rangeStart, (char)chars.getRangeEnd(j), (byte)-1);
}
}
}
charCategoryTable.compact();
numCategories = categories.size();
}
protected void mungeExpressionList(Hashtable expressions) {}
private void buildStateTable(Vector tempRuleList)
{
tempStateTable = new Vector();
tempStateTable.addElement(new short[numCategories + 1]);
tempStateTable.addElement(new short[numCategories + 1]);
for (int i = 0; i < tempRuleList.size(); i++) {
String rule = (String)tempRuleList.elementAt(i);
if (rule.charAt(0) != '!') {
parseRule(rule, true);
}
}
finishBuildingStateTable(true);
}
private void parseRule(String rule, boolean forward)
{
int p = 0;
int currentState = 1;
int lastState = currentState;
String pendingChars = "";
decisionPointStack = new Stack();
decisionPointList = new Vector();
loopingStates = new Vector();
statesToBackfill = new Vector();
boolean sawEarlyBreak = false;
if (!forward) {
loopingStates.addElement(new Integer(1));
}
decisionPointList.addElement(new Integer(currentState));
currentState = tempStateTable.size() - 1;
short[] state;
while (p < rule.length()) {
char c = rule.charAt(p);
clearLoopingStates = false;
if ((c == '[') || (c == '\\') || (Character.isLetter(c)) || (Character.isDigit(c)) || (c < ' ') || (c == '.') || (c >= ''))
{
if (c != '.') {
int q = p;
if (c == '\\') {
q = p + 2;
p++;
}
else if (c == '[') {
int bracketLevel = 1;
while (bracketLevel > 0) {
q++;
c = rule.charAt(q);
if (c == '[') {
bracketLevel++;
}
else if (c == ']') {
bracketLevel--;
}
else if (c == '\\') {
q++;
}
}
q++;
}
else
{
q = p + 1;
}
pendingChars = (String)expressions.get(rule.substring(p, q));
p = q - 1;
}
else
{
int rowNum = ((Integer)decisionPointList.lastElement()).intValue();
state = (short[])tempStateTable.elementAt(rowNum);
if ((p + 1 < rule.length()) && (rule.charAt(p + 1) == '*') && (state[0] != 0)) {
decisionPointList.addElement(new Integer(state[0]));
pendingChars = "";
p++;
if ((p + 1 < rule.length()) && (rule.charAt(p + 1) == '?'))
{
setLoopingStates(decisionPointList, decisionPointList);
p++;
}
}
else
{
StringBuffer temp = new StringBuffer();
for (int i = 0; i < numCategories; i++)
temp.append((char)(i + 256));
pendingChars = temp.toString();
}
}
if (pendingChars.length() != 0)
{
if ((p + 1 < rule.length()) && ((rule.charAt(p + 1) == '*') || (rule.charAt(p + 1) == '?')))
{
decisionPointStack.push(decisionPointList.clone());
}
int newState = tempStateTable.size();
if (loopingStates.size() != 0) {
statesToBackfill.addElement(new Integer(newState));
}
state = new short[numCategories + 1];
if (sawEarlyBreak) {
state[numCategories] = 16384;
}
tempStateTable.addElement(state);
updateStateTable(decisionPointList, pendingChars, (short)newState);
decisionPointList.removeAllElements();
lastState = currentState;
do {
currentState++;
decisionPointList.addElement(new Integer(currentState));
} while (currentState + 1 < tempStateTable.size());
}
}
if ((c == '+') || (c == '*') || (c == '?'))
{
if ((c == '*') || (c == '+'))
{
for (int i = lastState + 1; i < tempStateTable.size(); i++) {
Vector temp = new Vector();
temp.addElement(new Integer(i));
updateStateTable(temp, pendingChars, (short)(lastState + 1));
}
while (currentState + 1 < tempStateTable.size()) {
decisionPointList.addElement(new Integer(++currentState));
}
}
if ((c == '*') || (c == '?')) {
Vector temp = (Vector)decisionPointStack.pop();
for (int i = 0; i < decisionPointList.size(); i++)
temp.addElement(decisionPointList.elementAt(i));
decisionPointList = temp;
if ((c == '*') && (p + 1 < rule.length()) && (rule.charAt(p + 1) == '?'))
{
setLoopingStates(decisionPointList, decisionPointList);
p++;
}
}
}
if (c == '(')
{
tempStateTable.addElement(new short[numCategories + 1]);
lastState = currentState;
currentState++;
decisionPointList.insertElementAt(new Integer(currentState), 0);
decisionPointStack.push(decisionPointList.clone());
decisionPointStack.push(new Vector());
}
if (c == '|')
{
Vector oneDown = (Vector)decisionPointStack.pop();
Vector twoDown = (Vector)decisionPointStack.peek();
decisionPointStack.push(oneDown);
for (int i = 0; i < decisionPointList.size(); i++)
oneDown.addElement(decisionPointList.elementAt(i));
decisionPointList = ((Vector)twoDown.clone());
}
if (c == ')')
{
Vector exitPoints = (Vector)decisionPointStack.pop();
for (int i = 0; i < decisionPointList.size(); i++)
exitPoints.addElement(decisionPointList.elementAt(i));
decisionPointList = exitPoints;
if ((p + 1 >= rule.length()) || ((rule.charAt(p + 1) != '*') && (rule.charAt(p + 1) != '+') && (rule.charAt(p + 1) != '?')))
{
decisionPointStack.pop();
}
else
{
exitPoints = (Vector)decisionPointList.clone();
Vector temp = (Vector)decisionPointStack.pop();
int tempStateNum = ((Integer)temp.firstElement()).intValue();
short[] tempState = (short[])tempStateTable.elementAt(tempStateNum);
if ((rule.charAt(p + 1) == '?') || (rule.charAt(p + 1) == '*')) {
for (int i = 0; i < decisionPointList.size(); i++)
temp.addElement(decisionPointList.elementAt(i));
decisionPointList = temp;
}
if ((rule.charAt(p + 1) == '+') || (rule.charAt(p + 1) == '*')) {
for (int i = 0; i < tempState.length; i++) {
if (tempState[i] > tempStateNum) {
updateStateTable(exitPoints, new Character((char)(i + 256)).toString(), tempState[i]);
}
}
}
lastState = currentState;
currentState = tempStateTable.size() - 1;
p++;
}
}
if (c == '/') {
sawEarlyBreak = true;
for (int i = 0; i < decisionPointList.size(); i++) {
state = (short[])tempStateTable.elementAt(((Integer)decisionPointList.elementAt(i)).intValue()); int
tmp1456_1453 = numCategories; short[] tmp1456_1447 = state;tmp1456_1447[tmp1456_1453] = ((short)(tmp1456_1447[tmp1456_1453] | 0x2000));
}
}
if (clearLoopingStates) {
setLoopingStates(null, decisionPointList);
}
p++;
}
setLoopingStates(null, decisionPointList);
for (int i = 0; i < decisionPointList.size(); i++) {
int rowNum = ((Integer)decisionPointList.elementAt(i)).intValue();
state = (short[])tempStateTable.elementAt(rowNum); int
tmp1561_1558 = numCategories; short[] tmp1561_1552 = state;tmp1561_1552[tmp1561_1558] = ((short)(tmp1561_1552[tmp1561_1558] | 0x8000));
if (sawEarlyBreak) {
int tmp1582_1579 = numCategories; short[] tmp1582_1573 = state;tmp1582_1573[tmp1582_1579] = ((short)(tmp1582_1573[tmp1582_1579] | 0x2000));
}
}
}
private void updateStateTable(Vector rows, String pendingChars, short newValue)
{
short[] newValues = new short[numCategories + 1];
for (int i = 0; i < pendingChars.length(); i++) {
newValues[(pendingChars.charAt(i) - 'Ā')] = newValue;
}
for (int i = 0; i < rows.size(); i++) {
mergeStates(((Integer)rows.elementAt(i)).intValue(), newValues, rows);
}
}
private void mergeStates(int rowNum, short[] newValues, Vector rowsBeingUpdated)
{
short[] oldValues = (short[])tempStateTable.elementAt(rowNum);
boolean isLoopingState = loopingStates.contains(new Integer(rowNum));
for (int i = 0; i < oldValues.length; i++)
{
if (oldValues[i] != newValues[i])
{
if ((isLoopingState) && (loopingStates.contains(new Integer(oldValues[i])))) {
if (newValues[i] != 0) {
if (oldValues[i] == 0) {
clearLoopingStates = true;
}
oldValues[i] = newValues[i];
}
}
else if (oldValues[i] == 0) {
oldValues[i] = newValues[i];
}
else if (i == numCategories) {
oldValues[i] = ((short)(newValues[i] & 0xE000 | oldValues[i]));
}
else if ((oldValues[i] != 0) && (newValues[i] != 0))
{
int combinedRowNum = searchMergeList(oldValues[i], newValues[i]);
if (combinedRowNum != 0) {
oldValues[i] = ((short)combinedRowNum);
}
else
{
int oldRowNum = oldValues[i];
int newRowNum = newValues[i];
combinedRowNum = tempStateTable.size();
if (mergeList == null) {
mergeList = new Vector();
}
mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum });
short[] newRow = new short[numCategories + 1];
short[] oldRow = (short[])tempStateTable.elementAt(oldRowNum);
System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1);
tempStateTable.addElement(newRow);
oldValues[i] = ((short)combinedRowNum);
if (((decisionPointList.contains(new Integer(oldRowNum))) || (decisionPointList.contains(new Integer(newRowNum)))) && (!decisionPointList.contains(new Integer(combinedRowNum))))
{
decisionPointList.addElement(new Integer(combinedRowNum));
}
if (((rowsBeingUpdated.contains(new Integer(oldRowNum))) || (rowsBeingUpdated.contains(new Integer(newRowNum)))) && (!rowsBeingUpdated.contains(new Integer(combinedRowNum))))
{
decisionPointList.addElement(new Integer(combinedRowNum));
}
for (int k = 0; k < decisionPointStack.size(); k++) {
Vector dpl = (Vector)decisionPointStack.elementAt(k);
if (((dpl.contains(new Integer(oldRowNum))) || (dpl.contains(new Integer(newRowNum)))) && (!dpl.contains(new Integer(combinedRowNum))))
{
dpl.addElement(new Integer(combinedRowNum));
}
}
mergeStates(combinedRowNum, (short[])tempStateTable.elementAt(newValues[i]), rowsBeingUpdated);
}
}
}
}
}
private int searchMergeList(int a, int b)
{
if (mergeList == null) {
return 0;
}
for (int i = 0; i < mergeList.size(); i++) {
int[] entry = (int[])mergeList.elementAt(i);
if (((entry[0] == a) && (entry[1] == b)) || ((entry[0] == b) && (entry[1] == a))) {
return entry[2];
}
if ((entry[2] == a) && ((entry[0] == b) || (entry[1] == b))) {
return entry[2];
}
if ((entry[2] == b) && ((entry[0] == a) || (entry[1] == a))) {
return entry[2];
}
}
return 0;
}
private void setLoopingStates(Vector newLoopingStates, Vector endStates)
{
if (!loopingStates.isEmpty()) {
int loopingState = ((Integer)loopingStates.lastElement()).intValue();
for (int i = 0; i < endStates.size(); i++) {
eliminateBackfillStates(((Integer)endStates.elementAt(i)).intValue());
}
for (int i = 0; i < statesToBackfill.size(); i++) {
int rowNum = ((Integer)statesToBackfill.elementAt(i)).intValue();
short[] state = (short[])tempStateTable.elementAt(rowNum);
state[numCategories] = ((short)(state[numCategories] & 0xE000 | loopingState));
}
statesToBackfill.removeAllElements();
loopingStates.removeAllElements();
}
if (newLoopingStates != null) {
loopingStates = ((Vector)newLoopingStates.clone());
}
}
private void eliminateBackfillStates(int baseState)
{
if (statesToBackfill.contains(new Integer(baseState)))
{
statesToBackfill.removeElement(new Integer(baseState));
short[] state = (short[])tempStateTable.elementAt(baseState);
for (int i = 0; i < numCategories; i++) {
if (state[i] != 0) {
eliminateBackfillStates(state[i]);
}
}
}
}
private void backfillLoopingStates()
{
short[] loopingState = null;
int loopingStateRowNum = 0;
for (int i = 0; i < tempStateTable.size(); i++) {
short[] state = (short[])tempStateTable.elementAt(i);
int fromState = state[numCategories] & 0xFFFF1FFF;
if (fromState > 0)
{
if (fromState != loopingStateRowNum) {
loopingStateRowNum = fromState;
loopingState = (short[])tempStateTable.elementAt(loopingStateRowNum);
}
int tmp71_68 = numCategories; short[] tmp71_63 = state;tmp71_63[tmp71_68] = ((short)(tmp71_63[tmp71_68] & 0xE000));
for (int j = 0; j < state.length; j++) {
if (state[j] == 0) {
state[j] = loopingState[j];
}
else if (state[j] == 16384) {
state[j] = 0;
}
}
}
}
}
private void finishBuildingStateTable(boolean forward)
{
backfillLoopingStates();
int[] rowNumMap = new int[tempStateTable.size()];
Stack rowsToFollow = new Stack();
rowsToFollow.push(new Integer(1));
rowNumMap[1] = 1;
int i;
for (;
rowsToFollow.size() != 0;
i < numCategories)
{
int rowNum = ((Integer)rowsToFollow.pop()).intValue();
short[] row = (short[])tempStateTable.elementAt(rowNum);
i = 0; continue;
if ((row[i] != 0) &&
(rowNumMap[row[i]] == 0)) {
rowNumMap[row[i]] = row[i];
rowsToFollow.push(new Integer(row[i]));
}
i++;
}
int[] stateClasses = new int[tempStateTable.size()];
int nextClass = numCategories + 1;
short[] state1;
for (int i = 1; i < stateClasses.length; i++) {
if (rowNumMap[i] != 0)
{
state1 = (short[])tempStateTable.elementAt(i);
for (int j = 0; j < numCategories; j++) {
if (state1[j] != 0) {
stateClasses[i] += 1;
}
}
if (stateClasses[i] == 0)
stateClasses[i] = nextClass;
}
}
nextClass++;
int lastClass;
do
{
int currentClass = 1;
lastClass = nextClass;
while (currentClass < nextClass)
{
boolean split = false;
short[] state2; state1 = state2 = null;
for (int i = 0; i < stateClasses.length; i++) {
if (stateClasses[i] == currentClass)
{
if (state1 == null) {
state1 = (short[])tempStateTable.elementAt(i);
}
else {
state2 = (short[])tempStateTable.elementAt(i);
for (int j = 0; j < state2.length; j++)
if (((j == numCategories) && (state1[j] != state2[j]) && (forward)) || ((j != numCategories) && (stateClasses[state1[j]] != stateClasses[state2[j]])))
{
stateClasses[i] = nextClass;
split = true;
break;
}
}
}
}
if (split) {
nextClass++;
}
currentClass++;
}
} while (lastClass != nextClass);
int[] representatives = new int[nextClass];
for (int i = 1; i < stateClasses.length; i++) {
if (representatives[stateClasses[i]] == 0) {
representatives[stateClasses[i]] = i;
}
else {
rowNumMap[i] = representatives[stateClasses[i]];
}
}
for (int i = 1; i < rowNumMap.length; i++) {
if (rowNumMap[i] != i) {
tempStateTable.setElementAt(null, i);
}
}
int newRowNum = 1;
for (int i = 1; i < rowNumMap.length; i++) {
if (tempStateTable.elementAt(i) != null) {
rowNumMap[i] = (newRowNum++);
}
}
for (int i = 1; i < rowNumMap.length; i++) {
if (tempStateTable.elementAt(i) == null) {
rowNumMap[i] = rowNumMap[rowNumMap[i]];
}
}
if (forward) {
endStates = new boolean[newRowNum];
lookaheadStates = new boolean[newRowNum];
stateTable = new short[newRowNum * numCategories];
int p = 0;
int p2 = 0;
for (int i = 0; i < tempStateTable.size(); i++) {
short[] row = (short[])tempStateTable.elementAt(i);
if (row != null)
{
for (int j = 0; j < numCategories; j++) {
stateTable[p] = ((short)rowNumMap[row[j]]);
p++;
}
endStates[p2] = ((row[numCategories] & 0x8000) != 0 ? 1 : 0);
lookaheadStates[p2] = ((row[numCategories] & 0x2000) != 0 ? 1 : 0);
p2++;
}
}
}
else
{
backwardsStateTable = new short[newRowNum * numCategories];
int p = 0;
for (int i = 0; i < tempStateTable.size(); i++) {
short[] row = (short[])tempStateTable.elementAt(i);
if (row != null)
{
for (int j = 0; j < numCategories; j++) {
backwardsStateTable[p] = ((short)rowNumMap[row[j]]);
p++;
}
}
}
}
}
private void buildBackwardsStateTable(Vector tempRuleList)
{
tempStateTable = new Vector();
tempStateTable.addElement(new short[numCategories + 1]);
tempStateTable.addElement(new short[numCategories + 1]);
for (int i = 0; i < tempRuleList.size(); i++) {
String rule = (String)tempRuleList.elementAt(i);
if (rule.charAt(0) == '!') {
parseRule(rule.substring(1), false);
}
}
backfillLoopingStates();
int backTableOffset = tempStateTable.size();
if (backTableOffset > 2) {
backTableOffset++;
}
for (int i = 0; i < numCategories + 1; i++) {
tempStateTable.addElement(new short[numCategories + 1]);
}
short[] state = (short[])tempStateTable.elementAt(backTableOffset - 1);
for (int i = 0; i < numCategories; i++) {
state[i] = ((short)(i + backTableOffset));
}
int numRows = stateTable.length / numCategories;
for (int column = 0; column < numCategories; column++) {
for (int row = 0; row < numRows; row++) {
int nextRow = lookupState(row, column);
if (nextRow != 0) {
for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) {
int cellValue = lookupState(nextRow, nextColumn);
if (cellValue != 0) {
state = (short[])tempStateTable.elementAt(nextColumn + backTableOffset);
state[column] = ((short)(column + backTableOffset));
}
}
}
}
}
if (backTableOffset > 1)
{
state = (short[])tempStateTable.elementAt(1);
for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) {
short[] state2 = (short[])tempStateTable.elementAt(i);
for (int j = 0; j < numCategories; j++) {
if ((state[j] != 0) && (state2[j] != 0)) {
state2[j] = state[j];
}
}
}
state = (short[])tempStateTable.elementAt(backTableOffset - 1);
for (int i = 1; i < backTableOffset - 1; i++) {
short[] state2 = (short[])tempStateTable.elementAt(i);
if ((state2[numCategories] & 0x8000) == 0) {
for (int j = 0; j < numCategories; j++) {
if (state2[j] == 0) {
state2[j] = state[j];
}
}
}
}
}
finishBuildingStateTable(false);
}
protected void error(String message, int position, String context)
{
throw new IllegalArgumentException("Parse error: " + message + "\n" + Utility.escape(context.substring(0, position)) + "\n\n" + Utility.escape(context.substring(position)));
}
protected void debugPrintVector(String label, Vector v)
{
System.out.print(label);
for (int i = 0; i < v.size(); i++)
System.out.print(v.elementAt(i).toString() + "\t");
System.out.println();
}
protected void debugPrintVectorOfVectors(String label1, String label2, Vector v)
{
System.out.println(label1);
for (int i = 0; i < v.size(); i++) {
debugPrintVector(label2, (Vector)v.elementAt(i));
}
}
protected void debugPrintTempStateTable()
{
System.out.println(" tempStateTable:");
System.out.print(" C:\t");
for (int i = 0; i <= numCategories; i++)
System.out.print(Integer.toString(i) + "\t");
System.out.println();
for (int i = 1; i < tempStateTable.size(); i++) {
short[] row = (short[])tempStateTable.elementAt(i);
System.out.print(" " + i + ":\t");
for (int j = 0; j < row.length; j++) {
if (row[j] == 0) {
System.out.print(".\t");
}
else {
System.out.print(Integer.toString(row[j]) + "\t");
}
}
System.out.println();
}
}
}
private static final class SafeCharIterator
implements CharacterIterator, Cloneable
{
private CharacterIterator base;
private int rangeStart;
private int rangeLimit;
private int currentIndex;
SafeCharIterator(CharacterIterator base)
{
this.base = base;
rangeStart = base.getBeginIndex();
rangeLimit = base.getEndIndex();
currentIndex = base.getIndex();
}
public char first() {
return setIndex(rangeStart);
}
public char last() {
return setIndex(rangeLimit - 1);
}
public char current() {
if ((currentIndex < rangeStart) || (currentIndex >= rangeLimit)) {
return 65535;
}
return base.setIndex(currentIndex);
}
public char next()
{
currentIndex += 1;
if (currentIndex >= rangeLimit) {
currentIndex = rangeLimit;
return 65535;
}
return base.setIndex(currentIndex);
}
public char previous()
{
currentIndex -= 1;
if (currentIndex < rangeStart) {
currentIndex = rangeStart;
return 65535;
}
return base.setIndex(currentIndex);
}
public char setIndex(int i)
{
if ((i < rangeStart) || (i > rangeLimit)) {
throw new IllegalArgumentException("Invalid position");
}
currentIndex = i;
return current();
}
public int getBeginIndex() {
return rangeStart;
}
public int getEndIndex() {
return rangeLimit;
}
public int getIndex() {
return currentIndex;
}
public Object clone()
{
SafeCharIterator copy = null;
try {
copy = (SafeCharIterator)super.clone();
}
catch (CloneNotSupportedException e) {
throw new Error("Clone not supported: " + e);
}
CharacterIterator copyOfBase = (CharacterIterator)base.clone();
base = copyOfBase;
return copy;
}
}
public static void debugPrintln(String s)
{
String zeros = "0000";
StringBuffer out = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if ((c >= ' ') && (c < '')) {
out.append(c);
}
else {
out.append("\\u");
String temp = Integer.toHexString(c);
out.append("0000".substring(0, 4 - temp.length()));
out.append(temp);
}
}
System.out.println(out);
}
}
| [
"[email protected]"
] | |
e9c982ac2dcd70a0f24790425b1acd876d9b92e4 | 020c3bf8424bb2a04acfca0e3e5bcf02743970da | /yakhont/src/core/java/akha/yakhont/debug/BaseDialogFragment.java | 583fb5e1c6a3996320be6999094bdab671d266f7 | [
"Apache-2.0"
] | permissive | perlynk/Yakhont | 8594166c8dc9b02bcb97fa556216f32dc917fc64 | 04cb1eedab043777b0d43b902f5d924e82280aea | refs/heads/master | 2021-08-06T18:22:40.033100 | 2017-10-31T13:47:50 | 2017-10-31T13:47:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,340 | java | /*
* Copyright (C) 2015-2017 akha, a.k.a. Alexander Kharitonov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package akha.yakhont.debug;
import akha.yakhont.Core.Utils;
import akha.yakhont.CoreLogger;
import akha.yakhont.CoreLogger.Level;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.Arrays;
/**
* The <code>BaseDialogFragment</code> class is intended for debug purposes. Overridden methods most of the time just adds lifecycle logging.
* Some additional debug Fragments can be found in the full version. {@yakhont.preprocessor.remove.in.generated}
*
* @author akha
*/
@SuppressWarnings("JavaDoc")
@TargetApi(Build.VERSION_CODES.HONEYCOMB) //YakhontPreprocessor:removeInFlavor
public class BaseDialogFragment extends DialogFragment { // don't modify this line: it's subject to change by the Yakhont preprocessor
/**
* Initialises a newly created {@code BaseDialogFragment} object.
*/
public BaseDialogFragment() {
}
/**
* Override to change the logging message.
*
* @return The logging message (for debugging)
*/
@SuppressWarnings("JavaDoc")
protected String getDebugMessage() {
return "dialog fragment " + BaseFragment.getFragmentName(this);
}
/**
* Override to change the logging level.
* <br>The default value is {@link Level#WARNING WARNING}.
*
* @return The logging priority level (for debugging)
*/
@SuppressWarnings("SameReturnValue")
protected Level getDebugLevel() {
return Level.WARNING;
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onActivityCreated(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onActivityCreated(savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
CoreLogger.log(getDebugMessage() + ", requestCode " + requestCode +
", resultCode " + resultCode + " " + Utils.getActivityResultString(resultCode));
super.onActivityResult(requestCode, resultCode, data);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
@SuppressWarnings("deprecation")
public void onAttach(Activity activity) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onAttach(activity);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onAttach(Context context) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onAttach(context);
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-protected void onBindDialogView(View view) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- super.onBindDialogView(view);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onCancel(DialogInterface dialog) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onCancel(dialog);
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-public void onClick(DialogInterface dialog, int which) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage() + ", which " + which, false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- super.onClick(dialog, which);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onConfigurationChanged(Configuration newConfig) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", newConfig " + newConfig, false);
super.onConfigurationChanged(newConfig);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onCreate(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onCreate(savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
return super.onCreateDialog(savedInstanceState);
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-protected View onCreateDialogView(Context context) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- return super.onCreateDialogView(context);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
return super.onCreateView(inflater, container, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDestroy() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDestroy();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDestroyView() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDestroyView();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDetach() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDetach();
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-public void onDialogClosed(boolean positiveResult) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage() + ", positiveResult " + positiveResult, false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- super.onDialogClosed(positiveResult);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDismiss(DialogInterface dialog) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDismiss(dialog);
}
/**
* Please refer to the base method description.
*/
@CallSuper //YakhontPreprocessor:removeInFlavor
@Override //YakhontPreprocessor:removeInFlavor
@SuppressWarnings("deprecation") //YakhontPreprocessor:removeInFlavor
public void onInflate(AttributeSet attrs, Bundle savedInstanceState) { //YakhontPreprocessor:removeInFlavor
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", attrs " + attrs + //YakhontPreprocessor:removeInFlavor
", savedInstanceState " + savedInstanceState, false); //YakhontPreprocessor:removeInFlavor
super.onInflate(attrs, savedInstanceState); //YakhontPreprocessor:removeInFlavor
} //YakhontPreprocessor:removeInFlavor
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
@SuppressWarnings("deprecation")
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", attrs " + attrs + ", savedInstanceState " + savedInstanceState, false);
super.onInflate(activity, attrs, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", attrs " + attrs + ", savedInstanceState " + savedInstanceState, false);
super.onInflate(context, attrs, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onLowMemory() {
CoreLogger.log(Utils.getOnLowMemoryLevel(), getDebugMessage(), false);
super.onLowMemory();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onPause() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onPause();
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment- super.onPrepareDialogBuilder(builder);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-protected void onPrepareDialogBuilder(android.support.v7.app.AlertDialog.Builder builder) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat- super.onPrepareDialogBuilder(builder);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", requestCode " + requestCode +
", permissions " + Arrays.deepToString(permissions) +
", grantResults " + Arrays.toString(grantResults), false);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onResume() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onResume();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onSaveInstanceState(Bundle outState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", outState " + outState, false);
super.onSaveInstanceState(outState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onStart() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onStart();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onStop() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onStop();
}
/**
* Please refer to the base method description.
*/
@CallSuper //YakhontPreprocessor:removeInFlavor
@Override //YakhontPreprocessor:removeInFlavor
public void onTrimMemory(int level) { //YakhontPreprocessor:removeInFlavor
CoreLogger.log(Utils.getOnTrimMemoryLevel(level), getDebugMessage() + ", level " + Utils.getOnTrimMemoryLevelString(level), false); //YakhontPreprocessor:removeInFlavor
super.onTrimMemory(level); //YakhontPreprocessor:removeInFlavor
} //YakhontPreprocessor:removeInFlavor
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onViewCreated(view, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onViewStateRestored(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onViewStateRestored(savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void setRetainInstance(boolean retain) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", retain " + retain, true);
super.setRetainInstance(retain);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void setTargetFragment(Fragment fragment, int requestCode) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", fragment " + fragment + ", requestCode " + requestCode, true);
super.setTargetFragment(fragment, requestCode);
}
}
| [
"[email protected]"
] | |
29e5ca5c539bdec6839b0b24dcb72a92ed8ed77b | 0369bed326a59d5f3f5d19ed1258eab979ec402e | /Titles/helloWorld/java/HelloWorld/src/helloworld/title/TitleRegistry.java | f7fe8867ed0e944ba654cb65d9428724edb5db27 | [
"MIT"
] | permissive | magic-lantern-studio/mle-titles | 4e29892a4467c2fb9840448992fcfaab6eab9c34 | 55b79d1bdf0aa98ed057a6128fe69b25ab785b2c | refs/heads/master | 2022-09-29T06:14:42.904716 | 2022-09-17T18:42:30 | 2022-09-17T18:42:30 | 128,479,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,896 | java | /*
* TitleRegistry.java
* Created on Mar 28, 2006
*/
// COPYRIGHT_BEGIN
// COPYRIGHT_END
// Declare package.
package helloworld.title;
// Import standard Java classes.
import java.util.Observer;
import java.util.Observable;
import java.util.Vector;
// Import Magic Lantern Runtime Engine classes.
import com.wizzer.mle.runtime.core.MleActor;
import com.wizzer.mle.runtime.core.MleTables;
import com.wizzer.mle.runtime.core.MleRuntimeException;
/**
* This class manages a registry of title elements (e.g. Actors).
*
* @author Wizzer Works
*/
public class TitleRegistry implements Observer
{
// The Singleton instance of the title registry.
private static TitleRegistry m_theRegistry = null;
// The Actor registry.
private Vector m_actorRegistry = null;
// Hide the default constructor.
private TitleRegistry()
{
super();
// Create a container for the Actors in the title.
m_actorRegistry = new Vector();
// Add the registry as an Observer of the table manager.
MleTables.getInstance().addObserver(this);
}
/**
* Get the Singleton instance of the title registry.
*
* @return A <code>TitleRegistry</code> is returned.
*/
public static TitleRegistry getInstance()
{
if (m_theRegistry == null)
m_theRegistry = new TitleRegistry();
return m_theRegistry;
}
/**
* Get the registry of Actors.
*
* @return A <code>Vector</code> is returned containing the
* Actors that have been registered for the title.
*/
public Vector getActorRegistry()
{
return m_actorRegistry;
}
/**
* Add an Actor to the title registry.
*
* @param actor The Actor to add to the registry.
*
* @return <b>true</b> will be returned if the Actor is successfully added
* to the registry. Otherwise, <b>false</b> will be returned.
*
* @throws MleRuntimeException This exception is thrown if the input argument
* is <b>null</b>.
*/
public boolean addActor(MleActor actor)
throws MleRuntimeException
{
if (actor == null)
{
throw new MleRuntimeException("Unable to add Actor to title registry.");
}
return m_actorRegistry.add(actor);
}
/**
* Remove an Actor from the title registry.
*
* @param actor The Actor to remove from the registry.
*
* @return <b>true</b> will be returned if the Actor is successfully removed
* from the registry. Otherwise, <b>false</b> will be returned.
*
* @throws MleRuntimeException This exception is thrown if the input argument
* is <b>null</b>.
*/
public boolean removeActor(MleActor actor)
throws MleRuntimeException
{
if (actor == null)
{
throw new MleRuntimeException("Unable to remove Actor from title registry.");
}
return m_actorRegistry.remove(actor);
}
/**
* Clear the title registry by removing all registered title
* elements.
*/
public void clear()
{
// Clear the Actor registry.
m_actorRegistry.removeAllElements();
}
/**
* This method is called whenever the observed object is changed.
* <p>
* If the Observable is the <code>MleTables</code> class and the Object is
* an <code>MleActor</code>, then the Actor is added to the title registry.
* </p>
*
* @param obs The Observable object.
* @param obj An argument passed by the notifyObservers method from the
* Observable object.
*/
public void update(Observable obs, Object obj)
{
if (obs instanceof MleTables)
{
if (obj instanceof MleActor)
m_actorRegistry.add(obj);
}
}
}
| [
"[email protected]"
] | |
0ff854619cb1c1a33ef80b24f8bdf2969b6270ed | e157a8811bcf44365782f37734d991ae01f4379c | /Chapter11/src/sec02/exam05_static_method/RemoteControl.java | 2a28af0da927917206582905390e7390696b1a60 | [] | no_license | KIMDev-sever/study-java- | c212bf4950d20bd9b71aa72eb969ddbeffff1b44 | 1bd2dc2ff086aa449df1799b57391a764449aabf | refs/heads/master | 2022-12-20T07:42:44.537338 | 2020-10-06T01:25:40 | 2020-10-06T01:25:40 | 276,258,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package sec02.exam05_static_method;
public interface RemoteControl {
// 상수 public static final
int MAX_VOLUME = 10;
int MIN_VOLUME = 0;
//추상 메서드 public abstract
void turnOn();
void turnOff();
void setVolume(int volume);
//디폴트 메서드 public
default void setMute(boolean mute) {
if(mute) {
System.out.println("무음처리");
}else {
System.out.println("무음해제");
}
}
//정적 메서드 public
static void changeBattery() {
System.out.println("건전지 교체");
}
}
| [
"[email protected]"
] | |
02d42cd40052a797373b11616fb85540774f19b9 | 03beb22a38b4955555ae1796b26ab4d5dc233e76 | /test/app/src/main/java/com/example/test/DTO/CreateMemberDto.java | b1a8081ac3656919e738785bf36d2286c8e32ffc | [] | no_license | leeyoong/All-Fun-SideProject-FE | 2825062870e54545e53c4d4060a8337a136be008 | 52f9525f0eb5c44ae7657fecb116bbf65f3eb35f | refs/heads/main | 2023-06-25T16:30:19.148150 | 2021-07-31T07:37:33 | 2021-07-31T07:37:33 | 390,770,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,038 | java | package com.example.test.DTO;
public class CreateMemberDto {
public CreateMemberDto(String email, String passwd, String birth, String name, String phone, String nickname, String gender) {
this.email = email;
this.passwd = passwd;
this.birth = birth;
this.name = name;
this.phone = phone;
this.nickname = nickname;
this.gender = gender;
}
private String email; //
private String passwd;
private String birth; //yyyy-mm-dd
private String name;
private String phone;
private String nickname; //
private String gender; // Male Female
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPasswd() {
return passwd;
}
public void setPasswd(String passwd) {
this.passwd = passwd;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
@Override
public String toString() {
return "CreateMemberDto{" +
"email='" + email + '\'' +
", passwd='" + passwd + '\'' +
", birth='" + birth + '\'' +
", name='" + name + '\'' +
", phone='" + phone + '\'' +
", nickname='" + nickname + '\'' +
", gender='" + gender + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
ef67d8255ec2cd0c62351f12d338d5878fa38ddb | 8cb04a820f6eb5b91a7b400a0b7790b1dabf2f43 | /src/main/java/sunyu/demo/security/manager/config/tld/ClassPathTldsLoader.java | babee2f067eff4e693433b3c5cac44d6cc67d45d | [
"MIT"
] | permissive | Asura0923/security-manager | f9275cd206a73c9bbae38dc1ebf17c16387cfbd5 | 7540cdf778ae7c6a15249a1a0d204f0b1a29f57e | refs/heads/master | 2020-07-14T11:57:37.119134 | 2019-08-20T06:07:16 | 2019-08-20T06:07:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package sunyu.demo.security.manager.config.tld;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.List;
/**
* tlds classpath loader
*
* @author SunYu
*/
public class ClassPathTldsLoader {
@Autowired
private FreeMarkerConfigurer freeMarkerConfigurer;
@PostConstruct
public void loadClassPathTlds() {
freeMarkerConfigurer.getTaglibFactory().setClasspathTlds(classPathTldList);
}
final private List<String> classPathTldList;
public ClassPathTldsLoader(String... classPathTlds) {
super();
if (classPathTlds.length == 0) {
this.classPathTldList = Arrays.asList("/META-INF/security.tld");
} else {
this.classPathTldList = Arrays.asList(classPathTlds);
}
}
} | [
"[email protected]"
] | |
cfb72da54d681238bc485efc95194d6c3844c32e | d72223decd604f3fdda8aabfca3272012c690517 | /dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerModel.java | e9e5f3a96811a832a45919083fb37d0fd7864333 | [
"Apache-2.0"
] | permissive | wangyaomeng/dubbo-parent | aff8abfa13a5370211ea6a1d354f306c974f06b5 | 12a3b1d7626a50a568c73a535bb4358bb7b7789c | refs/heads/master | 2022-12-05T08:12:14.324015 | 2020-08-31T14:13:58 | 2020-08-31T14:13:58 | 291,729,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,535 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config.model;
import com.alibaba.dubbo.config.ReferenceConfig;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
public class ConsumerModel {
private ReferenceConfig metadata;
private Object proxyObject;
private String serviceName;
private final Map<Method, ConsumerMethodModel> methodModels = new IdentityHashMap<Method, ConsumerMethodModel>();
public ConsumerModel(String serviceName, ReferenceConfig metadata, Object proxyObject, Method[] methods) {
this.serviceName = serviceName;
this.metadata = metadata;
this.proxyObject = proxyObject;
if (proxyObject != null) {
for (Method method : methods) {
methodModels.put(method, new ConsumerMethodModel(method, metadata));
}
}
}
/**
* Return service metadata for consumer
*
* @return service metadata
*/
public ReferenceConfig getMetadata() {
return metadata;
}
public Object getProxyObject() {
return proxyObject;
}
/**
* Return method model for the given method on consumer side
*
* @param method method object
* @return method model
*/
public ConsumerMethodModel getMethodModel(Method method) {
return methodModels.get(method);
}
/**
* Return all method models for the current service
*
* @return method model list
*/
public List<ConsumerMethodModel> getAllMethods() {
return new ArrayList<ConsumerMethodModel>(methodModels.values());
}
public String getServiceName() {
return serviceName;
}
}
| [
"[email protected]"
] | |
c8715331b5826dbe211a83a2c5d730f76bb3433e | 8e26e41b2d8b0e6c2c837c5fc94a70f63e9d5683 | /backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/InternalClusterPolicies.java | 755978b0a3a764e0962a9501929cdf2797864d79 | [
"Apache-2.0"
] | permissive | deweydu/ovirt-engine | 8d23d6ce0dfadc596ddc95463c98e4c0a993eb34 | cb7e7c4d34786b83ff7b4e7a36d70ab69ed4e2e1 | refs/heads/master | 2020-12-13T19:55:55.841984 | 2015-09-24T08:45:24 | 2016-01-10T08:29:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,848 | java | package org.ovirt.engine.core.bll.scheduling;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.ovirt.engine.core.bll.scheduling.policyunits.CPUPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.CpuLevelFilterPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.EmulatedMachineFilterPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.EvenDistributionBalancePolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.EvenDistributionWeightPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.EvenGuestDistributionBalancePolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.EvenGuestDistributionWeightPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.HaReservationWeightPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.HostDeviceFilterPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.HostedEngineHAClusterFilterPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.HostedEngineHAClusterWeightPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.MemoryPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.MigrationPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.NetworkPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.NoneBalancePolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.NoneWeightPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.PinToHostPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingBalancePolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingWeightPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.VmAffinityFilterPolicyUnit;
import org.ovirt.engine.core.bll.scheduling.policyunits.VmAffinityWeightPolicyUnit;
import org.ovirt.engine.core.common.scheduling.ClusterPolicy;
import org.ovirt.engine.core.common.scheduling.PolicyUnitType;
import org.ovirt.engine.core.common.utils.Pair;
import org.ovirt.engine.core.compat.Guid;
public class InternalClusterPolicies {
private static final Map<Guid, ClusterPolicy> clusterPolicies = new HashMap<>();
static {
createBuilder("b4ed2332-a7ac-4d5f-9596-99a439cb2812")
.name("none")
.isDefault()
.setBalancer(NoneBalancePolicyUnit.class)
.addFilters(PinToHostPolicyUnit.class)
.addFilters(CPUPolicyUnit.class)
.addFilters(CpuLevelFilterPolicyUnit.class)
.addFilters(EmulatedMachineFilterPolicyUnit.class)
.addFilters(HostDeviceFilterPolicyUnit.class)
.addFilters(HostedEngineHAClusterFilterPolicyUnit.class)
.addFilters(MemoryPolicyUnit.class)
.addFilters(MigrationPolicyUnit.class)
.addFilters(VmAffinityFilterPolicyUnit.class)
.addFilters(NetworkPolicyUnit.class)
.addFunction(1, NoneWeightPolicyUnit.class)
.addFunction(1, HostedEngineHAClusterWeightPolicyUnit.class)
.addFunction(1, HaReservationWeightPolicyUnit.class)
.addFunction(1, VmAffinityWeightPolicyUnit.class)
.register();
createBuilder("20d25257-b4bd-4589-92a6-c4c5c5d3fd1a")
.name("evenly_distributed")
.setBalancer(EvenDistributionBalancePolicyUnit.class)
.addFilters(PinToHostPolicyUnit.class)
.addFilters(CPUPolicyUnit.class)
.addFilters(CpuLevelFilterPolicyUnit.class)
.addFilters(EmulatedMachineFilterPolicyUnit.class)
.addFilters(HostDeviceFilterPolicyUnit.class)
.addFilters(HostedEngineHAClusterFilterPolicyUnit.class)
.addFilters(MemoryPolicyUnit.class)
.addFilters(MigrationPolicyUnit.class)
.addFilters(VmAffinityFilterPolicyUnit.class)
.addFilters(NetworkPolicyUnit.class)
.addFunction(1, EvenDistributionWeightPolicyUnit.class)
.addFunction(1, HostedEngineHAClusterWeightPolicyUnit.class)
.addFunction(1, HaReservationWeightPolicyUnit.class)
.addFunction(1, VmAffinityWeightPolicyUnit.class)
.set(PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES, "2")
.set(PolicyUnitParameter.HIGH_UTILIZATION, "80")
.register();
createBuilder("5a2b0939-7d46-4b73-a469-e9c2c7fc6a53")
.name("power_saving")
.setBalancer(PowerSavingBalancePolicyUnit.class)
.addFilters(PinToHostPolicyUnit.class)
.addFilters(CPUPolicyUnit.class)
.addFilters(CpuLevelFilterPolicyUnit.class)
.addFilters(EmulatedMachineFilterPolicyUnit.class)
.addFilters(HostDeviceFilterPolicyUnit.class)
.addFilters(HostedEngineHAClusterFilterPolicyUnit.class)
.addFilters(MemoryPolicyUnit.class)
.addFilters(MigrationPolicyUnit.class)
.addFilters(VmAffinityFilterPolicyUnit.class)
.addFilters(NetworkPolicyUnit.class)
.addFunction(1, PowerSavingWeightPolicyUnit.class)
.addFunction(1, HostedEngineHAClusterWeightPolicyUnit.class)
.addFunction(1, HaReservationWeightPolicyUnit.class)
.addFunction(1, VmAffinityWeightPolicyUnit.class)
.set(PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES, "2")
.set(PolicyUnitParameter.HIGH_UTILIZATION, "80")
.set(PolicyUnitParameter.LOW_UTILIZATION, "20")
.register();
createBuilder("8d5d7bec-68de-4a67-b53e-0ac54686d579")
.name("vm_evenly_distributed")
.setBalancer(EvenGuestDistributionBalancePolicyUnit.class)
.addFilters(PinToHostPolicyUnit.class)
.addFilters(CPUPolicyUnit.class)
.addFilters(CpuLevelFilterPolicyUnit.class)
.addFilters(EmulatedMachineFilterPolicyUnit.class)
.addFilters(HostDeviceFilterPolicyUnit.class)
.addFilters(HostedEngineHAClusterFilterPolicyUnit.class)
.addFilters(MemoryPolicyUnit.class)
.addFilters(MigrationPolicyUnit.class)
.addFilters(VmAffinityFilterPolicyUnit.class)
.addFilters(NetworkPolicyUnit.class)
.addFunction(1, EvenGuestDistributionWeightPolicyUnit.class)
.addFunction(1, HostedEngineHAClusterWeightPolicyUnit.class)
.addFunction(1, HaReservationWeightPolicyUnit.class)
.addFunction(1, VmAffinityWeightPolicyUnit.class)
.set(PolicyUnitParameter.HIGH_VM_COUNT, "10")
.set(PolicyUnitParameter.MIGRATION_THRESHOLD, "5")
.set(PolicyUnitParameter.SPM_VM_GRACE, "5")
.register();
}
public static Map<Guid, ClusterPolicy> getClusterPolicies() {
return Collections.unmodifiableMap(clusterPolicies);
}
protected static PolicyBuilder createBuilder(String guid) {
final Guid realGuid = Guid.createGuidFromString(guid);
final PolicyBuilder builder = new PolicyBuilder(realGuid);
return builder;
}
protected final static class PolicyBuilder {
final ClusterPolicy policy;
private PolicyBuilder(Guid id) {
policy = new ClusterPolicy();
policy.setId(id);
policy.setFilters(new ArrayList<Guid>());
policy.setFilterPositionMap(new HashMap<Guid, Integer>());
policy.setFunctions(new ArrayList<Pair<Guid, Integer>>());
policy.setParameterMap(new HashMap<String, String>());
policy.setLocked(true);
}
public final ClusterPolicy getPolicy() {
return policy;
}
public final PolicyBuilder name(String name) {
policy.setName(name);
return this;
}
public final PolicyBuilder description(String description) {
policy.setDescription(description);
return this;
}
public final PolicyBuilder isDefault() {
policy.setDefaultPolicy(true);
return this;
}
public final PolicyBuilder set(PolicyUnitParameter parameter, String value) {
// This is only executed during application startup (class loading in fact)
// and should never fail or we have a bug in the static initializer of this
// class.
assert parameter.validValue(value);
policy.getParameterMap().put(parameter.getDbName(), value);
return this;
}
@SafeVarargs
public final PolicyBuilder addFilters(Class<? extends PolicyUnitImpl>... filters) {
for (Class<? extends PolicyUnitImpl> filter: filters) {
Guid guid = getGuidAndValidateType(filter, PolicyUnitType.FILTER);
// Previously last item, but do not touch the first one
if (policy.getFilters().size() >= 2) {
Guid last = policy.getFilters().get(policy.getFilters().size() - 1);
policy.getFilterPositionMap().put(last, 0);
}
// Mark first added item as first and any other as last
if (policy.getFilters().isEmpty()) {
policy.getFilterPositionMap().put(guid, -1);
} else {
policy.getFilterPositionMap().put(guid, 1);
}
policy.getFilters().add(guid);
}
return this;
}
@SafeVarargs
public final PolicyBuilder addFunction(Integer factor, Class<? extends PolicyUnitImpl>... functions) {
for (Class<? extends PolicyUnitImpl> function: functions) {
Guid guid = getGuidAndValidateType(function, PolicyUnitType.WEIGHT);
policy.getFunctions().add(new Pair<>(guid, factor));
}
return this;
}
public final PolicyBuilder setBalancer(Class<? extends PolicyUnitImpl> balancer) {
policy.setBalance(getGuidAndValidateType(balancer, PolicyUnitType.LOAD_BALANCING));
return this;
}
private Guid getGuidAndValidateType(Class<? extends PolicyUnitImpl> unit, PolicyUnitType expectedType) {
SchedulingUnit guid = unit.getAnnotation(SchedulingUnit.class);
// This is only executed during application startup (class loading in fact)
// and should never fail or we have a bug in the static initializer of this
// class.
if (guid == null) {
throw new IllegalArgumentException(unit.getName()
+ " is missing the required SchedulingUnit annotation metadata.");
}
if (expectedType != guid.type()) {
throw new IllegalArgumentException("Type " + expectedType.name() + " expected, but unit "
+ unit.getName() + " is of type " + guid.type().name());
}
if (!InternalPolicyUnits.getList().contains(unit)) {
throw new IllegalArgumentException("Policy unit " + unit.getName() + " is not present"
+ " in the list of enabled internal policy units.");
}
return Guid.createGuidFromString(guid.guid());
}
private PolicyBuilder register() {
clusterPolicies.put(policy.getId(), policy);
return this;
}
}
}
| [
"[email protected]"
] | |
3b847c82efe75ff433bd180538dee2208df304b5 | 58505311d768cd861a95bb4f39f8af0840d18b1e | /WallJumper/src/com/me/walljumper/screens/GameScreen.java | 3834e3cc700c64e72a95aa164c99bebcb142d1d5 | [] | no_license | VjDroider/WallJumper | d3f0eaf96d4ac668d3fbb361cb91252f28a50c27 | 8c28d4a94cb5d37ce5f04b1a8d0ddbefd223e734 | refs/heads/master | 2021-01-18T07:34:51.414082 | 2014-06-15T02:43:03 | 2014-06-15T02:43:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,098 | java | package com.me.walljumper.screens;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.Interpolation;
import com.me.walljumper.DirectedGame;
import com.me.walljumper.ProfileLoader;
import com.me.walljumper.WallJumper;
import com.me.walljumper.screens.screentransitions.ScreenTransition;
import com.me.walljumper.screens.screentransitions.ScreenTransitionFade;
import com.me.walljumper.screens.screentransitions.ScreenTransitionSlice;
import com.me.walljumper.tools.AudioManager;
import com.me.walljumper.tools.InputManager;
public class GameScreen extends ScreenHelper {
public GameScreen(DirectedGame game) {
super(game);
}
@Override
public void render(float delta) {
World.controller.render(delta);
}
@Override
public void resize(int width, int height) {
World.controller.resize(width, height);
}
@Override
public void show() {
World.controller = new World(game, this);
World.controller.show();
WallJumper.currentScreen = this;
}
@Override
public void hide() {
World.controller.hide();
}
@Override
public void pause() {
super.pause();
World.controller.pause();
}
@Override
public void resume() {
World.controller.resume();
}
@Override
public void dispose() {
World.controller.dispose();
}
public boolean handleTouchInput(int screenX, int screenY, int pointer, int button){
return World.controller.handleTouchInput(screenX, screenY, pointer, button);
}
public boolean handleKeyInput(int keycode) {
return World.controller.handleKeyInput(keycode);
}
//CHANGE LEVEL METHODS
//Set spawnpoint to null, destroy and init world controller and go to next level
public void nextLevel(){
WallJumper.level++;
World.controller.setSpawnPoint(null, false);
World.controller.destroy();
World.controller.init();
}
public void changeScreen(ScreenHelper screen) {
((Game) Gdx.app.getApplicationListener()).setScreen(screen);
}
@Override
public InputProcessor getInputProcessor() {
return InputManager.inputManager;
}
}
| [
"[email protected]"
] | |
c0894d54dcbb0178f05b1eadf7a8c5e8d247886c | a53f96eefd4c4e3691f074197506b6fb1a0fb201 | /Location.java | be423035f3a3431794cf8b46b6ccab6c3fbedef1 | [] | no_license | danmidwood/danimals | b0880fe474c4f956e5de340d76005964473722f6 | 0978240b6f34ac4093069608852d62d194f677a3 | HEAD | 2016-08-11T13:34:57.646256 | 2016-02-02T22:45:08 | 2016-02-03T12:50:35 | 50,949,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java |
/**
* Write a description of class Location here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Location extends Selection
{
int row;
int col;
public Location() {
addParam(new String("radius"), new Integer(10));
}
public Object select(Population pop) throws Exception{
if (!ready()) throw new Exception("Parameters not yet initialized");
int radius = ((Integer)getParamValue("radius")).intValue();
// Do not want to alter the current environment so create a
// temp copy to play with.
Population malleablePop = (Population)pop.clone();
Coord currentLocation = (Coord)pop.getCurrentlySelected();
int row = currentLocation.getRow();
int col = currentLocation.getCol();
java.util.Iterator allStrings = pop.keySet().iterator();
while (allStrings.hasNext()) {
Coord thisLocation = (Coord)allStrings.next();
int rowDiff = row - thisLocation.getRow();
int colDiff = col - thisLocation.getCol();
double thisRadius = Math.sqrt( (colDiff * colDiff) + (rowDiff * rowDiff));
// The current object should be removed
if (thisRadius == 0) malleablePop.remove(thisLocation);
if (thisRadius > radius) {
malleablePop.remove(thisLocation);
}
}
return malleablePop;
}
public boolean needsChild() {
return true;
}
public boolean needsPreselectedString() {
return true;
}
}
| [
"[email protected]"
] | |
e5281645b679719f38f5782b5bc2c6632d74943b | 7c779f6a42bda541b0548f2f387d65c9e44236de | /app/src/main/java/com/example/java6/MainActivity.java | fbcc089fafde05e6be0a6dd22f6fd43e8f14ec97 | [] | no_license | Webbernucthomework/JAVA_HW6 | fa202ecc9efc9e05bd6e8d09005e667dd719c0d1 | 34834971d683531ab1896c11fb7a990c505a4e13 | refs/heads/master | 2020-09-06T07:04:50.860771 | 2019-11-08T01:08:30 | 2019-11-08T01:08:30 | 220,358,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.example.java6;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
3f95fd13c3bcf67e5fdda88bf4061af20045fb4a | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Hadoop/273_1.java | 1c4629e40c82e46a5b24e021642dca18282cf5af | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | //,temp,OpenFileCtxCache.java,198,219,temp,NMContainerTokenSecretManager.java,214,234
//,3
public class xxx {
void cleanAll() {
ArrayList<OpenFileCtx> cleanedContext = new ArrayList<OpenFileCtx>();
synchronized (this) {
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
.iterator();
if (LOG.isTraceEnabled()) {
LOG.trace("openFileMap size:" + openFileMap.size());
}
while (it.hasNext()) {
Entry<FileHandle, OpenFileCtx> pairs = it.next();
OpenFileCtx ctx = pairs.getValue();
it.remove();
cleanedContext.add(ctx);
}
}
// Invoke the cleanup outside the lock
for (OpenFileCtx ofc : cleanedContext) {
ofc.cleanup();
}
}
}; | [
"[email protected]"
] | |
64913bd79e89c9466e88dde9491351a7e348fedc | 784db9fe74ecea7319637254de4e6a226c00fdf5 | /src/main/java/ch/pschatzmann/scad4j/mesh/Material.java | 1dfe2803cf5a722715ef6c7c10ce976aa5f0c281 | [] | no_license | pschatzmann/scad4j | 581ffaadb398cefe6cf41e3ab3db489f8fc6ee30 | 4662309d6b924c0cd64d7fa4d65c74929c86c96b | refs/heads/master | 2021-01-05T08:49:59.217445 | 2020-02-21T01:02:05 | 2020-02-21T01:02:05 | 240,961,190 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package ch.pschatzmann.scad4j.mesh;
public class Material {
private String name;
public Material(){}
public Material(String name){
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
3096c1a2d1b6ff9b14cf4161091d13cd3a0222ca | 5bc51d282f4437119d433036d8ba51229452a5ec | /src/main/java/com/travelplanner/Application.java | 3b474dd0f2a8f5bb076c991fec1a7fcfd3d3de0a | [] | no_license | monikaj93/travelplanner | 041e57232c2c27c9ba2f43d160efa2f93081babb | ac1136d9cab7c256f28f497d8fc1ce395b69995b | refs/heads/master | 2021-06-07T23:08:01.761832 | 2019-06-04T22:12:35 | 2019-06-04T22:12:35 | 143,773,438 | 0 | 0 | null | 2021-06-04T21:58:15 | 2018-08-06T19:27:42 | Java | UTF-8 | Java | false | false | 310 | java | package com.travelplanner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
} | [
"[email protected]"
] | |
c10ec09f854d096772e50b5e3c058b568a48af92 | 3127e92ab06084b27526ab308ebccdd1895e5bc5 | /src/dominion/models/cards/actions/Bazaar.java | b81783cd966933ef298a0fc51ae855369eff672a | [] | no_license | Lager-B08902082/dominion | 09c847deee9c20a1789eedb554d48ec287a2d53f | 04a196f78e31cfc8d14ac2bef1d1255169c71ebd | refs/heads/master | 2023-06-08T17:45:23.962205 | 2021-07-01T05:59:10 | 2021-07-01T05:59:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package dominion.models.cards.actions;
import dominion.models.cards.Card;
import dominion.models.cards.CardStyles;
import dominion.models.cards.CardTypes;
import dominion.models.expansions.SeaSide;
import dominion.models.player.Player;
public class Bazaar extends Card implements SeaSide, Action {
// Constructor
public Bazaar() {
name = "趕集";
description = "+1 卡片\n+2 行動\n+1 塊錢";
style = CardStyles.white;
type = CardTypes.action;
numCost = 5;
}
// Functions
@Override
public void perform(Player performer, boolean decreaseNumActions) {
performer.drawCards(1);
performer.increaseNumActions(2);
performer.increaseNumCoins(1);
if(decreaseNumActions) {
performer.decreaseNumActions();
}
doNextMove();
}
} | [
"[email protected]"
] | |
bb45958f2ed0aaca9b5a26c0b8915532462afff7 | d2eb73a6aea1f1a38b7b4c65444dde8590598825 | /01InterfacesExercises/Birthday Celebrations/BirthDate.java | 8dd5902432c360f25970df61b9be7854273be43c | [] | no_license | zdergatchev/Java-OOP-Advanced | a8d03b5242f2008f3d173c29eb16a2e52f8a5271 | 5725251f278421c54d9df05ef75f1f7a00088ec6 | refs/heads/master | 2021-01-22T18:06:54.944072 | 2017-03-21T09:21:47 | 2017-03-21T09:21:47 | 85,057,110 | 0 | 1 | null | 2017-03-21T09:21:47 | 2017-03-15T10:03:22 | Java | UTF-8 | Java | false | false | 138 | java | package BorderControl_05;
/**
* Created by r3v3nan7 on 16.03.17.
*/
public interface BirthDate {
public String getBirthDate();
}
| [
"[email protected]"
] | |
951509bf3e36b9f88dab517790b679522f52acc0 | 570ba8d7fab777fcedaa09a7b430a25482a75f3b | /nutan/read_emails.java | 384866a0f0c83c4af0ead92036161f9212baaedb | [] | no_license | bosonfields/Algorithm_record | c02b211ab2da42103c8840c6eeca179c15033635 | 1987b0fd9cd69e99f6f7e6c5ae36580c571efc00 | refs/heads/master | 2020-05-05T11:08:57.464576 | 2020-02-28T02:48:55 | 2020-02-28T02:48:55 | 179,976,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | public static void main(String[] args) {
int[] arr = {1,1,0,0,1};
System.out.println(readAll(arr));
}
public static int readAll(int[] emails){
if(emails.length == 0) return 0;
int n = emails.length;
int[] dp = new int[n];
dp[0] = emails[0] == 1 ? 1 : 0;
for(int i = 1; i < n; i++){
if(emails[i] == 1){
dp[i] = dp[i - 1] + 1;
}
else{
dp[i] = dp[i - 1];
dp[i] += emails[i - 1] == 1 ? 1 : 0;
}
}
if(emails[n - 1] == 0) dp[n - 1] -= 1;
return dp[n - 1];
} | [
"[email protected]"
] | |
23f963ec536ad3229937415afcefbac3dd89ec4a | 39ff77cee21d6cd141eeb1af743af22a33c8f4ae | /src/main/java/org.reactivestreams.extensions.sequenced/KeyedMessage.java | 304520c9550528968440867bf4b371baf5af3d95 | [] | no_license | RuedigerMoeller/reactive-streams-sequenced-proposal | 52fd20e3a9e9c0ac484e40fe87fb4b8e24569512 | f267c7bd5c1bc447025b6187e07edcf21190d258 | refs/heads/master | 2023-06-14T18:07:19.710629 | 2015-08-05T16:43:28 | 2015-08-05T16:43:28 | 39,892,261 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package org.reactivestreams.extensions.sequenced;
/**
* Created by ruedi on 29/07/15.
*
* Additional proposal
*
* a further message marker interface allowing for implementation of generic last value caches.
* A last value cache can be used in persistent message queues to replace plain message replay.
* E.g. for market data, one likely aims to store last market prices by stock instead of a full history
* of price events.
*
*/
public interface KeyedMessage {
Object getKey();
}
| [
"[email protected]"
] | |
85eff5be74ba7139d0eedf5344e31904d7271f1d | ff80bafc0b67a56a26d89493b03c3e4e3ee080a0 | /src/com/yj/ecard/ui/adapter/WithdrawRecordListViewHolder.java | c06293e0950085b504b065161e013fb91f19e730 | [] | no_license | yangmingguang/LY | f22ee87307e238cb92ac2f4ca5ae28666e7a51d1 | 259671862349071ddf94097232b9b4cafdd0e60e | refs/heads/master | 2016-09-06T06:11:08.651390 | 2015-11-30T14:37:46 | 2015-11-30T14:37:46 | 40,431,458 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,961 | java | /**
* @Title: WithdrawRecordListViewHolder.java
* @Package com.yj.ecard.ui.adapter
* @Description: TODO(用一句话描述该文件做什么)
* @author YangMingGuang
* @date 2015-5-25 下午5:26:13
* @version V1.0
*/
package com.yj.ecard.ui.adapter;
import android.content.Context;
import android.text.Html;
import android.view.View;
import android.widget.TextView;
import com.yj.ecard.R;
import com.yj.ecard.publics.model.WithdrawBean;
/**
* @ClassName: WithdrawRecordListViewHolder
* @Description: TODO(这里用一句话描述这个类的作用)
* @author YangMingGuang
* @date 2015-5-25 下午5:26:13
*
*/
public class WithdrawRecordListViewHolder {
private View state;
private boolean hasInited;
public TextView tvName, tvCard, tvTime, tvAmount;
public WithdrawRecordListViewHolder(View view) {
if (view != null) {
tvName = (TextView) view.findViewById(R.id.tv_name);
tvCard = (TextView) view.findViewById(R.id.tv_card);
tvTime = (TextView) view.findViewById(R.id.tv_time);
tvAmount = (TextView) view.findViewById(R.id.tv_amount);
state = view.findViewById(R.id.state);
hasInited = true;
}
}
/**
* @Title: initData
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param withdrawBean
* @param @param context 设定文件
* @return void 返回类型
* @throws
*/
public void initData(Context context, WithdrawBean withdrawBean) {
if (hasInited) {
tvName.setText("姓名:" + withdrawBean.realName);
tvCard.setText("卡号:" + withdrawBean.bankCardnum);
tvTime.setText(withdrawBean.addTime);
tvAmount.setText(Html.fromHtml("提现金额:<font color=#D00000>¥" + withdrawBean.cashAmount + "</font>"));
if (withdrawBean.state == 1) {
state.setBackgroundResource(R.color.state_green_color);
} else {
state.setBackgroundResource(R.color.state_gray_color);
}
}
}
}
| [
"[email protected]"
] | |
721183db999f350ce458a6eda8449ed9c8d56a89 | 441473eacc2770115b9b285d4115f999f0e208e9 | /Pract7_8/src/com/company/Employee.java | 99c0fe6e5047deeb5ea01a26f0c861690ac1123c | [] | no_license | denilai/JavaLabs | be26b0bf7b2d2048124f360804f505a51a69b8fa | f13b096bc8b431101c5aa5599e48c00e0156d4db | refs/heads/master | 2023-02-03T01:45:46.606622 | 2020-12-14T11:53:30 | 2020-12-14T11:53:30 | 293,067,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,165 | java | package com.company;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
public class Employee implements Comparable<Employee>{
private String fstName;
private String sndName;
private String position;
private double baseSalary;
public double finalSalary;
private static List<String> randomFstName;
private static List <String> randomSndName;
Company company;
int cashForCompany = 0;
public double getBaseSalary(){
return this.baseSalary;
}
Employee(String position) throws IOException {
randomFstName = Files.readAllLines(Path.of ("RandomFstNames.txt"), StandardCharsets.UTF_8);
randomSndName = Files.readAllLines(Path.of ("RandomSndNames.txt"), StandardCharsets.UTF_8);
Random random = new Random();
String rFstName = randomFstName.get(random.nextInt(100));
String rSndName = randomSndName.get(random.nextInt(88));
this.fstName = rFstName;
this.sndName = rSndName;
this.position = position;
this.baseSalary = random.nextInt(300000)+150000;
switch (position){
case "Manager":
finalSalary = new Manager().calcSalary(baseSalary);
break;
case "Operator":
finalSalary = new Operator().calcSalary(baseSalary);
break;
case "Top Manager":
finalSalary = new TopManager().calcSalary(baseSalary);
}
}
Employee(String fstName, String sndName, String position, double baseSalary) throws IOException {
this.fstName = fstName;
this.sndName = sndName;
this.baseSalary = baseSalary;
this.position = position;
switch (position){
case "Manager":
finalSalary = new Manager().calcSalary(baseSalary);
break;
case "Operator":
finalSalary = new Operator().calcSalary(baseSalary);
break;
case "Top Manager":
finalSalary = new TopManager().calcSalary(baseSalary);
}
FileReader reader = new FileReader("RandomNames.txt");
}
public double getFinalSalary() {
return finalSalary;
}
@Override
public int compareTo(Employee o) {
double eps = 0.000000001;
double temp = Math.abs(o.getFinalSalary()-this.getFinalSalary());
if (temp<eps ) return 0;
else if (o.getFinalSalary()>this.getFinalSalary())
return -1;
else return 1;
}
public String getPosition() {
return position;
}
public String getFullName() {
return fstName + ' ' + sndName;
}
@Override
public String toString() {
return "Employee: {"+
" name: " + fstName + ' '+ sndName +
" position: "+ position +
" final salary: "+ getFinalSalary() +
" }";
}
}
| [
"[email protected]"
] | |
9c57cf502979bf65b0836a2dbd1bb1f5d0c14b45 | 152e2092311725f750c86fcc14528015c727af38 | /codes/src/尚硅谷面试题第二季/CallableDemo.java | cda7705e15f8ed60c807e61154f79e7f80bffebc | [] | no_license | coder-tq/study-notes | b558c5039eb8dea47b18dadff9003175eade7375 | c6f0a6b9d269b203c7761fe4034cab8da8aa4ee2 | refs/heads/main | 2023-05-08T13:42:10.704596 | 2021-06-02T03:12:43 | 2021-06-02T03:12:43 | 367,073,353 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package 尚硅谷面试题第二季;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
/**
* @author coder_tq
* @Date 2021/5/16 9:28
*/
public class CallableDemo {
public static void main(String[] args) throws ExecutionException, InterruptedException {
FutureTask<Integer> futureTask = new FutureTask<>(new MyThread());
new Thread(futureTask,"AA").start();
futureTask.get();
}
}
class MyThread implements Callable<Integer>{
@Override
public Integer call() throws Exception {
System.out.println(Thread.currentThread().getName()+"Come in");
try { TimeUnit.MILLISECONDS.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); }
return 1024;
}
}
| [
"[email protected]"
] | |
dc9542588ad8ad2e79262570eb8e07b85e38c3f8 | d2705adcc800ce6a1e7a80566eb60ee0ce3cbaa8 | /107 Binary Tree Level Order Traversal II/TreeNode.java | 6d40eccf8e1bac425a4271181ce488756f819c6e | [] | no_license | PaulingZhou/LeetCode123 | 15a0830f7bd94b89ec3c228d7c5742f0d2330707 | e4500c819c545ea04ee8c04e36a4b7cf8f9589ec | refs/heads/master | 2021-07-11T13:28:52.255011 | 2017-10-14T12:07:32 | 2017-10-14T12:07:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.zhou.solution107;
//Definition for a binary tree node.
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
| [
"[email protected]"
] | |
1053eedb7b4378cf3833c2166085902c04340deb | 536bf97d11e9b57b690abfbb046faa544d0ad3f8 | /guimei/src/com/guimei/entity/Admin.java | 83cb611a54d33335e08d99ac5c2c0ec478310cb5 | [] | no_license | yanshuguang/guimei | 9289f6a7033d02dff5dc4d49dcb590f015c08f98 | eea4aa81fdb6fa675ec2a544eb46dce99f3abcbc | refs/heads/master | 2021-08-28T13:39:02.254520 | 2017-12-12T09:35:08 | 2017-12-12T09:35:08 | 113,973,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | package com.guimei.entity;
public class Admin {
private int admin_id;
private String admin_name;
private String admin_pwd;
private String admin_realname;
private String admin_email;
public int getAdmin_id() {
return admin_id;
}
public void setAdmin_id(int admin_id) {
this.admin_id = admin_id;
}
public String getAdmin_name() {
return admin_name;
}
public void setAdmin_name(String admin_name) {
this.admin_name = admin_name;
}
public String getAdmin_pwd() {
return admin_pwd;
}
public void setAdmin_pwd(String admin_pwd) {
this.admin_pwd = admin_pwd;
}
public String getAdmin_realname() {
return admin_realname;
}
public void setAdmin_realname(String admin_realname) {
this.admin_realname = admin_realname;
}
}
| [
"[email protected]"
] | |
be0ec8d6867b2123c781103d3ce005443060c7a4 | 31f043184e2839ad5c3acbaf46eb1a26408d4296 | /src/main/java/com/github/highcharts4gwt/model/highcharts/option/jso/plotoptions/gauge/point/JsoRemoveEvent.java | 5dd249db68a3f33f6b51e7ea6cdb640b075f35f0 | [] | no_license | highcharts4gwt/highchart-wrapper | 52ffa84f2f441aa85de52adb3503266aec66e0ac | 0a4278ddfa829998deb750de0a5bd635050b4430 | refs/heads/master | 2021-01-17T20:25:22.231745 | 2015-06-30T15:05:01 | 2015-06-30T15:05:01 | 24,794,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java |
package com.github.highcharts4gwt.model.highcharts.option.jso.plotoptions.gauge.point;
import com.github.highcharts4gwt.model.highcharts.object.api.Point;
import com.github.highcharts4gwt.model.highcharts.option.api.plotoptions.gauge.point.RemoveEvent;
import com.google.gwt.dom.client.NativeEvent;
public class JsoRemoveEvent
extends NativeEvent
implements RemoveEvent
{
protected JsoRemoveEvent() {
}
public final native Point point()
throws RuntimeException /*-{
return this.source;
}-*/
;
}
| [
"[email protected]"
] | |
e4a7977797cf0678be90045dbe5b9a10f10fc8a9 | 7b93bbdf60b2e24e013ae762e472dad262103d72 | /app/src/main/java/com/itbam/pixceler/util/FullScreen.java | ef1057f00acf53e3868c99605ac659d36c644a48 | [] | no_license | clebernascimento/AppPix | 6e2bbcaaf92888342b84720acd7435f507be23f6 | 84bfa1a3f7c43786ac19d82e3b402c7441fbd928 | refs/heads/master | 2023-01-22T03:09:33.491345 | 2020-12-01T12:41:25 | 2020-12-01T12:41:25 | 317,536,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package com.itbam.pixceler.util;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.itbam.pixceler.view.activity.MainActivity;
public class FullScreen extends MainActivity {
private final AppCompatActivity mainActivity;
public FullScreen(AppCompatActivity mainActivity) {
this.mainActivity = mainActivity;
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
hideSystemUI();
}
}
private void hideSystemUI() {
View decorView = mainActivity.getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN);
}
}
| [
"[email protected]"
] | |
54910d991f21377d338d2a26afa599edae5c290a | fc62bd2a89f01e2664d6b212f08e493725c38146 | /offer/ReverseList_24.java | 798d25704d6f011777e1b92adbd6a8262061dcef | [] | no_license | Yang1998/coding | 880fbe7503c5e0ce39d68afb799a74d6ca644475 | 7d0e27d359cf89d998c764560bfecf7a71908c24 | refs/heads/master | 2020-06-27T01:24:46.599762 | 2020-03-06T12:58:13 | 2020-03-06T12:58:13 | 199,809,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package offer;
public class ReverseList_24 {
public ListNode reverseList(ListNode node) {
if(node == null || node.next == null) {
return node;
}
ListNode cur = reverseList(node.next);
node.next.next = node;
node.next = null;
return cur;
}
}
| [
"[email protected]"
] | |
1aa85d77917cc3a91a0edd5342a1c4f29ec911b2 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_ae61205b10bb5d2e609a4fc3ca28a166dcada3a6/ModuleMapText2CPersistence/10_ae61205b10bb5d2e609a4fc3ca28a166dcada3a6_ModuleMapText2CPersistence_t.java | 46e8a5e3b801fa4c766612ceaf762b1687c52445 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,958 | java | /*
* Copyright 2010 Universitat Pompeu Fabra.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* under the License.
*/
package org.gitools.persistence.text;
import edu.upf.bg.progressmonitor.IProgressMonitor;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.commons.csv.CSVParser;
import org.gitools.model.ModuleMap;
import org.gitools.persistence.PersistenceException;
import org.gitools.persistence.PersistenceUtils;
import org.gitools.utils.CSVStrategies;
/** Read/Write modules from a two columns tabulated file,
* first column for item and second for module. */
public class ModuleMapText2CPersistence
extends ModuleMapPersistence<ModuleMap>{
@Override
public ModuleMap read(File file, IProgressMonitor monitor) throws PersistenceException {
// map between the item names and its index
Map<String, Integer> itemNameToRowMapping = new TreeMap<String, Integer>();
if (isItemNamesFilterEnabled()) {
String[] itemNames = getItemNames();
for (int i = 0; i < itemNames.length; i++) {
if (itemNameToRowMapping.containsKey(itemNames[i]))
throw new PersistenceException("Modules not mappable to heatmap due to duplicated row: " + itemNames[i]);
else
itemNameToRowMapping.put(itemNames[i], i);
}
}
// map between modules and item indices
final Map<String, Set<Integer>> moduleItemsMap =
new HashMap<String, Set<Integer>>();
// read mappings
try {
monitor.begin("Reading modules ...", 1);
Reader reader = PersistenceUtils.openReader(file);
CSVParser parser = new CSVParser(reader, CSVStrategies.TSV);
readModuleMappings(parser, isItemNamesFilterEnabled(),
itemNameToRowMapping, moduleItemsMap);
monitor.end();
}
catch (Exception ex) {
throw new PersistenceException(ex);
}
monitor.begin("Filtering modules ...", 1);
int minSize = getMinSize();
int maxSize = getMaxSize();
// create array of item names
//monitor.debug("isItemNamesFilterEnabled() = " + isItemNamesFilterEnabled());
//monitor.debug("itemNameToRowMapping.size() = " + itemNameToRowMapping.size());
String[] itemNames = new String[itemNameToRowMapping.size()];
for (Map.Entry<String, Integer> entry : itemNameToRowMapping.entrySet()) {
//monitor.debug(entry.getKey() + " --> " + entry.getValue());
itemNames[entry.getValue()] = entry.getKey();
}
// mask of used items
BitSet used = new BitSet(itemNames.length);
// remappend indices
int lastIndex = 0;
int[] indexMap = new int[itemNames.length];
// filter modules by size and identify which items are indexed
List<String> moduleNames = new ArrayList<String>();
List<int[]> modulesItemIndices = new ArrayList<int[]>();
Iterator<Entry<String, Set<Integer>>> it =
moduleItemsMap.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Set<Integer>> entry = it.next();
Set<Integer> indices = entry.getValue();
if (indices.size() >= minSize && indices.size() <= maxSize) {
moduleNames.add(entry.getKey());
int[] remapedIndices = new int[indices.size()];
Iterator<Integer> iit = indices.iterator();
for (int i = 0; i < indices.size(); i++) {
int index = iit.next();
if (!used.get(index)) {
used.set(index);
indexMap[index] = lastIndex++;
}
remapedIndices[i] = indexMap[index];
}
modulesItemIndices.add(remapedIndices);
}
else
it.remove();
}
// reorder item names according with remaped indices
String[] finalItemNames = new String[lastIndex];
for (int i = 0; i < itemNames.length; i++)
if (used.get(i))
finalItemNames[indexMap[i]] = itemNames[i];
monitor.end();
ModuleMap mmap = new ModuleMap();
mmap.setItemNames(finalItemNames);
mmap.setModuleNames(moduleNames.toArray(new String[moduleNames.size()]));
mmap.setAllItemIndices(modulesItemIndices.toArray(new int[modulesItemIndices.size()][]));
return mmap;
}
protected void readModuleMappings(
CSVParser parser,
boolean filterRows,
Map<String, Integer> itemNameToRowMapping,
Map<String, Set<Integer>> moduleItemsMap)
throws PersistenceException {
try {
String[] fields;
while ((fields = parser.getLine()) != null) {
if (fields.length < 2)
throw new PersistenceException(
"At least 2 columns expected at "
+ parser.getLineNumber()
+ "(item name and group name).");
String itemName = fields[0];
String groupName = fields[1];
Integer itemIndex = itemNameToRowMapping.get(itemName);
if (itemIndex == null && !filterRows) {
itemIndex = itemNameToRowMapping.size();
itemNameToRowMapping.put(itemName, itemIndex);
}
if (itemIndex != null) {
Set<Integer> itemIndices = moduleItemsMap.get(groupName);
if (itemIndices == null) {
itemIndices = new TreeSet<Integer>();
moduleItemsMap.put(groupName, itemIndices);
}
itemIndices.add(itemIndex);
}
}
}
catch (IOException e) {
throw new PersistenceException(e);
}
}
@Override
public void write(File file, ModuleMap moduleMap, IProgressMonitor monitor) throws PersistenceException {
final String[] moduleNames = moduleMap.getModuleNames();
int numModules = moduleNames.length;
monitor.begin("Saving modules...", numModules);
try {
Writer writer = PersistenceUtils.openWriter(file);
final PrintWriter pw = new PrintWriter(writer);
final String[] itemNames = moduleMap.getItemNames();
final int[][] indices = moduleMap.getAllItemIndices();
for (int i = 0; i < numModules; i++) {
for (int index : indices[i]) {
pw.print(itemNames[index]);
pw.print('\t');
pw.print(moduleNames[i]);
pw.print('\n');
}
monitor.worked(1);
}
pw.close();
monitor.end();
}
catch (Exception e) {
throw new PersistenceException(e);
}
}
}
| [
"[email protected]"
] | |
d74642e84deb656d37dc3eb21cd99fbe518babb4 | 53ae302356e9229edbd13f7380bb6dc8bed458da | /src/main/java/xin/cymall/CyFastApplication.java | 41bb4d236b309a1a4e5263bed732f04c8b12300b | [
"Apache-2.0"
] | permissive | cl330533960/take | 41060755288055309e207983d4d13c9921d07871 | 12cc2431ed50eaa0a54cb3eaa4939e2f3ef7afb2 | refs/heads/master | 2022-12-08T15:38:05.976821 | 2020-11-10T09:02:25 | 2020-11-10T09:02:25 | 193,087,452 | 0 | 0 | Apache-2.0 | 2022-12-06T00:43:01 | 2019-06-21T11:35:07 | JavaScript | UTF-8 | Java | false | false | 850 | java | package xin.cymall;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
// mapper 接口类扫描包配置
@MapperScan("xin.cymall.dao")
public class CyFastApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(CyFastApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(CyFastApplication.class, args);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.