blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4951956b0a46c54604e974dfb2cd2acd5e1618b2 | bbd0326cf4699c2116eb30c02cf7fe4ebb0558c0 | /expt0/patch/ACS/plausible/Lang_24_if_return_0.java | e280674e7768932fc11b3c3248a0893a4b885270 | [] | no_license | qixin5/ssFix | 82131862c0a54be88e57c1df246e6e2b49901e11 | fb106c8715e232885dc25ea9ea9b9d0910cf8524 | refs/heads/master | 2021-01-23T04:59:24.836730 | 2020-12-31T02:42:18 | 2020-12-31T02:42:18 | 86,259,519 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 48,289 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.lang3.math;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.commons.lang3.StringUtils;
/**
* <p>Provides extra functionality for Java Number classes.</p>
*
* @author Apache Software Foundation
* @author <a href="mailto:rand_mcneely@yahoo.com">Rand McNeely</a>
* @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
* @author Eric Pugh
* @author Phil Steitz
* @author Matthew Hawthorne
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author <a href="mailto:fredrik@westermarck.com">Fredrik Westermarck</a>
* @since 2.0
* @version $Id$
*/
public class NumberUtils {
/** Reusable Long constant for zero. */
public static final Long LONG_ZERO = new Long(0L);
/** Reusable Long constant for one. */
public static final Long LONG_ONE = new Long(1L);
/** Reusable Long constant for minus one. */
public static final Long LONG_MINUS_ONE = new Long(-1L);
/** Reusable Integer constant for zero. */
public static final Integer INTEGER_ZERO = new Integer(0);
/** Reusable Integer constant for one. */
public static final Integer INTEGER_ONE = new Integer(1);
/** Reusable Integer constant for minus one. */
public static final Integer INTEGER_MINUS_ONE = new Integer(-1);
/** Reusable Short constant for zero. */
public static final Short SHORT_ZERO = new Short((short) 0);
/** Reusable Short constant for one. */
public static final Short SHORT_ONE = new Short((short) 1);
/** Reusable Short constant for minus one. */
public static final Short SHORT_MINUS_ONE = new Short((short) -1);
/** Reusable Byte constant for zero. */
public static final Byte BYTE_ZERO = Byte.valueOf((byte) 0);
/** Reusable Byte constant for one. */
public static final Byte BYTE_ONE = Byte.valueOf((byte) 1);
/** Reusable Byte constant for minus one. */
public static final Byte BYTE_MINUS_ONE = Byte.valueOf((byte) -1);
/** Reusable Double constant for zero. */
public static final Double DOUBLE_ZERO = new Double(0.0d);
/** Reusable Double constant for one. */
public static final Double DOUBLE_ONE = new Double(1.0d);
/** Reusable Double constant for minus one. */
public static final Double DOUBLE_MINUS_ONE = new Double(-1.0d);
/** Reusable Float constant for zero. */
public static final Float FLOAT_ZERO = new Float(0.0f);
/** Reusable Float constant for one. */
public static final Float FLOAT_ONE = new Float(1.0f);
/** Reusable Float constant for minus one. */
public static final Float FLOAT_MINUS_ONE = new Float(-1.0f);
/**
* <p><code>NumberUtils</code> instances should NOT be constructed in standard programming.
* Instead, the class should be used as <code>NumberUtils.toInt("6");</code>.</p>
*
* <p>This constructor is public to permit tools that require a JavaBean instance
* to operate.</p>
*/
public NumberUtils() {
super();
}
//-----------------------------------------------------------------------
/**
* <p>Convert a <code>String</code> to an <code>int</code>, returning
* <code>zero</code> if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, <code>zero</code> is returned.</p>
*
* <pre>
* NumberUtils.toInt(null) = 0
* NumberUtils.toInt("") = 0
* NumberUtils.toInt("1") = 1
* </pre>
*
* @param str the string to convert, may be null
* @return the int represented by the string, or <code>zero</code> if
* conversion fails
* @since 2.1
*/
public static int toInt(String str) {
return toInt(str, 0);
}
/**
* <p>Convert a <code>String</code> to an <code>int</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, the default value is returned.</p>
*
* <pre>
* NumberUtils.toInt(null, 1) = 1
* NumberUtils.toInt("", 1) = 1
* NumberUtils.toInt("1", 0) = 1
* </pre>
*
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the int represented by the string, or the default if conversion fails
* @since 2.1
*/
public static int toInt(String str, int defaultValue) {
if(str == null) {
return defaultValue;
}
try {
return Integer.parseInt(str);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
/**
* <p>Convert a <code>String</code> to a <code>long</code>, returning
* <code>zero</code> if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, <code>zero</code> is returned.</p>
*
* <pre>
* NumberUtils.toLong(null) = 0L
* NumberUtils.toLong("") = 0L
* NumberUtils.toLong("1") = 1L
* </pre>
*
* @param str the string to convert, may be null
* @return the long represented by the string, or <code>0</code> if
* conversion fails
* @since 2.1
*/
public static long toLong(String str) {
return toLong(str, 0L);
}
/**
* <p>Convert a <code>String</code> to a <code>long</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, the default value is returned.</p>
*
* <pre>
* NumberUtils.toLong(null, 1L) = 1L
* NumberUtils.toLong("", 1L) = 1L
* NumberUtils.toLong("1", 0L) = 1L
* </pre>
*
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the long represented by the string, or the default if conversion fails
* @since 2.1
*/
public static long toLong(String str, long defaultValue) {
if (str == null) {
return defaultValue;
}
try {
return Long.parseLong(str);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
/**
* <p>Convert a <code>String</code> to a <code>float</code>, returning
* <code>0.0f</code> if the conversion fails.</p>
*
* <p>If the string <code>str</code> is <code>null</code>,
* <code>0.0f</code> is returned.</p>
*
* <pre>
* NumberUtils.toFloat(null) = 0.0f
* NumberUtils.toFloat("") = 0.0f
* NumberUtils.toFloat("1.5") = 1.5f
* </pre>
*
* @param str the string to convert, may be <code>null</code>
* @return the float represented by the string, or <code>0.0f</code>
* if conversion fails
* @since 2.1
*/
public static float toFloat(String str) {
return toFloat(str, 0.0f);
}
/**
* <p>Convert a <code>String</code> to a <code>float</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string <code>str</code> is <code>null</code>, the default
* value is returned.</p>
*
* <pre>
* NumberUtils.toFloat(null, 1.1f) = 1.0f
* NumberUtils.toFloat("", 1.1f) = 1.1f
* NumberUtils.toFloat("1.5", 0.0f) = 1.5f
* </pre>
*
* @param str the string to convert, may be <code>null</code>
* @param defaultValue the default value
* @return the float represented by the string, or defaultValue
* if conversion fails
* @since 2.1
*/
public static float toFloat(String str, float defaultValue) {
if (str == null) {
return defaultValue;
}
try {
return Float.parseFloat(str);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
/**
* <p>Convert a <code>String</code> to a <code>double</code>, returning
* <code>0.0d</code> if the conversion fails.</p>
*
* <p>If the string <code>str</code> is <code>null</code>,
* <code>0.0d</code> is returned.</p>
*
* <pre>
* NumberUtils.toDouble(null) = 0.0d
* NumberUtils.toDouble("") = 0.0d
* NumberUtils.toDouble("1.5") = 1.5d
* </pre>
*
* @param str the string to convert, may be <code>null</code>
* @return the double represented by the string, or <code>0.0d</code>
* if conversion fails
* @since 2.1
*/
public static double toDouble(String str) {
return toDouble(str, 0.0d);
}
/**
* <p>Convert a <code>String</code> to a <code>double</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string <code>str</code> is <code>null</code>, the default
* value is returned.</p>
*
* <pre>
* NumberUtils.toDouble(null, 1.1d) = 1.1d
* NumberUtils.toDouble("", 1.1d) = 1.1d
* NumberUtils.toDouble("1.5", 0.0d) = 1.5d
* </pre>
*
* @param str the string to convert, may be <code>null</code>
* @param defaultValue the default value
* @return the double represented by the string, or defaultValue
* if conversion fails
* @since 2.1
*/
public static double toDouble(String str, double defaultValue) {
if (str == null) {
return defaultValue;
}
try {
return Double.parseDouble(str);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
//-----------------------------------------------------------------------
/**
* <p>Convert a <code>String</code> to a <code>byte</code>, returning
* <code>zero</code> if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, <code>zero</code> is returned.</p>
*
* <pre>
* NumberUtils.toByte(null) = 0
* NumberUtils.toByte("") = 0
* NumberUtils.toByte("1") = 1
* </pre>
*
* @param str the string to convert, may be null
* @return the byte represented by the string, or <code>zero</code> if
* conversion fails
* @since 2.5
*/
public static byte toByte(String str) {
return toByte(str, (byte) 0);
}
/**
* <p>Convert a <code>String</code> to a <code>byte</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, the default value is returned.</p>
*
* <pre>
* NumberUtils.toByte(null, 1) = 1
* NumberUtils.toByte("", 1) = 1
* NumberUtils.toByte("1", 0) = 1
* </pre>
*
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the byte represented by the string, or the default if conversion fails
* @since 2.5
*/
public static byte toByte(String str, byte defaultValue) {
if(str == null) {
return defaultValue;
}
try {
return Byte.parseByte(str);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
/**
* <p>Convert a <code>String</code> to a <code>short</code>, returning
* <code>zero</code> if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, <code>zero</code> is returned.</p>
*
* <pre>
* NumberUtils.toShort(null) = 0
* NumberUtils.toShort("") = 0
* NumberUtils.toShort("1") = 1
* </pre>
*
* @param str the string to convert, may be null
* @return the short represented by the string, or <code>zero</code> if
* conversion fails
* @since 2.5
*/
public static short toShort(String str) {
return toShort(str, (short) 0);
}
/**
* <p>Convert a <code>String</code> to an <code>short</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string is <code>null</code>, the default value is returned.</p>
*
* <pre>
* NumberUtils.toShort(null, 1) = 1
* NumberUtils.toShort("", 1) = 1
* NumberUtils.toShort("1", 0) = 1
* </pre>
*
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the short represented by the string, or the default if conversion fails
* @since 2.5
*/
public static short toShort(String str, short defaultValue) {
if(str == null) {
return defaultValue;
}
try {
return Short.parseShort(str);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
//-----------------------------------------------------------------------
// must handle Long, Float, Integer, Float, Short,
// BigDecimal, BigInteger and Byte
// useful methods:
// Byte.decode(String)
// Byte.valueOf(String,int radix)
// Byte.valueOf(String)
// Double.valueOf(String)
// Float.valueOf(String)
// new Float(String)
// Integer.valueOf(String,int radix)
// Integer.valueOf(String)
// Integer.decode(String)
// Integer.getInteger(String)
// Integer.getInteger(String,int val)
// Integer.getInteger(String,Integer val)
// new Integer(String)
// new Double(String)
// new Byte(String)
// new Long(String)
// Long.getLong(String)
// Long.getLong(String,int)
// Long.getLong(String,Integer)
// Long.valueOf(String,int)
// Long.valueOf(String)
// new Short(String)
// Short.decode(String)
// Short.valueOf(String,int)
// Short.valueOf(String)
// new BigDecimal(String)
// new BigInteger(String)
// new BigInteger(String,int radix)
// Possible inputs:
// 45 45.5 45E7 4.5E7 Hex Oct Binary xxxF xxxD xxxf xxxd
// plus minus everything. Prolly more. A lot are not separable.
/**
* <p>Turns a string value into a java.lang.Number.</p>
*
* <p>First, the value is examined for a type qualifier on the end
* (<code>'f','F','d','D','l','L'</code>). If it is found, it starts
* trying to create successively larger types from the type specified
* until one is found that can represent the value.</p>
*
* <p>If a type specifier is not found, it will check for a decimal point
* and then try successively larger types from <code>Integer</code> to
* <code>BigInteger</code> and from <code>Float</code> to
* <code>BigDecimal</code>.</p>
*
* <p>If the string starts with <code>0x</code> or <code>-0x</code>, it
* will be interpreted as a hexadecimal integer. Values with leading
* <code>0</code>'s will not be interpreted as octal.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* <p>This method does not trim the input string, i.e., strings with leading
* or trailing spaces will generate NumberFormatExceptions.</p>
*
* @param str String containing a number, may be null
* @return Number created from the string
* @throws NumberFormatException if the value cannot be converted
*/
public static Number createNumber(String str) throws NumberFormatException {
if (str == null) {
return null;
}
if (StringUtils.isBlank(str)) {
throw new NumberFormatException("A blank string is not a valid number");
}
if (str.startsWith("--")) {
// this is protection for poorness in java.lang.BigDecimal.
// it accepts this as a legal value, but it does not appear
// to be in specification of class. OS X Java parses it to
// a wrong value.
return null;
}
if (str.startsWith("0x") || str.startsWith("-0x")) {
return createInteger(str);
}
char lastChar = str.charAt(str.length() - 1);
String mant;
String dec;
String exp;
int decPos = str.indexOf('.');
int expPos = str.indexOf('e') + str.indexOf('E') + 1;
if (decPos > -1) {
if (expPos > -1) {
if (expPos < decPos || expPos > str.length()) {
throw new NumberFormatException(str + " is not a valid number.");
}
dec = str.substring(decPos + 1, expPos);
} else {
dec = str.substring(decPos + 1);
}
mant = str.substring(0, decPos);
} else {
if (expPos > -1) {
if (expPos > str.length()) {
throw new NumberFormatException(str + " is not a valid number.");
}
mant = str.substring(0, expPos);
} else {
mant = str;
}
dec = null;
}
if (!Character.isDigit(lastChar) && lastChar != '.') {
if (expPos > -1 && expPos < str.length() - 1) {
exp = str.substring(expPos + 1, str.length() - 1);
} else {
exp = null;
}
//Requesting a specific type..
String numeric = str.substring(0, str.length() - 1);
boolean allZeros = isAllZeros(mant) && isAllZeros(exp);
switch (lastChar) {
case 'l' :
case 'L' :
if (dec == null
&& exp == null
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
try {
return createLong(numeric);
} catch (NumberFormatException nfe) {
//Too big for a long
}
return createBigInteger(numeric);
}
throw new NumberFormatException(str + " is not a valid number.");
case 'f' :
case 'F' :
try {
Float f = NumberUtils.createFloat(numeric);
if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) {
//If it's too big for a float or the float value = 0 and the string
//has non-zeros in it, then float does not have the precision we want
return f;
}
} catch (NumberFormatException nfe) {
// ignore the bad number
}
//$FALL-THROUGH$
case 'd' :
case 'D' :
try {
Double d = NumberUtils.createDouble(numeric);
if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) {
return d;
}
} catch (NumberFormatException nfe) {
// ignore the bad number
}
try {
return createBigDecimal(numeric);
} catch (NumberFormatException e) {
// ignore the bad number
}
//$FALL-THROUGH$
default :
throw new NumberFormatException(str + " is not a valid number.");
}
} else {
//User doesn't have a preference on the return type, so let's start
//small and go from there...
if (expPos > -1 && expPos < str.length() - 1) {
exp = str.substring(expPos + 1, str.length());
} else {
exp = null;
}
if (dec == null && exp == null) {
//Must be an int,long,bigint
try {
return createInteger(str);
} catch (NumberFormatException nfe) {
// ignore the bad number
}
try {
return createLong(str);
} catch (NumberFormatException nfe) {
// ignore the bad number
}
return createBigInteger(str);
} else {
//Must be a float,double,BigDec
boolean allZeros = isAllZeros(mant) && isAllZeros(exp);
try {
Float f = createFloat(str);
if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) {
return f;
}
} catch (NumberFormatException nfe) {
// ignore the bad number
}
try {
Double d = createDouble(str);
if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) {
return d;
}
} catch (NumberFormatException nfe) {
// ignore the bad number
}
return createBigDecimal(str);
}
}
}
/**
* <p>Utility method for {@link #createNumber(java.lang.String)}.</p>
*
* <p>Returns <code>true</code> if s is <code>null</code>.</p>
*
* @param str the String to check
* @return if it is all zeros or <code>null</code>
*/
private static boolean isAllZeros(String str) {
if (str == null) {
return true;
}
for (int i = str.length() - 1; i >= 0; i--) {
if (str.charAt(i) != '0') {
return false;
}
}
return str.length() > 0;
}
//-----------------------------------------------------------------------
/**
* <p>Convert a <code>String</code> to a <code>Float</code>.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
* @return converted <code>Float</code>
* @throws NumberFormatException if the value cannot be converted
*/
public static Float createFloat(String str) {
if (str == null) {
return null;
}
return Float.valueOf(str);
}
/**
* <p>Convert a <code>String</code> to a <code>Double</code>.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
* @return converted <code>Double</code>
* @throws NumberFormatException if the value cannot be converted
*/
public static Double createDouble(String str) {
if (str == null) {
return null;
}
return Double.valueOf(str);
}
/**
* <p>Convert a <code>String</code> to a <code>Integer</code>, handling
* hex and octal notations.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
* @return converted <code>Integer</code>
* @throws NumberFormatException if the value cannot be converted
*/
public static Integer createInteger(String str) {
if (str == null) {
return null;
}
// decode() handles 0xAABD and 0777 (hex and octal) as well.
return Integer.decode(str);
}
/**
* <p>Convert a <code>String</code> to a <code>Long</code>.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
* @return converted <code>Long</code>
* @throws NumberFormatException if the value cannot be converted
*/
public static Long createLong(String str) {
if (str == null) {
return null;
}
return Long.valueOf(str);
}
/**
* <p>Convert a <code>String</code> to a <code>BigInteger</code>.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
* @return converted <code>BigInteger</code>
* @throws NumberFormatException if the value cannot be converted
*/
public static BigInteger createBigInteger(String str) {
if (str == null) {
return null;
}
return new BigInteger(str);
}
/**
* <p>Convert a <code>String</code> to a <code>BigDecimal</code>.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
* @return converted <code>BigDecimal</code>
* @throws NumberFormatException if the value cannot be converted
*/
public static BigDecimal createBigDecimal(String str) {
if (str == null) {
return null;
}
// handle JDK1.3.1 bug where "" throws IndexOutOfBoundsException
if (StringUtils.isBlank(str)) {
throw new NumberFormatException("A blank string is not a valid number");
}
return new BigDecimal(str);
}
// Min in array
//--------------------------------------------------------------------
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static long min(long[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns min
long min = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static int min(int[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns min
int min = array[0];
for (int j = 1; j < array.length; j++) {
if (array[j] < min) {
min = array[j];
}
}
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static short min(short[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns min
short min = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static byte min(byte[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns min
byte min = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#min(double[]) IEEE754rUtils for a version of this method that handles NaN differently
*/
public static double min(double[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns min
double min = array[0];
for (int i = 1; i < array.length; i++) {
if (Double.isNaN(array[i])) {
return Double.NaN;
}
if (array[i] < min) {
min = array[i];
}
}
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#min(float[]) IEEE754rUtils for a version of this method that handles NaN differently
*/
public static float min(float[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns min
float min = array[0];
for (int i = 1; i < array.length; i++) {
if (Float.isNaN(array[i])) {
return Float.NaN;
}
if (array[i] < min) {
min = array[i];
}
}
return min;
}
// Max in array
//--------------------------------------------------------------------
/**
* <p>Returns the maximum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static long max(long[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns max
long max = array[0];
for (int j = 1; j < array.length; j++) {
if (array[j] > max) {
max = array[j];
}
}
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static int max(int[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns max
int max = array[0];
for (int j = 1; j < array.length; j++) {
if (array[j] > max) {
max = array[j];
}
}
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static short max(short[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns max
short max = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
}
}
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
*/
public static byte max(byte[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns max
byte max = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
}
}
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#max(double[]) IEEE754rUtils for a version of this method that handles NaN differently
*/
public static double max(double[] array) {
// Validates input
if (array== null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns max
double max = array[0];
for (int j = 1; j < array.length; j++) {
if (Double.isNaN(array[j])) {
return Double.NaN;
}
if (array[j] > max) {
max = array[j];
}
}
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#max(float[]) IEEE754rUtils for a version of this method that handles NaN differently
*/
public static float max(float[] array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
} else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
// Finds and returns max
float max = array[0];
for (int j = 1; j < array.length; j++) {
if (Float.isNaN(array[j])) {
return Float.NaN;
}
if (array[j] > max) {
max = array[j];
}
}
return max;
}
// 3 param min
//-----------------------------------------------------------------------
/**
* <p>Gets the minimum of three <code>long</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the smallest of the values
*/
public static long min(long a, long b, long c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
}
/**
* <p>Gets the minimum of three <code>int</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the smallest of the values
*/
public static int min(int a, int b, int c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
}
/**
* <p>Gets the minimum of three <code>short</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the smallest of the values
*/
public static short min(short a, short b, short c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
}
/**
* <p>Gets the minimum of three <code>byte</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the smallest of the values
*/
public static byte min(byte a, byte b, byte c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
}
/**
* <p>Gets the minimum of three <code>double</code> values.</p>
*
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the smallest of the values
* @see IEEE754rUtils#min(double, double, double) for a version of this method that handles NaN differently
*/
public static double min(double a, double b, double c) {
return Math.min(Math.min(a, b), c);
}
/**
* <p>Gets the minimum of three <code>float</code> values.</p>
*
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the smallest of the values
* @see IEEE754rUtils#min(float, float, float) for a version of this method that handles NaN differently
*/
public static float min(float a, float b, float c) {
return Math.min(Math.min(a, b), c);
}
// 3 param max
//-----------------------------------------------------------------------
/**
* <p>Gets the maximum of three <code>long</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the largest of the values
*/
public static long max(long a, long b, long c) {
if (b > a) {
a = b;
}
if (c > a) {
a = c;
}
return a;
}
/**
* <p>Gets the maximum of three <code>int</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the largest of the values
*/
public static int max(int a, int b, int c) {
if (b > a) {
a = b;
}
if (c > a) {
a = c;
}
return a;
}
/**
* <p>Gets the maximum of three <code>short</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the largest of the values
*/
public static short max(short a, short b, short c) {
if (b > a) {
a = b;
}
if (c > a) {
a = c;
}
return a;
}
/**
* <p>Gets the maximum of three <code>byte</code> values.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the largest of the values
*/
public static byte max(byte a, byte b, byte c) {
if (b > a) {
a = b;
}
if (c > a) {
a = c;
}
return a;
}
/**
* <p>Gets the maximum of three <code>double</code> values.</p>
*
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the largest of the values
* @see IEEE754rUtils#max(double, double, double) for a version of this method that handles NaN differently
*/
public static double max(double a, double b, double c) {
return Math.max(Math.max(a, b), c);
}
/**
* <p>Gets the maximum of three <code>float</code> values.</p>
*
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
* @param a value 1
* @param b value 2
* @param c value 3
* @return the largest of the values
* @see IEEE754rUtils#max(float, float, float) for a version of this method that handles NaN differently
*/
public static float max(float a, float b, float c) {
return Math.max(Math.max(a, b), c);
}
//-----------------------------------------------------------------------
/**
* <p>Checks whether the <code>String</code> contains only
* digit characters.</p>
*
* <p><code>Null</code> and empty String will return
* <code>false</code>.</p>
*
* @param str the <code>String</code> to check
* @return <code>true</code> if str contains only unicode numeric
*/
public static boolean isDigits(String str) {
if (StringUtils.isEmpty(str)) {
return false;
}
for (int i = 0; i < str.length(); i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
/**
* <p>Checks whether the String a valid Java number.</p>
*
* <p>Valid numbers include hexadecimal marked with the <code>0x</code>
* qualifier, scientific notation and numbers marked with a type
* qualifier (e.g. 123L).</p>
*
* <p><code>Null</code> and empty String will return
* <code>false</code>.</p>
*
* @param str the <code>String</code> to check
* @return <code>true</code> if the string is a correctly formatted number
*/
public static boolean isNumber(String str) {
if (StringUtils.isEmpty(str)) {
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
boolean hasExp = false;
boolean hasDecPoint = false;
boolean allowSigns = false;
boolean foundDigit = false;
// deal with any possible sign up front
int start = (chars[0] == '-') ? 1 : 0;
if (sz > start + 1) {
if (chars[start] == '0' && chars[start + 1] == 'x') {
int i = start + 2;
if (i == sz) {
return false; // str == "0x"
}
// checking hex (it can't be anything else)
for (; i < chars.length; i++) {
if ((chars[i] < '0' || chars[i] > '9')
&& (chars[i] < 'a' || chars[i] > 'f')
&& (chars[i] < 'A' || chars[i] > 'F')) {
return false;
}
}
return true;
}
}
sz--; // don't want to loop to the last char, check it afterwords
// for type qualifiers
int i = start;
// loop to the next to last char or to the last char if we need another digit to
// make a valid number (e.g. chars[0..5] = "1234E")
while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) {
if (chars[i] >= '0' && chars[i] <= '9') {
foundDigit = true;
allowSigns = false;
} else if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
// two decimal points or dec in exponent
return false;
}
hasDecPoint = true;
} else if (chars[i] == 'e' || chars[i] == 'E') {
// we've already taken care of hex.
if (hasExp) {
// two E's
return false;
}
if (!foundDigit) {
return false;
}
hasExp = true;
allowSigns = true;
} else if (chars[i] == '+' || chars[i] == '-') {
if (!allowSigns) {
return false;
}
allowSigns = false;
foundDigit = false; // we need a digit after the E
} else {
return false;
}
i++;
}
if (i < chars.length) {
if (chars[i] >= '0' && chars[i] <= '9') {
// no type qualifier, OK
return true;
}
if (chars[i] == 'e' || chars[i] == 'E') {
// can't have an E at the last byte
return false;
}
if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
// two decimal points or dec in exponent
return false;
}
// single trailing decimal point after non-exponent is ok
return foundDigit;
}
if (!allowSigns
&& (chars[i] == 'd'
|| chars[i] == 'D'
|| chars[i] == 'f'
|| chars[i] == 'F')) {
return foundDigit;
}
if (chars[i] == 'l'
|| chars[i] == 'L') {
***********************************************************************patch begin*********************************************************************
if (hasDecPoint==true){return false;}
************************************************************************patch end****************************************************************
// not allowing L with an exponent or decimal point
return foundDigit && !hasExp;
}
// last character is illegal
return false;
}
// allowSigns is true iff the val ends in 'E'
// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
return !allowSigns && foundDigit;
}
}
| [
"xinq07@gmail.com"
] | xinq07@gmail.com |
9d413a62e4a4e45792e75cdea5af66b1042e1650 | 2d233c5cd17585272b30ec0837b1da76aa543253 | /director-common/src/main/java/com/intel/director/common/ValidationUtil.java | f20b1060b986c8418e99dfd576ef1b1ddf0e2503 | [] | no_license | opencit/opencit-director | c4f83b7e85945fedbc1b0a5b6f6640fa238bc809 | 87e57c53021345eea67794d48108de39dd0d68e0 | refs/heads/master | 2021-01-21T11:16:09.398357 | 2018-10-17T17:33:59 | 2018-10-17T17:33:59 | 91,731,973 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,207 | java | package com.intel.director.common;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.commons.lang.StringUtils;
import com.intel.director.common.exception.DirectorException;
public class ValidationUtil {
public static void validateUrl(String urlStr, String type) throws DirectorException {
if(StringUtils.isBlank(urlStr)){
throw new DirectorException("Invalid "+type +" url");
}
URL url;
try {
url = new URL(urlStr);
} catch (MalformedURLException e) {
throw new DirectorException("Invalid " + type + " url");
}
String hostByUser = url.getHost();
if (StringUtils.isBlank(hostByUser)) {
throw new DirectorException("Error validating " + type + " endpoint. No host specified. ");
}
if (StringUtils.isBlank(url.getProtocol())) {
throw new DirectorException("Error validating " + type + " endpoint. No protocol specified. ");
}
if (url.getPort() == -1) {
throw new DirectorException("Error validating " + type + " endpoint. No port specified.");
}
String path = url.getPath();
if (StringUtils.isNotBlank(path)) {
throw new DirectorException("Please provide the " + type + " endpoint in format http(s)://HOST:PORT");
}
}
}
| [
"soakx@intel.com"
] | soakx@intel.com |
b655077f39368178e66dacdeac0c6166af970eeb | a5b866f5708d857347a50d6f106754c040d1acf4 | /Maps, Lambda and Stream API - Exercise/src/CompanyUsers.java | 0728b23c850f8de6c8509ba7ab0f4cbd14c82c96 | [] | no_license | StanchevaYoana/Java-Fundamentals | 3c8434cdab20a009737e0d25be2d45bc0d772e37 | 99a883c313864f52ae39026a508925f4924325d4 | refs/heads/master | 2020-06-21T20:00:54.710482 | 2019-08-05T13:50:29 | 2019-08-05T13:50:29 | 197,541,288 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,293 | java | import java.util.*;
public class CompanyUsers {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Map<String, List<String>> firmData = new LinkedHashMap<>();
String input = "";
while (!"End".equals(input = scanner.nextLine())) {
String[] data = input.split(" -> ");
String company = data[0];
String user = data[1];
firmData.putIfAbsent(company, new ArrayList<>());
if (isUnique(firmData, user, company)) {
firmData.get(company).add(user);
}
}
firmData.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey))
.forEach(e -> {
System.out.println(e.getKey());
e.getValue().stream().forEach(p -> System.out.println(String.format("-- %s", p)));
});
}
static boolean isUnique(Map<String, List<String>> firmData, String user, String company) {
boolean isUnique = true;
if (firmData.get(company).size() > 0) {
for (String s : firmData.get(company)) {
if (user.equals(s)) {
isUnique = false;
}
}
}
return isUnique;
}
} | [
"yoana.radoslavova@gmail.com"
] | yoana.radoslavova@gmail.com |
4a0a8cef67e11205f1fdb1f6fe266a7bb70b016c | 160a6b02ab51041d5bb3dd33068c711bdfa9301d | /src/main/java/com/pheonix/customerservice/model/Registration.java | f252c6a99d4160c4e4ceef3a0198b1b79ce1af59 | [] | no_license | praveenit219/springKafka-DigiCustomerService | e2c16c33c00bd28cf9711e34c57c59c1fbf4d507 | 15addb9333860083390166dcbbf48056d8e78b2a | refs/heads/master | 2020-04-19T22:37:51.403054 | 2019-02-01T04:58:09 | 2019-02-01T04:58:09 | 168,474,243 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.pheonix.customerservice.model;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
@Data
@NoArgsConstructor
@RequiredArgsConstructor
@Document(collection = "registrations")
public class Registration {
@Id
private String id;
@NonNull
private String email;
@NonNull
private String userId;
@NonNull
private String password;
@NonNull
private Date createdAt;
private Date updatedAt;
}
| [
"praveen.tirunamali@gmail.com"
] | praveen.tirunamali@gmail.com |
0defd075d8c5869a36cba52a1e577c9ea239b863 | 3af8f34768bf1dd525fad28f7c423b1af82b3571 | /src/main/java/jp/jyn/jbukkitlib/uuid/UUIDBytes.java | 505dab43118f6e9e0a2e61d52274163eb20d39ed | [
"Apache-2.0"
] | permissive | HimaJyun/JBukkitLib | 91ef4021e4023cba75e74acc26f56aabe3c14ecc | 71c3510b0341fd20f16cb9b0b2bb0fed90c0276d | refs/heads/master | 2021-11-22T10:33:52.835864 | 2021-07-26T03:19:52 | 2021-07-26T03:19:52 | 164,517,963 | 0 | 0 | Apache-2.0 | 2021-07-26T03:19:53 | 2019-01-08T00:08:39 | Java | UTF-8 | Java | false | false | 814 | java | package jp.jyn.jbukkitlib.uuid;
import java.nio.ByteBuffer;
import java.util.UUID;
/**
* UUID from/to byte array converter.
*/
public class UUIDBytes {
private UUIDBytes() {}
/**
* UUID to byte array
*
* @param uuid uuid
* @return byte array
*/
public static byte[] toBytes(UUID uuid) {
return ByteBuffer.allocate(16)
.putLong(uuid.getMostSignificantBits())
.putLong(uuid.getLeastSignificantBits())
.array();
}
/**
* byte array to UUID
*
* @param bytes byte array
* @return UUID
*/
public static UUID fromBytes(byte[] bytes) {
ByteBuffer bb = ByteBuffer.wrap(bytes);
long most = bb.getLong();
long least = bb.getLong();
return new UUID(most, least);
}
}
| [
"HimaJyun@users.noreply.github.com"
] | HimaJyun@users.noreply.github.com |
ca3ca085ee9abcc02a42e4843a86f4ba9304a1c3 | 2a2ca179cd70d29a4626d0496fe84cb3f7158f1b | /common/src/main/java/university/innopolis/industrialprogramming/messages/Message.java | e1fec5eb037a79c5698f0f48d3e671cc770b90c9 | [] | no_license | goshaQ/pointless-chat | dc6b38f42e58017844e57c4930f62d8a10e30977 | ea095c393600cb1433c64c06b5739932d02063d6 | refs/heads/master | 2020-04-09T02:00:33.855339 | 2018-12-01T08:52:33 | 2018-12-01T08:52:33 | 159,925,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package university.innopolis.industrialprogramming.messages;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = TextMessage.class, name = "text"),
@JsonSubTypes.Type(value = CommandMessage.class, name = "command")
})
public interface Message {
String getSender();
Object getContent();
void setSender(String sender);
}
| [
"g.emelyanov@innopolis.ru"
] | g.emelyanov@innopolis.ru |
4fb5b867cf5c7d0a945c09262181e329856e174d | 50e7c178a2ef61135dba4977c4e686190a64a4fd | /kwani/src/main/java/com/kwani/service/PlayerServiceImpl.java | 63e9bd120c12a6b1572e0d0b94a5734781a28233 | [] | no_license | duckey-kim/kwani-project | f3f2b253889f29981cc3b7baa885b2c7b86a1afb | 4fd4785fc5a97dbb21235beadaff519fc9bf65b0 | refs/heads/main | 2023-06-18T21:12:37.783310 | 2021-06-12T06:20:27 | 2021-06-12T06:20:27 | 313,810,339 | 0 | 1 | null | 2021-06-12T06:20:27 | 2020-11-18T03:16:11 | Java | UTF-8 | Java | false | false | 2,982 | java | package com.kwani.service;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.kwani.mapper.PlayerMapper;
import lombok.Setter;
import lombok.extern.log4j.Log4j;
@Log4j
@Service
@Transactional
public class PlayerServiceImpl implements PlayerService {
@Setter(onMethod_ = @Autowired)
private PlayerMapper playerMapper;
@Override
public List<Map<String, String>> getListFromTable(List<Map<String, String>> listMap,
List<Map<String, String>> list) {
// 주어진 listMap을 list에 추가
if (listMap != null) {
list.addAll(listMap);
}
return list;
}
@SuppressWarnings("unchecked")
@Override
public void setCurrentList(List<Map<String,String>>currentList, HttpSession session) {
List<Map<String,String>> savedList= (List<Map<String,String>>)session.getAttribute("list");
if(savedList!=null) {
currentList.addAll(0,savedList);
}
session.setAttribute("list", currentList);
}
@Override
public String setScriptArr(List<Map<String,String>> currentList) {
Iterator<Map<String, String>> it = currentList.iterator();
String result = "[";
while (it.hasNext()) {
result += "\"" + it.next().get("TRACK_URL") + "\"";
if (!it.hasNext())
break;
result += ",";
}
result += "]";
return result;
}
@Override
public List<Map<String, String>> getTrackUrlInAlbum(Integer albumId) {
// album id로 album수록곡들의 url을 가져온다.
List<Map<String, String>> urlList = playerMapper.getAlbumList(albumId);
return urlList == null ? Collections.emptyList() : urlList;
}
@Override
public List<Map<String, String>> getTracksUrl(Integer[] trackId) {
// trackId와 일치하는 곡의 url을 가져온다.
List<Map<String, String>> urlList = playerMapper.getTracksUrl(trackId);
return urlList == null ? Collections.emptyList() : urlList;
}
//playlist Id 같은 거 테이블에서 가져오기
@Override
public List<Map<String, String>> getUserPlayList(Integer listId) {
List<Map<String,String>> listMap = playerMapper.getUserPlayList(listId);
return listMap==null?Collections.emptyList():listMap;
}
@Override
public int mergeHistory(String email, Integer trackId) {
log.info("email : "+email);
log.info("trackId :"+trackId);
return playerMapper.mergeHistory(trackId, email);
}
@Override
public List<Map<String, String>> getListLibrary(String email) {
List<Map<String,String>> getList = playerMapper.getListLibrary(email);
return getList==null?Collections.emptyList():getList;
}
@Override
public List<Map<String, String>> getListLikedTrack(String email) {
List<Map<String,String>> getList = playerMapper.getListLikedTrack(email);
return getList==null?Collections.emptyList():getList;
}
}
| [
"57125670+duckey-kim@users.noreply.github.com"
] | 57125670+duckey-kim@users.noreply.github.com |
6a6469290e53c8a99998502895a6f7ea313328a8 | 6c22022d1a6730a09c8a441670f3dad8c7cd6559 | /src/njci/service/test/UserInfoServiceImplTest.java | 7d71fed7e2083c48d06087b558ad15d713875b69 | [] | no_license | Sanguine-00/recycle | 4496ef6afb5b637d8437d23f186e7a9a8393d96c | 61b5fed284fa7c1f15330a2d8770fdf8834dc2b6 | refs/heads/master | 2020-12-29T01:32:15.648799 | 2016-09-20T01:21:32 | 2016-09-20T01:21:32 | 62,302,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package njci.service.test;
import junit.framework.Assert;
import njci.bean.UserInfo;
import njci.service.UserInfoService;
import njci.util.EncryptUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class UserInfoServiceImplTest {
@Autowired
private UserInfoService userInfoService;
// @Autowired
// private RoleInfoService roleInfoService;
@Test
public void testInsert() {
UserInfo userInfo = new UserInfo();
userInfo.setName("孙琦");
userInfo.setLoginId("0000124");
userInfo.setPassword(EncryptUtil.md5Crypt("111111"));
userInfo.setLogo("images/孙琦.jpg");
userInfo.setPhone("15951712380");
userInfo.setAddress("连云港东海");
// RoleInfo roleInfo = roleInfoService.getById(1);// 2--管理员 1--普通用户
userInfo.setRole(2);
Integer actual = userInfoService.save(userInfo);
// Integer expected = 3;
// Assert.assertEquals(expected, actual);
}
@Test
public void testAppLogin(){
userInfoService.appLogin("0000125", "111111");
}
}
| [
"1216160345@qq.com"
] | 1216160345@qq.com |
77c8a3880019be1169a097dd797537c980786575 | df5e4e715d6188fc77092519dc1ecf4212038874 | /app/src/main/java/com/dev/kunal/musicalstructure/Song.java | 9a7132bfce619bc7c4b2d8f9309967d3dbe8cac1 | [] | no_license | kbhuwalka/MusicalStructure | 2dec42ccd9f6ed29a3edb9840057005a5ae64960 | d600c6951613ea01b2112e0507adbc18c8814a4e | refs/heads/master | 2021-07-10T12:10:39.398889 | 2017-10-11T19:41:30 | 2017-10-11T19:41:30 | 106,526,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package com.dev.kunal.musicalstructure;
/**
* Created by Kunal on 10/12/2017.
*/
public class Song {
public String name;
public String artist;
public Song(String name, String artist) {
this.name = name;
this.artist = artist;
}
}
| [
"kunal.bhuwalka@hotmail.com"
] | kunal.bhuwalka@hotmail.com |
270d76837d2e61f5f6fed142233e1824ef6eeede | 030c89cf1dbbeb756e854b727fe5dd2e7b4f8c71 | /java/Java basico/Java I/OCA/construtor/construtor02.java | df2b2556024574c708f1c62bd6c6b44deadefc0c | [] | no_license | isvaldo/Trabalhos-Faculdade | ce85e957ffd06c4b1199684671b4dcaa3984e1d9 | 4061383149900f35179a295eec7d3247bd24c880 | refs/heads/master | 2020-05-27T16:52:14.862534 | 2015-10-14T14:39:55 | 2015-10-14T14:39:55 | 22,792,860 | 0 | 0 | null | 2015-02-01T00:05:34 | 2014-08-09T18:50:57 | Java | UTF-8 | Java | false | false | 272 | java | package a.b.c;
public class D {
D() {
System.out.println("construtor");
}
void D() {
System.out.println("metodo");
}
public static void main(String... args) {
new D(); // valido construtor
new D().D(); // valido metodo
}
}
| [
"isvaldo.fernandes@gmail.com"
] | isvaldo.fernandes@gmail.com |
0285b6748f9a6735c0ca02ee41a6beb8a512be98 | 2815a9ed7a650d00aa3e731790d61b269e66fecd | /src/one/digitalinnovation/gof/abstractfactory/AbstractFactory.java | 198496a1299719179c34891c114a855e4c346f19 | [] | no_license | xXHachimanXx/lab-padroes-projeto-java | d1eaf8901bebd22d2d3a7bb55116d3e1ad17af34 | 274b874576d223dd3763dc952d51c03afa7ce9fe | refs/heads/main | 2023-08-22T17:33:36.198940 | 2021-10-08T00:14:51 | 2021-10-08T00:14:51 | 414,785,159 | 0 | 0 | null | 2021-10-07T23:25:00 | 2021-10-07T23:24:59 | null | UTF-8 | Java | false | false | 122 | java | package one.digitalinnovation.gof.abstractfactory;
public interface AbstractFactory<T> {
T create(String objType) ;
} | [
"globaldep90@gmail.com"
] | globaldep90@gmail.com |
2cd3629212e99c0e237b48b13dae6448dc0221dc | 20eba2b0e3b5e8f7fa6023694b9324d25d79a966 | /NativeAdDemo/secondapp/src/main/java/cn/domob/www/secondapp/MainActivity.java | cfad32fe3d4d559b57cdab3cde9ff7a0356e3826 | [] | no_license | Domob-SDK/android-ad-sdk-native-sample | 387e3669f76dada3fe0d95a46a817b86e198911d | 37f82b68cc56ceaecdf12b0f93620453fe1fca60 | refs/heads/master | 2020-06-07T12:40:20.221850 | 2015-01-19T03:53:30 | 2015-01-19T03:53:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | package cn.domob.www.secondapp;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"zhujiarong@domob.cn"
] | zhujiarong@domob.cn |
ee94c6be214a1ee745c79df288107c72275e65cd | a1debe8a6cf5f7797e285ecbf5b36b9db8ccd37a | /src/E1/Test.java | 56acfcf65a5da0cb08173a5df8308451e6d0c9c0 | [] | no_license | C1eromerom/TAD | b50df1bacaa86a456b5fffb5052d3e9c12a07cbd | de5fe4fbf8d427f08d939df7259b6fec95ceb663 | refs/heads/master | 2020-04-06T04:03:25.525088 | 2017-03-06T18:26:03 | 2017-03-06T18:26:03 | 83,065,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | package E1;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
ListaSimple lista = new ListaSimple();
Nodo a = new Nodo(1);
lista.setInicio(a);
lista.setTamaño(lista.getTamaño()+1);
Nodo b = new Nodo(2);
lista.getInicio().setSiguiente(b);
lista.setTamaño(lista.getTamaño()+1);
Nodo c = new Nodo(3);
lista.getInicio().getSiguiente().setSiguiente(c);
lista.setTamaño(lista.getTamaño()+1);
Nodo d = new Nodo(2);
lista.getInicio().getSiguiente().getSiguiente().setSiguiente(d);
lista.setTamaño(lista.getTamaño()+1);
Nodo e = new Nodo(5);
lista.getInicio().getSiguiente().getSiguiente().getSiguiente().setSiguiente(e);
lista.setTamaño(lista.getTamaño()+1);
lista.insertarInicio(new Nodo(0));
lista.insertarFinal(new Nodo(4));
System.out.println(lista.toString());
lista.insertarPosicion(3, new Nodo(9));
System.out.println(lista.toString());
System.out.println("Eliminar primero--");
lista.eliminarPrimero();
System.out.println(lista.toString());
System.out.println("Eliminar ultimo");
lista.eliminarUltimo();
System.out.println(lista.toString());
lista.eliminarPosicion(3);
System.out.println(lista.toString());
System.out.println(lista.buscarPrimero(new Nodo(2)));
System.out.println(lista.buscarTodos(new Nodo(2)));
}
}
| [
"C1eromerom@ieslavereda.es"
] | C1eromerom@ieslavereda.es |
d154d6dd38d4fcd470f535e0a6c97c7b039f0f10 | ff0966cc3d01ee6c6b522a081e9d31a172cd8658 | /ReportProjectV1.2/src/com/tibco/bean/Hospital.java | 685b613be0e498b3d53a7928a4d7afadd05acbc0 | [] | no_license | iFrankWu/MyGithub | f161cd2693d8cff8dabf7af161e376f114bd1bea | b41d01c069dbad7fe861c5926bdf9e975a341685 | refs/heads/master | 2020-12-29T02:43:48.817737 | 2016-12-25T09:59:19 | 2016-12-25T09:59:19 | 21,498,650 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,012 | java | package com.tibco.bean;
public class Hospital {
private int hospitalId;
private String name;
private String department;
private String machineNumber;
private String handController;
private String firmwareVersion;
private String hospitalLogo;
/**
* return the value of this department
* @return
*/
public String getDepartment() {
return department;
}
/**
* @param department the department to set
*
*/
public void setDepartment(String department) {
this.department = department;
}
/**
* return the value of this hospitalLogo
* @return
*/
public String getHospitalLogo() {
return hospitalLogo;
}
/**
* @param hospitalLogo the hospitalLogo to set
*
*/
public void setHospitalLogo(String hospitalLogo) {
this.hospitalLogo = hospitalLogo;
}
/**
* return the value of this handController
* @return
*/
public String getHandController() {
return handController;
}
/**
* @param handController the handController to set
*
*/
public void setHandController(String handController) {
this.handController = handController;
}
public int getHospitalId() {
return hospitalId;
}
public void setHospitalId(int hospitalId) {
this.hospitalId = hospitalId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMachineNumber() {
return machineNumber;
}
public void setMachineNumber(String machineNumber) {
this.machineNumber = machineNumber;
}
public String getFirmwareVersion() {
return firmwareVersion;
}
public void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
@Override
public String toString() {
return "Hospital [hospitalId=" + hospitalId + ", name=" + name
+ ", department=" + department + ", machineNumber="
+ machineNumber + ", handController=" + handController
+ ", firmwareVersion=" + firmwareVersion + ", hospitalLogo="
+ hospitalLogo + "]";
}
}
| [
"wushexin@gmail.com"
] | wushexin@gmail.com |
782e60ab36d18b7fcd125994b19d01a47000b16d | 21826160ae771c1c3dbf090f034d49fa24b93ce0 | /src/main/java/hotel/entity/Department.java | ef8c9b67a6114764209fc3bf87e03a826a0cbe4b | [] | no_license | buddhika75/hhims | fbfb20ef8c400583112784bcf04951caed6f5a2b | 62e25b002b32b00e38df7340a65e3fac1a21cb08 | refs/heads/master | 2021-01-16T00:28:25.927019 | 2015-04-30T05:32:00 | 2015-04-30T05:32:00 | 32,729,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hotel.entity;
import javax.persistence.Entity;
/**
*
* @author buddhika
*/
@Entity
public class Department extends DepartmentOrInstitution {
}
| [
"buddhika.ari@gmail.com"
] | buddhika.ari@gmail.com |
7eb0194bec224bb642e97f5c9eff84cb7618082a | 6ab3ba0c2909162b918606e127fa294930c01cbe | /TestBeanMachine.java | cf4fdef1a983a6ecd4ac6e9965b683b91e286bda | [] | no_license | u10416021/U10416021_HW6_bean_play- | 69d6bf133916d7abcba1fd0d5fa136ee938e36f6 | 81f719ce74dc4bc0d0a3dd60aef688edbb5d7cd9 | refs/heads/master | 2021-01-21T13:04:30.298120 | 2016-04-24T16:14:52 | 2016-04-24T16:14:52 | 55,300,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | //U10416021 張馨容
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.shape.*;
public class TestBeanMachine{
//main method
public static void main(String[] args) {
//create Thread
new Thread() {
@Override
//to run BeanMachine.class
public void run() {
Application.launch(BeanMachine.class);
}
//invoke the start() method to tell the JVM that the thread is ready to run
}.start();
}
} | [
"u10416021@go.utaipei.edu.tw"
] | u10416021@go.utaipei.edu.tw |
9f71463fc89d14deb6fe58126e20076a5023e316 | 28c1272f53181497cdcbbe4f903711d9fc0b0d68 | /sts/BankMybatis/src/main/java/com/mulcam/bank/MemberController.java | e415bca594d4d78499e86566b5fd7d154c36c46b | [] | no_license | kmathl96/K-Digital-AI | 88be4d6a30f5b4115217ecf90c7115dde2302784 | b13e3b1d0854f3289214f4f316c03d81d5031c47 | refs/heads/master | 2023-03-28T09:08:45.373705 | 2021-04-02T12:29:15 | 2021-04-02T12:29:15 | 332,774,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,004 | java | package com.mulcam.bank;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.mulcam.bank.bean.Member;
import com.mulcam.bank.dao.MemberDAO;
@Controller
public class MemberController {
private MemberDAO memberDao;
public void setMemberDao(MemberDAO memberDao) {
this.memberDao = memberDao;
}
@RequestMapping(value="/join", method=RequestMethod.GET)
public String join(Model model) {
model.addAttribute("page", "join_form");
return "template";
}
@RequestMapping(value="/join", method=RequestMethod.POST)
public ModelAndView join(HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView();
Member mem = null;
try {
mem = memberDao.queryMember(request.getParameter("id"));
if (mem!=null) {
modelAndView.addObject("err","아이디 중복");
modelAndView.addObject("page","err");
} else {
mem = new Member();
mem.setId(request.getParameter("id"));
mem.setPassword(request.getParameter("password"));
mem.setName(request.getParameter("name"));
mem.setSex(request.getParameter("sex"));
mem.setAge(Integer.parseInt(request.getParameter("age")));
mem.setEmail(request.getParameter("email"));
memberDao.insertMember(mem);
modelAndView.addObject("page","login_form");
}
} catch (Exception e) {
modelAndView.addObject("err","회원가입 오류");
modelAndView.addObject("page","err");
}
// 결과와 페이지를 한번에 넣어서 반환
modelAndView.setViewName("template");
return modelAndView;
}
@RequestMapping(value="/login", method=RequestMethod.GET)
public String login(Model model) {
model.addAttribute("page","login_form");
return "template";
}
@RequestMapping(value="/login", method=RequestMethod.POST)
public ModelAndView login(HttpServletRequest request) {
String id = request.getParameter("id");
String password = request.getParameter("password");
ModelAndView modelAndView = new ModelAndView();
try {
Member mem = memberDao.queryMember(id);
if (mem==null) {
throw new Exception();
} else {
if (mem.getPassword().equals(password)) {
HttpSession session = request.getSession();
session.setAttribute("id", id);
modelAndView.addObject("page", "makeaccount_form");
} else throw new Exception();
}
} catch (Exception e) {
modelAndView.addObject("page", "login_form");
}
modelAndView.setViewName("template");
return modelAndView;
}
@RequestMapping(value="/logout", method=RequestMethod.GET)
public String logout(HttpServletRequest request, Model model) {
HttpSession session = request.getSession();
session.removeAttribute("id");
model.addAttribute("page", "login_form");
return "template";
}
} | [
"kmathl96@naver.com"
] | kmathl96@naver.com |
117df491c12e8d3df79114bc8989ef5305f69d13 | 1ad210f6440215546e7990260125e9b5268a2bc7 | /src/main/java/br/com/casadocodigo/loja/conf/SecurityConfiguration.java | 91eb16063cfa4914df25e516ad6c4cc79a074009 | [] | no_license | t-d-jesus/casadocodigo | af5aa6b9b8261b0fbdd9c8fdc1ba682897cd2294 | 50466c39f19164022c3d285afefd5adee9cc5e68 | refs/heads/master | 2022-12-08T14:19:48.895765 | 2018-02-03T19:26:09 | 2018-02-03T19:26:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,735 | java | package br.com.casadocodigo.loja.conf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import br.com.casadocodigo.loja.daos.UserDAO;
//@EnableWebSecurity
@EnableWebMvcSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter{
@Autowired
private UserDAO users;
protected void configure(HttpSecurity http) throws Exception{
http.authorizeRequests()
.antMatchers("/products/form").hasRole("ADMIN")
.antMatchers("/shopping/**").permitAll()
.antMatchers(HttpMethod.POST,"/products").hasRole("ADMIN")
.antMatchers("/products/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/products")
.permitAll()
.and()
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/login")
.permitAll()
.and()
.exceptionHandling()
.accessDeniedPage("/WEB-INF/views/errors/403.jsp");
;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception{
auth.userDetailsService(users)
.passwordEncoder(new BCryptPasswordEncoder());
}
}
| [
"guear@hotmail.com"
] | guear@hotmail.com |
7b6e3611ec9981a7704127659fa117a47e88a59f | 916c84917601ec57f8229cd66b8dd1e35f1a3082 | /Opgave7/src/waren/Kookboek.java | cffa6e3fd420d1d9653cc0a01cdb12b57c0eaf30 | [] | no_license | krousseeuw/javaschool | 05cb3fe5bf26a0b4a2cd4c4ab4be81d6dcd0e529 | 6d12f83cc55a4cd27e514ea24735d1d2fc61fb17 | refs/heads/master | 2021-09-24T02:36:01.795608 | 2018-10-01T20:09:46 | 2018-10-01T20:09:46 | 112,503,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package waren;
public class Kookboek extends NonFictie implements IHardcover {
/**
*
*/
private static final long serialVersionUID = 3096601209161825684L;
@Override
public void geefMeerprijs() {
// TODO Auto-generated method stub
}
@Override
public void geefISBN() {
// TODO Auto-generated method stub
}
}
| [
"k.rousseeuw@hotmail.com"
] | k.rousseeuw@hotmail.com |
df272f5839461111ceea3af3104693fbb17f7651 | f6899a2cf1c10a724632bbb2ccffb7283c77a5ff | /glassfish-4.1.1/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/model/ResponseBody.java | ee523398bcd406905181d8a23e022a91245687c8 | [] | no_license | Appdynamics/OSS | a8903058e29f4783e34119a4d87639f508a63692 | 1e112f8854a25b3ecf337cad6eccf7c85e732525 | refs/heads/master | 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null | UTF-8 | Java | false | false | 5,978 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.admin.rest.model;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
public class ResponseBody {
public static final String EVENT_NAME="response/body";
private List<Message> messages = new ArrayList<Message>();
private boolean includeResourceLinks = true;
private List<ResourceLink> links = new ArrayList<ResourceLink>();
public ResponseBody() {
}
public ResponseBody(boolean includeResourceLinks) {
setIncludeResourceLinks(includeResourceLinks);
}
public ResponseBody(URI parentUri) {
addParentResourceLink(parentUri);
}
public ResponseBody(boolean includeResourceLinks, URI parentUri) {
setIncludeResourceLinks(includeResourceLinks);
addParentResourceLink(parentUri);
}
public void setIncludeResourceLinks(boolean includeResourceLinks) {
this.includeResourceLinks = includeResourceLinks;
}
public List<Message> getMessages() {
return this.messages;
}
public void setMessages(List<Message> val) {
this.messages = val;
}
public ResponseBody addSuccess(String message) {
return addMessage(Message.Severity.SUCCESS, message);
}
public ResponseBody addWarning(String message) {
return addMessage(Message.Severity.WARNING, message);
}
public ResponseBody addFailure(Throwable t) {
for (; t != null; t = t.getCause()) {
addFailure(t.getLocalizedMessage());
}
return this;
}
public ResponseBody addFailure(String message) {
return addMessage(Message.Severity.FAILURE, message);
}
public ResponseBody addFailure(String field, String message) {
return addMessage(Message.Severity.FAILURE, field, message);
}
public ResponseBody addMessage(Message.Severity severity, String field, String message) {
return add(new Message(severity, field, message));
}
public ResponseBody addMessage(Message.Severity severity, String message) {
return add(new Message(severity, message));
}
public ResponseBody add(Message message) {
getMessages().add(message);
return this;
}
public List<ResourceLink> getResourceLinks() {
return this.links;
}
public void setResourceLinks(List<ResourceLink> val) {
this.links = val;
}
public ResponseBody addParentResourceLink(URI uri) {
if (uri == null) { return this; }
return addResourceLink("parent", uri);
}
public void addActionResourceLink(String action, URI uri) {
addResourceLink("action", action, uri);
}
public ResponseBody addResourceLink(String rel, URI uri) {
return add(new ResourceLink(rel, uri));
}
public ResponseBody addResourceLink(String rel, String title, URI uri) {
return add(new ResourceLink(rel, title, uri));
}
public ResponseBody add(ResourceLink link) {
getResourceLinks().add(link);
return this;
}
public JSONObject toJson() throws JSONException {
JSONObject object = new JSONObject();
populateJson(object);
return object;
}
protected void populateJson(JSONObject object) throws JSONException {
if (!getMessages().isEmpty()) {
JSONArray array = new JSONArray();
for (Message message : getMessages()) {
array.put(message.toJson());
}
object.put("messages", array);
}
if (includeResourceLinks) {
if (!getResourceLinks().isEmpty()) {
JSONArray array = new JSONArray();
for (ResourceLink link : getResourceLinks()) {
array.put(link.toJson());
}
object.put("resources", array);
}
}
}
}
| [
"fgonzales@appdynamics.com"
] | fgonzales@appdynamics.com |
8878c419259d496fddf68d69aabfa68909d1994e | 065c55fd9490778f07fe3825a2242637e0828934 | /src/test/java/co/com/diegozornosa/delivery/manager/utils/TextFileUtilsTest.java | 9d75b6d03d45e79f646ae3110c948e8c3643e4fd | [] | no_license | difezoma/delivery-manager | 40bd3ea23929a28a5047301cc1663ea1fb5b6e3c | c2be8fade52fed93a9e04a8c5acfa44394418ba9 | refs/heads/master | 2022-12-03T02:16:47.341954 | 2020-08-18T16:41:52 | 2020-08-18T16:41:52 | 288,290,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package co.com.diegozornosa.delivery.manager.utils;
import co.com.diegozornosa.delivery.manager.exceptions.DeliveryException;
import org.junit.Test;
public class TextFileUtilsTest {
@Test(expected = DeliveryException.class)
public void testReadTextFile() throws Exception {
TextFileUtils.readTextFile("notFound.txt", "regex");
}
@Test(expected = DeliveryException.class)
public void testWriteTextFile() throws Exception {
TextFileUtils.writeTextFile("Z://notFound.txt", "fileName", "text");
}
} | [
"difezoma@gmail.com"
] | difezoma@gmail.com |
d034f6b2bad13802548cb62eada7eb86608426f1 | 24e625c795b42ddc1ebe1e25890b2c2b1474e2ac | /Chapter5/src/main/java/com/course/testng/Parameter/ParameterTet.java | 4617f8403db5ab56f82bf75a31d83e1c50f322d7 | [] | no_license | dingwen-star/Autotest | f66f40784dc6ca18324e2c3bc911e68e7ccac36b | 430d4c03e3e62f16781dff32bba4e78a409e58ae | refs/heads/master | 2020-07-06T02:52:46.402031 | 2019-09-12T08:33:15 | 2019-09-12T08:33:15 | 202,865,199 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.course.testng.Parameter;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class ParameterTet {
@Test
@Parameters({"name","age"})
public void parameter(String name,int age){
System.out.println();
System.out.println("name = "+ name+"; age = "+age);
}
}
| [
"771268289@qq.com"
] | 771268289@qq.com |
8a0432a08052f65c19c80ba0b998294fbffba5c0 | bf109ffc9d6b5f2830970da3bcdda535253033d9 | /demo/src/main/java/com/coolyota/demo/fragment/Fragment_2.java | 559d12d070dfdca8067af9dfb852f2b13f725692 | [] | no_license | liuwenrong/Analysis | 8cb4f43b0026c2f338398c1c9d7b5cd1a05407dd | a23f275a98df8d1bdaa556680f54c21d8a6c36c1 | refs/heads/master | 2021-01-02T09:30:35.089017 | 2017-09-20T03:16:47 | 2017-09-20T03:17:21 | 99,231,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | package com.coolyota.demo.fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.cy.demo.R;
/**
* des:
*
* @author liuwenrong
* @version 1.0,2017/7/21
*/
public class Fragment_2 extends Fragment {
private final String TAG = "Fragment_2";
@Override
public void onAttach(Context context) {
super.onAttach(context);
log(" 1__onAttach");
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
log(" 2__onCreate");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
log(" 3_onCreateView");
return inflater.inflate(R.layout.fragment_layout_2,container,false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
log(" 4__onActivityCreated");
}
@Override
public void onStart() {
super.onStart();
log(" 5__onStart");
}
@Override
public void onResume() {
super.onResume();
log(" 6__onResume");
}
@Override
public void onPause() {
super.onPause();
log(" 7__onPause");
}
@Override
public void onStop() {
super.onStop();
log(" 8__onStop");
}
@Override
public void onDestroyView() {
super.onDestroyView();
log(" 9__onDestroyView");
}
@Override
public void onDestroy() {
super.onDestroy();
log(" 10__onDestroy");
}
@Override
public void onDetach() {
super.onDetach();
log(" 11__onDetach");
}
private void log (String methodName){
Log.e(TAG,"-------->"+methodName);
}
}
| [
"liuwenrong@coolpad.com"
] | liuwenrong@coolpad.com |
c922802beccfb2bcee93cb57d266fff9d63fe6b1 | b530af769bb496cdbadb4d1c14b81d6c53e2e36f | /typescriptGenerator/src/main/java/io/github/factoryfx/factory/typescript/generator/ts/TsTypeArray.java | 9b58105cd41abfee489a8750b2ffa9052883d47c | [
"Apache-2.0"
] | permissive | factoryfx/factoryfx | ab366d3144a27fd07bbf4098b9dc82e3bab1181f | 08bab85ecd5ab30b26fa57d852c7fac3fb5ce312 | refs/heads/master | 2023-07-09T05:20:02.320970 | 2023-07-04T15:11:52 | 2023-07-04T15:11:52 | 59,744,695 | 12 | 3 | Apache-2.0 | 2023-03-02T15:11:26 | 2016-05-26T11:22:59 | Java | UTF-8 | Java | false | false | 427 | java | package io.github.factoryfx.factory.typescript.generator.ts;
import java.util.Set;
public class TsTypeArray implements TsType {
private final TsType type;
public TsTypeArray(TsType type) {
this.type = type;
}
@Override
public void addImport(Set<TsFile> imports) {
type.addImport(imports);
}
@Override
public String construct() {
return type.construct()+"[]";
}
}
| [
"henning.brackmann@scoop-software.de"
] | henning.brackmann@scoop-software.de |
d3835de02d1d67695375865b3032378d4a391c87 | 31665642ed578801e684eb0e71526707416f6c7b | /src/d3/game/bulletshell.java | 7bb7d72dc11aea88f0c967974d08970e74c1539a | [] | no_license | calint/a | 79fb449e4e9baf4b19da6b1cbf925235254ba981 | 50c8d03e0115cd52737a0f95e86b9043e731f419 | refs/heads/master | 2023-02-02T14:30:44.406050 | 2023-01-29T04:57:04 | 2023-01-29T04:57:04 | 32,960,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package d3.game;
import d3.f3;
import d3.objm;
import d3.p3;
import d3.world;
public class bulletshell extends objm{
static final long serialVersionUID=1L;
protected bulletshell(world w,p3 origin,p3 agl,p3 dpos,p3 dagl,double spread,double rot,double lifeTime0,f3 ph,p3 s){
super(w,origin,agl,new p3(dpos.x+w.rand(-spread,spread),dpos.y+w.rand(-spread,spread),dpos.z+w.rand(-spread,spread)),new p3(dagl.x+w.rand(-rot,rot),dagl.y+w.rand(-rot,rot),dagl.z+w.rand(-rot,rot)),ph,s,type_scenery,1,lifeTime0,true);
}
}
| [
"calin.tenitchi@gmail.com"
] | calin.tenitchi@gmail.com |
13ea464fbb3585dbd69491163ceb3036c9c350c6 | 0f389a643d66d3d1b03cbd409e23fcc1f218dc8f | /src/main/java/com/libertymutual/goforcode/wimp/configuration/SwaggerConfiguration.java | c7a5b3680e947f4a12a5efe721273b287b15df29 | [] | no_license | romangalanti/wimp | d5a4f034c9b9018bae00c7a83b7a3455f360b716 | 6b681807b3dddb895b9e7ce26d744f7c83849506 | refs/heads/master | 2021-01-20T11:47:57.608302 | 2017-09-01T17:51:20 | 2017-09-01T17:51:20 | 101,690,236 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | package com.libertymutual.goforcode.wimp.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@Configuration
public class SwaggerConfiguration {
@Bean
public Docket apiConfig() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.libertymutual.goforcode.wimp"))
.build();
}
}
| [
"roman.galanti@libertymutual.com"
] | roman.galanti@libertymutual.com |
8f5ea2b23cc9b4fda7a6f0d81a44064e9ab92f7f | c9e4e4ee6807e4465887a9476b202bc1111868c2 | /src/com/example/Animal.java | 09c4b8ac30db23ef1d34e5658b1609f8eabeddd2 | [] | no_license | CaballerosTeam/lombok-builder-inheritance | 5a9a202092bd9c569f8683eb531c8ec72c3315a2 | d9249c3f7683750042f5d319233a6c0804524573 | refs/heads/master | 2020-03-19T02:10:57.816125 | 2018-05-31T16:06:40 | 2018-05-31T16:06:40 | 135,606,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package com.example;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
@NoArgsConstructor
@AllArgsConstructor
public abstract class Animal {
String name;
public void say() {
throw new NotImplementedException();
}
}
| [
"sergei_iurzin@epam.com"
] | sergei_iurzin@epam.com |
f9445e9f3d42a111386ff34d9d6a88209f818e20 | 87e2c4c2e414adc69045ba285aca73bbcf2ebefc | /src/main/java/com/zonesion/cloud/service/CourseLessonAttachmentService.java | 25e412ef730c72eb47f5d53f075b0ed324d11f4f | [] | no_license | BulkSecurityGeneratorProject1/zonesion-cloud | 21001bb7bbe5421f0de82a3a41366b77622eb538 | b24c454b78b92b1c31ba2028bee65b3dd8a028a4 | refs/heads/master | 2022-12-18T18:38:10.544342 | 2017-08-11T00:48:29 | 2017-08-11T00:48:29 | 296,664,180 | 0 | 0 | null | 2020-09-18T15:46:05 | 2020-09-18T15:46:04 | null | UTF-8 | Java | false | false | 2,406 | java | package com.zonesion.cloud.service;
import com.zonesion.cloud.domain.CourseLessonAttachment;
import com.zonesion.cloud.repository.CourseLessonAttachmentRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service Implementation for managing CourseLessonAttachment.
*/
@Service
@Transactional
public class CourseLessonAttachmentService {
private final Logger log = LoggerFactory.getLogger(CourseLessonAttachmentService.class);
private final CourseLessonAttachmentRepository courseLessonAttachmentRepository;
public CourseLessonAttachmentService(CourseLessonAttachmentRepository courseLessonAttachmentRepository) {
this.courseLessonAttachmentRepository = courseLessonAttachmentRepository;
}
/**
* Save a courseLessonAttachment.
*
* @param courseLessonAttachment the entity to save
* @return the persisted entity
*/
public CourseLessonAttachment save(CourseLessonAttachment courseLessonAttachment) {
log.debug("Request to save CourseLessonAttachment : {}", courseLessonAttachment);
return courseLessonAttachmentRepository.save(courseLessonAttachment);
}
/**
* Get all the courseLessonAttachments.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<CourseLessonAttachment> findAll(Pageable pageable) {
log.debug("Request to get all CourseLessonAttachments");
return courseLessonAttachmentRepository.findAll(pageable);
}
/**
* Get one courseLessonAttachment by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public CourseLessonAttachment findOne(Long id) {
log.debug("Request to get CourseLessonAttachment : {}", id);
return courseLessonAttachmentRepository.findOne(id);
}
/**
* Delete the courseLessonAttachment by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete CourseLessonAttachment : {}", id);
courseLessonAttachmentRepository.delete(id);
}
}
| [
"751249871@qq.com"
] | 751249871@qq.com |
402d97dff8b4deb3b9bfe5e6fbe332619aa32b99 | 1a811644a0ea8aea9ee61c62eecb4f23eba6fe25 | /Source/MediaInfoDLL/MediaInfoDLL.JNative.java | d4cd92c614dbb44e616c492e383e84cd8597a3b5 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"NCSA",
"LGPL-2.0-or-later",
"curl",
"Zlib",
"GPL-1.0-or-later",
"MPL-2.0",
"Apache-2.0"
] | permissive | MediaArea/MediaInfoLib | 6b9542892996428c4a966bfd8743adc334bb9077 | 731e3b57c1f9dfa84bfccf3396c0485766b65ea2 | refs/heads/master | 2023-09-03T21:03:52.307978 | 2023-08-16T07:49:44 | 2023-08-16T07:49:44 | 22,110,149 | 576 | 209 | BSD-2-Clause | 2023-09-14T13:44:33 | 2014-07-22T15:50:26 | C++ | UTF-8 | Java | false | false | 24,533 | java | /* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
import org.xvolks.jnative.JNative;
import org.xvolks.jnative.Type;
import org.xvolks.jnative.pointers.Pointer;
import org.xvolks.jnative.pointers.memory.MemoryBlockFactory;
import org.xvolks.jnative.exceptions.NativeException;
import org.xvolks.jnative.pointers.memory.NativeMemoryBlock;
/**
* Class to retrieve info about media files.
* MediaInfo library (http://MediaArea.net/MediaInfo) is used
* by the help of JNative (http://jnative.sourceforge.net)
* to obtain technical the info about the files.
*
* @author bro3@users.sourceforge.net
* @author Info@MediaArea.net
*/
class MediaInfo
{
/* static_fields */
final public static int Stream_General = 0;
final public static int Stream_Video = 1;
final public static int Stream_Audio = 2;
final public static int Stream_Text = 3;
final public static int Stream_Other = 4;
final public static int Stream_Image = 5;
final public static int Stream_Menu = 6;
final public static int Stream_Max = 7;
final public static int Info_Name = 0;
final public static int Info_Text = 1;
final public static int Info_Measure = 2;
final public static int Info_Options = 3;
final public static int Info_Name_Text = 4;
final public static int Info_Measure_Text = 5;
final public static int Info_Info = 6;
final public static int Info_HowTo = 7;
final public static int Info_Max = 8;
/* The MediaInfo handle */
private String handle = null;
private JNative new_jnative;
/* The library to be used */
private static String libraryName = "";
/**
* Constructor that initializes the new MediaInfo object.
* @throws NativeException JNative Exception.
*/
public MediaInfo() throws NativeException, Exception
{
setLibraryName();
New();
}
/**
* Constructor that initializes the new MediaInfo object.
* @param libraryName name of libarary to be used
* @throws NativeException JNative Exception
*/
public MediaInfo(String libraryName) throws NativeException, Exception
{
setLibraryName(libraryName);
New();
}
/**
* Method New initializes the MediaInfo handle
* @throws NativeException JNative Exception
*/
private void New() throws NativeException, Exception
{
/* Getting the handle */
new_jnative = new JNative(libraryName, "MediaInfoA_New");
new_jnative.setRetVal(Type.INT);
new_jnative.invoke();
handle = new_jnative.getRetVal();
Option("CharSet", "UTF-8");
}
/**
* Opens a media file.
* Overloads method {@link #Open(int, int, int, int)}
* @param begin buffer with the beginning of datas
* @param beginSize size of begin
* @return 1 for success and 0 for failure
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Open(int, int, int, int)
*/
public int Open(int begin, int beginSize) throws HandleNotInitializedException, NativeException, Exception
{
return Open(begin, beginSize, 0, 0);
}
/**
* Opens a media file.
* @param begin buffer with the beginning of datas
* @param beginSize size of begin
* @param end buffer with the end of datas
* @param endSize size of end
* @return 1 for success and 0 for failure
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public int Open(int begin, int beginSize, int end, int endSize) throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Open_Buffer");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, Type.INT, String.valueOf(begin));
jnative.setParameter(2, Type.INT, String.valueOf(beginSize));
jnative.setParameter(3, Type.INT, String.valueOf(end));
jnative.setParameter(4, Type.INT, String.valueOf(endSize));
jnative.invoke();
/* Retrieving data */
int ret = Integer.parseInt(jnative.getRetVal());
return ret;
}
/**
* Opens a media file.
* @param filename the filename
* @return 1 for success and 0 for failure
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public int Open(String filename) throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/* Setting the memory with the byte array returned in UTF-8 format */
Pointer fileNamePointer = createPointer(filename);
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Open");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, fileNamePointer);
jnative.invoke();
/* Retrieving data */
int ret = Integer.parseInt(jnative.getRetVal());
return ret;
}
/**
* Gets the file info, (if available) according to the previous options set by {@link #Option(String, String)}
* @return the file info
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public String Inform() throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Inform");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, Type.INT, "0"); //Necessary for backward compatibility
jnative.invoke();
/* Retrieving data */
String ret = retrieveString(jnative);
return ret;
}
/**
* Gets the specific info according to the parameters.
* Overloads method {@link #Get(int, int, String, int, int)}.
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @param streamNumber stream number to process
* @param parameter parameter string (list of strings is available with Option("Info_Parameters");
* @return information
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Get(int, int, String, int, int)
*/
public String Get(int streamKind, int streamNumber, String parameter) throws HandleNotInitializedException, NativeException, Exception
{
return Get(streamKind, streamNumber, parameter, MediaInfo.Info_Name, MediaInfo.Info_Text);
}
/**
* Gets the specific info according to the parameters.
* Overloads method {@link #Get(int, int, String, int, int)}
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @param streamNumber stream to process
* @param parameter parameter string (list of strings is available with Option("Info_Parameters");
* @param infoKind type of info. Can be any of the Info_XX values {@link <a href="#field_detail">Field details</a>}
* @return desired information
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Get(int, int, String, int, int)
*/
public String Get(int streamKind, int streamNumber, String parameter, int infoKind) throws HandleNotInitializedException, NativeException, Exception
{
return Get(streamKind, streamNumber, parameter, infoKind, MediaInfo.Info_Name);
}
/**
* Gets the specific file info according to the parameters.
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @param streamNumber stream to process
* @param parameter parameter string (list of strings is available with Option("Info_Parameters");
* @param infoKind type of info. Can be any of the Info_XX values {@link <a href="#field_detail">Field details</a>}
* @param searchKind type of search. Can be any of the Info_XX values {@link <a href="#field_detail">Field details</a>}
* @return desired information
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public String Get(int streamKind, int streamNumber, String parameter, int infoKind, int searchKind) throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/* Setting the memory with the byte array returned in UTF-8 format */
Pointer parameterPointer = createPointer(parameter);
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Get");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, Type.INT, String.valueOf(streamKind));
jnative.setParameter(2, Type.INT, String.valueOf(streamNumber));
jnative.setParameter(3, parameterPointer);
jnative.setParameter(4, Type.INT, String.valueOf(infoKind));
jnative.setParameter(5, Type.INT, String.valueOf(searchKind));
jnative.invoke();
/* Retrieving data */
String ret = retrieveString(jnative);
return ret;
}
/**
* Gets the specific file info according to the parameters.
* Overloads method {@link #Get(int, int, int, int)}.
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @param streamNumber stream to process
* @param parameter parameter position (count of parameters is available with Count_Get(streamKind, streamNumber) )
* @return desired information
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Get(int, int, int, int)
*/
public String Get(int streamKind, int streamNumber, int parameter) throws HandleNotInitializedException, NativeException, Exception
{
return Get(streamKind, streamNumber, parameter, MediaInfo.Info_Text);
}
/**
* Gets the specific file info according to the parameters.
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @param streamNumber stream to process
* @param parameter parameter position (count of parameters is available with Count_Get(streamKind, streamNumber) )
* @param infoKind type of info. Can be any of the Info_XX values {@link <a href="#field_detail">Field details</a>}
* @return desired information
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public String Get(int streamKind, int streamNumber, int parameter, int infoKind) throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_GetI");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, Type.INT, String.valueOf(streamKind));
jnative.setParameter(2, Type.INT, String.valueOf(streamNumber));
jnative.setParameter(3, Type.INT, String.valueOf(parameter));
jnative.setParameter(4, Type.INT, String.valueOf(infoKind));
jnative.invoke();
/* Retrieving data */
String ret = retrieveString(jnative);
return ret;
}
/**
* Sets the option
* Overloads method {@link #Option(String, String)}
* @param option name of option
* @return desired information or status of the option
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Option(String, String)
*/
public String Option(String option) throws HandleNotInitializedException, NativeException, Exception
{
return Option(option, "");
}
/**
* Sets the option with value
* @param option name of option
* @param value option value
* @return desired information or status of the option
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public String Option(String option, String value) throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/* Setting the memory with the byte array returned in UTF-8 format */
Pointer optionPointer = createPointer(option);
Pointer valuePointer = createPointer(value);
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Option");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, optionPointer);
jnative.setParameter(2, valuePointer);
jnative.invoke();
/* Retrieving data */
String ret = retrieveString(jnative);
return ret;
}
/**
* Sets the option (you do not need to create a MediaInfo handle)
* Overloads method {@link #Option_Static(String, String)}
* @param option name of option
* @return desired information or status of the option
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Option_Static(String, String)
*/
static public String Option_Static(String option) throws HandleNotInitializedException, NativeException, Exception
{
return Option_Static(option, "");
}
/**
* Sets the option (you do not need to create a MediaInfo handle)
* @param option name of option
* @param value option value
* @return desired information or status of the option
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
static public String Option_Static(String option, String value) throws HandleNotInitializedException, NativeException, Exception
{
if (libraryName.equals(""))
setLibraryName();
/* Setting the memory with the byte array returned in UTF-8 format */
Pointer optionPointer = createPointer(option);
Pointer valuePointer = createPointer(value);
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Option");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, "0");
jnative.setParameter(1, optionPointer);
jnative.setParameter(2, valuePointer);
jnative.invoke();
/* Retrieving data */
String ret = retrieveString(jnative);
return ret;
}
/**
* Gets the state of the libaray
* @return state of the library (between 0 and 10000)
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public int State_Get() throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_State_Get");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.invoke();
/* Retrieving data */
int ret = Integer.parseInt(jnative.getRetVal());
return ret;
}
/**
* Gets the count of streams
* Overloads method {@link #Count_Get(int, int)}.
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @return count of streams
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
* @see #Count_Get(int, int)
*/
public int Count_Get(int streamKind) throws HandleNotInitializedException, NativeException, Exception
{
return Count_Get(streamKind, -1);
}
/**
* Gets the count of streams
* @param streamKind type of stream. Can be any of the Stream_XX values {@link <a href="#field_detail">Field details</a>}
* @param streamNumber stream to process
* @return count of parameters for a specific stream
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public int Count_Get(int streamKind, int streamNumber) throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Count_Get");
jnative.setRetVal(Type.INT);
jnative.setParameter(0, Type.INT, handle);
jnative.setParameter(1, Type.INT, String.valueOf(streamKind));
jnative.setParameter(2, Type.INT, String.valueOf(streamNumber));
jnative.invoke();
/* Retrieving data */
int retval = Integer.parseInt(jnative.getRetVal());
return retval;
}
/**
* Deletes the handle
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
protected void finalize() throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Delete");
jnative.setParameter(0, Type.INT, handle);
jnative.invoke();
}
/**
* Closes the handle
* @throws HandleNotInitializedException if the handle is null
* @throws NativeException JNative Exception
*/
public void Close() throws HandleNotInitializedException, NativeException, Exception
{
if (handle == null)
throw new HandleNotInitializedException("Handle is not initialized.");
/*JNative call */
JNative jnative = new JNative(libraryName, "MediaInfoA_Close");
jnative.setParameter(0, Type.INT, handle);
jnative.invoke();
}
/**
* Create a memory pointer for giving it to an external library
* @param value The string to give
* @return A pointer to the memory
*/
static Pointer createPointer(String value) throws Exception
{
value+="\0";
byte[] array=value.getBytes("UTF-8");
Pointer valuePointer = new Pointer(MemoryBlockFactory.createMemoryBlock(array.length));
valuePointer.setMemory(array);
return valuePointer;
}
/**
* Create a string from a memory pointer
* @param jnative The jnative handler
* @return A string
*/
static String retrieveString(JNative jnative) throws Exception
{
int address = Integer.parseInt(jnative.getRetVal());
byte[] strEnd ={0};
int howFarToSearch =10000;
int length =0;
while (true)
{
int pos=JNative.searchNativePattern(address+length, strEnd, howFarToSearch);
if (pos == -1)
howFarToSearch+=10000; //The strEnd wasn't found
else
{
length+=pos;
break;
}
}
if (length > 0)
{
Pointer retPointer = new Pointer(new NativeMemoryBlock(address, length));
String fileInfo = new String(retPointer.getMemory(), "UTF-8");
retPointer.dispose();
return fileInfo;
}
else
return new String();
}
/**
* Sets the default name of the library to be used.
* If windows -> "MediaInfo.dll" else -> "libmediainfo.so.0"
*/
public static void setLibraryName()
{
if (libraryName.equals(""))
{
String os=System.getProperty("os.name");
if (os!=null && os.toLowerCase().startsWith("windows"))
setLibraryName("MediaInfo.dll");
else if (os!=null && os.toLowerCase().startsWith("mac"))
setLibraryName("libmediainfo.dynlib.0");
else
setLibraryName("libmediainfo.so.0");
}
}
/**
* Sets the name of the library to be used.
* @param libName name of the library
*/
public static void setLibraryName(String libName)
{
libraryName = libName;
}
}
/**
* Exception thrown if the handle isn't initialized.
*/
class HandleNotInitializedException extends Exception
{
private static final long serialVersionUID = 1L;
HandleNotInitializedException(String msg)
{
super(msg);
}
}
| [
"jerome@mediaarea.net"
] | jerome@mediaarea.net |
e7358e2f065077b66f6ef144bc35da507bb910dd | 9aaa0eacd1c2851cabf58f464f68c91f742b26fd | /src/main/java/com/vobi/devops/bank/domain/UserType.java | e49e639649f084f7aa4089becf8d6f940a59794e | [] | no_license | zathuracode/bank-backend | 4e348a0070bbf658b24a1a3a85dcf868055fb48b | 4667aa53da4dd2d50124d13d6e45866a3fbb28a0 | refs/heads/master | 2023-03-10T02:17:39.064492 | 2021-02-25T02:49:15 | 2021-02-25T02:49:15 | 335,054,945 | 0 | 31 | null | null | null | null | UTF-8 | Java | false | false | 2,129 | java | package com.vobi.devops.bank.domain;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* @author Zathura Code Generator Version 9.0 http://zathuracode.org/
* www.zathuracode.org
*
*/
@Entity
@Table(name = "user_type", schema = "public")
public class UserType implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "usty_id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer ustyId;
@NotNull
@NotEmpty
@Size(max = 255)
@Column(name = "enable", nullable = false)
private String enable;
@NotNull
@NotEmpty
@Size(max = 255)
@Column(name = "name", nullable = false)
private String name;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userType")
private List<Users> userses = new ArrayList<>();
public UserType(@NotNull Integer ustyId, @NotNull @NotEmpty @Size(max = 255) String enable,
@NotNull @NotEmpty @Size(max = 255) String name, List<Users> userses) {
super();
this.ustyId = ustyId;
this.enable = enable;
this.name = name;
this.userses = userses;
}
public UserType() {
super();
}
public Integer getUstyId() {
return ustyId;
}
public void setUstyId(Integer ustyId) {
this.ustyId = ustyId;
}
public String getEnable() {
return enable;
}
public void setEnable(String enable) {
this.enable = enable;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Users> getUserses() {
return userses;
}
public void setUserses(List<Users> userses) {
this.userses = userses;
}
} | [
"diegomezusb@gmail.com"
] | diegomezusb@gmail.com |
e337bb1528507fb5315f71680763f08788452f84 | 99c03face59ec13af5da080568d793e8aad8af81 | /hom_classifier/2om_classifier/scratch/AOIS34LOI25/Pawn.java | df52720e37637536b2de4d826b6f3d4f25aa9606 | [] | no_license | fouticus/HOMClassifier | 62e5628e4179e83e5df6ef350a907dbf69f85d4b | 13b9b432e98acd32ae962cbc45d2f28be9711a68 | refs/heads/master | 2021-01-23T11:33:48.114621 | 2020-05-13T18:46:44 | 2020-05-13T18:46:44 | 93,126,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,760 | java | // This is a mutant program.
// Author : ysma
import java.util.ArrayList;
public class Pawn extends ChessPiece
{
public Pawn( ChessBoard board, ChessPiece.Color color )
{
super( board, color );
}
public java.lang.String toString()
{
if (color == ChessPiece.Color.WHITE) {
return "♙";
} else {
return "♟";
}
}
public java.util.ArrayList<String> legalMoves()
{
java.util.ArrayList<String> returnList = new java.util.ArrayList<String>();
if (this.getColor().equals( ChessPiece.Color.WHITE )) {
int currentCol = this.getColumn();
int nextRow = this.getRow() + 1;
if (nextRow <= 7) {
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextRow, currentCol ) );
}
}
if (this.getRow() == 1) {
int nextNextRow = this.getRow() + 2;
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null && board.getPiece( onePossibleMove( nextNextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextNextRow--, currentCol ) );
}
}
int leftColumn = currentCol - 1;
int rightColumn = currentCol + 1;
if (leftColumn >= 0) {
if (board.getPiece( onePossibleMove( nextRow, leftColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, leftColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, leftColumn ) );
}
}
}
if (rightColumn <= 7) {
if (board.getPiece( onePossibleMove( nextRow, rightColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, ~rightColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, rightColumn ) );
}
}
}
} else {
int currentCol = this.getColumn();
int nextRow = this.getRow() - 1;
if (nextRow >= 0) {
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextRow, currentCol ) );
}
}
if (this.getRow() == 6) {
int nextNextRow = this.getRow() - 2;
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null && board.getPiece( onePossibleMove( nextNextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextNextRow, currentCol ) );
}
}
int leftColumn = currentCol - 1;
int rightColumn = currentCol + 1;
if (leftColumn >= 0) {
if (board.getPiece( onePossibleMove( nextRow, leftColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, leftColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, leftColumn ) );
}
}
}
if (rightColumn <= 7) {
if (board.getPiece( onePossibleMove( nextRow, rightColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, rightColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, rightColumn ) );
}
}
}
}
return returnList;
}
} | [
"fout.alex@gmail.com"
] | fout.alex@gmail.com |
a78c9f90d0346c83fc6bfae4eb7032584672ac51 | a39f6d63e0203c18aa2da226472e1e807cf9e98a | /spring-boot-basic/src/main/java/com/gang/mars/basic/callabled/CallableThread.java | 18af2231e5dcb757c01440d8503608159b49f89f | [] | no_license | g-smll/gang-mars-java | 7b421dae913afff311f66a3a28e9818759576e6f | 4928466edc8e63c38053c7e8cca8a91e721b7453 | refs/heads/master | 2023-06-03T16:20:04.484729 | 2021-06-24T09:31:12 | 2021-06-24T09:31:12 | 370,247,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.gang.mars.basic.callabled;
import java.util.concurrent.Callable;
/**
* @author gang.chen
* @description Callable 举例线程返回值
* @time 2021/1/26 9:18
*/
public class CallableThread implements Callable<Integer> {
@Override
public Integer call() throws Exception {
System.out.println(Thread.currentThread().getName()+" ->"+"CallableThread -> method -> call()");
return 2048;
}
}
| [
"chengangyunnan@qq.com"
] | chengangyunnan@qq.com |
e62bb0f46c5842a77f0c27580f6c3f08e31ba1ba | cff5a5894d7ca7b48a9ff7f7e8c29ab8a80430b8 | /src/main/java/pl/waw/mizinski/umowy/model/TypUmowy.java | 80ae5e8b6f340fb39cce12f45b9a33fb6ca6adc0 | [] | no_license | mizin1/umowy | 2d0e5f3dbd194a480781359ec24faa109afc0d79 | 59dd9cf40385533d428958c8ed055bb0e9ecd8fa | refs/heads/master | 2020-01-23T07:25:23.272085 | 2014-02-11T16:36:35 | 2014-02-11T16:36:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package pl.waw.mizinski.umowy.model;
public class TypUmowy {
private String nazwa;
private String tytul;
private Integer kosztUzyskaniaPrzychodu;
public String getNazwa() {
return nazwa;
}
public void setNazwa(String nazwa) {
this.nazwa = nazwa;
}
public String getTytul() {
return tytul;
}
public void setTytul(String tytul) {
this.tytul = tytul;
}
public Integer getKosztUzyskaniaPrzychodu() {
return kosztUzyskaniaPrzychodu;
}
public void setKosztUzyskaniaPrzychodu(Integer kosztUzyskaniaPrzychodu) {
this.kosztUzyskaniaPrzychodu = kosztUzyskaniaPrzychodu;
}
@Override
public String toString() {
return nazwa;
}
}
| [
"konrad_1916@wp.pl"
] | konrad_1916@wp.pl |
ed438bf31ccf115a24889b482a6ffc4847644c9a | 5f0affefe50d04a9874261676bb240061acd2858 | /app/src/main/java/com/everlong/mentate/home/ui/HomeActivity.java | 4cbbe83ebb4a3039672b99af41b28a73db7e682e | [
"Apache-2.0"
] | permissive | akshitc/Mentate | f5840a1da497b6e60575eb92cd2a1b46a686f891 | d938948190ba2bd894c9db76ad4551f158ec88e9 | refs/heads/master | 2021-01-20T06:38:29.371321 | 2017-05-01T08:08:42 | 2017-05-01T08:08:42 | 89,904,735 | 0 | 0 | null | 2017-05-01T08:08:42 | 2017-05-01T07:07:38 | null | UTF-8 | Java | false | false | 1,911 | java | package com.everlong.mentate.home.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.everlong.mentate.MainApplication;
import com.everlong.mentate.R;
import com.everlong.mentate.game.ui.GameActivity;
import com.everlong.mentate.home.contract.HomeContract;
import com.everlong.mentate.home.contract.HomePresenter;
import com.everlong.mentate.home.di.DaggerHomeComponent;
import com.everlong.mentate.home.di.HomeModule;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class HomeActivity extends AppCompatActivity implements HomeContract.View {
@BindView(R.id.best_score)
TextView bestScoreText;
@Inject
HomePresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
injectComponents();
presenter.setViews();
}
private void injectComponents() {
DaggerHomeComponent.builder().applicationComponent(((MainApplication) getApplication())
.getApplicationComponent()).homeModule(new HomeModule(this)).build().inject(this);
}
@OnClick(R.id.start_button)
public void onStartButtonClicked() {
presenter.onStartClicked();
}
@Override
public void setBestScore(int bestScore) {
bestScoreText.setVisibility(View.VISIBLE);
bestScoreText.setText(getString(R.string.best_score, bestScore));
}
@Override
public void hideBestScore() {
bestScoreText.setVisibility(View.GONE);
}
@Override
public void launchGame() {
Intent intent = new Intent(this, GameActivity.class);
startActivity(intent);
}
}
| [
"akshit.chhabra@housing.com"
] | akshit.chhabra@housing.com |
edfb9fb9302845a32544eb494a24966354b8719a | 6512779e45e6b09960fd4623ccee0fa126d75536 | /http/src/main/java/com/lishang/http/callback/ResponseCallBack.java | 6d87e5d6342af6605e2fe387f55000431b1e1190 | [] | no_license | LiShang007/LSHttp | fdd1aa2579a4216b01e3b952c6c12cf2943a7759 | db072e9f52e76782e1e0b8f7352dabd229e569e1 | refs/heads/master | 2020-06-27T03:59:27.853210 | 2019-10-11T08:49:48 | 2019-10-11T08:49:48 | 199,838,784 | 9 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package com.lishang.http.callback;
import com.lishang.http.exception.LSHttpException;
/**
* 回调基类
*/
public interface ResponseCallBack {
void onFail(LSHttpException e);
}
| [
"zhaow@hzanchu.com"
] | zhaow@hzanchu.com |
e42a125f8639c04beff2d476dcb885648e6e8e0a | 4f4fdf914fe3fbdc74aee3546cce1f82e60a8547 | /SDICLab4_515015910005_丁丁/Mapper.java | 909356cdd6e20b9938ba6395e9f4c5145b9e9273 | [] | no_license | derFischer/distributed-system | 618ed737e1c0c3cdd612679318f0eb5ed44f5321 | f2b0b66a51a4ead715a548da64f68707d389f8bf | refs/heads/master | 2020-04-29T01:56:46.772301 | 2019-06-08T01:59:21 | 2019-06-08T01:59:21 | 175,747,097 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,985 | java | package sjtu.sdic.mapreduce.core;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import sjtu.sdic.mapreduce.common.KeyValue;
import sjtu.sdic.mapreduce.common.Utils;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Cachhe on 2019/4/19.
*/
public class Mapper {
/**
* doMap manages one map task: it should read one of the input files
* {@code inFile}, call the user-defined map function {@code mapF} for
* that file's contents, and partition mapF's output into {@code nReduce}
* intermediate files.
*
* There is one intermediate file per reduce task. The file name
* includes both the map task number and the reduce task number. Use
* the filename generated by {@link Utils#reduceName(String, int, int)}
* as the intermediate file for reduce task r. RPCCall
* {@link Mapper#hashCode(String)} on each key, mod nReduce,
* to pick r for a key/value pair.
*
* {@code mapF} is the map function provided by the application. The first
* argument should be the input file name, though the map function
* typically ignores it. The second argument should be the entire
* input file contents. {@code mapF} returns a list containing the
* key/value pairs for reduce; see {@link KeyValue} for the definition of
* KeyValue.
*
* Look at Java's File and Files API for functions to read
* and write files.
*
* Coming up with a scheme for how to format the key/value pairs on
* disk can be tricky, especially when taking into account that both
* keys and values could contain newlines, quotes, and any other
* character you can think of.
*
* One format often used for serializing data to a byte stream that the
* other end can correctly reconstruct is JSON. You are not required to
* use JSON, but as the output of the reduce tasks *must* be JSON,
* familiarizing yourself with it here may prove useful. There're many
* JSON-lib for Java, and we recommend and supply with FastJSON powered by
* Alibaba. You can refer to official docs or other resources to figure
* how to use it.
*
* The corresponding decoding functions can be found in {@link Reducer}.
*
* Remember to close the file after you have written all the values!
*
* Your code here (Part I).
*
* @param jobName the name of the MapReduce job
* @param mapTask which map task this is
* @param inFile file name (if in same dir, it's also the file path)
* @param nReduce the number of reduce task that will be run ("R" in the paper)
* @param mapF the user-defined map function
*/
public static void doMap(String jobName, int mapTask, String inFile, int nReduce, MapFunc mapF) {
File file = new File(inFile);
Long filelength = file.length();
byte[] content = new byte[filelength.intValue()];
String con = "";
try
{
FileInputStream f = new FileInputStream(file);
f.read(content);
f.close();
con = new String(content, "UTF-8");
}
catch(FileNotFoundException e)
{
System.out.println("can't find the file\n");
}
catch(IOException e)
{
System.out.println("io exception\n");
}
catch(Exception e)
{
System.out.println("unsupported encoding\n");
}
List<KeyValue> pairs = mapF.map(inFile, con);
for(int i = 0; i < nReduce; ++i)
{
String subfile = Utils.reduceName(jobName, mapTask, i);
File subf = new File(subfile);
if(!file.exists())
{
try
{
subf.createNewFile();
}
catch(IOException e)
{
System.out.println("io exception\n");
}
}
List<KeyValue> pairsi = new ArrayList<KeyValue>();
for(KeyValue pair : pairs)
{
if(hashCode(pair.key) % nReduce == i)
{
pairsi.add(pair);
}
}
try
{
String stringcontent = JSON.toJSONString(pairsi);
FileWriter filewriter = new FileWriter(subfile);
filewriter.write(stringcontent);
filewriter.close();
}
catch(IOException e)
{
System.out.println("io exception\n");
}
}
}
/**
* a simple method limiting hash code to be positive
*
* @param src string
* @return a positive hash code
*/
private static int hashCode(String src) {
return src.hashCode() & Integer.MAX_VALUE;
}
}
| [
"dingd2015@sjtu.edu.cn"
] | dingd2015@sjtu.edu.cn |
85241744419ea3da933f05350eac5880d794ef72 | 1df03818298d6d555e1a9413c256593a8f838ce6 | /Java8/src/collectMethods/groupBy5/Example6.java | 9ee74d2e4a7d3b219705c4b980291e69051d1048 | [] | no_license | anandu06/LearnByBhanuPratap | 1654fb408680d2b0c1ae73a08662c98252f9642a | 9c20875ec3e0ef6ad18940ce7901c160e45e538c | refs/heads/master | 2023-03-17T13:30:25.802571 | 2020-06-05T12:37:29 | 2020-06-05T12:37:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,685 | java | package collectMethods.groupBy5;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Example6 {
/**
* Important Note: Please watch video in sequence otherwise you will not understand
* because each video required previous concept
*/
public static void main(String[] args) {
List<String> list = Arrays.asList("AA", "AA", "BB", "AA", "CC", "BB", "DD");
Map<String, Long> result = list.stream()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
Map<String, Long> finalMap = new LinkedHashMap<>();
Stream<Entry<String, Long>> reversed = result.entrySet().stream()
.sorted(Map.Entry.comparingByValue());
reversed.forEachOrdered(e -> finalMap.put(e.getKey(), e.getValue()));
System.out.println(finalMap);
System.out.println("---------------");
Map<String, Long> finalMap1 = new LinkedHashMap<>();
Stream<Entry<String, Long>> reversed1 = result.entrySet().stream()
.sorted(Map.Entry.<String, Long>comparingByValue().reversed());
reversed1.parallel().forEachOrdered(e -> finalMap1.put(e.getKey(), e.getValue()));
System.out.println(finalMap1);
System.out.println("---------------");
Map<String, Long> finalMap2 = new LinkedHashMap<>();
Stream<Entry<String, Long>> reversed2 = result.entrySet().stream()
.sorted(Map.Entry.<String, Long>comparingByValue().reversed());
reversed2.parallel().forEach(e -> finalMap2.put(e.getKey(), e.getValue()));
System.out.println(finalMap2);
}
}
| [
"bhanupratap_singh@intuit.com"
] | bhanupratap_singh@intuit.com |
e3172c1e0867d23da1abddfa334c7a0d1c6405d9 | 86655a98718476712076d7fcaf462dae4eecf56c | /CodeEval/src/cashregister/Main.java | ad3b0bcb32a32e7af57e25bacdbdf0e62300177f | [] | no_license | Kritarie/CodeEval | 5d5c3d41cee415a4498733454c7159106835f426 | 84d48df5956b508aaa6bf88677de8a1fe16cdd60 | refs/heads/master | 2021-01-10T00:53:30.222346 | 2014-11-05T15:21:15 | 2014-11-05T15:21:15 | 23,437,052 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,236 | java | package cashregister;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.text.DecimalFormat;
public class Main {
//https://www.codeeval.com/open_challenges/54/
public static void main(String[] args) throws IOException {
File file = new File(args[0]);
BufferedReader in = new BufferedReader(new FileReader(file));
String line;
String[] splitLine;
double pp, ch;
while ((line = in.readLine()) != null) {
splitLine = line.split(";");
pp = Double.parseDouble(splitLine[0]);
ch = Double.parseDouble(splitLine[1]);
System.out.println(getChange(pp, ch));
}
in.close();
}
private static String getChange(double pp, double ch) {
if (pp > ch) {
return "ERROR";
}
if (pp == ch) {
return "ZERO";
}
StringBuilder sb = new StringBuilder();
DecimalFormat df = new DecimalFormat("#.##");
double change = Double.valueOf(df.format(ch - pp));
while (change != 0) {
while (change >= 100) {
change -= 100;
sb.append("ONE HUNDRED,");
}
while (change >= 50) {
change -= 50;
sb.append("FIFTY,");
}
while (change >= 20) {
change -= 20;
sb.append("TWENTY,");
}
while (change >= 10) {
change -= 10;
sb.append("TEN,");
}
while (change >= 5) {
change -= 5;
sb.append("FIVE,");
}
while (change >= 2) {
change -= 2;
sb.append("TWO,");
}
while (change >= 1) {
change -= 1;
sb.append("ONE,");
}
while (change >= 0.5) {
change = Double.valueOf(df.format(change - 0.5));
sb.append("HALF DOLLAR,");
}
while (change >= 0.25) {
change = Double.valueOf(df.format(change - 0.25));
sb.append("QUARTER,");
}
while (change >= 0.1) {
change = Double.valueOf(df.format(change - 0.1));
sb.append("DIME,");
}
while (change >= 0.05) {
change = Double.valueOf(df.format(change - 0.05));
sb.append("NICKEL,");
}
while (change >= 0.01) {
change = Double.valueOf(df.format(change - 0.01));
sb.append("PENNY,");
}
}
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
}
| [
"seanamos@seanamos.net"
] | seanamos@seanamos.net |
e3aab42deb5d9dbbbea0a0feb78f864e5b7346e7 | 6252c165657baa6aa605337ebc38dd44b3f694e2 | /org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-900-Files/boiler-To-Generate-900-Files/syncregions-900Files/TemperatureController856.java | 14c7147b4371ddeda3d5b14d48f06ae422f501d0 | [] | no_license | soha500/EglSync | 00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638 | 55101bc781349bb14fefc178bf3486e2b778aed6 | refs/heads/master | 2021-06-23T02:55:13.464889 | 2020-12-11T19:10:01 | 2020-12-11T19:10:01 | 139,832,721 | 0 | 1 | null | 2019-05-31T11:34:02 | 2018-07-05T10:20:00 | Java | UTF-8 | Java | false | false | 364 | java | package syncregions;
public class TemperatureController856 {
public execute(int temperature856, int targetTemperature856) {
//sync _bfpnFUbFEeqXnfGWlV2856, behaviour
1-if(temperatureDifference > 0 && boilerStatus == true) { return 1; } else if (temperatureDifference < 0 && boilerStatus == false) { return 2; } else return 0;
//endSync
}
}
| [
"sultanalmutairi@172.20.10.2"
] | sultanalmutairi@172.20.10.2 |
0357f0bf68e575d4d24cfd2521bc5d98eef76929 | c3c0bfab1e83c5d426c50fccc527590d84ac03f2 | /Chapter/src/main/java/com/xxgc/page/BasePage.java | 7afb8214468695596bfc7f5958f02df4d3b9b37d | [] | no_license | lidonghui123/ImoocTest | 448eeb091edbb116c983790b5bc2185fb6d87b01 | e4913fece53e4ced102175c6ec15691352c54d5d | refs/heads/master | 2023-05-11T05:33:40.583975 | 2019-12-13T13:53:25 | 2019-12-13T13:53:25 | 220,127,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,953 | java | package com.xxgc.page;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
public class BasePage {
//实例化log4j
static Logger logger=Logger.getLogger(BasePage.class);
//声明driver
public WebDriver driver1;
//构造方法,传入driver
public BasePage(WebDriver driver){
//因为driver1是没有数值的,需要给它进行赋值
this.driver1=driver;
}
/**
* Element方法封装
*/
public WebElement GetElement(String key){
WebElement element = driver1.findElement(this.GetByLocal(key));
return element;
}
/**
* 元素定位类型封装
*/
public By GetByLocal(String key) {
ProUtil pro = new ProUtil("element.properties");
//定位信息输出debug(key)值
logger.debug("你的定位信息的key为:"+key);
//key比对,
String Locator = pro.GetPro(key);
// value值进行拆分
String LocatorBy = Locator.split("<")[0];
String LocatorValue = Locator.split("<")[1];
logger.debug("你的定位方式为"+LocatorBy);
logger.debug("你的定位值为"+LocatorValue);
// 判断对应BY类型
if (LocatorBy.equals("id")) {
return By.id(LocatorValue);
} else if (LocatorBy.equals("name")) {
return By.name(LocatorValue);
} else if (LocatorBy.equals("className")) {
return By.className(LocatorValue);
} else {
return By.xpath(LocatorValue);
}
}
/**
* 鼠标悬停
* @param
*/
public void MoveToElement(WebElement ToElement){
//new action对象
Actions actions = new Actions(driver1);
//鼠标悬停在图片Elemet上面
actions.moveToElement(ToElement).perform();
}
} | [
"1323134804@qq.com"
] | 1323134804@qq.com |
e67e9876cb107fb57fce7a3373bb95f2a273fd5e | 1143d8cd087f13832536ffc49e9a7ef1bb12f077 | /easyble/src/main/java/com/happysoftware/easyble/BleDeviceState.java | 3f312f95de56e479b3754d2dca56927e71330928 | [
"Apache-2.0"
] | permissive | nziyouren/EasyBle | 5f6719ec6831f9cbdab6a2e3d4c399cb7c3d471c | 7142c4ae5c1a3afaa4125b925e6ab7e0b5b6b4ad | refs/heads/master | 2021-01-12T15:06:45.927964 | 2020-03-24T04:21:17 | 2020-03-24T04:21:17 | 71,703,086 | 103 | 18 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.happysoftware.easyble;
/**
* Created by zhang on 16/7/17.
*/
public enum BleDeviceState {
BLE_DEVICE_STATE_CONNECTED(1),
BLE_DEVICE_STATE_CONNECTING(2),
BLE_DEVICE_STATE_DISCONNECTED(0),
BLE_DEVICE_STATE_DISCONNECTING(3);
private int mState;
private BleDeviceState(int state) {
mState = state;
}
}
| [
"nziyouren@gmail.com"
] | nziyouren@gmail.com |
cf520f26b062a1b124166e903a175f060b7d312a | 49199a8cd151805d3ceec01247105767a345055b | /seminar9/src/ro/ase/cts/strategy/clase/Card.java | 11fc094959962ca0ff7fd1f0454178329dc3e36d | [] | no_license | aivanoaeianca18/cts | bdff971434454e5f3e8a6dd64ca05e9ae1111f3d | 0d051cb3e6c5c8706fa692a68d181f7565f55d79 | refs/heads/master | 2023-05-09T20:21:33.349087 | 2021-06-03T10:07:59 | 2021-06-03T10:07:59 | 342,203,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package ro.ase.cts.strategy.clase;
public class Card implements ModalitatePlata{
private float sold;
public Card(float sold) {
super();
this.sold = sold;
}
@Override
public void achita(float suma) {
if(suma<=sold) {
System.out.println("S-a realziat plata cu cardul in valoare de "+suma+" lei");
sold=sold-suma;
}else {
System.out.println("Fonduri insuficiente");
}
}
}
| [
"Anca@LAPTOP-U7UG9C6U"
] | Anca@LAPTOP-U7UG9C6U |
f2f8ff424e53b17c477c512be0ec6d432072c430 | f2048a75814e807528a8c86076155d7b45dd343f | /goodprefslib/src/androidTest/java/nouri/in/goodprefslib/ExampleInstrumentedTest.java | 466254e1555d57e6c2dc4f4f0665927bbf938303 | [] | no_license | MrNouri/GoodPrefs | e138768446a6757561806f67bc951d19d13db030 | c24828fb8ce332b9389ecb3b7c41601c9678c61e | refs/heads/master | 2020-04-03T19:41:45.878370 | 2019-03-30T14:37:46 | 2019-03-30T14:37:46 | 155,532,117 | 18 | 3 | null | 2019-03-30T14:37:47 | 2018-10-31T09:35:40 | Java | UTF-8 | Java | false | false | 731 | java | package nouri.in.goodprefslib;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("nouri.in.goodprefslib.test", appContext.getPackageName());
}
}
| [
"nouri.softeng@gmail.com"
] | nouri.softeng@gmail.com |
71d2938b489e22cdbc18fedd9bd55f9ced3b6c0d | 30e907d65a9c8e2124d7d592cac2e2f9a27f5151 | /src/Controller_QuanLy/Publications_TimTin.java | 8d85e3a54cfeb97fb61eb4515a6c028c122e410d | [
"MIT"
] | permissive | pavetw17/Eventweb | bc0f2271894d2bd1c0c13a1b6a03b490d3128575 | c1c668c94d05dcc5562583e382a68ea5e2fadf67 | refs/heads/master | 2020-03-11T11:56:05.489910 | 2018-04-25T09:28:13 | 2018-04-25T09:28:13 | 129,982,870 | 0 | 0 | null | 2018-04-25T09:28:14 | 2018-04-18T00:58:23 | Java | UTF-8 | Java | false | false | 5,991 | java | package Controller_QuanLy;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import BusinessLogic.FunctionAll;
import BusinessLogic.tbl_tt_publicationsBean;
import Entity.tbl_taikhoan_quantri;
import Entity.tbl_tt_publications;
@WebServlet("/Publications_TimTin")
public class Publications_TimTin extends HttpServlet {
private static final long serialVersionUID = 1L;
public Publications_TimTin() {
super();
}
@Resource(name = "EventDB")
private DataSource ds;
protected void xuly(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
tbl_taikhoan_quantri tbl_qt = (tbl_taikhoan_quantri) request
.getSession().getAttribute("tbl_qt");
if (tbl_qt != null) {
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
FunctionAll func = new FunctionAll();
String ten_bai = null;
Integer tu_ngay = null ;
Integer den_ngay = null;
if(request.getParameter("txt_tenbai")!=null && !request.getParameter("txt_tenbai").isEmpty()){
ten_bai = request.getParameter("txt_tenbai");
}
if(request.getParameter("txt_ngaybd")!=null && !request.getParameter("txt_ngaybd").isEmpty()){
tu_ngay = func.DoiNgayThangRaSoNguyen(request.getParameter("txt_ngaybd"));
}
if(request.getParameter("txt_ngayketthuc")!=null &&!request.getParameter("txt_ngayketthuc").isEmpty()){
den_ngay = func.DoiNgayThangRaSoNguyen(request.getParameter("txt_ngayketthuc"));
}
tbl_tt_publicationsBean bean = new tbl_tt_publicationsBean(ds);
PrintWriter out = response.getWriter();
if (request.getParameter("action").equalsIgnoreCase("getlength")) {
int tongso_dong = bean.Publications_layTongSoDong_coDieuKien(ten_bai, String.valueOf(tu_ngay), String.valueOf(den_ngay));
out.print(tongso_dong); //in ra cho Jquery
}else if (request.getParameter("action").equalsIgnoreCase("list")) {
Integer offset = Integer
.valueOf(request.getParameter("offset"));
Integer limit = Integer.valueOf(request.getParameter("limit"));
ArrayList<tbl_tt_publications> list = bean.timkiem(ten_bai,String.valueOf(tu_ngay),String.valueOf(den_ngay),String.valueOf(limit),String.valueOf(offset));
StringBuffer str = new StringBuffer();
str.append(" <script> "
+ "$('.deleteButton').click(function(e) {"
+ "if (confirm('Are you sure?')) { "
+ "var goTo = $(this).attr('href'); "
+ " $.post('/eventweb/Publications_XoaTin', { "
+ " id_news: goTo,"
+ " }, function(j){ "
+ " if(j=='success'){ "
+ " jAlert('Delete succeeded','Success');"
+ " timkiemtheodieukien(); "
+ " }else{ "
+ " jAlert('Failure. Error:' + j,'Error'); "
+ " }"
+ " }); "
+ " } "
+ " return false; }); "
+ "</script>");
str.append( "<table cellspacing='0' cellpadding='3' rules='cols' border='1' id='tbl_timkiem' "
+ "style='color: Black; background-color: White; border-color: #999999; border-width: 1px; border-style: Solid; width: 100%; "
+ "border-collapse: collapse; ' >");
str.append( " <tbody>");
str.append( "");
str.append( " <tr style='color: White; background: url(js/menu/menu_source/images/menu-bg.png) repeat; font-weight: bold; height: 25px'>");
str.append( " <th scope='col' style='width:18%'>Title</th> ");
str.append( " <th scope='col' style='width:70%'>Summary</th>");
str.append( " <th scope='col' style='width:9%' >Post Date</th>");
str.append( " <th scope='col' style='width:1%'></th>");
str.append( " <th scope='col' style='width:1%'></th>");
str.append( " <th scope='col' style='width:1%'></th>");
str.append( " </tr> ");
//System.out.print("list in ra" + list.size());
int cnt = 1;
for (int i = 0; i < list.size(); i++){
if (cnt % 2 == 0) {
str.append(" <tr style='background-color:#ccc'> ");
}
cnt ++;
str.append(" <td>" + list.get(i).getName_publication() + "</td> ");
str.append(" <td>" + list.get(i).getSummary() + " </td> ");
str.append(" <td style='font-size: small;'>" + func.DoiSoNguyenRaNgayThang(list.get(i).getPost_start_date()) + "</td>");
str.append(" <td style='width: 30px'> ");
str.append(" <a href='RedirectPage?action=xemnoidungPublications&id_tin_tuc=" + list.get(i).getId_publication() + "' target='_blank'");
str.append(" style='color: Red;'> View </a></td>");
str.append(" <td style='width: 30px'> ");
str.append(" <a href='Publications_SuaTin?id_tin_tuc=" + list.get(i).getId_publication() + "'" );
str.append(" style='color: Red;'> Edit </a></td>");
str.append(" <td style='width: 30px'> ");
str.append(" <a href='" + list.get(i).getId_publication() + "' class='deleteButton'");
str.append(" style='color: Red;'> Delete </a></td>");
str.append(" </tr> ");
}
str.append("<tr> <td colspan='9' style=' border-top-style: double;'>Tổng cộng: " + list.size() + " </td> </tr></tbody></table> ");
out.print(str.toString());
}
} else { //khong phai quanly
response.sendRedirect("admin/index.jsp");
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
xuly(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
xuly(request, response);
}
}
| [
"yhw0130@autuni.ac.nz"
] | yhw0130@autuni.ac.nz |
e0a7ea8ac0aeeb3fcfb26c29b01c17649f4a949e | 4b4495817b5c57027cffca298ebd7d7d39910198 | /MobileSafe/app/src/main/java/com/example/yhj/mobilesafe/activity/AddressActivity.java | 620b90e56afcc7eeaf73448c371b3e68c1f5b35c | [] | no_license | yxf120/AndroidApplication | c1382327755192d3bbee74677db3b77cd63e9981 | d209349723769bc327c6cbabb0846969dbd6abb0 | refs/heads/master | 2020-06-06T05:15:50.996716 | 2019-06-02T03:42:09 | 2019-06-02T03:42:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,546 | java | package com.example.yhj.mobilesafe.activity;
import android.animation.Animator;
import android.os.Vibrator;
import android.support.annotation.RequiresPermission;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.EditText;
import android.widget.TextView;
import com.example.yhj.mobilesafe.R;
import com.example.yhj.mobilesafe.db.AddressDao;
/**
* 归属地查询页面
* */
public class AddressActivity extends AppCompatActivity {
private EditText etNumber;
private TextView tvResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_address);
etNumber= (EditText) findViewById(R.id.et_number);
tvResult= (TextView) findViewById(R.id.tv_result);
etNumber.addTextChangedListener(new TextWatcher() {//文本框监听器
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String address= AddressDao.getAddress(s.toString());
tvResult.setText(address);
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
/*
* 归属地查询
* */
public void query(View v){
String number=etNumber.getText().toString().trim();
if(!TextUtils.isEmpty(number)){
String address= AddressDao.getAddress(number);
tvResult.setText(address);
}else {
Animation shake= AnimationUtils.loadAnimation(this,R.anim.shake);
etNumber.startAnimation(shake);
vibrate();
}
}
/*
* 手机震动(有权限)
* */
private void vibrate() {
Vibrator vibrator= (Vibrator) getSystemService(VIBRATOR_SERVICE);
//vibrator.vibrate(2000);震动2秒
//先等待一秒,再震动2秒,再等待1秒,再震动2秒;参数2表示只执行一次,不循环;等于0表示从头循环;参数2表示从第几个位置开始循环
vibrator.vibrate(new long[]{1000,2000,1000,3000},-1);
//vibrator.cancel();关闭震动
}
}
| [
"1364115532@qq.com"
] | 1364115532@qq.com |
ea71dbc5f1e30b4de29dd6ae2b683be89b22380c | c5cb1d4de80f81f784065f9e6ccb24a8a7150983 | /substance/src/main/java/org/pushingpixels/substance/internal/utils/SubstanceSplitPaneDivider.java | 887d502422d40187fbc407508a15d16c66406e41 | [
"BSD-3-Clause"
] | permissive | mtbadi39/swing-effects | 9cd609968f7c2045caf7e6ab07b9f14b3004ebd3 | a29f7a31c73e13027a7228324b5612768452c155 | refs/heads/master | 2021-09-16T12:23:54.090032 | 2018-06-20T13:52:27 | 2018-06-20T13:52:27 | 115,825,692 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,457 | java | /*
* Copyright (c) 2005-2018 Substance Kirill Grouchnikov. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* o Neither the name of Substance Kirill Grouchnikov nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.pushingpixels.substance.internal.utils;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Map;
import javax.swing.ButtonModel;
import javax.swing.DefaultButtonModel;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JSplitPane;
import javax.swing.SwingConstants;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
import javax.swing.plaf.basic.BasicSplitPaneUI;
import org.pushingpixels.substance.api.ComponentState;
import org.pushingpixels.substance.api.SubstanceCortex;
import org.pushingpixels.substance.api.SubstanceSlices.ColorSchemeAssociationKind;
import org.pushingpixels.substance.api.colorscheme.SubstanceColorScheme;
import org.pushingpixels.substance.internal.animation.StateTransitionTracker;
import org.pushingpixels.substance.internal.animation.StateTransitionTracker.ModelStateInfo;
import org.pushingpixels.substance.internal.animation.TransitionAwareUI;
import org.pushingpixels.substance.internal.painter.BackgroundPaintingUtils;
import org.pushingpixels.substance.internal.ui.SubstanceSplitPaneUI;
import org.pushingpixels.substance.internal.utils.icon.TransitionAwareIcon;
/**
* Split pane divider in <code>Substance</code> look and feel.
*
* @author Kirill Grouchnikov
*/
public class SubstanceSplitPaneDivider extends BasicSplitPaneDivider implements TransitionAwareUI {
/**
* Listener for transition animations.
*/
private RolloverControlListener substanceRolloverListener;
protected StateTransitionTracker stateTransitionTracker;
/**
* Listener on property change events.
*/
private PropertyChangeListener substancePropertyChangeListener;
/**
* Surrogate button model for tracking the thumb transitions.
*/
private ButtonModel gripModel;
private static class SubstanceSplitPaneDividerButton extends JButton {
// Don't want the button to participate in focus traversal
@Override
public boolean isFocusable() {
return false;
}
@Override
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
}
@Override
public Insets getInsets(Insets insets) {
if (insets == null) {
insets = new Insets(0, 0, 0, 0);
}
insets.set(0, 0, 0, 0);
return insets;
}
@Override
public Dimension getPreferredSize() {
Insets bInsets = SubstanceSizeUtils
.getButtonInsets(SubstanceSizeUtils.getComponentFontSize(this));
int iconWidth = getIcon().getIconWidth();
int iconHeight = getIcon().getIconHeight();
return new Dimension(iconWidth + bInsets.left + bInsets.right,
iconHeight + bInsets.top + bInsets.bottom);
}
}
/**
* Simple constructor.
*
* @param ui
* Associated UI.
*/
public SubstanceSplitPaneDivider(SubstanceSplitPaneUI ui) {
super(ui);
this.setLayout(new SubstanceDividerLayout());
}
@Override
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
if (this.splitPane != null) {
// fix for defect 358 - multiple listeners were installed
// on the same split pane
this.uninstall();
}
if (newUI != null) {
// installing
this.splitPane = newUI.getSplitPane();
this.gripModel = new DefaultButtonModel();
this.gripModel.setArmed(false);
this.gripModel.setSelected(false);
this.gripModel.setPressed(false);
this.gripModel.setRollover(false);
this.gripModel.setEnabled(this.splitPane.isEnabled());
this.stateTransitionTracker = new StateTransitionTracker(this.splitPane,
this.gripModel);
// fix for defect 109 - memory leak on changing skin
this.substanceRolloverListener = new RolloverControlListener(this, this.gripModel);
this.addMouseListener(this.substanceRolloverListener);
this.addMouseMotionListener(this.substanceRolloverListener);
this.substancePropertyChangeListener = (PropertyChangeEvent evt) -> {
if ("enabled".equals(evt.getPropertyName())) {
boolean isEnabled = splitPane.isEnabled();
gripModel.setEnabled(isEnabled);
if (leftButton != null)
leftButton.setEnabled(isEnabled);
if (rightButton != null)
rightButton.setEnabled(isEnabled);
setEnabled(isEnabled);
}
};
this.splitPane.addPropertyChangeListener(this.substancePropertyChangeListener);
this.stateTransitionTracker.registerModelListeners();
} else {
uninstall();
}
super.setBasicSplitPaneUI(newUI);
}
/**
* Uninstalls this divider.
*/
private void uninstall() {
// uninstalling
// fix for defect 109 - memory leak on changing skin
this.removeMouseListener(this.substanceRolloverListener);
this.removeMouseMotionListener(this.substanceRolloverListener);
this.substanceRolloverListener = null;
if (this.substancePropertyChangeListener != null) {
// System.out.println("Unregistering " + this.hashCode() + ":"
// + this.substancePropertyChangeListener.hashCode()
// + " from " + this.splitPane.hashCode());
this.splitPane.removePropertyChangeListener(this.substancePropertyChangeListener);
this.substancePropertyChangeListener = null;
}
this.stateTransitionTracker.unregisterModelListeners();
}
/*
* (non-Javadoc)
*
* @see java.awt.Component#paint(java.awt.Graphics)
*/
@Override
public void paint(Graphics g) {
if (SubstanceCoreUtilities.hasFlatAppearance(this.splitPane, true)) {
BackgroundPaintingUtils.updateIfOpaque(g, this.splitPane);
}
Graphics2D graphics = (Graphics2D) g.create();
ModelStateInfo modelStateInfo = this.stateTransitionTracker.getModelStateInfo();
ComponentState currState = modelStateInfo.getCurrModelState();
Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
.getStateContributionMap();
float alpha = SubstanceColorSchemeUtilities.getAlpha(this.splitPane, currState);
// compute the grip handle dimension
int minSizeForGripPresence = SubstanceSizeUtils
.getAdjustedSize(SubstanceSizeUtils.getComponentFontSize(this), 30, 1, 2, false);
int maxGripSize = SubstanceSizeUtils
.getAdjustedSize(SubstanceSizeUtils.getComponentFontSize(this), 40, 1, 3, false);
if (this.splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
int thumbHeight = this.getHeight();
if (thumbHeight >= minSizeForGripPresence) {
int gripHeight = thumbHeight / 4;
if (gripHeight > maxGripSize)
gripHeight = maxGripSize;
int thumbWidth = this.getWidth();
int gripX = 0;
int gripY = (thumbHeight - gripHeight) / 2;
// draw the grip bumps
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
float contribution = activeEntry.getValue().getContribution();
if (contribution == 0.0f)
continue;
ComponentState activeState = activeEntry.getKey();
graphics.setComposite(WidgetUtilities.getAlphaComposite(this.splitPane,
alpha * contribution, g));
SubstanceImageCreator.paintSplitDividerBumpImage(graphics, this, gripX, gripY,
thumbWidth, gripHeight, false,
SubstanceColorSchemeUtilities.getColorScheme(this,
ColorSchemeAssociationKind.MARK, activeState));
}
}
} else {
int thumbWidth = this.getWidth();
if (thumbWidth >= minSizeForGripPresence) {
int gripWidth = thumbWidth / 4;
if (gripWidth > maxGripSize)
gripWidth = maxGripSize;
int thumbHeight = this.getHeight();
// int gripHeight = thumbHeight * 2 / 3;
int gripX = (thumbWidth - gripWidth) / 2;
int gripY = 1;
// draw the grip bumps
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
float contribution = activeEntry.getValue().getContribution();
if (contribution == 0.0f)
continue;
ComponentState activeState = activeEntry.getKey();
graphics.setComposite(WidgetUtilities.getAlphaComposite(this.splitPane,
alpha * contribution, g));
SubstanceImageCreator.paintSplitDividerBumpImage(graphics, this, gripX, gripY,
gripWidth, thumbHeight, true,
SubstanceColorSchemeUtilities.getColorScheme(this,
ColorSchemeAssociationKind.MARK, activeState));
}
}
}
graphics.dispose();
super.paint(g);
}
/*
* (non-Javadoc)
*
* @see javax.swing.plaf.basic.BasicSplitPaneDivider#createLeftOneTouchButton()
*/
@Override
protected JButton createLeftOneTouchButton() {
JButton oneTouchButton = new SubstanceSplitPaneDividerButton();
Icon verticalSplit = new TransitionAwareIcon(oneTouchButton,
(SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.NORTH, scheme);
}, "substance.splitPane.left.vertical");
Icon horizontalSplit = new TransitionAwareIcon(oneTouchButton,
(SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.WEST, scheme);
}, "substance.splitPane.left.horizontal");
oneTouchButton.setIcon(
this.splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT ? verticalSplit
: horizontalSplit);
SubstanceCortex.ComponentOrParentScope.setButtonNeverPaintBackground(oneTouchButton, true);
oneTouchButton.setRequestFocusEnabled(false);
oneTouchButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
oneTouchButton.setFocusPainted(false);
oneTouchButton.setBorderPainted(false);
return oneTouchButton;
}
/*
* (non-Javadoc)
*
* @see javax.swing.plaf.basic.BasicSplitPaneDivider#createRightOneTouchButton()
*/
@Override
protected JButton createRightOneTouchButton() {
JButton oneTouchButton = new SubstanceSplitPaneDividerButton();
Icon verticalSplit = new TransitionAwareIcon(oneTouchButton,
(SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.SOUTH, scheme);
}, "substance.splitPane.right.vertical");
Icon horizontalSplit = new TransitionAwareIcon(oneTouchButton,
(SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.EAST, scheme);
}, "substance.splitPane.right.horizontal");
oneTouchButton.setIcon(
this.splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT ? verticalSplit
: horizontalSplit);
SubstanceCortex.ComponentOrParentScope.setButtonNeverPaintBackground(oneTouchButton, true);
oneTouchButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
oneTouchButton.setFocusPainted(false);
oneTouchButton.setBorderPainted(false);
oneTouchButton.setRequestFocusEnabled(false);
// b.setOpaque(false);
return oneTouchButton;
}
/**
* Updates the one-touch buttons.
*
* @param orientation
* Split pane orientation.
*/
public void updateOneTouchButtons(int orientation) {
if (orientation == JSplitPane.VERTICAL_SPLIT) {
if (this.leftButton != null) {
this.leftButton.setIcon(
new TransitionAwareIcon(this.leftButton, (SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.NORTH, scheme);
}, "substance.splitPane.left.vertical"));
}
if (this.rightButton != null) {
this.rightButton.setIcon(
new TransitionAwareIcon(this.rightButton, (SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.SOUTH, scheme);
}, "substance.splitPane.right.vertical"));
}
} else {
if (this.leftButton != null) {
this.leftButton.setIcon(
new TransitionAwareIcon(this.leftButton, (SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.WEST, scheme);
}, "substance.splitPane.left.horizontal"));
}
if (this.rightButton != null) {
this.rightButton.setIcon(
new TransitionAwareIcon(this.rightButton, (SubstanceColorScheme scheme) -> {
int fontSize = SubstanceSizeUtils.getComponentFontSize(splitPane);
return SubstanceImageCreator.getArrowIcon(
SubstanceSizeUtils.getSplitPaneArrowIconWidth(fontSize),
SubstanceSizeUtils.getSplitPaneArrowIconHeight(fontSize),
SubstanceSizeUtils.getArrowStrokeWidth(fontSize) / 1.5f,
SwingConstants.EAST, scheme);
}, "substance.splitPane.right.horizontal"));
}
}
}
/*
* (non-Javadoc)
*
* @seeorg.pushingpixels.substance.utils.Trackable#isInside(java.awt.event. MouseEvent)
*/
public boolean isInside(MouseEvent me) {
// entire area is sensitive
return true;
}
@Override
public StateTransitionTracker getTransitionTracker() {
return this.stateTransitionTracker;
}
/**
* Layout manager for the split pane divider.
*
* @author Kirill Grouchnikov
*/
protected class SubstanceDividerLayout extends DividerLayout {
@Override
public void layoutContainer(Container c) {
if (leftButton != null && rightButton != null && c == SubstanceSplitPaneDivider.this) {
if (splitPane.isOneTouchExpandable()) {
Insets insets = getInsets();
int buttonWidth = leftButton.getPreferredSize().width;
int buttonHeight = leftButton.getPreferredSize().height;
int offset = SubstanceSizeUtils.getSplitPaneButtonOffset(
SubstanceSizeUtils.getComponentFontSize(splitPane));
if (orientation == JSplitPane.VERTICAL_SPLIT) {
int extraX = (insets != null) ? insets.left : 0;
int y = (c.getSize().height - buttonHeight) / 2;
leftButton.setBounds(extraX + offset, y, buttonWidth, buttonHeight);
rightButton.setBounds(leftButton.getX() + leftButton.getWidth(), y,
buttonWidth, buttonHeight);
} else {
int extraY = (insets != null) ? insets.top : 0;
int x = (c.getSize().width - buttonWidth) / 2;
leftButton.setBounds(x, extraY + offset, buttonWidth, buttonHeight);
rightButton.setBounds(x, leftButton.getY() + leftButton.getHeight(),
buttonWidth, buttonHeight);
}
} else {
leftButton.setBounds(-5, -5, 1, 1);
rightButton.setBounds(-5, -5, 1, 1);
}
}
}
}
}
| [
""
] | |
e30df6137e2eafb074d4ff618800d73c2e6ccdcc | 75ce8fc9a46d98d41bdb705d3479a88120be7e60 | /extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/EnvVarHolder.java | b3b94340a39b6ea97e9ccf112d9d7cf948adbbb2 | [
"Apache-2.0"
] | permissive | JalajChawla/quarkus | ea58b7cbfe9dbcf4be6dd34610b8460d9c9b0c51 | 68f5be3454277e738163cc1ccf36a90bef111d41 | refs/heads/master | 2022-08-21T11:13:12.100365 | 2020-05-26T07:17:05 | 2020-05-26T07:17:05 | 266,983,430 | 1 | 0 | Apache-2.0 | 2020-05-26T08:12:00 | 2020-05-26T08:11:59 | null | UTF-8 | Java | false | false | 3,176 | java | package io.quarkus.kubernetes.deployment;
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.configmap;
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.field;
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.secret;
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.var;
import java.util.Collection;
import java.util.Map;
import io.quarkus.kubernetes.spi.KubernetesEnvBuildItem;
/**
* Common interface for configuration entities holding environment variables meant to be injected into containers.
*/
public interface EnvVarHolder {
/**
* Retrieves the definition of environment variables to add to the application's container.
*
* @return the associated {@link EnvVarsConfig} holding the definition of which environment variables to add
*/
EnvVarsConfig getEnv();
/**
* @deprecated use {@link #getEnv()} instead
*/
@Deprecated
Map<String, EnvConfig> getEnvVars();
/**
* Specifies which the name of the platform this EnvVarHolder targets. This name, when needed, is used by dekorate to
* generate the descriptor associated with the targeted deployment platform.
*
* @return the name of the targeted platform e.g. {@link Constants#KUBERNETES}
*/
String getTargetPlatformName();
/**
* Converts the environment variable configuration held by this EnvVarHolder (as returned by {@link #getEnv()} and
* {@link #getEnvVars()}) into a collection of associated {@link KubernetesEnvBuildItem}.
*
* @return a collection of {@link KubernetesEnvBuildItem} corresponding to the environment variable configurations
*/
default Collection<KubernetesEnvBuildItem> convertToBuildItems() {
final EnvVarValidator validator = new EnvVarValidator();
// first process old-style configuration, this relies on each configuration having a name
final String target = getTargetPlatformName();
getEnvVars().forEach((key, envConfig) -> {
envConfig.secret.ifPresent(s -> validator.process(new KubernetesEnvBuildItem(secret, s, s, target, true)));
envConfig.configmap.ifPresent(cm -> validator.process(new KubernetesEnvBuildItem(configmap, cm, cm, target, true)));
envConfig.field.ifPresent(f -> validator.process(new KubernetesEnvBuildItem(field, key, f, target, true)));
envConfig.value.ifPresent(v -> validator.process(new KubernetesEnvBuildItem(var, key, v, target, true)));
});
// override old-style with newer versions if present
final EnvVarsConfig c = getEnv();
c.vars.forEach((k, v) -> validator.process(new KubernetesEnvBuildItem(var, k, v, target)));
c.fields.forEach((k, v) -> validator.process(new KubernetesEnvBuildItem(field, k, v, target)));
c.configmaps
.ifPresent(cl -> cl.forEach(cm -> validator.process(new KubernetesEnvBuildItem(configmap, cm, cm, target))));
c.secrets.ifPresent(sl -> sl.forEach(s -> validator.process(new KubernetesEnvBuildItem(secret, s, s, target))));
return validator.getBuildItems();
}
}
| [
"metacosm@gmail.com"
] | metacosm@gmail.com |
f83fda119c4f59b4ef78e5fbbaf29d844afd905b | bff5ad8276f4113ce291791b2850f6e58f17130a | /httplib/src/main/java/com/martin/httplib/utils/ContextUtis.java | 26390c9f75cdc1302ecdac6f9eb879e7a4a61204 | [] | no_license | MartinLi2015/MartinHttp | 6efe5898ea536172b898d0f3605c6030b40befda | b697e3cfaccdf505b62e9282d3cd73cf8eff7e9b | refs/heads/master | 2021-05-13T12:15:59.445432 | 2018-03-21T09:59:01 | 2018-03-21T09:59:01 | 116,666,701 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.martin.httplib.utils;
import android.app.Application;
import android.content.Context;
/**
* 注入Context;
*
* @author martin
*/
public class ContextUtis {
private static Context context;
public static void init(Application application) {
ContextUtis.context = application;
}
public static Context getContext() {
if (context == null) {
throw new NullPointerException("you should init in Application");
}
return context;
}
}
| [
"1025236025@qq.com"
] | 1025236025@qq.com |
e58113646ba6f93c6472c03e93a2cc751c3a3475 | 1a4c7f36a90d882849fa494ed53f18a7c6f124a8 | /app/src/main/java/ac/airconditionsuit/app/aircondition/AirConditionManager.java | f6bb4f533d17cef71d7a731c22051260f62718c3 | [] | no_license | xiaoyi2015/DC_Demo | 61b118fff6894bf04bbbc76897933529530f52f1 | b6109fd871f2455caa714157007b23020fd58e0e | refs/heads/master | 2021-01-11T10:30:40.069235 | 2016-04-01T18:17:31 | 2016-04-01T18:17:31 | 76,365,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,079 | java | package ac.airconditionsuit.app.aircondition;
import ac.airconditionsuit.app.MyApp;
import ac.airconditionsuit.app.entity.*;
import ac.airconditionsuit.app.network.socket.socketpackage.*;
import ac.airconditionsuit.app.network.socket.socketpackage.Udp.UdpPackage;
import ac.airconditionsuit.app.util.ByteUtil;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ac on 10/15/15.
*/
public class AirConditionManager {
private static final String TAG = "AirConditionManager";
public static final int QUERY_ALL_TIMER = 0xffff;
public static final int QUERY_TIMER_NO = 0xfffe;
List<AirCondition> airConditions = new ArrayList<>();
// List<Timer> timers = new ArrayList<>();//usused
public void initAirConditionsByDeviceList(List<DeviceFromServerConfig> devices) {
// for (DeviceFromServerConfig dev : devices) {
// boolean found = false;
// for (AirCondition air : airConditions) {
// if (air.getAddress() == dev.getAddress()) {
// found = true;
// break;
// }
// }
// if (!found) {
// AirCondition ac = new AirCondition(dev);
// airConditions.add(ac);
// }
// }
airConditions.clear();
for (DeviceFromServerConfig dev : devices) {
airConditions.add(new AirCondition(dev));
}
}
public void initAirConditionsByDeviceList() {
// for (String configFileName : MyApp.getApp().getLocalConfigManager().getCurrentUserConfig().getHomeConfigFileNames()) {
// ServerConfigManager serverConfigManager = new ServerConfigManager();
// serverConfigManager.readFromFile(configFileName);
initAirConditionsByDeviceList(MyApp.getApp().getServerConfigManager().getDevices_new());
// }
}
public void queryAirConditionStatus() {
try {
if (MyApp.getApp().getSocketManager() != null && MyApp.getApp().getSocketManager().shouldSendPacketsToQuery()) {
MyApp.getApp().getSocketManager().getAllAirConditionStatusFromHostDevice(MyApp.getApp().getServerConfigManager().getDevices_new());
}
} catch (Exception e) {
Log.e(TAG, "init air condition status fail");
e.printStackTrace();
}
}
public void updateAirConditionStatueLocal(byte[] status) {
try {
AirConditionStatusResponse airConditionStatusResponse =
AirConditionStatusResponse.decodeFromByteArray(status);
AirCondition airCondition = getAirConditionByAddress(airConditionStatusResponse.getAddress());
if (airCondition == null) {
airCondition = new AirCondition(airConditionStatusResponse);
airConditions.add(airCondition);
}
airCondition.changeStatus(airConditionStatusResponse);
MyApp.getApp().getSocketManager().notifyActivity(new ObserveData(ObserveData.AIR_CONDITION_STATUS_RESPONSE, airCondition));
} catch (Exception e) {
Log.i(TAG, "decode air condition status failed");
e.printStackTrace();
}
}
public void updateTimerStatueLocal(byte[] contentData) {
try {
Timer timer = Timer.decodeFromByteArray(contentData);
MyApp.getApp().getServerConfigManager().updateTimer(timer);
MyApp.getApp().getSocketManager().notifyActivity(new ObserveData(ObserveData.TIMER_STATUS_RESPONSE, timer));
} catch (Exception e) {
Log.i(TAG, "decode timer status failed");
e.printStackTrace();
}
}
/**
* @param timerId 定时器id
*/
public void timerRun(int timerId) {
Log.v("liutao", "定时器执行");
//updateAcsByTimerRunned(timerId);
for (Timer t : MyApp.getApp().getServerConfigManager().getTimer()) {
if (timerId == (long) t.getTimerid()) {
MyApp.getApp().showToast("定时器\"" + t.getName() + "\"运行成功!");
break;
}
}
queryTimer(timerId);
}
public void controlScene(Scene scene, UdpPackage.Handler handle) throws Exception {
MyApp.getApp().getSocketManager().sendMessage(scene.toSocketControlPackage(handle));
//发送场景时,不主动查询空调状态,因为空调控制成功需要时间,此时查询到的状态,有可能是控制之前空调的状态。进而造成本地显示与实际空调状态不一致
//目前,控制空调成功后,主机不一定会反馈空调状态给app
//在我的空调界面,允许用户手动下拉刷新,主动发包读取所有空调状态
//MyApp.getApp().getAirConditionManager().queryAirConditionStatus();
//发送场景控制命令时,先set到本地缓存,使界面得到更新。
//updateACsBySceneControl(scene);
}
public void controlRoom(Room room, AirConditionControl airConditionControl) throws Exception {
MyApp.getApp().getSocketManager().sendMessage(new ControlPackage(room, airConditionControl));
// queryAirConditionStatus();
//updateAirconditions(room, airConditionControl);
}
private void updateAcsByTimerRunned(int timer_id) {
List<Timer> timers = MyApp.getApp().getServerConfigManager().getTimer();
for (Timer tm : timers) {
if (tm.getTimerid() == timer_id) {
List<Integer> indexes = tm.getIndexes_new_new();
for (Integer idxInTimer : indexes) {
Integer idx = idxInTimer - 1;
if (idx >= 0 && idx < airConditions.size()) {
AirCondition ac = airConditions.get(idx);
ac.setAirconditionMode(tm.getMode());
ac.setAirconditionFan(tm.getFan());
ac.setTemperature(tm.getTemperature());
ac.setOnoff(tm.isOnoff() ? 1 : 0);
MyApp.getApp().getSocketManager().notifyActivity(new ObserveData(ObserveData.AIR_CONDITION_STATUS_RESPONSE, ac));
}
}
}
}
}
private void updateACsBySceneControl(Scene scene) {
List<Command> commands = scene.getCommands();
if (commands == null) return;
for (Command command : commands) {
int address = command.getAddress();
// initAirConditionsByDeviceList();
for (AirCondition airCondition : airConditions) {
if (airCondition.getAddress() == address) {
airCondition.setAirconditionMode(command.getMode());
airCondition.setAirconditionFan(command.getFan());
airCondition.setTemperature(command.getTemperature());
airCondition.setOnoff(command.getOnoff());
}
}
}
}
private void updateAirconditions(Room room, AirConditionControl airConditionControl) throws Exception {
for (int index : room.getElements()) {
List<DeviceFromServerConfig> devices = MyApp.getApp().getServerConfigManager().getDevices_new();
if (devices.size() <= index) {
throw new Exception("air condition index is to large");
}
DeviceFromServerConfig deviceFromServerConfig = devices.get(index);
int address = deviceFromServerConfig.getAddress_new();
if (address > 255 || address < 0) {
throw new Exception("air condition address error");
}
// initAirConditionsByDeviceList();
for (AirCondition airCondition : airConditions) {
if (airCondition.getAddress() == address) {
airCondition.setAirconditionMode(airConditionControl.getMode());
airCondition.setAirconditionFan(airConditionControl.getWindVelocity());
airCondition.setTemperature(airConditionControl.getTemperature());
airCondition.setOnoff(airConditionControl.getOnoff());
}
}
}
}
/**
* @param index 待查找的空调的地址
* @return 可能为空
*/
public AirCondition getAirConditionByIndex_new(int index) {
List<DeviceFromServerConfig> devices_new = MyApp.getApp().getServerConfigManager().getDevices_new();
if (index < 0 || index >= devices_new.size()) {
return new AirCondition();
}
int address = devices_new.get(index).getAddress_new();
for (AirCondition airCondition : airConditions) {
if (airCondition.getAddress() == address) {
return airCondition;
}
}
return new AirCondition();
}
public AirCondition getAirConditionByAddress(int address) {
for (AirCondition airCondition : airConditions) {
if (airCondition.getAddress() == address) {
return airCondition;
}
}
return null;
}
public AirCondition getAirConditions(Room room) {
//List<Integer> elements = room.getElements();
if (room.getElements() == null || room.getElements().size() == 0) {
return null;
}
// AirCondition airConditionByIndex = getAirConditionByIndex(room.getElements().get(0));
// airCondition.setAirconditionMode(airConditionByIndex.getAirconditionMode());
// airCondition.setOnoff(airConditionByIndex.getOnoff());
// airCondition.setAirconditionFan(airConditionByIndex.getAirconditionFan());
// airCondition.setTemperature(airConditionByIndex.getTemperature());
// airCondition.setRealTemperature(airConditionByIndex.getRealTemperature());
AirCondition airCondition = new AirCondition();
airCondition.setMode(AirConditionControl.UNKNOW);
airCondition.setOnoff(AirConditionControl.UNKNOW);
airCondition.setFan(AirConditionControl.UNKNOW);
airCondition.setTemperature(AirConditionControl.UNKNOW);
airCondition.setRealTemperature(AirConditionControl.UNKNOW);
for (int i = 0; i < room.getElements().size(); i++) {
AirCondition temp = getAirConditionByIndex_new(room.getElements().get(i));
if (temp == null) {
continue;
}
if (i == 0) {
airCondition.setAirconditionMode(temp.getAirconditionMode());
airCondition.setOnoff(temp.getOnoff());
airCondition.setAirconditionFan(temp.getAirconditionFan());
if (temp.getTemperature() > 30 || temp.getTemperature() < 17) {
airCondition.setTemperature(AirConditionControl.UNKNOW);
} else {
airCondition.setTemperature(temp.getTemperature());
}
int t = temp.getRealTemperature();
Log.v("zln", temp.getRealTemperature() + "");
if (t > 99 || (t + 99) < 0) {
airCondition.setRealTemperature(AirConditionControl.UNKNOW);
} else {
airCondition.setRealTemperature(t);
}
} else {
if (temp.getAirconditionMode() != airCondition.getAirconditionMode()) {
airCondition.setMode(AirConditionControl.UNKNOW);
}
if (airCondition.getOnoff() == 0) {
airCondition.setOnoff(temp.getOnoff());
}
if (temp.getAirconditionFan() != airCondition.getAirconditionFan()) {
airCondition.setFan(AirConditionControl.UNKNOW);
}
if (temp.getTemperature() != airCondition.getTemperature()
|| temp.getTemperature() > 30 || temp.getTemperature() < 17) {
airCondition.setTemperature(AirConditionControl.UNKNOW);
}
if (temp.getRealTemperature() != airCondition.getRealTemperature()
|| temp.getRealTemperature() > 99 || temp.getRealTemperature() < -99) {
airCondition.setRealTemperature(AirConditionControl.UNKNOW);
}
}
}
return airCondition;
}
public void queryTimerAll() {
try {
Log.v("liutao", "主动发包读取所有定时器状态");
queryTimerAllWithException();
} catch (Exception e) {
e.printStackTrace();
}
}
private void queryTimerAllWithException() throws Exception {
if (MyApp.getApp().getSocketManager().shouldSendPacketsToQuery()) {
MyApp.getApp().getSocketManager().sendMessage(new QueryTimerPackage(0xffff));
MyApp.getApp().getServerConfigManager().clearTimer();
}
}
public void queryTimer(int id) {
MyApp.getApp().getSocketManager().sendMessage(new QueryTimerPackage(id));
}
public void controlAirCondition(Command command) {
try {
MyApp.getApp().getSocketManager().sendMessage(new ControlPackage(command));
} catch (Exception e) {
Log.e(TAG, "invalid command");
e.printStackTrace();
}
}
public void addTimerServer(Timer timer) {
timer.setTimerid(0xffffffff);
SocketPackage p = new TimerPackage(timer);
MyApp.getApp().getSocketManager().sendMessage(p);
}
public void modifyTimerServer(Timer timer) {
SocketPackage p = new TimerPackage(timer);
MyApp.getApp().getSocketManager().sendMessage(p);
}
public void deleteTimerServer(int id) {
SocketPackage p = new DeleteTimerPackage(id);
MyApp.getApp().getSocketManager().sendMessage(p);
}
public void deleteTimerLocal(byte[] id) {
int idInt = ByteUtil.byteArrayToShortAsBigEndian(id);
MyApp.getApp().getServerConfigManager().deleteTimerById(idInt);
}
}
| [
"zln@zhulinandeMacBook-Pro.local"
] | zln@zhulinandeMacBook-Pro.local |
b58d8f62f96286e6116e95658625cceb7cc0e835 | 5d6b3ad627a778575c06850ed8a61dd42d696620 | /dbflute-oracle-example/src/main/java/com/example/dbflute/oracle/dbflute/cbean/bs/BsSummaryProductCB.java | 83ccf1c38e22b5f9d4d46c9a69032e49763842c0 | [
"Apache-2.0"
] | permissive | hajimeni/dbflute-example-database | 9246ba7959b33e3b4eb470e9fd3e26aa78d0519a | 66b8fdf4fec3a63eb8fce1705e86061c88a216b1 | refs/heads/master | 2020-12-25T14:33:48.342906 | 2013-10-10T16:35:24 | 2013-10-10T16:35:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,064 | java | package com.example.dbflute.oracle.dbflute.cbean.bs;
import org.seasar.dbflute.cbean.AbstractConditionBean;
import org.seasar.dbflute.cbean.AndQuery;
import org.seasar.dbflute.cbean.ConditionBean;
import org.seasar.dbflute.cbean.ConditionQuery;
import org.seasar.dbflute.cbean.OrQuery;
import org.seasar.dbflute.cbean.SpecifyQuery;
import org.seasar.dbflute.cbean.SubQuery;
import org.seasar.dbflute.cbean.UnionQuery;
import org.seasar.dbflute.cbean.chelper.*;
import org.seasar.dbflute.cbean.coption.*;
import org.seasar.dbflute.cbean.sqlclause.SqlClause;
import org.seasar.dbflute.cbean.sqlclause.SqlClauseCreator;
import org.seasar.dbflute.dbmeta.DBMetaProvider;
import org.seasar.dbflute.twowaysql.factory.SqlAnalyzerFactory;
import com.example.dbflute.oracle.dbflute.allcommon.DBFluteConfig;
import com.example.dbflute.oracle.dbflute.allcommon.DBMetaInstanceHandler;
import com.example.dbflute.oracle.dbflute.allcommon.ImplementedInvokerAssistant;
import com.example.dbflute.oracle.dbflute.allcommon.ImplementedSqlClauseCreator;
import com.example.dbflute.oracle.dbflute.cbean.*;
import com.example.dbflute.oracle.dbflute.cbean.cq.*;
import com.example.dbflute.oracle.dbflute.cbean.nss.*;
/**
* The base condition-bean of SUMMARY_PRODUCT.
* @author oracleman
*/
public class BsSummaryProductCB extends AbstractConditionBean {
// ===================================================================================
// Attribute
// =========
protected SummaryProductCQ _conditionQuery;
// ===================================================================================
// Constructor
// ===========
public BsSummaryProductCB() {
if (DBFluteConfig.getInstance().isPagingCountLater()) {
enablePagingCountLater();
}
if (DBFluteConfig.getInstance().isPagingCountLeastJoin()) {
enablePagingCountLeastJoin();
}
if (DBFluteConfig.getInstance().isCheckCountBeforeQueryUpdate()) {
enableCheckCountBeforeQueryUpdate();
}
}
// ===================================================================================
// SqlClause
// =========
@Override
protected SqlClause createSqlClause() {
SqlClauseCreator creator = DBFluteConfig.getInstance().getSqlClauseCreator();
if (creator != null) {
return creator.createSqlClause(this);
}
return new ImplementedSqlClauseCreator().createSqlClause(this); // as default
}
// ===================================================================================
// DBMeta Provider
// ===============
@Override
protected DBMetaProvider getDBMetaProvider() {
return DBMetaInstanceHandler.getProvider(); // as default
}
// ===================================================================================
// Table Name
// ==========
public String getTableDbName() {
return "SUMMARY_PRODUCT";
}
// ===================================================================================
// PrimaryKey Handling
// ===================
public void acceptPrimaryKey(Long productId) {
assertObjectNotNull("productId", productId);
BsSummaryProductCB cb = this;
cb.query().setProductId_Equal(productId);
}
public ConditionBean addOrderBy_PK_Asc() {
query().addOrderBy_ProductId_Asc();
return this;
}
public ConditionBean addOrderBy_PK_Desc() {
query().addOrderBy_ProductId_Desc();
return this;
}
// ===================================================================================
// Query
// =====
/**
* Prepare for various queries. <br />
* Examples of main functions are following:
* <pre>
* <span style="color: #3F7E5E">// Basic Queries</span>
* cb.query().setMemberId_Equal(value); <span style="color: #3F7E5E">// =</span>
* cb.query().setMemberId_NotEqual(value); <span style="color: #3F7E5E">// !=</span>
* cb.query().setMemberId_GreaterThan(value); <span style="color: #3F7E5E">// ></span>
* cb.query().setMemberId_LessThan(value); <span style="color: #3F7E5E">// <</span>
* cb.query().setMemberId_GreaterEqual(value); <span style="color: #3F7E5E">// >=</span>
* cb.query().setMemberId_LessEqual(value); <span style="color: #3F7E5E">// <=</span>
* cb.query().setMemberName_InScope(valueList); <span style="color: #3F7E5E">// in ('a', 'b')</span>
* cb.query().setMemberName_NotInScope(valueList); <span style="color: #3F7E5E">// not in ('a', 'b')</span>
* cb.query().setMemberName_PrefixSearch(value); <span style="color: #3F7E5E">// like 'a%' escape '|'</span>
* <span style="color: #3F7E5E">// LikeSearch with various options: (versatile)</span>
* <span style="color: #3F7E5E">// {like ... [options]}</span>
* cb.query().setMemberName_LikeSearch(value, option);
* cb.query().setMemberName_NotLikeSearch(value, option); <span style="color: #3F7E5E">// not like ...</span>
* <span style="color: #3F7E5E">// FromTo with various options: (versatile)</span>
* <span style="color: #3F7E5E">// {(default) fromDatetime <= BIRTHDATE <= toDatetime}</span>
* cb.query().setBirthdate_FromTo(fromDatetime, toDatetime, option);
* <span style="color: #3F7E5E">// DateFromTo: (Date means yyyy/MM/dd)</span>
* <span style="color: #3F7E5E">// {fromDate <= BIRTHDATE < toDate + 1 day}</span>
* cb.query().setBirthdate_DateFromTo(fromDate, toDate);
* cb.query().setBirthdate_IsNull(); <span style="color: #3F7E5E">// is null</span>
* cb.query().setBirthdate_IsNotNull(); <span style="color: #3F7E5E">// is not null</span>
*
* <span style="color: #3F7E5E">// ExistsReferrer: (co-related sub-query)</span>
* <span style="color: #3F7E5E">// {where exists (select PURCHASE_ID from PURCHASE where ...)}</span>
* cb.query().existsPurchaseList(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.query().setXxx... <span style="color: #3F7E5E">// referrer sub-query condition</span>
* }
* });
* cb.query().notExistsPurchaseList...
*
* <span style="color: #3F7E5E">// InScopeRelation: (sub-query)</span>
* <span style="color: #3F7E5E">// {where MEMBER_STATUS_CODE in (select MEMBER_STATUS_CODE from MEMBER_STATUS where ...)}</span>
* cb.query().inScopeMemberStatus(new SubQuery<MemberStatusCB>() {
* public void query(MemberStatusCB subCB) {
* subCB.query().setXxx... <span style="color: #3F7E5E">// relation sub-query condition</span>
* }
* });
* cb.query().notInScopeMemberStatus...
*
* <span style="color: #3F7E5E">// (Query)DerivedReferrer: (co-related sub-query)</span>
* cb.query().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.specify().columnPurchasePrice(); <span style="color: #3F7E5E">// derived column for function</span>
* subCB.query().setXxx... <span style="color: #3F7E5E">// referrer sub-query condition</span>
* }
* }).greaterEqual(value);
*
* <span style="color: #3F7E5E">// ScalarCondition: (self-table sub-query)</span>
* cb.query().scalar_Equal().max(new SubQuery<MemberCB>() {
* public void query(MemberCB subCB) {
* subCB.specify().columnBirthdate(); <span style="color: #3F7E5E">// derived column for function</span>
* subCB.query().setXxx... <span style="color: #3F7E5E">// scalar sub-query condition</span>
* }
* });
*
* <span style="color: #3F7E5E">// OrderBy</span>
* cb.query().addOrderBy_MemberName_Asc();
* cb.query().addOrderBy_MemberName_Desc().withManualOrder(valueList);
* cb.query().addOrderBy_MemberName_Desc().withNullsFirst();
* cb.query().addOrderBy_MemberName_Desc().withNullsLast();
* cb.query().addSpecifiedDerivedOrderBy_Desc(aliasName);
*
* <span style="color: #3F7E5E">// Query(Relation)</span>
* cb.query().queryMemberStatus()...;
* cb.query().queryMemberAddressAsValid(targetDate)...;
* </pre>
* @return The instance of condition-query for base-point table to set up query. (NotNull)
*/
public SummaryProductCQ query() {
assertQueryPurpose(); // assert only when user-public query
return getConditionQuery();
}
public SummaryProductCQ getConditionQuery() { // public for parameter comment and internal
if (_conditionQuery == null) {
_conditionQuery = createLocalCQ();
}
return _conditionQuery;
}
protected SummaryProductCQ createLocalCQ() {
return xcreateCQ(null, getSqlClause(), getSqlClause().getBasePointAliasName(), 0);
}
protected SummaryProductCQ xcreateCQ(ConditionQuery childQuery, SqlClause sqlClause, String aliasName, int nestLevel) {
SummaryProductCQ cq = xnewCQ(childQuery, sqlClause, aliasName, nestLevel);
cq.xsetBaseCB(this);
return cq;
}
protected SummaryProductCQ xnewCQ(ConditionQuery childQuery, SqlClause sqlClause, String aliasName, int nestLevel) {
return new SummaryProductCQ(childQuery, sqlClause, aliasName, nestLevel);
}
public ConditionQuery localCQ() {
return getConditionQuery();
}
// ===================================================================================
// Union
// =====
/**
* Set up 'union' for base-point table. <br />
* You don't need to call SetupSelect in union-query,
* because it inherits calls before. (Don't call SetupSelect after here)
* <pre>
* cb.query().<span style="color: #FD4747">union</span>(new UnionQuery<SummaryProductCB>() {
* public void query(SummaryProductCB unionCB) {
* unionCB.query().setXxx...
* }
* });
* </pre>
* @param unionQuery The query of 'union'. (NotNull)
*/
public void union(UnionQuery<SummaryProductCB> unionQuery) {
final SummaryProductCB cb = new SummaryProductCB();
cb.xsetupForUnion(this); xsyncUQ(cb); unionQuery.query(cb); xsaveUCB(cb);
final SummaryProductCQ cq = cb.query(); query().xsetUnionQuery(cq);
}
/**
* Set up 'union all' for base-point table. <br />
* You don't need to call SetupSelect in union-query,
* because it inherits calls before. (Don't call SetupSelect after here)
* <pre>
* cb.query().<span style="color: #FD4747">unionAll</span>(new UnionQuery<SummaryProductCB>() {
* public void query(SummaryProductCB unionCB) {
* unionCB.query().setXxx...
* }
* });
* </pre>
* @param unionQuery The query of 'union all'. (NotNull)
*/
public void unionAll(UnionQuery<SummaryProductCB> unionQuery) {
final SummaryProductCB cb = new SummaryProductCB();
cb.xsetupForUnion(this); xsyncUQ(cb); unionQuery.query(cb); xsaveUCB(cb);
final SummaryProductCQ cq = cb.query(); query().xsetUnionAllQuery(cq);
}
// ===================================================================================
// Lock Wait
// =========
public ConditionBean lockForUpdateNoWait()
{ if (xhelpIsSqlClauseOracle()) { xhelpGettingSqlClauseOracle().lockForUpdateNoWait(); } return this; }
public ConditionBean lockForUpdateWait(int waitSec)
{ if (xhelpIsSqlClauseOracle()) { xhelpGettingSqlClauseOracle().lockForUpdateWait(waitSec); } return this; }
protected boolean xhelpIsSqlClauseOracle() {
return getSqlClause() instanceof org.seasar.dbflute.cbean.sqlclause.SqlClauseOracle;
}
protected org.seasar.dbflute.cbean.sqlclause.SqlClauseOracle xhelpGettingSqlClauseOracle() {
return (org.seasar.dbflute.cbean.sqlclause.SqlClauseOracle)getSqlClause();
}
// ===================================================================================
// SetupSelect
// ===========
protected ProductStatusNss _nssProductStatus;
public ProductStatusNss getNssProductStatus() {
if (_nssProductStatus == null) { _nssProductStatus = new ProductStatusNss(null); }
return _nssProductStatus;
}
/**
* Set up relation columns to select clause. <br />
* PRODUCT_STATUS by my PRODUCT_STATUS_CODE, named 'productStatus'.
* <pre>
* SummaryProductCB cb = new SummaryProductCB();
* cb.<span style="color: #FD4747">setupSelect_ProductStatus()</span>; <span style="color: #3F7E5E">// ...().with[nested-relation]()</span>
* cb.query().setFoo...(value);
* SummaryProduct summaryProduct = summaryProductBhv.selectEntityWithDeletedCheck(cb);
* ... = summaryProduct.<span style="color: #FD4747">getProductStatus()</span>; <span style="color: #3F7E5E">// you can get by using SetupSelect</span>
* </pre>
* @return The set-upper of nested relation. {setupSelect...().with[nested-relation]} (NotNull)
*/
public ProductStatusNss setupSelect_ProductStatus() {
if (hasSpecifiedColumn()) { // if reverse call
specify().columnProductStatusCode();
}
doSetupSelect(new SsCall() { public ConditionQuery qf() { return query().queryProductStatus(); } });
if (_nssProductStatus == null || !_nssProductStatus.hasConditionQuery())
{ _nssProductStatus = new ProductStatusNss(query().queryProductStatus()); }
return _nssProductStatus;
}
// [DBFlute-0.7.4]
// ===================================================================================
// Specify
// =======
protected HpSpecification _specification;
/**
* Prepare for SpecifyColumn, (Specify)DerivedReferrer. <br />
* This method should be called after SetupSelect.
* <pre>
* cb.setupSelect_MemberStatus(); <span style="color: #3F7E5E">// should be called before specify()</span>
* cb.specify().columnMemberName();
* cb.specify().specifyMemberStatus().columnMemberStatusName();
* cb.specify().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.specify().columnPurchaseDatetime();
* subCB.query().set...
* }
* }, aliasName);
* </pre>
* @return The instance of specification. (NotNull)
*/
public HpSpecification specify() {
assertSpecifyPurpose();
if (_specification == null) { _specification = new HpSpecification(this
, new HpSpQyCall<SummaryProductCQ>() {
public boolean has() { return true; }
public SummaryProductCQ qy() { return getConditionQuery(); }
}
, _purpose, getDBMetaProvider()); }
return _specification;
}
public HpColumnSpHandler localSp() {
return specify();
}
public boolean hasSpecifiedColumn() {
return _specification != null && _specification.isAlreadySpecifiedRequiredColumn();
}
public static class HpSpecification extends HpAbstractSpecification<SummaryProductCQ> {
protected ProductStatusCB.HpSpecification _productStatus;
public HpSpecification(ConditionBean baseCB, HpSpQyCall<SummaryProductCQ> qyCall
, HpCBPurpose purpose, DBMetaProvider dbmetaProvider)
{ super(baseCB, qyCall, purpose, dbmetaProvider); }
/**
* PRODUCT_ID: {PK, NotNull, NUMBER(16)}
* @return The information object of specified column. (NotNull)
*/
public HpSpecifiedColumn columnProductId() { return doColumn("PRODUCT_ID"); }
/**
* PRODUCT_NAME: {NotNull, VARCHAR2(50)}
* @return The information object of specified column. (NotNull)
*/
public HpSpecifiedColumn columnProductName() { return doColumn("PRODUCT_NAME"); }
/**
* PRODUCT_STATUS_CODE: {NotNull, CHAR(3), FK to PRODUCT_STATUS}
* @return The information object of specified column. (NotNull)
*/
public HpSpecifiedColumn columnProductStatusCode() { return doColumn("PRODUCT_STATUS_CODE"); }
/**
* LATEST_PURCHASE_DATETIME: {TIMESTAMP(3)(11, 3)}
* @return The information object of specified column. (NotNull)
*/
public HpSpecifiedColumn columnLatestPurchaseDatetime() { return doColumn("LATEST_PURCHASE_DATETIME"); }
public void everyColumn() { doEveryColumn(); }
public void exceptRecordMetaColumn() { doExceptRecordMetaColumn(); }
@Override
protected void doSpecifyRequiredColumn() {
columnProductId(); // PK
if (qyCall().qy().hasConditionQueryProductStatus()
|| qyCall().qy().xgetReferrerQuery() instanceof ProductStatusCQ) {
columnProductStatusCode(); // FK or one-to-one referrer
}
}
@Override
protected String getTableDbName() { return "SUMMARY_PRODUCT"; }
/**
* Prepare to specify functions about relation table. <br />
* PRODUCT_STATUS by my PRODUCT_STATUS_CODE, named 'productStatus'.
* @return The instance for specification for relation table to specify. (NotNull)
*/
public ProductStatusCB.HpSpecification specifyProductStatus() {
assertRelation("productStatus");
if (_productStatus == null) {
_productStatus = new ProductStatusCB.HpSpecification(_baseCB, new HpSpQyCall<ProductStatusCQ>() {
public boolean has() { return _qyCall.has() && _qyCall.qy().hasConditionQueryProductStatus(); }
public ProductStatusCQ qy() { return _qyCall.qy().queryProductStatus(); } }
, _purpose, _dbmetaProvider);
if (xhasSyncQyCall()) { // inherits it
_productStatus.xsetSyncQyCall(new HpSpQyCall<ProductStatusCQ>() {
public boolean has() { return xsyncQyCall().has() && xsyncQyCall().qy().hasConditionQueryProductStatus(); }
public ProductStatusCQ qy() { return xsyncQyCall().qy().queryProductStatus(); }
});
}
}
return _productStatus;
}
/**
* Prepare for (Specify)MyselfDerived (SubQuery).
* @return The object to set up a function for myself table. (NotNull)
*/
public HpSDRFunction<SummaryProductCB, SummaryProductCQ> myselfDerived() {
assertDerived("myselfDerived"); if (xhasSyncQyCall()) { xsyncQyCall().qy(); } // for sync (for example, this in ColumnQuery)
return new HpSDRFunction<SummaryProductCB, SummaryProductCQ>(_baseCB, _qyCall.qy(), new HpSDRSetupper<SummaryProductCB, SummaryProductCQ>() {
public void setup(String function, SubQuery<SummaryProductCB> subQuery, SummaryProductCQ cq, String aliasName, DerivedReferrerOption option) {
cq.xsmyselfDerive(function, subQuery, aliasName, option); } }, _dbmetaProvider);
}
}
// [DBFlute-0.9.5.3]
// ===================================================================================
// ColumnQuery
// ===========
/**
* Set up column-query. {column1 = column2}
* <pre>
* <span style="color: #3F7E5E">// where FOO < BAR</span>
* cb.<span style="color: #FD4747">columnQuery</span>(new SpecifyQuery<SummaryProductCB>() {
* public void query(SummaryProductCB cb) {
* cb.specify().<span style="color: #FD4747">columnFoo()</span>; <span style="color: #3F7E5E">// left column</span>
* }
* }).lessThan(new SpecifyQuery<SummaryProductCB>() {
* public void query(SummaryProductCB cb) {
* cb.specify().<span style="color: #FD4747">columnBar()</span>; <span style="color: #3F7E5E">// right column</span>
* }
* }); <span style="color: #3F7E5E">// you can calculate for right column like '}).plus(3);'</span>
* </pre>
* @param leftSpecifyQuery The specify-query for left column. (NotNull)
* @return The object for setting up operand and right column. (NotNull)
*/
public HpColQyOperand<SummaryProductCB> columnQuery(final SpecifyQuery<SummaryProductCB> leftSpecifyQuery) {
return new HpColQyOperand<SummaryProductCB>(new HpColQyHandler<SummaryProductCB>() {
public HpCalculator handle(SpecifyQuery<SummaryProductCB> rightSp, String operand) {
return xcolqy(xcreateColumnQueryCB(), xcreateColumnQueryCB(), leftSpecifyQuery, rightSp, operand);
}
});
}
protected SummaryProductCB xcreateColumnQueryCB() {
SummaryProductCB cb = new SummaryProductCB();
cb.xsetupForColumnQuery((SummaryProductCB)this);
return cb;
}
// ===================================================================================
// Dream Cruise
// ============
/**
* Welcome to the Dream Cruise for condition-bean deep world. <br />
* This is very specialty so you can get the frontier spirit. Bon voyage!
* @return The condition-bean for dream cruise, which is linked to main condition-bean.
*/
public SummaryProductCB dreamCruiseCB() {
SummaryProductCB cb = new SummaryProductCB();
cb.xsetupForDreamCruise((SummaryProductCB) this);
return cb;
}
protected ConditionBean xdoCreateDreamCruiseCB() {
return dreamCruiseCB();
}
// [DBFlute-0.9.6.3]
// ===================================================================================
// OrScopeQuery
// ============
/**
* Set up the query for or-scope. <br />
* (Same-column-and-same-condition-key conditions are allowed in or-scope)
* <pre>
* <span style="color: #3F7E5E">// where (FOO = '...' or BAR = '...')</span>
* cb.<span style="color: #FD4747">orScopeQuery</span>(new OrQuery<SummaryProductCB>() {
* public void query(SummaryProductCB orCB) {
* orCB.query().setFOO_Equal...
* orCB.query().setBAR_Equal...
* }
* });
* </pre>
* @param orQuery The query for or-condition. (NotNull)
*/
public void orScopeQuery(OrQuery<SummaryProductCB> orQuery) {
xorSQ((SummaryProductCB)this, orQuery);
}
/**
* Set up the and-part of or-scope. <br />
* (However nested or-scope query and as-or-split of like-search in and-part are unsupported)
* <pre>
* <span style="color: #3F7E5E">// where (FOO = '...' or (BAR = '...' and QUX = '...'))</span>
* cb.<span style="color: #FD4747">orScopeQuery</span>(new OrQuery<SummaryProductCB>() {
* public void query(SummaryProductCB orCB) {
* orCB.query().setFOO_Equal...
* orCB.<span style="color: #FD4747">orScopeQueryAndPart</span>(new AndQuery<SummaryProductCB>() {
* public void query(SummaryProductCB andCB) {
* andCB.query().setBar_...
* andCB.query().setQux_...
* }
* });
* }
* });
* </pre>
* @param andQuery The query for and-condition. (NotNull)
*/
public void orScopeQueryAndPart(AndQuery<SummaryProductCB> andQuery) {
xorSQAP((SummaryProductCB)this, andQuery);
}
// ===================================================================================
// DisplaySQL
// ==========
@Override
protected SqlAnalyzerFactory getSqlAnalyzerFactory()
{ return new ImplementedInvokerAssistant().assistSqlAnalyzerFactory(); }
@Override
protected String getLogDateFormat() { return DBFluteConfig.getInstance().getLogDateFormat(); }
@Override
protected String getLogTimestampFormat() { return DBFluteConfig.getInstance().getLogTimestampFormat(); }
// ===================================================================================
// Meta Handling
// =============
public boolean hasUnionQueryOrUnionAllQuery() {
return query().hasUnionQueryOrUnionAllQuery();
}
// ===================================================================================
// Purpose Type
// ============
@Override
protected void xprepareSyncQyCall(ConditionBean mainCB) {
final SummaryProductCB cb;
if (mainCB != null) {
cb = (SummaryProductCB)mainCB;
} else {
cb = new SummaryProductCB();
}
specify().xsetSyncQyCall(new HpSpQyCall<SummaryProductCQ>() {
public boolean has() { return true; }
public SummaryProductCQ qy() { return cb.query(); }
});
}
// ===================================================================================
// Internal
// ========
// very internal (for suppressing warn about 'Not Use Import')
protected String getConditionBeanClassNameInternally() { return SummaryProductCB.class.getName(); }
protected String getConditionQueryClassNameInternally() { return SummaryProductCQ.class.getName(); }
protected String getSubQueryClassNameInternally() { return SubQuery.class.getName(); }
protected String getConditionOptionClassNameInternally() { return ConditionOption.class.getName(); }
}
| [
"dbflute@gmail.com"
] | dbflute@gmail.com |
580ff01ca4cd4b653cbcc611c14c28b217296011 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.qqlite/assets/exlibs.1.jar/classes.jar/tencent/im/oidb/cmd0x7c4/cmd0x7c4.java | e4f694d1c09b1355cd0991c02fd2b83cb17e9757 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 275 | java | package tencent.im.oidb.cmd0x7c4;
public final class cmd0x7c4 {}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.qqlite\assets\exlibs.1.jar\classes.jar
* Qualified Name: tencent.im.oidb.cmd0x7c4.cmd0x7c4
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
d6086509660ab0480458b74443318ebe377852e0 | 8e58f55eb37a068722884d45744c57b57ce48b69 | /src/personnage/StatePacmanSuper.java | 5328817c5d817296101058af70b9fea82165a010 | [] | no_license | zeroual-nadia/Pac-Man | 50cbb4fb7a7ab1bc0d10c29a96e486dd88e87c08 | 7dcc2c16d25036ee66594691861cb63f2a3ee034 | refs/heads/master | 2023-04-03T17:20:35.572811 | 2021-04-11T19:22:20 | 2021-04-11T19:22:20 | 356,958,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package personnage;
import main.*;
public class StatePacmanSuper extends StatePacman{
public StatePacmanSuper(Pacman moi) {
super(moi);
}
public boolean estPredateur() {
return true;
}
public boolean estProie() {
return false;
}
public int getId() {
return InformationPacman.identifiantEtatPacmanSuper;
}
public int getTempState() {
return InformationPacman.tempStatePacmanSuper;
}
public int getTempDeplacementState() {
return InformationPacman.tempDeplacementPacmanSuper;
}
}
| [
"nadia1.zeroual@etu.u-pec.fr"
] | nadia1.zeroual@etu.u-pec.fr |
41a971fabf7ffcd2e5c377fa3d88efd5f964f679 | 890e0c1a0e19180a989613cdcc2e76ab4ea49984 | /src/sem2/pbo/praktikum/praktikum7/Hitung.java | 7d4dbc7ad561cae306eb488bb8f72781f19fca09 | [
"MIT"
] | permissive | zafflen528/Tugas-Kuliah-Setumpuk | 0c57ade88b255706a2d79a1f8e741eb940c2f962 | bbc8788b782300a5f39323875d2d3d17fa2dd18b | refs/heads/master | 2023-05-30T20:52:28.405720 | 2021-06-05T02:02:48 | 2021-06-05T02:02:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package sem2.pbo.praktikum.praktikum7;
public interface Hitung {
double hitungLuas();
double hitungKeliling();
double hitungSpesial();
}
| [
"loilyxtra@gmail.com"
] | loilyxtra@gmail.com |
3e305e2f25b842a4879f524f003beadbfcd3cd40 | 5d82f3ced50601af2b804cee3cf967945da5ff97 | /design-synthesis/existing-services/basiccommunicationdevice/src/main/java/org/choreos/services/BasicCommunicationDeviceImpl.java | b386a07e28d3be16d5cf15b163ba988e352a2427 | [
"Apache-2.0"
] | permissive | sesygroup/choreography-synthesis-enactment | 7f345fe7a9e0288bbde539fc373b43f1f0bd1eb5 | 6eb43ea97203853c40f8e447597570f21ea5f52f | refs/heads/master | 2022-01-26T13:20:50.701514 | 2020-03-20T12:18:44 | 2020-03-20T12:18:44 | 141,552,936 | 0 | 1 | Apache-2.0 | 2022-01-06T19:56:05 | 2018-07-19T09:04:05 | Java | UTF-8 | Java | false | false | 2,708 | java | package org.choreos.services;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jws.WebService;
import org.choreos.services.monitor.MonitorLogger;
import org.choreos.services.monitor.MonitorLoggerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.chorevolution.idm.common.types.ArtifactType;
import eu.chorevolution.idm.common.types.EventType;
@WebService(endpointInterface = "org.choreos.services.BasicCommunicationDevice")
public class BasicCommunicationDeviceImpl implements BasicCommunicationDevice{
private static Logger logger = LoggerFactory.getLogger(BasicCommunicationDeviceImpl.class);
private static MonitorLogger monitorLogger = new MonitorLoggerImpl();
protected Map<String, String> address = new HashMap<String, String>();
public void scenarioSetup() {
monitorLogger.sendToMonitor();
}
public void setEndpointAddress(String address) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void setInvocationAddress(String role, String name, List<String> endpoints) {
logger.info("PERFORM -- setInvocationAddress - parameters: role: "+(role.isEmpty()?"isEmpty parameter":role)+" - name: "+(name.isEmpty()?"isEmpty parameter":name)+" - endpoints[0]: "+(endpoints.get(0).isEmpty()?"isEmpty parameter":endpoints.get(0)));
if (address.containsKey(role)) {
address.remove(role);
}
address.put(role, endpoints.get(0));
}
public void basicCommDeviceSubscribe(String sessionId) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void basicCommDeviceUnsubscribe(String sessionId) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void bcdReceiveSms(String sessionId, SMSMessage msg) throws ScenarioException_Exception {
monitorLogger.sendEventData("WP7", Long.parseLong(sessionId), "BasicCommunicationDevice", ArtifactType.SERVICE, "BasicCommunicationDevice", "S36","S37", "bcd_receive_sms", null, EventType.RECEIVING_REQUEST, System.currentTimeMillis());
// TODO
logger.info("PERFORM -- BasicCommunicationDevice.bcdReceiveSms(String sessionId, SMSMessage msg)");
monitorLogger.sendEventData("WP7", Long.parseLong(sessionId), "BasicCommunicationDevice", ArtifactType.SERVICE, "BasicCommunicationDevice", "S36","S37", "bcd_receive_sms", null, EventType.REPLY_RESPONSE, System.currentTimeMillis());
}
}
| [
"alexander.perucci@gmail.com"
] | alexander.perucci@gmail.com |
0e0dfcf675fb9e64036240b13f848ed56b87e081 | 302a44d894645a1707a476a3b51d6050c8caf1a6 | /mq/springboot-redis-cluster/src/test/java/com/fsl/rediscluster/RedisClusterApplicationTests.java | 4eace33f9d085e652296a5f4247a85013a8dff13 | [] | no_license | yeasincode/tuling-shop | 0a3d6287a5765331e366bbc64218340584b2d117 | 620fe7fe8e7009679810ac6bc8a2151aa0eebd44 | refs/heads/master | 2020-12-04T04:47:17.030362 | 2020-01-03T18:29:58 | 2020-01-03T18:29:58 | 231,618,246 | 0 | 0 | null | 2020-01-03T15:48:55 | 2020-01-03T15:48:54 | null | UTF-8 | Java | false | false | 343 | java | package com.fsl.rediscluster;
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 RedisClusterApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"503693631@qq.com"
] | 503693631@qq.com |
101e798425c66e37aca6fe14a57365fe9ed56be3 | 3487b8b5adc8e0b2f42fd2723f8c91edaf5ada5c | /src/main/java/com/org/tutorial/controller/StudentController.java | ef9f57fc791037fb7aee6d9ed2b142f83712aead | [] | no_license | hackerpandit-coder/SpringBoot-CrudOperation | 068ecca258bb3f5c6ebee232b4e447acd0b30f04 | 6c3c321c6293a32384b6f03292405c9896cecfee | refs/heads/master | 2022-10-06T05:22:50.692288 | 2020-05-30T13:47:41 | 2020-05-30T13:47:41 | 266,349,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,359 | java | package com.org.tutorial.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.org.tutorial.common.ResponseObject;
import com.org.tutorial.model.StudentModel;
@RestController
public class StudentController {
@Autowired
private ResponseObject response;
@GetMapping("getName")
public String getName() {
return "Golden Boy";
}
@GetMapping("getStudent")
public ResponseObject getStudent() {
response.addData("First",getModel());
response.addData("Second",getModel());
response.addData("Third",getModel());
return response;
}
@GetMapping("getListOfStudent")
public ResponseObject getList() {
List<StudentModel> list = new ArrayList<>();
list.add(getModel());
list.add(getModel());
list.add(getModel());
list.add(getModel());
list.add(getModel());
list.add(getModel());
list.add(getModel());
response.addData("listOfStudent",list);
return response;
}
@GetMapping("getModel")
public StudentModel getModel() {
StudentModel model = new StudentModel();
model.setId(12);
model.setName("ramesh");
model.setAddress("kalipur");
model.setNumber(986781010);
return model;
}
}
| [
"virendramishra1995@gmail.com"
] | virendramishra1995@gmail.com |
6c57f5a932902619df5aa53c2166116e1f409579 | 8238896640cfae97218263983fc3bc1540ffc201 | /src/churchencoding/Tuple.java | c8add85aab07410a830ecb886ed8a8e596941422 | [] | no_license | smw1988/lambdacalculus | f81db295efd143ff1389f28716d279595a1619e1 | 5ce3c50b55d0357b682308d4b536d2521cc67c65 | refs/heads/master | 2020-03-28T19:12:22.341381 | 2018-09-23T05:08:23 | 2018-09-23T05:08:23 | 148,954,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package churchencoding;
import java.util.function.Function;
public interface Tuple<T1, T2> extends Function<Bool, Object> {
public static <T1, T2> Tuple<T1, T2> cons(T1 t1, T2 t2) {
return f -> f.apply(t1).apply(t2);
}
@SuppressWarnings("unchecked")
default T1 car() {
return (T1) this.apply(Bool.TRUE);
}
@SuppressWarnings("unchecked")
default T2 cdr() {
return (T2) this.apply(Bool.FALSE);
}
}
| [
"43306698+smw1988@users.noreply.github.com"
] | 43306698+smw1988@users.noreply.github.com |
2325b12bb3f1d7e6cbad0bbfded6085ca66304c0 | b213c0ecab539eea0bd1a9487a1d2187b583f086 | /src/main/java/com/tenfen/weixin/vo/recv/WxRecvMsg.java | d8fb06602d11b7ff4f612f478bcbf0c018a67843 | [] | no_license | yangjinbo47/flux | dd3df45e363b3b98c7b2933b2e1ef0a6a229fca6 | 0270e39e7ff045b37b8c2325baf286c2916c1cda | refs/heads/master | 2020-05-29T15:41:05.020638 | 2019-01-04T04:27:00 | 2019-01-04T04:27:00 | 68,091,529 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | package com.tenfen.weixin.vo.recv;
import com.tenfen.weixin.vo.WxMsg;
public class WxRecvMsg extends WxMsg {
private String msgId;
public WxRecvMsg(String toUser,String fromUser,String createDt,String msgType,String msgId) {
super(toUser, fromUser, createDt, msgType);
this.msgId= msgId;
}
public WxRecvMsg(WxRecvMsg msg) {
this(msg.getToUser(),msg.getFromUser(),msg.getCreateDt(),msg.getMsgType(),msg.getMsgId());
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
}
| [
"yangjinbo47@sina.com"
] | yangjinbo47@sina.com |
5907afa0c6d021c5a72d8080b5fabed918188599 | 7241c3116c783181bde7be7c4e77e78e97324956 | /library/src/main/java/com/ekuaizhi/library/http/callback/Callback.java | d6b7e03112afe22702757e5ce98935207f872c37 | [] | no_license | suwan1234/AMovie | 2c3c23c4c4e115277fec07764318634c627210b3 | 09e2c05132095252c20e1d9b3f7c256f4b1b96f2 | refs/heads/master | 2021-01-17T05:50:39.548742 | 2016-03-01T04:59:31 | 2016-03-01T04:59:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,383 | java | package com.ekuaizhi.library.http.callback;
import com.ekuaizhi.library.data.model.DataResult;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
public abstract class Callback<T> {
/**
* UI Thread
*
* @param request
*/
public void onBefore(Request request) {
}
/**
* UI Thread
*
* @param
*/
public void onAfter() {
}
/**
* UI Thread
*
* @param progress
*/
public void inProgress(float progress) {
}
/**
* Thread Pool Thread
*
* @param response
*/
public abstract T parseNetworkResponse(Response response) throws IOException;
public abstract void onError(Request request, Exception e);
public abstract T onErrors(Request request, Exception e);
public abstract void onResponse(T response);
public static Callback CALLBACK_DEFAULT = new Callback() {
@Override
public Object parseNetworkResponse(Response response) throws IOException {
return null;
}
@Override
public void onError(Request request, Exception e) {
}
@Override
public void onResponse(Object response) {
}
@Override
public Object onErrors(Request request, Exception e) {
return null;
}
};
} | [
"lv.min@i-ho.com.cn"
] | lv.min@i-ho.com.cn |
55209975a51a0e6bab9e99cad3d5ccf9111bdf49 | ecaf04efa0b3a445868352cf6c3eed7388380d0f | /KILL_BOREDOM/app/src/androidTest/java/rj/kill_boredom/ExampleInstrumentedTest.java | 545f508a9cfc2ac444b0d550c1fc280de4b3eed3 | [] | no_license | romalrj/project1 | 2a90116732a39600122eaf927d745d7ffba167ca | 6276e3f49dee543809ad800edabcedda998a5a09 | refs/heads/master | 2021-01-18T20:11:01.543928 | 2016-10-02T06:56:05 | 2016-10-02T06:56:05 | 69,761,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | package rj.kill_boredom;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("rj.kill_boredom", appContext.getPackageName());
}
}
| [
"romalrj07@gmail.com"
] | romalrj07@gmail.com |
0460be0e61bd85d5d8b0523ced6ba9c544b7c5b5 | 0529524c95045b3232f6553d18a7fef5a059545e | /app/src/androidTest/java/TestCase_com_arabicbible_moroccobible__1328298238.java | aefa835573f765bde4c4c9dd68e2fd0cafee1c7b | [] | no_license | sunxiaobiu/BasicUnitAndroidTest | 432aa3e10f6a1ef5d674f269db50e2f1faad2096 | fed24f163d21408ef88588b8eaf7ce60d1809931 | refs/heads/main | 2023-02-11T21:02:03.784493 | 2021-01-03T10:07:07 | 2021-01-03T10:07:07 | 322,577,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | import android.graphics.RectF;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class TestCase_com_arabicbible_moroccobible__1328298238 {
@Test
public void testCase() throws Exception {
RectF var1 = new RectF();
boolean var2 = var1.isEmpty();
}
}
| [
"sunxiaobiu@gmail.com"
] | sunxiaobiu@gmail.com |
7d5aa4d47e0f1158ed43e24aec21d3267b51a12d | 3379a74c78b05f4093826a307af7e6f3eb18da84 | /src/com/assignment/FilterPlays.java | 5f7fc8894e1e5f80238c44e74825f5dcfafc49f1 | [] | no_license | naveensdev/Part-1 | 480fd70aeefc9e304d5cb76db7155f3a7df3e628 | 9407037e6ad53c0394ffbe914ba1ffd63ae15634 | refs/heads/master | 2020-05-24T01:34:08.177075 | 2017-03-13T09:51:08 | 2017-03-13T09:51:08 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,382 | java | package com.assignment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
/*check to see if they show up after clicking “Filter Plays” on this page . If ALL of the filters listed below show up, then the test passes*/
public class FilterPlays {
public static void main(String[] args) {
/* System.setProperty("webdriver.gecko.driver", "C:\\geckodriver-v0.13.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();*/
System.setProperty("webdriver.chrome.driver","D:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("https://v2-pre-prod-app.krossover.com/intelligence/games/9603/breakdown");
//String[] listToVerify = {"Free Throws","Defense","Rebounds","Time Period","Top Searches","Shooting","Fouls","Turnovers"};
driver.findElement(By.xpath("//*[@id='plays-filter-dropdown-toggle-cta']/span[2]/i")).click();
ArrayList<String> list=new ArrayList<String>();//Creating arraylist
list.add("Free Throws");//Adding object in arraylist
list.add("Defense");
list.add("Rebounds");
list.add("Time Period");
list.add("Top Searches");
list.add("Shooting");
list.add("Fouls");
list.add("Turnovers");
//sSystem.out.println(list);
ArrayList<String> list2=new ArrayList<String>();
java.util.List<WebElement> List = driver.findElements(By.xpath("//li[2][@class='force-scrollbar']/div"));
for(int i=0;i<List.size();i++)
{
list2.add(List.get(i).getText());
//System.out.println(List.get(i).getText());
}
/* String orig[] = { "a", "b", "b", "c" };
String act[] = { "x", "b", "b", "y" };*/
List origList = new ArrayList(Arrays.asList(List));
List actList = Arrays.asList(list);
origList.retainAll(actList);
System.out.println(origList);
boolean flag=list2.containsAll(list);
System.out.println(flag);
}
}
| [
"naveensdev18@gmail.com"
] | naveensdev18@gmail.com |
b922dddb81c9168fb4d295d36e150f5b929066a9 | 43e133763e91f93018c6269771be7eb7a0132914 | /demo/src/main/java/demo/controller/table/ComplexTabelController.java | e5ddcfb6f73b623b586497b78f64f6985c8c2b32 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | blade-wings/beanui | 2dcca2093b662d924cb2506caca753e736ca5f7f | e1eae4b0bac326cdcfa85e8074a05e11b616eadb | refs/heads/master | 2022-01-27T07:32:40.360579 | 2018-11-23T13:19:12 | 2018-11-23T13:19:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,140 | java | package demo.controller.table;
import demo.view.table.complex.ComplexTableDataForm;
import demo.view.table.complex.ComplexTableEditForm;
import demo.view.table.complex.ComplexRow;
import org.december.beanui.element.Type;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/complex-table")
public class ComplexTabelController {
@RequestMapping(value = "/init-complex-table-data-form", method = RequestMethod.GET)
public ComplexTableDataForm initComplexTableDataForm() {
List<ComplexRow> tableData = new ArrayList<ComplexRow>();
ComplexRow complexRow = new ComplexRow();
complexRow.setId("1");
complexRow.setDate("2013-11-21 10:24");
complexRow.setTitle("Ulcycm Btktiti Nvssyf Utlpwph Dpvhlhftv Vksoo Bssyduiu Ojryewq");
complexRow.setAuthor("Jeffrey");
complexRow.setImportance(3);
complexRow.setReadings(3788);
complexRow.setStatus("deleted");
complexRow.setStatusType(Type.DANGER);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("1");
complexRow.setDate("1987-12-25 16:33");
complexRow.setTitle("Axnzqhehl Ldtjxdol Qxownrydo Jrdsqoyau Eonlhk");
complexRow.setAuthor("William");
complexRow.setReadings(2264);
complexRow.setStatus("draft");
complexRow.setStatusType(Type.WARNING);
complexRow.setImportance(1);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setImportance(1);
complexRow.setId("2");
complexRow.setDate("2007-06-05 05:59");
complexRow.setTitle("Xkgebkwj Vscaedii Lmjrhna Dsht Pokxn Rczgc");
complexRow.setAuthor("William");
complexRow.setReadings(3712);
complexRow.setStatus("draft");
complexRow.setStatusType(Type.WARNING);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setImportance(2);
complexRow.setId("3");
complexRow.setDate("1977-07-11 11:17");
complexRow.setTitle("Djjh Tunw Jqxk Evht Sdltrab Vumox Uqdfvt");
complexRow.setAuthor("Steven");
complexRow.setReadings(2078);
complexRow.setStatus("published");
complexRow.setStatusType(Type.SUCCESS);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setImportance(4);
complexRow.setId("4");
complexRow.setDate("1971-08-30 09:40");
complexRow.setTitle("Ezkj Efkqcyv Vmhv Sbtzxcfmv Ztwbeczpg Fwm");
complexRow.setAuthor("Scott");
complexRow.setReadings(4194);
complexRow.setStatus("draft");
complexRow.setStatusType(Type.WARNING);
complexRow.setImportance(1);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("5");
complexRow.setDate("1985-04-05 09:16");
complexRow.setTitle("Oeojqizd Ssoivufs Ostvtdqr Wgsscb Pbxyfrwq");
complexRow.setAuthor("Elizabeth");
complexRow.setReadings(1620);
complexRow.setStatus("draft");
complexRow.setStatusType(Type.WARNING);
complexRow.setImportance(2);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("6");
complexRow.setDate("1997-01-24 04:49");
complexRow.setTitle("Kekizewghb Sngorv Gmlxneg Vzlyetuc Fmanyepm Ggcuiuok");
complexRow.setAuthor("Robert");
complexRow.setReadings(2565);
complexRow.setStatus("published");
complexRow.setStatusType(Type.SUCCESS);
complexRow.setImportance(1);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("7");
complexRow.setDate("2016-03-01 12:32");
complexRow.setTitle("Exohuw Yqmu Lqcxqzcx Vkyjui Dryakkn Rczbfh Sshf Ntbklto Qounhwjg");
complexRow.setAuthor("Thomas");
complexRow.setReadings(3080);
complexRow.setStatus("published");
complexRow.setStatusType(Type.SUCCESS);
complexRow.setImportance(5);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("8");
complexRow.setDate("1983-06-22 01:18");
complexRow.setTitle("Daf Sqvf Jtusdk Inq Hoiptyu Oibxzjd");
complexRow.setAuthor("Sarah");
complexRow.setReadings(3964);
complexRow.setStatus("deleted");
complexRow.setStatusType(Type.DANGER);
complexRow.setImportance(3);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("9");
complexRow.setDate("1996-06-06 08:17");
complexRow.setTitle("Gbhmmqtd Kufwjwc Eggv Ueuamyq Mqwkmsejy");
complexRow.setAuthor("Michelle");
complexRow.setReadings(4339);
complexRow.setStatus("published");
complexRow.setStatusType(Type.SUCCESS);
complexRow.setImportance(1);
tableData.add(complexRow);
complexRow = new ComplexRow();
complexRow.setId("10");
complexRow.setDate("2001-11-06 23:31");
complexRow.setTitle("Klhpoius Lrsodzaw Tnrvio Ggfjkvb Afansgeqp Uvkbaxbyg Tzphjxwg");
complexRow.setAuthor("Donna");
complexRow.setReadings(1911);
complexRow.setStatus("deleted");
complexRow.setStatusType(Type.DANGER);
complexRow.setImportance(5);
tableData.add(complexRow);
ComplexTableDataForm complexTableDataForm = new ComplexTableDataForm();
complexTableDataForm.setTableData(tableData);
return complexTableDataForm;
}
@RequestMapping(value = "/init-complex-table-edit-form", method = RequestMethod.GET)
public ComplexTableEditForm initComplexTableEditForm() {
ComplexTableEditForm complexTableEditForm = new ComplexTableEditForm();
complexTableEditForm.setShow(true);
return complexTableEditForm;
}
}
| [
"595914343@qq.com"
] | 595914343@qq.com |
a8fd42fb83df96602883bcf1acf1c89d4b02a76d | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-13372-5-10-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/doc/XWikiDocument_ESTest.java | aa9933b0063e2506ca0fe907f92aaa917594df17 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | /*
* This file was automatically generated by EvoSuite
* Wed Apr 08 06:29:11 UTC 2020
*/
package com.xpn.xwiki.doc;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class XWikiDocument_ESTest extends XWikiDocument_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
e948ece55c76dd8ce5de3dafcf61b76f0704fa7f | 438fcb61810aac1ba8c456c32b6ff5e2bf91fd6b | /src/java/servlets/AddEventsFurther.java | b7c02cfc372641199981df130a78ab46a2e9c666 | [] | no_license | tre3nzalor3/repo | beb5cb9ac0eb90df548186dd640f58b38adb783a | cfaf0dd4c70f9edb07a2a7c58c57694f5f439d0d | refs/heads/master | 2021-01-20T17:03:01.242989 | 2017-02-28T02:15:40 | 2017-02-28T02:15:40 | 82,856,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | package servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import connBAZA.EventsDao;
import javax.servlet.annotation.WebServlet;
/**
*
* @author sienki
*/
@WebServlet("/AddEventsFurther")
public class AddEventsFurther extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
EventsDao event = new EventsDao();
String tytul = request.getParameter("Tytul");
String data = request.getParameter("Data");
String opis = request.getParameter("Opis");
event.createEvents(tytul,data,opis);
session.setAttribute("content", "DodanoNewsa.jsp");
response.sendRedirect("AdminIndex.jsp");
}
}
| [
"sienki14@o2.pl"
] | sienki14@o2.pl |
bc2629d7322e05176e6822c53c5c87ef3c69546f | adabaf9e85db0383a1cd4335a733367463b92289 | /3.JavaMultithreading/src/com/javarush/task/task25/task2503/Column.java | 3f9f3ed8f2983c892250582f798eec082ef18cff | [] | no_license | rossi23891/JavaRushTasks | 8bc8c64a3e2c6ca8028c2d90eabaef3ef666eb9a | 0250c3c16fb4f973b8c54c4a1400bc7b9679196f | refs/heads/master | 2021-07-08T21:17:46.607861 | 2020-08-16T19:38:10 | 2020-08-16T19:38:10 | 177,397,671 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,847 | java | package com.javarush.task.task25.task2503;
import java.util.*;
public enum Column implements Columnable{
Customer("Customer"),
BankName("Bank Name"),
AccountNumber("Account Number"),
Amount("Available Amount");
private String columnName;
private static int[] realOrder;
private Column(String columnName) {
this.columnName = columnName;
}
/**
* Задает новый порядок отображения колонок, который хранится в массиве realOrder.
* realOrder[индекс в энуме] = порядок отображения; -1, если колонка не отображается.
*
* @param newOrder новая последовательность колонок, в которой они будут отображаться в таблице
* @throws IllegalArgumentException при дубликате колонки
*/
public static void configureColumns(Column... newOrder) {
realOrder = new int[values().length];
for (Column column : values()) {
realOrder[column.ordinal()] = -1;
boolean isFound = false;
for (int i = 0; i < newOrder.length; i++) {
if (column == newOrder[i]) {
if (isFound) {
throw new IllegalArgumentException("Column '" + column.columnName + "' is already configured.");
}
realOrder[column.ordinal()] = i;
isFound = true;
}
}
}
}
/**
* Вычисляет и возвращает список отображаемых колонок в сконфигурированом порядке (см. метод configureColumns)
* Используется поле realOrder.
*
* @return список колонок
*/
public static List<Column> getVisibleColumns() {
List<Column> result = new LinkedList<>();
Map<Integer,Column> mapCol = new TreeMap<>();
Column[]array = Column.values();
for (int i = 0; i < realOrder.length ; i++) {
if(realOrder[i]!=-1){
mapCol.put(realOrder[i],array[i]);
}
}
Collection<Column> columnCollection = mapCol.values();
result.addAll(columnCollection);
return result;
}
@Override
public String getColumnName() {
return this.columnName;
}
@Override
public boolean isShown() {
return realOrder[ordinal()]>-1;
}
@Override
public void hide() {
int temp = realOrder[ordinal()];
realOrder[ordinal()]=-1;
for (int i = 0; i < realOrder.length; i++) {
if (realOrder[i]>temp){
realOrder[i]--;
}
}
}
}
| [
"rossi23891@gmail.com"
] | rossi23891@gmail.com |
2a7525a114921bb86ea7940f5b5b613666eaddc4 | 7458cf7f5fd5bf1afe0d17c99bd021b34b66aec0 | /src/com/gupaoedu/observer/useguava/Gper.java | 682739be1c97605e6523f27b8dbb809824bd32d8 | [] | no_license | roganluo2/design-patterns | 1c1bb072f405836e1c061f15cae10f6b3cfc05ab | c9876a7452622710135d854d5984971a228850de | refs/heads/master | 2020-04-27T20:28:15.452711 | 2019-04-18T05:48:31 | 2019-04-18T05:48:31 | 174,659,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | package com.gupaoedu.observer.useguava;
import com.google.common.collect.Lists;
import com.google.common.eventbus.EventBus;
/**
* Created by 召君王 on 2019/3/24.
*/
public class Gper {
private String name = "GPer生态圈";
public String getName() {
return name;
}
private Gper(){}
public static Gper getInstance(){
return InnerSingleton.instance;
}
private static class InnerSingleton{
private static Gper instance = new Gper();
}
public void publishQuestion( Question question)
{
System.out.println(question.getUsername() + "在" + this.name + "上提交了一个问题");
Lists.newArrayList();
EventBus eventBus = new EventBus();
EventListener eventListener = new EventListener();
eventBus.register(eventListener);
eventBus.post(question);
}
}
| [
"lzj8908@163.com"
] | lzj8908@163.com |
54ebdc7bf9f2c0698fe4f8d3e775661e505674fb | c496ea6397c9d1401392129cdaa52e941870fc75 | /MyDailyReport/app/src/main/java/bean/ZhBaseBean.java | 706242f2644faf8d39b86491463833cdbac4f69d | [
"MIT"
] | permissive | KKaKa/MyDailyReport | 640dd74e1e55f33a4924c6956480df681dc2b7fe | 3c3b055cbb1a538018d844131f4ad61c4995a731 | refs/heads/master | 2021-06-24T18:41:42.577918 | 2017-09-13T16:43:41 | 2017-09-13T16:43:41 | 103,413,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,782 | java | package bean;
import java.util.List;
/**
* Created by Administrator on 2017/9/6 0006.
*/
public class ZhBaseBean {
/**
* date : 20170905
* stories : [{"images":["https://pic4.zhimg.com/v2-ae5d75c24876a99d0aca0f503997fa53.jpg"],"type":0,"id":9602927,"ga_prefix":"090522","title":"小事 · 网吧里的人"},{"images":["https://pic1.zhimg.com/v2-ea36674a8111143a54c21872b5064a08.jpg"],"type":0,"id":9601753,"ga_prefix":"090521","title":"弱者在监狱中成长为黑帮大佬的故事,这有两个版本"},{"images":["https://pic4.zhimg.com/v2-684026cb3fdc5a2dbdf455c415bdfe13.jpg"],"type":0,"id":9594552,"ga_prefix":"090520","title":"又到无花果上市的季节了,料理一下,味道外貌都美得不行"},{"images":["https://pic3.zhimg.com/v2-abd85db54719c32f872dfde8a5053eca.jpg"],"type":0,"id":9602741,"ga_prefix":"090519","title":"热衷升级打怪、玄幻修真的网络小说是文学吗?"},{"images":["https://pic1.zhimg.com/v2-4b403aab5f1728ca8dcc81cb3b8d7bc0.jpg"],"type":0,"id":9601540,"ga_prefix":"090518","title":"所谓「最省油时速」的说法,有道理吗?"},{"images":["https://pic2.zhimg.com/v2-acae454054bfc52e1cc69cdf97fbcc71.jpg"],"type":0,"id":9602947,"ga_prefix":"090517","title":"俏江南倒了,湘鄂情和金钱豹也倒了,曾经的中高端餐厅接二连三地倒闭了"},{"images":["https://pic3.zhimg.com/v2-bffc2e5893738754d729a22118a0fc1a.jpg"],"type":0,"id":9602951,"ga_prefix":"090515","title":"要求剖腹产,家属不让,孕妇选择跳楼身亡实在是场悲剧"},{"images":["https://pic3.zhimg.com/v2-af0713cd564fdeeccba206d1f486aafe.jpg"],"type":0,"id":9602576,"ga_prefix":"090515","title":"「买我东西的,就是城市新中产;不买的,就是民工」"},{"images":["https://pic2.zhimg.com/v2-2682ed99669fb6da4378c2a01693fd19.jpg"],"type":0,"id":9602823,"ga_prefix":"090514","title":"被孩子的「为什么为什么为什么」问得焦头烂额,忍住,千万忍住"},{"images":["https://pic4.zhimg.com/v2-454c3fc3cc2360693b67948c31f9be57.jpg"],"type":0,"id":9602668,"ga_prefix":"090514","title":"央行等七部委一纸令下,还想再拿它来一夜暴富?别想了"},{"images":["https://pic4.zhimg.com/v2-9560ffc8a26a4b65e98095babecdd0a3.jpg"],"type":0,"id":9602172,"ga_prefix":"090512","title":"大误 · 同学们,证明科研水平的时候到了"},{"images":["https://pic3.zhimg.com/v2-0cf6a20d574df929c06da7a781906276.jpg"],"type":0,"id":9601796,"ga_prefix":"090511","title":"认清现实吧,我们的音乐教育实在是太差了"},{"images":["https://pic2.zhimg.com/v2-9ee1297b6533da7f199b916094244a81.jpg"],"type":0,"id":9601633,"ga_prefix":"090510","title":"总爱信誓旦旦立下各种 flag\u2026\u2026可能是个很好的习惯"},{"images":["https://pic1.zhimg.com/v2-0f82431da7eb68b1ddb059285ef01384.jpg"],"type":0,"id":9601687,"ga_prefix":"090509","title":"中国最好的大学都是哪些?2017 年,这是我们给出的排名"},{"images":["https://pic4.zhimg.com/v2-410e5d4bd67e292f8ac601413fdaa9db.jpg"],"type":0,"id":9596939,"ga_prefix":"090508","title":"偶像派变得严肃深邃,演技派不断耍宝自黑,娱乐圈还真是怪啊"},{"images":["https://pic1.zhimg.com/v2-1dad05d923a74b4f576bc786d4be6d4c.jpg"],"type":0,"id":9601654,"ga_prefix":"090507","title":"在非洲,国家队每赢一场球,留给大家打架的时间就不多了"},{"images":["https://pic1.zhimg.com/v2-309f90cc125d2dda6a4eaf5148390210.jpg"],"type":0,"id":9601539,"ga_prefix":"090507","title":"好奇心杀不死你家猫咪和狗狗,但「毒疫苗」会"},{"images":["https://pic1.zhimg.com/v2-317359511ae4c0b49e242004e98930cc.jpg"],"type":0,"id":9602169,"ga_prefix":"090507","title":"科技、金融、骗局和韭菜:中国式 ICO 财富盛宴与泡沫"},{"images":["https://pic4.zhimg.com/v2-0723c50a6a6878a57fa92d3b0a9e347f.jpg"],"type":0,"id":9599522,"ga_prefix":"090506","title":"瞎扯 · 如何正确地吐槽"}]
* top_stories : [{"image":"https://pic1.zhimg.com/v2-7cd211af8086f64bf917b9af8e5d75e0.jpg","type":0,"id":9602947,"ga_prefix":"090517","title":"俏江南倒了,湘鄂情和金钱豹也倒了,曾经的中高端餐厅接二连三地倒闭了"},{"image":"https://pic2.zhimg.com/v2-ecbf5cd0ebf0a54e5b6d8bddc011b3c1.jpg","type":0,"id":9602951,"ga_prefix":"090515","title":"要求剖腹产,家属不让,孕妇选择跳楼身亡实在是场悲剧"},{"image":"https://pic3.zhimg.com/v2-14fef8aaf78a16852970b6940f43e90e.jpg","type":0,"id":9602668,"ga_prefix":"090514","title":"央行等七部委一纸令下,还想再拿它来一夜暴富?别想了"},{"image":"https://pic2.zhimg.com/v2-7795ae292a7938baed2c0b4e4db5db91.jpg","type":0,"id":9602576,"ga_prefix":"090515","title":"「买我东西的,就是城市新中产;不买的,就是民工」"},{"image":"https://pic3.zhimg.com/v2-e1bd60730d5fc3bbcc0fa5fc6c8c31f6.jpg","type":0,"id":9602169,"ga_prefix":"090507","title":"科技、金融、骗局和韭菜:中国式 ICO 财富盛宴与泡沫"}]
*/
private String date;
private List<StoriesBean> stories;
private List<TopStoriesBean> top_stories;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public List<StoriesBean> getStories() {
return stories;
}
public void setStories(List<StoriesBean> stories) {
this.stories = stories;
}
public List<TopStoriesBean> getTop_stories() {
return top_stories;
}
public void setTop_stories(List<TopStoriesBean> top_stories) {
this.top_stories = top_stories;
}
public static class StoriesBean {
/**
* images : ["https://pic4.zhimg.com/v2-ae5d75c24876a99d0aca0f503997fa53.jpg"]
* type : 0
* id : 9602927
* ga_prefix : 090522
* title : 小事 · 网吧里的人
*/
private int id;
private String title;
private List<String> images;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
@Override
public String toString() {
return "StoriesBean{" +
"id=" + id +
", title='" + title + '\'' +
", images=" + images +
'}';
}
}
public static class TopStoriesBean {
}
}
| [
"644469447@qq.com"
] | 644469447@qq.com |
02fd286cd345c2823c9a2505ec4aac4a1227fb81 | 6e03f5175a5630e3939d1a4db14b588840802680 | /step04_Method/src/test/main/MainClass03.java | ba15aa69408f390acc73e0a6ca215f7460d72e2c | [] | no_license | parksujin11/Step04_method | 27b22b42c3273c7bf2614a4cfe4d5c0274eed9a3 | 6535481a6f9fdcfb0e76944f4e5af4a7340aa362 | refs/heads/master | 2021-08-12T01:44:59.042280 | 2017-11-14T08:42:56 | 2017-11-14T08:42:56 | 110,663,735 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 313 | java | package test.main;
public class MainClass03 {
public static void main(String[] args) {
//showNum() 메소드를 호출 해 보세요.
MainClass03.showNum(10);
int num=20;
MainClass03.showNum(num);
}
public static void showNum(int num) {
System.out.println("num:"+num);
}
}
| [
"skylove5182@naver.com"
] | skylove5182@naver.com |
73e195be7520176dcaab4cc5cc28343f7349b57b | cbe6e730b0e6f3f0df443c9031ad222163cc5223 | /contents/src/chapter03/section04/TestMain.java | fe09aaf09ab13a07672555b2425d9fdd5d492bb5 | [] | no_license | ehayand/core_java_8 | c493b50692bd0b66a19bcadaf07823b3d95ca789 | 69ddbd589f500b704a5c3be842e838c03e219adf | refs/heads/master | 2020-03-23T03:01:54.001410 | 2018-09-08T10:53:22 | 2018-09-08T10:53:22 | 141,005,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 248 | java | package chapter03.section04;
/**
* Created by ehay@naver.com on 2018-08-19
* Blog : http://ehay.tistory.com
* Github : http://github.com/ehayand
*/
public class TestMain {
//람다식
public static void main(String[] args){
}
}
| [
"ehay@naver.com"
] | ehay@naver.com |
b0816e961a10661a040019ee86e1c77b8fd51b80 | d3db05ee8909d960243e9af154169c65c6864696 | /src/main/java/com/mindtree/leafservice3/repository/EvaluationRepository.java | 95ffb996f0b6acb7579323b0b1e2828294ef324e | [] | no_license | m1049177/LEAFService | 188d44baf767d3574859abb4522543b363d2b77b | 728dc30e65bb3c06e619899e6399d75636a0b1dd | refs/heads/master | 2022-11-29T09:26:34.469617 | 2020-08-10T11:56:17 | 2020-08-10T11:56:17 | 286,460,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.mindtree.leafservice3.repository;
import com.mindtree.leafservice3.domain.Evaluation;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Evaluation entity.
*/
@SuppressWarnings("unused")
@Repository
public interface EvaluationRepository extends JpaRepository<Evaluation, Long> {
}
| [
"m1049177@mindtree.com"
] | m1049177@mindtree.com |
760d168f68b4edd8e21e3ea104a1c31294179ba6 | 8d2ecb3cba702d505c77318007b1a096ec6057a3 | /aCis_gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/BlessedSpiritShot.java | e07bf3a86cf4c2e19ba02abbc28a80dcec33e58b | [] | no_license | thevinou/ProjectL | b054ce30311f4a89c0ec93d4cbf86717b229cfaf | f0dfb9298b6ae1d0f00bd9b249120f90cbfc1c83 | refs/heads/master | 2016-09-05T17:25:29.161384 | 2015-01-30T08:52:57 | 2015-01-30T08:52:57 | 29,908,866 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,070 | java | /*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.handler.itemhandlers;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.ShotType;
import net.sf.l2j.gameserver.model.actor.L2Playable;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.holder.SkillHolder;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.model.item.kind.Weapon;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.util.Broadcast;
public class BlessedSpiritShot implements IItemHandler
{
@Override
public void useItem(L2Playable playable, ItemInstance item, boolean forceUse)
{
if (!(playable instanceof L2PcInstance))
return;
final L2PcInstance activeChar = (L2PcInstance) playable;
final ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
final Weapon weaponItem = activeChar.getActiveWeaponItem();
final int itemId = item.getItemId();
// Check if bss can be used
if (weaponInst == null || weaponItem == null || weaponItem.getSpiritShotCount() == 0)
{
if (!activeChar.getAutoSoulShot().contains(itemId))
activeChar.sendPacket(SystemMessageId.CANNOT_USE_SPIRITSHOTS);
return;
}
// Check if bss is already active (it can be charged over SpiritShot)
if (activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOT))
return;
// Check for correct grade.
if (weaponItem.getCrystalType() != item.getItem().getCrystalType())
{
if (!activeChar.getAutoSoulShot().contains(itemId))
activeChar.sendPacket(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH);
return;
}
// Consume bss if player has enough of them
if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
{
if (!activeChar.disableAutoShot(itemId))
activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS);
return;
}
final SkillHolder[] skills = item.getItem().getSkills();
activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
activeChar.setChargedShot(ShotType.BLESSED_SPIRITSHOT, true);
Broadcast.toSelfAndKnownPlayersInRadiusSq(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), 1, 0, 0), 360000);
}
} | [
"thevinou@gmail.com"
] | thevinou@gmail.com |
9861b816a5dfc270d9ed0aa4a4b4740a8ff9855f | e97cbc16eac6377940afe37e7720448f5e602696 | /app/src/test/java/com/example/constrain/ExampleUnitTest.java | f87c3cd6e01f2eec6013ddcd4f030dcb64399be1 | [
"Apache-2.0"
] | permissive | john9500/Android_Bottom_Navigation | 581e1b4a84faa5d4847f64d3fad07f5ab4e97b08 | c576572ec660b3ff1d6dff862880601eb8bd3efe | refs/heads/main | 2022-12-31T12:10:49.434987 | 2020-10-23T12:44:40 | 2020-10-23T12:44:40 | 306,634,151 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.example.constrain;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"59951145+john9500@users.noreply.github.com"
] | 59951145+john9500@users.noreply.github.com |
c48f4fd4c5d590be252631306bf58bc881ba6fb8 | 6500848c3661afda83a024f9792bc6e2e8e8a14e | /gp_JADX/com/google/common/p415b/aa.java | 14a2b506bd8c5b81ca0a94f1f82d8ea89668eec6 | [] | no_license | enaawy/gproject | fd71d3adb3784d12c52daf4eecd4b2cb5c81a032 | 91cb88559c60ac741d4418658d0416f26722e789 | refs/heads/master | 2021-09-03T03:49:37.813805 | 2018-01-05T09:35:06 | 2018-01-05T09:35:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package com.google.common.p415b;
import java.util.Set;
final class aa extends C6941z implements Set {
aa(C6942y c6942y) {
super(c6942y);
}
public final int hashCode() {
int i = 0;
for (Object next : this) {
int hashCode;
if (next != null) {
hashCode = next.hashCode();
} else {
hashCode = 0;
}
i = ((i + hashCode) ^ -1) ^ -1;
}
return i;
}
public final boolean equals(Object obj) {
return ca.m31781a((Set) this, obj);
}
}
| [
"genius.ron@gmail.com"
] | genius.ron@gmail.com |
30bbc27c5c0699c431af12910df10a3dbd202b36 | 90ad5696a7c20e9e74b995504c66b71d6b521772 | /plugins/org.mondo.ifc.cstudy.metamodel.edit/src/org/bimserver/models/ifc2x3tc1/provider/IfcDirectionItemProvider.java | 8c9920f352b2be94f991a5b3da733dc8b6db7218 | [] | no_license | mondo-project/mondo-demo-bim | 5bbdffa5a61805256e476ec2fa84d6d93aeea29f | 96d673eb14e5c191ea4ae7985eee4a10ac51ffec | refs/heads/master | 2016-09-13T11:53:26.773266 | 2016-06-02T20:02:05 | 2016-06-02T20:02:05 | 56,190,032 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,525 | java | /**
*/
package org.bimserver.models.ifc2x3tc1.provider;
import java.util.Collection;
import java.util.List;
import org.bimserver.models.ifc2x3tc1.Ifc2x3tc1Package;
import org.bimserver.models.ifc2x3tc1.IfcDirection;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
/**
* This is the item provider adapter for a {@link org.bimserver.models.ifc2x3tc1.IfcDirection} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class IfcDirectionItemProvider extends IfcGeometricRepresentationItemItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IfcDirectionItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addDirectionRatiosPropertyDescriptor(object);
addDirectionRatiosAsStringPropertyDescriptor(object);
addDimPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Direction Ratios feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDirectionRatiosPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_IfcDirection_DirectionRatios_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_IfcDirection_DirectionRatios_feature", "_UI_IfcDirection_type"),
Ifc2x3tc1Package.eINSTANCE.getIfcDirection_DirectionRatios(),
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Direction Ratios As String feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDirectionRatiosAsStringPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_IfcDirection_DirectionRatiosAsString_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_IfcDirection_DirectionRatiosAsString_feature", "_UI_IfcDirection_type"),
Ifc2x3tc1Package.eINSTANCE.getIfcDirection_DirectionRatiosAsString(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Dim feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDimPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_IfcDirection_Dim_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_IfcDirection_Dim_feature", "_UI_IfcDirection_type"),
Ifc2x3tc1Package.eINSTANCE.getIfcDirection_Dim(),
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}
/**
* This returns IfcDirection.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/IfcDirection"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
IfcDirection ifcDirection = (IfcDirection)object;
return getString("_UI_IfcDirection_type") + " " + ifcDirection.getDim();
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(IfcDirection.class)) {
case Ifc2x3tc1Package.IFC_DIRECTION__DIRECTION_RATIOS:
case Ifc2x3tc1Package.IFC_DIRECTION__DIRECTION_RATIOS_AS_STRING:
case Ifc2x3tc1Package.IFC_DIRECTION__DIM:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
}
| [
"debreceni@mit.bme.hu"
] | debreceni@mit.bme.hu |
68019c26013570ebeb55a97d4878e04798871c1e | 6ea50f055696a8a8e1c931680f7aeede884aedaf | /src/main/java/aryehg/http/StatisticsRequestParser.java | 41381593227a5792801ef38a9a1cb170caf16dda | [] | no_license | akir94/big-panda-exercise | 05e1979122cc064435ad067c4d41f1e0d6f0d8b8 | 2cff6e8f228c416c02dacc9ca28e5f11c15023ae | refs/heads/master | 2020-03-27T19:30:06.677041 | 2018-09-01T14:53:24 | 2018-09-01T14:53:24 | 146,993,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | package aryehg.http;
import com.sun.net.httpserver.HttpExchange;
class StatisticsRequestParser {
private static final String SUPPORTED_PATH_REGEX = "^/\\w+/\\w+$";
RequestedStatistic parse(HttpExchange httpExchange) throws UnsupportedRequest {
try {
String path = httpExchange.getRequestURI().getPath();
if (!path.matches(SUPPORTED_PATH_REGEX)) {
throw new UnsupportedRequest("Unsupported request path");
} else {
return createRequestedStatistic(path);
}
} catch (RuntimeException e) {
throw new UnsupportedRequest("Failed to parse request", e);
}
}
private RequestedStatistic createRequestedStatistic(String path) {
String[] pathParts = path.split("/");
String statisticType = pathParts[1];
String keyType = pathParts[2];
return new RequestedStatistic(statisticType, keyType);
}
}
| [
"akir94@gmail.com"
] | akir94@gmail.com |
46ba09d389a98f0bdca08023aa83cf49865bdcae | 1d32aa38e4e0e0c93fbb0cc259bc3ab3b1385afc | /app/src/main/java/com/bigpumpkin/app/ddng_android/weight/FlowLayoutManager.java | 00d27962bde844a1c4ad85300e783510f0d2575d | [] | no_license | GuYou957641694/ddng_android | 196df72fde36a64108a3cbb6fe980a3a256f1d86 | 70ff91b03001db3c3a69d63ab86a89ade013115c | refs/heads/master | 2020-07-11T16:07:17.255963 | 2019-12-12T03:01:59 | 2019-12-12T03:01:59 | 204,591,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,228 | java | package com.bigpumpkin.app.ddng_android.weight;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
public class FlowLayoutManager extends RecyclerView.LayoutManager {
private static final String TAG = FlowLayoutManager.class.getSimpleName();
final FlowLayoutManager self = this;
protected int width, height;
private int left, top, right;
//最大容器的宽度
private int usedMaxWidth;
//竖直方向上的偏移量
private int verticalScrollOffset = 0;
public int getTotalHeight() {
return totalHeight;
}
//计算显示的内容的高度
protected int totalHeight = 0;
private Row row = new Row();
private List<Row> lineRows = new ArrayList<>();
//保存所有的Item的上下左右的偏移量信息
private SparseArray<Rect> allItemFrames = new SparseArray<>();
public FlowLayoutManager() {
//设置主动测量规则,适应recyclerView高度为wrap_content
setAutoMeasureEnabled(true);
}
//每个item的定义
public class Item {
int useHeight;
View view;
public void setRect(Rect rect) {
this.rect = rect;
}
Rect rect;
public Item(int useHeight, View view, Rect rect) {
this.useHeight = useHeight;
this.view = view;
this.rect = rect;
}
}
//行信息的定义
public class Row {
public void setCuTop(float cuTop) {
this.cuTop = cuTop;
}
public void setMaxHeight(float maxHeight) {
this.maxHeight = maxHeight;
}
//每一行的头部坐标
float cuTop;
//每一行需要占据的最大高度
float maxHeight;
//每一行存储的item
List<Item> views = new ArrayList<>();
public void addViews(Item view) {
views.add(view);
}
}
@Override
public RecyclerView.LayoutParams generateDefaultLayoutParams() {
return new RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
//该方法主要用来获取每一个item在屏幕上占据的位置
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
totalHeight = 0;
int cuLineTop = top;
//当前行使用的宽度
int cuLineWidth = 0;
int itemLeft;
int itemTop;
int maxHeightItem = 0;
row = new Row();
lineRows.clear();
allItemFrames.clear();
removeAllViews();
if (getItemCount() == 0) {
detachAndScrapAttachedViews(recycler);
verticalScrollOffset = 0;
return;
}
if (getChildCount() == 0 && state.isPreLayout()) {
return;
}
//onLayoutChildren方法在RecyclerView 初始化时 会执行两遍
detachAndScrapAttachedViews(recycler);
if (getChildCount() == 0) {
width = getWidth();
height = getHeight();
left = getPaddingLeft();
right = getPaddingRight();
top = getPaddingTop();
usedMaxWidth = width - left - right;
}
for (int i = 0; i < getItemCount(); i++) {
View childAt = recycler.getViewForPosition(i);
if (View.GONE == childAt.getVisibility()) {
continue;
}
measureChildWithMargins(childAt, 0, 0);
int childWidth = getDecoratedMeasuredWidth(childAt);
int childHeight = getDecoratedMeasuredHeight(childAt);
int childUseWidth = childWidth;
int childUseHeight = childHeight;
//如果加上当前的item还小于最大的宽度的话
if (cuLineWidth + childUseWidth <= usedMaxWidth) {
itemLeft = left + cuLineWidth;
itemTop = cuLineTop;
Rect frame = allItemFrames.get(i);
if (frame == null) {
frame = new Rect();
}
frame.set(itemLeft, itemTop, itemLeft + childWidth, itemTop + childHeight);
allItemFrames.put(i, frame);
cuLineWidth += childUseWidth;
maxHeightItem = Math.max(maxHeightItem, childUseHeight);
row.addViews(new Item(childUseHeight, childAt, frame));
row.setCuTop(cuLineTop);
row.setMaxHeight(maxHeightItem);
} else {
//换行
formatAboveRow();
cuLineTop += maxHeightItem;
totalHeight += maxHeightItem;
itemTop = cuLineTop;
itemLeft = left;
Rect frame = allItemFrames.get(i);
if (frame == null) {
frame = new Rect();
}
frame.set(itemLeft, itemTop, itemLeft + childWidth, itemTop + childHeight);
allItemFrames.put(i, frame);
cuLineWidth = childUseWidth;
maxHeightItem = childUseHeight;
row.addViews(new Item(childUseHeight, childAt, frame));
row.setCuTop(cuLineTop);
row.setMaxHeight(maxHeightItem);
}
//不要忘了最后一行进行刷新下布局
if (i == getItemCount() - 1) {
formatAboveRow();
totalHeight += maxHeightItem;
}
}
totalHeight = Math.max(totalHeight, getVerticalSpace());
fillLayout(recycler, state);
}
//对出现在屏幕上的item进行展示,超出屏幕的item回收到缓存中
private void fillLayout(RecyclerView.Recycler recycler, RecyclerView.State state) {
if (state.isPreLayout()) { // 跳过preLayout,preLayout主要用于支持动画
return;
}
// 当前scroll offset状态下的显示区域
Rect displayFrame = new Rect(getPaddingLeft(), getPaddingTop() + verticalScrollOffset,
getWidth() - getPaddingRight(), verticalScrollOffset + (getHeight() - getPaddingBottom()));
//对所有的行信息进行遍历
for (int j = 0; j < lineRows.size(); j++) {
Row row = lineRows.get(j);
float lineTop = row.cuTop;
float lineBottom = lineTop + row.maxHeight;
//如果该行在屏幕中,进行放置item
if (lineTop < displayFrame.bottom && displayFrame.top < lineBottom) {
List<Item> views = row.views;
for (int i = 0; i < views.size(); i++) {
View scrap = views.get(i).view;
measureChildWithMargins(scrap, 0, 0);
addView(scrap);
Rect frame = views.get(i).rect;
//将这个item布局出来
layoutDecoratedWithMargins(scrap,
frame.left,
frame.top - verticalScrollOffset,
frame.right,
frame.bottom - verticalScrollOffset);
}
} else {
//将不在屏幕中的item放到缓存中
List<Item> views = row.views;
for (int i = 0; i < views.size(); i++) {
View scrap = views.get(i).view;
removeAndRecycleView(scrap, recycler);
}
}
}
}
/**
* 计算每一行没有居中的viewgroup,让居中显示
*/
private void formatAboveRow() {
List<Item> views = row.views;
for (int i = 0; i < views.size(); i++) {
Item item = views.get(i);
View view = item.view;
int position = getPosition(view);
//如果该item的位置不在该行中间位置的话,进行重新放置
if (allItemFrames.get(position).top < row.cuTop + (row.maxHeight - views.get(i).useHeight) / 2) {
Rect frame = allItemFrames.get(position);
if (frame == null) {
frame = new Rect();
}
frame.set(allItemFrames.get(position).left, (int) (row.cuTop + (row.maxHeight - views.get(i).useHeight) / 2),
allItemFrames.get(position).right, (int) (row.cuTop + (row.maxHeight - views.get(i).useHeight) / 2 + getDecoratedMeasuredHeight(view)));
allItemFrames.put(position, frame);
item.setRect(frame);
views.set(i, item);
}
}
row.views = views;
lineRows.add(row);
row = new Row();
}
/**
* 竖直方向需要滑动的条件
*
* @return
*/
@Override
public boolean canScrollVertically() {
return true;
}
//监听竖直方向滑动的偏移量
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler,
RecyclerView.State state) {
//实际要滑动的距离
int travel = dy;
//如果滑动到最顶部
if (verticalScrollOffset + dy < 0) {//限制滑动到顶部之后,不让继续向上滑动了
travel = -verticalScrollOffset;//verticalScrollOffset=0
} else if (verticalScrollOffset + dy > totalHeight - getVerticalSpace()) {//如果滑动到最底部
travel = totalHeight - getVerticalSpace() - verticalScrollOffset;//verticalScrollOffset=totalHeight - getVerticalSpace()
}
//将竖直方向的偏移量+travel
verticalScrollOffset += travel;
// 平移容器内的item
offsetChildrenVertical(-travel);
fillLayout(recycler, state);
return travel;
}
private int getVerticalSpace() {
return self.getHeight() - self.getPaddingBottom() - self.getPaddingTop();
}
public int getHorizontalSpace() {
return self.getWidth() - self.getPaddingLeft() - self.getPaddingRight();
}
}
| [
"j957641694@163.com"
] | j957641694@163.com |
9a45513684f654d48f58380ed802bb5487367f4b | 295d423efefa0be8ed4714d80848dbcfba946606 | /com/test/game/RedEnemy.java | ea542e994f92863dc51453b78425798eee62d678 | [] | no_license | SidharthBabu121/ColorDodge | 30f93abfe8a8eda607faf404f897ce9886dfd251 | 51bde056929cb381e75a766117546a38a255353e | refs/heads/master | 2020-05-05T06:27:24.560608 | 2019-04-06T05:12:12 | 2019-04-06T05:12:12 | 179,788,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package com.test.game;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Random;
public class RedEnemy extends GameSprite{
private Renderer renderer;
public RedEnemy(int x, int y, Diff id, Renderer renderer) {
super(x, y, id);
Random rNum = new Random();
this.renderer = renderer;
//enemy speed here. Must be an even number
final int bounce = 12;
xMove = rNum.nextInt(bounce) - bounce/2;
if (xMove == 0) xMove += 5;
yMove = rNum.nextInt(bounce) - bounce/2;
if (yMove == 0) yMove += 5;
}
public Rectangle getBounds() {
return new Rectangle (x, y, 20, 20);
}
public void tick() {
x += xMove;
y += yMove;
if(y <= 70 || y >= ColorShoot.HEIGHT - 60) yMove *= -1;
if(x <= 0 || x >= ColorShoot.WIDTH - 20) xMove *= -1;
}
public void render(Graphics res) {
if (id == Diff.RedEnemy) {
res.setColor(Color.red);
res.fillRect(x, y, 20, 20);
}
}
}
| [
"scott.taylor.lew@gmail.com"
] | scott.taylor.lew@gmail.com |
23ca683819dc5d1fe6392296d4c3fa9b7c6c5b27 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/34/34_6da3b1ca32b57a7002c0a1c4b1d50eae229a620b/VoiceRecDialog/34_6da3b1ca32b57a7002c0a1c4b1d50eae229a620b_VoiceRecDialog_t.java | ac9cab96c68041c837872421314be5cfefec9ecd | [] | 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 | 11,172 | java | package me.guillaumin.android.osmtracker.view;
import java.io.File;
import java.util.Date;
import java.util.UUID;
import me.guillaumin.android.osmtracker.OSMTracker;
import me.guillaumin.android.osmtracker.R;
import me.guillaumin.android.osmtracker.db.DataHelper;
import me.guillaumin.android.osmtracker.db.TrackContentProvider.Schema;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.media.MediaRecorder.OnInfoListener;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.Toast;
public class VoiceRecDialog extends ProgressDialog implements OnInfoListener{
private final static String TAG = VoiceRecDialog.class.getSimpleName();
/**
* Id of the track the dialog will add this waypoint to
*/
private long wayPointTrackId;
/**
* Unique identifier of the waypoint this dialog working on
*/
private String wayPointUuid = null;
/**
* AudioManager, to unmute microphone
*/
private AudioManager audioManager;
/**
* the duration of a voice recording in seconds
*/
private int recordingDuration;
/**
* Indicates if we are currently recording, to prevent double click.
*/
private boolean isRecording = false;
/**
* MediaRecorder used to record audio
*/
private MediaRecorder mediaRecorder;
/**
* MediaPlayer used to play a short beepbeep when recording starts
*/
private MediaPlayer mediaPlayerStart = null;
/**
* MediaPlayer used to play a short beep when recording stops
*/
private MediaPlayer mediaPlayerStop = null;
/**
* the context for this dialog
*/
private Context context;
/**
* saves the orientation at the time when the dialog was started
*/
private int currentOrientation = -1;
/**
* saves the requested orientation at the time when the dialog was started to restore it when we stop recording
*/
private int currentRequestedOrientation = -1;
/**
* saves the time when this dialog was started.
* This is needed to check if a key was pressed before the dialog was shown
*/
private long dialogStartTime = 0;
public VoiceRecDialog(Context context, long trackId) {
super(context);
this.context = context;
this.wayPointTrackId = trackId;
// Try to un-mute microphone, just in case
audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
// get preferences we'll need for this dialog
recordingDuration = Integer.parseInt(
PreferenceManager.getDefaultSharedPreferences(context).getString(OSMTracker.Preferences.KEY_VOICEREC_DURATION,
OSMTracker.Preferences.VAL_VOICEREC_DURATION));
this.setTitle(context.getResources().getString(R.string.tracklogger_voicerec_title));
this.setButton(context.getResources().getString(R.string.tracklogger_voicerec_stop), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mediaRecorder.stop();
VoiceRecDialog.this.dismiss();
}
});
}
/**
* @link android.app.Dialog#onStart()
*/
@Override
public void onStart() {
// we'll need the start time of this dialog to check if a key has been pressed before the dialog was opened
dialogStartTime = SystemClock.uptimeMillis();
boolean playSound = PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(OSMTracker.Preferences.KEY_SOUND_ENABLED, OSMTracker.Preferences.VAL_SOUND_ENABLED);
this.setMessage(
context.getResources().getString(R.string.tracklogger_voicerec_text)
.replace("{0}", String.valueOf(recordingDuration)));
// we need to avoid screen orientation change during recording because this causes some strange behavior
try{
this.currentOrientation = context.getResources().getConfiguration().orientation;
this.currentRequestedOrientation = this.getOwnerActivity().getRequestedOrientation();
this.getOwnerActivity().setRequestedOrientation(currentOrientation);
}catch(Exception e){
Log.w(TAG, "No OwnerActivity found for this Dialog. Use showDialog method within the activity to handle this Dialog and to avoid voice recording problems.");
}
Log.d(TAG,"onStart() called");
if(wayPointUuid == null){
Log.d(TAG,"onStart() no UUID set, generating a new UUID");
// there is no UUID set for the waypoint we're working on
// so we need to generate a UUID and track this point
wayPointUuid = UUID.randomUUID().toString();
Intent intent = new Intent(OSMTracker.INTENT_TRACK_WP);
intent.putExtra(Schema.COL_TRACK_ID, wayPointTrackId);
intent.putExtra(OSMTracker.INTENT_KEY_UUID, wayPointUuid);
intent.putExtra(OSMTracker.INTENT_KEY_NAME, context.getResources().getString(R.string.wpt_voicerec));
context.sendBroadcast(intent);
}
if (!isRecording) {
Log.d(TAG,"onStart() currently not recording, start a new one");
isRecording = true;
// Get a new audio filename
File audioFile = getAudioFile();
if (audioFile != null) {
// Some workaround for record problems
unMuteMicrophone();
// prepare the media players
if (playSound) {
mediaPlayerStart = MediaPlayer.create(context, R.raw.beepbeep);
if (mediaPlayerStart != null) {
mediaPlayerStart.setLooping(false);
}
mediaPlayerStop = MediaPlayer.create(context, R.raw.beep);
if (mediaPlayerStop != null) {
mediaPlayerStop.setLooping(false);
}
}
mediaRecorder = new MediaRecorder();
try {
// MediaRecorder configuration
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mediaRecorder.setOutputFile(audioFile.getAbsolutePath());
mediaRecorder.setMaxDuration(recordingDuration * 1000);
mediaRecorder.setOnInfoListener(this);
Log.d(TAG, "onStart() starting mediaRecorder...");
mediaRecorder.prepare();
mediaRecorder.start();
if (mediaPlayerStart != null) {
// short "beep-beep" to notify that recording started
mediaPlayerStart.start();
}
Log.d(TAG,"onStart() mediaRecorder started...");
} catch (Exception ioe) {
Log.w(TAG, "onStart() voice recording has failed", ioe);
this.dismiss();
Toast.makeText(context, context.getResources().getString(R.string.error_voicerec_failed),
Toast.LENGTH_SHORT).show();
}
// Still update waypoint, could be useful even without
// the voice file.
Intent intent = new Intent(OSMTracker.INTENT_UPDATE_WP);
intent.putExtra(Schema.COL_TRACK_ID, wayPointTrackId);
intent.putExtra(OSMTracker.INTENT_KEY_UUID, wayPointUuid);
intent.putExtra(OSMTracker.INTENT_KEY_LINK, audioFile.getName());
context.sendBroadcast(intent);
} else {
Log.w(TAG,"onStart() no suitable audioFile could be created");
// The audio file could not be created on the file system
// let the user know
Toast.makeText(context,
context.getResources().getString(R.string.error_voicerec_failed),
Toast.LENGTH_SHORT).show();
}
}
super.onStart();
}
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
Log.d(TAG, "onInfo() received mediaRecorder info ("+String.valueOf(what)+")");
switch(what){
case MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN:
case MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:
case MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:
if (mediaPlayerStop != null) {
// short "beep" when we stop to record
mediaPlayerStop.start();
}
// MediaRecorder has been stopped by system
// we're done, so we can dismiss the dialog
this.dismiss();
break;
}
}
/**
* called when the dialog disappears
*/
@Override
protected void onStop() {
Log.d(TAG, "onStop() called");
safeClose(mediaRecorder, false);
safeClose(mediaPlayerStart);
safeClose(mediaPlayerStop);
wayPointUuid = null;
isRecording = false;
try {
this.getOwnerActivity().setRequestedOrientation(currentRequestedOrientation);
} catch(Exception e) {
Log.w(TAG, "No OwnerActivity found for this Dialog. Use showDialog method within the activity to handle this Dialog and to avoid voice recording problems.");
}
super.onStop();
}
/* (non-Javadoc)
* @see android.app.AlertDialog#onKeyDown(int, android.view.KeyEvent)
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// only handle this event if it was raised after the dialog was shown
if(event.getDownTime() > dialogStartTime){
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_HEADSETHOOK:
// stop recording / dismiss the dialog
this.dismiss();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
/**
* Un-mute the microphone, to prevent a blank-recording
* on certain devices (Acer Liquid ?)
*/
private void unMuteMicrophone() {
Log.v(TAG, "unMuteMicrophone()");
if (audioManager.isMicrophoneMute()) {
audioManager.setMicrophoneMute(false);
}
}
/**
* @return a new File in the current track directory.
*/
public File getAudioFile() {
File audioFile = null;
// Query for current track directory
File trackDir = DataHelper.getTrackDirectory(wayPointTrackId);
// Create the track storage directory if it does not yet exist
if (!trackDir.exists()) {
if ( !trackDir.mkdirs() ) {
Log.w(TAG, "Directory [" + trackDir.getAbsolutePath() + "] does not exist and cannot be created");
}
}
// Ensure that this location can be written to
if (trackDir.exists() && trackDir.canWrite()) {
audioFile = new File(trackDir,
DataHelper.FILENAME_FORMATTER.format(new Date()) + DataHelper.EXTENSION_3GPP);
} else {
Log.w(TAG, "The directory [" + trackDir.getAbsolutePath() + "] will not allow files to be created");
}
return audioFile;
}
/**
* Safely close a {@link MediaPlayer} without throwing
* exceptions
* @param mp
*/
private void safeClose(MediaPlayer mp) {
if (mp != null) {
try {
mp.stop();
} catch (Exception e) {
Log.w(TAG, "Failed to stop media player",e);
} finally {
mp.release();
}
}
}
/**
* Safely close a {@link MediaRecorder} without throwing
* exceptions
* @param mr
*/
private void safeClose(MediaRecorder mr, boolean stopIt) {
if (mr != null) {
try {
if (stopIt) {
mr.stop();
}
} catch (Exception e) {
Log.w(TAG, "Failed to stop media recorder",e);
} finally {
mr.release();
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
9ea465880b0052a85303d7f7255f0dc5c0491969 | e087ef4984a8658c287d955276f08f06da358397 | /src/com/javarush/test/level37/lesson10/big01/AmigoSet.java | 54b179389eafb8c48546aef20c677881ac094f79 | [] | no_license | YuriiLosinets/javacore | f08fd93623bc5c90fcb4eb13a03a3360b702a5fb | 552117fd18a96ff99c6bd5455f16f4bb234d2bdc | refs/heads/master | 2021-01-10T14:39:57.494858 | 2016-03-25T08:40:31 | 2016-03-25T08:40:31 | 53,958,241 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,372 | java | package com.javarush.test.level37.lesson10.big01;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
/**
* Created by CMI-USER on 1/25/2016.
*/
public class AmigoSet<E> extends AbstractSet<E> implements Cloneable, Serializable, Set<E> {
private final static Object PRESENT = new Object();
private transient HashMap<E,Object> map;
public AmigoSet() {
map = new HashMap<>();
}
public AmigoSet(Collection<? extends E> collection){
map = new HashMap<>((int)Math.max(16,collection.size()/.75f));
this.addAll(collection);
}
@Override
public boolean add(E e) {
return null == map.put(e,PRESENT);
}
@Override
public Iterator<E> iterator() {
return map.keySet().iterator();
}
@Override
public int size() {
return map.keySet().size();
}
@Override
public boolean isEmpty() {
return map.keySet().isEmpty();
}
@Override
public boolean contains(Object o) {
return map.keySet().contains(o);
}
@Override
public boolean remove(Object o) {
return map.keySet().remove(o);
}
@Override
public Object clone() {
AmigoSet<E> amigoSet = new AmigoSet<>();
try {
amigoSet.addAll(this);
amigoSet.map.putAll(this.map);
}
catch (Exception e){
throw new InternalError();
}
return amigoSet;
}
private void writeObject(java.io.ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
s.writeObject(map.size());
for(E e:map.keySet()){
s.writeObject(e);
}
s.writeObject(HashMapReflectionHelper.callHiddenMethod(map,"capacity"));
s.writeObject(HashMapReflectionHelper.callHiddenMethod(map,"loadFactor"));
}
private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
int size = (int)s.readObject();
Set<E> set = new HashSet<>();
for(int i =0;i<size;i++){
set.add((E)s.readObject());
}
int capacity = (int)s.readObject();
float loadFactor = (float)s.readObject();
map = new HashMap<>(capacity,loadFactor);
for(E e:set){
map.put(e,PRESENT);
}
}
}
| [
"yuri.losinets@gmail.com"
] | yuri.losinets@gmail.com |
7402c4fd296723ab6961395eba11cbc99a2f8745 | 0f77c5ec508d6e8b558f726980067d1058e350d7 | /1_39_120042/com/ankamagames/baseImpl/graphics/alea/display/effects/CameraEffect.java | 4ea4e40a202580c3ba01d79173c613ad65ed52d8 | [] | no_license | nightwolf93/Wakxy-Core-Decompiled | aa589ebb92197bf48e6576026648956f93b8bf7f | 2967f8f8fba89018f63b36e3978fc62908aa4d4d | refs/heads/master | 2016-09-05T11:07:45.145928 | 2014-12-30T16:21:30 | 2014-12-30T16:21:30 | 29,250,176 | 5 | 5 | null | 2015-01-14T15:17:02 | 2015-01-14T15:17:02 | null | UTF-8 | Java | false | false | 2,072 | java | package com.ankamagames.baseImpl.graphics.alea.display.effects;
import com.ankamagames.framework.graphics.engine.*;
public class CameraEffect extends Effect
{
protected Direction m_direction;
public CameraEffect() {
super();
this.m_direction = Direction.BOTH;
}
public void setDirection(final Direction direction) {
if (direction == null) {
this.m_direction = Direction.BOTH;
}
else {
this.m_direction = direction;
}
}
public void setDirection(final String direction) {
this.setDirection(Direction.valueOf(direction));
}
@Override
public void clear() {
this.m_camera = null;
}
@Override
public void render(final Renderer renderer) {
}
protected final boolean applyOnX() {
return this.m_direction.applyOnX();
}
protected final boolean applyOnY() {
return this.m_direction.applyOnY();
}
public enum Direction
{
NONE {
@Override
boolean applyOnX() {
return false;
}
@Override
boolean applyOnY() {
return false;
}
},
X {
@Override
boolean applyOnX() {
return true;
}
@Override
boolean applyOnY() {
return false;
}
},
Y {
@Override
boolean applyOnX() {
return false;
}
@Override
boolean applyOnY() {
return true;
}
},
BOTH {
@Override
boolean applyOnX() {
return true;
}
@Override
boolean applyOnY() {
return true;
}
};
abstract boolean applyOnX();
abstract boolean applyOnY();
}
}
| [
"totomakers@hotmail.fr"
] | totomakers@hotmail.fr |
d7c382c112c2b673c099a96bf337ba4222010472 | 40279e5fd9b350f63caee3bb0345c4cec58402c2 | /Math/VectorTOFIX.java | c35c7b30dee1427e1874fa1dc0fe9eb3cb8c9f60 | [] | no_license | KarenSantos/DataStructureAndAlgorithmsLab | 8c8f937f6a9def35efaf77c527656c78487c0475 | 88abfb77e84999d82a830bca912d925f4d1a315d | refs/heads/master | 2021-01-01T20:35:17.699729 | 2014-07-03T22:28:49 | 2014-07-03T22:28:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,543 | java | package leda.aula4;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.RandomAccess;
public class VectorTOFIX<E> extends AbstractList<E> implements List<E>,
RandomAccess, Cloneable, java.io.Serializable {
/**
* The array buffer into which the components of the vector are stored. The
* capacity of the vector is the length of this array buffer, and is at
* least large enough to contain all the vector's elements.
*
* <p>
* Any array elements following the last element in the Vector are null.
*
* @serial
*/
protected Object[] elementData;
/**
* The number of valid components in this {@code Vector} object. Components
* {@code elementData[0]} through {@code elementData[elementCount-1]} are
* the actual items.
*
* @serial
*/
protected int elementCount;
/**
* The amount by which the capacity of the vector is automatically
* incremented when its size becomes greater than its capacity. If the
* capacity increment is less than or equal to zero, the capacity of the
* vector is doubled each time it needs to grow.
*
* @serial
*/
protected int capacityIncrement;
/** use serialVersionUID from JDK 1.0.2 for interoperability */
private static final long serialVersionUID = -2767605614048989439L;
/**
* Constructs an empty vector with the specified initial capacity and
* capacity increment.
*
* @param initialCapacity
* the initial capacity of the vector
* @param capacityIncrement
* the amount by which the capacity is increased when the vector
* overflows
* @throws IllegalArgumentException
* if the specified initial capacity is negative
*/
public VectorTOFIX(int initialCapacity, int capacityIncrement) {
super();
if (initialCapacity < 0)
throw new IllegalArgumentException("Illegal Capacity: "
+ initialCapacity);
this.elementData = new Object[initialCapacity];
this.capacityIncrement = capacityIncrement;
}
/**
* Constructs an empty vector with the specified initial capacity and with
* its capacity increment equal to zero.
*
* @param initialCapacity
* the initial capacity of the vector
* @throws IllegalArgumentException
* if the specified initial capacity is negative
*/
public VectorTOFIX(int initialCapacity) {
this(initialCapacity, 0);
}
/**
* Constructs an empty vector so that its internal data array has size
* {@code 10} and its standard capacity increment is zero.
*/
public VectorTOFIX() {
this(10);
}
// FIXME 1 defeito
/**
* Trims the capacity of this vector to be the vector's current size. If the
* capacity of this vector is larger than its current size, then the
* capacity is changed to equal the size by replacing its internal data
* array, kept in the field {@code elementData}, with a smaller one. An
* application can use this operation to minimize the storage of a vector.
*/
public synchronized void trimToSize() {
modCount++;
int oldCapacity = elementData.length;
if (elementCount <= oldCapacity) {
elementData = Arrays.copyOf(elementData, elementCount);
}
}
/**
* Increases the capacity of this vector, if necessary, to ensure that it
* can hold at least the number of components specified by the minimum
* capacity argument.
*
* <p>
* If the current capacity of this vector is less than {@code minCapacity},
* then its capacity is increased by replacing its internal data array, kept
* in the field {@code elementData}, with a larger one. The size of the new
* data array will be the old size plus {@code capacityIncrement}, unless
* the value of {@code capacityIncrement} is less than or equal to zero, in
* which case the new capacity will be twice the old capacity; but if this
* new size is still smaller than {@code minCapacity}, then the new capacity
* will be {@code minCapacity}.
*
* @param minCapacity
* the desired minimum capacity
*/
public synchronized void ensureCapacity(int minCapacity) {
modCount++;
ensureCapacityHelper(minCapacity);
}
/**
* This implements the unsynchronized semantics of ensureCapacity.
* Synchronized methods in this class can internally call this method for
* ensuring capacity without incurring the cost of an extra synchronization.
*
* @see #ensureCapacity(int)
*/
private void ensureCapacityHelper(int minCapacity) {
int oldCapacity = elementData.length;
if (minCapacity > oldCapacity) {
Object[] oldData = elementData;
int newCapacity = (capacityIncrement > 0) ? (oldCapacity + capacityIncrement)
: (oldCapacity * 2);
if (newCapacity < minCapacity) {
newCapacity = minCapacity;
}
elementData = Arrays.copyOf(elementData, newCapacity);
}
}
/**
* Sets the size of this vector. If the new size is greater than the current
* size, new {@code null} items are added to the end of the vector. If the
* new size is less than the current size, all components at index
* {@code newSize} and greater are discarded.
*
* @param newSize
* the new size of this vector
* @throws ArrayIndexOutOfBoundsException
* if the new size is negative
*/
public synchronized void setSize(int newSize) {
modCount++;
if (newSize > elementCount) {
ensureCapacityHelper(newSize);
} else {
for (int i = newSize; i < elementCount; i++) {
elementData[i] = null;
}
}
elementCount = newSize;
}
// FIXME 1 defeito
/**
* Returns the number of components in this vector.
*
* @return the number of components in this vector
*/
public synchronized int size() {
return elementData.length;
}
/**
* Tests if this vector has no components.
*
* @return {@code true} if and only if this vector has no components, that
* is, its size is zero; {@code false} otherwise.
*/
public synchronized boolean isEmpty() {
return elementCount == 0;
}
/**
* Returns an enumeration of the components of this vector. The returned
* {@code Enumeration} object will generate all items in this vector. The
* first item generated is the item at index {@code 0}, then the item at
* index {@code 1}, and so on.
*
* @return an enumeration of the components of this vector
* @see Iterator
*/
public Enumeration<E> elements() {
return new Enumeration<E>() {
int count = 0;
public boolean hasMoreElements() {
return count < elementCount;
}
public E nextElement() {
synchronized (VectorTOFIX.this) {
if (count < elementCount) {
return (E) elementData[count++];
}
}
throw new NoSuchElementException("Vector Enumeration");
}
};
}
/**
* Returns {@code true} if this vector contains the specified element. More
* formally, returns {@code true} if and only if this vector contains at
* least one element {@code e} such that
* <tt>(o==null ? e==null : o.equals(e))</tt>.
*
* @param o
* element whose presence in this vector is to be tested
* @return {@code true} if this vector contains the specified element
*/
public boolean contains(Object o) {
return indexOf(o, 0) >= 0;
}
/**
* Returns the index of the first occurrence of the specified element in
* this vector, or -1 if this vector does not contain the element. More
* formally, returns the lowest index {@code i} such that
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
* or -1 if there is no such index.
*
* @param o
* element to search for
* @return the index of the first occurrence of the specified element in
* this vector, or -1 if this vector does not contain the element
*/
public int indexOf(Object o) {
return indexOf(o, 0);
}
/**
* Returns the index of the first occurrence of the specified element in
* this vector, searching forwards from {@code index}, or returns -1 if the
* element is not found. More formally, returns the lowest index {@code i}
* such that
* <tt>(i >= index && (o==null ? get(i)==null : o.equals(get(i))))</tt>
* , or -1 if there is no such index.
*
* @param o
* element to search for
* @param index
* index to start searching from
* @return the index of the first occurrence of the element in this vector
* at position {@code index} or later in the vector; {@code -1} if
* the element is not found.
* @throws IndexOutOfBoundsException
* if the specified index is negative
* @see Object#equals(Object)
*/
public synchronized int indexOf(Object o, int index) {
if (o == null) {
for (int i = index; i < elementCount; i++)
if (elementData[i] == null)
return i;
} else {
for (int i = index; i < elementCount; i++)
if (o.equals(elementData[i]))
return i;
}
return -1;
}
/**
* Returns the index of the last occurrence of the specified element in this
* vector, or -1 if this vector does not contain the element. More formally,
* returns the highest index {@code i} such that
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
* or -1 if there is no such index.
*
* @param o
* element to search for
* @return the index of the last occurrence of the specified element in this
* vector, or -1 if this vector does not contain the element
*/
public synchronized int lastIndexOf(Object o) {
return lastIndexOf(o, elementCount - 1);
}
/**
* Returns the index of the last occurrence of the specified element in this
* vector, searching backwards from {@code index}, or returns -1 if the
* element is not found. More formally, returns the highest index {@code i}
* such that
* <tt>(i <= index && (o==null ? get(i)==null : o.equals(get(i))))</tt>
* , or -1 if there is no such index.
*
* @param o
* element to search for
* @param index
* index to start searching backwards from
* @return the index of the last occurrence of the element at position less
* than or equal to {@code index} in this vector; -1 if the element
* is not found.
* @throws IndexOutOfBoundsException
* if the specified index is greater than or equal to the
* current size of this vector
*/
public synchronized int lastIndexOf(Object o, int index) {
if (index >= elementCount)
throw new IndexOutOfBoundsException(index + " >= " + elementCount);
if (o == null) {
for (int i = index; i >= 0; i--)
if (elementData[i] == null)
return i;
} else {
for (int i = index; i >= 0; i--)
if (o.equals(elementData[i]))
return i;
}
return -1;
}
/**
* Returns the component at the specified index.
*
* <p>
* This method is identical in functionality to the {@link #get(int)} method
* (which is part of the {@link List} interface).
*
* @param index
* an index into this vector
* @return the component at the specified index
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index >= size()})
*/
public synchronized E elementAt(int index) {
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= "
+ elementCount);
}
return (E) elementData[index];
}
/**
* Returns the last component of the vector.
*
* @return the last component of the vector, i.e., the component at index
* <code>size() - 1</code>.
* @throws NoSuchElementException
* if this vector is empty
*/
public synchronized E lastElement() {
if (elementCount == 0) {
throw new NoSuchElementException();
}
return (E) elementData[elementCount - 1];
}
/**
* Sets the component at the specified {@code index} of this vector to be
* the specified object. The previous component at that position is
* discarded.
*
* <p>
* The index must be a value greater than or equal to {@code 0} and less
* than the current size of the vector.
*
* <p>
* This method is identical in functionality to the
* {@link #set(int, Object) set(int, E)} method (which is part of the
* {@link List} interface). Note that the {@code set} method reverses the
* order of the parameters, to more closely match array usage. Note also
* that the {@code set} method returns the old value that was stored at the
* specified position.
*
* @param obj
* what the component is to be set to
* @param index
* the specified index
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index >= size()})
*/
public synchronized void setElementAt(E obj, int index) {
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= "
+ elementCount);
}
elementData[index] = obj;
}
// FIXME 1 defeito
/**
* Deletes the component at the specified index. Each component in this
* vector with an index greater or equal to the specified {@code index} is
* shifted downward to have an index one smaller than the value it had
* previously. The size of this vector is decreased by {@code 1}.
*
* <p>
* The index must be a value greater than or equal to {@code 0} and less
* than the current size of the vector.
*
* <p>
* This method is identical in functionality to the {@link #remove(int)}
* method (which is part of the {@link List} interface). Note that the
* {@code remove} method returns the old value that was stored at the
* specified position.
*
* @param index
* the index of the object to remove
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index >= size()})
*/
public synchronized void removeElementAt(int index) {
modCount++;
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= "
+ elementCount);
} else if (index < 0) {
throw new ArrayIndexOutOfBoundsException(index);
}
int j = elementCount - index - 1;
if (j >= 0) {
System.arraycopy(elementData, index + 1, elementData, index, j);
}
elementCount--;
elementData[elementCount] = null; /* to let gc do its work */
}
/**
* Inserts the specified object as a component in this vector at the
* specified {@code index}. Each component in this vector with an index
* greater or equal to the specified {@code index} is shifted upward to have
* an index one greater than the value it had previously.
*
* <p>
* The index must be a value greater than or equal to {@code 0} and less
* than or equal to the current size of the vector. (If the index is equal
* to the current size of the vector, the new element is appended to the
* Vector.)
*
* <p>
* This method is identical in functionality to the
* {@link #add(int, Object) add(int, E)} method (which is part of the
* {@link List} interface). Note that the {@code add} method reverses the
* order of the parameters, to more closely match array usage.
*
* @param obj
* the component to insert
* @param index
* where to insert the new component
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index > size()})
*/
public synchronized void insertElementAt(E obj, int index) {
modCount++;
if (index > elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " > "
+ elementCount);
}
ensureCapacityHelper(elementCount + 1);
System.arraycopy(elementData, index, elementData, index + 1,
elementCount - index);
elementData[index] = obj;
elementCount++;
}
/**
* Adds the specified component to the end of this vector, increasing its
* size by one. The capacity of this vector is increased if its size becomes
* greater than its capacity.
*
* <p>
* This method is identical in functionality to the {@link #add(Object)
* add(E)} method (which is part of the {@link List} interface).
*
* @param obj
* the component to be added
*/
public synchronized void addElement(E obj) {
modCount++;
ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = obj;
}
/**
* Removes the first (lowest-indexed) occurrence of the argument from this
* vector. If the object is found in this vector, each component in the
* vector with an index greater or equal to the object's index is shifted
* downward to have an index one smaller than the value it had previously.
*
* <p>
* This method is identical in functionality to the {@link #remove(Object)}
* method (which is part of the {@link List} interface).
*
* @param obj
* the component to be removed
* @return {@code true} if the argument was a component of this vector;
* {@code false} otherwise.
*/
public synchronized boolean removeElement(Object obj) {
modCount++;
int i = indexOf(obj);
if (i >= 0) {
removeElementAt(i);
return true;
}
return false;
}
/**
* Removes all components from this vector and sets its size to zero.
*
* <p>
* This method is identical in functionality to the {@link #clear} method
* (which is part of the {@link List} interface).
*/
public synchronized void removeAllElements() {
modCount++;
// Let gc do its work
for (int i = 0; i < elementCount; i++)
elementData[i] = null;
elementCount = 0;
}
// Positional Access Operations
/**
* Returns the element at the specified position in this Vector.
*
* @param index
* index of the element to return
* @return object at the specified index
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index >= size()})
* @since 1.2
*/
public synchronized E get(int index) {
if (index >= elementCount)
throw new ArrayIndexOutOfBoundsException(index);
return (E) elementData[index];
}
/**
* Replaces the element at the specified position in this Vector with the
* specified element.
*
* @param index
* index of the element to replace
* @param element
* element to be stored at the specified position
* @return the element previously at the specified position
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index >= size()})
* @since 1.2
*/
public synchronized E set(int index, E element) {
if (index >= elementCount)
throw new ArrayIndexOutOfBoundsException(index);
Object oldValue = elementData[index];
elementData[index] = element;
return (E) oldValue;
}
/**
* Appends the specified element to the end of this Vector.
*
* @param e
* element to be appended to this Vector
* @return {@code true} (as specified by {@link Collection#add})
* @since 1.2
*/
public synchronized boolean add(E e) {
modCount++;
ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = e;
return true;
}
/**
* Removes the first occurrence of the specified element in this Vector If
* the Vector does not contain the element, it is unchanged. More formally,
* removes the element with the lowest index i such that
* {@code (o==null ? get(i)==null : o.equals(get(i)))} (if such an element
* exists).
*
* @param o
* element to be removed from this Vector, if present
* @return true if the Vector contained the specified element
* @since 1.2
*/
public boolean remove(Object o) {
return removeElement(o);
}
/**
* Inserts the specified element at the specified position in this Vector.
* Shifts the element currently at that position (if any) and any subsequent
* elements to the right (adds one to their indices).
*
* @param index
* index at which the specified element is to be inserted
* @param element
* element to be inserted
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index > size()})
* @since 1.2
*/
public void add(int index, E element) {
insertElementAt(element, index);
}
/**
* Removes the element at the specified position in this Vector. Shifts any
* subsequent elements to the left (subtracts one from their indices).
* Returns the element that was removed from the Vector.
*
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index >= size()})
* @param index
* the index of the element to be removed
* @return element that was removed
* @since 1.2
*/
public synchronized E remove(int index) {
modCount++;
if (index >= elementCount)
throw new ArrayIndexOutOfBoundsException(index);
Object oldValue = elementData[index];
int numMoved = elementCount - index - 1;
if (numMoved > 0)
System.arraycopy(elementData, index + 1, elementData, index,
numMoved);
elementData[--elementCount] = null; // Let gc do its work
return (E) oldValue;
}
/**
* Removes all of the elements from this Vector. The Vector will be empty
* after this call returns (unless it throws an exception).
*
* @since 1.2
*/
public void clear() {
removeAllElements();
}
// Bulk Operations
/**
* Returns true if this Vector contains all of the elements in the specified
* Collection.
*
* @param c
* a collection whose elements will be tested for containment in
* this Vector
* @return true if this Vector contains all of the elements in the specified
* collection
* @throws NullPointerException
* if the specified collection is null
*/
public synchronized boolean containsAll(Collection<?> c) {
return super.containsAll(c);
}
/**
* Appends all of the elements in the specified Collection to the end of
* this Vector, in the order that they are returned by the specified
* Collection's Iterator. The behavior of this operation is undefined if the
* specified Collection is modified while the operation is in progress.
* (This implies that the behavior of this call is undefined if the
* specified Collection is this Vector, and this Vector is nonempty.)
*
* @param c
* elements to be inserted into this Vector
* @return {@code true} if this Vector changed as a result of the call
* @throws NullPointerException
* if the specified collection is null
* @since 1.2
*/
public synchronized boolean addAll(Collection<? extends E> c) {
modCount++;
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacityHelper(elementCount + numNew);
System.arraycopy(a, 0, elementData, elementCount, numNew);
elementCount += numNew;
return numNew != 0;
}
/**
* Removes from this Vector all of its elements that are contained in the
* specified Collection.
*
* @param c
* a collection of elements to be removed from the Vector
* @return true if this Vector changed as a result of the call
* @throws ClassCastException
* if the types of one or more elements in this vector are
* incompatible with the specified collection (optional)
* @throws NullPointerException
* if this vector contains one or more null elements and the
* specified collection does not support null elements
* (optional), or if the specified collection is null
* @since 1.2
*/
public synchronized boolean removeAll(Collection<?> c) {
return super.removeAll(c);
}
/**
* Retains only the elements in this Vector that are contained in the
* specified Collection. In other words, removes from this Vector all of its
* elements that are not contained in the specified Collection.
*
* @param c
* a collection of elements to be retained in this Vector (all
* other elements are removed)
* @return true if this Vector changed as a result of the call
* @throws ClassCastException
* if the types of one or more elements in this vector are
* incompatible with the specified collection (optional)
* @throws NullPointerException
* if this vector contains one or more null elements and the
* specified collection does not support null elements
* (optional), or if the specified collection is null
* @since 1.2
*/
public synchronized boolean retainAll(Collection<?> c) {
return super.retainAll(c);
}
/**
* Inserts all of the elements in the specified Collection into this Vector
* at the specified position. Shifts the element currently at that position
* (if any) and any subsequent elements to the right (increases their
* indices). The new elements will appear in the Vector in the order that
* they are returned by the specified Collection's iterator.
*
* @param index
* index at which to insert the first element from the specified
* collection
* @param c
* elements to be inserted into this Vector
* @return {@code true} if this Vector changed as a result of the call
* @throws ArrayIndexOutOfBoundsException
* if the index is out of range (
* {@code index < 0 || index > size()})
* @throws NullPointerException
* if the specified collection is null
* @since 1.2
*/
public synchronized boolean addAll(int index, Collection<? extends E> c) {
modCount++;
if (index < 0 || index > elementCount)
throw new ArrayIndexOutOfBoundsException(index);
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacityHelper(elementCount + numNew);
int numMoved = elementCount - index;
if (numMoved > 0)
System.arraycopy(elementData, index, elementData, index + numNew,
numMoved);
System.arraycopy(a, 0, elementData, index, numNew);
elementCount += numNew;
return numNew != 0;
}
/**
* Compares the specified Object with this Vector for equality. Returns true
* if and only if the specified Object is also a List, both Lists have the
* same size, and all corresponding pairs of elements in the two Lists are
* <em>equal</em>. (Two elements {@code e1} and {@code e2} are
* <em>equal</em> if {@code (e1==null ? e2==null :
* e1.equals(e2))}.) In other words, two Lists are defined to be equal if
* they contain the same elements in the same order.
*
* @param o
* the Object to be compared for equality with this Vector
* @return true if the specified Object is equal to this Vector
*/
public synchronized boolean equals(Object o) {
return super.equals(o);
}
/**
* Returns the hash code value for this Vector.
*/
public synchronized int hashCode() {
return super.hashCode();
}
/**
* Returns a string representation of this Vector, containing the String
* representation of each element.
*/
public synchronized String toString() {
return super.toString();
}
// FIXME 1 defeito
/**
* Removes from this List all of the elements whose index is between
* fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding
* elements to the left (reduces their index). This call shortens the
* ArrayList by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this
* operation has no effect.)
*
* @param fromIndex
* index of first element to be removed
* @param toIndex
* index after last element to be removed
*/
protected synchronized void removeRange(int fromIndex, int toIndex) {
modCount++;
int numMoved = elementCount;
System.arraycopy(elementData, toIndex, elementData, fromIndex, numMoved);
// Let gc do its work
int newElementCount = elementCount - (toIndex - fromIndex);
while (elementCount != newElementCount)
elementData[--elementCount] = null;
}
/**
* Save the state of the {@code Vector} instance to a stream (that is,
* serialize it). This method is present merely for synchronization. It just
* calls the default writeObject method.
*/
private synchronized void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
s.defaultWriteObject();
}
}
| [
"karensantosrocha@gmail.com"
] | karensantosrocha@gmail.com |
28695b847e07de8f03feef22c34dcc245057fede | 4737211958ad98823bfada0515bb7943992aca13 | /src/main/java/collab/data/utils/EntityFactory.java | eb30cb25ab597bba20eba5d53493b4640ae857fe | [] | no_license | Gal-Greenberg/Shopping-backend | 652a1d36d0da538a56fa3de6fe3e3e3846f3aa90 | 251bd05880c23cbe477c6e8b4b452c7db3be6524 | refs/heads/master | 2023-05-28T06:58:40.431203 | 2020-05-24T08:52:43 | 2020-05-24T08:52:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package collab.data.utils;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import collab.data.ActionEntity;
import collab.data.ElementEntity;
import collab.data.UserEntity;
import collab.data.UserRole;
public interface EntityFactory {
public UserEntity createNewUser(String userId, String username,
String avatar, UserRole role);
public ElementEntity createNewElement(String elementId, String name, String type, boolean active,
java.util.Date createdTimestamp, String createdBy, ElementEntity parentElement,
Map<String,Object> elementAttributes);
public ActionEntity createNewAction(String actionId, String elementId, String invokedBy, String actionType,
java.util.Date createdTimestamp, Map<String,
Object> actionAttributes);
public ElementEntity createNewElement(String elementId, String name, String type, boolean active, Date createdTimestamp, String createdBy,
ElementEntity parentElement , HashMap<String, Object> elementAttributes);
}
| [
"galzilca@gmail.com"
] | galzilca@gmail.com |
b88cd62cb1ab753047784f59c98a843a1037e159 | 393693ac791b9377ed30d5e4276febb1d82c7de8 | /shell offline/allfiles/tempo/1405016/1405016/src/Stuffing/Frame.java | e008f7f1fe192ef12ceaa70acc5ee02e273a59a3 | [] | no_license | Mritunjoy71/CSE_314-OS-Sessional | dc2672126acfb3dbef4424769af8c48fd1554dc6 | 84648c164124ddc65c43e33ee6b3e9113e0ea513 | refs/heads/master | 2023-02-19T11:12:16.080216 | 2021-01-21T22:17:40 | 2021-01-21T22:17:40 | 331,764,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java | package Stuffing;
public class Frame {
byte kind_of_frame;
byte sec_no;
byte ack_no;
byte[] payload;
byte checksum;
public Frame(byte kind_of_frame, byte sec_no, byte ack_no, byte[] payload) {
this.kind_of_frame = kind_of_frame;
this.sec_no = sec_no;
this.ack_no = ack_no;
this.payload = payload;
this.checksum = (byte)(kind_of_frame ^ (byte)(sec_no ^ ack_no));
for (int i = 0; i < payload.length; i++)
this.checksum = (byte) (this.checksum ^ payload[i]);
}
public byte getChecksum() {
return checksum;
}
public void setChecksum(byte checksum) {
this.checksum = checksum;
}
public byte[] getPayload() {
return payload;
}
public void setPayload(byte[] payload) {
this.payload = payload;
}
public byte getSec_no() {
return sec_no;
}
public void setSec_no(byte sec_no) {
this.sec_no = sec_no;
}
public byte getKind_of_frame() {
return kind_of_frame;
}
public void setKind_of_frame(byte kind_of_frame) {
this.kind_of_frame = kind_of_frame;
}
public byte getAck_no() {
return ack_no;
}
public void setAck_no(byte ack_no) {
this.ack_no = ack_no;
}
}
| [
"you@example.com"
] | you@example.com |
24d5c2c32339be35539f230b98c6a3d24f1cb67d | cb0bbf825b8114c05210d20e77c6bb292f085d41 | /src/test/java/com/arobotv/problems/p0001_p0100/p0033_search_in_rotate_sorted_array/SearchRotateSortedArrayTest.java | 5fc02e6c895e74830a3052890908b4ace9b705a1 | [
"Apache-2.0"
] | permissive | arobot/LeetCode | 9e8c754ad53a5fdfa02efa2d8dd7660d8704f2be | 8bfc5a1b0e6419fc2e5cc9317ae4f9de7ab93195 | refs/heads/remote | 2023-05-12T14:12:00.362303 | 2023-05-10T03:51:15 | 2023-05-10T03:51:15 | 74,114,048 | 0 | 0 | null | 2022-03-17T03:50:44 | 2016-11-18T09:16:44 | Java | UTF-8 | Java | false | false | 1,567 | java | package com.arobotv.problems.p0001_p0100.p0033_search_in_rotate_sorted_array;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class SearchRotateSortedArrayTest {
static SearchRotateSortedArray searchRotateSortedArray = new SearchRotateSortedArray();
@Test
void testSearch() {
int[] nums = { 4, 5, 6, 7, 0, 1, 2 };
Assertions.assertEquals(4, searchRotateSortedArray.search(nums, 0));
}
@Test
void testSearch2() {
int[] nums = { 4, 5, 6, 7, 0, 1, 2 };
Assertions.assertEquals(3, searchRotateSortedArray.search(nums, 7));
}
@Test
void testSearch3() {
int[] nums = { 4, 5, 6, 7, 0, 1, 2 };
Assertions.assertEquals(2, searchRotateSortedArray.search(nums, 6));
}
@Test
void testSearch4() {
int[] nums = { 4, 5, 6, 7, 0, 1, 2 };
Assertions.assertEquals(5, searchRotateSortedArray.search(nums, 1));
}
@Test
void testSearch5() {
int[] nums = { 4, 5, 6, 7, 0, 1, 2 };
Assertions.assertEquals(-1, searchRotateSortedArray.search(nums, 3));
}
@Test
void testSearch6() {
int[] nums = { 1 };
Assertions.assertEquals(0, searchRotateSortedArray.search(nums, 1));
}
@Test
void testSearch7() {
int[] nums = { 1 };
Assertions.assertEquals(-1, searchRotateSortedArray.search(nums, -11));
}
@Test
void testSearch8() {
int[] nums = { 5,1,3 };
Assertions.assertEquals(2, searchRotateSortedArray.search(nums, 3));
}
}
| [
"niweigede@163.com"
] | niweigede@163.com |
540b5fbdf2a491f63f05135c30acd1f3ff1c9339 | 6fc3dec72a15bda990b6e309500f77c62c7b4f35 | /src/main/java/product_pkg/RemoveFromCartServlet.java | bae70249bd6de44a1435f31ed97613bbd2a8e39b | [] | no_license | yasmin-ahmed28/E-Commerce | b90f74d6aec3dcfb13b0379de9b92418140f1995 | 447eb44f91fa7fafdf119f286e1efabb4b133db1 | refs/heads/master | 2020-03-15T17:45:23.295574 | 2018-04-25T13:40:27 | 2018-04-25T13:40:27 | 132,268,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java |
package product_pkg;
import dbconnection.DBConnection;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RemoveFromCartServlet extends HttpServlet {
private ProductDAO productDAO;
private DBConnection dbConn = new DBConnection();
private ServletConfig sConf;
@Override
public void init(ServletConfig config) throws ServletException {
productDAO = new ProductDAO(dbConn);
sConf = config;
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
if(request.getParameter("cartItemIdToRemove") != null) {
try {
productDAO.removeFromCart(Integer.parseInt(request.getParameter("cartItemIdToRemove")));
out.write("done");
} catch (SQLException ex) {
Logger.getLogger(RemoveFromCartServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}
| [
"yasso64@github.com"
] | yasso64@github.com |
6064336c19c53c297072900201b48563e6304eed | 073231dca7e07d8513c8378840f2d22b069ae93f | /modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201608/LiveStreamEventServiceLocator.java | 25a14ca0f7234c8ed078a4ab4ad275100a5634c2 | [
"Apache-2.0"
] | permissive | zaper90/googleads-java-lib | a884dc2268211306416397457ab54798ada6a002 | aa441cd7057e6a6b045e18d6e7b7dba306085200 | refs/heads/master | 2021-01-01T19:14:01.743242 | 2017-07-17T15:48:32 | 2017-07-17T15:48:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,773 | java | // Copyright 2016 Google Inc. 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.
/**
* LiveStreamEventServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.dfp.axis.v201608;
public class LiveStreamEventServiceLocator extends org.apache.axis.client.Service implements com.google.api.ads.dfp.axis.v201608.LiveStreamEventService {
public LiveStreamEventServiceLocator() {
}
public LiveStreamEventServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public LiveStreamEventServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for LiveStreamEventServiceInterfacePort
private java.lang.String LiveStreamEventServiceInterfacePort_address = "https://ads.google.com/apis/ads/publisher/v201608/LiveStreamEventService";
public java.lang.String getLiveStreamEventServiceInterfacePortAddress() {
return LiveStreamEventServiceInterfacePort_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String LiveStreamEventServiceInterfacePortWSDDServiceName = "LiveStreamEventServiceInterfacePort";
public java.lang.String getLiveStreamEventServiceInterfacePortWSDDServiceName() {
return LiveStreamEventServiceInterfacePortWSDDServiceName;
}
public void setLiveStreamEventServiceInterfacePortWSDDServiceName(java.lang.String name) {
LiveStreamEventServiceInterfacePortWSDDServiceName = name;
}
public com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceInterface getLiveStreamEventServiceInterfacePort() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(LiveStreamEventServiceInterfacePort_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getLiveStreamEventServiceInterfacePort(endpoint);
}
public com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceInterface getLiveStreamEventServiceInterfacePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceSoapBindingStub _stub = new com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceSoapBindingStub(portAddress, this);
_stub.setPortName(getLiveStreamEventServiceInterfacePortWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setLiveStreamEventServiceInterfacePortEndpointAddress(java.lang.String address) {
LiveStreamEventServiceInterfacePort_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceSoapBindingStub _stub = new com.google.api.ads.dfp.axis.v201608.LiveStreamEventServiceSoapBindingStub(new java.net.URL(LiveStreamEventServiceInterfacePort_address), this);
_stub.setPortName(getLiveStreamEventServiceInterfacePortWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("LiveStreamEventServiceInterfacePort".equals(inputPortName)) {
return getLiveStreamEventServiceInterfacePort();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201608", "LiveStreamEventService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201608", "LiveStreamEventServiceInterfacePort"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("LiveStreamEventServiceInterfacePort".equals(portName)) {
setLiveStreamEventServiceInterfacePortEndpointAddress(address);
}
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}
| [
"api.cseeley@gmail.com"
] | api.cseeley@gmail.com |
9c0227b1a4344aa26bfbc8857d40f4822efa9a61 | e0601ef164bca0aae41b2943347fe5641e72d793 | /EJERCICIOS PRO 05/Ejercicio06.java | c5933a22114952df2786686ce0b1105ea0a5e176 | [] | no_license | Miguelgm1693/ejercicios-java | 767fb67dbf2cbc95469156e864da4c2ccafa34ab | 9d045859e700f03cf8caebdcfe0f519061da3036 | refs/heads/master | 2020-08-01T00:31:30.753219 | 2020-03-18T22:59:48 | 2020-03-18T22:59:48 | 210,800,305 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | public class Ejercicio06 {
public static void main(String[]args) {
System.out.println("En este programa vamos a mostrar los multiplos de 5 hasta el número 100");
int n = 320;
do {
System.out.println(n);
n -= 20;
} while (n > 140);
}
}
| [
"gonzalezmoramiguel@gmail.com"
] | gonzalezmoramiguel@gmail.com |
951aec52936bdaea8195bcb27c25cd534e305714 | 81ae98ac024cd3e24a5b2f48f9ba8dccc620ccee | /src/main/java/org/rash/projectallocationsystem/Dto/batch/SkillSetListDto.java | 61473f1ffc1f1b1db8ec71b022f953b6cbc70f1f | [] | no_license | MohammadRasool-Shaik/ProjectAllocationSystem | f236b8e746e571e7f4db6a828e094a386e02a596 | 24b5f2e048efb2486a9130e5443c708e2540c874 | refs/heads/master | 2021-01-12T12:46:53.320760 | 2017-08-08T03:44:12 | 2017-08-08T03:44:12 | 69,858,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,042 | java | package org.rash.projectallocationsystem.Dto.batch;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.rash.projectallocationsystem.Dto.SkillSetDto;
import org.rash.projectallocationsystem.Dto.StatusDto;
/**
* @author rasool.shaik
*
*/
public class SkillSetListDto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<SkillSetDto> skills = new ArrayList<SkillSetDto>();
private StatusDto statusDto;
/**
*
*/
public SkillSetListDto() {
super();
}
/**
* @return the skills
*/
public List<SkillSetDto> getSkills() {
return skills;
}
/**
* @param skills
* the skills to set
*/
public void setSkills(List<SkillSetDto> skills) {
this.skills = skills;
}
/**
* @return the statusDto
*/
public StatusDto getStatusDto() {
return statusDto;
}
/**
* @param statusDto
* the statusDto to set
*/
public void setStatusDto(StatusDto statusDto) {
this.statusDto = statusDto;
}
}
| [
"rasool1988@gmail.com"
] | rasool1988@gmail.com |
3f7514da8a16760b7472f737046a340c1484a326 | a1a51aad102f9f82647bb4624940bf1fd0486def | /platform/src/featurea/audio/Audio.java | 35842e44687ff05b4694b67f35619d766d7ccceb | [] | no_license | Madzi/featurea | 337c187b19c69e82956a4b8d711eb40dbbf07f7a | 4ee44d5910617c1233a77e0787d85717ee5347a0 | refs/heads/master | 2020-12-11T05:58:44.584623 | 2016-07-25T20:54:07 | 2016-07-25T20:54:07 | 64,206,389 | 0 | 1 | null | 2016-07-26T09:00:15 | 2016-07-26T09:00:15 | null | UTF-8 | Java | false | false | 5,196 | java | package featurea.audio;
import featurea.app.Context;
import featurea.app.MediaPlayer;
import java.util.*;
public final class Audio {
private final MediaPlayer mediaPlayer;
final Map<String, List<Sound>> soundMap = new WeakHashMap<String, List<Sound>>();
private final Map<String, Music> musicMap = new HashMap<String, Music>();
private double volume;
public boolean isEnable;
public Audio(MediaPlayer mediaPlayer) {
this.mediaPlayer = mediaPlayer;
}
public Clip load(String file) {
int index = file.lastIndexOf('/');
if (index == -1) {
return loadSound(file);
} else {
String dir = file.substring(0, index);
index = dir.lastIndexOf('/');
String prefix = dir.substring(index + 1, dir.length());
if ("music".equalsIgnoreCase(prefix)) {
return loadMusic(file);
} else {
return loadSound(file);
}
}
}
private Clip loadSound(String file) {
List<Sound> sounds = soundMap.get(file);
if (sounds == null) {
sounds = new ArrayList<>();
}
Sound result = new Sound(this, file);
sounds.add(result);
soundMap.put(file, sounds);
return result;
}
private Music loadMusic(String file) {
Music result = musicMap.get(file);
if (result == null) {
final MusicDriver driver = Context.al.newMusic(file);
result = new Music(this, file, driver);
musicMap.put(file, result);
}
return result;
}
public void release(String file) {
if (musicMap.containsKey(file)) {
Music music = musicMap.get(file);
music.driver.release();
musicMap.remove(music);
} else if (soundMap.containsKey(file)) {
Sound sound = soundMap.get(file).get(0);
sound.driver.releaseAllStreams();
soundMap.remove(file);
}
}
public Clip get(String file) {
if (soundMap.containsKey(file)) {
Sound clip = new Sound(this, file);
putSound(file, clip);
return clip;
} else if (musicMap.containsKey(file)) {
return musicMap.get(file);
}
return null;
}
public void play(String file) {
if (!isEnable) {
return;
}
if (musicMap.containsKey(file)) {
musicMap.get(file).play();
} else if (soundMap.containsKey(file)) {
for (Sound sound : soundMap.get(file)) {
sound.play();
}
} else {
if (!mediaPlayer.isProduction()) {
mediaPlayer.loader.load(file);
} else {
System.err.println("Audio not load: " + file);
}
}
}
public void loop(String file) {
if (!isEnable) {
return;
}
Clip clip = get(file);
if (clip != null) {
clip.setLoop(true).play();
}
}
public void pause(String file) {
if (musicMap.containsKey(file)) {
musicMap.get(file).pause();
} else if (soundMap.containsKey(file)) {
for (Sound sound : soundMap.get(file)) {
sound.pause();
}
}
}
public void stop(String file) {
if (musicMap.containsKey(file)) {
musicMap.get(file).stop();
} else if (soundMap.containsKey(file)) {
for (Sound sound : soundMap.get(file)) {
sound.stop();
}
}
}
public void resumeAll() {
if (!isEnable) {
return;
}
for (List<Sound> soundsClips : soundMap.values()) {
for (Sound sound : soundsClips) {
sound.play();
}
}
for (Music music : musicMap.values()) {
music.play();
}
}
public void pauseAll() {
for (List<Sound> soundsClips : soundMap.values()) {
for (Sound sound : soundsClips) {
sound.pause();
}
}
for (Music music : musicMap.values()) {
music.pause();
}
}
public void stopAll() {
for (List<Sound> soundsClips : soundMap.values()) {
for (Sound sound : soundsClips) {
sound.stop();
}
}
for (Music music : musicMap.values()) {
music.pause();
}
}
public void releaseAll() {
for (List<Sound> soundsClips : soundMap.values()) {
soundsClips.get(0).driver.releaseAllStreams();
}
soundMap.clear();
for (Music music : musicMap.values()) {
music.release();
}
musicMap.clear();
}
public void setVolume(double volume) {
this.volume = volume;
for (Music music : musicMap.values()) {
music.driver.setVolume(volume);
}
for (List<Sound> soundsClips : soundMap.values()) {
Sound sound = soundsClips.get(0);
sound.driver.setVolumeStream(sound.id, volume);
}
}
public double getVolume() {
return volume;
}
private void putSound(String file, Sound sound) {
List<Sound> fileSounds = soundMap.get(file);
if (fileSounds == null) {
fileSounds = new ArrayList<Sound>();
}
fileSounds.add(sound);
soundMap.put(file, fileSounds);
}
public Iterable<String> getClips() {
Set<String> result = new HashSet<String>();
result.addAll(soundMap.keySet());
result.addAll(musicMap.keySet());
return result;
}
public void onCreate() {
Context.al.init();
}
public void onDestroy() {
for (String file : getClips()) {
release(file);
}
if (Context.al != null) {
Context.al.destroy();
}
}
}
| [
"kolesnikovichdn@gmail.com"
] | kolesnikovichdn@gmail.com |
ff5aca61e99054c6be289e99e9f84c4a7c303e15 | 6257e70ac89e40abfb1d755647612142c559442e | /app/src/main/java/demoapp/dapulse/com/dapulsedemoapp/dagger/EmployeesModule.java | 22c0e854aa05f32a620bd7b769ca8aba7d93ab17 | [] | no_license | DaPulse/MobileTest-Android | 18c4604a4be295544c194c92fae4646a55abe46b | 139c6b589b46b0b1e6b3d8fad7610ae9f6164838 | refs/heads/master | 2021-03-24T12:31:29.106700 | 2017-07-23T07:52:58 | 2017-07-23T07:52:58 | 81,194,572 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,580 | java | package demoapp.dapulse.com.dapulsedemoapp.dagger;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import javax.inject.Named;
import dagger.Module;
import dagger.Provides;
import demoapp.dapulse.com.dapulsedemoapp.features.employees.EmployeeInteractor;
import demoapp.dapulse.com.dapulsedemoapp.features.employees.EmployeePresenter;
import demoapp.dapulse.com.dapulsedemoapp.features.employees.EmployeesVIP;
import demoapp.dapulse.com.dapulsedemoapp.features.employees.repo.EmployeeRepo;
import demoapp.dapulse.com.dapulsedemoapp.features.employees.repo.RealmEmployeeConverter;
@Module
public class EmployeesModule {
private final FragmentActivity activity;
public EmployeesModule(FragmentActivity activity) {
this.activity = activity;
}
@Provides @Named("activity")
@ActivityScope
Context provideActivityContext() {
return activity;
}
@Provides
@ActivityScope
EmployeesVIP.Interactor provideInteractor(ServerApi serverApi, EmployeesVIP.Repository repository) {
return new EmployeeInteractor(serverApi, repository);
}
@Provides
@ActivityScope
EmployeesVIP.Repository provideRepo(RealmEmployeeConverter converter, SharedPreferences prefs) {
return new EmployeeRepo(prefs, converter);
}
@Provides
@ActivityScope
EmployeePresenter providePresenter(EmployeesVIP.Interactor interactor) {
return new EmployeePresenter(interactor);
}
} | [
"ofer@dapulse.com"
] | ofer@dapulse.com |
8a00a4a7567f9a69cbea8fb6006da6bb67adfe93 | f048bed609d1406956000d004a2f2540110e3aa4 | /ms-kitchen/src/main/java/com/training/ykb/spring/KitchenRest.java | daacb2e2302032369c509417bbc3b2779573f130 | [] | no_license | osmanyaycioglu/ykb2906 | 8e73c851433dd0fe4868486a848dcc878bdf50d6 | 46596ae7750baf017c0117d9c3ed501b8691e1b4 | refs/heads/master | 2022-11-11T16:21:49.452212 | 2020-07-02T14:28:59 | 2020-07-02T14:28:59 | 276,019,309 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package com.training.ykb.spring;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/kitchen")
public class KitchenRest {
@Autowired
private KitchenManager km;
@PostMapping("/start/cooking")
public KitchenResponse startCook(@Validated @RequestBody final Order orderParam) {
return this.km.startCooking(orderParam);
}
}
| [
"osman.yaycioglu@gmail.com"
] | osman.yaycioglu@gmail.com |
07d0cfa0f38b16aeb7f1065dd5791426565deae9 | ff1796c374cf9934b446fae9e1241dd10b20ad6d | /app/src/main/java/com/example/jinkejinfuapplication/shouye/More_zixunActivity.java | 5ad0caa141ced6aeefcb85ec3facc5d435e003cd | [] | no_license | naiheanaihe/jinkejinfu | a11b6c7a1cf4b818ba4f4238a02cea8ed6ebd26e | 39495e8796a7e8574fef0262d6c2a1fa3e2cdf78 | refs/heads/master | 2020-03-17T00:30:36.242109 | 2018-12-01T05:25:59 | 2018-12-01T05:25:59 | 128,926,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,966 | java | package com.example.jinkejinfuapplication.shouye;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.example.jinkejinfuapplication.R;
import com.example.jinkejinfuapplication.base.AppBaseUrl;
import com.example.jinkejinfuapplication.base.BaseActivity;
import com.example.jinkejinfuapplication.taojinke.TuijianAdapter;
import com.example.jinkejinfuapplication.utils.LalaLog;
import com.example.jinkejinfuapplication.utils.ToastUtil;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.appsdream.nestrefresh.base.AbsRefreshLayout;
import cn.appsdream.nestrefresh.base.OnPullListener;
import cn.appsdream.nestrefresh.normalstyle.NestRefreshLayout;
public class More_zixunActivity extends BaseActivity implements OnPullListener {
private RecyclerView rec_tuijian;
private Shouye_zixunAdapter shouye_zixunAdapter;
private List<Map<String,String>> mList=new ArrayList<>();
private NestRefreshLayout nestRefreshLayout;
private int page=0;
@Override
protected void onActivityCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_more_zixun);
setTitle("更多资讯");
rec_tuijian= (RecyclerView) findViewById(R.id.rec_zixun);
LinearLayoutManager linManager1=new LinearLayoutManager(this, LinearLayoutManager.VERTICAL,false);
rec_tuijian.setLayoutManager(linManager1);
rec_tuijian.setHasFixedSize(true);
shouye_zixunAdapter =new Shouye_zixunAdapter(this,mList);
rec_tuijian.setAdapter(shouye_zixunAdapter);
nestRefreshLayout= (NestRefreshLayout) findViewById(R.id.nestlayou);
nestRefreshLayout.setOnLoadingListener(this);
}
@Override
protected void initData() {
redate();
}
private void redate() {
page=0;
mList.clear();
String url= AppBaseUrl.MORE_ZIXUN;
RequestParams params = new RequestParams(url);
params.addBodyParameter("str","0");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
LalaLog.i("更多资讯",result);
try {
JSONObject jObj = new JSONObject(result);
JSONArray jrry=jObj.getJSONArray("news");
for (int i=0;i<jrry.length();i++)
{
JSONObject ob=jrry.getJSONObject(i);
Map<String,String> map=new HashMap<String, String>();
map.put("gameId",ob.getString("gameId"));
map.put("background",AppBaseUrl.BASEURL+ob.getString("background"));
map.put("id",ob.getString("id"));
map.put("title",ob.getString("title"));
map.put("datetime",ob.getString("datetime"));
map.put("name",ob.getString("name"));
map.put("likenum",ob.getString("likenum"));
map.put("clicknum",ob.getString("clicknum"));
mList.add(map);
}
shouye_zixunAdapter.setmList(mList);
shouye_zixunAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
LalaLog.i("错误信息",ex.toString());
ToastUtil.show(More_zixunActivity.this,"网络发生错误!");
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
private void moredate() {
String url= AppBaseUrl.MORE_ZIXUN;
RequestParams params = new RequestParams(url);
params.addBodyParameter("str",page+"");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
LalaLog.i("更多资讯",result);
try {
ArrayList<Map<String,String>> mNewslist=new ArrayList<>();
JSONObject jObj = new JSONObject(result);
JSONArray jrry=jObj.getJSONArray("news");
for (int i=0;i<jrry.length();i++)
{
JSONObject ob=jrry.getJSONObject(i);
Map<String,String> map=new HashMap<String, String>();
map.put("gameId",ob.getString("gameId"));
map.put("background",AppBaseUrl.BASEURL+ob.getString("background"));
map.put("id",ob.getString("id"));
map.put("title",ob.getString("title"));
map.put("datetime",ob.getString("datetime"));
map.put("name",ob.getString("name"));
map.put("likenum",ob.getString("likenum"));
map.put("clicknum",ob.getString("clicknum"));
mNewslist.add(map);
}
if (mNewslist.size()==0)
{
nestRefreshLayout.onLoadFinished();
ToastUtil.show(More_zixunActivity.this,"没有更多数据了");
}else
{
mList.addAll(mNewslist);
nestRefreshLayout.onLoadFinished();
shouye_zixunAdapter.notifyItemRangeInserted(page*12,mNewslist.size());
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
LalaLog.i("错误信息",ex.toString());
ToastUtil.show(More_zixunActivity.this,"网络发生错误!");
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
@Override
protected void initListener() {
}
@Override
protected boolean isShowToolBar() {
return true;
}
@Override
public void onRefresh(AbsRefreshLayout listLoader) {
nestRefreshLayout.onLoadFinished();
page=0;
redate();
}
@Override
public void onLoading(AbsRefreshLayout listLoader) {
page+=1;
moredate();
}
}
| [
"2820175924@qq.com"
] | 2820175924@qq.com |
e97cab364077e62d7040ef2ccc42de47e2f4bb67 | c379297b6331a2b7f47d71c5f478a4ec31cd7fac | /app/src/main/java/com/bvm/ui_example_4/Quiz.java | 397c2eb9e884bd8014fdac64ace7f7c9b288b153 | [] | no_license | jayshah1x/Quiz.v.7 | 202f194ebcfdc630188032a69813ed221ce33eeb | 50e92de254acf2038f43b64e15c2d9df88bfb608 | refs/heads/master | 2022-04-22T13:20:39.659891 | 2020-04-27T11:10:35 | 2020-04-27T11:10:35 | 259,289,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,429 | java | package com.bvm.ui_example_4;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class Quiz extends AppCompatActivity {
private static TextView textViewQuestion, textViewScore, textViewQuestiononCount, countdownTimerText;
private static RadioButton rb1, rb2, rb3;
private static int questionCounter = 0, questionCountTotal , score = 0, var = 0, i =1;
private static boolean answered;
private static CountDownTimer countDownTimer;
private static RadioGroup rbGroup;
private static Button buttonConfirmNext;
private ColorStateList textColorDefaultRb;
int noOfMinutes = 30;
private static String[] Questions = new String[10];
String[] option1 = new String[10];
String[] option2 = new String[10] ;
String[] option3 = new String[10];
Integer[] correctanswer = new Integer[100];
private List<Question> questionList;
String j ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz);
/******Initialization****/
textViewQuestion = findViewById(R.id.text_view_question);
textViewScore = findViewById(R.id.text_view_score);
countdownTimerText = findViewById(R.id.text_view_countdonw);
rbGroup = findViewById(R.id.radio_group);
rb1 = findViewById(R.id.radio_button1);
rb2 = findViewById(R.id.radio_button2);
rb3 = findViewById(R.id.radio_button3);
buttonConfirmNext = findViewById(R.id.button);
textViewQuestiononCount = findViewById(R.id.text_view_question_count);
textColorDefaultRb = rb1.getTextColors();
getQuestion();
buttonConfirmNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!answered){
if(rb1.isChecked() | rb2.isChecked() |rb3.isChecked()){
stopCountdown();
checkAnswer();
}else{
Toast.makeText(Quiz.this, "Select one option", Toast.LENGTH_SHORT).show();
}
}else{
var++;
ShowNextQuestion();
Toast.makeText(Quiz.this, "Showing next question", Toast.LENGTH_SHORT).show();
}
}
private void ShowNextQuestion() {
stopCountdown();
noOfMinutes = 30 * 1000;
startTimer(noOfMinutes);
rb1.setTextColor(textColorDefaultRb);
rb2.setTextColor(textColorDefaultRb);
rb3.setTextColor(textColorDefaultRb);
rbGroup.clearCheck();
if (var < questionCountTotal) {
textViewQuestion.setText(Questions[var]);
rb1.setText(option1[var]);
rb2.setText(option2[var]);
rb3.setText(option3[var]);
textViewQuestiononCount.setText(var + " / " + questionCountTotal);
answered = false;
}
else{
Toast.makeText(Quiz.this, "You are done with the quiz", Toast.LENGTH_SHORT).show();
}
}
});
}
private void getQuestion() {
DatabaseReference myref = FirebaseDatabase.getInstance().getReference();
myref.addValueEventListener(new ValueEventListener() {
int Answer = 0;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
String Total = dataSnapshot.child("Subject").child("question").getValue().toString();
int value = Integer.parseInt(Total);
questionCountTotal = value;
for(int k=0;k <value; k++) {
i = k+1;
j = ("Question " + Integer.toString(i));
String Question = dataSnapshot.child(j).child("Que").getValue().toString();
String option1s = dataSnapshot.child(j).child("option 1").getValue().toString();
String option2s = dataSnapshot.child(j).child("option 2").getValue().toString();
String option3s = dataSnapshot.child(j).child("option 3").getValue().toString();
String correctAnswer = dataSnapshot.child(j).child("ans").getValue().toString();
Answer = Integer.parseInt(correctAnswer);
Questions[k] = Question;
option1[k] = option1s;
option2[k] = option2s;
option3[k] = option3s;
correctanswer[k] = (Integer.parseInt(correctAnswer));
}
FirstQuestion();
}
private void FirstQuestion() {
noOfMinutes = 30 * 1000;
startTimer(noOfMinutes);
textViewQuestion.setText(Questions[var]);
rb1.setText(option1[var]);
rb2.setText(option2[var]);
rb3.setText(option3[var]);
//ButtonFunc();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void checkAnswer() {
answered = true;
RadioButton rbSelected = findViewById(rbGroup.getCheckedRadioButtonId());
int answerNr = rbGroup.indexOfChild(rbSelected) + 1;
if(answerNr == correctanswer[var]){
score++;
textViewScore.setText("Score: " + score);
Toast.makeText(Quiz.this, "Your answer is correct", Toast.LENGTH_SHORT).show();
}
ShowSolution();
}
private void ShowSolution() {
rb1.setTextColor(Color.RED);
rb2.setTextColor(Color.RED);
rb3.setTextColor(Color.RED);
switch (correctanswer[var]){
case 1:
rb1.setTextColor(Color.GREEN);
textViewQuestion.setText("Answer 1 is correct");
break;
case 2:
rb2.setTextColor(Color.GREEN);
textViewQuestion.setText("Answer 2 is correct");
break;
case 3:
rb3.setTextColor(Color.GREEN);
textViewQuestion.setText("Answer 3 is correct");
break;
}
if (questionCounter < questionCountTotal) {
buttonConfirmNext.setText("NEXT");
}else{
buttonConfirmNext.setText("FINISH");
}
}
private void stopCountdown() {
if (countDownTimer != null) {
countDownTimer.cancel();
countDownTimer = null;
}
}
//Start Countodwn method
private void startTimer(int noOfMinutes) {
countDownTimer = new CountDownTimer(noOfMinutes, 1000) {
public void onTick(long millisUntilFinished) {
long millis = millisUntilFinished;
//Convert milliseconds into hour,minute and seconds
String hms = String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(millis) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millis)), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)));
countdownTimerText.setText(hms);//set text
}
public void onFinish() {
countdownTimerText.setText("TIME'S UP!!"); //On finish change timer text
countDownTimer = null;//set CountDownTimer to null
checkAnswer();
}
}.start();
}
}
/*
String Question = dataSnapshot.child("Question " + Integer.toString(i + 1)).child("Que").getValue().toString();
String option1s = dataSnapshot.child("Question "+ Integer.toString(i + 1)).child("option 1").getValue().toString();
String option2s = dataSnapshot.child("Question "+ Integer.toString(i + 1)).child("option 2").getValue().toString();
String option3s = dataSnapshot.child("Question "+ Integer.toString(i + 1)).child("option 3").getValue().toString();
String correctAnswer = dataSnapshot.child("Question " + Integer.toString(i + 1)).child("ans").getValue().toString();
int Answer = Integer.parseInt(correctAnswer);
Questions[i] = Question;
option1[i] = option1s;
option2[i] = option2s;
option3[i] =option3s;
correctanswer[i] = Answer;
*/
| [
"jayshahx01@gmail.com"
] | jayshahx01@gmail.com |
06cd0753d9e41d5de6567d070b23930890ee0438 | 7df62a93d307a01b1a42bb858d6b06d65b92b33b | /src/com/afunms/application/model/PSTypeVo.java | 6b956e2d639440ed0c59ba63d33316c4af03e754 | [] | no_license | wu6660563/afunms_fd | 79ebef9e8bca4399be338d1504faf9630c42a6e1 | 3fae79abad4f3eb107f1558199eab04e5e38569a | refs/heads/master | 2021-01-10T01:54:38.934469 | 2016-01-05T09:16:38 | 2016-01-05T09:16:38 | 48,276,889 | 0 | 1 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,992 | java | package com.afunms.application.model;
import com.afunms.common.base.BaseVo;
public class PSTypeVo extends BaseVo
{
private int id;
private String ipaddress;
private String port;
private String portdesc;
private int monflag;
private int flag;
private int timeout;
private String bid;
private String sendmobiles;
private String sendemail;
private String sendphone;
private int status;
private int supperid;//¹©Ó¦ÉÌid snow add at 2010-5-21
public int getSupperid() {
return supperid;
}
public void setSupperid(int supperid) {
this.supperid = supperid;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getIpaddress() {
return ipaddress;
}
public void setIpaddress(String ipaddress) {
this.ipaddress = ipaddress;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getPortdesc() {
return portdesc;
}
public void setPortdesc(String portdesc) {
this.portdesc = portdesc;
}
public int getMonflag() {
return monflag;
}
public void setMonflag(int monflag) {
this.monflag = monflag;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public String getBid() {
return bid;
}
public void setBid(String bid) {
this.bid = bid;
}
public String getSendmobiles() {
return sendmobiles;
}
public void setSendmobiles(String sendmobiles) {
this.sendmobiles = sendmobiles;
}
public String getSendemail() {
return sendemail;
}
public void setSendemail(String sendemail) {
this.sendemail = sendemail;
}
public String getSendphone() {
return sendphone;
}
public void setSendphone(String sendphone) {
this.sendphone = sendphone;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| [
"nick@comprame.com"
] | nick@comprame.com |
50b2a90b40770ce60791a1edf3a3826a673f7cdf | afff0d5bbc9e10cf7b3d3197c5a83cd656b060dc | /Snake/src/application/MenuController.java | b0a15ac5a82adcc22039306877a238b2e2db83df | [] | no_license | DrHelmholtz/snake | 9732f43a09121e4adba656f72b8bdc59a9e51d48 | c97e710ec45359c4c6ad5a6c09cd9fa5dcab806d | refs/heads/master | 2022-11-26T12:22:57.020532 | 2020-07-25T08:52:02 | 2020-07-25T08:52:02 | 282,404,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,154 | java | package application;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import Server.Client;
import Server.Points;
import javafx.application.Platform;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
/**
* Controller to the Menu.java
* @author Boldi
*
*/
public class MenuController implements Initializable{
@FXML
Button startgame_btn;
@FXML
Button exit_btn;
@FXML
Button properties_btn;
@FXML
Button leaderboards_btn;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
startgame_btn.setOnMousePressed(new EventHandler<Event>() {
@Override
public void handle(Event event) {
Menu.gamestart();
}
});
exit_btn.setOnMousePressed(new EventHandler<Event>() {
@Override
public void handle(Event event) {
Platform.exit();
}
});
properties_btn.setOnMousePressed(new EventHandler<Event>() {
@Override
public void handle(Event event) {
Menu.propertiesstart();
}
});
leaderboards_btn.setOnMousePressed(new EventHandler<Event>() {
@Override
public void handle(Event event){
List<Points> lp=Client.getPoints();
FXMLLoader loader=new FXMLLoader();
loader.setLocation(getClass().getResource("/resources/Leaderboards.fxml"));
try {
Parent leaderboardsParent=loader.load();
Scene leaderboardsScene=new Scene(leaderboardsParent);
leaderboardsScene.getStylesheets().add("/resources/application.css");
LeaderboardsController lc=loader.getController();
lc.initData(lp);
Stage window = (Stage)((Node)event.getSource()).getScene().getWindow();
window.setScene(leaderboardsScene);
window.show();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
| [
"szabo.boldi95@gmail.com"
] | szabo.boldi95@gmail.com |
b4bde09b274930732893f43517092fa060d37dc2 | c5595ee50a07bcb548c241eecaa3c565f7ff5db1 | /src/principal/TesteDeFolhaDePagamento.java | 7c1e859c3d9d85dc30a5dc3f9e815b5e2e7599c6 | [] | no_license | othonb/FolhaDePagamentoJavaPolimorfismo | 8ee3ca07d00cea0b15b034fb29cfb2699dbecea3 | 213b05888c92b4ad358fc0c57e81ed65a7946118 | refs/heads/master | 2021-08-17T17:20:49.521729 | 2017-11-21T13:07:54 | 2017-11-21T13:07:54 | 111,550,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,695 | java | package principal;
public class TesteDeFolhaDePagamento {
public static void main (String [] args) {
FuncionarioAssalariado funcionarioAssalariado =
new FuncionarioAssalariado("Fulano", "de Tal", "123456789-90", 200.00);
FuncionarioHorista funcionarioHorista =
new FuncionarioHorista("Sicrano", "de Tal", "1297894793-99", 20.00, 120.00);
FuncionarioComissionado funcionarioComissionado =
new FuncionarioComissionado("José", "Silva", "1212121212-22", 120.00, 0.23);
FuncionarioComissionadoComSalarioBase funcionarioComissionadoComSalarioBase =
new FuncionarioComissionadoComSalarioBase("Maria", "do Carmo", "78798797987-22", 100.00, 0.25, 980.00);
System.out.println ("Funcionários Processados Individualmente\n\n");
System.out.println (funcionarioAssalariado + " ganhou R$ " + funcionarioAssalariado.salario());
System.out.println (funcionarioHorista + " ganhou R$ " + funcionarioHorista.salario());
System.out.println (funcionarioComissionado + " ganhou R$ " + funcionarioComissionado.salario());
System.out.println (funcionarioComissionadoComSalarioBase + " ganhou R$ " + funcionarioComissionadoComSalarioBase.salario());
Funcionario [] funcionarios = new Funcionario [4];
funcionarios [0] = funcionarioAssalariado;
funcionarios [1] = funcionarioHorista;
funcionarios [2] = funcionarioComissionado;
funcionarios [3] = funcionarioComissionadoComSalarioBase;
for (Funcionario funcionarioAtual : funcionarios) {
System.out.println (funcionarioAtual);
if (funcionarioAtual instanceof FuncionarioComissionadoComSalarioBase) {
FuncionarioComissionadoComSalarioBase funcionario =
(FuncionarioComissionadoComSalarioBase) funcionarioAtual;
funcionario.setSalarioBase(1.10 * funcionario.getSalarioBase());
System.out.printf ("Novo salário base mais 10%% é: R$ %,.2f\n",
funcionario.getSalarioBase());
}
System.out.printf (" ganhou R$ %,.2f\n\n", funcionarioAtual.salario());
}
for (int i = 0; i < funcionarios.length; ++ i) {
System.out.printf ("Funcionario %d é um %s\n", i,
funcionarios[i].getClass().getName());
}
}
}
| [
"othonbatista@gmail.com"
] | othonbatista@gmail.com |
4bd8028c785916f39e9045792ade1fd6a0eb34a9 | 9cbbbf9fae9491939d7a28174ce8dfd9ad75a5fc | /coding_pratice/src/com/company/p_33.java | ec2e49bce56bc6a5c4351f1e13ee884dd35a79b5 | [] | no_license | U2jj19/u2jj_rep | a7982eca3b7319920f9a6deba73d67844ba88105 | dac1505c68209dfee5a980b55eaf07199e2fbc97 | refs/heads/master | 2023-06-30T14:12:54.483332 | 2021-08-04T20:45:21 | 2021-08-04T20:45:21 | 390,692,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package com.company;
import java.util.*;
public class p_33 {
public static void main(String[] args) {
try {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
char c = sc.next().charAt(0);
int count=0;
int n = str.length();
String str1 =str;
for (int i =0;i<n;i++)
{
if(str.charAt(i)==c)
{
count++;
}
}
System.out.println(count);
//System.out.println(str.split(" ",str.toUpperCase(str.charAt(0))));
}
catch (Exception e)
{
System.out.println(e);
}
}
}
| [
"u2jj.19@gmail.com"
] | u2jj.19@gmail.com |
f52e7c4cf468397a1ba6bdcea54d265f5f57cf7d | a4f385d06ede1f780c44607cf861be298cbb1699 | /NanoDegree/app/src/main/java/sd/chuongdao/nanodegree/Utils.java | f0e6d3c062f711ebe03e5afd47001543c82d624c | [] | no_license | riochuong/NanoDegree | b217452f6a156a601882095c65370441f6244281 | 09b9fde2a88545776cc0f493fe8d8b7a480123ba | refs/heads/master | 2021-01-10T05:14:24.751961 | 2015-06-29T02:41:29 | 2015-06-29T02:41:29 | 36,626,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package sd.chuongdao.nanodegree;
import android.content.Context;
import android.widget.Toast;
/**
* A collection of common use methods across the application
* Created by chuongdao on 6/5/15.
*/
public class Utils {
static Toast mToast = null;
/**
* Helper for displaying Toast
* @param ctx
* @param text
*/
public static void makeToast(Context ctx, String text) {
if (mToast != null)
mToast.cancel();
// save the reference to help reduce waiting time when showing toast
mToast = Toast.makeText(ctx,text,Toast.LENGTH_SHORT);
mToast.show();
}
}
| [
"riochuong@gmail.com"
] | riochuong@gmail.com |
36c87d184bdb299a755d33a6f038b56194f9ef8c | a75f5c2ad9552f0ae756d5cfa6eaa4d098fc74a8 | /autoparts-store/src/main/java/com/d1l/controller/adminpanel/CarsController.java | ce10834477f9af7936a14d20abc2296dd430c58b | [] | no_license | Dezzigner/autoparts | 6da4c190d2304efb97b3ee818ad1eb25ea38b11b | 29e5c1fe7745c8054be5239cf3878b3045cf6895 | refs/heads/master | 2021-05-03T16:15:56.175766 | 2016-09-23T04:45:24 | 2016-09-23T04:45:24 | 68,963,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,141 | java | package com.d1l.controller.adminpanel;
import com.d1l.dao.CarDao;
import com.d1l.model.Car;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CarsController extends ActionSupport {
private Car car;
private List<Car> carsList;
private int id;
@Override
public String execute() throws Exception {
carsList = CarDao.getCarsList();
return Action.SUCCESS;
}
public String update() {
if (!validate(getCar())) return Action.SUCCESS;
CarDao.addOrUpdateCar(getCar());
return Action.SUCCESS;
}
public String delete() {
CarDao.deleteCar(getId());
return Action.SUCCESS;
}
public String add() {
if (!validate(getCar())) return Action.SUCCESS;
CarDao.addOrUpdateCar(getCar());
return Action.SUCCESS;
}
public Car getCar() {
return car;
}
public void setCar(Car car) {
this.car = car;
}
public List<Car> getCarsList() {
return carsList;
}
public void setCarsList(List<Car> carsList) {
this.carsList = carsList;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String errorString;
public String getErrorString() {
return errorString;
}
public void setErrorString(String errorString) {
this.errorString = errorString;
}
private boolean validate(Car car)
{
Pattern namePattern = Pattern.compile("^[A-Za-z\\s]{1,100}$");
Matcher m = namePattern.matcher(car.getName());
if (!m.matches())
{
errorString = "The name is invalid";
return false;
}
Pattern yearPattern = Pattern.compile("^[0-9]{3,5}$");
m = yearPattern.matcher(String.valueOf(car.getReleaseYear()));
if (!m.matches())
{
errorString = "The release year is invalid";
return false;
}
return true;
}
}
| [
"Poplavskis Pavel"
] | Poplavskis Pavel |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.