blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8297556e0f5481fb0567402e2281cda4f33a7f2d | ce811f844c1c93aad20144054b721bcf67caa6e7 | /src/main/java/com/rvandoosselaer/blocks/shapes/StairsInnerCorner.java | ca3aeacc7fad5181903e64cad71f6394899ec7d7 | [
"BSD-3-Clause"
] | permissive | oilboi/Blocks | 457cfb70adda9e911213e75521b9520274852625 | 731df63dd76cdca61368e144d3dc19cf89660642 | refs/heads/master | 2022-12-03T11:55:33.230125 | 2020-07-28T08:06:38 | 2020-07-28T08:42:29 | 286,349,372 | 0 | 0 | BSD-3-Clause | 2020-08-10T01:37:40 | 2020-08-10T01:37:40 | null | UTF-8 | Java | false | false | 41,437 | java | package com.rvandoosselaer.blocks.shapes;
import com.jme3.math.FastMath;
import com.jme3.math.Matrix4f;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.math.Vector4f;
import com.rvandoosselaer.blocks.BlocksConfig;
import com.rvandoosselaer.blocks.Chunk;
import com.rvandoosselaer.blocks.ChunkMesh;
import com.rvandoosselaer.blocks.Direction;
import com.rvandoosselaer.blocks.Shape;
import com.simsilica.mathd.Vec3i;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
/**
* A shape implementation for an inner corner stair. The default facing of a stair is South.
*
* @author rvandoosselaer
*/
@ToString
@RequiredArgsConstructor
public class StairsInnerCorner implements Shape {
private static final Quaternion PI_X = new Quaternion().fromAngleAxis(FastMath.PI, Vector3f.UNIT_X);
private static final Quaternion PI_Y = new Quaternion().fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y);
private final Direction direction;
private final boolean upsideDown;
public StairsInnerCorner() {
this(Direction.UP, false);
}
@Override
public void add(Vec3i location, Chunk chunk, ChunkMesh chunkMesh) {
// when the shape is upside down (inverted), we need to perform 3 rotations. Two to invert the shape and one
// for the direction.
Quaternion rotation = Shape.getYawFromDirection(direction);
if (upsideDown) {
Quaternion inverse = PI_X.mult(PI_Y);
rotation = inverse.multLocal(rotation.inverseLocal());
}
// get the block scale, we multiply it with the vertex positions
float blockScale = BlocksConfig.getInstance().getBlockScale();
// check if we have 3 textures or only one
boolean multipleImages = chunk.getBlock(location.x, location.y, location.z).isUsingMultipleImages();
createUp(location, chunkMesh, rotation, blockScale, multipleImages);
createEast(location, chunkMesh, rotation, blockScale, multipleImages);
createSouth(location, chunkMesh, rotation, blockScale, multipleImages);
if (chunk.isFaceVisible(location, Shape.getYawFaceDirection(upsideDown ? Direction.EAST : Direction.WEST, direction))) {
createWest(location, chunkMesh, rotation, blockScale, multipleImages);
}
if (chunk.isFaceVisible(location, Shape.getYawFaceDirection(Direction.NORTH, direction))) {
createNorth(location, chunkMesh, rotation, blockScale, multipleImages);
}
if (chunk.isFaceVisible(location, Shape.getYawFaceDirection(upsideDown ? Direction.UP : Direction.DOWN, direction))) {
createDown(location, chunkMesh, rotation, blockScale, multipleImages);
}
}
private static void createUp(Vec3i location, ChunkMesh chunkMesh, Quaternion rotation, float blockScale, boolean multipleImages) {
int offset = chunkMesh.getPositions().size();
// # Positions:16
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, -0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.500f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.500f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, 0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.167f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, 0.167f, 0.500f)), location, blockScale));
// Index:
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 4);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 6);
chunkMesh.getIndices().add(offset + 7);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 8);
chunkMesh.getIndices().add(offset + 9);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 11);
chunkMesh.getIndices().add(offset + 12);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 13);
chunkMesh.getIndices().add(offset + 4);
chunkMesh.getIndices().add(offset + 14);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 7);
chunkMesh.getIndices().add(offset + 6);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 9);
chunkMesh.getIndices().add(offset + 15);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 12);
chunkMesh.getIndices().add(offset + 11);
chunkMesh.getIndices().add(offset + 10);
if (!chunkMesh.isCollisionMesh()) {
// Normals:
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 1.000f, 0.000f)));
// Tangents:
Matrix4f rotationMatrix = rotation.toRotationMatrix(new Matrix4f());
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
if (!multipleImages) {
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.000f));
} else {
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.778f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.778f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.889f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.889f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.778f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.889f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.889f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.778f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
}
}
}
private static void createDown(Vec3i location, ChunkMesh chunkMesh, Quaternion rotation, float blockScale, boolean multipleImages) {
int offset = chunkMesh.getPositions().size();
// # Positions:4
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.500f, 0.500f)), location, blockScale));
// Index:
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 1);
if (!chunkMesh.isCollisionMesh()) {
// Normals:
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, -1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, -1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, -1.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, -1.000f, 0.000f)));
// Tangents:
Matrix4f rotationMatrix = rotation.toRotationMatrix(new Matrix4f());
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
if (!multipleImages) {
chunkMesh.getUvs().add(new Vector2f(1.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.000f));
} else {
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.000f));
}
}
}
private static void createNorth(Vec3i location, ChunkMesh chunkMesh, Quaternion rotation, float blockScale, boolean multipleImages) {
int offset = chunkMesh.getPositions().size();
// # Positions:4
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.500f, -0.500f)), location, blockScale));
// Index:
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 1);
if (!chunkMesh.isCollisionMesh()) {
// Normals:
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, -1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, -1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, -1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, -1.000f)));
// Tangents:
Matrix4f rotationMatrix = rotation.toRotationMatrix(new Matrix4f());
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, 1.000f)));
if (!multipleImages) {
chunkMesh.getUvs().add(new Vector2f(0.0f, 0.0f));
chunkMesh.getUvs().add(new Vector2f(1.0f, 1.0f));
chunkMesh.getUvs().add(new Vector2f(1.0f, 0.0f));
chunkMesh.getUvs().add(new Vector2f(0.0f, 1.0f));
} else {
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
}
}
}
private static void createEast(Vec3i location, ChunkMesh chunkMesh, Quaternion rotation, float blockScale, boolean multipleImages) {
int offset = chunkMesh.getPositions().size();
// # Positions:18
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.500f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, -0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, 0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, 0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.167f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.500f, -0.167f)), location, blockScale));
// Index:
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 4);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 6);
chunkMesh.getIndices().add(offset + 7);
chunkMesh.getIndices().add(offset + 8);
chunkMesh.getIndices().add(offset + 9);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 11);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 7);
chunkMesh.getIndices().add(offset + 12);
chunkMesh.getIndices().add(offset + 8);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 13);
chunkMesh.getIndices().add(offset + 14);
chunkMesh.getIndices().add(offset + 15);
chunkMesh.getIndices().add(offset + 16);
chunkMesh.getIndices().add(offset + 14);
chunkMesh.getIndices().add(offset + 17);
chunkMesh.getIndices().add(offset + 15);
if (!chunkMesh.isCollisionMesh()) {
// Normals:
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(1.000f, 0.000f, 0.000f)));
// Tangents:
Matrix4f rotationMatrix = rotation.toRotationMatrix(new Matrix4f());
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, -1.000f)));
if (!multipleImages) {
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 1.000f));
} else {
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
}
}
}
private static void createWest(Vec3i location, ChunkMesh chunkMesh, Quaternion rotation, float blockScale, boolean multipleImages) {
int offset = chunkMesh.getPositions().size();
// # Positions:4
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.500f, -0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.500f, 0.500f)), location, blockScale));
// Index:
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 1);
if (!chunkMesh.isCollisionMesh()) {
// Normals:
chunkMesh.getNormals().add(rotation.mult(new Vector3f(-1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(-1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(-1.000f, 0.000f, 0.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(-1.000f, 0.000f, 0.000f)));
// Tangents:
Matrix4f rotationMatrix = rotation.toRotationMatrix(new Matrix4f());
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, 1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(0.000f, 0.000f, -1.000f, 1.000f)));
if (!multipleImages) {
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 1.000f));
} else {
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
}
}
}
private static void createSouth(Vec3i location, ChunkMesh chunkMesh, Quaternion rotation, float blockScale, boolean multipleImages) {
int offset = chunkMesh.getPositions().size();
// # Positions:18
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, -0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.500f, 0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, -0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, 0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.167f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.500f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.167f, -0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.167f, 0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.500f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(-0.167f, 0.167f, 0.500f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, -0.167f, 0.167f)), location, blockScale));
chunkMesh.getPositions().add(Shape.createVertex(rotation.mult(new Vector3f(0.500f, 0.500f, -0.167f)), location, blockScale));
// Index:
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 4);
chunkMesh.getIndices().add(offset + 2);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 6);
chunkMesh.getIndices().add(offset + 7);
chunkMesh.getIndices().add(offset + 8);
chunkMesh.getIndices().add(offset + 9);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 11);
chunkMesh.getIndices().add(offset + 12);
chunkMesh.getIndices().add(offset + 0);
chunkMesh.getIndices().add(offset + 13);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 3);
chunkMesh.getIndices().add(offset + 14);
chunkMesh.getIndices().add(offset + 4);
chunkMesh.getIndices().add(offset + 1);
chunkMesh.getIndices().add(offset + 15);
chunkMesh.getIndices().add(offset + 5);
chunkMesh.getIndices().add(offset + 7);
chunkMesh.getIndices().add(offset + 16);
chunkMesh.getIndices().add(offset + 8);
chunkMesh.getIndices().add(offset + 10);
chunkMesh.getIndices().add(offset + 17);
chunkMesh.getIndices().add(offset + 11);
if (!chunkMesh.isCollisionMesh()) {
// Normals:
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
chunkMesh.getNormals().add(rotation.mult(new Vector3f(0.000f, 0.000f, 1.000f)));
// Tangents:
Matrix4f rotationMatrix = rotation.toRotationMatrix(new Matrix4f());
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
chunkMesh.getTangents().add(rotationMatrix.mult(new Vector4f(1.000f, 0.000f, 0.000f, -1.000f)));
if (!multipleImages) {
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 1.000f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.000f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 1.000f));
} else {
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.000f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.667f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(0.667f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.333f));
chunkMesh.getUvs().add(new Vector2f(0.333f, 0.556f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.444f));
chunkMesh.getUvs().add(new Vector2f(1.000f, 0.667f));
}
}
}
}
| [
"remy.vand@gmail.com"
] | remy.vand@gmail.com |
09c628871d48d022b0261c5727553dedc819e289 | 1bafa5edd67767059c5b8a5239f3bed909269e1f | /stack_exchange_web_services/src/org/stackexchange/webservice/service/TokenService.java | f31b3a24b001897294a98658fb872183ad50568c | [] | no_license | lexcle/IF3110-2015-T3 | c3e203c536fc14959f275e4014696eb092fd9010 | 724ff342195aab09a8691660ec691a797ec1ca8b | refs/heads/master | 2020-02-26T17:07:16.571714 | 2015-12-06T16:05:57 | 2015-12-06T16:05:57 | 47,442,606 | 0 | 0 | null | 2015-12-05T04:42:14 | 2015-12-05T04:42:14 | null | UTF-8 | Java | false | false | 1,130 | java | package org.stackexchange.webservice.service;
import org.stackexchange.webservice.helper.ConnectionHelper;
import java.io.IOException;
public class TokenService {
ConnectionHelper connectionHelper;
public TokenService() {
connectionHelper = new ConnectionHelper();
}
public boolean isTokenValid(String token) {
try {
return Boolean.valueOf(connectionHelper.executeGET("http://localhost:9000/api/token/check?token=" + token));
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
public int getUserId(String token) {
try {
return Integer.valueOf(connectionHelper.executeGET("http://localhost:9000/api/id/user?token=" + token));
} catch (IOException e) {
e.printStackTrace();
return 0;
}
}
public String getUserName(String token) {
try {
return connectionHelper.executeGET("http://localhost:9000/api/user?token=" + token);
} catch (IOException e) {
e.printStackTrace();
return "";
}
}
}
| [
"vincent.s.the@gmail.com"
] | vincent.s.the@gmail.com |
5ef13cdf2ad315bca7858af5453c8eff39cfadcf | d069cb78d615697d6005b35a6bc3160308bd798c | /ProjectSource/app-library/src/test/java/com/kayako/sdk/android/k5/common/adapter/list/ListItemViewHolderTest.java | 2160c230b3e4fb56b50c45159030a3bb90d46d72 | [] | no_license | trilogy-group/kayako-Kayako-Android-SDK | 4511ed3c77cee07faffbebe5d7edfd6cda67117e | aae6af98ade343f634a44908c7c99eb2957b4533 | refs/heads/master | 2021-12-14T08:12:12.363526 | 2021-03-25T06:36:40 | 2021-03-25T06:36:40 | 66,345,280 | 5 | 8 | null | 2021-12-10T04:09:00 | 2016-08-23T07:44:22 | Java | UTF-8 | Java | false | false | 2,653 | java | package com.kayako.sdk.android.k5.common.adapter.list;
import android.view.View;
import android.widget.TextView;
import com.kayako.sdk.android.k5.R;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.times;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
@RunWith(MockitoJUnitRunner.class)
public class ListItemViewHolderTest {
private ListItemViewHolder listItemViewHolder;
@Rule
public final ErrorCollector collector = new ErrorCollector();
@Mock
private View view;
@Mock
private TextView textView;
@Before
public void setUp() {
when(view.findViewById(eq(R.id.ko__list_item_title))).thenReturn(textView);
when(view.findViewById(eq(R.id.ko__list_item_subtitle))).thenReturn(textView);
listItemViewHolder = new ListItemViewHolder(view);
}
@Test
public void constructorMView() {
//Act
verify(view, times(1)).findViewById(eq(R.id.ko__list_item_title));
verify(view, times(1)).findViewById(eq(R.id.ko__list_item_subtitle));
//Assert
collector.checkThat(listItemViewHolder.mView, is(instanceOf(View.class)));
collector.checkThat(listItemViewHolder.mView, is(equalTo(view)));
}
@Test
public void constructorMSubTitle() {
//Act
TextView textViewMSubTitle = (TextView) view.findViewById(R.id.ko__list_item_subtitle);
verify(view, times(1)).findViewById(eq(R.id.ko__list_item_title));
verify(view, times(2)).findViewById(eq(R.id.ko__list_item_subtitle));
//Assert
collector.checkThat(listItemViewHolder.mSubTitle, is(instanceOf(TextView.class)));
collector.checkThat(listItemViewHolder.mSubTitle, is(equalTo(textViewMSubTitle)));
}
@Test
public void constructorMTitle() {
//Act
TextView textViewMTitle = (TextView) view.findViewById(R.id.ko__list_item_title);
verify(view, times(2)).findViewById(eq(R.id.ko__list_item_title));
verify(view, times(1)).findViewById(eq(R.id.ko__list_item_subtitle));
//Assert
collector.checkThat(listItemViewHolder.mTitle, is(instanceOf(TextView.class)));
collector.checkThat(listItemViewHolder.mTitle, is(equalTo(textViewMTitle)));
}
}
| [
"samir.aghayarov@aurea.com"
] | samir.aghayarov@aurea.com |
99bba5c8c68da8531febb0a450046ae96da459f7 | e042e91cfc3854ff008a1f7c27ae79f944895f6c | /src/main/java/com/core/App.java | 35c345fa39b7f1808f424567c2128f30cb2388c7 | [] | no_license | shivanandara09/DemoCode | 27c317b69bb7ea3837a9420e2ad37ed818be4ac0 | 089bc324e32232fbad7e10ba5bfc0216ddb32c0e | refs/heads/master | 2020-04-11T22:25:26.006712 | 2019-01-14T09:59:13 | 2019-01-14T09:59:13 | 162,135,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package com.core;
import org.testng.annotations.Test;
/**
* Hello world!
*
*/
public class App
{
@Test
public static void disp()
{
System.out.println( "Hello World!" );
}
}
| [
"shivanandarai09@gmail.com"
] | shivanandarai09@gmail.com |
4ae879836029d7f900f77b57d3d0e0e7b25bd57e | c6673c474a251d12371ba2e7680dc78761fd3ada | /src/main/java/com/snpx/jenkinsdemo/JenkinsDemoApplication.java | a8aaa5a25fc35c18f1d097baac2e2e0b0110ee6d | [] | no_license | zh-haining/jenkins-demo | 94fd392f2017216ffec971270925cc4ffdb93176 | 8bcac984cfcd52fd09ba75c42b1b53d6d5e0329e | refs/heads/master | 2022-06-19T20:31:24.783636 | 2020-05-13T15:33:48 | 2020-05-13T15:33:48 | 256,489,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.snpx.jenkinsdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class JenkinsDemoApplication {
public static void main(String[] args) {
SpringApplication.run(JenkinsDemoApplication.class, args);
}
}
| [
"zh_haining@163.com"
] | zh_haining@163.com |
f8c694232f4d0f076f51fb553bd2afbfa4ef5538 | f94f3d452abc048c9704b8546dfe0f0faf28156b | /ui资源/商城/mall/src/main/java/com/scoprion/config/MallConfig.java | 272849b0ca97c007a35c6043c919d3e9e3534836 | [] | no_license | 1924666540/miniprogram | e5c61f2140a994940795f7fd24034ed0509bd9c2 | 9a6b30e57c95471818b44cf61e0ee5ea5b3d7591 | refs/heads/master | 2022-12-29T19:20:45.450132 | 2020-10-13T06:59:16 | 2020-10-13T06:59:16 | 303,583,469 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,117 | java | package com.scoprion.config;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import com.scoprion.constant.Constant;
import com.scoprion.intercepter.MallInterceptor;
import com.scoprion.mall.wx.rabbitmq.ConfirmCallBackListener;
import com.scoprion.mall.wx.rabbitmq.ReturnCallBackListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.List;
/**
* @author by kunlun
* @created on 2017/9/25.
*/
@Configuration
public class MallConfig extends WebMvcConfigurerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(MallConfig.class);
@Bean
public MallInterceptor getMallInterceptor() {
return new MallInterceptor();
}
/**
* 注入拦截器
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(getMallInterceptor());
super.addInterceptors(registry);
}
/**
* 重写消息转换格式
* {@inheritDoc}
* <p>This implementation is empty.
*
* @param converters
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
converters.add(fastJsonHttpMessageConverter);
super.configureMessageConverters(converters);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
super.addResourceHandlers(registry);
}
@Override
public void addCorsMappings(CorsRegistry registry) {
// super.addCorsMappings(registry);
registry.addMapping("/**/**")
.allowedOrigins("*")
.allowedHeaders("*")
.allowedMethods("*");
}
@Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory factory = new CachingConnectionFactory();
factory.setAddresses("127.0.0.1:5672");
factory.setUsername("guest");
factory.setPassword("guest");
//回调必须设置 否则接收不到
factory.setPublisherConfirms(true);
factory.setPublisherReturns(true);
//设置连接数 此种方式已解决高并发数据丢失 重连丢失问题
factory.setChannelCacheSize(100);
return factory;
}
@Bean
public DirectExchange defaultExchange() {
/**
* DirectExchange: 按照routingkey分发到指定队列
* TopicExchange: 多关键字匹配
* FanoutExchange: 将消息分发到所有的绑定队列,无routingkey的概念
* HeadersExchange: 通过添加属性 key-value匹配
*/
return new DirectExchange(Constant.EXCHANGE);
}
@Bean
public DirectExchange refundExchange() {
/**
* DirectExchange: 按照routingkey分发到指定队列
* TopicExchange: 多关键字匹配
* FanoutExchange: 将消息分发到所有的绑定队列,无routingkey的概念
* HeadersExchange: 通过添加属性 key-value匹配
*/
return new DirectExchange(Constant.REFUND_EXCHANGE);
}
@Bean
public Queue queue() {
return new Queue(Constant.QUEUE);
}
@Bean
public Queue refundQueue() {
return new Queue(Constant.REFUND_QUEUE);
}
@Bean
public Binding binding() {
/** 将队列绑定到交换机 */
return BindingBuilder.bind(refundQueue()).to(refundExchange()).with(Constant.REFUND_ROUTING_KEY);
}
@Bean
public Binding bindingRefund() {
/** 将队列绑定到交换机 */
return BindingBuilder.bind(queue()).to(defaultExchange()).with(Constant.ROUTING_KEY);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public RabbitTemplate rabbitTemplate() {
RabbitTemplate template = new RabbitTemplate(connectionFactory());
template.setMessageConverter(new Jackson2JsonMessageConverter());
template.setConfirmCallback(new ConfirmCallBackListener());
template.setReturnCallback(new ReturnCallBackListener());
return template;
}
/**
* 解决 队列消费 Object失败
*
* @return
*/
@Bean
public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory());
factory.setMessageConverter(new Jackson2JsonMessageConverter());
return factory;
}
}
| [
"etion@example.com"
] | etion@example.com |
f9e3c450a4333c869bc9d65bba63a03e79296b80 | e7beb4e0dd6dc827e76907d66132120bd8393379 | /src/main/java/user/registration/validate.java | b8ea2379ed1b55fa7a220903e2f7def120a4099f | [] | no_license | keshavanandsingh/day7.UC12 | d6794550ece9d1520731f1c340b548c36769262a | 263874f25ef6f264fe40520cbb615e1c768e796f | refs/heads/master | 2022-12-24T12:26:25.331258 | 2020-09-28T17:53:11 | 2020-09-28T17:53:11 | 299,388,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,288 | java | package user.registration;
import java.util.regex.*;
import java.util.*;
public class validate
{
private String message;
public validate(String message) {
this.message = message;
}
public validate() {
}
// first name validation
public boolean isValidFirstName(String msg)
{
String regex = "^[A-Z]{1}[a-zA-Z]{2,}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(msg);
return m.matches();
}
public boolean validateFirstName(String message) throws ExceptionClass {
this.message = message;
return validateFirstName();
}
public boolean validateFirstName() throws ExceptionClass{
validate val = new validate();
boolean ans = val.isValidFirstName(message);
if(ans == true) {
return ans;
}else {
throw new ExceptionClass("Invalid Entry");
}
}
// last name validation
public boolean isValidLastName(String msg)
{
String regex = "^[A-Z]{1}[a-zA-Z]{2,}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(msg);
return m.matches();
}
public boolean validateLastName(String message) throws ExceptionClass{
this.message = message;
return validateLastName();
}
public boolean validateLastName() throws ExceptionClass{
validate val = new validate();
boolean ans = val.isValidLastName(message);
if(ans == true) {
return ans;
}else {
throw new ExceptionClass("Invalid Entry");
}
}
// Phone number validation
public boolean isValidMobileNumber(String msg)
{
String regex = "^[1-9]{1}[0-9]{1}\\s{1}[1-9]{1}[0-9]{9}$";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(msg);
return m.matches();
}
public boolean validateMobileNumber(String message) throws ExceptionClass{
this.message = message;
return validateMobileNumber();
}
public boolean validateMobileNumber() throws ExceptionClass{
validate val = new validate();
boolean ans = val.isValidMobileNumber(message);
if(ans == true) {
return ans;
}else {
throw new ExceptionClass("Invalid Entry");
}
}
//email validation
public boolean isValidEmail(String msg)
{
String regex = "^[a-zA-Z0-9]+(([\\.+-][a-z0-9]{1,})?)+@(?:[a-zA-Z0-9])+\\.[a-zA-Z]{2,4}+((\\.[a-z]{2,4})?)$";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(msg);
return m.matches();
}
public boolean validateEmail(String message) throws ExceptionClass{
this.message = message;
return validateEmail();
}
public boolean validateEmail() throws ExceptionClass{
validate val = new validate();
boolean ans = val.isValidEmail(message);
if(ans == true) {
return ans;
}else {
throw new ExceptionClass("Invalid Entry");
}
}
// password validation
public boolean isValidPassword(String msg)
{
String regex = "^(?=.*[A-Z])(?=.*\\d)(?=.*\\W)[a-zA-Z0-9\\@\\_\\-\\+\\#\\*]{8,}$";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(msg);
return m.matches();
}
public boolean validatePassword(String message) throws ExceptionClass {
this.message = message;
return validatePassword();
}
public boolean validatePassword() throws ExceptionClass{
validate val = new validate();
boolean ans = val.isValidPassword(message);
if(ans == true) {
return ans;
}else {
throw new ExceptionClass("Invalid Entry");
}
}
}
| [
"keshavanand22@gmail.com"
] | keshavanand22@gmail.com |
f6beb90557b5196161295ae013107255daf44603 | 8bf67e3dde92e88447c607f9a1a2665778918e7d | /cloud-biz-core/src/main/java/com/qweib/cloud/repository/plat/ws/BscInvitationDao.java | dc12630b0241574039c5d0d5819096f49d2e61aa | [] | no_license | yeshenggen532432/test02 | 1f87235ba8822bd460f7c997dd977c3e68371898 | 52279089299a010f99c60bc6656476d68f19050f | refs/heads/master | 2022-12-11T01:38:24.097948 | 2020-09-07T06:36:51 | 2020-09-07T06:36:51 | 293,404,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,620 | java | package com.qweib.cloud.repository.plat.ws;
import com.qweib.cloud.core.dao.JdbcDaoTemplatePlud;
import com.qweib.cloud.core.domain.BscInvitation;
import com.qweib.cloud.core.exception.DaoException;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
@Repository
public class BscInvitationDao {
@Resource(name="pdaoTemplate")
private JdbcDaoTemplatePlud pdaoTemplate;
/**
*@see 批量添加邀请信息记录
*@param ivMsgs
*@创建:作者:YYP 创建时间:2015-4-2
*/
public int[] addInvitationMsgs( final List<BscInvitation> ivMsgs) {
String sql = "insert into bsc_invitation(member_id,receive_id,tp,content,datasource,belong_id,intime) values(?,?,?,?,?,?,?)";
try{
BatchPreparedStatementSetter setter = new BatchPreparedStatementSetter() {
public void setValues(PreparedStatement params, int num) throws SQLException {
params.setInt(1,ivMsgs.get(num).getMemberId());
params.setInt(2,ivMsgs.get(num).getReceiveId());
params.setString(3,ivMsgs.get(num).getTp());
params.setString(4,ivMsgs.get(num).getContent());
if(null==ivMsgs.get(num).getDatasource()){
params.setString(5,null);
}else{
params.setString(5,ivMsgs.get(num).getDatasource());
}
if(null==ivMsgs.get(num).getBelongId()){
params.setString(6,null);
}else{
params.setInt(6,ivMsgs.get(num).getBelongId());
}
params.setString(7,ivMsgs.get(num).getIntime());
}
public int getBatchSize() {
return ivMsgs.size();
}
};
return pdaoTemplate.batchUpdate(sql.toUpperCase(), setter);
}catch (Exception e) {
throw new DaoException(e);
}
}
/**
*@see 修改同意或不同意操作
*@param receiveId
*@param memId
*@param belongId
*@param tp
*@param idTp
*@创建:作者:YYP 创建时间:2015-4-3
*/
public Integer updateInAgree(Integer receiveId, Integer memId,
Integer belongId, String tp, String idTp) {
StringBuffer sql = new StringBuffer("update bsc_invitation set agree="+tp);
sql.append(" where receive_id="+receiveId+" and member_id="+memId);
if(null!=belongId){
sql.append(" and belong_id="+belongId);
}
if("1".equals(idTp)){
sql.append(" and tp=3 ");
}else if("2".equals(idTp)){
sql.append(" and tp=4 ");
}else{
sql.append(" and tp="+idTp);
}
try{
return pdaoTemplate.update(sql.toString());
}catch (Exception e) {
throw new DaoException(e);
}
}
}
| [
"1617683532@qq.com"
] | 1617683532@qq.com |
1d8ece2629a01d0c68625531499876884a2341f4 | bb4944b56c555a0110a59d17fdefc8996f528f54 | /Java/Interfaces/src/com/company/Main.java | 4405da2c29e54b96a47156492de5f61b8147e3b2 | [] | no_license | billbialas/Development | 2c95009a4395cf318e41fb7831c4d4c7fa106eda | 088155ee17d13fe4c9ca708d8b9fc64f230dd040 | refs/heads/master | 2021-01-10T14:13:09.910040 | 2016-04-30T03:58:03 | 2016-04-30T03:58:03 | 50,461,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,414 | java | package com.company;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
Player bill = new Player("Bill", 100,120);
System.out.println(bill.toString());
bill.setHitPoints(50);
System.out.println(bill);
bill.setWeapon("Big Ass Gun");
saveObect(bill);
// loadObject(bill);
System.out.println(bill);
ISaveable monster = new Monster("Killer", 100, 100);
System.out.println(monster);
//example of casting because we declcared monster as ISavable
System.out.println("Strength = " + ((Monster) monster).getStrength());
saveObect(monster);
//printvalues(readValues());
}
public static ArrayList<String> readValues(){
ArrayList<String> values = new ArrayList<String>();
Scanner scanner = new Scanner(System.in);
boolean quit = false;
int index=0;
System.out.println("Choose\n" +
"1 to enter a string\n" +
"0 to quit");
while (!quit){
System.out.println("Choose an option: ");
int choice = scanner.nextInt();
scanner.nextLine();
switch (choice){
case 0:
quit=true;
break;
case 1:
System.out.println("Enter a string: ");
String stringInput = scanner.nextLine();
values.add(index, stringInput);
index++;
break;
}
}
return values;
}
public static void saveObect(ISaveable objectToSave){
for (int i=0;i<objectToSave.write().size();i++){
System.out.println("Saving "+objectToSave.write().get(i) + " to storage device");
}
}
public static void loadObject(ISaveable objectToLoad){
List<String> values = readValues();
objectToLoad.read(values);
}
public static void printvalues(ArrayList<String> prmvalues){
ArrayList<String> values = new ArrayList<String>();
values = prmvalues;
for (int i=0;i<values.size();i++){
System.out.println("Index: " + i + " value stored: " + values.get(i).toString());
}
}
}
| [
"bill.bialas@gmail.com"
] | bill.bialas@gmail.com |
dfbd44928a0e1206d71454cbcf86c93d1175836d | 2ec0019a2049f377a8d7f008a2b1275f24f8c082 | /src/main/java/org/monroe/team/puzzle/pieces/metadata/MediaFileMetadataExtractor.java | 3ef70c15dbfa31a85438bf78e71b164b4ae1b31b | [] | no_license | mrjbee/puzzle | bbac1df1b62e1c269f215202486cef2db6a7fb72 | fde72832fd88976c24ee0a3aeff58cefc1e0b606 | refs/heads/master | 2021-01-18T04:54:42.013468 | 2017-05-08T08:51:32 | 2017-05-08T08:51:32 | 68,400,475 | 2 | 0 | null | 2017-01-14T16:44:16 | 2016-09-16T17:29:18 | Java | UTF-8 | Java | false | false | 158 | java | package org.monroe.team.puzzle.pieces.metadata;
import java.io.File;
public interface MediaFileMetadataExtractor {
MediaMetadata metadata(File file);
}
| [
"MisterJbee@gmail.com"
] | MisterJbee@gmail.com |
5db5cc5d4b80b4bf0eff3117ab9cf28ef5eeae16 | fe9db107a29c7ca3fe1bc77e34aac8d4aebaa568 | /src/starwars/Hero.java | 00c89e07b8acd04c6c8143c6bba25df81e9927ad | [] | no_license | spenceratkins/StarWars | 12047765f75056cfd6b6f206d6ca4b314d06890e | 19971972b42cb235afc7dd6eb142ae79b79cadae | refs/heads/master | 2020-03-28T21:30:50.026446 | 2018-09-19T18:27:29 | 2018-09-19T18:27:29 | 149,162,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | 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 starwars;
import java.awt.Color;
import java.awt.Graphics;
/**
*
* @author Spencer Atkins
*/
public class Hero extends Character {
//Fields (Variables)
private int health;
//Constructor
public Hero() {
super();
health = 3;
}
public Hero(int x, int y, Color color, int size, String name) {
super (x, y, color, size, name);
}
//Getters
public int getHealth() {
return health;
}
//Public Methods
public void kill() {
}
public void collect() {
}
public void teleport() {
}
//Private Methods
private void grow() {
}
private void canTeleport() {
}
}
| [
"692589@NV034104.sylvaniaschools.local"
] | 692589@NV034104.sylvaniaschools.local |
e90860cbae3ae8b31bfb5119824ab864d5d97511 | 9333a508b3bd2821ae92274a041f2aedf474aa14 | /CertificationSpring/src/main/java/com/alessio/aop/component/TestServiceAnnotations.java | 4b067903b6ed9381f2f95245bcb6df783a868bc2 | [] | no_license | Mazzotta13/spring-certification | 90e79fffeea180d670af081096e8fd877e83f528 | 36b8dfbb70873b26b0a4d0141b70add9bda6d6ee | refs/heads/master | 2022-11-12T10:20:43.707150 | 2020-06-30T09:30:40 | 2020-06-30T09:30:40 | 276,039,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.alessio.aop.component;
import org.springframework.stereotype.Service;
import com.alessio.aop.annotation.AnnotationLoggers;
@Service
public class TestServiceAnnotations {
@AnnotationLoggers
public void test() {
System.out.println("TestServiceAnnotations, test()");
}
}
| [
"mazzttaalessio93@gmail.com"
] | mazzttaalessio93@gmail.com |
b4baeee25582793766b1a6ea64ef55a078bffa56 | 988d60c39d330673da2be78521ea41eea0b09bbc | /src/main/java/CallHost.java | d4422c76ced1954c090c226347032ded14b2641c | [] | no_license | HelloTan/LineJava | 20dfe2fcec47a78349f3423efa971a76ff664e56 | 42befe4d291bbee17c2235e301606ae636729f7e | refs/heads/master | 2021-05-08T14:34:46.310752 | 2018-02-03T12:05:18 | 2018-02-03T12:05:18 | 120,087,152 | 0 | 1 | null | 2018-02-03T12:01:46 | 2018-02-03T12:01:46 | null | UTF-8 | Java | false | true | 17,161 | java | /**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CallHost implements org.apache.thrift.TBase<CallHost, CallHost._Fields>, java.io.Serializable, Cloneable, Comparable<CallHost> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CallHost");
private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = new org.apache.thrift.protocol.TField("zone", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CallHostStandardSchemeFactory());
schemes.put(TupleScheme.class, new CallHostTupleSchemeFactory());
}
public String host; // required
public int port; // required
public String zone; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
HOST((short)1, "host"),
PORT((short)2, "port"),
ZONE((short)3, "zone");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // HOST
return HOST;
case 2: // PORT
return PORT;
case 3: // ZONE
return ZONE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __PORT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.ZONE, new org.apache.thrift.meta_data.FieldMetaData("zone", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CallHost.class, metaDataMap);
}
public CallHost() {
}
public CallHost(
String host,
int port,
String zone)
{
this();
this.host = host;
this.port = port;
setPortIsSet(true);
this.zone = zone;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CallHost(CallHost other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetHost()) {
this.host = other.host;
}
this.port = other.port;
if (other.isSetZone()) {
this.zone = other.zone;
}
}
public CallHost deepCopy() {
return new CallHost(this);
}
@Override
public void clear() {
this.host = null;
setPortIsSet(false);
this.port = 0;
this.zone = null;
}
public String getHost() {
return this.host;
}
public CallHost setHost(String host) {
this.host = host;
return this;
}
public void unsetHost() {
this.host = null;
}
/** Returns true if field host is set (has been assigned a value) and false otherwise */
public boolean isSetHost() {
return this.host != null;
}
public void setHostIsSet(boolean value) {
if (!value) {
this.host = null;
}
}
public int getPort() {
return this.port;
}
public CallHost setPort(int port) {
this.port = port;
setPortIsSet(true);
return this;
}
public void unsetPort() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PORT_ISSET_ID);
}
/** Returns true if field port is set (has been assigned a value) and false otherwise */
public boolean isSetPort() {
return EncodingUtils.testBit(__isset_bitfield, __PORT_ISSET_ID);
}
public void setPortIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PORT_ISSET_ID, value);
}
public String getZone() {
return this.zone;
}
public CallHost setZone(String zone) {
this.zone = zone;
return this;
}
public void unsetZone() {
this.zone = null;
}
/** Returns true if field zone is set (has been assigned a value) and false otherwise */
public boolean isSetZone() {
return this.zone != null;
}
public void setZoneIsSet(boolean value) {
if (!value) {
this.zone = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case HOST:
if (value == null) {
unsetHost();
} else {
setHost((String)value);
}
break;
case PORT:
if (value == null) {
unsetPort();
} else {
setPort((Integer)value);
}
break;
case ZONE:
if (value == null) {
unsetZone();
} else {
setZone((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case HOST:
return getHost();
case PORT:
return Integer.valueOf(getPort());
case ZONE:
return getZone();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case HOST:
return isSetHost();
case PORT:
return isSetPort();
case ZONE:
return isSetZone();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CallHost)
return this.equals((CallHost)that);
return false;
}
public boolean equals(CallHost that) {
if (that == null)
return false;
boolean this_present_host = true && this.isSetHost();
boolean that_present_host = true && that.isSetHost();
if (this_present_host || that_present_host) {
if (!(this_present_host && that_present_host))
return false;
if (!this.host.equals(that.host))
return false;
}
boolean this_present_port = true;
boolean that_present_port = true;
if (this_present_port || that_present_port) {
if (!(this_present_port && that_present_port))
return false;
if (this.port != that.port)
return false;
}
boolean this_present_zone = true && this.isSetZone();
boolean that_present_zone = true && that.isSetZone();
if (this_present_zone || that_present_zone) {
if (!(this_present_zone && that_present_zone))
return false;
if (!this.zone.equals(that.zone))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(CallHost other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetHost()).compareTo(other.isSetHost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHost()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPort()).compareTo(other.isSetPort());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPort()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, other.port);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetZone()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CallHost(");
boolean first = true;
sb.append("host:");
if (this.host == null) {
sb.append("null");
} else {
sb.append(this.host);
}
first = false;
if (!first) sb.append(", ");
sb.append("port:");
sb.append(this.port);
first = false;
if (!first) sb.append(", ");
sb.append("zone:");
if (this.zone == null) {
sb.append("null");
} else {
sb.append(this.zone);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CallHostStandardSchemeFactory implements SchemeFactory {
public CallHostStandardScheme getScheme() {
return new CallHostStandardScheme();
}
}
private static class CallHostStandardScheme extends StandardScheme<CallHost> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CallHost struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // HOST
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.host = iprot.readString();
struct.setHostIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // PORT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.port = iprot.readI32();
struct.setPortIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // ZONE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.zone = iprot.readString();
struct.setZoneIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CallHost struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.host != null) {
oprot.writeFieldBegin(HOST_FIELD_DESC);
oprot.writeString(struct.host);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(PORT_FIELD_DESC);
oprot.writeI32(struct.port);
oprot.writeFieldEnd();
if (struct.zone != null) {
oprot.writeFieldBegin(ZONE_FIELD_DESC);
oprot.writeString(struct.zone);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CallHostTupleSchemeFactory implements SchemeFactory {
public CallHostTupleScheme getScheme() {
return new CallHostTupleScheme();
}
}
private static class CallHostTupleScheme extends TupleScheme<CallHost> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CallHost struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetHost()) {
optionals.set(0);
}
if (struct.isSetPort()) {
optionals.set(1);
}
if (struct.isSetZone()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetHost()) {
oprot.writeString(struct.host);
}
if (struct.isSetPort()) {
oprot.writeI32(struct.port);
}
if (struct.isSetZone()) {
oprot.writeString(struct.zone);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CallHost struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.host = iprot.readString();
struct.setHostIsSet(true);
}
if (incoming.get(1)) {
struct.port = iprot.readI32();
struct.setPortIsSet(true);
}
if (incoming.get(2)) {
struct.zone = iprot.readString();
struct.setZoneIsSet(true);
}
}
}
}
| [
"kaoru.nish@gmail.com"
] | kaoru.nish@gmail.com |
4582b5e0470c5d139d1700c30e29d150ddfa6eb5 | fc36dd03c04de1cb0ebe6325893b9d8899a1ae3b | /src/com/bdsht/xinehealth/model/base/BaseXhStyle.java | c29d1ffaaa6cf59c58484ada0a62d53ee102bc1a | [] | no_license | NewcityEngineer/jfinal-easy-admin | 95f005dfbb89cad5ab7c3b4cf23ba4a6f022d96c | 94bb2a42984fb0343f13671b0ef3a1eb3ea0c1c1 | refs/heads/master | 2020-12-03T07:57:37.056921 | 2017-07-06T02:18:08 | 2017-07-06T02:18:08 | 95,642,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,527 | java | package com.bdsht.xinehealth.model.base;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.IBean;
/**
* Generated by JFinal, do not modify this file.
*/
@SuppressWarnings("serial")
public abstract class BaseXhStyle<M extends BaseXhStyle<M>> extends Model<M> implements IBean {
public void setId(java.lang.Integer id) {
set("id", id);
}
public java.lang.Integer getId() {
return get("id");
}
public void setSId(java.lang.String sId) {
set("sId", sId);
}
public java.lang.String getSId() {
return get("sId");
}
public void setFoodTitleTid(java.lang.String foodTitleTid) {
set("food_title_tId", foodTitleTid);
}
public java.lang.String getFoodTitleTid() {
return get("food_title_tId");
}
public void setName(java.lang.String name) {
set("name", name);
}
public java.lang.String getName() {
return get("name");
}
public void setDescription(java.lang.String description) {
set("description", description);
}
public java.lang.String getDescription() {
return get("description");
}
public void setRule(java.lang.String rule) {
set("rule", rule);
}
public java.lang.String getRule() {
return get("rule");
}
public void setElement(java.lang.String element) {
set("element", element);
}
public java.lang.String getElement() {
return get("element");
}
public void setMain(java.lang.String main) {
set("main", main);
}
public java.lang.String getMain() {
return get("main");
}
public void setOther(java.lang.String other) {
set("other", other);
}
public java.lang.String getOther() {
return get("other");
}
public void setPrescription(java.lang.String prescription) {
set("prescription", prescription);
}
public java.lang.String getPrescription() {
return get("prescription");
}
public void setImg(java.lang.String img) {
set("img", img);
}
public java.lang.String getImg() {
return get("img");
}
public void setOldTime(java.lang.String oldTime) {
set("oldTime", oldTime);
}
public java.lang.String getOldTime() {
return get("oldTime");
}
public void setNewTime(java.lang.String newTime) {
set("newTime", newTime);
}
public java.lang.String getNewTime() {
return get("newTime");
}
public void setTimestamp(java.lang.String timestamp) {
set("timestamp", timestamp);
}
public java.lang.String getTimestamp() {
return get("timestamp");
}
}
| [
"newcitysoft@163.com"
] | newcitysoft@163.com |
273b740ea44e90b825d3446413cf2f57bcb1e2cc | 527678c57106c33567145d8a4503bb9482dc6227 | /Java Core/Java Code File/ClassPractise/src/Chapter5/Palindromes.java | 9875be41667fe6b6a0b8a1c4fe1e9f9f7c63d062 | [
"MIT"
] | permissive | themizan404/JAVA-All | 2107ffee64b5aed27343b17822751ce694bacbbc | 55fc16fd0eaf9165047ebf0b790043ae49c3ced2 | refs/heads/master | 2023-03-06T05:27:15.164458 | 2021-02-19T20:01:11 | 2021-02-19T20:01:11 | 294,966,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | package Chapter5;
import java.util.Scanner;
public class Palindromes {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter a string
System.out.print("Enter a string: ");
String s = input.nextLine();
// The index of the first character in the string
int low = 0;
// The index of the last character in the string
int high = s.length() - 1;
boolean isPalindrome = true;
while (low < high) {
if (s.charAt(low) != s.charAt(high)) {
isPalindrome = false;
break;
}
low++;
high--;
}
if (isPalindrome) {
System.out.println(s + " is a palindrome");
} else {
System.out.println(s + " is not a palindrome");
}
}
}
| [
"mizanthecoder@gmail.com"
] | mizanthecoder@gmail.com |
ae43814dc5cd59f4b140c6f9119fd295cc479930 | a6b1e248484d230ac0281b9a72a6d3e8d4885ef8 | /src/main/java/com/example/demo/utils/UseCase.java | d260399330421e0f7c6fbd651b608aa96c6ceff8 | [] | no_license | ColadaFF/spring-by-use-case | 1e06839b50447e3ed23cfe99c6bba5d4e4a189ee | 9653a34a86f0e5c18a9af03eed182c0b06f58bf3 | refs/heads/master | 2023-01-14T07:41:14.971453 | 2020-11-25T20:00:18 | 2020-11-25T20:00:18 | 316,041,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package com.example.demo.utils;
public interface UseCase<INPUT extends ApplicationRequest, OUTPUT extends ApplicationResponse> {
OUTPUT process(INPUT input);
}
| [
"cbarrientos@ias.com.co"
] | cbarrientos@ias.com.co |
ae83ea82ab579ac0f415a2e10f9a6dbf1f2531ee | 2d5c4791438c457da1dc78e18bdfc32f2d0da18a | /eiff-framework-test-parent/eiff-framework-test/src/main/java/com/eiff/framework/test/utils/MockTool.java | 5699b475219846e0991d4fec66165fe297b06c78 | [] | no_license | mazhaohui0710/cool-framework | 632bb9fabc407d3b8cd9274c6168c3ebf95aab98 | c801e3096ea8f87cdc15b3057ed55e00e0240197 | refs/heads/master | 2021-09-21T00:21:48.760409 | 2018-08-17T10:11:28 | 2018-08-17T10:11:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.eiff.framework.test.utils;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.FactoryBean;
public class MockTool {
public static <T> T mockFactoryBean(final T t) {
if (t instanceof FactoryBean) {
FactoryBean<?> factory = (FactoryBean<?>) t;
try {
Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return t;
}
}).when(factory).getObject();
} catch (Exception e) {
e.printStackTrace();
}
}
return t;
}
}
| [
"lusong19868290@163.com"
] | lusong19868290@163.com |
6a1ca21da5d78bcefe89be0b0f68fb263f8e6ac9 | 0ed8e062104d23e4bcad2ad74b014600011e3235 | /src/main/java/mcjty/meecreeps/actions/ActionOptions.java | 65c773d68605fac3e23a23d608c07f0eaeae01a3 | [
"MIT"
] | permissive | Rafii2198/MeeCreeps | 42416bfdff8bed3ea8fe8cf1f5daa3481858793c | e1a245673a8582f47fa99758fe58513ec85b0ab6 | refs/heads/master | 2021-08-30T02:27:09.326503 | 2017-12-15T18:09:09 | 2017-12-15T18:09:09 | 113,909,335 | 0 | 0 | null | 2017-12-11T21:23:47 | 2017-12-11T21:15:52 | Java | UTF-8 | Java | false | false | 14,859 | java | package mcjty.meecreeps.actions;
import io.netty.buffer.ByteBuf;
import mcjty.meecreeps.MeeCreeps;
import mcjty.meecreeps.api.IActionContext;
import mcjty.meecreeps.config.Config;
import mcjty.meecreeps.entities.EntityMeeCreeps;
import mcjty.meecreeps.network.NetworkTools;
import mcjty.meecreeps.network.PacketHandler;
import mcjty.meecreeps.proxy.GuiProxy;
import mcjty.meecreeps.varia.SoundTools;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.Constants;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
public class ActionOptions implements IActionContext {
private final List<MeeCreepActionType> actionOptions;
private final List<MeeCreepActionType> maybeActionOptions;
private final BlockPos targetPos;
private final EnumFacing targetSide;
private final int dimension;
@Nullable private final UUID playerId;
private final int actionId;
private int timeout;
private Stage stage;
private MeeCreepActionType task;
private String furtherQuestionId;
private boolean paused;
private List<Pair<BlockPos, ItemStack>> drops = new ArrayList<>();
// playerId can be null in case we have a player-less action
public ActionOptions(List<MeeCreepActionType> actionOptions, List<MeeCreepActionType> maybeActionOptions,
BlockPos targetPos, EnumFacing targetSide, int dimension, @Nullable UUID playerId, int actionId) {
this.actionOptions = actionOptions;
this.maybeActionOptions = maybeActionOptions;
this.targetPos = targetPos;
this.targetSide = targetSide;
this.dimension = dimension;
this.playerId = playerId;
this.actionId = actionId;
timeout = 10;
stage = Stage.WAITING_FOR_SPAWN;
task = null;
furtherQuestionId = null;
paused = false;
}
public ActionOptions(ByteBuf buf) {
int size = buf.readInt();
actionOptions = new ArrayList<>();
while (size > 0) {
actionOptions.add(new MeeCreepActionType(NetworkTools.readStringUTF8(buf)));
size--;
}
size = buf.readInt();
maybeActionOptions = new ArrayList<>();
while (size > 0) {
maybeActionOptions.add(new MeeCreepActionType(NetworkTools.readStringUTF8(buf)));
size--;
}
targetPos = NetworkTools.readPos(buf);
targetSide = EnumFacing.VALUES[buf.readByte()];
dimension = buf.readInt();
if (buf.readBoolean()) {
playerId = new UUID(buf.readLong(), buf.readLong());
} else {
playerId = null;
}
actionId = buf.readInt();
timeout = buf.readInt();
stage = Stage.values()[buf.readByte()];
if (buf.readBoolean()) {
task = new MeeCreepActionType(NetworkTools.readStringUTF8(buf));
}
furtherQuestionId = NetworkTools.readStringUTF8(buf);
paused = buf.readBoolean();
// Drops not needed on client so no persistance
}
public ActionOptions(NBTTagCompound tagCompound) {
NBTTagList list = tagCompound.getTagList("options", Constants.NBT.TAG_STRING);
actionOptions = new ArrayList<>();
for (int i = 0 ; i < list.tagCount() ; i++) {
actionOptions.add(new MeeCreepActionType(list.getStringTagAt(i)));
}
list = tagCompound.getTagList("maybe", Constants.NBT.TAG_STRING);
maybeActionOptions = new ArrayList<>();
for (int i = 0 ; i < list.tagCount() ; i++) {
maybeActionOptions.add(new MeeCreepActionType(list.getStringTagAt(i)));
}
list = tagCompound.getTagList("drops", Constants.NBT.TAG_COMPOUND);
drops = new ArrayList<>();
for (int i = 0 ; i < list.tagCount() ; i++) {
NBTTagCompound tc = list.getCompoundTagAt(i);
BlockPos p = BlockPos.fromLong(tc.getLong("p"));
NBTTagCompound itemTag = tc.getCompoundTag("i");
ItemStack stack = new ItemStack(itemTag);
drops.add(Pair.of(p, stack));
}
dimension = tagCompound.getInteger("dim");
targetPos = BlockPos.fromLong(tagCompound.getLong("pos"));
targetSide = EnumFacing.VALUES[tagCompound.getByte("targetSide")];
if (tagCompound.hasKey("player")) {
playerId = tagCompound.getUniqueId("player");
} else {
playerId = null;
}
actionId = tagCompound.getInteger("actionId");
timeout = tagCompound.getInteger("timeout");
stage = Stage.getByCode(tagCompound.getString("stage"));
if (tagCompound.hasKey("task")) {
task = new MeeCreepActionType(tagCompound.getString("task"));
}
if (tagCompound.hasKey("fqid")) {
furtherQuestionId = tagCompound.getString("fqid");
} else {
furtherQuestionId = null;
}
paused = tagCompound.getBoolean("paused");
}
public void writeToBuf(ByteBuf buf) {
buf.writeInt(actionOptions.size());
for (MeeCreepActionType option : actionOptions) {
NetworkTools.writeStringUTF8(buf, option.getId());
}
buf.writeInt(maybeActionOptions.size());
for (MeeCreepActionType option : maybeActionOptions) {
NetworkTools.writeStringUTF8(buf, option.getId());
}
NetworkTools.writePos(buf, targetPos);
buf.writeByte(targetSide.ordinal());
buf.writeInt(dimension);
if (playerId != null) {
buf.writeBoolean(true);
buf.writeLong(playerId.getMostSignificantBits());
buf.writeLong(playerId.getLeastSignificantBits());
} else {
buf.writeBoolean(false);
}
buf.writeInt(actionId);
buf.writeInt(timeout);
buf.writeByte(stage.ordinal());
if (task != null) {
buf.writeBoolean(true);
NetworkTools.writeStringUTF8(buf, task.getId());
} else {
buf.writeBoolean(false);
}
NetworkTools.writeStringUTF8(buf, furtherQuestionId);
buf.writeBoolean(paused);
// Drops not needed on client so no persistance
}
public void writeToNBT(NBTTagCompound tagCompound) {
NBTTagList list = new NBTTagList();
for (MeeCreepActionType option : actionOptions) {
list.appendTag(new NBTTagString(option.getId()));
}
tagCompound.setTag("options", list);
list = new NBTTagList();
for (MeeCreepActionType option : maybeActionOptions) {
list.appendTag(new NBTTagString(option.getId()));
}
tagCompound.setTag("maybe", list);
list = new NBTTagList();
for (Pair<BlockPos, ItemStack> pair : drops) {
NBTTagCompound tc = new NBTTagCompound();
tc.setLong("p", pair.getKey().toLong());
tc.setTag("i", pair.getValue().writeToNBT(new NBTTagCompound()));
list.appendTag(tc);
}
tagCompound.setTag("drops", list);
tagCompound.setInteger("dim", dimension);
tagCompound.setLong("pos", targetPos.toLong());
tagCompound.setByte("targetSide", (byte) targetSide.ordinal());
if (playerId != null) {
tagCompound.setUniqueId("player", playerId);
}
tagCompound.setInteger("actionId", actionId);
tagCompound.setInteger("timeout", timeout);
tagCompound.setString("stage", stage.getCode());
if (task != null) {
tagCompound.setString("task", task.getId());
}
if (furtherQuestionId != null) {
tagCompound.setString("fqid", furtherQuestionId);
}
tagCompound.setBoolean("paused", paused);
}
public void registerDrops(BlockPos pos, @Nonnull List<ItemStack> drops) {
for (ItemStack drop : drops) {
// Drops can be empty because they can be 'consumed' by the entity
if (!drop.isEmpty()) {
this.drops.add(Pair.of(pos, drop.copy()));
}
}
}
public List<Pair<BlockPos, ItemStack>> getDrops() {
return drops;
}
public void clearDrops() {
drops.clear();
}
public List<MeeCreepActionType> getActionOptions() {
return actionOptions;
}
public List<MeeCreepActionType> getMaybeActionOptions() {
return maybeActionOptions;
}
@Override
public BlockPos getTargetPos() {
return targetPos;
}
@Override
public EnumFacing getTargetSide() {
return targetSide;
}
public int getDimension() {
return dimension;
}
public int getActionId() {
return actionId;
}
public Stage getStage() {
return stage;
}
public void setStage(Stage stage) {
this.stage = stage;
this.timeout = stage.getTimeout();
}
public boolean isPaused() {
return paused;
}
public void setPaused(boolean paused) {
this.paused = paused;
}
public MeeCreepActionType getTask() {
return task;
}
@Nullable
@Override
public String getFurtherQuestionId() {
return furtherQuestionId;
}
public void setTask(MeeCreepActionType task, @Nullable String furtherQuestionId) {
this.task = task;
this.furtherQuestionId = furtherQuestionId;
}
public boolean tick(World world) {
if (paused) {
return true;
}
timeout--;
if (timeout <= 0) {
timeout = 20;
switch (stage) {
case WAITING_FOR_SPAWN:
if (spawn(world, getTargetPos(), getTargetSide(), getActionId(), true)) {
setStage(Stage.OPENING_GUI);
} else {
EntityPlayer player = getPlayer();
if (player != null) {
PacketHandler.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.cant_spawn_meecreep"), (EntityPlayerMP) player);
}
return false;
}
break;
case OPENING_GUI:
if (!openGui()) {
return false;
}
setStage(Stage.WAITING_FOR_PLAYER_INPUT);
break;
case WAITING_FOR_PLAYER_INPUT:
// @todo some kind of timeout as well?
MinecraftServer server = DimensionManager.getWorld(0).getMinecraftServer();
EntityPlayerMP player = playerId == null ? null : server.getPlayerList().getPlayerByUUID(playerId);
if (player == null) {
// If player is gone we stop
return false;
}
break;
case WORKING:
// It is up to the entity to set stage to DONE when done early
setStage(Stage.TIME_IS_UP);
break;
case TIME_IS_UP:
break;
case TASK_IS_DONE:
break;
case DONE:
return false;
}
}
return true;
}
@Nullable
@Override
public EntityPlayer getPlayer() {
if (playerId == null) {
return null;
}
World world = DimensionManager.getWorld(0);
MinecraftServer server = world.getMinecraftServer();
return server.getPlayerList().getPlayerByUUID(playerId);
}
@Nullable
public UUID getPlayerId() {
return playerId;
}
private boolean openGui() {
if (playerId == null) {
return false;
}
MinecraftServer server = DimensionManager.getWorld(0).getMinecraftServer();
EntityPlayerMP player = server.getPlayerList().getPlayerByUUID(playerId);
if (player != null) {
PacketHandler.INSTANCE.sendTo(new PacketActionOptionToClient(this, GuiProxy.GUI_MEECREEP_QUESTION), player);
} else {
return false;
}
return true;
}
private static boolean validSpawnPoint(World world, BlockPos p) {
return world.isAirBlock(p) && (!world.isAirBlock(p.down()) || !world.isAirBlock(p.down(2))) && world.isAirBlock(p.up());
}
public static boolean spawn(World world, BlockPos targetPos, EnumFacing targetSide, int actionId, boolean doSound) {
BlockPos p;
if (validSpawnPoint(world, targetPos.offset(targetSide))) {
p = targetPos.offset(targetSide);
} else if (validSpawnPoint(world, targetPos.north())) {
p = targetPos.north();
} else if (validSpawnPoint(world, targetPos.south())) {
p = targetPos.south();
} else if (validSpawnPoint(world, targetPos.east())) {
p = targetPos.east();
} else if (validSpawnPoint(world, targetPos.west())) {
p = targetPos.west();
} else if (validSpawnPoint(world, targetPos.up())) {
p = targetPos.up();
} else {
return false;
}
EntityMeeCreeps entity = new EntityMeeCreeps(world);
entity.setLocationAndAngles(p.getX()+.5, p.getY(), p.getZ()+.5, 0, 0);
entity.setActionId(actionId);
world.spawnEntity(entity);
if (doSound && Config.meeCreepVolume > 0.01f) {
String snd = "intro1";
switch (entity.getRandom().nextInt(4)) {
case 0:
snd = "intro1";
break;
case 1:
snd = "intro2";
break;
case 2:
snd = "intro3";
break;
case 3:
snd = "intro4";
break;
}
SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(MeeCreeps.MODID, snd));
SoundTools.playSound(world, sound, p.getX(), p.getY(), p.getZ(), Config.meeCreepVolume, 1);
}
return true;
}
}
| [
"mcjty1@gmail.com"
] | mcjty1@gmail.com |
516ea073223a4ec19255552def27ac77e4a29a2b | 9d135a0115e1b43c4137725b96f529f45ddf31cd | /demo/app/src/main/java/com/cy/demo/bean/ModuleItem.java | ac28c24ac05c9f93f1beae9e71d733c39c842bdd | [] | no_license | a464704584/AndroidDemo | 75627cc0c72272a82bcfe8a062f320a4a81247e7 | e963621ea277d4d6c8349914836640503ef16a91 | refs/heads/master | 2022-12-12T10:25:09.208559 | 2020-09-03T10:19:09 | 2020-09-03T10:19:09 | 283,381,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package com.cy.demo.bean;
import androidx.databinding.ObservableField;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
/**
* @创建者 CY
* @创建时间 2020/7/29 13:08
* @描述 天逢门下,降魔大仙,摧魔伐恶,鹰犬当先,二将闻召,立至坛前,依律道奉令,神功帝宣,魔妖万鬼,诛专战无盖,太上圣力,浩荡无边,急急奉北帝律令
*/
public class ModuleItem extends ViewModel {
public final ObservableField<String> title=new ObservableField<>();
public Integer navId;
public ModuleItem(String title,Integer navId) {
this.navId = navId;
this.title.set(title);
}
} | [
"chengyu@hansintelligent.com"
] | chengyu@hansintelligent.com |
1cb51ef2f8623dbaa6b7e50100537675e1dbe03a | 043e1e6e066bcc5cc395a38d26ab1928a158847e | /android/newFTMS/app/src/main/java/ca/mcgill/ecse321/newftms/customizeMenu.java | 7714fa9f17fbdd97af1fcfb7b95da2c65507d130 | [] | no_license | MaryAnnChev/Term-Project | 24276e08f6774ab9f8d90f1ea924306cef2d3a1b | c70830516dc98c98e7db7146dc2cdfffdc5d3836 | refs/heads/master | 2020-12-24T06:54:51.724989 | 2016-12-02T20:30:35 | 2016-12-02T20:30:35 | 73,390,135 | 0 | 0 | null | 2016-11-10T14:35:16 | 2016-11-10T14:35:16 | null | UTF-8 | Java | false | false | 6,213 | java | package ca.mcgill.ecse321.newftms;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import ca.mcgill.ecse321.FTMS.controller.FTMSController;
import ca.mcgill.ecse321.FTMS.model.Menu;
import ca.mcgill.ecse321.FTMS.model.OrderManager;
import ca.mcgill.ecse321.FTMS.model.Supply;
public class customizeMenu extends AppCompatActivity {
FTMSController fc = new FTMSController();
private String dishSelected;
private Menu menuSelected;
private ArrayList<String> selectedRemoveSupplies;
private ArrayList<String> selectedExtraSupplies;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customize_menu);
OrderManager om = OrderManager.getInstance();
TextView t = (TextView) findViewById(R.id.customize_label);
t.setTextColor(Color.rgb(0, 0, 200));
dishSelected = getIntent().getStringExtra("dishSelected");
menuSelected = om.getMenu(dishSelected);
createRemoveSuppliesListView();
createExtraSuppliesListView();
}
private void createRemoveSuppliesListView() {
ListView mil = (ListView)findViewById(R.id.remove_supplies_list);
mil.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
int numberOfSupplies = menuSelected.getIngredients().size();
String[] items = new String[numberOfSupplies];
for (int i=0; i<numberOfSupplies; i++) {
items[i] = menuSelected.getIngredients().get(i).getFoodName();
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.menuitemcheck, R.id.menuitemcheckbox, items);
mil.setAdapter(adapter);
ListAdapter listAdapter = mil.getAdapter();
int totalItemsHeight = 0;
for (int itemPos = 0; itemPos < numberOfSupplies; itemPos++) {
View item = listAdapter.getView(itemPos, null, mil);
item.measure(0, 0);
totalItemsHeight += item.getMeasuredHeight();
}
int totalDividersHeight = mil.getDividerHeight() *
(numberOfSupplies - 1);
// Set list height.
ViewGroup.LayoutParams params = mil.getLayoutParams();
params.height = totalItemsHeight + totalDividersHeight;
mil.setLayoutParams(params);
mil.requestLayout();
selectedRemoveSupplies = new ArrayList<String>();
mil.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String selectedItem = ((TextView)view).getText().toString();
if(selectedRemoveSupplies.contains(selectedItem))
selectedRemoveSupplies.remove(selectedItem);
else
selectedRemoveSupplies.add(selectedItem);
}
});
}
private void createExtraSuppliesListView() {
ListView mil = (ListView)findViewById(R.id.extra_supplies_list);
mil.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
int numberOfSupplies = menuSelected.getIngredients().size();
String[] items = new String[numberOfSupplies];
for (int i=0; i<numberOfSupplies; i++) {
items[i] = menuSelected.getIngredients().get(i).getFoodName();
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.menuitemcheck, R.id.menuitemcheckbox, items);
mil.setAdapter(adapter);
ListAdapter listAdapter = mil.getAdapter();
int totalItemsHeight = 0;
for (int itemPos = 0; itemPos < numberOfSupplies; itemPos++) {
View item = listAdapter.getView(itemPos, null, mil);
item.measure(0, 0);
totalItemsHeight += item.getMeasuredHeight();
}
int totalDividersHeight = mil.getDividerHeight() *
(numberOfSupplies - 1);
// Set list height.
ViewGroup.LayoutParams params = mil.getLayoutParams();
params.height = totalItemsHeight + totalDividersHeight;
mil.setLayoutParams(params);
mil.requestLayout();
selectedExtraSupplies = new ArrayList<String>();
mil.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String selectedItem = ((TextView)view).getText().toString();
if(selectedExtraSupplies.contains(selectedItem))
selectedExtraSupplies.remove(selectedItem);
else
selectedExtraSupplies.add(selectedItem);
}
});
}
public void orderCustomizedMeal(View v) {
if (selectedRemoveSupplies.size() > 0 || selectedExtraSupplies.size() > 0) {
OrderManager om = OrderManager.getInstance();
Button btn = (Button) findViewById(R.id.order_customized_button);
Supply[] remove = new Supply[selectedRemoveSupplies.size()];
for(int i=0; i<selectedRemoveSupplies.size(); i++)
remove[i] = om.getFoodSupply(selectedRemoveSupplies.get(i));
Supply[] extra = new Supply[selectedExtraSupplies.size()];
for(int i=0; i<selectedExtraSupplies.size(); i++)
extra[i] = om.getFoodSupply(selectedExtraSupplies.get(i));
try {
fc.orderCustomizedMeal(menuSelected, remove, extra);
} catch (Exception e) {
btn.setError(e.getMessage());
}
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
setResult(4);
}
return super.onKeyDown(keyCode, event);
}
}
| [
"rony.azrak@gmail.com"
] | rony.azrak@gmail.com |
3b204422f0ded6f5167143d7fd5dc6e78b7a320d | 63931224870fbe17c695a8981121a97e7e920438 | /src/main/java/com/shpowernode/crm/workbench/bean/DicValue.java | 10e2b20e3e007d69b6564aecbafa0a3015899e03 | [] | no_license | java-xiaohu/bcykdl | 646f79722df4b573f7316f335fb95559117d50d7 | 9bbd9714d18f29bbbd1512463781803b222425e4 | refs/heads/master | 2023-02-07T06:42:09.861203 | 2020-12-30T12:39:52 | 2020-12-30T12:39:52 | 317,446,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,737 | java | package com.shpowernode.crm.workbench.bean;
import org.springframework.stereotype.Component;
import java.io.Serializable;
/**
* tbl_dic_value
* @author
*/
@Component
public class DicValue implements Serializable {
/**
* 主键,采用UUID
*/
private String id;
/**
* 不能为空,并且要求同一个字典类型下字典值不能重复,具有唯一性。
*/
private String value;
/**
* 可以为空
*/
private String text;
/**
* 可以为空,但不为空的时候,要求必须是正整数
*/
private String orderno;
/**
* 外键
*/
private String typecode;
private static final long serialVersionUID = 1L;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getOrderno() {
return orderno;
}
public void setOrderno(String orderno) {
this.orderno = orderno;
}
public String getTypecode() {
return typecode;
}
public void setTypecode(String typecode) {
this.typecode = typecode;
}
@Override
public String toString() {
return "DicValue{" +
"id='" + id + '\'' +
", value='" + value + '\'' +
", text='" + text + '\'' +
", orderno='" + orderno + '\'' +
", typecode='" + typecode + '\'' +
'}';
}
} | [
"kdlbcy@163.com"
] | kdlbcy@163.com |
6d6ce953b98e004829d74aea9a3ec22ff8ff7722 | c04d14f63a9922b5d8b75bc3ef7cbbe530cb4ba2 | /src/main/java/com/example/实例3/Demo.java | 3a2ac4256bc0c9006471be07103ddcbd9836efcb | [
"Apache-2.0"
] | permissive | X-rapido/design-patterns-23-nums | af73b1561f66dcc9c7fa0ecc7e07a9b2e9f92f9d | 282c3e6d34ddd4310fc6037503e1a5d8b311b877 | refs/heads/master | 2021-06-16T04:31:59.461321 | 2020-03-24T15:19:02 | 2020-03-24T15:19:02 | 188,687,419 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package com.example.实例3;
import com.example.实例3.model.DocParam;
import com.example.实例3.spi.DocUpdateService;
import com.example.实例3.spi.impl.DocUpdateServiceImpl;
/**
* 优点:
* 1、结构简单,易上手开发
* 2、新增业务,只需要在责任链中新增实现即可。
* 3、公共查询和变量,可以在 BaseContext 体现
* 4、Handler处理器可复用
* 缺点:
* 1、全局使用公共请求参数,特殊需要下层请求参数,无法依赖上层返回结果
* 2、返回属性值,后者会将前者覆盖(可以逻辑避免)
* 思考:
* 1、全局处理,性能问题
*/
public class Demo {
public static void main(String[] args) {
// 1、请求参数
DocParam param = new DocParam();
param.setItemId("1");
param.setName("作品1");
param.setArtisanId("01");
// 执行更新
DocUpdateService docUpdateService =new DocUpdateServiceImpl();
// docUpdateService.fullImportItem();
docUpdateService.fullImportArtisan();
// docUpdateService.updateItems("01");
}
}
| [
"1056856191@qq.com"
] | 1056856191@qq.com |
1245624169ac2e9a0b3eb395ab66560b20ef52d6 | 8b31b8ff30862c5383cb92b13db0741142b7eb97 | /src/codingbat/warmup_1/Max1020Solution.java | cde473e4f90c2e54eca7c4a9e45125b51b918cac | [] | no_license | RyuChaehyeong/java202009 | bb8777682c811b0fac64dde420d23ab8448bad05 | aa55c321bb0b4692b4991fb5ea772f5c8bbdc4b0 | refs/heads/master | 2023-01-22T01:52:00.246360 | 2020-12-08T01:15:16 | 2020-12-08T01:15:16 | 299,485,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package codingbat.warmup_1;
public class Max1020Solution {
public int max1020(int a, int b) {
if(b>a) {
int temp = a;
a = b;
b = temp;
}
//From here, a is bigger!
if(a>=10&&a<=20) return a;
if(b>=10&&b<=20) return b;
return 0;
}
}
| [
"fluid15@naver.com"
] | fluid15@naver.com |
3ff0a7c5364009786683d0f917d109e6ecae2db1 | a437c8ada8567cdfb017931e2e9617011691ff17 | /Hospital Management Web/src/model/Doctor.java | dd239955d7123d1b4d0f935cb962cfa04402e12e | [] | no_license | Mahadi024/Hospital-Management | 244d616a1c9c23c300c62e8985f24ab10f721b45 | 97d9b3f4899e5ca855d51136650d3aa5dbb02b19 | refs/heads/master | 2020-04-02T16:34:56.935710 | 2018-10-25T05:17:03 | 2018-10-25T05:17:03 | 154,604,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,038 | java | package model;
public class Doctor {
int doctorId;
String doctorName;
String doctorSpeciality;
int doctorCharge;
String doctorVisitingDay;
String doctorContact;
public Doctor(){}
public Doctor(int doctorId, String doctorName, String doctorSpeciality, int doctorCharge, String doctorVisitingDay,
String doctorContact) {
super();
this.doctorId = doctorId;
this.doctorName = doctorName;
this.doctorSpeciality = doctorSpeciality;
this.doctorCharge = doctorCharge;
this.doctorVisitingDay = doctorVisitingDay;
this.doctorContact = doctorContact;
}
public Doctor(String doctorName, String doctorSpeciality, int doctorCharge, String doctorVisitingDay,
String doctorContact) {
super();
this.doctorName = doctorName;
this.doctorSpeciality = doctorSpeciality;
this.doctorCharge = doctorCharge;
this.doctorVisitingDay = doctorVisitingDay;
this.doctorContact = doctorContact;
}
public int getDoctorId() {
return doctorId;
}
public void setDoctorId(int doctorId) {
this.doctorId = doctorId;
}
public String getDoctorName() {
return doctorName;
}
public void setDoctorName(String doctorName) {
this.doctorName = doctorName;
}
public String getDoctorSpeciality() {
return doctorSpeciality;
}
public void setDoctorSpeciality(String doctorSpeciality) {
this.doctorSpeciality = doctorSpeciality;
}
public int getDoctorCharge() {
return doctorCharge;
}
public void setDoctorCharge(int doctorCharge) {
this.doctorCharge = doctorCharge;
}
public String getDoctorVisitingDay() {
return doctorVisitingDay;
}
public void setDoctorVisitingDay(String doctorVisitingDay) {
this.doctorVisitingDay = doctorVisitingDay;
}
public String getDoctorContact() {
return doctorContact;
}
public void setDoctorContact(String doctorContact) {
this.doctorContact = doctorContact;
}
@Override
public String toString() {
return getDoctorId()+","+getDoctorName()+","+getDoctorSpeciality()+","+getDoctorCharge()+","+getDoctorVisitingDay()+","+getDoctorContact();
}
}
| [
"mahadihasan.parash@gmail.com"
] | mahadihasan.parash@gmail.com |
7040bebf0cc0ce22c937d01c560b1ced8d766560 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/69/org/apache/commons/math/util/MathUtils_sign_1425.java | bae1e14b2179e33f338b4b012e6b6d77e3db77fe | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,016 | java |
org apach common math util
addit built function link math
version revis date
math util mathutil
return href http mathworld wolfram sign html sign
code code
method return
param
depend sign
sign
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
f84ef55c1479e887efd51b5422de5c76f865ff95 | bc6e0a651fe57fb849c148353b0d14799938da66 | /MyZoomControl/app/src/main/java/com/mizanthecoder/myzoomcontrol/MainActivity.java | 0e3219f2e651513dfb7ba6b144950b6d9fb2e089 | [] | no_license | themizan404/Android-main | 0843563ca379506c825c5053306c15a4a0edb96f | 91dd5b70ba2ca41f72f698a1aea71eb918c4f8c2 | refs/heads/main | 2023-03-25T23:54:55.495028 | 2021-03-27T17:05:27 | 2021-03-27T17:05:27 | 314,852,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,683 | java | package com.mizanthecoder.myzoomcontrol;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import android.widget.ZoomControls;
public class MainActivity extends AppCompatActivity {
private ImageView imageView;
private ZoomControls zoomControls;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView) findViewById(R.id.zoomImage);
zoomControls = (ZoomControls) findViewById(R.id.zoomControl);
zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Zoom IN", Toast.LENGTH_SHORT).show();
float x =imageView.getScaleX();
float y =imageView.getScaleY();
if (x<11 && y<11){
imageView.setScaleX((float)x+1);
imageView.setScaleY((float)y+1);
}
}
});
zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Zoom OUT", Toast.LENGTH_SHORT).show();
float x =imageView.getScaleX();
float y =imageView.getScaleY();
if (x>1 && y>1){
imageView.setScaleX((float)x-1);
imageView.setScaleY((float)y-1);
}
}
});
}
} | [
"mizanthecoder@gmail.com"
] | mizanthecoder@gmail.com |
8d9541028c5aaba3456a9bae9c195110e0710a68 | bfdbdfdf6d78bc138bc1e3790c5fb982b6ae4ea2 | /Option/src/Node.java | aa623289c00c464e2e04be7057fcba7ba8d9e51f | [] | no_license | kimo2700/finance_option- | ec13c6720b80d1c79f925f02ede0dbf3462173e6 | e2e6e7c7fd24b97f9400e5046066fc4b42c76bf4 | refs/heads/master | 2022-10-06T03:09:53.350936 | 2020-06-10T03:59:01 | 2020-06-10T03:59:01 | 271,173,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java |
public final class Node {
/*Node(double assetPrice,double step,double p,double d){
this.assetPrice=assetPrice;
this.step=step;
//System.out.println(assetPrice);
if(step>0) {
this.upperChild=new Node (assetPrice*p,step-1,p,d);
this.lowerChild=new Node(assetPrice*d,step-1,p,d);
}
else this.leaf=true;}/*/
public double assetPrice ;
public double payOff ;
public double intrValue;
public Node upperChild;
public Node lowerChild;
public double fugitValue;
public int level;
public boolean EEX=false;
Node (){
this.level=0;
this.assetPrice=0;
this.payOff=0;
this.upperChild=null;
this.lowerChild=null;
}
Node(int n ,double p){
this.level=n;
this.assetPrice=p;
this.payOff=0;
this.upperChild=null;
this.lowerChild=null;
}
public boolean isLeaf(int n){
if(level==n)
return true;
else
return false;
}
}
| [
"kimomeka02@gmail.com"
] | kimomeka02@gmail.com |
1c23e8f2bcd1ecaa570f860de2354b56d5c66147 | 22e34a4f428f420c18e4e887cba5419b10ffd0c7 | /src/com/clyang/behavior/interpreter/Constant.java | a093f263c8920418a783a7ba1b8f0be846b3c98d | [] | no_license | 924723498/designModel | eec68f5a0590c587db2da592a69bbc11d5d2c627 | a7f34907b47e156a19d3c8a3ca84177ea0776eb6 | refs/heads/master | 2020-09-01T11:09:19.303427 | 2019-11-28T08:15:25 | 2019-11-28T08:15:25 | 218,946,519 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.clyang.behavior.interpreter;
import java.util.Objects;
public class Constant extends Expression{
private boolean value;
public Constant(boolean value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o){
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Constant constant = (Constant) o;
return value == constant.value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean interpret(Context ctx) {
return value;
}
@Override
public String toString() {
return " |" +value+ "| ";
}
}
| [
"924723498@qq.com"
] | 924723498@qq.com |
d949cda7ff053243d3e1326c798b6824e659e8af | ae7ddef273da33ed0e49b5b5c4bdfa817558c838 | /Design Patterns/src/main/java/com/journaldev/behavioral/template/method/WoodenHouse.java | da585ef0f00512c9b003ac70e19226d013d807ef | [] | no_license | awageah/journaldev-design-patterns | 14bbb7579aeac81313909bab22a0a58828540de1 | 8af308a0b716552b36975b24244fc4641edb0add | refs/heads/main | 2023-07-26T17:49:53.966443 | 2021-09-13T13:23:56 | 2021-09-13T13:23:56 | 396,084,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.journaldev.behavioral.template.method;
public class WoodenHouse extends HouseTemplate {
@Override
public void buildWalls() {
System.out.println("Building Wooden Walls");
}
@Override
public void buildPillars() {
System.out.println("Building Pillars with Wood coating");
}
}
| [
"aymn.wageah@gmail.com"
] | aymn.wageah@gmail.com |
c9ab1fd0816fa0e824f6835be894ad65b8167278 | b342f91cc99eb1ca53c19ce3efd31b491ea747ec | /FeesCornerStageOne/serverstartup/src/com/feescorner/serverstartup/factoryrepository/GenericRepositoryImpl.java | b88830adc98d977911b55d39f5588aed4d5dd8be | [] | no_license | SolutionTag/fees_corner_at_developingstage | dc291ab1863d468428536e0a1fe69ce715e97165 | 16aa294d873fc4a1f0aea3cb2942adb5b614d513 | refs/heads/master | 2020-04-06T04:22:24.428481 | 2015-08-27T09:21:33 | 2015-08-27T09:21:33 | 28,000,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,174 | java | /**
*
CODED BY CODED DATE VERSION MADE_CHANGES
Aniruthan Dec 26, 2014 TODO
*/
package com.feescorner.serverstartup.factoryrepository;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import org.apache.log4j.Logger;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.JpaEntityInformationSupport;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.data.repository.NoRepositoryBean;
@SuppressWarnings("unchecked")
@NoRepositoryBean
public class GenericRepositoryImpl<T, ID extends Serializable>
extends SimpleJpaRepository<T, ID> implements GenericRepository<T, ID> , Serializable{
private static final long serialVersionUID = 1L;
static Logger logger = Logger.getLogger(GenericRepositoryImpl.class);
private final JpaEntityInformation<T, ?> entityInformation;
private final EntityManager em;
private final DefaultPersistenceProvider provider;
private Class<?> springDataRepositoryInterface;
public Class<?> getSpringDataRepositoryInterface() {
return springDataRepositoryInterface;
}
public void setSpringDataRepositoryInterface(
Class<?> springDataRepositoryInterface) {
this.springDataRepositoryInterface = springDataRepositoryInterface;
}
/**
* Creates a new {@link SimpleJpaRepository} to manage objects of the given
* {@link JpaEntityInformation}.
*
* @param entityInformation
* @param entityManager
*/
public GenericRepositoryImpl (JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager , Class<?> springDataRepositoryInterface) {
super(entityInformation, entityManager);
this.entityInformation = entityInformation;
this.em = entityManager;
this.provider = DefaultPersistenceProvider.fromEntityManager(entityManager);
this.springDataRepositoryInterface = springDataRepositoryInterface;
}
/**
* Creates a new {@link SimpleJpaRepository} to manage objects of the given
* domain type.
*
* @param domainClass
* @param em
*/
public GenericRepositoryImpl(Class<T> domainClass, EntityManager em) {
this(JpaEntityInformationSupport.getMetadata(domainClass, em), em, null);
}
public <S extends T> S save(S entity)
{
if (this.entityInformation.isNew(entity)) {
this.em.persist(entity);
flush();
return entity;
}
entity = this.em.merge(entity);
flush();
return entity;
}
public T saveWithoutFlush(T entity)
{
return
super.save(entity);
}
public List<T> saveWithoutFlush(Iterable<? extends T> entities)
{
List<T> result = new ArrayList<T>();
if (entities == null) {
return result;
}
for (T entity : entities) {
result.add(saveWithoutFlush(entity));
}
return result;
}
} | [
"Aniruthan@Aniruthan-PC"
] | Aniruthan@Aniruthan-PC |
27e3aa1b41d15fe9bc7a3b70e34ede7f10f48a23 | fb7cfbc4a914ba3f27344a3fe85db601a21dd57e | /app/src/main/java/com/yj/robust/ui/adapter/judgeImgParamsAdapter.java | fb549c78c3177f4dcbec9970b19ff6fb6bf91072 | [] | no_license | zhouxiang130/Robust | f163d68a2e00bee72a985ee6cebe37a8131e2c0d | fb1faf755d4dd6aab267960a95bf9aea00d8c6b0 | refs/heads/master | 2020-07-14T15:16:51.019563 | 2019-09-08T13:00:10 | 2019-09-08T13:00:10 | 205,341,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,251 | java | package com.yj.robust.ui.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.yj.robust.R;
import com.yj.robust.base.URLBuilder;
import java.util.List;
/**
* Created by Administrator on 2018/5/9 0009.
*/
public class judgeImgParamsAdapter extends BaseAdapter {
private static final String TAG = "judgeImgParamsAdapter";
private final List<String> rechargeBean;
LayoutInflater layoutInflater;
private Context context = null;
public judgeImgParamsAdapter(Context context, List<String> rechargeBean) {
this.rechargeBean = rechargeBean;
this.layoutInflater = LayoutInflater.from(context);
this.context = context;
}
@Override
public int getCount() {
return rechargeBean == null ? 0 : rechargeBean.size();
}
@Override
public Object getItem(int position) {
return rechargeBean.get(position);
}
@Override
public long getItemId(int position) {
return rechargeBean == null ? 0 : rechargeBean.size();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder ;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = layoutInflater.inflate(R.layout.layout_item_recharge, null);
viewHolder.item_judge_img_ = (ImageView) convertView.findViewById(R.id.item_judge_img_);//充值金额
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Log.i(TAG, "getView: " + rechargeBean.size()+ " ----" +position + "--------"+ URLBuilder.getUrl(rechargeBean.get(position)));
Glide.with(context)
.load(URLBuilder.getUrl(rechargeBean.get(position)))
.asBitmap()
.error(R.mipmap.default_goods)
.centerCrop()
.into(viewHolder.item_judge_img_);
return convertView;
}
class ViewHolder {
ImageView item_judge_img_;
}
} | [
"1141681281@qq.com"
] | 1141681281@qq.com |
a5e1ce77c9c36d99b89beda0e00965f2622ca63d | c0d53f9756ff4f2b2a5810d0087a0e33bdd2858c | /src/main/java/com/frates/wineapi/controller/WineController.java | 8e52635d562634abd60a599d5d74884eab3387a4 | [
"MIT"
] | permissive | ebelisia/wine-api | 099835a5026e8cfda4c33473610c7a3c0ba2112b | 3738b98b2290d4aa42ae464e6c8eebeb190238ea | refs/heads/main | 2023-04-02T02:57:48.567054 | 2021-04-03T21:00:18 | 2021-04-03T21:00:18 | 354,389,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,842 | java | package com.frates.wineapi.controller;
import com.frates.wineapi.domain.model.Wine;
import com.frates.wineapi.domain.repository.WineRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/wines")
public class WineController {
@Autowired
private WineRepository wineRepository;
@GetMapping
@ResponseStatus(HttpStatus.OK)
public List<Wine> getWines() {
return wineRepository.findAll();
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public Wine postWine(@RequestBody Wine wine) {
return wineRepository.save(wine);
}
@DeleteMapping("{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity<Wine> deleteWine(@PathVariable Long id) {
try {
if (!wineRepository.existsById(id)) {
return ResponseEntity.notFound().build();
}
wineRepository.deleteById(id);
return ResponseEntity.noContent().build();
}
catch (Exception e){
return ResponseEntity.badRequest().build();
}
}
@PutMapping("{id}")
@ResponseStatus(HttpStatus.OK)
public ResponseEntity<Wine> putWine(@PathVariable Long id,
@RequestBody Wine wine) {
try {
if (!wineRepository.existsById(id)) {
return ResponseEntity.notFound().build();
}
wine.setId(id);
wine = wineRepository.save(wine);
return ResponseEntity.ok(wine);
}
catch (Exception e){
return ResponseEntity.badRequest().build();
}
}
}
| [
"eduardo.belisia@gmail.com"
] | eduardo.belisia@gmail.com |
c7ef3b7a8558c99e64d101847770f9a57532ae4a | d4a1ffc1d81a0ca34d3800435b831b963f3b1981 | /CTCII/src/pkgch1/Qs1_6.java | ae86f5af17a9e9f035351a920207791683fd3fb7 | [] | no_license | jkim2390/juliesRepo | 2be9b95f16bd95c1041e4f643bce2edf45d0abd7 | 523d5cd178660a3b1964dec54fec6f6ff2b0d4c5 | refs/heads/master | 2021-01-20T10:00:12.646349 | 2017-09-05T04:59:16 | 2017-09-05T04:59:16 | 101,618,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package pkgch1;
public class Qs1_6 {
public int[][] rotate() {
int[][] arr = new int[][] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 }, { 13, 14, 15, 16 } };
int temp;
int[][] newtemp = new int[4][4];
int cnt = arr.length - 1;
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr.length; j++) {
temp = arr[i][j];
// System.out.println(temp);
newtemp[j][cnt] = temp;
System.out.println("ret: " + j + "/" + cnt + " " + newtemp[j][cnt]);
}
cnt--;
if (cnt < 0) {
break;
}
}
//print new arr
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr.length; j++) {
System.out.println(newtemp[i][j]);
}
}
return newtemp;
}
}
| [
"jkim2390@gmail.com"
] | jkim2390@gmail.com |
6d4e8b2b9a6ed62c4d01bd1301b54895d98a0a49 | 87554a8655455004ab00d1859b9033f5c76d9adb | /app/src/main/java/sokoloma777/myfirstapplication/MainActivity.java | d85bc7b1f2cf0a9c0c46129796e0fb94c579dd0c | [] | no_license | Xena777/fourth-repo | 2fe6aada38ca0b658d8bb73666b466ec28071a7c | c5404f3d821b81cce91a2ad9cc873c73b22aad46 | refs/heads/master | 2022-10-15T08:13:38.148709 | 2020-06-13T12:49:47 | 2020-06-13T12:49:47 | 272,009,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package sokoloma777.myfirstapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
private ListView listOfHeroes;
private String [] arrayOfHeroes;
private ArrayAdapter adapterForHeroes;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar my_toolbar = findViewById(R.id.my_toolbar);
setSupportActionBar(my_toolbar);
if (my_toolbar != null) {
my_toolbar.setTitle(R.string.header);
}
listOfHeroes = findViewById(R.id.heroesListView);
arrayOfHeroes = getResources().getStringArray(R.array.heroes);
adapterForHeroes = new ArrayAdapter(this, android.R.layout.simple_list_item_1, arrayOfHeroes);
listOfHeroes.setAdapter(adapterForHeroes);
listOfHeroes.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(MainActivity.this, Activity_second.class);
intent.putExtra("Hero", position);
startActivity(intent);
}
});
}
}
| [
"sokoloma777@yandex.ru"
] | sokoloma777@yandex.ru |
46f0532d5c93af8c0c5217a3ee926371a35b4690 | d1d6f12ca1f49088aa29298a0e2c977dc8ad7978 | /src/a_variables/Concatenate.java | 43458aa3e8ecaa2efb012c3f92b5ec8188ef20bb | [] | no_license | fabiandzp/Java-Fundamentals-Course | 68fd5d8a747b52a1343d5d75c77c8bdbdea2335e | c48b64ca977a13e19bcdf8eaacd59210db7dfdf3 | refs/heads/master | 2023-04-14T20:52:43.009127 | 2019-06-09T23:46:21 | 2019-06-09T23:46:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package a_variables;
public class Concatenate {
public static void main (String[] args){
String usuario = "Juan";
String saludar = "Hola";
System.out.println (saludar + " " + usuario );
System.out.println ("Saludos mi nombre es " + usuario );
}
}
| [
"fabiandzp@live.com"
] | fabiandzp@live.com |
768c9de2c997140a99f550a3591bc95283bd6633 | e50397841df4fd60d3c9bf9f44b3883a29bef6f8 | /src/org/usfirst/frc/team2175/log/LoggingConfig.java | a1a562c5803945fbee479b8271ffbde0dfd3780b | [] | no_license | frc-2175/2018RobotCode | 424317aeb764eeedc604cab4eac1e443bc783570 | 97d122d74763606ac40d30a1a2e77a975c87a9e6 | refs/heads/master | 2021-05-14T02:10:12.384937 | 2019-01-06T19:53:29 | 2019-01-06T19:53:29 | 116,587,615 | 4 | 0 | null | 2018-01-26T23:13:16 | 2018-01-07T18:05:08 | Java | UTF-8 | Java | false | false | 1,733 | java | package org.usfirst.frc.team2175.log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
public class LoggingConfig {
/** Set to root package, and must match one set in logging.properties. */
public static final String ROOT_LOGGER_NAME = "org.usfirst.frc.team2175";
public static final String PROPERTY_FILE_PATH = "/home/lvuser/logging.properties";
public static void initialize() {
new File("/home/lvuser/logTemp").mkdirs();
initializeFileLog(PROPERTY_FILE_PATH);
}
protected static void initializeFileLog(final String propertyFile) {
System.out.println("Initializing file logging");
final LogManager logManager = LogManager.getLogManager();
// regretfully the icky java.util.logging won't allow adding an existing
// property file to it so we have to reload the properties file again
try (final InputStream in = new FileInputStream(propertyFile)) {
logManager.readConfiguration(in);
} catch (final FileNotFoundException e) {
throw new IllegalStateException(
"Did not find logging properties file=" + propertyFile + ", msg=" + e.getMessage(), e);
} catch (SecurityException | IOException e) {
throw new IllegalStateException("Unable to read logging properties", e);
}
final String levelProperty = logManager.getProperty("java.util.logging.FileHandler.level");
final Logger log = Logger.getLogger(LoggingConfig.class.getName());
final Level level = log.getLevel();
log.info("File logging initialized, actual logging level=" + level + ", configured level=" + levelProperty);
}
}
| [
"kl.forthwind@gmail.com"
] | kl.forthwind@gmail.com |
c7631841e6d98011aa8cafca9e09f17ec3b6ad26 | d96f6e8ac41dee90937b2ebc9dcb1ea17a365654 | /datatypes-src/org/etsi/uri/TS102204/v1_1_2/descriptors/MSS_StatusReqDescriptor.java | ab80b4fee6fa66081c7f5e4ecfffd5df2515c733 | [
"Apache-2.0",
"LicenseRef-scancode-other-permissive"
] | permissive | pihvi/laverca | 72c7dd46cf313d25ba26ff5c6fed92a827a44ad6 | bff80bd21a9c0d30b83dea4e9757baba8269a9af | refs/heads/master | 2020-11-26T09:33:33.524058 | 2011-06-23T10:59:51 | 2011-06-23T10:59:51 | 1,940,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,567 | java | /*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
* Schema.
* $Id$
*/
package org.etsi.uri.TS102204.v1_1_2.descriptors;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.etsi.uri.TS102204.v1_1_2.MSS_StatusReq;
/**
* Class MSS_StatusReqDescriptor.
*
* @version $Revision$ $Date$
*/
public class MSS_StatusReqDescriptor extends org.etsi.uri.TS102204.v1_1_2.descriptors.MSS_StatusReqTypeDescriptor {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field _elementDefinition.
*/
private boolean _elementDefinition;
/**
* Field _nsPrefix.
*/
private java.lang.String _nsPrefix;
/**
* Field _nsURI.
*/
private java.lang.String _nsURI;
/**
* Field _xmlName.
*/
private java.lang.String _xmlName;
/**
* Field _identity.
*/
private org.exolab.castor.xml.XMLFieldDescriptor _identity;
//----------------/
//- Constructors -/
//----------------/
public MSS_StatusReqDescriptor() {
super();
setExtendsWithoutFlatten(new org.etsi.uri.TS102204.v1_1_2.descriptors.MSS_StatusReqTypeDescriptor());
_nsURI = "http://uri.etsi.org/TS102204/v1.1.2#";
_xmlName = "MSS_StatusReq";
_elementDefinition = true;
}
//-----------/
//- Methods -/
//-----------/
/**
* Method getAccessMode.
*
* @return the access mode specified for this class.
*/
@Override()
public org.exolab.castor.mapping.AccessMode getAccessMode(
) {
return null;
}
/**
* Method getIdentity.
*
* @return the identity field, null if this class has no
* identity.
*/
@Override()
public org.exolab.castor.mapping.FieldDescriptor getIdentity(
) {
if (_identity == null) {
return super.getIdentity();
}
return _identity;
}
/**
* Method getJavaClass.
*
* @return the Java class represented by this descriptor.
*/
@Override()
public java.lang.Class getJavaClass(
) {
return org.etsi.uri.TS102204.v1_1_2.MSS_StatusReq.class;
}
/**
* Method getNameSpacePrefix.
*
* @return the namespace prefix to use when marshaling as XML.
*/
@Override()
public java.lang.String getNameSpacePrefix(
) {
return _nsPrefix;
}
/**
* Method getNameSpaceURI.
*
* @return the namespace URI used when marshaling and
* unmarshaling as XML.
*/
@Override()
public java.lang.String getNameSpaceURI(
) {
return _nsURI;
}
/**
* Method getValidator.
*
* @return a specific validator for the class described by this
* ClassDescriptor.
*/
@Override()
public org.exolab.castor.xml.TypeValidator getValidator(
) {
return this;
}
/**
* Method getXMLName.
*
* @return the XML Name for the Class being described.
*/
@Override()
public java.lang.String getXMLName(
) {
return _xmlName;
}
/**
* Method isElementDefinition.
*
* @return true if XML schema definition of this Class is that
* of a global
* element or element with anonymous type definition.
*/
public boolean isElementDefinition(
) {
return _elementDefinition;
}
}
| [
"mikaeljl@8882375b-f798-4923-9e66-ffa807b0447f"
] | mikaeljl@8882375b-f798-4923-9e66-ffa807b0447f |
ff7634bb3faa03438782198c5a181afb76575220 | 2d0e4d410607ef8103856ac5922e5c1753d8f067 | /src/main/java/com/example/controller/HelloController.java | ae3ee6e04ef5b30c1d6d40d78e9b4e4496611be4 | [] | no_license | son199967/mangxahoi | 991fbb392e6db3bd5a979f5bbabd3b2cef3a1b61 | 97dadf4c1ae3ab65c2830173d475a1b11f7d1feb | refs/heads/master | 2023-01-01T16:14:30.519547 | 2020-09-26T07:47:11 | 2020-09-26T07:47:11 | 298,755,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
@Controller
@SessionAttributes("user")
public class HelloController {
@RequestMapping(value = "/home", method = RequestMethod.GET)
public String login(Model model) {
return "home";
}
}
| [
"sonnguyen@Sons-MacBook-Pro.local"
] | sonnguyen@Sons-MacBook-Pro.local |
41e53eaa3f3f0339d74b584cc5ac9a4f6dfcd77d | 4d6f449339b36b8d4c25d8772212bf6cd339f087 | /netreflected/src/Framework/System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a/system/web/ui/HtmlTextWriterAttribute.java | c717d22ed1ae37a6db910f4856178668cfb48cda | [
"MIT"
] | permissive | lvyitian/JCOReflector | 299a64550394db3e663567efc6e1996754f6946e | 7e420dca504090b817c2fe208e4649804df1c3e1 | refs/heads/master | 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,156 | java | /*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* 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.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.web.ui;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
// Import section
// PACKAGE_IMPORT_SECTION
/**
* The base .NET class managing System.Web.UI.HtmlTextWriterAttribute, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Web.UI.HtmlTextWriterAttribute" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Web.UI.HtmlTextWriterAttribute</a>
*/
public class HtmlTextWriterAttribute extends NetObject {
/**
* Fully assembly qualified name: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
*/
public static final String assemblyFullName = "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
/**
* Assembly name: System.Web
*/
public static final String assemblyShortName = "System.Web";
/**
* Qualified class name: System.Web.UI.HtmlTextWriterAttribute
*/
public static final String className = "System.Web.UI.HtmlTextWriterAttribute";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumReflected = createEnum();
JCEnum classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
static JCEnum createEnum() {
try {
return bridge.GetEnum(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public HtmlTextWriterAttribute(Object instance) {
super(instance);
if (instance instanceof JCObject) {
try {
String enumName = NetEnum.GetName(classType, (JCObject)instance);
classInstance = enumReflected.fromValue(enumName);
} catch (Throwable t) {
if (JCOBridgeInstance.getDebug())
t.printStackTrace();
classInstance = enumReflected;
}
} else if (instance instanceof JCEnum) {
classInstance = (JCEnum)instance;
}
}
public HtmlTextWriterAttribute() {
super();
// add reference to assemblyName.dll file
try {
addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
} catch (Throwable jcne) {
if (JCOBridgeInstance.getDebug())
jcne.printStackTrace();
}
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public JCType getJCOType() {
return classType;
}
final static HtmlTextWriterAttribute getFrom(JCEnum object, String value) {
try {
return new HtmlTextWriterAttribute(object.fromValue(value));
} catch (JCException e) {
return new HtmlTextWriterAttribute(object);
}
}
// Enum fields section
public static HtmlTextWriterAttribute Accesskey = getFrom(enumReflected, "Accesskey");
public static HtmlTextWriterAttribute Align = getFrom(enumReflected, "Align");
public static HtmlTextWriterAttribute Alt = getFrom(enumReflected, "Alt");
public static HtmlTextWriterAttribute Background = getFrom(enumReflected, "Background");
public static HtmlTextWriterAttribute Bgcolor = getFrom(enumReflected, "Bgcolor");
public static HtmlTextWriterAttribute Border = getFrom(enumReflected, "Border");
public static HtmlTextWriterAttribute Bordercolor = getFrom(enumReflected, "Bordercolor");
public static HtmlTextWriterAttribute Cellpadding = getFrom(enumReflected, "Cellpadding");
public static HtmlTextWriterAttribute Cellspacing = getFrom(enumReflected, "Cellspacing");
public static HtmlTextWriterAttribute Checked = getFrom(enumReflected, "Checked");
public static HtmlTextWriterAttribute Class = getFrom(enumReflected, "Class");
public static HtmlTextWriterAttribute Cols = getFrom(enumReflected, "Cols");
public static HtmlTextWriterAttribute Colspan = getFrom(enumReflected, "Colspan");
public static HtmlTextWriterAttribute Disabled = getFrom(enumReflected, "Disabled");
public static HtmlTextWriterAttribute For = getFrom(enumReflected, "For");
public static HtmlTextWriterAttribute Height = getFrom(enumReflected, "Height");
public static HtmlTextWriterAttribute Href = getFrom(enumReflected, "Href");
public static HtmlTextWriterAttribute Id = getFrom(enumReflected, "Id");
public static HtmlTextWriterAttribute Maxlength = getFrom(enumReflected, "Maxlength");
public static HtmlTextWriterAttribute Multiple = getFrom(enumReflected, "Multiple");
public static HtmlTextWriterAttribute Name = getFrom(enumReflected, "Name");
public static HtmlTextWriterAttribute Nowrap = getFrom(enumReflected, "Nowrap");
public static HtmlTextWriterAttribute Onchange = getFrom(enumReflected, "Onchange");
public static HtmlTextWriterAttribute Onclick = getFrom(enumReflected, "Onclick");
public static HtmlTextWriterAttribute ReadOnly = getFrom(enumReflected, "ReadOnly");
public static HtmlTextWriterAttribute Rows = getFrom(enumReflected, "Rows");
public static HtmlTextWriterAttribute Rowspan = getFrom(enumReflected, "Rowspan");
public static HtmlTextWriterAttribute Rules = getFrom(enumReflected, "Rules");
public static HtmlTextWriterAttribute Selected = getFrom(enumReflected, "Selected");
public static HtmlTextWriterAttribute Size = getFrom(enumReflected, "Size");
public static HtmlTextWriterAttribute Src = getFrom(enumReflected, "Src");
public static HtmlTextWriterAttribute Style = getFrom(enumReflected, "Style");
public static HtmlTextWriterAttribute Tabindex = getFrom(enumReflected, "Tabindex");
public static HtmlTextWriterAttribute Target = getFrom(enumReflected, "Target");
public static HtmlTextWriterAttribute Title = getFrom(enumReflected, "Title");
public static HtmlTextWriterAttribute Type = getFrom(enumReflected, "Type");
public static HtmlTextWriterAttribute Valign = getFrom(enumReflected, "Valign");
public static HtmlTextWriterAttribute Value = getFrom(enumReflected, "Value");
public static HtmlTextWriterAttribute Width = getFrom(enumReflected, "Width");
public static HtmlTextWriterAttribute Wrap = getFrom(enumReflected, "Wrap");
public static HtmlTextWriterAttribute Abbr = getFrom(enumReflected, "Abbr");
public static HtmlTextWriterAttribute AutoComplete = getFrom(enumReflected, "AutoComplete");
public static HtmlTextWriterAttribute Axis = getFrom(enumReflected, "Axis");
public static HtmlTextWriterAttribute Content = getFrom(enumReflected, "Content");
public static HtmlTextWriterAttribute Coords = getFrom(enumReflected, "Coords");
public static HtmlTextWriterAttribute DesignerRegion = getFrom(enumReflected, "DesignerRegion");
public static HtmlTextWriterAttribute Dir = getFrom(enumReflected, "Dir");
public static HtmlTextWriterAttribute Headers = getFrom(enumReflected, "Headers");
public static HtmlTextWriterAttribute Longdesc = getFrom(enumReflected, "Longdesc");
public static HtmlTextWriterAttribute Rel = getFrom(enumReflected, "Rel");
public static HtmlTextWriterAttribute Scope = getFrom(enumReflected, "Scope");
public static HtmlTextWriterAttribute Shape = getFrom(enumReflected, "Shape");
public static HtmlTextWriterAttribute Usemap = getFrom(enumReflected, "Usemap");
public static HtmlTextWriterAttribute VCardName = getFrom(enumReflected, "VCardName");
// Flags management section
} | [
"mario.mastrodicasa@masesgroup.com"
] | mario.mastrodicasa@masesgroup.com |
12f30dd20cca7f2710b50c2f4f9a8ebcb876227a | 04907db0710be0933960d38f41ad61ffcdf295e8 | /service-resources/resources_api/src/main/java/com/yanggy/cloud/controller/admin/MenuController.java | c6fc285955b2798d8435f32a452940a10c11a277 | [] | no_license | yanggy11/cloud-service | bf77a74a405f1360c9299979956364f818417ce5 | 653329bf48486360b5e3ac61a2d7ca150eb29342 | refs/heads/master | 2022-06-25T13:26:57.941789 | 2019-07-17T12:48:40 | 2019-07-17T12:48:40 | 149,373,154 | 0 | 0 | null | 2022-06-21T00:53:14 | 2018-09-19T01:18:15 | Java | UTF-8 | Java | false | false | 1,045 | java | package com.yanggy.cloud.controller.admin;
import com.yang.cloud.dto.ResponseEntity;
import com.yang.cloud.param.MenuParam;
import com.yanggy.cloud.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: yangguiyun
* @Date: 2017/10/21 16:59
* @Description:
*/
@RestController
@RequestMapping("/menu/**")
public class MenuController {
@Autowired
private IMenuService menuService;
@PostMapping(value = "getAllMenus")
public ResponseEntity<?> getAllMenusInpage(@RequestBody MenuParam menuParam) {
return menuService.getAllMenus(menuParam);
}
@PostMapping(value = "getMenusList")
public ResponseEntity<?> getMenusList(@RequestBody MenuParam menuParam) {
return menuService.getMenusList(menuParam);
}
}
| [
"yangguiyun250725@163.com"
] | yangguiyun250725@163.com |
d8f79a4d0a1a1685ab6fea52dc37307176b684aa | f404f7198c91a0f91ed6d6dd0a1cda9adf3edbb1 | /com/planet_ink/coffee_mud/Abilities/Songs/Skill_CenterOfAttention.java | 189165e40fbde0a3c50fd6604d8afa57cba3a3db | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bbailey/ewok | 1f1d35b219a6ebd33fd3ad3d245383d075ef457d | b4fcf4ba90c7460b19d0af56a3ecabbc88470f6f | refs/heads/master | 2020-04-05T08:27:05.904034 | 2017-02-01T04:14:19 | 2017-02-01T04:14:19 | 656,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,880 | java | package com.planet_ink.coffee_mud.Abilities.Songs;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2011-2016 Bo Zimmerman
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.
*/
public class Skill_CenterOfAttention extends BardSkill
{
@Override public String ID() { return "Skill_CenterOfAttention"; }
private final static String localizedName = CMLib.lang().L("Center of Attention");
@Override public String name() { return localizedName; }
@Override public String displayText() { return L("(Watching "+(invoker()==null?"a crazy bard":invoker().name())+")"); }
@Override protected int canAffectCode(){return CAN_MOBS;}
@Override protected int canTargetCode(){return CAN_MOBS;}
@Override public int abstractQuality(){return Ability.QUALITY_MALICIOUS;}
private static final String[] triggerStrings =I(new String[] {"CENTEROFATTENTION"});
@Override public String[] triggerStrings(){return triggerStrings;}
@Override public int classificationCode(){ return Ability.ACODE_SKILL|Ability.DOMAIN_FOOLISHNESS;}
@Override public int usageType(){return USAGE_MOVEMENT|USAGE_MANA;}
@Override protected int getTicksBetweenCasts() { return (int)(CMProps.getMillisPerMudHour() / CMProps.getTickMillis() / 2); }
@Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(affected instanceof MOB)
{
if(CMLib.flags().canBeSeenBy(invoker(), (MOB)affected))
affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_MOVE);
}
}
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((!CMLib.flags().canBeSeenBy(invoker(), mob))
||((invoker()!=null)&&(mob.location()!=invoker().location()))||(!CMLib.flags().isInTheGame(invoker(),true)))
{
unInvoke();
return false;
}
String verbStr;
String targetStr;
switch(CMLib.dice().roll(1, 10, 0))
{
case 1: verbStr=L("<S-IS-ARE> entranced by"); break;
case 2: verbStr=L("remain(s) captivated by"); break;
case 3: verbStr=L("<S-IS-ARE> captivated by"); break;
case 4: verbStr=L("remain(s) entranced by"); break;
case 5: verbStr=L("can't stop watching"); break;
case 6: verbStr=L("stare(s) amazed at"); break;
case 7: verbStr=L("<S-IS-ARE> hypnotized by"); break;
case 8: verbStr=L("remain(s) enthralled by"); break;
case 9: verbStr=L("<S-IS-ARE> delighted by"); break;
default: verbStr=L("remain(s) enchanted by"); break;
}
switch(CMLib.dice().roll(1, 10, 0))
{
case 1: targetStr=L("<T-YOUPOSS> performance"); break;
case 2: targetStr=L("<T-YOUPOSS> antics"); break;
case 3: targetStr=L("<T-YOUPOSS> flailing about"); break;
case 4: targetStr=L("<T-YOUPOSS> drama"); break;
case 5: targetStr=L("<T-YOUPOSS> show"); break;
case 6: targetStr=L("the ongoing spectacle"); break;
case 7: targetStr=L("<T-YOUPOSS> comedy"); break;
case 8: targetStr=L("<T-YOUPOSS> tomfoolery"); break;
case 9: targetStr=L("<T-YOUPOSS> escapades"); break;
default: targetStr=L("<T-YOUPOSS> stunts"); break;
}
mob.location().show(mob, invoker(), CMMsg.MSG_OK_VISUAL, L("<S-NAME> @x1 @x2.",verbStr,targetStr));
}
return true;
}
@Override
public int castingQuality(MOB mob, Physical target)
{
if((mob!=null)&&(target!=null))
{
if(CMLib.flags().isSitting(mob))
return Ability.QUALITY_INDIFFERENT;
if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false))
return Ability.QUALITY_INDIFFERENT;
if(target.fetchEffect(ID())!=null)
return Ability.QUALITY_INDIFFERENT;
}
return super.castingQuality(mob,target);
}
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(CMLib.flags().isSitting(mob))
{
mob.tell(L("You need to stand up!"));
return false;
}
if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false))
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final Set<MOB> h=properTargets(mob,givenTarget,auto);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth performing for."));
return false;
}
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg.MSK_MALICIOUS_MOVE|CMMsg.TYP_JUSTICE|(auto?CMMsg.MASK_ALWAYS:0),
auto?"":L("<S-NAME> begin(s) flailing about while making loud silly noises."));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
for (final Object element : h)
{
final MOB target=(MOB)element;
if(CMLib.flags().canBeSeenBy(mob, target))
{
int levelDiff=target.phyStats().level()-(((2*getXLEVELLevel(mob))+mob.phyStats().level()));
if(levelDiff>0)
levelDiff=levelDiff*5;
else
levelDiff=0;
final CMMsg msg2=CMClass.getMsg(mob,target,this,CMMsg.MSK_MALICIOUS_MOVE|CMMsg.TYP_MIND|(auto?CMMsg.MASK_ALWAYS:0),null);
if(mob.location().okMessage(mob,msg2))
{
mob.location().send(mob,msg2);
if((msg.value()<=0)&&(msg2.value()<=0))
{
maliciousAffect(mob,target,asLevel,3,-1);
target.location().show(target,mob,CMMsg.MSG_OK_ACTION,L("<S-NAME> begin(s) watching <T-NAME> with an amused expression."));
}
}
}
}
}
setTimeOfNextCast(mob);
}
else
return maliciousFizzle(mob,null,L("<S-NAME> attempt(s) to become the center of attention, but fail(s)."));
return success;
}
}
| [
"nosanity79@gmail.com"
] | nosanity79@gmail.com |
ca1b7c5727e34f3d0f802cf28fa0c9d1cbd451d8 | b67b01b4c067d9b4f05cf8c8fc73aa7edbcb3926 | /src/main/java/com/sinjee/admin/mapper/SysRoleMapper.java | 4f29b11227712684f3a33c3e9f06f3639bceac65 | [] | no_license | kweitan/hotsell | a7ada4b4bf0c3704308c6fb665d5ddd9419b4f73 | a943fd68ee829f37a0ac4687be23d010e373720a | refs/heads/master | 2022-05-28T01:54:43.210711 | 2020-03-27T10:38:38 | 2020-03-27T10:38:38 | 227,637,455 | 0 | 0 | null | 2022-05-20T21:18:35 | 2019-12-12T15:26:02 | Java | UTF-8 | Java | false | false | 309 | java | package com.sinjee.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sinjee.admin.entity.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Repository
@Mapper
public interface SysRoleMapper extends BaseMapper<SysRole> {
}
| [
"43361375+kweitan@users.noreply.github.com"
] | 43361375+kweitan@users.noreply.github.com |
3f8916e3974d939e1cbfd07ac423d3bd4f37f5b3 | 9979f42a447808a93bc8642e14778a3db54601da | /RateWorld/src/com/rateworld/swipemenulistview/SwipeMenu.java | bdc2b1e50fa9b1dc9b44e264aca218bed54b6c6b | [] | no_license | idrisbohra/Rateworld | 1bad0452a01295518c15953765c1461b3f0773dd | 11d9361bf8db81e01d4e9e02fcc9d73f33f50652 | refs/heads/master | 2021-01-10T09:42:36.010766 | 2016-01-27T13:19:47 | 2016-01-27T13:19:47 | 50,490,212 | 0 | 1 | null | 2016-01-27T14:08:13 | 2016-01-27T07:34:39 | Java | UTF-8 | Java | false | false | 823 | java | package com.rateworld.swipemenulistview;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
public class SwipeMenu {
private Context mContext;
private List<SwipeMenuItem> mItems;
private int mViewType;
public SwipeMenu(Context context) {
mContext = context;
mItems = new ArrayList<SwipeMenuItem>();
}
public Context getContext() {
return mContext;
}
public void addMenuItem(SwipeMenuItem item) {
mItems.add(item);
}
public void removeMenuItem(SwipeMenuItem item) {
mItems.remove(item);
}
public List<SwipeMenuItem> getMenuItems() {
return mItems;
}
public SwipeMenuItem getMenuItem(int index) {
return mItems.get(index);
}
public int getViewType() {
return mViewType;
}
public void setViewType(int viewType) {
this.mViewType = viewType;
}
}
| [
"johnjohny427@gmail.com"
] | johnjohny427@gmail.com |
42776b1175517e74e29b3253f1fe353e1e626b57 | b06a15632dda036ecdd26a79444c2ce8bf34b021 | /src/main/java/uz/pdp/appjpawarehouse/controller/WarehouseController.java | ba5298de02e4fee0cf6fc340f28966e41bfc4153 | [] | no_license | Jumaniyozovshokir/warehous | 11bf2caef22773426b19cd52a97104c469008a4b | cb5c10e4c51cbca93132da7703505eefcc106721 | refs/heads/main | 2023-03-13T23:18:55.230011 | 2021-03-17T09:56:58 | 2021-03-17T09:56:58 | 348,661,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package uz.pdp.appjpawarehouse.controller;
import org.springframework.web.bind.annotation.*;
import uz.pdp.appjpawarehouse.entity.Warehouse;
import uz.pdp.appjpawarehouse.payload.Result;
import uz.pdp.appjpawarehouse.service.WarehouseService;
import java.util.List;
@RestController
@RequestMapping("/warehouse")
public class WarehouseController {
final WarehouseService warehouseService;
public WarehouseController(WarehouseService warehouseService) {
this.warehouseService = warehouseService;
}
@PostMapping(value = "/upload")
public Result addWarehouse(@RequestBody Warehouse warehouse) {
Result result = warehouseService.addWarehouse(warehouse);
return result;
}
@GetMapping(value = "/get")
public List<Warehouse> getWarehouses() {
List<Warehouse> warehouses = warehouseService.getWarehouses();
return warehouses;
}
@PutMapping(value = "/edit/{warehouseId}")
public Result editWarehouse(@PathVariable Integer warehouseId, @RequestBody Warehouse warehouse) {
Result result = warehouseService.editWarehouse(warehouseId, warehouse);
return result;
}
@DeleteMapping(value = "/delete/{warehouseId}")
public Result deleteWarehouse(@PathVariable Integer warehouseId){
Result result = warehouseService.deleteWarehouse(warehouseId);
return result;
}
}
| [
"shokir0841@yahoo.com"
] | shokir0841@yahoo.com |
24481f73746928d3a49f713c36b57c53ccd44d17 | 50daa7d609e30b47961f13469765edf1a54fa318 | /LCM of two numbers/Main.java | 57d0a71d20cc9433b6a0d4ae17ec8e5c946d365d | [] | no_license | SreeVidhyaKrishna/Playground | e9091ece687836edc70bf0dfd72017267f1c8bf8 | 77022934c02b18f678303a18e58c69224666e583 | refs/heads/master | 2020-06-05T03:42:30.629787 | 2019-08-03T00:45:02 | 2019-08-03T00:45:02 | 192,301,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | #include<stdio.h>
int main()
{
int num_1, num_2, i, gcd, lcm, small;
scanf("%d %d", &num_1, &num_2);
small = num_1<num_2?num_1:num_2;
for(i = small; i >= 1; i--)
{
if(num_1 % i == 0 && num_2 % i == 0)
{
gcd = i;
break;
}
}
lcm = (num_1 * num_2)/gcd;
printf("%d", lcm);
return 0;
} | [
"46885393+SreeVidhyaKrishna@users.noreply.github.com"
] | 46885393+SreeVidhyaKrishna@users.noreply.github.com |
07ae7ca82ed485f5284c6d08501bb9b8ec0d5ea3 | 83ab0017dda064c5a826008792576f75ff654e07 | /sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosItemOperationType.java | 7054d28390666f6a09c5dc6c106cbdfe38a5f408 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | arerlend/azure-sdk-for-java | 611f7cd32e0f25b4b6c0896dd45b7214b2cf9816 | 9d29bbb81bcdac0a77142342e2dbef6094f55beb | refs/heads/master | 2023-01-08T19:08:58.071299 | 2020-11-11T21:53:30 | 2020-11-11T21:53:30 | 260,388,208 | 0 | 0 | MIT | 2020-05-01T05:41:20 | 2020-05-01T05:41:19 | null | UTF-8 | Java | false | false | 820 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos;
import com.azure.cosmos.implementation.batch.BatchRequestResponseConstant;
import com.azure.cosmos.util.Beta;
@Beta(Beta.SinceVersion.V4_7_0)
public enum CosmosItemOperationType {
CREATE(BatchRequestResponseConstant.OPERATION_CREATE),
DELETE(BatchRequestResponseConstant.OPERATION_DELETE),
READ(BatchRequestResponseConstant.OPERATION_READ),
REPLACE(BatchRequestResponseConstant.OPERATION_REPLACE),
UPSERT(BatchRequestResponseConstant.OPERATION_UPSERT);
CosmosItemOperationType(String operationValue) {
this.operationValue = operationValue;
}
String getOperationValue() {
return operationValue;
}
private final String operationValue;
}
| [
"noreply@github.com"
] | arerlend.noreply@github.com |
480f9f7d7fa91d287a6af183d924773e390ba2ec | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/kotlin/reflect/jvm/internal/impl/descriptors/annotations/AnnotationUseSiteTarget.java | cf337e2b52ec9b70cfeb0bd53f8c0989c722af6e | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package kotlin.reflect.jvm.internal.impl.descriptors.annotations;
import java.util.Objects;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
public enum AnnotationUseSiteTarget {
FIELD(null),
FILE(null),
PROPERTY(null),
PROPERTY_GETTER("get"),
PROPERTY_SETTER("set"),
RECEIVER(null),
CONSTRUCTOR_PARAMETER("param"),
SETTER_PARAMETER("setparam"),
PROPERTY_DELEGATE_FIELD("delegate");
@NotNull
public final String a;
/* access modifiers changed from: public */
AnnotationUseSiteTarget(String str) {
if (str == null) {
String name = name();
Objects.requireNonNull(name, "null cannot be cast to non-null type java.lang.String");
str = name.toLowerCase();
Intrinsics.checkNotNullExpressionValue(str, "(this as java.lang.String).toLowerCase()");
}
this.a = str;
}
@NotNull
public final String getRenderName() {
return this.a;
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
48535d398b9a5b3b2d02ecf46e09ae2133a3d6f9 | 7339b7dc2dc612afc3b1703d91f1b93cf1458c19 | /src/main/java/FoodDelivery/Application.java | 8f1ca82fcc05735e96d2b1aaa480ad3936bba0b2 | [] | no_license | Nivedita-PA/Food-Delivery-System | f23655b1fbffb3e909db81172ad31fc63f2b6f68 | 169a64a33d18bf349b862cf0210c3de2645c4c82 | refs/heads/main | 2023-06-04T14:12:15.427553 | 2021-06-15T18:11:19 | 2021-06-15T18:11:19 | 375,256,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,838 | java | package FoodDelivery;
import java.util.Scanner;
public class Application {
static Scanner sc = new Scanner(System.in);
FoodStore foodStore = FoodStore.getInstance();
public void createSystemMenu() {
boolean loop= true;
while(loop){
System.out.println("1. Print starters: ");
System.out.println("2. Print Main Course: ");
System.out.println("3. Print Snacks: ");
System.out.println("4. Print Drinks: ");
System.out.println("5. Add Food Items: ");
System.out.println("6. Delete Food Items: ");
System.out.println("7. Print Food Items: ");
System.out.println("8. Add order:" );
System.out.println("9. Exit: ");
System.out.println("Enter your choice: ");
//FoodStore foodStore = new FoodStore();
int choice = sc.nextInt();
switch (choice) {
case 1:
foodStore.printStarterItems();
break;
case 2:
foodStore.printMainCourse();
break;
case 3:
foodStore.printSnacks();
break;
case 4:
foodStore.printDrinks();
break;
case 5:
foodStore.addFoodItem();
break;
case 6: System.out.println("Enter name of food to delete");
String name = sc.nextLine();
sc.nextLine();
foodStore.deleteFoodItem(name);
break;
case 7:
foodStore.printAllFoodsSelected();
break;
case 8: OrderManager orderManager = new OrderManager();
orderManager.placeOrder();
break;
case 9: loop = false;
break;
}
}
}
public static void main(String[] args) {
System.out.println("-------Welcome to Food Delivery System------");
//Scanner sc = new Scanner(System.in);
Application application = new Application();
application.createSystemMenu();
}
}
| [
"npal4661@gmail.com"
] | npal4661@gmail.com |
b1d95652a903bdac5f61202d5aaa76e275501621 | 80a2b2d55406e692a384291ca22c9db2a279cab8 | /kizwid-caterr-client/src/test/java/kizwid/caterr/dao/ErrorEventDaoHibernateTest.java | f679e2efc45970267ad2fb214a4c15c95263c3e5 | [] | no_license | kizwid/monitor | e71e00be91a956047ab52499e67f506bc49b81bd | c7077f8507ed2680733747e5efd46150c55cc698 | refs/heads/master | 2021-01-23T20:12:58.765929 | 2015-08-23T17:27:36 | 2015-08-23T17:27:36 | 5,879,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,913 | java | package kizwid.caterr.dao;
import kizwid.caterr.domain.ErrorEvent;
import kizwid.sqlLoader.dao.DatabaseReleaseDao;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
/**
* User: kizwid
* Date: 2012-01-30
*/
@Ignore//TODO:until we decide on ORM strategy
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:caterr/hibernate-dao.spring.xml"})
public class ErrorEventDaoHibernateTest extends DatabaseTxTestFixture{
@Resource
ErrorEventDao errorEventDaoHibernate;
@Resource
JdbcTemplate jdbcTemplate;
@Resource
DatabaseReleaseDao databaseReleaseDao;
@Test //TODO: hibernate dao is broken
public void canSaveErrors(){
int rowCountErrorEventBefore = getRowCount("error_event");
int rowCountPricingErrorBefore = getRowCount("pricing_error");
ErrorEvent errorEvent = createErrorEvent("a", "FOO", "BAR", "BAZ", 0, 3);
errorEventDaoHibernate.save(errorEvent);
/*
ErrorEvent check = errorEventDaoHibernate.findById(errorEvent.getPrimaryKey());
assertEquals(errorEvent, check);
assertEquals( "row count not expected: ", rowCountErrorEventBefore + 1, getRowCount("error_event"));
assertEquals( "row count not expected: ", rowCountPricingErrorBefore + 3, getRowCount("pricing_error"));
List<ErrorEvent> retrievedErrorEvent = errorEventDaoHibernate.findByRiskGroup("BAR");
for (ErrorEvent event : retrievedErrorEvent) {
System.out.println(event);
}
assertTrue( retrievedErrorEvent.size() == 1);
assertTrue( retrievedErrorEvent.get(0).getPricingErrors().size() == 3);
*/
}
}
| [
"kidwidder@gmail.com"
] | kidwidder@gmail.com |
da9ead6c6742237405ddb51770939d2a4c27e350 | 91506af2ac04008354de62075a40383a2b54bf06 | /src/put/sailhero/model/PoiModel.java | 4211b9036197cf55d388e98ea9eb684049518bf8 | [] | no_license | aszczepanski/sailhero-android | 052b6a8c1e39bb81ff378227d17543efd33074ea | 574a257f3f5678bb367b37fb9fdb0f5f4ac6766f | refs/heads/master | 2021-01-18T13:58:29.844624 | 2015-02-08T22:02:30 | 2015-02-08T22:02:30 | 24,554,947 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package put.sailhero.model;
import android.content.Context;
import android.content.Intent;
public abstract class PoiModel extends BaseModel {
protected String mName;
protected String mCity;
public PoiModel() {
super();
}
public PoiModel(Integer id, String name, String city) {
super(id);
mName = name;
mCity = city;
}
public void setName(String name) {
mName = name;
}
public String getName() {
return mName;
}
public void setCity(String city) {
mCity = city;
}
public String getCity() {
return mCity;
}
public abstract Intent getDetailsIntent(final Context context);
}
| [
"aszczepanski92@gmail.com"
] | aszczepanski92@gmail.com |
971eb856cb8bea23ee1b2b1888222e225a44366e | fa63b0dfa4f0b4ab9f3ab226e97016a080b6041f | /src/main/java/com/prinjsystems/asct/structures/conductors/Spark.java | 877dc7d65b3a55c8ec427cbf71af01c210af234b | [] | no_license | VTHMgNPipola/ASCT | d4fe8b5591f29ef18e97eff47fc127f15d207551 | 3cca7cf35e5415ab8315be8a97265fcbcfb7071c | refs/heads/master | 2022-03-11T02:10:37.554157 | 2019-11-12T13:48:49 | 2019-11-12T13:48:49 | 198,311,475 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | package com.prinjsystems.asct.structures.conductors;
import com.prinjsystems.asctlib.PlaceableTile;
import com.prinjsystems.asctlib.structures.ActionTile;
import java.awt.Color;
@PlaceableTile("conductors")
public class Spark extends ActionTile {
private static final long serialVersionUID = -1176647464574253132L;
public Spark() {
super(0, 0, new Color(255, 191, 0), "Spark", "SPRK");
}
@Override
public void tick() {
throw new IllegalStateException("");
}
@Override
public Color getColor() {
return color;
}
}
| [
"web.anunciante@gmail.com"
] | web.anunciante@gmail.com |
32b5c979c7bdd360fb6273a5f041af1691678088 | 8a351d7b5a6945fb6d38a22be927dc84d8f9ebe4 | /practices/src/main/java/com/practice/io/excel/ExcelCell.java | 1d17b45f0df39306fe93bc35f6e7096698571f04 | [] | no_license | onebite/learning | 4dd3cd006f236cebee207fc6ba033533a621ae5d | 42fef8698ea00b8e61e0b5c58d14939715f76199 | refs/heads/master | 2020-07-29T00:54:49.316881 | 2018-12-27T10:25:01 | 2018-12-27T10:25:01 | 67,007,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.practice.io.excel;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author lxl
* @Date 2018/6/19 19:55
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ExcelCell {
/**
* 列坐标
* @return
*/
String head() default "";
}
| [
"lxl@lizikj.com"
] | lxl@lizikj.com |
466140a35c39343b6816010151c06a1161ca4868 | 5e28591ffac7f9968e086d1ddcf1e9996d3a67c1 | /src/views/OrderManagement.java | 41405ea05235fa33bb16b8305a500a225f9f9f37 | [] | no_license | tuandang198/javaSwing | 50f5560ed8d6b161a463bc805147bbaf46354f5a | 50f2ead5164240a3e37ff095ec6b0e1dd4adf47b | refs/heads/master | 2023-09-05T02:00:44.207298 | 2021-11-12T11:41:04 | 2021-11-12T11:41:04 | 417,513,235 | 0 | 0 | null | 2021-11-12T11:41:05 | 2021-10-15T13:40:20 | Java | UTF-8 | Java | false | false | 9,972 | 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 views;
import dao.CategoryDAO;
import dao.OrderDAO;
import dao.TotalBillDAO;
import java.util.List;
import javax.swing.table.DefaultTableModel;
import models.DanhMuc;
import models.Order;
import models.TotalBill;
/**
*
* @author doge
*/
public class OrderManagement extends javax.swing.JFrame {
/**
* Creates new form OrderManagement
*/
public OrderManagement() {
initComponents();
showTotalBill();
}
public void showTotalBill() {
List<TotalBill> list = TotalBillDAO.TotalBillList();
DefaultTableModel model = (DefaultTableModel) tblTotalBill.getModel();
model.setRowCount(0);
Object[] row = new Object[4];
for (int i = 0; i < list.size(); i++) {
row[0] = list.get(i).getId();
row[1] = list.get(i).getTotalPrice();
row[2] = list.get(i).getTotalQuantity();
row[3] = list.get(i).getDate();
model.addRow(row);
}
model.fireTableDataChanged();
}
public void showOrder(int orderId) {
List<Order> list = OrderDAO.OrderList(orderId);
DefaultTableModel model = (DefaultTableModel) tblOrder.getModel();
model.setRowCount(0);
Object[] row = new Object[3];
for (int i = 0; i < list.size(); i++) {
row[0] = list.get(i).getName();
row[1] = list.get(i).getPrice();
row[2] = list.get(i).getQuantity();
model.addRow(row);
}
model.fireTableDataChanged();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tblTotalBill = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
tblOrder = new javax.swing.JTable();
btnBack = new javax.swing.JButton();
btnDelete = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
tblTotalBill.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID", "Total bill", "Total quantity", "Buy date"
}
));
tblTotalBill.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tblTotalBillMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tblTotalBill);
tblOrder.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Product Name", "Price", "Quantity"
}
));
jScrollPane2.setViewportView(tblOrder);
btnBack.setText("Back");
btnBack.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnBackMouseClicked(evt);
}
});
btnDelete.setText("Delete Bill");
btnDelete.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnDeleteMouseClicked(evt);
}
});
jLabel1.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
jLabel1.setText("Order Management");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 682, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(btnBack)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(134, 134, 134)
.addComponent(btnDelete))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 682, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(btnBack)
.addComponent(btnDelete))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnBackMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnBackMouseClicked
// TODO add your handling code here:
dispose();
Home homePage = new Home();
homePage.setVisible(true);
}//GEN-LAST:event_btnBackMouseClicked
private void tblTotalBillMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblTotalBillMouseClicked
// TODO add your handling code here:
DefaultTableModel totalBilltbl = (DefaultTableModel) tblTotalBill.getModel();
int selectedRow = tblTotalBill.getSelectedRow();
System.out.println((Integer)totalBilltbl.getValueAt(selectedRow, 0));
showOrder((Integer)totalBilltbl.getValueAt(selectedRow, 0));
}//GEN-LAST:event_tblTotalBillMouseClicked
private void btnDeleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnDeleteMouseClicked
// TODO add your handling code here:
DefaultTableModel totalBillTbl = (DefaultTableModel) tblTotalBill.getModel();
DefaultTableModel orderTbl = (DefaultTableModel) tblOrder.getModel();
int selectedRow = tblTotalBill.getSelectedRow();
int id = Integer.parseInt(totalBillTbl.getValueAt(selectedRow, 0).toString());
OrderDAO.delete(id);
TotalBillDAO.delete(id);
showTotalBill();
orderTbl.setRowCount(0);
}//GEN-LAST:event_btnDeleteMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(OrderManagement.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(OrderManagement.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(OrderManagement.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(OrderManagement.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new OrderManagement().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnBack;
private javax.swing.JButton btnDelete;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable tblOrder;
private javax.swing.JTable tblTotalBill;
// End of variables declaration//GEN-END:variables
}
| [
"tuandang10998@gmail.com"
] | tuandang10998@gmail.com |
b1eb90b3d1c04e261275fe0ef7e42f9cf5b26f5d | 8d8fba266b08cf77055ec663c6f8c6f4d6917645 | /moocJava2020/osa08/12.HajautusarvoPaivaykselle/Paivays.java | 5dca0b9b90d34aeb6498292bafac2982a05af0d6 | [] | no_license | lnxbusdrvr/ohjelmoinninPerusteet | 4179dbb21269b87e92ae21e092528c5b4365e550 | 60079703ef17d7801c4aa1428e6f31e2ba1f0bf2 | refs/heads/master | 2022-02-05T06:09:27.338410 | 2020-11-11T23:52:04 | 2020-11-11T23:52:04 | 229,281,190 | 0 | 0 | null | 2022-01-21T23:48:05 | 2019-12-20T14:38:28 | Java | UTF-8 | Java | false | false | 2,099 | java |
public class Paivays {
private int paiva;
private int kuukausi;
private int vuosi;
public Paivays(int paiva, int kuukausi, int vuosi) {
this.paiva = paiva;
this.kuukausi = kuukausi;
this.vuosi = vuosi;
}
@Override
public String toString() {
return this.paiva + "." + this.kuukausi + "." + this.vuosi;
}
public boolean aiemmin(Paivays verrattava) {
if (this.vuosi < verrattava.vuosi) {
return true;
}
if (this.vuosi == verrattava.vuosi
&& this.kuukausi < verrattava.kuukausi) {
return true;
}
if (this.vuosi == verrattava.vuosi
&& this.kuukausi == verrattava.kuukausi
&& this.paiva < verrattava.paiva) {
return true;
}
return false;
}
public int erotusVuosissa(Paivays verrattava) {
if (aiemmin(verrattava)) {
return verrattava.erotusVuosissa(this);
}
int vuosiPois = 0;
if (this.kuukausi < verrattava.kuukausi) {
vuosiPois = 1;
} else if (this.kuukausi == verrattava.kuukausi && this.paiva < verrattava.paiva) {
vuosiPois = 1;
}
return this.vuosi - verrattava.vuosi - vuosiPois;
}
@Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + this.paiva;
hash = 89 * hash + this.kuukausi;
hash = 89 * hash + this.vuosi;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Paivays other = (Paivays) obj;
if (this.paiva != other.paiva) {
return false;
}
if (this.kuukausi != other.kuukausi) {
return false;
}
if (this.vuosi != other.vuosi) {
return false;
}
return true;
}
}
| [
"anticop@iki.fi"
] | anticop@iki.fi |
b44fb2a8e433783818c0d0ef11ec2d21a3d365c8 | b0ffeaa06e93302a6c12df13552d7955f9906b62 | /1.9.4/src/main/java/com/ayutaki/chinjufumod/init/lettertrays/BlockFudeDesk_dc.java | ade3b07d2cffcf91e52105598e5b6e02af95d187 | [] | no_license | TartaricAcid/ChinjufuMod | 78300d4c3e9f5dc04740441343156a98b458ef75 | f10216281b293b1f7095f54ac3b06833093d6b64 | refs/heads/master | 2021-01-12T05:26:57.522140 | 2017-01-04T16:22:15 | 2017-01-04T16:22:15 | 77,927,817 | 0 | 0 | null | 2017-01-03T15:12:42 | 2017-01-03T15:12:41 | null | UTF-8 | Java | false | false | 2,190 | java | package com.ayutaki.chinjufumod.init.lettertrays;
import com.ayutaki.chinjufumod.init.ChinjufuModTabs;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFudeDesk_dc extends Block {
public BlockFudeDesk_dc() {
super(Material.WOOD);
setRegistryName("BlockFudeDesk_dc");
setUnlocalizedName("fudedesk_dc");
setCreativeTab(ChinjufuModTabs.tabChinjufuMod);
setSoundType(SoundType.WOOD);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
public static final PropertyDirection FACING;
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
}
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
}
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] { FACING });
}
static {
FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.53125D, 1.0D);
}
} | [
"ayutaki@shiningsaga.sakura.ne.jp"
] | ayutaki@shiningsaga.sakura.ne.jp |
407d43c74c99b85c96a4a2b48acc5560df184ba5 | 639fc9b00e89aa8adddf52f298555a719b58c89d | /src/main/MainSercher.java | bfaf9bf83997f1a0dc1984116769841f8888547f | [] | no_license | donghyeok-dev/google-web-scraping | b2999b49c50cb42bf8ee2e9fd5c714d9019e6df9 | 19916275553f302dba6ae3f3abfda0806ed5e1c0 | refs/heads/master | 2023-04-11T00:17:06.121111 | 2021-04-21T14:25:49 | 2021-04-21T14:25:49 | 359,977,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,117 | java | package main;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class MainSercher {
static final String HOME_PATH = System.getProperty( "user.dir" );
static final String ROOT_PATH = HOME_PATH + "\\";
static final SimpleDateFormat DT_FORMAT = new SimpleDateFormat ( "yyyyMMdd HHmmss");
static final Date TIME = new Date();
public static void main(String[] args) throws InterruptedException, IOException {
SearcherProperties properties = getSearcherProperties();
final int DELAY_TIME = properties.getDelayTime();
/*
컴퓨터에 설치된 크롬 버전과 라이브러리 버전을 동하게 맞춰야 됨.
- java library: https://www.selenium.dev/ https://www.selenium.dev/downloads/
- chrome driver: https://chromedriver.chromium.org/downloads
//만약 창을 띄우지 않고 작업하고 싶다면,
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
*/
System.setProperty("webdriver.chrome.driver", ROOT_PATH + "chromedriver.exe");
WebDriver driver = new ChromeDriver();
String baseUrl = "https://www.google.com/search?q=%ED%83%84%EC%86%8C%EB%B0%B0%EC%B6%9C%EA%B6%8C";
driver.get(baseUrl);
for(String keyword : properties.getKeywords()) {
WebElement searchForm = driver.findElements(By.tagName("form")).get(0);
WebElement searchInputBox = searchForm.findElement(By.tagName("input"));
searchInputBox.clear();
searchInputBox.sendKeys(keyword);
searchForm.submit();
String currentFileName = ROOT_PATH + "result\\" + keyword + "_" + DT_FORMAT.format(TIME)+".txt";
//뉴스 클릭
Thread.sleep(DELAY_TIME);
WebElement btn_news = driver.findElements(By.className("hdtb-mitem")).stream()
.filter(
webElement -> webElement.getText().contains("뉴스")
).findFirst().orElse(null);
btn_news.click();
Thread.sleep(DELAY_TIME);
WebElement btn_tool = driver.findElement(By.id("hdtb-tls"));
// System.out.println(">>check: " + btn_tool.getAttribute("aria-expanded"));
if(btn_tool.getAttribute("aria-expanded").equals("false")) {
//도구 클릭
btn_tool.click();
//모든 날짜 클릭
Thread.sleep(DELAY_TIME);
WebElement hdtbMenus = driver.findElement(By.id("hdtbMenus")).findElements(By.tagName("span")).get(2);
hdtbMenus.click();
//지난 1일 클릭
Thread.sleep(DELAY_TIME);
WebElement btn_oneDay = driver.findElement(By.id("lb")).findElements(By.tagName("g-menu-item")).get(2);
btn_oneDay.click();
}
//하단 페이징 엘리먼트 얻음
List<WebElement> searchPages = driver.findElements(By.xpath("//div[@role='navigation']/span/table/tbody/tr/td"));
int curMaxPage = searchPages.size() > properties.getSearchMaxPageNumber()
? properties.getSearchMaxPageNumber()
: searchPages.size();
for (int i = 1; i <= curMaxPage; i++) {
//1번째 페이지부터 10번째 페이지까지 반복적으로 리스트 내용을 저장함
Thread.sleep(1000);
List<WebElement> curSearchList = driver.findElements(By.cssSelector(".g"));
if(curSearchList.size() > 0) {
curSearchList.forEach(webElement -> {
String[] split = webElement.getText().split("\n");
if (webElement.getText() != null && webElement.getText().trim().length() > 1) {
String contents = null;
if (webElement.getText().startsWith("웹 검색결과")) {
contents = split[2] + "\n" + webElement.findElement(By.tagName("a")).getAttribute("href") + "\n" + split[4] + "\n\n";
} else {
contents = split[0] + "\n" + webElement.findElement(By.tagName("a")).getAttribute("href") + "\n" + split[2] + "\n\n";
}
saveContentToFile(contents, currentFileName);
}
});
}else {
curSearchList = driver.findElements(By.tagName("g-card"));
curSearchList.forEach(webElement -> {
String[] split = webElement.getText().split("\n");
if (webElement.getText() != null && webElement.getText().trim().length() > 1) {
String contents = null;
contents = split[1] + " - " + split[0] + "\n" + webElement.findElement(By.tagName("a")).getAttribute("href") + "\n" + split[3] + " - " + split[2] + "\n\n";
saveContentToFile(contents, currentFileName);
}
});
}
Thread.sleep(DELAY_TIME);
if((i+1) <= curMaxPage) {
driver.findElement(By.xpath("//div[@role='navigation']/span/table/tbody/tr/td/a[@aria-label='Page " + (i + 1) + "']")).click();
}
}
Thread.sleep(DELAY_TIME);
}
}
public static SearcherProperties getSearcherProperties() {
Properties properties = new Properties();
try ( FileInputStream inputStream = new FileInputStream(ROOT_PATH + "setting.properties");
InputStreamReader streamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8))
{
properties.load(streamReader);
return new SearcherProperties(
Stream.of(Objects.requireNonNull(properties.getProperty("keywords")).split(","))
.map(String::trim)
.collect(Collectors.toList()),
Integer.parseInt(Objects.requireNonNull(properties.getProperty("searchMaxPageNumber"))),
Integer.parseInt(Objects.requireNonNull(properties.getProperty("delayTime")))
);
}catch(Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 파일 저장 메서드
* @param contents 저장할 내용
*/
public static void saveContentToFile(String contents, String fileName) {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(fileName, true))) {
bw.write(contents);
bw.flush();
}catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"donghyeok.jh@gmail.com"
] | donghyeok.jh@gmail.com |
8c8938034ea0099508215ae7bdb7b223ef7d3418 | d6f5f8f98211eaaf0048fb49855338d85d712f73 | /src/com/shuai/demo/protocol/RegisterByWeixinTask.java | 840d49538a813b3a147a37d1799dfd4fd7a78a29 | [
"Apache-2.0"
] | permissive | jinshiyi11/Demo | cca91197d0d41269767c993529a3ff9afa5fe403 | 135c779698fe2e10cb285165dee2fc4c823b74d3 | refs/heads/master | 2021-01-15T10:47:08.660196 | 2015-07-23T03:35:35 | 2015-07-23T03:35:35 | 37,188,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,298 | java | package com.shuai.demo.protocol;
import java.io.UnsupportedEncodingException;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.JsonRequest;
import com.google.gson.Gson;
import com.shuai.demo.MyApplication;
import com.shuai.demo.data.Constants;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.controller.UMServiceFactory;
import com.umeng.socialize.controller.UMSocialService;
import com.umeng.socialize.controller.listener.SocializeListeners.UMAuthListener;
import com.umeng.socialize.exception.SocializeException;
import com.umeng.socialize.weixin.controller.UMWXHandler;
/**
* 通过微信注册
* 先登录到微信,拿到微信的token,然后把微信的token传到我们自己的服务器验证,服务端到微信的服务器验证该token并返回本系统的uid和token以及服务端为用户分配的随机密码
*/
public class RegisterByWeixinTask {
private final static String WEIXIN_LOGIN_URL="";
private AtomicBoolean mCanceled;
private Context mContext;
private Listener<RegisterResult> mListener;
private ErrorListener mErrorListener;
private RequestQueue mRequestQueue;
/**
* 拿到微信的token后,到app的服务端验证并登陆
*
*/
private class LoginToServerTask extends JsonRequest<RegisterResult> {
private final String TAG=getClass().getSimpleName();
public LoginToServerTask(Context context,String token) {
super(Method.GET, RegisterByWeixinTask.getUrl(context,WEIXIN_LOGIN_URL,token),null, mListener, mErrorListener);
}
@Override
protected Response<RegisterResult> parseNetworkResponse(NetworkResponse response) {
try {
String jsonString = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
if(Constants.DEBUG){
Log.d(TAG, jsonString);
}
JSONObject root=new JSONObject(jsonString);
ErrorInfo error=ProtocolUtils.getProtocolInfo(root);
if(error.getErrorCode()!=0){
return Response.error(error);
}
String resultJson=root.get(ProtocolUtils.RESULT).toString();
Gson gson=new Gson();
RegisterResult result=gson.fromJson(resultJson, RegisterResult.class);
return Response.success(result, HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (Exception e) {
return Response.error(new ParseError(e));
}
}
}
private static String getUrl(Context context,String url, String token){
List<BasicNameValuePair> params = new LinkedList<BasicNameValuePair>();
params.add(new BasicNameValuePair("token", token));
UrlHelper.addCommonParameters(context, params);
return url+"?"+URLEncodedUtils.format(params, "UTF-8");
}
public RegisterByWeixinTask(Context context, Listener<RegisterResult> listener,ErrorListener errorListener) {
mContext=context;
mListener=listener;
mErrorListener=errorListener;
mRequestQueue=MyApplication.getRequestQueue();
}
public void login(){
loginToWeixin();
}
public void cancel(){
mCanceled.set(true);
if(mRequestQueue!=null)
mRequestQueue.cancelAll(this);
}
private void loginToWeixin(){
UMSocialService mController = UMServiceFactory.getUMSocialService("com.umeng.login");
UMWXHandler wxHandler = new UMWXHandler(mContext,Constants.APP_ID_WEIXIN,Constants.APP_SECRET_WEIXIN);
wxHandler.addToSocialSDK();
mController.doOauthVerify(mContext, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
@Override
public void onStart(SHARE_MEDIA platform) {
//授权开始
}
@Override
public void onError(SocializeException e, SHARE_MEDIA platform) {
//授权错误
if(mCanceled.get())
return;
mErrorListener.onErrorResponse(new ErrorInfo(ErrorInfo.ERROR_WEIXIN_OAUTH_ERROR, "微信授权错误"));
}
@Override
public void onComplete(Bundle value, SHARE_MEDIA platform) {
//授权完成
if(mCanceled.get())
return;
String token=null;
LoginToServerTask request=new LoginToServerTask(mContext,token);
request.setTag(RegisterByWeixinTask.this);
mRequestQueue.add(request);
}
@Override
public void onCancel(SHARE_MEDIA platform) {
//授权取消
if(mCanceled.get())
return;
mErrorListener.onErrorResponse(new ErrorInfo(ErrorInfo.ERROR_WEIXIN_OAUTH_CANCEL, "微信授权被取消"));
}
} );
}
}
| [
"49662990@qq.com"
] | 49662990@qq.com |
c5deefc099298ecbda1e2a5784f979d8dcd45860 | ffaebee70b7001fa0d00515f7323aaaba98c9e91 | /rtmf-guc/src/main/java/nl/rotterdam/rtmf/guc/routing/outbound/PayloadArrayMulticastRouter.java | a50efc5d686f063fd1f71809f66ebab73c5ab0af | [] | no_license | rotterdam/rtmf | 1ff4ed5c1cf5d99f2e1959ebf0a7ea9104dd37c9 | 640a49135c2fa41975430c23c12771eda6003454 | refs/heads/master | 2021-01-24T04:54:33.782540 | 2011-05-06T11:35:07 | 2011-05-06T11:38:27 | 1,700,173 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,496 | java | /*
* Copyright (c) 2009-2011 Gemeente Rotterdam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the European Union Public Licence (EUPL),
* version 1.1 (or any later version).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* European Union Public Licence for more details.
*
* You should have received a copy of the European Union Public Licence
* along with this program. If not, see
* http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
*/
package nl.rotterdam.rtmf.guc.routing.outbound;
import java.util.ArrayList;
import java.util.List;
import org.mule.DefaultMuleMessage;
import org.mule.api.MessagingException;
import org.mule.api.MuleMessage;
import org.mule.api.MuleSession;
import org.mule.api.config.MuleProperties;
import org.mule.api.endpoint.ImmutableEndpoint;
import org.mule.api.endpoint.OutboundEndpoint;
import org.mule.api.routing.CouldNotRouteOutboundMessageException;
import org.mule.api.routing.RoutePathNotFoundException;
import org.mule.api.routing.RoutingException;
import org.mule.config.i18n.CoreMessages;
import org.mule.routing.outbound.FilteringOutboundRouter;
public class PayloadArrayMulticastRouter extends FilteringOutboundRouter
{
public MuleMessage route(MuleMessage message, MuleSession session)
throws RoutingException
{
MuleMessage resultMessage;
if (endpoints == null || endpoints.size() == 0)
{
throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null);
}
List<MuleMessage> results = new ArrayList<MuleMessage>(endpoints.size());
try
{
OutboundEndpoint endpoint;
for (int i = 0; i < endpoints.size(); i++)
{
endpoint = (OutboundEndpoint) endpoints.get(i);
if(endpoint.getFilter()==null || (endpoint.getFilter()!=null && endpoint.getFilter().accept(message)))
{
if (((DefaultMuleMessage) message).isConsumable())
{
throw new MessagingException(
CoreMessages.cannotCopyStreamPayload(message.getPayload().getClass().getName()),
message);
}
MuleMessage clonedMessage = new DefaultMuleMessage(message.getPayload(), message);
results.add(send(session, clonedMessage, endpoint));
}
}
resultMessage = new DefaultMuleMessage(results.toArray((new MuleMessage[]{})));
resultMessage.setProperty(
MuleProperties.MULE_CORRELATION_ID_PROPERTY,
results.get(0).getProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY));
for (MuleMessage current : results) {
if (current.getProperty("attachmentKey") != null) {
logger.debug("Er is een propertie attachmentKey gevonden en op de resultMessage gezet");
resultMessage.setProperty("attachmentKey", current.getProperty("attachmentKey"));
break;
}
}
}
catch (Exception e)
{
throw new CouldNotRouteOutboundMessageException(message, (ImmutableEndpoint) endpoints.get(0), e);
}
return resultMessage;
}
}
| [
"andrej.koelewijn@it-eye.nl"
] | andrej.koelewijn@it-eye.nl |
b453cedc801269f49378c2623935e71c7d7fb47b | ac0d6430a54ac357d2408e0a692b611a04ddb79b | /app/src/main/java/com/cse403/matchonthestreet/controller/SportsIconFinder.java | 78b4612bca3a5abda15b2d8ef852a9b918b88b19 | [] | no_license | MatchOnTheStreet/MatchOnTheStreet | 91e20b6700acc894d630b2bdbbceae391b33ed8a | c202fe807c1ae1227113175a76695292bef0f2b2 | refs/heads/master | 2020-04-10T19:08:36.552458 | 2016-03-10T05:48:56 | 2016-03-10T05:48:56 | 50,128,620 | 0 | 0 | null | 2016-02-19T08:18:03 | 2016-01-21T18:41:53 | Java | UTF-8 | Java | false | false | 4,657 | java | package com.cse403.matchonthestreet.controller;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.regex.Pattern;
/**
* Created by Hao Liu on 2/23/16.
*
* This is the utility class that parses the title of the event and assign
* icons to them.
*/
public class SportsIconFinder {
private static SportsIconFinder sportsIconFinder;
protected static Map<Set<String>, String> drawableMap = new HashMap<>();
private SportsIconFinder(Context context) {
System.out.println("called icon finder");
AssetManager manager = context.getResources().getAssets();
try {
String[] drawableNames = manager.list("");
for (String filename : drawableNames) {
if (filename.startsWith("sports_") && filename.endsWith(".png")) {
String[] drawableTokens = filename.substring(0, filename.length() - 4).
replace("sports_", "").
split("_");
ArrayList<String> tokenList = new ArrayList<String>(Arrays.asList(drawableTokens));
String[] badWords = new String[]{
"and", "a", "on", "with", "up", "down", "out", "view", "side",
"of", "ball", "person", "player", "group", "team", "playing", "like",
"game", "couple", "at", "the", "from", "between", "among", "within",
"in", "black", "silhouette"
};
for (String w : badWords) {
while (tokenList.contains(w) || Pattern.matches("\\d", w)) {
tokenList.remove(w);
}
}
System.out.print("Filename: " + filename + "=[");
for (String t : tokenList) {
System.out.print(t + ",");
}
System.out.println("];");
drawableMap.put(new HashSet<>(tokenList), filename);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void initialize(Context context) {
if (sportsIconFinder == null) {
sportsIconFinder = new SportsIconFinder(context);
}
}
public static SportsIconFinder getInstance() {
return sportsIconFinder;
}
public String matchString(Context context, String query) {
String bestMatch = "";
int bestCount = 0;
query = query.replaceAll("[^\\w\\s]", "").toLowerCase();
System.out.println("Q: " + query);
String[] queryTokens = query.split(" ");
// Special case for "tennis" not "table tennis"
if (query.contains("tennis") && !query.contains("table tennis")) {
bestMatch = "sports_tennis_ball.png";
} else {
for (Set<String> tokens : drawableMap.keySet()) {
int matchCount = 0;
for (String token : queryTokens) {
if (tokens.contains(token)) {
if (matchCount == 0) {
matchCount++;
}
}
}
if (matchCount > bestCount) {
bestCount = matchCount;
bestMatch = drawableMap.get(tokens);
}
}
if (bestMatch.isEmpty() || bestCount == 0) {
return null;
}
}
return bestMatch;
}
public static Drawable getAssetImage(Context context, String filename) {
AssetManager assets = context.getResources().getAssets();
InputStream buffer = null;
if (drawableMap.values().contains(filename)) {
try {
buffer = new BufferedInputStream((assets.open(filename)));
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(buffer);
return new BitmapDrawable(context.getResources(), bitmap);
} else {
return null;
}
}
}
| [
"chakalakafrank@gmail.com"
] | chakalakafrank@gmail.com |
ea2f570de0fb5f7cf5a952c2271261eb6fd27497 | 66a611affb8f642c5fcbdfaa03a01b6107987720 | /yapool/yapool-hib4/src/test/java/nl/fw/yapool/sql/hibernate/HibernateTestCP.java | 920fd3952da7c9e800e7215245c44ee928a3488a | [
"MIT"
] | permissive | fshams/yapool | 7651a601a8470e56bcc90e657e4fa43c74ea04e1 | cbdb94ad4dbb24913681b5d60ff22ceebb97d424 | refs/heads/master | 2021-01-10T11:07:34.861969 | 2015-02-24T18:12:34 | 2015-02-24T18:12:34 | 45,242,143 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package nl.fw.yapool.sql.hibernate;
import java.util.Map;
import java.util.Properties;
import nl.fw.yapool.sql.SqlFactory;
import nl.fw.yapool.sql.SqlPool;
import nl.fw.yapool.sql.datasource.HsqlPoolBuilder;
import nl.fw.yapool.sql.hibernate.Hib4ConnectionProvider;
import org.hibernate.cfg.Environment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HibernateTestCP extends Hib4ConnectionProvider {
private static final long serialVersionUID = -1738074832972697023L;
protected Logger log = LoggerFactory.getLogger(getClass());
public static String poolId = HsqlPoolBuilder.JDBC_URL_TEST_IN_MEM + "Hib4";
@SuppressWarnings( {"unchecked", "rawtypes"})
@Override
public void configure(Map properties) {
props = new Properties();
props.putAll(properties);
pool = new SqlPool();
SqlFactory factory = new SqlFactory();
pool.setFactory(factory);
factory.setJdbcUrl(poolId);
props.setProperty(Environment.URL, factory.getJdbcUrl());
props.setProperty(Environment.AUTOCOMMIT, Boolean.toString(factory.isAutoCommit()));
// Disable cache so that all expected queries are executed.
props.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
props.setProperty(Environment.SHOW_SQL, "true");
// Register updated properties, this may not always work for all properties.
// But it does work for "SHOW_SQL".
properties.putAll(props);
getProvidedPools().addPool(poolId, pool);
log.info("SqlPool configure for Hibernate Test.");
}
@Override
public void start() {
log.info("SqlPool starting for Hibernate Test.");
super.start();
}
@Override
public void stop() {
log.info("SqlPool stopping for Hibernate Test.");
super.stop();
}
}
| [
"frederik.wiers@gmail.com"
] | frederik.wiers@gmail.com |
32b65f1270c2455b03ed4f22aecbc2f9749c8214 | 0a91076dd5e8fce62ffc5ed876241f044a51547a | /src/main/java/cn/qianshu/tick/controller/indexController.java | 4b9398dd26f2a8358b95f7d562669fcc9512f55e | [] | no_license | flowerII/Tick | 5125a4d11f82096280d8c1996befaace5add1289 | 21e326650fa180405bf5d475d7b4ba8f0cb5ca05 | refs/heads/master | 2020-04-13T08:57:58.015310 | 2018-12-25T16:32:44 | 2018-12-25T16:32:44 | 163,097,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package cn.qianshu.tick.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class indexController {
private static Logger logger = LoggerFactory.getLogger(indexController.class);
@RequestMapping("/testIP")
public String index() {
return "testIP";
}
@RequestMapping(value = "/getPage", method=RequestMethod.GET)
public String getTickPage() {
return "getPage";
}
@RequestMapping(value = "/getTick", method=RequestMethod.POST)
@ResponseBody
public String getTick(@RequestParam("ipAddress") String ipAddress,@RequestParam("activity_id") String activity_id) {
logger.info(ipAddress);
logger.info(activity_id);
return "1";
}
}
| [
"1479676948@qq.com"
] | 1479676948@qq.com |
a9653e0dd070cad791617acc70e98a39c97d8858 | 20a206922503289e8277c0ea17284416105e2805 | /src/main/java/com/ljh/mypage/commons/interceptor/LoginInterceptor.java | f6f61942196555c7d1578b8cd0c4462b5ea16c39 | [] | no_license | LeeJaeHoon43/SpringBoardProject3 | c0fbff4375c1242b72a45acef57dc7a1d2cf9dcd | cc9143347711817ec722c52e6759b4e6fc83a126 | refs/heads/master | 2023-02-18T16:26:34.166340 | 2021-01-08T11:23:14 | 2021-01-08T11:23:14 | 319,647,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,940 | java | package com.ljh.mypage.commons.interceptor;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class LoginInterceptor extends HandlerInterceptorAdapter{
private static final String LOGIN = "login";
private static final Logger LOGGER = LoggerFactory.getLogger(LoginInterceptor.class);
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
HttpSession httpSession = request.getSession();
ModelMap modelMap = modelAndView.getModelMap();
Object userVO = modelMap.get("user");
if (userVO != null) {
LOGGER.info("New Login Success");
httpSession.setAttribute(LOGIN, userVO);
// response.sendRedirect("/mypage");
if (request.getParameter("useCookie") != null) {
LOGGER.info("rememeber me");
// 쿠키 생성.
Cookie loginCookie = new Cookie("loginCookie", httpSession.getId());
loginCookie.setPath("/mypage");
loginCookie.setMaxAge(60 * 60 * 24 * 7);
// 전송.
response.addCookie(loginCookie);
}
Object destination = httpSession.getAttribute("destination");
response.sendRedirect(destination != null ? (String)destination : "/mypage");
}
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HttpSession httpSession = request.getSession();
// 기존의 로그인 정보 제거.
if (httpSession.getAttribute(LOGIN) != null) {
LOGGER.info("clear login data before");
httpSession.removeAttribute(LOGIN);
}
return true;
}
}
| [
"ljw160791@gmail.com"
] | ljw160791@gmail.com |
694e79395320c5934da71d898b9b55fffc49d7c6 | f5153ffc3a0ab8dcb8dbd5236ed6c6f26fad5839 | /Semester 2/2/hw2.2/src/test/java/group144/kidyankin/MainTest.java | fe445333c6c118322cb69a896922f310f7659db6 | [] | no_license | mikekidya/homeworks | 50988db4d8873b521b2e7fa0f3cfb1001e904a3e | d298e452be916b259c05b5c2f10be52e0ce5e7e4 | refs/heads/master | 2021-06-25T18:04:07.975346 | 2019-05-11T11:19:43 | 2019-05-11T11:19:43 | 109,307,578 | 0 | 8 | null | 2019-05-11T11:19:45 | 2017-11-02T19:08:15 | Java | UTF-8 | Java | false | false | 1,387 | java | package group144.kidyankin;
import org.junit.Test;
import java.io.*;
import java.util.Scanner;
import static org.junit.Assert.*;
public class MainTest {
@Test
public void mainConsole() {
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
ByteArrayInputStream arrayInputStream = new ByteArrayInputStream("3\n1 2 3\n4 5 6\n7 8 9\nS\n".getBytes());
System.setOut(new PrintStream(arrayOutputStream));
System.setIn(arrayInputStream);
Main.main(null);
String EXPECTED = "Enter array size (odd number): Enter the array:\nPrint in spiral order in file (F) or screen (S)? " +
"Elements in spiral order: 5 2 1 4 7 8 9 6 3 ";
assertEquals(EXPECTED, arrayOutputStream.toString());
}
@Test
public void mainFile() throws FileNotFoundException {
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
ByteArrayInputStream arrayInputStream = new ByteArrayInputStream("3\n1 2 3\n4 5 6\n7 8 9\nF\n".getBytes());
System.setOut(new PrintStream(arrayOutputStream));
System.setIn(arrayInputStream);
Main.main(null);
String EXPECTED = "Elements in spiral order: 5 2 1 4 7 8 9 6 3 ";
Scanner file = new Scanner(new File("output.txt"));
file.useDelimiter("\n");
assertEquals(EXPECTED, file.next());
}
} | [
"kidyankin@icloud.com"
] | kidyankin@icloud.com |
9bdf7b7cf89f7e4f468c5d4377212d4f5572e6f3 | 1e862112bc1de75748291a533f0b21ec2a249084 | /src/main/java/com/rtst/dhjc/entity/systemInfo/UserRole.java | 19ef9749d719faad49909bcf7802cb3f1cadbcc4 | [] | no_license | white66/dhjc_rmyy | aa36ddcea8cb0dca93410d146627e49cf442823c | 78da0b7c0e2a104cdfaffbf9bdd5f7be9328c947 | refs/heads/master | 2023-02-24T23:39:43.849151 | 2021-01-30T11:29:41 | 2021-01-30T11:29:41 | 293,670,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | package com.rtst.dhjc.entity.systemInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @since 2020-05-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class UserRole implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Integer userId;//用户ID
private Integer roleId;//角色ID
}
| [
"45169774+white66@users.noreply.github.com"
] | 45169774+white66@users.noreply.github.com |
d81795470f6ae1db341287d49d10006c417807a7 | 43ea91f3ca050380e4c163129e92b771d7bf144a | /services/mpc/src/main/java/com/huaweicloud/sdk/mpc/v1/model/VideoSuperresolution.java | b4c0aa9020ea723fab3a0ef243a88833a20437d0 | [
"Apache-2.0"
] | permissive | wxgsdwl/huaweicloud-sdk-java-v3 | 660602ca08f32dc897d3770995b496a82a1cc72d | ee001d706568fdc7b852792d2e9aefeb9d13fb1e | refs/heads/master | 2023-02-27T14:20:54.774327 | 2021-02-07T11:48:35 | 2021-02-07T11:48:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,375 | java | package com.huaweicloud.sdk.mpc.v1.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.function.Consumer;
import java.util.Objects;
/**
* VideoSuperresolution
*/
public class VideoSuperresolution {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="name")
private String name;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="execution_order")
private Integer executionOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="scale")
private String scale;
public VideoSuperresolution withName(String name) {
this.name = name;
return this;
}
/**
* 超分算法名称\"hw-sr\"。
* @return name
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public VideoSuperresolution withExecutionOrder(Integer executionOrder) {
this.executionOrder = executionOrder;
return this;
}
/**
* 1 表示视频处理时第一个执行,2表示第二个执行,以此类推;除不执行,各视频处理算法的执行次序不可相同。
* @return executionOrder
*/
public Integer getExecutionOrder() {
return executionOrder;
}
public void setExecutionOrder(Integer executionOrder) {
this.executionOrder = executionOrder;
}
public VideoSuperresolution withScale(String scale) {
this.scale = scale;
return this;
}
/**
* 超分倍数,取值范围是[2,8],默认2。
* @return scale
*/
public String getScale() {
return scale;
}
public void setScale(String scale) {
this.scale = scale;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
VideoSuperresolution videoSuperresolution = (VideoSuperresolution) o;
return Objects.equals(this.name, videoSuperresolution.name) &&
Objects.equals(this.executionOrder, videoSuperresolution.executionOrder) &&
Objects.equals(this.scale, videoSuperresolution.scale);
}
@Override
public int hashCode() {
return Objects.hash(name, executionOrder, scale);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class VideoSuperresolution {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" executionOrder: ").append(toIndentedString(executionOrder)).append("\n");
sb.append(" scale: ").append(toIndentedString(scale)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"hwcloudsdk@huawei.com"
] | hwcloudsdk@huawei.com |
0c2c34773a171c755cd4166e043afde55098a3f2 | 175d75ce6e62b0be428729ced19ef11ebda44d3b | /library/src/main/java/com/chou/library/util/DateUtil.java | 8f1a797e6ffb8cbca2ee7d352b41d763523cf2b4 | [] | no_license | wo5553435/HttpLibrary | a95a01bea89c62ab174152b628fedbe034baf960 | 34827130d6e477de293fef95695ee68183e422d7 | refs/heads/master | 2021-01-23T13:08:01.673232 | 2017-12-25T01:24:47 | 2017-12-25T01:24:47 | 93,221,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,520 | java | package com.chou.library.util;
import android.content.Context;
import android.text.format.DateUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static final int Year=DateUtils.FORMAT_SHOW_YEAR,Month_Date=DateUtils.FORMAT_SHOW_DATE,Week_Day=DateUtils.FORMAT_SHOW_WEEKDAY,Time=DateUtils.FORMAT_SHOW_TIME;
/**
* 接受yyyy年MM月dd日的日期字符串参数,返回两个日期相差的天数
* @param start
* @param end
* @return
* @throws ParseException
*/
public static long getDistDates(String start, String end){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
Date startDate;
Date endDate;
try {
startDate = sdf.parse(start);
endDate = sdf.parse(end);
return getDistDates(startDate, endDate);
} catch (ParseException e) {
e.printStackTrace();
return 0;
}
}
/**
* 返回两个日期相差的天数
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public static long getDistDates(Date startDate, Date endDate) {
long totalDate = 0;
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
long timestart = calendar.getTimeInMillis();
calendar.setTime(endDate);
long timeend = calendar.getTimeInMillis();
totalDate = Math.abs((timeend - timestart)) / (1000 * 60 * 60 * 24);
return totalDate;
}
public static long getDistDatesNotAbs(Date startDate, Date endDate) {
long totalDate = 0;
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
long timestart = calendar.getTimeInMillis();
calendar.setTime(endDate);
long timeend = calendar.getTimeInMillis();
totalDate = (timeend - timestart) / (1000 * 60 * 60 * 24);
return totalDate;
}
/**
* 返回star日子 是否晚于 end日子 (同一时刻也算否)
* @param start
* @param end
* @return
*/
public static boolean isAfterDay(String start,String end){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance();
Date startDate = null;
Date RealstartDate;
Date endDate;
try {
startDate = sdf.parse(start);
endDate = sdf.parse(end);
//calendar.setTime(startDate);
//calendar.add(Calendar.DAY_OF_MONTH,1);
//RealstartDate=calendar.getTime();
//String RealtimeStr=sdf.format(RealstartDate);
//RealstartDate=sdf.parse(RealtimeStr);
calendar.setTime(startDate);
long starttime=calendar.getTimeInMillis();
calendar.setTime(endDate);
long endttime=calendar.getTimeInMillis();
double totalDate =(endttime - starttime);
if(totalDate>0) return true;
else return false;
} catch (ParseException e) {
e.printStackTrace();
}
return false;
}
/**
* 返回由毫秒时间戳对应的时间字符串
* @param context
* @param millis
* @param flag
* @return
*/
public static String getDaytimeStr(Context context,long millis, int... flag){
return "";
}
public static boolean IsAfterToday(String start, String end){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance();
Date startDate = null;
Date endDate;
try {
startDate = sdf.parse(start);
endDate = sdf.parse(end); }catch (ParseException e) {
return false;
}
//calendar.setTime(startDate);
//calendar.add(Calendar.DAY_OF_MONTH,1);
//RealstartDate=calendar.getTime();
//String RealtimeStr=sdf.format(RealstartDate);
//RealstartDate=sdf.parse(RealtimeStr);
calendar.setTime(startDate);
long starttime=calendar.getTimeInMillis();
calendar.setTime(endDate);
long endttime=calendar.getTimeInMillis();
double totalDate =(endttime - starttime);
if(totalDate>0){
return true;
}else if(totalDate==0) {
return true;
}else{
return false;
}
// } catch (ParseException e) {
// e.printStackTrace();
// Logs.e("e==null",""+e);
// return false;
// }
}
/**
* 接受yyyy年MM月dd日的日期字符串参数
* @param start
* @param end
* @return
* @throws ParseException
*/
public static int compareTo(String start, String end){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
Date startDate;
Date endDate;
try {
startDate = sdf.parse(start);
endDate = sdf.parse(end);
return startDate.compareTo(endDate);
} catch (ParseException e) {
e.printStackTrace();
return -1;
}
}
/**
* 智能化计算任意两天相距天数 ,已每天的凌晨0:点为单位为一天
* @param start 开始时间
* @param end 结束时间
* @return 天数
*/
public static int comareToDaydiff(String start,String end ){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance();
Date startDate = null;
Date RealstartDate;
Date endDate;
try {
startDate = sdf.parse(start);
endDate = sdf.parse(end);
calendar.setTime(startDate);
calendar.add(Calendar.DAY_OF_MONTH,1);
RealstartDate=calendar.getTime();
String RealtimeStr=sdf.format(RealstartDate);
RealstartDate=sdf.parse(RealtimeStr);
calendar.setTime(RealstartDate);
long starttime=calendar.getTimeInMillis();
calendar.setTime(endDate);
long endttime=calendar.getTimeInMillis();
double totalDate = Math.ceil(Math.abs((endttime - starttime)) / (1000.0f * 60 * 60 * 24));
return (int)totalDate+1;
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
}
| [
"wo5553435@163.com"
] | wo5553435@163.com |
89c77bf6051c9d63330b8bc89ead1729f8c81c21 | feb5e052eecd2d3cff2649b1ed988a6734017792 | /node_modules/react-native-share/android/build/generated/source/buildConfig/debug/cl/json/BuildConfig.java | 4410414b5b046a41b84e87b787f51f7f5c5da509 | [
"MIT"
] | permissive | joaoguilhermee/react-native-marvel | 75e4c2e55c4713dccb92d7c10f4d03b7bc6d11c6 | 186d0f1b519dfe5aa7963e4a0130b2bcd35286f3 | refs/heads/master | 2022-12-02T11:30:06.070691 | 2020-01-24T18:08:37 | 2020-01-24T18:08:37 | 288,466,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package cl.json;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "cl.json";
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 = "";
}
| [
"joaogbarbosa@gmail.com"
] | joaogbarbosa@gmail.com |
1893c09009e689ec2ca2c9deb35ea6185b004f87 | e4dd18535ba22d5f7e481ea2c61bc6273593b6a0 | /src/java/services/src/main/java/service/TokenService.java | 9323c4944f233eaa25e49f33006994895b2dc3f5 | [] | no_license | huybinh1994/HTTTHienDai | d72561f0758d4ff4c06e3e0b08568c47c4462196 | 389d36b5766d22293763d37e8e0a4d2ac284fade | refs/heads/master | 2020-02-26T15:00:19.238160 | 2017-06-12T23:55:20 | 2017-06-12T23:55:20 | 83,222,090 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package service;
import model.TokensDTO;
public interface TokenService {
public Boolean finTokenByTK(TokensDTO tk);
public Boolean deleteTK(TokensDTO tk);
}
| [
"xuanthai_dbk@yahoo.com"
] | xuanthai_dbk@yahoo.com |
69bcb3148cd5a2721634141646a65df1abd7e6cc | 7016cec54fb7140fd93ed805514b74201f721ccd | /src/java/com/echothree/control/user/payment/common/edit/PaymentProcessorActionTypeEdit.java | ddd8cce6c6a5bfdfa45040c592f5aae8f20e5425 | [
"MIT",
"Apache-1.1",
"Apache-2.0"
] | permissive | echothreellc/echothree | 62fa6e88ef6449406d3035de7642ed92ffb2831b | bfe6152b1a40075ec65af0880dda135350a50eaf | refs/heads/master | 2023-09-01T08:58:01.429249 | 2023-08-21T11:44:08 | 2023-08-21T11:44:08 | 154,900,256 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,203 | java | // --------------------------------------------------------------------------------
// Copyright 2002-2023 Echo Three, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// --------------------------------------------------------------------------------
package com.echothree.control.user.payment.common.edit;
import com.echothree.control.user.payment.common.spec.PaymentProcessorActionTypeSpec;
public interface PaymentProcessorActionTypeEdit
extends PaymentProcessorActionTypeSpec, PaymentProcessorActionTypeDescriptionEdit {
String getIsDefault();
void setIsDefault(String isDefault);
String getSortOrder();
void setSortOrder(String sortOrder);
}
| [
"rich@echothree.com"
] | rich@echothree.com |
178d8489355942101d0d8bc2780dd79dcd4a51c8 | 413b89671d98cc1bcee05b7ed0a967d5d55db2a9 | /Examples/ENTRUST_UUV/src/main/java/controller/QV.java | d2cc61cdf89544fc04a3c9ac832b72197b14dd8f | [] | no_license | vepoblio/ENTRUST | 94bb57964cc579afc59ef7d4da23d04f62d232c0 | 9ece40e2b288f2eeef2a5a6b92741b601a9e7cdf | refs/heads/master | 2021-06-09T19:12:13.662275 | 2016-11-17T12:47:30 | 2016-11-17T12:47:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,494 | java | //==========================================================================================//
// //
// Author: //
// - Simos Gerasimou <simos@cs.york.ac.uk> (University of York) //
// //
//------------------------------------------------------------------------------------------//
// //
// Notes: //
// - Quantitative Verification class //
// It uses PrismApi class and invokes the appropriate methods //
// to quantify the property of interest. //
// //
//------------------------------------------------------------------------------------------//
// //
// Remarks: //
// //
//==========================================================================================//
package controller;
import java.util.List;
import auxiliary.Utility;
import prism.PrismAPI;
public class QV {
/** PRISM instance */
PrismAPI prism;
/** Name of model file */
String modelFileName;
/** Name of properties file */
String propertiesFileName;
/** Model string*/
String modelAsString;
/** output file */
String fileName;
/** Structure that keeps the result after RQV (i.e., reliability, cost, and response time) */
private RQVResult RQVResultsArray[];
/** System characteristics*/
private final int NUM_OF_SENSORS ;
private final int NUM_OF_SENSOR_CONFIGS ;//possible sensor configurations
private final int NUM_OF_SPEED_CONFIGS ; // [0,21], discrete steps
private final int NUM_OF_CONFIGURATIONS ;
/**
* Constructor
*/
public QV(){
//init system characteristics
NUM_OF_SPEED_CONFIGS = 21; // [0,21], discrete steps
NUM_OF_SENSORS = 3;
NUM_OF_SENSOR_CONFIGS = (int) (Math.pow(2,NUM_OF_SENSORS)); //possible sensor configurations
NUM_OF_CONFIGURATIONS = (NUM_OF_SENSOR_CONFIGS-1) * NUM_OF_SPEED_CONFIGS; //discard configuration in which all sensors are switch off
try{
//Read model and properties parameters
this.modelFileName = Utility.getProperty("MODEL_FILE");
this.propertiesFileName = Utility.getProperty("PROPERTIES_FILE");
//initialise PRISM instance
this.prism = new PrismAPI();
prism.setPropertiesFile(propertiesFileName);
//Read the model
this.modelAsString = Utility.readFile(modelFileName);
//init the output file
this.fileName = Utility.getProperty("RQV_OUTPUT_FILE");
//init structure for storing QV results
this.RQVResultsArray = new RQVResult[NUM_OF_CONFIGURATIONS];
}
catch(Exception e){
e.printStackTrace();
System.exit(-1);
}
}
/**
* Run quantitative verification
* @param parameters
*/
public RQVResult[] runQV(Object ... parameters){
//For all configurations run QV and populate RQVResultArray
for (int CSC=1; CSC<NUM_OF_SENSOR_CONFIGS; CSC++){
for (int s=20; s<=40; s++){
int index = ((CSC-1)*21)+(s-20);
Object[] arguments = new Object[9];
arguments[0] = parameters[0];
arguments[1] = parameters[1];
arguments[2] = parameters[2];
arguments[3] = estimateP(s/10.0, 5);
arguments[4] = estimateP(s/10.0, 7);
arguments[5] = estimateP(s/10.0, 11);
arguments[6] = parameters[3];
arguments[7] = CSC;
arguments[8] = s/10.0;
//1) Instantiate parametric stochastic model
String modelString = realiseProbabilisticModel(arguments);
//2) load PRISM model
prism.loadModel(modelString);
//3) run PRISM
List<Double> prismResult = prism.runPrism();
double req1result = prismResult.get(0);
double req2result = prismResult.get(1);
//4) store configuration results
RQVResultsArray[index] = new RQVResult(CSC, s/10.0, req1result, req2result);
}
}
//return RQVResult for all configurations
return RQVResultsArray;
}
/**
* Estimate Probability of producing a successful measurement
* @param speed
* @param alpha
* @return
*/
private static double estimateP(double speed, double alpha){
return 100 - alpha * speed;
}
/**
* Generate a complete and correct PRISM model using parameters given
* @param parameters for creating a correct PRISM model
* @return a correct PRISM model instance as a String
*/
private String realiseProbabilisticModel(Object ... parameters){
StringBuilder model = new StringBuilder(modelAsString + "\n\n//Variables\n");
//process the given parameters
model.append("const double r1 = "+ parameters[0].toString() +";\n");
model.append("const double r2 = "+ parameters[1].toString() +";\n");
model.append("const double r3 = "+ parameters[2].toString() +";\n");
model.append("const double p1 = "+ parameters[3].toString() +";\n");
model.append("const double p2 = "+ parameters[4].toString() +";\n");
model.append("const double p3 = "+ parameters[5].toString() +";\n");
model.append("const int PSC = "+ parameters[6].toString() +";\n");
model.append("const int CSC = "+ parameters[7].toString() +";\n");
model.append("const double s = "+ parameters[8].toString() +";\n\n");
return model.toString();
}
}
| [
"simos@cs.york.ac.uk"
] | simos@cs.york.ac.uk |
b56fccad9df07dfcbbf7a38cb8c9cd42032e4bdf | ae354e68317a92c17b88ec7711c4e5896ef8fcb4 | /src/projekt/chess/GUI/AbstractView.java | ea098e2ce02b32d606eba1f275df84ce55e59e3a | [] | no_license | sstokic-tgm/3D-Schach | 25d214e857c55f0f3f0cdbfacc9c74a8ad6885ac | a24aa8de530d3395f17fa2eda4b68fca3338db06 | refs/heads/master | 2021-01-14T13:43:44.117118 | 2015-01-12T15:37:26 | 2015-01-12T15:37:26 | 24,091,193 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,363 | java | package projekt.chess.GUI;
import projekt.chess.grids.Board;
import java.awt.Component;
import java.awt.event.MouseListener;
import projekt.chess.Global.Coord;
public interface AbstractView {
/* Placement functions */
/**
* Display every movable grids both on the main panel and on the small panel
*/
public void attackBoardPlacement();
/**
* Place a list of grids on the main panel
* @param boardList
*/
public void mainBoardPlacement(Board boardList);
/**
* Place a list of grids on the small panel
* @param boardList
*/
public void smallBoardPlacement(Board boardList);
/**
* Position every pieces on the board
*/
public void piecesPlacement();
/**
* Display the dead pieces in the top-right position of the window
*/
public void deadPiecesPlacement();
/* Cleaning function */
/**
* Display every attack boards (without any piece)
*/
public void cleanAttackBoards();
/**
* Display the grids from boardList without any piece on them
* @param boardList
*/
public void boardCleaning(Board boardList);
/**
* Remove every piece images from the board
*/
public void piecesCleaning();
/**
* Remove every images from the dead pieces section
*/
public void deadPiecesCleaning();
/**
* Get the JPanelImage corresponding to the 3D coord of the model.<br>
* The 3D coord is internally converted to graphical coordinates by calling {@link Global.Coord#toCoordGraph() Coord.toCoordGraph()}
* @param coord
* @return the JPanelImage corresponding to coord on the user interface
*/
public JPanelImage getCaseFrom3DCoords(Coord coord);
/**
* Get the 2D coord graph corresponding with a user interaction on the main panel
* @param x, y : coordinates of click or a mouse event on the UI
* @return CoordGraph of the case at the (x,y) coordinates
*/
public CoordGraph coordCaseAtPointer(int x, int y);
/**
* Get the 2D coord graph corresponding with a user interaction on the small panel
* @param x, y : coordinates of click or a mouse event on the UI
* @return CoordGraph of the case at the (x,y) coordinates
*/
public CoordGraph coordSmallCaseAtPointer(int x, int y);
/**
* Get the JPanelImage corresponding to the 2D coordGraph sent in parameter
* @param coordGraph
* @return JPanelImage
*/
public JPanelImage getCaseFromCoords(CoordGraph coordGraph);
/**
* Get the JPanelImage (from the small board) corresponding to the 2D coordGraph sent in parameter
* @param coordGraph
* @return JPanelImage
*/
public JPanelImage getSmallCaseFromCoords(CoordGraph coordGraph);
/**
* Remove and display again the dead pieces
*/
public void refreshDeadPieces();
/**
* Refresh the player names to reflect the current player in bold font
*/
public void refreshCurrentPlayer();
/**
* Display a popup window to ask the user if the first (or second) player is a human or a bot
* @param playerName
* @return JOptionPane.YES_OPTION or JOptionPane.NO_OPTION
*/
public int popupPlayer(String playerName);
/*
* Functions from the JFrame class that are used directly on the AbstractView
* This should not happen if we want to respect a true MVC pattern
*/
public void dispose();
public void revalidate();
public void addMouseListener(MouseListener listener);
public void pack();
public void setLocationRelativeTo(Component object);
} | [
"sstokic@student.tgm.ac.at"
] | sstokic@student.tgm.ac.at |
44773872dca850824307c5623abf16c9c27a7fb2 | 2d870d749faf8864975a3da3f58c270eac74965d | /src/main/java/com/design/create/norFactory/controller/FactoryController.java | a8ee6f8ef82a476c2f1afa11e0a0ef759e560398 | [] | no_license | jjc120074203/spring-design-learning | d51c8f5aaf08dff5c7375484cb0d73336d59df61 | 972d312595c480916cccd3f6c26439541e996de6 | refs/heads/master | 2022-07-03T23:04:44.593773 | 2021-02-02T10:49:14 | 2021-02-02T10:49:14 | 206,931,138 | 0 | 0 | null | 2022-06-17T02:27:36 | 2019-09-07T07:17:03 | Java | UTF-8 | Java | false | false | 1,121 | java | package com.design.create.norFactory.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.design.create.norFactory.Delivery;
import com.design.create.norFactory.DeliveryProvider;
/**
* @author 工厂test
*
*/
@RestController
public class FactoryController {
@Autowired
@Qualifier("A_Provider_Factory")//当前一个接口实现多个类 指定Spring 注解要加载的bean
private DeliveryProvider DeliveryProviderA;
@Autowired
@Qualifier("B_Provider_Factory")//指定Spring 注解要加载的bean
private DeliveryProvider DeliveryProviderB;
/**
* 抽象工厂
* @param a
* @return
*/
@GetMapping("/testAbstractFactory")
public String testAbstractFactory(int a){
if (a>0) {
//定义A类抽象工厂实现方法
Delivery da=DeliveryProviderA.handleProvider();
return da.Delivery();
}
Delivery dB=DeliveryProviderB.handleProvider();
return dB.Delivery();
}
}
| [
"chenjl@.csizg.com"
] | chenjl@.csizg.com |
222896363a823ac96b93cdb0238c01a5bad58a24 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/kylin/learning/6224/ShellExecutable.java | 0e317b32407ba88c2f1edc17f203bc6f94e83dc9 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,469 | 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.kylin.job.common;
import java.io.IOException;
import org.apache.kylin.common.util.Pair;
import org.apache.kylin.job.exception.ExecuteException;
import org.apache.kylin.job.exception.ShellException;
import org.apache.kylin.job.execution.AbstractExecutable;
import org.apache.kylin.job.execution.ExecutableContext;
import org.apache.kylin.job.execution.ExecuteResult;
import org.slf4j.LoggerFactory;
/**
*/
public class ShellExecutable extends AbstractExecutable {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ShellExecutable.class);
private static final String CMD = "cmd";
public ShellExecutable() {
super();
}
@Override
protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException {
try {
logger.info("executing:" + getCmd());
final PatternedLogger patternedLogger = new PatternedLogger(logger);
final Pair<Integer, String> result = context.getConfig().getCliCommandExecutor().execute(getCmd(), patternedLogger);
getManager().addJobInfo(getId(), patternedLogger.getInfo());
return result.getFirst() == 0 ? new ExecuteResult(ExecuteResult.State.SUCCEED,result.getSecond())
: ExecuteResult.createFailed(new ShellException(result.getSecond()));
} catch (IOException e) {
logger.error("job:" + getId() + " execute finished with exception", e);
return ExecuteResult.createError(e);
}
}
public void setCmd(String cmd) {
setParam(CMD, cmd);
}
public String getCmd() {
return getParam(CMD);
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
7b14985c2cc5819d007d5c1d7bb8e738425a88de | 5db00ec8e46043d4e6cb675e9b0265a31f2b5890 | /src/main/java/com/lohika/nsorestservice/model/NsoUser.java | 35cc15a84d8b1f9edb604f9451166929b7a31fa8 | [] | no_license | devTitarenko/nso-rest-service | b9483ab3a6a349ba5f3d21887bf7ddd560055337 | f8f52bb78c46ed91e831caec8e68b6f26a3631bd | refs/heads/master | 2020-07-09T11:54:48.280670 | 2019-08-23T12:37:12 | 2019-08-23T12:37:12 | 203,962,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.lohika.nsorestservice.model;
import lombok.Data;
@Data
public class NsoUser {
private User user;
@Data
static class User {
private String name;
private String uid;
private String gid;
private String password;
private String ssh_keydir;
private String homedir;
}
}
| [
"vtytarenko@lohika.com"
] | vtytarenko@lohika.com |
5f195db38a2af5786cee5f87307af8a95771ee92 | 23c50379a9c637d320ff664cff234fddd7c2d8d3 | /src/main/java/pers/tuershen/bladeplus/bukkit/inv/WarningInventory.java | cdcc3e571a2732763abc6b5d02c928863249eb89 | [] | no_license | Tuershen/BladePlus | f654227ee45da7e1feb23a3d1312f60333238b8d | fac164512cbc62fd254b9bd8586b776c5ab0d2ae | refs/heads/main | 2023-04-19T16:20:35.729629 | 2021-05-08T15:25:24 | 2021-05-08T15:25:24 | 338,181,317 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,074 | java | package pers.tuershen.bladeplus.bukkit.inv;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import pers.tuershen.bladeplus.BladePlusMain;
import pers.tuershen.bladeplus.api.IYamlSetting;
import pers.tuershen.bladeplus.bukkit.common.BladePlusItem;
/**
* @auther Tuershen Create Date on 2021/2/9
* 警告界面
*/
public class WarningInventory implements InventoryHolder {
private Inventory warning;
public WarningInventory(String title, IYamlSetting iYamlSetting){
BladePlusItem firstItem = iYamlSetting.getIYamlGuiSetting().getBladePlusInventoryAttribute().getFirstItem();
ItemStack first = new ItemStack(Material.valueOf(firstItem.getType()), 1, firstItem.getDur());
this.warning = BladePlusMain.bladePlusMain.getServer().createInventory(this, 9, title);
for (int i = 0; i < 9; i++)
this.warning.setItem(i, first);
}
@Override
public Inventory getInventory() {
return this.warning;
}
}
| [
"1208465031@qq.com"
] | 1208465031@qq.com |
27e94d2478c9fcc2f76634776c20945ef84bd806 | 33d8ec2e883bd4adb789dc13f24d5d6f8d6d9d2b | /src/lucka17/Lucka17.java | a12400ac0df3d8deba06aea7d382b75032400420 | [] | no_license | torbjornumegard/adventofcode2016 | cec939410ceaa1fae5f40a6a36e0b7e03571dae8 | f13d3f4ba6b35ee3de3f855216e77b717280e6f7 | refs/heads/master | 2021-01-12T07:31:50.604303 | 2016-12-20T16:34:29 | 2016-12-20T16:34:29 | 76,972,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,305 | java | package lucka17;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.junit.Assert;
public class Lucka17 {
String passcode;
int maxLength; // dont examine paths longer than this
public Lucka17(String code, int max) {
System.out.print(code + ":");
passcode = code;
maxLength = max;
}
public static void main(String[] args) {
Assert.assertEquals("check hash", "f2bc", md5("hijklD").substring(0, 4));
Assert.assertEquals("check hash", "5745", md5("hijklDR").substring(0, 4));
Assert.assertEquals("check hash", "528e", md5("hijklDU").substring(0, 4));
Lucka17 lucka = new Lucka17("ihgpwlah", 10);
Assert.assertEquals("DDRRRD", lucka.solve());
lucka = new Lucka17("kglvqrro", 20);
Assert.assertEquals("DDUDRLRRUDRD", lucka.solve());
lucka = new Lucka17("ulqzkmiv", 30);
Assert.assertEquals("DRURDRUDDLLDLUURRDULRLDUUDDDRR", lucka.solve());
lucka = new Lucka17("qzthpkfp", 20);
lucka.solve();
}
public String solve() {
String s = solve(1, 1, "");
System.out.println(s);
return s;
}
private String solve(int x, int y, String stepsDone) {
if (x == 4 && y == 4) {
return stepsDone;
}
if (x < 1 || y < 1 || x > 4 || y > 4 || stepsDone.length()>this.maxLength) {
return null; // not possible
}
String hashstring = md5(this.passcode + stepsDone).substring(0, 4);
boolean upPossible = hashstring.charAt(0) >= 'b' && hashstring.charAt(0) <= 'f';
boolean downPossible = hashstring.charAt(1) >= 'b' && hashstring.charAt(1) <= 'f';
boolean leftPossible = hashstring.charAt(2) >= 'b' && hashstring.charAt(2) <= 'f';
boolean rightPossible = hashstring.charAt(3) >= 'b' && hashstring.charAt(3) <= 'f';
String s1 = rightPossible ? solve(x + 1, y, stepsDone + "R") : null;
String s2 = downPossible ? solve(x, y + 1, stepsDone + "D") : null;
String s3 = leftPossible ? solve(x - 1, y, stepsDone + "L") : null;
String s4 = upPossible ? solve(x, y - 1, stepsDone + "U") : null;
String best = s1;
if (best == null || s2 != null && s2.length() < best.length()) {
best = s2;
}
if (best == null || s3 != null && s3.length() < best.length()) {
best = s3;
}
if (best == null || s4 != null && s4.length() < best.length()) {
best = s4;
}
return best; // the shortest string-path
}
private static String md5(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(input.getBytes());
BigInteger number = new BigInteger(1, messageDigest);
String hashtext = number.toString(16);
// Now we need to zero pad it if you actually want the full 32 chars.
while (hashtext.length() < 32) {
hashtext = "0" + hashtext;
}
return hashtext;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
}
| [
"torbjorn.umegard@tacton.com"
] | torbjorn.umegard@tacton.com |
37970d2c2643fafa649aa2908afeee53e073f592 | 2753311aa10600d5ffde7d5bd1f050b5f1d71d68 | /src/main/java/by/sazanchuk/finalTask/controller/command/action/Command.java | 742a990f26c2a501b0e0394487d1a63b61579aeb | [] | no_license | dianasaz/PetClinic | 770d432fbb605a1ce62c4234ff6074f066a6687d | d8ac658046a9b8b5cbc60f38a55901c98a9e637d | refs/heads/master | 2022-07-05T09:59:34.841146 | 2020-05-14T15:53:46 | 2020-05-14T15:53:46 | 233,541,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package by.sazanchuk.finalTask.controller.command.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* The interface Command.
*/
public interface Command {
/**
* Execute command result.
*
* @param request the request
* @param response the response
* @return the command result
*/
CommandResult execute(HttpServletRequest request, HttpServletResponse response);
}
| [
"dianasazanchuk@gmail.com"
] | dianasazanchuk@gmail.com |
624500288fc7566a658c82b9e03da55160cd8559 | e1ba56c68e8fdc12b994fb8c7eae7c596260c0eb | /app/src/androidTest/java/com/androilk/bifs/ExampleInstrumentedTest.java | 7e6a4487ac17d953c9aed6ab4c4caf8e84cedaf7 | [] | no_license | busraserbest/BifsMobile | f675e6eb5b0a04619d561b42f934c9f35a4bb757 | d087abd0eab83628d535f157d0f6ffc464ca6e3e | refs/heads/master | 2020-03-12T14:34:02.965451 | 2018-04-23T15:35:33 | 2018-04-23T15:35:33 | 142,436,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.androilk.bifs;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.androilk.bifs", appContext.getPackageName());
}
}
| [
"f.burakilk@yandex.com"
] | f.burakilk@yandex.com |
181ae4460c9acbae78cafe37fe10e7f48df9cb14 | de4c4ac484e27daab6f1567d336d6459961a1cd5 | /app/src/androidTest/java/com/concordia/cejv669/lab10_1/ExampleInstrumentedTest.java | 15de2325800c5745b50c48380b5e56fd5e8822b5 | [] | no_license | zhenqianfeng/Lab101 | 5147aa1aa3fa09e3909d303b823e6d32296c89ba | 1eaabd57775830ceff30608b429cfe4201d5f39a | refs/heads/master | 2020-04-24T12:45:39.303856 | 2019-02-22T01:35:15 | 2019-02-22T01:35:15 | 171,965,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.concordia.cejv669.lab10_1;
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.concordia.cejv669.lab10_1", appContext.getPackageName());
}
}
| [
"ferretfeng@yahoo.ca"
] | ferretfeng@yahoo.ca |
200920d9ecd5eaab87dafd968242efc83cc3f110 | a784fa962f5bed1b240c97d325c4a91281259217 | /src/leetcode/problem/p0/P169.java | 96fa6450a30892ea5e83b934635ee46f4ef4f612 | [] | no_license | HwangNara/algorithm | f41e680f4f0709c662aa22bdb98d6e227387c050 | 086feb0812319f74356125c4016a4565559d500e | refs/heads/master | 2022-04-30T19:32:35.488279 | 2021-03-14T11:55:38 | 2021-03-14T11:55:38 | 56,922,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package leetcode.problem.p0;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class P169 {
public static void main(String[] args) {
int[] input = {2, 2, 1, 1, 1, 2, 2};
// int[] input = {3, 3, 4};
// int[] input = {2, 2, 1, 1, 1, 2, 2};
System.out.println(new P169().majorityElement(input)); // 2
}
public int majorityElement(int[] nums) {
Map<Integer, Integer> map = new HashMap<>();
for (int n : nums) {
map.merge(n, 1, (oldVal, newVal) -> oldVal + 1);
}
int maxKey = -1;
int maxVal = -1;
for (Entry<Integer, Integer> entry : map.entrySet()) {
if (maxVal < entry.getValue()) {
maxKey = entry.getKey();
maxVal = entry.getValue();
}
}
return maxKey;
}
}
| [
"hnaras@naver.com"
] | hnaras@naver.com |
45e45073328f3f7f1d7d3315491a98f32ae6e896 | b4305d3a107db3d2c788b9798ff5e81c318ce488 | /carbon/src/main/java/carbon/view/CornersView.java | 94a92f72b7a3d86755200ca9c9cabbb9d499b80b | [
"Apache-2.0"
] | permissive | mohitissar/Carbon | 8bc838ee7c245a552a7d68813a7a0520970fbf82 | 7a17de88ece291b0675a4c3991c0fa4791bdc1da | refs/heads/master | 2020-04-21T02:17:55.307430 | 2019-01-11T22:25:21 | 2019-01-11T22:26:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package carbon.view;
@Deprecated
public interface CornersView extends RoundedCornersView {
Corners getCorners();
void setCorners(Corners corners);
void setCornerCut(float cornerCut);
}
| [
"niewartotupisac@gmail.com"
] | niewartotupisac@gmail.com |
0a9798379914e17c8b634a43022aa4de67f40331 | a67903f1e816a29028ec4b137afd92aa8139c31f | /mobile/android/app/src/main/java/com/nl/clubbook/helper/UserEmailFetcher.java | e301634fef88543e94d19e2438b1d60a48f6737b | [] | no_license | andrewkuzmych/clubbook | 021e838631960b296527b1752aee96966f0ad93f | 19e30cfe5215d74f45f05339379980d85e22e4e2 | refs/heads/master | 2021-03-24T12:34:06.563067 | 2015-02-25T09:24:31 | 2015-02-25T09:24:31 | 19,495,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,755 | java | package com.nl.clubbook.helper;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import java.util.LinkedList;
import java.util.List;
/**
* Created by Andrew on 5/26/2014.
*/
public class UserEmailFetcher {
public static String getEmail(Context context) {
AccountManager accountManager = AccountManager.get(context);
Account account = getAccount(accountManager);
if (account == null) {
return null;
} else {
return account.name;
}
}
public static String getUsername(Context context){
AccountManager manager = AccountManager.get(context);
Account[] accounts = manager.getAccountsByType("com.google");
List<String> possibleEmails = new LinkedList<String>();
for (Account account : accounts) {
// TODO: Check possibleEmail against an email regex or treat
// account.name as an email address only for certain account.type values.
possibleEmails.add(account.name);
}
if(!possibleEmails.isEmpty() && possibleEmails.get(0) != null){
String email = possibleEmails.get(0);
String[] parts = email.split("@");
if(parts.length > 0 && parts[0] != null)
return parts[0];
else
return null;
}else
return null;
}
private static Account getAccount(AccountManager accountManager) {
Account[] accounts = accountManager.getAccountsByType("com.google");
Account account;
if (accounts.length > 0) {
account = accounts[0];
} else {
account = null;
}
return account;
}
}
| [
"andrew.kuzmych@gmail.com"
] | andrew.kuzmych@gmail.com |
0a7263308b4456f69a38c98822a140c18527dec9 | d820b164487958dfbdba363ef9206bba79cf0486 | /app/src/main/java/com/example/forfishes/AdminAlterActivity.java | 0a8494fd1e71498e05bbc7b4b3e26452694778ed | [] | no_license | KimonnAravind/Fish-care-series | 1e5d21ccf0df913a2b6ecc405bf8a75663bb747d | c331770964b20cb179d6faca82f8efd424e31ac7 | refs/heads/master | 2022-04-10T14:53:34.491470 | 2020-03-08T06:38:53 | 2020-03-08T06:38:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,625 | java | package com.example.forfishes;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import java.util.HashMap;
public class AdminAlterActivity extends AppCompatActivity
{
private Button applychanges,deleteproduct;
private EditText name,price,description;
private ImageView imageView;
private String productID="";
private DatabaseReference productRef;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_alter);
deleteproduct=(Button)findViewById(R.id.deleteproduct);
productID=getIntent().getStringExtra("pid");
imageView=(ImageView)findViewById(R.id.product_images);
productRef= FirebaseDatabase.getInstance().getReference().child("Products").child(productID);
applychanges=(Button)findViewById(R.id.applychanges);
name=(EditText)findViewById(R.id.product_names);
price=(EditText)findViewById(R.id.product_prices);
description=(EditText)findViewById(R.id.product_descriptions);
displayproductinfo();
deleteproduct.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
deletethisproduct();
}
});
applychanges.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(AdminAlterActivity.this, "Fine", Toast.LENGTH_SHORT).show();
applychangesall();
}
});
}
private void deletethisproduct()
{
HashMap<String,Object> proMap= new HashMap<>();
proMap.put("description","Temporarily unavailable");
proMap.put("pname","Temporarily unavailable");
proMap.put("price","000");
productRef.updateChildren(proMap).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful())
{
Toast.makeText(AdminAlterActivity.this, "Product Deleted", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(AdminAlterActivity.this, AdminProductActivity.class);
startActivity(intent);
}
}
});
}
private void applychangesall()
{
String uname=name.getText().toString();
String uprice= price.getText().toString();
String udescription = description.getText().toString();
if(uname.equals(""))
{
Toast.makeText(this, "Enter Product name", Toast.LENGTH_SHORT).show();
}
else if (uprice.equals(""))
{
Toast.makeText(this, "Enter Product price", Toast.LENGTH_SHORT).show();
}
else if(udescription.equals(""))
{
Toast.makeText(this, "Enter Product description", Toast.LENGTH_SHORT).show();
}
else
{
HashMap<String ,Object> productMap = new HashMap<>();
productMap.put("pid",productID);
productMap.put("description",udescription);
productMap.put("price",uprice);
productMap.put("pname",uname);
productRef.updateChildren(productMap).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task)
{
if(task.isSuccessful())
{
Toast.makeText(AdminAlterActivity.this, "Changes applied successfully", Toast.LENGTH_SHORT).show();
Intent intent= new Intent(AdminAlterActivity.this,AdminProductActivity.class);
startActivity(intent);
finish();
}
}
});
}
}
private void displayproductinfo()
{
productRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot)
{
if(dataSnapshot.exists())
{
String p1name= dataSnapshot.child("pname").getValue().toString();
String p1price= dataSnapshot.child("price").getValue().toString();
String p1descripion= dataSnapshot.child("description").getValue().toString();
String p1image= dataSnapshot.child("image").getValue().toString();
name.setText(p1name);
price.setText(p1price);
description.setText(p1descripion);
Picasso.get().load(p1image).into(imageView);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"aravindselvam03@gmail.com"
] | aravindselvam03@gmail.com |
44e9b83aa1ddcaf948cdb5e2edaa25230310a16f | 56e9db0afbdbce85d5b13a9e6b56a47662b07b38 | /app/src/test/java/at/wtmvienna/app/utils/DatabaseTest.java | 14c146a11946483231ed6cd0f4da86fa78000d12 | [
"Apache-2.0"
] | permissive | GDGVienna/wtmvienna-app | 3a4363a2f821d6e185c5de51761c05f0bd9270e9 | 1a47c1c7960f24106609ba4f681cb457b7422d87 | refs/heads/master | 2021-01-19T20:40:23.090650 | 2017-03-07T17:37:29 | 2017-03-07T17:37:29 | 83,762,757 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | package at.wtmvienna.app.utils;
import android.database.Cursor;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class DatabaseTest {
@Mock Cursor cursor;
@Test
public void should_return_string_cursor_data() {
// Given
when(cursor.getColumnIndexOrThrow("column_name")).thenReturn(42);
when(cursor.getString(42)).thenReturn("string-data");
// When
String result = Database.getString(cursor, "column_name");
// Then
assertThat(result).isEqualTo("string-data");
}
@Test
public void should_return_int_cursor_data() {
// Given
when(cursor.getColumnIndexOrThrow("column_name")).thenReturn(21);
when(cursor.getInt(21)).thenReturn(10);
// When
int result = Database.getInt(cursor, "column_name");
// Then
assertThat(result).isEqualTo(10);
}
}
| [
"helmuth@breitenfellner.at"
] | helmuth@breitenfellner.at |
6351f8175629deea6075d64680f8b2955700505b | b991b3822572e13c1a0e17f037564326d4932ff6 | /valid-number/Wrong Answer/4-28-2020, 12_27_27 PM/Solution.java | 3321d1c793d46fc7a2e091a88085d43d3c446cac | [] | no_license | isaigm/leetcode | 8f1188a824e78f11b8223302fe625e9a8bf9262a | e53b04a9f627ff95aaae9f8e5315f5f688c6b9e2 | refs/heads/master | 2023-01-06T02:07:41.118942 | 2022-12-31T23:13:20 | 2022-12-31T23:13:20 | 248,679,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | // https://leetcode.com/problems/valid-number
class Solution {
public boolean isNumber(String s) {
s = s.trim();
if(s.compareTo(".") == 0) return false;
return s.matches("^\\s*[\\+-]?((\\d+)|(\\d*\\.\\d*)|(\\d+e[\\+-]?\\d+)|(\\d+\\.\\d+e[\\+-]?\\d+))\\s*$");
}
} | [
"isaigm23@gmail.com"
] | isaigm23@gmail.com |
a30b6eb5ec7a205d5b13984acbc92274590f6bb1 | 123a8325d7fffa23d99fb66fc70937b0a4087b7a | /src/com/gcj/db/DBUtils.java | 3c4101849477c068da6d52e4afe1726a27000624 | [] | no_license | gao715108023/IMTestTool | 1a7b5f77ccc316f114bdcaf97dcab5dc3d600ec2 | 41d9610940afef9e2a3e007709fa5d647af7eeea | refs/heads/master | 2016-08-05T12:25:18.107131 | 2014-06-27T03:21:12 | 2014-06-27T03:21:12 | 21,262,647 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,176 | java | package com.gcj.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class DBUtils {
private Connection conn;
private PreparedStatement pst;
String databaseName = "test";
String host = "10.15.144.76";
String port = "3306";
String username = "test";
String password = "111111";
public DBUtils() {
super();
}
public DBUtils(String databaseName, String host, String port, String username, String password) {
super();
this.databaseName = databaseName;
this.host = host;
this.port = port;
this.username = username;
this.password = password;
}
public void getConn() {
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://" + host + ":" + port + "/" + databaseName;
try {
Class.forName(driverName);
conn = DriverManager.getConnection(url, username, password);
conn.setAutoCommit(false);
System.out.println("连接成功!");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void addBatch(String obj) {
try {
pst.setString(1, obj);
pst.addBatch();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void commitBatch() {
try {
pst.executeBatch();
conn.commit();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void close() {
try {
if (pst != null)
pst.close();
if (conn != null)
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
DBUtils dbUtils = new DBUtils();
try {
dbUtils.getConn();
} finally {
dbUtils.close();
}
}
}
| [
"alfred0918@163.com"
] | alfred0918@163.com |
07ca4d9f04b00257fb4d382437a54e2695a62816 | 63cbe7ac41934555f12688de13f115adfea67051 | /netty_server/src/main/java/com/todorex/service/impl/UserServiceImpl.java | f0d33fd6763b3ed8f3cfa0f3e67b9660c76ddf52 | [] | no_license | todorex/Springboot_Netty | 137c88f0cd35c6bb53edd0eb2d41ef56f12b7023 | 17650f5080ec62fe068b420f557397b49cb059ef | refs/heads/master | 2020-03-24T00:19:54.933590 | 2018-07-25T13:17:12 | 2018-07-25T13:17:12 | 142,286,009 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.todorex.service.impl;
import com.todorex.dao.UserMapper;
import com.todorex.entity.User;
import com.todorex.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author rex
* 2018/7/25
*/
@Service
public class UserServiceImpl implements UserService{
@Autowired
private UserMapper userMapper;
@Override
public int saveUser(String[] userInfo) {
User user = new User();
user.setName(userInfo[0]);
user.setAge(Integer.valueOf(userInfo[1]));
userMapper.insertSelective(user);
return user.getId();
}
}
| [
"rex19951001@gmail.com"
] | rex19951001@gmail.com |
45168000002ca4f9e565403caa5266fee113426e | c056d4cf5facbc11c9963d005ca8f18f50e2d05d | /Android/tool/tools/AndroidUtils-master/androidutils/src/main/java/com/mlr/utils/StringUtils.java | 69c97e9e973d10e86375168a8ad6869821ee7bed | [] | no_license | yuxhe/study-2 | ad4cf8f1d78f5d3f4aa51788bb44d6e03cebe83c | e09d5f92416233005a5b9e5ff44bdf56379bcb40 | refs/heads/master | 2022-12-31T07:40:48.637525 | 2019-12-22T11:43:57 | 2019-12-22T11:43:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | /*
* File Name: StringUtils.java
* History:
* Created by wangyl on 2011-9-5
*/
package com.mlr.utils;
import android.text.TextUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 字符串工具类
*/
public class StringUtils {
public static boolean isEmpty(CharSequence str) {
return isEmpty(str, false);
}
public static boolean isEmpty(CharSequence str, boolean trim) {
if (trim && str != null) {
str = String.valueOf(str).trim();
}
return TextUtils.isEmpty(str) || "null".equals(str);
}
public static String getFormattedDateTime(long timestamp, String formatStr) {
try {
SimpleDateFormat format = new SimpleDateFormat(formatStr);
Date date = new Date(timestamp);
return format.format(date.getTime());
} catch (Exception e) {
LogUtils.e(e);
}
return "";
}
}
| [
"liuzl15@vanke.com"
] | liuzl15@vanke.com |
269b538ad18199d7c0cc9e9f4c1ecedb903c0a52 | fd98a6d448532c6733bb4de8884aca53007e390e | /src/main/java/com/cegielskir/formwork/builder/dao/impl/FormworkProjectDAOImpl.java | c4802d42a1131279fa92f44c2d56638159eed3bc | [] | no_license | cegielskir/formwork-builder | cf1f591903547947ace8a2a2a42689b416490841 | 5b6d4ea7057a5db809bf67de476f331405d722a4 | refs/heads/master | 2020-04-25T21:48:19.366595 | 2019-03-19T19:39:42 | 2019-03-19T19:39:42 | 173,091,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,218 | java | package com.cegielskir.formwork.builder.dao.impl;
import com.cegielskir.formwork.builder.dao.FormworkProjectDAO;
import com.cegielskir.formwork.builder.entity.Formwork;
import com.cegielskir.formwork.builder.entity.FormworkProject;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
@Repository
public class FormworkProjectDAOImpl implements FormworkProjectDAO {
@Autowired
private EntityManager entityManager;
@Override
public void add(FormworkProject formworkProject) {
Session currentSession = entityManager.unwrap(Session.class);
currentSession.saveOrUpdate(formworkProject);
}
@Override
public void delete(int id) {
Session currentSession = entityManager.unwrap(Session.class);
FormworkProject formworkProject = currentSession.load(FormworkProject.class, id);
currentSession.delete(formworkProject);
}
@Override
public FormworkProject getById(int id) {
Session currentSession = entityManager.unwrap(Session.class);
return currentSession.get(FormworkProject.class, id);
}
}
| [
"cegielski.rafaal@gmail.com"
] | cegielski.rafaal@gmail.com |
bb15278ed831dd38880c41b0eaec73cc071303b0 | c7e220e88f4efa0bcaef34f799d162df74638c42 | /src/vips-notification-worker/src/test/java/ca/bc/gov/open/pssg/rsbc/vips/notification/worker/health/HealthCheckTest.java | c640d2b41df01abbc769555f7439764ee0fda42e | [
"Apache-2.0"
] | permissive | kkflood/jag-dps | ebd281c9087671e60989cb21f533eb201840c99c | 9ee507060d2fd5466f3ce0d95fd263bc5f1491f6 | refs/heads/master | 2021-05-21T20:14:46.066512 | 2020-04-21T15:04:11 | 2020-04-21T15:04:11 | 252,785,174 | 0 | 0 | Apache-2.0 | 2020-04-03T16:32:53 | 2020-04-03T16:32:53 | null | UTF-8 | Java | false | false | 1,579 | java | package ca.bc.gov.open.pssg.rsbc.vips.notification.worker.health;
import ca.bc.gov.open.ords.vips.client.api.HealthApi;
import ca.bc.gov.open.ords.vips.client.api.handler.ApiException;
import ca.bc.gov.open.ords.vips.client.api.model.HealthOrdsResponse;
import ca.bc.gov.open.pssg.rsbc.vips.ords.client.health.HealthService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class HealthCheckTest {
private static final int HTTP_STATUS_OK = 200;
@Mock
private HealthApi healthApi;
@Mock
private HealthService healthServiceMock;
private HealthCheck sut;
@BeforeAll
public void setup() throws ApiException {
MockitoAnnotations.initMocks(this);
sut = new HealthCheck(healthServiceMock);
}
@Test
public void withValidResponseShouldReturnValid() {
Health health = sut.health();
Assertions.assertEquals(Status.UP, health.getStatus());
}
@Test
public void withExceptionResponse() throws ApiException {
Mockito.when(healthApi.health()).thenThrow(ApiException.class);
Assertions.assertThrows(ApiException.class, () -> {
HealthOrdsResponse response = healthApi.health();
});
}
}
| [
"Carol11.Carpenter@nttdata.com"
] | Carol11.Carpenter@nttdata.com |
9c2694ec48bdcab9abcd91bb51492dc1b5f26151 | 185f012aba8be724475d7b914ff3f71cb3a9dd49 | /Step25_JDBC_My/src/test/main/MainClass11.java | d578a2a686a6c1d6210cb9c69921b0845fd78e7e | [] | no_license | iohong21/Java | 72539c97ccdcd0fe7003d16b78287322056f3b33 | b2badaae9e3004ba24e28f89f6cc1db80d2895ab | refs/heads/master | 2020-03-19T10:59:31.582517 | 2018-06-27T02:08:35 | 2018-06-27T02:08:35 | 136,411,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package test.main;
import test.dao.MemberDao;
import test.dto.MemberDto;
public class MainClass11 {
public static void main(String[] args) {
/*
* MmeberDao 객체를 이용해서 1번회원의 정보를 얻어와서
* useDto() 메소드를 호출해 보세요
*/
useDto(MemberDao.getInstance().getData(1));
}
public static void useDto(MemberDto dto) {
System.out.println(dto.getNum() + "|" + dto.getName() + "|" + dto.getAddr());
}
} | [
"iohong21@naver.com"
] | iohong21@naver.com |
8808f0f864d5da17c14df7f61abbecb5b92bb41a | 48e9b69b6f460a514e97c4898b11f35d8c8e888f | /src/main/java/com/lerif/springjwt/SpringBootSecurityJwtApplication.java | 7d34d78d1cfa7e469cc46ddaffe2c23daafeb2da | [] | no_license | Rifressources/Api-Rif-SpringBoot-JWT | 68c39a73446a23acf25cae19452e490001f2e8fc | e7be138a04653049b966535bbaa889816b846d69 | refs/heads/master | 2023-04-27T08:35:05.989603 | 2021-05-07T14:12:20 | 2021-05-07T14:12:20 | 365,184,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.lerif.springjwt;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootSecurityJwtApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootSecurityJwtApplication.class, args);
}
}
| [
"rifressources@gmail.com"
] | rifressources@gmail.com |
cd3c0729b3c0472970002b776b866b48693fee52 | e0ee2f55e2c87ad353807b19d1000de2e3a26281 | /app/src/main/java/raphaelschilling/de/puzzlesolver/MainActivity.java | 09ced9d800c0f0305757fa45c66e366cf8e518b8 | [] | no_license | raaphy/puzzleSolverAndroid | 61b94e18a74d8dbe51707a273edf683703433bbe | 7a1fb9e4d78a4df4f1e36507fc7c401f873784fe | refs/heads/master | 2021-05-15T08:10:56.899210 | 2017-10-22T16:44:47 | 2017-10-22T16:44:47 | 107,884,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package raphaelschilling.de.puzzlesolver;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"raphaelschilling@web.de"
] | raphaelschilling@web.de |
709284ddcf9089ff007c93edc34d39e2c6d1025a | 2334c43ce7d3e466023eaf70f4ca7e70137130f0 | /modules/designtime/src/main/java/org/shaolin/bmdp/designtime/page/UIPageUtil.java | 226f0752134dfadaf45f9b4aba0686c70720b08c | [
"Apache-2.0"
] | permissive | xingbo/uimaster | f3651f66f79b75bf035ecff61f10e19868c5aacb | f4f520716e94b24fee4999cb75be78481c8259f0 | refs/heads/master | 2020-12-24T11:37:00.621683 | 2015-07-28T11:49:53 | 2015-07-28T11:49:53 | 41,100,224 | 3 | 0 | null | 2015-08-20T14:26:57 | 2015-08-20T14:26:57 | null | UTF-8 | Java | false | false | 11,917 | java | package org.shaolin.bmdp.designtime.page;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.shaolin.bmdp.datamodel.bediagram.BEListType;
import org.shaolin.bmdp.datamodel.bediagram.BEObjRefType;
import org.shaolin.bmdp.datamodel.bediagram.BEType;
import org.shaolin.bmdp.datamodel.bediagram.BinaryType;
import org.shaolin.bmdp.datamodel.bediagram.BooleanType;
import org.shaolin.bmdp.datamodel.bediagram.CEObjRefType;
import org.shaolin.bmdp.datamodel.bediagram.DateTimeType;
import org.shaolin.bmdp.datamodel.bediagram.DoubleType;
import org.shaolin.bmdp.datamodel.bediagram.FileType;
import org.shaolin.bmdp.datamodel.bediagram.IntType;
import org.shaolin.bmdp.datamodel.bediagram.LongType;
import org.shaolin.bmdp.datamodel.bediagram.StringType;
import org.shaolin.bmdp.datamodel.bediagram.TimeType;
import org.shaolin.bmdp.datamodel.common.ParamScopeType;
import org.shaolin.bmdp.datamodel.common.VariableCategoryType;
import org.shaolin.bmdp.datamodel.page.ComponentConstraintType;
import org.shaolin.bmdp.datamodel.page.TableLayoutConstraintType;
import org.shaolin.bmdp.datamodel.page.TableLayoutType;
import org.shaolin.bmdp.datamodel.page.UICheckBoxGroupType;
import org.shaolin.bmdp.datamodel.page.UICheckBoxType;
import org.shaolin.bmdp.datamodel.page.UIComboBoxType;
import org.shaolin.bmdp.datamodel.page.UIComponentType;
import org.shaolin.bmdp.datamodel.page.UIDateType;
import org.shaolin.bmdp.datamodel.page.UIFileType;
import org.shaolin.bmdp.datamodel.page.UIHiddenType;
import org.shaolin.bmdp.datamodel.page.UILabelType;
import org.shaolin.bmdp.datamodel.page.UIListType;
import org.shaolin.bmdp.datamodel.page.UIPanelType;
import org.shaolin.bmdp.datamodel.page.UIRadioButtonGroupType;
import org.shaolin.bmdp.datamodel.page.UIRadioButtonType;
import org.shaolin.bmdp.datamodel.page.UIReferenceEntityType;
import org.shaolin.bmdp.datamodel.page.UITableType;
import org.shaolin.bmdp.datamodel.page.UITextAreaType;
import org.shaolin.bmdp.datamodel.page.UITextFieldType;
public class UIPageUtil {
public final static Map<String, Class<?>> BEFIELD_TYPES
= new LinkedHashMap<String, Class<?>>();
public final static Map<String, Class<?>> ACTION_TYPES
= new LinkedHashMap<String, Class<?>>();
public static final List<String> BASE_RULES
= new LinkedList<String>();
private final static String[] CATEGORIES = new String[4];
private final static String[] SCOPES = new String[4];
static {
BEFIELD_TYPES.put("UILabelType", UILabelType.class);
BEFIELD_TYPES.put("UITextFieldType", UITextFieldType.class);
BEFIELD_TYPES.put("UITextAreaType", UITextAreaType.class);
BEFIELD_TYPES.put("UIHiddenType", UIHiddenType.class);
BEFIELD_TYPES.put("UICheckBoxType", UICheckBoxType.class);
BEFIELD_TYPES.put("UIRadioButtonType", UIRadioButtonType.class);
BEFIELD_TYPES.put("UIComboBoxType", UIComboBoxType.class);
BEFIELD_TYPES.put("UIListType", UIListType.class);
BEFIELD_TYPES.put("UIRadioButtonGroupType", UIRadioButtonGroupType.class);
BEFIELD_TYPES.put("UICheckBoxGroupType", UICheckBoxGroupType.class);
BEFIELD_TYPES.put("UIFileType", UIFileType.class);
BEFIELD_TYPES.put("UIDateType", UIDateType.class);
BEFIELD_TYPES.put("UIEntityType", UIReferenceEntityType.class);
BEFIELD_TYPES.put("UITableType", UITableType.class);
CATEGORIES[0] = VariableCategoryType.BUSINESS_ENTITY.value();
CATEGORIES[1] = VariableCategoryType.CONSTANT_ENTITY.value();
CATEGORIES[2] = VariableCategoryType.UI_ENTITY.value();
CATEGORIES[3] = VariableCategoryType.JAVA_CLASS.value();
SCOPES[0] = ParamScopeType.IN.value();
SCOPES[1] = ParamScopeType.OUT.value();
SCOPES[2] = ParamScopeType.IN_OUT.value();
SCOPES[3] = ParamScopeType.INTERNAL.value();
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UIFile");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UIMultipleChoiceAndCE");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UIMultipleChoice");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UISelect");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UISingleChoiceAndCE");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UISingleChoice");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UIText");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UITextWithCE");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UITextWithCurrency");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UITextWithDate");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UITextWithFloatNumber");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UITextWithNumber");
BASE_RULES.add("org.shaolin.uimaster.page.od.rules.UITable");
}
public static void createLayout(UIPanelType parent, int rows, int columns) {
TableLayoutType layout = new TableLayoutType();
for (int i=0; i<rows; i++) {
layout.getRowHeightWeights().add(new Double(0.0));// default length
}
for (int j=0; j<columns; j++) {
layout.getColumnWidthWeights().add(new Double(1.0)); // 100% length
}
parent.setLayout(layout);
}
public static void createLayoutWithPanelEachRow(UIPanelType parent, int rows, int columns) {
TableLayoutType layout = new TableLayoutType();
for (int i=0; i<rows; i++) {
layout.getRowHeightWeights().add(new Double(-1.0));
String uiid = parent.getUIID() + "_uiPanel" + i;
UIPanelType newPanel = new UIPanelType();
newPanel.setUIID(uiid);
newPanel.setLayout(new TableLayoutType());
parent.getComponents().add(newPanel);
ComponentConstraintType cc = new ComponentConstraintType();
TableLayoutConstraintType c = new TableLayoutConstraintType();
c.setX(0);
c.setY(i);
c.setAlign("FULL");
cc.setConstraint(c);
cc.setComponentId(uiid);
parent.getLayoutConstraints().add(cc);
((TableLayoutType)newPanel.getLayout())
.getRowHeightWeights().add(new Double(-1.0));
for (int j=0; j<columns; j++) {
((TableLayoutType)newPanel.getLayout())
.getColumnWidthWeights().add(new Double(-1.0));
}
}
parent.setLayout(layout);
}
public static List<String> fetchPanelElementsUIID(UIPanelType parent) {
List<UIComponentType> list = fetchPanelElements(parent);
List<String> uiids = new ArrayList<String>(list.size());
for (UIComponentType comp: list) {
uiids.add(comp.getUIID());
}
return uiids;
}
public static List<UIComponentType> fetchPanelElements(UIPanelType parent) {
List<UIComponentType> list = new ArrayList<UIComponentType>();
fetchPanelElements0(parent, list);
return list;
}
private static void fetchPanelElements0(UIPanelType parent, List<UIComponentType> list) {
List<UIComponentType> subcomps = parent.getComponents();
for (UIComponentType comp: subcomps) {
if (comp instanceof UIPanelType) {
fetchPanelElements0((UIPanelType)comp, list);
} else {
list.add(comp);
}
}
}
public static String getDefaultJspName(String entityName) {
return entityName;
}
public static List<String> getAllRuleNames() {
List<String> ruels = new ArrayList<String>();
return ruels;
}
public static List<String> getRuleParameters() {
return Collections.emptyList();
}
public static String[] getODBaseRules() {
String[] rules = new String[BASE_RULES.size()];
BASE_RULES.toArray(rules);
return rules;
}
public static String getTypeByIndex(int i) {
if (i == -1) {
return "";
}
Set<String> typeNames = getBEFieldMappingTypes();
String[] types = new String[typeNames.size()];
typeNames.toArray(types);
return types[i];
}
public static Set<String> getBEFieldMappingTypes() {
return BEFIELD_TYPES.keySet();
}
public static Class<?> getMappingClass(String type) {
return BEFIELD_TYPES.get(type);
}
public static String getDefaultODRuleType(BEType type) {
if (type instanceof BinaryType) {
return "org.shaolin.uimaster.page.od.rules.UIText";
}
if (type instanceof IntType) {
return "org.shaolin.uimaster.page.od.rules.UITextWithNumber";
}
if (type instanceof LongType) {
return "org.shaolin.uimaster.page.od.rules.UITextWithNumber";
}
if (type instanceof StringType) {
return "org.shaolin.uimaster.page.od.rules.UIText";
}
if (type instanceof BooleanType) {
return "org.shaolin.uimaster.page.od.rules.UISelect";
}
if (type instanceof DoubleType) {
return "org.shaolin.uimaster.page.od.rules.UITextWithFloatNumber";
}
if (type instanceof FileType) {
return "org.shaolin.uimaster.page.od.rules.UIFile";
}
if (type instanceof TimeType) {
return "org.shaolin.uimaster.page.od.rules.UITextWithDate";
}
if (type instanceof DateTimeType) {
return "org.shaolin.uimaster.page.od.rules.UITextWithDate";
}
if (type instanceof BEObjRefType) {
String beName = ((BEObjRefType)type).getTargetEntity().getEntityName();
return beName.replace("be", "form");
}
if (type instanceof CEObjRefType) {
return "org.shaolin.uimaster.page.od.rules.UISingleChoiceAndCE";
}
if (type instanceof BEListType) {
/**
* table is no needed a rule defintion.
if (((BEListType)type).getElementType() instanceof BEObjRefType) {
return "org.shaolin.uimaster.page.od.rules.UITable";
}
*/
if (((BEListType)type).getElementType() instanceof CEObjRefType) {
return "org.shaolin.uimaster.page.od.rules.UIMultipleChoiceAndCE";
}
return "org.shaolin.uimaster.page.od.rules.UIMultipleChoice";
}
return "org.shaolin.uimaster.page.od.rules.UIText";
}
public static String getDefaultUIType(BEType type) {
if (type instanceof BinaryType) {
return "UILabelType";
}
if (type instanceof IntType) {
return "UITextFieldType";
}
if (type instanceof LongType) {
return "UITextFieldType";
}
if (type instanceof StringType) {
return "UITextFieldType";
}
if (type instanceof BooleanType) {
return "UICheckBoxType";
}
if (type instanceof DoubleType) {
return "UITextFieldType";
}
if (type instanceof FileType) {
return "UIFileType";
}
if (type instanceof TimeType || type instanceof DateTimeType) {
return "UIDateType";
}
if (type instanceof BEObjRefType) {
return "UIEntityType";
}
if (type instanceof CEObjRefType) {
return "UIComboBoxType";
}
if (type instanceof BEListType) {
if (((BEListType)type).getElementType() instanceof BEObjRefType) {
return "UITableType";
}
if (((BEListType)type).getElementType() instanceof CEObjRefType) {
return "UIComboBoxType";
}
return "UIComboBoxType";
}
return "UILabelType";
}
public static UIComponentType createUIComponent(String uitype) {
if ("UILabelType".equals(uitype)) {
return new UILabelType();
}
if ("UIHiddenType".equals(uitype)) {
return new UIHiddenType();
}
if ("UITextAreaType".equals(uitype)) {
return new UITextAreaType();
}
if ("UITextFieldType".equals(uitype)) {
return new UITextFieldType();
}
if ("UIFileType".equals(uitype)) {
return new UIFileType();
}
if ("UIComboBoxType".equals(uitype)) {
return new UIComboBoxType();
}
if ("UICheckBoxType".equals(uitype)) {
return new UICheckBoxType();
}
if ("UIDateType".equals(uitype)) {
return new UIDateType();
}
if ("UITableType".equals(uitype)) {
return new UITableType();
}
if ("UIEntityType".equals(uitype)) {
return new UIReferenceEntityType();
}
return new UILabelType();
}
public static String[] getVarCategories() {
return CATEGORIES;
}
public static String[] getVarScopes() {
return SCOPES;
}
public static String upperCaseFristWord(String name)
{
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
public static String lowerCaseFristWord(String name)
{
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
}
}
| [
"shao.lin@live.com"
] | shao.lin@live.com |
5228af6adf54b153025f168da47e4b49c5878a69 | 7381ccf67b5ac1eb5bf2d9923a965893b42c7ea8 | /src/com/yq/service/impl/UserServiceImpl.java | a1b496a07ae92867a26b218c4b6d950b1fe9f45d | [
"MIT"
] | permissive | toneyyq/shop | 01648c292103c9fd9498c953e3eccecccb2896f4 | 39b78c9446bbf9f3f2e5bc2774d72011de0a3bbc | refs/heads/master | 2023-08-22T18:23:47.939605 | 2023-08-03T09:06:01 | 2023-08-03T09:06:01 | 316,553,488 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 1,155 | java | package com.yq.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yq.dao.UserDao;
import com.yq.po.User;
import com.yq.service.UserService;
/**
*
* Ë├╗žservice▓Ń╩Á¤Í
*
*/
@Service(value = "userService")
public class UserServiceImpl implements UserService {
private UserDao userDao;
@Autowired
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
@Override
public User login(String userName, String password) {
// TODO Auto-generated method stub
try {
return userDao.login(userName, password);
} catch (Exception e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
@Override
public int register(User user) {
// TODO Auto-generated method stub
try {
return 1;
} catch (Exception e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
@Override
public int update(User user) {
// TODO Auto-generated method stub
try {
return 1;
} catch (Exception e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
}
| [
"59810234+toneyyq@users.noreply.github.com"
] | 59810234+toneyyq@users.noreply.github.com |
4cf87c8df9a6826fd9314a4b6225272e503d43b3 | 41c9500b1e4ec1ecef9e23dd258981291e9b9752 | /xibavideoplayer/src/main/java/com/axiba/xibavideoplayer/utils/XibaUtil.java | 708f3feaa3253b487a08db216d42d41a6ee2b15e | [
"Apache-2.0"
] | permissive | shitou9999/XibaVideoPlayer | 7e9748844ca89280a6fbc810b51e83546a317e82 | c3757ae6339cf09b4532476a9f95433e647a1232 | refs/heads/master | 2020-06-19T04:46:02.837809 | 2016-11-27T14:14:42 | 2016-11-27T14:14:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,628 | java | package com.axiba.xibavideoplayer.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import com.axiba.xibavideoplayer.BuildConfig;
import java.util.Formatter;
import java.util.Locale;
/**
* Created by xiba on 2016/11/26.
*/
public class XibaUtil {
/**
* 将毫秒数转化为字符串格式的时长
* @param timeMs
* @return
*/
public static String stringForTime(long timeMs){
if (timeMs <= 0 || timeMs >= 24 * 60 * 60 * 1000) {
return "00:00";
}
long totalSeconds = timeMs / 1000;
long seconds = totalSeconds % 60;
long minutes = (totalSeconds / 60) % 60;
long hours = totalSeconds / 3600;
StringBuilder stringBuilder = new StringBuilder();
Formatter mFormatter = new Formatter(stringBuilder, Locale.getDefault());
if (hours > 0) {
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
} else {
return mFormatter.format("%02d:%02d", minutes, seconds).toString();
}
}
/**
* wifi是否连接
* @param context
* @return true 已连接; false wifi未连接
*/
public static boolean isWifiConnected(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.getType() == connectivityManager.TYPE_WIFI;
}
}
| [
"tough1985@gmail.com"
] | tough1985@gmail.com |
9f18a76899777eac9e627edcc946f3bf38a3ce3b | 420a586ed2466fd3ccc20dca127133f7c5888391 | /src/main/java/com/platform/example/model/mapper/BankAccountMapper.java | 692992319c32f4644d0f439e00c6125dbe0761d3 | [] | no_license | zburlea9/RentGym_backend | c5a91080c257444e3c03140def158196d67a7bb4 | a232959056b41a3ab9d225fc359e0e55d1c802ac | refs/heads/main | 2023-02-24T03:03:35.547972 | 2021-01-29T13:59:39 | 2021-01-29T13:59:39 | 334,160,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package com.platform.example.model.mapper;
import com.platform.example.model.DTO.BankAccountDTO;
import com.platform.example.model.DTO.UserDTO;
import com.platform.example.model.entity.BankAccount;
import com.platform.example.model.entity.User;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.springframework.beans.factory.annotation.Autowired;
import javax.persistence.EntityManager;
@Mapper
public abstract class BankAccountMapper {
@Autowired
EntityManager entityManager;
public abstract BankAccountDTO toDTO(BankAccount bankAccount);
public abstract BankAccount toEntity(BankAccountDTO bankAccountDTO);
public abstract void toEntityUpdate(@MappingTarget BankAccount bankAccount, BankAccountDTO bankAccountDTO);
}
| [
"zburlea.ionut@gmail.com"
] | zburlea.ionut@gmail.com |
7d9dc4141f3708bc2bd21f44243baf7ffeb5dff1 | 26abbd3b0ad7559123e8709db5e4004ed3d67ec3 | /src/main/java/com/imooc/concurrency/example/syncContainer/VectorTest2.java | b07dae44cbc72b56a9367206c0f81c9d06c9a778 | [] | no_license | whjpyy/concurrency | e21608ce702beb3f89344f3d5a4dea54dc8be6e3 | 5a3b99c4b7b6771158dc44f8ca607cd2baee998f | refs/heads/master | 2020-04-11T17:54:26.323348 | 2018-12-31T14:27:28 | 2018-12-31T14:27:28 | 161,978,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,272 | java | package com.imooc.concurrency.example.syncContainer;
import com.imooc.concurrency.annotations.NotThreadSafe;
import com.imooc.concurrency.annotations.ThreadSafe;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
@Slf4j
@NotThreadSafe
public class VectorTest2 {
private static List<Integer> list = new Vector<>();
public static void main(String[] args) {
while(true) {
for (int i = 0; i < 10; i++) {
list.add(i);
}
Thread thread1 = new Thread() {
@Override
public void run() {
for (int i = 0; i < list.size(); i++) {
list.remove(i);
}
}
};
Thread thread2 = new Thread() {
@Override
public void run() {
for (int i = 0; i < list.size(); i++) {
list.get(i);
}
}
};
thread1.start();
thread2.start();
}
}
}
| [
"409121961@qq.com"
] | 409121961@qq.com |
be1dd11ea39995c9d4709b86bb52c69d8215b5aa | 1ec31a5a533e403560283a1dff275e94a482fa96 | /src/com/sx/sql/DbMananger.java | 4c04408a08b258a6fcb3eb5553b2cdfadf3ae324 | [] | no_license | JacoblLee/BrainSharp | 89fc839f8854dfcfe9ae4585852f17325e3ce43f | 30b143fc8d7daf7d279c61f64a4abd7d9b1b50ec | refs/heads/master | 2021-06-10T20:54:45.118970 | 2016-10-29T03:27:08 | 2016-10-29T03:27:08 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,650 | java | package com.sx.sql;
import java.util.ArrayList;
import java.util.List;
import com.sx.model.Canginfo;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DbMananger extends SQLiteOpenHelper {
private final static String DATABASE_NAME = "Njjzw.db";
private final static int DATABASE_VERSION = 1;
// public final static String STATE = "state";
// private final static String TABLE_POINTLOG = "table_pointLog";
// public final static String AWARD_DATE= "award_date";
private final static String CANG_TABLE = "tb_cang";
private final static String APPTYPE = "apptype";
private final static String APPCONTENT = "appcontent";
private final static String APPINDEX = "appindex";
// private final static String QAINDEX = "qaIndex";
public DbMananger(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
// String sql1 =
// "CREATE TABLE "+CANG_TABLE+" ("+APPTYPE+" INTEGER, "+APPCONTENT+" INTEGER, "+QAINDEX+" INTEGER);";
// String sql2 =
// "CREATE TABLE "+TABLE_POINTLOG+" ( "+AWARD_DATE+" varchar(20));";
db.execSQL("CREATE TABLE IF NOT EXISTS "+CANG_TABLE+" (_id INTEGER PRIMARY KEY AUTOINCREMENT, apptype VARCHAR, appcontent VARCHAR,appindex INTEGER)");
// db.execSQL(sql1);
// db.execSQL(sql2);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// String sql1 = "DROP TABLE IF EXISTS " + TABLE_POINTLOG;
String sql2 = "DROP TABLE IF EXISTS " + CANG_TABLE;
db.execSQL(sql2);
// db.execSQL(sql2);
onCreate(db);
}
// public long insertPointLog(String date){
// SQLiteDatabase db = this.getWritableDatabase();
// /* ContentValues */
// ContentValues cv = new ContentValues();
// cv.put(AWARD_DATE, date);
// long row = db.insert(TABLE_POINTLOG, null, cv);
// return row;
// }
// public boolean queryLog(String date){
// boolean exsits = false;
// SQLiteDatabase db = this.getReadableDatabase();
// Cursor cursor =
// db.rawQuery("select * from "+TABLE_POINTLOG+" where "+AWARD_DATE+"= ?",
// new String[]{""+date+""});
// while(cursor.moveToNext()){
// exsits = true;
// break;
// }
// cursor.close();
// return exsits;
// }
// public Cursor getUserState(int level){
// SQLiteDatabase db = this.getReadableDatabase();
// Cursor cursor =
// db.rawQuery("select "+LEVEL+","+POINT+","+QAINDEX+" from "+USER_STATE+" where "+LEVEL+"=?",new
// String[]{String.valueOf(level)});
// return cursor;
// }
public void insertState(Canginfo cang) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put(APPTYPE, cang.getApptype());
cv.put(APPCONTENT, cang.getAppcontent());
cv.put(APPINDEX, cang.getAppindex());
db.insert(CANG_TABLE, null, cv);
}
public void Delete() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("DELETE FROM students WHERE name='张三'");
// Log.d("msg","张三的信息已经被删除");
// Toast.makeText(this, "张三的信息已经被删除", Toast.LENGTH_SHORT).show();
}
public List<Canginfo> getScrollData() {
List<Canginfo> persons = new ArrayList<Canginfo>();
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(
"select * from tb_cang",null);
while (cursor.moveToNext()) {
Canginfo cang=new Canginfo();
cang.setId(cursor.getInt(0));
cang.setApptype(cursor.getString(1));
cang.setAppcontent(cursor.getString(2));
cang.setAppindex(cursor.getString(3));
persons.add(cang);
}
return persons;
}
public long getCount(String apptype,String appindex) {
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery("select count(*) from tb_cang where apptype=? and appindex=?", new String[] { String.valueOf(apptype),
String.valueOf(appindex)});
if (cursor.moveToNext()) {
return cursor.getLong(0);
}
return 0;
}
// public void updateState(QA qa){
// SQLiteDatabase db = this.getWritableDatabase();
// String sql =
// "update "+USER_STATE+" set "+POINT+"="+qa.getPoint()+" , "+QAINDEX+"="+qa.getIndex()+" where "+LEVEL+"="+qa.getLevel();
// db.execSQL(sql);
// }
// public void resetState(){
// SQLiteDatabase db = this.getWritableDatabase();
// String sql = "delete from "+USER_STATE;
// db.execSQL(sql);
// }
// public Cursor select() {
// SQLiteDatabase db = this.getReadableDatabase();
// Cursor cursor = db
// .query(USER_STATE, null, null, null, null, null,null);
// return cursor;
// }
}
| [
"903963491@qq.com"
] | 903963491@qq.com |
1af06a39d3a11fe2490cfafe1b8dfd6d7e1c2c7e | c434ac9454e3164740b1ff8ef3eceff58f62b14a | /Scrum/src/Story.java | 96b1cdb797b4ea27ad25f131ef889b4f2c9eaa38 | [] | no_license | joslina/JoslinaScrum | 630a8ddfa93f5aedd2c3d25cef36f0063991f27a | a75c2c34098d721b96466de8246d06402085d45f | refs/heads/master | 2016-09-06T16:13:37.005911 | 2013-11-13T07:07:58 | 2013-11-13T07:07:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 819 | java | import java.util.*;
public class Story
{
static String as_a;
static String i_Want_to;
static String so_that;
static int priority, point;
List<Task> Tasks = new ArrayList<Task>();
public Story(String as_a, String i_Want_to, String so_that, int priority, int point)
{
Story.as_a=as_a;
Story.i_Want_to=i_Want_to;
Story.so_that=so_that;
Story.priority=priority;
Story.point=point;
//print_Story();
}
@SuppressWarnings("unused")
private void print_Story()
{
System.out.println(as_a + ", " + i_Want_to + ", " +so_that);
System.out.println("Story priority "+priority);
System.out.println("Story priority "+point);
}
public void setTask(String string, int i)
{
Task newTask= new Task();
newTask.name=string;
newTask.duration=i;
Tasks.add(newTask);
}
} | [
"joslina21@gmail.com"
] | joslina21@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.