blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d86984f6d962ca4dd43797e7d845e85f835927bf | 61db66a2208ded488445a5cec7ec16fc3bf1a5fa | /JAVA EE/SpringEtORM/animoz/src/main/java/com/animoz/modele/Espece.java | d02b971693822df011bf72c972239e0e8f8c6de5 | [] | no_license | Kenjaman/UDEV3 | d3bac1007e2e6ebf2c7c89d1e7f3f2f48771b088 | a8c39820a1a14ea1da113abb5a81b57c38d9c01f | refs/heads/master | 2022-03-12T15:43:16.849572 | 2022-02-13T18:30:16 | 2022-02-13T18:30:16 | 216,365,891 | 0 | 0 | null | 2022-02-13T18:30:16 | 2019-10-20T13:25:35 | HTML | UTF-8 | Java | false | false | 753 | java | package com.animoz.modele;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Espece {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nom;
@OneToMany(mappedBy = "espece")
private List<Animal> animaux;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public List<Animal> getAnimaux() {
return animaux;
}
public void setAnimaux(List<Animal> animaux) {
this.animaux = animaux;
}
}
| [
"56792437+Kenjaman@users.noreply.github.com"
] | 56792437+Kenjaman@users.noreply.github.com |
9e816a4ac79e458b1bc5162a47383977fa5f1ee1 | fb8bf4fd80f1522a33b3f2be72165d8db0071ea4 | /core/src/com/magnias/world/map/World.java | 72bdaa7e677d7b837d3bed6fec65dac0d6d78994 | [
"MIT"
] | permissive | angelocarly/xyzEngine | 710ed3b2d5686bc0d7a40d24443f913fda088181 | d0bd3011f044728ce6a46edd2e2254226fc80219 | refs/heads/master | 2022-06-18T10:22:14.986939 | 2020-05-09T22:21:31 | 2020-05-09T22:21:31 | 261,571,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,862 | java | package com.magnias.world.map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.attributes.DirectionalLightsAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.utils.DefaultTextureBinder;
import com.badlogic.gdx.graphics.g3d.utils.RenderContext;
import com.badlogic.gdx.graphics.g3d.utils.TextureBinder;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.bullet.DebugDrawer;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.physics.bullet.dynamics.*;
import com.badlogic.gdx.physics.bullet.linearmath.btIDebugDraw;
import com.magnias.game.Game;
import com.magnias.game.PlayState;
import com.magnias.render.*;
import com.magnias.util.VectorMath;
import com.magnias.world.entity.Entity;
import com.magnias.world.entity.EntityBox;
import com.magnias.world.entity.EntityManager;
import com.magnias.world.entity.EntityPlayer;
public class World {
private Map map;
private EntityManager entityManager;
private DebugDrawer debugDrawer;
private btDispatcher dispatcher;
private btDbvtBroadphase broadphase;
private btConstraintSolver constraintSolver;
private btCollisionConfiguration collisionConfig;
private btDynamicsWorld physicsWorld;
private EntityPlayer player;
private Environment environment;
private MultiTargetFrameBuffer gBuffer;
private MultiTargetFrameBuffer lightingBuffer;
private boolean debugDraw = false;
float a;
private RenderContext renderContext;
public void input(float delta) {
if (Gdx.input.isKeyPressed(54))
this.entityManager.addEntity((Entity) new EntityBox(this, this.player.getPosition().cpy().add(0.0F, 5.0F, 0.0F), new Vector3(1.0F, 1.0F, 1.0F)));
if (Gdx.input.isKeyJustPressed(52))
this.debugDraw = !this.debugDraw;
if (Gdx.input.isKeyJustPressed(46))
this.player.setPosition(new Vector3(10.0F, 30.0F, 10.0F));
if (Gdx.input.isKeyJustPressed(44))
DitherShader.getInstance().reload();
if (Gdx.input.isKeyJustPressed(33)) {
Vector3 rayFrom = new Vector3((Game.renderManager.getCamera()).position);
Vector3 rayTo = rayFrom.cpy().add((Game.renderManager.getCamera().getPickRay(Gdx.input.getX(), Gdx.input.getY())).direction.cpy().scl(100.0F));
ClosestRayResultCallback c = new ClosestRayResultCallback(Vector3.Zero, Vector3.Z);
c.setCollisionObject(null);
c.setClosestHitFraction(1.0F);
c.setRayFromWorld(rayFrom);
c.setRayToWorld(rayTo);
this.physicsWorld.rayTest(rayFrom, rayTo, (RayResultCallback) c);
if (c.hasHit()) {
Vector3 v = new Vector3();
c.getHitPointWorld(v);
PlayState.CUSTOM_STRING = v.toString();
((btRigidBody) c.getCollisionObject()).applyCentralForce((new Vector3(rayTo)).scl(2000.0F));
}
}
for (DirectionalLight dLight : ((DirectionalLightsAttribute) this.environment.get(DirectionalLightsAttribute.Type)).lights)
((DirectionalShadowLight) dLight).update((Game.renderManager.getCamera()).position.cpy(), dLight.direction);
}
public World() {
this.a = 0.0F;
this.renderContext = new RenderContext((TextureBinder) new DefaultTextureBinder(1));
this.collisionConfig = (btCollisionConfiguration) new btDefaultCollisionConfiguration();
this.dispatcher = (btDispatcher) new btCollisionDispatcher(this.collisionConfig);
this.broadphase = new btDbvtBroadphase();
this.constraintSolver = (btConstraintSolver) new btSequentialImpulseConstraintSolver();
this.physicsWorld = (btDynamicsWorld) new btDiscreteDynamicsWorld(this.dispatcher, (btBroadphaseInterface) this.broadphase, this.constraintSolver, this.collisionConfig);
this.physicsWorld.setGravity(new Vector3(0.0F, -9.81F, 0.0F));
this.debugDrawer = new DebugDrawer();
this.debugDrawer.setDebugMode(32769);
this.physicsWorld.setDebugDrawer((btIDebugDraw) this.debugDrawer);
long startTime = System.currentTimeMillis();
MapGenerator mgen = new MapGenerator(120L);
this.map = mgen.generateMap(this, 10, 2, 10);
System.out.println("Map generated in " + (System.currentTimeMillis() - startTime) + " ms");
this.entityManager = new EntityManager(this);
this.player = new EntityPlayer(this, new Vector3(8.0F, 32.0F, 8.0F));
this.entityManager.addEntity((Entity) this.player);
this.environment = new Environment();
DirectionalShadowLight d = new DirectionalShadowLight(1024, 1024, 64.0F, 64.0F, -400.0F, 400.0F);
d.color.set(Color.GREEN);
d.update(this.map.getWorldCenter(), new Vector3(1.0F, -2.0F, -1.2F));
this.environment.add((DirectionalLight) d);
d = new DirectionalShadowLight(1024, 1024, 64.0F, 64.0F, -400.0F, 400.0F);
d.color.set(Color.RED);
d.update(this.map.getWorldCenter(), (new Vector3(-1.0F, -2.0F, -1.2F)).nor());
this.environment.add((DirectionalLight) d);
float scale = 1.0F;
this.gBuffer = MultiTargetFrameBuffer.create(Pixmap.Format.RGBA8888, 2, (int) (Game.WIDTH * scale), (int) (Game.HEIGHT * scale), true, true);
this.lightingBuffer = MultiTargetFrameBuffer.create(Pixmap.Format.RGBA8888, 1, (int) (Game.WIDTH * scale), (int) (Game.HEIGHT * scale), true, true);
}
public void render() {
if (this.debugDraw) {
this.debugDrawer.begin(Game.renderManager.getCamera());
this.physicsWorld.debugDrawWorld();
this.debugDrawer.end();
return;
}
BasicShader basicShader2 = BasicShader.getInstance();
for (DirectionalLight dLight : ((DirectionalLightsAttribute) this.environment.get(DirectionalLightsAttribute.Type)).lights) {
DirectionalShadowLight d = (DirectionalShadowLight) dLight;
basicShader2.begin(d.getCamera(), this.renderContext);
d.begin();
renderGeometry((Shader) basicShader2, d.getCamera());
d.end();
basicShader2.end();
}
this.gBuffer.begin();
Gdx.gl.glClear(0x100 | 0x4000);
GBufferShader gBufferShader = GBufferShader.getInstance();
gBufferShader.begin(Game.renderManager.getCamera(), this.renderContext);
this.entityManager.render((Shader) gBufferShader, Game.renderManager.getCamera());
gBufferShader.end();
this.gBuffer.end();
this.gBuffer.begin();
GBufferBlockShader gBufferBlockShader = GBufferBlockShader.getInstance();
gBufferBlockShader.begin(Game.renderManager.getCamera(), this.renderContext);
this.map.render((Shader) gBufferBlockShader, Game.renderManager.getCamera());
gBufferBlockShader.end();
this.gBuffer.end();
Gdx.gl.glEnable(3042);
Gdx.gl.glBlendFunc(768, 768);
this.lightingBuffer.begin();
Gdx.gl.glClear(0x100 | 0x4000);
LightingShader ls = LightingShader.getInstance();
ls.begin(Game.renderManager.getScreenCamera(), this.renderContext);
ls.bindGBuffer(this.gBuffer);
ls.setUniformWorldTrans(new Vector3((-Game.WIDTH / 2), (-Game.HEIGHT / 2), -1.0F));
for (DirectionalLight dLight : ((DirectionalLightsAttribute) this.environment.get(DirectionalLightsAttribute.Type)).lights) {
DirectionalShadowLight d = (DirectionalShadowLight) dLight;
ls.bindLight(d);
ls.render(Game.screenMesh);
}
ls.end();
this.lightingBuffer.end();
Gdx.gl.glDisable(3042);
DitherShader ditherShader = DitherShader.getInstance();
BasicShader basicShader1 = BasicShader.getInstance();
basicShader1.begin(Game.renderManager.getScreenCamera(), this.renderContext);
basicShader1.setUniformWorldTrans(new Vector3((-Game.WIDTH / 2), (-Game.HEIGHT / 2), -1.0F));
basicShader1.bindTexture("u_diffuse", (Texture) this.lightingBuffer.getColorBufferTexture());
basicShader1.render(Game.screenMeshFlipped);
}
public void update(float delta) {
if (!this.debugDraw) {
this.entityManager.update(delta);
this.physicsWorld.stepSimulation(delta, 0, 0.016666668F);
}
}
public void createExplosion(Vector3 position, float strength) {
int range = (int) Math.ceil(strength);
Vector3 blockPos = new Vector3();
float x;
for (x = position.x - range / 2.0F; x <= position.x + range / 2.0F; x++) {
float y;
for (y = position.y - range / 2.0F; y <= position.y + range / 2.0F; y++) {
float z;
for (z = position.z - range / 2.0F; z <= position.z + range / 2.0F; z++) {
blockPos.set(x, y, z);
if (VectorMath.shorterThan(position, blockPos, range / 2.0F) && this.map.getBlock(blockPos) != 0) {
blockPos = VectorMath.floor(blockPos).add(0.5F);
this.map.setBlock(blockPos, (byte) 0);
EntityBox b = new EntityBox(this, blockPos, new Vector3(1.0F, 1.0F, 1.0F));
b.move(blockPos.sub(position).scl(-2.0F));
this.entityManager.addEntity((Entity) b);
}
}
}
}
for (x = position.x - range / 2.0F; x <= position.x + range / 2.0F; x += 8.0F) {
float y;
for (y = position.y - range / 2.0F; y <= position.y + range / 2.0F; y += 8.0F) {
float z;
for (z = position.z - range / 2.0F; z <= position.z + range / 2.0F; z += 8.0F) {
this.map.updateChunkInfoAtBlock((int) x, (int) y, (int) z);
}
}
}
}
private void renderGeometry(Shader shader, Camera camera) {
this.entityManager.render(shader, camera);
this.map.render(shader, camera);
}
public EntityPlayer getPlayer() {
return this.player;
}
public Map getMap() {
return this.map;
}
public EntityManager getEntityManager() {
return this.entityManager;
}
public btDynamicsWorld getPhysicsWorld() {
return this.physicsWorld;
}
public Environment getEnvironment() {
return this.environment;
}
public void dispose() {
this.map.dispose();
this.entityManager.dispose();
}
}
| [
"angelo.carly@protonmail.com"
] | angelo.carly@protonmail.com |
297c5be73c1d3b197065b1c4be837bd1e7f3e86e | b867bb5702fad0cd39ab98623f10000250548d36 | /manage-parent/exam-manage-api/src/main/java/com/kalix/exam/manage/api/biz/IExamQuesBeanService.java | 4415f160743324bdcda8ce417af9ffe27746d258 | [] | no_license | chenyanxu/exam-parent | e4dcfbecaa2d52284030c0c5bddd62cd7279a8fd | a536a46461fb9564a21e914e52f76fbe72028b01 | refs/heads/master | 2022-12-19T09:48:40.525915 | 2019-09-19T05:34:34 | 2019-09-19T05:34:34 | 161,290,711 | 0 | 0 | null | 2022-12-05T23:49:38 | 2018-12-11T06:56:21 | Java | UTF-8 | Java | false | false | 1,158 | java | package com.kalix.exam.manage.api.biz;
import com.kalix.exam.manage.entities.ExamQuesBean;
import com.kalix.framework.core.api.biz.IBizService;
import java.util.List;
public interface IExamQuesBeanService extends IBizService<ExamQuesBean> {
/**
* 获取对应信息
* @param examId
* @param quesIds
* @param quesType
* @param subType
* @return
*/
ExamQuesBean getExamQuesInfo(Long examId, String quesIds, String quesType, String subType);
/**
* 按照试卷模板Id,考试Id获取试题的ids串
* @param paperId
* @param examId
* @return
*/
String getExamQuesIds(Long paperId, Long examId);
/**
* 按照试卷模板Id,考试Id获取试题信息
* @param paperId
* @return
*/
List<ExamQuesBean> getExamQuesInfo(Long paperId);
/**
* 批量添加对应表信息
* @param examQuesBeans
*/
void addBatch(List<ExamQuesBean> examQuesBeans);
/**
* 删除考试考题关联信息删除考试考题关联
* @param quesIds
* @param subType
*/
void deleteExamQuesInfo(String quesIds, String subType);
}
| [
"yangze_lmkj@163.com"
] | yangze_lmkj@163.com |
3025f0baadf57b0799cca318559cafc829f102e0 | eed7dc234af40a7e95f406f4852fbc166c18aa31 | /SMS/src/jpa/service/CourseService.java | 96ec9c068db64027920bb099d28adec9fcc03332 | [] | no_license | twash0519/My-Projects | d7195530edc1cb9636b89ec70745eb05d929e9bb | 7a757a07959cc5aad6dcf291754323296f3a6047 | refs/heads/master | 2020-05-18T13:58:34.156556 | 2019-05-14T01:15:39 | 2019-05-14T01:15:39 | 184,455,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java | package jpa.service;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import jpa.dao.CourseDAO;
import jpa.entitymodels.Course;
public class CourseService implements CourseDAO{
@Override
public List<Course> getAllCourses() {
// TODO Auto-generated method stub
EntityManagerFactory factory = Persistence.createEntityManagerFactory("SMS");
EntityManager manager = factory.createEntityManager();
Query queryCourses = manager.createQuery("select c from Course c");
List<Course> cList = queryCourses.getResultList();
for (Course course :cList) {
System.out.println(course.toString());
}
return cList;
}
}
| [
"theresa.gaines@EC2AMAZ-TJ3IE1T.corp.amazonworkspaces.com"
] | theresa.gaines@EC2AMAZ-TJ3IE1T.corp.amazonworkspaces.com |
2946c9c6dd93a37d94eccf45229c59bf8053d076 | 5bcc8fbd334efb7f60c159472d3c90c45446d5b0 | /WEB-INF/classes/codeshare/user/service/InsertUserService.java | e67a590ab2fbfb51fce0443de878342a60cfbf43 | [] | no_license | Inseok123/CodeShareSite | 1e2f45a6f7c4e9cf9b7adc8d99d67a9deaf5728f | 70a0d79daa901b0563dfaf1243a6dba6aa68d388 | refs/heads/master | 2021-01-01T11:09:58.915019 | 2020-02-09T05:58:40 | 2020-02-09T05:58:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 878 | java | package codeshare.user.service;
import java.sql.Connection;
import java.sql.SQLException;
import codeshare.dao.UserDao;
import codeshare.dto.User;
import codeshare.exception.ServiceException;
import codeshare.jdbc.ConnectionProvider;
import codeshare.jdbc.JdbcUtil;
// 회원가입 서비스 클래스
public class InsertUserService {
private static InsertUserService instance = new InsertUserService();
public static InsertUserService getInstance() {
return instance;
}
private InsertUserService() {
}
// 회원가입 메서드
public void insert(User user) {
Connection conn = null;
try {
conn = ConnectionProvider.getConnection();
UserDao dao = UserDao.getInstance();
dao.insert(conn, user);
} catch (SQLException e) {
throw new ServiceException("유저 등록 실패: " + e.getMessage(),e);
} finally {
JdbcUtil.close(conn);
}
}
}
| [
"mdour@naver.com"
] | mdour@naver.com |
b6bd1add1ff3487d5e83b5487e6eba81b39f1b06 | adde0e71a48162653fec33b2a2f52abd427539d4 | /x10-2.4.3-src/x10.compiler/src/x10/ast/X10MethodDecl_c.java | 0db967cfa7160224a66127cb64b9757a210556f6 | [] | no_license | indukprabhu/deepChunking | f8030f128df5b968413b7a776c56ef7695f70667 | 2784c6884d19493ea6372343145e557810b8e45b | refs/heads/master | 2022-06-07T19:22:19.105255 | 2020-04-29T18:49:33 | 2020-04-29T18:49:33 | 259,726,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,301 | java | /*
* This file is part of the X10 project (http://x10-lang.org).
*
* This file is licensed to You under the Eclipse Public License (EPL);
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* (C) Copyright IBM Corporation 2006-2014.
*/
package x10.ast;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import polyglot.ast.AmbExpr_c;
import polyglot.ast.Binary;
import polyglot.ast.Block;
import polyglot.ast.Call;
import polyglot.ast.CanonicalTypeNode;
import polyglot.ast.ClassMember;
import polyglot.ast.Expr;
import polyglot.ast.Field;
import polyglot.ast.FieldDecl;
import polyglot.ast.FlagsNode;
import polyglot.ast.Formal;
import polyglot.ast.Id;
import polyglot.ast.Local;
import polyglot.ast.MethodDecl;
import polyglot.ast.MethodDecl_c;
import polyglot.ast.NamedVariable;
import polyglot.ast.New;
import polyglot.ast.Node;
import polyglot.ast.NodeFactory;
import polyglot.ast.Return;
import polyglot.ast.Special;
import polyglot.ast.Stmt;
import polyglot.ast.TypeCheckFragmentGoal;
import polyglot.ast.TypeNode;
import polyglot.frontend.Globals;
import polyglot.frontend.Job;
import polyglot.frontend.SetResolverGoal;
import polyglot.main.Reporter;
import polyglot.types.ClassDef;
import polyglot.types.ClassType;
import polyglot.types.CodeDef;
import polyglot.types.ConstructorDef;
import polyglot.types.ConstructorInstance;
import polyglot.types.Context;
import polyglot.types.Def;
import polyglot.types.ErrorRef_c;
import polyglot.types.FieldInstance;
import polyglot.types.Flags;
import polyglot.types.LazyRef;
import polyglot.types.LocalDef;
import polyglot.types.MemberDef;
import polyglot.types.MemberInstance;
import polyglot.types.MethodDef;
import polyglot.types.Name;
import polyglot.types.Package;
import polyglot.types.QName;
import polyglot.types.Ref;
import polyglot.types.Ref_c;
import polyglot.types.SemanticException;
import polyglot.types.ContainerType;
import polyglot.types.Type;
import polyglot.types.TypeObject;
import polyglot.types.TypeSystem;
import polyglot.types.Types;
import polyglot.util.CodeWriter;
import polyglot.util.CollectionUtil;
import x10.util.AnnotationUtils;
import x10.util.CollectionFactory;
import polyglot.util.ErrorInfo;
import polyglot.util.InternalCompilerError;
import polyglot.util.Position;
import polyglot.util.TypedList;
import polyglot.visit.ContextVisitor;
import polyglot.visit.NodeVisitor;
import polyglot.visit.PrettyPrinter;
import polyglot.visit.Translator;
import polyglot.visit.TypeBuilder;
import polyglot.visit.TypeCheckPreparer;
import polyglot.visit.TypeChecker;
import x10.constraint.XFailure;
import x10.constraint.XVar;
import x10.constraint.XTerm;
import x10.types.constraints.ConstraintManager;
import x10.constraint.XVar;
import x10.errors.Errors;
import x10.errors.Errors.IllegalConstraint;
import x10.extension.X10Del;
import x10.extension.X10Del_c;
import x10.extension.X10Ext;
import x10.types.ConstrainedType;
import x10.types.MacroType;
import x10.types.ParameterType;
import x10.types.X10ClassDef;
import x10.types.X10ClassType;
import x10.types.X10ConstructorDef;
import polyglot.types.Context;
import x10.types.X10MemberDef;
import x10.types.X10MethodDef;
import x10.types.MethodInstance;
import x10.types.X10ParsedClassType_c;
import x10.types.X10ProcedureDef;
import x10.types.X10TypeEnv_c;
import polyglot.types.TypeSystem;
import x10.types.XTypeTranslator;
import x10.types.X10ParsedClassType;
import x10.types.X10MethodDef_c;
import x10.types.checker.Checker;
import x10.types.checker.PlaceChecker;
import x10.types.checker.VarChecker;
import x10.types.checker.Converter;
import x10.types.constraints.CConstraint;
import x10.types.constraints.CNativeRequirement;
import x10.types.constraints.TypeConstraint;
import x10.types.constraints.XConstrainedTerm;
import x10.visit.X10TypeChecker;
/** A representation of a method declaration.
* Includes an extra field to represent the guard
* in the method definition.
*
* @author vj
*
*/
public class X10MethodDecl_c extends MethodDecl_c implements X10MethodDecl {
// The representation of the guard on the method definition
DepParameterExpr guard;
List<TypeParamNode> typeParameters;
List<TypeNode> throwsTypes;
TypeNode offerType;
TypeNode hasType;
public X10MethodDecl_c(NodeFactory nf, Position pos, FlagsNode flags,
TypeNode returnType, Id name,
List<TypeParamNode> typeParams, List<Formal> formals, DepParameterExpr guard, TypeNode offerType, List<TypeNode> throwsTypes, Block body) {
super(pos, flags, returnType instanceof HasTypeNode_c ? nf.UnknownTypeNode(returnType.position()) : returnType,
name, formals, body);
this.guard = guard;
this.typeParameters = TypedList.copyAndCheck(typeParams, TypeParamNode.class, true);
if (returnType instanceof HasTypeNode_c)
hasType = ((HasTypeNode_c) returnType).typeNode();
this.offerType = offerType;
this.throwsTypes = throwsTypes;
}
public TypeNode offerType() {
return offerType;
}
protected X10MethodDecl_c hasType(TypeNode hasType) {
if (this.hasType != hasType) {
X10MethodDecl_c n = (X10MethodDecl_c) copy();
n.hasType = hasType;
return n;
}
return this;
}
public X10MethodDecl_c offerType(TypeNode offerType) {
if (this.offerType != offerType) {
X10MethodDecl_c n = (X10MethodDecl_c) copy();
n.offerType = offerType;
return n;
}
return this;
}
public List<TypeNode> throwsTypes() {
return throwsTypes;
}
public X10MethodDecl_c throwsTypes(List<TypeNode> throwsTypes) {
if (this.throwsTypes != throwsTypes) {
X10MethodDecl_c n = (X10MethodDecl_c) copy();
n.throwsTypes = throwsTypes;
return n;
}
return this;
}
protected X10MethodDef createMethodDef(TypeSystem ts, X10ClassDef ct, Flags flags) {
X10MethodDef mi = (X10MethodDef) ts.methodDef(position(), name().position(), Types.ref(ct.asType()), flags, returnType.typeRef(), name.id(),
Collections.<Ref<? extends Type>>emptyList(), Collections.<Ref<? extends Type>>emptyList(),
offerType == null ? null : offerType.typeRef());
mi.setThisDef(ct.thisDef());
mi.setPlaceTerm(PlaceChecker.methodPlaceTerm(mi));
return mi;
}
@Override
public Node buildTypesOverride(TypeBuilder tb) {
// Have to inline super.buildTypesOverride(tb) to make sure the body
// is visited after the appropriate information is set up
TypeSystem ts = tb.typeSystem();
X10ClassDef ct = tb.currentClass();
assert ct != null;
Flags flags = this.flags.flags();
if (ct.flags().isInterface()) {
flags = flags.Public().Abstract();
}
X10MethodDecl_c n = this;
X10MethodDef md = createMethodDef(ts, ct, flags);
ct.addMethod(md);
TypeBuilder tbChk = tb.pushCode(md);
final TypeBuilder tbx = tb;
final MethodDef mdx = md;
n = (X10MethodDecl_c) n.visitSignature(new NodeVisitor() {
public Node override(Node n) {
return X10MethodDecl_c.this.visitChild(n, tbx.pushCode(mdx));
}
});
List<Ref<? extends Type>> formalTypes = new ArrayList<Ref<? extends Type>>(n.formals().size());
for (Formal f1 : n.formals()) {
formalTypes.add(f1.type().typeRef());
}
md.setReturnType(n.returnType().typeRef());
md.setFormalTypes(formalTypes);
List<Ref<? extends Type>> throw_types = new ArrayList<Ref<? extends Type>>();
for (TypeNode t : n.throwsTypes()) {
throw_types.add(t.typeRef());
}
md.setThrowTypes(throw_types);
n = (X10MethodDecl_c) X10Del_c.visitAnnotations(n, tb);
List<AnnotationNode> as = ((X10Del) n.del()).annotations();
if (as != null) {
List<Ref<? extends Type>> ats = new ArrayList<Ref<? extends Type>>(as.size());
for (AnnotationNode an : as) {
ats.add(an.annotationType().typeRef());
}
md.setDefAnnotations(ats);
}
// Enable return type inference for this method declaration.
if (n.returnType() instanceof UnknownTypeNode) {
md.inferReturnType(true);
}
// XXXX inferred
if (n.guard() != null) {
md.setSourceGuard(n.guard().valueConstraint());
md.setGuard(Types.<CConstraint>lazyRef(ConstraintManager.getConstraintSystem().makeCConstraint()));
md.setTypeGuard(n.guard().typeConstraint());
} else {
md.setGuard(Types.<CConstraint>lazyRef(ConstraintManager.getConstraintSystem().makeCConstraint()));
}
List<ParameterType> typeParameters = new ArrayList<ParameterType>(n.typeParameters().size());
for (TypeParamNode tpn : n.typeParameters()) {
typeParameters.add(tpn.type());
}
md.setTypeParameters(typeParameters);
List<LocalDef> formalNames = new ArrayList<LocalDef>(n.formals().size());
for (Formal f : n.formals()) {
formalNames.add(f.localDef());
}
md.setFormalNames(formalNames);
Flags xf = md.flags();
if (xf.isProperty()) {
final LazyRef<XTerm> bodyRef = Types.lazyRef(null);
bodyRef.setResolver(new SetResolverGoal(tb.job()).intern(tb.job().extensionInfo().scheduler()));
md.body(bodyRef);
}
// property implies public, final
if (xf.isProperty()) {
if (xf.isAbstract())
xf = xf.Public();
else
xf = xf.Public().Final();
md.setFlags(xf);
n = (X10MethodDecl_c) n.flags(n.flags().flags(xf));
}
Block body = (Block) n.visitChild(n.body, tbChk);
n = (X10MethodDecl_c) n.body(body);
return n.methodDef(md);
}
@Override
public void addDecls(Context c) {
}
public void setResolver(Node parent, final TypeCheckPreparer v) {
X10MethodDef mi = (X10MethodDef) this.mi;
if (mi.body() instanceof LazyRef<?>) {
LazyRef<XTerm> r = (LazyRef<XTerm>) mi.body();
TypeChecker tc = new X10TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo());
tc = (TypeChecker) tc.context(v.context().freeze());
r.setResolver(new TypeCheckFragmentGoal<XTerm>(parent, this, tc, r, false));
}
// if (mi.guard() instanceof LazyRef<?>) {
// final LazyRef<CConstraint> g = (LazyRef<CConstraint>) mi.guard();
// g.setResolver(new Runnable(){
// public void run() {
// if (mi.sourceGuard() != null) {
// g.update(mi.sourceGuard().get());
// System.err.println("Propagating source guard unmodified " + g.get());
// } else {
// g.update(ConstraintManager.getConstraintSystem().makeCConstraint());
// }
// }
// });
// }
}
/** Visit the children of the method. */
public Node visitSignature(NodeVisitor v) {
FlagsNode flags = (FlagsNode) this.visitChild(this.flags, v);
Id name = (Id) this.visitChild(this.name, v);
List<TypeParamNode> typeParams = visitList(this.typeParameters, v);
List<Formal> formals = this.visitList(this.formals, v);
DepParameterExpr guard = (DepParameterExpr) visitChild(this.guard, v);
TypeNode ht = (TypeNode) visitChild(this.hasType, v);
TypeNode ot = (TypeNode) visitChild(this.offerType, v);
TypeNode returnType = (TypeNode) visitChild(this.returnType, v);
List<TypeNode> throwsTypes = visitList(this.throwsTypes, v);
return reconstruct(flags, name, typeParams, formals, guard, ht, returnType, ot, throwsTypes, this.body);
}
/** Reconstruct the method.
* @param throwsTypes2 */
protected X10MethodDecl_c reconstruct(FlagsNode flags, Id name, List<TypeParamNode> typeParameters, List<Formal> formals, DepParameterExpr guard, TypeNode hasType, TypeNode returnType, TypeNode offerType, List<TypeNode> throwsTypes, Block body) {
X10MethodDecl_c n = (X10MethodDecl_c) super.reconstruct(flags, returnType, name, formals, body);
if (! CollectionUtil.allEqual(typeParameters, n.typeParameters) || guard != n.guard || hasType != n.hasType || offerType != n.offerType || ! CollectionUtil.allEqual(throwsTypes, n.throwsTypes) ) {
if (n == this) {
n = (X10MethodDecl_c) n.copy();
}
n.typeParameters = TypedList.copyAndCheck(typeParameters, TypeParamNode.class, true);
n.guard = guard;
n.hasType = hasType;
n.offerType = offerType;
n.throwsTypes = throwsTypes;
return n;
}
return n;
}
public List<TypeParamNode> typeParameters() {
return typeParameters;
}
public X10MethodDecl_c typeParameters(List<TypeParamNode> typeParams) {
X10MethodDecl_c n = (X10MethodDecl_c) copy();
n.typeParameters=TypedList.copyAndCheck(typeParams, TypeParamNode.class, true);
return n;
}
public DepParameterExpr guard() { return guard; }
public X10MethodDecl_c guard(DepParameterExpr e) {
X10MethodDecl_c n = (X10MethodDecl_c) copy();
n.guard = e;
return n;
}
@Override
public X10MethodDecl_c flags(FlagsNode flags) {
return (X10MethodDecl_c) super.flags(flags);
}
@Override
public X10MethodDecl_c returnType(TypeNode returnType) {
return (X10MethodDecl_c) super.returnType(returnType);
}
@Override
public X10MethodDecl_c name(Id name) {
return (X10MethodDecl_c) super.name(name);
}
@Override
public X10MethodDecl_c formals(List<Formal> formals) {
return (X10MethodDecl_c) super.formals(formals);
}
@Override
public X10MethodDecl_c methodDef(MethodDef mi) {
return (X10MethodDecl_c) super.methodDef(mi);
}
@Override
public X10MethodDef methodDef() {
return (X10MethodDef) super.methodDef();
}
@Override
public Context enterScope(Context c) {
c = super.enterScope(c);
if (!c.inStaticContext() && methodDef().thisDef() != null)
c.addVariable(methodDef().thisDef().asInstance());
return c;
}
@Override
public Context enterChildScope(Node child, Context c) {
// We should have entered the method scope already.
assert c.currentCode() == this.methodDef();
Context oldC = c;
if (child != body()) {
// Push formals so they're in scope in the types of the other formals.
c = c.pushBlock();
for (TypeParamNode f : typeParameters) {
f.addDecls(c);
}
for (int i=0; i < formals.size(); i++) {
Formal f = formals.get(i);
f.addDecls(c);
if (f == child)
break; // do not add downstream formals
}
}
// Ensure that the place constraint is set appropriately when
// entering the appropriate children
if (child == body || child == returnType || child == hasType || child == offerType || child == guard
|| (formals != null && formals.contains(child))|| (throwsTypes != null && throwsTypes.contains(child))) {
X10MethodDef md = methodDef();
XConstrainedTerm placeTerm = md == null ? null : md.placeTerm();
if (placeTerm == null) {
placeTerm = PlaceChecker.methodPlaceTerm(md);
}
if (c == oldC)
c = c.pushBlock();
c.setPlace(placeTerm);
}
if (child == body && offerType != null && offerType.typeRef().known()) {
if (oldC == c)
c = c.pushBlock();
c.setCollectingFinishScope(offerType.type());
}
// Add the method guard into the environment.
if (guard != null) {
if (child == body || child == offerType || child == hasType || child == returnType
|| (formals != null && formals.contains(child))|| (throwsTypes != null && throwsTypes.contains(child))) {
Ref<CConstraint> vc = guard.valueConstraint();
Ref<TypeConstraint> tc = guard.typeConstraint();
if (vc != null || tc != null) {
if (oldC==c) {
c = c.pushBlock();
}
c.setName(" MethodGuard for |" + mi.name() + "| ");
if (vc != null)
c.addConstraint(vc);
if (tc != null) {
c.setTypeConstraintWithContextTerms(tc);
}
}
}
}
addInClassInvariantIfNeeded(c, false);
return super.enterChildScope(child, c);
}
public void addInClassInvariantIfNeeded(Context c, boolean force) {
if (!mi.flags().isStatic()) {
// this call occurs in the body of an instance method for T.
// Pick up the real clause for T -- that information is known
// statically about "this"
Ref<? extends ContainerType> container = mi.container();
if (container.known()) {
X10ClassType type = (X10ClassType) Types.get(container);
Ref<CConstraint> rc = type.x10Def().realClauseWithThis();
c.addConstraint(rc);
Ref<TypeConstraint> tc = type.x10Def().typeBounds();
if (tc != null) {
c.setTypeConstraintWithContextTerms(tc);
}
}
}
}
public void translate(CodeWriter w, Translator tr) {
Context c = tr.context();
Flags flags = flags().flags();
if (c.currentClass().flags().isInterface()) {
flags = flags.clearPublic();
flags = flags.clearAbstract();
}
FlagsNode oldFlags = this.flags;
try {
this.flags = this.flags.flags(flags.retainJava()); // ensure that X10Flags are not printed out .. javac will not know what to do with them.
super.translate(w, tr);
}
finally {
this.flags = oldFlags;
}
}
@Override
public Node setResolverOverride(Node parent, TypeCheckPreparer v) {
final X10MethodDef mi = (X10MethodDef) this.mi;
if (mi.inferGuard() && body() != null) {
NodeVisitor childv = v.enter(parent, this);
childv = childv.enter(this, v.nodeFactory().Empty(Position.COMPILER_GENERATED));
if (mi.guard() instanceof LazyRef<?>) {
TypeCheckPreparer tcp = (TypeCheckPreparer) childv;
final LazyRef<CConstraint> r = (LazyRef<CConstraint>) mi.guard();
TypeChecker tc = new X10TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo(), true);
tc = (TypeChecker) tc.context(tcp.context().freeze());
r.setResolver(new TypeCheckInferredGuardGoal(this, new Node[] { }, body(), tc, r, mi.sourceGuard()));
/*
g.setResolver(new Runnable(){
public void run() {
g.update(mi.sourceGuard().get());
System.err.println("Propagating guard " + g.get() + " for method " + mi.name());
}
});
*/
}
}
else {
if (mi.guard() instanceof LazyRef<?>) {
final LazyRef<CConstraint> r = (LazyRef<CConstraint>) mi.guard();
r.setResolver(new Runnable(){
public void run() {
if (mi.sourceGuard() != null) {
r.update(mi.sourceGuard().get());
// System.err.println("Propagating source guard unmodified " + r.get());
} else {
r.update(ConstraintManager.getConstraintSystem().makeCConstraint());
}
}
});
}
}
if (returnType() instanceof UnknownTypeNode && body() != null) {
UnknownTypeNode tn = (UnknownTypeNode) returnType();
NodeVisitor childv = v.enter(parent, this);
childv = childv.enter(this, returnType());
if (childv instanceof TypeCheckPreparer) {
TypeCheckPreparer tcp = (TypeCheckPreparer) childv;
final LazyRef<Type> r = (LazyRef<Type>) tn.typeRef();
TypeChecker tc = new X10TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo(), true);
tc = (TypeChecker) tc.context(tcp.context().freeze());
// todo: if the return type is void, let's skip this whole resolver stuff.
r.setResolver(new TypeCheckReturnTypeGoal(this, new Node[] { guard(), offerType() }, body(), tc, r));
}
}
return super.setResolverOverride(parent, v);
}
@Override
protected void checkFlags(ContextVisitor tc, Flags xf) {
// Set the native flag if incomplete or extern so super.checkFlags doesn't complain.
super.checkFlags(tc, xf);
if (xf.isProperty() && ! xf.isAbstract() && ! xf.isFinal()) {
Errors.issue(tc.job(),
new Errors.NonAbstractPropertyMethodMustBeFinal(position()));
}
//if (xf.isProperty() && xf.isStatic()) {
// Errors.issue(tc.job(),
// new Errors.PropertyMethodCannotBeStatic(position()));
//}
}
private Type getType(ContextVisitor tc, String name) throws SemanticException {
return tc.typeSystem().systemResolver().findOne(QName.make(name));
}
private boolean nodeHasOneAnnotation(ContextVisitor tc, Node n, String ann_name) {
X10Ext ext = (X10Ext) n.ext();
try {
List<X10ClassType> anns = ext.annotationMatching(getType(tc, ann_name));
if (anns.size() == 0) return false;
if (anns.size() > 1) {
Errors.issue(tc.job(), new SemanticException("Cannot have more than one @Opaque annotation", n.position()));
}
return true;
} catch (SemanticException e) {
assert false : e;
return false; // in case asserts are off
}
}
@Override
public Node typeCheck(ContextVisitor tc) {
X10MethodDecl_c n = this;
NodeFactory nf = tc.nodeFactory();
TypeSystem ts = (TypeSystem) tc.typeSystem();
if (((TypeSystem) tc.typeSystem()).isStructType(mi.container().get())) {
Flags xf = mi.flags().Final();
mi.setFlags(xf);
n = (X10MethodDecl_c) n.flags(n.flags().flags(xf));
}
Flags xf = mi.flags();
//if (xf.isProperty() && body == null) {
// Errors.issue(tc.job(),
// new SemanticException("A property method must have a body.", position()));
//}
if (xf.isProperty()) {
boolean ok = false;
if (xf.isAbstract() || xf.isNative()) {
ok = true;
}
if (nodeHasOneAnnotation(tc,n,"x10.compiler.Opaque")) {
ok = true;
} else if (n.body != null && n.body.statements().size() == 1) {
Stmt s = n.body.statements().get(0);
if (s instanceof Return) {
Return r = (Return) s;
if (r.expr() != null) {
final X10MethodDef_c mdef = (X10MethodDef_c) mi;
// detecting cycles in property methods
// recurse into the expr to see what other methods we call
if (mdef.isCircularPropertyMethod(r.expr())) {
Errors.issue(tc.job(), new SemanticException("Circular property method definition. Expanding the property method may result in an infinite loop.\n\tProperty:"+mi, position));
} else {
// while expanding this expression we might recursively type check the same method
XTerm v = null;
try {
Context cxt = tc.context();
// Translate the body with the SpecialAsQualifiedVar
// bit turned on.
cxt = cxt.pushSpecialAsQualifiedVar();
v = ts.xtypeTranslator().translate((CConstraint) null, r.expr(), cxt, true);
ok = true;
X10MethodDef mi = (X10MethodDef) this.mi;
if (mi.body() instanceof LazyRef<?>) {
LazyRef<XTerm> bodyRef = (LazyRef<XTerm>) mi.body();
bodyRef.update(v);
}
} catch (IllegalConstraint z) {
Errors.issue(tc.job(),z);
ok = true;
}
}
}
}
}
if (! ok)
Errors.issue(tc.job(),
new Errors.MethodBodyMustBeConstraintExpressiong(position()));
}
n = (X10MethodDecl_c) n.superTypeCheck(tc);
try {
dupFormalCheck(typeParameters, formals);
} catch (SemanticException e) {
Errors.issue(tc.job(), e, n);
}
try {
Types.checkMissingParameters(n.returnType());
} catch (SemanticException e) {
Errors.issue(tc.job(), e, n.returnType());
}
if (!position.isCompilerGenerated()) { // for struct X[+T], we generate equals(T), but it is type-safe because it is readonly and struct are final.
// formals are always in contravariant positions, while return type in covariant position (ctors are ignored)
for (Formal f : n.formals) {
final TypeNode fType = f.type();
Types.checkVariance(fType, ParameterType.Variance.CONTRAVARIANT,tc.job());
}
Types.checkVariance(n.returnType, ParameterType.Variance.COVARIANT,tc.job());
}
// check subtype restriction on implicit and explicit operator as:
// the return type must be a subtype of the container type
final Name nameId = n.name.id();
if (nameId==Converter.implicit_operator_as || nameId==Converter.operator_as) {
final X10MethodDef methodDef = n.methodDef();
final ContainerType container = methodDef.container().get();
final Type returnT = Types.baseType(methodDef.returnType().get());
final List<Ref<? extends Type>> formals = methodDef.formalTypes();
assert formals.size()==1 : "Currently it is a parsing error if the number of formals for an implicit or explicit 'as' operator is different than 1! formals="+formals;
final Type argumentT = Types.baseType(formals.get(0).get());
// I compare ClassDef due to this example:
//class B[U] {
// public static operator[T](x:T):B[T] = null;
//}
// We only search in the target type (not the source type), so
// public static operator (x:Bar) as Any = null; // ERR
assert container instanceof X10ParsedClassType : container;
boolean isReturnWrong = !(returnT instanceof X10ParsedClassType) || ((X10ParsedClassType)returnT ).def()!=((X10ParsedClassType)container).def();
boolean isFormalWrong = SEARCH_CASTS_ONLY_IN_TARGET || !(argumentT instanceof X10ParsedClassType) || ((X10ParsedClassType)argumentT).def()!=((X10ParsedClassType)container).def();
if (isReturnWrong && isFormalWrong) {
Errors.issue(tc.job(),
new Errors.MustHaveSameClassAsContainer(n.position()));
}
}
return n;
}
private static boolean SEARCH_CASTS_ONLY_IN_TARGET = true; // see XTENLANG_2667
public static void dupFormalCheck(List<TypeParamNode> typeParams, List<Formal> formals) throws SemanticException {
Set<Name> pnames = CollectionFactory.newHashSet();
for (TypeParamNode p : typeParams) {
Name name = p.name().id();
if (pnames.contains(name))
throw new Errors.TypeParameterMultiplyDefined(name, p.position());
pnames.add(name);
}
// Check for duplicate formals. This isn't caught in Formal_c
// because we add all the formals into the scope before visiting a
// formal, so the lookup of a duplicate formal returns itself rather
// than the previous formal.
Set<Name> names = CollectionFactory.newHashSet();
LinkedList<Formal> q = new LinkedList<Formal>();
q.addAll(formals);
while (! q.isEmpty()) {
Formal f = q.removeFirst();
Name name = f.name().id();
if (! name.equals(Name.make(""))) {
if (names.contains(name))
throw new Errors.LocalVariableMultiplyDefined(name, f.position());
names.add(name);
}
if (f instanceof X10Formal) {
X10Formal ff = (X10Formal) f;
q.addAll(ff.vars());
}
}
}
protected X10MethodDecl_c superTypeCheck(ContextVisitor tc) {
return (X10MethodDecl_c) super.typeCheck(tc);
}
@Override
public Node conformanceCheck(ContextVisitor tc) {
//checkVariance(tc);
MethodDef mi = this.methodDef();
TypeSystem xts = (TypeSystem) tc.typeSystem();
if (mi.flags().isProperty()) {
MethodInstance xmi = (MethodInstance) mi.asInstance();
if (xmi.guard() != null && ! xmi.guard().valid())
Errors.issue(tc.job(),
new Errors.PropertyMethodCannotHaveGuard(guard, position()));
}
checkVisibility(tc, this);
// Need to ensure that method overriding is checked in the right context
// The classInvariant needs to be added.
// Note that the guard should not be added, since we need to check that the
// guard is entailed by any method that is overridden by this method.
Context childtc = tc.context().pushBlock();
addInClassInvariantIfNeeded(childtc, true);
ContextVisitor childVisitor = tc.context(childtc);
return super.conformanceCheck(childVisitor);
}
final static boolean CHECK_VISIBILITY = false;
protected static void checkVisibility(ContextVisitor tc, final ClassMember mem) {
// This doesn't work since we've already translated away expressions into constraints.
if (! CHECK_VISIBILITY)
return;
final SemanticException[] ex = new SemanticException[1];
// Check if all fields, methods, etc accessed from the signature of mem are in scope wherever mem can be accessed.
// Assumes the fields, methods, etc are accessible from mem, at least.
mem.visitChildren(new NodeVisitor() {
boolean on = false;
@Override
public Node override(Node parent, Node n) {
if (! on) {
if (n instanceof TypeNode) {
try {
on = true;
return this.visitEdgeNoOverride(parent, n);
}
finally {
on = false;
}
}
else {
return this.visitEdgeNoOverride(parent, n);
}
}
if (n instanceof Stmt) {
return n;
}
if (parent instanceof FieldDecl && n == ((FieldDecl) parent).init()) {
return n;
}
if (n instanceof Field) {
FieldInstance fi = (((Field) n).fieldInstance());
if (! hasSameScope(fi, mem.memberDef())) {
ex[0] = new SemanticException("Field " + fi.name() + " cannot be used in this signature; not accessible from all contexts in which the member is accessible.", n.position());
}
}
if (n instanceof Call) {
MethodInstance mi = (((Call) n).methodInstance());
if (! hasSameScope(mi, mem.memberDef())) {
ex[0] = new SemanticException("Method " + mi.signature() + " cannot be used in this signature; not accessible from all contexts in which the member is accessible.", n.position());
}
}
if (n instanceof ClosureCall) {
MethodInstance mi = (((ClosureCall) n).closureInstance());
if (! hasSameScope(mi, mem.memberDef())) {
ex[0] = new SemanticException("Method " + mi.signature() + " cannot be used in this signature; not accessible from all contexts in which the member is accessible.", n.position());
}
}
if (n instanceof TypeNode) {
TypeNode tn = (TypeNode) n;
Type t = tn.type();
t = Types.baseType(t);
if (t instanceof X10ClassType) {
X10ClassType ct = (X10ClassType) t;
if (! hasSameScope(ct, mem.memberDef())) {
ex[0] = new SemanticException("Class " + ct.fullName() + " cannot be used in this signature; not accessible from all contexts in which the member is accessible.", n.position());
}
}
}
if (n instanceof New) {
ConstructorInstance ci = (((New) n).constructorInstance());
if (! hasSameScope(ci, mem.memberDef())) {
ex[0] = new SemanticException("Constructor " + ci.signature() + " cannot be used in this signature; not accessible from all contexts in which the member is accessible.", n.position());
}
}
return null;
}
Flags getSignatureFlags(MemberDef def) {
Flags sigFlags = def.flags();
if (def instanceof ClassDef) {
ClassDef cd = (ClassDef) def;
if (cd.isTopLevel()) {
return sigFlags;
}
if (cd.isMember()) {
ClassDef outer = Types.get(cd.outer());
Flags outerFlags = getSignatureFlags(outer);
return combineFlagsWithContainerFlags(sigFlags, outerFlags);
}
return Flags.PRIVATE;
}
else {
Type t = Types.get(def.container());
t = Types.baseType(t);
if (t instanceof ClassType) {
ClassType ct = (ClassType) t;
Flags outerFlags = getSignatureFlags(ct.def());
return combineFlagsWithContainerFlags(sigFlags, outerFlags);
}
}
return sigFlags;
}
private Flags combineFlagsWithContainerFlags(Flags sigFlags, Flags outerFlags) {
if (outerFlags.isPrivate() || sigFlags.isPrivate())
return Flags.PRIVATE;
if (outerFlags.isPackage() || sigFlags.isPackage())
return Flags.NONE;
if (outerFlags.isProtected())
return Flags.NONE;
if (sigFlags.isProtected())
return Flags.PROTECTED;
return Flags.PUBLIC;
}
private <T extends Def> boolean hasSameScope(MemberInstance<T> mi, MemberDef signature) {
Flags sigFlags = getSignatureFlags(signature);
if (sigFlags.isPrivate()) {
return true;
}
if (sigFlags.isPackage()) {
if (mi.flags().isPublic())
return true;
if (mi.flags().isProtected() || mi.flags().isPackage()) {
return hasSamePackage(mi.def(), signature);
}
return false;
}
if (sigFlags.isProtected()) {
if (mi.flags().isPublic())
return true;
if (mi.flags().isProtected()) {
return hasSameClass(mi.def(), signature);
}
return false;
}
if (sigFlags.isPublic()) {
if (mi.flags().isPublic())
return true;
return false;
}
return false;
}
private ClassDef getClass(Def def) {
if (def instanceof ClassDef) {
return (ClassDef) def;
}
if (def instanceof MemberDef) {
MemberDef md = (MemberDef) def;
Type container = Types.get(md.container());
if (container != null) {
container = Types.baseType(container);
if (container instanceof ClassType) {
return ((ClassType) container).def();
}
}
}
return null;
}
private boolean hasSameClass(Def def, MemberDef accessor) {
ClassDef c1 = getClass(def);
ClassDef c2 = getClass(accessor);
if (c1 == null || c2 == null)
return false;
return c1.equals(c2);
}
private boolean hasSamePackage(Def def, MemberDef accessor) {
ClassDef c1 = getClass(def);
ClassDef c2 = getClass(accessor);
if (c1 == null || c2 == null)
return false;
Package p1 = Types.get(c1.package_());
Package p2 = Types.get(c2.package_());
if (p1 == null && p2 == null)
return true;
if (p1 == null || p2 == null)
return false;
return p1.equals(p2);
}
});
if (ex[0] != null)
Errors.issue(tc.job(), ex[0], mem);
}
/*protected void checkVariance(ContextVisitor tc) {
if (methodDef().flags().isStatic())
return;
X10ClassDef cd = (X10ClassDef) tc.context().currentClassDef();
final Map<Name,ParameterType.Variance> vars = CollectionFactory.newHashMap();
for (int i = 0; i < cd.typeParameters().size(); i++) {
ParameterType pt = cd.typeParameters().get(i);
ParameterType.Variance v = cd.variances().get(i);
vars.put(pt.name(), v);
}
try {
Checker.checkVariancesOfType(returnType.position(), returnType.type(), ParameterType.Variance.COVARIANT, "as a method return type", vars, tc);
} catch (SemanticException e) {
Errors.issue(tc.job(), e, this);
}
for (Formal f : formals) {
try {
Checker.checkVariancesOfType(f.type().position(), f.declType(), ParameterType.Variance.CONTRAVARIANT, "as a method parameter type", vars, tc);
} catch (SemanticException e) {
Errors.issue(tc.job(), e, this);
}
}
}*/
public Node typeCheckOverride(Node parent, ContextVisitor tc) {
X10MethodDecl nn = this;
X10MethodDecl old = nn;
TypeSystem xts = (TypeSystem) tc.typeSystem();
// Step 0. Process annotations.
TypeChecker childtc = (TypeChecker) tc.enter(parent, nn);
nn = (X10MethodDecl) X10Del_c.visitAnnotations(nn, childtc);
// Do not infer types of native methods
if (nn.returnType() instanceof UnknownTypeNode && ! X10FieldDecl_c.shouldInferType(nn, xts))
Errors.issue(tc.job(), new Errors.CannotInferNativeMethodReturnType(position()));
// Step I.a. Check the formals.
// First, record the final status of each of the type params and formals.
List<TypeParamNode> processedTypeParams = nn.visitList(nn.typeParameters(), childtc);
nn = (X10MethodDecl) nn.typeParameters(processedTypeParams);
List<Formal> processedFormals = nn.visitList(nn.formals(), childtc);
nn = (X10MethodDecl) nn.formals(processedFormals);
// [NN]: Don't do this here, do it on lookup of the formal. We don't want spurious self constraints in the signature.
// for (Formal n : processedFormals) {
// Ref<Type> ref = (Ref<Type>) n.type().typeRef();
// Type newType = ref.get();
//
// if (n.localDef().flags().isFinal()) {
// XConstraint c = X10TypeMixin.xclause(newType);
// if (c == null)
// c = new XConstraint_c();
// else
// c = c.copy();
// try {
// c.addSelfBinding(xts.xtypeTranslator().trans(n.localDef().asInstance()));
// }
// catch (XFailure e) {
// throw new SemanticException(e.getMessage(), position());
// }
// newType = X10TypeMixin.xclause(newType, c);
// }
//
// ref.update(newType);
// }
// Step I.b. Check the guard.
if (nn.guard() != null) {
ContextVisitor guardtc = childtc.context(childtc.context().pushDepType(Types.<Type>ref(xts.unknownType(nn.guard().position()))));
DepParameterExpr processedWhere = (DepParameterExpr) nn.visitChild(nn.guard(), guardtc);
nn = (X10MethodDecl) nn.guard(processedWhere);
VarChecker ac = new VarChecker(childtc.job());
ac = (VarChecker) ac.context(childtc.context());
processedWhere.visit(ac);
if (ac.error != null) {
Errors.issue(ac.job(), ac.error, this);
}
// Now build the new formal arg list.
// TODO: Add a marker to the TypeChecker which records
// whether in fact it changed the type of any formal.
List<Formal> formals = processedFormals;
//List newFormals = new ArrayList(formals.size());
X10ProcedureDef pi = (X10ProcedureDef) nn.memberDef();
CConstraint c = pi.guard().get();
try {
if (c != null) {
c = c.copy();
for (Formal n : formals) {
Ref<Type> ref = (Ref<Type>) n.type().typeRef();
Type newType = ref.get();
// Fold the formal's constraint into the guard.
XVar var = xts.xtypeTranslator().translate(n.localDef().asInstance());
CConstraint dep = Types.xclause(newType);
if (dep != null) {
dep = dep.copy();
dep = dep.substitute(var, c.self());
/*
XPromise p = dep.intern(var);
dep = dep.substitute(p.term(), c.self());
*/
c.addIn(dep);
}
ref.update(newType);
}
}
// reporter.report(1, "X10MethodDecl_c: typeoverride mi= " + nn.methodInstance());
// Fold this's constraint (the class invariant) into the guard.
{
Type t = tc.context().currentClass();
CConstraint dep = Types.xclause(t);
if (c != null && dep != null) {
XVar thisVar = methodDef().thisVar();
if (thisVar != null)
dep = dep.substitute(thisVar, c.self());
// dep = dep.copy();
// XPromise p = dep.intern(xts.xtypeTranslator().transThis(t));
// dep = dep.substitute(p.term(), c.self());
c.addIn(dep);
}
}
}
catch (XFailure e) {
tc.errorQueue().enqueue(ErrorInfo.SEMANTIC_ERROR, e.getMessage(), position());
c = null;
}
// Check if the guard is consistent.
if (c != null && ! c.consistent()) {
Errors.issue(tc.job(),
new Errors.DependentClauseIsInconsistent("method", guard),
this);
// FIXME: [IP] mark constraint clause as invalid
}
}
List<TypeNode> processedThrowsTypes = nn.visitList(nn.throwsTypes(), childtc);
nn = (X10MethodDecl) nn.throwsTypes(processedThrowsTypes);
// Step II. Check the return type.
// Now visit the returntype to ensure that its depclause, if any is processed.
// Visit the formals so that they get added to the scope .. the return type
// may reference them.
//TypeChecker tc1 = (TypeChecker) tc.copy();
// childtc will have a "wrong" mi pushed in, but that doesnt matter.
// we simply need to push in a non-null mi here.
TypeChecker childtc1 = (TypeChecker) tc.enter(parent, nn);
if (childtc1.context() == tc.context())
childtc1 = (TypeChecker) childtc1.context((Context) tc.context().shallowCopy());
// Add the type params and formals to the context.
nn.visitList(nn.typeParameters(),childtc1);
nn.visitList(nn.formals(),childtc1);
Context childCxt = childtc1.context();
addInClassInvariantIfNeeded(childCxt, true);
childCxt.setVarWhoseTypeIsBeingElaborated(null);
{
final TypeNode r = (TypeNode) nn.visitChild(nn.returnType(), childtc1);
nn = (X10MethodDecl) nn.returnType(r);
Type type = PlaceChecker.ReplaceHereByPlaceTerm(r.type(), ( Context ) childtc1.context());
((Ref<Type>) nn.methodDef().returnType()).update(r.type());
if (hasType != null) {
final TypeNode h = (TypeNode) nn.visitChild(((X10MethodDecl_c) nn).hasType, childtc1);
Type hasType = PlaceChecker.ReplaceHereByPlaceTerm(h.type(), ( Context ) childtc1.context());
nn = (X10MethodDecl) ((X10MethodDecl_c) nn).hasType(h);
boolean checkSubType = true;
try {
Types.checkMissingParameters(h);
} catch (SemanticException e) {
Errors.issue(tc.job(), e, h);
checkSubType = false;
}
if (checkSubType && ! xts.isSubtype(type, hasType, tc.context())) {
Errors.issue(tc.job(),
new Errors.TypeIsNotASubtypeOfTypeBound(type, hasType, position()));
}
}
// Check the offer type
if (offerType != null) {
final TypeNode o = (TypeNode) nn.visitChild(((X10MethodDecl_c) nn).offerType, childtc1);
nn = (X10MethodDecl) ((X10MethodDecl_c) nn).offerType(o);
((X10MethodDef) nn.methodDef()).setOfferType(Types.ref(o.type()));
}
}
// reporter.report(1, "X10MethodDecl_c: typeoverride mi= " + nn.methodInstance());
// Step III. Check the body.
// We must do it with the correct mi -- the return type will be
// checked by return e; statements in the body, and the offerType by offer e; statements in the body.
TypeChecker childtc2 = (TypeChecker) tc.enter(parent, nn); // this will push in the right mi.
// Add the type params and formals to the context.
nn.visitList(nn.typeParameters(),childtc2);
nn.visitList(nn.formals(),childtc2);
addInClassInvariantIfNeeded(childtc2.context(), true);
//reporter.report(1, "X10MethodDecl_c: after visiting formals " + childtc2.context());
// Now process the body.
nn = (X10MethodDecl) nn.body((Block) nn.visitChild(nn.body(), childtc2));
nn = (X10MethodDecl) childtc2.leave(parent, old, nn, childtc2);
if (nn.returnType() instanceof UnknownTypeNode && X10FieldDecl_c.shouldInferType(nn, xts)) {
NodeFactory nf = tc.nodeFactory();
if (nn.body() == null) {
Errors.issue(tc.job(), new Errors.CannotInferMethodReturnType(nn.position()));
Position rtpos = nn.returnType().position();
nn = (X10MethodDecl_c) nn.returnType(nf.CanonicalTypeNode(rtpos, xts.unknownType(rtpos)));
}
// Body had no return statement. Set to void.
Type t;
if (!xts.isUnknown(nn.returnType().typeRef().getCached())) {
t = nn.returnType().typeRef().getCached();
}
else {
t = xts.Void();
}
((Ref<Type>) nn.returnType().typeRef()).update(t);
nn = (X10MethodDecl) nn.returnType(nf.CanonicalTypeNode(nn.returnType().position(), t));
}
return nn;
}
private static final Collection<String> TOPICS =
CollectionUtil.list(Reporter.types, Reporter.context);
/** Write the method to an output file. */
public void prettyPrintHeader(CodeWriter w, PrettyPrinter tr) {
w.begin(0);
for (Iterator<AnnotationNode> i = (((X10Ext) this.ext()).annotations()).iterator(); i.hasNext(); ) {
AnnotationNode an = i.next();
an.prettyPrint(w, tr);
w.allowBreak(0, " ");
}
print(flags, w, tr);
w.write("def " + name);
if (!typeParameters.isEmpty()) {
w.write("[");
w.begin(0);
for (Iterator<TypeParamNode> pi = typeParameters.iterator(); pi.hasNext(); ) {
TypeParamNode pn = pi.next();
print(pn, w, tr);
if (pi.hasNext()) {
w.write(",");
w.allowBreak(0, " ");
}
}
w.end();
w.write("]");
}
w.write("(");
w.allowBreak(2, 2, "", 0);
w.begin(0);
for (Iterator<Formal> i = formals.iterator(); i.hasNext(); ) {
Formal f = i.next();
print(f, w, tr);
if (i.hasNext()) {
w.write(",");
w.allowBreak(0, " ");
}
}
w.end();
w.write("):");
w.allowBreak(2, 2, "", 1);
print(returnType, w, tr);
w.end();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(flags.flags().translate());
sb.append(returnType).append(" ");
sb.append(name);
if (typeParameters != null && !typeParameters.isEmpty())
sb.append(typeParameters);
sb.append("(...)");
return sb.toString();
}
}
| [
"NVIDIA.COM+User(622487)@IK-LT.nvidia.com"
] | NVIDIA.COM+User(622487)@IK-LT.nvidia.com |
56b202353c304ee2fb2bad694a9248f9105f88d3 | b71272908fc8e9440d7af1860376ab93ba3ca6aa | /src/main/java/ru/itis/LZ77Test.java | ff0594ec9b612e3c3d8b4feb6478a91d439a976d | [] | no_license | a-shn/TextCompressor | ae380398ca02c2f8819fdf829968192d1b52b2dc | 5997da071e71fb7aed8d22fda69c53736884afc6 | refs/heads/master | 2023-01-20T18:05:55.271430 | 2020-11-27T13:41:47 | 2020-11-27T13:41:47 | 314,833,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 845 | java | package ru.itis;
import ru.itis.structures.LZ78Node;
import ru.itis.structures.Node;
import ru.itis.utils.FileReader;
import ru.itis.utils.LZ78;
import ru.itis.utils.SlidingWindowLZ77;
import java.io.IOException;
import java.util.List;
public class LZ77Test {
public static void main(String[] args) throws IOException {
final int BUFFER_SIZE = 10;
String filepath = "/home/xiu-xiu/PythonProjects/Archivator/data/voina_i_mir.txt";
FileReader fileReader = new FileReader();
List<Integer> fileInts = fileReader.getIntArrayOfFile(filepath);
SlidingWindowLZ77 lz77 = new SlidingWindowLZ77();
List<Node> nodes = lz77.getNodesList(fileInts, BUFFER_SIZE);
System.out.println("symbols in raw: " + fileInts.size());
System.out.println("nodes after lz77: " + nodes.size());
}
}
| [
"sh.il.almaz@gmail.com"
] | sh.il.almaz@gmail.com |
97dfd1a2ec45321675130371e3419c1ac9bfea07 | 315da21cafff4f0a9604caa2feb529a9ed99db54 | /seckill-demo/src/main/java/com/cckp/seckill/controller/DemoController.java | 500695f62746cc88e3e003959639233abe284200 | [] | no_license | cckp/ms | d261cdd7515e96f67adedbb46ebbb7d5c68b2e98 | 2b9d8cae1eaade60ec8a778452b5e071a9c641f0 | refs/heads/main | 2023-06-06T20:35:37.577739 | 2021-07-01T16:47:12 | 2021-07-01T16:47:12 | 381,922,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package com.cckp.seckill.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author cckp
*/
@Controller
@RequestMapping("/demo")
public class DemoController {
@RequestMapping("/hello")
public String hello(Model model) {
model.addAttribute("name", "cckp");
return "hello";
}
}
| [
"1454660582@qq.com"
] | 1454660582@qq.com |
767e70fa23f205a530161b91f53260aa6dfea7c7 | 183154b0421c1a5a0c820c42f2b94aa69f81fdd2 | /src/test/java/cyclops/control/either/CompletableEither4Test.java | 1286c2869644e56e344d3d3ab83680d0a53c16fa | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jbgi/cyclops-react | b8996fc741a7c9483f58e2ef67793d460b44ea98 | bf1a4fe159d6e5600012ae9c3a76a30f2df78606 | refs/heads/master | 2021-03-16T05:07:14.062630 | 2017-05-17T06:23:46 | 2017-05-17T06:23:46 | 91,538,054 | 1 | 0 | null | 2017-05-17T05:45:05 | 2017-05-17T05:45:05 | null | UTF-8 | Java | false | false | 18,629 | java | package cyclops.control.either;
import cyclops.Reducers;
import cyclops.Semigroups;
import cyclops.Streams;
import cyclops.async.Future;
import cyclops.collections.box.Mutable;
import cyclops.collections.ListX;
import cyclops.collections.immutable.PStackX;
import cyclops.control.*;
import cyclops.control.either.Either4.CompletableEither4;
import cyclops.function.Monoid;
import org.jooq.lambda.Seq;
import org.jooq.lambda.tuple.Tuple;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.*;
public class CompletableEither4Test {
public static <LT2,LT3,RT> CompletableEither4<RT,LT2,LT3,RT> right(RT value){
CompletableEither4<RT,LT2,LT3,RT> completable = Either4.either4();
completable.complete(value);
return completable;
}
@Test
public void completableTest(){
CompletableEither4<Integer,Integer,Integer,Integer> completable = Either4.either4();
Either4<Throwable,Integer,Integer,Integer> mapped = completable.map(i->i*2)
.flatMap(i->Eval.later(()->i+1));
completable.complete(5);
System.out.println(mapped.getClass());
mapped.printOut();
assertThat(mapped.get(),equalTo(11));
}
@Test
public void completableNoneTest(){
CompletableEither4<Integer,Integer,Integer,Integer> completable = Either4.either4();
Either4<Throwable,Integer,Integer,Integer> mapped = completable.map(i->i*2)
.flatMap(i->Eval.later(()->i+1));
completable.complete(null);
mapped.printOut();
assertThat(mapped.isPresent(),equalTo(false));
assertThat(mapped.swap1().get(),instanceOf(NoSuchElementException.class));
}
@Test
public void completableErrorTest(){
CompletableEither4<Integer,Integer,Integer,Integer> completable = Either4.either4();
Either4<Throwable,Integer,Integer,Integer> mapped = completable.map(i->i*2)
.flatMap(i->Eval.later(()->i+1));
completable.completeExceptionally(new IllegalStateException());
mapped.printOut();
assertThat(mapped.isPresent(),equalTo(false));
assertThat(mapped.swap1().get(),instanceOf(IllegalStateException.class));
}
boolean lazy = true;
@Test
public void lazyTest() {
CompletableEither4Test.right(10)
.flatMap(i -> { lazy=false; return right(15);})
.map(i -> { lazy=false; return right(15);})
.map(i -> Maybe.of(20));
assertTrue(lazy);
}
@Test
public void mapFlatMapTest(){
assertThat(right(10)
.map(i->i*2)
.flatMap(i->right(i*4))
.get(),equalTo(80));
}
static class Base{ }
static class One extends Base{ }
static class Two extends Base{}
@Test
public void isLeftRight(){
assertTrue(just.isRight());
assertTrue(none.isLeft1());
assertTrue(left2.isLeft2());
assertTrue(left3.isLeft3());
assertFalse(just.isLeft1());
assertFalse(just.isLeft2());
assertFalse(just.isLeft3());
assertFalse(none.isLeft2());
assertFalse(none.isLeft3());
assertFalse(none.isRight());
assertFalse(left2.isLeft1());
assertFalse(left2.isLeft3());
assertFalse(left2.isRight());
assertFalse(left3.isLeft1());
assertFalse(left3.isLeft2());
assertFalse(left3.isRight());
}
@Test
public void odd() {
System.out.println(even(CompletableEither4Test.right(200000)).get());
}
public Either4<Throwable,String,String,String> odd(Either4<Throwable,String,String,Integer> n) {
return n.flatMap(x -> even(CompletableEither4Test.right(x - 1)));
}
public Either4<Throwable,String,String,String> even(Either4<Throwable,String,String,Integer> n) {
return n.flatMap(x -> {
return x <= 0 ? CompletableEither4Test.right("done") : odd(CompletableEither4Test.right(x - 1));
});
}
Either4<Throwable,String,String,Integer> just;
Either4<String,String,String,Integer> left2;
Either4<String,String,String,Integer> left3;
Either4<String,String,String,Integer> none;
@Before
public void setUp() throws Exception {
just = right(10);
none = Either4.left1("none");
left2 = Either4.left2("left2");
left3 = Either4.left3("left3");
}
@Test
public void testZip(){
assertThat(right(10).zip(Eval.now(20),(a, b)->a+b).get(),equalTo(30));
//pending https://github.com/aol/cyclops-react/issues/380
// assertThat(Either.right(10).zip((a,b)->a+b,Eval.now(20)).get(),equalTo(30));
assertThat(right(10).zipS(Stream.of(20),(a,b)->a+b).get(),equalTo(30));
assertThat(right(10).zip(Seq.of(20),(a,b)->a+b).get(),equalTo(30));
assertThat(right(10).zip(Seq.of(20)).get(),equalTo(Tuple.tuple(10,20)));
assertThat(right(10).zipS(Stream.of(20)).get(),equalTo(Tuple.tuple(10,20)));
assertThat(right(10).zip(Eval.now(20)).get(),equalTo(Tuple.tuple(10,20)));
}
@Test
public void nest(){
assertThat(just.nest().map(m->m.get()),equalTo(Either4.right(10)));
}
@Test
public void coFlatMap(){
assertThat(just.coflatMap(m-> m.isPresent()? m.get() : 50),equalTo(Either4.right(10)));
assertThat(none.coflatMap(m-> m.isPresent()? m.get() : 50),equalTo(Either4.right(50)));
}
@Test
public void combine(){
Monoid<Integer> add = Monoid.of(0, Semigroups.intSum);
assertThat(just.combineEager(add,none),equalTo(Either4.right(10)));
assertThat(none.combineEager(add,just),equalTo(Either4.right(0)));
assertThat(none.combineEager(add,none),equalTo(Either4.right(0)));
assertThat(just.combineEager(add,Either4.right(10)),equalTo(Either4.right(20)));
Monoid<Integer> firstNonNull = Monoid.of(null , Semigroups.firstNonNull());
Either<String,Integer> nil = Either.right(null);
Either<String,Integer> ten = Either.right(10);
//pending https://github.com/aol/cyclops-react/issues/380
// assertThat(just.combineEager(firstNonNull,nil),equalTo(just));
// assertThat(just.combineEager(firstNonNull,nil.map(i->null)),equalTo(just));
// assertThat(just.combineEager(firstNonNull,ten.map(i->null)),equalTo(just));
}
@Test
public void visit(){
assertThat(just.visit(secondary->"no", left2->"left2",left3->"left3", primary->"yes"),equalTo("yes"));
assertThat(none.visit(secondary->"no", left2->"left2",left3->"left3", primary->"yes"),equalTo("no"));
assertThat(left2.visit(secondary->"no", left2->"left2",left3->"left3", primary->"yes"),equalTo("left2"));
assertThat(left3.visit(secondary->"no", left2->"left2",left3->"left3", primary->"yes"),equalTo("left3"));
}
@Test
public void testToMaybe() {
assertThat(just.toMaybe(),equalTo(Maybe.of(10)));
assertThat(none.toMaybe(),equalTo(Maybe.none()));
}
private int add1(int i){
return i+1;
}
@Test
public void testOfT() {
assertThat(Ior.primary(1),equalTo(Ior.primary(1)));
}
@Test
public void testUnitT() {
assertThat(just.unit(20),equalTo(Either4.right(20)));
}
@Test
public void testisPrimary() {
assertTrue(just.isRight());
assertFalse(none.isRight());
}
@Test
public void testMapFunctionOfQsuperTQextendsR() {
assertThat(just.map(i->i+5),equalTo(Either4.right(15)));
}
@Test
public void testFlatMap() {
assertThat(just.flatMap(i->Either4.right(i+5)),equalTo(Either4.right(15)));
assertThat(none.flatMap(i->Either4.right(i+5)),equalTo(Either4.left1("none")));
}
@Test
public void testWhenFunctionOfQsuperTQextendsRSupplierOfQextendsR() {
assertThat(just.visit(i->i+1,()->20),equalTo(11));
assertThat(none.visit(i->i+1,()->20),equalTo(20));
}
@Test
public void testStream() {
assertThat(just.stream().toListX(),equalTo(ListX.of(10)));
assertThat(none.stream().toListX(),equalTo(ListX.of()));
}
@Test
public void testOfSupplierOfT() {
}
@Test
public void testConvertTo() {
Stream<Integer> toStream = just.visit(m->Stream.of(m),()->Stream.of());
assertThat(toStream.collect(Collectors.toList()),equalTo(ListX.of(10)));
}
@Test
public void testConvertToAsync() {
Future<Stream<Integer>> async = Future.ofSupplier(()->just.visit(f->Stream.of((int)f),()->Stream.of()));
assertThat(async.get().collect(Collectors.toList()),equalTo(ListX.of(10)));
}
@Test
public void testIterate() {
assertThat(just.iterate(i->i+1).limit(10).sumInt(i->i),equalTo(145));
}
@Test
public void testGenerate() {
assertThat(just.generate().limit(10).sumInt(i->i),equalTo(100));
}
@Test
public void testMapReduceReducerOfE() {
assertThat(just.mapReduce(Reducers.toCountInt()),equalTo(1));
}
@Test
public void testFoldMonoidOfT() {
assertThat(just.foldLeft(Reducers.toTotalInt()),equalTo(10));
}
@Test
public void testFoldTBinaryOperatorOfT() {
assertThat(just.foldLeft(1, (a,b)->a*b),equalTo(10));
}
@Test
public void testToTry() {
assertTrue(none.toTry().isFailure());
assertThat(just.toTry(),equalTo(Try.success(10)));
}
@Test
public void testToTryClassOfXArray() {
assertTrue(none.toTry(Throwable.class).isFailure());
}
@Test
public void testToIor() {
assertThat(just.toIor(),equalTo(Ior.primary(10)));
}
@Test
public void testToIorNone(){
Ior<String,Integer> ior = none.toIor();
assertTrue(ior.isSecondary());
assertThat(ior,equalTo(Ior.secondary("none")));
}
@Test
public void testToIorSecondary() {
assertThat(just.toIor().swap(),equalTo(Ior.secondary(10)));
}
@Test
public void testToIorSecondaryNone(){
Ior<Integer,String> ior = none.toIor().swap();
assertTrue(ior.isPrimary());
assertThat(ior,equalTo(Ior.primary("none")));
}
@Test
public void testToEvalNow() {
assertThat(just.toEvalNow(),equalTo(Eval.now(10)));
}
@Test(expected=NoSuchElementException.class)
public void testToEvalNowNone() {
none.toEvalNow();
fail("exception expected");
}
@Test
public void testToEvalLater() {
assertThat(just.toEvalLater(),equalTo(Eval.later(()->10)));
}
@Test(expected=NoSuchElementException.class)
public void testToEvalLaterNone() {
none.toEvalLater().get();
fail("exception expected");
}
@Test
public void testToEvalAlways() {
assertThat(just.toEvalAlways(),equalTo(Eval.always(()->10)));
}
@Test(expected=NoSuchElementException.class)
public void testToEvalAlwaysNone() {
none.toEvalAlways().get();
fail("exception expected");
}
@Test
public void testMkString() {
assertThat(just.mkString(),equalTo("CompletableEither4[10]"));
assertThat(none.mkString(),equalTo("Either4.left1[none]"));
}
@Test
public void testGet() {
assertThat(just.get(),equalTo(10));
}
@Test(expected=NoSuchElementException.class)
public void testGetNone() {
none.get();
}
@Test
public void testFilter() {
assertFalse(just.filter(i->i<5).isPresent());
assertTrue(just.filter(i->i>5).isPresent());
assertFalse(none.filter(i->i<5).isPresent());
assertFalse(none.filter(i->i>5).isPresent());
}
@Test
public void testOfType() {
assertFalse(just.ofType(String.class).isPresent());
assertTrue(just.ofType(Integer.class).isPresent());
assertFalse(none.ofType(String.class).isPresent());
assertFalse(none.ofType(Integer.class).isPresent());
}
@Test
public void testFilterNot() {
assertTrue(just.filterNot(i->i<5).isPresent());
assertFalse(just.filterNot(i->i>5).isPresent());
assertFalse(none.filterNot(i->i<5).isPresent());
assertFalse(none.filterNot(i->i>5).isPresent());
}
@Test
public void testNotNull() {
assertTrue(just.notNull().isPresent());
assertFalse(none.notNull().isPresent());
}
@Test
public void testMapReduceReducerOfR() {
assertThat(just.mapReduce(Reducers.toPStackX()),equalTo(PStackX.fromIterable(just)));
}
@Test
public void testMapReduceFunctionOfQsuperTQextendsRMonoidOfR() {
assertThat(just.mapReduce(s->s.toString(), Monoid.of("",Semigroups.stringJoin(","))),equalTo(",10"));
}
@Test
public void testReduceMonoidOfT() {
assertThat(just.reduce(Monoid.of(1,Semigroups.intMult)),equalTo(10));
}
@Test
public void testReduceBinaryOperatorOfT() {
assertThat(just.reduce((a,b)->a+b),equalTo(Optional.of(10)));
}
@Test
public void testReduceTBinaryOperatorOfT() {
assertThat(just.reduce(10,(a,b)->a+b),equalTo(20));
}
@Test
public void testReduceUBiFunctionOfUQsuperTUBinaryOperatorOfU() {
assertThat(just.reduce(11,(a,b)->a+b,(a,b)->a*b),equalTo(21));
}
@Test
public void testReduceStreamOfQextendsMonoidOfT() {
ListX<Integer> countAndTotal = just.reduce(Stream.of(Reducers.toCountInt(),Reducers.toTotalInt()));
assertThat(countAndTotal,equalTo(ListX.of(1,10)));
}
@Test
public void testReduceIterableOfReducerOfT() {
ListX<Integer> countAndTotal = just.reduce(Arrays.asList(Reducers.toCountInt(),Reducers.toTotalInt()));
assertThat(countAndTotal,equalTo(ListX.of(1,10)));
}
@Test
public void testFoldRightMonoidOfT() {
assertThat(just.foldRight(Monoid.of(1,Semigroups.intMult)),equalTo(10));
}
@Test
public void testFoldRightTBinaryOperatorOfT() {
assertThat(just.foldRight(10,(a,b)->a+b),equalTo(20));
}
@Test
public void testFoldRightMapToType() {
assertThat(just.foldRightMapToType(Reducers.toPStackX()),equalTo(PStackX.fromIterable(just)));
}
@Test
public void testWhenFunctionOfQsuperMaybeOfTQextendsR() {
assertThat(just.visit(s->"hello", ()->"world"),equalTo("hello"));
assertThat(none.visit(s->"hello", ()->"world"),equalTo("world"));
}
@Test
public void testOrElseGet() {
assertThat(none.orElseGet(()->2),equalTo(2));
assertThat(just.orElseGet(()->2),equalTo(10));
}
@Test
public void testToOptional() {
assertFalse(none.toOptional().isPresent());
assertTrue(just.toOptional().isPresent());
assertThat(just.toOptional(),equalTo(Optional.of(10)));
}
@Test
public void testToStream() {
assertThat(none.toStream().collect(Collectors.toList()).size(),equalTo(0));
assertThat(just.toStream().collect(Collectors.toList()).size(),equalTo(1));
}
@Test
public void testOrElse() {
assertThat(none.orElse(20),equalTo(20));
assertThat(just.orElse(20),equalTo(10));
}
@Test(expected=RuntimeException.class)
public void testOrElseThrow() {
none.orElseThrow(()->new RuntimeException());
}
@Test
public void testOrElseThrowSome() {
assertThat(just.orElseThrow(()->new RuntimeException()),equalTo(10));
}
@Test
public void testToFutureW() {
Future<Integer> cf = just.toFuture();
assertThat(cf.get(),equalTo(10));
}
@Test
public void testToCompletableFuture() {
CompletableFuture<Integer> cf = just.toCompletableFuture();
assertThat(cf.join(),equalTo(10));
}
@Test
public void testToCompletableFutureAsync() {
CompletableFuture<Integer> cf = just.toCompletableFutureAsync();
assertThat(cf.join(),equalTo(10));
}
Executor exec = Executors.newFixedThreadPool(1);
@Test
public void testToCompletableFutureAsyncExecutor() {
CompletableFuture<Integer> cf = just.toCompletableFutureAsync(exec);
assertThat(cf.join(),equalTo(10));
}
@Test
public void testIterator1() {
assertThat(Streams.stream(just.iterator()).collect(Collectors.toList()),
equalTo(Arrays.asList(10)));
}
@Test
public void testForEach() {
Mutable<Integer> capture = Mutable.of(null);
none.forEach(c->capture.set(c));
assertNull(capture.get());
just.forEach(c->capture.set(c));
assertThat(capture.get(),equalTo(10));
}
@Test
public void testSpliterator() {
assertThat(StreamSupport.stream(just.spliterator(),false).collect(Collectors.toList()),
equalTo(Arrays.asList(10)));
}
@Test
public void testCast() {
Either4<Throwable,String,String,Number> num = just.cast(Number.class);
}
@Test
public void testMapFunctionOfQsuperTQextendsR1() {
assertThat(just.map(i->i+5),equalTo(Either4.right(15)));
}
@Test
public void testPeek() {
Mutable<Integer> capture = Mutable.of(null);
just = just.peek(c->capture.set(c));
just.get();
assertThat(capture.get(),equalTo(10));
}
private Trampoline<Integer> sum(int times, int sum){
return times ==0 ? Trampoline.done(sum) : Trampoline.more(()->sum(times-1,sum+times));
}
@Test
public void testTrampoline() {
assertThat(just.trampoline(n ->sum(10,n)),equalTo(Either4.right(65)));
}
@Test
public void testUnitT1() {
assertThat(none.unit(10),equalTo(Either4.right(10)));
}
}
| [
"john.mcclean@teamaol.com"
] | john.mcclean@teamaol.com |
89ec17afed06cdccc9c3eeb46d358ba4d61b7d12 | 56d664e65aa599dce259ff160738e9f0ad3ba00e | /src/main/java/com/example/demo/controller/admin/NhanVienResController.java | 93a8a31f49c4ce8af8adf37d1128f1a7df9bbee4 | [] | no_license | huuphuc0261993/vpdt | eaed8ef17e2274350848e40d0171dda1c5b2ee9b | 8a847161a75d4a073d7bfbacae6cb5028d2b53e2 | refs/heads/master | 2022-12-18T19:54:53.679234 | 2020-09-28T09:12:42 | 2020-09-28T09:12:42 | 291,638,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,555 | java | package com.example.demo.controller.admin;
import com.example.demo.model.NhanVien;
import com.example.demo.model.PhongBan;
import com.example.demo.model.ThongBao;
import com.example.demo.service.NhanVienService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/api/nhanvien")
public class NhanVienResController {
@Autowired
private NhanVienService nhanVienService;
@RequestMapping(value = "/view/{id}",method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public ResponseEntity<List<NhanVien>> showView(@PathVariable("id")Long id){
List<NhanVien>nhanViens=nhanVienService.listNhanVien(id);
List<NhanVien> nhanVienList = new ArrayList<>();
for (NhanVien nv:nhanViens) {
NhanVien nhanVien = new NhanVien();
nhanVien.setFullName(nv.getFullName());
nhanVien.setPhongBan(nv.getPhongBan());
nhanVien.setMnv(nv.getMnv());
nhanVienList.add(nhanVien);
}
return new ResponseEntity<List<NhanVien>>(nhanVienList, HttpStatus.OK);
}
}
| [
"huuphuc0261993@gmail.com"
] | huuphuc0261993@gmail.com |
6d0abf92a81277f210ff3d82425eb12988a2646a | 3579c367451e47c99530e83cc80e8e773cb7c300 | /gzxant-activiti/src/main/java/com/gzxant/utils/ActivitiUtils.java | 0319bec7039054ef693920467575e12e819c71c7 | [
"Apache-2.0"
] | permissive | Parmet/gzxant | d3b5db257cc7b3dafb919836a7d9ad27ae467952 | 09e3e34407cde898284875217ca42adcc0504e64 | refs/heads/master | 2020-03-09T10:15:19.537897 | 2018-05-09T03:25:48 | 2018-05-09T03:25:48 | 128,732,887 | 0 | 2 | Apache-2.0 | 2018-05-11T05:34:50 | 2018-04-09T07:36:22 | JavaScript | UTF-8 | Java | false | false | 6,117 | java | package com.gzxant.utils;
import java.util.HashMap;
import java.util.Map;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import com.gzxant.enums.HttpCodeEnum;
import com.gzxant.exception.SlifeException;
import com.gzxant.vo.ProcessVO;
/**
* @author: xufei.
* @createTime: 2017/8/11.
*/
public class ActivitiUtils {
// static UserDetailDao userDetailDao = Application.getBean(UserDetailDao.class);
//
// static UserServiceClient userServiceClient = Application.getBean(UserServiceClient.class);
//
// static HistoryService historyService = Application.getBean(HistoryService.class);
/**
* 获取用户信息
* @param userId
* @return
*/
// public static UserInfo getUserInfo(String userId) {
// if (userDetailDao.has(userId)) {
// return parseUserInfo(userDetailDao.get(userId));
// }
// RespDTO resp = userServiceClient.getUser(userId);
// return Optional.ofNullable(resp.data)
// .map(data -> {
// userDetailDao.set(JSON.toJSONString(data), userId);
// return parseUserInfo(JSON.toJSONString(data));
// })
// .orElseThrow(() ->new TaiChiException(ErrorCode.FAIL, "get user from user service error"));
// }
// private static UserInfo parseUserInfo(String json) {
// return JSON.parseObject(json, UserInfo.class);
// }
// /**
// * 删除缓存
// * @param userId
// */
// public static void delUserCache(String userId) {
// if (userDetailDao.has(userId)) {
// userDetailDao.del(userId);
// }
// }
/**
* 节点对应的中文名称
* @param type
* @return
*/
public static String parseToZhType(String type) {
Map<String, String> types = new HashMap<String, String>();
types.put("userTask", "用户任务");
types.put("serviceTask", "系统任务");
types.put("startEvent", "开始节点");
types.put("endEvent", "结束节点");
types.put("exclusiveGateway", "条件判断节点(系统自动根据条件处理)");
types.put("inclusiveGateway", "并行处理任务");
types.put("callActivity", "子流程");
return types.get(type) == null ? type : types.get(type);
}
/**
* 将dto转为activiti的entity
* @param role
* @return
*/
// public static GroupEntity toActivitiGroup(SysRoleDTO role){
// GroupEntity groupEntity = new GroupEntity();
// groupEntity.setId(role.getRoleId());
// groupEntity.setName(role.getName());
// groupEntity.setType(role.getType() + "");
// groupEntity.setRevision(1);
// return groupEntity;
// }
/**
* 将dto转为activiti的entity
* @param user
* @return
*/
// public static UserEntity toActivitiUser(SysUserDTO user){
// UserEntity userEntity = new UserEntity();
// userEntity.setId(user.getUserId());
// userEntity.setFirstName(user.getRealname());
// userEntity.setLastName(StringUtils.EMPTY);
// userEntity.setPassword(user.getPassword());
// userEntity.setEmail(user.getEmail());
// userEntity.setRevision(1);
// return userEntity;
// }
/**
* 抽取流程实例需要返回的内容
* @param processDefinition
* @param deployment
* @return
*/
public static ProcessVO toProcessVO(ProcessDefinition processDefinition, Deployment deployment) {
if (null == processDefinition || null == deployment) {
throw new SlifeException(HttpCodeEnum.INVALID_REQUEST);
}
ProcessVO dto = new ProcessVO();
dto.category = processDefinition.getCategory();
dto.processonDefinitionId = processDefinition.getId();
dto.key = processDefinition.getKey();
dto.name = deployment.getName();
dto.revision = processDefinition.getVersion();
dto.deploymentTime = deployment.getDeploymentTime().getTime();
dto.xmlName = processDefinition.getResourceName();
dto.picName = processDefinition.getDiagramResourceName();
dto.deploymentId = deployment.getId();
dto.suspend = processDefinition.isSuspended();
dto.description = processDefinition.getDescription();
return dto;
}
// public static TaskDTO toTaskDTO(TaskInfo task, String status, ProcessDefinition processDefinition, Deployment deployment) {
// TaskDTO dto = new TaskDTO();
// dto.setTaskId(task.getId());
// dto.setTaskName(task.getName());
//// dto.setTime(historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult().getStartTime().getTime());
// dto.setVariable(task.getTaskLocalVariables());
// dto.setPdName(deployment.getName());
// dto.setVersion("V:" + processDefinition.getVersion());
// dto.setProcessInstanceId(task.getProcessInstanceId());
// dto.setStatus(status);
// dto.setTitle((String) task.getProcessVariables().get("title"));
// dto.setNodeKey(task.getTaskDefinitionKey());
// dto.setProcessDefKey(processDefinition.getKey());
// return dto;
// }
// public static TaskListDTO toTaskListDTO(PageResultsDTO dto, String category) {
// TaskListDTO taskList = new TaskListDTO();
// taskList.setCategory(category);
// taskList.setPage(dto.page);
// taskList.setPageSize(dto.pageSize);
// taskList.setTotalCount((int) dto.totalCount);
// taskList.setTasks(dto.getList());
// return taskList;
// }
//
// public static TaskListDTO toTaskListDTO(List<TaskDTO> tasks, String category, int page, int pageSize, long totalCount) {
// TaskListDTO taskList = new TaskListDTO();
// taskList.setCategory(category);
// taskList.setPage(page);
// taskList.setPageSize(pageSize);
// taskList.setTotalCount((int) totalCount);
// taskList.setTasks(tasks);
// return taskList;
// }
} | [
"158215350@qq.com"
] | 158215350@qq.com |
983fdb7d0076b7494ce6c696484345d52b55a17a | b05ffb267c1ddaa2e71a07ec7c4d6617e2a4b19a | /x-im-message-server/src/main/java/com/eikesi/im/message/config/package-info.java | 27ae37bc54b31b822e31b0861bd7b1726da2f1d7 | [] | no_license | pologood/eikesi | 122f1000273ec0f9d83def5debe24b48a3196234 | eb4824b336863f12347db6909f55b1c1a62a61c8 | refs/heads/master | 2020-05-30T10:53:07.888064 | 2019-05-14T15:45:05 | 2019-05-14T15:45:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | /**
* Spring Framework configuration files.
*/
package com.eikesi.im.message.config;
| [
"2732067273@qq.com"
] | 2732067273@qq.com |
605fa2ac8f308337882c7beb72c834785c04dbbe | 8554b38a01b2819f34ded77fa13e581d3406ce08 | /Collection/src/com/Map/MapTest01.java | 144776e0539f287a42bf90f3e88f2524c71f9b16 | [] | no_license | studywzy/Test | aaba4658c152907acced2c0a133f65fc68940d2a | 24b09724dda063e03a1ff40864a56b8e76fd9be3 | refs/heads/master | 2022-04-04T13:15:21.194527 | 2020-02-26T09:32:29 | 2020-02-26T09:32:29 | 240,662,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,079 | java | package com.Map;
import java.util.*;
/**
* @author Wzy
* @date 2020-02-20 - 13:43
*
* 关于Map集合中常用的方法
* void clear(); 清空Map
*
* boolean containsKey(Object key); 判断Map中是否包含这样的key
* boolean containsValue(Object value); 判断Map中是否包含这样的value
*
* Object get (Object key); 通过key获取value
*
* boolean isEmpty(); 判断该集合是否为空
*
* Object put(Object key,Object value); 向集合中添加键值对
*
* Object remove(Object key); 通过key将键值对删除
*
* int size(); 和获取Map中键值对的个数
*
* Set keySet(); 获取Map中所有的key
*
* Collection values(); 获取Map集合中所有的value
*
* Set<Map.Entry<K,V>> entrySet(); 返回此映射中包含的映射关系的Set视图
*
*
* 注意:存储在Map集合key部分的元素需要同时重写hashCode和equals方法
*/
public class MapTest01 {
public static void main(String[] args) {
//创建Map集合
Map persons = new HashMap();
//存储键值对
persons.put("10000","JACK");
persons.put("10011","JACK");
persons.put("10002","SUN");
persons.put("10003","COOK");
persons.put("10004","KING");
persons.put("10000","LUCY");
//判断键值对的个数
//Map中的key是无序不可重复的,和HashSet相同
System.out.println(persons.size());//5,有一个key相同没加进去
//判断集合中是否包含这样的key
System.out.println(persons.containsKey("10000"));//true
//判断集合中是否包含这样的value
//注意:Map中如果key重复了,value采用的是"覆盖"
System.out.println(persons.containsValue("LUCY"));//true
//通过key来获取value
Object val = persons.get("10011");
System.out.println(val);//JACK
//通过key删除键值对
persons.remove("10002");
System.out.println(persons.size());//4
//获取所有的value
Collection values = persons.values();
Iterator it = values.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
//获取所有的key
//如何遍历Map集合
Set keys = persons.keySet();
Iterator it2 = keys.iterator();
while (it2.hasNext()){
Object id = it2.next();
Object name = persons.get(id);
System.out.println(id + "-->" + name);
}
/*
10000-->LUCY
10011-->JACK
10004-->KING
10003-->COOK
*/
//entrySet
//返回此映射中包含的映射关系的Set视图
//将Map转为Set集合
Set entrySet = persons.entrySet();
Iterator it3 = entrySet.iterator();
while(it3.hasNext()){
System.out.println(it3.next());
}
/*
10000=LUCY
10011=JACK
10004=KING
10003=COOK
*/
}
}
| [
"1365997350@qq.com"
] | 1365997350@qq.com |
4f39ca6c4bb72632208e4f2c60e675eb6e36765b | 5b2f8e72776d66e2b6b4ba982da52e01a389119d | /FinalHoroscopeTester.java | 039c6ead53090fde8f8e1bfee04339ad0dab1b84 | [] | no_license | nicolelfella/Horoscopes | dd5984a9e4608ffded62b64436be900237300277 | 392c8dfea8c1f402a08f315b78126ad57c6b1ada | refs/heads/master | 2016-09-05T22:09:23.884995 | 2014-03-23T08:21:48 | 2014-03-23T08:21:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | //CS201 Assignment 1 Part 1g
//Nicole Fella
/**
* Final Horoscope Tester Modification
* used to test MadoscopeEngine if arg passed through
**/
public class FinalHoroscopeTester
{
//testing through main method
public static void main(String[] args)
{
//declare variable for HoroscopeEngine object
HoroscopeEngine myHoroscope;
//if there are no arguments passed, default to NumberscopeEngine
if (args.length == 0)
myHoroscope = new NumberscopeEngine();
//otherwise, test MadoscopeEngine
else
myHoroscope = new MadoscopeEngine();
//test Horoscope
System.out.println(myHoroscope.getHoroscope());
}
} | [
"nicolelfella@gmail.com"
] | nicolelfella@gmail.com |
de27bd67b929d1afd500607ce110cb39d98fc2c0 | fc008d7e311ab1a95532b4a9fe036a86454f149e | /src/practive/bit/arrayDemo/Test.java | 38c5a6fc7c099fb7902469061c7e34b9413ab273 | [] | no_license | Sasura321/S1 | 9787a99cec3a89b93775c056722d7814c5426374 | 2886dd79aebc2d0a8d0c25b7788de17954bc9a94 | refs/heads/master | 2020-03-28T18:31:36.084180 | 2019-03-05T08:52:22 | 2019-03-05T08:52:22 | 148,888,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package practive.bit.arrayDemo;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
class MyThread implements Runnable {
private int ticket = 100;
private Lock ticketLock = new ReentrantLock();
@Override
public void run() {
for(int i = 0; i < 100; i++) {
ticketLock.lock();
try {
if(this.ticket > 0) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+",还有"+this.ticket--+"张票");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
ticketLock.unlock();
}
}
}
}
public class Test {
public static void main (String[] args) {
MyThread mt = new MyThread();
Thread t1 = new Thread(mt, "黄牛A");
Thread t2 = new Thread(mt, "黄牛B");
Thread t3 = new Thread(mt, "黄牛C");
t1.setPriority(Thread.MIN_PRIORITY);
t2.setPriority(Thread.MAX_PRIORITY);
t3.setPriority(Thread.MAX_PRIORITY);
t1.start();
t2.start();
t3.start();
}
} | [
"2818760446@qq.com"
] | 2818760446@qq.com |
a50181f9fbe381aa118aec820f27d32399c182e5 | 9a2e0f9cfc617a89f100f11c5e260a2a1a1264b3 | /src/test/java/com/mycompany/store/web/rest/InvoiceResourceIntTest.java | 1325ec406724567e3c9451908d8c36b704b015bf | [] | no_license | sahithi813/online-store | d139c2dd6770ab6ed6a4d9ac43d8b3fa54687ec0 | 69bfc12d826285901e3a4d7597046c12efe68aae | refs/heads/master | 2020-05-07T20:13:06.164029 | 2019-04-11T20:52:41 | 2019-04-11T20:52:41 | 180,849,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,995 | java | package com.mycompany.store.web.rest;
import com.mycompany.store.StoreApp;
import com.mycompany.store.domain.Invoice;
import com.mycompany.store.domain.ProductOrder;
import com.mycompany.store.repository.InvoiceRepository;
import com.mycompany.store.service.InvoiceService;
import com.mycompany.store.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import static com.mycompany.store.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import com.mycompany.store.domain.enumeration.InvoiceStatus;
import com.mycompany.store.domain.enumeration.PaymentMethod;
/**
* Test class for the InvoiceResource REST controller.
*
* @see InvoiceResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = StoreApp.class)
@WithMockUser(username="admin", authorities={"ROLE_ADMIN"}, password = "admin")
public class InvoiceResourceIntTest {
private static final Instant DEFAULT_DATE = Instant.ofEpochMilli(0L);
private static final Instant UPDATED_DATE = Instant.now().truncatedTo(ChronoUnit.MILLIS);
private static final String DEFAULT_DETAILS = "AAAAAAAAAA";
private static final String UPDATED_DETAILS = "BBBBBBBBBB";
private static final InvoiceStatus DEFAULT_STATUS = InvoiceStatus.PAID;
private static final InvoiceStatus UPDATED_STATUS = InvoiceStatus.ISSUED;
private static final PaymentMethod DEFAULT_PAYMENT_METHOD = PaymentMethod.CREDIT_CARD;
private static final PaymentMethod UPDATED_PAYMENT_METHOD = PaymentMethod.CASH_ON_DELIVERY;
private static final Instant DEFAULT_PAYMENT_DATE = Instant.ofEpochMilli(0L);
private static final Instant UPDATED_PAYMENT_DATE = Instant.now().truncatedTo(ChronoUnit.MILLIS);
private static final BigDecimal DEFAULT_PAYMENT_AMOUNT = new BigDecimal(1);
private static final BigDecimal UPDATED_PAYMENT_AMOUNT = new BigDecimal(2);
@Autowired
private InvoiceRepository invoiceRepository;
@Autowired
private InvoiceService invoiceService;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private Validator validator;
private MockMvc restInvoiceMockMvc;
private Invoice invoice;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final InvoiceResource invoiceResource = new InvoiceResource(invoiceService);
this.restInvoiceMockMvc = MockMvcBuilders.standaloneSetup(invoiceResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter)
.setValidator(validator).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Invoice createEntity(EntityManager em) {
Invoice invoice = new Invoice()
.date(DEFAULT_DATE)
.details(DEFAULT_DETAILS)
.status(DEFAULT_STATUS)
.paymentMethod(DEFAULT_PAYMENT_METHOD)
.paymentDate(DEFAULT_PAYMENT_DATE)
.paymentAmount(DEFAULT_PAYMENT_AMOUNT);
// Add required entity
ProductOrder productOrder = ProductOrderResourceIntTest.createEntity(em);
em.persist(productOrder);
em.flush();
invoice.setOrder(productOrder);
return invoice;
}
@Before
public void initTest() {
invoice = createEntity(em);
}
@Test
@Transactional
public void createInvoice() throws Exception {
int databaseSizeBeforeCreate = invoiceRepository.findAll().size();
// Create the Invoice
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isCreated());
// Validate the Invoice in the database
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeCreate + 1);
Invoice testInvoice = invoiceList.get(invoiceList.size() - 1);
assertThat(testInvoice.getDate()).isEqualTo(DEFAULT_DATE);
assertThat(testInvoice.getDetails()).isEqualTo(DEFAULT_DETAILS);
assertThat(testInvoice.getStatus()).isEqualTo(DEFAULT_STATUS);
assertThat(testInvoice.getPaymentMethod()).isEqualTo(DEFAULT_PAYMENT_METHOD);
assertThat(testInvoice.getPaymentDate()).isEqualTo(DEFAULT_PAYMENT_DATE);
assertThat(testInvoice.getPaymentAmount()).isEqualTo(DEFAULT_PAYMENT_AMOUNT);
}
@Test
@Transactional
public void createInvoiceWithExistingId() throws Exception {
int databaseSizeBeforeCreate = invoiceRepository.findAll().size();
// Create the Invoice with an existing ID
invoice.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
// Validate the Invoice in the database
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkDateIsRequired() throws Exception {
int databaseSizeBeforeTest = invoiceRepository.findAll().size();
// set the field null
invoice.setDate(null);
// Create the Invoice, which fails.
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkStatusIsRequired() throws Exception {
int databaseSizeBeforeTest = invoiceRepository.findAll().size();
// set the field null
invoice.setStatus(null);
// Create the Invoice, which fails.
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkPaymentMethodIsRequired() throws Exception {
int databaseSizeBeforeTest = invoiceRepository.findAll().size();
// set the field null
invoice.setPaymentMethod(null);
// Create the Invoice, which fails.
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkPaymentDateIsRequired() throws Exception {
int databaseSizeBeforeTest = invoiceRepository.findAll().size();
// set the field null
invoice.setPaymentDate(null);
// Create the Invoice, which fails.
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkPaymentAmountIsRequired() throws Exception {
int databaseSizeBeforeTest = invoiceRepository.findAll().size();
// set the field null
invoice.setPaymentAmount(null);
// Create the Invoice, which fails.
restInvoiceMockMvc.perform(post("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllInvoices() throws Exception {
// Initialize the database
invoiceRepository.saveAndFlush(invoice);
// Get all the invoiceList
restInvoiceMockMvc.perform(get("/api/invoices?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(invoice.getId().intValue())))
.andExpect(jsonPath("$.[*].date").value(hasItem(DEFAULT_DATE.toString())))
.andExpect(jsonPath("$.[*].details").value(hasItem(DEFAULT_DETAILS.toString())))
.andExpect(jsonPath("$.[*].status").value(hasItem(DEFAULT_STATUS.toString())))
.andExpect(jsonPath("$.[*].paymentMethod").value(hasItem(DEFAULT_PAYMENT_METHOD.toString())))
.andExpect(jsonPath("$.[*].paymentDate").value(hasItem(DEFAULT_PAYMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].paymentAmount").value(hasItem(DEFAULT_PAYMENT_AMOUNT.intValue())));
}
@Test
@Transactional
public void getInvoice() throws Exception {
// Initialize the database
invoiceRepository.saveAndFlush(invoice);
// Get the invoice
restInvoiceMockMvc.perform(get("/api/invoices/{id}", invoice.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(invoice.getId().intValue()))
.andExpect(jsonPath("$.date").value(DEFAULT_DATE.toString()))
.andExpect(jsonPath("$.details").value(DEFAULT_DETAILS.toString()))
.andExpect(jsonPath("$.status").value(DEFAULT_STATUS.toString()))
.andExpect(jsonPath("$.paymentMethod").value(DEFAULT_PAYMENT_METHOD.toString()))
.andExpect(jsonPath("$.paymentDate").value(DEFAULT_PAYMENT_DATE.toString()))
.andExpect(jsonPath("$.paymentAmount").value(DEFAULT_PAYMENT_AMOUNT.intValue()));
}
@Test
@Transactional
public void getNonExistingInvoice() throws Exception {
// Get the invoice
restInvoiceMockMvc.perform(get("/api/invoices/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateInvoice() throws Exception {
// Initialize the database
invoiceService.save(invoice);
int databaseSizeBeforeUpdate = invoiceRepository.findAll().size();
// Update the invoice
Invoice updatedInvoice = invoiceRepository.findById(invoice.getId()).get();
// Disconnect from session so that the updates on updatedInvoice are not directly saved in db
em.detach(updatedInvoice);
updatedInvoice
.date(UPDATED_DATE)
.details(UPDATED_DETAILS)
.status(UPDATED_STATUS)
.paymentMethod(UPDATED_PAYMENT_METHOD)
.paymentDate(UPDATED_PAYMENT_DATE)
.paymentAmount(UPDATED_PAYMENT_AMOUNT);
restInvoiceMockMvc.perform(put("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedInvoice)))
.andExpect(status().isOk());
// Validate the Invoice in the database
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeUpdate);
Invoice testInvoice = invoiceList.get(invoiceList.size() - 1);
assertThat(testInvoice.getDate()).isEqualTo(UPDATED_DATE);
assertThat(testInvoice.getDetails()).isEqualTo(UPDATED_DETAILS);
assertThat(testInvoice.getStatus()).isEqualTo(UPDATED_STATUS);
assertThat(testInvoice.getPaymentMethod()).isEqualTo(UPDATED_PAYMENT_METHOD);
assertThat(testInvoice.getPaymentDate()).isEqualTo(UPDATED_PAYMENT_DATE);
assertThat(testInvoice.getPaymentAmount()).isEqualTo(UPDATED_PAYMENT_AMOUNT);
}
@Test
@Transactional
public void updateNonExistingInvoice() throws Exception {
int databaseSizeBeforeUpdate = invoiceRepository.findAll().size();
// Create the Invoice
// If the entity doesn't have an ID, it will throw BadRequestAlertException
restInvoiceMockMvc.perform(put("/api/invoices")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invoice)))
.andExpect(status().isBadRequest());
// Validate the Invoice in the database
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeUpdate);
}
@Test
@Transactional
public void deleteInvoice() throws Exception {
// Initialize the database
invoiceService.save(invoice);
int databaseSizeBeforeDelete = invoiceRepository.findAll().size();
// Delete the invoice
restInvoiceMockMvc.perform(delete("/api/invoices/{id}", invoice.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate the database is empty
List<Invoice> invoiceList = invoiceRepository.findAll();
assertThat(invoiceList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Invoice.class);
Invoice invoice1 = new Invoice();
invoice1.setId(1L);
Invoice invoice2 = new Invoice();
invoice2.setId(invoice1.getId());
assertThat(invoice1).isEqualTo(invoice2);
invoice2.setId(2L);
assertThat(invoice1).isNotEqualTo(invoice2);
invoice1.setId(null);
assertThat(invoice1).isNotEqualTo(invoice2);
}
}
| [
"sahithi.reddy@capgemini.com"
] | sahithi.reddy@capgemini.com |
69594fd8604fd614fc30a5bb276fe2b0feea2fba | cf4b65ee2474cce7e0f69191a5042e92a90c7a26 | /gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/ListGSYVideoPlayer.java | 589cc0ef844ba2f5d83f65f41aa031c135a674b4 | [] | no_license | helloCJP/CjpFastAndroid | 71505f1a124663954a430c680750ae4fcd85006b | 42b7b365f033ea9927812a82bc6e72c609ad4d76 | refs/heads/master | 2021-01-18T08:07:29.312972 | 2020-02-16T16:16:58 | 2020-02-16T16:16:58 | 100,354,368 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,493 | java | package com.shuyu.gsyvideoplayer.video;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.shuyu.gsyvideoplayer.model.GSYVideoModel;
import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer;
import com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shuyu on 2016/12/20.
*/
public class ListGSYVideoPlayer extends StandardGSYVideoPlayer {
protected List<GSYVideoModel> mUriList = new ArrayList<>();
protected int mPlayPosition;
/**
* 1.5.0开始加入,如果需要不同布局区分功能,需要重载
*/
public ListGSYVideoPlayer(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public ListGSYVideoPlayer(Context context) {
super(context);
}
public ListGSYVideoPlayer(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* 设置播放URL
*
* @param url 播放url
* @param cacheWithPlay 是否边播边缓存
* @return
*/
public boolean setUp(List<GSYVideoModel> url, boolean cacheWithPlay, int position) {
mUriList = url;
mPlayPosition = position;
GSYVideoModel gsyVideoModel = url.get(position);
boolean set = setUp(gsyVideoModel.getUrl(), cacheWithPlay, gsyVideoModel.getTitle());
if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
mTitleTextView.setText(gsyVideoModel.getTitle());
}
return set;
}
/**
* 设置播放URL
*
* @param url 播放url
* @param cacheWithPlay 是否边播边缓存
* @param cachePath 缓存路径,如果是M3U8或者HLS,请设置为false
* @return
*/
public boolean setUp(List<GSYVideoModel> url, boolean cacheWithPlay, int position, File cachePath) {
mUriList = url;
mPlayPosition = position;
GSYVideoModel gsyVideoModel = url.get(position);
boolean set = setUp(gsyVideoModel.getUrl(), cacheWithPlay, cachePath, gsyVideoModel.getTitle());
if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
mTitleTextView.setText(gsyVideoModel.getTitle());
}
return set;
}
@Override
public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionBar, boolean statusBar) {
GSYBaseVideoPlayer gsyBaseVideoPlayer = super.startWindowFullscreen(context, actionBar, statusBar);
if (gsyBaseVideoPlayer != null) {
ListGSYVideoPlayer listGSYVideoPlayer = (ListGSYVideoPlayer) gsyBaseVideoPlayer;
listGSYVideoPlayer.mPlayPosition = mPlayPosition;
listGSYVideoPlayer.mUriList = mUriList;
GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
listGSYVideoPlayer.mTitleTextView.setText(gsyVideoModel.getTitle());
}
}
return gsyBaseVideoPlayer;
}
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
if (gsyVideoPlayer != null) {
ListGSYVideoPlayer listGSYVideoPlayer = (ListGSYVideoPlayer) gsyVideoPlayer;
mPlayPosition = listGSYVideoPlayer.mPlayPosition;
mUriList = listGSYVideoPlayer.mUriList;
GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
mTitleTextView.setText(gsyVideoModel.getTitle());
}
}
super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
}
@Override
public void onCompletion() {
if (mPlayPosition < (mUriList.size() - 1)) {
return;
}
super.onCompletion();
}
@Override
public void onAutoCompletion() {
if (mPlayPosition < (mUriList.size() - 1)) {
mPlayPosition++;
GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
setUp(gsyVideoModel.getUrl(), mCache, mCachePath, gsyVideoModel.getTitle());
if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
mTitleTextView.setText(gsyVideoModel.getTitle());
}
startPlayLogic();
return;
}
super.onAutoCompletion();
}
}
| [
"cjp7109@163.com"
] | cjp7109@163.com |
c8ae4015bbe5b69720aaff65b411f11eb342f8b1 | d6a5da3794ef8a79b2cc8e58caf7a9915ef741b4 | /src/main/java/agents/anac/y2011/ValueModelAgent/IssuesDecreases.java | ad655ca1cfb46cdea4f0a47eefc5a18053cf066a | [] | no_license | Shaobo-Xu/ANAC2019 | 67d70b52217a28129a6c1ccd3d23858e81c64240 | 6f47514a4b8ee5bc81640692030c6ed976804500 | refs/heads/master | 2020-05-16T22:26:14.655595 | 2019-07-28T15:29:49 | 2019-07-28T15:29:49 | 183,329,259 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,698 | java | package agents.anac.y2011.ValueModelAgent;
import java.util.HashMap;
import java.util.Map;
import genius.core.issue.ISSUETYPE;
import genius.core.issue.Issue;
import genius.core.issue.IssueDiscrete;
import genius.core.issue.IssueInteger;
import genius.core.issue.IssueReal;
import genius.core.issue.Value;
import genius.core.issue.ValueInteger;
import genius.core.issue.ValueReal;
import genius.core.utility.AdditiveUtilitySpace;
//a class that translate the issue values of all issue types
//into our standart ValueDecrease.
public class IssuesDecreases{
private Map<String,ValueDecrease> values;
private ISSUETYPE type;
private Issue origin;
//for use in real
private boolean goingDown;
IssuesDecreases(AdditiveUtilitySpace space){
values = new HashMap<String,ValueDecrease>();
}
//at start assumes that all issues have the same value.
//also assumes that all values except the "optimal"
//have a decrease equal to the weight with a very high varience
public void initilize(Issue issue,Value maximalValue,int issueCount){
double initWeight = 1.0/issueCount;
type = issue.getType();
origin = issue;
switch(type){
case DISCRETE:
IssueDiscrete issueD = (IssueDiscrete)issue;
int s = issueD.getNumberOfValues();
for(int i=0;i<s;i++){
String key = issueD.getValue(i).toString();
ValueDecrease val;
if(key.equals(maximalValue.toString())){
val = new ValueDecrease(0,0.9,0.01);
}
else{
val = new ValueDecrease(initWeight,0.02,initWeight);
}
values.put(key, val);
}
break;
case REAL:
IssueReal issueR = (IssueReal)issue;
double lower = issueR.getLowerBound();
double higher = issueR.getUpperBound();
double maxValue = ((ValueReal)maximalValue).getValue();
ValueDecrease worst = new ValueDecrease(initWeight,0.1,initWeight);
values.put("WORST", worst);
//likely to be either lower or higher.
//but even if its not, that the first bid is likely to be
//closer to the optimal...
goingDown = maxValue<(lower+higher)/2;
break;
case INTEGER:
IssueInteger issueI = (IssueInteger)issue;
lower = issueI.getLowerBound();
higher = issueI.getUpperBound();
maxValue = ((ValueInteger)maximalValue).getValue();
worst = new ValueDecrease(initWeight,0.1,initWeight);
values.put("WORST", worst);
//likely to be either lower or higher.
//but even if its not, that the first bid is likely to be
//closer to the optimal...
goingDown = maxValue<(lower+higher)/2;
break;
}
}
//change all costs so that the new maximal decrease equals the old, AND all
//others change proportionately.
//assumes that the normalization process accured because of a faulty
//scale when evaluating other player's bids
public void normalize(double newWeight){
double originalMinVal = 1;
for(ValueDecrease val: values.values()){
if(originalMinVal>val.getDecrease()){
originalMinVal=val.getDecrease();
}
}
double originalMaxVal = weight();
if(originalMaxVal == originalMinVal){
for(ValueDecrease val: values.values()){
val.forceChangeDecrease(newWeight);
}
}
else{
double changeRatio = newWeight/(originalMaxVal-originalMinVal);
for(ValueDecrease val: values.values()){
val.forceChangeDecrease(
(val.getDecrease()-originalMinVal)*changeRatio);
}
}
}
//maximal decrease
public double weight(){
double maximalDecrease = 0;
for(ValueDecrease val: values.values()){
if(maximalDecrease<val.getDecrease()){
maximalDecrease=val.getDecrease();
}
}
return maximalDecrease;
}
public ValueDecrease getExpectedDecrease(Value value){
switch(type){
case DISCRETE:
ValueDecrease val = values.get(value.toString());
if(val!=null) return val;
break;
case REAL:
IssueReal issueR = (IssueReal)origin;
double lower = issueR.getLowerBound();
double higher = issueR.getUpperBound();
double curValue = ((ValueReal)value).getValue();
double portionOfWorst = (curValue-lower)/(higher-lower);
if(!goingDown){
portionOfWorst = 1-portionOfWorst;
}
ValueDecrease worst = values.get("WORST");
if(worst!=null)return new RealValuedecreaseProxy(worst,portionOfWorst);
case INTEGER:
IssueInteger issueI = (IssueInteger)origin;
lower = issueI.getLowerBound();
higher = issueI.getUpperBound();
curValue = ((ValueInteger)value).getValue();
portionOfWorst = (curValue-lower)/(higher-lower);
if(!goingDown){
portionOfWorst = 1-portionOfWorst;
}
worst = values.get("WORST");
if(worst!=null)return new RealValuedecreaseProxy(worst,portionOfWorst);
}
//should choose something that will make the program recoverable
return new ValueDecrease(1,0.01,1);
}
} | [
"601115401@qq.com"
] | 601115401@qq.com |
2d82ce9aa548fc2451ca9f85c0803a974b603867 | daab099e44da619b97a7a6009e9dee0d507930f3 | /rt/com/sun/xml/internal/ws/spi/db/RepeatedElementBridge.java | ca0b34227e9a11d7127e9825e4b2bde503a6fe18 | [] | no_license | xknower/source-code-jdk-8u211 | 01c233d4f498d6a61af9b4c34dc26bb0963d6ce1 | 208b3b26625f62ff0d1ff6ee7c2b7ee91f6c9063 | refs/heads/master | 2022-12-28T17:08:25.751594 | 2020-10-09T03:24:14 | 2020-10-09T03:24:14 | 278,289,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,925 | java | /* */ package com.sun.xml.internal.ws.spi.db;
/* */
/* */ import java.io.InputStream;
/* */ import java.io.OutputStream;
/* */ import java.lang.reflect.Array;
/* */ import java.util.Collection;
/* */ import java.util.HashSet;
/* */ import java.util.Iterator;
/* */ import java.util.List;
/* */ import java.util.NoSuchElementException;
/* */ import java.util.Set;
/* */ import javax.xml.bind.JAXBException;
/* */ import javax.xml.bind.attachment.AttachmentMarshaller;
/* */ import javax.xml.bind.attachment.AttachmentUnmarshaller;
/* */ import javax.xml.namespace.NamespaceContext;
/* */ import javax.xml.stream.XMLStreamReader;
/* */ import javax.xml.stream.XMLStreamWriter;
/* */ import javax.xml.transform.Result;
/* */ import javax.xml.transform.Source;
/* */ import org.w3c.dom.Node;
/* */ import org.xml.sax.ContentHandler;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class RepeatedElementBridge<T>
/* */ implements XMLBridge<T>
/* */ {
/* */ XMLBridge<T> delegate;
/* */ CollectionHandler collectionHandler;
/* */
/* */ public RepeatedElementBridge(TypeInfo typeInfo, XMLBridge<T> xb) {
/* 61 */ this.delegate = xb;
/* 62 */ this.collectionHandler = create(typeInfo);
/* */ }
/* */
/* */ public CollectionHandler collectionHandler() {
/* 66 */ return this.collectionHandler;
/* */ }
/* */
/* */
/* */ public BindingContext context() {
/* 71 */ return this.delegate.context();
/* */ }
/* */
/* */
/* */ public void marshal(T object, XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
/* 76 */ this.delegate.marshal(object, output, am);
/* */ }
/* */
/* */
/* */ public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
/* 81 */ this.delegate.marshal(object, output, nsContext, am);
/* */ }
/* */
/* */
/* */ public void marshal(T object, Node output) throws JAXBException {
/* 86 */ this.delegate.marshal(object, output);
/* */ }
/* */
/* */
/* */ public void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
/* 91 */ this.delegate.marshal(object, contentHandler, am);
/* */ }
/* */
/* */
/* */ public void marshal(T object, Result result) throws JAXBException {
/* 96 */ this.delegate.marshal(object, result);
/* */ }
/* */
/* */
/* */ public T unmarshal(XMLStreamReader in, AttachmentUnmarshaller au) throws JAXBException {
/* 101 */ return this.delegate.unmarshal(in, au);
/* */ }
/* */
/* */
/* */ public T unmarshal(Source in, AttachmentUnmarshaller au) throws JAXBException {
/* 106 */ return this.delegate.unmarshal(in, au);
/* */ }
/* */
/* */
/* */ public T unmarshal(InputStream in) throws JAXBException {
/* 111 */ return this.delegate.unmarshal(in);
/* */ }
/* */
/* */
/* */ public T unmarshal(Node n, AttachmentUnmarshaller au) throws JAXBException {
/* 116 */ return this.delegate.unmarshal(n, au);
/* */ }
/* */
/* */
/* */ public TypeInfo getTypeInfo() {
/* 121 */ return this.delegate.getTypeInfo();
/* */ }
/* */
/* */
/* */ public boolean supportOutputStream() {
/* 126 */ return this.delegate.supportOutputStream();
/* */ }
/* */
/* */
/* */ static class BaseCollectionHandler
/* */ implements CollectionHandler
/* */ {
/* */ Class type;
/* */
/* */
/* */ BaseCollectionHandler(Class c) {
/* 137 */ this.type = c;
/* */ } public int getSize(Object c) {
/* 139 */ return ((Collection)c).size();
/* */ }
/* */ public Object convert(List list) {
/* */ try {
/* 143 */ Object o = this.type.newInstance();
/* 144 */ ((Collection)o).addAll(list);
/* 145 */ return o;
/* 146 */ } catch (Exception e) {
/* 147 */ e.printStackTrace();
/* */
/* 149 */ return list;
/* */ }
/* */ } public Iterator iterator(Object c) {
/* 152 */ return ((Collection)c).iterator();
/* */ } }
/* */
/* 155 */ static final CollectionHandler ListHandler = new BaseCollectionHandler(List.class) {
/* */ public Object convert(List list) {
/* 157 */ return list;
/* */ }
/* */ };
/* 160 */ static final CollectionHandler HashSetHandler = new BaseCollectionHandler(HashSet.class) {
/* */ public Object convert(List<?> list) {
/* 162 */ return new HashSet(list);
/* */ }
/* */ };
/* */ public static CollectionHandler create(TypeInfo ti) {
/* 166 */ Class javaClass = (Class)ti.type;
/* 167 */ if (javaClass.isArray())
/* 168 */ return new ArrayHandler((Class)(ti.getItemType()).type);
/* 169 */ if (List.class.equals(javaClass) || Collection.class.equals(javaClass))
/* 170 */ return ListHandler;
/* 171 */ if (Set.class.equals(javaClass) || HashSet.class.equals(javaClass)) {
/* 172 */ return HashSetHandler;
/* */ }
/* 174 */ return new BaseCollectionHandler(javaClass);
/* */ }
/* */
/* */ static class ArrayHandler implements CollectionHandler {
/* */ Class componentClass;
/* */
/* */ public ArrayHandler(Class component) {
/* 181 */ this.componentClass = component;
/* */ }
/* */
/* */ public int getSize(Object c) {
/* 185 */ return Array.getLength(c);
/* */ }
/* */
/* */ public Object convert(List list) {
/* 189 */ Object array = Array.newInstance(this.componentClass, list.size());
/* 190 */ for (int i = 0; i < list.size(); i++) {
/* 191 */ Array.set(array, i, list.get(i));
/* */ }
/* 193 */ return array;
/* */ }
/* */
/* */ public Iterator iterator(final Object c) {
/* 197 */ return new Iterator() {
/* 198 */ int index = 0;
/* */
/* */ public boolean hasNext() {
/* 201 */ if (c == null || Array.getLength(c) == 0) {
/* 202 */ return false;
/* */ }
/* 204 */ return (this.index != Array.getLength(c));
/* */ }
/* */
/* */ public Object next() throws NoSuchElementException {
/* 208 */ Object retVal = null;
/* */ try {
/* 210 */ retVal = Array.get(c, this.index++);
/* 211 */ } catch (ArrayIndexOutOfBoundsException ex) {
/* 212 */ throw new NoSuchElementException();
/* */ }
/* 214 */ return retVal;
/* */ }
/* */
/* */ public void remove() {}
/* */ };
/* */ }
/* */ }
/* */
/* */ public static interface CollectionHandler {
/* */ int getSize(Object param1Object);
/* */
/* */ Iterator iterator(Object param1Object);
/* */
/* */ Object convert(List param1List);
/* */ }
/* */ }
/* Location: D:\tools\env\Java\jdk1.8.0_211\rt.jar!\com\sun\xml\internal\ws\spi\db\RepeatedElementBridge.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"xknower@126.com"
] | xknower@126.com |
dea4de14b07f42a0358d84514a9c37d9029d9a3a | 13be766e1f1105514db711161ef99e8988aa8197 | /digital.innovation.one.utils/src/digital/innovation/one/utils/operacao/internal/SubHelper.java | 9156e252acd5dd82d95be36d7305ccba000fadef | [] | no_license | FANasc/JavaModular | 24f504d41b41f478bac60d02238722cf2452c9d4 | 22d058c05824254ddafef772fa40474092ac5691 | refs/heads/main | 2023-07-04T15:23:22.985066 | 2021-07-31T23:58:20 | 2021-07-31T23:58:20 | 391,484,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package digital.innovation.one.utils.operacao.internal;
public class SubHelper implements Operacao {
@Override
public int execute(int a, int b) {
return a - b;
}
} | [
"fernandoaguiardonascimento@gmail.com"
] | fernandoaguiardonascimento@gmail.com |
48887830fee34e7226e90c00824b0a0d6e843294 | c9aaf973992089e2f76c55a91b6843c2b9ced0e4 | /src/main/java/org/hisp/dhis/commons/functional/package-info.java | c1abee8842fc14bad594c0badcdcffd0da84ac14 | [] | no_license | dhis2/dhis2-support-commons | 9cd5cc551c3651fcf5f492ff256c734c90653538 | 83714ad6832bf9be4da38866724518e3c0fbbeb3 | refs/heads/master | 2021-06-01T15:26:42.520274 | 2018-01-10T11:30:33 | 2018-01-10T11:30:33 | 37,645,074 | 0 | 0 | null | 2018-01-15T22:34:29 | 2015-06-18T07:40:27 | Java | UTF-8 | Java | false | false | 111 | java |
/**
* Functional interfaces.
*
* @author Lars Helge Overland
*/
package org.hisp.dhis.commons.functional; | [
"larshelge@gmail.com"
] | larshelge@gmail.com |
134384d7156ec7fa34df19bcd64239c99bfd4c10 | ca769cd86bf8b75d3a6ae5fd5a3c1767d50e2c54 | /src/org/helioviewer/jhv/gui/components/calendar/JHVCalendarEvent.java | a75acd972cd49c2e265d9abba75a57129868cc5c | [] | no_license | AngrodAlcarin/JHelioviewer | e4c501b2a751934b274ef1d2005a25b09f55cb97 | 2870cb2794d5829ae40e44a98e1afc38a95a2dad | refs/heads/master | 2021-01-18T16:38:50.119930 | 2015-02-27T13:32:35 | 2015-02-27T13:32:37 | 31,534,013 | 1 | 0 | null | 2015-03-02T09:58:30 | 2015-03-02T09:58:30 | null | UTF-8 | Java | false | false | 1,137 | java | package org.helioviewer.jhv.gui.components.calendar;
import java.util.EventObject;
/**
* An event which indicates that a component-defined action occured. This event
* is generated by a component (such as a JHVCalendar) when the
* component-specific action occurs (such as a date has been selected). The
* event is passed to every JHVActionListener object that registered to receive
* such events using the component's addJHVActionListener method.
*
* @author Stephan Pagel
*/
public class JHVCalendarEvent extends EventObject {
// ////////////////////////////////////////////////////////////////
// Definitions
// ////////////////////////////////////////////////////////////////
private static final long serialVersionUID = 1L;
// ////////////////////////////////////////////////////////////////
// Methods
// ////////////////////////////////////////////////////////////////
/**
* Default constructor.
*
* @param source
* The object on which the Event initially occurred.
*/
public JHVCalendarEvent(Object source) {
super(source);
}
}
| [
"stefan.meier6@students.fhnw.ch"
] | stefan.meier6@students.fhnw.ch |
c4d1879dad2fce081f82a77a847dc83ef1297a61 | dd73d856ef2ee7d8a411da53fb90889b8bc203bb | /FoodTruck/app/src/main/java/com/example/user/foodtruck/MenuActivity.java | e57a35d1566f9c801bfd3217ce3a3df736b6f376 | [] | no_license | dyyyy/FoodTruck_Application | 68d12e3a83b121a19f9b737212beb3cb1e72ab05 | fa8f12d2cd0f520255ef2006de9ef225548f661f | refs/heads/master | 2021-05-10T16:16:15.473779 | 2018-03-05T06:45:43 | 2018-03-05T06:45:43 | 118,572,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,896 | java | package com.example.user.foodtruck;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import com.example.user.adapter.MenuTabAdapter;
import com.example.user.networkutil.NetworkAvailable;
import com.example.user.networkutil.RestTempleatAsyncTask;
import com.example.user.vo.FoodTruckVO;
import com.example.user.vo.ReviewVO;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
public class MenuActivity extends AppCompatActivity {
int setPosition;
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
NetworkAvailable networkAvailable = new NetworkAvailable(this);
if (networkAvailable.isNetworkAvailable()) {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar1);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
setPosition = getIntent().getIntExtra("position", 0);
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setCurrentItem(setPosition, false);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs1);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
} else {
Toast.makeText(this, "network is not available", Toast.LENGTH_SHORT).show();
finish();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public static class PlaceholderFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener {
private static final String ARG_SECTION_NUMBER = "section_number";
public PlaceholderFragment() {
}
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
private View mFragmentView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d("argument", " : " + getArguments().get(ARG_SECTION_NUMBER));
if (mFragmentView != null) {
return mFragmentView;
} else {
//한번씩만 호출됨 그뒤로 호출안됨..
mFragmentView = inflater.inflate(R.layout.menu_tab, container, false);
Map<String, Integer> map = new HashMap<>();
map.put("category", getArguments().getInt(ARG_SECTION_NUMBER));
String addr = "/getfoodtrucklist/{category}";
RestTempleatAsyncTask restTempleatAsyncTask = new RestTempleatAsyncTask(addr, map);
try {
String result = restTempleatAsyncTask.execute().get();
List<FoodTruckVO> ftrucklist1 = new ObjectMapper().readValue(result, new TypeReference<List<FoodTruckVO>>() {
});
ListView listView = mFragmentView.findViewById(R.id.menutablistview);
MenuTabAdapter menuTabAdapter = new MenuTabAdapter(listView.getContext(), ftrucklist1);
listView.setAdapter(menuTabAdapter);
listView.setOnItemClickListener(this);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return mFragmentView;
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
FoodTruckVO vo = (FoodTruckVO) parent.getItemAtPosition(position);
Intent intent;
if (vo != null) {
intent = new Intent(this.getContext(), MenuDetailActivity.class);
intent.putExtra("object", vo);
startActivity(intent);
} else {
Toast.makeText(this.getContext(), "게시물이 없습니다.", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onClick(View v) {
/*페이징 처리부분*/
Toast.makeText(v.getContext(), "페이징 버튼 : " + v.getId() + "category : " + getArguments().getInt(ARG_SECTION_NUMBER), Toast.LENGTH_SHORT).show();
switch (getArguments().getInt(ARG_SECTION_NUMBER)) {
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
default:
break;
}
}
}
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return PlaceholderFragment.newInstance(position + 1);
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "tab1";
case 1:
return "tab2";
case 2:
return "tab3";
case 3:
return "tab4";
case 4:
return "tab5";
case 5:
return "tab6";
case 6:
return "tab7";
case 7:
return "tab8";
case 8:
return "tab9";
default:
return "error";
}
}
@Override
public int getCount() {
// Show 3 total pages.
return 9;
}
}
}
| [
"dyj7857@gmail.com"
] | dyj7857@gmail.com |
a3fe3cd9275c7c25503d5947c3abec142443f033 | 50bcdc5639b17ca8cc2809033a064bac59a84023 | /Foodpai/app/src/main/java/com/mobilephone/foodpai/activity/FoodMainDetailsActivity.java | 53d67cec2fb779f3c32465f307b2f7ac60682a4b | [] | no_license | liaoshaowei/MyFoos | a277f657879150421dce68539e5a038b01fcc07d | f486cc24f2bc9e603f2ae05edc46a7c8bd76a9f5 | refs/heads/master | 2020-07-13T08:03:24.962201 | 2016-11-16T06:15:03 | 2016-11-16T06:15:03 | 73,888,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,666 | java | package com.mobilephone.foodpai.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.mobilephone.foodpai.R;
import com.mobilephone.foodpai.adapter.MainDetailListViewAdapter;
import com.mobilephone.foodpai.bean.FoodMainDetailBean;
import com.mobilephone.foodpai.bean.UserBean;
import com.mobilephone.foodpai.bean.bmobbean.CollectBean;
import com.mobilephone.foodpai.myinterface.UnitOfHeat;
import com.mobilephone.foodpai.myview.MylistView;
import com.mobilephone.foodpai.util.DaoBmobUtil;
import com.mobilephone.foodpai.util.DownLoadImageUtil;
import com.mobilephone.foodpai.util.HttpUtil;
import com.mobilephone.foodpai.util.JsonUtil;
import com.mobilephone.foodpai.util.ThreadUtil;
import com.mobilephone.foodpai.util.UnitUtil;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.bmob.v3.exception.BmobException;
public class FoodMainDetailsActivity extends AppCompatActivity {
private static final int GET_SEARCH_DETAILS = 10;
private static final String TAG = "test";
@Bind(R.id.toolbar)
Toolbar toolbar;
@Bind(R.id.ivGoodsPic)
ImageView ivGoodsPic;
@Bind(R.id.tvGoodsName)
TextView tvGoodsName;
@Bind(R.id.tvEnergy)
TextView tvEnergy;
@Bind(R.id.rbKilocalorie)
RadioButton rbKilocalorie;
@Bind(R.id.rbKilojoule)
RadioButton rbKilojoule;
@Bind(R.id.btnAdd)
Button btnAdd;
@Bind(R.id.btnCompare)
Button btnCompare;
@Bind(R.id.radioGroup)
RadioGroup radioGroup;
@Bind(R.id.tvUnit)
TextView tvUnit;
@Bind(R.id.tvIngredientCalory)
TextView tvIngredientCalory;
@Bind(R.id.tvLightsCalory)
TextView tvLightsCalory;
@Bind(R.id.tvIngredientProtein)
TextView tvIngredientProtein;
@Bind(R.id.tvLightsProtein)
TextView tvLightsProtein;
@Bind(R.id.tvIngredientFat)
TextView tvIngredientFat;
@Bind(R.id.tvLightsFat)
TextView tvLightsFat;
@Bind(R.id.tvInCarbohydrate)
TextView tvInCarbohydrate;
@Bind(R.id.tvLightsCarbohydrate)
TextView tvLightsCarbohydrate;
@Bind(R.id.tvInFiberDietary)
TextView tvInFiberDietary;
@Bind(R.id.tvLightsFiberDietary)
TextView tvLightsFiberDietary;
@Bind(R.id.tvGIvalue)
TextView tvGIvalue;
@Bind(R.id.tvGIgrade)
TextView tvGIgrade;
@Bind(R.id.tvGLvalue)
TextView tvGLvalue;
@Bind(R.id.tvGLgrade)
TextView tvGLgrade;
@Bind(R.id.ivCaloriesPic)
ImageView ivCaloriesPic;
@Bind(R.id.tvRide)
TextView tvRide;
@Bind(R.id.tvCompare)
TextView tvCompare;
@Bind(R.id.lvCalories)
MylistView lvCalories;
@Bind(R.id.tvLight)
TextView tvLight;
@Bind(R.id.tvSuggest)
TextView tvSuggest;
@Bind(R.id.tvAppraise)
TextView tvAppraise;
@Bind(R.id.rgSwitch)
RadioGroup rgSwitch;
@Bind(R.id.rlCompare)
RelativeLayout rlCompare;
@Bind(R.id.tvMultiple)
TextView tvMultiple;
@Bind(R.id.tvHead)
TextView tvHead;
private MainDetailListViewAdapter detailLvAdapter;
private String calory;
private String kilo;
private String liCalory;
private String inProtein;
private String liProtein;
private String inFat;
private String liFat;
private String inCarbohydrate;
private String liCarbohydrate;
private String inFiberDietary;
private String liFiberDietary;
private String _calory;
private List<UnitOfHeat> unitOfHeats = new ArrayList<>();
boolean isCollect = false;//判断是否已经收藏
private String code;
private Map<String, String> map = new HashMap<>();
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case GET_SEARCH_DETAILS:
String json = (String) msg.obj;
if (json != null) {
FoodMainDetailBean detailBean = JsonUtil.parseFoodMainDetailBean(json);
if (detailBean != null) {
List<FoodMainDetailBean.UnitsBean> units = detailBean.getUnits();
//食物名称
name = detailBean.getName();
url = detailBean.getThumb_image_url();
imageUrl = detailBean.getLarge_image_url();
String fiber_dietary = detailBean.getFiber_dietary();//食物纤维
String calory = detailBean.getCalory();//热量
String protein = detailBean.getProtein();//蛋白质
String carbohydrate = detailBean.getCarbohydrate();// 碳水化合物
String gi = detailBean.getGi();//Gi值
String gl = detailBean.getGl();//GL
String appraise = detailBean.getAppraise();//食物红绿灯
//初始化RadioButton
initRadioButton(units);
//刷新ListView
detailLvAdapter.notifyDataSetChanged();
//放置数据
placeData_i(detailBean);
placeData_ii(detailBean);
placeData_iii(detailBean);
Glide.with(FoodMainDetailsActivity.this).load(url).into(ivGoodsPic);
tvGoodsName.setText(name);
tvEnergy.setText(calory+"千卡");
}
}
break;
}
}
};
private String _kilo;
private String name;
private String url;
private String imageUrl;
private Menu menu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_food_main_details);
ButterKnife.bind(this);
//获取code
Intent intent = getIntent();
code = intent.getStringExtra("code");
initFoodDetails(code);
//初始化ToolBar
initToolBar();
//初始化ListiView
initListView();
onQuery();
}
/**
*
*
* @param code
*/
/**
* 初始化ToolBar
*/
private void initToolBar() {
setSupportActionBar(toolbar);
toolbar.setTitle("详细信息");
toolbar.setTitleTextColor(getResources().getColor(R.color.black));
toolbar.setNavigationIcon(R.mipmap.ic_back_dark);
menu = toolbar.getMenu();
}
/**
* 为ToolBar绑定菜单
* @param menu
* @return
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.food_main_detail_tool_bar_menu, menu);
return true;
}
/**
* 为ToolBar的菜单项设置点击事件
*
* @param item
* @return
*/
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// startActivity(new Intent(this, MainActivity.class));
finish();
break;
case R.id.action_like:
UserBean user = UserBean.getCurrentUser(UserBean.class);
if (user!=null) {
//增加
if (isCollect == false) {
DaoBmobUtil.getInstance().onAdd(name,null,imageUrl,calory,code, new DaoBmobUtil.OnDaoAdd() {
@Override
public void onAdd(String s, BmobException e) {
if (e == null) {
Toast.makeText(FoodMainDetailsActivity.this, "收藏", Toast.LENGTH_SHORT).show();
item.setIcon(R.mipmap.ic_news_keep_heighlight);
onQuery();
}else {
Toast.makeText(FoodMainDetailsActivity.this, "网络异常,请检查网络", Toast.LENGTH_SHORT).show();
}
}
});
//删除
} else {
Log.e(TAG, "onOptionsItemSelected: ");
DaoBmobUtil.getInstance().onDelete(map,name, new DaoBmobUtil.OnDelete() {
@Override
public void onDelete(BmobException e) {
if (e == null) {
Toast.makeText(FoodMainDetailsActivity.this, "取消收藏", Toast.LENGTH_SHORT).show();
item.setIcon(R.mipmap.ic_news_keep_default);
isCollect = false;
}else {
Toast.makeText(FoodMainDetailsActivity.this, "网络异常,请检查网络", Toast.LENGTH_SHORT).show();
}
}
});
}
}else {
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
break;
}
return true;
}
/**
* 查询数据库
* 获得objectId;
*/
public void onQuery() {
DaoBmobUtil.getInstance().onQuery(new DaoBmobUtil.OnDaoQuery() {
@Override
public void onQuery(List<CollectBean> list, BmobException e) {
if (e == null) {
for (int i = 0; i < list.size(); i++) {
String titlename = list.get(i).getTitle();
String objectId = list.get(i).getObjectId();
Log.e(TAG, "onQuery: "+titlename+"/"+objectId);
map.put(titlename, objectId); //获得objectId并存储在map中
if (titlename.equals(name)) {
//设置收藏图标和文字
Log.e(TAG, "onQueryequals: "+name);
menu.findItem(R.id.action_like).setIcon(R.mipmap.ic_news_keep_heighlight);
isCollect = true;
}
}
}else {
Toast.makeText(FoodMainDetailsActivity.this, "网络异常,请检查网络", Toast.LENGTH_SHORT).show();
}
}
});
}
/**
* 根据FoodMainDetailBean.UnitsBean的数量,动态绘画RadioButton
* 根据FoodMainDetailBean.UnitsBean的数量,动态绘画RadioButton
* 根据FoodMainDetailBean.UnitsBean的数量,动态绘画RadioButton,并给unitOfHeats赋值
* 每个物品的第一个RadioButton都是“每100克”,但是不在units中
*
* @param units
*/
private void initRadioButton(List<FoodMainDetailBean.UnitsBean> units) {
for (int i = 0; i <= units.size(); i++) {
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
layoutParams.setMargins(6, 5, 5, 6);
RadioButton radioButton = new RadioButton(this);
radioButton.setLayoutParams(layoutParams);
if (i == 0) {
radioButton.setText("每100克");
radioButton.setChecked(true);
} else {
FoodMainDetailBean.UnitsBean unitsBean = units.get(i - 1);
String unitName = unitsBean.getAmount() + unitsBean.getUnit();
radioButton.setText(unitName);
UnitOfHeat unitOfHeat = new UnitOfHeat(unitName, unitsBean.getWeight(), unitsBean.getCalory());
unitOfHeats.add(unitOfHeat);
}
radioButton.setTextColor(getResources().getColor(R.color.mainGray));
radioButton.setButtonDrawable(android.R.color.transparent); //隐藏单选圆形按钮
radioButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.selector_main_detail_ii_radiobutton));
radioButton.setGravity(Gravity.CENTER);
radioButton.setEllipsize(TextUtils.TruncateAt.MARQUEE);
radioButton.setLines(1);
radioButton.setId(i);
radioGroup.addView(radioButton, layoutParams);
radioGroup.invalidate();
}
}
/**
* 放置布局1的数据
* @param detailBean
*/
private void placeData_i(FoodMainDetailBean detailBean) {
String name = detailBean.getName();
calory = detailBean.getCalory();
toolbar.setTitle(name);
tvGoodsName.setText(name);
DownLoadImageUtil.load(this, detailBean.getThumb_image_url(), R.mipmap.mq_ic_emoji_normal, R.mipmap.fail_img, ivGoodsPic);
calory = detailBean.getCalory();
rgSwitch.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rbKilocalorie:
tvEnergy.setText(calory + "千卡");
break;
case R.id.rbKilojoule:
kilo = UnitUtil.conversionKilo(calory);
tvEnergy.setText(kilo + "千焦");
break;
}
int checked = radioGroup.getCheckedRadioButtonId();
if (checked == 0) {
placeCaloryOrKilo(calory);
} else {
placeCaloryOrKilo(_calory);
}
}
});
}
/**
* 放置布局2的数据
*
* @param detailBean
*/
private void placeData_ii(final FoodMainDetailBean detailBean) {
FoodMainDetailBean.IngredientBean ingredient = detailBean.getIngredient();
final FoodMainDetailBean.LightsBean lights = detailBean.getLights();
_calory = ingredient.getCalory();
liCalory = lights.getCalory();
inProtein = ingredient.getProtein();
liProtein = lights.getProtein();
inFat = ingredient.getFat();
liFat = lights.getFat();
inCarbohydrate = ingredient.getCarbohydrate();
liCarbohydrate = lights.getCarbohydrate();
inFiberDietary = ingredient.getFiber_dietary();
liFiberDietary = lights.getFiber_dietary();
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId > 0) {
List<FoodMainDetailBean.UnitsBean> units = detailBean.getUnits();
String calory_unit = units.get(checkedId - 1).getCalory();
placeCaloryOrKilo(calory_unit);
inProtein = UnitUtil.conversionUnit(_calory, calory_unit, inProtein);
inFat = UnitUtil.conversionUnit(_calory, calory_unit, inFat);
inCarbohydrate = UnitUtil.conversionUnit(_calory, calory_unit, inCarbohydrate);
inFiberDietary = UnitUtil.conversionUnit(_calory, calory_unit, inFiberDietary);
tvUnit.setText(units.get(checkedId - 1).getAmount() + units.get(checkedId - 1).getUnit());
} else {
tvUnit.setText("每100克");
placeCaloryOrKilo(_calory);
}
placeData(detailBean, lights);
}
});
placeData(detailBean, lights);
placeCaloryOrKilo(_calory);
}
private void placeData(FoodMainDetailBean detailBean, FoodMainDetailBean.LightsBean lights) {
tvLightsCalory.setText(liCalory);
tvIngredientProtein.setText(inProtein.length() == 0 ? "---" : inProtein + "克");
tvLightsProtein.setText(liProtein);
tvIngredientFat.setText(inFat.length() == 0 ? "---" : inFat + "克");
tvLightsFat.setText(liFat);
tvInCarbohydrate.setText(inCarbohydrate.length() == 0 ? "---" : inCarbohydrate + "克");
tvLightsCarbohydrate.setText(liCarbohydrate);
tvInFiberDietary.setText(inFiberDietary.length() == 0 ? "---" : inFiberDietary + "克");
tvLightsFiberDietary.setText(liFiberDietary);
tvGIvalue.setText(detailBean.getGi());
tvGLvalue.setText(detailBean.getGl());
tvGIgrade.setText(lights.getGi());
tvGLgrade.setText(lights.getGl());
}
private void placeCaloryOrKilo(String calory) {
if (rbKilocalorie.isChecked()) {
tvIngredientCalory.setText(calory + "千卡");
} else {
String kilo = UnitUtil.conversionKilo(calory);
tvIngredientCalory.setText(kilo + "千焦");
}
}
/**
* 初始化布局3中的ListView
*/
public void initListView() {
detailLvAdapter = new MainDetailListViewAdapter(this, unitOfHeats);
lvCalories.setAdapter(detailLvAdapter);
}
/**
* 放置布局3中的数据
*
* @param detailBean
*/
public void placeData_iii(FoodMainDetailBean detailBean) {
String appraise = detailBean.getAppraise();
FoodMainDetailBean.CompareBean compare = detailBean.getCompare();
Method[] methods = compare.getClass().getMethods();
tvAppraise.setText(appraise);
int health_light = detailBean.getHealth_light();
switch (health_light) {
case 1:
tvLight.setBackgroundResource(R.mipmap.ic_food_light_green);
tvSuggest.setText("推荐");
tvSuggest.setTextColor(getResources().getColor(R.color.light_green));
break;
case 2:
tvLight.setBackgroundResource(R.mipmap.ic_food_light_yellow);
tvSuggest.setText("适量");
tvSuggest.setTextColor(getResources().getColor(R.color.light_yellow));
break;
case 3:
tvLight.setBackgroundResource(R.mipmap.ic_food_light_red);
tvSuggest.setText("少吃");
tvSuggest.setTextColor(getResources().getColor(R.color.light_red));
break;
}
if(detailBean.getUnits() == null||detailBean.getUnits().size() == 0){
tvHead.setVisibility(View.GONE);
}
if (compare.getAmount1() == null){
rlCompare.setVisibility(View.GONE);
ivCaloriesPic.setVisibility(View.GONE);
tvMultiple.setVisibility(View.GONE);
tvCompare.setVisibility(View.GONE);
}else {
DownLoadImageUtil.load(this,compare.getTarget_image_url(),R.mipmap.mq_ic_emoji_normal,R.mipmap.fail_img,ivCaloriesPic);
tvMultiple.setText(compare.getAmount1());
tvCompare.setText(compare.getAmount0()+compare.getUnit0()+detailBean.getName()+" ≈ "+compare.getAmount1()+compare.getUnit1()+compare.getTarget_name());
}
}
/**
* 初始化FoodDetail的数据
*
* @param code
*/
private void initFoodDetails(final String code) {
ThreadUtil.execute(new Runnable() {
@Override
public void run() {
String foodMainDetailJson = HttpUtil.getFoodMainDetailJson(FoodMainDetailsActivity.this, code);
if (foodMainDetailJson != null) {
Message msg = handler.obtainMessage();
msg.what = GET_SEARCH_DETAILS;
msg.obj = foodMainDetailJson;
handler.sendMessage(msg);
}
}
});
}
}
| [
"18818849865@163.com"
] | 18818849865@163.com |
0954afade0a82e1b3378e1a6d1e4d46ec017468d | e05bbf93210be7e568c9aa9954ad6016b9f8c98e | /SydovaVladaFirstProject/src/main/java/ua/mainLogic/Parsing.java | 4be6d30235e264bdba3d2c75237dc3861c71af77 | [] | no_license | SokolSerhiy/First | d7c6cc270ad3b280f859aa0a0810c28256593a84 | 31322a7bbd5206e1800fa6f1b3ede431bd9b1bd3 | refs/heads/master | 2021-07-08T13:17:12.039087 | 2017-10-03T12:22:17 | 2017-10-03T12:22:17 | 105,646,642 | 0 | 0 | null | 2017-10-03T12:01:02 | 2017-10-03T12:01:01 | null | UTF-8 | Java | false | false | 2,696 | java | package ua.mainLogic;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.context.ConfigurableApplicationContext;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import ua.entity.Cases;
import ua.entity.Courts;
import ua.graphics.FirstPage;
import ua.repository.CaseRepository;
public class Parsing {
public int parse(ConfigurableApplicationContext run, Courts court) {
int t = 0;
try {
String START_URL = court.getAdress();
WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED);
HtmlPage page = webClient.getPage(START_URL);
webClient.getOptions().setJavaScriptEnabled(true);
// webClient.getOptions().setCssEnabled(true);
// webClient.getOptions().setThrowExceptionOnScriptError(false);
// webClient.getOptions().setPrintContentOnFailingStatusCode(false);
webClient.waitForBackgroundJavaScript(1000);
HtmlButton button = page.getHtmlElementById("cleardate");
button.click();
webClient.waitForBackgroundJavaScript(1000);
final HtmlTable table = page.getHtmlElementById("assignments");
CaseRepository caseRepository = run.getBean(CaseRepository.class);
DomElement buttonNext = page.getFirstByXPath("//span[@class='ui-icon ui-icon-circle-arrow-e']");
DomElement elem = page.getElementById("assignments_info");
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy hh:mm");
String strdate = null;
Date nDate = null;
int second = 0;
for (int k = 0; k <= second; k++) {
for (int i = 1; i < 11; i++) {
if (table.getCellAt(i, 1) == null) {
break;
}
String full = elem.asText();
int first = Integer.valueOf(full.substring(full.indexOf("із") + 3, full.length() - 9));
second = first / 10;
Cases cas = new Cases();
strdate = table.getCellAt(i, 0).asText();
nDate = sdf.parse(strdate);
cas.setDate(nDate);
cas.setJudge(table.getCellAt(i, 1).asText());
cas.setNumber(table.getCellAt(i, 2).asText());
cas.setSides(table.getCellAt(i, 3).asText());
cas.setType(table.getCellAt(i, 4).asText());
cas.setCourt(court.getName().toString());
caseRepository.save(cas);
t++;
}
buttonNext.click();
}
webClient.close();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println(t);
return t;
}
}
| [
"saveskul@ukr.net"
] | saveskul@ukr.net |
ee0fe4ec0214f1b23da2986d11ec5968baf054c9 | 1a37864cb448b269c57c8757203322605763cd9b | /src/essais/TestMoyenne.java | 51af8ec20ab9b0c1918d9549ecbf6985de40a795 | [] | no_license | Xeenaath/approche-objet | 65792ba79f92aea15d198e0abd4456a0554a9473 | e33f15179e0780f0379a03262a44a3e4c73849f4 | refs/heads/master | 2023-04-09T11:31:05.712614 | 2020-07-08T09:47:41 | 2020-07-08T09:47:41 | 275,096,483 | 0 | 0 | null | 2021-04-26T20:27:08 | 2020-06-26T07:17:29 | Java | UTF-8 | Java | false | false | 391 | java | package essais;
import banque.CalculMoyenne;
public class TestMoyenne {
public static void main(String[] args) {
CalculMoyenne calculMoyenne = new CalculMoyenne();
calculMoyenne.ajout(12);
calculMoyenne.ajout(15);
calculMoyenne.ajout(18);
calculMoyenne.ajout(11);
calculMoyenne.ajout(17);
calculMoyenne.ajout(19);
System.out.println(calculMoyenne.calculMoyenne());
}
}
| [
"znathangirotz@gmail.com"
] | znathangirotz@gmail.com |
5a3670a87ced603ec4e67c53426cb85ed43b9bf8 | 09f5ac6ba9039072048a3830647012563cf81501 | /MySolution/src/test/java/com/leetcode/SolutionReverse.java | be0346bf3001effdec8af859c650292e490e359f | [] | no_license | DrinkToWink/DataStructureAlgorithm | fe93ec87d80a50ebcee5f1528821286d793dca4c | bd05eba86631d4045d4a71708726b789c0ae0075 | refs/heads/master | 2023-05-08T03:06:46.410008 | 2021-05-29T03:25:41 | 2021-05-29T03:25:41 | 295,161,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.leetcode;
/**
* @User xiangyl
* @Data 2021/5/28
*/
public class SolutionReverse {
public static void main(String[] args) {
SolutionReverse solutionReverse = new SolutionReverse();
System.out.println(solutionReverse.reverse(1534236469));
}
public int reverse(int x) {
int res = 0;
int a = 0;
while (x != 0) {
if (res < Integer.MIN_VALUE / 10 || res > Integer.MAX_VALUE / 10)
a = x % 10;
x /= 10;
res = res * 10 + a;
}
return res;
}
}
| [
"2279104443@qq.com"
] | 2279104443@qq.com |
5f92b005205832cf8b979b8d3856c9ac9b9e95f0 | 6cd8234075cd59c4f6a1491da4185eab0e4a4337 | /src/Student/studentDAO.java | e06de983a8d8810d41a4ab834a84e6aeb1d2bcd6 | [] | no_license | stuti-deshpande/Servlet--JSPs--MVC-via-RequestDispatcher---Database-I-O- | 9032b78f53b098c8d5d4edf13f6c5de74972764d | 7e7f0c3f764a197c0be43e1e4d92b6d4b8c57af0 | refs/heads/master | 2021-01-22T18:58:11.333091 | 2017-03-16T01:51:26 | 2017-03-16T01:51:26 | 85,139,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,409 | java | package Student;
import java.sql.*;
public class studentDAO {
public Connection con=null;
public studentDAO(){
try{
System.out.println("trying server connect");
Class.forName ("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection ("jdbc:oracle:thin:@apollo.ite.gmu.edu:1521:ite10g","sdeshpa2", "zeezoo");
}
catch(Exception e){
System.out.println("Cannot connect to the server");
e.printStackTrace();
}
}
public studentBean retrieveData(String Student_Id){
Statement stmt = null;
studentBean sb1=null;
try
{
System.out.println("Creating statement...");
stmt = con.createStatement();
String sql;
sql = "select * from surveydetails where STUDENT_ID= '"+ Student_Id +"'";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next())
{
String studentid = rs.getString("STUDENT_ID");
String firstname = rs.getString("fstname");
//String lastname = rs.getString("lastname");
String telno = rs.getString("phone");
String street1 = rs.getString("street1");
String street2 = rs.getString("street2");
String city = rs.getString("city");
String state = rs.getString("state");
String zip = rs.getString("zip");
String email = rs.getString("email");
String likes = rs.getString("likemost");
String site = rs.getString("howtosite");
String data = rs.getString("numbers");
String mean = rs.getString("mean");
String sd = rs.getString("SD");
String URL=rs.getString("URL");
String Likelihood=rs.getString("Likelihood");
String date=rs.getString("DOS");
String GradMonth=rs.getString("GradMonth");
String Year=rs.getString("Year");
String comments=rs.getString("comments");
sb1=new studentBean();
sb1.setStudentID(studentid);
sb1.setFirstName(firstname);
//sb1.setLastName(lastname);
sb1.setStreet1(street1);
sb1.setStreet2(street2);
sb1.setTelephonenum(telno);
sb1.setEmail(email);
sb1.setZip(zip);
sb1.setState(state);
sb1.setCity(city);
sb1.setLikeMost(likes);
sb1.setHowToSite(site);
sb1.setData(data);
sb1.setMean(mean);
sb1.setSd(sd);
sb1.setURL(URL);
sb1.setLikelihood(Likelihood);
sb1.setGradMonth(GradMonth);
sb1.setYear(Year);
sb1.setComments(comments);
sb1.setDate(date);
}
}
catch(Exception e){
System.out.println("Unable to retreive data");
e.printStackTrace();
}
return sb1;
}
public void storeData(String STUDENT_ID,String fstname,String street1, String street2, String zip, String city,String state,String email,String phone,String URL,String DOS,String numbers,String howtosite,String GradMonth,String Year,String Likelihood,String mean,String SD,String likemost,String comments) throws SQLException{
{
try{
Statement stmt= con.createStatement();
String sql="insert into surveydetails values ('"+STUDENT_ID+"','"+fstname+"','"+street1+"','"+street2+"','"+zip+"','"+city+"','"+state+"','"+email+"','"+phone+"','"+URL+"','"+numbers+"','"+howtosite+"','"+GradMonth+"','"+Year+"','"+Likelihood+"','"+mean+"','"+SD+"','"+likemost+"','"+comments+"','"+DOS+"')";
stmt.executeUpdate(sql);
}
catch(Exception e){
System.out.println("Cannot store data in database");
e.printStackTrace();
}
}
}
public String getStudentId(){
ResultSet rs =null;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<ul>");
try
{
Statement stmt= con.createStatement();
String sql1="select STUDENT_ID from surveydetails";
rs=stmt.executeQuery(sql1);
while(rs.next()){
stringBuilder.append("<li><a href='Myservlet?STUDENT_ID="+ rs.getString("Student_ID") +"'>"+rs.getString("Student_ID")+"</a></li>");
}
stringBuilder.append("</ul>");
con.close();
} catch (Exception e) {
System.out.println("Cannot get student ID's: "+e.getMessage());
e.printStackTrace();
}
return stringBuilder.toString();
}
}
| [
"stutideshpande.19@gmail.com"
] | stutideshpande.19@gmail.com |
25832eb7bee8b30fac5286a3bb5389d772187ecf | dbf3e67f54827c57ddf0ddd6081633ea02b25e01 | /app/src/main/java/com/ek/posbridge/API/Retrofit/LocationCall/Address.java | c7cc4d5c2566a18790675f16d980cbc91ee0ee1b | [] | no_license | ekrusznis/SCposbridge | 26c5911695daa45eaf8feff1cc1a979d5999c9c9 | fc094866d856408e5ebc28a6eadcc2b368d0accb | refs/heads/master | 2020-03-24T21:58:21.309585 | 2018-07-31T19:52:38 | 2018-07-31T19:52:38 | 143,060,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,794 | java | package com.ek.posbridge.API.Retrofit.LocationCall;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Address {
@SerializedName("address_line_1")
@Expose
private String addressLine1;
@SerializedName("locality")
@Expose
private String locality;
@SerializedName("administrative_district_level_1")
@Expose
private String administrativeDistrictLevel1;
@SerializedName("postal_code")
@Expose
private String postalCode;
@SerializedName("country")
@Expose
private String country;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Address:\n");
sb.append(new GsonBuilder().setPrettyPrinting().create().toJson(this));
return sb.toString();
}
public String getAddressLine1() {
return addressLine1;
}
public void setAddressLine1(String addressLine1) {
this.addressLine1 = addressLine1;
}
public String getLocality() {
return locality;
}
public void setLocality(String locality) {
this.locality = locality;
}
public String getAdministrativeDistrictLevel1() {
return administrativeDistrictLevel1;
}
public void setAdministrativeDistrictLevel1(String administrativeDistrictLevel1) {
this.administrativeDistrictLevel1 = administrativeDistrictLevel1;
}
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
} | [
"ekrusznis@aol.com"
] | ekrusznis@aol.com |
2c257309cf86fa71cf085be0f2b5e34e7d4377c9 | e2098dc52d16f0bcbfe134f8da2ca58d64cbcbd5 | /src/it/multithread/ReentrantLockDemo.java | d42decfdbbb5817586b0e0d6ce8646bc23b4b4cc | [] | no_license | ale1692/Esempio | 717f1cb440bafb233ee628c5317ba1cb16431b96 | 718fd5649dca0de85d518535ab423c726e24c2e7 | refs/heads/master | 2021-03-30T16:12:48.776436 | 2018-03-03T17:55:15 | 2018-03-03T17:55:15 | 122,380,037 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 921 | java | package it.multithread;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ReentrantLockDemo {
public static void main(String[] args) {
Hole hole = new Hole();
ProducerEvolution producer = new ProducerEvolution(hole);
ConsumerEvolution consumer = new ConsumerEvolution(hole);
ExecutorService executor = Executors.newFixedThreadPool(2);
executor.submit(producer);
executor.submit(consumer);
// Evidenziamo la registrazione degli oggetti producer e consumer, la loro
// esecuzione per 10 ms, e lo shutdown dell’Executor che arresta i Thread
// coinvolti. L’esecuzione della classe demo mostrerà in console lo stesso
// risultato visto nel precedente capitolo.
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
executor.shutdownNow();
System.out.println("Shutdown completato");
}
}
| [
"ale16_92@hotmail.it"
] | ale16_92@hotmail.it |
3565ae78bb20e135c2753495dcf210b6a38008f7 | c582b903003533693985810b1bede0491d492ee7 | /src/main/java/com/kidsphoto/mall/entity/Product.java | ae158b7e3de501ba2cbedb4eb0e013c521f7ccf6 | [] | no_license | LM-0826/mall | d4da70ee6452ab07247ab8be6eb3f90dd76a6144 | 9de2e4d578ee731a1f4b0a7466286fb4586bef6e | refs/heads/master | 2022-06-26T11:33:02.803967 | 2019-11-29T10:18:39 | 2019-11-29T10:18:39 | 219,468,253 | 0 | 0 | null | 2022-06-17T02:38:19 | 2019-11-04T09:52:34 | Java | UTF-8 | Java | false | false | 843 | java | package com.kidsphoto.mall.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author 李明
* @create 2019-11-18 16:59
*/
@lombok.Data
@Entity
@Table(name = "t_product")
public class Product extends Data implements Serializable {
//学校
@Column(name = "school")
private String school;
//产品名字
@Column(name = "product_name")
private String productName;
//照片类型id
@Column(name = "photo_type_id")
private Long photoTypeId;
// 产品描述
@Column(name = "product_describe")
private String productDescribe;
// 价格
@Column(name = "price", nullable = false)
private BigDecimal price = new BigDecimal("0.00");
// 有无规格 0 无规格,1 有规格
@Column(name = "flag")
private int flag;
}
| [
"317174545@qq.com"
] | 317174545@qq.com |
811288305de98a6a32c5566a523b51be7300cedc | 4116dea1f23a2708167301b328d43f0b08675b2f | /footballapi/src/androidTest/java/com/arc/footballapi/ExampleInstrumentedTest.java | 47e6613be6159f2ff194ca293b1e4e4a0b21e284 | [] | no_license | adirahman/TestFootBallAPI | 6e1596e8e0de0a1a4093f35f92eb4bf3d98137fe | 5535bc0f2734c57520d3eab47b0637fb1d6bbaed | refs/heads/master | 2020-04-22T14:00:16.703937 | 2019-02-13T07:25:15 | 2019-02-13T07:25:15 | 170,428,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package com.arc.footballapi;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.arc.footballapi.test", appContext.getPackageName());
}
}
| [
"rahmanadi9@gmail.com"
] | rahmanadi9@gmail.com |
f1a2bc6262302e5bb9a16ef5b235e903ef14b23d | 75384ca29ccc6d71ff8c52f68bc5bf9503d24413 | /2294-동전 2.java | 87a4d9dc2cc4d8768bf8f5880df0960691840da0 | [] | no_license | ptkjw1997/BaekJoon | c7e706a1018497dcc2f177b84c91a3fa017174c1 | 50d999888ca4556726d06e26b3c435b2e2835152 | refs/heads/master | 2023-07-17T22:52:32.791214 | 2021-08-21T15:47:46 | 2021-08-21T15:47:46 | 385,880,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | package Main;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] line = br.readLine().split(" ");
int num_coin = Integer.parseInt(line[0]), target = Integer.parseInt(line[1]);
int[] coin = new int[num_coin+1];
int[] DP = new int[target+1];
Arrays.fill(DP, 10001);
DP[0] = 0;
for(int i = 1; i <= num_coin; i++) {
coin[i] = Integer.parseInt(br.readLine());
}
for(int i = 1; i <= num_coin; i++) {
for(int j = coin[i]; j <= target; j++) {
DP[j] = Math.min(DP[j], DP[j-coin[i]]+1);
}
}
System.out.println((DP[target] == 10001) ? -1 : DP[target]);
}
} | [
"ptkjw1997@naver.com"
] | ptkjw1997@naver.com |
94b20ef43b06a812103aff67c2c34404f2cb8ed3 | db4cbf3e52784c2647fa5e6f780f69201e01e0d6 | /servicios-jpa/src/main/java/co/com/servicios/modelo/Competencia.java | f0730d847e2c4008cc8f2fbc32a9e2f8458d6af1 | [] | no_license | Edgar1121830/ServicesUsta | 5679c0d03fc3b5bbe42e9fd0b36d8fe4a6925725 | 413d3a695b20d333b9fbb90206b2a86538aec5de | refs/heads/master | 2020-04-04T12:25:26.344690 | 2018-11-02T22:00:58 | 2018-11-02T22:00:58 | 155,925,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 886 | java | package co.com.servicios.modelo;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the competencias database table.
*
*/
@Entity
@Table(name="competencias")
@NamedQuery(name="Competencia.findAll", query="SELECT c FROM Competencia c")
public class Competencia implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int codcompetencia;
private String nombrecompetencia;
public Competencia() {
}
public int getCodcompetencia() {
return this.codcompetencia;
}
public void setCodcompetencia(int codcompetencia) {
this.codcompetencia = codcompetencia;
}
public String getNombrecompetencia() {
return this.nombrecompetencia;
}
public void setNombrecompetencia(String nombrecompetencia) {
this.nombrecompetencia = nombrecompetencia;
}
} | [
"edgarmedinauptc@gmail.com"
] | edgarmedinauptc@gmail.com |
fb397f99077186cc325aec28a89b87673fe95c29 | 63f0a2e2c918db544cb58da2636f370bd80a36fe | /JavaPractice/src/org/dimigo/oop/Car2.java | 4ed6b88d2eb26bd3ebbec12782abd17a185d32f3 | [] | no_license | hd132521/old | f412d3fa717c371e820cf4eaf7a87b6b8470637b | df26870f3da914187a6bd563039aa2a24cdf573a | refs/heads/master | 2022-10-12T11:38:10.307957 | 2015-11-10T01:53:41 | 2015-11-10T01:53:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | /**
*
*/
package org.dimigo.oop;
/**
*<pre>
*org.dimigo.oop
* |_Car
*1. 개요:
*2. 작성일: 2015. 4. 13.
*</pre>
* @author : 박유택
* @version : 1.0
*/
public class Car2 {
private String company;
private String model;
private String color;
private int maxSpeed;
private int price;
public Car2() {}
public Car2(String company, String model, String color, int maxSpeed, int price)
{
this.company = company;
this.model = model;
this.color = color;
this.maxSpeed = maxSpeed;
this.price = price;
}
public String getCompany(){
return company;
}
public String getModel(){
return model;
}
public String getColor(){
return color;
}
public int getPrice(){
return price;
}
public int getMaxSpeed(){
return maxSpeed;
}
/*public void setCompany(String Company){
company = Company;
}
public void setModel(String Model){
model = Model;
}
public void setColor(String Color){
color = Color;
}
public void setPrice(int Price){
price = Price;
}
public void setMaxSpeed(int MaxSpeed){
maxSpeed = MaxSpeed;
}*/
}
| [
"parkyutack12@naver.com"
] | parkyutack12@naver.com |
a6e4044d3635d18ca254619d3bf52dd6aa171b61 | b62728ad1e88efe8ee2dc281153c74066aabff91 | /Internship/src/StringLvl1/lexico13.java | 1fd8de8866e7295abd7b3be58225b69d2709e7bc | [] | no_license | anubhavv13/Internship | a0730a9488f27d1bb5d256b46da50710d94cdb6d | b561eb8bfc4bd5ddf4fa21d739e318579d2d2ac2 | refs/heads/master | 2022-09-26T15:49:19.959584 | 2020-05-31T20:26:40 | 2020-05-31T20:26:40 | 267,621,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package StringLvl1;
import java.util.Scanner;
class lexico13 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s1,s2;
int r;
System.out.println("Enter First String");
s1 = sc.nextLine();
System.out.println("Enter Second String");
s2 = sc.nextLine();
r = s1.compareToIgnoreCase(s2);
if(r == 0)
System.out.println("Same String ");
else if(r>0)
System.out.println(s1 + " ...Comes later");
else
System.out.println(s2 + " ...Comes");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5f076d7ec865b2c52f1165247bbc669a46b5c54a | 5bc6db48a29cb942004fd708a8c5c15ffb19b49e | /ChessGame/src/chess/game/ChessPieceClass.java | 480917845f5f5f02d1ae22053e38a3b19d4dd7bc | [] | no_license | joelmaxw311/chessGame | cc351a0e326d1d00be4a286ea3613f6b546b0315 | 25b2e1bc6621bbbdd436130e1b5b918fee1d93e3 | refs/heads/master | 2023-01-12T01:28:09.380880 | 2020-11-21T02:41:17 | 2020-11-21T02:41:17 | 314,717,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | 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 chess.game;
/**
* The class of a chess piece, which defines the piece's movement pattern an role in the game.
* @author joelm
*/
public enum ChessPieceClass {
PAWN, ROOK, BISHOP, KNIGHT, KING, QUEEN, UNMOVED_PAWN("pawn"), EMPTY(null), OUT_OF_BOUNDS(null);
/** the name of the image file for this piece type */
public final String filename;
ChessPieceClass() {
filename = name().toLowerCase();
}
ChessPieceClass(String name) {
filename = name;
}
@Override
public String toString() {
return filename.toUpperCase();
}
public boolean isKing() {
return this == KING;
}
}
| [
"joelmaxw311@gmail.com"
] | joelmaxw311@gmail.com |
8d4eb434de48cec64a003e7df2a90660ceb072b6 | c5ae302804ee4196c2bdb0b32adf5bd93107b31a | /src/main/java/my/examples/trees/CheckParanthesis.java | a218fd3af60d417cc892840a0eb68831657df29e | [
"Apache-2.0"
] | permissive | kamalcph/data-structures | 2c495d4a1751e89fe9c22d345b059dafe9f3f663 | 473bb2d081455f4bee545ba95d7a9ebdaaf2a1ce | refs/heads/master | 2022-03-30T16:05:23.990151 | 2020-03-21T05:28:40 | 2020-03-21T05:28:40 | 97,203,362 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,080 | java | package my.examples.trees;
public class CheckParanthesis {
Stack stack = new Stack(100);
class Stack {
int top = -1;
char[] items;
int maxElements;
public Stack(int size) {
items = new char[size];
maxElements = size - 1;
}
public void push(char c) {
if (top == maxElements) {
System.out.println("Stack is full");
// throw Full exception
} else {
items[++top] = c;
}
}
public char pop() {
if (top == -1) {
System.out.println("UnderFlow error");
return '\0';
}
char element = items[top];
top--;
return element;
}
public boolean isEmpty() {
return top == -1;
}
}
public boolean isMatchingChar(char c1, char c2) {
if (c1 == '{' && c2 == '}')
return true;
else if (c1 == '[' && c2 == ']')
return true;
else if (c1 == '(' && c2 == ')')
return true;
else
return false;
}
public boolean checkForParans(char[] c) {
for (int i=0; i<c.length; i++) {
if (c[i] == '{' || c[i] == '[' || c[i] == '(')
stack.push(c[i]);
else if (c[i] == '}' || c[i] == ']' || c[i] == ')') {
final boolean isMatch = isMatchingChar(stack.pop(), c[i]);
if (!isMatch)
return false;
} else {
// skip
}
}
return stack.isEmpty();
}
public static void main(String[] args) {
char exp[] = {'{','(',')','}','[',']'};
CheckParanthesis cp = new CheckParanthesis();
if (cp.checkForParans(exp))
System.out.println("Balanced ");
else
System.out.println("Not Balanced ");
System.out.println(118 % 16);
System.out.println(118 & 15);
System.out.println(1 << 4);
}
}
| [
"kamal@nmsworks.co.in"
] | kamal@nmsworks.co.in |
2c6ad8b993695afe0ba0518c664ec8e3fb1e8709 | dec16c3402103848b17884784bb702ba6e8c4d49 | /lib-unlimited/src/main/java/fr/tduf/libunlimited/low/files/gfx/materials/domain/Material.java | 52db7bbbfb867df33d2dece8ec7eb62878567cf6 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | djey47/tduf | 0ba6f419adb4884b4919bb416f4945a0a31a737a | f80b01251d60b34e8ef4c43f51492827a9e8b491 | refs/heads/master | 2021-06-08T21:49:33.276593 | 2021-04-12T13:18:33 | 2021-04-12T13:18:33 | 136,150,640 | 6 | 0 | NOASSERTION | 2020-10-25T13:23:57 | 2018-06-05T09:07:36 | Java | UTF-8 | Java | false | false | 1,351 | java | package fr.tduf.libunlimited.low.files.gfx.materials.domain;
/**
* Represents a material with its settings and layer parameters
*/
public class Material {
protected String name;
protected MaterialSettings properties;
protected LayerGroup layerGroup;
private Material() {}
public static MaterialBuilder builder() {
return new MaterialBuilder();
}
public String getName() {
return name;
}
public MaterialSettings getProperties() {
return properties;
}
public LayerGroup getLayerGroup() {
return layerGroup;
}
public static class MaterialBuilder extends Material {
public MaterialBuilder withName(String name) {
this.name = name;
return this;
}
public MaterialBuilder withGlobalSettings(MaterialSettings materialSettings) {
this.properties = materialSettings;
return this;
}
public MaterialBuilder withLayerGroup(LayerGroup layerGroup) {
this.layerGroup = layerGroup;
return this;
}
public Material build() {
Material material = new Material();
material.name = name;
material.properties = properties;
material.layerGroup = layerGroup;
return material;
}
}
}
| [
"djey47@github.com"
] | djey47@github.com |
cefecb67ac08553ad5cb94fbc92162db380454ee | 1fc4739f0ec511e90d88b6948c8f195681a939ac | /app/src/main/java/com/narcoding/actingaptitudetesting/emotion/contract/Order.java | d0561bd77c267ea4131daff9faf43625d698e109 | [] | no_license | narcoding/ActingTest | fa6eeb2180f4b6ab891595e7ee2aee6b99ba64b7 | 5f94c6575e144abdac1a1192d15c46504ab3fc4e | refs/heads/master | 2021-05-23T05:21:34.703371 | 2020-07-20T06:36:13 | 2020-07-20T06:36:13 | 95,137,087 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Cognitive Services (formerly Project Oxford): https://www.microsoft.com/cognitive-services
//
// Microsoft Cognitive Services (formerly Project Oxford) GitHub:
// https://github.com/Microsoft/Cognitive-Emotion-Android
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// 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 com.narcoding.actingaptitudetesting.emotion.contract;
public enum Order {
ASCENDING,
DESCENDING
}
| [
"naimyag@gmail.com"
] | naimyag@gmail.com |
79cd54b838e3a1ee697c85b6a7f0ef66d24cd368 | 3900c7b96dfe4bdcf47f2e06fb743d4ea75ce733 | /Farmstory2/src/kr/farmstory2/vo/MemberVO.java | d410a2a3709d5de76a1b727c2cace29fe305d794 | [] | no_license | neogeolee/Jsp | 2d3a203f1900b372d2ea821eac9a84b4fbcc3307 | 500f0f81e4090baff8f98ea1e790c0fecb7d6bcb | refs/heads/master | 2023-01-02T13:50:11.856497 | 2020-10-27T07:01:54 | 2020-10-27T07:01:54 | 268,417,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package kr.farmstory2.vo;
public class MemberVO {
private String uid;
private String pass;
private String name;
private String nick;
private String email;
private String hp;
private int grade;
private String zip;
private String addr1;
private String addr2;
private String regip;
private String rdate;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getHp() {
return hp;
}
public void setHp(String hp) {
this.hp = hp;
}
public int getGrade() {
return grade;
}
public void setGrade(int grade) {
this.grade = grade;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getAddr1() {
return addr1;
}
public void setAddr1(String addr1) {
this.addr1 = addr1;
}
public String getAddr2() {
return addr2;
}
public void setAddr2(String addr2) {
this.addr2 = addr2;
}
public String getRegip() {
return regip;
}
public void setRegip(String regip) {
this.regip = regip;
}
public String getRdate() {
return rdate;
}
public void setRdate(String rdate) {
this.rdate = rdate;
}
} | [
"dlxognsdl1!"
] | dlxognsdl1! |
6fc9c6364a9d7219681aac0b40500202ecc1b968 | fa548a483cac31014118432aa5d735470d18f2a1 | /src/main/java/com/ssm/crud/controller/PageController.java | 79fa12510406ada79859ad4e916ad1d3f795a20c | [] | no_license | xub1997/ssm-crud | 7b49e5559d2e446e91cda4761aac527648ad78ec | 693f584eb6e7fa0aba7608ec25306a5a4f252562 | refs/heads/master | 2022-12-25T00:52:17.604408 | 2020-02-15T07:54:28 | 2020-02-15T07:54:28 | 146,070,143 | 0 | 0 | null | 2022-12-16T11:16:22 | 2018-08-25T06:09:01 | JavaScript | UTF-8 | Java | false | false | 1,269 | java | package com.ssm.crud.controller;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class PageController {
private static Logger logger =Logger.getLogger(PageController.class);
@RequestMapping("/login.html")
public String login() {
return "login";
}
@RequestMapping("/articleManage.html")
public String articleManage() {
return "articleManage";
}
@RequestMapping("/categoryManage.html")
public String categoryManage() {
return "categoryManage";
}
@RequestMapping("/commentManage.html")
public String commentManage() {
return "commentManage";
}
@RequestMapping("/index.html")
public String index() {
return "index";
}
@RequestMapping("/messageManage.html")
public String messageManage() {
return "messageManage";
}
@RequestMapping("/timeLineManage.html")
public String timeLineManage() {
return "timeLineManage";
}
@RequestMapping("/userManage.html")
public String userManage() {
return "userManage";
}
@RequestMapping("/addArticle.html")
public String addArticle() {
return "addArticle";
}
@RequestMapping("/editArticle.html")
public String editArticle() {
return "editArticle";
}
}
| [
"42289281+xub1997@users.noreply.github.com"
] | 42289281+xub1997@users.noreply.github.com |
316e86ffc36ebd37fe31d94626af8038b80dc92c | 1a35f4e106777a509ac0f875b9f72c17b93880cf | /week-18/day-02/Library/src/test/java/com/greenfoxacademy/libraryapp/LibraryappApplicationTests.java | 3b40205c86a17be2e9400c0a6735bd843917c86f | [] | no_license | green-fox-academy/Erykahh1982 | e2de8949bdb55df4782b39c478863381f0e4d99d | d54183009526521e1b7de31a8518c669b3fb8d57 | refs/heads/master | 2020-04-01T17:15:35.795925 | 2019-05-07T12:52:10 | 2019-05-07T12:52:10 | 153,420,597 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.greenfoxacademy.libraryapp;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class LibraryappApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"posta.erika.mail@gmail.com"
] | posta.erika.mail@gmail.com |
1b4c780b54fc60832718ac5100c9ea9ea6c61eac | b3b2f91722db60b86c5f3372215ad609fe103aa0 | /src/main/java/com/krishnan/DefaultTemplateContainer.java | 1a2923983cb82ad5053bc5fc8d5e55c888dab9e5 | [] | no_license | Krishnanudhaya/Drools | e9fa7335ee34bc938e91f7a73b160208faab891e | 5124f4701583b11a66a297a232c07e646db093a8 | refs/heads/master | 2022-06-23T16:01:57.442616 | 2019-11-25T02:33:17 | 2019-11-25T02:33:17 | 223,846,031 | 0 | 1 | null | 2022-06-17T22:20:24 | 2019-11-25T02:27:58 | Java | UTF-8 | Java | false | false | 7,235 | java | package com.krishnan;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.drools.core.util.IoUtils;
/**
* Container for a set of templates (residing in one file). This class will
* parse the template file.
*/
public class DefaultTemplateContainer implements TemplateContainer {
private String header;
private Map<String, Column> columnMap = new HashMap<String, Column>();
private List<Column> columns = new ArrayList<Column>();
private Map<String, RuleTemplate> templates = new HashMap<String, RuleTemplate>();
private boolean replaceOptionals;
public DefaultTemplateContainer(final String template) {
this(DefaultTemplateContainer.class.getResourceAsStream(template), true);
}
public DefaultTemplateContainer(final InputStream templateStream) {
this(templateStream, true);
}
public DefaultTemplateContainer(final String template, boolean replaceOptionals) {
this(DefaultTemplateContainer.class.getResourceAsStream(template), replaceOptionals);
}
public DefaultTemplateContainer(final InputStream templateStream, boolean replaceOptionals) {
this.replaceOptionals = replaceOptionals;
parseTemplate(templateStream);
validateTemplate();
}
private void validateTemplate() {
if (columns.size() == 0) {
throw new DecisionTableParseException("Missing header columns");
}
if (templates.size() == 0) {
throw new DecisionTableParseException("Missing templates");
}
}
private void parseTemplate(final InputStream templateStream) {
try {
final ColumnFactory cf = new ColumnFactory();
final BufferedReader templateReader = new BufferedReader(
new InputStreamReader(templateStream, IoUtils.UTF8_CHARSET));
String line;
boolean inTemplate = false;
boolean inHeader = false;
boolean inContents = false;
boolean inMultiLineComment = false;
RuleTemplate template = null;
StringBuilder header = new StringBuilder();
StringBuilder contents = new StringBuilder();
while ((line = templateReader.readLine()) != null) {
if (inMultiLineComment) {
int commentEnd = line.indexOf( "*/" );
if (commentEnd >= 0) {
line = line.substring( commentEnd+2 );
inMultiLineComment = false;
} else {
line = "";
}
} else {
int commentStart = line.indexOf( "/*" );
if (commentStart >= 0) {
int commentEnd = line.indexOf( "*/" );
if (commentEnd > commentStart) {
line = line.substring( 0, commentStart ) + line.substring( commentEnd+2 );
} else {
line = line.substring( 0, commentStart );
inMultiLineComment = true;
}
}
}
String trimmed = line.trim();
if (trimmed.length() > 0) {
if (trimmed.startsWith("template header")) {
inHeader = true;
} else if (trimmed.startsWith("template ")) {
inTemplate = true;
inHeader = false;
String quotedName = trimmed.substring(8).trim();
quotedName = quotedName.substring(1, quotedName.length() - 1);
template = new RuleTemplate(quotedName, this, replaceOptionals );
addTemplate(template);
} else if (trimmed.startsWith("package ")) {
if ( !inHeader ) {
throw new DecisionTableParseException(
"Missing header");
}
inHeader = false;
header.append(line).append("\n");
} else if (trimmed.startsWith("import ")) {
inHeader = false;
header.append(line).append("\n");
} else if (inHeader) {
addColumn(cf.getColumn(trimmed));
} else if (!inTemplate) {
header.append(line).append("\n");
} else if (!inContents && trimmed.startsWith("rule ")) {
inContents = true;
contents.append(line).append("\n");
} else if (trimmed.equals("end template")) {
template.setContents(contents.toString());
contents.setLength(0);
inTemplate = false;
inContents = false;
} else if (inContents) {
contents.append(removeSingleLineComment(line)).append( "\n");
} else {
template.addColumn(trimmed);
}
}
}
if (inTemplate) {
throw new DecisionTableParseException("Missing end template");
}
this.header = header.toString();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (templateStream != null) { closeStream(templateStream); }
}
}
private String removeSingleLineComment(String line) {
int commentStart = line.indexOf( "//" );
return commentStart < 0 ? line : line.substring( 0, commentStart );
}
private void addTemplate(RuleTemplate template) {
templates.put(template.getName(), template);
}
/*
* (non-Javadoc)
*
* @see org.kie.decisiontable.parser.TemplateContainer#getTemplates()
*/
public Map<String, RuleTemplate> getTemplates() {
return templates;
}
private void addColumn(Column c) {
columns.add(c);
columnMap.put(c.getName(), c);
}
/*
* (non-Javadoc)
*
* @see org.kie.decisiontable.parser.TemplateContainer#getColumns()
*/
public Column[] getColumns() {
return columns.toArray(new Column[columns.size()]);
}
/*
* (non-Javadoc)
*
* @see org.kie.decisiontable.parser.TemplateContainer#getHeader()
*/
public String getHeader() {
return header;
}
private void closeStream(final InputStream stream) {
try {
stream.close();
} catch (final Exception e) {
System.err.print("WARNING: Wasn't able to "
+ "correctly close stream for decision table. "
+ e.getMessage());
}
}
public Column getColumn(final String name) {
return columnMap.get(name);
}
}
| [
"krishnakirit468@gmail.com"
] | krishnakirit468@gmail.com |
fbe078db2481f3535817abc06347dd813b23a94d | 124dbd0df5939d590dc4597fe906b644e6ee9532 | /app/src/main/java/com/instagram_parser/Entity/Images.java | 1cd77f3f37aaf434b14ec2383cf90e143f6ab49e | [] | no_license | gncaliskan/parser | 326858390c4372178798a20c3bac5899a7bbf7f1 | e5f221308924b70d2cf35687a39ec5836ab71e03 | refs/heads/master | 2022-01-23T04:52:11.010630 | 2019-07-31T13:43:17 | 2019-07-31T13:43:17 | 198,201,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.instagram_parser.Entity;
public class Images
{
private Thumbnail thumbnail;
public void setThumbnail(Thumbnail thumbnail){
this.thumbnail = thumbnail;
}
public Thumbnail getThumbnail(){
return this.thumbnail;
}
} | [
"gamzeezmag@users.noreply.github.com"
] | gamzeezmag@users.noreply.github.com |
d6008372502066880e57246f42707d0b2a46d490 | ef25402a233fe78e114afdbe7bed46c8fed41c5d | /Levelup/snq/self/dynamicStack.java | 66d3f2714e4e1a6b979ad91d03f1d95f30e13a63 | [] | no_license | manojmalik35/Code | 966ae31351067a24713538a1fcbb659f57271eee | 59a60f528aa83e1a0359041c46ed26b3af85ba3e | refs/heads/master | 2023-01-13T03:12:43.795871 | 2020-11-09T07:15:19 | 2020-11-09T07:15:19 | 281,858,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | public class dynamicStack<T> extends stack<T>{
public dynamicStack(){
super();
}
public dynamicStack(int size){
super(size);
}
public dynamicStack(Object[] arr){
super(arr.length * 2);
for(int i = 0; i < arr.length; i++)
push((T)arr[i]);
}
@Override
public void push(T val){
if(super.size() == super.maxSize()){
Object[] temp = new Object[super.size()];
for(int i = temp.length - 1; i >= 0; i--){
temp[i] = top_();
pop_();
}
resize(2 * temp.length);
for(int i = 0; i < temp.length; i++)
push_((T)temp[i]);
}
push_(val);// super.push(val);
}
} | [
"malik.manoj35@gmail.com"
] | malik.manoj35@gmail.com |
8a6c85c75e0c26df2057279532515ac19626d209 | 302eb4e411a6168db9cb32ba724d5208c5b7364c | /src/main/java/org/freelesson/springsecurityjdbc/config/security/AuthTokenStore.java | 9b24b373efc7075a9c905318eb2db04dd239b670 | [] | no_license | muraguri2005/spring-security-jdbc | c2e0c918a724e7fc2de1348e8e1f2a2cd4071ff0 | 904076c11317e892e0d2ff0d9a91ddcbcc21b440 | refs/heads/master | 2021-09-08T03:42:04.453767 | 2020-05-01T16:33:10 | 2020-05-01T16:33:10 | 198,443,844 | 0 | 0 | null | 2021-08-25T11:49:49 | 2019-07-23T14:08:57 | Java | UTF-8 | Java | false | false | 1,050 | java | package org.freelesson.springsecurityjdbc.config.security;
import javax.sql.DataSource;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
public class AuthTokenStore extends JdbcTokenStore {
public AuthTokenStore(DataSource dataSource) {
super(dataSource);
}
@Override
public OAuth2AccessToken readAccessToken(String tokenValue) {
OAuth2AccessToken accessToken = null;
try {
accessToken = new DefaultOAuth2AccessToken(tokenValue);
}
catch (EmptyResultDataAccessException e) {
System.err.println("Failed to find access token for token "+tokenValue);
}
catch (IllegalArgumentException e) {
System.err.println("Failed to deserialize access token for " +tokenValue+" : "+e);
removeAccessToken(tokenValue);
}
return accessToken;
}
}
| [
"richard@tulaa.io"
] | richard@tulaa.io |
55dcafd4a45c0dd87870ca5f1f1f2dcc0b020192 | 9a80d54055681ba8102a71a7d544c391c8fe31d9 | /src/main/java/com/cjl/crud/service/EmployeeService.java | d1f3c6a1d08583774547ba082fb6a76548d33ea9 | [] | no_license | DramaChen/SSMPro | a1a0976099c66db39957d9e9ff9d4b2a23846abd | 6fd31e6a86f9fda2ea71d5225dce8d0516c1e931 | refs/heads/master | 2020-03-27T09:51:04.052693 | 2018-08-28T02:17:28 | 2018-08-28T02:17:28 | 146,377,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package com.cjl.crud.service;
import com.cjl.crud.bean.Employee;
import java.util.List;
/**
* @author ChenJunLin
* @Date 2018/8/24-20:57
*/
public interface EmployeeService {
public List<Employee> getAllEmployee();
public void saveEmp(Employee employee);
public boolean checkUser(String name);
public Employee getEmp(Integer id);
public void updateEmp(Employee employee);
public void deleteEmp(Integer id);
public void deleteBatch(List<Integer> ids);
}
| [
"291920822@qq.com"
] | 291920822@qq.com |
562218bf39bc1120b019a954a0998aa63df39042 | c386eecbe7eebca4552cde05a72138a194e619b3 | /com/example/SpringCore/test/AppConfig.java | 48f4c5cf6e6bfad55e856319b203119f3699f60b | [] | no_license | nammavar-guru/java | 34184f3b718637b32b289a2856fef7fbdd192b3a | 7bf0784decc22b42580cb62f4bbedd002fc5d067 | refs/heads/master | 2020-08-31T12:44:58.756400 | 2020-02-25T14:35:11 | 2020-02-25T14:35:11 | 218,694,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | package com.example.SpringCore.test;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages="com.example.SpringCore.test")
public class AppConfig {
}
| [
"noreply@github.com"
] | noreply@github.com |
0433bf1902932494fcc0d74b4b48883f8e50c902 | 5f82aae041ab05a5e6c3d9ddd8319506191ab055 | /Projects/JxPath/12/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java | f9785f6484fdfcd937fc9a0bf4adbd17927641bd | [
"Apache-2.0"
] | permissive | lingming/prapr_data | e9ddabdf971451d46f1ef2cdbee15ce342a6f9dc | be9ababc95df45fd66574c6af01122ed9df3db5d | refs/heads/master | 2023-08-14T20:36:23.459190 | 2021-10-17T13:49:39 | 2021-10-17T13:49:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,294 | 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.commons.jxpath.ri.model.dom;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.jxpath.ri.NamespaceResolver;
import org.apache.commons.jxpath.ri.QName;
import org.apache.commons.jxpath.ri.model.NodeIterator;
import org.apache.commons.jxpath.ri.model.NodePointer;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
/**
* An iterator of attributes of a DOM Node.
*
* @author Dmitri Plotnikov
* @version $Revision$ $Date$
*/
public class DOMAttributeIterator implements NodeIterator {
private NodePointer parent;
private QName name;
private List attributes;
private int position = 0;
public DOMAttributeIterator(NodePointer parent, QName name) {
this.parent = parent;
this.name = name;
attributes = new ArrayList();
Node node = (Node) parent.getNode();
if (node.getNodeType() == Node.ELEMENT_NODE) {
String lname = name.getName();
if (!lname.equals("*")) {
Attr attr = getAttribute((Element) node, name);
if (attr != null) {
attributes.add(attr);
}
}
else {
NamedNodeMap map = node.getAttributes();
int count = map.getLength();
for (int i = 0; i < count; i++) {
Attr attr = (Attr) map.item(i);
if (testAttr(attr, name)) {
attributes.add(attr);
}
}
}
}
}
private boolean testAttr(Attr attr, QName testName) {
String nodePrefix = DOMNodePointer.getPrefix(attr);
String nodeLocalName = DOMNodePointer.getLocalName(attr);
if (nodePrefix != null && nodePrefix.equals("xmlns")) {
return false;
}
if (nodePrefix == null && nodeLocalName.equals("xmlns")) {
return false;
}
String testLocalName = name.getName();
if (testLocalName.equals("*") || testLocalName.equals(nodeLocalName)) {
String testPrefix = testName.getPrefix();
if (equalStrings(testPrefix, nodePrefix)) {
return true;
}
String testNS = null;
if (testPrefix != null) {
testNS = parent.getNamespaceURI(testPrefix);
}
String nodeNS = null;
if (nodePrefix != null) {
nodeNS = parent.getNamespaceURI(nodePrefix);
}
return equalStrings(testNS, nodeNS);
}
return false;
}
private static boolean equalStrings(String s1, String s2) {
return s1 == s2 || s1 != null && s1.equals(s2);
}
private Attr getAttribute(Element element, QName name) {
String testPrefix = name.getPrefix();
String testNS = null;
if (testPrefix != null) {
NamespaceResolver nsr = parent.getNamespaceResolver();
testNS = nsr == null ? null : nsr.getNamespaceURI(testPrefix);
testNS = testNS == null ? parent.getNamespaceURI(testPrefix) : testNS;
}
if (testNS != null) {
Attr attr = element.getAttributeNodeNS(testNS, name.getName());
if (attr != null) {
return attr;
}
// This may mean that the parser does not support NS for
// attributes, example - the version of Crimson bundled
// with JDK 1.4.0
NamedNodeMap nnm = element.getAttributes();
for (int i = 0; i < nnm.getLength(); i++) {
attr = (Attr) nnm.item(i);
if (testAttr(attr, name)) {
return attr;
}
}
return null;
}
return element.getAttributeNode(name.getName());
}
public NodePointer getNodePointer() {
if (position == 0) {
if (!setPosition(1)) {
return null;
}
position = 0;
}
int index = position - 1;
if (index < 0) {
index = 0;
}
return new DOMAttributePointer(parent, (Attr) attributes.get(index));
}
public int getPosition() {
return position;
}
public boolean setPosition(int position) {
this.position = position;
return position >= 1 && position <= attributes.size();
}
} | [
"2890268106@qq.com"
] | 2890268106@qq.com |
a6d29b5f2c2ca9c9849d45f459c0ba3d1946cd27 | 230bcb399293a3d8255fab5249832553af453f62 | /ParserMC3/src/main/java/com/example/ParserMC3/dao/DescriptionDAOinterface.java | 2f6b484e8e4fce3b958d1adb11add93691cf67e2 | [] | no_license | KostyaKrivonos/parser | b0ac6376d26f25a179197a78b62e42723820cc3f | 3a98a6990f65b14fd2b48418d40a26e6eebe7dcd | refs/heads/master | 2020-03-30T10:04:02.957868 | 2018-10-01T14:53:37 | 2018-10-01T14:53:37 | 151,104,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package com.example.ParserMC3.dao;
public interface DescriptionDAOinterface <E, K>{
void add(E entity);
void delete(E entity);
E getById(K key);
E getByIdVacancy(K key);
void updateStatus(E entity);
}
| [
"krivonos92@ukr.net"
] | krivonos92@ukr.net |
57d4a0410535bde219008d1999fd3ed8247f8001 | d8759216411241a72c669012661b092deb0b0ffc | /sources/com/shaded/fasterxml/jackson/databind/node/ShortNode.java | d4a23f466926069eef60d32492d18518339df8ca | [] | no_license | indraja95/SmartParkingSystem | eba63c2d6d8f36860edbd4d1f09f37749d2302df | dc5c868a1d74794108a16d69cea606845f96080d | refs/heads/master | 2023-04-01T18:58:15.337029 | 2021-04-02T22:48:53 | 2021-04-02T22:48:53 | 313,754,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,596 | java | package com.shaded.fasterxml.jackson.databind.node;
import com.shaded.fasterxml.jackson.core.JsonGenerator;
import com.shaded.fasterxml.jackson.core.JsonParser.NumberType;
import com.shaded.fasterxml.jackson.core.JsonProcessingException;
import com.shaded.fasterxml.jackson.core.JsonToken;
import com.shaded.fasterxml.jackson.core.io.NumberOutput;
import com.shaded.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
public final class ShortNode extends NumericNode {
final short _value;
public ShortNode(short s) {
this._value = s;
}
public static ShortNode valueOf(short s) {
return new ShortNode(s);
}
public JsonToken asToken() {
return JsonToken.VALUE_NUMBER_INT;
}
public NumberType numberType() {
return NumberType.INT;
}
public boolean isIntegralNumber() {
return true;
}
public boolean isShort() {
return true;
}
public boolean canConvertToInt() {
return true;
}
public boolean canConvertToLong() {
return true;
}
public Number numberValue() {
return Short.valueOf(this._value);
}
public short shortValue() {
return this._value;
}
public int intValue() {
return this._value;
}
public long longValue() {
return (long) this._value;
}
public float floatValue() {
return (float) this._value;
}
public double doubleValue() {
return (double) this._value;
}
public BigDecimal decimalValue() {
return BigDecimal.valueOf((long) this._value);
}
public BigInteger bigIntegerValue() {
return BigInteger.valueOf((long) this._value);
}
public String asText() {
return NumberOutput.toString((int) this._value);
}
public boolean asBoolean(boolean z) {
return this._value != 0;
}
public final void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
jsonGenerator.writeNumber(this._value);
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (obj.getClass() != getClass()) {
return false;
}
if (((ShortNode) obj)._value != this._value) {
return false;
}
return true;
}
public int hashCode() {
return this._value;
}
}
| [
"indraja.nutalapati@gmail.com"
] | indraja.nutalapati@gmail.com |
67aa84988127a662341dd78d429cbfe02c2f7a7b | 9728bc63cf5c4c3e3e43b17d3a5fafa0011401c5 | /app/src/main/java/com/sdxxtop/guardianapp/model/http/util/NetUtil.java | 2ed1be42a3e61a767be8d360cea7b54eacf0cf0b | [] | no_license | Preterit/GuardianApp_litying | 11046280a5a51d1286c0fada7bf50fbf5c887cd4 | bbc708e1f3f4bc1c488e80c784a300ea4ec0913e | refs/heads/master | 2022-02-24T21:30:37.742419 | 2019-07-19T14:23:23 | 2019-07-19T14:23:23 | 197,173,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,566 | java | package com.sdxxtop.guardianapp.model.http.util;
import android.text.TextUtils;
import android.util.Base64;
import com.orhanobut.logger.Logger;
import com.sdxxtop.guardianapp.BuildConfig;
import com.sdxxtop.guardianapp.model.http.net.HttpConstantValue;
import org.apache.http.conn.ConnectTimeoutException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Locale;
import java.util.Map;
/**
* 1. map ({(a,1),(b,2),(c,3)}) 转成字符串 str (a=1&b=2&c=3)
* 2. str = str + appkey
* 3. 计算str的md5
* 4. 将 md5存入map: map.put("sn", md5)
* 5. map 转成 json
* 6. 对json字符串进行base64加密
* <p>
* 公司进行的签名规则
*/
public class NetUtil {
private static String getBase64(String str) {
String result = "";
if (str != null) {
try {
result = new String(Base64.encode(str.getBytes("utf-8"), Base64.NO_WRAP), "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return result;
}
public static String getBase64Data(Map<String, String> map) {
if (map == null || map.size() == 0)
return "";
map.put("v", BuildConfig.VERSION_NAME.replaceAll("\\.", "0"));
map.put("ts", System.currentTimeMillis() + "");//把时间转成时间戳?
StringBuilder sb = new StringBuilder();
Object[] keyArr = map.keySet().toArray();
Arrays.sort(keyArr);
for (int i = 0; i < keyArr.length; i++) {
if (i != 0) {
sb.append(HttpConstantValue.STR_SPLICE_SYMBOL);
}
Object key = keyArr[i];
sb.append(key).append(HttpConstantValue.STR_EQUAL_OPERATION).append(map.get(key));
}
map.put("sn", NetUtil.md5(sb.toString() + HttpConstantValue.APP_KEY).toUpperCase());
for (String key : map.keySet()) {
Logger.e("key " + key + " value " + map.get(key));
}
JSONObject json = new JSONObject(map);
String jsonStr = json.toString();
return NetUtil.getBase64(jsonStr);
}
//MD5加密算法
private static String md5(String content) {
byte[] hash;
try {
hash = MessageDigest.getInstance("MD5").digest(content.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("NoSuchAlgorithmException", e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UnsupportedEncodingException", e);
}
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10) {
hex.append("0");
}
hex.append(Integer.toHexString(b & 0xFF));
}
return hex.toString();
}
public static String getHttpExceptionMsg(Throwable exception, String errorMsg) {
String defaultMsg = "未知错误";
if (exception != null) {
Logger.e("Request Exception:" + exception.getMessage());
if (exception instanceof UnknownHostException) {
defaultMsg = "您的网络可能有问题,请确认连接上有效网络后重试";
} else if (exception instanceof ConnectTimeoutException) {
defaultMsg = "连接超时,您的网络可能有问题,请确认连接上有效网络后重试";
} else if (exception instanceof SocketTimeoutException) {
defaultMsg = "请求超时,您的网络可能有问题,请确认连接上有效网络后重试";
} else {
defaultMsg = "未知的网络错误, 请重试";
}
} else {
if (!TextUtils.isEmpty(errorMsg)) {
Logger.e("Request Exception errorMsg: " + errorMsg);
String lowerMsg = errorMsg.toLowerCase(Locale.ENGLISH);
if (lowerMsg.contains("java")
|| lowerMsg.contains("exception")
|| lowerMsg.contains(".net")
|| lowerMsg.contains("java")) {
defaultMsg = "未知错误, 请重试";
} else {
defaultMsg = "未知错误, 请重试";
}
}
}
return defaultMsg;
}
}
| [
"18614005205@163.com"
] | 18614005205@163.com |
0d32e86e7a5de9222b5fd28e5330cc78ba850bc0 | 23d65cfe9a12378fdb6d79ade399cad89bc8c01f | /roteiros/R11-01-Rot-Arvore-Binaria-de-Busca-environment/src/test/java/adt/bst/StudentBSTTest.java | 270757cbe74701cc8b5d8d3cadc106e590422b1a | [] | no_license | GersonSales/LEDA | 5feaf6c41dd8416648d930f3b8c3d79e9c2bbf26 | faeeffeb117eefe861f52ce7cf85619f13e2ecbb | refs/heads/master | 2021-03-16T04:14:16.849769 | 2016-12-09T00:07:06 | 2016-12-09T00:07:06 | 60,433,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,107 | java | package adt.bst;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import adt.bt.BTNode;
public class StudentBSTTest {
private BSTImpl<Integer> tree;
private BTNode<Integer> NIL = new BTNode<Integer>();
private void fillTree() {
Integer[] array = { 6, 23, -34, 5, 9, 2, 0, 76, 12, 67, 232, -40 };
for (int i : array) {
tree.insert(i);
}
}
@Before
public void setUp() {
tree = new BSTImpl<>();
}
@Test
public void prePostOrdeTest() {
fillTree();// 6, 23, -34, 5, 9, 2, 0, 76, 12, 67, 232, -40
assertArrayEquals(
new Integer[] { 6, -34, -40, 5, 2, 0, 23, 9, 12, 76, 67, 232 },
tree.preOrder());
assertArrayEquals(
new Integer[] { -40, -34, 0, 2, 5, 6, 9, 12, 23, 67, 76, 232 },
tree.order());
assertArrayEquals(
new Integer[] { -40, 0, 2, 5, -34, 12, 9, 67, 232, 76, 23, 6 },
tree.postOrder());
tree.remove(6);
assertArrayEquals(
new Integer[] { 9, -34, -40, 5, 2, 0, 23, 12, 76, 67, 232 },
tree.preOrder());
assertArrayEquals(
new Integer[] { -40, -34, 0, 2, 5, 9, 12, 23, 67, 76, 232 },
tree.order());
assertArrayEquals(
new Integer[] { -40, 0, 2, 5, -34, 12, 67, 232, 76, 23, 9 },
tree.postOrder());
tree.remove(5);
tree.remove(23);
tree.remove(-34);
assertArrayEquals(new Integer[] { 9, 0, -40, 2, 67, 12, 76, 232 },
tree.preOrder());
assertArrayEquals(new Integer[] { -40, 0, 2, 9, 12, 67, 76, 232 },
tree.order());
assertArrayEquals(new Integer[] { -40, 2, 0, 12, 232, 76, 67, 9 },
tree.postOrder());
tree.remove(9);
tree.remove(67);
tree.remove(0);
assertArrayEquals(new Integer[] { 12, 2, -40, 76, 232 },
tree.preOrder());
assertArrayEquals(new Integer[] { -40, 2, 12, 76, 232 }, tree.order());
assertArrayEquals(new Integer[] { -40, 2, 232, 76, 12 },
tree.postOrder());
tree.remove(12);
tree.remove(76);
tree.remove(2);
assertArrayEquals(new Integer[] { 232, -40 }, tree.preOrder());
assertArrayEquals(new Integer[] { -40, 232 }, tree.order());
assertArrayEquals(new Integer[] { -40, 232 }, tree.postOrder());
tree.remove(-40);
assertArrayEquals(new Integer[] { 232 }, tree.preOrder());
assertArrayEquals(new Integer[] { 232 }, tree.order());
assertArrayEquals(new Integer[] { 232 }, tree.postOrder());
}
@Test
public void countingTest() {
tree.insert(50);
tree.insert(17);
tree.insert(9);
tree.insert(14);
tree.insert(12);
tree.insert(23);
tree.insert(19);
tree.insert(76);
tree.insert(54);
tree.insert(72);
tree.insert(67);
System.out.println(Arrays.toString(tree.preOrder()));
System.out.println(Arrays.toString(tree.order()));
System.out.println(Arrays.toString(tree.postOrder()));
fillTree();
System.out.println(tree.numberOfLeafs());
System.out.println(tree.numberOfGradeOne());
System.out.println(tree.numberOfGradeTwo());
}
@Test
public void testInit() {
assertTrue(tree.isEmpty());
assertEquals(0, tree.size());
assertEquals(-1, tree.height());
assertEquals(NIL, tree.getRoot());
assertArrayEquals(new Integer[] {}, tree.order());
assertArrayEquals(new Integer[] {}, tree.preOrder());
assertArrayEquals(new Integer[] {}, tree.postOrder());
assertEquals(NIL, tree.search(12));
assertEquals(NIL, tree.search(-23));
assertEquals(NIL, tree.search(0));
assertEquals(null, tree.minimum());
assertEquals(null, tree.maximum());
assertEquals(null, tree.successor(12));
assertEquals(null, tree.successor(-23));
assertEquals(null, tree.successor(0));
assertEquals(null, tree.predecessor(12));
assertEquals(null, tree.predecessor(-23));
assertEquals(null, tree.predecessor(0));
}
@Test
public void removeLeafsTest() {
fillTree();
assertEquals(4, tree.height());
tree.remove(0);
assertEquals(3, tree.height());
tree.remove(2);
tree.remove(12);
tree.remove(67);
tree.remove(232);
assertEquals(2, tree.height());
tree.remove(-40);
tree.remove(5);
tree.remove(9);
tree.remove(76);
assertEquals(1, tree.height());
tree.remove(-34);
tree.remove(23);
assertEquals(0, tree.height());
tree.remove(6);
assertEquals(-1, tree.height());
}
@Test
public void parentTest() {
fillTree();
assertEquals(null, tree.search(6).getParent());
assertEquals(new Integer(6), tree.search(-34).getParent().getData());
assertEquals(new Integer(-34), tree.search(-40).getParent().getData());
assertEquals(new Integer(-34), tree.search(5).getParent().getData());
assertEquals(new Integer(5), tree.search(2).getParent().getData());
assertEquals(new Integer(2), tree.search(0).getParent().getData());
assertEquals(new Integer(6), tree.search(23).getParent().getData());
assertEquals(new Integer(23), tree.search(9).getParent().getData());
assertEquals(new Integer(9), tree.search(12).getParent().getData());
assertEquals(new Integer(23), tree.search(76).getParent().getData());
assertEquals(new Integer(76), tree.search(67).getParent().getData());
assertEquals(new Integer(76), tree.search(232).getParent().getData());
assertEquals(new Integer(-34), tree.search(6).getLeft().getData());
assertEquals(new Integer(-40), tree.search(-34).getLeft().getData());
assertEquals(null, tree.search(-40).getLeft().getData());
assertEquals(new Integer(2), tree.search(5).getLeft().getData());
assertEquals(new Integer(0), tree.search(2).getLeft().getData());
assertEquals(null, tree.search(0).getLeft().getData());
assertEquals(new Integer(9), tree.search(23).getLeft().getData());
assertEquals(null, tree.search(9).getLeft().getData());
assertEquals(null, tree.search(12).getLeft().getData());
assertEquals(new Integer(67), tree.search(76).getLeft().getData());
assertEquals(null, tree.search(67).getLeft().getData());
assertEquals(null, tree.search(232).getLeft().getData());
assertEquals(null, tree.search(-40).getRight().getData());
assertEquals(new Integer(5), tree.search(-34).getRight().getData());
assertEquals(null, tree.search(5).getRight().getData());
assertEquals(null, tree.search(2).getRight().getData());
assertEquals(null, tree.search(0).getRight().getData());
assertEquals(new Integer(23), tree.search(6).getRight().getData());
assertEquals(new Integer(76), tree.search(23).getRight().getData());
assertEquals(new Integer(232), tree.search(76).getRight().getData());
assertEquals(null, tree.search(232).getRight().getData());
assertEquals(null, tree.search(67).getRight().getData());
assertEquals(new Integer(12), tree.search(9).getRight().getData());
assertEquals(null, tree.search(12).getRight().getData());
}
@Test
public void removedParentTest() {
fillTree();
assertEquals(12, tree.size());
tree.remove(76);
assertEquals(null, tree.search(76).getData());
assertEquals(new Integer(232), tree.search(23).getRight().getData());
assertEquals(new Integer(67), tree.search(232).getLeft().getData());
assertEquals(null, tree.search(232).getRight().getData());
assertEquals(new Integer(23), tree.search(232).getParent().getData());
assertEquals(11, tree.size());
tree.remove(232);
assertEquals(null, tree.search(232).getData());
assertEquals(new Integer(67), tree.search(23).getRight().getData());
assertEquals(null, tree.search(67).getLeft().getData());
assertEquals(null, tree.search(67).getRight().getData());
assertEquals(new Integer(23), tree.search(67).getParent().getData());
assertEquals(10, tree.size());
tree.remove(67);
assertEquals(null, tree.search(67).getData());
assertEquals(null, tree.search(23).getRight().getData());
assertEquals(9, tree.size());
tree.remove(9);
assertEquals(null, tree.search(9).getData());
assertEquals(new Integer(12), tree.search(23).getLeft().getData());
assertEquals(null, tree.search(12).getLeft().getData());
assertEquals(new Integer(23), tree.search(12).getParent().getData());
assertEquals(8, tree.size());
tree.remove(23);
assertEquals(null, tree.search(23).getData());
assertEquals(new Integer(12), tree.search(6).getRight().getData());
assertEquals(null, tree.search(12).getRight().getData());
assertEquals(null, tree.search(12).getLeft().getData());
assertEquals(new Integer(6), tree.search(12).getParent().getData());
assertEquals(7, tree.size());
tree.remove(-34);
assertEquals(null, tree.search(-34).getData());
assertEquals(new Integer(0), tree.search(6).getLeft().getData());
assertEquals(new Integer(5), tree.search(0).getRight().getData());
assertEquals(new Integer(-40), tree.search(0).getLeft().getData());
assertEquals(new Integer(6), tree.search(0).getParent().getData());
assertEquals(6, tree.size());
tree.remove(6);
assertEquals(null, tree.search(6).getData());
assertEquals(new Integer(12), tree.getRoot().getData());
assertEquals(null, tree.search(12).getRight().getData());
assertEquals(new Integer(0), tree.search(12).getLeft().getData());
assertEquals(new Integer(12), tree.search(0).getParent().getData());
assertEquals(5, tree.size());
tree.remove(0);
assertEquals(null, tree.search(0).getData());
assertEquals(new Integer(12), tree.getRoot().getData());
assertEquals(new Integer(2), tree.getRoot().getLeft().getData());
assertEquals(new Integer(12), tree.search(2).getParent().getData());
assertEquals(new Integer(-40), tree.search(2).getLeft().getData());
assertEquals(new Integer(5), tree.search(2).getRight().getData());
assertEquals(new Integer(2), tree.search(-40).getParent().getData());
assertEquals(new Integer(2), tree.search(5).getParent().getData());
assertEquals(4, tree.size());
tree.remove(12);
assertEquals(null, tree.search(12).getData());
assertEquals(new Integer(2), tree.getRoot().getData());
assertEquals(new Integer(-40), tree.search(2).getLeft().getData());
assertEquals(new Integer(5), tree.search(2).getRight().getData());
assertEquals(new Integer(2), tree.search(-40).getParent().getData());
assertEquals(new Integer(2), tree.search(5).getParent().getData());
assertEquals(3, tree.size());
tree.remove(tree.getRoot().getData());
assertEquals(null, tree.search(2).getData());
assertEquals(new Integer(5), tree.getRoot().getData());
assertEquals(new Integer(-40), tree.search(5).getLeft().getData());
assertEquals(null, tree.search(5).getRight().getData());
assertEquals(new Integer(5), tree.search(-40).getParent().getData());
assertEquals(2, tree.size());
tree.remove(tree.getRoot().getData());
assertEquals(null, tree.search(5).getData());
assertEquals(new Integer(-40), tree.getRoot().getData());
assertEquals(null, tree.search(-40).getLeft().getData());
assertEquals(null, tree.search(-40).getRight().getData());
assertEquals(null, tree.search(-40).getParent());
assertEquals(1, tree.size());
tree.remove(-40);
assertEquals(null, tree.search(-40).getData());
assertEquals(null, tree.getRoot().getData());
assertEquals(null, tree.getRoot().getLeft());
assertEquals(null, tree.getRoot().getRight());
assertEquals(0, tree.size());
}
@Test
public void heightTest() {
fillTree();
tree.remove(-40);
tree.remove(23);
tree.remove(9);
tree.remove(76);
tree.remove(67);
tree.remove(12);
tree.remove(232);
assertEquals(4, tree.height());
tree.insert(3);
assertEquals(4, tree.height());
tree.insert(4);
assertEquals(5, tree.height());
tree.remove(0);
assertEquals(5, tree.height());
tree.remove(2);
assertEquals(4, tree.height());
}
@Test
public void predecessorSucessorTest() {
fillTree();
assertEquals(new Integer(9), tree.successor(6).getData());
assertEquals(new Integer(5), tree.predecessor(6).getData());
assertEquals(new Integer(0), tree.successor(-34).getData());
assertEquals(new Integer(-40), tree.predecessor(-34).getData());
assertEquals(new Integer(-34), tree.successor(-40).getData());
assertEquals(null, tree.predecessor(-40));
assertEquals(new Integer(6), tree.successor(5).getData());
assertEquals(new Integer(2), tree.predecessor(5).getData());
assertEquals(new Integer(5), tree.successor(2).getData());
assertEquals(new Integer(0), tree.predecessor(2).getData());
assertEquals(new Integer(2), tree.successor(0).getData());
assertEquals(new Integer(-34), tree.predecessor(0).getData());
assertEquals(new Integer(67), tree.successor(23).getData());
assertEquals(new Integer(12), tree.predecessor(23).getData());
assertEquals(new Integer(12), tree.successor(9).getData());
assertEquals(new Integer(6), tree.predecessor(9).getData());
assertEquals(new Integer(23), tree.successor(12).getData());
assertEquals(new Integer(9), tree.predecessor(12).getData());
assertEquals(new Integer(232), tree.successor(76).getData());
assertEquals(new Integer(67), tree.predecessor(76).getData());
assertEquals(new Integer(76), tree.successor(67).getData());
assertEquals(new Integer(23), tree.predecessor(67).getData());
assertEquals(null, tree.successor(232));
assertEquals(new Integer(76), tree.predecessor(232).getData());
}
@Test
public void testMinMax() {
tree.insert(6);
assertEquals(new Integer(6), tree.minimum().getData());
assertEquals(new Integer(6), tree.maximum().getData());
tree.insert(23);
assertEquals(new Integer(6), tree.minimum().getData());
assertEquals(new Integer(23), tree.maximum().getData());
tree.insert(-34);
assertEquals(new Integer(-34), tree.minimum().getData());
assertEquals(new Integer(23), tree.maximum().getData());
tree.insert(5);
assertEquals(new Integer(-34), tree.minimum().getData());
assertEquals(new Integer(23), tree.maximum().getData());
tree.insert(9);
assertEquals(new Integer(-34), tree.minimum().getData());
assertEquals(new Integer(23), tree.maximum().getData());
}
@Test
public void testSucessorPredecessor() {
fillTree(); // -40 -34 0 2 5 6 9 12 23 67 76 232
assertEquals(null, tree.predecessor(-40));
assertEquals(new Integer(-34), tree.successor(-40).getData());
assertEquals(new Integer(-40), tree.predecessor(-34).getData());
assertEquals(new Integer(0), tree.successor(-34).getData());
assertEquals(new Integer(-34), tree.predecessor(0).getData());
assertEquals(new Integer(2), tree.successor(0).getData());
assertEquals(new Integer(0), tree.predecessor(2).getData());
assertEquals(new Integer(5), tree.successor(2).getData());
}
@Test
public void testSize() {
fillTree(); // -40 -34 0 2 5 6 9 12 23 67 76 232
int size = 12;
assertEquals(size, tree.size());
while (!tree.isEmpty()) {
tree.remove(tree.getRoot().getData());
assertEquals(--size, tree.size());
}
}
@Test
public void equalsElementTest() {
assertEquals(-1, tree.height());
assertEquals(0, tree.size());
tree.insert(10);
assertEquals(0, tree.height());
assertEquals(1, tree.size());
tree.insert(9);
assertEquals(1, tree.height());
assertEquals(2, tree.size());
tree.insert(10);
assertEquals(1, tree.height());
assertEquals(2, tree.size());
tree.insert(9);
assertEquals(1, tree.height());
assertEquals(2, tree.size());
}
@Test
public void invalidInsert() {
tree.insert(null);
tree.insert(null);
tree.remove(null);
assertEquals(0, tree.size());
assertEquals(-1, tree.height());
assertEquals(null, tree.getRoot().getData());
assertEquals(null, tree.getRoot().getLeft());
assertEquals(null, tree.getRoot().getRight());
assertEquals(null, tree.maximum());
assertEquals(null, tree.minimum());
assertTrue(tree.isEmpty());
}
@Test
public void minimumMaximum() {
fillTree();// -40 -34 0 2 5 6 9 12 23 67 76 232
assertEquals(new Integer(-40), tree.minimum().getData());
assertEquals(new Integer(232), tree.maximum().getData());
tree.remove(-40);
tree.remove(232);
assertEquals(new Integer(-34), tree.minimum().getData());
assertEquals(new Integer(76), tree.maximum().getData());
tree.remove(-34);
tree.remove(76);
assertEquals(new Integer(0), tree.minimum().getData());
assertEquals(new Integer(67), tree.maximum().getData());
tree.remove(0);
tree.remove(67);
assertEquals(new Integer(2), tree.minimum().getData());
assertEquals(new Integer(23), tree.maximum().getData());
tree.remove(2);
tree.remove(23);
assertEquals(new Integer(5), tree.minimum().getData());
assertEquals(new Integer(12), tree.maximum().getData());
tree.remove(5);
tree.remove(12);
assertEquals(new Integer(6), tree.minimum().getData());
assertEquals(new Integer(9), tree.maximum().getData());
tree.remove(6);
tree.remove(9);
assertEquals(null, tree.minimum());
assertEquals(null, tree.maximum());
assertTrue(tree.isEmpty());
}
@Test
public void testHeight() {
fillTree(); // -40 -34 0 2 5 6 9 12 23 67 76 232
Integer[] preOrder = new Integer[] { 6, -34, -40, 5, 2, 0, 23, 9, 12,
76, 67, 232 };
assertArrayEquals(preOrder, tree.preOrder());
assertEquals(4, tree.height());
tree.remove(0);
assertEquals(3, tree.height());
tree.remove(2);
assertEquals(3, tree.height());
}
@Test
public void testRemove() {
fillTree(); // -40 -34 0 2 5 6 9 12 23 67 76 232
Integer[] order = { -40, -34, 0, 2, 5, 6, 9, 12, 23, 67, 76, 232 };
assertArrayEquals(order, tree.order());
tree.remove(6);
order = new Integer[] { -40, -34, 0, 2, 5, 9, 12, 23, 67, 76, 232 };
assertArrayEquals(order, tree.order());
tree.remove(9);
order = new Integer[] { -40, -34, 0, 2, 5, 12, 23, 67, 76, 232 };
assertArrayEquals(order, tree.order());
assertEquals(NIL, tree.search(6));
assertEquals(NIL, tree.search(9));
}
@Test
public void testSearch() {
fillTree(); // -40 -34 0 2 5 6 9 12 23 67 76 232
assertEquals(new Integer(-40), tree.search(-40).getData());
assertEquals(new Integer(-34), tree.search(-34).getData());
assertEquals(NIL, tree.search(2534));
}
} | [
"gerson.junior@ccc.ufcg.edu.br"
] | gerson.junior@ccc.ufcg.edu.br |
76edbfd2568d811bca5b39470fc886f398ae8a18 | 9c3bb98eb9d0a587a302bdfa811f7b5c6a5a0a37 | /Week 3/id_495/LeetCode_74_495.java | 024f6b777d95fd54d14bd21ffed087dd762efdce | [] | permissive | chenlei65368/algorithm004-05 | 842db9d9017556656aef0eeb6611eec3991f6c90 | 60e9ef1051a1d0441ab1c5484a51ab77a306bf5b | refs/heads/master | 2020-08-07T23:09:30.548805 | 2019-12-17T10:48:22 | 2019-12-17T10:48:22 | 213,617,423 | 1 | 0 | Apache-2.0 | 2019-12-17T10:48:24 | 2019-10-08T10:50:41 | Java | UTF-8 | Java | false | false | 1,271 | java | class LeetCode_74_495 {
public static void main(String[] args) {
System.out.println(searchMatrix(new int[][] {
new int[] {1, 3, 5, 7},
new int[] {10, 11, 16, 20},
new int[] {23, 30, 34, 50}
}, 34));
}
public static boolean searchMatrix(int[][] matrix, int target) {
if (matrix.length == 0 || matrix[0].length == 0) {
return false;
}
if (target < matrix[0][0]) {
return false;
}
int n = matrix.length;
int m = matrix[0].length;
int rl = 0, rr = n;
int cl = 0, cr = m;
while (rl <= rr && rl < n) {
int row = rl + (rr-rl)/2;
if (target >= matrix[row][0]) {
rl = row + 1;
}
else {
rr = row - 1;
}
}
int searchRow = rl-1;
if (rl-1 < 0) {
return false;
}
while (cl <= cr && cl < m) {
int col = cl + (cr-cl)/2;
if (target >= matrix[searchRow][col]) {
cl = col + 1;
}
else {
cr = col - 1;
}
}
int res = matrix[searchRow][cl-1];
return res == target;
}
}
| [
"fengzhong_yue@163.com"
] | fengzhong_yue@163.com |
420267a3092a704b116cfe714704e071aa0ed65e | 92f1690af1d595bc40bd6985b9d2d1a124b0e89a | /Lab7.java | 8e96e0be137b239c6439fe9e7292c4921b65ac0e | [] | no_license | cdeming91/labs | b685d94c32313678a016bb1f063866c90b7144d5 | db3c7ce71e74529bac8cbed061c8bf66560aae88 | refs/heads/master | 2020-09-24T10:21:17.980110 | 2016-10-03T13:26:28 | 2016-10-03T13:26:28 | 66,580,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,898 | java | import java.util.InputMismatchException;
import java.util.Scanner;
public class Lab7 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] name = new String[] { "ChrisS", "Kyle", "Narmatha", "Mumeen", "Tenica", "Sadia", "James", "ChrisD",
"Mark", "Yolanda", "Brent", "Krafus", "Ashlei", "Purba", "David", "Bryan", "Thomas", "Keesha", "Nurah",
"Robert" };
String[] hometown = new String[] { "Royal Oak", "Detroit", "West Bloomfield", "Detroit", "Detroit",
"Farmington Hills", "Highland Park", "Macomb", "Redford", "Detroit", "Sagnasty", "Detroit",
"Southfield", "Detroit", "Farminton Hills", "Hamtramck", "Rochester", "Detroit", "Detroit", "Detroit",
"Sterling Heights" };
String[] favoriteFood = new String[] { "Chocolate", "Turkey Burgers", " Cucumber", "Potato", "Pizza",
"watermelon", "Franks", "Pizza", "lo-mein ", "Asparagus", "Taco", "Salmon", "Veggie Wraps", "apples",
"grape", "Oatmel", "Ziti", "Smoothies", "Salmon", "Ice cream" };
System.out.println("Welcome to our java class!");
Scanner scanner = new Scanner(System.in);
int studentIndex;
String choice = ("y");
String answer = "";
while (choice.equals("y")) {
System.out.println("Which student would you like to learn more about?");
try {
studentIndex = scanner.nextInt()-1;
System.out.println("Student " + (studentIndex+1) + " is " + name[studentIndex]);
} catch (IndexOutOfBoundsException | IllegalArgumentException ex) {
System.out.println("You have entered an invalid number. Please choose from 1-20.");
continue;
} catch (InputMismatchException ex) {
System.out.println("You have entered an invalid response. Please choose a number from 1-20.");
scanner.next();
continue;
}
scanner.nextLine();
while (true) {
System.out.println("What would you like to learn about another person? (Hometown or favorite food)");
answer = scanner.nextLine();
if (answer.equalsIgnoreCase("hometown")) {
System.out.println(name[studentIndex] + " is from " + hometown[studentIndex]);
break;
} else if (answer.equalsIgnoreCase("favorite food")) {
System.out.println(name[studentIndex] + "'s favorite food is " + favoriteFood[studentIndex]);
break;
} else {
System.out.println("Please choose from the two options that were presented.");
}
}
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
95e8ab458ed2f643e0d288b5b6097f5278e46a82 | 90573b2c921e39fa0dff060a929f4b9dc55d3e19 | /src/main/java/io/github/coolmineman/cheaterdeleter/modules/rotation/LockDetector.java | 6aa71e4889e3937182663ae50aaa02258f2072ea | [
"CC0-1.0"
] | permissive | EncryptSL/CheaterDeleter | 27e62381e3b34f7f05cdf0f01a93050bbd818e3b | 3b25cdd4926d3c9aa2be4429b3b8c9f7d9d74e66 | refs/heads/master | 2023-04-11T19:57:51.602502 | 2021-03-31T00:31:42 | 2021-03-31T00:31:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,710 | java | package io.github.coolmineman.cheaterdeleter.modules.rotation;
import java.util.UUID;
import io.github.coolmineman.cheaterdeleter.events.PlayerRotationListener;
import io.github.coolmineman.cheaterdeleter.modules.CDModule;
import io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;
import io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;
import io.github.coolmineman.cheaterdeleter.util.MathUtil;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.hit.HitResult.Type;
import net.minecraft.world.RaycastContext.FluidHandling;
public class LockDetector extends CDModule implements PlayerRotationListener {
public LockDetector() {
super("lock_detector");
PlayerRotationListener.EVENT.register(this);
}
@Override
public void onRotate(CDPlayer player, float yawDelta, float pitchDelta, double move, PlayerMoveC2SPacketView packet) {
if (!enabledFor(player)) return;
double x = packet.isChangePosition() ? packet.getX() : player.getPacketX();
double y = packet.isChangePosition() ? packet.getY() : player.getPacketY();
double z = packet.isChangePosition() ? packet.getZ() : player.getPacketZ();
HitResult result = player.raycast(x, y, z, packet.getYaw(), packet.getPitch(), 6, FluidHandling.NONE);
if (result.getType() == Type.ENTITY) {
EntityHitResult entityHitResult = (EntityHitResult)result;
double offsetx = result.getPos().getX() - entityHitResult.getEntity().getX();
double offsetz = result.getPos().getZ() - entityHitResult.getEntity().getZ();
LockDetectorData data = player.getOrCreateData(LockDetectorData.class, LockDetectorData::new);
if (data.target == null || !data.target.equals(entityHitResult.getEntity().getUuid())) {
data.offsetx = offsetx;
data.offsetz = offsetz;
data.lock = 0;
data.target = entityHitResult.getEntity().getUuid();
} else {
double distance = MathUtil.getDistanceSquared(offsetx, offsetz, data.offsetx, data.offsetz);
if (move > 2 && Math.abs(pitchDelta) > 0.01 && distance < 0.001) {
++data.lock;
if (data.lock > 3) {
flag(player, FlagSeverity.MAJOR, "Entity Lock (Killaura)");
}
} else if (move > 2) {
data.target = null;
}
}
}
}
public static class LockDetectorData {
double offsetx;
double offsetz;
UUID target;
int lock;
}
}
| [
"62723322+CoolMineman@users.noreply.github.com"
] | 62723322+CoolMineman@users.noreply.github.com |
cc5b87f69df3efeda86db992e333c0a44f36efb3 | 2b9fa9384d219abfd3fe15c4ec228446dfc85ebd | /InterfaceComparateur/src/com/interfacecomparateur/profile/ChangePasswordActivity.java | 2493e4cb5ddaaa70ce01d37c8df9441a5974cdd0 | [] | no_license | oueslatisameh/L3F1 | 6a4f53e373a7772514e3ae6d9528fd027ceb2eb9 | f082131f97861960441d8899da355d52654f5746 | refs/heads/master | 2020-04-25T03:43:54.914546 | 2016-02-07T13:32:44 | 2016-02-07T13:32:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,329 | java | package com.interfacecomparateur.profile;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.example.interfacecomparateur.R;
import com.interfacecomparateur.ConnectionActivity;
import com.interfacecomparateur.classes.RequeteHTTP;
/**
* <b>Activité permettant à l'utilisateur de changer le mot de passe associé à son compte.</b>
*
* @author Equipe L3I1
*
*/
public class ChangePasswordActivity extends Activity {
/**
* Identifiant (adresse e-mail) de l'utilisateur connecté.
*/
private String identifiant;
/**
* Bouton sur lequel l'utilisateur doit appuyer pour changer son mot de passe.
*/
private Button buttonChange;
/**
* EditText où l'utilisateur doit saisir son nouveau de passe.
*/
private EditText newPasswordEditText;
/**
* EditText où l'utilisateur doit saisir son nouveau mot de passe (confirmation).
*/
private EditText newPasswordConfirmationEditText;
/**
* TextView où sont affichées les éventuelles erreurs survenues au cours de l'opération.
*/
private TextView errorTextview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.change_password_vue);
Intent intent = getIntent();
identifiant = intent.getStringExtra("id");
newPasswordEditText = (EditText)findViewById(R.id.new_user_password1);
newPasswordConfirmationEditText = (EditText)findViewById(R.id.new_user_password2);
errorTextview = (TextView)findViewById(R.id.error_textview);
ImageButton buttonBack = (ImageButton)findViewById(R.id.button_back);
buttonBack.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
buttonChange = (Button)findViewById(R.id.button_change);
buttonChange.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
boolean error = false;
final ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressBar);
StringBuffer sb = new StringBuffer();
final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
progressBar.setVisibility(View.INVISIBLE);
}
};
if(newPasswordEditText.getText().toString().equals("") || newPasswordConfirmationEditText.getText().toString().equals("")) {
error=true;
sb.append("Les champs 'adresse e-mail' et 'mot de passe' doivent être renseignés");
}
if (!(newPasswordEditText.getText().toString().equals(newPasswordConfirmationEditText.getText().toString()))) {
if (error)
sb.append("\n");
else
error=true;
sb.append("Les deux mots de passe ne sont pas identiques");
}
if (error) {
errorTextview.setVisibility(View.VISIBLE);
errorTextview.setText(sb.toString());
}
else {
progressBar.setVisibility(View.VISIBLE);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
changePassword();
handler.sendMessage(handler.obtainMessage());
}
});
thread.start();
}
}
});
}
/**
* Requête POST envoyée au serveur afin de changer le mot de passe de l'utilisateur par le nouveau
* mot de passe saisi.
* Si l'opération a réussie (si le champ 'registered' a pour valeur 'success' dans le document JSON renvoyé
* par le serveur), le texte du bouton change et indique 'Mot de passe changé'.
*/
private void changePassword() {
boolean networkAvailable = RequeteHTTP.isNetworkConnected(this);
RequeteHTTP requete = new RequeteHTTP(getApplicationContext(),"/account/",new String[]{"field","value"},new String[]{"password",ConnectionActivity.sha1Hash(newPasswordEditText.getText().toString())},identifiant);
final JSONObject jsonDocument = requete.sendPostRequest();
String registered = null;
if (!networkAvailable) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),"Réseau non disponible",Toast.LENGTH_SHORT).show();
}
});
}
else if (jsonDocument==null) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),"Erreur lors du changement de votre mot de passe",Toast.LENGTH_LONG).show();
}
});
}
else {
try {
registered = jsonDocument.getString("registered");
if (jsonDocument.has("err")) {
runOnUiThread(new Runnable() {
public void run() {
try {
JSONArray errors = jsonDocument.getJSONArray("err");
errorTextview.setVisibility(View.VISIBLE);
StringBuffer sb = new StringBuffer();
for (int i=0;i<errors.length();i++)
sb.append(errors.get(i)+"\n");
errorTextview.setText(sb.toString());
}
catch(JSONException e) {
Log.d("Err",e.getMessage());
}
}
});
}
}
catch(JSONException e) {
Log.d("Err",e.getMessage());
}
if(registered.equals("success")) {
runOnUiThread(new Runnable() {
public void run() {
errorTextview.setVisibility(View.INVISIBLE);
buttonChange.setText("Mot de passe modifié");
buttonChange.setClickable(false);
}
});
}
}
}
}
| [
"serkserk@live.fr"
] | serkserk@live.fr |
e7bb73e326243211bd568df8791c8d717f84d005 | 89e2a68f1025ee54aea0b526dd271315b6d63966 | /jdroid-gradle-android-plugin/src/main/groovy/com/jdroid/gradle/android/AndroidApplicationGradlePluginExtension.java | 501f6ab2c40502565b498930c959d4daae8e8dc6 | [
"Apache-2.0"
] | permissive | maxirosson/jdroid-gradle-plugin | 0e47a85dd5e9c4510d62cb2c7e9da0b00c8c9e4a | 9d164ab05110dd941148f0fe845801307c7c74dd | refs/heads/master | 2022-11-13T03:05:57.155436 | 2022-11-04T00:46:45 | 2022-11-04T00:46:45 | 69,528,357 | 4 | 3 | Apache-2.0 | 2021-03-28T00:15:18 | 2016-09-29T03:48:04 | Java | UTF-8 | Java | false | false | 1,051 | java | package com.jdroid.gradle.android;
import org.gradle.api.Project;
public class AndroidApplicationGradlePluginExtension extends AndroidGradlePluginExtension {
private boolean isFakeReleaseBuildTypeEnabled;
private boolean isReleaseBuildTypeDebuggable;
public AndroidApplicationGradlePluginExtension(Project project) {
super(project);
isFakeReleaseBuildTypeEnabled = propertyResolver.getBooleanProp("FAKE_RELEASE_BUILD_TYPE_ENABLED", false);
isReleaseBuildTypeDebuggable = propertyResolver.getBooleanProp("RELEASE_BUILD_TYPE_DEBUGGABLE", false);
}
public boolean isFakeReleaseBuildTypeEnabled() {
return isFakeReleaseBuildTypeEnabled;
}
public void setFakeReleaseBuildTypeEnabled(boolean fakeReleaseBuildTypeEnabled) {
isFakeReleaseBuildTypeEnabled = fakeReleaseBuildTypeEnabled;
}
public boolean isReleaseBuildTypeDebuggable() {
return isReleaseBuildTypeDebuggable;
}
public void setReleaseBuildTypeDebuggable(boolean releaseBuildTypeDebuggable) {
isReleaseBuildTypeDebuggable = releaseBuildTypeDebuggable;
}
}
| [
"maxirosson@gmail.com"
] | maxirosson@gmail.com |
328d55ef09fb058d5b99647385955816cb8d2055 | c76c21b8d28cdced68a554c755b55d90ff5efab0 | /Rediseno3D/app/src/main/java/com/example/rediseno3d/OBJAdapter.java | 8dfc60cc8ab87471c092349056962b2fe7e38dcb | [] | no_license | cesarimm/TrabajoTerminal_II | b7a5ee2d0f14702c9d220f4f42d183bf327fa5db | f6161ca5a9bc0403c13be621ced96e63b086f579 | refs/heads/master | 2021-05-20T10:58:10.580447 | 2020-07-27T23:54:39 | 2020-07-27T23:54:39 | 252,255,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,213 | java | package com.example.rediseno3d;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import org.opencv.android.Utils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.FileProvider;
@RequiresApi(api = Build.VERSION_CODES.O)
public class OBJAdapter extends ArrayAdapter {
private List<OBJ> items = this.obtenerLista();
public OBJAdapter(Context context){
super(context, 0);
}
public OBJAdapter(@NonNull Context context, int resource) {
super(context, resource);
}
@Override
public int getCount() {
return items != null ? items.size() : 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final int aux = position;
LayoutInflater layoutInflater =(LayoutInflater) LayoutInflater.from(parent.getContext());
// Referencia del view procesado
View listItemView;
//Comprobando si el View no existe
listItemView = null == convertView ? layoutInflater.inflate(
R.layout.dis_obj,
parent,
false) : convertView;
TextView tvTitulo = (TextView) listItemView.findViewById(R.id.lvTitulo);
TextView tvFecha = (TextView) listItemView.findViewById(R.id.lvFecha);
ImageView tvImageView = (ImageView) listItemView.findViewById(R.id.imageViewInflado);
// Obtener el item actual
OBJ item = items.get(position);
// Obtener Views
// Actualizar los Views
tvTitulo.setText(item.getNombre());
tvFecha.setText(item.getFecha());
final String nombre = item.getNombre();
//Trabajar con la imagen de cada uno
/*File file = new File(Environment.getExternalStorageDirectory() + "/R3D/imagenes/IMG_20200603_175302.jpg");
try{
Bitmap imagenBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
tvImageView.setImageBitmap(imagenBitmap);
}catch (Exception e){
}*/
tvImageView.setImageResource(R.drawable.cubito);
////Para los botones
Button compartir = (Button) listItemView.findViewById(R.id.btnCompartir);
final Button visualizar = (Button) listItemView.findViewById(R.id.btnVisualizar);
Button eliminar = (Button) listItemView.findViewById(R.id.btnEliminar);
eliminar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(getContext(), "eliminar"+aux, Toast.LENGTH_SHORT).show();
eliminarArchivo(getContext(), nombre, aux);
}
});
visualizar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(getContext(), "visualizar"+aux, Toast.LENGTH_SHORT).show();
abrirVisualizador(getContext(), nombre);
}
});
compartir.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri path = FileProvider.getUriForFile(getContext(), "com.example.rediseno3d", new File(Environment.getExternalStorageDirectory()+"/R3D/obj/"+nombre));
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, "R3D: ");
shareIntent.putExtra(Intent.EXTRA_STREAM, path);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.setType("text/*");
getContext().startActivity(Intent.createChooser(shareIntent, "Share..."));
}
});
return listItemView;
}
@RequiresApi(api = Build.VERSION_CODES.O)
private List<OBJ> obtenerLista(){
List<OBJ> archivos = new ArrayList<OBJ>();
///Obtener los archivos del adapter y poder utilizarlos en el visualizador
File f = new File(Environment.getExternalStorageDirectory() + "/R3D/obj/");
File[] files = f.listFiles();
BasicFileAttributes atributos;
for (int i = files.length -1; i >=0 ; i--) {
String nombre, fecha="xx/xx/xx";
//Obteniendo el nombre
nombre = files[i].getName();
//Obtener la fecha
try{
atributos = Files.readAttributes(files[i].toPath(), BasicFileAttributes.class);
FileTime tiempo = atributos.creationTime();
String patron = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(patron);
fecha = simpleDateFormat.format(new Date(tiempo.toMillis()));
}catch(IOException e){
e.printStackTrace();
}
archivos.add(new OBJ(nombre, fecha, ""));
}
return archivos;
}
private void eliminarArchivo(Context contexto, final String nombreArchvo, final int aux){
AlertDialog.Builder build = new AlertDialog.Builder(contexto);
build.setMessage("¿Desea eliminar el archivo?");
build.setTitle("Eliminar OBJ");
build.setPositiveButton("Si", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
items.remove(aux);
notifyDataSetChanged();
File f = new File(Environment.getExternalStorageDirectory() + "/R3D/obj/"+nombreArchvo);
f.delete();
}
});
build.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
AlertDialog dialog = build.create();
dialog.show();
}
private void abrirVisualizador(Context contexto, String nombreArchvo){
try{
///Obtener los datos para la libreria de OPENGL a partir del OBJ
float vertices[] = Figura.getVertices(nombreArchvo);
byte indices[] = Figura.getIndices(nombreArchvo);
float colors[]= new float[(vertices.length/3)*4];
for(int x=0;x<(vertices.length/3)*4;x++){
colors[x] = 0.5f;
}
// Toast.makeText(getApplicationContext(), "Item: "+textView.getText().toString(), Toast.LENGTH_LONG).show();
Intent intent = new Intent(contexto, Visualizador.class);
intent.putExtra("Vertices", vertices);
intent.putExtra("Indices", indices);
intent.putExtra("Colores", colors);
contexto.startActivity(intent);
}catch(Exception e){
///NJo es posible abrir
AlertDialog.Builder build = new AlertDialog.Builder(contexto);
build.setMessage("Calidad no soportada por el visualizador");
build.setTitle("Visualizador");
build.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
AlertDialog dialog = build.create();
dialog.show();
}
}
}
| [
"bmwcesarim@gmail.com"
] | bmwcesarim@gmail.com |
fa319e164cf50142ff5a413938203995ad0d7ddb | b88d48327946e8c76766985319c499a2c5c1b40e | /jdk8_src/org/omg/IOP/ENCODING_CDR_ENCAPS.java | 0fb6f4ef09c8dcd4f0bf7fbcba32dcc4d8d6bbb6 | [] | no_license | edwerner/react-app-server | cf63dfeeac176ff4d785832476b6d603a6058640 | b55143b5635368be8d2f90820351804f9e9a6691 | refs/heads/master | 2020-04-26T13:29:37.727794 | 2019-03-03T14:04:12 | 2019-03-03T14:04:12 | 173,581,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package org.omg.IOP;
/**
* org/omg/IOP/ENCODING_CDR_ENCAPS.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u102/7268/corba/src/share/classes/org/omg/PortableInterceptor/IOP.idl
* Wednesday, June 22, 2016 1:16:37 PM PDT
*/
public interface ENCODING_CDR_ENCAPS
{
/**
* The CDR Encapsulation encoding.
* @see CodecFactory
*/
public static final short value = (short)(0);
}
| [
"werner.77@hotmail.com"
] | werner.77@hotmail.com |
5d392632cf8a2667ace7930f64946e746993669c | 3b5fc2ac869e8e55f31cf99c6dd700d57b6e9155 | /addressbook-web-tests/src/test/java/ru/stqua/pft/addressbook/appmanager/ContactHelper.java | b8c914deb0b0a45cc08d2af2c72324bee2fce72e | [
"Apache-2.0"
] | permissive | GornyAlex/pdt_37 | 63bb9e8f97b56e5895b18f738f7dd0ebd80237a9 | 7738ab485ba75c1ab3be2361a616b615fcf38558 | refs/heads/master | 2021-01-11T19:52:39.418639 | 2017-03-25T16:10:45 | 2017-03-25T16:10:45 | 79,414,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,205 | java | package ru.stqua.pft.addressbook.appmanager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import ru.stqua.pft.addressbook.model.ContactData;
import ru.stqua.pft.addressbook.model.Contacts;
import ru.stqua.pft.addressbook.model.GroupData;
import java.util.List;
/**
* Created by Alexander Gorny on 1/29/2017.
*/
public class ContactHelper extends HelperBase {
public ContactHelper(WebDriver wd) {
super(wd);
}
public void gotoHomePage() {
if (isElementPresent(By.id("maintable"))) {
return;
}
click(By.linkText("home"));
}
public void submitContactCreation() {
click(By.xpath("//div[@id='content']/form/input[21]"));
}
public void fillContactForm(ContactData contactData, boolean creation) {
type(By.name("firstname"), contactData.getFirsName());
type(By.name("lastname"), contactData.getLastName());
type(By.name("nickname"), contactData.getNickname());
type(By.name("title"), contactData.getTitle());
type(By.name("company"), contactData.getCompany());
type(By.name("address"), contactData.getAddress());
type(By.name("home"), contactData.getHomePhone());
type(By.name("mobile"), contactData.getMobilePhone());
type(By.name("work"), contactData.getWorkPhone());
type(By.name("email"), contactData.getEmail());
type(By.name("email2"), contactData.getEmail2());
type(By.name("email3"), contactData.getEmail3());
type(By.name("homepage"), contactData.getUrlHomePage());
attach(By.name("photo"), contactData.getPhoto());
if (creation) {
if (contactData.getGroups().size() > 0) {
Assert.assertTrue(contactData.getGroups().size() == 1);
new Select(wd.findElement(By.name("new_group"))).selectByVisibleText(contactData.getGroups().iterator().next().getName());
} else {
Assert.assertTrue(isElementPresent(By.name("new_group")));
}
} else {
Assert.assertFalse(isElementPresent(By.name("new_group")));
}
}
public void initAddNewContact() {
click(By.linkText("add new"));
}
public void selectContactById(int id) {
wd.findElement(By.cssSelector("input[value='" + id + "']")).click();
}
public void selectGroupById(int id) {
Select dropdown = new Select(wd.findElement(By.cssSelector("select[name='to_group']")));
dropdown.selectByValue("" + id);
click(By.name("add"));
}
public void filterContactsByGroupId(int id) {
Select dropdown = new Select(wd.findElement(By.cssSelector("select[name='group']")));
dropdown.selectByValue("" + id);
}
public void removeContactFromGroup() {
click(By.cssSelector("input[name='remove']"));
}
public void deleteSelectedContact() {
click(By.xpath("//input[@value='Delete']"));
wd.switchTo().alert().accept();
}
public void editContactById(int id) {
wd.findElement(By.cssSelector("a[href='edit.php?id=" + id + "']")).click();
}
public void updateContact() {
click(By.name("update"));
}
public void create(ContactData contact, boolean creation) {
initAddNewContact();
fillContactForm(contact, creation);
submitContactCreation();
contactCache = null;
}
public void modify(ContactData contact) {
editContactById(contact.getId());
fillContactForm(contact, false);
updateContact();
contactCache = null;
gotoHomePage();
}
public void delete(ContactData contact) {
selectContactById(contact.getId());
deleteSelectedContact();
contactCache = null;
gotoHomePage();
}
public void addToGroup(ContactData contact, GroupData group) {
selectContactById(contact.getId());
selectGroupById(group.getId());
contactCache = null;
gotoHomePage();
}
public void deleteFromGroup(ContactData contact, GroupData group) {
filterContactsByGroupId(group.getId());
selectContactById(contact.getId());
removeContactFromGroup();
contactCache = null;
gotoHomePage();
}
public boolean isThereAContact() {
return isElementPresent(By.xpath("(//input[@name='selected[]'])[1]"));
}
public int count() {
return wd.findElements(By.name("selected[]")).size();
}
private Contacts contactCache = null;
public Contacts all() {
if (contactCache != null) {
return new Contacts(contactCache);
}
contactCache = new Contacts();
List<WebElement> elements = wd.findElements(By.xpath("//tr[@name='entry']"));
for (WebElement element : elements) {
List<WebElement> cells = element.findElements(By.tagName("td"));
int id = Integer.parseInt(element.findElement(By.tagName("input")).getAttribute("value"));
String lastName = cells.get(1).getText();
String firstName = cells.get(2).getText();
String address = cells.get(3).getText();
String allEmails = cells.get(4).getText();
String allPhones = cells.get(5).getText();
contactCache.add(new ContactData()
.withId(id)
.withFirsName(firstName)
.withLastName(lastName)
.withAddress(address)
.withAllEmails(allEmails)
.withAllPhones(allPhones));
}
return new Contacts(contactCache);
}
public ContactData infoFromEditForm(ContactData contact) {
initContactModificationById(contact.getId());
String firstName = wd.findElement(By.name("firstname")).getAttribute("value");
String lastName = wd.findElement(By.name("lastname")).getAttribute("value");
String nickNme = wd.findElement(By.name("nickname")).getAttribute("value");
String company = wd.findElement(By.name("company")).getAttribute("value");
String title = wd.findElement(By.name("title")).getAttribute("value");
String address = wd.findElement(By.name("address")).getAttribute("value");
String home = wd.findElement(By.name("home")).getAttribute("value");
String mobile = wd.findElement(By.name("mobile")).getAttribute("value");
String work = wd.findElement(By.name("work")).getAttribute("value");
String email = wd.findElement(By.name("email")).getAttribute("value");
String email2 = wd.findElement(By.name("email2")).getAttribute("value");
String email3 = wd.findElement(By.name("email3")).getAttribute("value");
String homePage = wd.findElement(By.name("homepage")).getAttribute("value");
wd.navigate().back();
return new ContactData().withId(contact.getId())
.withFirsName(firstName)
.withLastName(lastName)
.withNickname(nickNme)
.withCompany(company)
.withTitle(title)
.withAddress(address)
.withHomePhone(home)
.withMobilePhone(mobile)
.withWorkPhone(work)
.withEmail(email.trim())
.withEmail2(email2.trim())
.withEmail3(email3.trim())
.withUrlHomePage(homePage.trim());
}
private void initContactModificationById(int id) {
WebElement checkbox = wd.findElement(By.cssSelector(String.format("input[value='%s']", id)));
WebElement row = checkbox.findElement(By.xpath("./../.."));
List<WebElement> cells = row.findElements(By.tagName("td"));
cells.get(7).findElement(By.tagName("a")).click();
// wd.findElement(By.xpath(String.format("//input[@value='%s']/../../td[8]/a", id))).click();
// wd.findElement(By.xpath(String.format("//tr[.//input[@value='%s']]/td[8]/a", id))).click();
// wd.findElement(By.cssSelector(String.format("a[href='edit.php?id='%s']", id))).click();
}
public String contactInfoFromDetailsPage(ContactData contact) {
initContactDetailsById(contact.getId());
return wd.findElement(By.id("content")).getText();
}
private void initContactDetailsById(int id) {
WebElement checkbox = wd.findElement(By.cssSelector(String.format("input[value='%s']", id)));
WebElement row = checkbox.findElement(By.xpath("./../.."));
List<WebElement> cells = row.findElements(By.tagName("td"));
cells.get(6).findElement(By.tagName("a")).click();
// wd.findElement(By.cssSelector(String.format("a[href='view.php?id='%s']", id))).click();
}
}
| [
"test.automation.developer@gmail.com"
] | test.automation.developer@gmail.com |
c37a62adaedca668243e5f367183c0056193c697 | af1171bdd9ef8508d700bd243e3865553a7eeda0 | /JavaDemos/src/test/java/spider/jsoup/PageContentParseTest.java | 1e58a6579e271ff250ad44275b65cfdd2cddce76 | [] | no_license | jxzhung/JavaCodes | 0297d011a63817204d1d433e59721d96b84c30aa | 170c00e3617ece6537cb56b55ec5e4d626f3d4a7 | refs/heads/master | 2020-07-03T05:11:37.830227 | 2018-09-03T00:53:36 | 2018-09-03T00:53:36 | 74,195,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,272 | java | package spider.jsoup;
import org.jsoup.Connection;
import org.jsoup.HttpStatusException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import java.io.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 测试页面抓取和过滤
*/
public class PageContentParseTest {
private static final String BASE_URL = "http://91.t9l.space/";
private static final String RE_TIME = " \\d{2}:\\d{2}";
public static void main(String[] args) {
PageContentParseTest parseTest = new PageContentParseTest();
parseTest.getPage();
}
public void getPage() {
String url = "";
Page page = new Page();
page.setUrl(url);
List<Res> resList = new ArrayList();
Document doc;
Connection.Response response = null;
InputStream in = null;
try {
in = new FileInputStream("/Users/jzhung/t2.html");
doc = Jsoup.parse(in, "utf-8", BASE_URL);
String title = doc.title();
if (title.equals("")) {
System.out.println("载入页面失败 无标题 " + " 页面:" + url);
return;
}
Element firstPost = doc.select("div.postmessage.firstpost").first();
Element msg = firstPost.select("div.t_msgfontfix").first();
List<TextNode> list = msg.textNodes();
String html = msg.html();
System.out.println(html);
String regEx_html = "<[^><]+>"; // 定义HTML标签的正则表达式
Pattern p = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(html);
Pattern timePtn = Pattern.compile(RE_TIME, Pattern.CASE_INSENSITIVE);
int lastEndIndex = 0;
StringBuilder content = new StringBuilder();
while (m.find()) {
String data = m.group();
//System.out.println("---------" + m.start() + " , " + m.end() + " last:" + lastEndIndex + " " + data);
// 图片节点保留
if (data.startsWith("<img")) {
if (data.contains("file")) {
Document document = Jsoup.parseBodyFragment(data, BASE_URL);
String imgUrl = document.body().child(0).attr("abs:file");
System.out.println(imgUrl);
//保存图片到数据库
Res res = new Res();
res.setNetUrl(imgUrl);
res.setFromUrl(imgUrl);
//System.out.println(data);
content.append("<img src=\"" + imgUrl + "\" />");
} else {
//System.out.println("跳过图片:" + data);
}
} else if (data.startsWith("<br")) {
//有内容再加换行
if (content.length() > 0) {
content.append(data);
}
}
if (m.start() - lastEndIndex > 0) {
String textData = html.substring(lastEndIndex, m.start()).trim();
if (textData.equals("") || textData.startsWith("本帖最后") || textData.equals("下载") || textData.endsWith("B)")) {
//System.out.println("跳过:" + textData);
lastEndIndex = m.end();
continue;
}
Matcher timeMatcher = timePtn.matcher(textData);
if (!timeMatcher.find()) {
System.out.println("获取" + lastEndIndex + "," + m.start() + " 数据:" + textData);
content.append(textData);
}
//System.out.println(append);
}
lastEndIndex = m.end();
}
System.out.println("解析结果:" + content.toString());
//System.out.println(m.group(0));;
//String result = m.replaceAll(""); // 过滤script标签
//System.out.println(result);
if (1 > 0) {
return;
}
List<Node> nodeList = msg.childNodes();
StringBuilder contentBuilder = new StringBuilder();
//下载完图片并替换好的内容
contentBuilder = doNode(nodeList, contentBuilder, resList, page);
System.out.println("内容:" + contentBuilder.toString());
//System.out.println("发现并下载完成" + resList.size() + "张图片");
} catch (HttpStatusException e) {
e.printStackTrace();
int code = -1;
if (response != null) {
code = response.statusCode();
}
System.out.println("返回状态码错误:" + code + " 地址:" + url);
} catch (IOException e) {
System.out.println("网络错误:" + " 地址:" + url);
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public StringBuilder doNode(List<Node> list, StringBuilder builder, List<Res> localImgList, Page page) {
for (Node node : list) {
String outHtml = node.outerHtml().trim();
//System.out.println("outHtml:" + outHtml);
String cls = node.attr("class");
// 排除图片提示
if (cls.equals("imgtitle") || cls.equals("attach_popup") || cls.equals("t_attach")) {
continue;
}
if (node.childNodeSize() != 0) {
doNode(node.childNodes(), builder, localImgList, page);//递归 如果还有子节点继续循环操作
} else {
if (outHtml.indexOf("<img") >= 0) {//如果是 img标签进行标识type
String netUrl = node.attr("abs:file");
if (netUrl.equals("")) {
continue;
}
//todo 本地路径和网络路径的处理
String fileName = (localImgList.size() + 1) + FileNameUtil.getImgEnds(netUrl);
String halfDir = "images\\";
String savePath = "D:\\" + halfDir + fileName;
File downResultFile = new File(savePath);
//不存在才下载
if (!downResultFile.exists()) {
//downResultFile = client.download(netUrl, savePath);
//System.out.println("模拟下载图片:" + netUrl + " 保存到:" + savePath);
} else {
//System.out.println("文件已存在磁盘 " + savePath + " url:" + netUrl);
}
//下载成功后不再下载
if (downResultFile.exists()) {
long imgLen = downResultFile.length();
if (imgLen < 100) {
downResultFile.delete();
//System.out.println("下载图片失败 文件大小太小:" + imgLen + " " + savePath + " url:" + netUrl);
continue;
}
} else {
//System.out.println("下载图片失败, 文件不存在 " + savePath + " url:" + netUrl);
}
Res res = new Res();
res.setFromUrl(page.getUrl());
res.setNetUrl(netUrl);
res.setHashCode("hash");
res.setMd5("md5");
res.setSize(downResultFile.length());
res.setUri("/images/" + halfDir + fileName);
res.setName(fileName);
res.setMimeType("image/jpg");
Timestamp tt = new Timestamp(System.currentTimeMillis());
res.setCreateTime(tt);
res.setLastReadTime(tt);
localImgList.add(res);
builder.append("<img src=\"" + res.getUri() + "\">");
builder.append("<br/>");
System.out.println("图" + node.attr("file"));
} else {
if (!("".equals(outHtml))) {//如果不是空的进行设置类型
String text = node.toString().trim();
//过滤帖子提示
if (text.startsWith("本帖最后由") && text.endsWith("编辑")) {
//System.out.println("过滤帖子提示");
continue;
}
if (text.equals("<br>") || text.endsWith("[/attach]")) {
//System.out.println("过滤<br>");
continue;
}
builder.append(text.replace("", "").replace(" ", ""));
//自动补全句号
/* if (!text.endsWith(".") && !text.endsWith("。") && !text.endsWith(",") && !text.endsWith(",")
&& !text.endsWith(":") && !text.endsWith(":")
&& !text.endsWith("!")
&& !text.endsWith("!")
) {
builder.append("。");
}*/
builder.append("<br/>");
System.out.println(text);
//System.out.println("html:" + node.parent().attr("class"));
} else {
//System.out.println("跳过空"+outHtml);
continue;
}
}
}
}
return builder;
}
}
class Page {
String url;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
class FileNameUtil {
public static String getImgEnds(String downimg) {
String ends;
String iname = downimg.toLowerCase();
if (iname.endsWith("png")) {
ends = ".png";
} else {
ends = ".jpg";
}
return ends;
}
}
/**
* 资源
*/
class Res {
private Integer resId;
private String hashCode;//hash码用来去重
private String name;//文件名
private String md5;//校验码
private Long size;//文件大小
private String uri;//保存路径
private String mimeType;//文件类型
private String fromUrl;//来源
private String netUrl;//网络路径
private Timestamp createTime;//文件创建时间
private Timestamp lastReadTime;//最后访问时间
private Integer downCount;//下载次数
private Integer likeCount;//喜欢
public Integer getResId() {
return resId;
}
public void setResId(Integer resId) {
this.resId = resId;
}
public String getHashCode() {
return hashCode;
}
public void setHashCode(String hashCode) {
this.hashCode = hashCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public String getFromUrl() {
return fromUrl;
}
public void setFromUrl(String fromUrl) {
this.fromUrl = fromUrl;
}
public String getNetUrl() {
return netUrl;
}
public void setNetUrl(String netUrl) {
this.netUrl = netUrl;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
public Timestamp getLastReadTime() {
return lastReadTime;
}
public void setLastReadTime(Timestamp lastReadTime) {
this.lastReadTime = lastReadTime;
}
public Integer getDownCount() {
return downCount;
}
public void setDownCount(Integer downCount) {
this.downCount = downCount;
}
public Integer getLikeCount() {
return likeCount;
}
public void setLikeCount(Integer likeCount) {
this.likeCount = likeCount;
}
@Override
public String toString() {
return "Res{" +
"resId=" + resId +
", hashCode='" + hashCode + '\'' +
", name='" + name + '\'' +
", md5='" + md5 + '\'' +
", size=" + size +
", uri='" + uri + '\'' +
", mimeType='" + mimeType + '\'' +
", fromUrl='" + fromUrl + '\'' +
", netUrl='" + netUrl + '\'' +
", createTime=" + createTime +
", lastReadTime=" + lastReadTime +
", downCount=" + downCount +
", likeCount=" + likeCount +
'}';
}
} | [
"i@jzhung.com"
] | i@jzhung.com |
cd715d0f6e93edb17802ed022e7956cb6fd60003 | af4bb16152a7082f5ac83cb53145d0e8d9d12c7f | /LiaoTianShi/src/com/l/chat_qunliao/Send.java | a2488afd2b7b835c6ac42225d24acca24a196049 | [] | no_license | Ticsmyc/Java-Learning | c001209ea8ef48ee68128fe95fae850281f4e94b | c81e6b804021e5ab634bfd1d7e4ae9577f52fdb2 | refs/heads/master | 2020-06-14T17:45:45.331511 | 2019-12-19T09:00:22 | 2019-12-19T09:00:22 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,536 | java | package com.l.chat_qunliao;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
/**
* 客户端的发送
* @author Ice
*
*/
public class Send implements Runnable {
private BufferedReader console;
private DataOutputStream dos;
private Socket client;
private boolean isRunning;
private String usr_name;
public Send(Socket client,String usr_name) {
this.client = client;
this.isRunning=true;
this.usr_name = usr_name;
console = new BufferedReader(new InputStreamReader(System.in));
try {
dos = new DataOutputStream(client.getOutputStream());
//发送名称
send(usr_name);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("创建流错误");
this.release();
}
}
//释放资源
private void release() {
this.isRunning=false;
Utils.close(dos,client);
}
//发送消息
private void send(String msg) {
try {
dos.writeUTF(msg);
dos.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("发送错误");
release();
}
}
private String getStrFromConsole(){
try {
return console.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "";
}
@Override
public void run() {
// TODO Auto-generated method stub
while(isRunning) {
String msg =getStrFromConsole();
if(!msg.equals("")){
send(msg);
}
}
}
}
| [
"liu0148@outlook.com"
] | liu0148@outlook.com |
8e86dcb88f65e99d46e3b7ee4c8d48e1d2e0fb00 | 6d5605b4619190cbaa47046b2e4b2a0784bbdf96 | /app/src/main/java/com/example/connectsys/classes/produto/Produto.java | 35450fb8c7d120c8dd8806b9b0b6e79e6c2a7af0 | [] | no_license | JoOzO96/ConnectSysMobile | a04371cd60e511dcdb52ee04f961dbaafcb42ec4 | ce4732316c25d2780961a14742815e2cc4f9c9f9 | refs/heads/master | 2020-07-23T00:41:34.345808 | 2019-10-31T14:54:39 | 2019-10-31T14:54:39 | 207,385,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,775 | java | package com.example.connectsys.classes.produto;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.example.connectsys.banco.Banco;
import com.example.connectsys.uteis.DadosBanco;
import com.example.connectsys.uteis.GetSetDinamico;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
public class Produto {
Long codproduto;
String numerointerno;
String numerofabricante;
String numeroean;
Long codlocalizacao;
Long codgrupo;
Long codsubgrupo;
Long codfornecedorpadrao;
Long codicmscupom;
Long codicmsnotafiscal;
Long codmarca;
Long codcomposicao;
String descricao;
Date datacadastro;
Date datavenda;
Date datacompra;
Date dataalteracao;
String aplicacao;
Long codunidade;
String custoletra;
Double valorcompra;
Double valorcusto;
Double custocomercializacaopercentual;
Double custovenda;
Double quantidadeestoque;
Double quantidademinima;
Double quantidademaxima;
Double fretevalor;
Double fretepercentual;
Double darf;
Double icms;
Double ipi;
Double percentualavista;
Double percentualaprazo;
Double valoravista;
Double valoraprazo;
Double valortotal;
String ncm;
String classificacaofiscal;
String situacaotributaria;
Double perccomissao;
Boolean inativo;
Boolean naocomprar;
Double pesoliquidounitarioipi;
Double pesoliquidototalipi;
Double pesobrutototal;
Double pesoliquidototal;
Double ipivenda;
Double ipikg;
String imagem;
String tipoproduto;
String observacao;
Double mvainterno;
Double mvaexterno;
Long codprodutosimilar;
String numerointernosimilar;
String issqncodlistaservico;
String issqnsituacaotributaria;
String situacaotributariasaida;
String csosn;
String codipientrada;
String codipisaida;
String codpis;
Double percpis;
Double valorpisunitario;
String codcofins;
Double perccofins;
Double valorcofinsunitario;
String codpisentrada;
String codcofinsentrada;
Double percsubstituicao;
String codexcecaoipi;
String classeipi;
String cnpjipi;
String codseloipi;
Long quantidadeseloipi;
String codenquandramentoipi;
String informacaoadicional;
Boolean empromocao;
Double percdescontopromocao;
Double valordevendapromocao;
Double valorcofinsunitarioentrada;
Double perccofinsentrada;
Double percpisentrada;
Double valorpisunitarioentrada;
Double percipientrada;
Double valoripiunitarioentrada;
String codtipo;
String localiza;
Double percdescontoformulacao;
Long codnaturezapadrao;
Long codempresa;
String icmsvelho;
Date datavalidade;
String cest;
String origem;
String origemgarden;
String categoria;
String cientifico;
String aplicacaogarden;
String cultivo;
Boolean produtocomposto;
Double totalcomposicao;
Double valorunitariosubstituicao;
Long codnotaentradacadastro;
Double valordespesas;
String chassi;
Long codunidadetributavel;
Double fatortributavel;
String cstconsumidorfinal;
String csosnconsumidorfinal;
String exigibilidadeiss;
Double efet_baseicmsstretido;
Double efet_aliquotasuportada;
Double efet_valoricmsstretido;
Double efet_basefcpstretido;
Double efet_aliquotafcpretido;
Double efet_valorfcpstretido;
String informacaoadicionalexterna;
Boolean cestao;
Long codnaturezarevenda;
public Long getCodproduto() {
return codproduto;
}
public void setCodproduto(Long codproduto) {
this.codproduto = codproduto;
}
public String getNumerointerno() {
return numerointerno;
}
public void setNumerointerno(String numerointerno) {
this.numerointerno = numerointerno;
}
public String getNumerofabricante() {
return numerofabricante;
}
public void setNumerofabricante(String numerofabricante) {
this.numerofabricante = numerofabricante;
}
public String getNumeroean() {
return numeroean;
}
public void setNumeroean(String numeroean) {
this.numeroean = numeroean;
}
public Long getCodlocalizacao() {
return codlocalizacao;
}
public void setCodlocalizacao(Long codlocalizacao) {
this.codlocalizacao = codlocalizacao;
}
public Long getCodgrupo() {
return codgrupo;
}
public void setCodgrupo(Long codgrupo) {
this.codgrupo = codgrupo;
}
public Long getCodsubgrupo() {
return codsubgrupo;
}
public void setCodsubgrupo(Long codsubgrupo) {
this.codsubgrupo = codsubgrupo;
}
public Long getCodfornecedorpadrao() {
return codfornecedorpadrao;
}
public void setCodfornecedorpadrao(Long codfornecedorpadrao) {
this.codfornecedorpadrao = codfornecedorpadrao;
}
public Long getCodicmscupom() {
return codicmscupom;
}
public void setCodicmscupom(Long codicmscupom) {
this.codicmscupom = codicmscupom;
}
public Long getCodicmsnotafiscal() {
return codicmsnotafiscal;
}
public void setCodicmsnotafiscal(Long codicmsnotafiscal) {
this.codicmsnotafiscal = codicmsnotafiscal;
}
public Long getCodmarca() {
return codmarca;
}
public void setCodmarca(Long codmarca) {
this.codmarca = codmarca;
}
public Long getCodcomposicao() {
return codcomposicao;
}
public void setCodcomposicao(Long codcomposicao) {
this.codcomposicao = codcomposicao;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public Date getDatacadastro() {
return datacadastro;
}
public void setDatacadastro(Date datacadastro) {
this.datacadastro = datacadastro;
}
public Date getDatavenda() {
return datavenda;
}
public void setDatavenda(Date datavenda) {
this.datavenda = datavenda;
}
public Date getDatacompra() {
return datacompra;
}
public void setDatacompra(Date datacompra) {
this.datacompra = datacompra;
}
public Date getDataalteracao() {
return dataalteracao;
}
public void setDataalteracao(Date dataalteracao) {
this.dataalteracao = dataalteracao;
}
public String getAplicacao() {
return aplicacao;
}
public void setAplicacao(String aplicacao) {
this.aplicacao = aplicacao;
}
public Long getCodunidade() {
return codunidade;
}
public void setCodunidade(Long codunidade) {
this.codunidade = codunidade;
}
public String getCustoletra() {
return custoletra;
}
public void setCustoletra(String custoletra) {
this.custoletra = custoletra;
}
public Double getValorcompra() {
return valorcompra;
}
public void setValorcompra(Double valorcompra) {
this.valorcompra = valorcompra;
}
public Double getValorcusto() {
return valorcusto;
}
public void setValorcusto(Double valorcusto) {
this.valorcusto = valorcusto;
}
public Double getCustocomercializacaopercentual() {
return custocomercializacaopercentual;
}
public void setCustocomercializacaopercentual(Double custocomercializacaopercentual) {
this.custocomercializacaopercentual = custocomercializacaopercentual;
}
public Double getCustovenda() {
return custovenda;
}
public void setCustovenda(Double custovenda) {
this.custovenda = custovenda;
}
public Double getQuantidadeestoque() {
return quantidadeestoque;
}
public void setQuantidadeestoque(Double quantidadeestoque) {
this.quantidadeestoque = quantidadeestoque;
}
public Double getQuantidademinima() {
return quantidademinima;
}
public void setQuantidademinima(Double quantidademinima) {
this.quantidademinima = quantidademinima;
}
public Double getQuantidademaxima() {
return quantidademaxima;
}
public void setQuantidademaxima(Double quantidademaxima) {
this.quantidademaxima = quantidademaxima;
}
public Double getFretevalor() {
return fretevalor;
}
public void setFretevalor(Double fretevalor) {
this.fretevalor = fretevalor;
}
public Double getFretepercentual() {
return fretepercentual;
}
public void setFretepercentual(Double fretepercentual) {
this.fretepercentual = fretepercentual;
}
public Double getDarf() {
return darf;
}
public void setDarf(Double darf) {
this.darf = darf;
}
public Double getIcms() {
return icms;
}
public void setIcms(Double icms) {
this.icms = icms;
}
public Double getIpi() {
return ipi;
}
public void setIpi(Double ipi) {
this.ipi = ipi;
}
public Double getPercentualavista() {
return percentualavista;
}
public void setPercentualavista(Double percentualavista) {
this.percentualavista = percentualavista;
}
public Double getPercentualaprazo() {
return percentualaprazo;
}
public void setPercentualaprazo(Double percentualaprazo) {
this.percentualaprazo = percentualaprazo;
}
public Double getValoravista() {
return valoravista;
}
public void setValoravista(Double valoravista) {
this.valoravista = valoravista;
}
public Double getValoraprazo() {
return valoraprazo;
}
public void setValoraprazo(Double valoraprazo) {
this.valoraprazo = valoraprazo;
}
public Double getValortotal() {
return valortotal;
}
public void setValortotal(Double valortotal) {
this.valortotal = valortotal;
}
public String getNcm() {
return ncm;
}
public void setNcm(String ncm) {
this.ncm = ncm;
}
public String getClassificacaofiscal() {
return classificacaofiscal;
}
public void setClassificacaofiscal(String classificacaofiscal) {
this.classificacaofiscal = classificacaofiscal;
}
public String getSituacaotributaria() {
return situacaotributaria;
}
public void setSituacaotributaria(String situacaotributaria) {
this.situacaotributaria = situacaotributaria;
}
public Double getPerccomissao() {
return perccomissao;
}
public void setPerccomissao(Double perccomissao) {
this.perccomissao = perccomissao;
}
public Boolean getInativo() {
return inativo;
}
public void setInativo(Boolean inativo) {
this.inativo = inativo;
}
public Boolean getNaocomprar() {
return naocomprar;
}
public void setNaocomprar(Boolean naocomprar) {
this.naocomprar = naocomprar;
}
public Double getPesoliquidounitarioipi() {
return pesoliquidounitarioipi;
}
public void setPesoliquidounitarioipi(Double pesoliquidounitarioipi) {
this.pesoliquidounitarioipi = pesoliquidounitarioipi;
}
public Double getPesoliquidototalipi() {
return pesoliquidototalipi;
}
public void setPesoliquidototalipi(Double pesoliquidototalipi) {
this.pesoliquidototalipi = pesoliquidototalipi;
}
public Double getPesobrutototal() {
return pesobrutototal;
}
public void setPesobrutototal(Double pesobrutototal) {
this.pesobrutototal = pesobrutototal;
}
public Double getPesoliquidototal() {
return pesoliquidototal;
}
public void setPesoliquidototal(Double pesoliquidototal) {
this.pesoliquidototal = pesoliquidototal;
}
public Double getIpivenda() {
return ipivenda;
}
public void setIpivenda(Double ipivenda) {
this.ipivenda = ipivenda;
}
public Double getIpikg() {
return ipikg;
}
public void setIpikg(Double ipikg) {
this.ipikg = ipikg;
}
public String getImagem() {
return imagem;
}
public void setImagem(String imagem) {
this.imagem = imagem;
}
public String getTipoproduto() {
return tipoproduto;
}
public void setTipoproduto(String tipoproduto) {
this.tipoproduto = tipoproduto;
}
public String getObservacao() {
return observacao;
}
public void setObservacao(String observacao) {
this.observacao = observacao;
}
public Double getMvainterno() {
return mvainterno;
}
public void setMvainterno(Double mvainterno) {
this.mvainterno = mvainterno;
}
public Double getMvaexterno() {
return mvaexterno;
}
public void setMvaexterno(Double mvaexterno) {
this.mvaexterno = mvaexterno;
}
public Long getCodprodutosimilar() {
return codprodutosimilar;
}
public void setCodprodutosimilar(Long codprodutosimilar) {
this.codprodutosimilar = codprodutosimilar;
}
public String getNumerointernosimilar() {
return numerointernosimilar;
}
public void setNumerointernosimilar(String numerointernosimilar) {
this.numerointernosimilar = numerointernosimilar;
}
public String getIssqncodlistaservico() {
return issqncodlistaservico;
}
public void setIssqncodlistaservico(String issqncodlistaservico) {
this.issqncodlistaservico = issqncodlistaservico;
}
public String getIssqnsituacaotributaria() {
return issqnsituacaotributaria;
}
public void setIssqnsituacaotributaria(String issqnsituacaotributaria) {
this.issqnsituacaotributaria = issqnsituacaotributaria;
}
public String getSituacaotributariasaida() {
return situacaotributariasaida;
}
public void setSituacaotributariasaida(String situacaotributariasaida) {
this.situacaotributariasaida = situacaotributariasaida;
}
public String getCsosn() {
return csosn;
}
public void setCsosn(String csosn) {
this.csosn = csosn;
}
public String getCodipientrada() {
return codipientrada;
}
public void setCodipientrada(String codipientrada) {
this.codipientrada = codipientrada;
}
public String getCodipisaida() {
return codipisaida;
}
public void setCodipisaida(String codipisaida) {
this.codipisaida = codipisaida;
}
public String getCodpis() {
return codpis;
}
public void setCodpis(String codpis) {
this.codpis = codpis;
}
public Double getPercpis() {
return percpis;
}
public void setPercpis(Double percpis) {
this.percpis = percpis;
}
public Double getValorpisunitario() {
return valorpisunitario;
}
public void setValorpisunitario(Double valorpisunitario) {
this.valorpisunitario = valorpisunitario;
}
public String getCodcofins() {
return codcofins;
}
public void setCodcofins(String codcofins) {
this.codcofins = codcofins;
}
public Double getPerccofins() {
return perccofins;
}
public void setPerccofins(Double perccofins) {
this.perccofins = perccofins;
}
public Double getValorcofinsunitario() {
return valorcofinsunitario;
}
public void setValorcofinsunitario(Double valorcofinsunitario) {
this.valorcofinsunitario = valorcofinsunitario;
}
public String getCodpisentrada() {
return codpisentrada;
}
public void setCodpisentrada(String codpisentrada) {
this.codpisentrada = codpisentrada;
}
public String getCodcofinsentrada() {
return codcofinsentrada;
}
public void setCodcofinsentrada(String codcofinsentrada) {
this.codcofinsentrada = codcofinsentrada;
}
public Double getPercsubstituicao() {
return percsubstituicao;
}
public void setPercsubstituicao(Double percsubstituicao) {
this.percsubstituicao = percsubstituicao;
}
public String getCodexcecaoipi() {
return codexcecaoipi;
}
public void setCodexcecaoipi(String codexcecaoipi) {
this.codexcecaoipi = codexcecaoipi;
}
public String getClasseipi() {
return classeipi;
}
public void setClasseipi(String classeipi) {
this.classeipi = classeipi;
}
public String getCnpjipi() {
return cnpjipi;
}
public void setCnpjipi(String cnpjipi) {
this.cnpjipi = cnpjipi;
}
public String getCodseloipi() {
return codseloipi;
}
public void setCodseloipi(String codseloipi) {
this.codseloipi = codseloipi;
}
public Long getQuantidadeseloipi() {
return quantidadeseloipi;
}
public void setQuantidadeseloipi(Long quantidadeseloipi) {
this.quantidadeseloipi = quantidadeseloipi;
}
public String getCodenquandramentoipi() {
return codenquandramentoipi;
}
public void setCodenquandramentoipi(String codenquandramentoipi) {
this.codenquandramentoipi = codenquandramentoipi;
}
public String getInformacaoadicional() {
return informacaoadicional;
}
public void setInformacaoadicional(String informacaoadicional) {
this.informacaoadicional = informacaoadicional;
}
public Boolean getEmpromocao() {
return empromocao;
}
public void setEmpromocao(Boolean empromocao) {
this.empromocao = empromocao;
}
public Double getPercdescontopromocao() {
return percdescontopromocao;
}
public void setPercdescontopromocao(Double percdescontopromocao) {
this.percdescontopromocao = percdescontopromocao;
}
public Double getValordevendapromocao() {
return valordevendapromocao;
}
public void setValordevendapromocao(Double valordevendapromocao) {
this.valordevendapromocao = valordevendapromocao;
}
public Double getValorcofinsunitarioentrada() {
return valorcofinsunitarioentrada;
}
public void setValorcofinsunitarioentrada(Double valorcofinsunitarioentrada) {
this.valorcofinsunitarioentrada = valorcofinsunitarioentrada;
}
public Double getPerccofinsentrada() {
return perccofinsentrada;
}
public void setPerccofinsentrada(Double perccofinsentrada) {
this.perccofinsentrada = perccofinsentrada;
}
public Double getPercpisentrada() {
return percpisentrada;
}
public void setPercpisentrada(Double percpisentrada) {
this.percpisentrada = percpisentrada;
}
public Double getValorpisunitarioentrada() {
return valorpisunitarioentrada;
}
public void setValorpisunitarioentrada(Double valorpisunitarioentrada) {
this.valorpisunitarioentrada = valorpisunitarioentrada;
}
public Double getPercipientrada() {
return percipientrada;
}
public void setPercipientrada(Double percipientrada) {
this.percipientrada = percipientrada;
}
public Double getValoripiunitarioentrada() {
return valoripiunitarioentrada;
}
public void setValoripiunitarioentrada(Double valoripiunitarioentrada) {
this.valoripiunitarioentrada = valoripiunitarioentrada;
}
public String getCodtipo() {
return codtipo;
}
public void setCodtipo(String codtipo) {
this.codtipo = codtipo;
}
public String getLocaliza() {
return localiza;
}
public void setLocaliza(String localiza) {
this.localiza = localiza;
}
public Double getPercdescontoformulacao() {
return percdescontoformulacao;
}
public void setPercdescontoformulacao(Double percdescontoformulacao) {
this.percdescontoformulacao = percdescontoformulacao;
}
public Long getCodnaturezapadrao() {
return codnaturezapadrao;
}
public void setCodnaturezapadrao(Long codnaturezapadrao) {
this.codnaturezapadrao = codnaturezapadrao;
}
public Long getCodempresa() {
return codempresa;
}
public void setCodempresa(Long codempresa) {
this.codempresa = codempresa;
}
public String getIcmsvelho() {
return icmsvelho;
}
public void setIcmsvelho(String icmsvelho) {
this.icmsvelho = icmsvelho;
}
public Date getDatavalidade() {
return datavalidade;
}
public void setDatavalidade(Date datavalidade) {
this.datavalidade = datavalidade;
}
public String getCest() {
return cest;
}
public void setCest(String cest) {
this.cest = cest;
}
public String getOrigem() {
return origem;
}
public void setOrigem(String origem) {
this.origem = origem;
}
public String getOrigemgarden() {
return origemgarden;
}
public void setOrigemgarden(String origemgarden) {
this.origemgarden = origemgarden;
}
public String getCategoria() {
return categoria;
}
public void setCategoria(String categoria) {
this.categoria = categoria;
}
public String getCientifico() {
return cientifico;
}
public void setCientifico(String cientifico) {
this.cientifico = cientifico;
}
public String getAplicacaogarden() {
return aplicacaogarden;
}
public void setAplicacaogarden(String aplicacaogarden) {
this.aplicacaogarden = aplicacaogarden;
}
public String getCultivo() {
return cultivo;
}
public void setCultivo(String cultivo) {
this.cultivo = cultivo;
}
public Boolean getProdutocomposto() {
return produtocomposto;
}
public void setProdutocomposto(Boolean produtocomposto) {
this.produtocomposto = produtocomposto;
}
public Double getTotalcomposicao() {
return totalcomposicao;
}
public void setTotalcomposicao(Double totalcomposicao) {
this.totalcomposicao = totalcomposicao;
}
public Double getValorunitariosubstituicao() {
return valorunitariosubstituicao;
}
public void setValorunitariosubstituicao(Double valorunitariosubstituicao) {
this.valorunitariosubstituicao = valorunitariosubstituicao;
}
public Long getCodnotaentradacadastro() {
return codnotaentradacadastro;
}
public void setCodnotaentradacadastro(Long codnotaentradacadastro) {
this.codnotaentradacadastro = codnotaentradacadastro;
}
public Double getValordespesas() {
return valordespesas;
}
public void setValordespesas(Double valordespesas) {
this.valordespesas = valordespesas;
}
public String getChassi() {
return chassi;
}
public void setChassi(String chassi) {
this.chassi = chassi;
}
public Long getCodunidadetributavel() {
return codunidadetributavel;
}
public void setCodunidadetributavel(Long codunidadetributavel) {
this.codunidadetributavel = codunidadetributavel;
}
public Double getFatortributavel() {
return fatortributavel;
}
public void setFatortributavel(Double fatortributavel) {
this.fatortributavel = fatortributavel;
}
public String getCstconsumidorfinal() {
return cstconsumidorfinal;
}
public void setCstconsumidorfinal(String cstconsumidorfinal) {
this.cstconsumidorfinal = cstconsumidorfinal;
}
public String getCsosnconsumidorfinal() {
return csosnconsumidorfinal;
}
public void setCsosnconsumidorfinal(String csosnconsumidorfinal) {
this.csosnconsumidorfinal = csosnconsumidorfinal;
}
public String getExigibilidadeiss() {
return exigibilidadeiss;
}
public void setExigibilidadeiss(String exigibilidadeiss) {
this.exigibilidadeiss = exigibilidadeiss;
}
public Double getEfet_baseicmsstretido() {
return efet_baseicmsstretido;
}
public void setEfet_baseicmsstretido(Double efet_baseicmsstretido) {
this.efet_baseicmsstretido = efet_baseicmsstretido;
}
public Double getEfet_aliquotasuportada() {
return efet_aliquotasuportada;
}
public void setEfet_aliquotasuportada(Double efet_aliquotasuportada) {
this.efet_aliquotasuportada = efet_aliquotasuportada;
}
public Double getEfet_valoricmsstretido() {
return efet_valoricmsstretido;
}
public void setEfet_valoricmsstretido(Double efet_valoricmsstretido) {
this.efet_valoricmsstretido = efet_valoricmsstretido;
}
public Double getEfet_basefcpstretido() {
return efet_basefcpstretido;
}
public void setEfet_basefcpstretido(Double efet_basefcpstretido) {
this.efet_basefcpstretido = efet_basefcpstretido;
}
public Double getEfet_aliquotafcpretido() {
return efet_aliquotafcpretido;
}
public void setEfet_aliquotafcpretido(Double efet_aliquotafcpretido) {
this.efet_aliquotafcpretido = efet_aliquotafcpretido;
}
public Double getEfet_valorfcpstretido() {
return efet_valorfcpstretido;
}
public void setEfet_valorfcpstretido(Double efet_valorfcpstretido) {
this.efet_valorfcpstretido = efet_valorfcpstretido;
}
public String getInformacaoadicionalexterna() {
return informacaoadicionalexterna;
}
public void setInformacaoadicionalexterna(String informacaoadicionalexterna) {
this.informacaoadicionalexterna = informacaoadicionalexterna;
}
public Boolean getCestao() {
return cestao;
}
public void setCestao(Boolean cestao) {
this.cestao = cestao;
}
public Long getCodnaturezarevenda() {
return codnaturezarevenda;
}
public void setCodnaturezarevenda(Long codnaturezarevenda) {
this.codnaturezarevenda = codnaturezarevenda;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Produto)) return false;
Produto produto = (Produto) o;
return Objects.equals(getCodproduto(), produto.getCodproduto()) &&
Objects.equals(getNumerointerno(), produto.getNumerointerno()) &&
Objects.equals(getNumerofabricante(), produto.getNumerofabricante()) &&
Objects.equals(getNumeroean(), produto.getNumeroean()) &&
Objects.equals(getCodlocalizacao(), produto.getCodlocalizacao()) &&
Objects.equals(getCodgrupo(), produto.getCodgrupo()) &&
Objects.equals(getCodsubgrupo(), produto.getCodsubgrupo()) &&
Objects.equals(getCodfornecedorpadrao(), produto.getCodfornecedorpadrao()) &&
Objects.equals(getCodicmscupom(), produto.getCodicmscupom()) &&
Objects.equals(getCodicmsnotafiscal(), produto.getCodicmsnotafiscal()) &&
Objects.equals(getCodmarca(), produto.getCodmarca()) &&
Objects.equals(getCodcomposicao(), produto.getCodcomposicao()) &&
Objects.equals(getDescricao(), produto.getDescricao()) &&
Objects.equals(getDatacadastro(), produto.getDatacadastro()) &&
Objects.equals(getDatavenda(), produto.getDatavenda()) &&
Objects.equals(getDatacompra(), produto.getDatacompra()) &&
Objects.equals(getDataalteracao(), produto.getDataalteracao()) &&
Objects.equals(getAplicacao(), produto.getAplicacao()) &&
Objects.equals(getCodunidade(), produto.getCodunidade()) &&
Objects.equals(getCustoletra(), produto.getCustoletra()) &&
Objects.equals(getValorcompra(), produto.getValorcompra()) &&
Objects.equals(getValorcusto(), produto.getValorcusto()) &&
Objects.equals(getCustocomercializacaopercentual(), produto.getCustocomercializacaopercentual()) &&
Objects.equals(getCustovenda(), produto.getCustovenda()) &&
Objects.equals(getQuantidadeestoque(), produto.getQuantidadeestoque()) &&
Objects.equals(getQuantidademinima(), produto.getQuantidademinima()) &&
Objects.equals(getQuantidademaxima(), produto.getQuantidademaxima()) &&
Objects.equals(getFretevalor(), produto.getFretevalor()) &&
Objects.equals(getFretepercentual(), produto.getFretepercentual()) &&
Objects.equals(getDarf(), produto.getDarf()) &&
Objects.equals(getIcms(), produto.getIcms()) &&
Objects.equals(getIpi(), produto.getIpi()) &&
Objects.equals(getPercentualavista(), produto.getPercentualavista()) &&
Objects.equals(getPercentualaprazo(), produto.getPercentualaprazo()) &&
Objects.equals(getValoravista(), produto.getValoravista()) &&
Objects.equals(getValoraprazo(), produto.getValoraprazo()) &&
Objects.equals(getValortotal(), produto.getValortotal()) &&
Objects.equals(getNcm(), produto.getNcm()) &&
Objects.equals(getClassificacaofiscal(), produto.getClassificacaofiscal()) &&
Objects.equals(getSituacaotributaria(), produto.getSituacaotributaria()) &&
Objects.equals(getPerccomissao(), produto.getPerccomissao()) &&
Objects.equals(getInativo(), produto.getInativo()) &&
Objects.equals(getNaocomprar(), produto.getNaocomprar()) &&
Objects.equals(getPesoliquidounitarioipi(), produto.getPesoliquidounitarioipi()) &&
Objects.equals(getPesoliquidototalipi(), produto.getPesoliquidototalipi()) &&
Objects.equals(getPesobrutototal(), produto.getPesobrutototal()) &&
Objects.equals(getPesoliquidototal(), produto.getPesoliquidototal()) &&
Objects.equals(getIpivenda(), produto.getIpivenda()) &&
Objects.equals(getIpikg(), produto.getIpikg()) &&
Objects.equals(getImagem(), produto.getImagem()) &&
Objects.equals(getTipoproduto(), produto.getTipoproduto()) &&
Objects.equals(getObservacao(), produto.getObservacao()) &&
Objects.equals(getMvainterno(), produto.getMvainterno()) &&
Objects.equals(getMvaexterno(), produto.getMvaexterno()) &&
Objects.equals(getCodprodutosimilar(), produto.getCodprodutosimilar()) &&
Objects.equals(getNumerointernosimilar(), produto.getNumerointernosimilar()) &&
Objects.equals(getIssqncodlistaservico(), produto.getIssqncodlistaservico()) &&
Objects.equals(getIssqnsituacaotributaria(), produto.getIssqnsituacaotributaria()) &&
Objects.equals(getSituacaotributariasaida(), produto.getSituacaotributariasaida()) &&
Objects.equals(getCsosn(), produto.getCsosn()) &&
Objects.equals(getCodipientrada(), produto.getCodipientrada()) &&
Objects.equals(getCodipisaida(), produto.getCodipisaida()) &&
Objects.equals(getCodpis(), produto.getCodpis()) &&
Objects.equals(getPercpis(), produto.getPercpis()) &&
Objects.equals(getValorpisunitario(), produto.getValorpisunitario()) &&
Objects.equals(getCodcofins(), produto.getCodcofins()) &&
Objects.equals(getPerccofins(), produto.getPerccofins()) &&
Objects.equals(getValorcofinsunitario(), produto.getValorcofinsunitario()) &&
Objects.equals(getCodpisentrada(), produto.getCodpisentrada()) &&
Objects.equals(getCodcofinsentrada(), produto.getCodcofinsentrada()) &&
Objects.equals(getPercsubstituicao(), produto.getPercsubstituicao()) &&
Objects.equals(getCodexcecaoipi(), produto.getCodexcecaoipi()) &&
Objects.equals(getClasseipi(), produto.getClasseipi()) &&
Objects.equals(getCnpjipi(), produto.getCnpjipi()) &&
Objects.equals(getCodseloipi(), produto.getCodseloipi()) &&
Objects.equals(getQuantidadeseloipi(), produto.getQuantidadeseloipi()) &&
Objects.equals(getCodenquandramentoipi(), produto.getCodenquandramentoipi()) &&
Objects.equals(getInformacaoadicional(), produto.getInformacaoadicional()) &&
Objects.equals(getEmpromocao(), produto.getEmpromocao()) &&
Objects.equals(getPercdescontopromocao(), produto.getPercdescontopromocao()) &&
Objects.equals(getValordevendapromocao(), produto.getValordevendapromocao()) &&
Objects.equals(getValorcofinsunitarioentrada(), produto.getValorcofinsunitarioentrada()) &&
Objects.equals(getPerccofinsentrada(), produto.getPerccofinsentrada()) &&
Objects.equals(getPercpisentrada(), produto.getPercpisentrada()) &&
Objects.equals(getValorpisunitarioentrada(), produto.getValorpisunitarioentrada()) &&
Objects.equals(getPercipientrada(), produto.getPercipientrada()) &&
Objects.equals(getValoripiunitarioentrada(), produto.getValoripiunitarioentrada()) &&
Objects.equals(getCodtipo(), produto.getCodtipo()) &&
Objects.equals(getLocaliza(), produto.getLocaliza()) &&
Objects.equals(getPercdescontoformulacao(), produto.getPercdescontoformulacao()) &&
Objects.equals(getCodnaturezapadrao(), produto.getCodnaturezapadrao()) &&
Objects.equals(getCodempresa(), produto.getCodempresa()) &&
Objects.equals(getIcmsvelho(), produto.getIcmsvelho()) &&
Objects.equals(getDatavalidade(), produto.getDatavalidade()) &&
Objects.equals(getCest(), produto.getCest()) &&
Objects.equals(getOrigem(), produto.getOrigem()) &&
Objects.equals(getOrigemgarden(), produto.getOrigemgarden()) &&
Objects.equals(getCategoria(), produto.getCategoria()) &&
Objects.equals(getCientifico(), produto.getCientifico()) &&
Objects.equals(getAplicacaogarden(), produto.getAplicacaogarden()) &&
Objects.equals(getCultivo(), produto.getCultivo()) &&
Objects.equals(getProdutocomposto(), produto.getProdutocomposto()) &&
Objects.equals(getTotalcomposicao(), produto.getTotalcomposicao()) &&
Objects.equals(getValorunitariosubstituicao(), produto.getValorunitariosubstituicao()) &&
Objects.equals(getCodnotaentradacadastro(), produto.getCodnotaentradacadastro()) &&
Objects.equals(getValordespesas(), produto.getValordespesas()) &&
Objects.equals(getChassi(), produto.getChassi()) &&
Objects.equals(getCodunidadetributavel(), produto.getCodunidadetributavel()) &&
Objects.equals(getFatortributavel(), produto.getFatortributavel()) &&
Objects.equals(getCstconsumidorfinal(), produto.getCstconsumidorfinal()) &&
Objects.equals(getCsosnconsumidorfinal(), produto.getCsosnconsumidorfinal()) &&
Objects.equals(getExigibilidadeiss(), produto.getExigibilidadeiss()) &&
Objects.equals(getEfet_baseicmsstretido(), produto.getEfet_baseicmsstretido()) &&
Objects.equals(getEfet_aliquotasuportada(), produto.getEfet_aliquotasuportada()) &&
Objects.equals(getEfet_valoricmsstretido(), produto.getEfet_valoricmsstretido()) &&
Objects.equals(getEfet_basefcpstretido(), produto.getEfet_basefcpstretido()) &&
Objects.equals(getEfet_aliquotafcpretido(), produto.getEfet_aliquotafcpretido()) &&
Objects.equals(getEfet_valorfcpstretido(), produto.getEfet_valorfcpstretido()) &&
Objects.equals(getInformacaoadicionalexterna(), produto.getInformacaoadicionalexterna()) &&
Objects.equals(getCestao(), produto.getCestao()) &&
Objects.equals(getCodnaturezarevenda(), produto.getCodnaturezarevenda());
}
@Override
public int hashCode() {
return Objects.hash(getCodproduto(), getNumerointerno(), getNumerofabricante(), getNumeroean(), getCodlocalizacao(), getCodgrupo(), getCodsubgrupo(), getCodfornecedorpadrao(), getCodicmscupom(), getCodicmsnotafiscal(), getCodmarca(), getCodcomposicao(), getDescricao(), getDatacadastro(), getDatavenda(), getDatacompra(), getDataalteracao(), getAplicacao(), getCodunidade(), getCustoletra(), getValorcompra(), getValorcusto(), getCustocomercializacaopercentual(), getCustovenda(), getQuantidadeestoque(), getQuantidademinima(), getQuantidademaxima(), getFretevalor(), getFretepercentual(), getDarf(), getIcms(), getIpi(), getPercentualavista(), getPercentualaprazo(), getValoravista(), getValoraprazo(), getValortotal(), getNcm(), getClassificacaofiscal(), getSituacaotributaria(), getPerccomissao(), getInativo(), getNaocomprar(), getPesoliquidounitarioipi(), getPesoliquidototalipi(), getPesobrutototal(), getPesoliquidototal(), getIpivenda(), getIpikg(), getImagem(), getTipoproduto(), getObservacao(), getMvainterno(), getMvaexterno(), getCodprodutosimilar(), getNumerointernosimilar(), getIssqncodlistaservico(), getIssqnsituacaotributaria(), getSituacaotributariasaida(), getCsosn(), getCodipientrada(), getCodipisaida(), getCodpis(), getPercpis(), getValorpisunitario(), getCodcofins(), getPerccofins(), getValorcofinsunitario(), getCodpisentrada(), getCodcofinsentrada(), getPercsubstituicao(), getCodexcecaoipi(), getClasseipi(), getCnpjipi(), getCodseloipi(), getQuantidadeseloipi(), getCodenquandramentoipi(), getInformacaoadicional(), getEmpromocao(), getPercdescontopromocao(), getValordevendapromocao(), getValorcofinsunitarioentrada(), getPerccofinsentrada(), getPercpisentrada(), getValorpisunitarioentrada(), getPercipientrada(), getValoripiunitarioentrada(), getCodtipo(), getLocaliza(), getPercdescontoformulacao(), getCodnaturezapadrao(), getCodempresa(), getIcmsvelho(), getDatavalidade(), getCest(), getOrigem(), getOrigemgarden(), getCategoria(), getCientifico(), getAplicacaogarden(), getCultivo(), getProdutocomposto(), getTotalcomposicao(), getValorunitariosubstituicao(), getCodnotaentradacadastro(), getValordespesas(), getChassi(), getCodunidadetributavel(), getFatortributavel(), getCstconsumidorfinal(), getCsosnconsumidorfinal(), getExigibilidadeiss(), getEfet_baseicmsstretido(), getEfet_aliquotasuportada(), getEfet_valoricmsstretido(), getEfet_basefcpstretido(), getEfet_aliquotafcpretido(), getEfet_valorfcpstretido(), getInformacaoadicionalexterna(), getCestao(), getCodnaturezarevenda());
}
//FUNÇÕES DA CLASSE PRODUTO
@Override
public String toString() {
return codproduto + " - " + descricao;
}
public void removeProdutos(Context context) {
Banco myDb = new Banco(context);
SQLiteDatabase db = myDb.getReadableDatabase();
db.delete("produto", null, null);
}
public Cursor retornaProdutoFiltradaCursorSincro(SQLiteDatabase db, Long codProduto) {
Cursor cursor = db.rawQuery("SELECT codproduto FROM produto where codproduto = " + codProduto, null);
if (cursor.getCount() > 0) {
cursor.moveToFirst();
}
return cursor;
}
public Boolean cadastraProdutoSincro(SQLiteDatabase db, Produto produto) {
DadosBanco dadosBanco = new DadosBanco();
ContentValues valores = new ContentValues();
List<Field> fieldList = new ArrayList<>(Arrays.asList(produto.getClass().getDeclaredFields()));
for (int i = 0; fieldList.size() != i; i++) {
valores = dadosBanco.insereValoresContent(fieldList.get(i), produto, valores);
}
if (valores.containsKey("codproduto")) {
if (valores.get("codproduto") != null) {
Cursor cursor = produto.retornaProdutoFiltradaCursorSincro(db, Long.parseLong(valores.get("codproduto").toString()));
if (cursor.getCount() == 0) {
Long retorno = 0L;
valores.remove("cadastroandroid");
retorno = db.insert("produto", null, valores);
db.close();
valores.clear();
return retorno != -1;
} else {
valores.remove("alteradoandroid");
long retorno = db.update("produto", valores, "codproduto= " + valores.get("codproduto").toString(), null);
db.close();
valores.clear();
return retorno != -1;
}
} else {
return false;
}
} else {
return false;
}
}
public Cursor retornaProduto(Context context) {
Banco myDb = new Banco(context);
SQLiteDatabase db = myDb.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM produto", null);
if (cursor.getCount() > 0) {
cursor.moveToFirst();
}
//db.close();
return cursor;
}
public List<Produto> retornaListaProduto(Context context) {
Banco myDb = new Banco(context);
List<Produto> produtos = new ArrayList<>();
Produto produto = new Produto();
GetSetDinamico getSetDinamico = new GetSetDinamico();
SQLiteDatabase db = myDb.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM produto", null);
if (cursor.getCount() > 0) {
cursor.moveToFirst();
for (int i = 0; i < cursor.getCount(); i++) {
produto = new Produto();
produto = retornaProduto(context, cursor.getLong(cursor.getColumnIndex("codproduto")));
produtos.add(produto);
cursor.moveToNext();
}
}
return produtos;
}
public Produto retornaProduto(Context context, Long codproduto) {
Banco myDb = new Banco(context);
Produto produto = new Produto();
GetSetDinamico getSetDinamico = new GetSetDinamico();
SQLiteDatabase db = myDb.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT rowid _id,* FROM produto where codproduto = " + codproduto, null);
if (cursor.getCount() > 0) {
cursor.moveToFirst();
}
List<Field> fieldListCliente = new ArrayList<>(Arrays.asList(Produto.class.getDeclaredFields()));
for (int j = 0; cursor.getCount() != j; j++) {
for (int f = 0; fieldListCliente.size() != f; f++) {
String tipo = getSetDinamico.retornaTipoCampo(fieldListCliente.get(f));
String nomeCampo = fieldListCliente.get(f).getName().toLowerCase();
Object retorno = getSetDinamico.retornaValorCursor(tipo, nomeCampo, cursor);
if (retorno != null) {
Object retProduto = getSetDinamico.insereField(fieldListCliente.get(f), produto, retorno);
produto = (Produto) retProduto;
}
}
}
db.close();
return produto;
}
}
| [
"141865@upf.br"
] | 141865@upf.br |
662da2084a0844202681c3595f173d6b01af7edc | 503f639f973e24640f80697f04c9a85c34e896ec | /dotnet-api/src/main/java/consulo/dotnet/dll/DotNetModuleFileType.java | 5c3c04b1cbaa72525bba65afabe2edfa7ac48c8d | [
"Apache-2.0"
] | permissive | consulo/consulo-dotnet | da4c94aa61300ae3639bb8388890b685ed5627fd | d5efc8b23c36c21e65b3097996254993615080f6 | refs/heads/master | 2023-09-06T05:28:02.844201 | 2023-07-08T17:06:55 | 2023-07-08T17:06:55 | 14,622,200 | 21 | 4 | Apache-2.0 | 2023-01-01T16:41:06 | 2013-11-22T16:06:53 | Java | UTF-8 | Java | false | false | 1,705 | java | /*
* Copyright 2013-2014 must-be.org
*
* 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 consulo.dotnet.dll;
import consulo.localize.LocalizeValue;
import consulo.util.io.FileUtil;
import consulo.virtualFileSystem.VirtualFileManager;
import consulo.virtualFileSystem.archive.ArchiveFileType;
import javax.annotation.Nonnull;
/**
* @author VISTALL
* @since 28.11.13.
*/
public class DotNetModuleFileType extends ArchiveFileType
{
public static boolean isDllFile(@Nonnull String filePath)
{
return FileUtil.extensionEquals(filePath, ourExtension);
}
private static final String ourExtension = "dll";
public static final DotNetModuleFileType INSTANCE = new DotNetModuleFileType();
public static final String PROTOCOL = "netdll";
protected DotNetModuleFileType()
{
super(VirtualFileManager.getInstance());
}
@Nonnull
@Override
public String getProtocol()
{
return PROTOCOL;
}
@Nonnull
@Override
public LocalizeValue getDescription()
{
return LocalizeValue.localizeTODO(".NET libraries");
}
@Nonnull
@Override
public String getId()
{
return "DLL_ARCHIVE";
}
@Nonnull
@Override
public String getDefaultExtension()
{
return ourExtension;
}
}
| [
"vistall.valeriy@gmail.com"
] | vistall.valeriy@gmail.com |
7a26a285af46e2ef144524248cfea470c7944626 | a8ecf0e32b680a02866bb00534f9973593ca8aea | /src/main/java/com/yunding/answer/common/util/TokenUtil.java | 71f41d9408b178efc2945d47e6fac9894cf518ec | [] | no_license | 15383459000/ask_system | 701d8653fa566b6de043580df5c94e5e365b60e7 | a710d69c0778c4e03301c2b33b9d7fb94b05ef11 | refs/heads/master | 2022-10-20T13:02:48.551316 | 2020-03-28T15:46:33 | 2020-03-28T15:46:33 | 240,718,980 | 2 | 2 | null | 2022-10-12T20:37:59 | 2020-02-15T13:39:56 | Java | UTF-8 | Java | false | false | 1,270 | java | package com.yunding.answer.common.util;
import java.util.Random;
import java.util.UUID;
/**
* Token生成工具
*/
public class TokenUtil {
final static int RAND_UPPER = 0;
final static int RAND_LOWER = 1;
final static int RAND_RANGE = 2;
final static String TOKEN_PREFIX = "ANSWER";
private static Random random = new Random();
public static String genToken() {
String lowerCaseUUID = UUID.randomUUID().toString().replace("-", "").toLowerCase();
return TOKEN_PREFIX + randomLowerUpperCase(lowerCaseUUID);
}
private static String randomLowerUpperCase(String uuid) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < uuid.length(); i++) {
int rand = random.nextInt(RAND_RANGE);
if (rand == RAND_UPPER) {
stringBuilder.append(String.valueOf(uuid.charAt(i)).toUpperCase());
} else if (rand == RAND_LOWER) {
stringBuilder.append(String.valueOf(uuid.charAt(i)).toLowerCase());
}
}
return stringBuilder.toString();
}
public static void main(String[] args) {
String s = UUID.randomUUID().toString();
System.out.println(s.replace("-","").toLowerCase());
}
}
| [
"1062092416@qq.com"
] | 1062092416@qq.com |
f7176d0a845691c45a5a84637f058d3631d21ef8 | 0f55928c4cfa223f9a627e9b5dec6ca4dabac303 | /src/test/java/akka/HelloAkka2.java | d1ee3e94fb229901602a11bfe23c15064c58942a | [] | no_license | r13ljj/Z_JONEX | 3c0be2dd5dc6bd9ce8dbfece39d67960278dc40e | 4c9dde9ff6855f2b9ac00d66a5d16f02dc660859 | refs/heads/master | 2022-07-08T08:02:50.447283 | 2018-11-06T07:04:16 | 2018-11-06T07:04:16 | 9,805,434 | 0 | 0 | null | 2022-06-29T19:31:03 | 2013-05-02T04:04:35 | Java | UTF-8 | Java | false | false | 1,102 | java | package akka;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.UntypedActor;
public class HelloAkka2 {
public static void main(String[] argArr) {
ActorSystem systemObj = ActorSystem.create("helloAkka");
ActorRef actorRef = systemObj.actorOf(Props.create(Actor_Master.class));
actorRef.tell("hello Akka!", ActorRef.noSender());
}
}
class Actor_Master extends UntypedActor {
@Override
public void onReceive(Object objMsg) throws Exception {
// 注意 : 在这里创建另外一个 Actor,也就是 Actor_Slave
ActorRef slave = this.getContext().actorOf(Props.create(Actor_Slave.class));
slave.tell("go to work!", this.getSelf());
}
}
class Actor_Slave extends UntypedActor {
@Override
public void onReceive(Object objMsg) throws Exception {
if (objMsg.equals("go to work!")) {
// 只有收到 go to work! 这条消息时,
// 才输出 yes sir!
System.out.println("yes sir!");
}
}
} | [
"xubai@juanpi.com"
] | xubai@juanpi.com |
885315e3343b6e230b5ecd105eb5e2bdb0cccf56 | 37b6550e8196725dfc1dbecb0fbe09763f009480 | /sw2-core/src/main/java/com/luxsoft/sw3/maquila/model/EntradaDeMaterial.java | 2d3bed803ef9ea24fac6236cb1d012693bd35238 | [] | no_license | rcancino/sw2 | 9509e5e2060923e882cb341d4c987e6f6eade69d | 7d832ce1c28fdfb6efd21823411bae86d0cf2a91 | refs/heads/master | 2020-04-07T07:12:14.337028 | 2017-11-27T22:59:33 | 2017-11-27T22:59:33 | 14,619,759 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 7,623 | java | package com.luxsoft.sw3.maquila.model;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
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;
import javax.persistence.Version;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.Type;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import com.luxsoft.siipap.model.BaseBean;
import com.luxsoft.siipap.model.UserLog;
import com.luxsoft.sw3.model.AdressLog;
/**
* Esta es la entidad que representa el documento de Recepcion de Material
* La RecepcionDeMaterial agrupa una seria de entradas unitarias todas
* dirigidas al mismo almacen del maquilador
* Mantiene una relacion BIDIRECCIONAL 1-many con EntradaDeMaterial en lo que se conoce
* com relacion Padre-Hijo
*
* @author Ruben Cancino
*
*/
@Entity
@Table(name="SX_MAQ_ENTRADAS")
public class EntradaDeMaterial extends BaseBean{
@Id @GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "ENTRADA_ID")
private Long id;
@SuppressWarnings("unused")
@Version
private int version;
@ManyToOne(optional = false,
fetch=FetchType.EAGER)
@JoinColumn(name = "ALMACEN_ID", nullable = false,updatable=false)
@NotNull(message="El almacen es mandatorio")
private Almacen almacen;
@Column(name="ALMACEN_NOMBRE",nullable=false,updatable=false)
private String almacenNombre;
@Column(name="MAQUILADOR_NOMBRE",nullable=false,length=70)
private String maquiladorNombre;
@Column(name="ENTRADA_DE_MAQUILADOR",nullable=false,length=15)
@Length(max=15)
private String entradaDeMaquilador;
@Column(name="FECHA",nullable=false)
@Type(type="date")
private Date fecha=new Date();
@Column(name="FACTURA",length=40)
@Length(max=40)
private String factura;
@Column(name="FABRICANTE",length=70)
@Length(max=70)
private String fabricante;
@Column(name="OBSERVACIONES")
@Length(max=255)
private String observaciones;
@OneToMany(cascade={
CascadeType.PERSIST
,CascadeType.MERGE
,CascadeType.REMOVE
}
,fetch=FetchType.LAZY,mappedBy="recepcion")
@Cascade(value=org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private Set<EntradaDeMaterialDet> partidas=new HashSet<EntradaDeMaterialDet>();
@Embedded
@AttributeOverrides({
@AttributeOverride(name="createUser", column=@Column(name="CREADO_USR" ,nullable=true,insertable=true,updatable=false)),
@AttributeOverride(name="updateUser", column=@Column(name="MODIFICADO_USR",nullable=true,insertable=true,updatable=true)),
@AttributeOverride(name="creado", column=@Column(name="CREADO" ,nullable=true,insertable=true,updatable=false)),
@AttributeOverride(name="modificado", column=@Column(name="MODIFICADO" ,nullable=true,insertable=true,updatable=true))
})
private UserLog log=new UserLog();
@Embedded
@AttributeOverrides({
@AttributeOverride(name="createdIp", column=@Column(nullable=true,insertable=true,updatable=false)),
@AttributeOverride(name="updatedIp", column=@Column(nullable=true,insertable=true,updatable=true)),
@AttributeOverride(name="createdMac",column=@Column(nullable=true,insertable=true,updatable=false)),
@AttributeOverride(name="updatedMac",column=@Column(nullable=true,insertable=true,updatable=true))
})
private AdressLog addresLog=new AdressLog();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEntradaDeMaquilador() {
return entradaDeMaquilador;
}
public void setEntradaDeMaquilador(String entradaDeMaquilador) {
Object old=this.entradaDeMaquilador;
this.entradaDeMaquilador = entradaDeMaquilador;
firePropertyChange("entradaDeMaquilador", old, entradaDeMaquilador);
}
public Almacen getAlmacen() {
return almacen;
}
public void setAlmacen(Almacen almacen) {
Object old=this.almacen;
this.almacen = almacen;
firePropertyChange("almacen", old, almacen);
if(almacen!=null){
setAlmacenNombre(almacen.getNombre());
setMaquiladorNombre(almacen.getMaquilador().getNombre());
}else{
setAlmacen(null);
setMaquiladorNombre(null);
}
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
Object old=this.fecha;
this.fecha = fecha;
firePropertyChange("fecha", old, fecha);
}
public String getObservaciones() {
return observaciones;
}
public void setObservaciones(String observaciones) {
Object old=this.observaciones;
this.observaciones = observaciones;
firePropertyChange("observaciones", old, observaciones);
}
public String getFactura() {
return factura;
}
public void setFactura(String factura) {
this.factura = factura;
}
public String getFabricante() {
return fabricante;
}
public void setFabricante(String fabricante) {
Object old=this.fabricante;
this.fabricante = fabricante;
firePropertyChange("fabricante", old, fabricante);
}
public String getAlmacenNombre() {
return almacenNombre;
}
public void setAlmacenNombre(String almacenNombre) {
this.almacenNombre = almacenNombre;
}
public String getMaquiladorNombre() {
return maquiladorNombre;
}
public void setMaquiladorNombre(String maquiladorNombre) {
this.maquiladorNombre = maquiladorNombre;
}
public Set<EntradaDeMaterialDet> getPartidas() {
return partidas;
}
public boolean agregarEntrada(final EntradaDeMaterialDet e){
e.setRecepcion(this);
return partidas.add(e);
}
public boolean eliminarEntrada(final EntradaDeMaterialDet det){
det.setRecepcion(null);
return partidas.remove(det);
}
public boolean tieneCortes(){
return CollectionUtils.exists(getPartidas(),new Predicate(){
public boolean evaluate(Object object) {
EntradaDeMaterialDet em=(EntradaDeMaterialDet)object;
return em.isCortado();
}
});
}
public UserLog getLog() {
return log;
}
public void setLog(UserLog log) {
this.log = log;
}
public AdressLog getAddresLog() {
return addresLog;
}
public void setAddresLog(AdressLog addresLog) {
this.addresLog = addresLog;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.SHORT_PREFIX_STYLE)
.append(getId())
.toString();
}
@Override
public boolean equals(Object obj) {
if(obj==null)return false;
if(obj==this)return true;
EntradaDeMaterial r=(EntradaDeMaterial)obj;
return new EqualsBuilder()
.append(getId(),r.getId())
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17,35)
.append(getId())
.toHashCode();
}
}
| [
"rubencancino6@gmail.com"
] | rubencancino6@gmail.com |
b53eda354a218d7e01279ae2b7c3e9af0087f559 | 3d3da5067cc635c371a9b111332128cf659ad27d | /src/main/java/com/talentfootpoint/talentfootpoint/util/ImageUtils.java | aa02322f4a58441d0713a60f6792ab64a23b61f4 | [] | no_license | lisubin/talentfootpoint | 826444f0abcef7657a386681e5b17c8b4687c4bc | 6a80df6c2f90a59ecd31f744f4506f55e994753b | refs/heads/master | 2022-07-18T12:39:36.418481 | 2019-11-27T09:30:58 | 2019-11-27T09:30:58 | 222,381,613 | 0 | 0 | null | 2022-06-17T02:42:48 | 2019-11-18T06:48:41 | Java | UTF-8 | Java | false | false | 7,120 | java | package com.talentfootpoint.talentfootpoint.util;
import com.talentfootpoint.talentfootpoint.exception.BaseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayList;
/***
* 对图片进行操作
*
* @author xiezg
* @since 2011/7/29
*
*/
public class ImageUtils {
public static final Logger log = LoggerFactory.getLogger(ImageUtils.class);
private static ImageUtils imageHelper = null;
public static ImageUtils getImageUtils() {
if (imageHelper == null) {
imageHelper = new ImageUtils();
}
return imageHelper;
}
/***
* 按指定的比例缩放图片
*
* @param sourceImagePath
* 源地址
* @param destinationPath
* 改变大小后图片的地址
* @param scale
* 缩放比例,如1.2
*/
public static void scaleImage(String sourceImagePath,
String destinationPath, double scale,String format) {
File file = new File(sourceImagePath);
BufferedImage bufferedImage;
try {
bufferedImage = ImageIO.read(file);
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
width = parseDoubleToInt(width * scale);
height = parseDoubleToInt(height * scale);
Image image = bufferedImage.getScaledInstance(width, height,
Image.SCALE_SMOOTH);
BufferedImage outputImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics graphics = outputImage.getGraphics();
graphics.drawImage(image, 0, 0, null);
graphics.dispose();
ImageIO.write(outputImage, format, new File(destinationPath));
} catch (IOException e) {
System.out.println("scaleImage方法压缩图片时出错了");
e.printStackTrace();
}
}
/***
* 将图片缩放到指定的高度或者宽度
* @param sourceImagePath 图片源地址
* @param destinationPath 压缩完图片的地址
* @param width 缩放后的宽度
* @param height 缩放后的高度
* @param auto 是否自动保持图片的原高宽比例
* @param format 图图片格式 例如 jpg
*/
public static void scaleImageWithParams(String sourceImagePath,
String destinationPath, int width, int height, boolean auto,String format) {
try {
File file = new File(sourceImagePath);
BufferedImage bufferedImage = null;
bufferedImage = ImageIO.read(file);
if (auto) {
ArrayList<Integer> paramsArrayList = getAutoWidthAndHeight(bufferedImage,width,height);
width = paramsArrayList.get(0);
height = paramsArrayList.get(1);
System.out.println("自动调整比例,width="+width+" height="+height);
}
Image image = bufferedImage.getScaledInstance(width, height,
Image.SCALE_DEFAULT);
BufferedImage outputImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics graphics = outputImage.getGraphics();
graphics.drawImage(image, 0, 0, null);
graphics.dispose();
ImageIO.write(outputImage, format, new File(destinationPath));
} catch (Exception e) {
System.out.println("scaleImageWithParams方法压缩图片时出错了");
e.printStackTrace();
}
}
/***
* 将图片缩放到指定的高度或者宽度
* @param sourceImagePath 图片源地址
* @param destinationPath 压缩完图片的地址
* @param width 缩放后的宽度
* @param height 缩放后的高度
* @param auto 是否自动保持图片的原高宽比例
* @param format 图图片格式 例如 jpg
*/
public static void scaleImageWithParams(InputStream inputStream,
String destinationPath, int width, int height, boolean auto,String format) throws BaseException{
try {
BufferedImage bufferedImage = null;
bufferedImage = ImageIO.read(inputStream);
if (auto) {
ArrayList<Integer> paramsArrayList = getAutoWidthAndHeight(bufferedImage,width,height);
width = paramsArrayList.get(0);
height = paramsArrayList.get(1);
System.out.println("自动调整比例,width="+width+" height="+height);
}
Image image = bufferedImage.getScaledInstance(width, height,
Image.SCALE_DEFAULT);
BufferedImage outputImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics graphics = outputImage.getGraphics();
graphics.drawImage(image, 0, 0, null);
graphics.dispose();
ImageIO.write(outputImage, format, new File(destinationPath));
} catch (Exception e) {
log.error(e.getMessage(), e.getCause());
throw new BaseException("图片压缩出现异常,请联系客服。", e.getCause());
}
}
/**
* 将double类型的数据转换为int,四舍五入原则
*
* @param sourceDouble
* @return
*/
private static int parseDoubleToInt(double sourceDouble) {
int result = 0;
result = (int) sourceDouble;
return result;
}
/***
*
* @param bufferedImage 要缩放的图片对象
* @param width_scale 要缩放到的宽度
* @param height_scale 要缩放到的高度
* @return 一个集合,第一个元素为宽度,第二个元素为高度
*/
private static ArrayList<Integer> getAutoWidthAndHeight(BufferedImage bufferedImage,int width_scale,int height_scale){
ArrayList<Integer> arrayList = new ArrayList<Integer>();
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
double scale_w =getDot2Decimal( width_scale,width);
System.out.println("getAutoWidthAndHeight width="+width + "scale_w="+scale_w);
double scale_h = getDot2Decimal(height_scale,height);
if (scale_w<scale_h) {
arrayList.add(parseDoubleToInt(scale_w*width));
arrayList.add(parseDoubleToInt(scale_w*height));
}
else {
arrayList.add(parseDoubleToInt(scale_h*width));
arrayList.add(parseDoubleToInt(scale_h*height));
}
return arrayList;
}
/***
* 返回两个数a/b的小数点后三位的表示
* @param a
* @param b
* @return
*/
public static double getDot2Decimal(int a,int b){
BigDecimal bigDecimal_1 = new BigDecimal(a);
BigDecimal bigDecimal_2 = new BigDecimal(b);
BigDecimal bigDecimal_result = bigDecimal_1.divide(bigDecimal_2,new MathContext(4));
Double double1 = new Double(bigDecimal_result.toString());
System.out.println("相除后的double为:"+double1);
return double1;
}
public static void resizeImage(InputStream is, OutputStream os, int size, String format) throws IOException {
BufferedImage prevImage = ImageIO.read(is);
double width = prevImage.getWidth();
double height = prevImage.getHeight();
double percent = size/width;
int newWidth = (int)(width * percent);
int newHeight = (int)(height * percent);
BufferedImage image = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_BGR);
Graphics graphics = image.createGraphics();
graphics.drawImage(prevImage, 0, 0, newWidth, newHeight, null);
ImageIO.write(image, format, os);
os.flush();
is.close();
os.close();
}
}
| [
"2464009416@qq.com"
] | 2464009416@qq.com |
11f016f2b5a5ab8d336bddb33175abf14d92d826 | 054afa271137f4352122320cf76e513f58413a66 | /ESM/src/com/rmrdigitalmedia/esm/models/EntrypointChecklistAuditTable.java | 171844e05a4813363a0f3eaa78ca316aa1049ef9 | [] | no_license | rmanleyreeve/esm | 2043c076b05867ec63b2bbbe946813f2a29c4e07 | 22eab488c6a850e2479f52e0bb692bed92d7358d | refs/heads/master | 2022-12-18T12:23:23.625695 | 2018-05-03T15:15:01 | 2018-05-03T15:15:01 | 294,141,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,563 | java | package com.rmrdigitalmedia.esm.models ;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import com.javaranch.common.Str;
import com.javaranch.db.DBResults;
import com.javaranch.db.TableFacade;
/** Strongly typed access to the database table "ENTRYPOINT_CHECKLIST_AUDIT".
*
* This source file was automatically generated by "Jenny the db code generator"
* based on information found in the database. Do not modify this file!
*
* For more information on Jenny, see http://www.javaranch.com/jenny.jsp
*
*
* Most of the methods are static so you don't need to instantiate a copy of this class
* to do your work. The primary access methods are:
* <ul>
*
* <b>getRow()/getRows()/getAllRows()</b><br>
* <b>search() </b><i>like getRows(), but you can specify which columns you want back</i><br>
* <b>update()</b><br>
* <b>delete()</b><br>
* <b>insert()</b><br>
*
* </ul>
*
* These methods all have the option of passing in a connection as the first parameter.
* Usually you won't use a connection directly, but sometimes it's useful.
*
* The getRows() methods all return an array of Row objects or a single Row object. The
* row object is easy to work with and provides strong type checking. If your table has
* a lot of columns, and your search will return a lot of rows, you might want to consider
* using a search() method instead. You lose some of your strong type checking, but
* you might go a lot easier on memory. In these cases, you will want to make sure you
* use the column name constants found at the top of this class.
*
*/
public class EntrypointChecklistAuditTable
{
private static Implementation imp = new Implementation();
public static final String tableName = "ENTRYPOINT_CHECKLIST_AUDIT";
public static final String idColumnName = "ID";
public static final String entrypointIDColumnName = "ENTRYPOINT_ID";
public static final String q1ValueColumnName = "Q1_VALUE";
public static final String q1CommentsColumnName = "Q1_COMMENTS";
public static final String q2BooleanColumnName = "Q2_BOOLEAN";
public static final String q2CommentsColumnName = "Q2_COMMENTS";
public static final String q3BooleanColumnName = "Q3_BOOLEAN";
public static final String q3CommentsColumnName = "Q3_COMMENTS";
public static final String q4ValueColumnName = "Q4_VALUE";
public static final String q4CommentsColumnName = "Q4_COMMENTS";
public static final String q5DimsHColumnName = "Q5_DIMS_H";
public static final String q5DimsWColumnName = "Q5_DIMS_W";
public static final String q5CommentsColumnName = "Q5_COMMENTS";
public static final String q6BooleanColumnName = "Q6_BOOLEAN";
public static final String q6CommentsColumnName = "Q6_COMMENTS";
public static final String q7ValueColumnName = "Q7_VALUE";
public static final String q7CommentsColumnName = "Q7_COMMENTS";
public static final String q8BooleanColumnName = "Q8_BOOLEAN";
public static final String q8CommentsColumnName = "Q8_COMMENTS";
public static final String q9BooleanColumnName = "Q9_BOOLEAN";
public static final String q9CommentsColumnName = "Q9_COMMENTS";
public static final String q10BooleanColumnName = "Q10_BOOLEAN";
public static final String q10CommentsColumnName = "Q10_COMMENTS";
public static final String q11BooleanColumnName = "Q11_BOOLEAN";
public static final String q11CommentsColumnName = "Q11_COMMENTS";
public static final String q12BooleanColumnName = "Q12_BOOLEAN";
public static final String q12CommentsColumnName = "Q12_COMMENTS";
public static final String q13BooleanColumnName = "Q13_BOOLEAN";
public static final String q13CommentsColumnName = "Q13_COMMENTS";
public static final String q14BooleanColumnName = "Q14_BOOLEAN";
public static final String q14CommentsColumnName = "Q14_COMMENTS";
public static final String q15BooleanColumnName = "Q15_BOOLEAN";
public static final String q15CommentsColumnName = "Q15_COMMENTS";
public static final String q16BooleanColumnName = "Q16_BOOLEAN";
public static final String q16CommentsColumnName = "Q16_COMMENTS";
private static String[] allColumns =
{
idColumnName , entrypointIDColumnName , q1ValueColumnName , q1CommentsColumnName , q2BooleanColumnName , q2CommentsColumnName , q3BooleanColumnName , q3CommentsColumnName , q4ValueColumnName , q4CommentsColumnName , q5DimsHColumnName , q5DimsWColumnName , q5CommentsColumnName , q6BooleanColumnName , q6CommentsColumnName , q7ValueColumnName , q7CommentsColumnName , q8BooleanColumnName , q8CommentsColumnName , q9BooleanColumnName , q9CommentsColumnName , q10BooleanColumnName , q10CommentsColumnName , q11BooleanColumnName , q11CommentsColumnName , q12BooleanColumnName , q12CommentsColumnName , q13BooleanColumnName , q13CommentsColumnName , q14BooleanColumnName , q14CommentsColumnName , q15BooleanColumnName , q15CommentsColumnName , q16BooleanColumnName , q16CommentsColumnName ,
};
/** You probably want to use the static methods for most of your access, but once in a while you might need to
* pass an instance object to a method that knows how to work with these sorts of tables.
*/
public static Implementation getInstance()
{
return imp ;
}
/** For use by unit testing, although you could provide your own implementation here if
* you wanted to.
*
* To use this in your unit testing, create an instance of MockEntrypointChecklistAuditTable and pass
* it in here. Then set your mock return values, call the method you are testing and examine
* the mock values that are now set!
*/
public static void setInstance( EntrypointChecklistAuditTable.Implementation instance )
{
imp = instance ;
}
/** Exposed for unit testing purposes only! */
static class Implementation extends TableFacade
{
/** Exposed for unit testing purposes only! */
Implementation()
{
super( EsmFacade.getInstance() , tableName );
}
// convert a DBResults object to an array of Row objects.
// requires that all of the columns be represented in the DBResults object and in the right order
private static Row[] rowArray( DBResults r )
{
Row[] rows = new Row[ r.size() ];
for( int i = 0 ; i < rows.length ; i++ )
{
rows[ i ] = new Row( r.getRow( i ) );
}
return rows ;
}
/** Instantiate an empty Row object */
public Row getRow()
{
// if you are wondering about why this method is so lame - it's for unit testing!
// The idea is that during unit testing, a different test object will be returned here.
// To learn more about unit testing with Jenny generated code, visit <a href="http://www.javaranch.com/jenny.jsp">www.javaranch.com/jenny.jsp</a>
return new Row();
}
/** Instantiate a Row object and fill its content based on a search for the ID.
*
* Return null if not found. Return first item if more than one found.
*/
public Row getRow( Connection con , int id ) throws SQLException
{
Row row = new Row( this.search( con , "ID" , String.valueOf( id ) , allColumns ) );
return row.dataLoadedFromDatabase() ? row : null ;
}
/** Instantiate a Row object and fill its content based on a search for the ID.
*
* Return null if not found.
*/
public Row getRow( long id ) throws SQLException
{
Row row = new Row( this.search( "ID" , String.valueOf( id ) , allColumns ) );
return row.dataLoadedFromDatabase() ? row : null ;
}
/** Instantiate a Row object and fill its content based on a search
*
* Return null if not found.
*/
public Row getRow( Connection con , String column , String searchText ) throws SQLException
{
Row row = new Row( this.search( con , column , searchText , allColumns ) );
return row.dataLoadedFromDatabase() ? row : null ;
}
/** Instantiate a Row object and fill its content based on a search
*
* Return null if not found.
*/
public Row getRow( String column , String searchText ) throws SQLException
{
Row row = new Row( this.search( column , searchText , allColumns ) );
return row.dataLoadedFromDatabase() ? row : null ;
}
/** Return an array of length zero if nothing found */
public Row[] getRows( Connection con , String column , String searchText ) throws SQLException
{
return rowArray( this.search( con , column , searchText , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getRows( String column , String searchText ) throws SQLException
{
return rowArray( this.search( column , searchText , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getRows( Connection con , String column , String[] searchText ) throws SQLException
{
return rowArray( this.search( con , column , searchText , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getRows( String column , String[] searchText ) throws SQLException
{
return rowArray( this.search( column , searchText , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getRows( Connection con , String whereClause ) throws SQLException
{
return rowArray( this.search( con , whereClause , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getRows( String whereClause ) throws SQLException
{
return rowArray( this.search( whereClause , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getAllRows( Connection con ) throws SQLException
{
return rowArray( this.search( con , allColumns ) );
}
/** Return an array of length zero if nothing found */
public Row[] getAllRows() throws SQLException
{
return rowArray( this.search( allColumns ) );
}
public void update( Connection con , int id , Map data ) throws SQLException
{
this.update( con , "ID" , String.valueOf( id ) , data );
}
public void update( int id , Map data ) throws SQLException
{
this.update( "ID" , String.valueOf( id ) , data );
}
public void delete( Connection con , long id ) throws SQLException
{
this.delete( con , "ID" , String.valueOf( id ) );
}
public void delete( long id ) throws SQLException
{
this.delete( "ID" , String.valueOf( id ) );
}
public long insertAndGetID( Connection con , Map data ) throws SQLException
{
return this.insertAndGetID( con , data , "ID" );
}
public long insertAndGetID( Map data ) throws SQLException
{
return this.insertAndGetID( data , "ID" );
}
}
public static class Row
{
private boolean dataLoadedFromDatabase = false ;
private int id ;
private int entrypointID ;
private String q1Value ;
private String q1Comments ;
private String q2Boolean ;
private String q2Comments ;
private String q3Boolean ;
private String q3Comments ;
private String q4Value ;
private String q4Comments ;
private String q5DimsH ;
private String q5DimsW ;
private String q5Comments ;
private String q6Boolean ;
private String q6Comments ;
private String q7Value ;
private String q7Comments ;
private String q8Boolean ;
private String q8Comments ;
private String q9Boolean ;
private String q9Comments ;
private String q10Boolean ;
private String q10Comments ;
private String q11Boolean ;
private String q11Comments ;
private String q12Boolean ;
private String q12Comments ;
private String q13Boolean ;
private String q13Comments ;
private String q14Boolean ;
private String q14Comments ;
private String q15Boolean ;
private String q15Comments ;
private String q16Boolean ;
private String q16Comments ;
/** for internal use only! If you need a row object, use getRow(). */
Row()
{
}
private Row( String[] data )
{
if ( data != null )
{
this.id = Str.toInt( data[0] );
this.entrypointID = Str.toInt( data[1] );
this.q1Value = data[2];
this.q1Comments = data[3];
this.q2Boolean = data[4];
this.q2Comments = data[5];
this.q3Boolean = data[6];
this.q3Comments = data[7];
this.q4Value = data[8];
this.q4Comments = data[9];
this.q5DimsH = data[10];
this.q5DimsW = data[11];
this.q5Comments = data[12];
this.q6Boolean = data[13];
this.q6Comments = data[14];
this.q7Value = data[15];
this.q7Comments = data[16];
this.q8Boolean = data[17];
this.q8Comments = data[18];
this.q9Boolean = data[19];
this.q9Comments = data[20];
this.q10Boolean = data[21];
this.q10Comments = data[22];
this.q11Boolean = data[23];
this.q11Comments = data[24];
this.q12Boolean = data[25];
this.q12Comments = data[26];
this.q13Boolean = data[27];
this.q13Comments = data[28];
this.q14Boolean = data[29];
this.q14Comments = data[30];
this.q15Boolean = data[31];
this.q15Comments = data[32];
this.q16Boolean = data[33];
this.q16Comments = data[34];
dataLoadedFromDatabase = true ;
}
}
private Row( DBResults results )
{
this( results.getRow(0) );
}
public int getID()
{
return id ;
}
public void setID( int id )
{
this.id = id ;
}
public int getEntrypointID()
{
return entrypointID ;
}
public void setEntrypointID( int entrypointID )
{
this.entrypointID = entrypointID ;
}
public String getQ1Value()
{
return q1Value ;
}
public void setQ1Value( String q1Value )
{
this.q1Value = q1Value ;
}
public String getQ1Comments()
{
return q1Comments ;
}
public void setQ1Comments( String q1Comments )
{
this.q1Comments = q1Comments ;
}
public String getQ2Boolean()
{
return q2Boolean ;
}
public void setQ2Boolean( String q2Boolean )
{
this.q2Boolean = q2Boolean ;
}
public String getQ2Comments()
{
return q2Comments ;
}
public void setQ2Comments( String q2Comments )
{
this.q2Comments = q2Comments ;
}
public String getQ3Boolean()
{
return q3Boolean ;
}
public void setQ3Boolean( String q3Boolean )
{
this.q3Boolean = q3Boolean ;
}
public String getQ3Comments()
{
return q3Comments ;
}
public void setQ3Comments( String q3Comments )
{
this.q3Comments = q3Comments ;
}
public String getQ4Value()
{
return q4Value ;
}
public void setQ4Value( String q4Value )
{
this.q4Value = q4Value ;
}
public String getQ4Comments()
{
return q4Comments ;
}
public void setQ4Comments( String q4Comments )
{
this.q4Comments = q4Comments ;
}
public String getQ5DimsH()
{
return q5DimsH ;
}
public void setQ5DimsH( String q5DimsH )
{
this.q5DimsH = q5DimsH ;
}
public String getQ5DimsW()
{
return q5DimsW ;
}
public void setQ5DimsW( String q5DimsW )
{
this.q5DimsW = q5DimsW ;
}
public String getQ5Comments()
{
return q5Comments ;
}
public void setQ5Comments( String q5Comments )
{
this.q5Comments = q5Comments ;
}
public String getQ6Boolean()
{
return q6Boolean ;
}
public void setQ6Boolean( String q6Boolean )
{
this.q6Boolean = q6Boolean ;
}
public String getQ6Comments()
{
return q6Comments ;
}
public void setQ6Comments( String q6Comments )
{
this.q6Comments = q6Comments ;
}
public String getQ7Value()
{
return q7Value ;
}
public void setQ7Value( String q7Value )
{
this.q7Value = q7Value ;
}
public String getQ7Comments()
{
return q7Comments ;
}
public void setQ7Comments( String q7Comments )
{
this.q7Comments = q7Comments ;
}
public String getQ8Boolean()
{
return q8Boolean ;
}
public void setQ8Boolean( String q8Boolean )
{
this.q8Boolean = q8Boolean ;
}
public String getQ8Comments()
{
return q8Comments ;
}
public void setQ8Comments( String q8Comments )
{
this.q8Comments = q8Comments ;
}
public String getQ9Boolean()
{
return q9Boolean ;
}
public void setQ9Boolean( String q9Boolean )
{
this.q9Boolean = q9Boolean ;
}
public String getQ9Comments()
{
return q9Comments ;
}
public void setQ9Comments( String q9Comments )
{
this.q9Comments = q9Comments ;
}
public String getQ10Boolean()
{
return q10Boolean ;
}
public void setQ10Boolean( String q10Boolean )
{
this.q10Boolean = q10Boolean ;
}
public String getQ10Comments()
{
return q10Comments ;
}
public void setQ10Comments( String q10Comments )
{
this.q10Comments = q10Comments ;
}
public String getQ11Boolean()
{
return q11Boolean ;
}
public void setQ11Boolean( String q11Boolean )
{
this.q11Boolean = q11Boolean ;
}
public String getQ11Comments()
{
return q11Comments ;
}
public void setQ11Comments( String q11Comments )
{
this.q11Comments = q11Comments ;
}
public String getQ12Boolean()
{
return q12Boolean ;
}
public void setQ12Boolean( String q12Boolean )
{
this.q12Boolean = q12Boolean ;
}
public String getQ12Comments()
{
return q12Comments ;
}
public void setQ12Comments( String q12Comments )
{
this.q12Comments = q12Comments ;
}
public String getQ13Boolean()
{
return q13Boolean ;
}
public void setQ13Boolean( String q13Boolean )
{
this.q13Boolean = q13Boolean ;
}
public String getQ13Comments()
{
return q13Comments ;
}
public void setQ13Comments( String q13Comments )
{
this.q13Comments = q13Comments ;
}
public String getQ14Boolean()
{
return q14Boolean ;
}
public void setQ14Boolean( String q14Boolean )
{
this.q14Boolean = q14Boolean ;
}
public String getQ14Comments()
{
return q14Comments ;
}
public void setQ14Comments( String q14Comments )
{
this.q14Comments = q14Comments ;
}
public String getQ15Boolean()
{
return q15Boolean ;
}
public void setQ15Boolean( String q15Boolean )
{
this.q15Boolean = q15Boolean ;
}
public String getQ15Comments()
{
return q15Comments ;
}
public void setQ15Comments( String q15Comments )
{
this.q15Comments = q15Comments ;
}
public String getQ16Boolean()
{
return q16Boolean ;
}
public void setQ16Boolean( String q16Boolean )
{
this.q16Boolean = q16Boolean ;
}
public String getQ16Comments()
{
return q16Comments ;
}
public void setQ16Comments( String q16Comments )
{
this.q16Comments = q16Comments ;
}
private boolean dataLoadedFromDatabase()
{
return dataLoadedFromDatabase ;
}
private Map buildDataMap()
{
Map data = new HashMap();
data.put( idColumnName , String.valueOf( this.id ) );
data.put( entrypointIDColumnName , String.valueOf( this.entrypointID ) );
data.put( q1ValueColumnName , this.q1Value );
data.put( q1CommentsColumnName , this.q1Comments );
data.put( q2BooleanColumnName , this.q2Boolean );
data.put( q2CommentsColumnName , this.q2Comments );
data.put( q3BooleanColumnName , this.q3Boolean );
data.put( q3CommentsColumnName , this.q3Comments );
data.put( q4ValueColumnName , this.q4Value );
data.put( q4CommentsColumnName , this.q4Comments );
data.put( q5DimsHColumnName , this.q5DimsH );
data.put( q5DimsWColumnName , this.q5DimsW );
data.put( q5CommentsColumnName , this.q5Comments );
data.put( q6BooleanColumnName , this.q6Boolean );
data.put( q6CommentsColumnName , this.q6Comments );
data.put( q7ValueColumnName , this.q7Value );
data.put( q7CommentsColumnName , this.q7Comments );
data.put( q8BooleanColumnName , this.q8Boolean );
data.put( q8CommentsColumnName , this.q8Comments );
data.put( q9BooleanColumnName , this.q9Boolean );
data.put( q9CommentsColumnName , this.q9Comments );
data.put( q10BooleanColumnName , this.q10Boolean );
data.put( q10CommentsColumnName , this.q10Comments );
data.put( q11BooleanColumnName , this.q11Boolean );
data.put( q11CommentsColumnName , this.q11Comments );
data.put( q12BooleanColumnName , this.q12Boolean );
data.put( q12CommentsColumnName , this.q12Comments );
data.put( q13BooleanColumnName , this.q13Boolean );
data.put( q13CommentsColumnName , this.q13Comments );
data.put( q14BooleanColumnName , this.q14Boolean );
data.put( q14CommentsColumnName , this.q14Comments );
data.put( q15BooleanColumnName , this.q15Boolean );
data.put( q15CommentsColumnName , this.q15Comments );
data.put( q16BooleanColumnName , this.q16Boolean );
data.put( q16CommentsColumnName , this.q16Comments );
return data ;
}
/** update a row object based on a search */
public void update( Connection con , String column , String searchText ) throws SQLException
{
imp.update( con , column , searchText , buildDataMap() );
}
/** update a row object based on a search */
public void update( String column , String searchText ) throws SQLException
{
imp.update( column , searchText , buildDataMap() );
}
/** update a row object based on the id */
public void update( Connection con ) throws SQLException
{
imp.update( con , id , buildDataMap() );
}
/** update a row object based on the id */
public void update() throws SQLException
{
imp.update( id , buildDataMap() );
}
/** create a new row complete with a new ID.
The current ID is ignored. The new ID is placed in the row.
@return the new row ID
*/
public long insert( Connection con ) throws SQLException
{
return imp.insertAndGetID( con , buildDataMap() );
}
/** create a new row complete with a new ID.
The current ID is ignored. The new ID is placed in the row.
@return the new row ID
*/
public long insert() throws SQLException
{
return imp.insertAndGetID( buildDataMap() );
}
/** delete a row object based on the id */
public void delete( Connection con ) throws SQLException
{
imp.delete( con , id );
}
/** delete a row object based on the id */
public void delete() throws SQLException
{
imp.delete( id );
}
}
/** Return an empty row object */
public static Row getRow()
{
return imp.getRow();
}
/** Instantiate a Row object and fill its content based on a search for the ID.
*
* Return null if not found.
*/
public static Row getRow( Connection con , int id ) throws SQLException
{
return imp.getRow( con , id );
}
/** Instantiate a Row object and fill its content based on a search for the ID.
*
* Return null if not found.
*/
public static Row getRow( long id ) throws SQLException
{
return imp.getRow( id );
}
/** Instantiate a Row object and fill its content based on a search
*
* Return null if not found.
*/
public static Row getRow( Connection con , String column , String searchText ) throws SQLException
{
return imp.getRow( con , column , searchText );
}
/** Instantiate a Row object and fill its content based on a search
*
* Return null if not found.
*/
public static Row getRow( String column , String searchText ) throws SQLException
{
return imp.getRow( column , searchText );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( Connection con , String column , String searchText ) throws SQLException
{
return imp.getRows( con , column , searchText );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( String column , String searchText ) throws SQLException
{
return imp.getRows( column , searchText );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( Connection con , String column , String[] searchText ) throws SQLException
{
return imp.getRows( con , column , searchText );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( String column , String[] searchText ) throws SQLException
{
return imp.getRows( column , searchText );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( Connection con , String column , int searchValue ) throws SQLException
{
return imp.getRows( con , column , String.valueOf( searchValue ) );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( String column , int searchValue ) throws SQLException
{
return imp.getRows( column , String.valueOf( searchValue ) );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( Connection con , String column , int[] searchValues ) throws SQLException
{
return imp.getRows( con , column , Str.toStringArray( searchValues ) );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( String column , int[] searchValues ) throws SQLException
{
return imp.getRows( column , Str.toStringArray( searchValues ) );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( Connection con , String whereClause ) throws SQLException
{
return imp.getRows( con , whereClause );
}
/** Return an array of length zero if nothing found */
public static Row[] getRows( String whereClause ) throws SQLException
{
return imp.getRows( whereClause );
}
/** Return an array of length zero if nothing found */
public static Row[] getAllRows( Connection con ) throws SQLException
{
return imp.getAllRows( con );
}
/** Return an array of length zero if nothing found */
public static Row[] getAllRows() throws SQLException
{
return imp.getAllRows();
}
public static DBResults search( Connection con , String column , String searchText , String[] dataColumns ) throws SQLException
{
return imp.search( con , column , searchText , dataColumns );
}
public static DBResults search( String column , String searchText , String[] dataColumns ) throws SQLException
{
return imp.search( column , searchText , dataColumns );
}
public static DBResults search( Connection con , String column , String[] searchText , String[] dataColumns ) throws SQLException
{
return imp.search( con , column , searchText , dataColumns );
}
public static DBResults search( String column , String searchText[] , String[] dataColumns ) throws SQLException
{
return imp.search( column , searchText , dataColumns );
}
public static DBResults search( Connection con , String column , int searchValue , String[] dataColumns ) throws SQLException
{
return imp.search( con , column , searchValue , dataColumns );
}
public static DBResults search( String column , int searchValue , String[] dataColumns ) throws SQLException
{
return imp.search( column , searchValue , dataColumns );
}
public static DBResults search( Connection con , String column , int[] searchValues , String[] dataColumns ) throws SQLException
{
return imp.search( con , column , searchValues , dataColumns );
}
public static DBResults search( String column , int[] searchValues , String[] dataColumns ) throws SQLException
{
return imp.search( column , searchValues , dataColumns );
}
public static DBResults search( Connection con , String whereClause , String[] dataColumns ) throws SQLException
{
return imp.search( con , whereClause , dataColumns );
}
public static DBResults search( String whereClause , String[] dataColumns ) throws SQLException
{
return imp.search( whereClause , dataColumns );
}
public static DBResults search( Connection con , String[] dataColumns ) throws SQLException
{
return imp.search( con , dataColumns );
}
public static DBResults search( String[] dataColumns ) throws SQLException
{
return imp.search( dataColumns );
}
public static void update( Connection con , String column , String searchText , Map data ) throws SQLException
{
imp.update( con , column , searchText , data );
}
public static void update( String column , String searchText , Map data ) throws SQLException
{
imp.update( column , searchText , data );
}
public static void delete( Connection con , long id ) throws SQLException
{
imp.delete( con , id );
}
public static void delete( long id ) throws SQLException
{
imp.delete( id );
}
public static void delete( Connection con , String column , String searchText ) throws SQLException
{
imp.delete( con , column , searchText );
}
public static void delete( String column , String searchText ) throws SQLException
{
imp.delete( column , searchText );
}
public static long insert( Connection con , Map data ) throws SQLException
{
return imp.insertAndGetID( con , data );
}
public static long insert( Map data ) throws SQLException
{
return imp.insertAndGetID( data );
}
}
| [
"rich@rmrdigitalmedia.co.uk"
] | rich@rmrdigitalmedia.co.uk |
8548a9a618e74815c47cf2e947d6a7177731d842 | 989099f4b4de704b658060f1572014f68ad2c4c5 | /app/src/main/java/com/example/xadp5/ps2g_app/NewProject.java | 88d3239d51a0f4ac42ef633d1a7fce47de6d71c8 | [] | no_license | xavier-pena/PS2G | 11a828db63a791cfcd98638bbec84007b656e185 | 63f091eb466c262fcfd2ec97c1ea2caffb2db0dd | refs/heads/master | 2021-07-10T10:12:49.502956 | 2017-10-13T16:46:57 | 2017-10-13T16:46:57 | 106,849,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.example.xadp5.ps2g_app;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class NewProject extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_project);
}
}
| [
"you@example.com"
] | you@example.com |
b5d6c7a82bc49f5cf8228b10b88696e4bde03f10 | db0b1d5e0f34d588b268f0f7765db3e747021560 | /Hash/Programmers_전화번호목록.java | f70008d357cccbcac233b0004fe49629f8a0edd0 | [] | no_license | yelimi/algorithm | ea597be60029165641930fe88655fda3114b0a3f | 45df05867024dcddc3dc9c4e3cf88c3aea4592f8 | refs/heads/master | 2022-06-21T23:39:01.922874 | 2022-05-29T16:48:37 | 2022-05-29T16:48:37 | 225,543,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | import java.util.*;
class Solution {
public boolean solution(String[] phone_book) {
boolean answer = true;
int index = 1;
HashMap<String, Integer> map = new HashMap();
for(int i=0;i<phone_book.length;i++)
map.put(phone_book[i], index);
for(int i=0;i<phone_book.length;i++){
for(int j=1;j<phone_book[i].length();j++){
if(map.containsKey(phone_book[i].substring(0, j)))
answer = false;
}
}
return answer;
}
}
| [
"laura0319@hanmail.net"
] | laura0319@hanmail.net |
223036896990562b484baf29934ad869667d181c | 0d4e5b0d5a16eb93ea1fe6cc0f96eaa52acf57da | /model/src/main/java/com/grotto/grotto/model/homeImpl/ProductBrandsHomeImp.java | 6cf55dfb13ed1acae0c629568db02c753c31e26d | [] | no_license | Grotto-ITI/grotto-web | f8df68937e909dbf5fa8fd34969f3e8fe61a4e8a | 4e1993a9db7c5e6deee50d7093f1c835dcadb2a6 | refs/heads/master | 2021-01-01T15:44:22.509010 | 2015-05-04T19:35:07 | 2015-05-04T19:35:07 | 34,942,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | 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 com.grotto.grotto.model.homeImpl;
import com.grotto.grotto.model.home.AbstractDaoInt;
//import dao.AbstractDaoImp;
import java.io.Serializable;
import com.grotto.grotto.model.home.pojo.ProductBrands;
/**
*
* @author Mostafa_ITI
*/
public class ProductBrandsHomeImp extends AbstractDaoImp<ProductBrands, Integer> implements AbstractDaoInt<ProductBrands, Integer> {
public ProductBrandsHomeImp() {
super(ProductBrands.class);
}
}
| [
"dina.abdelbadea2@gmail.com"
] | dina.abdelbadea2@gmail.com |
d84d09464d0685dd6887f4d72fa51820014b02b6 | d280c25deaac65b7f665149286e93d4b937f0668 | /L13/src/main/java/ru/otus/spring/petrova/repository/AuthorRepository.java | 929625ac275b13b5fe57a204587267a1cc7ff2ee | [] | no_license | iriss22/2020-02-otus-spring-petrova | 2de50bb66cdbc41fdf3f2c928224f66b577618af | 6f6d14d119ed3de01983fcc3f237f2602087a320 | refs/heads/master | 2022-09-26T02:36:25.726328 | 2020-08-17T16:24:27 | 2020-08-17T16:24:27 | 244,465,140 | 0 | 0 | null | 2022-09-08T01:13:30 | 2020-03-02T20:11:05 | Java | UTF-8 | Java | false | false | 309 | java | package ru.otus.spring.petrova.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import ru.otus.spring.petrova.domain.Author;
import java.util.Optional;
public interface AuthorRepository extends MongoRepository<Author, String> {
Optional<Author> findByName(String name);
}
| [
"iraloseva@bk.ru"
] | iraloseva@bk.ru |
868d2512285a30dc82a44c91284b2529c545a486 | b6e75064a215e49fec179b0be4bb11a12ea87938 | /src/org/ctp/enchantmentsolution/advancements/Rewards.java | 738932337f78800f2692efd3afa1a8ef45dfbcfc | [] | no_license | DXUltimate/EnchantmentSolution | 92d653657d2647cb38c007cc3109a22a01e84954 | ad638663f00e0f34f320faa22b8625fed1f4fee8 | refs/heads/master | 2022-11-28T06:42:26.015066 | 2020-08-11T18:10:24 | 2020-08-11T19:27:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,965 | java | package org.ctp.enchantmentsolution.advancements;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import org.ctp.enchantmentsolution.advancements.util.JsonBuilder;
import org.ctp.enchantmentsolution.advancements.util.Validator;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.libs.jline.internal.Nullable;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
/**
* Specifies rewards which are given when the advancement is completed.
*/
public class Rewards {
private static final Type NAMESPACED_KEY_SET_TYPE = new TypeToken<Set<NamespacedKey>>() {}.getType();
private @Nullable Set<NamespacedKey> recipes = null;
private @Nullable Set<NamespacedKey> loots = null;
private int experience = 0;
private @Nullable NamespacedKey function = null;
/**
* @return the id of the recipes which will unlock upon completion of the
* advancement
*/
public Set<NamespacedKey> getRecipes() {
return recipes == null ? Collections.emptySet() : Collections.unmodifiableSet(recipes);
}
/**
* @return the id of the loot tables from all of which items will be given upon
* completion of the advancement
*/
public Set<NamespacedKey> getLoots() {
return loots == null ? Collections.emptySet() : Collections.unmodifiableSet(loots);
}
/**
* @return the amount of experience which will be given upon completion of the
* advancement
*/
public int getExperience() {
return experience;
}
/**
* @return the id of the function which will run upon completion of the
* advancement
*/
public @Nullable NamespacedKey getFunction() {
return function;
}
/**
* @param experience
* the amount of experience which should be given upon completion of
* the advancement
* @return the current rewards object for chaining
*/
public Rewards setExperience(int experience) {
Validator.zeroToDisable(experience);
this.experience = experience;
return this;
}
/**
* @return the JSON representation of the reward object
*/
JsonObject toJson() {
return new JsonBuilder().add("recipes", recipes, NAMESPACED_KEY_SET_TYPE).add("loot", loots, NAMESPACED_KEY_SET_TYPE).addPositive("experience", experience).add("function", function).build();
}
/**
* @return the hash code of this rewards object
*/
@Override
public int hashCode() {
return Objects.hash(recipes, loots, experience, function);
}
/**
* @param object
* the reference object with which to compare
* @return whether this object has the same content as the passed parameter
*/
@Override
public boolean equals(Object object) {
if (!(object instanceof Rewards)) return false;
Rewards rew = (Rewards) object;
return Objects.equals(rew.recipes, recipes) && Objects.equals(rew.loots, loots) && Objects.equals(rew.experience, experience) && Objects.equals(rew.function, function);
}
}
| [
"laytfire2@gmail.com"
] | laytfire2@gmail.com |
cfc009dcd94efedb23179f9d0e872409dd21c66f | 769bacaf2a6c5386f974cacee9fce5a214af9cca | /src/com/andrejlatys/GameBoardTileType.java | 9d70689e71d798c1ee4868843efe42cac9e83271 | [] | no_license | lotro13/SNAKE_GAME_OOP | 1806676cec441bf8e5baf13805a937eb95fa0579 | 56829fc7ab4bb3136019e0f026a4bf65338faa6e | refs/heads/master | 2022-12-29T08:51:43.218275 | 2020-10-19T21:03:12 | 2020-10-19T21:03:12 | 305,511,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package com.andrejlatys;
public enum GameBoardTileType {
EMPTY,
SNAKE,
HEAD,
FOOD
}
| [
"lotro5676@gmail.com"
] | lotro5676@gmail.com |
75451d4d80d7ce91f93949a6610ebf43f5994ee9 | e03f6cfe026fd76080888086f3b1e0601ab6495e | /src/test/java/org/jose4j/jwk/OctJwkGeneratorTest.java | 20102311a78f0e1626c787f623231e40c31ec280 | [
"Apache-2.0"
] | permissive | srikaharit/jose4j | 275f0de2a2532dd7a6aefdc5d4fcc48c9bc58b1b | 4795f7638b10ea1261a0dbb28c0d2bd617ab9429 | refs/heads/master | 2020-11-26T02:23:02.541792 | 2017-01-24T13:11:12 | 2017-01-24T13:11:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,202 | java | /*
* Copyright 2012-2016 Brian Campbell
*
* 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.jose4j.jwk;
import junit.framework.TestCase;
import org.jose4j.lang.ByteUtil;
import javax.crypto.SecretKey;
/**
*/
public class OctJwkGeneratorTest extends TestCase
{
public void testGen()
{
for (int size : new int[]{128, 192, 256, 192, 384, 512})
{
OctetSequenceJsonWebKey jsonWebKey = OctJwkGenerator.generateJwk(size);
assertNotNull(jsonWebKey.getKey());
assertTrue(jsonWebKey.getKey() instanceof SecretKey);
assertEquals(ByteUtil.byteLength(size), jsonWebKey.getOctetSequence().length);
}
}
}
| [
"brian.d.campbell@gmail.com"
] | brian.d.campbell@gmail.com |
3180574aa8a88ec321b0eb3856b6589c22cb8497 | a2e7850aa588184581220f23b856ae2ec08a72e4 | /src/main/java/co/castle/action/vkiller/ItemBreakBible.java | 0c2628165aa5e63020c5671940f7a2c4b0aaddaf | [] | no_license | Andres6936/Castlevania-Roguelike | ab837b34c27f0cef09ab55348284d44c9012baa2 | 44947bd59213727e100829f170de1a56a934fc06 | refs/heads/master | 2022-05-03T22:21:06.856855 | 2022-04-08T00:28:36 | 2022-04-08T00:28:36 | 166,899,772 | 8 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,279 | java | package co.castle.action.vkiller;
import co.castle.action.BeamProjectileSkill;
import co.castle.player.Player;
public class ItemBreakBible extends BeamProjectileSkill
{
public boolean allowsSelfTarget( )
{
return false;
}
public int getCost( )
{
Player p = (Player) performer;
return (int) ( p.getCastCost( ) * 1.1 );
}
public int getDamage( )
{
return 7 + getPlayer( ).getShotLevel( ) + getPlayer( ).getSoulPower( ) * 2;
}
public int getHeartCost( )
{
return 2;
}
public int getHit( )
{
return 100;
}
public String getID( )
{
return "ItemBreakBible";
}
public int getPathType( )
{
return PATH_LINEAR;
}
public String getPromptPosition( )
{
return "Where?";
}
public int getRange( )
{
return 15;
}
public String getSelfTargettedMessage( )
{
return "The fireball flies to the heavens";
}
public String getSFX( )
{
return "wav/fire.wav";
}
public String getSFXID( )
{
return "SFX_ITEMBREAKBIBLE";
}
public String getShootMessage( )
{
return "The bible opens and shreds a beam of light!";
}
public String getSpellAttackDesc( )
{
return "beam of light";
}
public boolean piercesThru( )
{
return true;
}
} | [
"noreply@github.com"
] | noreply@github.com |
220515f2ee2fe8b83080f7be0b2d9aea816fe4ed | 79570cb10aad807590bac4ad42f00f0c03c0155d | /chapter_002/src/test/java/ru/job4j/pojo/LicenseTest.java | 4272e48f7261f1a82963f82e358a6a429163a5b1 | [] | no_license | ForLearningAtJob4J/job4j | 1a3fbca55ac67963abc8998685e0cf36e7c262e9 | 83bbc14f2c8cd9063e73848b2ffe804ab1e851d9 | refs/heads/master | 2021-06-05T20:12:07.633631 | 2021-05-24T06:41:43 | 2021-05-24T06:41:43 | 144,977,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package ru.job4j.pojo;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class LicenseTest {
@Test
public void eqName() {
License first = new License();
first.setCode("audio");
License second = new License();
second.setCode("audio");
assertThat(first, is(second));
}
}
| [
"youcanwriteme@yandex.ru"
] | youcanwriteme@yandex.ru |
d041e4b3a2664efd13a56b77927e5c308e41dfeb | e0f48724a662a62aed451dc04477401f4b5a53ef | /JavaRushTasks/3.JavaMultithreading/src/com/javarush/task/task25/task2509/SocketTask.java | 5a15f7d509a5b876e3359ce0e95281c444e7eed6 | [] | no_license | egorw/java_rush_project | 09554b4fec84baaa5f39c88dca440c5065a30568 | 768d91e813247bf427363575026c68c65361304f | refs/heads/master | 2020-03-25T06:58:11.768532 | 2018-08-04T14:12:52 | 2018-08-04T14:12:52 | 143,534,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package com.javarush.task.task25.task2509;
import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;
public abstract class SocketTask<T> implements CancellableTask<T> {
private Socket socket;
protected synchronized void setSocket(Socket socket) {
this.socket = socket;
}
public synchronized void cancel() {
//close all resources here
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public RunnableFuture<T> newTask() {
return new FutureTask<T>(this) {
public boolean cancel(boolean mayInterruptIfRunning) {
//close all resources here by using proper SocketTask method
//call super-class method in finally block
try {
socket.close();
} catch (IOException ignored) {
} finally {
super.cancel(mayInterruptIfRunning);
}
return false;
}
};
}
} | [
"egor.w869@gmail.com"
] | egor.w869@gmail.com |
1341dc6ac350fcc4831ac91ffc317bc912534612 | a27fd987fb8ce6caddfb4106b97f31564726ec5b | /code/app/src/main/java/com/example/bhaskar/locationtest/MainActivity.java | b7cbaa074530b94c4497a8bef1be51fb422ddcd9 | [] | no_license | bhaskargurram/mcc-project | aec373861d158f1bba92037b965a9501bbd50418 | ba2c968e394532a5c08790e2f84ca364fb8691a3 | refs/heads/master | 2020-04-28T01:30:38.527775 | 2015-05-19T02:01:57 | 2015-05-19T02:01:57 | 35,377,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,489 | java | package com.example.bhaskar.locationtest;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class MainActivity extends ActionBarActivity implements
ConnectionCallbacks, OnConnectionFailedListener {
protected static final String TAG = "basic-location-sample";
private float totalwalk;
protected GoogleApiClient mGoogleApiClient;
GoogleMap googleMap;
Marker TP;
protected Location mLastLocation;
private SharedPreferences preference;
private final String PrefTAG = "LocationTest";
private final String ArrayTAG = "LocationArray";
private final String DataTAG = "Walked";
Polyline line;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
preference = getSharedPreferences(PrefTAG, MODE_PRIVATE);
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
googleMap.setBuildingsEnabled(true);
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
startService(new Intent(getBaseContext(), MainService.class));
//--------------------------------------------------------------------------------------------------
// The minimum time (in miliseconds) the system will wait until checking if the location changed
int minTime = 5000;
// The minimum distance (in meters) traveled until you will be notified
float minDistance = 7;
// Create a new instance of the location listener
MyLocationListener myLocListener = new MyLocationListener();
// Get the location manager from the system
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// Get the criteria you would like to use
Criteria criteria = new Criteria();
criteria.setPowerRequirement(Criteria.POWER_LOW);
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setSpeedRequired(false);
// Get the best provider from the criteria specified, and false to say it can turn the provider on if it isn't already
String bestProvider = locationManager.getBestProvider(criteria, false);
// Request location updates
locationManager.requestLocationUpdates(bestProvider, minTime, minDistance, myLocListener);
//--------------------------------------------------------------------------------------------------
buildGoogleApiClient();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);//Menu Resource, Menu
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.walkdata:
putDistance();
totalwalk = preference.getFloat(DataTAG, 0f);
Toast.makeText(getApplicationContext(), "Total distance travelled is " + totalwalk + " meters", Toast.LENGTH_SHORT).show();
break;
case R.id.clear:
SharedPreferences.Editor editor = preference.edit();
editor.remove(ArrayTAG);
editor.remove(DataTAG);
editor.commit();
line.remove();
Toast.makeText(getApplicationContext(), "Data Cleared", Toast.LENGTH_SHORT).show();
break;
case R.id.refresh:
locate();
plotroute();
Toast.makeText(getApplicationContext(), "Refreshed", Toast.LENGTH_SHORT).show();
break;
}
return true;
}
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
if (mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect();
}
}
/**
* Runs when a GoogleApiClient object successfully connects.
*/
@Override
public void onConnected(Bundle connectionHint) {
// Provides a simple way of getting a device's location and is well suited for
// applications that do not require a fine-grained location and that do not need location
// updates. Gets the best and most recent location currently available, which may be null
// in rare cases when a location is not available.
locate();
}
public void locate() {
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if (mLastLocation != null) {
final LatLng pos = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude());
if (TP != null)
TP.remove();
TP = googleMap.addMarker(new MarkerOptions().position(pos).title(
"Latitude:" + mLastLocation.getLatitude() + "\nLongitude:" + mLastLocation.getLongitude()));
final CameraPosition cameraPosition = new CameraPosition.Builder()
.target(pos) // Sets the center of the map to my coordinates
.zoom(18) // Sets the zoom
.bearing(180) // Sets the orientation of the camera to south
.tilt(30) // Sets the tilt of the camera to 30 degrees
.build();
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
Set<String> set = preference.getStringSet(ArrayTAG, null);
if (set == null) {
set = new HashSet<String>();
}
String locationToAdd = mLastLocation.getLatitude() + "," + mLastLocation.getLongitude();
set.add(locationToAdd);
plotroute();
}
}, 2000);
} else {
Toast.makeText(this, "No location detected", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onConnectionFailed(ConnectionResult result) {
// Refer to the javadoc for ConnectionResult to see what error codes might be returned in
// onConnectionFailed.
Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = " + result.getErrorCode());
}
public void plotroute() {
Set<String> set = preference.getStringSet(ArrayTAG, null);
PolylineOptions options = new PolylineOptions();
options.color(Color.RED);
options.width(5);
if (set != null) {
Iterator iterator = set.iterator();
while (iterator.hasNext()) {
String data = (String) iterator.next();
String[] array = data.split(",");
LatLng latlng = new LatLng(Double.parseDouble(array[0]), Double.parseDouble(array[1]));
options.add(latlng);
}
}
if (line != null) {
line.remove();
}
line = googleMap.addPolyline(options);
}
public void putDistance() {
totalwalk = 0;
Set<String> set = preference.getStringSet(ArrayTAG, null);
if (set != null) {
Iterator iterator = set.iterator();
float length = 0f;
String prev = "";
if (iterator.hasNext()) {
prev = (String) iterator.next();
// Toast.makeText(getApplicationContext(),prev,Toast.LENGTH_LONG).show();
}
while (iterator.hasNext()) {
String current = (String) iterator.next();
//Toast.makeText(getApplicationContext(),current,Toast.LENGTH_LONG).show();
String[] currentarray = current.split(",");
String[] prevarray = prev.split(",");
Double prevlat = Double.parseDouble(prevarray[0]);
Double prevlon = Double.parseDouble(prevarray[1]);
Double currlat = Double.parseDouble(currentarray[0]);
Double currlon = Double.parseDouble(currentarray[1]);
Location locationA = new Location("point A");
locationA.setLatitude(prevlat);
locationA.setLongitude(prevlon);
Location locationB = new Location("point B");
locationB.setLatitude(currlat);
locationB.setLongitude(currlon);
float distance = locationA.distanceTo(locationB);
totalwalk += distance;
prev = current;
}
SharedPreferences.Editor editor = preference.edit();
editor.putFloat(DataTAG, totalwalk);
editor.commit();
}
}
@Override
public void onConnectionSuspended(int cause) {
// The connection to Google Play services was lost for some reason. We call connect() to
// attempt to re-establish the connection.
Log.i(TAG, "Connection suspended");
mGoogleApiClient.connect();
}
private class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
if (loc != null) {
Set<String> set = preference.getStringSet(ArrayTAG, null);
if (set == null) {
set = new HashSet<String>();
}
String locationToAdd = loc.getLatitude() + "," + loc.getLongitude();
set.add(locationToAdd);
SharedPreferences.Editor editor = preference.edit();
editor.putStringSet(ArrayTAG, set);
editor.commit();
Toast.makeText(getApplicationContext(), "LocationUpdated", Toast.LENGTH_LONG).show();
locate();
plotroute();
// Do something knowing the location changed by the distance you requested
}
}
@Override
public void onProviderDisabled(String arg0) {
// Do something here if you would like to know when the provider is disabled by the user
}
@Override
public void onProviderEnabled(String arg0) {
// Do something here if you would like to know when the provider is enabled by the user
}
@Override
public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
// Do something here if you would like to know when the provider status changes
}
}
} | [
"bhaskargurram2000@gmail.com"
] | bhaskargurram2000@gmail.com |
d977ce1d6d3aa5212156367e7b812128e7f0de52 | 3393b36fe734d6467c5d142f226e3dd962e50e49 | /springcloud/cloud2020/seata-account-service2003/src/main/java/com/huiyalinalibaba/domain/Account.java | 3a0e984744cb9ce3d9d9cb633b2c5733de7acb4a | [] | no_license | huiyalin525/huiyalin | 22d45b95c45d0ee0501e3e3b857a5982236f83cc | 037750bd2ead2f0e25ee68689a3143db22e3ebfa | refs/heads/master | 2022-12-21T06:20:55.536320 | 2020-04-22T06:34:19 | 2020-04-22T06:34:19 | 223,343,207 | 0 | 0 | null | 2022-12-16T15:26:20 | 2019-11-22T06:59:49 | Java | UTF-8 | Java | false | false | 368 | java | package com.huiyalinalibaba.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Account {
private Long id;
private Long userId;
private BigDecimal total;
private BigDecimal used;
private BigDecimal residue;
}
| [
"1404225646@qq.com"
] | 1404225646@qq.com |
00f141d5b8dc919928bc8f7316bb46f4c2c1ac23 | 9d6f2dc5f13e67aafdac745b3c30cc560688a0d9 | /kkangs_android_2019-master/AndroidLab/part3_8/src/main/java/com/example/part3_8/RealmReadActivity.java | 33b7b588851cbffa2624c4242b1b460bd9eb86c2 | [] | no_license | innurman/books | 6c533c6b5feb1c357714790221b8ac4e98bdb13e | eabfb5f51039812add1a62a205ef867807f5995f | refs/heads/master | 2022-07-28T01:39:25.958023 | 2020-05-18T13:12:21 | 2020-05-18T13:12:21 | 264,923,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package com.example.part3_8;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import io.realm.Realm;
/**
* Created by kkang
* 깡샘의 안드로이드 프로그래밍 - 루비페이퍼
* 위의 교제에 담겨져 있는 코드로 설명 및 활용 방법은 교제를 확인해 주세요.
*/
public class RealmReadActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_realm_read);
TextView titleView=findViewById(R.id.realm_read_title);
TextView contentView=findViewById(R.id.realm_read_content);
Intent intent=getIntent();
String title=intent.getStringExtra("title");
Realm mRealm=Realm.getDefaultInstance();
MemoVO vo=mRealm.where(MemoVO.class).equalTo("title", title).findFirst();
titleView.setText(vo.title);
contentView.setText(vo.content);
}
}
| [
"innurman@gmail.com"
] | innurman@gmail.com |
c7d7218d5cd84366714c0469a2bab380b7255f54 | 429116960d5f5bb9f09d9f2de9c48daf6603752f | /designpattern/chain/src/main/java/com/iluwatar/chain/RequestType.java | 2c9a2c239ef91d5340ade8d14e52319a5e764bdf | [
"MIT"
] | permissive | rogeryumnam/jse-examples | 7f8840441632fe112727bf1ce40f395bfecacaa9 | 604fd924818c492a0690858c28ca39711b43ec16 | refs/heads/master | 2021-01-13T02:30:48.313243 | 2016-12-05T14:34:46 | 2016-12-05T14:34:46 | 81,535,442 | 0 | 2 | null | 2017-02-10T06:43:15 | 2017-02-10T06:43:15 | null | UTF-8 | Java | false | false | 108 | java | package com.iluwatar.chain;
public enum RequestType {
DEFEND_CASTLE, TORTURE_PRISONER, COLLECT_TAX
}
| [
"himansu.h.nayak@ericsson.com"
] | himansu.h.nayak@ericsson.com |
1d57a4e633267e0b0788cc10c058db69b05e1dcc | 251f2ff37241e1e282e2e3df0a6218161ae8fd57 | /Gerenciador-Financeiro/src/br/com/gerenciadorfinanceiro/modelo/entidades/Receita.java | bd1c50cb433381576b4d8b6bcf3fb2a4e344430b | [] | no_license | ericteles54/Projetos-Teste | 76091a88be82153fb8b28896551f8f6e62ad5514 | 0f3f20260ab70bd42ec46c5a7cc6492237eb0762 | refs/heads/master | 2016-08-11T07:19:38.493286 | 2015-12-29T12:37:55 | 2015-12-29T12:37:55 | 47,607,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package br.com.gerenciadorfinanceiro.modelo.entidades;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
@Entity
@NamedQuery(name="receita.findAll", query="SELECT r FROM Receita r")
public class Receita extends Movimentacao{
@Id @GeneratedValue
private Long id;
@ManyToOne
private Conta conta;
public Conta getConta() {
return conta;
}
public void setConta(Conta conta) {
this.conta = conta;
}
}
| [
"ericteles54@hotmail.com"
] | ericteles54@hotmail.com |
f7bc9ff2292ba629a7acc310c5195f2c29e4e9d9 | b76cc5921104f01d284a5908480194532fb94648 | /ProyectoFinalOscar2/app/src/main/java/com/example/tartanuk/proyectofinaloscar2/AcercaDe.java | 59ad99a94a112f4b861c8adbab94a3f4ea1d1a7a | [] | no_license | oscargarciagarcia/ProyectosVariosOscar | 0b57c2e80f4582461d59c2f9125fa832cbb7c91c | 2d618c6ebd5e509ae33901b6c88b0509d84bee3f | refs/heads/master | 2021-01-10T06:03:37.032447 | 2016-02-16T15:15:33 | 2016-02-16T15:15:33 | 49,935,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.example.tartanuk.proyectofinaloscar2;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
/**
* Created by tartanuk on 16/2/16.
*/
public class AcercaDe extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.acerca_de);
}
}
| [
"tartanuk93@gmail.com"
] | tartanuk93@gmail.com |
59e96d7debbab7a513d1ab0acc9340bf3db08444 | 3361743dbadc24226a9f1a7f9189eb3cfe883add | /src/test/java/com/trycloud/pages/LoginPageTryCloud.java | ef8f0ae638ee4491add7c45505a90d2fdb048345 | [] | no_license | IcyEzra/TryCloudProject29 | 3ae488391978fdf5c7e71e13cf05fac93bb637f3 | bf6a4e340b91dcebc2106e17647e4779685624a6 | refs/heads/master | 2023-03-22T23:14:45.270373 | 2021-02-12T02:15:41 | 2021-02-12T02:15:41 | 335,146,309 | 0 | 0 | null | 2021-02-12T02:15:42 | 2021-02-02T02:35:48 | Java | UTF-8 | Java | false | false | 526 | java | package com.trycloud.pages;
import com.trycloud.utilities.Driver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class LoginPageTryCloud {
public LoginPageTryCloud(){
PageFactory.initElements(Driver.getDriver(),this);
}
@FindBy(id="user")
public WebElement inputUsername;
@FindBy(id="password")
public WebElement inputPassword;
@FindBy(id="submit-form")
public WebElement loginButton;
}
| [
"74148803+UmarUzdanov@users.noreply.github.com"
] | 74148803+UmarUzdanov@users.noreply.github.com |
7d7bfc96e98fec00a88eece6826f244e373539a8 | c90647a4828d7e46eb0852f87f013440e45ff73d | /app/src/main/java/com/example/basicbankingapp/Data/Transaction.java | d145d4c4313574b15fe6151e3532e920d38e05ed | [] | no_license | DjStar11/BasicBankingApp | 6201c4c52dafef37210a45adb34c3d8a5b7f53ae | 2f6f2d69c78bf203a4914585e887b5371889ae89 | refs/heads/main | 2023-07-16T12:33:17.748511 | 2021-08-21T08:34:59 | 2021-08-21T08:34:59 | 398,151,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package com.example.basicbankingapp.Data;
public class Transaction {
private String fromUser;
private String ToUser;
private int amountTransfered;
private int status;
public Transaction(String fromUser,String toUser, int amountTransfered, int status) {
this.fromUser = fromUser;
ToUser=toUser;
this.amountTransfered=amountTransfered;
this.status=status;
}
public String getFromUser(){return fromUser;}
public void setFromUser(String fromUser){this.fromUser=fromUser;}
public String getToUser(){return ToUser;}
public void setToUser(String toUser){ToUser=toUser;}
public int getAmountTransfered(){return amountTransfered;}
public void setAmountTransfered(int amountTransfered){
this.amountTransfered = amountTransfered;
}
public int getStatus(){return status;}
public void setStatus(int status){this.status=status;}
}
| [
"dipanshujoshi2002@gmail.com"
] | dipanshujoshi2002@gmail.com |
02e200bcad6ba2021faa6da84fcd03806a0c5000 | 06fc186d8550ad1e8b84f1c276da322ba34c2b3f | /service-registry/src/main/java/com/youtap/service/registry/ServiceRegistryApplication.java | 8b8fa6976ea9ea63e9c98215ca80451e3f955f96 | [] | no_license | khuative/youtap-interview-test | ddf26e4533ef8845b595232d9a0e172983c50561 | c0c2e89b286937cb40e277ebf2f25b03066d524d | refs/heads/main | 2023-07-26T23:18:19.469333 | 2021-09-03T21:25:43 | 2021-09-03T21:25:43 | 402,864,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.youtap.service.registry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class ServiceRegistryApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceRegistryApplication.class, args);
}
}
| [
"khumutonga@gmail.com"
] | khumutonga@gmail.com |
e22fdbde9ba6dfd6206334e3bbdf28bc255de4f7 | 24f28b01db45a872f3c5c3b2407da3861fbb1809 | /src/test/java/urkrewrite/Test.java | e5cecd8a70dff023ee8f4e4f484e05d4d615ef0f | [] | no_license | apple0407/mushroom | 92764e0a63cabc516acaef5e89c27b2760074aaf | 866453896a76ea6d3ef954af55d09137478834e9 | refs/heads/master | 2020-12-13T04:32:00.561120 | 2017-06-25T14:55:19 | 2017-06-25T14:55:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package urkrewrite;
import org.marker.mushroom.core.proxy.SingletonProxyFrontURLRewrite;
import org.marker.urlrewrite.URLRewriteEngine;
public class Test {
private static final URLRewriteEngine urlRewrite = SingletonProxyFrontURLRewrite.getInstance();
public static void main(String[] args) {
urlRewrite.putRule("channel", "/{channel}.html");
urlRewrite.putRule("content", "/{type}/thread-{id}.html");
urlRewrite.putRule("page", "/{channel}-{page}.html");
String url1 = "/cms?type=article&id=1&time=20142211";
url1 = "/cms?p=document/d";
System.out.println("E:" + urlRewrite.encoder(url1));
System.out.println("D:" + urlRewrite.decoder(url1));
}
}
| [
"wuweiit@gmail.com"
] | wuweiit@gmail.com |
3b71ca67a73829deb9d230817ddc7d16fb22a606 | 1c731fbd73a1b311de8326996d367f845ed3d080 | /src/main/java/org/format/framework/propertyeditor/binder/GlobalCustomBinder.java | e7a22f26d8671d9444303d763e5e017faec3f161 | [] | no_license | fangjian0423/simple-web-framework | 10af4d218c53840755a8a6cc84c27f476ecf4308 | d0f12e6d4d6b1137637c4f55e7312fbd93b59a99 | refs/heads/master | 2021-01-19T08:32:28.442374 | 2014-07-24T02:29:57 | 2014-07-24T02:29:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | package org.format.framework.propertyeditor.binder;
import org.format.framework.bind.DataBinder;
import org.format.framework.propertyeditor.CustomBinder;
import org.format.framework.propertyeditor.editors.IntegerArrayPropertyEditor;
import org.format.framework.propertyeditor.editors.CustomDateEditor;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GlobalCustomBinder implements CustomBinder {
@Override
public void addCustomPropertyEditor(DataBinder dataBinder) {
dataBinder.addCustomPropertyEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
dataBinder.addCustomPropertyEditor(int[].class, new IntegerArrayPropertyEditor(","));
}
}
| [
"fangjian0423@gmail.com"
] | fangjian0423@gmail.com |
6bbc1e3529f0fc6fc5be04489052509c055fd6dd | 9278d539b65206cde55cb07bbd233a291fb716d8 | /src/main/java/com/eco/gdit/udemy/vaadin/Tutorial2/Validators.java | 4d083b073c5652bdef357768a40f50dc8912cea9 | [] | no_license | ecogle/VaadinTutorial | fbc98877858be1d56f2c5a9685a35fff396d300a | 00f8de4ff24084a9d68bd38647a19526219425b3 | refs/heads/master | 2020-12-02T06:17:57.301211 | 2017-07-10T19:21:32 | 2017-07-10T19:21:32 | 96,812,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 999 | java | package com.eco.gdit.udemy.vaadin.Tutorial2;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.ui.Button;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
public class Validators {
private TextField name;
private TextField age;
public void myValidator(UI ui){
VerticalLayout root = new VerticalLayout();
Person person = new Person();
root.setMargin(true);
root.setHeight("100%");
BeanFieldGroup<Person> fieldGroup = new BeanFieldGroup<>(Person.class);
name = new TextField("Name");
age = new TextField("Age");
fieldGroup.bind(name, "name");
fieldGroup.bind(age, "age");
fieldGroup.setItemDataSource(person);
Button button = new Button("Save");
button.addClickListener(t->{
try {
fieldGroup.commit();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(person);
});
root.addComponents(name,age,button);
ui.setContent(root);
}
}
| [
"ecogle@gmail.com"
] | ecogle@gmail.com |
93dee5df1dea7d057e67fae31d598e9a0141a7b9 | 0a5d2dbd48610c3f0f5bb8b2867fb83f766347d8 | /WukongWeather/RoundCornerProgressBar/build/generated/source/buildConfig/debug/com/akexorcist/roundcornerprogressbar/BuildConfig.java | a35a223cf98e99718a4913f556babad4969747c2 | [] | no_license | xinghuoliaoyuan45/WuKong-Weather-App | 29542494960996ca88cf14af34916c090ad8615b | ccb9d70a9af3269cbf6ab2d6524f0a95e4caad39 | refs/heads/master | 2020-12-11T07:38:08.699832 | 2016-07-20T15:04:26 | 2016-07-20T15:04:26 | 64,043,364 | 3 | 0 | null | 2016-07-24T01:34:02 | 2016-07-24T01:34:02 | null | UTF-8 | Java | false | false | 489 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.akexorcist.roundcornerprogressbar;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.akexorcist.roundcornerprogressbar";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "unspecified";
}
| [
"460093533@qq.com"
] | 460093533@qq.com |
75172df8cd1968a2941f90962d61044039257238 | 28963f45841d716633ad6c19ebc991e7cd35cbb2 | /src/main/java/service/consumerWithZk/ConsumerHandler.java | 4462237e475ca95d3f313a900572249b4f0a94fa | [] | no_license | jean880814/rpc-client | 85067bbd1a84dd21ad7d773928759abaae84303d | 74c773662da8d0eb024fab7ada1538f01aea153b | refs/heads/master | 2021-03-18T03:20:43.693168 | 2020-03-28T06:27:47 | 2020-03-28T06:27:47 | 247,042,162 | 0 | 0 | null | 2020-03-17T07:47:14 | 2020-03-13T10:11:16 | Java | UTF-8 | Java | false | false | 577 | java | package service.consumerWithZk;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
public class ConsumerHandler extends ChannelInboundHandlerAdapter {
private Object object;
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
object = msg;
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace();
}
public Object getObject() {
return this.object;
}
}
| [
"422921631@qq.com"
] | 422921631@qq.com |
75aa1cf974f1d706f324ec3a1aa32e13a48e7237 | b2333f5ee0e5576ad26fff2f9cbb1ec95ae86b00 | /src/hot/org/domain/moneda/session/SessionListener.java | aa6d756d02cd87f5b56c1daf5206d43a8fcdb5fa | [] | no_license | lfernandortiz/moneda | b989b83d62cc13e09e3433c97150bcdcef36c6de | 7ad83506f84537e77821837468e94def7fce28b7 | refs/heads/master | 2021-01-11T15:58:23.512185 | 2016-03-31T21:35:51 | 2016-03-31T21:35:51 | 44,342,315 | 0 | 0 | null | 2015-10-15T20:05:54 | 2015-10-15T20:05:52 | null | UTF-8 | Java | false | false | 729 | java | package org.domain.moneda.session;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.jboss.logging.Logger;
public class SessionListener implements HttpSessionListener, java.io.Serializable{
private static final Logger log = Logger.getLogger(SessionListener.class);
public List< HttpSession> listsession = new ArrayList<HttpSession>();
public void sessionCreated(HttpSessionEvent event) {
listsession.add(event.getSession());
}
public void sessionDestroyed(HttpSessionEvent event) {
listsession.remove(event.getSession());
}
} | [
"erlis1986@gmail.com"
] | erlis1986@gmail.com |
e9584bf7b7fb81d810872168d0fb2d4678c0a237 | 7ed0e94c4d7ce6337f565afb733392dd7229b987 | /app/src/main/java/com/code4a/jlibrarydemo/utils/Constants.java | 9f38c5a8acd2d9fd5dac2e791b25657842053e34 | [
"Apache-2.0"
] | permissive | code4a/JLibraryDemo | 9368c56640a60eb9821da1fd0b598ab814a2058c | 1245596639872d0a63ec0047208098532cc077bf | refs/heads/master | 2021-01-11T12:27:53.093304 | 2018-06-04T09:11:58 | 2018-06-04T09:11:58 | 76,623,260 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package com.code4a.jlibrarydemo.utils;
import com.code4a.jlibrary.utils.FileUtil;
import com.code4a.jlibrarydemo.JLibraryApp;
/**
* Created by code4a on 2017/1/12.
*/
public class Constants {
public static final String GANHUO_API = "http://gank.io/";
public static final String dir = FileUtil.getDiskCacheDir(JLibraryApp.getInstance()) + "/girls";
public static final String FULI = "福利";
public static final String VIDEO = "休息视频";
public static final String BUNDLE_WV_TITLE = "wv_title";
public static final String BUNDLE_WV_URL = "wv_url";
public static final String ABOUT_ME = "http://www.code4a.com/about/";
public static final String AESKEY = "http://www.code4a.com";
public static final String CODE4A_API = "https://raw.githubusercontent.com/code4a/code4aApi/master/";
public static final String CODE4A_ALIPAYINFO = "key.txt";
}
| [
"jiangyantao8@gmail.com"
] | jiangyantao8@gmail.com |
6a62db8a165ec5602df22633e0f1b617a20c0a47 | c3522de33f18eb353754d089678402d2754b8c57 | /short-sentiment-core/src/main/java/core/classifier/ClassifierResult.java | b8606f9f4fb386a9325c57d8e1d2ae030474321a | [] | no_license | slavv/short-sentiment | 38ffd4a766ff924bb9349c32c672b903bab8899b | 67648c4866312a533b6eec5978d3b7e3505aee7a | refs/heads/master | 2020-06-02T00:41:44.341414 | 2015-02-17T21:59:23 | 2015-02-17T21:59:23 | 30,142,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package core.classifier;
import cc.mallet.classify.Classifier;
import cc.mallet.classify.Trial;
/**
* The result of classifier training.
*/
public class ClassifierResult {
private final Classifier classifier;
private final Trial trial;
public ClassifierResult(Classifier classifier, Trial trial) {
this.classifier = classifier;
this.trial = trial;
}
public Classifier getClassifier() {
return classifier;
}
public Trial getTrial() {
return trial;
}
}
| [
"lacho.kozhuharov@gmail.com"
] | lacho.kozhuharov@gmail.com |
3d021ab3ef6728e8e77b0edc65b19c1372d67aef | 69136c8212922a4052c3cac07be8b67c77b5d0a5 | /gk-backend/src/main/java/com/gasparking/model/User.java | 4c3bbfc4ca6e140d40af553e5081ab11f3c98afc | [] | no_license | gaspercastell/gk-system | a17542757d8a6da91f126bfb8be8cad353197f09 | 45419333eafce1b64f659436d8673b1165dac977 | refs/heads/master | 2021-09-02T22:34:48.971116 | 2018-01-04T00:16:13 | 2018-01-04T00:16:13 | 114,697,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | package com.gasparking.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="usuario")
public class User implements Serializable {
private static final long serialVersionUID = -3009157732242241606L;
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
@Column(name="id_usuario", unique=true, nullable=false)
private long id;
@Column(name="nombre",length=100)
private String name;
@Column(name="primer_apellido",length=100)
private String firstLastname;
@Column(name="segundo_apellido",length=100)
private String secondLastname;
@Column(name="usuario",length=100)
private String username;
@Column(name="clave",length=100)
private String password;
protected User() {}
public User(String name,String firstLastname,String secondLastname,String username, String password) {
this.name=name;
this.firstLastname=firstLastname;
this.secondLastname=secondLastname;
this.username=username;
this.password=password;
}
}
| [
"retro.rever@gmail.com"
] | retro.rever@gmail.com |
faae59a0a72b769fd6c9bd2d67cc658ce541c607 | 53c9c3d25bda6918a77cc1c5193dea2385f386c0 | /src/main/java/com/martinsanguin/solarsystem/bootstrap/WeatherConditionsLoader.java | b86343751bdd7ef8330145031befd56bfb952b28 | [] | no_license | martin090/solar-system | 7e791611c388a0f888492d723f871f8823f383f8 | d828c2147f26be16990bd8c31420b2163b9ba16b | refs/heads/master | 2023-05-24T10:10:00.718177 | 2021-06-16T00:41:26 | 2021-06-16T00:41:26 | 375,891,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package com.martinsanguin.solarsystem.bootstrap;
import com.martinsanguin.solarsystem.entities.Weather;
import com.martinsanguin.solarsystem.services.WeatherService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class WeatherConditionsLoader implements CommandLineRunner {
private boolean dataInitialization;
private int years;
private WeatherService weatherService;
public WeatherConditionsLoader(@Value("${weather.data.init}") String dataInitialization,
@Value("${weather.data.years}") int years,
WeatherService weatherService) {
this.dataInitialization = Boolean.valueOf(dataInitialization);
this.years = years;
this.weatherService = weatherService;
}
@Override
public void run(String... args) throws Exception {
if(this.dataInitialization){
int days = 365 * this.years;
for (int day = 1; day <= days; day++){
Weather weather = new Weather();
weather.setDay(day);
weather.setWeather(this.weatherService.computeWeatherForDay(day).toString());
weather.setPerimeter(this.weatherService.computePerimeterForDay(day));
this.weatherService.saveWeatherCondition(weather);
}
}
}
}
| [
"sanguinmartin@gmail.com"
] | sanguinmartin@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.