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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12656f1b38dc683f23c950194a2ec7921b9eae4e | 3cc0b905754e2374d6339ba55166fa16e44aea68 | /src/main/java/com/navi/springapiloja/services/BoletoService.java | d50b8f9674b6ce8d7db81ce61294e6e5cf1cc3ca | [] | no_license | IvanSJr/SpringApiLoja | de6500af450d0b3696c69be5c2430171941b9f42 | f2b644fe8d609fe5763afebf99fb58c830a4600f | refs/heads/master | 2023-07-05T00:50:06.690080 | 2021-08-20T00:50:05 | 2021-08-20T00:50:05 | 380,385,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package com.navi.springapiloja.services;
import java.util.Calendar;
import java.util.Date;
import org.springframework.stereotype.Service;
import com.navi.springapiloja.domain.PagamentoComBoleto;
@Service
public class BoletoService {
public void populatePaymentSlips(PagamentoComBoleto pagto, Date instanteDoPedido) {
Calendar cal = Calendar.getInstance();
cal.setTime(instanteDoPedido);
cal.add(Calendar.DAY_OF_MONTH, 7);
pagto.setDataVencimento(cal.getTime());
}
}
| [
"ivan.junior2706@gmail.com"
] | ivan.junior2706@gmail.com |
a3e3130db138d95c9fa4d52858bd0775fa76c18b | 22090db4786144630c43e07152bfbda6cce31171 | /ABC1.java | 18a8213bcd9ca688575bbd561097ddda283ee01d | [] | no_license | yxysophia/code | e5c492eaf153d4dc6a5f11a658e5b5c27a040649 | e4d985cd2bd277d81a026574532968b3c3acf2c8 | refs/heads/master | 2020-03-16T21:46:33.987229 | 2019-02-21T13:24:24 | 2019-02-21T13:24:24 | 133,014,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,697 | java | package CODE.多线程;
//编些一个程序,启动三个线程,三个线程的名字分别是A,B,C,每个线程将自己的名字在屏幕上打印5遍,
// 打印顺序分别是ABCABC
class Print3
{
private int flag=1;
synchronized public void printA()
{
while(flag!=1)
{
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println(Thread.currentThread().getName());
flag=2;
notifyAll();
}
synchronized public void printB()
{
while(flag!=2)
{
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println(Thread.currentThread().getName());
flag=3;
notifyAll();
}
synchronized public void printC()
{
while(flag!=3)
{
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println(Thread.currentThread().getName());
flag=1;
notifyAll();
}
}
public class ABC1
{
public static void main(String[] args) {
Print3 print3=new Print3();
new Thread(()->
{
for(int i=0;i<5;i++)
print3.printA();
}).start();
new Thread(()->
{
for(int i=0;i<5;i++)
print3.printB();
}).start();
new Thread(()->
{
for(int i=0;i<5;i++)
print3.printC();
}).start();
}
}
| [
"2049161978@qq.com"
] | 2049161978@qq.com |
78ab30496b14fe83ff79dddc3c3f86fe14c60daf | 44aa9893ce81a3e7aac48cab867f31dafffc5afd | /code/dsavenk/cqa_dialog/src/main/java/edu/emory/mathcs/ir/cqa_dialog/utils/ExtractClarificationTypesApp.java | d285df908e8b68461aa447c2ba8bdb79f80efb93 | [] | no_license | DenXX/irlab | 2182f524bbb7089b4df419c132aad57633498082 | b2446ecefd170c8cb916ff6509da0d014a167ea7 | refs/heads/master | 2021-01-24T14:46:57.066134 | 2017-04-28T20:24:20 | 2017-04-28T20:24:20 | 15,643,401 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,376 | java | package edu.emory.mathcs.ir.cqa_dialog.utils;
import edu.stanford.nlp.ling.HasIndex;
import edu.stanford.nlp.ling.HasLemma;
import edu.stanford.nlp.simple.Document;
import edu.stanford.nlp.simple.Sentence;
import edu.stanford.nlp.simple.SentenceAlgorithms;
import edu.stanford.nlp.trees.SemanticHeadFinder;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.TreeLemmatizer;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* Created by dsavenk on 1/25/16.
*/
public class ExtractClarificationTypesApp {
private final static Set<String> STOPWORDS = new HashSet<>(Arrays.asList(
new String[]{"i", "there", "it", "you", "they", "we", "my", "your",
"their", "a", "the", "an", "'s", "'m", "our", "there",
"something", "someone", "our", "this", "that", "me", "he",
"she", "anything", "these", "some", "itself", "everything"}));
private static final SemanticHeadFinder headFinder = new SemanticHeadFinder();
private static final TreeLemmatizer treeLemmatizer = new TreeLemmatizer();
private static String cleanUp(String line) {
return line.replaceAll("<[^>]*>", " ");
}
private static void printNp(String np, String head) {
np = np.trim();
if (!np.isEmpty()) {
System.out.println(np.replaceAll("^(a[n]?|the)\\s", "") + "\t" + head);
}
}
private static void extractNp(String line) {
Document doc = new Document(line);
for (Sentence sent : doc.sentences()) {
Properties props = new Properties();
props.setProperty("parse.model", "edu/stanford/nlp/models/srparser/englishSR.ser.gz");
Tree parseTree = sent.parse(props);
parseTree.indexLeaves();
for (Tree subtree : parseTree) {
if (subtree.isPhrasal() &&
subtree.label().value().equals("NP")) {
subtree = treeLemmatizer.transformTree(subtree);
// Get np phrase.
String np = subtree.getLeaves()
.stream()
.map(leaf -> ((HasLemma)leaf.label()).lemma().toLowerCase())
.filter(term -> !STOPWORDS.contains(term))
.collect(Collectors.joining(" "));
if (!np.isEmpty()) {
Tree head = subtree.headTerminal(headFinder);
List<String> path = sent.algorithms().dependencyPathBetween(0,
((HasIndex) head.label()).index() - 1, Sentence::lemmas);
List<String> filteredPath = new ArrayList<>();
for (int i = 0; i < path.size(); i += 2) {
filteredPath.add(path.get(i));
}
if (filteredPath.size() > 0) {
filteredPath.remove(filteredPath.size() - 1);
}
List<String> keyphrases = sent.algorithms().keyphrases();
String headStr =
((HasLemma) subtree.headTerminal(headFinder).label()).lemma().toLowerCase();
String parent = filteredPath.size() > 0 ? filteredPath.get(filteredPath.size() - 1) : "";
System.out.println(np + "\t" + headStr + "\t" + String.join(" ", filteredPath) + "\t" + parent + "\t" + String.join(",", keyphrases));
}
}
}
}
}
public static void main(String... args) {
File qaTextFile = new File(args[0]);
try (BufferedReader reader =
new BufferedReader(new FileReader(qaTextFile))) {
String line;
int index = 0;
while ((line = reader.readLine()) != null) {
if (!line.isEmpty()) {
extractNp(cleanUp(line));
}
if (index % 100 == 0) {
System.err.println(index + " lines processed.");
}
++index;
}
} catch (IOException e) {
e.printStackTrace();
} ;
}
}
| [
"denissavenkov@gmail.com"
] | denissavenkov@gmail.com |
f5f41eb2cbf3fa8cc756a9adf12d285b0af8f507 | 169a2289329001982f5ce07b148c69deb6c266e1 | /modules/phono-java-audio/src/java/com/phono/audio/codec/g722/NativeG722Codec.java | e79564c443804bffa297ee18faf363e72c738f08 | [
"Apache-2.0",
"MIT"
] | permissive | so1us2/PhonoSDK | 4b57033e77ee41f32a9c9e3531493370e3463f12 | 400849a2149465dc43336e06ba6a01251971aa85 | refs/heads/master | 2021-05-30T14:09:55.329859 | 2015-01-16T22:13:24 | 2015-01-16T22:13:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | /*
* Copyright 2011 Voxeo Corp.
*
* 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.phono.audio.codec.g722;
import com.phono.audio.codec.CodecFace;
import com.phono.audio.codec.DecoderFace;
import com.phono.audio.codec.EncoderFace;
/**
*
* @author tim
*/
public class NativeG722Codec implements CodecFace, EncoderFace, DecoderFace {
int _sampleRate;
short[] _adataOut;
byte[] _wireOut;
byte[] _codec;
byte[] _outW;
private native byte[] initCodec();
private native void g722Encode(byte[] codec, short[] a, byte[] w);
private native void g722Decode(byte[] codec, byte[] w, short[] a);
public native void freeCodec(byte[] codec);
static {
System.loadLibrary("g722");
}
public NativeG722Codec() {
_adataOut = new short[320];
_wireOut = new byte[160]; // that _has to be big enough
_codec = initCodec();
}
public int getFrameSize() {
return 160;
}
public int getFrameInterval() {
return 20;
}
public long getCodec() {
return G722Codec.AUDIO_G722;
}
public DecoderFace getDecoder() {
return this;
}
public EncoderFace getEncoder() {
return this;
}
public float getSampleRate() {
return 16000.0F;
}
public String getName() {
return "G.722";
}
public byte[] encode_frame(short[] audio) {
g722Encode(_codec, audio, _wireOut);
return _wireOut;
}
public short[] decode_frame(byte[] bytes) {
g722Decode(_codec, bytes, _adataOut);
return _adataOut;
}
public byte[] lost_frame(byte[] current_frame, byte[] next_frame) {
return current_frame;
}
}
| [
"tim@phonefromhere.com"
] | tim@phonefromhere.com |
8214337a9df2d50f19134a225a7ab9cc65f83af7 | 547ce67e4fb170d5dd7fac896bdc92532dea2a38 | /src/java/com/ctc/wstx/io/BranchingReaderSource.java | 1278786cb9c56347ead8ec8f8847918459f66a1e | [] | no_license | xranby/Woodstox4 | c3c510d84334f1aacacb26858ac95bbc9b7add19 | ad17cef017f8a3032bfde37ad0f2c812598efd02 | refs/heads/master | 2021-01-17T09:03:06.799677 | 2015-03-14T23:48:59 | 2015-03-14T23:48:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,747 | java | package com.ctc.wstx.io;
import java.io.IOException;
import java.io.Reader;
import javax.xml.stream.XMLStreamException;
import com.ctc.wstx.api.ReaderConfig;
import com.ctc.wstx.util.TextBuffer;
/**
* Specialized input source that can "branch" input it reads; essentially
* both giving out read data AND also writing it out to a Writer.
*<p>
* Currently this Reader is only used as the main-level Reader, to allow for
* branching of internal DTD subset to a text buffer if necessary.
*/
public final class BranchingReaderSource
extends ReaderSource
{
// // // Branching information
TextBuffer mBranchBuffer = null;
int mBranchStartOffset = 0;
boolean mConvertLFs = false;
/**
* Flag that indicates that last char from previous buffer was
* '\r', and that following '\n' (if there is one) needs to be
* ignored.
*/
boolean mGotCR = false;
public BranchingReaderSource(ReaderConfig cfg, String pubId, SystemId sysId,
Reader r, boolean realClose)
{
/* null -> no parent,
* null -> not from explicit entity (no id/name)
*/
super(cfg, null, null, pubId, sysId, r, realClose);
}
public int readInto(WstxInputData reader)
throws IOException, XMLStreamException
{
// Need to flush out branched content?
if (mBranchBuffer != null) {
if (mInputLast > mBranchStartOffset) {
appendBranched(mBranchStartOffset, mInputLast);
}
mBranchStartOffset = 0;
}
return super.readInto(reader);
}
public boolean readMore(WstxInputData reader, int minAmount)
throws IOException, XMLStreamException
{
// Existing data to output to branch?
if (mBranchBuffer != null) {
int ptr = reader.mInputPtr;
int currAmount = mInputLast - ptr;
if (currAmount > 0) {
if (ptr > mBranchStartOffset) {
appendBranched(mBranchStartOffset, ptr);
}
mBranchStartOffset = 0;
}
}
return super.readMore(reader, minAmount);
}
/*
//////////////////////////////////////////////////
// Branching methods; used mostly to make a copy
// of parsed internal subsets.
//////////////////////////////////////////////////
*/
public void startBranch(TextBuffer tb, int startOffset,
boolean convertLFs)
{
mBranchBuffer = tb;
mBranchStartOffset = startOffset;
mConvertLFs = convertLFs;
mGotCR = false;
}
/**
* Currently this input source does not implement branching
*/
public void endBranch(int endOffset)
{
if (mBranchBuffer != null) {
if (endOffset > mBranchStartOffset) {
appendBranched(mBranchStartOffset, endOffset);
}
// Let's also make sure no branching is done from this point on:
mBranchBuffer = null;
}
}
/*
//////////////////////////////////////////////////
// Internal methods
//////////////////////////////////////////////////
*/
private void appendBranched(int startOffset, int pastEnd) {
// Main tricky thing here is just replacing of linefeeds...
if (mConvertLFs) {
char[] inBuf = mBuffer;
/* this will also unshare() and ensure there's room for at
* least one more char
*/
char[] outBuf = mBranchBuffer.getCurrentSegment();
int outPtr = mBranchBuffer.getCurrentSegmentSize();
// Pending \n to skip?
if (mGotCR) {
if (inBuf[startOffset] == '\n') {
++startOffset;
}
}
while (startOffset < pastEnd) {
char c = inBuf[startOffset++];
if (c == '\r') {
if (startOffset < pastEnd) {
if (inBuf[startOffset] == '\n') {
++startOffset;
}
} else {
mGotCR = true;
}
c = '\n';
}
// Ok, let's add char to output:
outBuf[outPtr++] = c;
// Need more room?
if (outPtr >= outBuf.length) {
outBuf = mBranchBuffer.finishCurrentSegment();
outPtr = 0;
}
}
mBranchBuffer.setCurrentLength(outPtr);
} else {
mBranchBuffer.append(mBuffer, startOffset, pastEnd-startOffset);
}
}
}
| [
"tatu.saloranta@iki.fi"
] | tatu.saloranta@iki.fi |
0b8cacd4d227bf2ca004d540af2700c75c869eaf | 756057021a220534209e9ed006f55b2bfb1a6e3f | /app/src/main/java/com/example/mankind/Instruction2Activity.java | 99800d63c1995858af0a2eeec62c4bdbc34d89cf | [] | no_license | yluo0017/IE-ManKind | 8f9e8b30e36266b7be5748392729644d69f27b38 | 314bfeb9198fa6dd55733edc4a01552917b0aa0f | refs/heads/master | 2020-07-08T20:02:43.544356 | 2019-10-21T11:38:53 | 2019-10-21T11:38:53 | 203,761,704 | 0 | 0 | null | 2019-10-12T06:57:20 | 2019-08-22T09:32:30 | Java | UTF-8 | Java | false | false | 1,186 | java | package com.example.mankind;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
/**
* The type Instruction 2 activity.
*/
public class Instruction2Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_instruction2);
initActionBar();
// findViewById(R.id.next).getBackground().setAlpha(180);
findViewById(R.id.next).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Instruction2Activity.this, Question2_1Activity.class));
}
});
}
//Init action bar with app name
private void initActionBar() {
ActionBar actionBar = getActionBar();
actionBar.setLogo(null);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setCustomView(R.layout.action_bar);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
}
} | [
"43309025+yluo0017@users.noreply.github.com"
] | 43309025+yluo0017@users.noreply.github.com |
9467e0326e094f5688f2c2ce7b9aa84c11e4da89 | f10df54242b61508d20fbbdb41b5a2f3088b611c | /WEB-INF/classes/com/pitayastudio/godzilla/modelboard/QiBoard.java | f60d0c1f644e9b9bb5ca3df134c2799fdeca86df | [] | no_license | pitayastudio/godzilla | 54ccc88cbc30f0e7c8779f3f7db4ad8b44fc0477 | 8dab3312ccdf1f614efc0a6fcf6b95bdf845306f | refs/heads/master | 2021-01-10T06:18:19.267597 | 2016-03-17T08:41:40 | 2016-03-17T08:41:40 | 54,018,606 | 0 | 0 | null | 2016-03-16T11:04:47 | 2016-03-16T09:32:34 | null | UTF-8 | Java | false | false | 4,386 | java | package com.pitayastudio.godzilla.modelboard;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.pitayastudio.godzilla.common.Color;
import com.pitayastudio.godzilla.common.Utils;
import com.pitayastudio.godzilla.model.ColorBlock;
import com.pitayastudio.godzilla.model.Coord;
import java.util.EnumMap;
import javax.annotation.Nonnull;
/**
* Immutable board of Qi-{@link Coord}'s.
* So far it is used only for testing code.
* It is expensive to construct a QiBoard, so it is not used in production yet.
*/
public class QiBoard {
private static final boolean FLAG_PROFILE = true;
public static Builder newBuilder() {
return new Builder();
}
public static QiBoard readFromString(@Nonnull String boardInput) {
BlockBoard blockBoard = BlockBoard.readFromString(boardInput);
return newBuilder().setBlockBoard(blockBoard).build();
}
private final BlockBoard blockBoard;
private final ImmutableMap<ColorBlock, ImmutableSet<Coord>> blockToQiCoordsMap;
private final EnumMap<Color, ImmutableSet<ColorBlock>> colorToBlocksWithZeroQi;
private QiBoard(
@Nonnull BlockBoard blockBoard,
@Nonnull ImmutableMap<ColorBlock, ImmutableSet<Coord>> blockToQiCoordsMap,
@Nonnull EnumMap<Color, ImmutableSet<ColorBlock>> colorToBlocksWithZeroQi) {
this.blockBoard = blockBoard;
this.blockToQiCoordsMap = blockToQiCoordsMap;
this.colorToBlocksWithZeroQi = colorToBlocksWithZeroQi;
}
public BlockBoard getBlockBoard() {
return blockBoard;
}
public ImmutableSet<Coord> getAllQiCoordsForColorBlock(@Nonnull ColorBlock colorBlock) {
return blockToQiCoordsMap.get(colorBlock);
}
public ImmutableSet<ColorBlock> getAllBlocksOfColorWithZeroQi(@Nonnull Color color) {
return colorToBlocksWithZeroQi.get(color);
}
public boolean isColorBlockOfZeroQi(@Nonnull ColorBlock colorBlock) {
return colorToBlocksWithZeroQi.get(colorBlock.getColor()).contains(colorBlock);
}
public static class Builder {
private BlockBoard blockBoard;
private final EnumMap<Color, ImmutableSet<ColorBlock>> colorToBlocksWithZeroQiBuilder =
new EnumMap<>(Color.class);
private final ImmutableMap.Builder<ColorBlock, ImmutableSet<Coord>> blockToQiCoordsMapBuilder =
ImmutableMap.builder();
private Builder() {}
public Builder setBlockBoard(@Nonnull BlockBoard blockBoard) {
this.blockBoard = blockBoard;
return this;
}
public QiBoard build() {
assert (null != blockBoard);
if (FLAG_PROFILE) {
long time00 = System.nanoTime();
findQiCoordsForAllColorBlocks();
Utils.profile(time00, "QiBoard.build => findQiCoordsForAllColorBlocks");
} else {
findQiCoordsForAllColorBlocks();
}
ImmutableMap<ColorBlock, ImmutableSet<Coord>> blockToQiCoordsMap =
blockToQiCoordsMapBuilder.build();
if (FLAG_PROFILE) {
long time00 = System.nanoTime();
findBlocksWithZeroQi(blockToQiCoordsMap);
Utils.profile(time00, "QiBoard.build => findBlocksWithZeroQi");
} else {
findBlocksWithZeroQi(blockToQiCoordsMap);
}
QiBoard qiBoard =
new QiBoard(blockBoard, blockToQiCoordsMap, colorToBlocksWithZeroQiBuilder);
return qiBoard;
}
private void findQiCoordsForAllColorBlocks() {
for (Color color : Color.values()) {
for (ColorBlock colorBlock : blockBoard.getAllBlocksOfColor(color)) {
ImmutableSet<Coord> qiCoords = findQiCoordsForBlock(colorBlock);
blockToQiCoordsMapBuilder.put(colorBlock, qiCoords);
}
}
}
private ImmutableSet<Coord> findQiCoordsForBlock(ColorBlock colorBlock) {
return blockBoard.findQiCoordsForBlock(colorBlock);
}
private void findBlocksWithZeroQi(
ImmutableMap<ColorBlock, ImmutableSet<Coord>> blockToQiCoordsMap) {
for (Color color : Color.values()) {
ImmutableSet.Builder<ColorBlock> blocksOfColorWithZeroQiBuilder = ImmutableSet.builder();
for (ColorBlock colorBlock : blockBoard.getAllBlocksOfColor(color)) {
if (blockToQiCoordsMap.get(colorBlock).isEmpty()) {
blocksOfColorWithZeroQiBuilder.add(colorBlock);
}
}
colorToBlocksWithZeroQiBuilder.put(color, blocksOfColorWithZeroQiBuilder.build());
}
}
}
}
| [
"github@pitayastudio.org"
] | github@pitayastudio.org |
1e6a5cd37a08adff0346bec4b5c93212c13c9f66 | 3616f5c767d40410952c4a45848f24717a7e69c0 | /XiXiSdk/src/main/java/com/xixi/sdk/serialpos/LLCmdsSet.java | 45ab084c240bef132458fbbb4ecf774bf0d35fe2 | [
"Apache-2.0"
] | permissive | Clark-caipeiyuan/sampleSDK | 8fef1e201f26ed4b4efa3b1e260861dfa78ae524 | 14c7a5337ffc7aa533e5c1db4d7912db1c5fa668 | refs/heads/main | 2023-01-14T07:38:12.504198 | 2020-11-23T02:10:32 | 2020-11-23T02:10:32 | 315,175,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,104 | java | package com.xixi.sdk.serialpos;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import com.xixi.sdk.app.LongLakeApplication;
import com.xixi.sdk.logger.Log;
import com.xixi.sdk.utils.mem.LLMemoryManager;
import com.xixi.sdk.utils.thread.UIThreadDispatcher;
public class LLCmdsSet implements ISerialDataEnum {
public static void test() {
/*
* LLCmdsSet.searchByCmd(CMD_KEYBOARD_FROM_CTRLBOARD);
* LLCmdsSet.searchByCmd(CMD_DOOR_CMD_TO_CTRL_BOARD);
* LLCmdsSet.searchByCmd(CMD_PAD_SWITCH_CMD_FROM_CTRL_BOARD);
* LLCmdsSet.searchByCmd(CMD_START_RESET_SWITCH_CMD_FROM_CTRL_BOARD);
*/}
private static LLCmdsSet instance;
public LLCmdsSet() {
}
public synchronized static LLCmdsSet getInstance() {
if (instance == null) {
instance = new LLCmdsSet();
}
return instance;
}
public interface LLProcessKeyData {
public void processKeyData(byte key, boolean b);
}
public interface LLProcessDoorData {
public void processDooEvent(boolean b);
}
public interface LLProcessCardData {
public void icCardEvent(String cardId);
}
private static LLProcessKeyData defalut_keyData = new LLProcessKeyData() {
@Override
public void processKeyData(byte key, boolean b) {
}
};
private static LLProcessDoorData defalut_doorData = new LLProcessDoorData() {
@Override
public void processDooEvent(boolean b) {
}
};
private static LLProcessCardData defalut_cardData = new LLProcessCardData() {
@Override
public void icCardEvent(String cardId) {
}
};
private static LLProcessDoorData doorData = defalut_doorData ;
private static LLProcessCardData cardData = defalut_cardData ;
private static LLProcessKeyData keyData = defalut_keyData;
public static void setProcessCardData(LLProcessCardData cardData1) {
cardData = cardData1 == null ? defalut_cardData : cardData1;
}
public static void setProcessDoorData(LLProcessDoorData doorData1) {
doorData = doorData1 == null ? defalut_doorData : doorData1;
}
public static void setProcessKeyData(LLProcessKeyData keyData1) {
keyData = keyData1 == null ? defalut_keyData : keyData1;
}
public interface LL_IPreprocess {
Object composeData(byte data[]);
boolean preprocess(byte data[]);
void onMessage(Object data);
}
private final static LL_IPreprocess const_ret_ls = new LL_IPreprocess() {
@Override
public Object composeData(byte[] data) {
return String.valueOf(data[3]);
}
@Override
public boolean preprocess(byte[] data) {
return true;
}
@Override
public void onMessage(Object data) {
}
};
public interface LLProcessElevatorData {
public void processElevatorDirection(int direction);
public void processElevatorFloor(int floor);
}
private static LLProcessElevatorData default_elevator = new LLProcessElevatorData() {
@Override
public void processElevatorDirection(int direction) {
}
@Override
public void processElevatorFloor(int floor) {
}
};
static LLProcessElevatorData elevatorDelegate = default_elevator;
public static void setProcessElevatorFloor(LLProcessElevatorData data) {
elevatorDelegate = data == null ? default_elevator : data;
}
private final static LL_IPreprocess elevatorDirectionHandler = new LL_IPreprocess() {
@Override
public boolean preprocess(byte[] data) {
// elevatorDelegate.processElevatorDirection(data[3]);
return true;
}
@Override
public void onMessage(Object data) {
}
@Override
public Object composeData(byte[] data) {
return null;
}
};
private final static LL_IPreprocess elevatorStatus = new LL_IPreprocess() {
@Override
public boolean preprocess(byte[] data) {
elevatorDelegate.processElevatorFloor(data[4]);
return true;
}
@Override
public void onMessage(Object data) {
}
@Override
public Object composeData(byte[] data) {
return null;
}
};
private final static LL_IPreprocess elevatorFloorHandler = new LL_IPreprocess() {
@Override
public boolean preprocess(byte[] data) {
elevatorDelegate.processElevatorFloor(data[3]);
return true;
}
@Override
public void onMessage(Object data) {
}
@Override
public Object composeData(byte[] data) {
return null;
}
};
// final static String CONST_PERMIITED_IDs =
// "10A58000354D820D,B47D1812,D55EA7C5,001F77C0 , 04424992A13280 ,
// 973CAF3E";
private final static LL_IPreprocess cardIdHandler = new LL_IPreprocess() {
@Override
public Object composeData(byte rawData[]) {
return null;
}
@Override
public boolean preprocess(byte[] rawData) {
StringBuilder sb = new StringBuilder();
String tempString = "";
try {
for (int i = 0; i < rawData[1] - 5; i++) {
int cc = rawData[i + 3];
cc = cc < 0 ? cc + 256 : cc;
sb.append(String.format("%02X", cc));
}
tempString = sb.toString();
} catch (Exception e) {
}
final String upperCase = tempString; // rcvSerialPortData.toUpperCase(Locale.CHINA);
Log.i(LongLakeApplication.DANIEL_TAG, "cardIdHandler " + upperCase.toString());
/*
* LLDBManager.getInstance().verifyIcCardsAvailable(upperCase, new
* LLCardValidEvent() {
*
* @Override public void onValid(boolean validTag) { //TODO
* //CmdRetKits.openDoor(validTag); } });
*/
cardData.icCardEvent(upperCase);
return true;
}
@Override
public void onMessage(Object data) {
}
};
final LLMemoryManager<CmdNode> mm = new LLMemoryManager<CmdNode>() {
protected CmdNode allocate() {
return new CmdNode("key", 0x6, CMD_KEYBOARD_FROM_CTRLBOARD, const_ret_ls);
}
};
final CmdNode cnComparator = new CmdNode("key", 0x6, CMD_KEYBOARD_FROM_CTRLBOARD, const_ret_ls);
final Comparator<CmdNode> comparator = new Comparator<CmdNode>() {
@Override
public int compare(CmdNode arg0, CmdNode arg1) {
return (arg0.getCmd()) - (arg1.getCmd());
}
};
public static class CmdNode {
public CmdNode(String prefix, int length, int cmd, LL_IPreprocess r) {
super();
this.length = length;
this.cmd = cmd;
this.r = r;
this.prefix = prefix;
}
int length;
public int getLength() {
return length & 0xFF;
}
public boolean fixed_length() {
return (length & FLEXIBLE_LENGTH_BIT) == 0;
}
public boolean isCmdReq() {
return (cmd & REQ_BIT) != 0;
}
public int getCmd() {
return cmd & 0xffff;
}
public void setCmd(int cmd) {
this.cmd = cmd;
}
int cmd;
String prefix;
public String getPrefix() {
return prefix;
}
public void SetPrefix(String prefix) {
this.prefix = prefix;
}
LL_IPreprocess r;
public synchronized LL_IPreprocess getR() {
return r;
}
public synchronized void setR(LL_IPreprocess r) {
this.r = r;
}
}
private final static String PREFIX_RET = "ret";
// static final byte[] temp_card_buffer = new byte[4];
private final static int REQ_BIT = 0x10000;
private final static int FLEXIBLE_LENGTH_BIT = 0x100;
/**
*
*/
public CmdNode searchByCmd(int cmdCode) {
/*
* final CmdNode cnComparator = mm.popBuffer() ;
* cnComparator.setCmd(cmdCode); int iIndex =
* Arrays.binarySearch(VALID_CMD_PAIRS, cnComparator, comparator);
* mm.pushBuffer(cnComparator);
*
* if (iIndex < 0) { Log.i(LongLakeApplication.DANIEL_TAG,
* "invalid code " + cmdCode); return null; } else { return
* VALID_CMD_PAIRS[iIndex]; }
*/
return cmdNodeMap.get(cmdCode);
}
private final static Map<Integer, CmdNode> cmdNodeMap = new HashMap<Integer, CmdNode>();
static {
cmdNodeMap.put(CMD_KEYBOARD_FROM_CTRLBOARD,
new CmdNode("key", 0x6, CMD_KEYBOARD_FROM_CTRLBOARD | REQ_BIT, new LL_IPreprocess() {
@Override
public Object composeData(byte rawData[]) {
return Byte.valueOf(rawData[DATA_INDEX]);
}
@Override
public boolean preprocess(byte[] data) {
return false;
}
@Override
public void onMessage(Object data) {
byte key = (Byte) data;
if (0 <= Arrays.binarySearch(const_key_model, key)) {
keyData.processKeyData(key, false);
}
}
}));
cmdNodeMap.put(CMD_DOOR_CMD_FROM_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_DOOR_CMD_FROM_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_RFID_CMD_TO_CTRL_BOARD,
new CmdNode("ic", MAX_CMD_LENGTH, CMD_RFID_CMD_TO_CTRL_BOARD | REQ_BIT, cardIdHandler));
cmdNodeMap.put(CMD_BUTTON_SWITCH_CMD_TO_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_BUTTON_SWITCH_CMD_TO_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_DOOR_STATUS_CMD_TO_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_DOOR_STATUS_CMD_TO_CTRL_BOARD | REQ_BIT, new LL_IPreprocess() {
@Override
public Object composeData(byte[] data) {
return null;
}
@Override
public boolean preprocess(byte[] data) {
final byte bit = data[DATA_INDEX];
UIThreadDispatcher.dispatch(new Runnable() {
public void run() {
doorData.processDooEvent(bit != 0x1);
// LLDoorObservable.getInstance().setDoorStatus(bit
// != 0x1);
}
});
return true;
}
@Override
public void onMessage(Object data) {
}
}));
cmdNodeMap.put(CMD_PAD_SWITCH_CMD_TO_CTRL_BOARD,
new CmdNode("pad_status", 0x5, CMD_PAD_SWITCH_CMD_TO_CTRL_BOARD | REQ_BIT, new LL_IPreprocess() {
@Override
public Object composeData(byte rawData[]) {
return null;
}
@Override
public boolean preprocess(byte[] data) {
return true;
}
@Override
public void onMessage(Object data) {
}
}));
cmdNodeMap.put(CMD_LED_SWITCH_CMD_FROM_CTRL_BOARD,
new CmdNode("led", 0x6, CMD_LED_SWITCH_CMD_FROM_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_LOG_CMD,
new CmdNode(PREFIX_RET, FLEXIBLE_LENGTH_BIT, CMD_LOG_CMD | REQ_BIT, new LL_IPreprocess() {
@Override
public Object composeData(byte[] data) {
return null;
}
@Override
public boolean preprocess(byte[] data) {
// StringBuilder sb = new StringBuilder();
// sb.append("FW=>");
// try {
// for (int index = DATA_INDEX; index <
// data[LENGTH_KEY_OFFSET] - 2; index++) {
// sb.append(String.format("%c", data[index]));
// }
// Log.d(LongLakeApplication.DANIEL_TAG, sb.toString());
// } catch(Exception e) {
// }
return true;
}
@Override
public void onMessage(Object data) {
}
}));
cmdNodeMap.put(CMD_RESET_SWITCH_CMD_TO_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_RESET_SWITCH_CMD_TO_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_START_RESET_SWITCH_CMD_FROM_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_START_RESET_SWITCH_CMD_FROM_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_DEV_READY_STATUS_CMD, new CmdNode(PREFIX_RET, 0x6, CMD_DEV_READY_STATUS_CMD, const_ret_ls));
cmdNodeMap.put(CMD_LIGHT_SWITCH_CMD_TO_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_LIGHT_SWITCH_CMD_TO_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_DEV_RTC_CONFIGURATION_CMD,
new CmdNode(PREFIX_RET, 0x6, CMD_DEV_RTC_CONFIGURATION_CMD, const_ret_ls));
cmdNodeMap.put(CMD_SOUND_SWITCH_CMD_FROM_CTRL_BOARD,
new CmdNode(PREFIX_RET, 0x6, CMD_SOUND_SWITCH_CMD_FROM_CTRL_BOARD, const_ret_ls));
cmdNodeMap.put(CMD_ELEVATOR_ALLOW_FLOOR, new CmdNode(PREFIX_RET, 0x6, CMD_ELEVATOR_ALLOW_FLOOR, const_ret_ls));
cmdNodeMap.put(CMD_ELEVATOR_DIRECT_FLOOR,
new CmdNode(PREFIX_RET, 0x6, CMD_ELEVATOR_DIRECT_FLOOR, const_ret_ls));
cmdNodeMap.put(CMD_ELEVATOR_BOARD_NUM, new CmdNode(PREFIX_RET, 0x6, CMD_ELEVATOR_BOARD_NUM, const_ret_ls));
cmdNodeMap.put(CMD_GET_ELEVATOR_ELEVATOR_STATUS,
new CmdNode(PREFIX_RET, 0x7, CMD_GET_ELEVATOR_ELEVATOR_STATUS, elevatorStatus));
cmdNodeMap.put(CMD_SET_ELEVATOR_FLOOR_COUNT,
new CmdNode(PREFIX_RET, 0x6, CMD_SET_ELEVATOR_FLOOR_COUNT, const_ret_ls));
cmdNodeMap.put(CMD_GET_ELEVATOR_DIRECTION,
new CmdNode(PREFIX_RET, 0x6, CMD_GET_ELEVATOR_DIRECTION | REQ_BIT, elevatorDirectionHandler));
cmdNodeMap.put(CMD_GET_ELEVATOR_FLOOR,
new CmdNode(PREFIX_RET, 0x6, CMD_GET_ELEVATOR_FLOOR | REQ_BIT, elevatorFloorHandler));
cmdNodeMap.put(CMD_NFC_CARD_MSG, new CmdNode("NFC reader", 0, CMD_NFC_CARD_MSG, cardIdHandler));
}
private final static byte const_key_model[] = { '#', '*', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
private final CmdNode VALID_CMD_PAIRS[] = { /*
* new CmdNode("key", 0x6,
* CMD_KEYBOARD_FROM_CTRLBOARD |
* REQ_BIT, new LL_IPreprocess()
* {
*
* @Override public Object
* composeData(byte rawData[]) {
* return Byte.valueOf(rawData[
* DATA_INDEX]); }
*
* @Override public boolean
* preprocess(byte[] data) {
* return false; }
*
* @Override public void
* onMessage(Object data) { byte
* key = (Byte) data; if (0 <=
* Arrays.binarySearch(
* const_key_model, key)) {
* keyData.processKeyData(key,
* false); } } }),
*
* new CmdNode(PREFIX_RET, 0x6,
* CMD_DOOR_CMD_FROM_CTRL_BOARD,
* const_ret_ls), new
* CmdNode("ic", MAX_CMD_LENGTH,
* CMD_RFID_CMD_TO_CTRL_BOARD |
* REQ_BIT, cardIdHandler),
*
* new CmdNode(PREFIX_RET, 0x6,
* CMD_BUTTON_SWITCH_CMD_TO_CTRL_BOARD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_DOOR_STATUS_CMD_TO_CTRL_BOARD
* | REQ_BIT, new
* LL_IPreprocess() {
*
* @Override public Object
* composeData(byte[] data) {
* return null; }
*
* @Override public boolean
* preprocess(byte[] data) {
* final byte bit =
* data[DATA_INDEX];
* UIThreadDispatcher.dispatch(
* new Runnable() { public void
* run() {
* doorData.processDooEvent(bit
* != 0x1); //
* LLDoorObservable.getInstance(
* ).setDoorStatus(bit // !=
* 0x1); } }); return true; }
*
* @Override public void
* onMessage(Object data) { }
*
* }), new CmdNode("pad_status",
* 0x5,
* CMD_PAD_SWITCH_CMD_TO_CTRL_BOARD
* | REQ_BIT, new
* LL_IPreprocess() {
*
* @Override public Object
* composeData(byte rawData[]) {
* return null; }
*
* @Override public boolean
* preprocess(byte[] data) {
*
* return true; }
*
* @Override public void
* onMessage(Object data) {
*
* }
*
* }), new CmdNode("led", 0x6,
* CMD_LED_SWITCH_CMD_FROM_CTRL_BOARD,
* const_ret_ls), new
* CmdNode(PREFIX_RET,
* FLEXIBLE_LENGTH_BIT,
* CMD_LOG_CMD | REQ_BIT, new
* LL_IPreprocess() {
*
* @Override public Object
* composeData(byte[] data) {
* return null; }
*
* @Override public boolean
* preprocess(byte[] data) { //
* StringBuilder sb = new
* StringBuilder(); //
* sb.append("FW=>"); // try {
* // for (int index =
* DATA_INDEX; index < //
* data[LENGTH_KEY_OFFSET] - 2;
* index++) { //
* sb.append(String.format("%c",
* data[index])); // } //
* Log.d(LongLakeApplication.
* DANIEL_TAG, sb.toString());
* // } catch(Exception e) { //
* } return true; }
*
* @Override public void
* onMessage(Object data) {
*
* }
*
* }), new CmdNode(PREFIX_RET,
* 0x6,
* CMD_RESET_SWITCH_CMD_TO_CTRL_BOARD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_START_RESET_SWITCH_CMD_FROM_CTRL_BOARD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_DEV_READY_STATUS_CMD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_LIGHT_SWITCH_CMD_TO_CTRL_BOARD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_DEV_RTC_CONFIGURATION_CMD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_SOUND_SWITCH_CMD_FROM_CTRL_BOARD,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_ELEVATOR_ALLOW_FLOOR,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_ELEVATOR_DIRECT_FLOOR,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_ELEVATOR_BOARD_NUM,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x7,
* CMD_GET_ELEVATOR_ELEVATOR_STATUS,
* elevatorStatus), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_SET_ELEVATOR_FLOOR_COUNT,
* const_ret_ls), new
* CmdNode(PREFIX_RET, 0x6,
* CMD_GET_ELEVATOR_DIRECTION |
* REQ_BIT,
* elevatorDirectionHandler),
* new CmdNode(PREFIX_RET, 0x6,
* CMD_GET_ELEVATOR_FLOOR |
* REQ_BIT,
* elevatorFloorHandler), new
* CmdNode("NFC reader", 0,
* CMD_NFC_CARD_MSG,
* cardIdHandler), // new
* CmdNode("NFC reader", 14,
* CMD_NFC_CARD_MSG,
* cardIdHandler),
*/ };
public CmdNode[] getVALID_CMD_PAIRS() {
return VALID_CMD_PAIRS;
}
}
| [
"caicai__1377@163.com"
] | caicai__1377@163.com |
1d8063faafdbfbdde54d42e393bd86472b444440 | dc0919c9609f03f5b239ec0799cea22ed070f411 | /android/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl.java | 4b62a987068ecca36bd97b982e422aea66379fba | [] | no_license | jjensn/milight-decompile | a8f98af475f452c18a74fd1032dce8680f23abc0 | 47c4b9eea53c279f6fab3e89091e2fef495c6159 | refs/heads/master | 2021-06-01T17:23:28.555123 | 2016-10-12T18:07:53 | 2016-10-12T18:07:53 | 70,721,205 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,907 | java | package android.support.v4.view.accessibility;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;
import java.util.List;
abstract interface AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl
{
public abstract void addAction(Object paramObject, int paramInt);
public abstract void addChild(Object paramObject, View paramView);
public abstract void addChild(Object paramObject, View paramView, int paramInt);
public abstract List<Object> findAccessibilityNodeInfosByText(Object paramObject, String paramString);
public abstract Object findFocus(Object paramObject, int paramInt);
public abstract Object focusSearch(Object paramObject, int paramInt);
public abstract int getActions(Object paramObject);
public abstract void getBoundsInParent(Object paramObject, Rect paramRect);
public abstract void getBoundsInScreen(Object paramObject, Rect paramRect);
public abstract Object getChild(Object paramObject, int paramInt);
public abstract int getChildCount(Object paramObject);
public abstract CharSequence getClassName(Object paramObject);
public abstract CharSequence getContentDescription(Object paramObject);
public abstract int getMovementGranularities(Object paramObject);
public abstract CharSequence getPackageName(Object paramObject);
public abstract Object getParent(Object paramObject);
public abstract CharSequence getText(Object paramObject);
public abstract String getViewIdResourceName(Object paramObject);
public abstract int getWindowId(Object paramObject);
public abstract boolean isAccessibilityFocused(Object paramObject);
public abstract boolean isCheckable(Object paramObject);
public abstract boolean isChecked(Object paramObject);
public abstract boolean isClickable(Object paramObject);
public abstract boolean isEnabled(Object paramObject);
public abstract boolean isFocusable(Object paramObject);
public abstract boolean isFocused(Object paramObject);
public abstract boolean isLongClickable(Object paramObject);
public abstract boolean isPassword(Object paramObject);
public abstract boolean isScrollable(Object paramObject);
public abstract boolean isSelected(Object paramObject);
public abstract boolean isVisibleToUser(Object paramObject);
public abstract Object obtain();
public abstract Object obtain(View paramView);
public abstract Object obtain(View paramView, int paramInt);
public abstract Object obtain(Object paramObject);
public abstract boolean performAction(Object paramObject, int paramInt);
public abstract boolean performAction(Object paramObject, int paramInt, Bundle paramBundle);
public abstract void recycle(Object paramObject);
public abstract void setAccessibilityFocused(Object paramObject, boolean paramBoolean);
public abstract void setBoundsInParent(Object paramObject, Rect paramRect);
public abstract void setBoundsInScreen(Object paramObject, Rect paramRect);
public abstract void setCheckable(Object paramObject, boolean paramBoolean);
public abstract void setChecked(Object paramObject, boolean paramBoolean);
public abstract void setClassName(Object paramObject, CharSequence paramCharSequence);
public abstract void setClickable(Object paramObject, boolean paramBoolean);
public abstract void setContentDescription(Object paramObject, CharSequence paramCharSequence);
public abstract void setEnabled(Object paramObject, boolean paramBoolean);
public abstract void setFocusable(Object paramObject, boolean paramBoolean);
public abstract void setFocused(Object paramObject, boolean paramBoolean);
public abstract void setLongClickable(Object paramObject, boolean paramBoolean);
public abstract void setMovementGranularities(Object paramObject, int paramInt);
public abstract void setPackageName(Object paramObject, CharSequence paramCharSequence);
public abstract void setParent(Object paramObject, View paramView);
public abstract void setParent(Object paramObject, View paramView, int paramInt);
public abstract void setPassword(Object paramObject, boolean paramBoolean);
public abstract void setScrollable(Object paramObject, boolean paramBoolean);
public abstract void setSelected(Object paramObject, boolean paramBoolean);
public abstract void setSource(Object paramObject, View paramView);
public abstract void setSource(Object paramObject, View paramView, int paramInt);
public abstract void setText(Object paramObject, CharSequence paramCharSequence);
public abstract void setViewIdResourceName(Object paramObject, String paramString);
public abstract void setVisibleToUser(Object paramObject, boolean paramBoolean);
}
/* Location:
* Qualified Name: android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityNodeInfoImpl
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.6.1-SNAPSHOT
*/ | [
"jjensen@GAM5YG3QC-MAC.local"
] | jjensen@GAM5YG3QC-MAC.local |
13a4bfb2f4d98a0d428ac351e194498f0ad9503d | 479f575f80b5ff724b05f93e1b2c5f8ee6c6c10c | /09_01_00_MakeStackWithQueue.java | d44af9324ff0b687684d4f154d3d9a59ed471871 | [] | no_license | wannawannawanna/coding-interview | 9ceeca391a0c9363d8c8e4af6b4ce968417f6564 | 7e3c5306fef6cee8f57d05e412a31c52aa6cf160 | refs/heads/master | 2021-01-05T16:54:19.894511 | 2020-09-06T13:53:25 | 2020-09-06T13:53:25 | 241,081,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package Offer;
import java.util.Queue;
import java.util.LinkedList;
public class example9_1 {
Queue<Integer> q1 = new LinkedList<Integer>();
Queue<Integer> q2 = new LinkedList<Integer>();
public void push(int node) {
if(q1.isEmpty() && q2.isEmpty()) {
q1.add(node); //队列没有push()函数,push()是栈的
}
else if(!q1.isEmpty()) {
q1.add(node);
}
else if(!q2.isEmpty()) {
q2.add(node);
}
}
public int pop() {
if(!q1.isEmpty() && q2.isEmpty()) {
int length = q1.size(); //如果想用for那必须先获得队列的长度,然后作为i的上界,
//否则队列长度是变化的,直接在for里面写q1.size()的话会越界,,,,,或者直接用while,判断队列长度不为1就好了
for(int i = 0; i < length - 1; i++) {
int current = q1.poll();
q2.add(current);
}
return q1.poll();
}
else if(!q2.isEmpty() && q1.isEmpty()) {
while(q2.size() != 1) {
int current = q2.poll(); //返回队列顶元素,并删除,没有pop()这个函数,pop是栈的,,,
//如果只想返回队列顶元素不删除,那么用peek()
q1.add(current);
}
return q2.poll();
}
return 0;
}
public static void main(String[] args) {
example9_1 ex = new example9_1();
ex.push(1);
ex.push(2);
ex.push(3);
System.out.println(ex.pop());
System.out.println(ex.pop());
ex.push(4);
System.out.println(ex.pop());
System.out.println(ex.pop());
}
}
| [
"noreply@github.com"
] | wannawannawanna.noreply@github.com |
a6ed5a13d46ba37386445660c1fb0af791f89e11 | 594330a18c59489bfd9c7f86fd9cfc79c9cd900d | /kr-scientific/kr-scientific-impl/src/main/java/com/ronglian/kangrui/saas/research/sci/biz/StudyRoleBiz.java | 11408c23dae4066bbabb4b4bad63fda8b9b7755e | [] | no_license | ahjsjxy/res | c4c686867595f9157f3bb2b4d683e999d295432b | 20397d1d8e512951df7b990d3687c62c55b99c94 | refs/heads/master | 2022-12-20T19:57:40.570635 | 2019-06-29T15:09:45 | 2019-06-29T15:09:45 | 194,418,422 | 0 | 2 | null | 2022-12-16T03:46:46 | 2019-06-29T15:08:17 | Java | UTF-8 | Java | false | false | 5,931 | java | package com.ronglian.kangrui.saas.research.sci.biz;
import com.ronglian.kangrui.saas.research.common.biz.BaseBiz;
import com.ronglian.kangrui.saas.research.common.constant.RestCodeConstants;
import com.ronglian.kangrui.saas.research.common.vo.Msg;
import com.ronglian.kangrui.saas.research.sci.consts.ResearchConsts;
import com.ronglian.kangrui.saas.research.sci.consts.RoleTypeConsts;
import com.ronglian.kangrui.saas.research.sci.entity.StudyRole;
import com.ronglian.kangrui.saas.research.sci.entity.StudyRoleButton;
import com.ronglian.kangrui.saas.research.sci.entity.StudyRoleUser;
import com.ronglian.kangrui.saas.research.sci.entity.StudyUser;
import com.ronglian.kangrui.saas.research.sci.mapper.StudyRoleButtonMapper;
import com.ronglian.kangrui.saas.research.sci.mapper.StudyRoleMapper;
import com.ronglian.kangrui.saas.research.sci.mapper.StudyRoleUserMapper;
import com.ronglian.kangrui.saas.research.sci.mapper.StudyUserMapper;
import com.ronglian.kangrui.saas.research.sci.vo.StudyRoleVo;
import com.ronglian.kangrui.saas.research.shirobase.service.ShiroService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* ${DESCRIPTION}
*
* @author lanyan
* @create 2019-05-28 14:23
**/
@Service
public class StudyRoleBiz extends BaseBiz<StudyRoleMapper, StudyRole> {
@Autowired
private StudyRoleMapper studyRoleMapper ;
@Autowired
private StudyRoleButtonMapper studyRoleButtonMapper ;
@Autowired
private StudyRoleUserMapper studyRoleUserMapper ;
@Autowired
private StudyUserMapper studyUserMapper ;
@Autowired
private StudyRoleUserBiz studyRoleUserBiz ;
@Autowired
private StudyRoleButtonBiz studyRoleButtonBiz ;
/**
* 给项目创建角色(每个项目默认创建4个角色)
* 每个角色赋值按钮权限
* 项目创建者为默认为项目管理员
*
* @param studyId
*/
public void addStudyRoleInfo(Long studyId){
// 新建项目-角色
for (RoleTypeConsts.RoleTypeEnum roleTypeEnum : RoleTypeConsts.RoleTypeEnum.values()) {
StudyRole studyRole = new StudyRole() ;
studyRole.setName(roleTypeEnum.getName());
studyRole.setAllowOperate(ResearchConsts.ALLOW_OPERATE_NO);//1:禁止修改删除
studyRole.setDeleted(ResearchConsts.DELETED_NO);//0:未删除
studyRole.setCreateUser(ShiroService.getCurrentUser().getId());
studyRole.setUpdateTime(new Date());
studyRole.setStudyId(studyId);
studyRole = this.insertSelective(studyRole) ;
// 角色赋值按钮权限
List<String> buttonCodeList = Arrays.asList(roleTypeEnum.getButtonArray());
for (String buttonCode: buttonCodeList) {
StudyRoleButton studyRoleButton = new StudyRoleButton() ;
studyRoleButton.setButtonCode(buttonCode);
studyRoleButton.setRoleId(studyRole.getId());
studyRoleButtonMapper.insertSelective(studyRoleButton) ;
}
// 项目创建者为 【项目管理员, 数据管理员, 数据录入员, 数据分析员】4个角色都有
//if (roleTypeEnum.getName().equals(RoleTypeConsts.STUDY_ADMIN)) {
StudyRoleUser studyRoleUser = new StudyRoleUser() ;
studyRoleUser.setRoleId(studyRole.getId());
studyRoleUser.setUserId(ShiroService.getCurrentUser().getId());
studyRoleUserMapper.insertSelective(studyRoleUser) ;
//}
}
// 项目创建用户
StudyUser studyUser = new StudyUser() ;
studyUser.setStudyId(studyId);
studyUser.setUserId(ShiroService.getCurrentUser().getId());
studyUserMapper.insertSelective(studyUser) ;
}
/**
* 获取某项目下的角色列表
* @param studyId
* @param roleName
* @return
*/
public List<StudyRoleVo> getStudyRoleList(Long studyId, String roleName) {
StudyRoleVo studyRoleVo = new StudyRoleVo() ;
studyRoleVo.setStudyId(studyId);
studyRoleVo.setName(roleName);
return studyRoleMapper.getStudyRoleList(studyRoleVo) ;
}
/**
* 校验 项目下的角色名称是否重复
* @param studyRoleVo
* @return
*/
public List<StudyRoleVo> checkNameExists(StudyRoleVo studyRoleVo) {
return studyRoleMapper.checkNameExists(studyRoleVo) ;
}
/**
* 根据角色ID删除 1, 把角色置为无效 2, 删除角色下关联的用户 3, 删除角色下关联的按钮
*
* @return
*/
public Msg deleteRoleInfo(Long roleId) {
Msg msg = new Msg() ;
msg.setSucFlag(Boolean.FALSE);
try {
// 1, 把角色置为无效
StudyRole studyRole = this.selectById(roleId) ;
studyRole.setDeleted(ResearchConsts.DELETED_YES);
studyRole.setUpdateTime(new Date());
studyRole.setUpdateUser(ShiroService.getCurrentUser().getId());
this.updateSelectiveById(studyRole);
// 2, 删除角色下关联的用户
StudyRoleUser studyRoleUser = new StudyRoleUser() ;
studyRoleUser.setRoleId(roleId);
studyRoleUserBiz.delete(studyRoleUser);
// 3, 删除角色下关联的按钮
StudyRoleButton studyRoleButton = new StudyRoleButton() ;
studyRoleButton.setRoleId(roleId);
studyRoleButtonBiz.delete(studyRoleButton);
msg.setSucFlag(Boolean.TRUE);
msg.setDesc(ResearchConsts.STUDY_ROLE_DEL_SUC_MSG);
} catch (Exception e) {
msg.setCode(RestCodeConstants.STATUS_CODE_DELETE_EXCEPTION);
e.printStackTrace();
}
return msg ;
}
}
| [
"1445464932@qq.com"
] | 1445464932@qq.com |
3cab8485d52f3537852fda851e3538cc9b415a0b | 29fedac04bbd8949f6e456c692188466021a57ab | /app/src/main/java/com/nikkuts/lastfmapp/gson/albuminfo/Attr.java | 3b743d6b2323b109f74302f5e5e0edc65afc8d40 | [] | no_license | Nikuts/LastFMApp | 093e83f06f22f2b2222ca99a6dedbd393e0ff2ca | f495c9810af86328dc455fd41ce28596e98e184a | refs/heads/master | 2020-03-31T16:55:17.283482 | 2019-07-29T18:45:11 | 2019-07-29T18:45:11 | 152,397,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.nikkuts.lastfmapp.gson.albuminfo;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Attr {
@SerializedName("rank")
@Expose
private String rank;
public String getRank() {
return rank;
}
}
| [
"nikkuts@gmail.com"
] | nikkuts@gmail.com |
5d4b416dcc6b19adea1933742d505890fb425d26 | 3f90c2df80d9f96a760d1e04c2d5dbb9d7e88a24 | /contrib/zebra/src/test/org/apache/hadoop/zebra/io/TestRecord.java | acc789b5cd8296d9c3260514dd42b8d4e48a3896 | [
"Apache-2.0"
] | permissive | hirohanin/pig7hadoop21 | d038ecc3400bcc7124ecce356f2a30533f6ee188 | b595f515dde305dfcb0d965ce07c51f629d7a824 | refs/heads/master | 2021-01-25T03:54:55.074368 | 2010-11-02T12:19:26 | 2010-11-02T12:19:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,998 | 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.hadoop.zebra.io;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.StringTokenizer;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.zebra.io.BasicTable;
import org.apache.hadoop.zebra.io.TableInserter;
import org.apache.hadoop.zebra.io.TableScanner;
import org.apache.hadoop.zebra.io.BasicTable.Reader.RangeSplit;
import org.apache.hadoop.zebra.parser.ParseException;
import org.apache.hadoop.zebra.types.Projection;
import org.apache.hadoop.zebra.schema.Schema;
import org.apache.hadoop.zebra.types.TypesUtils;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataByteArray;
import org.apache.pig.data.Tuple;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
/**
*
* Test projections on complicated column types.
*
*/
public class TestRecord {
private static Configuration conf;
private static Path path;
private static FileSystem fs;
static int count;
final static String STR_SCHEMA = "r1:record(f1:int, f2:long), r2:record(f5, r3:record(f3:float, f4))";
final static String STR_STORAGE = "[r1.f1]; [r2.r3.f4]; [r1.f2, r2.r3.f3]";
@BeforeClass
public static void setUpOnce() throws IOException {
conf = new Configuration();
conf.setInt("table.output.tfile.minBlock.size", 64 * 1024);
conf.setInt("table.input.split.minSize", 64 * 1024);
conf.set("table.output.tfile.compression", "none");
RawLocalFileSystem rawLFS = new RawLocalFileSystem();
fs = new LocalFileSystem(rawLFS);
path = new Path(fs.getWorkingDirectory(), "TestRecord");
fs = path.getFileSystem(conf);
// drop any previous tables
BasicTable.drop(path, conf);
// Build Table and column groups
BasicTable.Writer writer = new BasicTable.Writer(path, STR_SCHEMA,
STR_STORAGE, conf);
writer.finish();
Schema schema = writer.getSchema();
Tuple tuple = TypesUtils.createTuple(schema);
BasicTable.Writer writer1 = new BasicTable.Writer(path, conf);
int part = 0;
TableInserter inserter = writer1.getInserter("part" + part, true);
TypesUtils.resetTuple(tuple);
Tuple tupRecord1;
try {
tupRecord1 = TypesUtils.createTuple(schema.getColumnSchema("r1")
.getSchema());
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
Tuple tupRecord2;
try {
tupRecord2 = TypesUtils.createTuple(schema.getColumnSchema("r2")
.getSchema());
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
Tuple tupRecord3;
try {
tupRecord3 = TypesUtils.createTuple(new Schema("f3:float, f4"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
// insert data in row 1
int row = 0;
// r1:record(f1:int, f2:long
tupRecord1.set(0, 1);
tupRecord1.set(1, 1001L);
tuple.set(0, tupRecord1);
// r2:record(r3:record(f3:float, f4))
tupRecord2.set(0, "f5 row1 byte array");
tupRecord3.set(0, 1.3);
tupRecord3.set(1, new DataByteArray("r3 row1 byte array"));
tupRecord2.set(1, tupRecord3);
tuple.set(1, tupRecord2);
inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
.getBytes()), tuple);
// row 2
row++;
TypesUtils.resetTuple(tuple);
TypesUtils.resetTuple(tupRecord1);
TypesUtils.resetTuple(tupRecord2);
TypesUtils.resetTuple(tupRecord3);
// r1:record(f1:int, f2:long
tupRecord1.set(0, 2);
tupRecord1.set(1, 1002L);
tuple.set(0, tupRecord1);
// r2:record(r3:record(f3:float, f4))
tupRecord2.set(0, "f5 row2 byte array");
tupRecord3.set(0, 2.3);
tupRecord3.set(1, new DataByteArray("r3 row2 byte array"));
tupRecord2.set(1, tupRecord3);
tuple.set(1, tupRecord2);
inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
.getBytes()), tuple);
// finish building table, closing out the inserter, writer, writer1
inserter.close();
writer1.finish();
writer.close();
}
@AfterClass
public static void tearDownOnce() throws IOException {
BasicTable.drop(path, conf);
}
@Test
// Test read , simple projection 0, not record of record level.
public void testRead1() throws IOException, ParseException {
String projection0 = new String("r1.f1, r1.f2");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection0);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
System.out.println("read 1:" + RowValue.toString());
// read 1:(1,1001L)
Assert.assertEquals(1, RowValue.get(0));
scanner.advance();
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(2, RowValue.get(0));
reader.close();
}
/*
* String STR_SCHEMA =
* "r1:record(f1:int, f2:long), r2:record(f5, r3:record(f3:float, f4))";
* String STR_STORAGE = "[r1.f1]; [r2.r3.f4]; [r1.f2, r2.r3.f3]";
*/
@Test
// Test read , record of record level,
public void testRead2() throws IOException, ParseException {
String projection1 = new String("r2.r3.f4, r2.r3.f3");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection1);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
System.out.println("read 2:" + RowValue.toString());
// read 2:(r3 row1 byte array,1.3)
Assert.assertEquals("r3 row1 byte array", RowValue.get(0).toString());
Assert.assertEquals(1.3, RowValue.get(1));
scanner.advance();
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals("r3 row2 byte array", RowValue.get(0).toString());
Assert.assertEquals(2.3, RowValue.get(1));
reader.close();
}
/*
* String STR_SCHEMA =
* "r1:record(f1:int, f2:long), r2:record(f5, r3:record(f3:float, f4))";
* String STR_STORAGE = "[r1.f1]; [r2.r3.f4]; [r1.f2, r2.r3.f3]";
*/
@Test
// test stitch, r1.f1, r2.r3.f3
public void testRead3() throws IOException, ParseException {
String projection2 = new String("r1.f1, r2.r3.f3");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection2);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
System.out.println("read 3:" + RowValue.toString());
// read 3:(1,1.3)
Assert.assertEquals(1, RowValue.get(0));
Assert.assertEquals(1.3, RowValue.get(1));
scanner.advance();
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(2, RowValue.get(0));
Assert.assertEquals(2.3, RowValue.get(1));
reader.close();
}
@Test
public void testRead4() throws IOException, ParseException {
String projection3 = new String("r1, r2");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection3);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
System.out.println("read 4:" + RowValue.toString());
// read 4:((1,1001L),(f5 row1 byte array,(1.3,r3 row1 byte array)))
Assert.assertEquals(1, ((Tuple) RowValue.get(0)).get(0));
Assert.assertEquals(1001L, ((Tuple) RowValue.get(0)).get(1));
Assert.assertEquals("f5 row1 byte array", ((Tuple) RowValue.get(1)).get(0)
.toString());
Assert.assertEquals(1.3, ((Tuple) ((Tuple) RowValue.get(1)).get(1)).get(0));
Assert.assertEquals("r3 row1 byte array",
((Tuple) ((Tuple) RowValue.get(1)).get(1)).get(1).toString());
scanner.advance();
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(2, ((Tuple) RowValue.get(0)).get(0));
Assert.assertEquals(1002L, ((Tuple) RowValue.get(0)).get(1));
Assert.assertEquals("f5 row2 byte array", ((Tuple) RowValue.get(1)).get(0)
.toString());
Assert.assertEquals(2.3, ((Tuple) ((Tuple) RowValue.get(1)).get(1)).get(0));
Assert.assertEquals("r3 row2 byte array",
((Tuple) ((Tuple) RowValue.get(1)).get(1)).get(1).toString());
reader.close();
}
@Test
// test stitch, r2.f5.f3
public void testRead5() throws IOException, ParseException {
String projection3 = new String("r2.r3.f3");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection3);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
System.out.println("read 5:" + RowValue.toString());
// read 5:(1.3)
Assert.assertEquals(1.3, RowValue.get(0));
scanner.advance();
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(2.3, RowValue.get(0));
reader.close();
}
/*
* String STR_SCHEMA =
* "r1:record(f1:int, f2:long), r2:record(f5, r3:record(f3:float, f4))";
* String STR_STORAGE = "[r1.f1]; [r2.r3.f4]; [r1.f2, r2.r3.f3]";
*/
@Test
// test stitch,(r1.f2, r1.f1)
public void testRead6() throws IOException, ParseException {
String projection3 = new String("r1.f2,r1.f1");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection3);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
System.out.println("read 6:" + RowValue.toString());
// read 6:(1001L,1)
Assert.assertEquals(1001L, RowValue.get(0));
Assert.assertEquals(1, RowValue.get(1));
try {
RowValue.get(2);
Assert.fail("Should throw index out of bound exception ");
} catch (Exception e) {
e.printStackTrace();
}
scanner.advance();
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(1002L, RowValue.get(0));
Assert.assertEquals(2, RowValue.get(1));
try {
RowValue.get(2);
Assert.fail("Should throw index out of bound exception ");
} catch (Exception e) {
e.printStackTrace();
}
reader.close();
}
@Test
// test projection, negative, none-exist column name.
public void testReadNegative1() throws IOException, ParseException {
String projection4 = new String("r3");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection4);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(null, RowValue.get(0));
reader.close();
}
@Test
// test projection, negative, none-exist column name.
public void testReadNegative2() throws IOException, ParseException {
String projection4 = new String("NO");
BasicTable.Reader reader = new BasicTable.Reader(path, conf);
reader.setProjection(projection4);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
scanner.getValue(RowValue);
Assert.assertEquals(null, RowValue.get(0));
reader.close();
}
}
| [
"root@rohan-laptop.(none)"
] | root@rohan-laptop.(none) |
481aa621ce03f55b20d246c8742427d63b205356 | 0109b94a2386cebd05b34a0fe32878d844d092cf | /src/main/java/com/unlcn/ils/tps/E_fleetshare.java | 33032291cfe6a40156461abfccf2f269d5b55d33 | [] | no_license | JB1214379009/tps_develop | d62294c755a70885d0fa3def6c71ab8be90e63fc | c55ef43615f9980155ed607ab80789d75e2d2780 | refs/heads/master | 2021-01-12T07:09:22.808626 | 2017-05-24T06:25:23 | 2017-05-24T06:25:23 | 76,916,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,611 | java | package com.unlcn.ils.tps;
import java.io.Serializable;
import com.chinacreator.c2.annotation.Column;
import com.chinacreator.c2.annotation.ColumnType;
import com.chinacreator.c2.annotation.Entity;
/**
* 分供方份额表
* @author
* @generated
*/
@Entity(id = "entity:com.unlcn.ils.tps.e_fleetshare", table = "tps_share", ds = "ilsdb")
public class E_fleetshare implements Serializable {
private static final long serialVersionUID = 1741638594805760L;
/**
*序号
*/
@Column(id = "lineid", type = ColumnType.uuid, datatype = "string32")
private java.lang.String lineid;
/**
*分供方id
*/
@Column(id = "shipper_id", datatype = "string32")
private java.lang.String shipperId;
/**
*份额编号
*/
@Column(id = "lineno", datatype = "string64")
private java.lang.String lineno;
/**
*起运城市id
*/
@Column(id = "start_city_id", datatype = "int")
private java.lang.Integer startCityId;
/**
*起运城市
*/
@Column(id = "start_city", datatype = "string32")
private java.lang.String startCity;
/**
*目的地省份id
*/
@Column(id = "dest_province_id", datatype = "int")
private java.lang.Integer destProvinceId;
/**
*目的地省份
*/
@Column(id = "dest_province", datatype = "string32")
private java.lang.String destProvince;
/**
*份额量
*/
@Column(id = "scale", datatype = "bigdecimal")
private java.math.BigDecimal scale;
/**
*预计发运量
*/
@Column(id = "totalqty", datatype = "bigdecimal")
private java.math.BigDecimal totalqty;
/**
*有效日期
*/
@Column(id = "begin_date", datatype = "timestamp")
private java.sql.Timestamp beginDate;
/**
*失效日期
*/
@Column(id = "end_date", datatype = "timestamp")
private java.sql.Timestamp endDate;
/**
*创建时间
*/
@Column(id = "create_time", datatype = "timestamp")
private java.sql.Timestamp createTime;
/**
*创建人
*/
@Column(id = "create_user", datatype = "string32")
private java.lang.String createUser;
/**
*取消标志
*/
@Column(id = "active", datatype = "tinyint")
private java.lang.Integer active;
/**
*取消操作员
*/
@Column(id = "active_user", datatype = "string32")
private java.lang.String activeUser;
/**
*取消操作时间
*/
@Column(id = "active_time", datatype = "timestamp")
private java.sql.Timestamp activeTime;
/**
*取消说明
*/
@Column(id = "active_memo", datatype = "string256")
private java.lang.String activeMemo;
/**
*1
*/
@Column(id = "shipper_name", datatype = "string256")
private java.lang.String shipperName;
/**
* 设置序号
*/
public void setLineid(java.lang.String lineid) {
this.lineid = lineid;
}
/**
* 获取序号
*/
public java.lang.String getLineid() {
return lineid;
}
/**
* 设置分供方id
*/
public void setShipperId(java.lang.String shipperId) {
this.shipperId = shipperId;
}
/**
* 获取分供方id
*/
public java.lang.String getShipperId() {
return shipperId;
}
/**
* 设置份额编号
*/
public void setLineno(java.lang.String lineno) {
this.lineno = lineno;
}
/**
* 获取份额编号
*/
public java.lang.String getLineno() {
return lineno;
}
/**
* 设置起运城市id
*/
public void setStartCityId(java.lang.Integer startCityId) {
this.startCityId = startCityId;
}
/**
* 获取起运城市id
*/
public java.lang.Integer getStartCityId() {
return startCityId;
}
/**
* 设置起运城市
*/
public void setStartCity(java.lang.String startCity) {
this.startCity = startCity;
}
/**
* 获取起运城市
*/
public java.lang.String getStartCity() {
return startCity;
}
/**
* 设置目的地省份id
*/
public void setDestProvinceId(java.lang.Integer destProvinceId) {
this.destProvinceId = destProvinceId;
}
/**
* 获取目的地省份id
*/
public java.lang.Integer getDestProvinceId() {
return destProvinceId;
}
/**
* 设置目的地省份
*/
public void setDestProvince(java.lang.String destProvince) {
this.destProvince = destProvince;
}
/**
* 获取目的地省份
*/
public java.lang.String getDestProvince() {
return destProvince;
}
/**
* 设置份额量
*/
public void setScale(java.math.BigDecimal scale) {
this.scale = scale;
}
/**
* 获取份额量
*/
public java.math.BigDecimal getScale() {
return scale;
}
/**
* 设置预计发运量
*/
public void setTotalqty(java.math.BigDecimal totalqty) {
this.totalqty = totalqty;
}
/**
* 获取预计发运量
*/
public java.math.BigDecimal getTotalqty() {
return totalqty;
}
/**
* 设置有效日期
*/
public void setBeginDate(java.sql.Timestamp beginDate) {
this.beginDate = beginDate;
}
/**
* 获取有效日期
*/
public java.sql.Timestamp getBeginDate() {
return beginDate;
}
/**
* 设置失效日期
*/
public void setEndDate(java.sql.Timestamp endDate) {
this.endDate = endDate;
}
/**
* 获取失效日期
*/
public java.sql.Timestamp getEndDate() {
return endDate;
}
/**
* 设置创建时间
*/
public void setCreateTime(java.sql.Timestamp createTime) {
this.createTime = createTime;
}
/**
* 获取创建时间
*/
public java.sql.Timestamp getCreateTime() {
return createTime;
}
/**
* 设置创建人
*/
public void setCreateUser(java.lang.String createUser) {
this.createUser = createUser;
}
/**
* 获取创建人
*/
public java.lang.String getCreateUser() {
return createUser;
}
/**
* 设置取消标志
*/
public void setActive(java.lang.Integer active) {
this.active = active;
}
/**
* 获取取消标志
*/
public java.lang.Integer getActive() {
return active;
}
/**
* 设置取消操作员
*/
public void setActiveUser(java.lang.String activeUser) {
this.activeUser = activeUser;
}
/**
* 获取取消操作员
*/
public java.lang.String getActiveUser() {
return activeUser;
}
/**
* 设置取消操作时间
*/
public void setActiveTime(java.sql.Timestamp activeTime) {
this.activeTime = activeTime;
}
/**
* 获取取消操作时间
*/
public java.sql.Timestamp getActiveTime() {
return activeTime;
}
/**
* 设置取消说明
*/
public void setActiveMemo(java.lang.String activeMemo) {
this.activeMemo = activeMemo;
}
/**
* 获取取消说明
*/
public java.lang.String getActiveMemo() {
return activeMemo;
}
/**
* 设置1
*/
public void setShipperName(java.lang.String shipperName) {
this.shipperName = shipperName;
}
/**
* 获取1
*/
public java.lang.String getShipperName() {
return shipperName;
}
}
| [
"1214379009@qq.com"
] | 1214379009@qq.com |
713919372f79d421247698a4085fe7bdbfddde8b | eff0c40e417e9319ca6d3d8368d4ad12c60268ee | /src/main/java/com/capitalone/dashboard/collector/TravisClient.java | 2fb6eda28603b1e3bf68d70725b2341ff7c66b20 | [
"Apache-2.0"
] | permissive | isabella232/hygieia-build-travis-collector | 4133c6929f3d2daeb3b0cbd496859fa3bd943f4d | cd9a674d7255e30f37138f03ecc22300c4694489 | refs/heads/master | 2023-01-13T10:28:35.656379 | 2019-09-30T03:45:42 | 2019-09-30T03:45:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 604 | java | package com.capitalone.dashboard.collector;
import com.capitalone.dashboard.misc.HygieiaException;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.TravisJob;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.List;
public interface TravisClient {
/**
* Fetch full populated build information for a build.
*
* @param job the the travis job object
* @return a Build instance or null
*/
List<Build> getBuilds(TravisJob job) throws MalformedURLException, HygieiaException, URISyntaxException;
}
| [
"ragha.vema@capitalone.com"
] | ragha.vema@capitalone.com |
7158a8eb7afac3868a74a6ea84d82007024dcca0 | f7a9778efa818c7f896d418f334ce505d1bd3b15 | /linked_list/21/1.java | 9cb38c0463084a06fec20ba2b6334afcf5b22d55 | [] | no_license | BergAdolf/java_algorithm | 538b06169b4904acc6080596c89e29e13933587c | f247a30c24911f37357893711883ec167a54db7b | refs/heads/master | 2023-08-07T09:42:11.197953 | 2021-04-27T15:06:07 | 2021-04-27T15:06:07 | 331,265,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | /**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if(l1 == null)
return l2;
if(l2 == null)
return l1;
ListNode node = new ListNode(0);
ListNode hand = node;
while(l1 != null || l2 != null){
if(l1 == null){
node.next = l2;
break;
}
else if(l2 == null){
node.next = l1;
break;
}
else{
if(l1.val < l2.val){
node.next = l1;
node = node.next;
l1 = l1.next;
}
else{
node.next = l2;
node = node.next;
l2 = l2.next;
}
}
}
return hand.next;
}
} | [
"2279137960@qq.com"
] | 2279137960@qq.com |
d4a010229cd40c036af4ff08ca6bb7b75aac382d | cbf157f42144a20198f68227253b9ee139cc67b5 | /pawn/src/java/com/dass/pawning/service/DueTypeService.java | 5b936dc9090729ff8c523b97b520aed699c5929b | [] | no_license | mahindajayakody/pawn-glt | aa3763abb6de07bbb4cf5c17357a4453b865e182 | 92532df4d2e8f7fe67ae44ce5ba1cf5ad02f4933 | refs/heads/master | 2022-11-15T04:26:34.361806 | 2020-07-12T20:25:05 | 2020-07-12T20:25:05 | 279,137,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package com.dass.pawning.service;
import java.util.List;
import com.dass.core.exception.PawnException;
import com.dass.core.util.AuthorizableService;
import com.dass.core.util.DataBag;
import com.dass.core.util.QueryCriteria;
import com.dass.core.util.UserConfig;
import com.dass.pawning.domain.DueType;
public interface DueTypeService extends AuthorizableService{
public void createDueType(UserConfig userConfig,DueType dueType)throws PawnException;
public void updateDueType(UserConfig userConfig,DueType dueType)throws PawnException;
public void removeDueType(UserConfig userConfig,DueType dueType)throws PawnException;
public DueType getDueTypeById(UserConfig userConfig,int recordId)throws PawnException;
public DueType getDueTypeByCode(UserConfig userConfig,String code)throws PawnException;
public DataBag getAllDueType(UserConfig userConfig,List<QueryCriteria> criteriaList)throws PawnException;
}
| [
"Administrator@modular4.com"
] | Administrator@modular4.com |
43bc85cb15f55ab49352ab6e2ffc9550ba5a5c72 | 39f0a89af57dd00a1a14ac1f7a1b9e8737ba3d7c | /src/main/java/com/thinkgem/jeesite/modules/bisai/util/ResultUtils.java | 949013bd8de3c7549a067fab52bf01da52ac292c | [] | no_license | xiaofeng68/bisai | a6d613453fc6ad4c34327f94f8bbbbf825f106bf | f6f91d5f8e04017e67fc57a66968b605e7c5d0d3 | refs/heads/master | 2021-01-09T05:55:18.497822 | 2017-07-04T15:17:46 | 2017-07-04T15:17:46 | 80,836,557 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.thinkgem.jeesite.modules.bisai.util;
public class ResultUtils {
public static String numToUpper(Integer num) {
// String u[] = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
String u[] = { "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
char[] str = String.valueOf(num).toCharArray();
String rstr = "";
for (int i = 0; i < str.length; i++) {
rstr = rstr + u[Integer.parseInt(str[i] + "")];
}
return rstr;
}
}
| [
"yu_qhai@LAPTOP-GE69N6QJ"
] | yu_qhai@LAPTOP-GE69N6QJ |
b9341a7352bc01d8e40495055208d3b72708ce7a | ed106b9bb9747cc892fd5220d6142cb7ee18a78b | /app/src/main/java/com/example/laughingmn/picscan/PhotoActivity.java | 24ef62400dd093df63425f65d71c31990103f840 | [
"Apache-2.0"
] | permissive | licijit/Picscan | 117465dff96772260fe67d6237ebb8efc5b0671f | 17e580d97c411d4ed2cbeafbcc91d4d513340520 | refs/heads/master | 2020-05-31T21:21:21.107808 | 2017-06-13T13:33:17 | 2017-06-13T13:33:17 | 94,048,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,467 | java | package com.example.laughingmn.picscan;
import android.content.Context;
import android.graphics.Point;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.View;
import com.example.laughingmn.picscan.R;
import com.example.laughingmn.picscan.other.Profile;
import com.example.laughingmn.picscan.other.TinderCard;
import com.example.laughingmn.picscan.other.Utils;
import com.mindorks.placeholderview.SwipeDecor;
import com.mindorks.placeholderview.SwipePlaceHolderView;
/**
* Created by laughingmn on 2/5/17.
*/
public class PhotoActivity extends AppCompatActivity {
private SwipePlaceHolderView mSwipeView;
private Context mContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photos);
mSwipeView = (SwipePlaceHolderView)findViewById(R.id.swipeView);
mContext = getApplicationContext();
int bottomMargin = Utils.dpToPx(5);
Point windowSize = Utils.getDisplaySize(getWindowManager());
mSwipeView.getBuilder()
.setDisplayViewCount(3)
.setHeightSwipeDistFactor(10)
.setWidthSwipeDistFactor(5)
.setSwipeDecor(new SwipeDecor()
.setViewWidth(windowSize.x)
.setViewHeight(windowSize.y - bottomMargin)
.setViewGravity(Gravity.TOP)
.setPaddingTop(20)
.setRelativeScale(0.01f)
.setSwipeInMsgLayoutId(R.layout.tinder_swipe_in_msg_view)
.setSwipeOutMsgLayoutId(R.layout.tinder_swipe_out_msg_view));
for(Profile profile : Utils.loadProfiles(this.getApplicationContext())){
mSwipeView.addView(new TinderCard(mContext, profile, mSwipeView));
}
// findViewById(R.id.rejectBtn).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// mSwipeView.doSwipe(false);
// }
// });
//
// findViewById(R.id.acceptBtn).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// mSwipeView.doSwipe(true);
// }
// });
}
public void onBackPressed(){
this.finish();
}
}
| [
"luckydas.51@gmail.com"
] | luckydas.51@gmail.com |
b6a0319c28317bfa2d373d1e69ef91ce3d5843f7 | fb5c005b1357510d8f41d1b80a434b8eb7569d23 | /src/main/java/com/neuqsoft/config/SwaggerConfig.java | 5e157459b21a94a9394251c30f6480ba78081bdb | [
"Apache-2.0"
] | permissive | zhangxueg/db-back | 2d3739e55593a753339f95ab3eef66cf6afa4658 | 9a8cb787021f68195d8b4f5b34cdaa7b54c048fb | refs/heads/main | 2023-02-10T02:09:32.303558 | 2021-01-05T01:49:48 | 2021-01-05T01:49:48 | 325,709,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package com.neuqsoft.config;
import com.neuqsoft.common.config.BaseSwaggerConfig;
import com.neuqsoft.common.domain.SwaggerProperties;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger API文档相关配置
* Created by macro on 2018/4/26.
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.neuqsoft.modules")
.title("mall-tiny项目骨架")
.description("mall-tiny项目骨架相关接口文档")
.contactName("macro")
.version("1.0")
.enableSecurity(true)
.build();
}
}
| [
"577516964@qq.com"
] | 577516964@qq.com |
22f55d5a53b671b77eacfc10cbac8e9fedf858c6 | 193b758dd2aebac01edd6cee9dc4ac97febc09fa | /src/main/java/com/ricardojlrufino/eventbus/EventMessage.java | 920807398349686933cda74de15594f5a94aa1db | [
"MIT"
] | permissive | ricardojlrufino/eventbus4j | 3127ed38b137baef8dba7f50500ef11fc218d906 | a663b9c06eb23fd6bce412754cce20e2ca9bca91 | refs/heads/master | 2022-12-31T23:02:14.653040 | 2020-05-21T02:40:44 | 2020-05-21T02:41:10 | 265,714,366 | 0 | 0 | MIT | 2020-10-13T22:09:29 | 2020-05-21T00:17:55 | Java | UTF-8 | Java | false | false | 184 | java | package com.ricardojlrufino.eventbus;
/**
* A Event is an object with a specific type that is associated to a specific {@link
* EventHandler}.
*/
public interface EventMessage {
} | [
"ricardo.jl.rufino@gmail.com"
] | ricardo.jl.rufino@gmail.com |
8217d567cb29173897842c9b32b5b95be8eb03f5 | fb7d48d6a28765a2d17f5a5a33976afb17efbaa7 | /springbootwebtest004/src/test/java/com/springbootwebtest004/Springbootwebtest004ApplicationTests.java | b2ff6a7712b99871c1b33a9c9603aad9d67b936a | [] | no_license | wangzhen4444/SpringBootWebTest | 94e6adbc164915559260f45eb849ef201eee7cb3 | d94026800b7cd38765ea75dda865d3d09149bec1 | refs/heads/master | 2020-03-06T21:35:26.331068 | 2018-04-24T13:23:31 | 2018-04-24T13:23:31 | 127,081,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.springbootwebtest004;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class Springbootwebtest004ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"911898654@qq.com"
] | 911898654@qq.com |
ab07c17c3e2a98ad15a48b5f18f9a2f230146325 | 1b9cc8b79652a27f01172a11cc2115d59cad737f | /AWT/client/view/LoginForm.java | 95333dd13b01c26b0a5b156e2d1974804db38475 | [] | no_license | Ignorant-Instigator/Maze | 0d1e6eec13e3ad2464908402c594697d7354abf7 | 629942e9fe4a052949ab5dc27b7491b03188820e | refs/heads/master | 2021-01-22T06:45:25.843527 | 2014-08-09T17:25:06 | 2014-08-09T17:27:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package view;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class LoginForm extends JComponent {
private JTextField name;
private JLabel label;
public LoginForm() {
setFrame();
}
private void setFrame() {
label = new JLabel("Input your name and press enter");
name = new JTextField(20);
setBackground(Color.GRAY);
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 1;
c.gridy = 1;
add(label, c);
c.gridy = 2;
add(name, c);
}
public JTextField getInput() {
return name;
}
public String getText() {
return name.getText();
}
}
| [
"ignorant.instigator@gmail.com"
] | ignorant.instigator@gmail.com |
20429751fb3a32eea04b14850df8909ea8d28101 | d8fc463723be100d29ac297961a21695c037f562 | /bunnies-core/src/main/java/de/oetting/bumpingbunnies/core/input/InputService.java | 5175406b3e3b6559d599b49d7ac7c50127df0756 | [] | no_license | hinnerkoetting/bumpingbunnies | 994ccb082394f0316829109a10eaaec8cfeb3f0f | 3bc9a554904816d492d4c61209f3f6365b9ca324 | refs/heads/master | 2021-01-01T17:48:27.834179 | 2016-01-31T14:14:52 | 2016-01-31T14:14:52 | 35,323,680 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package de.oetting.bumpingbunnies.core.input;
public interface InputService {
}
| [
"hinnerk.oetting@gmail.com"
] | hinnerk.oetting@gmail.com |
7239c20cdf6ef72392301e59578b1ffaeca57ab8 | 2808e509c2177879241f29e61c6f4e5653237f1d | /src/com/sandbox/EnumCycleTest.java | 11ecfe43a1ffef80cbaa0d0152a77112c670c97c | [] | no_license | rfnunes/docker | bd8fbb55ef44b68f86b3b5ec281ed82e34c1f29c | d24cf91a6f8af8299686793a606db63c50c296b2 | refs/heads/master | 2021-05-04T23:10:58.833774 | 2018-01-24T22:26:36 | 2018-01-24T22:26:36 | 120,085,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | /*
* Copyright (C) Coriant
* The reproduction, transmission or use of this document or its contents
* is not permitted without express written authorization.
* Offenders will be liable for damages.
* All rights, including rights created by patent grant or
* registration of a utility model or design, are reserved.
* Modifications made to this document are restricted to authorized personnel only.
* Technical specifications and features are binding only when specifically
* and expressly agreed upon in a written contract.
*
*/
package com.ossnms.sandbox;
import java.util.EnumSet;
import java.util.Set;
/**
* Created by pt102933 on 8/2/2017.
*/
public class EnumCycleTest {
enum MyEnum { A, B, C }
private static final Set<MyEnum> set = EnumSet.allOf(MyEnum.class);
public static void main(String[] args) {
new EnumCycleTest().go();
}
private void go() {
long tStart = System.currentTimeMillis();
check(MyEnum.C);
long tEnd = System.currentTimeMillis();
long tDelta = tEnd - tStart;
//double elapsedSeconds = tDelta / 1000.0;
System.out.println(tDelta);
}
private boolean check(MyEnum c) {
//return set.contains(c);
return c == MyEnum.A || c == MyEnum.B || c == MyEnum.C;
}
}
| [
"ricardo.nunes@coriant.com"
] | ricardo.nunes@coriant.com |
a44ddab44e18f8aec3d35d0299359bbf8637933e | 258a8585ed637342645b56ab76a90a1256ecbb45 | /Folitics/src/main/java/com/ohmuk/folitics/hibernate/repository/verdict/global/GlobalVerdictReligionDistributionRepository.java | 2b5cb238055f4b6c38eafdab90c9d43c88e44a7e | [] | no_license | exatip407/folitics | 06e899aae2dbfdeda981c40c0ce578d223979568 | aff3392e09c35f5f799e3fb1c4534b5343a22f01 | refs/heads/master | 2021-01-01T16:23:14.684470 | 2017-07-20T10:27:08 | 2017-07-20T10:27:08 | 97,819,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,194 | java | package com.ohmuk.folitics.hibernate.repository.verdict.global;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import com.ohmuk.folitics.hibernate.entity.verdict.global.GlobalVerdictReligionDistribution;
import com.ohmuk.folitics.hibernate.entity.verdict.lookup.Religion;
/**
* Repository implementation for {@link GlobalVerdictReligionDistribution}
*
* @author Abhishek
*
*/
@Component
@Repository
public class GlobalVerdictReligionDistributionRepository
implements
IGlobalVerdictDistributionRepository<GlobalVerdictReligionDistribution, Religion> {
private static Logger logger = LoggerFactory
.getLogger(GlobalVerdictReligionDistributionRepository.class);
@Autowired
private SessionFactory sessionFactory;
private Session getSession() {
return sessionFactory.getCurrentSession();
}
@Override
public GlobalVerdictReligionDistribution save(
GlobalVerdictReligionDistribution globalVerdictReligionDistribution) {
logger.debug("Entered GlobalVerdictReligionDistributionRepository save method");
logger.debug("Trying to save GlobalVerdictReligionDistribution for Religion id = "
+ globalVerdictReligionDistribution.getReligion().getId());
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.save(globalVerdictReligionDistribution);
logger.debug("Saved GlobalVerdictReligionDistribution object and got id = "
+ globalVerdictReligionDistribution.getReligion().getId()
+ " and now getting GlobalVerdictReligionDistribution object from database");
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class,
globalVerdictReligionDistribution.getReligion().getId());
logger.debug("Got GlobalVerdictReligionDistribution object from database. Exiting GlobalVerdictReligionDistributionRepository save method");
return globalVerdictReligionDistribution;
}
@Override
public GlobalVerdictReligionDistribution find(Religion religion) {
logger.debug("Entered GlobalVerdictReligionDistributionRepository find method");
logger.debug("Trying to get GlobalVerdictReligionDistribution with id = "
+ religion.getId());
GlobalVerdictReligionDistribution globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class, religion.getId());
logger.debug("Got GlobalVerdictReligionDistribution object from database. Exiting GlobalVerdictReligionDistributionRepository find method");
return globalVerdictReligionDistribution;
}
@Override
public List<GlobalVerdictReligionDistribution> findAll() {
logger.debug("Entered GlobalVerdictReligionDistributionRepository findAll method");
logger.debug("Trying to get all GlobalVerdictReligionDistribution");
Criteria selectAllCriteria = getSession().createCriteria(
GlobalVerdictReligionDistribution.class);
@SuppressWarnings("unchecked")
List<GlobalVerdictReligionDistribution> globalVerdictReligionDistributions = selectAllCriteria
.list();
logger.debug("Got all GlobalVerdictReligionDistribution objects from database. Exiting GlobalVerdictReligionDistributionRepository findAll method");
return globalVerdictReligionDistributions;
}
@Override
public GlobalVerdictReligionDistribution update(
GlobalVerdictReligionDistribution globalVerdictReligionDistribution) {
logger.debug("Entered GlobalVerdictReligionDistributionRepository update method");
logger.debug("Merging the object first with id = "
+ globalVerdictReligionDistribution.getReligion().getId());
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.merge(globalVerdictReligionDistribution);
logger.debug("Now updating the GlobalVerdictReligionDistribution object in database with id = "
+ globalVerdictReligionDistribution.getReligion().getId());
getSession().update(globalVerdictReligionDistribution);
logger.debug("Getting the GlobalVerdictReligionDistribution object from database");
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class,
globalVerdictReligionDistribution.getReligion().getId());
logger.debug("Got GlobalVerdictReligionDistribution object from database. Exiting GlobalVerdictReligionDistributionRepository update method");
return globalVerdictReligionDistribution;
}
@Override
public boolean deleteById(Religion religion) {
logger.debug("Entered GlobalVerdictReligionDistributionRepository deleteById method");
logger.debug("Trying to get GlobalVerdictReligionDistribution with id = "
+ religion.getId());
GlobalVerdictReligionDistribution globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class, religion);
logger.debug("Now trying to delete the GlobalVerdictReligionDistribution object with id = "
+ globalVerdictReligionDistribution.getReligion().getId());
getSession().delete(globalVerdictReligionDistribution);
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class, religion.getId());
if (globalVerdictReligionDistribution == null) {
logger.debug("Deleted GlobalVerdictReligionDistribution object from database. Exiting GlobalVerdictReligionDistributionRepository deleteById method");
return true;
} else {
return false;
}
}
@Override
public boolean delete(
GlobalVerdictReligionDistribution globalVerdictReligionDistribution) {
logger.debug("Entered GlobalVerdictReligionDistributionRepository delete method");
logger.debug("Trying to get GlobalVerdictReligionDistribution with id = "
+ globalVerdictReligionDistribution.getReligion().getId());
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class,
globalVerdictReligionDistribution.getReligion().getId());
logger.debug("Now trying to delete the GlobalVerdictReligionDistribution object with id = "
+ globalVerdictReligionDistribution.getReligion().getId());
getSession().delete(globalVerdictReligionDistribution);
globalVerdictReligionDistribution = (GlobalVerdictReligionDistribution) getSession()
.get(GlobalVerdictReligionDistribution.class,
globalVerdictReligionDistribution.getReligion().getId());
if (globalVerdictReligionDistribution == null) {
logger.debug("Deleted GlobalVerdictReligionDistribution object from database. Exiting GlobalVerdictReligionDistributionRepository deleteById method");
return true;
} else {
return false;
}
}
}
| [
"gautam@exatip.com"
] | gautam@exatip.com |
6c83a02d313caac196f55550a5988a98ae6192d6 | c2d8181a8e634979da48dc934b773788f09ffafb | /storyteller/output/mazdasalestool/GrepExhibitionReportUsedOnVisitmotivationintroductionAction.java | ec127ab23f547e76c9144ca3ec46504200e12ac0 | [] | no_license | toukubo/storyteller | ccb8281cdc17b87758e2607252d2d3c877ffe40c | 6128b8d275efbf18fd26d617c8503a6e922c602d | refs/heads/master | 2021-05-03T16:30:14.533638 | 2016-04-20T12:52:46 | 2016-04-20T12:52:46 | 9,352,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,597 | java | package net.mazdasalestool.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.mazdasalestool.model.*;
import net.mazdasalestool.model.crud.*;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.web.context.support.WebApplicationContextUtils;
import net.enclosing.util.HibernateSession;
public class GrepExhibitionReportUsedOnVisitmotivationintroductionAction extends Action{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) throws Exception{
Session session = new HibernateSession().currentSession(this
.getServlet().getServletContext());
Criteria criteria = session.createCriteria(ExhibitionReportUsed.class);
if(req.getParameter("q") !=null && !req.getParameter("q").equals("")){
criteria.add(Restrictions.like("visitmotivationintroduction","%" + new String(req.getParameter("q").getBytes("8859_1"), "UTF-8") + "%"));
}
session.flush();
req.setAttribute("intrausers", criteria.list());
req.setAttribute("from","GrepExhibitionReportUsedOnVisitmotivationintroduction");
return mapping.findForward("success");
}
} | [
"toukubo@gmail.com"
] | toukubo@gmail.com |
6f23dd1ca8a0709722c86036204159488a3f8832 | 4548e4f32e28b7d584f7ece89335eb7e60a01d5c | /app/src/main/java/com/prakash/androidcodeshop/myknowledgebase/activities/ContentDisplayCH2Activity.java | 2c75d6214e4563fc58dc87a1fa304e650e470ea1 | [] | no_license | Prakash172/MyKnowledgeBase | 8f80011d135723fd2d3647efa7af8d468388ee03 | 1445ae92ea29833ecaef65471cada7e945fa31b3 | refs/heads/master | 2020-04-26T12:32:30.064683 | 2019-03-03T09:09:19 | 2019-03-03T09:09:19 | 173,553,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,456 | java | package com.prakash.androidcodeshop.myknowledgebase.activities;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import com.prakash.androidcodeshop.myknowledgebase.R;
import com.prakash.androidcodeshop.myknowledgebase.codestrings.ChapterTwo;
public class ContentDisplayCH2Activity extends AppCompatActivity {
private Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_content_display_ch2);
intent = new Intent(this, CodeDisplayDialogActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
ImageButton textView = findViewById(R.id.textview_ib);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "textView");
startActivity(intent);
}
});
ImageButton textViewBold = findViewById(R.id.textviewbold_ib);
textViewBold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "textViewBold");
startActivity(intent);
}
});
ImageButton textViewItalic = findViewById(R.id.textviewitalic_ib);
textViewItalic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "textViewItalic");
startActivity(intent);
}
});
ImageButton textViewLink = findViewById(R.id.textviewlinkify_ib);
textViewLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "textWithLink");
startActivity(intent);
}
});
ImageButton textViewLetterSpacing = findViewById(R.id.tvw_lineSpacing_and_padding_ib);
textViewLetterSpacing.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "textViewLetterSpacing");
startActivity(intent);
}
});
ImageButton editTextName = findViewById(R.id.edittext_name);
editTextName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "editTextName");
startActivity(intent);
}
});
ImageButton editTextPassword = findViewById(R.id.edittext_password);
editTextPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "editTextPassword");
startActivity(intent);
}
});
ImageButton editTextPhone = findViewById(R.id.edittext_phone);
editTextPhone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.putExtra("code", "editTextPhone");
startActivity(intent);
}
});
}
}
| [
"electrophile172@gmail.com"
] | electrophile172@gmail.com |
2061e112b686421d8d4b70f90977509ba7171721 | 8f900b6cd74584c8c332fe37fb87814ed7414557 | /GHotel/src/nb/ghotel/util/DateUtil.java | 3f506652422905e0715fb7e1d3a689077110c5db | [] | no_license | lzrabbit/Java | dd33147eaa20f41d0d8c51fbbce267d161a44c7c | d3df2143a4f25c211e7e076b3ac9fa510d6a98d4 | refs/heads/master | 2021-01-22T13:08:25.060495 | 2014-02-17T13:04:49 | 2014-02-17T13:04:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,225 | java | package nb.ghotel.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public abstract class DateUtil {
public static Date parse(String source) {
String pattern = "yyyy-MM-dd";
if (source.contains(":")) {
pattern += " HH:mm:ss";
}
return parse(source, pattern);
}
public static Date parse(String source, String pattern) {
SimpleDateFormat format = new SimpleDateFormat(pattern);
try {
return format.parse(source);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
public static Date parse(int year, int month, int day) {
return Parse(year, month, day, 0, 0, 0);
}
public static Date Parse(int year, int month, int day, int hour,
int minute, int second) {
String source = String.format("%s-%s-%s %s:%s:%s", year,
month < 10 ? "0" + month : month, day < 10 ? "0" + day : day,
hour < 10 ? "0" + hour : hour, minute < 10 ? "0" + minute
: minute, second < 10 ? "0" + second : second);
return parse(source);
}
public static Date now() {
return new Date();
}
public static Date today() {
return new Date();
}
}
| [
"lzrabbit@126.com"
] | lzrabbit@126.com |
8e1ce305608879b16dc5a1060d0eca9e77da93e0 | 9c4b0ea5236a1431af4f3ef7b9cf575d7c5f65e7 | /HeroStatsActivity.java | 70433882a896d3029ac397c50c513f6902b1cfe0 | [] | no_license | javiertok99/DemoExplicitIntent | 2625b0e3608710a9b661e8cdb8c87159789889cb | 3545fdfced06707966363a27dd13a9be4a831d8c | refs/heads/master | 2020-03-15T23:50:18.550042 | 2018-05-07T06:18:33 | 2018-05-07T06:18:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,551 | java | package com.example.a16022934.demoexplicitintent;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class HeroStatsActivity extends AppCompatActivity {
TextView tvName, tvStrength, tvTechnicalProwess;
Button btnLike, btnDislike;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hero_stats);
// Get the intent
Intent i = getIntent();
// Get the Hero object first activity put in Intent
Hero hero = (Hero) i.getSerializableExtra("hero");
tvName = (TextView) findViewById(R.id.textViewName);
tvStrength = (TextView)findViewById(R.id.textViewStrength);
tvTechnicalProwess = (TextView)findViewById(R.id.textViewTechnicalProwess);
btnLike = (Button) findViewById(R.id.buttonLike);
btnDislike = (Button) findViewById(R.id.buttonDislike);
// Use getters of Hero object to get the attributes
tvName.setText(hero.getName());
tvStrength.setText("Strength: " + hero.getStrength());
tvTechnicalProwess.setText("Technical: " + hero.getTechnicalProwess());
// When button Like is clicked, set the results
// accordingly and finish() to close this act.
btnLike.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0) {
// Create intent & pass in String data
Intent i = new Intent();
i.putExtra("like", "like");
// Set result to RESULT_OK to indicate normal // response and pass in the intent containing the // like
setResult(RESULT_OK, i);
finish();
}});
// When button Dislike is clicked, set the results
// accordingly and finish() to close this activity
btnDislike.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0) {
//Create intent & pass in String data
Intent i = new Intent();
i.putExtra("like", "dislike");
// Set result to RESULT_OK to indicate normal
// response and pass in the intent containing the
// dislike
setResult(RESULT_OK, i);
finish();
}});
}
}
| [
"16022934@myrp.edu.sg"
] | 16022934@myrp.edu.sg |
6020ca250f91071e0dcd2ab1f7d266f7dec9ec14 | 1b949586c8feb0fb5230382fa8501850893950b1 | /fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositProductData.java | ea936104dc63ddbbfe1cd5926c91f8e2707472f4 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"LicenseRef-scancode-public-domain",
"CDDL-1.1",
"LicenseRef-scancode-free-unknown",
"EPL-1.0",
"Classpath-exception-2.0",
"GPL-2.0-only"
] | permissive | cjxonix/fineractapp | 44d3a66cf9eddc99bfa3d8f5697797bc855f8e46 | b711fb2d142f5f7ecc39448fa868cc0542084328 | refs/heads/master | 2022-06-19T11:52:56.167338 | 2020-04-06T05:37:37 | 2020-04-06T05:37:37 | 253,395,889 | 0 | 0 | Apache-2.0 | 2022-06-03T02:18:38 | 2020-04-06T04:39:14 | Java | UTF-8 | Java | false | false | 32,614 | 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.fineract.portfolio.savings.data;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
import org.apache.fineract.accounting.producttoaccountmapping.data.PaymentTypeToGLAccountMapper;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.portfolio.charge.data.ChargeData;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartData;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
/**
* Immutable data object representing a Fixed Deposit product.
*/
public class FixedDepositProductData extends DepositProductData {
// additional fields
private boolean preClosurePenalApplicable;
protected BigDecimal preClosurePenalInterest;
protected EnumOptionData preClosurePenalInterestOnType;
protected Integer minDepositTerm;
protected Integer maxDepositTerm;
private EnumOptionData minDepositTermType;
private EnumOptionData maxDepositTermType;
protected Integer inMultiplesOfDepositTerm;
protected EnumOptionData inMultiplesOfDepositTermType;
protected BigDecimal minDepositAmount;
protected BigDecimal depositAmount;
protected BigDecimal maxDepositAmount;
private Collection<EnumOptionData> preClosurePenalInterestOnTypeOptions;
private Collection<EnumOptionData> periodFrequencyTypeOptions;
public static FixedDepositProductData template(final CurrencyData currency, final EnumOptionData interestCompoundingPeriodType,
final EnumOptionData interestPostingPeriodType, final EnumOptionData interestCalculationType,
final EnumOptionData interestCalculationDaysInYearType, final EnumOptionData accountingRule,
final Collection<CurrencyData> currencyOptions, final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions,
final Collection<EnumOptionData> interestPostingPeriodTypeOptions,
final Collection<EnumOptionData> interestCalculationTypeOptions,
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions,
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions,
final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions,
final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> chargeOptions,
final Collection<ChargeData> penaltyOptions, final InterestRateChartData chartTemplate,
final Collection<EnumOptionData> preClosurePenalInterestOnTypeOptions,
final Collection<EnumOptionData> periodFrequencyTypeOptions, final Collection<TaxGroupData> taxGroupOptions) {
final Long id = null;
final String name = null;
final String shortName = null;
final String description = null;
final BigDecimal nominalAnnualInterestRate = null;
final Integer lockinPeriodFrequency = null;
final EnumOptionData lockinPeriodFrequencyType = null;
final BigDecimal minBalanceForInterestCalculation = null;
final Map<String, Object> accountingMappings = null;
final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings = null;
final Collection<ChargeData> charges = null;
final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings = null;
final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings = null;
final Collection<InterestRateChartData> interestRateCharts = null;
final boolean preClosurePenalApplicable = false;
final BigDecimal preClosurePenalInterest = null;
final EnumOptionData preClosurePenalInterestOnType = null;
final Integer minDepositTerm = null;
final Integer maxDepositTerm = null;
final EnumOptionData minDepositTermType = null;
final EnumOptionData maxDepositTermType = null;
final Integer inMultiplesOfDepositTerm = null;
final EnumOptionData inMultiplesOfDepositTermType = null;
final BigDecimal minDepositAmount = null;
final BigDecimal depositAmount = null;
final BigDecimal maxDepositAmount = null;
final boolean withHoldTax = false;
final TaxGroupData taxGroup = null;
return new FixedDepositProductData(id, name, shortName, description, currency, nominalAnnualInterestRate,
interestCompoundingPeriodType, interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType,
lockinPeriodFrequency, lockinPeriodFrequencyType, minBalanceForInterestCalculation, accountingRule, accountingMappings,
paymentChannelToFundSourceMappings, currencyOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions,
accountingMappingOptions, charges, chargeOptions, penaltyOptions, feeToIncomeAccountMappings,
penaltyToIncomeAccountMappings, interestRateCharts, chartTemplate, preClosurePenalApplicable, preClosurePenalInterest,
preClosurePenalInterestOnType, preClosurePenalInterestOnTypeOptions, minDepositTerm, maxDepositTerm, minDepositTermType,
maxDepositTermType, inMultiplesOfDepositTerm, inMultiplesOfDepositTermType, minDepositAmount, depositAmount,
maxDepositAmount, periodFrequencyTypeOptions, withHoldTax, taxGroup, taxGroupOptions);
}
public static FixedDepositProductData withCharges(final FixedDepositProductData existingProduct, final Collection<ChargeData> charges) {
return new FixedDepositProductData(existingProduct.id, existingProduct.name, existingProduct.shortName,
existingProduct.description, existingProduct.currency, existingProduct.nominalAnnualInterestRate,
existingProduct.interestCompoundingPeriodType, existingProduct.interestPostingPeriodType,
existingProduct.interestCalculationType, existingProduct.interestCalculationDaysInYearType,
existingProduct.lockinPeriodFrequency, existingProduct.lockinPeriodFrequencyType,
existingProduct.minBalanceForInterestCalculation, existingProduct.accountingRule, existingProduct.accountingMappings,
existingProduct.paymentChannelToFundSourceMappings, existingProduct.currencyOptions,
existingProduct.interestCompoundingPeriodTypeOptions, existingProduct.interestPostingPeriodTypeOptions,
existingProduct.interestCalculationTypeOptions, existingProduct.interestCalculationDaysInYearTypeOptions,
existingProduct.lockinPeriodFrequencyTypeOptions, existingProduct.withdrawalFeeTypeOptions,
existingProduct.paymentTypeOptions, existingProduct.accountingRuleOptions, existingProduct.accountingMappingOptions,
charges, existingProduct.chargeOptions, existingProduct.penaltyOptions, existingProduct.feeToIncomeAccountMappings,
existingProduct.penaltyToIncomeAccountMappings, existingProduct.interestRateCharts, existingProduct.chartTemplate,
existingProduct.preClosurePenalApplicable, existingProduct.preClosurePenalInterest,
existingProduct.preClosurePenalInterestOnType, existingProduct.preClosurePenalInterestOnTypeOptions,
existingProduct.minDepositTerm, existingProduct.maxDepositTerm, existingProduct.minDepositTermType,
existingProduct.maxDepositTermType, existingProduct.inMultiplesOfDepositTerm, existingProduct.inMultiplesOfDepositTermType,
existingProduct.minDepositAmount, existingProduct.depositAmount, existingProduct.maxDepositAmount,
existingProduct.periodFrequencyTypeOptions, existingProduct.withHoldTax, existingProduct.taxGroup,
existingProduct.taxGroupOptions);
}
/**
* Returns a {@link FixedDepositProductData} that contains and exist
* {@link FixedDepositProductData} data with further template data for
* dropdowns.
*
* @param taxGroupOptions
* TODO
*/
public static FixedDepositProductData withTemplate(final FixedDepositProductData existingProduct,
final Collection<CurrencyData> currencyOptions, final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions,
final Collection<EnumOptionData> interestPostingPeriodTypeOptions,
final Collection<EnumOptionData> interestCalculationTypeOptions,
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions,
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions,
final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions,
final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> chargeOptions,
final Collection<ChargeData> penaltyOptions, final InterestRateChartData chartTemplate,
final Collection<EnumOptionData> preClosurePenalInterestOnTypeOptions,
final Collection<EnumOptionData> periodFrequencyTypeOptions, final Collection<TaxGroupData> taxGroupOptions) {
return new FixedDepositProductData(existingProduct.id, existingProduct.name, existingProduct.shortName,
existingProduct.description, existingProduct.currency, existingProduct.nominalAnnualInterestRate,
existingProduct.interestCompoundingPeriodType, existingProduct.interestPostingPeriodType,
existingProduct.interestCalculationType, existingProduct.interestCalculationDaysInYearType,
existingProduct.lockinPeriodFrequency, existingProduct.lockinPeriodFrequencyType,
existingProduct.minBalanceForInterestCalculation, existingProduct.accountingRule, existingProduct.accountingMappings,
existingProduct.paymentChannelToFundSourceMappings, currencyOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions,
accountingMappingOptions, existingProduct.charges, chargeOptions, penaltyOptions,
existingProduct.feeToIncomeAccountMappings, existingProduct.penaltyToIncomeAccountMappings,
existingProduct.interestRateCharts, chartTemplate, existingProduct.preClosurePenalApplicable,
existingProduct.preClosurePenalInterest, existingProduct.preClosurePenalInterestOnType,
preClosurePenalInterestOnTypeOptions, existingProduct.minDepositTerm, existingProduct.maxDepositTerm,
existingProduct.minDepositTermType, existingProduct.maxDepositTermType, existingProduct.inMultiplesOfDepositTerm,
existingProduct.inMultiplesOfDepositTermType, existingProduct.minDepositAmount, existingProduct.depositAmount,
existingProduct.maxDepositAmount, periodFrequencyTypeOptions, existingProduct.withHoldTax, existingProduct.taxGroup,
taxGroupOptions);
}
public static FixedDepositProductData withAccountingDetails(final FixedDepositProductData existingProduct,
final Map<String, Object> accountingMappings,
final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings,
final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings,
final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings) {
final Collection<CurrencyData> currencyOptions = null;
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestPostingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestCalculationTypeOptions = null;
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions = null;
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions = null;
final Collection<EnumOptionData> withdrawalFeeTypeOptions = null;
final Collection<PaymentTypeData> paymentTypeOptions = null;
final Collection<EnumOptionData> accountingRuleOptions = null;
final Map<String, List<GLAccountData>> accountingMappingOptions = null;
final Collection<ChargeData> chargeOptions = null;
final Collection<ChargeData> penaltyOptions = null;
return new FixedDepositProductData(existingProduct.id, existingProduct.name, existingProduct.shortName,
existingProduct.description, existingProduct.currency, existingProduct.nominalAnnualInterestRate,
existingProduct.interestCompoundingPeriodType, existingProduct.interestPostingPeriodType,
existingProduct.interestCalculationType, existingProduct.interestCalculationDaysInYearType,
existingProduct.lockinPeriodFrequency, existingProduct.lockinPeriodFrequencyType,
existingProduct.minBalanceForInterestCalculation, existingProduct.accountingRule, accountingMappings,
paymentChannelToFundSourceMappings, currencyOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions,
accountingMappingOptions, existingProduct.charges, chargeOptions, penaltyOptions, feeToIncomeAccountMappings,
penaltyToIncomeAccountMappings, existingProduct.interestRateCharts, existingProduct.chartTemplate,
existingProduct.preClosurePenalApplicable, existingProduct.preClosurePenalInterest,
existingProduct.preClosurePenalInterestOnType, existingProduct.preClosurePenalInterestOnTypeOptions,
existingProduct.minDepositTerm, existingProduct.maxDepositTerm, existingProduct.minDepositTermType,
existingProduct.maxDepositTermType, existingProduct.inMultiplesOfDepositTerm, existingProduct.inMultiplesOfDepositTermType,
existingProduct.minDepositAmount, existingProduct.depositAmount, existingProduct.maxDepositAmount,
existingProduct.periodFrequencyTypeOptions, existingProduct.withHoldTax, existingProduct.taxGroup,
existingProduct.taxGroupOptions);
}
public static FixedDepositProductData instance(final DepositProductData depositProductData, final boolean preClosurePenalApplicable,
final BigDecimal preClosurePenalInterest, final EnumOptionData preClosurePenalInterestOnType, final Integer minDepositTerm,
final Integer maxDepositTerm, final EnumOptionData minDepositTermType, final EnumOptionData maxDepositTermType,
final Integer inMultiplesOfDepositTerm, final EnumOptionData inMultiplesOfDepositTermType, final BigDecimal minDepositAmount,
final BigDecimal depositAmount, final BigDecimal maxDepositAmount) {
final Map<String, Object> accountingMappings = null;
final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings = null;
final Collection<CurrencyData> currencyOptions = null;
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestPostingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestCalculationTypeOptions = null;
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions = null;
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions = null;
final Collection<EnumOptionData> withdrawalFeeTypeOptions = null;
final Collection<PaymentTypeData> paymentTypeOptions = null;
final Collection<EnumOptionData> accountingRuleOptions = null;
final Map<String, List<GLAccountData>> accountingMappingOptions = null;
final Collection<ChargeData> chargeOptions = null;
final Collection<ChargeData> penaltyOptions = null;
final Collection<ChargeData> charges = null;
final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings = null;
final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings = null;
final Collection<InterestRateChartData> interestRateCharts = null;
final InterestRateChartData chartTemplate = null;
final Collection<EnumOptionData> preClosurePenalInterestOnTypeOptions = null;
final Collection<EnumOptionData> periodFrequencyTypeOptions = null;
final Collection<TaxGroupData> taxGroupOptions = null;
return new FixedDepositProductData(depositProductData.id, depositProductData.name, depositProductData.shortName,
depositProductData.description, depositProductData.currency, depositProductData.nominalAnnualInterestRate,
depositProductData.interestCompoundingPeriodType, depositProductData.interestPostingPeriodType,
depositProductData.interestCalculationType, depositProductData.interestCalculationDaysInYearType,
depositProductData.lockinPeriodFrequency, depositProductData.lockinPeriodFrequencyType,
depositProductData.minBalanceForInterestCalculation, depositProductData.accountingRule, accountingMappings,
paymentChannelToFundSourceMappings, currencyOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions,
accountingMappingOptions, charges, chargeOptions, penaltyOptions, feeToIncomeAccountMappings,
penaltyToIncomeAccountMappings, interestRateCharts, chartTemplate, preClosurePenalApplicable, preClosurePenalInterest,
preClosurePenalInterestOnType, preClosurePenalInterestOnTypeOptions, minDepositTerm, maxDepositTerm, minDepositTermType,
maxDepositTermType, inMultiplesOfDepositTerm, inMultiplesOfDepositTermType, minDepositAmount, depositAmount,
maxDepositAmount, periodFrequencyTypeOptions, depositProductData.withHoldTax, depositProductData.taxGroup, taxGroupOptions);
}
public static FixedDepositProductData lookup(final Long id, final String name) {
final String shortName = null;
final CurrencyData currency = null;
final String description = null;
final BigDecimal nominalAnnualInterestRate = null;
final EnumOptionData interestCompoundingPeriodType = null;
final EnumOptionData interestPostingPeriodType = null;
final EnumOptionData interestCalculationType = null;
final EnumOptionData interestCalculationDaysInYearType = null;
final Integer lockinPeriodFrequency = null;
final EnumOptionData lockinPeriodFrequencyType = null;
final BigDecimal minBalanceForInterestCalculation = null;
final EnumOptionData accountingType = null;
final Map<String, Object> accountingMappings = null;
final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings = null;
final Collection<CurrencyData> currencyOptions = null;
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestPostingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestCalculationTypeOptions = null;
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions = null;
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions = null;
final Collection<EnumOptionData> withdrawalFeeTypeOptions = null;
final Collection<PaymentTypeData> paymentTypeOptions = null;
final Collection<EnumOptionData> accountingRuleOptions = null;
final Map<String, List<GLAccountData>> accountingMappingOptions = null;
final Collection<ChargeData> charges = null;
final Collection<ChargeData> chargeOptions = null;
final Collection<ChargeData> penaltyOptions = null;
final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings = null;
final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings = null;
final Collection<InterestRateChartData> interestRateCharts = null;
final InterestRateChartData chartTemplate = null;
final boolean preClosurePenalApplicable = false;
final BigDecimal preClosurePenalInterest = null;
final EnumOptionData preClosurePenalInterestOnType = null;
final Collection<EnumOptionData> preClosurePenalInterestOnTypeOptions = null;
final Integer minDepositTerm = null;
final Integer maxDepositTerm = null;
final EnumOptionData minDepositTermType = null;
final EnumOptionData maxDepositTermType = null;
final Integer inMultiplesOfDepositTerm = null;
final EnumOptionData inMultiplesOfDepositTermType = null;
final BigDecimal minDepositAmount = null;
final BigDecimal depositAmount = null;
final BigDecimal maxDepositAmount = null;
final Collection<EnumOptionData> periodFrequencyTypeOptions = null;
final boolean withHoldTax = false;
final TaxGroupData taxGroup = null;
final Collection<TaxGroupData> taxGroupOptions = null;
return new FixedDepositProductData(id, name, shortName, description, currency, nominalAnnualInterestRate,
interestCompoundingPeriodType, interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType,
lockinPeriodFrequency, lockinPeriodFrequencyType, minBalanceForInterestCalculation, accountingType, accountingMappings,
paymentChannelToFundSourceMappings, currencyOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions,
accountingMappingOptions, charges, chargeOptions, penaltyOptions, feeToIncomeAccountMappings,
penaltyToIncomeAccountMappings, interestRateCharts, chartTemplate, preClosurePenalApplicable, preClosurePenalInterest,
preClosurePenalInterestOnType, preClosurePenalInterestOnTypeOptions, minDepositTerm, maxDepositTerm, minDepositTermType,
maxDepositTermType, inMultiplesOfDepositTerm, inMultiplesOfDepositTermType, minDepositAmount, depositAmount,
maxDepositAmount, periodFrequencyTypeOptions, withHoldTax, taxGroup, taxGroupOptions);
}
public static FixedDepositProductData withInterestChart(final FixedDepositProductData existingProduct,
final Collection<InterestRateChartData> interestRateCharts) {
return new FixedDepositProductData(existingProduct.id, existingProduct.name, existingProduct.shortName,
existingProduct.description, existingProduct.currency, existingProduct.nominalAnnualInterestRate,
existingProduct.interestCompoundingPeriodType, existingProduct.interestPostingPeriodType,
existingProduct.interestCalculationType, existingProduct.interestCalculationDaysInYearType,
existingProduct.lockinPeriodFrequency, existingProduct.lockinPeriodFrequencyType,
existingProduct.minBalanceForInterestCalculation, existingProduct.accountingRule, existingProduct.accountingMappings,
existingProduct.paymentChannelToFundSourceMappings, existingProduct.currencyOptions,
existingProduct.interestCompoundingPeriodTypeOptions, existingProduct.interestPostingPeriodTypeOptions,
existingProduct.interestCalculationTypeOptions, existingProduct.interestCalculationDaysInYearTypeOptions,
existingProduct.lockinPeriodFrequencyTypeOptions, existingProduct.withdrawalFeeTypeOptions,
existingProduct.paymentTypeOptions, existingProduct.accountingRuleOptions, existingProduct.accountingMappingOptions,
existingProduct.charges, existingProduct.chargeOptions, existingProduct.penaltyOptions,
existingProduct.feeToIncomeAccountMappings, existingProduct.penaltyToIncomeAccountMappings, interestRateCharts,
existingProduct.chartTemplate, existingProduct.preClosurePenalApplicable, existingProduct.preClosurePenalInterest,
existingProduct.preClosurePenalInterestOnType, existingProduct.preClosurePenalInterestOnTypeOptions,
existingProduct.minDepositTerm, existingProduct.maxDepositTerm, existingProduct.minDepositTermType,
existingProduct.maxDepositTermType, existingProduct.inMultiplesOfDepositTerm, existingProduct.inMultiplesOfDepositTermType,
existingProduct.minDepositAmount, existingProduct.depositAmount, existingProduct.maxDepositAmount,
existingProduct.periodFrequencyTypeOptions, existingProduct.withHoldTax, existingProduct.taxGroup,
existingProduct.taxGroupOptions);
}
private FixedDepositProductData(final Long id, final String name, final String shortName, final String description,
final CurrencyData currency, final BigDecimal nominalAnnualInterestRate, final EnumOptionData interestCompoundingPeriodType,
final EnumOptionData interestPostingPeriodType, final EnumOptionData interestCalculationType,
final EnumOptionData interestCalculationDaysInYearType, final Integer lockinPeriodFrequency,
final EnumOptionData lockinPeriodFrequencyType, final BigDecimal minBalanceForInterestCalculation,
final EnumOptionData accountingType, final Map<String, Object> accountingMappings,
final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings,
final Collection<CurrencyData> currencyOptions, final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions,
final Collection<EnumOptionData> interestPostingPeriodTypeOptions,
final Collection<EnumOptionData> interestCalculationTypeOptions,
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions,
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions,
final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions,
final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> charges,
final Collection<ChargeData> chargeOptions, final Collection<ChargeData> penaltyOptions,
final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings,
final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings,
final Collection<InterestRateChartData> interestRateCharts, final InterestRateChartData chartTemplate,
final boolean preClosurePenalApplicable, final BigDecimal preClosurePenalInterest,
final EnumOptionData preClosurePenalInterestOnType, final Collection<EnumOptionData> preClosurePenalInterestOnTypeOptions,
final Integer minDepositTerm, final Integer maxDepositTerm, final EnumOptionData minDepositTermType,
final EnumOptionData maxDepositTermType, final Integer inMultiplesOfDepositTerm,
final EnumOptionData inMultiplesOfDepositTermType, final BigDecimal minDepositAmount, final BigDecimal depositAmount,
final BigDecimal maxDepositAmount, final Collection<EnumOptionData> periodFrequencyTypeOptions, final boolean withHoldTax,
final TaxGroupData taxGroup, final Collection<TaxGroupData> taxGroupOptions) {
super(id, name, shortName, description, currency, nominalAnnualInterestRate, interestCompoundingPeriodType,
interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType, lockinPeriodFrequency,
lockinPeriodFrequencyType, accountingType, accountingMappings, paymentChannelToFundSourceMappings, currencyOptions,
interestCompoundingPeriodTypeOptions, interestPostingPeriodTypeOptions, interestCalculationTypeOptions,
interestCalculationDaysInYearTypeOptions, lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions,
accountingRuleOptions, accountingMappingOptions, charges, chargeOptions, penaltyOptions, feeToIncomeAccountMappings,
penaltyToIncomeAccountMappings, interestRateCharts, chartTemplate, minBalanceForInterestCalculation, withHoldTax, taxGroup,
taxGroupOptions);
// fixed deposit additional fields
this.preClosurePenalApplicable = preClosurePenalApplicable;
this.preClosurePenalInterest = preClosurePenalInterest;
this.preClosurePenalInterestOnType = preClosurePenalInterestOnType;
this.minDepositTerm = minDepositTerm;
this.maxDepositTerm = maxDepositTerm;
this.minDepositTermType = minDepositTermType;
this.maxDepositTermType = maxDepositTermType;
this.inMultiplesOfDepositTerm = inMultiplesOfDepositTerm;
this.inMultiplesOfDepositTermType = inMultiplesOfDepositTermType;
this.minDepositAmount = minDepositAmount;
this.depositAmount = depositAmount;
this.maxDepositAmount = maxDepositAmount;
// template
this.preClosurePenalInterestOnTypeOptions = preClosurePenalInterestOnTypeOptions;
this.periodFrequencyTypeOptions = periodFrequencyTypeOptions;
}
public Integer getMinDepositTerm() {
return minDepositTerm;
}
public EnumOptionData getMinDepositTermType() {
return minDepositTermType;
}
public EnumOptionData getMaxDepositTermType() {
return maxDepositTermType;
}
public Integer getMaxDepositTerm() {
return maxDepositTerm;
}
public Integer getInMultiplesOfDepositTerm() {
return inMultiplesOfDepositTerm;
}
public EnumOptionData getInMultiplesOfDepositTermType() {
return inMultiplesOfDepositTermType;
}
public BigDecimal getMinDepositAmount() {
return minDepositAmount;
}
public BigDecimal getDepositAmount() {
return depositAmount;
}
public BigDecimal getMaxDepositAmount() {
return maxDepositAmount;
}
public EnumOptionData getPreClosurePenalInterestOnType() {
return preClosurePenalInterestOnType;
}
public BigDecimal getPreClosurePenalInterest() {
return preClosurePenalInterest;
}
public boolean isPreClosurePenalApplicable() {
return preClosurePenalApplicable;
}
} | [
"niwoogabajoel@gmail.com"
] | niwoogabajoel@gmail.com |
ac3d9d92fd3ed76588d4acefada41ea1fcb8533f | 8e1d2aee54bfad13b6eba8750271c52cde61efe8 | /codinginterview/src/main/java/com/example/codinginterview/graphsandtrees/BST.java | 35cc52df88d74c6360b0a23b7efb4996a95e19cd | [] | no_license | samjonescode/Miscellany | d11b52382714bf2b5f0cb849e05e024c24a0829e | 9897b05b76b30f4f78b1b3bba6a3db9d568ef1d9 | refs/heads/master | 2022-04-06T02:36:23.939879 | 2020-02-16T17:58:19 | 2020-02-16T17:58:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package com.example.codinginterview.graphsandtrees;
import java.util.ArrayList;
import java.util.List;
public class BST {
public static void main(String[] args) {
TreeNode t = new TreeNode(1);
TreeNode t1 = new TreeNode(20);
TreeNode t2 = new TreeNode(-1);
List<TreeNode> treeNodes = new ArrayList<>();
treeNodes.add(t1);
treeNodes.add(t2);
for(TreeNode n : treeNodes){
t.insert(n);
}
System.out.println(t);
}
}
class TreeNode {
int data;
TreeNode left;
TreeNode right;
TreeNode(int data){
this.data = data;
}
void insert(TreeNode newNode){
if( this.data < newNode.data ){
if(this.right!=null){
this.right.insert(newNode);
} else {
this.right = newNode;
}
}
else if (this.data > newNode.data){
if (this.left!=null){
this.left.insert(newNode);
} else {
this.left = newNode;
}
}
}
@Override
public String toString() {
return this.data + " left " + this.left + " right " + this.right;
}
} | [
"samuelriley1393@gmail.com"
] | samuelriley1393@gmail.com |
ef83b253b7135d30cb8ecf80e6276415caa95d79 | 82a8ccbc7cf51f27ce686ae03032d97d0e59083a | /Java/AP-1/scores100.java | a011665fe34c905b29c0bd083bad4e5930ba702e | [] | no_license | Nitro1231/CodingBat | 0385cd53233c525e40939e223dcad747d45e0cb0 | ce140e854ef22c14751a2152d5d2f8f345849412 | refs/heads/master | 2023-05-26T13:34:04.561455 | 2020-05-01T14:37:58 | 2020-05-01T14:37:58 | 260,394,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | /*
Given an array of scores, return true if there are scores of 100 next to each other in the array. The array length will be at least 2.
scores100([1, 100, 100]) → true
scores100([1, 100, 99, 100]) → false
scores100([100, 1, 100, 100]) → true
*/
public boolean scores100(int[] scores) {
for(int i = 0; i < scores.length - 1; i ++)
if (scores[i] == 100 && scores[i] == scores[i+1])
return true;
return false;
}
| [
"nitro0@naver.com"
] | nitro0@naver.com |
b59e48f9e879191c2a14fdd13e37697e6af54925 | 1f9aa5a00b5b60d333b1aa1697ceabc3e4d3500a | /app/src/main/java/com/android/ATRGames/MathExercises/DifficultTask.java | 5d2ca3fab91df2ee6e72da8b8a0affa232e73260 | [] | no_license | almar94/A.T.RGames | 2f3697ffd764ac7f489e2fbc7fb068e3430e839a | 81c34dd1abefdfa4ad722c52a883191eac83507d | refs/heads/master | 2023-03-21T08:25:24.229320 | 2020-10-16T15:32:16 | 2020-10-16T15:32:16 | 304,667,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,287 | java | package com.android.ATRGames.MathExercises;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.android.ATRGames.R;
public class DifficultTask extends AppCompatActivity {
Button start_btn,difficult_show1, difficult_show2, btn_math_answer11, btn_math_answer12, btn_math_answer13, btn_math_answer14;
TextView timer, points, questions, TV_math_go;
ProgressBar progressBar;
ImageView difficult_home;
Game g = new Game(100);
int sec = 20;
CountDownTimer countDownTimer = new CountDownTimer(20000, 1000) {
@Override
public void onTick(long l) {
sec--;
timer.setText(Integer.toString(sec) + " שניות ");
progressBar.setProgress(20 - sec);
}
@Override
public void onFinish() {
btn_math_answer11.setEnabled(false);
btn_math_answer12.setEnabled(false);
btn_math_answer13.setEnabled(false);
btn_math_answer14.setEnabled(false);
TV_math_go.setText(" נגמר הזמן "+ g.getNumberCorrect() + "/" + (g.getTotalSQuestions() - 1));
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
start_btn.setVisibility(View.VISIBLE);
difficult_show1.setVisibility(View.VISIBLE);
difficult_show1.setText(g.getScore() + " נקודות " );
difficult_show2.setVisibility(View.VISIBLE);
difficult_show2.setText(g.getNumberCorrect() + " שאלות נכונות ");
points.setText("0 נקודות");
}
}, 1000);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_difficult_task);
start_btn = findViewById(R.id.difficult_start_btn);
difficult_show1 = findViewById(R.id.difficult_show1);
difficult_show2 = findViewById(R.id.difficult_show2);
btn_math_answer11 = findViewById(R.id.btn_math_answer21);
btn_math_answer12 = findViewById(R.id.btn_math_answer22);
btn_math_answer13 = findViewById(R.id.btn_math_answer23);
btn_math_answer14 = findViewById(R.id.btn_math_answer24);
difficult_home = findViewById(R.id.difficult_home);
timer = findViewById(R.id.difficult_timer);
points = findViewById(R.id.difficult_points);
questions = findViewById(R.id.difficult_questions);
TV_math_go = findViewById(R.id.difficult_TV_math_go);
progressBar = findViewById(R.id.difficult_progressBar);
timer.setText("0 שניות");
questions.setText("");
points.setText("0 נקודות");
difficult_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(DifficultTask.this, PickLevel.class);
startActivity(i);
finish();
}
});
View.OnClickListener startBTN = new View.OnClickListener() {
@Override
public void onClick(View view) {
Button start = (Button) view;
start_btn.setVisibility(View.INVISIBLE);
sec = 20;
g = new Game(100);
nextTurn();
countDownTimer.start();
}
};
View.OnClickListener answerBTN = new View.OnClickListener() {
@Override
public void onClick(View view) {
Button buttonClicked = (Button) view;
int answerSelected = Integer.parseInt(buttonClicked.getText().toString());
g.checkAnswer(answerSelected, 10, 30);
points.setText(Integer.toString(g.getScore()) + " נקודות ");
nextTurn();
}
};
start_btn.setOnClickListener(startBTN);
btn_math_answer11.setOnClickListener(answerBTN);
btn_math_answer12.setOnClickListener(answerBTN);
btn_math_answer13.setOnClickListener(answerBTN);
btn_math_answer14.setOnClickListener(answerBTN);
}
private void nextTurn() {
g.makeNewQuestions();
int [] answer = g.getCurrentQuestions().getAnswerArray();
btn_math_answer11.setText(Integer.toString(answer[0]));
btn_math_answer12.setText(Integer.toString(answer[1]));
btn_math_answer13.setText(Integer.toString(answer[2]));
btn_math_answer14.setText(Integer.toString(answer[3]));
questions.setText(g.getCurrentQuestions().getQuestionsString());
btn_math_answer11.setEnabled(true);
btn_math_answer12.setEnabled(true);
btn_math_answer13.setEnabled(true);
btn_math_answer14.setEnabled(true);
TV_math_go.setText(g.getNumberCorrect() + "/" + (g.getTotalSQuestions() - 1));
}
} | [
"almareshef3@gmail.com"
] | almareshef3@gmail.com |
7ebed1fe9eec58572dcac0e8cd5ad376b2b6d61e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_8bc0cb14b19ad5cabf5f29eb6ebcf6b6e42d47a4/SourceCode/4_8bc0cb14b19ad5cabf5f29eb6ebcf6b6e42d47a4_SourceCode_s.java | 50c77f16d1ed739bc774fdefc16bc3ec2b759ac2 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,381 | java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.Reader;
import java.io.StringReader;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.pmd.PMD;
public class SourceCode {
public static abstract class CodeLoader {
private SoftReference<List<String>> code;
public List<String> getCode() {
List<String> c = null;
if (code != null) {
c = code.get();
}
if (c != null) {
return c;
}
this.code = new SoftReference<List<String>>(load());
return code.get();
}
public abstract String getFileName();
protected abstract Reader getReader() throws Exception;
protected List<String> load() {
LineNumberReader lnr = null;
try {
lnr = new LineNumberReader(getReader());
List<String> lines = new ArrayList<String>();
String currentLine;
while ((currentLine = lnr.readLine()) != null) {
lines.add(currentLine);
}
return lines;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage());
} finally {
try {
if (lnr != null) {
lnr.close();
}
} catch (Exception e) {
throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage());
}
}
}
}
public static class FileCodeLoader extends CodeLoader {
private File file;
private String encoding;
public FileCodeLoader(File file, String encoding) {
this.file = file;
this.encoding = encoding;
}
@Override
public Reader getReader() throws Exception {
return new InputStreamReader(new FileInputStream(file), encoding);
}
@Override
public String getFileName() {
return this.file.getAbsolutePath();
}
}
public static class StringCodeLoader extends CodeLoader {
public static final String DEFAULT_NAME = "CODE_LOADED_FROM_STRING";
private String code;
private String name;
public StringCodeLoader(String code) {
this(code, DEFAULT_NAME);
}
public StringCodeLoader(String code, String name) {
this.code = code;
this.name = name;
}
@Override
public Reader getReader() {
return new StringReader(code);
}
@Override
public String getFileName() {
return name;
}
}
private CodeLoader cl;
public SourceCode(CodeLoader cl) {
this.cl = cl;
}
public List<String> getCode() {
return cl.getCode();
}
public StringBuffer getCodeBuffer() {
StringBuffer sb = new StringBuffer();
List<String> lines = cl.getCode();
for (String line : lines) {
sb.append(line);
sb.append(PMD.EOL);
}
return sb;
}
public String getSlice(int startLine, int endLine) {
StringBuffer sb = new StringBuffer();
List<String> lines = cl.getCode();
for (int i = startLine - 1; i < endLine && i < lines.size(); i++) {
if (sb.length() != 0) {
sb.append(PMD.EOL);
}
sb.append(lines.get(i));
}
return sb.toString();
}
public String getFileName() {
return cl.getFileName();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
eda5e302145c1e1d97d0389d4a5c26f4d01c4d70 | 333f031638b9357162730551f5fece29de26f58e | /app/src/main/java-gen/com/kinth/football/dao/PushMessageDao.java | 727dc6aa2318c07288538bbef0262e6440526e0f | [] | no_license | Solaning/cloud-football | 19a21f0585989c639846f44bd30cdff8aff84f22 | 7e310daceb2694851c6a52c3a956a8bc4a7a3d2f | refs/heads/master | 2021-01-10T15:43:08.658612 | 2015-10-24T08:52:55 | 2015-10-24T08:52:55 | 44,853,394 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,139 | java | package com.kinth.football.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;
import com.kinth.football.dao.PushMessage;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table PUSH_MESSAGE.
*/
public class PushMessageDao extends AbstractDao<PushMessage, Long> {
public static final String TABLENAME = "PUSH_MESSAGE";
/**
* Properties of entity PushMessage.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
public final static Property Type = new Property(1, String.class, "type", false, "TYPE");
public final static Property Date = new Property(2, Long.class, "date", false, "DATE");
public final static Property Content = new Property(3, String.class, "content", false, "CONTENT");
public final static Property HasRead = new Property(4, Boolean.class, "hasRead", false, "HAS_READ");
public final static Property IsClick = new Property(5, Integer.class, "isClick", false, "IS_CLICK");
};
public PushMessageDao(DaoConfig config) {
super(config);
}
public PushMessageDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "'PUSH_MESSAGE' (" + //
"'_id' INTEGER PRIMARY KEY ," + // 0: id
"'TYPE' TEXT NOT NULL ," + // 1: type
"'DATE' INTEGER," + // 2: date
"'CONTENT' TEXT," + // 3: content
"'HAS_READ' INTEGER," + // 4: hasRead
"'IS_CLICK' INTEGER);"); // 5: isClick
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'PUSH_MESSAGE'";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, PushMessage entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getType());
Long date = entity.getDate();
if (date != null) {
stmt.bindLong(3, date);
}
String content = entity.getContent();
if (content != null) {
stmt.bindString(4, content);
}
Boolean hasRead = entity.getHasRead();
if (hasRead != null) {
stmt.bindLong(5, hasRead ? 1l: 0l);
}
Integer isClick = entity.getIsClick();
if (isClick != null) {
stmt.bindLong(6, isClick);
}
}
/** @inheritdoc */
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
/** @inheritdoc */
@Override
public PushMessage readEntity(Cursor cursor, int offset) {
PushMessage entity = new PushMessage( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1), // type
cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2), // date
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // content
cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0, // hasRead
cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5) // isClick
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, PushMessage entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setType(cursor.getString(offset + 1));
entity.setDate(cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2));
entity.setContent(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setHasRead(cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0);
entity.setIsClick(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(PushMessage entity, long rowId) {
entity.setId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(PushMessage entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}
| [
"384276310@qq.com"
] | 384276310@qq.com |
e95828a74e3a4807e0651dd290b6032e2680cae9 | d9fde528493b244863cb15b1d98f0eeeea086f79 | /app/src/main/java/com/ziroom/creation/utils/LogUtils.java | 7abbf8073aeaede1443a692a69fb01e629511c2e | [] | no_license | lmnrenbc/Creation | b9a4dab09874004e70957e41f5338880240fc802 | 7dd1a2dce84a7f8726cf0d9d22100f7306cf939c | refs/heads/master | 2021-05-06T20:25:26.818650 | 2017-11-28T06:11:03 | 2017-11-28T06:11:03 | 112,293,279 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,749 | java | package com.ziroom.creation.utils;
import android.util.Log;
import com.ziroom.creation.base.Constant;
import com.ziroom.creation.base.CreationApplication;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import static com.ziroom.creation.base.Constant.DATE_COMMON;
import static com.ziroom.creation.base.Constant.DATE_CONNECTED;
import static com.ziroom.creation.base.Constant.LOG_DEFULT_TYPE;
import static com.ziroom.creation.base.Constant.LOG_FILE_NAME;
import static com.ziroom.creation.base.Constant.LOG_FILE_SUFFIX;
import static com.ziroom.creation.base.Constant.LOG_PATH_SDCARD_DIR;
import static com.ziroom.creation.base.Constant.LOG_SDCARD_FILE_SAVE_DAYS;
/**
* 日志工具类
* Created by lmnrenbc on 2017/5/3.
*/
public class LogUtils {
private static Boolean LOG_SWITCH = CreationApplication.isRelease; // 日志文件总开关
private static Boolean LOG_WRITE_TO_FILE = !CreationApplication.isRelease; // 日志写入文件开关
private static SimpleDateFormat LogSdf = new SimpleDateFormat(DATE_COMMON); // 日志的输出格式
private static SimpleDateFormat logfile = new SimpleDateFormat(DATE_CONNECTED); // 日志文件格式
public static void w(String tag, Object msg) { // 警告信息
log(tag, msg.toString(), 'w');
}
public static void w(String tag, String msg, Throwable t) {
if (LOG_SWITCH) {
if (t != null) {
msg += "\n" + Log.getStackTraceString(t);
}
log(tag, msg, 'w');
}
}
public static void e(String tag, String msg, Throwable t) {
if (LOG_SWITCH) {
if (t != null) {
msg += "\n" + Log.getStackTraceString(t);
}
log(tag, msg, 'e');
}
}
public static void i(String tag, String msg, Throwable t) {
if (LOG_SWITCH) {
if (t != null) {
msg += "\n" + Log.getStackTraceString(t);
}
log(tag, msg, 'i');
}
}
public static void e(String tag, Object msg) { // 错误信息
log(tag, msg.toString(), 'e');
}
public static void d(String tag, Object msg) {// 调试信息
log(tag, msg.toString(), 'd');
}
public static void i(String tag, Object msg) {//
log(tag, msg.toString(), 'i');
}
public static void v(String tag, Object msg) {
log(tag, msg.toString(), 'v');
}
public static void w(String tag, String text) {
log(tag, text, 'w');
}
public static void e(String tag, String text) {
log(tag, text, 'e');
}
public static void d(String tag, String text) {
log(tag, text, 'd');
}
public static void i(String tag, String text) {
log(tag, text, 'i');
}
public static void v(String tag, String text) {
log(tag, text, 'v');
}
/**
* 根据tag, msg和等级,输出日志
*
* @param tag
* @param msg
* @param level
* @return void
* @since v 1.0
*/
private static void log(String tag, String msg, char level) {
tag = Constant.LOG_TAG + tag;
if (LOG_SWITCH) {
if ('e' == level && ('e' == LOG_DEFULT_TYPE || 'v' == LOG_DEFULT_TYPE)) { // 输出错误信息
Log.e(tag, msg);
} else if ('w' == level && ('w' == LOG_DEFULT_TYPE || 'v' == LOG_DEFULT_TYPE)) {
Log.w(tag, msg);
} else if ('d' == level && ('d' == LOG_DEFULT_TYPE || 'v' == LOG_DEFULT_TYPE)) {
Log.d(tag, msg);
} else if ('i' == level && ('d' == LOG_DEFULT_TYPE || 'v' == LOG_DEFULT_TYPE)) {
Log.i(tag, msg);
} else {
Log.v(tag, msg);
}
if (LOG_WRITE_TO_FILE) {
delFile();
// writeLogtoFile(String.valueOf(level), tag, msg);
}
}
}
/**
* 打开日志文件并写入日志
*
* @return
**/
private static void writeLogtoFile(String logtype, String tag, String text) {// 新建或打开日志文件
Date nowtime = new Date();
String needWriteFiel = logfile.format(nowtime);
String needWriteMessage = LogSdf.format(nowtime) + " " + logtype
+ " " + tag + " " + text;
File file = new File(LOG_PATH_SDCARD_DIR, LOG_FILE_NAME + needWriteFiel + LOG_FILE_SUFFIX);
try {
FileWriter filerWriter = new FileWriter(file, true);// 后面这个参数代表是不是要接上文件中原来的数据,不进行覆盖
BufferedWriter bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(needWriteMessage);
bufWriter.newLine();
bufWriter.close();
filerWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 删除制定的日志文件
*/
public static void delFile() {// 删除日志文件
String needDelFiel = logfile.format(getDateBefore());
File file = new File(LOG_PATH_SDCARD_DIR, LOG_FILE_NAME + needDelFiel + LOG_FILE_SUFFIX);
if (file.exists()) {
file.delete();
}
}
/**
* 得到现在时间前的几天日期,用来得到需要删除的日志文件名
*/
private static Date getDateBefore() {
Date nowtime = new Date();
Calendar now = Calendar.getInstance();
now.setTime(nowtime);
now.set(Calendar.DATE, now.get(Calendar.DATE) - LOG_SDCARD_FILE_SAVE_DAYS);
return now.getTime();
}
} | [
"lmnrenbc@163.com"
] | lmnrenbc@163.com |
6603cd125dfd7880c0958ce7d563cae9c49bd2e5 | 5b3101fa8d3578dd1ee3206259fbec8d394d91c0 | /app/src/main/java/myadapterfg/wiranata/com/CoachesItem.java | d8fb2a15dedadcc4bdccef59991f50be24d5bc81 | [] | no_license | dimaswiranata/AndroidStudio-Belajar_Adapter | 17385d899ea85e84a064719d902f62c6d1bcd05a | d13e2044c3891110537e850e2acd914a62d58010 | refs/heads/master | 2020-08-12T12:36:53.534888 | 2019-10-13T05:55:49 | 2019-10-13T05:55:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | package myadapterfg.wiranata.com;
public class CoachesItem{
private String coachAge;
private String coachName;
private String coachCountry;
public void setCoachAge(String coachAge){
this.coachAge = coachAge;
}
public String getCoachAge(){
return coachAge;
}
public void setCoachName(String coachName){
this.coachName = coachName;
}
public String getCoachName(){
return coachName;
}
public void setCoachCountry(String coachCountry){
this.coachCountry = coachCountry;
}
public String getCoachCountry(){
return coachCountry;
}
@Override
public String toString(){
return
"CoachesItem{" +
"coach_age = '" + coachAge + '\'' +
",coach_name = '" + coachName + '\'' +
",coach_country = '" + coachCountry + '\'' +
"}";
}
}
| [
"36686862+dimaswiranata@users.noreply.github.com"
] | 36686862+dimaswiranata@users.noreply.github.com |
41b496c6489aa7a0d7bcfafafc9bf05bba04b87a | 2613e22cb211c7b2466adb4989ffba5a7afa4e26 | /src/main/java/bom/dtoBuilder/UserDtoBuilder.java | 8bb91c17b43f1a3729898243af53f1b46fdec9c2 | [] | no_license | michalzst/bom | bc115e5c4b48ff6fc0eb161e60d4bb4c3cf4c7b0 | ad776e45f4a502f78872a773530d7a56e423a64e | refs/heads/master | 2022-06-14T14:02:03.958703 | 2019-11-15T12:26:03 | 2019-11-15T12:26:03 | 203,169,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package bom.dtoBuilder;
import bom.dto.UserDto;
import bom.user.Role;
import bom.user.User;
import bom.user.UsersRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Set;
@Service
public class UserDtoBuilder {
@Autowired
private UsersRepository<User> usersRepository;
public User buildUserEntity(UserDto dto) {
User user;
if (dto.getId() == null) {
user = new User();
} else {
user = usersRepository.getOne(dto.getId());
}
user.setFirstName(dto.getFirstName());
user.setSurName(dto.getSurName());
user.setUsername(dto.getUsername());
user.setPasswordHash(dto.getPassword());
return user;
}
}
| [
"misiek-pl@o2.pl"
] | misiek-pl@o2.pl |
aa6e420489af71b7a88c35c099603c1dfcfc405d | 71fc9de2491b6d02536b9732e3721cf5466b8567 | /benchmark/src/main/java/com/espertech/esper/example/benchmark/server/CEPProvider.java | 9f3f5974a88dfd80aa58fdd5382fef3330b0f7bf | [] | no_license | hancy2013/esper-voter | 7843b9c56a307e883e2801fb5f87238eb1399399 | 0c3494cbf07affb0b0e61637be17acfb80ae204b | refs/heads/master | 2020-12-11T05:46:33.158979 | 2015-06-28T19:48:34 | 2015-06-28T19:48:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,592 | java | /**************************************************************************************
* Copyright (C) 2007 Esper Team. All rights reserved. *
* http://esper.codehaus.org *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license *
* a copy of which has been included with this distribution in the license.txt file. *
**************************************************************************************/
package com.espertech.esper.example.benchmark.server;
import com.espertech.esper.example.benchmark.*;
import com.espertech.esper.client.*;
import com.espertech.esper.example.benchmark.MarketData;
/**
* A factory and interface to wrap ESP/CEP engine dependency in a single space
*
* @author Alexandre Vasseur http://avasseur.blogspot.com
*/
public class CEPProvider {
public static interface ICEPProvider {
public void init(int sleepListenerMillis, boolean order);
public void registerStatement(String statement, String statementID);
public void sendEvent(Object theEvent);
}
public static ICEPProvider getCEPProvider() {
String className = System.getProperty("esper.benchmark.provider", EsperCEPProvider.class.getName());
try {
Class klass = Class.forName(className);
return (ICEPProvider) klass.newInstance();
} catch (Throwable t) {
t.printStackTrace();
throw new RuntimeException(t);
}
}
public static class EsperCEPProvider implements ICEPProvider {
private EPAdministrator epAdministrator;
private EPRuntime epRuntime;
// only one of those 2 will be attached to statement depending on the -mode selected
private UpdateListener updateListener;
private MySubscriber subscriber;
private static int sleepListenerMillis;
public EsperCEPProvider() {
}
public void init(final int _sleepListenerMillis, boolean order) {
sleepListenerMillis = _sleepListenerMillis;
Configuration configuration;
// EsperHA enablement - if available
try {
Class configurationHAClass = Class.forName("com.espertech.esperha.client.ConfigurationHA");
configuration = (Configuration) configurationHAClass.newInstance();
System.out.println("=== EsperHA is available, using ConfigurationHA ===");
} catch (ClassNotFoundException e) {
configuration = new Configuration();
} catch (Throwable t) {
System.err.println("Could not properly determine if EsperHA is available, default to Esper");
t.printStackTrace();
configuration = new Configuration();
}
configuration.addEventType("Market", MarketData.class);
// EsperJMX enablement - if available
try {
Class.forName("com.espertech.esper.jmx.client.EsperJMXPlugin");
configuration.addPluginLoader(
"EsperJMX",
"com.espertech.esper.jmx.client.EsperJMXPlugin",
null);// will use platform mbean - should enable platform mbean connector in startup command line
System.out.println("=== EsperJMX is available, using platform mbean ===");
} catch (ClassNotFoundException e) {
;
}
//REMOVES ORDER
if(!order) {
configuration.getEngineDefaults().getThreading().setListenerDispatchPreserveOrder(false); //removes order-preserving
configuration.getEngineDefaults().getThreading().setInsertIntoDispatchPreserveOrder(false);
configuration.getEngineDefaults().getThreading()
.setListenerDispatchPreserveOrder(false);
configuration.getEngineDefaults().getThreading()
.setInternalTimerEnabled(false); // remove thread that handles time advancing
}
//END REMOVE ORDER
EPServiceProvider epService = EPServiceProviderManager.getProvider("benchmark", configuration);
epAdministrator = epService.getEPAdministrator();
updateListener = new MyUpdateListener();
subscriber = new MySubscriber();
epRuntime = epService.getEPRuntime();
}
public void registerStatement(String statement, String statementID) {
EPStatement stmt = epAdministrator.createEPL(statement, statementID);
if (System.getProperty("esper.benchmark.ul") != null) {
stmt.addListener(updateListener);
} else {
stmt.setSubscriber(subscriber);
}
}
public void sendEvent(Object theEvent) {
epRuntime.sendEvent(theEvent);
}
}
public static class MyUpdateListener implements UpdateListener {
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
if (newEvents != null) {
if (EsperCEPProvider.sleepListenerMillis > 0) {
try {
Thread.sleep(EsperCEPProvider.sleepListenerMillis);
} catch (InterruptedException ie) {
;
}
}
}
}
}
public static class MySubscriber {
public void update(String ticker) {
if (EsperCEPProvider.sleepListenerMillis > 0) {
try {
Thread.sleep(EsperCEPProvider.sleepListenerMillis);
} catch (InterruptedException ie) {
;
}
}
}
public void update(MarketData marketData) {
if (EsperCEPProvider.sleepListenerMillis > 0) {
try {
Thread.sleep(EsperCEPProvider.sleepListenerMillis);
} catch (InterruptedException ie) {
;
}
}
}
public void update(String ticker, double avg, long count, double sum) {
if (EsperCEPProvider.sleepListenerMillis > 0) {
try {
Thread.sleep(EsperCEPProvider.sleepListenerMillis);
} catch (InterruptedException ie) {
;
}
}
}
}
}
| [
"jmeehan16@gmail.com"
] | jmeehan16@gmail.com |
a90b10484d0f43f5e8ea5f6b041a8e7a96818d8c | c5b1d0951b18cbde9f2abc7ff00451e5ecc8ae13 | /src/com/starbaby/diyBook/utils/JavaBeanZuoShu.java | f4c090fc5681251bc3c27ca74202a74bac15d022 | [] | no_license | sangmingming/MyMusic | c1f787c612b70b41810d7c86b9d299d06e742b06 | 1eb15042c50fe2803eaf8a71320ea44736f64680 | refs/heads/master | 2021-01-20T17:50:11.392996 | 2014-04-04T04:43:50 | 2014-04-04T04:43:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,437 | java | package com.starbaby.diyBook.utils;
import java.io.Serializable;
import java.util.ArrayList;
public class JavaBeanZuoShu implements Serializable{
public ArrayList<String> musicList = new ArrayList<String>();//做书里的音乐资源(如果存在)
// public ArrayList<String> imageList = new ArrayList<String>();//模板图书的图片集合(别人作品)
// public ArrayList<String> playInfo = new ArrayList<String>();//
public ArrayList<Integer> playId = new ArrayList<Integer>();//做书图片的id位置
public ArrayList<String> playList = new ArrayList<String>();//做书图片和原图片的集合
// public ArrayList<String> getImageList() {
// return imageList;
// }
// public void setImageList(ArrayList<String> imageList) {
// this.imageList = imageList;
// }
// public ArrayList<String> getPlayInfo() {
// return playInfo;
// }
// public void setPlayInfo(ArrayList<String> playInfo) {
// this.playInfo = playInfo;
// }
public ArrayList<Integer> getPlayId() {
return playId;
}
public void setPlayId(ArrayList<Integer> playId) {
this.playId = playId;
}
public ArrayList<String> getPlayList() {
return playList;
}
public void setPlayList(ArrayList<String> playList) {
this.playList = playList;
}
public ArrayList<String> getMusicList() {
return musicList;
}
public void setMusicList(ArrayList<String> musicList) {
this.musicList = musicList;
}
}
| [
"lfs84244025@126.com"
] | lfs84244025@126.com |
503fdd6d7d2ae7917c2affe55da9897eb371921c | c10662c73dd8e402baabaac19bd3f892e75184f9 | /src/main/java/hyorongE/springboot/web/dto/PostsSaveRequestDto.java | 60433196c1ece3655f560ffdf7da1a5b656ee3a6 | [] | no_license | hyorongE/hyorong-study | a612325a197547c4c96b0defa524f4bbc7f54463 | c8c0b4c26eff1090dd6a87958b273d7d788b0c80 | refs/heads/master | 2023-01-07T02:42:35.947870 | 2020-11-08T05:08:47 | 2020-11-08T05:08:47 | 304,367,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | package hyorongE.springboot.web.dto;
import hyorongE.springboot.domain.posts.Posts;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
public class PostsSaveRequestDto {
private String title;
private String content;
private String author;
@Builder
public PostsSaveRequestDto(String title,String content,String author){
this.title = title;
this.content = content;
this.author = author;
}
public Posts toEntity() {
return Posts.builder()
.title(title)
.content(content)
.author(author)
.build();
}
}
| [
"khj5910297@naver.com"
] | khj5910297@naver.com |
319e69243e9d544e3aced204c242c3226991e3ef | 3efe48ee39abe230d7b9d2bfdddee2c428e6049f | /net.unicoen.unimappergenerator/src/net/unicoen/MyStringValueConverter.java | a9e8c1d8b752fa78fea4d734d762c7768b5ddeb4 | [] | no_license | UnicoenProject/UniMapperGenerator | f0fe1cfa779b589790095fbe149629b23e4bf184 | 556413d48fd864e96f196cfd0e0176eccd2d2cd0 | refs/heads/master | 2021-04-19T00:58:56.870598 | 2017-04-03T00:31:12 | 2017-04-03T00:31:12 | 13,693,502 | 1 | 0 | null | 2016-08-17T00:54:48 | 2013-10-19T01:42:18 | Java | UTF-8 | Java | false | false | 572 | java | package net.unicoen;
import org.eclipse.xtext.conversion.ValueConverterException;
import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;
import org.eclipse.xtext.nodemodel.INode;
public class MyStringValueConverter extends AbstractLexerBasedConverter<String> {
@Override
protected String toEscapedString(String value) {
return value;
}
@Override
protected void assertValidValue(String value) {
super.assertValidValue(value);
}
@Override
public String toValue(String string, INode node) throws ValueConverterException {
return string;
}
} | [
"exkazuu@gmail.com"
] | exkazuu@gmail.com |
949c4ef59880b2922783c17312806672d3f26bdc | a5ad6e83970d2170e8f01d4847cb7db3aab0674e | /SCG/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java | aea73962ac5a413549f9f47054d5d55aaa5dc6ae | [] | no_license | NikemoXss/SCGAS | a0e9232a34fc657984f6d38701852f98bc006c40 | 16e5593451f92556cc03a8ea75a49549ccbd5e22 | refs/heads/master | 2020-06-25T07:58:20.725491 | 2017-09-22T08:53:52 | 2017-09-22T08:53:55 | 96,523,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,731 | java | /*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
*
* 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.handmark.pulltorefresh.library.internal;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import com.czscg.R;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
@SuppressLint("ViewConstructor")
public class IndicatorLayout extends FrameLayout implements AnimationListener {
static final int DEFAULT_ROTATION_ANIMATION_DURATION = 150;
private Animation mInAnim, mOutAnim;
private ImageView mArrowImageView;
private final Animation mRotateAnimation, mResetRotateAnimation;
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
super(context);
mArrowImageView = new ImageView(context);
Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
mArrowImageView.setImageDrawable(arrowD);
final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
mArrowImageView.setPadding(padding, padding, padding, padding);
addView(mArrowImageView);
int inAnimResId, outAnimResId;
switch (mode) {
case PULL_FROM_END:
inAnimResId = R.anim.slide_in_from_bottom;
outAnimResId = R.anim.slide_out_to_bottom;
setBackgroundResource(R.drawable.indicator_bg_bottom);
// Rotate Arrow so it's pointing the correct way
mArrowImageView.setScaleType(ScaleType.MATRIX);
Matrix matrix = new Matrix();
matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
mArrowImageView.setImageMatrix(matrix);
break;
default:
case PULL_FROM_START:
inAnimResId = R.anim.slide_in_from_top;
outAnimResId = R.anim.slide_out_to_top;
setBackgroundResource(R.drawable.indicator_bg_top);
break;
}
mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
mInAnim.setAnimationListener(this);
mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
mOutAnim.setAnimationListener(this);
final Interpolator interpolator = new LinearInterpolator();
mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateAnimation.setInterpolator(interpolator);
mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
mRotateAnimation.setFillAfter(true);
mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mResetRotateAnimation.setInterpolator(interpolator);
mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
mResetRotateAnimation.setFillAfter(true);
}
public final boolean isVisible() {
Animation currentAnim = getAnimation();
if (null != currentAnim) {
return mInAnim == currentAnim;
}
return getVisibility() == View.VISIBLE;
}
public void hide() {
startAnimation(mOutAnim);
}
public void show() {
mArrowImageView.clearAnimation();
startAnimation(mInAnim);
}
@Override
public void onAnimationEnd(Animation animation) {
if (animation == mOutAnim) {
mArrowImageView.clearAnimation();
setVisibility(View.GONE);
} else if (animation == mInAnim) {
setVisibility(View.VISIBLE);
}
clearAnimation();
}
@Override
public void onAnimationRepeat(Animation animation) {
// NO-OP
}
@Override
public void onAnimationStart(Animation animation) {
setVisibility(View.VISIBLE);
}
public void releaseToRefresh() {
mArrowImageView.startAnimation(mRotateAnimation);
}
public void pullToRefresh() {
mArrowImageView.startAnimation(mResetRotateAnimation);
}
}
| [
"2461178131@qq.com"
] | 2461178131@qq.com |
85ce9a421b1b36321bad74b18b098fb036a28b95 | 4b451a3f8c0a309d27b7afbcd3a1bc9475665f67 | /wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/tables/Th.java | d6483a8f3cf16f35d388a107fa43703f267c2fba | [
"Apache-2.0"
] | permissive | deshpamit/wff | 0ba31ea65a77f206dd368d27595ad20ab2d66aca | 2551216cf78fa48e37a3eb6ddcb60e79b8b1b2f1 | refs/heads/master | 2021-01-12T14:08:08.175632 | 2016-10-01T14:18:17 | 2016-10-01T14:18:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,034 | java | package com.webfirmframework.wffweb.tag.html.tables;
import java.util.logging.Logger;
import com.webfirmframework.wffweb.settings.WffConfiguration;
import com.webfirmframework.wffweb.tag.html.AbstractHtml;
import com.webfirmframework.wffweb.tag.html.TagNameConstants;
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute;
import com.webfirmframework.wffweb.tag.html.identifier.GlobalAttributable;
import com.webfirmframework.wffweb.tag.html.identifier.ThAttributable;
/**
* @author WFF
* @since 1.0.0
* @version 1.0.0
*
*/
public class Th extends AbstractHtml {
private static final long serialVersionUID = 1_0_0L;
public static final Logger LOGGER = Logger.getLogger(Th.class.getName());
{
init();
}
/**
* Represents the root of an HTML or XHTML document. All other elements must
* be descendants of this element.
*
* @param base
* i.e. parent tag of this tag
* @param attributes
* An array of {@code AbstractAttribute}
*
* @since 1.0.0
*/
public Th(final AbstractHtml base, final AbstractAttribute... attributes) {
super(TagNameConstants.TH, base, attributes);
if (WffConfiguration.isDirectionWarningOn()) {
warnForUnsupportedAttributes(attributes);
}
}
private static void warnForUnsupportedAttributes(
final AbstractAttribute... attributes) {
for (final AbstractAttribute abstractAttribute : attributes) {
if (!(abstractAttribute != null
&& (abstractAttribute instanceof ThAttributable
|| abstractAttribute instanceof GlobalAttributable))) {
LOGGER.warning(abstractAttribute
+ " is not an instance of ThAttribute");
}
}
}
/**
* invokes only once per object
*
* @author WFF
* @since 1.0.0
*/
protected void init() {
// to override and use this method
}
}
| [
"webfirm.framework@gmail.com"
] | webfirm.framework@gmail.com |
c8a4c028403d40ec7ed05ca402e65671252e23cb | 6d6d8b5f6d9d6c3ac804bf07502800662f7cedaa | /src/lab10/Panel.java | a6afae061e12f40f0a004861796381b5da115a2d | [] | no_license | Dasmitrich/Javalabs | 83afc615b9e3f2af0177b6d91c5562f6b7e24b52 | 89ddb4ff92133b2f57302975df9a478b2861297c | refs/heads/master | 2023-02-02T23:09:31.561670 | 2020-12-11T18:16:01 | 2020-12-11T18:16:01 | 297,341,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,670 | java | package lab10;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Panel extends JPanel {
private JButton numbers[] = new JButton[10];
private JTextField field = new JTextField();
private JButton backspace = new JButton("Backspace");
private JButton clear = new JButton("Cl");
private JButton equal = new JButton("=");
private JButton plus = new JButton("+");
private JButton multiply = new JButton("*");
private JButton divide = new JButton("/");
private JButton minus = new JButton("-");
private JButton dot = new JButton(".");
private double num1 = 0;
private double num2 = 0;
private char sym;
public Panel(){
setLayout(null);
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
numbers[i*3+j+1] = new JButton((j*3+i+1)+"");
numbers[i*3+j+1].setBounds(i*(50+20)+10, 100 + j * (50+20)+10, 50, 50);
add(numbers[i*3+j+1]);
}
}
numbers[0] = new JButton("0");
numbers[0].setBounds(80, 320, 50, 50);
add(numbers[0]);
plus.setBounds(220, 110, 50, 50);
add(plus);
minus.setBounds(220, 180, 50, 50);
add(minus);
multiply.setBounds(220, 250, 50, 50);
add(multiply);
divide.setBounds(220, 320, 50, 50);
add(divide);
clear.setBounds(10, 320, 50, 50);
add(clear);
equal.setBounds(150, 320, 50, 50);
add(equal);
dot.setBounds(220, 80, 50, 20);
add(dot);
backspace.setBounds(10, 80, 190, 20);
add(backspace);
field.setEditable(false);
field.setBounds(20, 20, 240, 50);
add(field);
ActionListener operListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dot.setEnabled(true);
JButton temp = new JButton();
temp = (JButton) e.getSource();
String str = field.getText();
if(str.length()!=0) {
if (temp == clear) {
field.setText(null);
num1 = 0;
num2 = 0;
}
if (temp == backspace) {
str = str.substring(0, str.length() - 1);
field.setText(str);
}
if (temp == plus) {
num1 = Double.parseDouble(field.getText());
System.out.println(num1);
field.setText(null);
sym = '+';
}
if (temp == minus) {
num1 = Double.parseDouble(field.getText());
field.setText(null);
sym = '-';
}
if (temp == multiply) {
num1 = Double.parseDouble(field.getText());
field.setText(null);
sym = '*';
}
if (temp == divide) {
num1 = Double.parseDouble(field.getText());
field.setText(null);
sym = '/';
}
if(temp == dot){
field.setText(field.getText() + ".");
dot.setEnabled(false);
}
if(temp == equal) {
num2 = Double.parseDouble(field.getText());
field.setText(null);
switch (sym) {
case '+':
num1 += num2;
field.setText(Double.toString(num1));
break;
case '-':
num1 -= num2;
field.setText(Double.toString(num1));
break;
case '*':
num1 *= num2;
field.setText(Double.toString(num1));
break;
case '/':
if (num2 != 0.0)
num1 /= num2;
else
System.err.println("Деление на ноль невозможно");
field.setText(Double.toString(num1));
break;
}
}
}
}
};
clear.addActionListener(operListener);
backspace.addActionListener(operListener);
equal.addActionListener(operListener);
plus.addActionListener(operListener);
minus.addActionListener(operListener);
divide.addActionListener(operListener);
multiply.addActionListener(operListener);
ActionListener numListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JButton b = new JButton();
b = (JButton) e.getSource();
if(b == dot)
dot.setEnabled(false);
field.setText(field.getText() + b.getText());
}
};
for(JButton but: numbers){
but.addActionListener(numListener);
}
dot.addActionListener(operListener);
}
} | [
"dashmitrich@gmail.com"
] | dashmitrich@gmail.com |
3c276efed3c38eb7201d9cb794e54fd62a35c48a | c2ddb0ea09476cadd067a688bae64fedea1f8f63 | /test/src/Try.java | edebdf1841a216d4439430cfe99d781e01e5b4f8 | [] | no_license | inabotnaru1/QA-lab1 | 6d653986221b9edd18092d0a0633cbc18f40d8df | f7e81503cd6aa6f28b3fa5bc577d2f1b38dc4f20 | refs/heads/main | 2023-01-06T15:50:14.864286 | 2020-11-07T19:40:50 | 2020-11-07T19:40:50 | 310,918,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21 | java | public class Try {
}
| [
"inabotnaru1@gmail.com"
] | inabotnaru1@gmail.com |
e1c869c9aaff2e9e46edc25e30f34efb8c698dab | 33b59b4b19b6087a4ce7c01688a239404e81e833 | /ttangTtang/src/admin/outuser/service/OutuserService.java | c3d180d0d60321325897d7ae491685d747479b0d | [] | no_license | teamJavaTT/ttangTtang | 07d049367a66e45e47be99df23f46755de7fe3c3 | fafdf07ff78e15d274f07e087c417bf3838fa618 | refs/heads/master | 2023-07-15T15:44:18.024076 | 2021-08-17T06:49:12 | 2021-08-17T06:49:12 | 373,061,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,217 | java | package admin.outuser.service;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import admin.outuser.dao.OutuserDao;
import admin.outuser.model.Outusercolumn;
import jdbc.DBConnection;
public class OutuserService {
private OutuserDao outuserDao = new OutuserDao();
// 글 목록에 읽어오기
public OutuserPage getOutuserPage(int pageNo) throws Exception {
int size = 10;
int startNo = (pageNo - 1) * size + 1;
int endNo = startNo + 9;
try (Connection conn = DBConnection.getConnection()) {
int total = outuserDao.selectCount(conn);
List<Outusercolumn> outuserColumn = outuserDao.outuserSelect(conn, startNo, endNo);
return new OutuserPage(total, pageNo, size, outuserColumn);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
public OutuserData getOutuserRead(int outuserNum) throws Exception {
try (Connection conn = DBConnection.getConnection()){
Outusercolumn outuserColumn = outuserDao.outuserReadSelect(conn, outuserNum);
return new OutuserData(outuserColumn);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
// 글 목록에 읽어오기 끝
// 글 삭제
public void getOutuserDelete(int delNo) throws SQLException, Exception {
try(Connection conn = DBConnection.getConnection()){
outuserDao.outuserDelete(conn, delNo);
}
}
// 글 끝
// 수정
/*
* public Integer outuserMod(int delNo, Outuser modReq) throws Exception {
* Connection conn = null; try { conn = DBConnection.getConnection();
* conn.setAutoCommit(false);
*
* Outusercolumn outuser = toOutuserMod(delNo, modReq); Outusercolumn
* savedArticle = outuserDao.outuserUpdate(conn, outuser); if (savedArticle ==
* null) { throw new RuntimeException("fail to update"); } conn.commit();
*
* return savedArticle.getFno(); } catch (SQLException e) {
* JdbcUtil.rollback(conn); throw new RuntimeException(e); } catch
* (RuntimeException e) { JdbcUtil.rollback(conn); throw e; } finally {
* JdbcUtil.close(conn); } } // 수정 끝 private Outusercolumn toOutuserMod(int
* delNo, Outuser req) { Date now = new Date(); return new
* Outusercolumn(delNo, req.getFtit(), req.getFtext(), now); }
*/
}
| [
"96tmdals@gmail.com"
] | 96tmdals@gmail.com |
ec1668fb0774f2ac6d82fc5ff6e8e6f7ad24ff6e | b3b1dceb135f76936eb6b0992e2bd953225ae381 | /SpringBoot代码/coursemanage/src/main/java/com/manage/course/entity/Notice.java | 967a79c2c4845d8f67a74a86b93a1f5d37247724 | [] | no_license | DreamPersonalize/CurriculumManage | d72f703315c6f6403ca385db68a72ada90f0c72f | 5e879c538afb644d808b2ad6627cec628edee48f | refs/heads/master | 2022-11-24T13:34:02.061177 | 2020-08-03T03:55:36 | 2020-08-03T03:55:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,848 | java | package com.manage.course.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* author: zhang
* date: 2020年4月16日16:46:15
* 公告表
*/
@Entity
@Data
public class Notice {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer notice_id;
private Integer User;
private Integer Course;
private String Name;
private String Content;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date Releasetime;
public Integer getNotice_id() {
return notice_id;
}
public void setNotice_id(Integer notice_id) {
this.notice_id = notice_id;
}
public Integer getUser() {
return User;
}
public void setUser(Integer user) {
User = user;
}
public Integer getCourse() {
return Course;
}
public void setCourse(Integer course) {
Course = course;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getContent() {
return Content;
}
public void setContent(String content) {
Content = content;
}
public Date getReleasetime() {
return Releasetime;
}
public void setReleasetime(Date releasetime) {
Releasetime = releasetime;
}
@Override
public String toString() {
return "Notice{" +
"notice_id=" + notice_id +
", User=" + User +
", Course=" + Course +
", Name='" + Name + '\'' +
", Content='" + Content + '\'' +
", Releasetime=" + Releasetime +
'}';
}
}
| [
"PersonZhang2019@outlook.com"
] | PersonZhang2019@outlook.com |
7ac70cca2fb8e37e7bff1d9b32f725a1a80dbdc2 | 752769cdbde5709ec894e46509ea26d072f63860 | /jsf-demos/im/src/main/java/com/jsf/config/DataConfig.java | aa9ec10d7881e95816f72d541f0aa9799e39ecdd | [
"BSD-3-Clause"
] | permissive | cjg208/JSF | dca375b472d16e2a7cb9ac56e939b63d60cc86cf | 693041b6bb6a1b753d3be072c8ee7d879622e6b5 | refs/heads/master | 2023-01-01T08:39:47.925873 | 2020-10-27T08:35:08 | 2020-10-27T08:35:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,577 | java | package com.jsf.config;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
import java.util.Properties;
/**
* Created with IntelliJ IDEA.
* Description: DB数据源、Mybatis|Plugins、事务
* User: xujunfei
* Date: 2017-11-28
* Time: 10:43
*
* @version 2.0
*/
@Configuration
@MapperScan(basePackages = {DataConfig.mapperPackage}, sqlSessionFactoryRef = "sqlSessionFactory")
@EnableTransactionManagement
public class DataConfig {
private Logger logger = LoggerFactory.getLogger(DataConfig.class);
public final static String mapperPackage = "com.jsf.database.mapper";
public final static String modelPackage = "com.jsf.database.model";
public final static String xmlMapperLocation = "classpath*:mapper/**/*.xml";
@Bean(name = "sqlSessionFactory")
@Primary
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) {
try {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
// we MUST set the 'VFS' if you use jar
bean.setVfs(SpringBootVFS.class);
// 实体类位置
bean.setTypeAliasesPackage(modelPackage);
// 设置mapper.xml文件所在位置
org.springframework.core.io.Resource[] resources = new PathMatchingResourcePatternResolver().getResources(xmlMapperLocation);
bean.setMapperLocations(resources);
// 添加分页插件
PageInterceptor pageHelper = new PageInterceptor();
Properties p = new Properties();
p.setProperty("helperDialect", "mysql"); // 数据库方言,注意如果是pg数据库,请替换为postgresql
p.setProperty("supportMethodsArguments", "true");
p.setProperty("params", "pageNum=pageNo;pageSize=pageSize;");
pageHelper.setProperties(p);
Interceptor[] plugins = new Interceptor[]{pageHelper};
bean.setPlugins(plugins);
return bean.getObject();
} catch (Exception e) {
logger.error("Database sqlSessionFactory create error!", e);
return null;
}
}
@Bean(name = "sqlSessionTemplate")
@Primary
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
/**
* 事务管理
*
* @return
*/
@Bean(name = "platformTransactionManager")
@Primary
public PlatformTransactionManager platformTransactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
| [
"809573150@qq.com"
] | 809573150@qq.com |
86cbb904c1bdde335c500fcc9b77d9f5440fcb0b | 0e0343f1ceacde0b67d7cbf6b0b81d08473265ab | /bpmn/aurora.bpmn.designer.rcp/src/aurora/ide/designer/diagram/feature/AChoreographyTaskFeatureContainer.java | 77cdc94dd178035e7cdd6db8b2cc864801f7a6d0 | [] | no_license | Chajunghun/aurora-project | 33d5f89e9f21c49d01d3d09d32102d3c496df851 | d4d39861446ea941929780505987dbaf9e3b7a8d | refs/heads/master | 2021-01-01T05:39:36.339810 | 2015-03-24T07:41:45 | 2015-03-24T07:41:45 | 33,435,911 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package aurora.ide.designer.diagram.feature;
import org.eclipse.bpmn2.modeler.ui.features.choreography.ChoreographyTaskFeatureContainer;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.custom.ICustomFeature;
import aurora.ide.bpmn.model.ex.feature.ShowWebSettingFeature;
public class AChoreographyTaskFeatureContainer extends
ChoreographyTaskFeatureContainer {
public ICustomFeature[] getCustomFeatures(IFeatureProvider fp) {
ICustomFeature[] superFeatures = super.getCustomFeatures(fp);
ICustomFeature[] thisFeatures = new ICustomFeature[1 + superFeatures.length];
for (int i = 0; i < superFeatures.length; ++i) {
thisFeatures[i] = superFeatures[i];
}
thisFeatures[superFeatures.length] = new ShowWebSettingFeature(fp);
return thisFeatures;
}
}
| [
"rufus.sly@gmail.com@c3805726-bc34-11dd-8164-2ff6f70dce53"
] | rufus.sly@gmail.com@c3805726-bc34-11dd-8164-2ff6f70dce53 |
7323677d33af4a505dcc5fd635a08a28bac17c72 | bd6316cee2e540976b560a61723db3bc2691915c | /src/main/java/com/github/hdy/common/util/WebUtils.java | 0631124584663e4fef5ae7627fcd410750988433 | [] | no_license | hdy10/boot-common | 28a994924f53e13bc2fc7585a979fca386467023 | 47548e0d237dacb4ec1457287a9212558fa35f27 | refs/heads/master | 2022-07-15T08:53:40.967985 | 2020-03-05T11:58:17 | 2020-03-05T11:58:17 | 193,711,374 | 0 | 2 | null | 2022-06-29T17:28:08 | 2019-06-25T13:18:21 | Java | UTF-8 | Java | false | false | 14,496 | java | package com.github.hdy.common.util;
import cn.hutool.core.codec.Base64;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.github.hdy.common.exceptions.CustomException;
import com.github.hdy.common.result.Results;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.method.HandlerMethod;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
/**
* Miscellaneous utilities for web applications.
*
* @author 贺大爷
* @date 2019/6/25
*/
@Slf4j
@UtilityClass
public class WebUtils extends org.springframework.web.util.WebUtils {
private final String BASIC_ = "Basic ";
private final String UNKNOWN = "unknown";
/**
* 判断是否ajax请求
* spring ajax 返回含有 ResponseBody 或者 RestController注解
*
* @param handlerMethod HandlerMethod
*
* @return 是否ajax请求
*/
public boolean isBody(HandlerMethod handlerMethod) {
ResponseBody responseBody = ClassUtils.getAnnotation(handlerMethod, ResponseBody.class);
return responseBody != null;
}
/**
* 读取cookie
*
* @param name cookie name
*
* @return cookie value
*/
public String getCookieVal(String name) {
HttpServletRequest request = WebUtils.getRequest();
Assert.notNull(request, "request from RequestContextHolder is null");
return getCookieVal(request, name);
}
/**
* 读取cookie
*
* @param request HttpServletRequest
* @param name cookie name
*
* @return cookie value
*/
public String getCookieVal(HttpServletRequest request, String name) {
Cookie cookie = getCookie(request, name);
return cookie != null ? cookie.getValue() : null;
}
/**
* 清除 某个指定的cookie
*
* @param response HttpServletResponse
* @param key cookie key
*/
public void removeCookie(HttpServletResponse response, String key) {
setCookie(response, key, null, 0);
}
/**
* 设置cookie
*
* @param response HttpServletResponse
* @param name cookie name
* @param value cookie value
* @param maxAgeInSeconds maxage
*/
public void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
cookie.setMaxAge(maxAgeInSeconds);
cookie.setHttpOnly(true);
response.addCookie(cookie);
}
/**
* 获取 HttpServletRequest
*
* @return {HttpServletRequest}
*/
public HttpServletRequest getRequest() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
}
/**
* 获取 HttpServletResponse
*
* @return {HttpServletResponse}
*/
public HttpServletResponse getResponse() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
}
/**
* 返回json
*
* @param response HttpServletResponse
* @param result 结果对象
*/
public void renderJson(HttpServletResponse response, Object result) {
renderJson(response, result, MediaType.APPLICATION_JSON_UTF8_VALUE);
}
/**
* 返回json
*
* @param response HttpServletResponse
* @param result 结果对象
* @param contentType contentType
*/
public void renderJson(HttpServletResponse response, Object result, String contentType) {
response.setCharacterEncoding("UTF-8");
response.setContentType(contentType);
try (PrintWriter out = response.getWriter()) {
out.append(JSONUtil.toJsonStr(result));
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
/**
* 获取ip
*
* @return {String}
*/
public String getIP() {
return getIP(WebUtils.getRequest());
}
/**
* 获取ip
*
* @param request HttpServletRequest
*
* @return {String}
*/
public String getIP(HttpServletRequest request) {
Assert.notNull(request, "HttpServletRequest is null");
String ip = request.getHeader("X-Requested-For");
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return StringUtils.isBlank(ip) ? null : ip.split(",")[0];
}
/**
* 从request 获取CLIENT_ID
*
* @return
*/
@SneakyThrows
public String[] getClientId(ServerHttpRequest request) {
String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
if (header == null || !header.startsWith(BASIC_)) {
throw new CustomException("请求头中client信息为空");
}
byte[] base64Token = header.substring(6).getBytes("UTF-8");
byte[] decoded;
try {
decoded = Base64.decode(base64Token);
} catch (IllegalArgumentException e) {
throw new CustomException(
"Failed to decode basic authentication token");
}
String token = new String(decoded, StandardCharsets.UTF_8);
int delim = token.indexOf(":");
if (delim == -1) {
throw new CustomException("Invalid basic authentication token");
}
return new String[]{token.substring(0, delim), token.substring(delim + 1)};
}
/**
* post请求
*
* @param url : 请求地址
* @param params : 参数 格式:{参数1=val&参数2=val}
*/
public static String URLPost(String url, Object params, HttpServletRequest request) {
DataOutputStream out = null;
BufferedReader in = null;
HttpURLConnection httpCon = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
httpCon = (HttpURLConnection) realUrl.openConnection();
httpCon.setConnectTimeout(60000);
httpCon.setReadTimeout(60000);
System.setProperty("sun.net.client.defaultConnectTimeout", "60000");
System.setProperty("sun.net.client.defaultReadTimeout", "60000");
//设置请求头里面的数据,以下设置用于解决http请求code415的问题
try {
JSON.parseObject(params.toString());
httpCon.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
} catch (Exception e) {
httpCon.setRequestProperty("text/plain", "application/json;charset=UTF-8");
}
// 发送POST请求必须设置如下两行
httpCon.setDoOutput(true);
httpCon.setDoInput(true);
// 获取URLConnection对象对应的输出流
PrintWriter printWriter = new PrintWriter(httpCon.getOutputStream());
// 发送请求参数
if (!Strings.isNull(params))
printWriter.write(params.toString());//post的参数 xx=xx&yy=yy
// flush输出流的缓冲
printWriter.flush();
// 定义BufferedReader输入流来读取URL的响应
//BufferedImage img = ImageIO.read(httpCon.getInputStream());
in = new BufferedReader(new InputStreamReader(httpCon.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送 POST 请求出现异常!url:{" + url + "}" + e);
Results results = new Results(202, "网络请求失败,请刷新重试", null);
return results.toString();
}// 使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
httpCon.disconnect();
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
public static String URLGet(String url, String param) {
String result = "";
BufferedReader in = null;
try {
String urlNameString = url + "?" + param;
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
connection.setRequestProperty("Referer", "https://www.baidu.com/s?wd=ip%E6%9F%A5%E8%AF%A2&rsv_spt=1&rsv_iqid=0x8b361eca0000b76d&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_sug3=6&rsv_sug1=4&rsv_sug7=100");
// 建立实际的连接
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段
/*for (String key : map.keySet()) {
System.out.println(key + "--->" + map.get(key));
}*/
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(
connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e);
e.printStackTrace();
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result;
}
/**
* post请求
*
* @param url : 请求地址
* @param params : 参数 格式:{参数1=val&参数2=val}
*/
public static String URLPostHead(String url, Object params, String... head) {
DataOutputStream out = null;
BufferedReader in = null;
HttpURLConnection httpCon = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
httpCon = (HttpURLConnection) realUrl.openConnection();
httpCon.setConnectTimeout(60000);
httpCon.setReadTimeout(60000);
System.setProperty("sun.net.client.defaultConnectTimeout", "60000");
System.setProperty("sun.net.client.defaultReadTimeout", "60000");
//设置请求头里面的数据,以下设置用于解决http请求code415的问题
try {
JSON.parseObject(params.toString());
httpCon.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
} catch (Exception e) {
httpCon.setRequestProperty("text/plain", "application/json;charset=UTF-8");
}
for (String s : head) {
httpCon.setRequestProperty(s.split("\\.")[0], s.split("\\.")[1]);
}
// 发送POST请求必须设置如下两行
httpCon.setDoOutput(true);
httpCon.setDoInput(true);
// 获取URLConnection对象对应的输出流
PrintWriter printWriter = new PrintWriter(httpCon.getOutputStream());
// 发送请求参数
if (!Strings.isNull(params))
printWriter.write(params.toString());//post的参数 xx=xx&yy=yy
// flush输出流的缓冲
printWriter.flush();
// 定义BufferedReader输入流来读取URL的响应
//BufferedImage img = ImageIO.read(httpCon.getInputStream());
in = new BufferedReader(new InputStreamReader(httpCon.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
Results results = new Results(202, "网络请求失败,请刷新重试", null);
return results.toString();
}// 使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
httpCon.disconnect();
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
}
| [
"498218711@qq.com"
] | 498218711@qq.com |
aef40a41e5a2f06d32a86bd73ccc400959bdfe5b | 984233ef1685225dda449306a3037e83e6e3e5b8 | /src/main/java/com/frank/netty/mqtt/store/DupPublishMessageStore.java | d45ca794fe23ab718802b1e6507789e3cc00bbf2 | [] | no_license | Flyerfrank/workspace | 81c62c13657e5dde5442043c973ba9a860924cca | 2b9fbc94bccef180ea33aedcee01f2b615f89973 | refs/heads/master | 2020-04-16T01:14:50.968965 | 2019-05-22T14:08:41 | 2019-05-22T14:08:41 | 165,165,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,439 | java | package com.frank.netty.mqtt.store;
import java.io.Serializable;
/**
* @author james
* @description PUBLISH重发消息存储
*/
public class DupPublishMessageStore implements Serializable {
private static final long serialVersionUID = -8112511377194421600L;
private String clientId;
private String topic;
private int mqttQoS;
private int messageId;
private byte[] messageBytes;
public DupPublishMessageStore() {
}
public String getClientId() {
return this.clientId;
}
public DupPublishMessageStore setClientId(String clientId) {
this.clientId = clientId;
return this;
}
public String getTopic() {
return this.topic;
}
public DupPublishMessageStore setTopic(String topic) {
this.topic = topic;
return this;
}
public int getMqttQoS() {
return this.mqttQoS;
}
public DupPublishMessageStore setMqttQoS(int mqttQoS) {
this.mqttQoS = mqttQoS;
return this;
}
public int getMessageId() {
return this.messageId;
}
public DupPublishMessageStore setMessageId(int messageId) {
this.messageId = messageId;
return this;
}
public byte[] getMessageBytes() {
return this.messageBytes;
}
public DupPublishMessageStore setMessageBytes(byte[] messageBytes) {
this.messageBytes = messageBytes;
return this;
}
}
| [
"710620070@qq.com"
] | 710620070@qq.com |
371cac0f0e531fa288562e3e9496d36e19022727 | 5c2bbb01cc18871ea5ee769fb0d2af565db63ee9 | /src/menu/MainMenu.java | 172f4aa65ca11f5fc1396558d57f79316c736b74 | [] | no_license | ConnorHGit/JumpingGame | 75e858cc55bf5381a9686c969ea198ce677b84be | 35b204a9b2dda4983f014fe4c42c0f6b41685e2b | refs/heads/master | 2020-06-08T09:55:59.137412 | 2014-11-07T02:32:47 | 2014-11-07T02:32:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 835 | java | package menu;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import game.Game;
import javax.swing.JButton;
public class MainMenu extends AbstractMenu {
public MainMenu(){
super();
addComponent(new JButton("Start"),350, 200, 100, 40);
((JButton) getComponent(0)).addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeMenu();
if(Game.g.entities.size() <= 0){
Game.g.startGame("testlevel.lvl");
}
else
Game.g.gameStarted = true;
}
});
}
@Override
public void render(Graphics g) {
}
@Override
public void openMenu() {
super.openMenu();
if(Game.g.entities.size() > 0)
((JButton) getComponent(0)).setText("Resume");
else
((JButton) getComponent(0)).setText("Start");
}
}
| [
"connor.infernaldoom@gmail.com"
] | connor.infernaldoom@gmail.com |
c3979393f095f4eb364da986fe19263050d15097 | a7b874f991d0bfb5f0caaec5acc5bc3c83eefa7b | /ocr-server/pre-requisitos/pdftk-2.02-dist/java/pdftk/org/bouncycastle/asn1/cmp/CertStatus.java | 67653608b06a7a782976b7b339766c3541765a41 | [] | no_license | wallacevff/OCR-SERVER-x64 | 0d25534675776db08f6964352fe4038c4797ec5a | 4d2627bb7cb478b49dcf482ad199e07b19d41b15 | refs/heads/master | 2023-03-31T21:41:41.643705 | 2021-03-28T14:22:40 | 2021-03-28T14:22:40 | 352,348,738 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,732 | java | package pdftk.org.bouncycastle.asn1.cmp;
import java.math.BigInteger;
import pdftk.org.bouncycastle.asn1.ASN1EncodableVector;
import pdftk.org.bouncycastle.asn1.ASN1Integer;
import pdftk.org.bouncycastle.asn1.ASN1Object;
import pdftk.org.bouncycastle.asn1.ASN1OctetString;
import pdftk.org.bouncycastle.asn1.ASN1Primitive;
import pdftk.org.bouncycastle.asn1.ASN1Sequence;
import pdftk.org.bouncycastle.asn1.DEROctetString;
import pdftk.org.bouncycastle.asn1.DERSequence;
public class CertStatus
extends ASN1Object
{
private ASN1OctetString certHash;
private ASN1Integer certReqId;
private PKIStatusInfo statusInfo;
private CertStatus(ASN1Sequence seq)
{
certHash = ASN1OctetString.getInstance(seq.getObjectAt(0));
certReqId = ASN1Integer.getInstance(seq.getObjectAt(1));
if (seq.size() > 2)
{
statusInfo = PKIStatusInfo.getInstance(seq.getObjectAt(2));
}
}
public CertStatus(byte[] certHash, BigInteger certReqId)
{
this.certHash = new DEROctetString(certHash);
this.certReqId = new ASN1Integer(certReqId);
}
public CertStatus(byte[] certHash, BigInteger certReqId, PKIStatusInfo statusInfo)
{
this.certHash = new DEROctetString(certHash);
this.certReqId = new ASN1Integer(certReqId);
this.statusInfo = statusInfo;
}
public static CertStatus getInstance(Object o)
{
if (o instanceof CertStatus)
{
return (CertStatus)o;
}
if (o != null)
{
return new CertStatus(ASN1Sequence.getInstance(o));
}
return null;
}
public ASN1OctetString getCertHash()
{
return certHash;
}
public ASN1Integer getCertReqId()
{
return certReqId;
}
public PKIStatusInfo getStatusInfo()
{
return statusInfo;
}
/**
* <pre>
* CertStatus ::= SEQUENCE {
* certHash OCTET STRING,
* -- the hash of the certificate, using the same hash algorithm
* -- as is used to create and verify the certificate signature
* certReqId INTEGER,
* -- to match this confirmation with the corresponding req/rep
* statusInfo PKIStatusInfo OPTIONAL
* }
* </pre>
* @return a basic ASN.1 object representation.
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(certHash);
v.add(certReqId);
if (statusInfo != null)
{
v.add(statusInfo);
}
return new DERSequence(v);
}
}
| [
"wallacevff@hotmail.com"
] | wallacevff@hotmail.com |
77428bc140ed6939192997912007efbb1f05ddb5 | f1acd13de6f9a5c474638f9a90c1367f7c81a7f6 | /src/main/java/com/tys/project/vo/PageMaker.java | c000dac746056f396d89431a472915a6b2563448 | [] | no_license | GUGUGOO/Homework | b658239de9e5a8c37f6e94b4ef82da042983d712 | 07a464b18dc347e5ae88d627f0275e5774285843 | refs/heads/main | 2023-01-19T04:58:17.746387 | 2020-11-29T22:04:48 | 2020-11-29T22:04:48 | 317,051,389 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,467 | java | package com.tys.project.vo;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
public class PageMaker {
private int totalCount;
private int startPage;
private int endPage;
private boolean prev;
private boolean next;
private int displayPageNum = 10;
private PagingVO pag;
public void setPag(PagingVO pag) {
this.pag = pag;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
calcData();
}
public int getTotalCount() {
return totalCount;
}
public int getStartPage() {
return startPage;
}
public int getEndPage() {
return endPage;
}
public boolean isPrev() {
return prev;
}
public boolean isNext() {
return next;
}
public int getDisplayPageNum() {
return displayPageNum;
}
public PagingVO getPag() {
return pag;
}
// 페이지 계산
private void calcData() {
endPage = (int) (Math.ceil(pag.getPage() / (double)displayPageNum) * displayPageNum);
startPage = (endPage - displayPageNum) + 1;
if(startPage <= 0) startPage = 1;
int tempEndPage = (int) (Math.ceil(totalCount / (double)pag.getPerPageNum()));
if (endPage > tempEndPage) {
endPage = tempEndPage;
}
prev = startPage == 1 ? false : true;
next = endPage * pag.getPerPageNum() >= totalCount ? false : true;
}
// 페이지 쿼리 작성
public String makeQuery(int page) {
UriComponents uriComponents =
UriComponentsBuilder.newInstance()
.queryParam("page", page)
.queryParam("perPageNum", pag.getPerPageNum())
.build();
return uriComponents.toUriString();
}
// 서칭 작성
public String makeSearch(int page) {
UriComponents uriComponents =
UriComponentsBuilder.newInstance()
.queryParam("page", page)
.queryParam("perPageNum", pag.getPerPageNum())
.queryParam("searchType", ((PagingSearchVO)pag).getSearchType())
.queryParam("keyword", encoding(((PagingSearchVO)pag).getKeyword()))
.build();
return uriComponents.toUriString();
}
// 인코딩
private String encoding(String keyword) {
if(keyword == null || keyword.trim().length() == 0) {
return "";
}
try {
return URLEncoder.encode(keyword,"UTF-8");
}
catch(UnsupportedEncodingException e) {
return "";
}
}
} | [
"noreply@github.com"
] | GUGUGOO.noreply@github.com |
d6ac97a452f378d55cbc72c4497f7398f7ad17b4 | 8d118326379f673fd0dbd83e20f282ce8f06421d | /sampletest/src/main/java/learning/ValidParentheses.java | 8fc9ab9a4cbe6f8e075b56e3a3f1b76777ccc801 | [] | no_license | chpsrinu/learning | c12545525216d68305c9c4391c8cdd7eda997682 | 718f0f30dbe87c284b377fad6a0ea8e7ee242722 | refs/heads/master | 2021-06-18T02:40:35.529924 | 2021-01-22T20:39:55 | 2021-01-22T20:39:55 | 150,308,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 824 | java | package learning;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
public class ValidParentheses {
public static boolean isValid(String s) {
Map<Character, Character> map = new HashMap<Character, Character>();
map.put('(', ')');
map.put('[', ']');
map.put('{', '}');
Stack<Character> stack = new Stack<>();
for (int i=0;i<s.length();i++) {
char curr = s.charAt(i);
if(map.keySet().contains(curr)) {
stack.push(curr);
} else if(map.values().contains(curr)) {
if (!stack.empty() && map.get(stack.peek()) == curr) {
stack.pop();
}
} else
return false;
}
return stack.empty();
}
public static void main(String[] args) {
System.out.println(isValid("()"));
System.out.println(isValid("(){}[]"));
System.out.println(isValid("(}"));
}
}
| [
"pchowdad@cisco.com"
] | pchowdad@cisco.com |
615aff086cd3645aa7b43cc5530713dd8281ec98 | 348880954053b1ed356b945ab29295a514e772ae | /hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/UtilizationEndpoint.java | 55f90552b3646c3cb9c70fb7aae72c570dad1c28 | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | bharatviswa504/hadoop-ozone | 434c781240ef0b8b81e6464d6d92aad9e0de0965 | bcfb64ae588c896fd540abcfb860cc9ddb9a2523 | refs/heads/master | 2023-08-11T03:53:53.586146 | 2022-01-12T05:24:01 | 2022-01-12T05:24:01 | 215,187,757 | 3 | 2 | Apache-2.0 | 2019-10-15T02:26:46 | 2019-10-15T02:26:46 | null | UTF-8 | Java | false | false | 3,781 | 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.hadoop.ozone.recon.api;
import javax.inject.Inject;
import org.hadoop.ozone.recon.schema.UtilizationSchemaDefinition;
import org.hadoop.ozone.recon.schema.tables.daos.FileCountBySizeDao;
import org.hadoop.ozone.recon.schema.tables.pojos.FileCountBySize;
import org.jooq.DSLContext;
import org.jooq.Record3;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Collections;
import java.util.List;
import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_QUERY_BUCKET;
import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_QUERY_FILE_SIZE;
import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_QUERY_VOLUME;
import static org.hadoop.ozone.recon.schema.tables.FileCountBySizeTable.FILE_COUNT_BY_SIZE;
/**
* Endpoint for querying the counts of a certain file Size.
*/
@Path("/utilization")
@Produces(MediaType.APPLICATION_JSON)
public class UtilizationEndpoint {
private FileCountBySizeDao fileCountBySizeDao;
private UtilizationSchemaDefinition utilizationSchemaDefinition;
@Inject
public UtilizationEndpoint(FileCountBySizeDao fileCountBySizeDao,
UtilizationSchemaDefinition
utilizationSchemaDefinition) {
this.utilizationSchemaDefinition = utilizationSchemaDefinition;
this.fileCountBySizeDao = fileCountBySizeDao;
}
/**
* Return the file counts from Recon DB.
* @return {@link Response}
*/
@GET
@Path("/fileCount")
public Response getFileCounts(
@QueryParam(RECON_QUERY_VOLUME)
String volume,
@QueryParam(RECON_QUERY_BUCKET)
String bucket,
@QueryParam(RECON_QUERY_FILE_SIZE)
long fileSize
) {
DSLContext dslContext = utilizationSchemaDefinition.getDSLContext();
List<FileCountBySize> resultSet;
if (volume != null && bucket != null && fileSize > 0) {
Record3<String, String, Long> recordToFind = dslContext
.newRecord(FILE_COUNT_BY_SIZE.VOLUME,
FILE_COUNT_BY_SIZE.BUCKET,
FILE_COUNT_BY_SIZE.FILE_SIZE)
.value1(volume)
.value2(bucket)
.value3(fileSize);
FileCountBySize record = fileCountBySizeDao.findById(recordToFind);
resultSet = record != null ?
Collections.singletonList(record) : Collections.emptyList();
} else if (volume != null && bucket != null) {
resultSet = dslContext.select().from(FILE_COUNT_BY_SIZE)
.where(FILE_COUNT_BY_SIZE.VOLUME.eq(volume))
.and(FILE_COUNT_BY_SIZE.BUCKET.eq(bucket))
.fetchInto(FileCountBySize.class);
} else if (volume != null) {
resultSet = fileCountBySizeDao.fetchByVolume(volume);
} else {
// fetch all records
resultSet = fileCountBySizeDao.findAll();
}
return Response.ok(resultSet).build();
}
}
| [
"noreply@github.com"
] | bharatviswa504.noreply@github.com |
277669c87177f9a9ece0483af60f66cb3e1bd98b | 1e2b8b6b12bca4eb32aa1745bccf4cbf548fe3c4 | /app/src/main/java/com/opalinskiy/ostap/pastebin/interactor/dagger/modules/ProfileModule.java | cab83eb5b161d50def5fd88f496947c69dcd29aa | [] | no_license | OstapOpalinskiy/PastebinAppClient | 34c73985d580ddbab65b361d863120f763531b15 | f145b8a2948592c00ea2e5cc035bf2f3705d50a2 | refs/heads/master | 2021-01-20T20:35:41.540214 | 2016-07-20T09:30:02 | 2016-07-20T09:30:02 | 63,152,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | package com.opalinskiy.ostap.pastebin.interactor.dagger.modules;
import android.content.SharedPreferences;
import com.opalinskiy.ostap.pastebin.interactor.IDataInteractor;
import com.opalinskiy.ostap.pastebin.interactor.RequestParams;
import com.opalinskiy.ostap.pastebin.screens.main_screen.IMainScreen;
import com.opalinskiy.ostap.pastebin.screens.profile_screen.IProfileScreen;
import com.opalinskiy.ostap.pastebin.screens.profile_screen.presenter.ProfilePresenter;
import dagger.Module;
import dagger.Provides;
@Module
public class ProfileModule {
IProfileScreen.IProfileView view;
public ProfileModule(IProfileScreen.IProfileView view) {
this.view = view;
}
@Provides
IProfileScreen.IPresenter provideProfileModule(IMainScreen.IPresenter mainPresenter, IDataInteractor model
, RequestParams parameters, SharedPreferences prefs) {
return new ProfilePresenter(mainPresenter, view, model, parameters, prefs);
}
} | [
"ostap.opal@gmail.com"
] | ostap.opal@gmail.com |
8c8e2689a8f18cd3bce82bf86d204b53998fc6ea | 7e2b10878b76fb7634655887224d44860d0be83a | /src/main/java/poc/raviraj/gwtapp/client/GwtApp.java | 4d331b0f5de65e70da841c0303a8253c0d735ca3 | [] | no_license | jcodesmarter/gwtappcfx | 7fe8de4450b0f1c8fcb1f6dbeed9cd00acd6dc1e | 0daa43f36137dd450090665337209a9450f21999 | refs/heads/master | 2021-01-19T12:53:00.063499 | 2017-04-14T12:50:30 | 2017-04-14T12:50:30 | 88,051,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package poc.raviraj.gwtapp.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootLayoutPanel;
public class GwtApp implements EntryPoint {
public static MainContainerLayout CONTAINER = new MainContainerLayout();
public void onModuleLoad() {
RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
rootLayoutPanel.add(CONTAINER);
}
}
| [
"ravirajs@citiustech.com"
] | ravirajs@citiustech.com |
b1ce0d4fa91e2f729ed421844b00ddc344be5e6e | 963599f6f1f376ba94cbb504e8b324bcce5de7a3 | /sources/com/jakewharton/rxbinding2/view/AutoValue_ViewLayoutChangeEvent.java | e55fffe58325d4ab54a9ec10e424cafdda3c9e17 | [] | no_license | NikiHard/cuddly-pancake | 563718cb73fdc4b7b12c6233d9bf44f381dd6759 | 3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4 | refs/heads/main | 2023-04-09T06:58:04.403056 | 2021-04-20T00:45:08 | 2021-04-20T00:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,890 | java | package com.jakewharton.rxbinding2.view;
import android.view.View;
final class AutoValue_ViewLayoutChangeEvent extends ViewLayoutChangeEvent {
private final int bottom;
private final int left;
private final int oldBottom;
private final int oldLeft;
private final int oldRight;
private final int oldTop;
private final int right;
private final int top;
private final View view;
AutoValue_ViewLayoutChangeEvent(View view2, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
if (view2 != null) {
this.view = view2;
this.left = i;
this.top = i2;
this.right = i3;
this.bottom = i4;
this.oldLeft = i5;
this.oldTop = i6;
this.oldRight = i7;
this.oldBottom = i8;
return;
}
throw new NullPointerException("Null view");
}
public View view() {
return this.view;
}
public int left() {
return this.left;
}
public int top() {
return this.top;
}
public int right() {
return this.right;
}
public int bottom() {
return this.bottom;
}
public int oldLeft() {
return this.oldLeft;
}
public int oldTop() {
return this.oldTop;
}
public int oldRight() {
return this.oldRight;
}
public int oldBottom() {
return this.oldBottom;
}
public String toString() {
return "ViewLayoutChangeEvent{view=" + this.view + ", left=" + this.left + ", top=" + this.top + ", right=" + this.right + ", bottom=" + this.bottom + ", oldLeft=" + this.oldLeft + ", oldTop=" + this.oldTop + ", oldRight=" + this.oldRight + ", oldBottom=" + this.oldBottom + "}";
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof ViewLayoutChangeEvent)) {
return false;
}
ViewLayoutChangeEvent viewLayoutChangeEvent = (ViewLayoutChangeEvent) obj;
if (this.view.equals(viewLayoutChangeEvent.view()) && this.left == viewLayoutChangeEvent.left() && this.top == viewLayoutChangeEvent.top() && this.right == viewLayoutChangeEvent.right() && this.bottom == viewLayoutChangeEvent.bottom() && this.oldLeft == viewLayoutChangeEvent.oldLeft() && this.oldTop == viewLayoutChangeEvent.oldTop() && this.oldRight == viewLayoutChangeEvent.oldRight() && this.oldBottom == viewLayoutChangeEvent.oldBottom()) {
return true;
}
return false;
}
public int hashCode() {
return ((((((((((((((((this.view.hashCode() ^ 1000003) * 1000003) ^ this.left) * 1000003) ^ this.top) * 1000003) ^ this.right) * 1000003) ^ this.bottom) * 1000003) ^ this.oldLeft) * 1000003) ^ this.oldTop) * 1000003) ^ this.oldRight) * 1000003) ^ this.oldBottom;
}
}
| [
"a.amirovv@mail.ru"
] | a.amirovv@mail.ru |
56757f232bad86506be57b45cbfd8841e94828ea | 5741045375dcbbafcf7288d65a11c44de2e56484 | /reddit-decompilada/com/google/android/gms/internal/zzfiq.java | 47a1341e9dfe0e55c6b311581e20a06362622209 | [] | no_license | miarevalo10/ReporteReddit | 18dd19bcec46c42ff933bb330ba65280615c281c | a0db5538e85e9a081bf268cb1590f0eeb113ed77 | refs/heads/master | 2020-03-16T17:42:34.840154 | 2018-05-11T10:16:04 | 2018-05-11T10:16:04 | 132,843,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,566 | java | package com.google.android.gms.internal;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.nio.ByteOrder;
import java.util.logging.Level;
import java.util.logging.Logger;
import sun.misc.Unsafe;
final class zzfiq {
private static final Logger f7472a = Logger.getLogger(zzfiq.class.getName());
private static final Unsafe f7473b = m6112d();
private static final Class<?> f7474c = m6099a("libcore.io.Memory");
private static final boolean f7475d = (m6099a("org.robolectric.Robolectric") != null);
private static final boolean f7476e = m6111c(Long.TYPE);
private static final boolean f7477f = m6111c(Integer.TYPE);
private static final zzd f7478g;
private static final boolean f7479h = m6114f();
private static final boolean f7480i = m6113e();
private static final long f7481j = ((long) m6098a(byte[].class));
private static final long f7482k = ((long) m6098a(boolean[].class));
private static final long f7483l = ((long) m6106b(boolean[].class));
private static final long f7484m = ((long) m6098a(int[].class));
private static final long f7485n = ((long) m6106b(int[].class));
private static final long f7486o = ((long) m6098a(long[].class));
private static final long f7487p = ((long) m6106b(long[].class));
private static final long f7488q = ((long) m6098a(float[].class));
private static final long f7489r = ((long) m6106b(float[].class));
private static final long f7490s = ((long) m6098a(double[].class));
private static final long f7491t = ((long) m6106b(double[].class));
private static final long f7492u = ((long) m6098a(Object[].class));
private static final long f7493v = ((long) m6106b(Object[].class));
private static final long f7494w;
private static final boolean f7495x;
static abstract class zzd {
Unsafe f7471a;
zzd(Unsafe unsafe) {
this.f7471a = unsafe;
}
public abstract byte mo1923a(Object obj, long j);
public abstract void mo1924a(Object obj, long j, byte b);
}
static final class zza extends zzd {
zza(Unsafe unsafe) {
super(unsafe);
}
public final byte mo1923a(Object obj, long j) {
return zzfiq.f7495x ? zzfiq.m6096a(obj, j) : ((byte) (zzfiq.m6109c(obj, -4 & j) >>> ((int) ((j & 3) << 3))));
}
public final void mo1924a(Object obj, long j, byte b) {
if (zzfiq.f7495x) {
zzfiq.m6101a(obj, j, b);
} else {
zzfiq.m6107b(obj, j, b);
}
}
}
static final class zzb extends zzd {
zzb(Unsafe unsafe) {
super(unsafe);
}
public final byte mo1923a(Object obj, long j) {
return zzfiq.f7495x ? zzfiq.m6096a(obj, j) : ((byte) (zzfiq.m6109c(obj, -4 & j) >>> ((int) ((j & 3) << 3))));
}
public final void mo1924a(Object obj, long j, byte b) {
if (zzfiq.f7495x) {
zzfiq.m6101a(obj, j, b);
} else {
zzfiq.m6107b(obj, j, b);
}
}
}
static final class zzc extends zzd {
zzc(Unsafe unsafe) {
super(unsafe);
}
public final byte mo1923a(Object obj, long j) {
return this.a.getByte(obj, j);
}
public final void mo1924a(Object obj, long j, byte b) {
this.a.putByte(obj, j, b);
}
}
static {
Field a;
long objectFieldOffset;
boolean z = false;
zzd com_google_android_gms_internal_zzfiq_zzd = null;
if (f7473b != null) {
if (!m6115g()) {
com_google_android_gms_internal_zzfiq_zzd = new zzc(f7473b);
} else if (f7476e) {
com_google_android_gms_internal_zzfiq_zzd = new zzb(f7473b);
} else if (f7477f) {
com_google_android_gms_internal_zzfiq_zzd = new zza(f7473b);
}
}
f7478g = com_google_android_gms_internal_zzfiq_zzd;
if (m6115g()) {
a = m6100a(Buffer.class, "effectiveDirectAddress");
if (a != null) {
if (a != null) {
if (f7478g == null) {
objectFieldOffset = f7478g.f7471a.objectFieldOffset(a);
f7494w = objectFieldOffset;
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
z = true;
}
f7495x = z;
}
}
objectFieldOffset = -1;
f7494w = objectFieldOffset;
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
z = true;
}
f7495x = z;
}
}
a = m6100a(Buffer.class, "address");
if (a != null) {
if (f7478g == null) {
objectFieldOffset = f7478g.f7471a.objectFieldOffset(a);
f7494w = objectFieldOffset;
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
z = true;
}
f7495x = z;
}
}
objectFieldOffset = -1;
f7494w = objectFieldOffset;
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
z = true;
}
f7495x = z;
}
private zzfiq() {
}
static /* synthetic */ byte m6096a(java.lang.Object r1, long r2) {
/* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: com.google.android.gms.internal.zzfiq.a(java.lang.Object, long):byte
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:116)
at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:249)
at jadx.core.ProcessClass.process(ProcessClass.java:34)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
Caused by: jadx.core.utils.exceptions.DecodeException: Unknown instruction: not-long
at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:568)
at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:56)
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:102)
... 5 more
*/
/*
// Can't load method instructions.
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.a(java.lang.Object, long):byte");
}
static byte m6097a(byte[] bArr, long j) {
return f7478g.mo1923a(bArr, f7481j + j);
}
private static int m6098a(Class<?> cls) {
return f7480i ? f7478g.f7471a.arrayBaseOffset(cls) : -1;
}
private static <T> java.lang.Class<T> m6099a(java.lang.String r0) {
/* JADX: method processing error */
/*
Error: java.lang.NullPointerException
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.searchTryCatchDominators(ProcessTryCatchRegions.java:75)
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.process(ProcessTryCatchRegions.java:45)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.postProcessRegions(RegionMakerVisitor.java:63)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:58)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
at jadx.core.ProcessClass.process(ProcessClass.java:37)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
*/
/*
r0 = java.lang.Class.forName(r0); Catch:{ Throwable -> 0x0005 }
return r0;
L_0x0005:
r0 = 0;
return r0;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.a(java.lang.String):java.lang.Class<T>");
}
private static java.lang.reflect.Field m6100a(java.lang.Class<?> r0, java.lang.String r1) {
/* JADX: method processing error */
/*
Error: java.lang.NullPointerException
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.searchTryCatchDominators(ProcessTryCatchRegions.java:75)
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.process(ProcessTryCatchRegions.java:45)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.postProcessRegions(RegionMakerVisitor.java:63)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:58)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
at jadx.core.ProcessClass.process(ProcessClass.java:37)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
*/
/*
r0 = r0.getDeclaredField(r1); Catch:{ Throwable -> 0x0009 }
r1 = 1; Catch:{ Throwable -> 0x0009 }
r0.setAccessible(r1); Catch:{ Throwable -> 0x0009 }
return r0;
L_0x0009:
r0 = 0;
return r0;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.a(java.lang.Class, java.lang.String):java.lang.reflect.Field");
}
static /* synthetic */ void m6101a(java.lang.Object r1, long r2, byte r4) {
/* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: com.google.android.gms.internal.zzfiq.a(java.lang.Object, long, byte):void
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:116)
at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:249)
at jadx.core.ProcessClass.process(ProcessClass.java:34)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
Caused by: jadx.core.utils.exceptions.DecodeException: Unknown instruction: not-int
at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:568)
at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:56)
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:102)
... 5 more
*/
/*
// Can't load method instructions.
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.a(java.lang.Object, long, byte):void");
}
private static void m6102a(Object obj, long j, int i) {
f7478g.f7471a.putInt(obj, j, i);
}
static void m6103a(byte[] bArr, long j, byte b) {
f7478g.mo1924a(bArr, f7481j + j, b);
}
static boolean m6104a() {
return f7480i;
}
private static int m6106b(Class<?> cls) {
return f7480i ? f7478g.f7471a.arrayIndexScale(cls) : -1;
}
static /* synthetic */ void m6107b(java.lang.Object r1, long r2, byte r4) {
/* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: com.google.android.gms.internal.zzfiq.b(java.lang.Object, long, byte):void
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:116)
at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:249)
at jadx.core.ProcessClass.process(ProcessClass.java:34)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
Caused by: jadx.core.utils.exceptions.DecodeException: Unknown instruction: not-int
at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:568)
at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:56)
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:102)
... 5 more
*/
/*
// Can't load method instructions.
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.b(java.lang.Object, long, byte):void");
}
static boolean m6108b() {
return f7479h;
}
private static boolean m6111c(java.lang.Class<?> r9) {
/* JADX: method processing error */
/*
Error: java.lang.NullPointerException
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.searchTryCatchDominators(ProcessTryCatchRegions.java:75)
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.process(ProcessTryCatchRegions.java:45)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.postProcessRegions(RegionMakerVisitor.java:63)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:58)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
at jadx.core.ProcessClass.process(ProcessClass.java:37)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
*/
/*
r0 = m6115g();
r1 = 0;
if (r0 != 0) goto L_0x0008;
L_0x0007:
return r1;
L_0x0008:
r0 = f7474c; Catch:{ Throwable -> 0x008b }
r2 = "peekLong"; Catch:{ Throwable -> 0x008b }
r3 = 2; Catch:{ Throwable -> 0x008b }
r4 = new java.lang.Class[r3]; Catch:{ Throwable -> 0x008b }
r4[r1] = r9; Catch:{ Throwable -> 0x008b }
r5 = java.lang.Boolean.TYPE; Catch:{ Throwable -> 0x008b }
r6 = 1; Catch:{ Throwable -> 0x008b }
r4[r6] = r5; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r4); Catch:{ Throwable -> 0x008b }
r2 = "pokeLong"; Catch:{ Throwable -> 0x008b }
r4 = 3; Catch:{ Throwable -> 0x008b }
r5 = new java.lang.Class[r4]; Catch:{ Throwable -> 0x008b }
r5[r1] = r9; Catch:{ Throwable -> 0x008b }
r7 = java.lang.Long.TYPE; Catch:{ Throwable -> 0x008b }
r5[r6] = r7; Catch:{ Throwable -> 0x008b }
r7 = java.lang.Boolean.TYPE; Catch:{ Throwable -> 0x008b }
r5[r3] = r7; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r5); Catch:{ Throwable -> 0x008b }
r2 = "pokeInt"; Catch:{ Throwable -> 0x008b }
r5 = new java.lang.Class[r4]; Catch:{ Throwable -> 0x008b }
r5[r1] = r9; Catch:{ Throwable -> 0x008b }
r7 = java.lang.Integer.TYPE; Catch:{ Throwable -> 0x008b }
r5[r6] = r7; Catch:{ Throwable -> 0x008b }
r7 = java.lang.Boolean.TYPE; Catch:{ Throwable -> 0x008b }
r5[r3] = r7; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r5); Catch:{ Throwable -> 0x008b }
r2 = "peekInt"; Catch:{ Throwable -> 0x008b }
r5 = new java.lang.Class[r3]; Catch:{ Throwable -> 0x008b }
r5[r1] = r9; Catch:{ Throwable -> 0x008b }
r7 = java.lang.Boolean.TYPE; Catch:{ Throwable -> 0x008b }
r5[r6] = r7; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r5); Catch:{ Throwable -> 0x008b }
r2 = "pokeByte"; Catch:{ Throwable -> 0x008b }
r5 = new java.lang.Class[r3]; Catch:{ Throwable -> 0x008b }
r5[r1] = r9; Catch:{ Throwable -> 0x008b }
r7 = java.lang.Byte.TYPE; Catch:{ Throwable -> 0x008b }
r5[r6] = r7; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r5); Catch:{ Throwable -> 0x008b }
r2 = "peekByte"; Catch:{ Throwable -> 0x008b }
r5 = new java.lang.Class[r6]; Catch:{ Throwable -> 0x008b }
r5[r1] = r9; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r5); Catch:{ Throwable -> 0x008b }
r2 = "pokeByteArray"; Catch:{ Throwable -> 0x008b }
r5 = 4; Catch:{ Throwable -> 0x008b }
r7 = new java.lang.Class[r5]; Catch:{ Throwable -> 0x008b }
r7[r1] = r9; Catch:{ Throwable -> 0x008b }
r8 = byte[].class; Catch:{ Throwable -> 0x008b }
r7[r6] = r8; Catch:{ Throwable -> 0x008b }
r8 = java.lang.Integer.TYPE; Catch:{ Throwable -> 0x008b }
r7[r3] = r8; Catch:{ Throwable -> 0x008b }
r8 = java.lang.Integer.TYPE; Catch:{ Throwable -> 0x008b }
r7[r4] = r8; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r7); Catch:{ Throwable -> 0x008b }
r2 = "peekByteArray"; Catch:{ Throwable -> 0x008b }
r5 = new java.lang.Class[r5]; Catch:{ Throwable -> 0x008b }
r5[r1] = r9; Catch:{ Throwable -> 0x008b }
r9 = byte[].class; Catch:{ Throwable -> 0x008b }
r5[r6] = r9; Catch:{ Throwable -> 0x008b }
r9 = java.lang.Integer.TYPE; Catch:{ Throwable -> 0x008b }
r5[r3] = r9; Catch:{ Throwable -> 0x008b }
r9 = java.lang.Integer.TYPE; Catch:{ Throwable -> 0x008b }
r5[r4] = r9; Catch:{ Throwable -> 0x008b }
r0.getMethod(r2, r5); Catch:{ Throwable -> 0x008b }
return r6;
L_0x008b:
return r1;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.c(java.lang.Class):boolean");
}
private static sun.misc.Unsafe m6112d() {
/* JADX: method processing error */
/*
Error: java.lang.NullPointerException
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.searchTryCatchDominators(ProcessTryCatchRegions.java:75)
at jadx.core.dex.visitors.regions.ProcessTryCatchRegions.process(ProcessTryCatchRegions.java:45)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.postProcessRegions(RegionMakerVisitor.java:63)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:58)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
at jadx.core.ProcessClass.process(ProcessClass.java:37)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:199)
*/
/*
r0 = new com.google.android.gms.internal.zzfir; Catch:{ Throwable -> 0x000c }
r0.<init>(); Catch:{ Throwable -> 0x000c }
r0 = java.security.AccessController.doPrivileged(r0); Catch:{ Throwable -> 0x000c }
r0 = (sun.misc.Unsafe) r0; Catch:{ Throwable -> 0x000c }
return r0;
L_0x000c:
r0 = 0;
return r0;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfiq.d():sun.misc.Unsafe");
}
private static boolean m6113e() {
if (f7473b == null) {
return false;
}
try {
Class cls = f7473b.getClass();
cls.getMethod("objectFieldOffset", new Class[]{Field.class});
cls.getMethod("arrayBaseOffset", new Class[]{Class.class});
cls.getMethod("arrayIndexScale", new Class[]{Class.class});
cls.getMethod("getInt", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putInt", new Class[]{Object.class, Long.TYPE, Integer.TYPE});
cls.getMethod("getLong", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putLong", new Class[]{Object.class, Long.TYPE, Long.TYPE});
cls.getMethod("getObject", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putObject", new Class[]{Object.class, Long.TYPE, Object.class});
if (m6115g()) {
return true;
}
cls.getMethod("getByte", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putByte", new Class[]{Object.class, Long.TYPE, Byte.TYPE});
cls.getMethod("getBoolean", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putBoolean", new Class[]{Object.class, Long.TYPE, Boolean.TYPE});
cls.getMethod("getFloat", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putFloat", new Class[]{Object.class, Long.TYPE, Float.TYPE});
cls.getMethod("getDouble", new Class[]{Object.class, Long.TYPE});
cls.getMethod("putDouble", new Class[]{Object.class, Long.TYPE, Double.TYPE});
return true;
} catch (Throwable th) {
String valueOf = String.valueOf(th);
StringBuilder stringBuilder = new StringBuilder(71 + String.valueOf(valueOf).length());
stringBuilder.append("platform method missing - proto runtime falling back to safer methods: ");
stringBuilder.append(valueOf);
f7472a.logp(Level.WARNING, "com.google.protobuf.UnsafeUtil", "supportsUnsafeArrayOperations", stringBuilder.toString());
return false;
}
}
private static boolean m6114f() {
if (f7473b == null) {
return false;
}
try {
Class cls = f7473b.getClass();
cls.getMethod("objectFieldOffset", new Class[]{Field.class});
cls.getMethod("getLong", new Class[]{Object.class, Long.TYPE});
if (m6115g()) {
return true;
}
cls.getMethod("getByte", new Class[]{Long.TYPE});
cls.getMethod("putByte", new Class[]{Long.TYPE, Byte.TYPE});
cls.getMethod("getInt", new Class[]{Long.TYPE});
cls.getMethod("putInt", new Class[]{Long.TYPE, Integer.TYPE});
cls.getMethod("getLong", new Class[]{Long.TYPE});
cls.getMethod("putLong", new Class[]{Long.TYPE, Long.TYPE});
cls.getMethod("copyMemory", new Class[]{Long.TYPE, Long.TYPE, Long.TYPE});
cls.getMethod("copyMemory", new Class[]{Object.class, Long.TYPE, Object.class, Long.TYPE, Long.TYPE});
return true;
} catch (Throwable th) {
String valueOf = String.valueOf(th);
StringBuilder stringBuilder = new StringBuilder(71 + String.valueOf(valueOf).length());
stringBuilder.append("platform method missing - proto runtime falling back to safer methods: ");
stringBuilder.append(valueOf);
f7472a.logp(Level.WARNING, "com.google.protobuf.UnsafeUtil", "supportsUnsafeByteBufferOperations", stringBuilder.toString());
return false;
}
}
private static boolean m6115g() {
return (f7474c == null || f7475d) ? false : true;
}
private static int m6109c(Object obj, long j) {
return f7478g.f7471a.getInt(obj, j);
}
}
| [
"mi.arevalo10@uniandes.edu.co"
] | mi.arevalo10@uniandes.edu.co |
0640050738cf9515a319f5830645f214d7aafa34 | d52bf0f78ac89d183d755345741094c0dfb1fe89 | /Key_value_DB/DBMS/Hashmap_DB.java | ca23eb73814abb7b8f92f5896f0abaf1edf073d2 | [] | no_license | Kvetter/Spring2018Database | 7e2021763a629fa4aa50e04445554e083962c9e6 | 0962801786620b8b87eee208939c1a013af8fd5b | refs/heads/master | 2021-09-06T10:29:57.719993 | 2018-02-05T15:19:20 | 2018-02-05T15:19:20 | 119,988,484 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,917 | java | package DBMS;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
public class Hashmap_DB {
private HashMap<String ,Long> map;
private File file;
private RandomAccessFile raf;
/**
* Constructer that creates the objects needed to store our data and read and write to a file
* @throws IOException
*/
public Hashmap_DB () throws IOException {
file = new File(System.getProperty("user.dir") + "/DB/database");
raf = new RandomAccessFile(file, "rw");
map = createHashMap();
}
/**
* Checks weather our database file exists and reads the data from that file while saving the key and
* the byte offset in our hashmap
* @return A hashmap, either generated with data from our database, or a new empty one
* @throws IOException
*/
public HashMap createHashMap() throws IOException {
if (file.exists()) {
HashMap<String, Long> hashmap = new HashMap<>();
// A loop that reads a line from our file, splitting it so we only get the key
// and getting the byte offset to store in our hashmap
for (Long i = Long.valueOf(0); i < raf.length(); i = raf.getFilePointer()) {
//String to store data from our file
String keyBuilder = new String();
//Getting the byte offset
Long pointer = raf.getFilePointer();
//Reading a line from our database, where we split on the byte value for a comma (,)
String[] line = raf.readLine().split("00101100 ");
//Parsing the byte value to a string so it can be read
String[] keyData = line[0].split("\\s+");
for (String key : keyData) {
keyBuilder += (char) Integer.parseInt(key, 2);
}
//Saving the key and byte offset in our hashmap
hashmap.put(keyBuilder, pointer);
}
return hashmap;
} else {
return new HashMap<>();
}
}
/**
* We set the byte offset and reads the data from our database file
* @param key
* @return String
* @throws IOException
*/
public String dbRead(String key) throws IOException {
// Setting the offset to the value, so we know exactly where our data is stored in the database file
raf.seek(map.get(key));
//Reads the data and splitting it on the byte value for a comma (,)
String[] dataLine = raf.readLine().split("00101100 ");
// Convert the binary string to a human readable value
String data = new String();
String[] valueData = dataLine[1].split("\\s+");
for (String value : valueData) {
data += (char) Integer.parseInt(value, 2);
}
//Removing the key, so we only show the value
return data.toString().replaceAll(".*,", "");
}
/**
* Saving the key and byte offset in our hashmap and saves both the key and value in the database file
* @param key
* @param value
* @throws IOException
*/
public void dbWrite (String key, String value) throws IOException {
String data = key + "," + value;
// Creating a byte array to store our key and value
byte[] byteArray = data.getBytes(StandardCharsets.UTF_8);
//Saving the key and byte offset in our hashmap
map.put(key, raf.getFilePointer());
// Convert the value to binary
String byteData = "";
for (byte b : byteArray) {
byteData += String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0').concat(" ");
}
//Saves the binary data in the db file
raf.writeBytes(byteData);
//Creating a newline in the db file
raf.writeBytes(System.getProperty("line.separator"));
}
}
| [
"kasper.vetter@mail.dk"
] | kasper.vetter@mail.dk |
ae350592aaf3acf7729a80c689f3eb5f8311b9b5 | be0b29dc7d4927c7265774aca643e9f86ad6de15 | /app/src/main/java/com/example/androidbaseproject/MainApplication.java | bebeda248ba4756b2686594dea3c89cb8af73ed6 | [
"Apache-2.0"
] | permissive | MarkyC/android-base-project | 5808ccfbae89f8a2dd6db24360cd227c44cef227 | bd987919a90b03dcf765926954c4526c068fb837 | refs/heads/master | 2020-02-26T13:11:48.712793 | 2016-07-20T21:39:01 | 2016-07-20T21:39:01 | 63,805,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.example.androidbaseproject;
import android.app.Application;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import io.fabric.sdk.android.Fabric;
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
setupFabric();
}
/**
* Sets up this application to use Fabric
*/
private void setupFabric() {
// Set up Crashlytics, disabled for debug builds
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
// Initialize Fabric with the debug-disabled crashlytics.
Fabric.with(this, crashlyticsKit);
}
}
| [
"marco@clearbridgemobile.com"
] | marco@clearbridgemobile.com |
f492e0d586c2af2261fa605486d055c56d9f1ac0 | c659d4831bb28238d9874a9285e45c7910312633 | /src/sample/notes/ControllerNotesBoard.java | b93b20d3aaf7efc5292ba86a78f891dab3dd5220 | [] | no_license | RaphaelStYves/untiled5 | 77c713b9c1d12afc285eb6da8a84ff191bd12277 | a6164a69ab20c95ccbaf49b8b01062903a51397f | refs/heads/master | 2021-09-04T19:26:43.569650 | 2018-01-21T18:09:26 | 2018-01-21T18:09:26 | 113,800,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,331 | java | package sample.notes;
import javafx.fxml.FXML;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import sample.chordBoard.ControllerChordBoard;
import sample.chordFinder.*;
import sample.model.AlgoNote;
import sample.model.EChord;
import sample.model.Piece;
import sample.model.Pulse;
import java.util.List;
import java.util.Map;
import static sample.Main.*;
public class ControllerNotesBoard {
private Scene scene;
private Piece oldPiece;
private Piece newPiece;
@FXML
private Canvas canvas;
private Canvas canvas2 = new Canvas(1920, 900);
@FXML
private Pane pane;
@FXML
public void loadAllComponants() {
deleteCanvas();
createHorizontalLine();
createVerticalLine();
loadNotes(oldPiece, Color.RED, 0.35, 1.20);
loadNotes(newPiece, Color.GREEN, 1, 1);
pane.getChildren().addAll(canvas, canvas2);
}
public void movingBar(int count) {
canvas2.getGraphicsContext2D().clearRect(0, 0, 2000, 2000);
GraphicsContext bar = canvas2.getGraphicsContext2D();
bar.setFill(Color.RED);
bar.setGlobalAlpha(1);
bar.fillRoundRect(count * NOTEWIDTH, 3, 3, ((NBNOTE + 1) * NOTEHEIGHT), 10, 10);
}
public void initialize() {
createHorizontalLine();
createVerticalLine();
pane.setOnMouseClicked(event -> {
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setFill(Color.BLACK);
gc.setGlobalAlpha(0.30);
gc.fillRoundRect(0, ((int) (event.getY() / NOTEHEIGHT)) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
System.out.println(event.getY() - NOTEHEIGHT / 2);
});
}
public void deleteCanvas() {
pane.getChildren().clear();
canvas.getGraphicsContext2D().clearRect(0, 0, 2000, 2000);
}
public void loadNotes(Piece piece, Color color, double opacity, double bigger) {
GraphicsContext gc = canvas.getGraphicsContext2D();
for (int i = 0; i < piece.notes.size(); i++) {
if (piece.notes.get(i).getOn() && (piece.notes.get(i).getPulse16()) < NBPULSEVISIBLE) {
if (piece.notes.get(i).getTracknumber() == 0)
gc.setFill(color);
gc.setGlobalAlpha(opacity);
gc.setStroke(Color.BLACK);
gc.strokeRoundRect(piece.notes.get(i).getPulse16() * NOTEWIDTH, (NBNOTE - notePlace(piece.notes.get(i).getCNote())) * NOTEHEIGHT, piece.notes.get(i).getLenght16() * NOTEWIDTH, NOTEHEIGHT * bigger, 10, 10);
Color color1 = selectTheColorTrack(piece.notes.get(i).getTracknumber());
gc.setFill(color1);
gc.fillRoundRect(piece.notes.get(i).getPulse16() * NOTEWIDTH, (NBNOTE - notePlace(piece.notes.get(i).getCNote())) * NOTEHEIGHT, piece.notes.get(i).getLenght16() * NOTEWIDTH, NOTEHEIGHT * bigger, 10, 10);
// gc.strokeText(Integer.toString(piece.notes.get(i).getPulse16()), piece.notes.get(i).getPulse16() * NOTEWIDTH, (NBNOTE - notePlace(piece.notes.get(i).getCNote())) * NOTEHEIGHT);
}
}
}
private Color selectTheColorTrack(int trackNumber) {
switch (trackNumber) {
case 0: return Color.BLUE;
case 1: return Color.YELLOWGREEN;
case 2: return Color.RED;
case 3: return Color.GRAY;
case 4: return Color.GREEN;
case 5: return Color.BLUE;
case 6: return Color.YELLOWGREEN;
case 7: return Color.RED;
case 8: return Color.GRAY;
case 9:return Color.GREEN;
case 10: return Color.BLUE;
case 11:return Color.YELLOWGREEN;
case 12: return Color.RED;
case 13: return Color.GRAY;
case 14: return Color.GREEN;
case 15: return Color.GREEN;
}
return Color.BLUE;
}
private int notePlace(int cnote) {
int div = cnote / 12;
switch (cnote % 12) {
case 0: return div * 7 + 0;
case 1: return div * 7 + 0;
case 2: return div * 7 + 1;
case 3:return div * 7 + 1;
case 4:return div * 7 + 2;
case 5: return div * 7 + 3;
case 6:return div * 7 + 3;
case 7:return div * 7 + 4;
case 8: return div * 7 + 4;
case 9: return div * 7 + 5;
case 10: return div * 7 + 5;
case 11: return div * 7 + 6;
}
return 13;
}
private void createVerticalLine() {
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setFill(Color.BLUE);
gc.setGlobalAlpha(0.20);
for (int i = 0; i <= NBPULSEVISIBLE; i++) {
if (i % 2 == 0) {
gc.fillRoundRect(i * NOTEWIDTH, 0, 3, ((NBNOTE + 1) * NOTEHEIGHT), 10, 10);
}
if (i % 16 == 0) {
gc.fillRoundRect(i * NOTEWIDTH, 0, 3, ((NBNOTE + 1) * NOTEHEIGHT), 10, 10);
}
}
}
public void createHorizontalLine() {
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setFill(Color.BLUE);
gc.setGlobalAlpha(0.20);
for (int i = 0; i <= NBNOTE; i++) {
switch (i % 7) {
case 0:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
// gc.strokeText("C", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
case 1:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
//gc.strokeText("D", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
case 2:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
// gc.strokeText("E", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
case 3:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
// gc.strokeText("F", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
case 4:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
// gc.strokeText("G", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
case 5:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
// gc.strokeText("A", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
case 6:
gc.fillRoundRect(0, (NBNOTE - i) * NOTEHEIGHT, NOTEWIDTH * NBPULSEVISIBLE, NOTEHEIGHT, 10, 10);
//gc.strokeText("B", TXTAJUTX, (NBNOTE - i) * NOTEHEIGHT + TXTAJUTY);
break;
}
}
}
public void noteAlgo(ControllerChordBoard controllerChordBoard) {
for (Map.Entry<Integer, Pulse> entry : oldPiece.pulses.entrySet()) {
if (entry.getKey() <= NBPULSEVISIBLE) {
for (int j = 0; j < entry.getValue().getNotes().size(); j++) {
int noteOld = entry.getValue().getNotes().get(j).getCNote();
EChord echordOld = controllerChordBoard.getMapTilesOld().get(entry.getKey());
EChord echordNew = controllerChordBoard.getMapTilesNew().get(entry.getKey());
int noteNew = AlgoNote.changenote(echordOld, echordNew, noteOld);
newPiece.pulses.get(entry.getKey()).getNotes().get(j).setCNote(noteNew);
}
}
}
loadAllComponants();
}
/**
* Is called by the main application to give a reference back to itself.
*
* @param oldPiece
*/
public void setPiece(Piece oldPiece, Piece newPiece) {
this.oldPiece = oldPiece;
this.newPiece = newPiece;
}
public void setAloView(int[][] array) {
GraphicsContext gc = canvas.getGraphicsContext2D();
for (int i = 0; i < NBPULSEVISIBLE; i++) {
for (int j = 0; j < 12; j++) {
if (array[i][j] == 1) {
gc.setStroke(Color.BLACK);
gc.strokeText(Integer.toString(array[i][j]), i * NOTEWIDTH, (12 - notePlace(j) + 3) * NOTEHEIGHT);
}
}
}
}
public void setAloViewPulseList(List<PulseChord> listPulse) {
GraphicsContext gc = canvas.getGraphicsContext2D();
for (int i = 0; i < NBPULSEVISIBLE; i++) {
if ((i % 2) == 0) {
for (int j = 0; j < listPulse.get(i).getScores().size(); j++) {
gc.setStroke(Color.BLACK);
gc.strokeText(Double.toString(listPulse.get(i).getScores().get(j)), i * NOTEWIDTH, (50 - j) * NOTEHEIGHT);
}
}
}
}
public void setChords(List<String> findChords) {
GraphicsContext gc = canvas.getGraphicsContext2D();
for (int i = 0; i < findChords.size(); i++) {
gc.setStroke(Color.BLACK);
gc.strokeText(findChords.get(i), i * NOTEWIDTH, 1 * NOTEHEIGHT);
}
}
public void viewAllBeatChordsAllChordsAll32(AllBeatChordsAllChordsOne32 allBeatChordsAllChordsOne32) {
GraphicsContext gc = canvas.getGraphicsContext2D();
for (int j = 0; j < allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().size(); j++) {
for (int k = 0; k < allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getFullBeatChordAllChordsOne32Map().size(); k++) {
// gc.setFill(Color.WHITE);
// gc.fillRect(j * NOTEWIDTH,1* NOTEHEIGHT,NOTEWIDTH*4,NOTEHEIGHT);
gc.setStroke(Color.BLACK);
double temp = allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getFullBeatChordAllChordsOne32Map().get(k).getScore();
gc.strokeText(Double.toString(temp), j * NOTEWIDTH * 10 + 10, k * NOTEHEIGHT + 12);
gc.setStroke(Color.BLUE);
int temp3 = allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getFullBeatChordAllChordsOne32Map().get(k).getBestIndexChord();
gc.strokeText(Double.toString(temp3), j * NOTEWIDTH * 10 + 20, k * NOTEHEIGHT + 120);
String temp4 = allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getFullBeatChordAllChordsOne32Map().get(k).getBestEChord().name();
gc.strokeText(temp4, j * NOTEWIDTH * 10 + 50, k * NOTEHEIGHT + 120);
String temp5 = Integer.toString(allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getFullBeatChordAllChordsOne32Map().get(k).getNumberOfPulse());
gc.strokeText(temp5, j * NOTEWIDTH * 10 + 70, k * NOTEHEIGHT + 120);
gc.setStroke(Color.RED);
// double temp2 = allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getFullBeatChordAllChordsOne32Map().get(k).getBestIndexChord();
// gc.strokeText(Double.toString(temp2), j * NOTEWIDTH *10, j*k * NOTEHEIGHT + 24);
}
gc.setStroke(Color.RED);
double temp4 = allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(j).getScore();
gc.strokeText(Double.toString(temp4), j * NOTEWIDTH * 10 + 10, NOTEHEIGHT + 250);
// double index = fullBeatChordAllChordsOne32.getBestIndexChord();
// gc.strokeText(Double.toString(index), 5 * NOTEWIDTH, (52)* NOTEHEIGHT+12);
}
gc.setStroke(Color.BLACK);
double score = allBeatChordsAllChordsOne32.getScore();
gc.strokeText("best score " + Double.toString(score), 1 * NOTEWIDTH, (51) * NOTEHEIGHT + 12);
int indexBeat = allBeatChordsAllChordsOne32.getBestIndexChord();
gc.strokeText("best BestIndexChord " + Double.toString(indexBeat), 1 * NOTEWIDTH, (51) * NOTEHEIGHT + 24);
for (int i = 0; i < allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(indexBeat).getFullBeatChordAllChordsOne32Map().size(); i++) {
String temp7 = allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(indexBeat).getFullBeatChordAllChordsOne32Map().get(i).getBestEChord().name();
gc.strokeText("Echord " + temp7, i * NOTEWIDTH * 10, (51) * NOTEHEIGHT + 40);
String temp8 = Integer.toString(allBeatChordsAllChordsOne32.getAllBeatChordsAllChordsOne32Map().get(indexBeat).getFullBeatChordAllChordsOne32Map().get(i).getNumberOfPulse());
gc.strokeText("number pulse " + temp8, i * NOTEWIDTH * 10, (51) * NOTEHEIGHT + 50);
}
}
public void setScene(Scene scene) {
this.scene = scene;
}
}
| [
"raphaelstyves@gmail.com"
] | raphaelstyves@gmail.com |
36ee8145eeba61f05797f1ed272af5bd75e888a8 | 3369b5570b138c0275f70b5a2d2ff2013066ea2b | /src/com/elawhelp/ui/Request_Lawyer.java | efb530564b801948867f61a553443a7353b81e31 | [] | no_license | Shuddho93/eLawHelp | 05b28079014d8423f5f2acf3328a31c97812d9fe | b2260f2e9331f15ad73b0f641a0e2e75980f23d0 | refs/heads/master | 2020-03-28T17:03:57.783495 | 2018-09-15T07:24:52 | 2018-09-15T07:24:52 | 148,755,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,331 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.elawhelp.ui;
import com.elawhelp.util.DBUtil;
import java.util.Arrays;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
/**
*
* @author lenovo
*/
public class Request_Lawyer extends javax.swing.JFrame {
/**
* Creates new form Request_Lawyer
*/
public Request_Lawyer() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel1.setText("Your Matches:");
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane2.setViewportView(jTextArea1);
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)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 498, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(43, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(59, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @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(Request_Lawyer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Request_Lawyer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Request_Lawyer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Request_Lawyer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
Request_Lawyer rl = new Request_Lawyer();
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
rl.setVisible(true);
}
});
Session session = DBUtil.getSession();
String hql = "from issue i join i.issue_id business";
Query q = session.createQuery(hql);
List<Object[]> ilist = q.list();
int count = ilist.size();
System.out.println("no of question found: " + count);
for (Object[] u1 : ilist) {
rl.jTextArea1.setText(Arrays.toString(u1));
rl.jTextArea1.setText("/n");
};
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
}
| [
"Shuddho@DESKTOP-DS2EEPB"
] | Shuddho@DESKTOP-DS2EEPB |
1c811648e60e0c81cce8a6440391cc5a071d3a74 | 27b591ce909342d4b30682a73b4971521f8984b6 | /wiki-admin/src/main/java/com/hzqing/admin/domain/system/UserInfoDetails.java | 0ca827f6bb00c9ba021b1f2b4411ae0a25cb966e | [
"MIT"
] | permissive | scokaven/HZQ-Wiki | 699726de8285ec566091b43de41df42406ce34ab | 8573e1f40e7a5868156694db1d165c63d76a6843 | refs/heads/master | 2020-12-10T23:00:05.019170 | 2020-01-11T08:47:30 | 2020-01-11T08:47:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,809 | java | package com.hzqing.admin.domain.system;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;
/**
* @author hzqing
* @date 2019-05-21 10:47
*/
@Data
public class UserInfoDetails implements UserDetails {
/**
* 用户id
*/
int userId;
/**
* 用户登陆名称
*/
String username;
/**
* 用户登陆密码
*/
String password;
/**
* 所有的资源id
*/
List<GrantedAuthority> authorities;
boolean accountNonExpired;
boolean accountNonLocked;
boolean credentialsNonExpired;
boolean enabled;
public UserInfoDetails() {
}
public UserInfoDetails(int userId, String username, String password) {
this.userId = userId;
this.username = username;
this.password = password;
}
public UserInfoDetails(int userId, String username, String password, List<GrantedAuthority> authorities, boolean accountNonExpired, boolean accountNonLocked, boolean credentialsNonExpired, boolean enabled) {
this.userId = userId;
this.username = username;
this.password = password;
this.authorities = authorities;
this.accountNonExpired = accountNonExpired;
this.accountNonLocked = accountNonLocked;
this.credentialsNonExpired = credentialsNonExpired;
this.enabled = enabled;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"hengzhaoqing@163.com"
] | hengzhaoqing@163.com |
44ee1184645bd6f8fa8758f37e233b0d8900c878 | 02cc5c7de52f8d6ebf75ff34caf10f76033abb07 | /27-Access Modifiers/src/com/cybertek/p1/C.java | 091bfb5ceae3adba7df91fd8a8b946b8c5e322fa | [] | no_license | Mery1609/pool | c2183cde100aef6a679bed63ae4e25322511a47c | 67a3568ecb54fb2b7604ebf5c291e3dcacfd1fa3 | refs/heads/master | 2020-04-16T01:15:12.715201 | 2018-11-22T05:23:38 | 2018-11-22T05:23:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 135 | java | package com.cybertek.p1;
public class C {
public static void main(String[] args) {
A object = new A();
object.display();
}
}
| [
"a.jumaklychev@gmail.com"
] | a.jumaklychev@gmail.com |
77b3d81de0401d622c05d92ac9d3972c1bf5a23b | 87d41770b2d744688824d2cdb44d89f95268c9bf | /src/vos/PedidoProdConSustituciones.java | f8faf695a146b6e0629e4ef47be15a7a6778d462 | [
"MIT"
] | permissive | js-diaz/sistrans | ceca27762302be5e50118f6b295fdc4a122f8b7a | c6fe9379c083c86d1f9704c63f91f5c8474c8316 | refs/heads/Salvar2.0 | 2021-08-28T01:20:23.122380 | 2017-12-11T01:41:25 | 2017-12-11T01:41:25 | 103,463,860 | 0 | 0 | null | 2017-11-19T23:49:53 | 2017-09-14T00:00:49 | Java | IBM852 | Java | false | false | 1,028 | java | package vos;
import java.util.List;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* Pedido que ha hecho un cliente de un menu, con sustituciones en Úl.
* @author JuanSebastian
*/
public class PedidoProdConSustituciones extends PedidoProd {
/**
* Sustituciones de un ingrediente por otro.
*/
@JsonProperty(value="sustituciones")
private List<SustitucionIngrediente> sustituciones;
public PedidoProdConSustituciones(@JsonProperty(value="cantidad") Integer cantidad, @JsonProperty(value="cuenta") CuentaMinimum cuenta,
@JsonProperty(value="plato") InfoProdRest plato, @JsonProperty(value="entregado") Boolean entregado,
@JsonProperty(value="sustituciones") List<SustitucionIngrediente> sustituciones) {
super(cantidad, cuenta, plato, entregado);
this.sustituciones = sustituciones;
}
public List<SustitucionIngrediente> getSustituciones() {
return sustituciones;
}
public void setSustituciones(List<SustitucionIngrediente> sustituciones) {
this.sustituciones = sustituciones;
}
}
| [
"js.diaz@uniandes.edu.co"
] | js.diaz@uniandes.edu.co |
8b080005a3bfdf47729fbdc0ddcfce6bad27cc1f | 54f220fdf8a4e9a49a3ce0235f4c550440fe91e0 | /network-programming-in-java/src/main/java/com/youxiang/chapter09/PooledDaytimeServer.java | 1e86d0223e959c0ca7136f3e4829949a13f815a9 | [] | no_license | RiversLau/java-network-programming | 5af90789cf93e23abe3b5be1014e699a808bc88c | 895828d8b937db72242d7441b57f382953ff5854 | refs/heads/master | 2020-03-08T14:26:12.204199 | 2018-04-15T09:10:16 | 2018-04-15T09:10:16 | 128,184,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,902 | java | package com.youxiang.chapter09;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author: Rivers
* @date: 2018/4/7
*/
public class PooledDaytimeServer {
private static final int PORT = 1313;
public static void main(String[] args) {
ExecutorService pool = Executors.newFixedThreadPool(50);
try (ServerSocket ss = new ServerSocket(PORT)) {
while (true) {
try {
Socket connection = ss.accept();
DaytimeTask task = new DaytimeTask(connection);
pool.submit(task);
} catch (IOException ex) {
System.out.println("Accept failed");
}
}
} catch (IOException ex) {
System.out.println("Initialize ServerSocket failed");
}
}
private static class DaytimeTask implements Callable<Void> {
private Socket connection;
DaytimeTask(Socket connection) {
this.connection = connection;
}
@Override
public Void call() throws Exception {
try {
Writer out = new OutputStreamWriter(connection.getOutputStream());
Date now = new Date();
out.write(now.toString() + "\r\n");
out.flush();
} catch (IOException e) {
e.printStackTrace();
System.out.println(e);
} finally {
try {
connection.close();
} catch (IOException e) {
//do nothing
}
}
return null;
}
}
}
| [
"zhaoxiang0805@hotmail.com"
] | zhaoxiang0805@hotmail.com |
531ab0d9a89bad8c844ec28e10a687e4c7651d4c | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/com/autonavi/minimap/basemap/traffic/net/AudioDownloadCallback.java | 41600c87f193b1ca71f6918af5277ca5adacbef7 | [] | no_license | shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391040 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,633 | java | package com.autonavi.minimap.basemap.traffic.net;
import android.os.Environment;
import com.amap.bundle.blutils.FileUtil;
import com.autonavi.common.Callback;
import com.autonavi.common.Callback.CachePolicyCallback;
import com.autonavi.common.Callback.CachePolicyCallback.CachePolicy;
import com.autonavi.common.Callback.d;
import java.io.File;
public abstract class AudioDownloadCallback implements Callback<File>, CachePolicyCallback, d {
private String url;
public String getCacheKey() {
return null;
}
public void onCancelled() {
}
public void onLoading(long j, long j2) {
}
public void onStart() {
}
public String getUrl() {
return this.url;
}
public void setUrl(String str) {
this.url = str;
}
public CachePolicy getCachePolicy() {
return CachePolicy.NetworkOnly;
}
public final String getSavePath() {
String substring = this.url.substring(this.url.lastIndexOf("/") + 1);
StringBuilder sb = new StringBuilder();
sb.append(agy.a(substring));
sb.append(".spx");
String sb2 = sb.toString();
if (Environment.getExternalStorageState().equals("mounted")) {
StringBuilder sb3 = new StringBuilder();
sb3.append(Environment.getExternalStorageDirectory());
sb3.append("/autonavi/audio/");
return new File(sb3.toString(), sb2).getPath();
}
StringBuilder sb4 = new StringBuilder();
sb4.append(FileUtil.getFilesDir());
sb4.append("/audio/");
sb4.append(sb2);
return sb4.toString();
}
}
| [
"hubert.yang@nf-3.com"
] | hubert.yang@nf-3.com |
30e49e9b5a09eb6e00152709fb57d5abd52810ea | 6874b5bde1a3756b94b4059838ebec03040812a2 | /app/src/main/java/ra/sumbayak/briogas/api/models/DeviceData.java | 6c755790cd4280be70673c7289f0d75303708bf6 | [] | no_license | rsmbyk/briogas-android | 57969baf9bfeb4c69a10d957ccf1d2da11ef8b02 | efeb2a8625301b55a5f8afb5ef28b22cfe228898 | refs/heads/master | 2021-06-22T10:42:20.137828 | 2017-08-13T06:20:54 | 2017-08-13T06:20:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package ra.sumbayak.briogas.api.models;
import com.google.gson.annotations.SerializedName;
public class DeviceData {
@SerializedName ("id") public int id;
@SerializedName ("owner") public String owner;
@SerializedName ("methane") public int methane;
@SerializedName ("pressure") public int pressure;
@SerializedName ("content") public int content;
@SerializedName ("temperature") public int temperature;
@SerializedName ("power") public boolean power;
@SerializedName ("today_methane_production")
public int methane_production;
}
| [
"ronaldsumbayak611@gmail.com"
] | ronaldsumbayak611@gmail.com |
d2becb7d230f8228ca203c9db8455c50217eb34d | 9867e0371f7853fe8aedc41a1f44b514b14578d9 | /ksiegarnia-rest-api/src/main/java/pl/ksiegarnia/rest/model/Item.java | 49633d66fed9d5bd30fa72f6e4f6487a3e21c0ab | [] | no_license | grubarek/ksiegarnia | 7660e08726b925b129ffacae9d8d84acc9f3cdd9 | 727253db6d4297a607a04f87f55ada32f5c35d40 | refs/heads/master | 2021-01-20T09:01:45.722370 | 2015-09-05T13:27:01 | 2015-09-05T13:27:01 | 39,726,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | package pl.ksiegarnia.rest.model;
import java.util.List;
/**
* Created by pgrubarek on 17.08.15.
*/
public class Item {
private static final long serialVersionUID = 4764932857557385437L;
private Long id;
private Double price;
private Integer quantity;
public List<Long> itemList;
public Item() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public List<Long> getItemList() {
return itemList;
}
public void setItemList(List<Long> itemList) {
this.itemList = itemList;
}
@Override
public String toString() {
return "Item{" +
"id=" + id +
", price=" + price +
", quantity=" + quantity +
", itemList=" + itemList +
'}';
}
}
| [
"pgrubarek@corelogic.pl"
] | pgrubarek@corelogic.pl |
1b1615853d20b7d10696583676c0422e1f79d2c1 | 02199456a5cbcde327530d98b4aadc28fee70045 | /contrib/carto/src/main/java/io/jeo/carto/CartoCSS.java | ff41c1832bddcac97b6018370d2fce874c04029c | [
"Apache-2.0"
] | permissive | jeo/jeo | 48a721cc3abc3145ba961db4cde7493027b3bd1e | 70cd7b8be60f9aca35e439b440651eaeef78c5fd | refs/heads/master | 2023-08-13T19:17:57.576288 | 2021-04-26T21:09:33 | 2021-04-26T21:09:33 | 12,117,077 | 14 | 13 | Apache-2.0 | 2023-05-23T20:19:44 | 2013-08-14T19:06:14 | Java | UTF-8 | Java | false | false | 1,420 | java | /* Copyright 2013 The jeo project. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.jeo.carto;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.jeo.data.FileDriver;
import io.jeo.map.Style;
public class CartoCSS extends FileDriver<Style> {
@Override
public String name() {
return "CartoCSS";
}
@Override
public List<String> aliases() {
return Arrays.asList("carto", "css");
}
@Override
public Class<Style> type() {
return Style.class;
}
@Override
protected Style open(File file, Map<?, Object> opts) throws IOException {
return Carto.parse(file);
}
@Override
public Set<Capability> capabilities() {
return Collections.emptySet();
}
}
| [
"jdeolive@gmail.com"
] | jdeolive@gmail.com |
6a9bcae4684626dee79f2c27147e90c8715be1e7 | 8a6621d2221ad808eadfe849f45e8b2d77b9676a | /Assignment2_Client/target/generated-sources/jaxws-wsimport/client/EditMovieResponse.java | e0f4860ba7bc80fdefa548673a97ec87f87fd57d | [] | no_license | ducchibui/Assignment2_Repo2 | d172726b4719b099b60617abf151c00d1c2b7279 | 817c0094efb68758baccea22fe872b9071c8ef62 | refs/heads/master | 2021-05-18T01:39:16.297896 | 2020-04-02T14:18:43 | 2020-04-02T14:18:43 | 251,050,486 | 0 | 0 | null | 2021-03-31T22:00:40 | 2020-03-29T14:21:53 | JavaScript | UTF-8 | Java | false | false | 726 | java |
package client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for editMovieResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="editMovieResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "editMovieResponse")
public class EditMovieResponse {
}
| [
"CBui@absolute.com"
] | CBui@absolute.com |
eb29511777c71f5d17c1de3164d45d89bea6063a | 6201e56ad425a424e8f5e18ecac4570badc2aff9 | /app/src/androidTest/java/co/com/proyectoii/udea/virtualstore/ApplicationTest.java | 350a3c2e221c4007f6f590092bef7f8101fcdc16 | [] | no_license | santigomezp/ProyectoIntegradorII | a1d48112f4a3841c04b7e2686f1666e7710f2c45 | 0e21c32882da71a4ca586ede0f26808a2fcb3c64 | refs/heads/master | 2021-01-10T04:00:04.922540 | 2016-01-21T17:26:26 | 2016-01-21T17:26:26 | 46,904,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package co.com.proyectoii.udea.virtualstore;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"santiago_2466@hotmail.com"
] | santiago_2466@hotmail.com |
a48e722887a776b50c0436a368575ed4a2960707 | 78121dfc7762f62344e4d7b2f6b9186f7f59087c | /02 - Desenvolvimento/04 - Construcao/08 - Aplicacao/12 - Server/DCoracoesServer/src/main/java/br/com/dcoracoes/server/model/movimento/ContaPoupanca.java | 02026bd6361901f247d778d6ba0850d4ed10c872 | [] | no_license | joserobson/sistema-gerencia-vendas-catalogo | ee5cb5ee5e893170345ab5290d3d8cbc83a78da4 | 478bbbc223ce323ba9df6230ed17f9650feb048e | refs/heads/master | 2021-01-10T09:24:45.588241 | 2015-06-30T20:48:04 | 2015-06-30T20:48:04 | 48,184,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package br.com.dcoracoes.server.model.movimento;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
/**
* @author Jose Robson
* @version 1.0
* @created 06-mar-2012 18:43:12
*/
@Entity
@DiscriminatorValue("ContaPoupanca")
public class ContaPoupanca extends MovimentoConta {
public ContaPoupanca(){
super();
}
public void finalize() throws Throwable {
super.finalize();
}
} | [
"robsbq@gmail.com"
] | robsbq@gmail.com |
572f6c6b53aea1b132d8bbd5ede5cd28c2b90660 | e15f44ec67162c8d28dfb768b0955fd87867c916 | /app/src/main/java/app/qingtingfm/com/util/androidutil/PathUtils.java | fae958c3a19d09e8f774c43b16f36053f06f971f | [] | no_license | xyjian758/fastbaseapp | e718b1ab3b4d57508bc82cd4f8a706254193b282 | 621b438eedfffea05d144f1630d8c81b76257b9c | refs/heads/master | 2020-04-10T16:13:45.835663 | 2018-12-10T07:56:58 | 2018-12-10T07:56:58 | 161,138,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,248 | java | package app.qingtingfm.com.util.androidutil;
import android.os.Build;
import android.os.Environment;
import app.qingtingfm.com.application.AndroidApplication;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/04/15
* desc : utils about path
* </pre>
*/
public class PathUtils {
private PathUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
//---------------------------以下都为AndroidUtil里面的工具方法----------------------------------------
/**
* Return the path of /system.
*
* @return the path of /system
*/
public static String getRootPath() {
return Environment.getRootDirectory().getAbsolutePath();
}
/**
* Return the path of /data.
*
* @return the path of /data
*/
public static String getDataPath() {
return Environment.getDataDirectory().getAbsolutePath();
}
/**
* Return the path of /cache.
*
* @return the path of /cache
*/
public static String getDownloadCachePath() {
return Environment.getDownloadCacheDirectory().getAbsolutePath();
}
/**
* Return the path of /data/data/package.
*
* @return the path of /data/data/package
*/
public static String getInternalAppDataPath() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return AndroidApplication.getAppContext().getApplicationInfo().dataDir;
}
return AndroidApplication.getAppContext().getDataDir().getAbsolutePath();
}
/**
* Return the path of /data/data/package/code_cache.
*
* @return the path of /data/data/package/code_cache
*/
public static String getInternalAppCodeCacheDir() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return AndroidApplication.getAppContext().getApplicationInfo().dataDir + "/code_cache";
}
return AndroidApplication.getAppContext().getCodeCacheDir().getAbsolutePath();
}
/**
* Return the path of /data/data/package/cache.
*
* @return the path of /data/data/package/cache
*/
public static String getInternalAppCachePath() {
return AndroidApplication.getAppContext().getCacheDir().getAbsolutePath();
}
/**
* Return the path of /data/data/package/databases.
*
* @return the path of /data/data/package/databases
*/
public static String getInternalAppDbsPath() {
return AndroidApplication.getAppContext().getApplicationInfo().dataDir + "/databases";
}
/**
* Return the path of /data/data/package/databases/name.
*
* @param name The name of database.
* @return the path of /data/data/package/databases/name
*/
public static String getInternalAppDbPath(String name) {
return AndroidApplication.getAppContext().getDatabasePath(name).getAbsolutePath();
}
/**
* Return the path of /data/data/package/files.
*
* @return the path of /data/data/package/files
*/
public static String getInternalAppFilesPath() {
return AndroidApplication.getAppContext().getFilesDir().getAbsolutePath();
}
/**
* Return the path of /data/data/package/shared_prefs.
*
* @return the path of /data/data/package/shared_prefs
*/
public static String getInternalAppSpPath() {
return AndroidApplication.getAppContext().getApplicationInfo().dataDir + "shared_prefs";
}
/**
* Return the path of /data/data/package/no_backup.
*
* @return the path of /data/data/package/no_backup
*/
public static String getInternalAppNoBackupFilesPath() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return AndroidApplication.getAppContext().getApplicationInfo().dataDir + "no_backup";
}
return AndroidApplication.getAppContext().getNoBackupFilesDir().getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0.
*
* @return the path of /storage/emulated/0
*/
public static String getExternalStoragePath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStorageDirectory().getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Music.
*
* @return the path of /storage/emulated/0/Music
*/
public static String getExternalMusicPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Podcasts.
*
* @return the path of /storage/emulated/0/Podcasts
*/
public static String getExternalPodcastsPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PODCASTS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Ringtones.
*
* @return the path of /storage/emulated/0/Ringtones
*/
public static String getExternalRingtonesPath() {
if (isExternalStorageDisable()) return "";
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Alarms.
*
* @return the path of /storage/emulated/0/Alarms
*/
public static String getExternalAlarmsPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_ALARMS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Notifications.
*
* @return the path of /storage/emulated/0/Notifications
*/
public static String getExternalNotificationsPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_NOTIFICATIONS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Pictures.
*
* @return the path of /storage/emulated/0/Pictures
*/
public static String getExternalPicturesPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Movies.
*
* @return the path of /storage/emulated/0/Movies
*/
public static String getExternalMoviesPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Download.
*
* @return the path of /storage/emulated/0/Download
*/
public static String getExternalDownloadsPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/DCIM.
*
* @return the path of /storage/emulated/0/DCIM
*/
public static String getExternalDcimPath() {
if (isExternalStorageDisable()) {
return "";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Documents.
*
* @return the path of /storage/emulated/0/Documents
*/
public static String getExternalDocumentsPath() {
if (isExternalStorageDisable()) {
return "";
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Documents";
}
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package.
*
* @return the path of /storage/emulated/0/Android/data/package
*/
public static String getExternalAppDataPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalCacheDir().getParentFile().getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/cache.
*
* @return the path of /storage/emulated/0/Android/data/package/cache
*/
public static String getExternalAppCachePath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalCacheDir().getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files.
*
* @return the path of /storage/emulated/0/Android/data/package/files
*/
public static String getExternalAppFilesPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(null).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Music.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Music
*/
public static String getExternalAppMusicPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_MUSIC).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Podcasts.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Podcasts
*/
public static String getExternalAppPodcastsPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_PODCASTS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Ringtones.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Ringtones
*/
public static String getExternalAppRingtonesPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_RINGTONES).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Alarms.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Alarms
*/
public static String getExternalAppAlarmsPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_ALARMS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Notifications.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Notifications
*/
public static String getExternalAppNotificationsPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_NOTIFICATIONS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Pictures.
*
* @return path of /storage/emulated/0/Android/data/package/files/Pictures
*/
public static String getExternalAppPicturesPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Movies.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Movies
*/
public static String getExternalAppMoviesPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_MOVIES).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Download.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Download
*/
public static String getExternalAppDownloadPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/DCIM.
*
* @return the path of /storage/emulated/0/Android/data/package/files/DCIM
*/
public static String getExternalAppDcimPath() {
if (isExternalStorageDisable()) {
return "";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DCIM).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Documents.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Documents
*/
public static String getExternalAppDocumentsPath() {
if (isExternalStorageDisable()) {
return "";
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(null).getAbsolutePath() + "/Documents";
}
//noinspection ConstantConditions
return AndroidApplication.getAppContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath();
}
/**
* Return the path of /storage/emulated/0/Android/obb/package.
*
* @return the path of /storage/emulated/0/Android/obb/package
*/
public static String getExternalAppObbPath() {
if (isExternalStorageDisable()) {
return "";
}
return AndroidApplication.getAppContext().getObbDir().getAbsolutePath();
}
private static boolean isExternalStorageDisable() {
return !Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
}
}
| [
"824006354@qq.com"
] | 824006354@qq.com |
45c7ffc102baceedde364a4e828b4b5555a4566b | 205135c18cd7e264d5a3abd49a096930c7453970 | /test/com/xfashion/shared/BarcodeHelperTest.java | 95edbc1278065c87b847ba6e9a9de6a5de9958ca | [] | no_license | archmage74/x-fashion | 25f34b2fb0a76b04ae921de95facf6d576c4eaae | a72f6facd0716e3b74b42cfdeea1000d2e7fe338 | refs/heads/master | 2020-04-09T10:37:37.353269 | 2012-10-21T16:57:55 | 2012-10-21T16:57:55 | 3,690,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 611 | java | package com.xfashion.shared;
import org.junit.Test;
import junit.framework.Assert;
public class BarcodeHelperTest {
@Test
public void barcodeTest1() {
BarcodeHelper bh = new BarcodeHelper();
Long input = 101008000037L;
String actual = bh.generateEan(input);
String expected = "1010080000370";
Assert.assertEquals(expected, actual);
}
@Test
public void barcodeTest2() {
BarcodeHelper bh = new BarcodeHelper();
Long input = 567814569871L;
String actual = bh.generateEan(input);
String expected = "5678145698717";
Assert.assertEquals(expected, actual);
}
}
| [
"werner.puff@gmx.net"
] | werner.puff@gmx.net |
51c720d6e66bca48bb6761a959896610c0fbddb9 | 135881e6393f822fac5a17332530e6b5a51880ac | /common/src/main/java/com/self/learn/java/innerClassDemo/Circle.java | 033d5c0275544502dc05730d77c7573da9063e65 | [] | no_license | linaaron/beckend | 9c2fffea8e0e9aa243841a1d59383203a04171ad | 113cab3baf7e829f34a4b31a9fdcce3a443c32cb | refs/heads/master | 2016-08-09T23:17:41.450817 | 2016-03-11T06:47:36 | 2016-03-11T06:47:36 | 48,156,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,506 | java | package com.self.learn.java.innerClassDemo;
public class Circle {
public static int count = 1;
private double radius = 0;
private Draw draw = null;
public Circle() {
}
public Circle(double radius) {
this.radius = radius;
}
//member inner class
class Draw {
double radius = 2;
public void drawShape() {
System.out.println(Circle.this.radius); //outer
System.out.println(Draw.this.radius);
System.out.println(this.radius); //inner
System.out.println(count); //local
}
}
public Draw getDrawInstance() {
if (draw == null) {
draw = new Draw();
}
return draw;
}
//local inner class
public int getRadius() {
int a = 1;
class Radius {
int b = a;
int radius = 6;
}
new Thread() {
public void run() {
System.out.println(a);
// System.out.println(b);
};
}.start();
return new Radius().radius;
}
//static inner class
static class staticInner {
public staticInner() {
}
}
public void test() {
}
public static void main(String[] args) {
Circle circle = new Circle(3);
Draw draw = circle.new Draw();
draw.drawShape();
circle.getDrawInstance().drawShape();
Circle.staticInner staticInner = new Circle.staticInner();
}
}
| [
"Aaron.Lin@ehealth-china.com"
] | Aaron.Lin@ehealth-china.com |
1643b9c0e3db3fa5fa7b28592dfc4b2fce43397d | eb3861ad885b35b26aecb5f9544ad14e74588e18 | /MAC0323/EP11/MoveToFront.java | 58593cb0d02c606791870b86a9c0fc1620b451b2 | [] | no_license | limapvictor/backup-materias-antigas | b5d8aa020667363274f31bc02122c66fc53d6a7e | 20e8c6353d67afa1ec8523dd1a0ebd5b47158442 | refs/heads/master | 2023-02-28T06:48:41.518937 | 2021-02-01T22:06:54 | 2021-02-01T22:06:54 | 335,091,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,204 | java | /****************************************************************
Nome: Victor Pereira Lima
NUSP: 10737028
Ao preencher esse cabeçalho com o meu nome e o meu número USP,
declaro que todas as partes originais desse exercício programa (EP)
foram desenvolvidas e implementadas por mim e que portanto não
constituem desonestidade acadêmica ou plágio.
Declaro também que sou responsável por todas as cópias desse
programa e que não distribui ou facilitei a sua distribuição.
Estou ciente que os casos de plágio e desonestidade acadêmica
serão tratados segundo os critérios divulgados na página da
disciplina.
Entendo que EPs sem assinatura devem receber nota zero e, ainda
assim, poderão ser punidos por desonestidade acadêmica.
Abaixo descreva qualquer ajuda que você recebeu para fazer este
EP. Inclua qualquer ajuda recebida por pessoas (inclusive
monitoras e colegas). Com exceção de material de MAC0323, caso
você tenha utilizado alguma informação, trecho de código,...
indique esse fato abaixo para que o seu programa não seja
considerado plágio ou irregular.
Exemplo:
A monitora me explicou que eu devia utilizar a função xyz().
O meu método xyz() foi baseada na descrição encontrada na
página https://www.ime.usp.br/~pf/algoritmos/aulas/enumeracao.html.
Descrição de ajuda ou indicação de fonte:
Se for o caso, descreva a seguir 'bugs' e limitações do seu programa:
****************************************************************/
import edu.princeton.cs.algs4.BinaryStdIn;
import edu.princeton.cs.algs4.BinaryStdOut;
import edu.princeton.cs.algs4.StdOut;
public class MoveToFront
{
public static final int R = 256;
public static void encode()
{
char[] ascii = new char[R];
for (int i = 0; i < R; i++)
ascii[i] = (char)i;
while (!BinaryStdIn.isEmpty()) {
char c = BinaryStdIn.readChar();
int pos = findChar(c, ascii);
BinaryStdOut.write(pos, 8);
moveCharToFront(pos, ascii);
}
BinaryStdOut.close();
}
public static void decode()
{
char[] ascii = new char[R];
for (int i = 0; i < R; i++)
ascii[i] = (char)i;
while (!BinaryStdIn.isEmpty()) {
int pos = BinaryStdIn.readInt(8);
BinaryStdOut.write(ascii[pos]);
moveCharToFront(pos, ascii);
}
BinaryStdOut.close();
}
private static int findChar(char c, char[] ascii)
{
int i;
for (i = 0; i < R && ascii[i] != c; i++);
return (i);
}
private static void moveCharToFront(int pos, char[] ascii)
{
char c = ascii[pos];
int i;
for (i = pos; i > 0; i--)
ascii[i] = ascii[i - 1];
ascii[i] = c;
}
public static void main(String[] args)
{
if (args[0].compareTo("-") == 0)
encode();
else if (args[0].compareTo("+") == 0)
decode();
}
} | [
"lima.p.victor@outlook.com"
] | lima.p.victor@outlook.com |
8404e3e58a8732422a5fe833c9639838e378e43e | a1e2f1299e94d5dfeae6e4391893e2e4ea7ee39d | /app/src/main/java/com/example/daggerpractice/practice/Engine.java | c0467c6ed2c0a49572e15b003231cc7db8db9b64 | [] | no_license | venki131/DaggerPractice | cc1b78d831715d8b6e2a9ecc8d0fb267c37e843f | 2f1110ded2ed92ba3aa7531d4f389d5ba52029e7 | refs/heads/master | 2020-07-30T20:03:45.766785 | 2019-10-03T09:06:07 | 2019-10-03T09:06:07 | 210,342,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package com.example.daggerpractice.practice;
import javax.inject.Inject;
public interface Engine {
void start();
}
| [
"venkatesh.n@techtreeit.com"
] | venkatesh.n@techtreeit.com |
d5d139f7c90626e628e7a9bcd8546cb7f9ebc6b2 | eaae18539fef63104faf926e88f4e39721cc313b | /src/Poberezhets/e-olimp/week2/Main.java | a8937b5381e38bc5e722dfe2c5075c478cea7e48 | [] | no_license | anneteka/OKAlabs | e83977d9f58f93ce3c985584e45330b7d7d06b2b | 44c1215cf90117ea15e8db0035adcab895a0a970 | refs/heads/master | 2020-04-09T15:10:40.869208 | 2018-12-20T22:05:53 | 2018-12-20T22:05:53 | 160,418,193 | 2 | 8 | null | null | null | null | UTF-8 | Java | false | false | 2,433 | java |
/**
* Якось нарешті жителі планети Земля знайшли заселену планету, назвали її ТТВ,
* і відправили разом з кораблем туди одного кролика. Кролику сподобався клімат
* нової планети і через місяць він народив на світ ще одного кролика. Відомо,
* що кожен місяц кожен кролик, який був присутніс на планеті, відтворював на
* світ ще одного кролика. На планеті звідкілясь завіся монстр, який на початку
* місяця з'їдав k кроликів, як тільки їх ставало строго більше k. У задачі
* необхідно визначити кількість кроликів, яка буде на планеті через n місяців
* після прибуття на неї космічного корабля з першим кроликом.
*
*
* Вхідні дані
*
* Перший рядок містить кількість місяців n (0 ≤ n ≤ 100), другий - число
* кроликів k(0 ≤ k ≤ 10000), яких з'їдав монстр.
*
* Вихідні дані
*
* Визначіть кількість кроликів, які будуть знаходитись на планеті ТТВ через n
* місяців після поселення на неї першого кролика. Відомо, що результат для
* довільного тесту завжди не перевищує 2*109.
*
* @author Богдана
*
*/
import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Main obj=new Main();
obj.beginProcess();
}
void beginProcess() throws IOException{
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int n = in.nextInt();
int k = in.nextInt();
if ((n >=0 && n <= 100) && (k >=0 && k <=10000)) {
System.out.println(rabbits(n, k));
}
}
}
public static int rabbits(int n, int k) {
int am = 1;
for (int i = 0; i < n; i++) {
if (am > k)
am = am - k;
am = am * 2;
}
return am;
}
}
| [
"a.karlysheva@ukma.edu.ua"
] | a.karlysheva@ukma.edu.ua |
26ceb7ae8bce96cca3d099233aa981c1ecc53923 | 88da869075d87a9079b786a7a8ccaf14de589bc8 | /app/src/main/java/com/cecilia/framework/module/main/adapter/NewsAdapter.java | 1457bdadfff2b725a69c2a143f6f2033d65abea1 | [] | no_license | Ellbert/HongZun | d820a8114c123a5c739cf00f2754824ced5b86b7 | 38bb0648f7a6041b342baaf343e88d6db3f1ea76 | refs/heads/master | 2020-04-07T18:54:35.793598 | 2019-01-23T01:22:41 | 2019-01-23T01:22:43 | 158,629,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,489 | java | package com.cecilia.framework.module.main.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.cecilia.framework.R;
import com.cecilia.framework.base.BaseLmrvAdapter;
import com.cecilia.framework.base.BaseViewHolder;
import com.cecilia.framework.module.main.activity.NewDetailActivity;
import com.cecilia.framework.module.main.activity.NewsActivity;
import com.cecilia.framework.module.main.bean.NoticeBean;
public class NewsAdapter extends BaseLmrvAdapter<NoticeBean> {
public NewsAdapter(Context context) {
super(context);
}
@Override
public BaseViewHolder onCreateRecyclerViewHolder(LayoutInflater layoutInflater, ViewGroup parent, int viewType) {
return new BaseViewHolder(layoutInflater.inflate(R.layout.item_new, parent, false));
}
@Override
public void onBindRecyclerViewHolder(BaseViewHolder holder, final NoticeBean data) {
// ImageUtil.loadNetworkImage(mContext, data.getProduct_img(), (ImageView) holder.getView(R.id.iv_recommend), true, false, null);
TextView textView = holder.getView(R.id.tv_text);
textView.setText(data.getTTitle()+"");
holder.getView(R.id.tv_more).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NewDetailActivity.launch(mContext,data);
}
});
}
}
| [
"15015868732@163.com"
] | 15015868732@163.com |
112a4b68a08f33eb00449f95b6d2ddde26b4dd4b | 1bc27636c50b91b4537dab615616e0071dad4010 | /HDState/src/xiong/hdstats/da/evaluator/PsuedoRandomLDACompare.java | 4c12d0963e3949b64c8016034dd9c6a9ab375fd4 | [] | no_license | Fred1991/HDStats | bc99565952ca5d09df669132ca779c8d87cb9e72 | a194b1e002dbea493b9e279a0285ab0da2b938a8 | refs/heads/master | 2021-09-14T23:01:20.889674 | 2018-05-21T17:57:12 | 2018-05-21T17:57:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,004 | java | package xiong.hdstats.da.evaluator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import edu.uva.libopt.numeric.*;
import smile.math.matrix.Matrix;
import smile.projection.PCA;
import smile.stat.distribution.SpikedMultivariateGaussianDistribution;
import smile.stat.distribution.MultivariateGaussianDistribution;
import xiong.hdstats.da.Classifier;
import xiong.hdstats.da.LDA;
import xiong.hdstats.da.PseudoInverseLDA;
import xiong.hdstats.da.OnlineLDA;
import xiong.hdstats.da.OptimalLDA;
import xiong.hdstats.da.CovLDA;
import xiong.hdstats.da.comb.OMPDA;
import xiong.hdstats.da.comb.RayleighFlowLDA;
import xiong.hdstats.da.comb.StochasticTruncatedRayleighFlowDBSDA;
import xiong.hdstats.da.comb.TruncatedRayleighFlowDBSDA;
import xiong.hdstats.da.comb.TruncatedRayleighFlowLDA;
import xiong.hdstats.da.comb.TruncatedRayleighFlowSDA;
import xiong.hdstats.da.comb.TruncatedRayleighFlowUnit;
import xiong.hdstats.da.mcmc.BayesLDA;
import xiong.hdstats.da.mcmc.LiklihoodBayesLDA;
import xiong.hdstats.da.mcmc.MCBayesLDA;
import xiong.hdstats.da.mcmc.MCRegularizedBayesLDA;
import xiong.hdstats.da.mcmc.RegularizedBayesLDA;
import xiong.hdstats.da.mcmc.RegularizedLikelihoodBayesLDA;
import xiong.hdstats.da.ml.AdaBoostTreeClassifier;
import xiong.hdstats.da.ml.AdaboostLRClassifier;
import xiong.hdstats.da.ml.DTreeClassifier;
import xiong.hdstats.da.ml.LRClassifier;
import xiong.hdstats.da.ml.NonlinearSVMClassifier;
import xiong.hdstats.da.ml.RandomForestClassifier;
import xiong.hdstats.da.ml.SVMClassifier;
import xiong.hdstats.da.shruken.DBSDA;
import xiong.hdstats.da.shruken.ODaehrLDA;
import xiong.hdstats.da.shruken.SDA;
import xiong.hdstats.da.shruken.ShLDA;
import xiong.hdstats.da.shruken.ShrinkageLDA;
import xiong.hdstats.da.shruken.InvalidLDA;
import xiong.hdstats.gaussian.CovarianceEstimator;
public class PsuedoRandomLDACompare {
public static PrintStream ps = null;
public static PrintStream ps1 = null;
public static void main(String[] args) throws FileNotFoundException {
for (int i = 1; i <= 10; i += 2)
_main(200, 10, i*20, 500, 5);
}
public static void _main(int p, int nz, int initTrainSize, int testSize, int rate) throws FileNotFoundException {
ps = new PrintStream("C:/Users/xiongha/Desktop/TruncatedLDA/accuracy-" + p + "-" + nz + "-" + initTrainSize + "-"
+ ((double) rate / 1.0) + ".txt");
ps1 = new PrintStream("C:/Users/xiongha/Desktop/TruncatedLDA/betacomp-" + p + "-" + nz + "-" + initTrainSize + "-"
+ ((double) rate / 1.0) + ".txt");
double[][] cov = new double[p][p];
double[][] groupMean = new double[2][p];
double[] mud = new double[p];
for (int i = 0; i < cov.length; i++) {
for (int j = 0; j < cov.length; j++) {
cov[i][j] = Math.pow(0.8, Math.abs(i - j));
}
}
double[] meanPositive = new double[p];
double[] meanNegative = new double[p];
for (int i = 0; i < meanPositive.length; i++) {
if (i < nz) {
meanPositive[i] = 1.0;
mud[i] = 1.0;
groupMean[0][i] = 1.0;
} else {
meanPositive[i] = 0.0;
mud[i] = 0.0;
groupMean[0][i] = 0.0;
}
meanNegative[i] = 0.0;
groupMean[1][i] = 0.0;
}
double[][] theta_s = new Matrix(cov).inverse();
double[] beta_s = new double[p];
new Matrix(theta_s).ax(mud, beta_s);
SpikedMultivariateGaussianDistribution posD = new SpikedMultivariateGaussianDistribution(meanPositive, cov);
SpikedMultivariateGaussianDistribution negD = new SpikedMultivariateGaussianDistribution(meanNegative, cov);
for (int r = 0; r < 100; r++) {
double[][] testData = new double[testSize][p];
int[] testLabel = new int[testSize];
for (int i = 0; i < testSize; i++) {
double[] tdat;
if (i % 10 < rate) {
tdat = posD.rand();
testLabel[i] = 1;
} else {
tdat = negD.rand();
testLabel[i] = -1;
}
for (int j = 0; j < cov.length; j++)
testData[i][j] = tdat[j];
}
double[][] trainData = new double[initTrainSize][p];
int[] trainLabel = new int[initTrainSize];
for (int i = 0; i < initTrainSize; i++) {
double[] tdat;
{
if (i % 10 < rate) {
tdat = posD.rand();
trainLabel[i] = 1;
} else {
tdat = negD.rand();
trainLabel[i] = -1;
}
for (int j = 0; j < cov.length; j++)
trainData[i][j] = tdat[j];
}
}
long start = 0;
long current = 0;
start = System.currentTimeMillis();
OptimalLDA opLDA = new OptimalLDA(beta_s, groupMean, -1.0 * Math.log(rate / (10.0 - rate)));
current = System.currentTimeMillis();
accuracy("optimal", testData, testLabel, opLDA, start, current);
CovarianceEstimator.lambda = 12;
// start = System.currentTimeMillis();
// DBSDA dbsda = new DBSDA(trainData, trainLabel, false);
// current = System.currentTimeMillis();
// accuracy("DBSDA", testData, testLabel, dbsda, start, current);
start = System.currentTimeMillis();
SDA sda = new SDA(trainData, trainLabel, false);
current = System.currentTimeMillis();
accuracy("SDA", testData, testLabel, sda, start, current);
// start = System.currentTimeMillis();
// PseudoInverseLDA LDA = new PseudoInverseLDA(trainData, trainLabel, false);
// current = System.currentTimeMillis();
// accuracy("LDA", testData, testLabel, LDA, start, current);
for (int i = 1; i < 20; i++) {
start = System.currentTimeMillis();
OMPDA olda = new OMPDA
(trainData, trainLabel, false, i);
current = System.currentTimeMillis();
accuracy("OMP-" + (i), testData, testLabel, olda, start, current);
betacompare("OMP-" + (i),olda.getBeta(),beta_s);
}
// for (int i = 1; i < 20; i++) {
// start = System.currentTimeMillis();
// TruncatedRayleighFlowUnit olda = new TruncatedRayleighFlowUnit(trainData, trainLabel, false, i * 2 + 2);
// current = System.currentTimeMillis();
// accuracy("TruncatedRayleighFlowUnit-" + (i), testData, testLabel, olda, start, current);
// betacompare("TruncatedRayleighFlowUnit-" + (i),olda.getBeta(),beta_s);
// }
for (int i = 5; i < 15; i++) {
start = System.currentTimeMillis();
TruncatedRayleighFlowLDA olda = new TruncatedRayleighFlowLDA(trainData, trainLabel, false, i * 2 + 2);
current = System.currentTimeMillis();
accuracy("TruncatedRayleighFlowLDA-" + (i), testData, testLabel, olda, start, current);
betacompare("TruncatedRayleighFlowLDA-" + (i),olda.getBeta(),beta_s);
}
CovarianceEstimator.lambda=12;
// for (int i = 1; i < 20; i++) {
// start = System.currentTimeMillis();
// TruncatedRayleighFlowSDA olda = new TruncatedRayleighFlowSDA(trainData, trainLabel, false, i * 2 + 2);
// current = System.currentTimeMillis();
// accuracy("TruncatedRayleighFlowSDA-" + (i), testData, testLabel, olda, start, current);
// betacompare("TruncatedRayleighFlowSDA-" + (i),olda.getBeta(),beta_s);
// }
for (int i = 5; i < 15; i++) {
start = System.currentTimeMillis();
TruncatedRayleighFlowDBSDA olda = new TruncatedRayleighFlowDBSDA(trainData, trainLabel, false, i * 2 + 2);
current = System.currentTimeMillis();
accuracy("TruncatedRayleighFlowDBSDA-" + (i), testData, testLabel, olda, start, current);
betacompare("TruncatedRayleighFlowDBSDA-" + (i),olda.getBeta(),beta_s);
}
// for (int i = 0; i < 5; i++) {
// start = System.currentTimeMillis();
// TruncatedRayleighFlowDBSDA olda = new
// TruncatedRayleighFlowDBSDA(trainData, trainLabel, false,
// i * 2 + 6);
// current = System.currentTimeMillis();
// accuracy("TruncatedRayleighFlowDBSDA-" + (i * 2 + 6), testData,
// testLabel, olda, start, current);
// }
start = System.currentTimeMillis();
RayleighFlowLDA olda = new RayleighFlowLDA(trainData, trainLabel, false);
current = System.currentTimeMillis();
accuracy("RayleighFlowLDA", testData, testLabel, olda, start, current);
betacompare("RayleighFlowLDA",olda.getBeta(),beta_s);
// start = System.currentTimeMillis();
// DBSDA dblda = new DBSDA(trainData, trainLabel, false);
// current = System.currentTimeMillis();
// accuracy("DBSDA", testData, testLabel, dblda, start, current);
// Estimator.lambda = 32.0;
// System.out.println(Utils.getErrorInf(olda.means[0], new
// double[1][p]));
}
}
private static void betacompare(String name, double[] beta, double[] betas) {
// int[] plabels=new int[labels.length];
// System.out.println("accuracy statistics");
if(beta.length!=betas.length)
System.exit(-1);
System.out.println(beta.length+"\t"+betas.length);
int tp = 0, fp = 0, tn = 0, fn = 0;
double[] err = new double[beta.length];
for (int i = 0; i < beta.length; i++) {
// System.out.println(beta[i] + "\t vs\t" + betas[i]);
if (beta[i] !=0 && betas[i] >= 1e-10) {
tp++;
} else if (beta[i] == 0 && betas[i] <1e-10) {
tn++;
} else if (betas[i] !=0 && betas[i] <1e-10) {
fp++;
} else {
fn++;
}
err[i] = beta[i] - betas[i];
}
ps1.println(name + "\t" + tp + "\t" + tn + "\t" + fp + "\t" + fn +"\t"+Utils.getLxNorm(err, Utils.L1)+"\t"+Utils.getLxNorm(err, Utils.L2));
}
private static void accuracy(String name, double[][] data, int[] labels, Classifier<double[]> classifier, long t1,
long t2) {
// int[] plabels=new int[labels.length];
// System.out.println("accuracy statistics");
int tp = 0, fp = 0, tn = 0, fn = 0;
for (int i = 0; i < labels.length; i++) {
int pl = classifier.predict(data[i]);
// System.out.println(pl + "\t vs\t" + labels[i]);
if (pl == 1 && labels[i] == 1) {
tp++;
} else if (pl == -1 && labels[i] == -1) {
tn++;
} else if (pl == 1 && labels[i] == -1) {
fp++;
} else {
fn++;
}
}
long train_time = t2 - t1;
double test_time = ((double) (System.currentTimeMillis() - t2)) / ((double) labels.length);
ps.println(name + "\t" + tp + "\t" + tn + "\t" + fp + "\t" + fn + "\t" + train_time + "\t" + test_time);
}
}
| [
"xiongha@rt04xiongha.managed.mst.edu"
] | xiongha@rt04xiongha.managed.mst.edu |
ec316a702739af7081163b2298193a1be93bcf38 | 30cd16b8d072a8c0d078bed61a1202a883c647c3 | /custom/training/trainingstorefront/web/src/org/training/storefront/filters/ConsentFilter.java | f2403124ca226b17a5b6c32229f0b468fb6cb58a | [] | no_license | purnandaru16/hybris-training-2 | 3d68958dba04e337d2695132982fe91e1d05674a | a8110da7be3a9d0f51d9cf6fc4ba0dade6205b88 | refs/heads/master | 2023-02-24T06:02:21.496718 | 2021-01-26T06:37:01 | 2021-01-26T06:37:01 | 332,448,673 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,273 | java | /*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package org.training.storefront.filters;
import de.hybris.platform.acceleratorstorefrontcommons.constants.WebConstants;
import de.hybris.platform.commercefacades.consent.AnonymousConsentFacade;
import de.hybris.platform.commercefacades.consent.data.AnonymousConsentData;
import de.hybris.platform.commercefacades.user.UserFacade;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.WebUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Filter which handle consent for anonymous customers.<br/>
* It read consent cookie and based on it set proper consent in session.
*/
public class ConsentFilter extends OncePerRequestFilter
{
private static final Logger LOG = LoggerFactory.getLogger(ConsentFilter.class);
private static final ObjectMapper mapper = new ObjectMapper();
private static final int NEVER_EXPIRES = (int) TimeUnit.DAYS.toSeconds(365); // 365 days for expiring
private UserFacade userFacade;
private AnonymousConsentFacade anonymousConsentFacade;
@Override
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
final FilterChain filterChain) throws ServletException, IOException
{
handleConsents(request, response);
filterChain.doFilter(request, response);
}
void handleConsents(final HttpServletRequest request, final HttpServletResponse response)
{
if (!getUserFacade().isAnonymousUser())
{
LOG.debug("user is not anonymous, nothing to filter");
return;
}
final Supplier<List<AnonymousConsentData>> consentReader = () -> readConsentCookies(request);
final Consumer<List<AnonymousConsentData>> consentWriter = consents -> writeConsentCookies(response, consents);
getAnonymousConsentFacade().synchronizeAnonymousConsents(consentReader, consentWriter);
}
protected List<AnonymousConsentData> readConsentCookies(final HttpServletRequest request)
{
final Cookie cookie = WebUtils.getCookie(request, WebConstants.ANONYMOUS_CONSENT_COOKIE);
if (cookie != null)
{
try
{
final String cookieValue = URLDecoder.decode(cookie.getValue(), UTF_8);
return Arrays.asList(mapper.readValue(cookieValue, AnonymousConsentData[].class));
}
catch (final IOException e)
{
LOG.error("IOException occurred while reading the cookie", e);
}
}
return Collections.emptyList();
}
protected void writeConsentCookies(final HttpServletResponse response, final List<AnonymousConsentData> consents)
{
try
{
final String cookieValue = mapper.writeValueAsString(consents);
final Cookie cookie = new Cookie(WebConstants.ANONYMOUS_CONSENT_COOKIE, URLEncoder.encode(cookieValue, UTF_8));
cookie.setMaxAge(NEVER_EXPIRES);
cookie.setPath("/");
cookie.setHttpOnly(true);
cookie.setSecure(true);
response.addCookie(cookie);
}
catch (final IOException e)
{
LOG.error("IOException occurred while writing the cookie to the Servlet Response", e);
}
}
protected UserFacade getUserFacade()
{
return userFacade;
}
@Required
public void setUserFacade(final UserFacade userFacade)
{
this.userFacade = userFacade;
}
protected AnonymousConsentFacade getAnonymousConsentFacade()
{
return anonymousConsentFacade;
}
@Required
public void setAnonymousConsentFacade(final AnonymousConsentFacade anonymousConsentFacade)
{
this.anonymousConsentFacade = anonymousConsentFacade;
}
}
| [
"kris.sunupurnandaru@ai.astra.co.id"
] | kris.sunupurnandaru@ai.astra.co.id |
38cdeaad33047da63b12793e472fc80e95f26c7d | 520029ffb90f20e3d945afe5d089daa8f7230b0c | /src/estructuras/Estructuras.java | fa44bc76f5af3bbbd504ed178cb80c910c1904f9 | [] | no_license | Zagitt/Estructuras | c2bbe67582614712ef34349e2646993b22c9a0f7 | 9da35f10368f9957c0708c980402ecd74af139fb | refs/heads/master | 2021-01-22T18:23:10.570191 | 2015-09-09T18:30:24 | 2015-09-09T18:30:24 | 42,145,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | 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 estructuras;
/**
*
* @author Gianni
*/
public class Estructuras {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
| [
"zagitt@gmail.com"
] | zagitt@gmail.com |
c0f3855990a5858c1615af9137134e14540650f6 | 7d51de419f40b2b828dd69157ea5993a55537b7d | /IceFeeling/src/main/java/dmz/faction/icefeeling/data/client/IFBlockStateProvider.java | 5718f91fb2d60908f97bf9107e9d5db7e71d81ed | [] | no_license | nicolas1410/IceFeeling | 7d8cbc1230a153115da14b66d39891ebfdfcdfef | da4b8e3bfbfb718104c28204437b86b38caa8147 | refs/heads/main | 2023-08-15T01:55:21.269950 | 2021-01-29T09:41:44 | 2021-01-29T09:41:44 | 329,286,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,909 | java | package dmz.faction.icefeeling.data.client;
import dmz.faction.icefeeling.blocks.IFBlocks;
import dmz.faction.icefeeling.mod.Main;
import net.minecraft.block.Block;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.common.data.ExistingFileHelper;
public class IFBlockStateProvider extends BlockStateProvider {
public IFBlockStateProvider(DataGenerator gen, ExistingFileHelper existingFileHelper) {
super(gen, Main.MOD_ID, existingFileHelper);
}
@Override
protected void registerStatesAndModels() {
simpleBlock(IFBlocks.JADE_ORE.get());
makeBlockItemFromExistingModel(IFBlocks.JADE_ORE.get());
simpleBlock(IFBlocks.OPAL_ORE.get());
makeBlockItemFromExistingModel(IFBlocks.OPAL_ORE.get());
simpleBlock(IFBlocks.TITANITE_ORE.get());
makeBlockItemFromExistingModel(IFBlocks.TITANITE_ORE.get());
simpleBlock(IFBlocks.MYTHRIL_ORE.get());
makeBlockItemFromExistingModel(IFBlocks.MYTHRIL_ORE.get());
simpleBlock(IFBlocks.OPAL_ORE_NETHER.get());
makeBlockItemFromExistingModel(IFBlocks.OPAL_ORE_NETHER.get());
simpleBlock(IFBlocks.SOLARIUM_ORE.get());
makeBlockItemFromExistingModel(IFBlocks.SOLARIUM_ORE.get());
simpleBlock(IFBlocks.ROBUSIUM_ORE.get());
makeBlockItemFromExistingModel(IFBlocks.ROBUSIUM_ORE.get());
simpleBlock(IFBlocks.ROBUSIUM_BLOCK.get());
makeBlockItemFromExistingModel(IFBlocks.ROBUSIUM_BLOCK.get());
}
private void makeBlockItemFromExistingModel(Block block) {
final ModelFile model = models().getExistingFile(block.getRegistryName());
simpleBlockItem(block, model);
}
}
| [
"nicod@DESKTOP-K2TL84V"
] | nicod@DESKTOP-K2TL84V |
f06bab465b8ddb1235036663e3e5b11b58b49dd1 | 3a0db6a676ac9cfdce9b44ab70f6819bb2de0364 | /AvoidTheBlocks/src/com/dk/nichlasandreasen/avoidtheblocks/entities/PowerUpCoin.java | b4f130a17cb73ac34d1d159916ed94e9b32e88f7 | [] | no_license | nicaa/AvoidTheBlocks | b8123be056305e5bb22c765f81a32520d2325c66 | f4135553efe1a4675e88a27908e63b420150f8f0 | refs/heads/master | 2021-01-10T07:09:32.309341 | 2015-06-14T22:47:15 | 2015-06-14T22:47:15 | 36,192,058 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.dk.nichlasandreasen.avoidtheblocks.entities;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import com.dk.nichlasandreasen.avoidtheblocks.utils.BitmapHolder;
public class PowerUpCoin extends Entity{
private Context context;
private Bitmap powerUp;
private int speed;
public PowerUpCoin(Context context, int width, int height, int x , int y){
this.context = context;
setX(x);
setY(y);
setHeight(height);
setWidth(width);
speed = (int)(width*0.006);
initBitmaps();
setSprite(powerUp);
setRect(new Rect(getX(), getY(), getX() + getSprite().getWidth(),getX() + getSprite().getHeight()));
}
public void initBitmaps(){
powerUp = BitmapHolder.powerUpCoin;
}
public void moveUp() {
setY(getY() - speed);
getRect().set(getX(), getY(), getX() + getSprite().getWidth(),getY() + getSprite().getHeight());
}
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
} | [
"nica1408@gmail.com"
] | nica1408@gmail.com |
93152b7ed7158f4626e674ce1686e754b57d6e9c | 0a8da300c0d464f66fbe39078b1e06b250976f99 | /app/src/main/java/project/sherpa/ui/activities/AccountActivity.java | efd63634363eb8114cc6acaf4b3b925e705d3b79 | [] | no_license | hogtreks/Sherpa | 3a4279a80029d1db981e9d4d69d4e2d9702e3fe4 | 33a55a6c7b72f2f080049cd6df000f2deeedfc46 | refs/heads/master | 2022-02-04T14:13:11.429120 | 2017-10-13T02:56:19 | 2017-10-13T02:56:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package project.sherpa.ui.activities;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import project.sherpa.R;
import project.sherpa.databinding.ActivityAccountBinding;
import project.sherpa.models.viewmodels.AccountViewModel;
/**
* Created by Alvin on 7/28/2017.
*/
public class AccountActivity extends AppCompatActivity {
// ** Member Variables ** //
ActivityAccountBinding mBinding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_account);
AccountViewModel vm = new AccountViewModel(this);
mBinding.setVm(vm);
}
}
| [
"amagh1990@gmail.com"
] | amagh1990@gmail.com |
4619ac81074f6e3a67873cef78c37b8271e6b693 | f52124d6c972765b3bf2ec10323afce85cf5505c | /sgee2.4-showcase/src/main/java/com/smartgwt/sample/showcase/client/Showcase.java | 3f8d973d0454c93aef640d486e81a158cd4d1dac | [] | no_license | thanglt/sg-train-example | e6fdcc79faf274b1f8f91c80d42140dffec80cd5 | 45f019310578172bfe44706223b9ceecc9a47529 | refs/heads/master | 2016-08-06T23:56:21.427629 | 2012-05-19T04:49:28 | 2012-05-19T04:49:28 | 36,644,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,345 | java | /*
* Isomorphic SmartGWT web presentation layer
* Copyright 2000 and beyond Isomorphic Software, Inc.
*
* OWNERSHIP NOTICE
* Isomorphic Software owns and reserves all rights not expressly granted in this source code,
* including all intellectual property rights to the structure, sequence, and format of this code
* and to all designs, interfaces, algorithms, schema, protocols, and inventions expressed herein.
*
* If you have any questions, please email <sourcecode@isomorphic.com>.
*
* This entire comment must accompany any portion of Isomorphic Software source code that is
* copied or moved from this file.
*/
package com.smartgwt.sample.showcase.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.HistoryListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.MenuItemIfFunction;
import com.smartgwt.client.widgets.menu.events.ClickHandler;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeNode;
import com.smartgwt.client.widgets.tree.events.LeafClickEvent;
import com.smartgwt.client.widgets.tree.events.LeafClickHandler;
import com.smartgwt.sample.showcase.client.data.CommandTreeNode;
import com.smartgwt.sample.showcase.client.data.ExplorerTreeNode;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Showcase implements EntryPoint, HistoryListener {
private TabSet mainTabSet;
private SideNavTree sideNav;
private Menu contextMenu;
public void onModuleLoad() {
final String initToken = History.getToken();
//setup overall layout / viewport
VLayout main = new VLayout() {
protected void onInit() {
super.onInit();
if (initToken.length() != 0) {
onHistoryChanged(initToken);
}
}
};
main.setWidth100();
main.setHeight100();
main.setLayoutMargin(5);
main.setStyleName("tabSetContainer");
HLayout hLayout = new HLayout();
hLayout.setWidth100();
hLayout.setHeight100();
VLayout sideNavLayout = new VLayout();
sideNavLayout.setHeight100();
sideNavLayout.setWidth(290);
sideNavLayout.setShowResizeBar(true);
sideNav = new SideNavTree();
sideNav.addLeafClickHandler(new LeafClickHandler() {
public void onLeafClick(LeafClickEvent event) {
TreeNode node = event.getLeaf();
showSample(node);
}
});
sideNavLayout.addMember(sideNav);
hLayout.addMember(sideNavLayout);
mainTabSet = new TabSet();
mainTabSet.setWidth100();
mainTabSet.setHeight100();
Layout paneContainerProperties = new Layout();
paneContainerProperties.setLayoutMargin(0);
paneContainerProperties.setLayoutTopMargin(1);
mainTabSet.setPaneContainerProperties(paneContainerProperties);
mainTabSet.setWidth100();
mainTabSet.setHeight100();
mainTabSet.addTabSelectedHandler(new TabSelectedHandler() {
public void onTabSelected(TabSelectedEvent event) {
Tab selectedTab = event.getTab();
String historyToken = selectedTab.getAttribute("historyToken");
if (historyToken != null) {
History.newItem(historyToken, false);
} else {
History.newItem("main", false);
}
}
});
Tab tab = new Tab();
tab.setTitle("SmartGWT EE Showcase ");
tab.setIcon("silk/database_connect.png");
ShowcaseGrid tocGrid = new ShowcaseGrid();
tocGrid.setHeight100();
tocGrid.setWidth100();
tocGrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
public void onRecordDoubleClick(RecordDoubleClickEvent event) {
TreeNode node = (TreeNode) event.getRecord();
showSample(node);
}
});
Window window = new Window();
window.setTitle("SmartGWT Enterprise Edition Showcase");
window.setHeaderIcon("silk/database_connect.png", 16, 16);
window.setWidth(500);
window.setHeight(375);
window.addItem(tocGrid);
window.setKeepInParentRect(true);
window.setTop(30);
window.setLeft(30);
window.setCanDragResize(true);
HLayout mainPanel = new HLayout();
mainPanel.setHeight100();
mainPanel.setWidth100();
if (SC.hasFirebug()) {
Label label = new Label();
label.setContents("<p>Firebug can make the Showcase run slow.</p><p>For the best performance, we suggest disabling Firebug for this site.</p>");
label.setWidth100();
label.setHeight("auto");
label.setMargin(20);
Window fbWindow = new Window();
fbWindow.setHeaderIcon("silk/bug.png", 16, 16);
fbWindow.setTitle("Firebug Detected");
fbWindow.addItem(label);
fbWindow.setWidth(220);
fbWindow.setHeight(130);
LayoutSpacer spacer = new LayoutSpacer();
spacer.setWidth100();
mainPanel.addMember(spacer);
mainPanel.addMember(fbWindow);
}
mainPanel.addChild(window);
contextMenu = createContextMenu();
tab.setPane(mainPanel);
mainTabSet.addTab(tab);
Canvas canvas = new Canvas();
canvas.setBackgroundImage("[SKIN]/shared/background.gif");
canvas.setWidth100();
canvas.setHeight100();
canvas.addChild(mainTabSet);
hLayout.addMember(canvas);
main.addMember(hLayout);
main.draw();
// Add history listener
History.addHistoryListener(this);
RootPanel.get("loadingMsg").getElement().setInnerHTML("");
}
private Menu createContextMenu() {
Menu menu = new Menu();
menu.setWidth(140);
MenuItemIfFunction enableCondition = new MenuItemIfFunction() {
public boolean execute(Canvas target, Menu menu, MenuItem item) {
int selectedTab = mainTabSet.getSelectedTabNumber();
return selectedTab != 0;
}
};
MenuItem closeItem = new MenuItem("<u>C</u>lose");
closeItem.setEnableIfCondition(enableCondition);
closeItem.setKeyTitle("Alt+C");
KeyIdentifier closeKey = new KeyIdentifier();
closeKey.setAltKey(true);
closeKey.setKeyName("C");
closeItem.setKeys(closeKey);
closeItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
int selectedTab = mainTabSet.getSelectedTabNumber();
mainTabSet.removeTab(selectedTab);
mainTabSet.selectTab(selectedTab - 1);
}
});
MenuItem closeAllButCurrent = new MenuItem("Close All But Current");
closeAllButCurrent.setEnableIfCondition(enableCondition);
closeAllButCurrent.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
int selected = mainTabSet.getSelectedTabNumber();
Tab[] tabs = mainTabSet.getTabs();
int[] tabsToRemove = new int[tabs.length - 2];
int cnt = 0;
for (int i = 1; i < tabs.length; i++) {
if (i != selected) {
tabsToRemove[cnt] = i;
cnt++;
}
}
mainTabSet.removeTabs(tabsToRemove);
}
});
MenuItem closeAll = new MenuItem("Close All");
closeAll.setEnableIfCondition(enableCondition);
closeAll.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
Tab[] tabs = mainTabSet.getTabs();
int[] tabsToRemove = new int[tabs.length - 1];
for (int i = 1; i < tabs.length; i++) {
tabsToRemove[i - 1] = i;
}
mainTabSet.removeTabs(tabsToRemove);
mainTabSet.selectTab(0);
}
});
menu.setItems(closeItem, closeAllButCurrent, closeAll);
return menu;
}
protected void showSample(TreeNode node) {
boolean isExplorerTreeNode = node instanceof ExplorerTreeNode;
if (node instanceof CommandTreeNode) {
CommandTreeNode commandTreeNode = (CommandTreeNode) node;
commandTreeNode.getCommand().execute();
} else if (isExplorerTreeNode) {
ExplorerTreeNode explorerTreeNode = (ExplorerTreeNode) node;
PanelFactory factory = explorerTreeNode.getFactory();
if (factory != null) {
String panelID = factory.getID();
Tab tab = null;
if (panelID != null) {
String tabID = panelID + "_tab";
tab = mainTabSet.getTab(tabID);
}
if (tab == null) {
Canvas panel = factory.create();
tab = new Tab();
tab.setID(factory.getID() + "_tab");
//store history token on tab so that when an already open is selected, one can retrieve the
//history token and update the URL
tab.setAttribute("historyToken", explorerTreeNode.getNodeID());
tab.setContextMenu(contextMenu);
String sampleName = explorerTreeNode.getName();
String icon = explorerTreeNode.getIcon();
if (icon == null) {
icon = "silk/plugin.png";
}
String imgHTML = Canvas.imgHTML(icon, 16, 16);
tab.setTitle("<span>" + imgHTML + " " + sampleName + "</span>");
tab.setPane(panel);
tab.setCanClose(true);
mainTabSet.addTab(tab);
mainTabSet.selectTab(tab);
} else {
mainTabSet.selectTab(tab);
}
History.newItem(explorerTreeNode.getNodeID(), false);
}
}
}
public void onHistoryChanged(String historyToken) {
if (historyToken == null || historyToken.equals("")) {
mainTabSet.selectTab(0);
} else {
ExplorerTreeNode[] showcaseData = sideNav.getShowcaseData();
for (ExplorerTreeNode explorerTreeNode : showcaseData) {
if (explorerTreeNode.getNodeID().equals(historyToken)) {
showSample(explorerTreeNode);
sideNav.selectRecord(explorerTreeNode);
Tree tree = sideNav.getData();
TreeNode categoryNode = tree.getParent(explorerTreeNode);
while (categoryNode != null && !"/".equals(tree.getName(categoryNode))) {
tree.openFolder(categoryNode);
categoryNode = tree.getParent(categoryNode);
}
}
}
}
}
}
| [
"usedtolove@3780552c-9477-eb81-3b8a-ad7423f44bd1"
] | usedtolove@3780552c-9477-eb81-3b8a-ad7423f44bd1 |
70172a2b3a4c04a652f6ab158cb20567912a4274 | 80913050cc14a814b02a461874001b60e469c38c | /OJ/intersection.java | 34742a2ef05649a83b24497c2818c3aa934f0928 | [] | no_license | Irena-J/Daily-practice-and-reflection | 8d0a3f53d293562a786ffc075124c70f53809315 | 79d66901b10c746dd4ce14260751aebea6760dd7 | refs/heads/master | 2022-12-11T22:48:14.710789 | 2020-09-06T14:47:32 | 2020-09-06T14:47:32 | 206,910,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | //给定两个数组,编写一个函数来计算它们的交集。
public int[] intersection(int[] nums1, int[] nums2) {
Set<Integer> set = new HashSet<>();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums1.length; i++) {
map.put(nums1[i], i);
}
for (int j = 0; j < nums2.length; j++) {
if (map.containsKey(nums2[j])) {
set.add(nums2[j]);
}
}
int[] res = new int[set.size()];
Iterator iterator = set.iterator();
int k = 0;
while (iterator.hasNext()) {
res[k] = (int) iterator.next();
k++;
}
return res;
} | [
"2426733691@qq.com"
] | 2426733691@qq.com |
9b239b60fe44945fd9f1de12d4783da25825f0e8 | 52f90d555fb5f4cde058f2f6ca045d367e7c268d | /src/main/java/sstendal/rest/RestService.java | e94cc6185438d14b34e088ebc4633e26f2bd85ac | [] | no_license | sstendal/angular-signicat | 48392bc5ab4cfe35ed0d272d9ddaf0a83e115049 | f71c12281271ad07166f981c6729ac4a20644742 | refs/heads/master | 2016-09-05T16:19:38.269843 | 2015-09-11T15:53:56 | 2015-09-11T15:53:56 | 41,752,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package sstendal.rest;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
/**
* The REST backend
*/
@Path("/")
public class RestService {
/**
* curl http://localhost:8090/rest/username
*/
@GET
@Produces("text/plain")
@Path("/username")
public Response getUsername(@Context HttpServletRequest request) {
String username = (String) request.getSession().getAttribute("username");
if (username == null) {
return Response.status(401).build();
} else {
return Response.status(200).entity("You are logged in as " + username).build();
}
}
/**
* curl http://localhost:8090/rest/logout
*/
@GET
@Produces("text/plain")
@Path("/logout")
public Response logout(@Context HttpServletRequest request) {
request.getSession().removeAttribute("username");
return Response.status(200).entity("You are logged out").build();
}
}
| [
"sigurd@sstendal.no"
] | sigurd@sstendal.no |
d88eef6632c8bbf81f4462228c9adbd9262f8fb8 | 8da3eabe508213c795e8a7a228b57df394753820 | /src/main/java/com/webischia/test1/repositories/CategoryRepository.java | 630e4192125dc93128d4ca8000531451780837fe | [] | no_license | ffahri/springlearn | 17f3f53faded18712ec4b1762c4a99deb47b1355 | 7ba76921ce72ab149338a822990984705031413a | refs/heads/master | 2021-08-18T21:03:44.534902 | 2017-11-23T20:58:36 | 2017-11-23T20:58:36 | 111,843,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.webischia.test1.repositories;
import com.webischia.test1.domain.Category;
import org.springframework.data.repository.CrudRepository;
import java.util.Optional;
public interface CategoryRepository extends CrudRepository<Category,Long> {
Optional<Category> findByDescription(String description);
}
| [
"admin@webischia.com"
] | admin@webischia.com |
fb7a2c2e61070b509cb528baca3f9589a6030fee | bda84da832065996cde92f2f2bba42d1a02b92c1 | /Learnings/src/IncrementDecrement.java | 73d929ce873f07b06774c1008bcf5963a16c3804 | [] | no_license | 0DarkPrince0/Core-Java-Practise2 | afce7bd96099febf1eed7f55ba651c0392bad95e | ca8ad823eb8c666ebcf5af603387f76ba8881ca7 | refs/heads/master | 2022-12-21T19:48:11.968238 | 2020-09-18T10:43:27 | 2020-09-18T10:43:27 | 296,591,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java |
public class IncrementDecrement {
public static void inc()
{
int n=5;
System.out.println(++n);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
IncrementDecrement.inc();
}
}
| [
"faheem.ilahi@rediffmail.com"
] | faheem.ilahi@rediffmail.com |
40902645af91e4d5fca0f3efdef4a8def23256ab | 0e75d26812f6e52385e5295e86c123ba6930ece0 | /library1206/src/main/java/com/springboot/library/controller/LibLoanBookController.java | 54e0b1f2dbfeef4dff6b7b5f99a6d93fab2bb83d | [] | no_license | valdetegjoni/library | 486ce843f5ea497042282a52771380a78424c3d6 | 16514e0aba1cba4d49778a35c8dd4c6b9fa97345 | refs/heads/master | 2023-05-19T20:36:52.359236 | 2021-06-15T09:23:29 | 2021-06-15T09:23:29 | 374,036,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | /**
*
*/
package com.springboot.library.controller;
import javax.validation.Valid;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.library.entity.LibLoanBook;
import com.springboot.library.request.LoanBookRequest;
import com.springboot.library.service.LibLoanBookService;
import com.springboot.library.view.LibLoanBookView;
/**
* @author valdete
*
*/
@RestController
@RequestMapping("/loan")
public class LibLoanBookController {
private final LibLoanBookService service;
/**
* @param service
*/
public LibLoanBookController(LibLoanBookService service) {
this.service = service;
}
@GetMapping("/{id}")
@ResponseBody
public LibLoanBookView getLoanBook(@PathVariable Long id) {
return service.getLoanBook(id);
}
@GetMapping
@ResponseBody
public Page<LibLoanBookView> getAllLoanBooks(@PageableDefault(sort = "id", direction = Sort.Direction.ASC) Pageable pageable){
return service.getAllLoanedBooks(pageable);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable Long id) {
service.deleteLoanBook(id);
}
@PostMapping
@ResponseBody
@ResponseStatus(HttpStatus.CREATED)
public LibLoanBookView createLoanBook(@RequestBody @Valid LoanBookRequest req) {
return service.createLoanBook(req);
}
@PutMapping("/{id}")
public LibLoanBookView updateLoanBook(@PathVariable(name = "id") Long id, @RequestBody @Valid LoanBookRequest req) {
LibLoanBook loanBook = service.findByIdOrThrow(id);
return service.update(loanBook, req);
}
}
| [
"gjoni_v@hotmail.com"
] | gjoni_v@hotmail.com |
d554c326e72f1d7882b798fa910ea843d757ae7e | 36f256378ed0620e8cbb67a54247eae6d7fbb23b | /src/com/epam/kaliada/oop/task2/Product.java | 2b7153b8b3de140065465a678a8a53290b147b42 | [] | no_license | AlKaliada/Java_Basics_UpSkill_Lab_1 | 797c1dd239ee0a947e9b35c067799de01fc3f9b7 | 4bec9b9b53ce55d07f70e811788f96bee99b5770 | refs/heads/master | 2023-01-21T11:21:46.686677 | 2020-12-09T09:33:45 | 2020-12-09T09:33:45 | 304,262,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.epam.kaliada.oop.task2;
public class Product {
private String name;
private double price;
private int quantity;
public Product(String name, double price, int quantity) {
if (name == null || quantity < 1 || price <= 0){
throw new IllegalArgumentException("No valid data");
}
this.name = name;
this.price = price;
this.quantity = quantity;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
| [
"Aliaksei.Kaliada@gmail.com"
] | Aliaksei.Kaliada@gmail.com |
cc9ec2aa7cd69701285dbaa1c21f153e2b386d41 | 5a45e848d65186a1eedf921d8ecc125f78c8917e | /practica_7/src/paquete_2/SumaNumeros.java | 1a9024cdd29b4eef29ea9591aed64737dd3c71e9 | [] | no_license | concpetosfundamentalesprogramacionaa19/practica080719-2bim-davidpillco | 02fd1fb75f2c06a01266d74aa2ca38c9cd79cd47 | df375adaf2e15bf4a6e0d3db255176ad16691902 | refs/heads/master | 2020-06-17T09:28:11.259202 | 2019-07-08T21:56:18 | 2019-07-08T21:56:18 | 195,881,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 607 | 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 paquete_2;
/**
*
* @author davidpill
*/
public class SumaNumeros {
public static void suma(int n) {
double suma = 0;
for (int i = 0; i <= n; i++) {
suma = suma + i;
}
System.out.println(suma);
}
public static int Suma (int valor) {
if (valor <= 0){
return 0;
}else{
return valor + Suma(valor-1);
}
}
}
| [
"davidpilco@gmail.com"
] | davidpilco@gmail.com |
a033e79e059acd0692368509ce502d01185289b0 | fe8f794f3a4abed3ab3a2d68c9842534522720a8 | /app/src/main/java/info/kingpes/mymodule/MainActivity.java | ec7a44bef3957bd50a93f8711c2caa7aa02097e9 | [] | no_license | hhnchau/MyModule | d73b1e082252d0405decee7db66695eecddafe85 | c2a1d97b9995b8aa63e1552e7f566165fb7d5977 | refs/heads/master | 2020-06-13T20:58:53.864465 | 2019-07-02T04:23:36 | 2019-07-02T04:23:36 | 194,785,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package info.kingpes.mymodule;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import info.kingpes.mymodule.fragmentcontroller.FragmentController;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void fragmentController(View view) {
startActivity(new Intent(this, FragmentController.class));
}
}
| [
"chauhn@phuthotech.vn"
] | chauhn@phuthotech.vn |
d8c877a916e649fe821af21a06e1ff8f95978436 | 82fe1a0adea33c02d1a09fffa580c9a5f3ac0d23 | /src/me/wilk3z/kpractice/commands/cmdTeam.java | 9352499f2db67cfc6d2fdaf55c8aa4bf7783de63 | [] | no_license | kliwwy/kPractice | 7780b3d4a1135f8f579c1f916a06361c3b5f4f3b | f1c9953f902ebf5fb3d59d6107639495fb89da94 | refs/heads/master | 2020-04-13T17:31:33.438413 | 2018-12-28T17:57:35 | 2018-12-28T17:57:35 | 163,350,125 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,640 | java | package me.wilk3z.kpractice.commands;
import me.wilk3z.kpractice.Practice;
import me.wilk3z.kpractice.teams.TeamHandler;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class cmdTeam implements CommandExecutor
{
public Practice plugin;
public cmdTeam(Practice plugin)
{
this.plugin = plugin;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
TeamHandler teamHandler = new TeamHandler(plugin);
if(sender instanceof Player)
{
Player p = (Player) sender;
if(args.length >= 1)
{
String subCmd = args[0];
if (subCmd.equalsIgnoreCase("create"))
{
teamHandler.createTeam(p);
return true;
}
if (subCmd.equalsIgnoreCase("disband"))
{
teamHandler.disbandTeam(p);
return true;
}
if (subCmd.equalsIgnoreCase("leader"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.setLeader(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return false;
}
p.sendMessage(ChatColor.RED + "Usage: /team leader <player>");
return false;
}
if (subCmd.equalsIgnoreCase("kick"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.kickFromTeam(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return true;
}
p.sendMessage(ChatColor.RED + "Usage: /team kick <player>");
return false;
}
if (subCmd.equalsIgnoreCase("promote"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.promote(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return true;
}
p.sendMessage(ChatColor.RED + "Usage: /team promote <player>");
return false;
}
if (subCmd.equalsIgnoreCase("demote"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.demote(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return true;
}
p.sendMessage(ChatColor.RED + "Usage: /team demote <player>");
return false;
}
if (subCmd.equalsIgnoreCase("invite"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.invite(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return true;
}
p.sendMessage(ChatColor.RED + "Usage: /team invite <player>");
return false;
}
if (subCmd.equalsIgnoreCase("join"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.joinTeam(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return true;
}
p.sendMessage(ChatColor.RED + "Usage: /team join <player>");
return false;
}
if (subCmd.equalsIgnoreCase("quit"))
{
teamHandler.quitTeam(p);
return true;
}
if (subCmd.equalsIgnoreCase("open"))
{
teamHandler.open(p);
return true;
}
if (subCmd.equalsIgnoreCase("close"))
{
teamHandler.close(p);
return true;
}
if (subCmd.equalsIgnoreCase("info") || subCmd.equalsIgnoreCase("i"))
{
if(args.length >= 2)
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
teamHandler.showTeamInfo(p, target);
return true;
}
p.sendMessage(ChatColor.YELLOW + args[1] + ChatColor.RED + " is currently not online.");
return false;
}
teamHandler.showTeamInfo(p, p);
return false;
}
displayHelp(p);
p.sendMessage(ChatColor.RED + "Unknown sub-command '" + ChatColor.YELLOW + subCmd + ChatColor.RED + "'.");
return false;
}
displayHelp(p);
return false;
}
return false;
}
public void displayHelp(Player p)
{
p.sendMessage(ChatColor.DARK_GRAY + ChatColor.STRIKETHROUGH.toString() + "-----------------------------------------------");
p.sendMessage(ChatColor.GOLD + ChatColor.BOLD.toString() + "Team Commands");
p.sendMessage(ChatColor.DARK_PURPLE + "Use " + ChatColor.LIGHT_PURPLE + "@" + ChatColor.DARK_PURPLE + " at the start of a chat message to send a team message.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team create" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Creates kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team disband" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Deletes an existing kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team leader <player>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team kick <player>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team promote <player>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team demote <player>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team invite <player>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team join <player>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the icon for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team quit" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the default or editor inventory for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team open" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team close" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team chat <msg>" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "/team info [player]" + ChatColor.DARK_GREEN + " - " + ChatColor.YELLOW + "Sets the arenas for a kit.");
p.sendMessage(ChatColor.DARK_GRAY + ChatColor.STRIKETHROUGH.toString() + "-----------------------------------------------");
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.