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
51df0394a689998f01a00e08c7eeac30fe290d99
c366c3fb4e444761f7a833fa55c3fb8d8973fcc0
/app/src/main/java/com/example/architecturecomponentsapp/MainActivity.java
0d5426759039f38b684552c36b1cb4cb044e0a4c
[]
no_license
lusicom/ArchitectureComponentsApp
7520b60ecade6ce884a5828d01b67cf0a881797f
6fced73ffbf33870cc9c117d1d91ce3d11587459
refs/heads/master
2023-08-17T18:55:57.527474
2021-09-16T16:11:36
2021-09-16T16:11:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,059
java
package com.example.architecturecomponentsapp; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; import com.google.android.material.floatingactionbutton.FloatingActionButton; public class MainActivity extends AppCompatActivity { private WordViewModel mWordViewModel; public static final int NEW_WORD_ACTIVITY_REQUEST_CODE = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RecyclerView recyclerView = findViewById(R.id.recyclerview); final WordListAdapter adapter = new WordListAdapter(new WordListAdapter.WordDiff()); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); mWordViewModel = new ViewModelProvider(this).get(WordViewModel.class); mWordViewModel.getAllWords().observe(this, words -> { adapter.submitList(words); }); FloatingActionButton fab = findViewById(R.id.fab); } public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == NEW_WORD_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) { Word word = new Word(data.getStringExtra(NewWordActivity.EXTRA_REPLY)); mWordViewModel.insert(word); } else { Toast.makeText( getApplicationContext(), R.string.empty_not_saved, Toast.LENGTH_LONG).show(); } } public void fabOnClick(View view) { Intent intent = new Intent(MainActivity.this, NewWordActivity.class); startActivityForResult(intent, NEW_WORD_ACTIVITY_REQUEST_CODE); } }
[ "lusicomgolub@gmail.com" ]
lusicomgolub@gmail.com
050d9860daf1f104d0a4dbdab27275aaa895405b
d7418e512f26efdc6a780b1f3d63dfd5ee01449c
/03- Terza settimana/01- Primo giorno/Ottavo progetto/src/main/MainLibro_02.java
a75936745c37d9de97ccb39c469d719e6f7f7d92
[]
no_license
iltommi1995/java-dev-corso
546efabb42de4d796cdf369615a23f6213d10c33
5003ee23b24cb5144cde5c2226b5275e35ca23f0
refs/heads/main
2023-02-09T21:49:48.235822
2021-01-06T16:09:48
2021-01-06T16:09:48
305,150,941
2
1
null
2020-11-02T13:24:55
2020-10-18T16:53:12
JavaScript
UTF-8
Java
false
false
1,036
java
package main; import java.util.Scanner; public class MainLibro_02 { public static void main(String[] args) { Scanner tastiera = new Scanner(System.in); System.out.println("Quanti libri vuoi inserire?"); int nLibri = Integer.parseInt(tastiera.nextLine()); int numero = nLibri; String elenco = ""; Libro l; double mediaPrezzi = 0; while(nLibri > 0) { l = new Libro(); System.out.println("Inserisci il titolo del libro"); l.titolo = tastiera.nextLine(); System.out.println("Inserisci l'autore del libro"); l.autore = tastiera.nextLine(); System.out.println("Inserisci il genere del libro"); l.genere = tastiera.nextLine(); System.out.println("Inserisci il prezzo del libro"); l.prezzo = Double.parseDouble(tastiera.nextLine()); elenco += "- " + l.titolo + ", " + l.autore + ", " + l.prezzo + "\n"; nLibri --; mediaPrezzi += l.prezzo; } System.out.println(elenco + "Media prezzo libri : " + mediaPrezzi/numero); tastiera.close(); } }
[ "tomasdanielavilavisintin@yahoo.it" ]
tomasdanielavilavisintin@yahoo.it
cfe48cfbe3bbbe0f0135169b42cea4a86dea25eb
c86b6e959abce95e86b2ba2bca230f1236deb6ae
/bookstore/bookstore/WEB-INF/src/jp/ac/asojuku/bookstore/check/CheckSecurity.java
fde069561aea3d0ef74271f082787c0f8b84fd0c
[]
no_license
takatanbook/sample
ce30ad273b5dcd25506b6b40b8744ad4458bbc37
85df29dfef800640e0c2741d568fd886909d44a7
refs/heads/master
2021-01-21T04:48:20.278091
2016-07-19T02:59:16
2016-07-19T02:59:16
50,288,342
0
0
null
null
null
null
UTF-8
Java
false
false
3,408
java
package jp.ac.asojuku.bookstore.check; /* * @author TAKAMICHI TANAKA * フォームから入力された値を検査するクラス * !エクスクラメーション * * */ public class CheckSecurity { //ひらがなの正規表現(Unicode 16進数 ひらがなの範囲) private static final String P_HIRAGANA_ONLY = "^[\\u3040-\\u309F]+$"; //漢字の正規表現(Unicode 16進数 漢字の範囲) private static final String P_KANG_ONLY = "^[\\u4E00-\\u9FFF]+$"; //郵便番号の正規表現 private static final String P_ZIPCODE = "^\\d{3}(-\\d{4}|-\\d{2}|)$"; //電話番号の正規表現 private static final String P_NUMBER = "^0\\d{1,4}-\\d{1,4}-\\d{4}$"; //メールアドレスの正規表現 private static final String P_MAILADDRES = "^[a-zA-Z0-9!#$%&'_`/=~\\*\\+\\-\\?\\^\\{\\|\\}]+(\\.[a-zA-Z0-9!#$%&'_`/=~\\*\\+\\-\\?\\^\\{\\|\\}]+)*+(.*)@[a-zA-Z0-9][a-zA-Z0-9\\-]*(\\.[a-zA-Z0-9\\-]+)+$"; //文字数を検査する(文字列、最小値、最大値) public static boolean stringLengthCheck(String input, int min, int max) { //フラグの設定 boolean msg = true; // 長さであるかを取得 int length = input.length(); if(length < min) { // 最小文字数よりも少なかった場合 msg = false; } if(length > max) { // 最大文字数よりも多かった場合 msg = false; } return msg; // 許容内であった場合(true) それ以外は(false) } /* * 郵便番号チェック(return true or false) * str値は、入力される値 */ public static boolean isZipCode(String str) { //あたいが正規表現の値とマッチするか return str.matches(P_ZIPCODE); } /* * 平仮名チェック(return true or false) * str値は、入力される値 * */ public static boolean isHiraganaOnly(String str) { //あたいが正規表現の値とマッチするか return str.matches(P_HIRAGANA_ONLY); } /*電話番号チェック(return true or false) * str値は、入力される値 */ public static boolean isNumber(String str){ //あたいが正規表現の値とマッチするか return str.matches(P_NUMBER); } /*漢字チェック(return true or false) * str値は、入力される値 */ public static boolean isKanji(String str){ //あたいが正規表現の値とマッチするか return str.matches(P_KANG_ONLY ); } /* *メールアドレスをチェック(return true or false) *str値は、入力される値 * */ public static boolean isMail(String str){ //あたいが正規表現の値とマッチするか return str.matches(P_MAILADDRES); } /* 二つの文字列が一致チェック(return true or false) * str値は、入力される値 * */ public static boolean matc(String str1, String str2){ //フラグの設定 boolean data = true; //値が女性か男性か? if(str1.equals(str2)){ data = false; } return data; } /* 文字列が空かnullチェック(return true or false) * str値は、入力される値 * */ public static boolean isEmpty(String value){ //フラグの設定 boolean msg = true; if(value == null || value.length() == 0){ msg = false; } return msg; } }
[ "takamichi@tanaka-suzuka-no-MacBook.local" ]
takamichi@tanaka-suzuka-no-MacBook.local
01b618bf3aa51fe8bc4ad87ca5bba4a0f03e9d2a
d18a33fc4cdf1f10ccff81bc1b049afd8fdb05dc
/src/core/simple/Pixel.java
031240eb902992202677cbf99a586952fee7c7ef
[]
no_license
bufflu/AdjustRGB
06eb0bdac49b61458016b1d9e4cf56832ea96fa8
a62b264f9a78f60afcba09da858c4337985379f1
refs/heads/master
2020-05-29T15:03:09.805138
2019-05-29T14:13:02
2019-05-29T14:13:02
189,211,498
0
0
null
null
null
null
UTF-8
Java
false
false
1,308
java
package core.simple; /** * ClassName: Pixel * Description: record single pixel's pixel value, coordinate point(i, j), and RGB value. * Date: 2019/5/24 11:39 * * @author LU */ public class Pixel { private int c; private int p; private int i; private int j; private RGB rgb; public Pixel(int c, int i, int j) { this.c = c; this.i = i; this.j = j; } public Pixel(int c, int p, int i, int j, RGB rgb) { this.c = c; this.p = p; this.i = i; this.j = j; this.rgb = rgb; } public int getC() { return c; } public void setC(int c) { this.c = c; } public int getP() { return p; } public void setP(int p) { this.p = p; } public int getI() { return i; } public void setI(int i) { this.i = i; } public int getJ() { return j; } public void setJ(int j) { this.j = j; } public RGB getRgb() { return rgb; } public void setRgb(RGB rgb) { this.rgb = rgb; } } class RGB { int a; int r; int g; int b; public RGB(int a, int r, int g, int b) { this.a = a; this.r = r; this.g = g; this.b = b; } }
[ "gxl_0014233077@163.com" ]
gxl_0014233077@163.com
06d0be29c8ae46af0482c518c7faa093836421de
08f666333d0d3abd1cf34c205a576a15ffcefbed
/order-core/src/main/java/com/duoduo/order/resp/toutiao/PostAddr.java
18d71a82329fbfe3cbd2e5e9720abc41bd4e156a
[]
no_license
liujinwene/duoduo-order
e13cadfd7a2e454209ad5ec3bed61bf70be8e88f
809e31aedb21d42e74b8c9b61e4fb67d2a7cb1e5
refs/heads/master
2021-01-25T06:30:27.335538
2017-06-29T01:43:03
2017-06-29T01:43:03
93,584,738
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.duoduo.order.resp.toutiao; public class PostAddr { private Province province; private City city; private Town town; private String detail; public Province getProvince() { return province; } public void setProvince(Province province) { this.province = province; } public City getCity() { return city; } public void setCity(City city) { this.city = city; } public Town getTown() { return town; } public void setTown(Town town) { this.town = town; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } }
[ "278810263@qq.com" ]
278810263@qq.com
c507d9261a61cd9c23f71d8e61579f47f498bbbe
1aa3ba640218ed9a55c147edc25939b495bba5c8
/Algorithms/src/PepcodingBitManipulation/Minimum_No_Of_Software_Developers.java
9866e87f1e97745794dca88c7b46dcc0402e0276
[]
no_license
vedanttttt/Data-Structures-and-Algorithms-in-Java
b5ae7598438b7f548d86fabbb588c57adf4ec1fe
2cb710567bc6d46610df76baf22337c394a13f97
refs/heads/master
2023-06-06T19:10:11.804737
2021-07-01T15:22:59
2021-07-01T15:22:59
292,471,409
0
0
null
null
null
null
UTF-8
Java
false
false
1,826
java
//1. You are given N strings which represents N different skills related to I.T field. //2. You are working on a project and you want to hire a team of software developers for that project. //3. There are N applicants. Every applicant has mentioned his/her skills in resume. //4. You have to select the minimum number of developers such that for every required skill, there is // at least one person in the team who has that skill. //5. It is guaranteed that you can form a team which covers all the required skills. package PepcodingBitManipulation; import java.io.*; import java.util.*; public class Minimum_No_Of_Software_Developers { static ArrayList<Integer> sol = new ArrayList<>(); public static void solution(int[] people, int nskills, int cp, ArrayList<Integer> onesol, int smask) { // write your code here if(cp==people.length){ if(smask== ((1<<nskills) - 1)){ if(sol.size()==0 || onesol.size()< sol.size()){ sol=new ArrayList<>(onesol); } } return; } //didnt added this person solution(people,nskills,cp+1,onesol,smask); //added person onesol.add(cp); solution(people,nskills,cp+1,onesol,smask | people[cp]); onesol.remove(onesol.size()-1); } public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); HashMap<String, Integer> smap = new HashMap<>(); for (int i = 0; i < n; i++) { smap.put(scn.next(), i); } int np = scn.nextInt(); int[] people = new int[np]; for (int i = 0; i < np; i++) { int personSkills = scn.nextInt(); for (int j = 0; j < personSkills; j++) { String skill = scn.next(); int snum = smap.get(skill); people[i] = people[i] | (1 << snum); } } solution(people, n, 0, new ArrayList<>(), 0); System.out.println(sol); } }
[ "51362126+vedanttttt@users.noreply.github.com" ]
51362126+vedanttttt@users.noreply.github.com
37ee20994a98dce016cd8c466deaa33076e4d18e
99bb8ab32de67a03312c873b051dd2dac45d4f14
/Node.java
6bfb8d11834fdd42205ff46c056d5fe0ab3bf761
[]
no_license
mayurk/code-questions
5223e69eb0d022fc793e7c8d107dafaaedd67fff
949919b9ddf899fa9d806187a13ededd4facb5f2
refs/heads/master
2021-01-21T17:01:41.407105
2017-06-05T21:56:28
2017-06-05T21:56:28
91,923,106
0
0
null
null
null
null
UTF-8
Java
false
false
165
java
public class Node { public int data; public Node head; public Node next; public Node tail; public String toString() { return "[" + this.data + "]->"; } }
[ "mayur.kharkar@gmail.com" ]
mayur.kharkar@gmail.com
1922c4632d93788c562f66cf50484467321ee7d8
95cfe2239c8fce0cec91d76e0a82f59a9efc4cb8
/sourceCode/CommonsLangMutGenerator/java.lang.ArrayIndexOutOfBoundsException/4223_lang/mut/ArrayUtils.java
2b84eaf302cc1fad40fe34a31993aac6149aed5e
[]
no_license
Djack1010/BUG_DB
28eff24aece45ed379b49893176383d9260501e7
a4b6e4460a664ce64a474bfd7da635aa7ff62041
refs/heads/master
2022-04-09T01:58:29.736794
2020-03-13T14:15:11
2020-03-13T14:15:11
141,260,015
0
1
null
null
null
null
UTF-8
Java
false
false
253,590
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; import java.lang.reflect.Array; import java.util.Arrays; import java.util.BitSet; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.mutable.MutableInt; /** * <p>Operations on arrays, primitive arrays (like {@code int[]}) and * primitive wrapper arrays (like {@code Integer[]}).</p> * * <p>This class tries to handle {@code null} input gracefully. * An exception will not be thrown for a {@code null} * array input. However, an Object array that contains a {@code null} * element may throw an exception. Each method documents its behaviour.</p> * * <p>#ThreadSafe#</p> * @since 2.0 * @version $Id: ArrayUtils.java 1645483 2014-12-14 18:22:06Z kinow $ */ public class ArrayUtils { /** * An empty immutable {@code Object} array. */ public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; /** * An empty immutable {@code Class} array. */ public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0]; /** * An empty immutable {@code String} array. */ public static final String[] EMPTY_STRING_ARRAY = new String[0]; /** * An empty immutable {@code long} array. */ public static final long[] EMPTY_LONG_ARRAY = new long[0]; /** * An empty immutable {@code Long} array. */ public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0]; /** * An empty immutable {@code int} array. */ public static final int[] EMPTY_INT_ARRAY = new int[0]; /** * An empty immutable {@code Integer} array. */ public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0]; /** * An empty immutable {@code short} array. */ public static final short[] EMPTY_SHORT_ARRAY = new short[0]; /** * An empty immutable {@code Short} array. */ public static final Short[] EMPTY_SHORT_OBJECT_ARRAY = new Short[0]; /** * An empty immutable {@code byte} array. */ public static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; /** * An empty immutable {@code Byte} array. */ public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = new Byte[0]; /** * An empty immutable {@code double} array. */ public static final double[] EMPTY_DOUBLE_ARRAY = new double[0]; /** * An empty immutable {@code Double} array. */ public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0]; /** * An empty immutable {@code float} array. */ public static final float[] EMPTY_FLOAT_ARRAY = new float[0]; /** * An empty immutable {@code Float} array. */ public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY = new Float[0]; /** * An empty immutable {@code boolean} array. */ public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0]; /** * An empty immutable {@code Boolean} array. */ public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = new Boolean[0]; /** * An empty immutable {@code char} array. */ public static final char[] EMPTY_CHAR_ARRAY = new char[0]; /** * An empty immutable {@code Character} array. */ public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0]; /** * The index value when an element is not found in a list or array: {@code -1}. * This value is returned by methods in this class and can also be used in comparisons with values returned by * various method from {@link java.util.List}. */ public static final int INDEX_NOT_FOUND = -1; /** * <p>ArrayUtils instances should NOT be constructed in standard programming. * Instead, the class should be used as <code>ArrayUtils.clone(new int[] {2})</code>.</p> * * <p>This constructor is public to permit tools that require a JavaBean instance * to operate.</p> */ public ArrayUtils() { super(); } // NOTE: Cannot use {@code} to enclose text which includes {}, but <code></code> is OK // Basic methods handling multi-dimensional arrays //----------------------------------------------------------------------- /** * <p>Outputs an array as a String, treating {@code null} as an empty array.</p> * * <p>Multi-dimensional arrays are handled correctly, including * multi-dimensional primitive arrays.</p> * * <p>The format is that of Java source code, for example <code>{a,b}</code>.</p> * * @param array the array to get a toString for, may be {@code null} * @return a String representation of the array, '{}' if null array input */ public static String toString(final Object array) { return toString(array, "{}"); } /** * <p>Outputs an array as a String handling {@code null}s.</p> * * <p>Multi-dimensional arrays are handled correctly, including * multi-dimensional primitive arrays.</p> * * <p>The format is that of Java source code, for example <code>{a,b}</code>.</p> * * @param array the array to get a toString for, may be {@code null} * @param stringIfNull the String to return if the array is {@code null} * @return a String representation of the array */ public static String toString(final Object array, final String stringIfNull) { if (array == null) { return stringIfNull; } return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString(); } /** * <p>Get a hash code for an array handling multi-dimensional arrays correctly.</p> * * <p>Multi-dimensional primitive arrays are also handled correctly by this method.</p> * * @param array the array to get a hash code for, {@code null} returns zero * @return a hash code for the array */ public static int hashCode(final Object array) { return new HashCodeBuilder().append(array).toHashCode(); } /** * <p>Compares two arrays, using equals(), handling multi-dimensional arrays * correctly.</p> * * <p>Multi-dimensional primitive arrays are also handled correctly by this method.</p> * * @param array1 the left hand array to compare, may be {@code null} * @param array2 the right hand array to compare, may be {@code null} * @return {@code true} if the arrays are equal * @deprecated this method has been replaced by {@code java.util.Objects.deepEquals(Object, Object)} and will be * removed from future releases. */ @Deprecated public static boolean isEquals(final Object array1, final Object array2) { return new EqualsBuilder().append(array1, array2).isEquals(); } // To map //----------------------------------------------------------------------- /** * <p>Converts the given array into a {@link java.util.Map}. Each element of the array * must be either a {@link java.util.Map.Entry} or an Array, containing at least two * elements, where the first element is used as key and the second as * value.</p> * * <p>This method can be used to initialize:</p> * <pre> * // Create a Map mapping colors. * Map colorMap = MapUtils.toMap(new String[][] {{ * {"RED", "#FF0000"}, * {"GREEN", "#00FF00"}, * {"BLUE", "#0000FF"}}); * </pre> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array an array whose elements are either a {@link java.util.Map.Entry} or * an Array containing at least two elements, may be {@code null} * @return a {@code Map} that was created from the array * @throws IllegalArgumentException if one element of this Array is * itself an Array containing less then two elements * @throws IllegalArgumentException if the array contains elements other * than {@link java.util.Map.Entry} and an Array */ public static Map<Object, Object> toMap(final Object[] array) { if (array == null) { return null; } final Map<Object, Object> map = new HashMap<Object, Object>((int) (array.length * 1.5)); for (int i = 0; i < array.length; i++) { final Object object = array[i]; if (object instanceof Map.Entry<?, ?>) { final Map.Entry<?,?> entry = (Map.Entry<?,?>) object; map.put(entry.getKey(), entry.getValue()); } else if (object instanceof Object[]) { final Object[] entry = (Object[]) object; if (entry.length < 2) { throw new IllegalArgumentException("Array element " + i + ", '" + object + "', has a length less than 2"); } map.put(entry[0], entry[1]); } else { throw new IllegalArgumentException("Array element " + i + ", '" + object + "', is neither of type Map.Entry nor an Array"); } } return map; } // Generic array //----------------------------------------------------------------------- /** * <p>Create a type-safe generic array.</p> * * <p>The Java language does not allow an array to be created from a generic type:</p> * * <pre> public static &lt;T&gt; T[] createAnArray(int size) { return new T[size]; // compiler error here } public static &lt;T&gt; T[] createAnArray(int size) { return (T[])new Object[size]; // ClassCastException at runtime } * </pre> * * <p>Therefore new arrays of generic types can be created with this method. * For example, an array of Strings can be created:</p> * * <pre> String[] array = ArrayUtils.toArray("1", "2"); String[] emptyArray = ArrayUtils.&lt;String&gt;toArray(); * </pre> * * <p>The method is typically used in scenarios, where the caller itself uses generic types * that have to be combined into an array.</p> * * <p>Note, this method makes only sense to provide arguments of the same type so that the * compiler can deduce the type of the array itself. While it is possible to select the * type explicitly like in * <code>Number[] array = ArrayUtils.&lt;Number&gt;toArray(Integer.valueOf(42), Double.valueOf(Math.PI))</code>, * there is no real advantage when compared to * <code>new Number[] {Integer.valueOf(42), Double.valueOf(Math.PI)}</code>.</p> * * @param <T> the array's element type * @param items the varargs array items, null allowed * @return the array, not null unless a null array is passed in * @since 3.0 */ public static <T> T[] toArray(final T... items) { return items; } // Clone //----------------------------------------------------------------------- /** * <p>Shallow clones an array returning a typecast result and handling * {@code null}.</p> * * <p>The objects in the array are not cloned, thus there is no special * handling for multi-dimensional arrays.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param <T> the component type of the array * @param array the array to shallow clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static <T> T[] clone(final T[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static long[] clone(final long[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static int[] clone(final int[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static short[] clone(final short[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static char[] clone(final char[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static byte[] clone(final byte[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static double[] clone(final double[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static float[] clone(final float[] array) { if (array == null) { return null; } return array.clone(); } /** * <p>Clones an array returning a typecast result and handling * {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array the array to clone, may be {@code null} * @return the cloned array, {@code null} if {@code null} input */ public static boolean[] clone(final boolean[] array) { if (array == null) { return null; } return array.clone(); } // nullToEmpty //----------------------------------------------------------------------- /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Object[] nullToEmpty(final Object[] array) { if (isEmpty(array)) { return EMPTY_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 3.2 */ public static Class<?>[] nullToEmpty(final Class<?>[] array) { if (isEmpty(array)) { return EMPTY_CLASS_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static String[] nullToEmpty(final String[] array) { if (isEmpty(array)) { return EMPTY_STRING_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static long[] nullToEmpty(final long[] array) { if (isEmpty(array)) { return EMPTY_LONG_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static int[] nullToEmpty(final int[] array) { if (isEmpty(array)) { return EMPTY_INT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static short[] nullToEmpty(final short[] array) { if (isEmpty(array)) { return EMPTY_SHORT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static char[] nullToEmpty(final char[] array) { if (isEmpty(array)) { return EMPTY_CHAR_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static byte[] nullToEmpty(final byte[] array) { if (isEmpty(array)) { return EMPTY_BYTE_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static double[] nullToEmpty(final double[] array) { if (isEmpty(array)) { return EMPTY_DOUBLE_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static float[] nullToEmpty(final float[] array) { if (isEmpty(array)) { return EMPTY_FLOAT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static boolean[] nullToEmpty(final boolean[] array) { if (isEmpty(array)) { return EMPTY_BOOLEAN_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Long[] nullToEmpty(final Long[] array) { if (isEmpty(array)) { return EMPTY_LONG_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Integer[] nullToEmpty(final Integer[] array) { if (isEmpty(array)) { return EMPTY_INTEGER_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Short[] nullToEmpty(final Short[] array) { if (isEmpty(array)) { return EMPTY_SHORT_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Character[] nullToEmpty(final Character[] array) { if (isEmpty(array)) { return EMPTY_CHARACTER_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Byte[] nullToEmpty(final Byte[] array) { if (isEmpty(array)) { return EMPTY_BYTE_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Double[] nullToEmpty(final Double[] array) { if (isEmpty(array)) { return EMPTY_DOUBLE_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Float[] nullToEmpty(final Float[] array) { if (isEmpty(array)) { return EMPTY_FLOAT_OBJECT_ARRAY; } return array; } /** * <p>Defensive programming technique to change a {@code null} * reference to an empty one.</p> * * <p>This method returns an empty array for a {@code null} input array.</p> * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class.</p> * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Boolean[] nullToEmpty(final Boolean[] array) { if (isEmpty(array)) { return EMPTY_BOOLEAN_OBJECT_ARRAY; } return array; } // Subarrays //----------------------------------------------------------------------- /** * <p>Produces a new array containing the elements between * the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * <p>The component type of the subarray is always the same as * that of the input array. Thus, if the input is an array of type * {@code Date}, the following usage is envisaged:</p> * * <pre> * Date[] someDates = (Date[])ArrayUtils.subarray(allDates, 2, 5); * </pre> * * @param <T> the component type of the array * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(Object[], int, int) */ public static <T> T[] subarray(final T[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; final Class<?> type = array.getClass().getComponentType(); if (newSize <= 0) { @SuppressWarnings("unchecked") // OK, because array is of type T final T[] emptyArray = (T[]) Array.newInstance(type, 0); return emptyArray; } @SuppressWarnings("unchecked") // OK, because array is of type T final T[] subarray = (T[]) Array.newInstance(type, newSize); System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code long} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(long[], int, int) */ public static long[] subarray(final long[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_LONG_ARRAY; } final long[] subarray = new long[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code int} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(int[], int, int) */ public static int[] subarray(final int[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_INT_ARRAY; } final int[] subarray = new int[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code short} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(short[], int, int) */ public static short[] subarray(final short[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_SHORT_ARRAY; } final short[] subarray = new short[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code char} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(char[], int, int) */ public static char[] subarray(final char[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_CHAR_ARRAY; } final char[] subarray = new char[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code byte} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(byte[], int, int) */ public static byte[] subarray(final byte[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_BYTE_ARRAY; } final byte[] subarray = new byte[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code double} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(double[], int, int) */ public static double[] subarray(final double[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_DOUBLE_ARRAY; } final double[] subarray = new double[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code float} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(float[], int, int) */ public static float[] subarray(final float[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_FLOAT_ARRAY; } final float[] subarray = new float[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } /** * <p>Produces a new {@code boolean} array containing the elements * between the start and end indices.</p> * * <p>The start index is inclusive, the end index exclusive. * Null array input produces null output.</p> * * @param array the array * @param startIndexInclusive the starting index. Undervalue (&lt;0) * is promoted to 0, overvalue (&gt;array.length) results * in an empty array. * @param endIndexExclusive elements up to endIndex-1 are present in the * returned subarray. Undervalue (&lt; startIndex) produces * empty array, overvalue (&gt;array.length) is demoted to * array length. * @return a new array containing the elements between * the start and end indices. * @since 2.1 * @see Arrays#copyOfRange(boolean[], int, int) */ public static boolean[] subarray(final boolean[] array, int startIndexInclusive, int endIndexExclusive) { if (array == null) { return null; } if (startIndexInclusive < 0) { startIndexInclusive = 0; } if (endIndexExclusive > array.length) { endIndexExclusive = array.length; } final int newSize = endIndexExclusive - startIndexInclusive; if (newSize <= 0) { return EMPTY_BOOLEAN_ARRAY; } final boolean[] subarray = new boolean[newSize]; System.arraycopy(array, startIndexInclusive, subarray, 0, newSize); return subarray; } // Is same length //----------------------------------------------------------------------- /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}. * * <p>Any multi-dimensional aspects of the arrays are ignored.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final Object[] array1, final Object[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final long[] array1, final long[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final int[] array1, final int[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final short[] array1, final short[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final char[] array1, final char[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final byte[] array1, final byte[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final double[] array1, final double[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final float[] array1, final float[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } /** * <p>Checks whether two arrays are the same length, treating * {@code null} arrays as length {@code 0}.</p> * * @param array1 the first array, may be {@code null} * @param array2 the second array, may be {@code null} * @return {@code true} if length of arrays matches, treating * {@code null} as an empty array */ public static boolean isSameLength(final boolean[] array1, final boolean[] array2) { if ((array1 == null && array2 != null && array2.length > 0) || (array2 == null && array1 != null && array1.length > 0) || (array1 != null && array2 != null && array1.length != array2.length)) { return false; } return true; } //----------------------------------------------------------------------- /** * <p>Returns the length of the specified array. * This method can deal with {@code Object} arrays and with primitive arrays.</p> * * <p>If the input array is {@code null}, {@code 0} is returned.</p> * * <pre> * ArrayUtils.getLength(null) = 0 * ArrayUtils.getLength([]) = 0 * ArrayUtils.getLength([null]) = 1 * ArrayUtils.getLength([true, false]) = 2 * ArrayUtils.getLength([1, 2, 3]) = 3 * ArrayUtils.getLength(["a", "b", "c"]) = 3 * </pre> * * @param array the array to retrieve the length from, may be null * @return The length of the array, or {@code 0} if the array is {@code null} * @throws IllegalArgumentException if the object argument is not an array. * @since 2.1 */ public static int getLength(final Object array) { if (array == null) { return 0; } return Array.getLength(array); } /** * <p>Checks whether two arrays are the same type taking into account * multi-dimensional arrays.</p> * * @param array1 the first array, must not be {@code null} * @param array2 the second array, must not be {@code null} * @return {@code true} if type of arrays matches * @throws IllegalArgumentException if either array is {@code null} */ public static boolean isSameType(final Object array1, final Object array2) { if (array1 == null || array2 == null) { throw new IllegalArgumentException("The Array must not be null"); } return array1.getClass().getName().equals(array2.getClass().getName()); } // Reverse //----------------------------------------------------------------------- /** * <p>Reverses the order of the given array.</p> * * <p>There is no special handling for multi-dimensional arrays.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final Object[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final long[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final int[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final short[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final char[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final byte[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final double[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final float[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p>Reverses the order of the given array.</p> * * <p>This method does nothing for a {@code null} input array.</p> * * @param array the array to reverse, may be {@code null} */ public static void reverse(final boolean[] array) { if (array == null) { return; } reverse(array, 0, array.length); } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final boolean[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; boolean tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final byte[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; byte tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final char[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; char tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final double[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; double tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final float[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; float tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final int[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; int tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final long[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; long tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final Object[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; Object tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } /** * <p> * Reverses the order of the given array in the given range. * </p> * * <p> * This method does nothing for a {@code null} input array. * </p> * * @param array * the array to reverse, may be {@code null} * @param startIndexInclusive * the starting index. Undervalue (&lt;0) is promoted to 0, overvalue (&gt;array.length) results in no * change. * @param endIndexExclusive * elements up to endIndex-1 are reversed in the array. Undervalue (&lt; start index) results in no * change. Overvalue (&gt;array.length) is demoted to array length. * @since 3.2 */ public static void reverse(final short[] array, final int startIndexInclusive, final int endIndexExclusive) { if (array == null) { return; } int i = startIndexInclusive < 0 ? 0 : startIndexInclusive; int j = Math.min(array.length, endIndexExclusive) - 1; short tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } // IndexOf search // ---------------------------------------------------------------------- // Object IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given object in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param objectToFind the object to find, may be {@code null} * @return the index of the object within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final Object[] array, final Object objectToFind) { return indexOf(array, objectToFind, 0); } /** * <p>Finds the index of the given object in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param objectToFind the object to find, may be {@code null} * @param startIndex the index to start searching at * @return the index of the object within the array starting at the index, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final Object[] array, final Object objectToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } if (objectToFind == null) { for (int i = startIndex; i < array.length; i++) { if (array[i] == null) { return i; } } } else if (array.getClass().getComponentType().isInstance(objectToFind)) { for (int i = startIndex; i < array.length; i++) { if (objectToFind.equals(array[i])) { return i; } } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given object within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param objectToFind the object to find, may be {@code null} * @return the last index of the object within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final Object[] array, final Object objectToFind) { return lastIndexOf(array, objectToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given object in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than * the array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param objectToFind the object to find, may be {@code null} * @param startIndex the start index to travers backwards from * @return the last index of the object within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final Object[] array, final Object objectToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } if (objectToFind == null) { for (int i = startIndex; i >= 0; i--) { if (array[i] == null) { return i; } } } else if (array.getClass().getComponentType().isInstance(objectToFind)) { for (int i = startIndex; i >= 0; i--) { if (objectToFind.equals(array[i])) { return i; } } } return INDEX_NOT_FOUND; } /** * <p>Checks if the object is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param objectToFind the object to find * @return {@code true} if the array contains the object */ public static boolean contains(final Object[] array, final Object objectToFind) { return indexOf(array, objectToFind) != INDEX_NOT_FOUND; } // long IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final long[] array, final long valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final long[] array, final long valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final long[] array, final long valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final long[] array, final long valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final long[] array, final long valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // int IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final int[] array, final int valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final int[] array, final int valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final int[] array, final int valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final int[] array, final int valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final int[] array, final int valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // short IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final short[] array, final short valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final short[] array, final short valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final short[] array, final short valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final short[] array, final short valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final short[] array, final short valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // char IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input * @since 2.1 */ public static int indexOf(final char[] array, final char valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input * @since 2.1 */ public static int indexOf(final char[] array, final char valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input * @since 2.1 */ public static int lastIndexOf(final char[] array, final char valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input * @since 2.1 */ public static int lastIndexOf(final char[] array, final char valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object * @since 2.1 */ public static boolean contains(final char[] array, final char valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // byte IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final byte[] array, final byte valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final byte[] array, final byte valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final byte[] array, final byte valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final byte[] array, final byte valueToFind, int startIndex) { if (array == null) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final byte[] array, final byte valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // double IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final double[] array, final double valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value within a given tolerance in the array. * This method will return the index of the first value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param tolerance tolerance of the search * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final double[] array, final double valueToFind, final double tolerance) { return indexOf(array, valueToFind, 0, tolerance); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final double[] array, final double valueToFind, int startIndex) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the index of the given value in the array starting at the given index. * This method will return the index of the first value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @param tolerance tolerance of the search * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } final double min = valueToFind - tolerance; final double max = valueToFind + tolerance; for (int i = startIndex; i < array.length; i++) { if (array[i] >= min && array[i] <= max) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final double[] array, final double valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value within a given tolerance in the array. * This method will return the index of the last value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param tolerance tolerance of the search * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final double[] array, final double valueToFind, final double tolerance) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE, tolerance); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final double[] array, final double valueToFind, int startIndex) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value in the array starting at the given index. * This method will return the index of the last value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @param tolerance search for value within plus/minus this amount * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } final double min = valueToFind - tolerance; final double max = valueToFind + tolerance; for (int i = startIndex; i >= 0; i--) { if (array[i] >= min && array[i] <= max) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final double[] array, final double valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } /** * <p>Checks if a value falling within the given tolerance is in the * given array. If the array contains a value within the inclusive range * defined by (value - tolerance) to (value + tolerance).</p> * * <p>The method returns {@code false} if a {@code null} array * is passed in.</p> * * @param array the array to search * @param valueToFind the value to find * @param tolerance the array contains the tolerance of the search * @return true if value falling within tolerance is in array */ public static boolean contains(final double[] array, final double valueToFind, final double tolerance) { return indexOf(array, valueToFind, 0, tolerance) != INDEX_NOT_FOUND; } // float IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final float[] array, final float valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final float[] array, final float valueToFind, int startIndex) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final float[] array, final float valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than the * array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final float[] array, final float valueToFind, int startIndex) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final float[] array, final float valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // boolean IndexOf //----------------------------------------------------------------------- /** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int indexOf(final boolean[] array, final boolean valueToFind) { return indexOf(array, valueToFind, 0); } /** * <p>Finds the index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex is treated as zero. A startIndex larger than the array * length will return {@link #INDEX_NOT_FOUND} ({@code -1}).</p> * * @param array the array to search through for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the index to start searching at * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} * array input */ public static int indexOf(final boolean[] array, final boolean valueToFind, int startIndex) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { startIndex = 0; } for (int i = startIndex; i < array.length; i++) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Finds the last index of the given value within the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) if * {@code null} array input.</p> * * @param array the array to travers backwords looking for the object, may be {@code null} * @param valueToFind the object to find * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final boolean[] array, final boolean valueToFind) { return lastIndexOf(array, valueToFind, Integer.MAX_VALUE); } /** * <p>Finds the last index of the given value in the array starting at the given index.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.</p> * * <p>A negative startIndex will return {@link #INDEX_NOT_FOUND} ({@code -1}). A startIndex larger than * the array length will search from the end of the array.</p> * * @param array the array to traverse for looking for the object, may be {@code null} * @param valueToFind the value to find * @param startIndex the start index to travers backwards from * @return the last index of the value within the array, * {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input */ public static int lastIndexOf(final boolean[] array, final boolean valueToFind, int startIndex) { if (ArrayUtils.isEmpty(array)) { return INDEX_NOT_FOUND; } if (startIndex < 0) { return INDEX_NOT_FOUND; } else if (startIndex >= array.length) { startIndex = array.length - 1; } for (int i = startIndex; i >= 0; i--) { if (valueToFind == array[i]) { return i; } } return INDEX_NOT_FOUND; } /** * <p>Checks if the value is in the given array.</p> * * <p>The method returns {@code false} if a {@code null} array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return {@code true} if the array contains the object */ public static boolean contains(final boolean[] array, final boolean valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; } // Primitive/Object array converters // ---------------------------------------------------------------------- // Character array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Characters to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Character} array, may be {@code null} * @return a {@code char} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static char[] toPrimitive(final Character[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_CHAR_ARRAY; } final char[] result = new char[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].charValue(); } return result; } /** * <p>Converts an array of object Character to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Character} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code char} array, {@code null} if null array input */ public static char[] toPrimitive(final Character[] array, final char valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_CHAR_ARRAY; } final char[] result = new char[array.length]; for (int i = 0; i < array.length; i++) { final Character b = array[i]; result[i] = (b == null ? valueForNull : b.charValue()); } return result; } /** * <p>Converts an array of primitive chars to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code char} array * @return a {@code Character} array, {@code null} if null array input */ public static Character[] toObject(final char[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_CHARACTER_OBJECT_ARRAY; } final Character[] result = new Character[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Character.valueOf(array[i]); } return result; } // Long array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Longs to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Long} array, may be {@code null} * @return a {@code long} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static long[] toPrimitive(final Long[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_LONG_ARRAY; } final long[] result = new long[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].longValue(); } return result; } /** * <p>Converts an array of object Long to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Long} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code long} array, {@code null} if null array input */ public static long[] toPrimitive(final Long[] array, final long valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_LONG_ARRAY; } final long[] result = new long[array.length]; for (int i = 0; i < array.length; i++) { final Long b = array[i]; result[i] = (b == null ? valueForNull : b.longValue()); } return result; } /** * <p>Converts an array of primitive longs to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code long} array * @return a {@code Long} array, {@code null} if null array input */ public static Long[] toObject(final long[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_LONG_OBJECT_ARRAY; } final Long[] result = new Long[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Long.valueOf(array[i]); } return result; } // Int array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Integers to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Integer} array, may be {@code null} * @return an {@code int} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static int[] toPrimitive(final Integer[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_INT_ARRAY; } final int[] result = new int[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].intValue(); } return result; } /** * <p>Converts an array of object Integer to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Integer} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return an {@code int} array, {@code null} if null array input */ public static int[] toPrimitive(final Integer[] array, final int valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_INT_ARRAY; } final int[] result = new int[array.length]; for (int i = 0; i < array.length; i++) { final Integer b = array[i]; result[i] = (b == null ? valueForNull : b.intValue()); } return result; } /** * <p>Converts an array of primitive ints to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array an {@code int} array * @return an {@code Integer} array, {@code null} if null array input */ public static Integer[] toObject(final int[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_INTEGER_OBJECT_ARRAY; } final Integer[] result = new Integer[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Integer.valueOf(array[i]); } return result; } // Short array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Shorts to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Short} array, may be {@code null} * @return a {@code byte} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static short[] toPrimitive(final Short[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_SHORT_ARRAY; } final short[] result = new short[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].shortValue(); } return result; } /** * <p>Converts an array of object Short to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Short} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code byte} array, {@code null} if null array input */ public static short[] toPrimitive(final Short[] array, final short valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_SHORT_ARRAY; } final short[] result = new short[array.length]; for (int i = 0; i < array.length; i++) { final Short b = array[i]; result[i] = (b == null ? valueForNull : b.shortValue()); } return result; } /** * <p>Converts an array of primitive shorts to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code short} array * @return a {@code Short} array, {@code null} if null array input */ public static Short[] toObject(final short[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_SHORT_OBJECT_ARRAY; } final Short[] result = new Short[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Short.valueOf(array[i]); } return result; } // Byte array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Bytes to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Byte} array, may be {@code null} * @return a {@code byte} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static byte[] toPrimitive(final Byte[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BYTE_ARRAY; } final byte[] result = new byte[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].byteValue(); } return result; } /** * <p>Converts an array of object Bytes to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Byte} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code byte} array, {@code null} if null array input */ public static byte[] toPrimitive(final Byte[] array, final byte valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BYTE_ARRAY; } final byte[] result = new byte[array.length]; for (int i = 0; i < array.length; i++) { final Byte b = array[i]; result[i] = (b == null ? valueForNull : b.byteValue()); } return result; } /** * <p>Converts an array of primitive bytes to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code byte} array * @return a {@code Byte} array, {@code null} if null array input */ public static Byte[] toObject(final byte[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BYTE_OBJECT_ARRAY; } final Byte[] result = new Byte[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Byte.valueOf(array[i]); } return result; } // Double array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Doubles to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Double} array, may be {@code null} * @return a {@code double} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static double[] toPrimitive(final Double[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_DOUBLE_ARRAY; } final double[] result = new double[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].doubleValue(); } return result; } /** * <p>Converts an array of object Doubles to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Double} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code double} array, {@code null} if null array input */ public static double[] toPrimitive(final Double[] array, final double valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_DOUBLE_ARRAY; } final double[] result = new double[array.length]; for (int i = 0; i < array.length; i++) { final Double b = array[i]; result[i] = (b == null ? valueForNull : b.doubleValue()); } return result; } /** * <p>Converts an array of primitive doubles to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code double} array * @return a {@code Double} array, {@code null} if null array input */ public static Double[] toObject(final double[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_DOUBLE_OBJECT_ARRAY; } final Double[] result = new Double[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Double.valueOf(array[i]); } return result; } // Float array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Floats to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Float} array, may be {@code null} * @return a {@code float} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static float[] toPrimitive(final Float[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_FLOAT_ARRAY; } final float[] result = new float[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].floatValue(); } return result; } /** * <p>Converts an array of object Floats to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Float} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code float} array, {@code null} if null array input */ public static float[] toPrimitive(final Float[] array, final float valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_FLOAT_ARRAY; } final float[] result = new float[array.length]; for (int i = 0; i < array.length; i++) { final Float b = array[i]; result[i] = (b == null ? valueForNull : b.floatValue()); } return result; } /** * <p>Converts an array of primitive floats to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code float} array * @return a {@code Float} array, {@code null} if null array input */ public static Float[] toObject(final float[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_FLOAT_OBJECT_ARRAY; } final Float[] result = new Float[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Float.valueOf(array[i]); } return result; } // Boolean array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Booleans to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Boolean} array, may be {@code null} * @return a {@code boolean} array, {@code null} if null array input * @throws NullPointerException if array content is {@code null} */ public static boolean[] toPrimitive(final Boolean[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BOOLEAN_ARRAY; } final boolean[] result = new boolean[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i].booleanValue(); } return result; } /** * <p>Converts an array of object Booleans to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Boolean} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code boolean} array, {@code null} if null array input */ public static boolean[] toPrimitive(final Boolean[] array, final boolean valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BOOLEAN_ARRAY; } final boolean[] result = new boolean[array.length]; for (int i = 0; i < array.length; i++) { final Boolean b = array[i]; result[i] = (b == null ? valueForNull : b.booleanValue()); } return result; } /** * <p>Converts an array of primitive booleans to objects.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code boolean} array * @return a {@code Boolean} array, {@code null} if null array input */ public static Boolean[] toObject(final boolean[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BOOLEAN_OBJECT_ARRAY; } final Boolean[] result = new Boolean[array.length]; for (int i = 0; i < array.length; i++) { result[i] = (array[i] ? Boolean.TRUE : Boolean.FALSE); } return result; } // ---------------------------------------------------------------------- /** * <p>Checks if an array of Objects is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final Object[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive longs is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final long[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive ints is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final int[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive shorts is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final short[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive chars is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final char[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive bytes is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final byte[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive doubles is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final double[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive floats is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final float[] array) { return array == null || array.length == 0; } /** * <p>Checks if an array of primitive booleans is empty or {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is empty or {@code null} * @since 2.1 */ public static boolean isEmpty(final boolean[] array) { return array == null || array.length == 0; } // ---------------------------------------------------------------------- /** * <p>Checks if an array of Objects is not empty or not {@code null}.</p> * * @param <T> the component type of the array * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static <T> boolean isNotEmpty(final T[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive longs is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final long[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive ints is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final int[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive shorts is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final short[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive chars is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final char[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive bytes is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final byte[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive doubles is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final double[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive floats is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final float[] array) { return (array != null && array.length != 0); } /** * <p>Checks if an array of primitive booleans is not empty or not {@code null}.</p> * * @param array the array to test * @return {@code true} if the array is not empty or not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final boolean[] array) { return (array != null && array.length != 0); } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(null, null) = null * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * ArrayUtils.addAll([null], [null]) = [null, null] * ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"] * </pre> * * @param <T> the component type of the array * @param array1 the first array whose elements are added to the new array, may be {@code null} * @param array2 the second array whose elements are added to the new array, may be {@code null} * @return The new array, {@code null} if both arrays are {@code null}. * The type of the new array is the type of the first array, * unless the first array is null, in which case the type is the same as the second array. * @since 2.1 * @throws IllegalArgumentException if the array types are incompatible */ public static <T> T[] addAll(final T[] array1, final T... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final Class<?> type1 = array1.getClass().getComponentType(); @SuppressWarnings("unchecked") // OK, because array is of type T final T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length); System.arraycopy(array1, 0, joinedArray, 0, array1.length); try { System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); } catch (final ArrayStoreException ase) { // Check if problem was due to incompatible types /* * We do this here, rather than before the copy because: * - it would be a wasted check most of the time * - safer, in case check turns out to be too strict */ final Class<?> type2 = array2.getClass().getComponentType(); if (!type1.isAssignableFrom(type2)){ throw new IllegalArgumentException("Cannot store "+type2.getName()+" in an array of " +type1.getName(), ase); } throw ase; // No, so rethrow original } return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new boolean[] array. * @since 2.1 */ public static boolean[] addAll(final boolean[] array1, final boolean... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final boolean[] joinedArray = new boolean[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new char[] array. * @since 2.1 */ public static char[] addAll(final char[] array1, final char... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final char[] joinedArray = new char[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new byte[] array. * @since 2.1 */ public static byte[] addAll(final byte[] array1, final byte... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final byte[] joinedArray = new byte[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new short[] array. * @since 2.1 */ public static short[] addAll(final short[] array1, final short... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final short[] joinedArray = new short[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new int[] array. * @since 2.1 */ public static int[] addAll(final int[] array1, final int... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final int[] joinedArray = new int[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new long[] array. * @since 2.1 */ public static long[] addAll(final long[] array1, final long... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final long[] joinedArray = new long[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new float[] array. * @since 2.1 */ public static float[] addAll(final float[] array1, final float... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final float[] joinedArray = new float[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Adds all the elements of the given arrays into a new array.</p> * <p>The new array contains all of the element of {@code array1} followed * by all of the elements {@code array2}. When an array is returned, it is always * a new array.</p> * * <pre> * ArrayUtils.addAll(array1, null) = cloned copy of array1 * ArrayUtils.addAll(null, array2) = cloned copy of array2 * ArrayUtils.addAll([], []) = [] * </pre> * * @param array1 the first array whose elements are added to the new array. * @param array2 the second array whose elements are added to the new array. * @return The new double[] array. * @since 2.1 */ public static double[] addAll(final double[] array1, final double... array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } final double[] joinedArray = new double[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element, unless the element itself is null, * in which case the return type is Object[]</p> * * <pre> * ArrayUtils.add(null, null) = [null] * ArrayUtils.add(null, "a") = ["a"] * ArrayUtils.add(["a"], null) = ["a", null] * ArrayUtils.add(["a"], "b") = ["a", "b"] * ArrayUtils.add(["a", "b"], "c") = ["a", "b", "c"] * </pre> * * @param <T> the component type of the array * @param array the array to "add" the element to, may be {@code null} * @param element the object to add, may be {@code null} * @return A new array containing the existing elements plus the new element * The returned array type will be that of the input array (unless null), * in which case it will have the same type as the element. * If both are null, an IllegalArgumentException is thrown * @since 2.1 * @throws IllegalArgumentException if both arguments are null */ public static <T> T[] add(final T[] array, final T element) { Class<?> type; if (array != null){ type = array.getClass().getComponentType(); } else if (element != null) { type = element.getClass(); } else { throw new IllegalArgumentException("Arguments cannot both be null"); } @SuppressWarnings("unchecked") // type must be T final T[] newArray = (T[]) copyArrayGrow1(array, type); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, true) = [true] * ArrayUtils.add([true], false) = [true, false] * ArrayUtils.add([true, false], true) = [true, false, true] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static boolean[] add(final boolean[] array, final boolean element) { final boolean[] newArray = (boolean[])copyArrayGrow1(array, Boolean.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0) = [0] * ArrayUtils.add([1], 0) = [1, 0] * ArrayUtils.add([1, 0], 1) = [1, 0, 1] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static byte[] add(final byte[] array, final byte element) { final byte[] newArray = (byte[])copyArrayGrow1(array, Byte.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, '0') = ['0'] * ArrayUtils.add(['1'], '0') = ['1', '0'] * ArrayUtils.add(['1', '0'], '1') = ['1', '0', '1'] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static char[] add(final char[] array, final char element) { final char[] newArray = (char[])copyArrayGrow1(array, Character.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0) = [0] * ArrayUtils.add([1], 0) = [1, 0] * ArrayUtils.add([1, 0], 1) = [1, 0, 1] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static double[] add(final double[] array, final double element) { final double[] newArray = (double[])copyArrayGrow1(array, Double.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0) = [0] * ArrayUtils.add([1], 0) = [1, 0] * ArrayUtils.add([1, 0], 1) = [1, 0, 1] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static float[] add(final float[] array, final float element) { final float[] newArray = (float[])copyArrayGrow1(array, Float.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0) = [0] * ArrayUtils.add([1], 0) = [1, 0] * ArrayUtils.add([1, 0], 1) = [1, 0, 1] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static int[] add(final int[] array, final int element) { final int[] newArray = (int[])copyArrayGrow1(array, Integer.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0) = [0] * ArrayUtils.add([1], 0) = [1, 0] * ArrayUtils.add([1, 0], 1) = [1, 0, 1] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static long[] add(final long[] array, final long element) { final long[] newArray = (long[])copyArrayGrow1(array, Long.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * <p>Copies the given array and adds the given element at the end of the new array.</p> * * <p>The new array contains the same elements of the input * array plus the given element in the last position. The component type of * the new array is the same as that of the input array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0) = [0] * ArrayUtils.add([1], 0) = [1, 0] * ArrayUtils.add([1, 0], 1) = [1, 0, 1] * </pre> * * @param array the array to copy and add the element to, may be {@code null} * @param element the object to add at the last index of the new array * @return A new array containing the existing elements plus the new element * @since 2.1 */ public static short[] add(final short[] array, final short element) { final short[] newArray = (short[])copyArrayGrow1(array, Short.TYPE); newArray[newArray.length - 1] = element; return newArray; } /** * Returns a copy of the given array of size 1 greater than the argument. * The last value of the array is left to the default value. * * @param array The array to copy, must not be {@code null}. * @param newArrayComponentType If {@code array} is {@code null}, create a * size 1 array of this type. * @return A new copy of the array of size 1 greater than the input. */ private static Object copyArrayGrow1(final Object array, final Class<?> newArrayComponentType) { if (array != null) { final int arrayLength = Array.getLength(array); final Object newArray = Array.newInstance(array.getClass().getComponentType(), arrayLength + 1); System.arraycopy(array, 0, newArray, 0, arrayLength); return newArray; } return Array.newInstance(newArrayComponentType, 1); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0, null) = [null] * ArrayUtils.add(null, 0, "a") = ["a"] * ArrayUtils.add(["a"], 1, null) = ["a", null] * ArrayUtils.add(["a"], 1, "b") = ["a", "b"] * ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"] * </pre> * * @param <T> the component type of the array * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range (index &lt; 0 || index &gt; array.length). * @throws IllegalArgumentException if both array and element are null */ public static <T> T[] add(final T[] array, final int index, final T element) { Class<?> clss = null; if (array != null) { clss = array.getClass().getComponentType(); } else if (element != null) { clss = element.getClass(); } else { throw new IllegalArgumentException("Array and element cannot both be null"); } @SuppressWarnings("unchecked") // the add method creates an array of type clss, which is type T final T[] newArray = (T[]) add(array, index, element, clss); return newArray; } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0, true) = [true] * ArrayUtils.add([true], 0, false) = [false, true] * ArrayUtils.add([false], 1, true) = [false, true] * ArrayUtils.add([true, false], 1, true) = [true, true, false] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range (index &lt; 0 || index &gt; array.length). */ public static boolean[] add(final boolean[] array, final int index, final boolean element) { return (boolean[]) add(array, index, Boolean.valueOf(element), Boolean.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add(null, 0, 'a') = ['a'] * ArrayUtils.add(['a'], 0, 'b') = ['b', 'a'] * ArrayUtils.add(['a', 'b'], 0, 'c') = ['c', 'a', 'b'] * ArrayUtils.add(['a', 'b'], 1, 'k') = ['a', 'k', 'b'] * ArrayUtils.add(['a', 'b', 'c'], 1, 't') = ['a', 't', 'b', 'c'] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static char[] add(final char[] array, final int index, final char element) { return (char[]) add(array, index, Character.valueOf(element), Character.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add([1], 0, 2) = [2, 1] * ArrayUtils.add([2, 6], 2, 3) = [2, 6, 3] * ArrayUtils.add([2, 6], 0, 1) = [1, 2, 6] * ArrayUtils.add([2, 6, 3], 2, 1) = [2, 6, 1, 3] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static byte[] add(final byte[] array, final int index, final byte element) { return (byte[]) add(array, index, Byte.valueOf(element), Byte.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add([1], 0, 2) = [2, 1] * ArrayUtils.add([2, 6], 2, 10) = [2, 6, 10] * ArrayUtils.add([2, 6], 0, -4) = [-4, 2, 6] * ArrayUtils.add([2, 6, 3], 2, 1) = [2, 6, 1, 3] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static short[] add(final short[] array, final int index, final short element) { return (short[]) add(array, index, Short.valueOf(element), Short.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add([1], 0, 2) = [2, 1] * ArrayUtils.add([2, 6], 2, 10) = [2, 6, 10] * ArrayUtils.add([2, 6], 0, -4) = [-4, 2, 6] * ArrayUtils.add([2, 6, 3], 2, 1) = [2, 6, 1, 3] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static int[] add(final int[] array, final int index, final int element) { return (int[]) add(array, index, Integer.valueOf(element), Integer.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add([1L], 0, 2L) = [2L, 1L] * ArrayUtils.add([2L, 6L], 2, 10L) = [2L, 6L, 10L] * ArrayUtils.add([2L, 6L], 0, -4L) = [-4L, 2L, 6L] * ArrayUtils.add([2L, 6L, 3L], 2, 1L) = [2L, 6L, 1L, 3L] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static long[] add(final long[] array, final int index, final long element) { return (long[]) add(array, index, Long.valueOf(element), Long.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add([1.1f], 0, 2.2f) = [2.2f, 1.1f] * ArrayUtils.add([2.3f, 6.4f], 2, 10.5f) = [2.3f, 6.4f, 10.5f] * ArrayUtils.add([2.6f, 6.7f], 0, -4.8f) = [-4.8f, 2.6f, 6.7f] * ArrayUtils.add([2.9f, 6.0f, 0.3f], 2, 1.0f) = [2.9f, 6.0f, 1.0f, 0.3f] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static float[] add(final float[] array, final int index, final float element) { return (float[]) add(array, index, Float.valueOf(element), Float.TYPE); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices).</p> * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element.</p> * * <pre> * ArrayUtils.add([1.1], 0, 2.2) = [2.2, 1.1] * ArrayUtils.add([2.3, 6.4], 2, 10.5) = [2.3, 6.4, 10.5] * ArrayUtils.add([2.6, 6.7], 0, -4.8) = [-4.8, 2.6, 6.7] * ArrayUtils.add([2.9, 6.0, 0.3], 2, 1.0) = [2.9, 6.0, 1.0, 0.3] * </pre> * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @return A new array containing the existing elements and the new element * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt; array.length). */ public static double[] add(final double[] array, final int index, final double element) { return (double[]) add(array, index, Double.valueOf(element), Double.TYPE); } /** * Underlying implementation of add(array, index, element) methods. * The last parameter is the class, which may not equal element.getClass * for primitives. * * @param array the array to add the element to, may be {@code null} * @param index the position of the new object * @param element the object to add * @param clss the type of the element being added * @return A new array containing the existing elements and the new element */ private static Object add(final Object array, final int index, final Object element, final Class<?> clss) { if (array == null) { if (index != 0) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0"); } final Object joinedArray = Array.newInstance(clss, 1); Array.set(joinedArray, 0, element); return joinedArray; } final int length = Array.getLength(array); if (index > length || index < 0) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length); } final Object result = Array.newInstance(clss, length + 1); System.arraycopy(array, 0, result, 0, index); Array.set(result, index, element); if (index < length) { System.arraycopy(array, index, result, index + 1, length - index); } return result; } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove(["a"], 0) = [] * ArrayUtils.remove(["a", "b"], 0) = ["b"] * ArrayUtils.remove(["a", "b"], 1) = ["a"] * ArrayUtils.remove(["a", "b", "c"], 1) = ["a", "c"] * </pre> * * @param <T> the component type of the array * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ @SuppressWarnings("unchecked") // remove() always creates an array of the same type as its input public static <T> T[] remove(final T[] array, final int index) { return (T[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, "a") = null * ArrayUtils.removeElement([], "a") = [] * ArrayUtils.removeElement(["a"], "b") = ["a"] * ArrayUtils.removeElement(["a", "b"], "a") = ["b"] * ArrayUtils.removeElement(["a", "b", "a"], "a") = ["b", "a"] * </pre> * * @param <T> the component type of the array * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static <T> T[] removeElement(final T[] array, final Object element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([true], 0) = [] * ArrayUtils.remove([true, false], 0) = [false] * ArrayUtils.remove([true, false], 1) = [true] * ArrayUtils.remove([true, true, false], 1) = [true, false] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static boolean[] remove(final boolean[] array, final int index) { return (boolean[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, true) = null * ArrayUtils.removeElement([], true) = [] * ArrayUtils.removeElement([true], false) = [true] * ArrayUtils.removeElement([true, false], false) = [true] * ArrayUtils.removeElement([true, false, true], true) = [false, true] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static boolean[] removeElement(final boolean[] array, final boolean element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([1], 0) = [] * ArrayUtils.remove([1, 0], 0) = [0] * ArrayUtils.remove([1, 0], 1) = [1] * ArrayUtils.remove([1, 0, 1], 1) = [1, 1] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static byte[] remove(final byte[] array, final int index) { return (byte[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 1) = null * ArrayUtils.removeElement([], 1) = [] * ArrayUtils.removeElement([1], 0) = [1] * ArrayUtils.removeElement([1, 0], 0) = [1] * ArrayUtils.removeElement([1, 0, 1], 1) = [0, 1] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static byte[] removeElement(final byte[] array, final byte element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove(['a'], 0) = [] * ArrayUtils.remove(['a', 'b'], 0) = ['b'] * ArrayUtils.remove(['a', 'b'], 1) = ['a'] * ArrayUtils.remove(['a', 'b', 'c'], 1) = ['a', 'c'] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static char[] remove(final char[] array, final int index) { return (char[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 'a') = null * ArrayUtils.removeElement([], 'a') = [] * ArrayUtils.removeElement(['a'], 'b') = ['a'] * ArrayUtils.removeElement(['a', 'b'], 'a') = ['b'] * ArrayUtils.removeElement(['a', 'b', 'a'], 'a') = ['b', 'a'] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static char[] removeElement(final char[] array, final char element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([1.1], 0) = [] * ArrayUtils.remove([2.5, 6.0], 0) = [6.0] * ArrayUtils.remove([2.5, 6.0], 1) = [2.5] * ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static double[] remove(final double[] array, final int index) { return (double[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 1.1) = null * ArrayUtils.removeElement([], 1.1) = [] * ArrayUtils.removeElement([1.1], 1.2) = [1.1] * ArrayUtils.removeElement([1.1, 2.3], 1.1) = [2.3] * ArrayUtils.removeElement([1.1, 2.3, 1.1], 1.1) = [2.3, 1.1] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static double[] removeElement(final double[] array, final double element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([1.1], 0) = [] * ArrayUtils.remove([2.5, 6.0], 0) = [6.0] * ArrayUtils.remove([2.5, 6.0], 1) = [2.5] * ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static float[] remove(final float[] array, final int index) { return (float[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 1.1) = null * ArrayUtils.removeElement([], 1.1) = [] * ArrayUtils.removeElement([1.1], 1.2) = [1.1] * ArrayUtils.removeElement([1.1, 2.3], 1.1) = [2.3] * ArrayUtils.removeElement([1.1, 2.3, 1.1], 1.1) = [2.3, 1.1] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static float[] removeElement(final float[] array, final float element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([1], 0) = [] * ArrayUtils.remove([2, 6], 0) = [6] * ArrayUtils.remove([2, 6], 1) = [2] * ArrayUtils.remove([2, 6, 3], 1) = [2, 3] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static int[] remove(final int[] array, final int index) { return (int[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 1) = null * ArrayUtils.removeElement([], 1) = [] * ArrayUtils.removeElement([1], 2) = [1] * ArrayUtils.removeElement([1, 3], 1) = [3] * ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static int[] removeElement(final int[] array, final int element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([1], 0) = [] * ArrayUtils.remove([2, 6], 0) = [6] * ArrayUtils.remove([2, 6], 1) = [2] * ArrayUtils.remove([2, 6, 3], 1) = [2, 3] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static long[] remove(final long[] array, final int index) { return (long[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 1) = null * ArrayUtils.removeElement([], 1) = [] * ArrayUtils.removeElement([1], 2) = [1] * ArrayUtils.removeElement([1, 3], 1) = [3] * ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static long[] removeElement(final long[] array, final long element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.remove([1], 0) = [] * ArrayUtils.remove([2, 6], 0) = [6] * ArrayUtils.remove([2, 6], 1) = [2] * ArrayUtils.remove([2, 6, 3], 1) = [2, 3] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ public static short[] remove(final short[] array, final int index) { return (short[]) remove((Object) array, index); } /** * <p>Removes the first occurrence of the specified element from the * specified array. All subsequent elements are shifted to the left * (subtracts one from their indices). If the array doesn't contains * such an element, no elements are removed from the array.</p> * * <p>This method returns a new array with the same elements of the input * array except the first occurrence of the specified element. The component * type of the returned array is always the same as that of the input * array.</p> * * <pre> * ArrayUtils.removeElement(null, 1) = null * ArrayUtils.removeElement([], 1) = [] * ArrayUtils.removeElement([1], 2) = [1] * ArrayUtils.removeElement([1, 3], 1) = [3] * ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param element the element to be removed * @return A new array containing the existing elements except the first * occurrence of the specified element. * @since 2.1 */ public static short[] removeElement(final short[] array, final short element) { final int index = indexOf(array, element); if (index == INDEX_NOT_FOUND) { return clone(array); } return remove(array, index); } /** * <p>Removes the element at the specified position from the specified array. * All subsequent elements are shifted to the left (subtracts one from * their indices).</p> * * <p>This method returns a new array with the same elements of the input * array except the element on the specified position. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * @param array the array to remove the element from, may not be {@code null} * @param index the position of the element to be removed * @return A new array containing the existing elements except the element * at the specified position. * @throws IndexOutOfBoundsException if the index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 2.1 */ private static Object remove(final Object array, final int index) { final int length = getLength(array); if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length); } final Object result = Array.newInstance(array.getClass().getComponentType(), length - 1); System.arraycopy(array, 0, result, 0, index); if (index < length - 1) { System.arraycopy(array, index + 1, result, index, length - index - 1); } return result; } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll(["a", "b", "c"], 0, 2) = ["b"] * ArrayUtils.removeAll(["a", "b", "c"], 1, 2) = ["a"] * </pre> * * @param <T> the component type of the array * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ @SuppressWarnings("unchecked") // removeAll() always creates an array of the same type as its input public static <T> T[] removeAll(final T[] array, final int... indices) { return (T[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, "a", "b") = null * ArrayUtils.removeElements([], "a", "b") = [] * ArrayUtils.removeElements(["a"], "b", "c") = ["a"] * ArrayUtils.removeElements(["a", "b"], "a", "c") = ["b"] * ArrayUtils.removeElements(["a", "b", "a"], "a") = ["b", "a"] * ArrayUtils.removeElements(["a", "b", "a"], "a", "a") = ["b"] * </pre> * * @param <T> the component type of the array * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static <T> T[] removeElements(final T[] array, final T... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<T, MutableInt> occurrences = new HashMap<T, MutableInt>(values.length); for (final T v : values) { final MutableInt count = occurrences.get(v); if (count == null) { occurrences.put(v, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<T, MutableInt> e : occurrences.entrySet()) { final T v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v, found); if (found < 0) { break; } toRemove.set(found++); } } @SuppressWarnings("unchecked") // removeAll() always creates an array of the same type as its input final T[] result = (T[]) removeAll(array, toRemove); return result; } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static byte[] removeAll(final byte[] array, final int... indices) { return (byte[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static byte[] removeElements(final byte[] array, final byte... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final Map<Byte, MutableInt> occurrences = new HashMap<Byte, MutableInt>(values.length); for (final byte v : values) { final Byte boxed = Byte.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Byte, MutableInt> e : occurrences.entrySet()) { final Byte v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.byteValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (byte[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static short[] removeAll(final short[] array, final int... indices) { return (short[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static short[] removeElements(final short[] array, final short... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Short, MutableInt> occurrences = new HashMap<Short, MutableInt>(values.length); for (final short v : values) { final Short boxed = Short.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Short, MutableInt> e : occurrences.entrySet()) { final Short v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.shortValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (short[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static int[] removeAll(final int[] array, final int... indices) { return (int[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static int[] removeElements(final int[] array, final int... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Integer, MutableInt> occurrences = new HashMap<Integer, MutableInt>(values.length); for (final int v : values) { final Integer boxed = Integer.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Integer, MutableInt> e : occurrences.entrySet()) { final Integer v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.intValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (int[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static char[] removeAll(final char[] array, final int... indices) { return (char[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static char[] removeElements(final char[] array, final char... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Character, MutableInt> occurrences = new HashMap<Character, MutableInt>(values.length); for (final char v : values) { final Character boxed = Character.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Character, MutableInt> e : occurrences.entrySet()) { final Character v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.charValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (char[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static long[] removeAll(final long[] array, final int... indices) { return (long[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static long[] removeElements(final long[] array, final long... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Long, MutableInt> occurrences = new HashMap<Long, MutableInt>(values.length); for (final long v : values) { final Long boxed = Long.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Long, MutableInt> e : occurrences.entrySet()) { final Long v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.longValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (long[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static float[] removeAll(final float[] array, final int... indices) { return (float[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static float[] removeElements(final float[] array, final float... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Float, MutableInt> occurrences = new HashMap<Float, MutableInt>(values.length); for (final float v : values) { final Float boxed = Float.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Float, MutableInt> e : occurrences.entrySet()) { final Float v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.floatValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (float[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([1], 0) = [] * ArrayUtils.removeAll([2, 6], 0) = [6] * ArrayUtils.removeAll([2, 6], 0, 1) = [] * ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] * ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] * ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static double[] removeAll(final double[] array, final int... indices) { return (double[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, 1, 2) = null * ArrayUtils.removeElements([], 1, 2) = [] * ArrayUtils.removeElements([1], 2, 3) = [1] * ArrayUtils.removeElements([1, 3], 1, 2) = [3] * ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] * ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static double[] removeElements(final double[] array, final double... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Double, MutableInt> occurrences = new HashMap<Double, MutableInt>(values.length); for (final double v : values) { final Double boxed = Double.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Double, MutableInt> e : occurrences.entrySet()) { final Double v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.doubleValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (double[]) removeAll(array, toRemove); } /** * <p>Removes the elements at the specified positions from the specified array. * All remaining elements are shifted to the left.</p> * * <p>This method returns a new array with the same elements of the input * array except those at the specified positions. The component * type of the returned array is always the same as that of the input * array.</p> * * <p>If the input array is {@code null}, an IndexOutOfBoundsException * will be thrown, because in that case no valid index can be specified.</p> * * <pre> * ArrayUtils.removeAll([true, false, true], 0, 2) = [false] * ArrayUtils.removeAll([true, false, true], 1, 2) = [true] * </pre> * * @param array the array to remove the element from, may not be {@code null} * @param indices the positions of the elements to be removed * @return A new array containing the existing elements except those * at the specified positions. * @throws IndexOutOfBoundsException if any index is out of range * (index &lt; 0 || index &gt;= array.length), or if the array is {@code null}. * @since 3.0.1 */ public static boolean[] removeAll(final boolean[] array, final int... indices) { return (boolean[]) removeAll((Object) array, clone(indices)); } /** * <p>Removes occurrences of specified elements, in specified quantities, * from the specified array. All subsequent elements are shifted left. * For any element-to-be-removed specified in greater quantities than * contained in the original array, no change occurs beyond the * removal of the existing matching items.</p> * * <p>This method returns a new array with the same elements of the input * array except for the earliest-encountered occurrences of the specified * elements. The component type of the returned array is always the same * as that of the input array.</p> * * <pre> * ArrayUtils.removeElements(null, true, false) = null * ArrayUtils.removeElements([], true, false) = [] * ArrayUtils.removeElements([true], false, false) = [true] * ArrayUtils.removeElements([true, false], true, true) = [false] * ArrayUtils.removeElements([true, false, true], true) = [false, true] * ArrayUtils.removeElements([true, false, true], true, true) = [false] * </pre> * * @param array the array to remove the element from, may be {@code null} * @param values the elements to be removed * @return A new array containing the existing elements except the * earliest-encountered occurrences of the specified elements. * @since 3.0.1 */ public static boolean[] removeElements(final boolean[] array, final boolean... values) { if (isEmpty(array) || isEmpty(values)) { return clone(array); } final HashMap<Boolean, MutableInt> occurrences = new HashMap<Boolean, MutableInt>(2); // only two possible values here for (final boolean v : values) { final Boolean boxed = Boolean.valueOf(v); final MutableInt count = occurrences.get(boxed); if (count == null) { occurrences.put(boxed, new MutableInt(1)); } else { count.increment(); } } final BitSet toRemove = new BitSet(); for (final Map.Entry<Boolean, MutableInt> e : occurrences.entrySet()) { final Boolean v = e.getKey(); int found = 0; for (int i = 0, ct = e.getValue().intValue(); i < ct; i++) { found = indexOf(array, v.booleanValue(), found); if (found < 0) { break; } toRemove.set(found++); } } return (boolean[]) removeAll(array, toRemove); } /** * Removes multiple array elements specified by index. * @param array source * @param indices to remove, WILL BE SORTED--so only clones of user-owned arrays! * @return new array of same type minus elements specified by unique values of {@code indices} * @since 3.0.1 */ // package protected for access by unit tests static Object removeAll(final Object array, final int... indices) { final int length = getLength(array); int diff = 0; // number of distinct indexes, i.e. number of entries that will be removed if (isNotEmpty(indices)) { Arrays.sort(indices); int i = indices.length; int prevIndex = length; while (--i >= 0) { final int index = indices[i]; if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length); } if (index >= prevIndex) { continue; } diff++; prevIndex = index; } } final Object result = Array.newInstance(array.getClass().getComponentType(), length - diff); if (diff < length) { int end = length; // index just after last copy int dest = length - diff; // number of entries so far not copied for (int i = indices.length - 1; i >= 0; i--) { final int index = indices[i]; if (end - index > 1) { // same as (cp > 0) final int cp = end - index - 1; dest -= cp; System.arraycopy(array, index + 1, result, dest, cp); // Afer this copy, we still have room for dest items. } end = index; } if (end > 0) { System.arraycopy(array, 0, result, 0, end); } } return result; } /** * Removes multiple array elements specified by indices. * * @param array source * @param indices to remove * @return new array of same type minus elements specified by the set bits in {@code indices} * @since 3.2 */ // package protected for access by unit tests static Object removeAll(final Object array, final BitSet indices) { final int srcLength = ArrayUtils.getLength(array); // No need to check maxIndex here, because method only currently called from removeElements() // which guarantee to generate on;y valid bit entries. // final int maxIndex = indices.length(); // if (maxIndex > srcLength) { // throw new IndexOutOfBoundsException("Index: " + (maxIndex-1) + ", Length: " + srcLength); // } final int removals = indices.cardinality(); // true bits are items to remove final Object result = Array.newInstance(array.getClass().getComponentType(), srcLength - removals); int srcIndex=0; int destIndex=0; int count; int set; while((set = indices.nextSetBit(srcIndex)) != -1){ count = set - srcIndex; if (count > 0) { System.arraycopy(array, srcIndex, result, destIndex, count); destIndex += count; } srcIndex = indices.nextClearBit(set); } count = srcLength - srcIndex; if (count > 0) { System.arraycopy(array, srcIndex, result, destIndex, count); } return result; } /** * <p>This method checks whether the provided array is sorted according to the class's * {@code compareTo} method.</p> * * @param array the array to check * @param <T> the datatype of the array to check, it must implement {@code Comparable} * @return whether the array is sorted * @since 3.4 */ public static <T extends Comparable<? super T>> boolean isSorted(final T[] array) { return isSorted(array, new Comparator<T>() { public int compare(T o1, T o2) { return o1.compareTo(o2); } }); } /** * <p>This method checks whether the provided array is sorted according to the provided {@code Comparator}.</p> * * @param array the array to check * @param comparator the {@code Comparator} to compare over * @param <T> the datatype of the array * @return whether the array is sorted * @since 3.4 */ public static <T> boolean isSorted(final T[] array, final Comparator<T> comparator) { if (comparator == null) { throw new IllegalArgumentException("Comparator should not be null."); } if(array == null || array.length < 2) { return true; } T previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final T current = array[i]; if (comparator.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(int[] array) { if(array == null || array.length < 2) { return true; } int previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final int current = array[i]; if(NumberUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(long[] array) { if(array == null || array.length < 2) { return true; } long previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final long current = array[i]; if(NumberUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(short[] array) { if(array == null || array.length < 2) { } short previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final short current = array[i]; if(NumberUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(final double[] array) { if(array == null || array.length < 2) { return true; } double previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final double current = array[i]; if(Double.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(final float[] array) { if(array == null || array.length < 2) { return true; } float previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final float current = array[i]; if(Float.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(byte[] array) { if(array == null || array.length < 2) { return true; } byte previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final byte current = array[i]; if(NumberUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering.</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(char[] array) { if(array == null || array.length < 2) { return true; } char previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final char current = array[i]; if(CharUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; } /** * <p>This method checks whether the provided array is sorted according to natural ordering * ({@code false} before {@code true}).</p> * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(boolean[] array) { if(array == null || array.length < 2) { return true; } boolean previous = array[0]; final int n = array.length; for(int i = 1; i < n; i++) { final boolean current = array[i]; if(BooleanUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; } }
[ "giachi.iada@gmail.com" ]
giachi.iada@gmail.com
982b3d92b2c499c471d3cdf5f0528d90001b313c
eaf51644a5c3863df1554740855f6563a0a23691
/tobacco-demo-webapp/src/main/java/me/noroutine/ErrorController.java
bacd19021426f1f53905f8ca9748e7179431e111
[ "MIT" ]
permissive
lannerate/tobacco-demo
d29845319554bd8b52d3349008a0f4db6a3edea4
cddf6a03fd9c0b0b27130159b58b35323c1bb59f
refs/heads/master
2021-01-25T02:29:06.961145
2012-12-09T22:07:14
2012-12-09T22:07:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package me.noroutine; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; /** * @author Oleksii Khilkevych * @since 02.12.12 */ @Controller @RequestMapping("/error") public class ErrorController { @RequestMapping("/404") public String error404() { return "error.404"; } @RequestMapping("/{code}") @ResponseBody public int error(@PathVariable int code) { return code; } }
[ "oleksiy.khilkevich@gmail.com" ]
oleksiy.khilkevich@gmail.com
d362d4994a1e75421f8d7ebe5bbe787873420f2b
37cf5ff5959a7e8248f73e861a42387e3167fab1
/src/main/java/com/guardedbox/constants/SecurityParameters.java
99ad9a64b5938fc10fa20e0a238dbf98abcd7c21
[ "Apache-2.0" ]
permissive
marioHackathon/guardedbox
b8d0f51c87165d7f3266b58ac6562d6e8ec76f2d
8faadc47bde5c12428b7780ccb16f3c26cbeec9c
refs/heads/master
2020-04-09T03:50:23.509038
2018-12-01T11:24:36
2018-12-01T11:24:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
package com.guardedbox.constants; /** * Security Parameters. * * @author s3curitybug@gmail.com * */ public final class SecurityParameters { /** Entropy expander length (number of hexadecimal characters). */ public static final int ENTROPY_EXPANDER_LENGTH = 256; /** Login challenge length. */ public static final int LOGIN_CHALLENGE_LENGTH = 128; /** Login challenge time to live (ms). */ public static final long LOGIN_CHALLENGE_TTL = 10 * 60 * 1000L; /** Login code length. */ public static final int LOGIN_CODE_LENGTH = 10; /** Login code time to live (ms). */ public static final long LOGIN_CODE_TTL = 10 * 60 * 1000L; /** Registration token length. */ public static final int REGISTRATION_TOKEN_LENGTH = 64; /** Registration token time to live (ms). */ public static final long REGISTRATION_TOKEN_TTL = 2 * 60 * 60 * 1000L; /** Registration token minimum time to live (ms). Tokens will not be overridden during this time since its expedition. */ public static final long REGISTRATION_TOKEN_MIN_TTL = 5 * 60 * 1000L; /** Number of security questions. */ public static final int N_SECURITY_QUESTIONS = 3; /** Name of the captcha response header. */ public static final String CAPTCHA_RESPONSE_HEADER = "Captcha-Response"; }
[ "s3curitybug@gmail.com" ]
s3curitybug@gmail.com
3cff3fa04f8a09e230ab23b4c7a88ccdf89961cd
ee67aa1067d3f90d4ed3c75926cc8fbf0c4e406a
/app/src/test/java/com/example/luci/roamappdevelopment/ExampleUnitTest.java
9967ff7b279d5805ede730c7a1a07b0a18366fc9
[]
no_license
LucianComsa/RoamAppDevelopment
4d871a827319016f1b66c203d196c398bb6e0172
78f25a09a76ccd11a9961092786d68e5d78a49d4
refs/heads/master
2021-09-05T10:25:05.088910
2018-01-26T11:40:40
2018-01-26T11:40:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.example.luci.roamappdevelopment; 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() throws Exception { assertEquals(4, 2 + 2); } }
[ "luci_crossfire@yahoo.com" ]
luci_crossfire@yahoo.com
d79a825317c06cd8fd6a0d023fe37ced8d17603f
8af8c7bba543ac9f0267783c17cf1985170e2e18
/src/src/main/java/enshud/s3/checker/ASTVariableDeclaration.java
2e32da438274b20a69a016ae389e5f0d8910cc48
[]
no_license
kk-mats/ESDX
8cd92b18fcce3a6ec9fa09dd4805c9ac54b3eacd
d845b98f82b55bc921ccc087479ae32714eed926
refs/heads/master
2021-05-13T18:11:19.106852
2018-01-31T16:48:56
2018-01-31T16:48:56
116,854,160
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package enshud.s3.checker; import java.util.ArrayList; public class ASTVariableDeclaration extends AST { private ArrayList<String> names; private ASTVariableType type; ASTVariableDeclaration(final ArrayList<String> names, final ASTVariableType type, final Record record) { super(record); this.names=names; this.type=type; } public void accept(final ASTVisitor visitor) throws ASTException { try { visitor.visit(this); } catch (ASTException e) { throw e; } } public ArrayList<String> getNames() { return names; } public ASTVariableType getType() { return type; } public void setNames(final ArrayList<String> names) { this.names=names; } }
[ "k.mats.kk@gmail.com" ]
k.mats.kk@gmail.com
23689614d63876889f7dc97732ff40cdcc7ba6e0
3c2621b46b2f4560d34ea35104b62fbb8a4a227e
/androidCode/src/main/java/cqu/cqumonk/androidcode/downLoadManager/ThreadInfo.java
450b76880daaf2d712cd6bf97bc1348519478f78
[]
no_license
chenzhuo1024/AndroidCode
534df0802f5773e2019222efa0eb4fc1e82446c0
cc0c9a8a71b05e5f1595d7c9548bb33d42e09e68
refs/heads/master
2021-05-30T20:52:46.045414
2015-05-12T03:26:52
2015-05-12T03:26:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,593
java
package cqu.cqumonk.androidcode.downLoadManager; import java.io.Serializable; /** * Created by CQUMonk on 2015/4/11. */ public class ThreadInfo implements Serializable { private int threadId; private String url; //下载的开始位置,结束位置,和完成进度 private int start; private int end; private int finished; public ThreadInfo() { } public ThreadInfo(int threadId, String url, int start, int end, int finished) { this.threadId = threadId; this.url = url; this.start = start; this.end = end; this.finished = finished; } @Override public String toString() { return "ThreadInfo{" + "threadId=" + threadId + ", url='" + url + '\'' + ", start=" + start + ", end=" + end + ", finished=" + finished + '}'; } public int getThreadId() { return threadId; } public void setThreadId(int threadId) { this.threadId = threadId; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(int end) { this.end = end; } public int getFinished() { return finished; } public void setFinished(int finished) { this.finished = finished; } }
[ "zhuochen@cqu.edu.cn" ]
zhuochen@cqu.edu.cn
8f78abc2c0a299aa1e83a591c9cc3baa6e098e31
6b45f1560ecccc832cc0063291eb3522605f6169
/src/main/java/com/fbieck/conf/batches/TweetBatchConfiguration.java
45e415efbf96b77a4928573024afddd132b33a6e
[]
no_license
florianBieck/MultivariateStatistik
7135322bffb7a729022f7ddb88dc7bfc80ab30cf
751725d49d25b15a85420df82632c57356e126ac
refs/heads/master
2020-03-28T12:18:49.496500
2018-11-08T12:09:35
2018-11-08T12:09:35
148,286,887
0
0
null
null
null
null
UTF-8
Java
false
false
1,583
java
package com.fbieck.conf.batches; import com.fbieck.batch.tweet.TweetProcessor; import com.fbieck.batch.tweet.TweetReader; import com.fbieck.batch.tweet.TweetWriter; import com.fbieck.entities.twitter.Tweet; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class TweetBatchConfiguration { @Autowired private JobBuilderFactory jobBuilderFactory; @Autowired private StepBuilderFactory stepBuilderFactory; @Autowired private TweetProcessor tweetProcessor; @Autowired private TweetReader tweetReader; @Autowired private TweetWriter tweetWriter; @Bean public Job job_tweet() { Step step = stepBuilderFactory.get("tweet") .<org.springframework.social.twitter.api.Tweet, Tweet>chunk(500) .reader(tweetReader) .processor(tweetProcessor) .writer(tweetWriter) .allowStartIfComplete(true) .build(); return jobBuilderFactory.get("job_tweet") .incrementer(new RunIdIncrementer()) .start(step) .build(); } }
[ "florian@bieck.com" ]
florian@bieck.com
164d42fc9977754e09927743758dac6940b158e0
28287953acab45e052978fd881d07417694992c2
/src/main/java/com/racs/core/entities/Roles.java
2073a54c9f2c817854ffe595b0d2f0570e70e543
[]
no_license
christophermaster/RACS
2d79a98c2cc4ed4eddfb758a9388d3b086529083
1e022cb316643be4a3580f050581c6caf067b384
refs/heads/master
2021-07-23T22:35:41.063898
2018-11-05T13:17:52
2018-11-05T13:17:52
139,760,171
0
0
null
null
null
null
UTF-8
Java
false
false
6,628
java
package com.racs.core.entities; import javax.persistence.*; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Clase entidad que representa un rol de una aplicación, además de una * entidad que se relaciona con los usuarios. * * @author team disca */ @Entity //@Table(name = "roles_users", uniqueConstraints = @UniqueConstraint(columnNames = { "aplication_client_id", "name" })) @Table(name = "roles") public class Roles implements Serializable { /** * */ private static final long serialVersionUID = -5423416466129355042L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "name", length = 50, nullable = false) private String name; @Column(name = "type") private String type; @Column(name = "enabled") private Boolean enabled; @Temporal(TemporalType.DATE) @Column (name="creation_date") private Date creationDate; @Temporal(TemporalType.DATE) @Column (name="last_update_date") private Date lastUpdateDate; @Column(name = "creator_user" ) private String creatorUser; @Column(name = "last_user_updater") private String lastUserUpdater; /*@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "roleApp") private List<FunctionalityRole> functionalityRoles = new ArrayList<>();*/ @ManyToMany(mappedBy = "rols") private List<User> users = new ArrayList<>(); // Gestion de la relacion *ToMany /*public void addFunctionalityRole(FunctionalityRole functionalityRole) { functionalityRoles.add(functionalityRole); functionalityRole.setRoleApp(this); } public void removeFunctionalityRole(FunctionalityRole functionalityRole) { functionalityRoles.remove(functionalityRole); functionalityRole.setRoleApp(null); }*/ public void addUserSso(User user) { users.add(user); user.getRols().add(this); } public void removeUserSso(User user) { users.remove(user); user.getRols().remove(this); } // Constructores public Roles() { } public Roles(Long id, String name, String type, Boolean enabled, Date creationDate, Date lastUpdateDate, String creatorUser, String lastUserUpdater, List<User> users) { super(); this.id = id; this.name = name; this.type = type; this.enabled = enabled; this.creationDate = creationDate; this.lastUpdateDate = lastUpdateDate; this.creatorUser = creatorUser; this.lastUserUpdater = lastUserUpdater; this.users = users; } //Getter y Setter public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Boolean getEnabled() { return enabled; } public void setEnabled(Boolean enabled) { this.enabled = enabled; } public Date getCreationDate() { return creationDate; } public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } public Date getLastUpdateDate() { return lastUpdateDate; } public void setLastUpdateDate(Date lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } public String getCreatorUser() { return creatorUser; } public void setCreatorUser(String creatorUser) { this.creatorUser = creatorUser; } public String getLastUserUpdater() { return lastUserUpdater; } public void setLastUserUpdater(String lastUserUpdater) { this.lastUserUpdater = lastUserUpdater; } public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("RoleUser [id="); builder.append(id); builder.append(", name="); builder.append(name); builder.append(", type="); builder.append(type); builder.append(", enabled="); builder.append(enabled); builder.append(", creationDate="); builder.append(creationDate); builder.append(", lastUpdateDate="); builder.append(lastUpdateDate); builder.append(", creatorUser="); builder.append(creatorUser); builder.append(", lastUserUpdater="); builder.append(lastUserUpdater); builder.append(", users="); builder.append(users); builder.append("]"); return builder.toString(); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); result = prime * result + ((creatorUser == null) ? 0 : creatorUser.hashCode()); result = prime * result + ((enabled == null) ? 0 : enabled.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode()); result = prime * result + ((lastUserUpdater == null) ? 0 : lastUserUpdater.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((users == null) ? 0 : users.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Roles)) return false; Roles other = (Roles) obj; if (creationDate == null) { if (other.creationDate != null) return false; } else if (!creationDate.equals(other.creationDate)) return false; if (creatorUser == null) { if (other.creatorUser != null) return false; } else if (!creatorUser.equals(other.creatorUser)) return false; if (enabled == null) { if (other.enabled != null) return false; } else if (!enabled.equals(other.enabled)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (lastUpdateDate == null) { if (other.lastUpdateDate != null) return false; } else if (!lastUpdateDate.equals(other.lastUpdateDate)) return false; if (lastUserUpdater == null) { if (other.lastUserUpdater != null) return false; } else if (!lastUserUpdater.equals(other.lastUserUpdater)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (type == null) { if (other.type != null) return false; } else if (!type.equals(other.type)) return false; if (users == null) { if (other.users != null) return false; } else if (!users.equals(other.users)) return false; return true; } }
[ "christopherfacyt@gmail.com" ]
christopherfacyt@gmail.com
5f42b5b0ea8f21d14537df676d846805bcbfc6f9
51b19a3b066f68d5157d3b76a066feea2e274602
/week3/src/Task4.java
f7fded298443b3d119579be79958057391507284
[]
no_license
got7zzan/C4-jxc
fc76a3fe46ff649a2cdb308765b5f1cbd0d55164
d149f1dbeee0327c92440cf51dcad4a19ff56a1b
refs/heads/master
2023-04-08T06:56:26.368542
2021-04-18T10:46:02
2021-04-18T10:46:02
331,885,002
0
0
null
null
null
null
UTF-8
Java
false
false
1,311
java
/* wordCount(用 hashMap 实现) 输入一串由英文字符串,现在需要统计出每个英文字母出现的次数 */ import java.util.HashMap; import java.util.Scanner; public class Task4 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("请输入一串字符串:"); String s= in.nextLine(); HashMap<Character,Integer> map = new HashMap<>(); //将字符串转为字符串数组 char[] str = s.toCharArray(); //遍历字符串 for (char c : str) { //使用获取到的字符,判断map中是否存在 //如果存在,则value++ if(map.containsKey(c)) { Integer value = map.get(c); value++; map.put(c,value); } //如果不存在 else { map.put(c,1); } } //最后输出结果 System.out.println("结果为:"); //Map.keySet() 方法将获取 Map 集合的所有键,并存放在一个 Set 集合对象中 for (Character key : map.keySet()) { Integer value = map.get(key); System.out.println(key+":"+value); } } }
[ "1765373189@qq.com" ]
1765373189@qq.com
f342620732b23a8d12bfe3967ac6ff46d6917995
80a1ecfec9d5a6153ad7c81783b90bfea5ee3974
/j2ee-parent/j2ee-extjs/src/main/java/com/maty/j2ee/exception/LoginException.java
de11a6aa88577d251f75d4b213c7c3c7a868780a
[]
no_license
cxjava/maty-project
4c5a04c34c09e96fa8d176173206b14b6bc5b96d
dd66dd7f141a6511f0f8ce816269c9e38fdd9b58
refs/heads/master
2021-01-22T13:42:34.482268
2013-06-19T08:38:05
2013-06-19T08:38:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,415
java
package com.maty.j2ee.exception; import org.apache.shiro.authc.AuthenticationException; /** * @author Maty Chen * */ public class LoginException extends AuthenticationException { /** */ private static final long serialVersionUID = 1625966047389581357L; /** * error code,config in the i18n file,use * MessageSource.getMessage(errorCode, null, locale) get the value ,and show * to user */ private String errorCode; /** * */ public LoginException() { super(); } /** * @param message * @param cause */ public LoginException(String message, Throwable cause) { super(message, cause); } /** * @param message * @param errorCode * @param cause */ public LoginException(String message, String errorCode, Throwable cause) { super(message, cause); this.errorCode = errorCode; } /** * @param message * @param errorCode */ public LoginException(String message, String errorCode) { super(message); this.errorCode = errorCode; } /** * @param message */ public LoginException(String message) { super(message); } /** * @param cause */ public LoginException(Throwable cause) { super(cause); } /** * @return the errorCode error code,config in the i18n file,use * MessageSource.getMessage(errorCode, null, locale) get the value * ,and show to user */ public String getErrorCode() { return errorCode; } }
[ "cxjava@gmail.com" ]
cxjava@gmail.com
3e55903a17c02a8487f4f9b6afb947c75f819cc1
8d215cc39f6871703130d2eb0476957b3ea6198b
/app/src/main/java/com/htlc/cykf/app/activity/ChangeUsernameActivity.java
999c1cdf0ffb114208b9a1615459f42c7283733d
[]
no_license
lpsll/ChuYuanJianKang_Doctor
383c903617f3a3665e976f68002628f3ec3e82f3
6671f3e02b5be4754e01a545f9fe81e9ecd897fc
refs/heads/master
2021-01-24T10:54:02.752248
2016-06-16T02:11:52
2016-06-16T02:11:52
70,297,151
0
1
null
null
null
null
UTF-8
Java
false
false
4,083
java
package com.htlc.cykf.app.activity; import android.os.Bundle; import android.text.method.HideReturnsTransformationMethod; import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.htlc.cykf.R; import com.htlc.cykf.app.App; import com.htlc.cykf.app.util.ToastUtil; import com.htlc.cykf.core.ActionCallbackListener; import com.htlc.cykf.model.UserBean; /** * Created by sks on 2016/2/15. */ public class ChangeUsernameActivity extends BaseActivity implements View.OnClickListener { private TextView mTextUsername, mTextButton; private EditText mEditText; private LinearLayout mLinearUsername; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_change_username); setupView(); } private void setupView() { findViewById(R.id.imageBack).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); mLinearUsername = (LinearLayout) findViewById(R.id.linearUsername); mTextUsername = (TextView) findViewById(R.id.textUsername); mTextButton = (TextView) findViewById(R.id.textButton); mEditText = (EditText) findViewById(R.id.editInput); mTextButton.setOnClickListener(this); refreshView(); } private void refreshView() { mTextUsername.setText("+86-"+application.getUserBean().username); mLinearUsername.setVisibility(View.VISIBLE); mEditText.setVisibility(View.GONE); mTextButton.setText("更换"); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.textButton: execute(); break; } } private void execute() { String buttonName = mTextButton.getText().toString(); if ("更换".equals(buttonName)) { mLinearUsername.setVisibility(View.GONE); mEditText.setVisibility(View.VISIBLE); mTextButton.setText("下一步"); } else if ("下一步".equals(buttonName)) { checkPassword(); } else if ("绑定".equals(buttonName)) { bindNewTel(); } } private void checkPassword() { final String password = mEditText.getText().toString().trim(); String username = application.getUserBean().username; appAction.login(username, password, new ActionCallbackListener<UserBean>() { @Override public void onSuccess(UserBean data) { data.password = password; application.setUserBean(data); mEditText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); // mEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); mEditText.setText(""); mEditText.setHint("请输入新手机号"); mTextButton.setText("绑定"); } @Override public void onFailure(String errorEvent, String message) { if(handleNetworkOnFailure(errorEvent, message)) return; ToastUtil.showToast(App.app, message); } }); } private void bindNewTel() { final String username = mEditText.getText().toString().trim(); appAction.changeUsername(username, new ActionCallbackListener<Void>() { @Override public void onSuccess(Void data) { UserBean userBean = new UserBean(); userBean.username = username; application.setUserBean(userBean); refreshView(); } @Override public void onFailure(String errorEvent, String message) { if(handleNetworkOnFailure(errorEvent, message)) return; ToastUtil.showToast(application,message); } }); } }
[ "peng.yuanbo@163.com" ]
peng.yuanbo@163.com
8f72da09e32a4c9801cf266fe8e85234e40f4ff5
0b0f5aaf4fc19c1e6b2f4729756d1f08345f3f7a
/src/main/java/xutils/utils/UUIDUtils.java
cf8464d8d42703ca13ad9285f66a61b3884174c1
[]
no_license
spiderII/commonUtils
bc6ffd2f5aacdaffeb07df563293d12626c0e35a
769f7ddd8f534eae8f434a84f05d6268d5ec784b
refs/heads/master
2020-11-26T05:01:47.399714
2018-01-19T09:39:58
2018-01-19T09:39:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,674
java
package xutils.utils; import java.net.InetAddress; /** * UUID 生成工具类 * * @author xuan * @version $Revision: 1.0 $, $Date: 2012-11-22 上午9:54:58 $ */ public class UUIDUtils { private static UUIDUtils uuid = new UUIDUtils(); private static final int IP; static { int ipadd; try { ipadd = toInt(InetAddress.getLocalHost().getAddress()); } catch (Exception e) { ipadd = 0; } IP = ipadd; } private static short counter = (short) 0; private static final int JVM = (int) (System.currentTimeMillis() >>> 8); /** * 构造方法 */ public UUIDUtils() { } /** * 生成16进制表达的字符串 UUID。 * * @return 32 字节长度的 UUID 字符串 */ public String generateHex() { StringBuilder sb = new StringBuilder(32); sb.append(format(getIP())); sb.append(format(getJVM())); sb.append(format(getHighTime())); sb.append(format(getLowTime())); sb.append(format(getCount())); return sb.toString().toUpperCase(); } /** * 生成字节数组的UUID * * @return */ public byte[] generateBytes() { byte[] bytes = new byte[16]; System.arraycopy(getBytes(getIP()), 0, bytes, 0, 4); System.arraycopy(getBytes(getJVM()), 0, bytes, 4, 4); System.arraycopy(getBytes(getHighTime()), 0, bytes, 8, 2); System.arraycopy(getBytes(getLowTime()), 0, bytes, 10, 4); System.arraycopy(getBytes(getCount()), 0, bytes, 14, 2); return bytes; } private String format(int intval) { String formatted = Integer.toHexString(intval); StringBuilder buf = new StringBuilder("00000000"); buf.replace(8 - formatted.length(), 8, formatted); return buf.toString(); } private String format(short shortval) { String formatted = Integer.toHexString(shortval); StringBuilder buf = new StringBuilder("0000"); buf.replace(4 - formatted.length(), 4, formatted); return buf.toString(); } /** * Unique across JVMs on this machine (unless they load this class in the same quater second - very unlikely) */ private int getJVM() { return JVM; } /** * Unique in a millisecond for this JVM instance (unless there are > Short.MAX_VALUE instances created in a * millisecond) */ private short getCount() { synchronized (UUIDUtils.class) { if (counter < 0) { counter = 0; } return counter++; } } /** * Unique in a local network */ private int getIP() { return IP; } /** * Unique down to millisecond */ private short getHighTime() { return (short) (System.currentTimeMillis() >>> 32); } private int getLowTime() { return (int) System.currentTimeMillis(); } private static int toInt(byte[] bytes) { int result = 0; for (int i = 0; i < 4; i++) { result = (result << 8) - Byte.MIN_VALUE + bytes[i]; } return result; } private static byte[] getBytes(int intval) { return new byte[] { (byte) (intval >> 24), (byte) (intval >> 16), (byte) (intval >> 8), (byte) intval }; } private static byte[] getBytes(short shortval) { return new byte[] { (byte) (shortval >> 8), (byte) shortval }; } /** * 产生新的UUID * * @return 32位长的UUID字符串 */ public static String uuid() { return uuid.generateHex(); } }
[ "test" ]
test
78a9c5a7576ac325769d89d65ad4c8e11de3e524
cba5d5319b6efd200416c348d157fb7b53145f86
/SVG-Library/SVG-Plugin/src/main/groovy/com/android/svg/support/model/VectorModel.java
a10522a4385efe0a8318917c7a81c18f6d36b4e6
[ "Apache-2.0" ]
permissive
chiwenheng/SVG-Android
f78dda2109878b7067e1e830da03928db6648182
8fe96d4ae449ee81f1779f9a187cad81fc3205a7
refs/heads/master
2020-06-26T18:15:35.423624
2016-11-17T07:34:06
2016-11-17T07:34:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package com.android.svg.support.model; public class VectorModel { public String name; public Vector vector; }
[ "jgy08954@ly.com" ]
jgy08954@ly.com
a1628ac6beab63bb6856e9a1cb54ff18663dedd9
6e52798954c06a11075c6f8e55ef42b557d7cf47
/Robot2015/src/org/usfirst/frc/team3255/robot2015/commands/DrivetrainResetGyro.java
1af623a9c88c5ceac11a4417df6d809d41eaf558
[]
no_license
FRCTeam3255/Robot2015
2373895f9fff49996f359332b8fe91e46d3649f0
0cc8cb2da1630042ecad8224dc725cbce4ecad29
refs/heads/master
2020-12-25T17:56:50.047915
2017-03-25T23:54:24
2017-03-25T23:54:24
29,079,629
1
2
null
null
null
null
UTF-8
Java
false
false
914
java
package org.usfirst.frc.team3255.robot2015.commands; /** * */ public class DrivetrainResetGyro extends CommandBase { public DrivetrainResetGyro() { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); requires(drivetrain); } // Called just before this Command runs the first time protected void initialize() { drivetrain.resetGyro(); } // Called repeatedly when this Command is scheduled to run protected void execute() { } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return true; } // Called once after isFinished returns true protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { end(); } }
[ "tylerdwarren98@gmail.com" ]
tylerdwarren98@gmail.com
c4d63caf442c6b206b6d6257a39f60568a09c3ae
4fb480db43556444fdf0fb7ac4f59572742ccf3c
/replugin-host-library/build/generated/source/aidl/debug/com/qihoo360/replugin/IBinderGetter.java
5514bf18fa0ad6915f926203a8cf970f071ec27d
[]
no_license
csy51095/Learn_Replugin
96a9ac1286d34f5992ff64feae93199fa8dc7f2f
6bfa2c4cfb950b48b02099ede9cdc54e9111cbb8
refs/heads/master
2022-11-28T15:24:32.109074
2020-08-17T03:20:18
2020-08-17T03:20:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,899
java
/* * This file is auto-generated. DO NOT MODIFY. * Original file: /Users/clark/StudioProjects/Learn_Replugin/replugin-host-library/src/main/aidl/com/qihoo360/replugin/IBinderGetter.aidl */ package com.qihoo360.replugin; /** * Binder的获取器,可用于延迟加载IBinder的情况。 * <p> * 目前用于: * <p> * * RePlugin.registerGlobalBinderDelayed * * @author RePlugin Team */ public interface IBinderGetter extends android.os.IInterface { /** Local-side IPC implementation stub class. */ public static abstract class Stub extends android.os.Binder implements com.qihoo360.replugin.IBinderGetter { private static final java.lang.String DESCRIPTOR = "com.qihoo360.replugin.IBinderGetter"; /** Construct the stub at attach it to the interface. */ public Stub() { this.attachInterface(this, DESCRIPTOR); } /** * Cast an IBinder object into an com.qihoo360.replugin.IBinderGetter interface, * generating a proxy if needed. */ public static com.qihoo360.replugin.IBinderGetter asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof com.qihoo360.replugin.IBinderGetter))) { return ((com.qihoo360.replugin.IBinderGetter)iin); } return new com.qihoo360.replugin.IBinderGetter.Stub.Proxy(obj); } @Override public android.os.IBinder asBinder() { return this; } @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException { java.lang.String descriptor = DESCRIPTOR; switch (code) { case INTERFACE_TRANSACTION: { reply.writeString(descriptor); return true; } case TRANSACTION_get: { data.enforceInterface(descriptor); android.os.IBinder _result = this.get(); reply.writeNoException(); reply.writeStrongBinder(_result); return true; } default: { return super.onTransact(code, data, reply, flags); } } } private static class Proxy implements com.qihoo360.replugin.IBinderGetter { private android.os.IBinder mRemote; Proxy(android.os.IBinder remote) { mRemote = remote; } @Override public android.os.IBinder asBinder() { return mRemote; } public java.lang.String getInterfaceDescriptor() { return DESCRIPTOR; } /** * 获取IBinder对象 */ @Override public android.os.IBinder get() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); android.os.IBinder _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_get, _data, _reply, 0); _reply.readException(); _result = _reply.readStrongBinder(); } finally { _reply.recycle(); _data.recycle(); } return _result; } } static final int TRANSACTION_get = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); } /** * 获取IBinder对象 */ public android.os.IBinder get() throws android.os.RemoteException; }
[ "zdy6542158" ]
zdy6542158
a5316ac8a5369efef7d2e9851942c9736be5adb1
df11ac2ac8ac5acd9a747a3754bfceabbcd5d985
/src/objects/mob/Boss.java
943a5b8448356afb2b7c99f7b0dea63bbb62fe9c
[]
no_license
jmecn/dungeon_generator
3c4540f7404a56b6d5b89b6013da39f47b4aa36e
95071bbccf7ba7f415a6557e6dc11107f215b927
refs/heads/master
2020-06-11T02:54:12.335683
2016-12-04T13:34:41
2016-12-04T13:34:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package objects.mob; import java.awt.Point; import engine.MessageLog; import tiles.TileFactory; public class Boss extends Monster { public Boss(int x, int y, int bonus, char s, String desc, MessageLog l) { super(x, y, s, desc, l); this.pos = new Point(x, y); this.maxHealth=this.hp=40+(bonus*10); this.atk=bonus*5; this.def=bonus*5; this.vit=pickVit(); this.dead=false; this.symbol=s; this.description=desc; this.floor = TileFactory.getInstance().createTileMonster(this.symbol); this.mobTile = TileFactory.getInstance().createTileMonster(this.symbol); } public void murder() { this.dead = true; this.hp=0; this.mobTile = TileFactory.getInstance().createTileStairsDown(); } }
[ "bastien.chapusot@gmx.com" ]
bastien.chapusot@gmx.com
b2695e58a25fd084e62912bbe807b6c4434162bf
17d45abeef6286b1fcff82cd3fad7a6a8d719592
/trunk/rund.FUNKER/src/de/fhaugsburg/rundfunker/rundspieler/DataException.java
079b742ff16da0cb884b5c6495bcdfc7cf06ccf4
[]
no_license
BackupTheBerlios/rundfunker
095a393400baa34aff8c570b79d37a5c739c738f
74085fe601a3b943222d2d9f2a52759d37ed6964
refs/heads/master
2020-12-25T19:26:15.105118
2007-03-11T23:48:17
2007-03-11T23:48:17
40,746,415
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package de.fhaugsburg.rundfunker.rundspieler; public class DataException extends Exception { public DataException() { super(); // TODO Auto-generated constructor stub } public DataException(String message) { super(message); // TODO Auto-generated constructor stub } public DataException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } public DataException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } }
[ "krizleebear@7f6a71ac-f62a-0410-8efa-aa123f0b956c" ]
krizleebear@7f6a71ac-f62a-0410-8efa-aa123f0b956c
83d00b2a558b85b6a94c786e1a61793a28f429eb
2fd9d77d529e9b90fd077d0aa5ed2889525129e3
/DecompiledViberSrc/app/src/main/java/com/viber/voip/messages/conversation/adapter/viewbinders/v.java
009eef08285246994ba4068ca5e6233275685cb2
[]
no_license
cga2351/code
703f5d49dc3be45eafc4521e931f8d9d270e8a92
4e35fb567d359c252c2feca1e21b3a2a386f2bdb
refs/heads/master
2021-07-08T15:11:06.299852
2021-05-06T13:22:21
2021-05-06T13:22:21
60,314,071
1
3
null
null
null
null
UTF-8
Java
false
false
1,106
java
package com.viber.voip.messages.conversation.adapter.viewbinders; import android.widget.TextView; import com.viber.dexshared.Logger; import com.viber.voip.ViberEnv; import com.viber.voip.messages.conversation.aa; import com.viber.voip.messages.conversation.adapter.a.a; import com.viber.voip.messages.conversation.adapter.a.c.a.i; import com.viber.voip.ui.g.e; public class v extends e<a, i> { private static final Logger a = ViberEnv.getLogger(); private final TextView b; private final TextView c; public v(TextView paramTextView1, TextView paramTextView2) { this.b = paramTextView1; this.c = paramTextView2; } public void a(a parama, i parami) { super.a(parama, parami); aa localaa = parama.c(); String str1 = localaa.h(); String str2 = parami.c(localaa); this.b.setText(str1); this.c.setText(str2); } } /* Location: E:\Study\Tools\apktool2_2\dex2jar-0.0.9.15\classes_viber_3_dex2jar.jar * Qualified Name: com.viber.voip.messages.conversation.adapter.viewbinders.v * JD-Core Version: 0.6.2 */
[ "yu.liang@navercorp.com" ]
yu.liang@navercorp.com
a7129aca88ff5c0b9fd76241f2eed1ec4f7d9b77
9238addfe77c3b0663e20791b2b5b31624b3e9f4
/Project1/backend/src/main/java/Main.java
74e97d38cc92deae61bd09f6bb0f4e1eb4cbf4b5
[]
no_license
KeithSantamaria/Project1-Expense-Reimbursement-System
ef033481ddb504d804d64172cfe1ed1d0889f118
874bf679eeb26552fbcea18a6640b0241c60b219
refs/heads/master
2023-05-01T04:00:42.119810
2021-05-27T15:15:02
2021-05-27T15:15:02
371,415,592
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
import com.revature.batch412.keithsantamaria.project1.app.App; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Level; import org.apache.log4j.Logger; public class Main { public static void main(String[] args) { Logger mongoLogger = Logger.getLogger("org.mongodb.driver"); mongoLogger.setLevel(Level.FATAL); BasicConfigurator.configure(); System.out.println("Hello Project1"); App myApp = new App(); myApp.run(); } }
[ "keithasantamaria@gmail.com" ]
keithasantamaria@gmail.com
9a063af50da5a36ca2d2d4b0b3efc907e52f1967
798a3e148d3056f69e9fdbd5ad1897e0f524153b
/resource/akela/src/main/java/com/mozilla/pig/eval/Example.java
7656b56177c4c99b4a4d15a96c66ab0881a0d4be
[ "Apache-2.0" ]
permissive
XiaoLyu/project
9ef98a181536e2dd3527188ca8b5376ac8ed5626
03bab060a022479d4de93322e85da5d0a72e0fe1
refs/heads/master
2021-08-28T10:50:50.131966
2017-12-12T01:34:07
2017-12-12T01:34:07
108,073,116
1
0
null
null
null
null
UTF-8
Java
false
false
2,896
java
/* * Copyright 2012 Mozilla Foundation * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.mozilla.pig.eval; import java.io.IOException; import java.util.Iterator; import org.apache.pig.EvalFunc; import org.apache.pig.data.Tuple; import org.apache.pig.data.DataBag; import org.apache.pig.Algebraic; import org.apache.pig.impl.logicalLayer.schema.Schema; import org.apache.pig.data.DataType; /** * The Example function takes a bag of results and returns a single element * of that bag. It is intended for use when grouping a set of results and * you want a single example item in the final result set. */ public final class Example extends EvalFunc<Tuple> implements Algebraic { static private Tuple realexec(Tuple input) throws IOException { DataBag bag = (DataBag) input.get(0); Iterator<Tuple> it = bag.iterator(); while (it.hasNext()) { Tuple t = it.next(); if (t != null) { return t; } } return null; } @Override public Tuple exec(Tuple input) throws IOException { return realexec(input); } static public class Sub extends EvalFunc<Tuple> { @Override public Tuple exec(Tuple input) throws IOException { return realexec(input); } } @Override public Schema outputSchema(Schema input) { try { if (input.size() != 1) { return null; } Schema.FieldSchema fs = input.getField(0); if (fs.type != DataType.BAG) { return null; } return fs.schema; } catch (Exception e) { this.log.error("Caught exception in " + this.getClass().getSimpleName() + ".outputSchema", e); return null; } } // We can use the same class in all cases since the input schema is the // same. public String getInitial() { return Sub.class.getName(); } public String getIntermed() { return Sub.class.getName(); } public String getFinal() { return Sub.class.getName(); } }
[ "blue_key2004@163.com" ]
blue_key2004@163.com
f5269f0f0336cc6f38c1bc5416cad338a1afcb08
39bd5d301e773f7d8f9eda8fe630737213bd1da5
/weShop/weshop-user/src/main/java/tech/wetech/weshop/user/service/impl/RegionServiceImpl.java
9343b469fad7f6f6b4f85a2ed458b49a7b837787
[ "MIT" ]
permissive
lizheng8845021/weshop
b7e7c6b66d33aa3a6073416b84d58c7d9373c5fb
019955a8b21be6eb1122b1c58a45f94c44dc7600
refs/heads/master
2022-10-01T23:05:08.142244
2020-06-09T06:01:31
2020-06-09T06:01:31
267,826,050
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package tech.wetech.weshop.user.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RestController; import tech.wetech.weshop.common.service.BaseService; import tech.wetech.weshop.user.mapper.RegionMapper; import tech.wetech.weshop.user.po.Region; import tech.wetech.weshop.user.service.RegionService; /** * @author cjbi@outlook.com */ @RestController public class RegionServiceImpl extends BaseService<Region> implements RegionService { @Autowired private RegionMapper regionMapper; @Override public String queryNameById(Short id) { return regionMapper.selectNameById(id); } }
[ "lzstruggle@163.com" ]
lzstruggle@163.com
eee85414c2d101581f6b1352824865eaf152c8b2
27739503db621758fee6b46958e64e613a9b8281
/src/com/zhang/pro/data_processing/tools/SegmentCluster.java
de146180cf1878e7259abdd648632cb6a2cfb62a
[]
no_license
zhang-jian-19400/Trajects
063ca0fa6021defd856fce509588b29042ddeab1
38dcdeaecfa0dadedbaee6d4bd414c5ac955aacf
refs/heads/master
2021-01-13T02:50:55.364039
2017-03-31T07:18:37
2017-03-31T07:18:37
77,138,508
0
0
null
null
null
null
UTF-8
Java
false
false
79
java
package com.zhang.pro.data_processing.tools; public class SegmentCluster { }
[ "1148214126@qq.com" ]
1148214126@qq.com
e21a4a736b771502c95fe462888f290498dd4592
143c000cd9fc4551bc1e5fd0654612aa23ce2915
/src/com/freechart/demo/ShowTimeSeriesChartsExample3.java
f59f72b995625cc03e6f86a2b489eb8cc84d4ea9
[]
no_license
hi-cbh/CPU_MEM
d935c8e9ef84c7851af83c782d216235b75988d2
6f096fe4b86efc44bca96c9d0dcc75f9ea8d2efb
refs/heads/master
2021-01-21T05:20:20.770526
2017-04-08T12:50:08
2017-04-08T12:50:08
83,173,096
0
0
null
null
null
null
UTF-8
Java
false
false
15,662
java
package com.freechart.demo; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.StandardChartTheme; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.labels.StandardXYItemLabelGenerator; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.chart.title.TextTitle; import org.jfree.data.time.Millisecond; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.jfree.data.xy.XYDataset; import org.jfree.ui.RectangleInsets; import com.until.info.PrintCPUAndMen; /** * 不使用线程的方式,获取并显示CPU内存, 在139在后台运行时,出现CPU占用率正常,但在运行时,获取的精度受到影响,导致获取进度较低 * * @author Administrator * */ public class ShowTimeSeriesChartsExample3 extends JFrame implements ActionListener { /** * */ private static final long serialVersionUID = 1L; private static final double MaxValue = 350.0; // 显示数据轴最大值 private static final int WIGTH = 600; private static final int HIGHT = 300; private static boolean isRun = false; DynamicResource dr = null; private static final double MinValue = 0.0; // 显示数据轴最小值 private static TimeSeries series1; private static TimeSeries series2; private static TimeSeries series3; private static TimeSeries series31; private static TimeSeries series32; private static TimeSeries series4; JLabel jlpackage = new JLabel("APK包名:"); final JTextField jtf1 = new JTextField(20); public ShowTimeSeriesChartsExample3() { } public static void main(String[] args) { ShowTimeSeriesChartsExample3 example = new ShowTimeSeriesChartsExample3(); example.setTitle("时序图"); example.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); example.setBounds(100, 100, 1250, 750); example.getContentPane().add(example.createUI()); example.setVisible(true); // example.dynamicRun(); } /** * 创建图形面板 * * @return */ public JPanel createUI() { // TimeSeries series = new TimeSeries("时序表标题", Millisecond.class); /** * 解决中文问题 */ StandardChartTheme standardChartTheme = new StandardChartTheme("CN"); standardChartTheme.setExtraLargeFont(new Font("微软雅黑", Font.BOLD, 20)); standardChartTheme.setRegularFont(new Font("宋书", Font.PLAIN, 15)); standardChartTheme.setLargeFont(new Font("宋书", Font.PLAIN, 15)); ChartFactory.setChartTheme(standardChartTheme); JPanel mainPanel = new JPanel(); series1 = new TimeSeries("CPU", Millisecond.class); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(series1); JFreeChart chart = createChart(dataset, "CPU(%)", "time", "", MinValue, 100); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(WIGTH, HIGHT)); panel.add(chartPanel, BorderLayout.CENTER); mainPanel.add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 20, 20, 10, 10), 0, 0)); series2 = new TimeSeries("PrivateDirty", Millisecond.class); TimeSeriesCollection dataset2 = new TimeSeriesCollection(); dataset2.addSeries(series2); JFreeChart chart2 = createChart(dataset2, "内存(M)", "time", "", MinValue, MaxValue); panel = new JPanel(); ChartPanel chartPanel2 = new ChartPanel(chart2); chartPanel2.setPreferredSize(new Dimension(WIGTH, HIGHT)); panel.setLayout(new BorderLayout()); panel.add(chartPanel2, BorderLayout.CENTER); mainPanel.add(panel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 10, 10, 10, 10), 0, 0)); series3 = new TimeSeries("上传下载流量", Millisecond.class); // series31 = new TimeSeries("下载流量", Millisecond.class); // series32 = new TimeSeries("上传流量", Millisecond.class); TimeSeriesCollection dataset3 = new TimeSeriesCollection(); dataset3.addSeries(series3); // dataset3.addSeries(series31); // dataset3.addSeries(series32); JFreeChart chart3 = createChart(dataset3, "WIFI流量(M)", "time", "", MinValue, 100); panel = new JPanel(); ChartPanel chartPanel3 = new ChartPanel(chart3); chartPanel3.setPreferredSize(new Dimension(WIGTH, HIGHT)); panel.setLayout(new BorderLayout()); panel.add(chartPanel3, BorderLayout.CENTER); mainPanel.add(panel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 10, 10, 10, 10), 0, 0)); series4 = new TimeSeries("上传下载流量", Millisecond.class); TimeSeriesCollection dataset4 = new TimeSeriesCollection(); dataset4.addSeries(series4); JFreeChart chart4 = createChart(dataset4, "4G流量(M)", "time", "", MinValue, 200); panel = new JPanel(); ChartPanel chartPanel4 = new ChartPanel(chart4); chartPanel4.setPreferredSize(new Dimension(WIGTH, HIGHT)); panel.setLayout(new BorderLayout()); panel.add(chartPanel4, BorderLayout.CENTER); mainPanel.add(panel, new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 10, 10, 20, 20), 0, 0)); /** * gridx = 2; // X2 gridy = 0; // Y0 gridwidth = 1; // 横占一个单元格 * gridheight = 1; // 列占一个单元格 weightx = 0.0; // 当窗口放大时,长度不变 weighty = * 0.0; // 当窗口放大时,高度不变 anchor = GridBagConstraints.NORTH; // * 当组件没有空间大时,使组件处在北部 fill = GridBagConstraints.BOTH; // 当格子有剩余空间时,填充空间 * insert = new Insets(0, 0, 0, 0); // 组件彼此的间距 ipadx = 0; // * 组件内部填充空间,即给组件的最小宽度添加多大的空间 ipady = 0; // 组件内部填充空间,即给组件的最小高度添加多大的空间 new * GridBagConstraints(gridx, gridy, gridwidth, gridheight, weightx, * weighty, anchor, fill, insert, ipadx, ipady); */ JPanel jp = new JPanel(); jlpackage.setFont(new Font("宋体", Font.BOLD, 20)); // 包名输入框 jtf1.setFont(new Font("宋体", Font.BOLD, 16)); jtf1.setBounds(10, 10, 50, 15); JButton jb = new JButton(" 开始 "); jb.setFont(new Font("宋体", Font.BOLD, 18)); JButton jb2 = new JButton(" 停止 "); jb2.setFont(new Font("宋体", Font.BOLD, 18)); jp.add(jlpackage); jp.add(jtf1); jp.add(jb); jp.add(jb2); jp.setLayout(new FlowLayout(FlowLayout.LEFT)); mainPanel.add(jp); jtf1.setText("cn.cj.pe"); jtf1.setEditable(true); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (jtf1.getText().equals("")) { } if (!isRun) { isRun = true; dr = new DynamicResource(); dr.start(); } System.out.println("currentakg:" + jtf1.getText()); System.out.println("isRun:" + isRun); } }); jb2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (isRun) { isRun = false; dr.stop(); dr = null; } System.out.println("isRun:" + isRun); } }); return mainPanel; } public class DynamicResource extends Thread { @Override public void run() { dynamicRun(); } } /** * 动态运行 */ public void dynamicRun() { double cpu = 0.0; double mem = 0.0; double flow4G = 0.0; double flowWIFI = 0.0; System.out.println("isRun:" + isRun); String pkg = jtf1.getText(); if (pkg.equals("")) { JOptionPane.showMessageDialog(new JFrame(), "包名不能为空!"); return; } while (isRun) { cpu = getCPUValue(pkg); mem = getMemValue(pkg); // flow4G = getFlowValue4G(); flowWIFI = getFlowValue(pkg,"wlan0"); if (cpu == -1 || mem == -1 || flow4G == -1 || flowWIFI == -1) { JOptionPane.showMessageDialog(new JFrame(), "APP是否启动,或设备是否连接!"); break; } series1.add(new Millisecond(), cpu); series2.add(new Millisecond(), mem); // // //series3.add(new Millisecond(), flow4G); // series4.add(new Millisecond(), flowWIFI); try { Thread.currentThread(); Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } } /** * 返回处理后的结果 * * @return */ public static double getFlowValue() { String flow = PrintCPUAndMen.GetFlow("cn.cj.pe", "rmnet_data0"); if (flow.equals("")) { return -1; } String s[] = flow.split("#"); double down = Double.parseDouble(s[0].trim()) / 1024; double up = Double.parseDouble(s[1].trim()) / 1024; double all = (down + up) / 1024; // M DecimalFormat df = new DecimalFormat("#.00"); System.out.println(Double.parseDouble(df.format(all))); return Double.parseDouble(df.format(all)); } /** * 返回处理后的结果 * * @return */ public static double getFlowValue4G() { String flow = PrintCPUAndMen.GetFlow("cn.cj.pe", "wlan0"); if (flow.equals("")) { return -1; } String s[] = flow.split("#"); double down = Double.parseDouble(s[0].trim()) / 1024; double up = Double.parseDouble(s[1].trim()) / 1024; double all = (down + up) / 1024; // M DecimalFormat df = new DecimalFormat("#.00"); System.out.println(Double.parseDouble(df.format(all))); return Double.parseDouble(df.format(all)); } /** * 返回处理后的结果 * * @return */ public static double getFlowValue(String pkg, String wlan) { String flow = PrintCPUAndMen.GetFlow(pkg, wlan); if (flow.equals("")) { return -1; } String s[] = flow.split("#"); double down = Double.parseDouble(s[0].trim()) / 1024; double up = Double.parseDouble(s[1].trim()) / 1024; double all = (down + up) / 1024; // M DecimalFormat df = new DecimalFormat("#.00"); System.out.println(Double.parseDouble(df.format(all))); return Double.parseDouble(df.format(all)); } /** * 返回处理后的结果 * * @return */ public static double getCPUValue() { String cpu = PrintCPUAndMen.getCPU("cn.cj.pe"); if (!cpu.contains("%")) { return -1; } String s[] = cpu.split("%"); System.out.println("getCPUValue:" + Double.parseDouble(s[0])); return Double.parseDouble(s[0]); } /** * 返回处理后的结果 * * @return */ public static double getCPUValue(String pkg) { String cpu = PrintCPUAndMen.getCPU(pkg); if (!cpu.contains("%")) { return -1; } String s[] = cpu.split("%"); System.out.println("getCPUValue:" + Double.parseDouble(s[0])); return Double.parseDouble(s[0]); } /** * 返回处理后的结果 * * @return */ public static double getMemValue() { DecimalFormat df = new DecimalFormat("#"); double mem = PrintCPUAndMen.getMemoryPrivateDirty("cn.cj.pe"); if (mem == -1) { return -1; } mem = mem / 1024; String memory = df.format(mem); System.out.println("getMemValue:" + Double.parseDouble(memory)); return Double.parseDouble(memory); } /** * 返回处理后的结果 * * @return */ public static double getMemValue(String pkg) { DecimalFormat df = new DecimalFormat("#"); double mem = PrintCPUAndMen.getMemoryPrivateDirty(pkg); if (mem == -1) { return -1; } mem = mem / 1024; String memory = df.format(mem); System.out.println("getMemValue:" + Double.parseDouble(memory)); return Double.parseDouble(memory); } /** * 根据结果集构造JFreechart报表对象 * * @param dataset * @return */ private JFreeChart createChart(XYDataset dataset, String titlename, String xname, String yname, double min, double max) { // 创建JFreeChart对象 JFreeChart result = ChartFactory.createTimeSeriesChart("", xname, yname, dataset, true, false, false); result.setBackgroundPaint(Color.white); // 边框可见 result.setBorderVisible(true); TextTitle title = new TextTitle(titlename, new Font("宋体", Font.BOLD, 20)); // 解决曲线图片标题中文乱码问题 result.setTitle(title); // 设置图表样式 XYPlot plot = (XYPlot) result.getPlot(); ValueAxis axis = plot.getDomainAxis(); // 数据区的背景图片背景色 plot.setBackgroundPaint(Color.lightGray); // 分类轴网格线条颜色 plot.setDomainGridlinePaint(Color.white); // 数据轴网格线条颜色 plot.setRangeGridlinePaint(Color.white); // 坐标轴到数据区的间距 plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); // 自动设置数据轴数据范围 axis.setAutoRange(true); // 设置时间轴显示的数据 axis.setFixedAutoRange(20000D); // /点与点之间的间距 // 数据轴固定数据范围 axis = plot.getRangeAxis(); // 设置是否显示数据轴 axis.setRange(min, max); // Y轴 NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis(); setNumberAxis(numberaxis); // x轴 ValueAxis domainAxis = plot.getDomainAxis(); setDomainAxis(domainAxis); XYItemRenderer xyitemrenderer = plot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; // 数据点可见 xylineandshaperenderer.setBaseShapesVisible(true); // 数据点是实心点 xylineandshaperenderer.setBaseShapesFilled(true); // 数据点显示数据 xylineandshaperenderer .setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); xylineandshaperenderer.setBaseItemLabelsVisible(true); } return result; } /** * 设置X轴 * * @param domainAxis */ private static void setDomainAxis(ValueAxis domainAxis) { domainAxis.setVisible(false); domainAxis.setAutoTickUnitSelection(true); domainAxis.setTickMarksVisible(false); } /** * 设置Y轴 * * @param numberAxis */ private static void setNumberAxis(NumberAxis numberaxis) { // numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // // 是否显示零点 // numberaxis.setAutoRangeIncludesZero(true); // numberaxis.setAutoTickUnitSelection(false); // // 解决Y轴标题中文乱码 // numberaxis.setLabelFont(new Font("sans-serif", Font.PLAIN, 14)); // // numberaxis.setTickUnit(new NumberTickUnit(10000));//Y轴数据间隔 } public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub } }
[ "hi_cbh@qq.com" ]
hi_cbh@qq.com
abc906bc174755c32bac1bfe4dad651693321b6a
b2df8f8d5ce70dbb5260a3f157cc0bc65fab8bef
/springboot-ssm-blog/src/main/java/com/oycbest/ssmblog/filter/JwtFilter.java
41fee47d4ce2c633a6827e9210a9a08b700a3e08
[]
no_license
tianzeshaui/springboot-learning-demo
acaea714505fd91f5593b727d6af4971c821d7b7
c75587aadc0092e0619e422a97e57371715f5733
refs/heads/master
2023-04-11T14:35:26.349561
2021-04-26T16:28:41
2021-04-26T16:28:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,583
java
package com.oycbest.ssmblog.filter; import com.oycbest.ssmblog.config.JwtToken; import com.oycbest.ssmblog.constant.ShiroConstant; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @Author: oyc * @Date: 2020-06-05 9:28 * @Description: 鉴权登录拦截器 */ @Slf4j public class JwtFilter extends BasicHttpAuthenticationFilter { /** * 执行登录认证 * * @param request * @param response * @param mappedValue * @return */ @Override protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { try { executeLogin(request, response); return true; } catch (Exception e) { throw new AuthenticationException("Token失效,请重新登录", e); } } /** * */ @Override protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String token = httpServletRequest.getHeader(ShiroConstant.X_ACCESS_TOKEN); JwtToken jwtToken = new JwtToken(token); // 提交给realm进行登入,如果错误他会抛出异常并被捕获 getSubject(request, response).login(jwtToken); // 如果没有抛出异常则代表登入成功,返回true return true; } /** * 对跨域提供支持 */ @Override protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception { HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin")); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE"); httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers")); // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态 if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) { httpServletResponse.setStatus(HttpStatus.OK.value()); return false; } return super.preHandle(request, response); } }
[ "1456682842@qq.com" ]
1456682842@qq.com
040929c960140b4b8a565966a7899da1892e9a6f
d24eea32829c0adbd6ceff4a054464c8c03f3d4f
/deck-of-cards-kata/src/test/java/bnymellon/codekatas/deckofcards/sortedset/immutable/GoogleGuavaDeckOfCardsAsSortedSetTest.java
942e8e0191c9f4d490fd2429ef27fffa17a6c32a
[ "Apache-2.0" ]
permissive
rajsek/CodeKatas
e324745d9cd5fa86ff1179620d9efb08603acbf0
02d6659abcd4f66872236da985913cc369066b75
refs/heads/master
2021-05-06T11:26:48.594998
2017-12-14T19:47:32
2017-12-14T19:47:32
114,288,367
0
0
null
2017-12-14T19:27:47
2017-12-14T19:27:46
null
UTF-8
Java
false
false
3,683
java
/* * Copyright 2017 BNY Mellon. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package bnymellon.codekatas.deckofcards.sortedset.immutable; import java.util.Deque; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import java.util.SortedSet; import com.google.common.collect.ImmutableSetMultimap; import org.junit.Assert; import org.junit.Test; import bnymellon.codekatas.deckofcards.Card; import bnymellon.codekatas.deckofcards.Rank; import bnymellon.codekatas.deckofcards.Suit; public class GoogleGuavaDeckOfCardsAsSortedSetTest { private JDKImperativeDeckOfCardsAsSortedSet jdkDeck = new JDKImperativeDeckOfCardsAsSortedSet(); private GoogleGuavaDeckOfCardsAsSortedSet ggDeck = new GoogleGuavaDeckOfCardsAsSortedSet(); @Test public void allCards() { Assert.assertEquals(this.jdkDeck.getCards(), this.ggDeck.getCards()); } @Test public void diamonds() { Assert.assertEquals(this.jdkDeck.diamonds(), this.ggDeck.diamonds()); } @Test public void hearts() { Assert.assertEquals(this.jdkDeck.hearts(), this.ggDeck.hearts()); } @Test public void spades() { Assert.assertEquals(this.jdkDeck.spades(), this.ggDeck.spades()); } @Test public void clubs() { Assert.assertEquals(this.jdkDeck.clubs(), this.ggDeck.clubs()); } @Test public void deal() { Deque<Card> jdkShuffle = this.jdkDeck.shuffle(new Random(1)); Deque<Card> ggShuffle = this.ggDeck.shuffle(new Random(1)); Set<Card> jdkHand = this.jdkDeck.deal(jdkShuffle, 5); Set<Card> ggHand = this.ggDeck.deal(ggShuffle, 5); Assert.assertEquals(jdkHand, ggHand); } @Test public void shuffleAndDealHands() { List<Set<Card>> jdkHands = this.jdkDeck.shuffleAndDeal(new Random(1), 5, 5); List<Set<Card>> ggHands = this.ggDeck.shuffleAndDeal(new Random(1), 5, 5); Assert.assertEquals(jdkHands, ggHands); } @Test public void dealHands() { Deque<Card> jdkShuffled = this.jdkDeck.shuffle(new Random(1)); Deque<Card> ggShuffled = this.ggDeck.shuffle(new Random(1)); List<Set<Card>> jdkHands = this.jdkDeck.dealHands(jdkShuffled, 5, 5); List<Set<Card>> ggHands = this.ggDeck.dealHands(ggShuffled, 5, 5); Assert.assertEquals(jdkHands, ggHands); } @Test public void cardsBySuit() { Map<Suit, SortedSet<Card>> jdkCardsBySuit = this.jdkDeck.getCardsBySuit(); ImmutableSetMultimap<Suit, Card> ggCardsBySuit = this.ggDeck.getCardsBySuit(); Assert.assertEquals(jdkCardsBySuit.get(Suit.CLUBS), ggCardsBySuit.get(Suit.CLUBS)); } @Test public void countsBySuit() { Assert.assertEquals( this.jdkDeck.countsBySuit().get(Suit.CLUBS).intValue(), this.ggDeck.countsBySuit().count(Suit.CLUBS)); } @Test public void countsByRank() { Assert.assertEquals( this.jdkDeck.countsByRank().get(Rank.TEN).intValue(), this.ggDeck.countsByRank().count(Rank.NINE)); } }
[ "Donald.Raab@bnymellon.com" ]
Donald.Raab@bnymellon.com
cefbce13ad476993b31af5afc6026395d724f175
69ea81b1add5eca8cac7eb71c611dc8ceaa50005
/layout/listview_demo2/src/test/java/io/wooo/listview_demo2/ExampleUnitTest.java
c1d0f2596f897162ccaab37a5fc9a6a40809a1ac
[]
no_license
wushuaiping/android-learn-demo
2dbf9557c54b2d6ea6140da49f84c57cf3659fa9
f883e472b0c53923c1ce40a5651676b16e6e86d1
refs/heads/master
2020-08-10T10:12:37.526407
2019-10-30T07:07:46
2019-10-30T07:07:46
214,322,726
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package io.wooo.listview_demo2; 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); } }
[ "spwu@creams.io" ]
spwu@creams.io
5533272f0eee9f45f8a33c23cf3dfec8323e2c64
b2b7173c9343c22c700ceee8fb992f5e7add1c00
/rating-data-service/src/test/java/com/sr/ratingdataservice/RatingDataServiceApplicationTests.java
be5add68c0d15aeb1e73e47a4f90b69dd8e73e2d
[]
no_license
sratoori/sratoori
66e54e0e7492222c16fa06bff5b87f16e868a7c4
d34c68c0d8570b74c85c04204770240050a6e027
refs/heads/master
2020-07-25T05:46:00.159882
2020-05-18T22:52:35
2020-05-18T22:52:35
208,185,509
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.sr.ratingdataservice; 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 RatingDataServiceApplicationTests { @Test public void contextLoads() { } }
[ "suresh.ratoori@gmail.com" ]
suresh.ratoori@gmail.com
779e4f2478e7bc1ac2af306ddbc32c8479a25e2f
9dc2720f4d6f0cb9bcf9594f0ca50407cde76d8d
/app/src/main/java/com/olins/movie/data/api/response/DetailMovieResponse.java
64132b26e0939cf01f9f4b421a341ff1f42f677b
[]
no_license
rahmanshu/tugas-movie
64d01de2b60f4a90ad719f1085aad0fc2f7bcd3a
de1e9417d82cd2bd1337e1f58551771e7a1228ab
refs/heads/master
2022-05-29T07:24:14.726603
2020-04-22T15:00:58
2020-04-22T15:00:58
257,932,029
0
0
null
null
null
null
UTF-8
Java
false
false
6,120
java
package com.olins.movie.data.api.response; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.olins.movie.data.api.bean.Ratings; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class DetailMovieResponse implements Serializable { @SerializedName("Title") @Expose private String title; @SerializedName("Year") @Expose private String year; @SerializedName("Rated") @Expose private String rated; @SerializedName("Released") @Expose private String released; @SerializedName("Runtime") @Expose private String runtime; @SerializedName("Genre") @Expose private String genre; @SerializedName("Director") @Expose private String director; @SerializedName("Writer") @Expose private String writer; @SerializedName("Actors") @Expose private String actors; @SerializedName("Plot") @Expose private String plot; @SerializedName("Language") @Expose private String language; @SerializedName("Country") @Expose private String country; @SerializedName("Awards") @Expose private String awards; @SerializedName("Poster") @Expose private String poster; @SerializedName("Metascore") @Expose private String metascore; @SerializedName("imdbRating") @Expose private String imdbRating; @SerializedName("imdbVotes") @Expose private String imdbVotes; @SerializedName("imdbID") @Expose private String imdbId; @SerializedName("Type") @Expose private String type; @SerializedName("DVD") @Expose private String dvd; @SerializedName("BoxOffice") @Expose private String boxOffice; @SerializedName("Production") @Expose private String production; @SerializedName("Website") @Expose private String website; @SerializedName("response") @Expose private String response; @SerializedName("Ratings") @Expose private List<Ratings> ratings = new ArrayList<>(); public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getRated() { return rated; } public void setRated(String rated) { this.rated = rated; } public String getReleased() { return released; } public void setReleased(String released) { this.released = released; } public String getRuntime() { return runtime; } public void setRuntime(String runtime) { this.runtime = runtime; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } public String getDirector() { return director; } public void setDirector(String director) { this.director = director; } public String getWriter() { return writer; } public void setWriter(String writer) { this.writer = writer; } public String getActors() { return actors; } public void setActors(String actors) { this.actors = actors; } public String getPlot() { return plot; } public void setPlot(String plot) { this.plot = plot; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getAwards() { return awards; } public void setAwards(String awards) { this.awards = awards; } public String getPoster() { return poster; } public void setPoster(String poster) { this.poster = poster; } public String getMetascore() { return metascore; } public void setMetascore(String metascore) { this.metascore = metascore; } public String getImdbRating() { return imdbRating; } public void setImdbRating(String imdbRating) { this.imdbRating = imdbRating; } public String getImdbVotes() { return imdbVotes; } public void setImdbVotes(String imdbVotes) { this.imdbVotes = imdbVotes; } public String getImdbId() { return imdbId; } public void setImdbId(String imdbId) { this.imdbId = imdbId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getDvd() { return dvd; } public void setDvd(String dvd) { this.dvd = dvd; } public String getBoxOffice() { return boxOffice; } public void setBoxOffice(String boxOffice) { this.boxOffice = boxOffice; } public String getProduction() { return production; } public void setProduction(String production) { this.production = production; } public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website; } public String getResponse() { return response; } public void setResponse(String response) { this.response = response; } public List<Ratings> getRatings() { return ratings; } public void setRatings(List<Ratings> ratings) { this.ratings = ratings; } }
[ "faiz.ahmadhio@phincon.com" ]
faiz.ahmadhio@phincon.com
f56906405b84171ea11c10c34325a5686ace7ca1
e51edc59e2764a0a3498fdc6b76f87060e020392
/health_backend/src/main/java/com/itheima/service/SpringSecurityUserService.java
75da71faf304b567808a24c229b9a397295a445a
[]
no_license
WXCD-LYY/wxcd_health
eb2d8dc286018a10c71270e488fce2bf7d622598
f2dca0ad6e1b501eb97e8e8256064cc10b8ea08d
refs/heads/master
2023-06-30T23:12:35.243470
2021-07-29T14:39:52
2021-07-29T14:39:52
326,877,290
0
0
null
null
null
null
UTF-8
Java
false
false
2,076
java
package com.itheima.service; import com.alibaba.dubbo.config.annotation.Reference; import com.itheima.pojo.Permission; import com.itheima.pojo.Role; import com.itheima.pojo.User; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * @Company: CUG * @Description: TODO * @Author: LiYangyong * @Date: 2021/1/26/026 20:21 **/ @Component public class SpringSecurityUserService implements UserDetailsService { // 使用dubbo通过网络远程调用服务提供方获取数据库中的用户信息 @Reference private UserService userService; // 根据用户名查询数据库获取用户信息 public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userService.findByUsername(username); if (user == null) { // 用户名不存在 return null; } List<GrantedAuthority> list = new ArrayList<>(); // 动态为当前用户授权 Set<Role> roles = user.getRoles(); for (Role role : roles) { // 遍历角色集合,为用户授予角色 list.add(new SimpleGrantedAuthority(role.getKeyword())); Set<Permission> permissions = role.getPermissions(); for (Permission permission : permissions) { // 遍历权限集合,为用户授权 list.add(new SimpleGrantedAuthority(permission.getKeyword())); } } org.springframework.security.core.userdetails.User securityUser = new org.springframework.security.core.userdetails.User(username, user.getPassword(), list); return securityUser; } }
[ "13222762017@163.com" ]
13222762017@163.com
6390f80a3c2b6c7e7e7bdda2638d445f6ede621c
7c6652a58915f184c512ab893a4c07549d435efd
/spring-in-action/004.Aspect-oriented_Spring/spring-annotated-aspects/src/main/java/concert/ConcertConfig.java
b692c79415f5648c812b305aea15ef210b74aa9c
[ "MIT" ]
permissive
lsieun/learn-spring
e780d5d76204537a080f9e388b390b140c3ca0cd
32e5ca9c2017f321c353b31c4231e496c051e6d7
refs/heads/master
2021-10-10T17:16:13.297287
2019-01-14T12:29:28
2019-01-14T12:29:28
107,852,693
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
package concert; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; @Configuration @EnableAspectJAutoProxy //Enable AspectJ auto-proxying @ComponentScan public class ConcertConfig { @Bean public Audience audience() { return new Audience(); } }
[ "331505785@qq.com" ]
331505785@qq.com
997a1d1a10f1adeed37fac91a89bb2eca319a034
531e060b9ea6a7baa6a01f97f9e0ea4f9aef1839
/app/src/main/java/com/delos/github/arubadel/fragment/TcpOptionDialogFragment.java
f7ebb948be6a1e7e89763465a224a4c40ec2d24c
[]
no_license
Arubadel/Arubadel-noFirebase
ce2e7cefef89fa3c1fc8e14cd7542474eabd59df
89d38dfc6a8788903900c86a088d9f0a822042a0
refs/heads/master
2021-01-12T08:56:49.992393
2016-12-17T14:42:51
2016-12-17T14:42:51
76,730,951
0
1
null
null
null
null
UTF-8
Java
false
false
1,505
java
package com.delos.github.arubadel.fragment; /** * Created by sumit on 29/10/16. */ import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import com.delos.github.arubadel.R; import com.delos.github.arubadel.adapter.TcpCongestionControlAdapter; import com.delos.github.arubadel.app.Activity; import com.delos.github.arubadel.util.ShellUtils; /** * Created by: veli * Date: 10/23/16 4:17 PM */ public class TcpOptionDialogFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); final TcpCongestionControlAdapter adapter = new TcpCongestionControlAdapter(getActivity()); final ShellUtils shell = ((Activity)getActivity()).getShellSession(); dialogBuilder.setTitle(getString(R.string.choose_tcp)); //dialogBuilder.setMessage("What would like to do?"); dialogBuilder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { shell.getSession().addCommand(((TcpCongestionControlAdapter.TcpItem) adapter.getItem(which)).command); } }); return dialogBuilder.create(); } }
[ "androidlover5842@gmail.com" ]
androidlover5842@gmail.com
7c63167712a84c46772eaa873d8b3f55cc749572
8d6a347b3ee7d5f3abf2144de3ab788e4dfa3162
/src/main/java/com/stevesun/solutions/_484.java
3ef6731639548e6c301d240be0417521719fa43c
[ "Apache-2.0" ]
permissive
Sam-Si/Leetcode
3f58b88325ad6a02da0d84c885f08bee8fce8b0d
5e7403360cd87c6f32bac05863e4679702f3417c
refs/heads/master
2021-01-22T03:31:26.751878
2017-05-24T15:11:50
2017-05-24T15:11:50
92,386,586
2
1
null
2017-05-25T09:18:22
2017-05-25T09:18:21
null
UTF-8
Java
false
false
2,509
java
package com.stevesun.solutions; /** 484. Find Permutation * By now, you are given a secret signature consisting of character 'D' and 'I'. * 'D' represents a decreasing relationship between two numbers, 'I' represents an increasing relationship between two numbers. * And our secret signature was constructed by a special integer array, which contains uniquely all the different number from 1 to n (n is the length of the secret signature plus 1). * For example, the secret signature "DI" can be constructed by array [2,1,3] or [3,1,2], * but won't be constructed by array [3,2,4] or [2,1,3,4], which are both illegal constructing special string that can't represent the "DI" secret signature. On the other hand, now your job is to find the lexicographically smallest permutation of [1, 2, ... n] could refer to the given secret signature in the input. Example 1: Input: "I" Output: [1,2] Explanation: [1,2] is the only legal initial spectial string can construct secret signature "I", where the number 1 and 2 construct an increasing relationship. Example 2: Input: "DI" Output: [2,1,3] Explanation: Both [2,1,3] and [3,1,2] can construct the secret signature "DI", but since we want to find the one with the smallest lexicographical permutation, you need to output [2,1,3] Note: The input string will only contain the character 'D' and 'I'. The length of input string is a positive integer and will not exceed 10,000 */ public class _484 { /**credit:https://discuss.leetcode.com/topic/76221/java-o-n-clean-solution-easy-to-understand * For example, given IDIIDD we start with sorted sequence 1234567 Then for each k continuous D starting at index i we need to reverse [i, i+k] portion of the sorted sequence. e.g. IDIIDD 1234567 // sorted 1324765 // answer */ public int[] findPermutation(String s) { int[] result = new int[s.length()+1]; for (int i = 0; i <= s.length(); i++) result[i] = i+1; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'D') { int left = i; while (i < s.length() && s.charAt(i) == 'D') i++; reverse(result, left, i); } } return result; } private void reverse(int[] result, int left, int i) { while (left < i) { int temp = result[left]; result[left] = result[i]; result[i] = temp; left++; i--; } } }
[ "stevesun@coupang.com" ]
stevesun@coupang.com
119aab56f041e084b1a205cecf66dffb6bee142f
45f20bf4597b5f89e5293c35e223204159310956
/quickfixj-core/src/main/java/quickfix/field/FeeMultiplier.java
436bfe8afce9cc6d42b72a9df59121155cdfc24f
[ "BSD-2-Clause", "LicenseRef-scancode-public-domain" ]
permissive
lloydchan/quickfixj
9d42924c8e9d4cc0a96821faa4006fcd4b0d21c4
e26446c775b3f63d93bb4e8d6f02fde8a22d73fc
refs/heads/master
2020-07-31T21:20:20.178481
2019-09-26T14:40:49
2019-09-26T14:40:49
210,757,360
0
0
null
2019-09-25T04:46:02
2019-09-25T04:46:01
null
UTF-8
Java
false
false
1,140
java
/* Generated Java Source File */ /******************************************************************************* * Copyright (c) quickfixengine.org All rights reserved. * * This file is part of the QuickFIX FIX Engine * * This file may be distributed under the terms of the quickfixengine.org * license as defined by quickfixengine.org and appearing in the file * LICENSE included in the packaging of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. * * See http://www.quickfixengine.org/LICENSE for licensing information. * * Contact ask@quickfixengine.org if any conditions of this licensing * are not clear to you. ******************************************************************************/ package quickfix.field; import quickfix.DoubleField; public class FeeMultiplier extends DoubleField { static final long serialVersionUID = 20050617; public static final int FIELD = 1329; public FeeMultiplier() { super(1329); } public FeeMultiplier(double data) { super(1329, data); } }
[ "lloyd.khc.chan@gmail.com" ]
lloyd.khc.chan@gmail.com
1d1efe81031f3d9f7dc173aaa9380a25abc8ac71
0de7cff2bb674dc6d938f50bbabd7bae3113afa7
/src/main/java/com/nicli/service/MeetingManager.java
fbe5efb0808a3a66aa52709c9e78e59a1a0ee741
[]
no_license
mickthompson7/meetingScheduler
d317d74004b2d92424460b51cf1ee0d65e07a137
e3041a279263c61e3a778d0ca3bacacd509072cb
refs/heads/master
2021-01-15T21:01:58.712756
2014-02-06T15:10:04
2014-02-06T15:10:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,011
java
package com.nicli.service; import com.nicli.domain.DayBookings; import com.nicli.domain.Meeting; import com.nicli.domain.OfficeHours; import java.util.List; /** * Interface that helps manage Meeting related tasks */ public interface MeetingManager { /** * Creates DayBookings from a Meeting Object * * @param meeting the Meeting object used for Booking creation * @return a DayBooking Object representing a Meeting */ DayBookings createDayBookings(Meeting meeting); /** * Based on a List of Meetings passed in as a parameter this method removes those meetings that are out of office hours. * * @param officeHours the OfficeHours in which the meetings has to be in * @param meetingList the MeetingList that needs to be filtered based on OfficeHours constraint * @return a new List without the removed Meetings out of Office Hours */ List<Meeting> removeMeetingsOutOfOfficeHours(OfficeHours officeHours, List<Meeting> meetingList); }
[ "xibeca06@gmail.com" ]
xibeca06@gmail.com
f1ca1b32782aa7d58bf2d09ebecc4d7156bc79e5
362f2989649fae2688aa1dee4f096c9643cd5843
/module-redis/src/main/java/com/boot/dubbo/service/RedisService.java
84f68bcb083dc5389ae4290f1a1b5daf1e124979
[]
no_license
zhouzhonghui/dubbo-starter-an
1d54751b0a1cb3f8e061be2bce6313a0ff278f5e
309f83f2d04058762489247e354bd9e8c01146fe
refs/heads/master
2021-05-04T23:49:51.719611
2018-01-10T01:03:40
2018-01-10T01:03:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
674
java
package com.boot.dubbo.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import java.util.concurrent.TimeUnit; @Component public class RedisService{ @Autowired private RedisTemplate redisTemplate; public void set(Object key, Object value, final long timeout, final TimeUnit unit){ redisTemplate.opsForValue().set(key,value,timeout,unit); } public Object get(Object key){ return redisTemplate.opsForValue().get(key); } public void delete(Object key){ redisTemplate.delete(key); } }
[ "12158117@qq.com" ]
12158117@qq.com
25590970132e20a1f8cddb01cc7827ed84ce93d2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/28/28_f774b12840b659fe47fe77f6ca509712bed1a477/Neighborhood/28_f774b12840b659fe47fe77f6ca509712bed1a477_Neighborhood_s.java
0caaac769a9b4da3bf8234b785087af22f1aa2f2
[]
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
4,105
java
package agent; import java.util.ArrayList; import java.util.List; import board.Board; import board.Cell; public class Neighborhood { public enum Direction { TOP, TOPRIGHT, RIGHT, BOTTOMRIGHT, BOTTOM, BOTTOMLEFT, LEFT, TOPLEFT; /** * Potrzebne miedzy innymi do badania zagrozenia. * * @param dir * zadany kierunek * @return kierunek przeciwny do podanego */ public static Direction getOppositeDir(Direction dir) { Direction opposite = null; switch (dir) { case TOP: opposite = BOTTOM; break; case TOPRIGHT: opposite = BOTTOMLEFT; break; case RIGHT: opposite = LEFT; break; case BOTTOMRIGHT: opposite = TOPLEFT; break; case BOTTOM: opposite = TOP; break; case BOTTOMLEFT: opposite = TOPRIGHT; break; case LEFT: opposite = RIGHT; break; case TOPLEFT: opposite = BOTTOMRIGHT; break; } return opposite; } } /** * 9 to Agent, 0 to komrka nie brana pod uwag * * Tylko na razie tak "na pa"... ;] */ private static final Direction[] translateMask = { null, Direction.TOP, Direction.TOPRIGHT, Direction.RIGHT, Direction.BOTTOMRIGHT, Direction.BOTTOM, Direction.BOTTOMLEFT, Direction.LEFT, Direction.TOPLEFT, null }; private static final int[][] mask = { { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, { 0, 0, 8, 8, 1, 1, 1, 1, 1, 2, 2, 0, 0 }, { 0, 8, 8, 8, 8, 1, 1, 1, 2, 2, 2, 2, 0 }, { 0, 7, 8, 8, 8, 1, 1, 1, 2, 2, 2, 3, 0 }, { 0, 7, 7, 7, 8, 8, 1, 2, 2, 3, 3, 3, 0 }, { 7, 7, 7, 7, 7, 7, 9, 3, 3, 3, 3, 3, 3 }, { 0, 0, 7, 7, 6, 6, 5, 4, 4, 3, 3, 0, 0 }, { 0, 0, 0, 6, 6, 5, 5, 5, 4, 4, 0, 0, 0 }, { 0, 0, 0, 0, 6, 5, 5, 5, 4, 0, 0, 0, 0 } }; private static int cell9X = -1, cell9Y = -1; private Agent.Orientation orientation; private Cell firstCell; private List<Cell> cells; private int x, y; private float temperature; public Neighborhood(Board board, Agent agent, Direction direction) { findCell9(); orientation = agent.getOrientation(); x = agent.getPosition().getX(); y = agent.getPosition().getY(); findAllCellsOfDirection(board, direction); computeAverages(); } private void computeAverages() { float temperature = 0.0f; float minDist = Float.POSITIVE_INFINITY; for (Cell cell : cells) { // temp temperature += cell.getTemperature(); // which cell is first? float dist = (float) Math.sqrt(Math.pow(cell.getX() - x, 2) + Math.pow(cell.getY() - y, 2)); if (dist < minDist) { minDist = dist; firstCell = cell; } } this.temperature = temperature / cells.size(); } private void findAllCellsOfDirection(Board board, Direction direction) { cells = new ArrayList<Cell>(); for (int mx = 0; mx < mask.length; mx++) for (int my = 0; my < mask[mx].length; my++) if (translateMask[mask[mx][my]] == direction) { Cell tmp = board.getCellAt( x + tx(mx - cell9X, my - cell9Y), y + ty(mx - cell9X, my - cell9Y)); if (tmp != null) cells.add(tmp); } } /** * Obracanie wzgldnych wsprzdnych... * * @param x * @param y * @return */ private int tx(int x, int y) { switch (orientation) { default: return x; case SOUTH: return -x; case EAST: return -y; case WEST: return y; } } private int ty(int x, int y) { switch (orientation) { default: return y; case SOUTH: return -y; case EAST: return x; case WEST: return -x; } } private void findCell9() { if (cell9X != -1 && cell9Y != -1) return; for (int x = 0; x < mask.length; x++) for (int y = 0; y < mask[x].length; y++) if (mask[x][y] == 9) { cell9X = x; cell9Y = y; break; } } public float getTemperature() { return temperature; } public Cell getFirstCell() { return firstCell; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
28a13aecb89677c8a72c5f47f514c269c21191be
a02539f9e99cb6e14b3c7c3a722678b334066980
/app/src/main/java/com/auto1_test/api_aws_eu_qa_1/auto1codingtest/utils/MySingleton.java
d9fb4de0058d5026f3c530e094dd0ab780a04d83
[]
no_license
umarpazir11/LoadMore-Recyclerview-Cars-Data
b1d8bcc031752016400f17312eb10b9402e484e0
bdc9d14b16957f826851a6431fde434417f55fc0
refs/heads/master
2021-01-19T13:18:40.640180
2018-12-30T12:43:05
2018-12-30T12:43:05
82,382,372
0
0
null
null
null
null
UTF-8
Java
false
false
1,131
java
package com.auto1_test.api_aws_eu_qa_1.auto1codingtest.utils; import android.content.Context; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; public class MySingleton { private static MySingleton mInstance; private RequestQueue mRequestQueue; private static Context mCtx; private MySingleton(Context context) { mCtx = context; mRequestQueue = getRequestQueue(); } public static synchronized MySingleton getInstance(Context context) { if (mInstance == null) { mInstance = new MySingleton(context); } return mInstance; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { // getApplicationContext() is key, it keeps you from leaking the // Activity or BroadcastReceiver if someone passes one in. mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext()); } return mRequestQueue; } public <T> void addToRequestQueue(Request<T> req) { getRequestQueue().add(req); } }
[ "umar.appcom@gmail.com" ]
umar.appcom@gmail.com
0679796fc45ea42000f67ba8573023f0d3bbedf3
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/68/760.java
5810ac57e580802bfba8919e92732066b5b665ae
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package <missing>; public class GlobalMembers { public static void Main() { int n; int i; int j; int k; int t; int m; float a; float b; String tempVar = ConsoleInput.scanfRead(); if (tempVar != null) { n = Integer.parseInt(tempVar); } for (m = 6;m <= n;m++) { if (m % 2 == 0) { System.out.printf("%ld=",m); for (i = 3;i <= m - 3;i++) { a = Math.sqrt(i); for (k = 2;k <= a;k++) { if (i % k == 0) { break; } } if (k > a) { t = m - i; b = Math.sqrt(t); for (j = 2;j <= b;j++) { if (t % j == 0) { break; } } if (j > b) { System.out.printf("%d+%d\n",i,t); break; } } } } } } }
[ "y.yu@open.ac.uk" ]
y.yu@open.ac.uk
25afecebc9abb63b428f16fa16a0e45c9dd5367b
0a1355c1328ba421b24de92b22b0836d447d68a2
/Callback11/CBCount/CounterClientImpl.java
ee26a744b74446bda33b18cadb41d4f0e6f10ea5
[]
no_license
AranaDeDoros/SistDist
ba4a03fce93e0334183952cddd07b66edf22b73b
111dab15a5a8b1ac27c22ca1411fea5d40550215
refs/heads/master
2021-04-06T11:16:16.100285
2019-12-15T21:21:27
2019-12-15T21:21:27
124,840,248
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
// CounterClientImpl.java package CBCount; public class CounterClientImpl extends CounterClientPOA { public void update(int value) { System.out.println("Server information. " + "New Counter value: " + value); } }
[ "davidfloresitver@gmail.com" ]
davidfloresitver@gmail.com
04db8eca3556aa0478436aa881324e4daa1e69b9
4aff308b90ff9aab9b17583c493c35772f55d1f0
/core/src/test/java/org/everit/json/schema/internal/JsonPointerFormatValidatorTest.java
9d7defcbce6c02bd198c3b5138fffd8f567fd703
[ "Apache-2.0" ]
permissive
sreekesh93/json-schema
8fc37eaac203c0984a36cdbc6af14f9c4cc1a358
683bbcdc2e5c69f671690c6bbe6dd25783a16da2
refs/heads/master
2021-11-30T22:18:13.086103
2020-03-16T17:22:41
2020-03-16T17:22:41
247,777,667
0
0
Apache-2.0
2020-03-16T17:30:13
2020-03-16T17:30:12
null
UTF-8
Java
false
false
1,186
java
package org.everit.json.schema.internal; import static java.lang.String.format; import static org.everit.json.schema.internal.ValidatorTestSupport.assertSuccess; import org.junit.Test; public class JsonPointerFormatValidatorTest { private final JsonPointerFormatValidator subject = new JsonPointerFormatValidator(); @Test public void stringSuccess() { assertSuccess("/hello", subject); } @Test public void root() { assertSuccess("/", subject); } @Test public void emptyStringIsValid() { assertSuccess("", subject); } @Test public void illegalLeadingCharFailure() { assertFailure("aaa"); } @Test public void invalidTildeEscape() { assertFailure("/~asd"); } @Test public void invalidEscapeNum() { assertFailure("/~2"); } @Test public void trailingTilde() { assertFailure("/foo/bar~"); } @Test public void uriFragment() { assertFailure("#/"); } private void assertFailure(String input) { ValidatorTestSupport.assertFailure(input, subject, format("[%s] is not a valid JSON pointer", input)); } }
[ "ebence88@gmail.com" ]
ebence88@gmail.com
fc9a0b3b18fda09002279a9e1fddc4086d34220c
e4fa11b081846a2a722dd2c211a5e836acc9e434
/src/main/java/hu/oe/nik/szfmv/automatedcar/virtualfunctionbus/packets/visualization/IParkingDistancePacket.java
e4f8ea71ce780dda3e1a9404e72cea8b2a50d8bc
[]
no_license
SzFMV2020-Tavasz/AutomatedCar-A
fe37cff899ddb30787a32cd12242a025416ea097
a89cbfdc2e6f121c3b49e1eab4dc5bc269c06e7c
refs/heads/master
2020-12-27T12:56:57.429871
2020-05-14T05:46:11
2020-05-14T05:46:11
237,910,522
4
4
null
2020-07-01T19:30:34
2020-02-03T07:41:00
Java
UTF-8
Java
false
false
199
java
package hu.oe.nik.szfmv.automatedcar.virtualfunctionbus.packets.visualization; public interface IParkingDistancePacket { /** * Gets the parking distance */ float getDistance(); }
[ "szebeni.zsuzsanna@gmail.com" ]
szebeni.zsuzsanna@gmail.com
60ce83484db3040f0c579de2cafe6e18dcf25056
6c406d766735c8f57a3675c5b3e619e701cd0dc9
/server-jersey/src/main/java/ru/terra/spending/controller/LoginController.java
605610518a39c181837b547bd274c68f5193b31b
[]
no_license
TERRANZ/spending
d29c23af6e88b0f9fe567479040a8d37bbbefa4b
ebca7021366477f4ade77bc643a377a0ce702a6b
refs/heads/master
2021-01-02T23:12:09.974858
2015-07-16T10:00:48
2015-07-16T10:00:48
5,867,701
1
0
null
null
null
null
UTF-8
Java
false
false
3,169
java
package ru.terra.spending.controller; import com.sun.jersey.api.core.HttpContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ru.terra.server.controller.AbstractResource; import ru.terra.server.dto.LoginDTO; import ru.terra.spending.constants.URLConstants; import ru.terra.spending.db.entity.User; import ru.terra.spending.engine.CaptchaEngine; import ru.terra.spending.engine.UsersEngine; import ru.terra.spending.engine.YandexCaptcha; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; @Path(URLConstants.Login.LOGIN) public class LoginController extends AbstractResource { private Logger logger = LoggerFactory.getLogger(this.getClass()); private UsersEngine usersEngine = new UsersEngine(); private CaptchaEngine captchaEngine = new YandexCaptcha(); @GET @Path(URLConstants.Login.LOGIN_DO_LOGIN_JSON) @Produces(MediaType.APPLICATION_JSON) public LoginDTO login(@Context HttpContext hc, @QueryParam(URLConstants.Login.LOGIN_PARAM_USER) String user, @QueryParam(URLConstants.Login.LOGIN_PARAM_PASS) String pass) { logger.info("User requests login with user = " + user + " and pass = " + pass); LoginDTO ret = new LoginDTO(); ret.logged = false; if (user != null && pass != null) { User u = usersEngine.login(user, pass); if (u != null) { ret.id = u.getId(); ret.session = sessionsHolder.registerUserSession(u); ret.logged = true; } else { ret.message = "user not found"; } } else { ret.message = "invalid parameters"; } return ret; } @GET @Path(URLConstants.Login.LOGIN_DO_REGISTER_JSON) @Produces(MediaType.APPLICATION_JSON) public LoginDTO reg(@Context HttpContext hc, @QueryParam(URLConstants.Login.LOGIN_PARAM_USER) String user, @QueryParam(URLConstants.Login.LOGIN_PARAM_PASS) String pass, @QueryParam(URLConstants.Login.LOGIN_PARAM_CAPTCHA) String captcha, @QueryParam(URLConstants.Login.LOGIN_PARAM_CAPVAL) String capval) { logger.info("User requests reg with user = " + user + " and pass = " + pass); LoginDTO ret = new LoginDTO(); if (user != null && usersEngine.findUserByName(user) == null) { if (user != null && pass != null) { if (captchaEngine.checkCaptcha(capval, captcha)) { Integer retId = usersEngine.registerUser(user, pass); ret.logged = true; ret.id = retId; } else { ret.logged = false; ret.message = "Invalid captcha"; } } else { ret.logged = false; } } else { ret.logged = false; ret.message = "User already exists"; } return ret; } }
[ "terrach@terranz.ath.cx" ]
terrach@terranz.ath.cx
1425d8160ac751a21d91e647880c15ab05cd0cfc
2636b9ce828a7862d93ca19521bfec89e8530a2c
/turms-gateway/src/main/java/im/turms/gateway/infra/proto/TurmsRequestParser.java
b173783f3cb2e6c0ca6f954feb0e55e958356ef7
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0", "AGPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference", "SSPL-1.0" ]
permissive
turms-im/turms
f1ccbc78175a176b3f5edf34b2b2badc901dcece
33bef70a5737c23adea72c6ba150b851bee6bfb6
refs/heads/develop
2023-09-01T17:02:03.053493
2023-08-23T13:53:21
2023-08-23T14:04:20
191,290,973
1,506
217
Apache-2.0
2023-04-25T02:38:02
2019-06-11T04:01:39
Java
UTF-8
Java
false
false
3,803
java
/* * Copyright (C) 2019 The Turms Project * https://github.com/turms-im/turms * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package im.turms.gateway.infra.proto; import java.io.IOException; import com.google.protobuf.CodedInputStream; import com.google.protobuf.ExtensionRegistry; import com.google.protobuf.WireFormat; import org.springframework.util.Assert; import im.turms.server.common.access.client.dto.request.TurmsRequest; import im.turms.server.common.access.client.dto.request.user.CreateSessionRequest; import im.turms.server.common.access.common.ResponseStatusCode; import im.turms.server.common.infra.exception.ResponseException; import static im.turms.server.common.access.client.dto.request.TurmsRequest.KindCase.CREATE_SESSION_REQUEST; import static im.turms.server.common.access.client.dto.request.TurmsRequest.KindCase.KIND_NOT_SET; /** * @author James Chen */ public final class TurmsRequestParser { /** * {@link TurmsRequest:73} */ private static final int REQUEST_ID_TAG = 8; private static final ExtensionRegistry REGISTRY = ExtensionRegistry.getEmptyRegistry(); private static final long UNDEFINED_REQUEST_ID = Long.MIN_VALUE; private TurmsRequestParser() { } public static SimpleTurmsRequest parseSimpleRequest(CodedInputStream turmsRequestInputStream) { Assert.notNull(turmsRequestInputStream, "The input stream must not be null"); try { long requestId = UNDEFINED_REQUEST_ID; TurmsRequest.KindCase type; while (true) { int tag = turmsRequestInputStream.readTag(); if (tag == REQUEST_ID_TAG) { if (requestId == UNDEFINED_REQUEST_ID) { requestId = turmsRequestInputStream.readInt64(); } else { throw ResponseException.get(ResponseStatusCode.ILLEGAL_ARGUMENT, "Not a valid request: Duplicate request ID"); } } else { int kindFieldNumber = WireFormat.getTagFieldNumber(tag); type = TurmsRequest.KindCase.forNumber(kindFieldNumber); break; } } if (requestId == UNDEFINED_REQUEST_ID) { throw ResponseException.get(ResponseStatusCode.ILLEGAL_ARGUMENT, "Not a valid request: No request ID"); } if (type == null || type == KIND_NOT_SET) { throw ResponseException.get(ResponseStatusCode.ILLEGAL_ARGUMENT, "Not a valid request: Unknown request type: " + type); } CreateSessionRequest createSessionRequest = null; if (type == CREATE_SESSION_REQUEST) { createSessionRequest = turmsRequestInputStream .readMessage(CreateSessionRequest.parser(), REGISTRY); } return new SimpleTurmsRequest(requestId, type, createSessionRequest); } catch (IOException e) { throw ResponseException.get(ResponseStatusCode.ILLEGAL_ARGUMENT, "Not a valid request: " + e.getMessage()); } } }
[ "eurekajameschen@gmail.com" ]
eurekajameschen@gmail.com
04731a454e3d6934ccab97d6ca687948ebdf286c
a3061f91fc1726e95eb5f41a06aece47e0114109
/app/src/main/java/com/example/pkl/activities/BuatListTamu.java
bc23fd32ed1749d289881fdec89db6644e8ecc15
[]
no_license
AdityaPutraPratama12/PKL_BUKUTAMU
cd871ee956fe9943c11971228b444aa02f886314
3ac3771b9202a22ebe382008114638aff7334d42
refs/heads/master
2023-02-10T07:38:26.003383
2021-01-11T04:37:53
2021-01-11T04:37:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
729
java
package com.example.pkl.activities; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import com.example.pkl.R; public class BuatListTamu extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_buat_list_tamu); } public void Pindah(View view) { Intent intent = new Intent(BuatListTamu.this, MainActivity.class); startActivity(intent); } public void Pindah2(View view) { Intent intent = new Intent(BuatListTamu.this, ListTamu.class); startActivity(intent); } }
[ "rakagigih65@gmail.com" ]
rakagigih65@gmail.com
e12124c4a4034b5c6d1eb9d38a8937dc7530ea50
133e8a34e82f0409e070a4d9332868aa71773b9e
/.Battletest/src/test/java/com/qa/Battletest/AppTest.java
3915bdff29293bc848b2bbf94ad280811bad1538
[]
no_license
kylemchown/Week-2
fd593e8613779369dcce11358dd02b4bc2244490
6c29c8b2202725a06b5a3dc227170ed16af0532c
refs/heads/master
2020-03-27T13:38:59.137845
2018-08-30T15:04:21
2018-08-30T15:04:21
146,620,871
0
0
null
null
null
null
UTF-8
Java
false
false
645
java
package com.qa.Battletest; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "kyle.m.chown@gmail.com" ]
kyle.m.chown@gmail.com
53eb36c915c91744bc4afd1392376e586e7cce42
4c8ad81b8f406f85f6625829b1bdbc200cf480a1
/src/main/java/com/drag/yaso/user/dao/UserTicketDetailDao.java
c291bf0905e4c9e72dccc00bf91e78d58846c841
[]
no_license
longyunbo/yaso
1c5822d595f070912223cbb902a01cb1131ae9c0
9636f12675a9179583fed7dc0a1bc1d75005a5c8
refs/heads/master
2020-03-28T13:58:03.040512
2018-09-15T08:53:02
2018-09-15T08:53:02
148,446,076
0
1
null
null
null
null
UTF-8
Java
false
false
1,046
java
package com.drag.yaso.user.dao; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import com.drag.yaso.user.entity.UserTicketDetail; public interface UserTicketDetailDao extends JpaRepository<UserTicketDetail, String>, JpaSpecificationExecutor<UserTicketDetail> { @Query(value = "select * from t_user_ticket_detail where id = ?1", nativeQuery = true) UserTicketDetail findOne(int id); @Query(value = "select * from t_user_ticket_detail where ticket_id = ?1 order by create_time desc", nativeQuery = true) List<UserTicketDetail> findByTicketId(int ticketid); @Query(value = "select * from t_user_ticket_detail where uid = ?1 order by create_time desc", nativeQuery = true) List<UserTicketDetail> findByUid(int uid); @Query(value = "select * from t_user_ticket_detail where id in (?1)", nativeQuery = true) List<UserTicketDetail> findByIdIn(List<Integer> ids); }
[ "longyunbo@guohuaigroup.com" ]
longyunbo@guohuaigroup.com
054f5db7ed3314f9ca8f0d4d7e22a864499d7fb9
dba13c8a1ad3ff5a6de872b1933888d892489c25
/PortalWebArboretum/src/entidades/tipoVisualizacion.java
d8d484f7d06b4544aa01c08dff0f2fea20b2f562
[]
no_license
Danro08/PortalWebStackoverflow
6aadb5dfb1683b723f41e3f8f58b954fd67360fa
0a9febd28e09413d3689fc9faae2561499d08a28
refs/heads/master
2023-05-09T14:15:51.368414
2021-05-29T03:01:12
2021-05-29T03:01:12
358,316,541
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package entidades; public class tipoVisualizacion { private String descripcion; private String nombre; private int tipodevisualizacionID; private int estado; public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public int getTipodevisualizacionID() { return tipodevisualizacionID; } public void setTipodevisualizacionID(int tipodevisualizacionID) { this.tipodevisualizacionID = tipodevisualizacionID; } public int getEstado() { return estado; } public void setEstado(int estado) { this.estado = estado; } }
[ "marwa@SAM" ]
marwa@SAM
78d4accfa74904ae0240b1f35d836b039175ae4e
70c8078d9dc8ef3a455777fc73a85a2d31c1e6bc
/backend/dscatalog/src/main/java/com/sistemalima/dscatalog/resources/CategoryResource.java
88a3cd928a030cf5a2c98f2bc288f43cad08c40b
[]
no_license
wagnersistemalima/projeto1-bootcamp-devsuperior
2a451deb37b9d4356fbe30de84ffafb25ed19e50
80fe7a7750ada3cf15da9b940c99f3d3fc997871
refs/heads/master
2023-01-10T04:10:29.053885
2020-11-09T21:54:35
2020-11-09T21:54:35
311,470,027
2
0
null
null
null
null
UTF-8
Java
false
false
2,980
java
package com.sistemalima.dscatalog.resources; import java.net.URI; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort.Direction; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import com.sistemalima.dscatalog.dto.CategoryDTO; import com.sistemalima.dscatalog.services.CategoryService; // controlador Rest @RestController @RequestMapping(value = "/categories") public class CategoryResource { // dependencia @Autowired private CategoryService service; // 1 end point / buscar todos/ retorna uma resposta http (200) com sucesso @GetMapping public ResponseEntity<Page<CategoryDTO>> findAll( @RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "linesPerPage", defaultValue = "12") Integer linesPerPage, @RequestParam(value = "direction", defaultValue = "ASC") String direction, @RequestParam(value = "orderBy", defaultValue = "name") String orderBy ) { PageRequest pageRequest = PageRequest.of(page, linesPerPage, Direction.valueOf(direction), orderBy); Page<CategoryDTO> list = service.findAllPaged(pageRequest); return ResponseEntity.ok().body(list); } // 2 end point / buscar por id / retorna uma resposta (200) com sucesso @GetMapping(value = "/{id}") public ResponseEntity <CategoryDTO> findById(@PathVariable Long id) { CategoryDTO dto = service.findById(id); return ResponseEntity.ok().body(dto); } // 3 end point / inserir uma nova categoria @PostMapping public ResponseEntity<CategoryDTO> insert(@RequestBody CategoryDTO dto) { dto = service.insert(dto); URI uri = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(dto.getId()).toUri(); return ResponseEntity.created(uri).body(dto); } // 4 end point / atualizar uma categoria @PutMapping(value = "/{id}") public ResponseEntity<CategoryDTO> update(@PathVariable Long id, @RequestBody CategoryDTO dto) { dto = service.update(id, dto); return ResponseEntity.ok().body(dto); } // 5 end point / deletar categoria @DeleteMapping(value = "/{id}") public ResponseEntity<CategoryDTO> delete(@PathVariable long id) { service.delete(id); return ResponseEntity.noContent().build(); } }
[ "wagner.sistemalima@gmail.com" ]
wagner.sistemalima@gmail.com
424b97a02557ff77ba1db0cb406e66c18923b27e
8285862deb597bd721c453b2623f6cccc5070584
/tinymall-product/src/main/java/indi/tom/tinymall/product/entity/AttrEntity.java
5d38ff87817c4c95322815937e77ad77efed29d1
[]
no_license
YiyiSmile/TinyMall
6df5785c3545f48fb2bf1d4e55d8463d66ac08d1
f08fd8a452e5febf76ed6362954529b3496700b3
refs/heads/main
2023-02-09T07:03:36.437473
2021-01-01T14:08:40
2021-01-01T14:08:40
323,620,823
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package indi.tom.tinymall.product.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 商品属性 * * @author tom098 * @email tom098@gmail.com * @date 2020-12-23 13:36:19 */ @Data @TableName("pms_attr") public class AttrEntity implements Serializable { private static final long serialVersionUID = 1L; /** * 属性id */ @TableId private Long attrId; /** * 属性名 */ private String attrName; /** * 是否需要检索[0-不需要,1-需要] */ private Integer searchType; /** * 属性图标 */ private String icon; /** * 可选值列表[用逗号分隔] */ private String valueSelect; /** * 属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性] */ private Integer attrType; /** * 启用状态[0 - 禁用,1 - 启用] */ private Long enable; /** * 所属分类 */ private Long catelogId; /** * 快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整 */ private Integer showDesc; }
[ "956548728@qq.com" ]
956548728@qq.com
ebba242ba1bb2a2f504c66c1283b1deac2ae2ebd
0c5f55f4418c5fa1cd782e763bfa18b3b21cb5b6
/EbooksReptile/reptile-models/reptile-models-hibernate/src/main/java/com/poet/reptile/model/hibernate/Book.java
c0384dd14258e8ba0d341f21b6bf5c499068a167
[ "Apache-2.0" ]
permissive
fengbaicanhe/itebooks-reptile
48d1d0da534d28a3908940ea9c06ab89b6e68a62
d1702b67df52162912c28de215c9761fca193a55
refs/heads/master
2016-08-11T06:05:13.325459
2016-01-10T15:14:23
2016-01-10T15:14:23
49,371,959
0
0
null
null
null
null
UTF-8
Java
false
false
2,656
java
package com.poet.reptile.model.hibernate; import com.poet.reptile.api.model.IAuthor; import com.poet.reptile.api.model.ICategory; import com.poet.reptile.api.model.support.AbstractBook; import javax.persistence.*; import java.io.Serializable; import java.util.List; @Entity @Table(name="book") public class Book extends AbstractBook { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="book_id") @Override public Integer getId() { return (Integer) super.getId(); } @Column(name="book_title") @Override public String getBookTitle() { return super.getBookTitle(); } @Column(name="book_subtitle") @Override public String getBookSubTitle() { return super.getBookSubTitle(); } @Column(name="book_isbn") @Override public String getBookIsbn() { return super.getBookIsbn(); } @Column(name="book_pub_year") @Override public String getBookPubYear() { return super.getBookPubYear(); } @Column(name="book_pages") @Override public Integer getBookPages() { return super.getBookPages(); } @Column(name="book_language") @Override public String getBookLanguage() { return super.getBookLanguage(); } @Column(name="book_file_size") @Override public String getBookFileSize() { return super.getBookFileSize(); } @Column(name="book_file_format") @Override public String getBookFileFormat() { return super.getBookFileFormat(); } @Column(name="book_desc") @Override public String getBookDesc() { return super.getBookDesc(); } @Column(name="book_image_url") @Override public String getBookImageUrl() { return super.getBookImageUrl(); } @Column(name="book_download_url") @Override public String getBookDownloadUrl() { return super.getBookDownloadUrl(); } @ManyToMany(targetEntity = Category.class,fetch = FetchType.LAZY) @JoinTable(name = "book_category_asso", joinColumns = {@JoinColumn(name = "book_id")}, inverseJoinColumns = {@JoinColumn(name = "category_id")}) @Override public List<ICategory> getBookCategories() { return super.getBookCategories(); } @ManyToMany(targetEntity = Author.class,fetch = FetchType.LAZY) @JoinTable(name = "book_author_asso", joinColumns = {@JoinColumn(name="book_id")}, inverseJoinColumns = {@JoinColumn(name = "author_id")}) @Override public List<IAuthor> getBookAuthors() { return super.getBookAuthors(); } }
[ "fengbaicanhe@hotmail.com" ]
fengbaicanhe@hotmail.com
ddf2598e6fafbe2dc759bf60878e10322407f40f
984bc78055def357c50c2c465e740a54e686d22e
/lib/mp3tag/src/org/farng/mp3/id3/FrameBodyTEXT.java
d68ec7e9d54d26e86e4094505e0f70ebcec8c925
[]
no_license
lboynton/XMPP-Client
18986dc4a95a28f318b8563bba054da3befcea4a
b833d79153562f93c74f7122a72989733acaff37
refs/heads/master
2021-01-13T02:22:26.402596
2009-07-09T21:01:11
2009-07-09T21:01:11
247,388
2
2
null
null
null
null
UTF-8
Java
false
false
1,105
java
package org.farng.mp3.id3; import org.farng.mp3.InvalidTagException; import java.io.RandomAccessFile; /** * &nbsp;&nbsp; The 'Lyricist/Text writer' frame is intended for the writer of the<br> &nbsp;&nbsp; text or lyrics in * the recording.</p> * * @author Eric Farng * @version $Revision: 1.4 $ */ public class FrameBodyTEXT extends AbstractFrameBodyTextInformation { /** * Creates a new FrameBodyTEXT object. */ public FrameBodyTEXT() { super(); } /** * Creates a new FrameBodyTEXT object. */ public FrameBodyTEXT(final FrameBodyTEXT body) { super(body); } /** * Creates a new FrameBodyTEXT object. */ public FrameBodyTEXT(final byte textEncoding, final String text) { super(textEncoding, text); } /** * Creates a new FrameBodyTEXT object. */ public FrameBodyTEXT(final RandomAccessFile file) throws java.io.IOException, InvalidTagException { super(file); } public String getIdentifier() { return "TEXT"; } }
[ "lee@lboynton.com" ]
lee@lboynton.com
6abc67a4d4f94c2a63d0cc27152924a77fa8f856
05d0da2726c43c621f65f3004b122b6a43cbcf09
/src/com/wizarpos/emvsample/activity/PayProduct.java
59b812b7ef5a112f3888286cddcfae2a7c58d8bd
[]
no_license
aurora-santos07/yo_lo_pa_go_oct
3d1b129381c0c5ba6da35a25943072a482934c29
d713ba61ccbbf1a04f5a30923ae8a70263d9e24e
refs/heads/master
2022-12-24T17:14:00.365609
2020-10-06T21:52:56
2020-10-06T21:52:56
300,775,762
0
0
null
null
null
null
UTF-8
Java
false
false
3,501
java
package com.wizarpos.emvsample.activity; import com.google.android.material.bottomnavigation.BottomNavigationView; import androidx.fragment.app.Fragment; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.widget.Toast; import com.wizarpos.emvsample.R; import net.yolopago.pago.fragment.FragmentMerchant; import net.yolopago.pago.fragment.FragmentPay; import net.yolopago.pago.fragment.TxListFragment; import java.util.ArrayList; public class PayProduct extends AppCompatActivity implements FragmentPay.FragmentPayListeer{ private FragmentPay fragmentPay; private TxListFragment txListFragment; private FragmentMerchant fragmentMerchant; private static Fragment theFragment; String data1; Integer data2; Double Data3; private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pay_product); Bundle b = getIntent().getExtras(); String verTotal = b.getString("pagartotal"); ArrayList<Product> Pay = (ArrayList<Product>) b.getSerializable("productos"); for (int i = 0; i < Pay.size(); i++) { String data1 = Pay.get(i).getProducto(); String data2 = Pay.get(i).getCantidad(); Integer c = Integer.parseInt(data2); Double data3 = Pay.get(i).getPrecio(); //Double dou = Double.parseDouble(data3); //TicketLineDto ticketLineDto = //Log.i("Information", "lista: " + data1 +", " + c + ", " + data3); } fragmentPay = new FragmentPay(); Bundle bundle = new Bundle(); bundle.putString("message", verTotal); bundle.putSerializable("productospay", Pay); FragmentPay fragmentPay = new FragmentPay(); fragmentPay.setArguments(bundle); getSupportFragmentManager() .beginTransaction() .replace(R.id.containerPago, fragmentPay) .commit(); mOnNavigationItemSelectedListener = item -> { switch (item.getItemId()) { case R.id.navigation_pay: Toast.makeText(getApplicationContext(), "Pagos", Toast.LENGTH_LONG).show(); break; case R.id.navigation_voucher: Toast.makeText(getApplicationContext(), "lista", Toast.LENGTH_LONG).show(); break; case R.id.navigation_merchant: Toast.makeText(getApplicationContext(), "merchant", Toast.LENGTH_LONG).show(); break; } return true; }; } // Initiating Menu XML file (menu.xml) @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_bottom_navigation, menu); return true; } @Override public void onInputPaySent(CharSequence input) { } @Override public boolean onKeyDown(int keyCode, KeyEvent event){ switch (keyCode) { case KeyEvent.KEYCODE_1: onOne(); break; } return true; } public void onOne(){ } }
[ "aurorasantos@MacBook-Pro-de-Aurora.local" ]
aurorasantos@MacBook-Pro-de-Aurora.local
197aa97f7feeecc0d313693294e13151c7a8e490
3ee05452b1aab2995a9c4d963be453fbc2d2c5f0
/src/com/giraffects/notifymyway/DatabaseManager.java
21338a67cda6228acccd3df0d2076334fe2b4a2b
[]
no_license
JerichoJyant/NotifyMyWay
741d75e2c778198dce32ebca0d86b966f78eb836
288c9ace8651325d1e4a58c59338be9d378efc68
refs/heads/master
2021-05-27T01:31:35.083548
2011-04-03T22:00:09
2011-04-03T22:00:09
1,192,034
1
0
null
null
null
null
UTF-8
Java
false
false
10,481
java
package com.giraffects.notifymyway; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.net.Uri; import android.provider.ContactsContract.PhoneLookup; public class DatabaseManager { private Context context; private DatabaseHelper database_helper; private SQLiteDatabase database; // Vibration Patterns Table private static final String VP_TABLE_NAME = "vibration_patterns"; public static final String VP_KEY_NAME = "name"; public static final String VP_KEY_PATTERN = "pattern"; public static final String VP_KEY_ROWID = "_id"; // Assign Contact Table private static final String AC_TABLE_NAME = "contact_assignments"; public static final String AC_KEY_CONTACT = "contact"; public static final String AC_KEY_ROWID = "_id"; public static final String AC_KEY_VP_ROWID = "vibration_pattern_id"; private static class DatabaseHelper extends SQLiteOpenHelper { // Upgrade when changing schema // Database Version 1: Pre release // Database Version 2: Release 1.0 // Database Version 3: 1.5.0 Alpha (subject to change to Release 1.5.0) private static final int VERSION_PRERELEASE = 1; private static final int VERSION_1 = 2; private static final int VERSION_1POINT5 = 3; private static final int DATABASE_VERSION = VERSION_1POINT5; // Database name private static final String DATABASE_NAME = "nmw_data"; private static final String VP_TABLE_CREATE = "CREATE TABLE " + VP_TABLE_NAME + " (" + VP_KEY_ROWID + " integer primary key autoincrement, " + VP_KEY_NAME + " TEXT, " + VP_KEY_PATTERN + " TEXT);"; private static final String AC_TABLE_CREATE = "CREATE TABLE " + AC_TABLE_NAME + " (" + AC_KEY_ROWID + " integer primary key autoincrement, " + AC_KEY_CONTACT + " INTEGER, " + AC_KEY_VP_ROWID + " INTEGER);"; private static final String DATABASE_CREATE = VP_TABLE_CREATE + " " + AC_TABLE_CREATE; // TODO: @SuppressWarnings("unused") private static Context context; DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); DatabaseHelper.context = context; } @Override public void onCreate(SQLiteDatabase db) { // Run sql to create database StaticHelper.d("Creating database"); db.execSQL(DATABASE_CREATE); // Load and execute default SQL StaticHelper.d("Running default sql"); insertVersion1SQL(db); insertVersion1Point5SQL(db); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion == VERSION_PRERELEASE) { // Should not happen StaticHelper.w("Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + VP_TABLE_NAME); onCreate(db); } if (oldVersion == VERSION_1) { // Upgrade from 1.0.0 to 1.5.0 // Insert the SQL for 1.5.0 StaticHelper.i("Upgrading database from version " + oldVersion + " to " + newVersion + ", which will keep all old data"); insertVersion1Point5SQL(db); db.execSQL(AC_TABLE_CREATE); // Create Assign Contacts table } } } private static void insertVersion1SQL(SQLiteDatabase db) { StaticHelper.i("Inserting Version 1 SQL"); db.beginTransaction(); DatabaseManager.createVibrationPattern("Quarter Second Buzz", "0,250", db); DatabaseManager.createVibrationPattern("Half Second Buzz", "0,500", db); DatabaseManager.createVibrationPattern("One Second Buzz", "0,1000", db); DatabaseManager.createVibrationPattern("Two Second Buzz", "0,2000", db); DatabaseManager.createVibrationPattern("Three Second Buzz", "0,3000", db); DatabaseManager .createVibrationPattern("Four Second Buzz", "0,4000", db); DatabaseManager.createVibrationPattern("Triple Buzz", "0,250,100,250,100,250", db); DatabaseManager.createVibrationPattern("Triple Buzz (shorter)", "0,150,50,150,50,150", db); DatabaseManager.createVibrationPattern("Triple Buzz (shortest)", "0,75,25,75,25,75", db); DatabaseManager.createVibrationPattern("5 Super Rapid Pulses", "0,50,50,50,50,50,50,50,50,50,50", db); DatabaseManager .createVibrationPattern( "10 Super Rapid Pulses", "0,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50", db); DatabaseManager .createVibrationPattern( "20 Super Rapid Pulses", "0,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50", db); DatabaseManager.createVibrationPattern("5 Rapid Pulses", "0,100,100,100,100,100,100,100,100,100,100", db); DatabaseManager .createVibrationPattern( "10 Rapid Pulses", "0,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100", db); DatabaseManager .createVibrationPattern( "20 Rapid Pulses", "0,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100", db); DatabaseManager.createVibrationPattern("Delayed One-Second-Buzz", "250,1000", db); DatabaseManager.createVibrationPattern("RapTap Tap Slap", "0,200,200,200,200,500,250,1000", db); db.setTransactionSuccessful(); db.endTransaction(); } private static void insertVersion1Point5SQL(SQLiteDatabase db) { StaticHelper.i("Inserting Version 1Point5 SQL"); db.beginTransaction(); DatabaseManager.createVibrationPattern("Royal Entrance", "0,400,100,250,100,250,200,500,100,250,500,250,100,250", db); // Tyler // Burnham DatabaseManager .createVibrationPattern( "Fibonacci", "0,1,100,2,100,3,100,5,100,8,100,13,100,21,100,34,100,55,100,89,100,144,100,233,100,337,100,610", db); // Tyler Burnham // TODO: More patterns db.setTransactionSuccessful(); db.endTransaction(); } DatabaseManager(Context context) { this.context = context; } /** * Open the database. If it cannot be opened, try to create a new instance * of the database. If it cannot be created, throw an exception to signal * the failure * * @return this (self reference, allowing this to be chained in an * initialization call) * @throws SQLException * if the database could be neither opened or created */ public DatabaseManager open() throws SQLException { database_helper = new DatabaseHelper(context); database = database_helper.getWritableDatabase(); return this; } public void close() { database_helper.close(); } /** * Return a Cursor over the list of all vibration patterns in the vibration * patterns database * * @return Cursor over all vibration patterns */ public Cursor fetchAllVibrationPatterns() { return database.query(VP_TABLE_NAME, new String[] { VP_KEY_ROWID, VP_KEY_NAME, VP_KEY_PATTERN }, null, null, null, null, null); } /** * Return a Cursor positioned at the vp that matches the given rowId * * @param rowId * id of vp to retrieve * @return Cursor positioned to matching vp, if found * @throws SQLException * if vp could not be found/retrieved */ public Cursor fetchVibrationPattern(long rowId) throws SQLException { Cursor mCursor = database.query(true, VP_TABLE_NAME, new String[] { VP_KEY_ROWID, VP_KEY_NAME, VP_KEY_PATTERN }, VP_KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } public Cursor fetchAssignedContactByContactRowId(long contactRowId) throws SQLException { Cursor mCursor = database.query(true, AC_TABLE_NAME, new String[] { AC_KEY_ROWID, AC_KEY_CONTACT, AC_KEY_VP_ROWID }, AC_KEY_CONTACT + "=" + contactRowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } public long createVibrationPattern(String name, String pattern) { ContentValues initialValues = new ContentValues(); initialValues.put(VP_KEY_NAME, name); initialValues.put(VP_KEY_PATTERN, pattern); return database.insert(VP_TABLE_NAME, null, initialValues); } public static long createVibrationPattern(String name, String pattern, SQLiteDatabase database) { ContentValues initialValues = new ContentValues(); initialValues.put(VP_KEY_NAME, name); initialValues.put(VP_KEY_PATTERN, pattern); return database.insert(VP_TABLE_NAME, null, initialValues); } /** * Update the vibration pattern using the details provided. The VP to be * updated is specified using the rowId, and it is altered to use the name * and pattern values passed in * * @param rowId * id of vp to update * @param name * value to set vp name to * @param pattern * value to set vp pattern to * @return true if the note was successfully updated, false otherwise */ public boolean updateVibrationPattern(long rowId, String name, String pattern) { ContentValues args = new ContentValues(); args.put(VP_KEY_NAME, name); args.put(VP_KEY_PATTERN, pattern); return database.update(VP_TABLE_NAME, args, VP_KEY_ROWID + "=" + rowId, null) > 0; } public String getVibrationPatternFromNumber(String phoneNumber) throws NumberNotKnownException { long id; Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri .encode(phoneNumber)); ContentResolver resolver = context.getContentResolver(); Cursor cursor = resolver.query(uri, new String[] { PhoneLookup.DISPLAY_NAME, PhoneLookup._ID }, null, null, null); if (cursor.moveToFirst()) { id = cursor.getLong(cursor.getColumnIndex(PhoneLookup._ID)); } else { // Number not in contacts throw new NumberNotKnownException(); } DatabaseManager db = new DatabaseManager(context).open(); try { Cursor assignedContact = db.fetchAssignedContactByContactRowId(id); long vp_rowid = assignedContact.getLong(assignedContact .getColumnIndex(DatabaseManager.AC_KEY_VP_ROWID)); Cursor vp_cur = db.fetchVibrationPattern(vp_rowid); String vp = vp_cur.getString(vp_cur .getColumnIndex(DatabaseManager.VP_KEY_ROWID)); } catch (SQLException e) { // Contact not assigned throw new NumberNotKnownException(); } finally { db.close(); } return vp; } }
[ "iamjp180@gmail.com" ]
iamjp180@gmail.com
27910cd6b6ecc49ed59a2d514f6a61acf7230142
ccdfe6a0af1f995d41082ffdc7635cf61ae17fde
/retrofit/src/main/java/com/lxw/retrofit/http/PartMap.java
14e6a73c8ea3facaa05fdaba5c8b795d1dfe9256
[]
no_license
lsw645/RetrofitPractice
69fe370bd12617c7eda24dd910ddfdab8ee0d793
dfa613c20768ac01d10741b7bfe2a61ea96b8935
refs/heads/master
2020-03-27T08:29:55.763101
2018-08-27T07:17:08
2018-08-27T07:17:08
146,260,912
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.lxw.retrofit.http; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * <pre> * author : lxw * e-mail : lsw@tairunmh.com * time : 2018/08/23 * desc : * </pre> */ @Documented @Target(PARAMETER) @Retention(RUNTIME) public @interface PartMap { String encoding() default "binary"; }
[ "425346708@qq.com" ]
425346708@qq.com
bf30edc1e445452311d246caef0557410a6ad840
dff16eefc748d9b956780a65fa4d7db554abc96f
/src/grafikakomputer/widget/ui/List.java
7ccc18bfd94a5aa21318b4c97bf3db7f9c731014
[]
no_license
situkangsayur/GrafkomBresenham
051f0b36c87e8c66f826b2b141e21e626d45e5b7
e0d016abdf0f6f6bb21a362eaaadcd400f954df0
refs/heads/master
2020-12-24T16:59:31.299040
2012-04-24T06:32:44
2012-04-24T06:32:44
4,121,734
1
0
null
null
null
null
UTF-8
Java
false
false
994
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package grafikakomputer.widget.ui; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.AbstractListModel; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.border.EmptyBorder; /** * * @author hendri */ public class List extends JList { public List() { setOpaque(false); setBackground(new Color(0.0F, 0.0F, 0.0F, 0.0F)); setBorder(new EmptyBorder(4, 4, 4, 4)); setForeground(new Color(255, 255, 255)); setSelectionBackground(new Color(255, 0, 0)); setModel(new DefaultListModel()); } protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); super.paintComponent(g); } }
[ "sistukangsayur@gmail.com" ]
sistukangsayur@gmail.com
51857825f3133b42f5fd58cef3478a5e3d80c30b
2b2560f72c1c88183704b9dd5eeb76ff0f573e0a
/src/bean/DataBlock.java
9fc813903d2d712aa88368164380fb957724b712
[]
no_license
vivekvenkris/SMIRFWeb
906055f65e17481f0fe4a4f7a69bbf12b1f97b00
9afd2cc3e729b0e7aa3b99362236bb6a1e99e84b
refs/heads/master
2021-01-18T22:40:05.466564
2019-09-18T13:21:10
2019-09-18T13:21:10
71,474,488
1
1
null
null
null
null
UTF-8
Java
false
false
1,720
java
package bean; import org.w3c.dom.Node; public class DataBlock { private String dbID; private String node; private String key; private Integer pwcID; private Integer maxSize; private Integer size; public DataBlock(String node, Node datablockXMlNode) { this.key = datablockXMlNode.getAttributes().getNamedItem("key").getNodeValue(); this.pwcID = Integer.parseInt(datablockXMlNode.getAttributes().getNamedItem("pwc_id").getNodeValue()); this.maxSize = Integer.parseInt(datablockXMlNode.getAttributes().getNamedItem("size").getNodeValue()); this.size = Integer.parseInt(datablockXMlNode.getTextContent()); this.node = node; } @Override public boolean equals(Object obj) { if(obj instanceof DataBlock && ((DataBlock)obj).dbID.equals(this.dbID) && ((DataBlock)obj).node.equals(this.node)) return true; return false; } public boolean hasOverflown() { return this.size >= (this.maxSize -1); } @Override public String toString() { return (node + " " + key + " " + pwcID + " " + maxSize + " " + size); } public String getDbID() { return dbID; } public void setDbID(String dbID) { this.dbID = dbID; } public String getNode() { return node; } public void setNode(String node) { this.node = node; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public Integer getPwcID() { return pwcID; } public void setPwcID(Integer pwcID) { this.pwcID = pwcID; } public Integer getMaxSize() { return maxSize; } public void setMaxSize(Integer maxSize) { this.maxSize = maxSize; } public Integer getSize() { return size; } public void setSize(Integer size) { this.size = size; } }
[ "vivekvenkris@gmail.com" ]
vivekvenkris@gmail.com
dd3b16b007c47ff70625fa9c3d874d28f011e466
b5a93d03a4ae2d3928e09d6d2e7079a486a627b2
/Downloads/AgentWeb-master/library/src/main/java/com/just/library/EventHandlerImpl.java
1a1830a3e437b66d5cc9064e9f46204c30b728ee
[ "Apache-2.0" ]
permissive
GuolinYao/AgentWeb-master
5670822a413f106ae45f6d9414fe8ca3b136d89f
7a284ba4e7e6c2b2069e445205e53bfd1bdab197
refs/heads/master
2020-12-03T07:54:28.361135
2017-06-28T07:40:03
2017-06-28T07:40:04
95,638,904
1
1
null
null
null
null
UTF-8
Java
false
false
1,435
java
package com.just.library; import android.view.KeyEvent; import android.webkit.WebView; /** * <b>@项目名:</b> agentweb<br> * <b>@包名:</b>com.just.library<br> * <b>@创建者:</b> cxz -- just<br> * <b>@创建时间:</b> &{DATE}<br> * <b>@公司:</b> <br> * <b>@邮箱:</b> cenxiaozhong.qqcom@qq.com<br> * <b>@描述</b><br> */ public class EventHandlerImpl implements IEventHandler { private WebView mWebView; private EventInterceptor mEventInterceptor; public static final EventHandlerImpl getInstantce(WebView view,EventInterceptor eventInterceptor) { return new EventHandlerImpl(view, eventInterceptor); } public EventHandlerImpl(WebView webView,EventInterceptor eventInterceptor) { LogUtils.i("Info","EventInterceptor:"+eventInterceptor); this.mWebView = webView; this.mEventInterceptor = eventInterceptor; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { return back(); } return false; } @Override public boolean back() { if(this.mEventInterceptor!=null&&this.mEventInterceptor.event()){ return true; } if(mWebView!=null&&mWebView.canGoBack()){ mWebView.goBack(); return true; } return false; } public void inJectPriorityEvent(){ } }
[ "635142285@qq.com" ]
635142285@qq.com
74e89e90b05188d80ed693bfd0a1a39e2ab4e8b6
1b1f44d5087e7432ceccdf0df2bc2154600e488c
/app/src/main/java/br/com/zone/adapter/CustomFragmentPageAdapter.java
c8be0fe37bd74b97abd49f8205976415a5b6d52d
[]
no_license
GabrielCeffas/zone
4a6743ee64b693e1b0d32d7748ad50de18ff0f4b
ac293a1fae06fadb5959188a0ab0dd57827081bf
refs/heads/master
2021-08-20T02:25:22.134507
2017-11-28T00:52:40
2017-11-28T00:52:40
103,930,232
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
package br.com.zone.adapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import br.com.zone.fragment.semanalFragment; import br.com.zone.fragment.diarioFragment; public class CustomFragmentPageAdapter extends FragmentPagerAdapter{ private static final int FRAGMENT_COUNT = 2; public CustomFragmentPageAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position){ case 0: return new diarioFragment(); case 1: return new semanalFragment(); } return null; } @Override public int getCount() { return FRAGMENT_COUNT; } @Override public CharSequence getPageTitle(int position) { switch (position){ case 0: return "Diario"; case 1: return "Semanal"; } return null; } }
[ "gabriel.ceffas@gmail.com" ]
gabriel.ceffas@gmail.com
0a615ce3c25be0e3f1fa559b7ab4387666ae31f1
6635387159b685ab34f9c927b878734bd6040e7e
/src/azv.java
e10d2a653a110e06cb754047677cc8a5d77043b0
[]
no_license
RepoForks/com.snapchat.android
987dd3d4a72c2f43bc52f5dea9d55bfb190966e2
6e28a32ad495cf14f87e512dd0be700f5186b4c6
refs/heads/master
2021-05-05T10:36:16.396377
2015-07-16T16:46:26
2015-07-16T16:46:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
import com.snapchat.android.analytics.framework.UpdateSnapsAnalyticsPlatform; public final class azv implements bvp<UpdateSnapsAnalyticsPlatform> { private final azj module; static { if (!azv.class.desiredAssertionStatus()) {} for (boolean bool = true;; bool = false) { $assertionsDisabled = bool; return; } } private azv(azj paramazj) { assert (paramazj != null); module = paramazj; } public static bvp<UpdateSnapsAnalyticsPlatform> a(azj paramazj) { return new azv(paramazj); } } /* Location: * Qualified Name: azv * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
a0a59c5ec7eb9aaae2940d82dcf040f3f2780c31
1317692dea78922272229c92c14ecfb7cc5abf2e
/UML/src/uml/structuredClassifiers/impl/StructuredClassifierImpl.java
c8e515c1d768d6fe565e2b5eade009e14ed59698
[]
no_license
ferchouche/SmallUML
b6fd1c69cfe46dd0cf635fee9a1990019b469691
5cc8fdd7439afbaa86e6f2cb2831a87a1bc5eb59
refs/heads/master
2021-06-12T01:42:59.134482
2016-12-19T00:35:43
2016-12-19T00:35:43
76,800,256
1
0
null
null
null
null
UTF-8
Java
false
false
9,213
java
/** */ package uml.structuredClassifiers.impl; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.WrappedException; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import uml.classification.Property; import uml.classification.impl.ClassifierImpl; import uml.structuredClassifiers.ConnectableElement; import uml.structuredClassifiers.Connector; import uml.structuredClassifiers.StructuredClassifier; import uml.structuredClassifiers.StructuredClassifiersPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Structured Classifier</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link uml.structuredClassifiers.impl.StructuredClassifierImpl#getOwnedAttribute <em>Owned Attribute</em>}</li> * <li>{@link uml.structuredClassifiers.impl.StructuredClassifierImpl#getOwnedConnector <em>Owned Connector</em>}</li> * <li>{@link uml.structuredClassifiers.impl.StructuredClassifierImpl#getPart <em>Part</em>}</li> * <li>{@link uml.structuredClassifiers.impl.StructuredClassifierImpl#getRole <em>Role</em>}</li> * </ul> * * @generated */ public abstract class StructuredClassifierImpl extends ClassifierImpl implements StructuredClassifier { /** * The cached value of the '{@link #getOwnedAttribute() <em>Owned Attribute</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOwnedAttribute() * @generated * @ordered */ protected EList<Property> ownedAttribute; /** * The cached value of the '{@link #getOwnedConnector() <em>Owned Connector</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOwnedConnector() * @generated * @ordered */ protected EList<Connector> ownedConnector; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected StructuredClassifierImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return StructuredClassifiersPackage.Literals.STRUCTURED_CLASSIFIER; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Property> getOwnedAttribute() { if (ownedAttribute == null) { ownedAttribute = new EObjectContainmentEList<Property>(Property.class, this, StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE); } return ownedAttribute; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Connector> getOwnedConnector() { if (ownedConnector == null) { ownedConnector = new EObjectContainmentEList<Connector>(Connector.class, this, StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR); } return ownedConnector; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Property> getPart() { // TODO: implement this method to return the 'Part' reference list // Ensure that you remove @generated or mark it @generated NOT // The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting // so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used. throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ConnectableElement> getRole() { // TODO: implement this method to return the 'Role' reference list // Ensure that you remove @generated or mark it @generated NOT // The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting // so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used. throw new UnsupportedOperationException(); } /** * The cached invocation delegate for the '{@link #part() <em>Part</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #part() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate PART__EINVOCATION_DELEGATE = ((EOperation.Internal)StructuredClassifiersPackage.Literals.STRUCTURED_CLASSIFIER___PART).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") public EList<Property> part() { try { return (EList<Property>)PART__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #allRoles() <em>All Roles</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #allRoles() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate ALL_ROLES__EINVOCATION_DELEGATE = ((EOperation.Internal)StructuredClassifiersPackage.Literals.STRUCTURED_CLASSIFIER___ALL_ROLES).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") public EList<ConnectableElement> allRoles() { try { return (EList<ConnectableElement>)ALL_ROLES__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE: return ((InternalEList<?>)getOwnedAttribute()).basicRemove(otherEnd, msgs); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR: return ((InternalEList<?>)getOwnedConnector()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE: return getOwnedAttribute(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR: return getOwnedConnector(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__PART: return getPart(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__ROLE: return getRole(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE: getOwnedAttribute().clear(); getOwnedAttribute().addAll((Collection<? extends Property>)newValue); return; case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR: getOwnedConnector().clear(); getOwnedConnector().addAll((Collection<? extends Connector>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE: getOwnedAttribute().clear(); return; case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR: getOwnedConnector().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE: return ownedAttribute != null && !ownedAttribute.isEmpty(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR: return ownedConnector != null && !ownedConnector.isEmpty(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__PART: return !getPart().isEmpty(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER__ROLE: return !getRole().isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER___PART: return part(); case StructuredClassifiersPackage.STRUCTURED_CLASSIFIER___ALL_ROLES: return allRoles(); } return super.eInvoke(operationID, arguments); } } //StructuredClassifierImpl
[ "abdeldjallil_ferchouche@hotmail.com" ]
abdeldjallil_ferchouche@hotmail.com
84e277a61adcff4109c82633e5e127da327f2ddb
36bda14cc10d4d1f53c06620ccb94c100a1368b3
/DuelistMod/src/main/java/duelistmod/cards/OjamaBlue.java
1bdef84d1d7ffc6d41d3bc2ff2e8a69a3e6e8e17
[ "Unlicense" ]
permissive
Dream5366/StS-DuelistMod
465e5e3ec56e630ac659cc0e57861f9dd6c15548
f2902db0e14cfa175053188b9f37b4c9611955ac
refs/heads/master
2021-05-18T02:43:50.357300
2020-02-15T15:17:54
2020-02-15T15:17:54
251,068,687
0
0
Unlicense
2020-03-29T15:43:02
2020-03-29T15:43:01
null
UTF-8
Java
false
false
4,771
java
package duelistmod.cards; import com.megacrit.cardcrawl.cards.AbstractCard; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.localization.CardStrings; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.orbs.AbstractOrb; import duelistmod.*; import duelistmod.abstracts.DuelistCard; import duelistmod.helpers.DebuffHelper; import duelistmod.interfaces.*; import duelistmod.orbs.*; import duelistmod.patches.*; import duelistmod.powers.*; import duelistmod.variables.Tags; public class OjamaBlue extends DuelistCard { // TEXT DECLARATION public static final String ID = DuelistMod.makeID("OjamaBlue"); private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID); public static final String IMG = DuelistMod.makeCardPath("OjamaBlue.png"); public static final String NAME = cardStrings.NAME; public static final String DESCRIPTION = cardStrings.DESCRIPTION; public static final String UPGRADE_DESCRIPTION = cardStrings.UPGRADE_DESCRIPTION; // /TEXT DECLARATION/ // STAT DECLARATION private static final CardRarity RARITY = CardRarity.RARE; private static final CardTarget TARGET = CardTarget.ENEMY; private static final CardType TYPE = CardType.SKILL; public static final CardColor COLOR = AbstractCardEnum.DUELIST_MONSTERS; private static final int COST = 2; private static int MIN_DEBUFF_TURNS_ROLL = 1; private static int MAX_DEBUFF_TURNS_ROLL = 5; // /STAT DECLARATION/ public OjamaBlue() { super(ID, NAME, IMG, COST, DESCRIPTION, TYPE, COLOR, RARITY, TARGET); this.tags.add(Tags.MONSTER); this.tags.add(Tags.OJAMA); this.tags.add(Tags.ARCANE); this.showEvokeValue = true; this.showEvokeOrbCount = 1; this.originalName = this.name; this.tributes = this.baseTributes = 4; this.magicNumber = this.baseMagicNumber = 2; } // Actions the card should do. @Override public void use(AbstractPlayer p, AbstractMonster m) { // Summon tribute(p, this.tributes, false, this); for (int i = 0; i < this.magicNumber; i++) { int randomTurnNum = AbstractDungeon.cardRandomRng.random(MIN_DEBUFF_TURNS_ROLL, MAX_DEBUFF_TURNS_ROLL); applyPower(DebuffHelper.getRandomDebuff(p, m, randomTurnNum), m); } AbstractOrb earth = new Buffer(); channel(earth); } // Which card to return when making a copy of this card. @Override public AbstractCard makeCopy() { return new OjamaBlue(); } // Upgraded stats. @Override public void upgrade() { if (this.canUpgrade()) { if (this.timesUpgraded > 0) { this.upgradeName(NAME + "+" + this.timesUpgraded); } else { this.upgradeName(NAME + "+"); } if (this.timesUpgraded == 1) { this.upgradeBaseCost(1); } else if (this.tributes > 0) { this.upgradeTributes(-1); } else { this.upgradeMagicNumber(1); } this.rawDescription = UPGRADE_DESCRIPTION; this.initializeDescription(); } } @Override public boolean canUpgrade() { if (this.magicNumber <= 9) { return true; } else { return false; } } // If player doesn't have enough summons, can't play card @Override public boolean canUse(AbstractPlayer p, AbstractMonster m) { // Check super canUse() boolean canUse = super.canUse(p, m); if (!canUse) { return false; } // Pumpking & Princess else if (this.misc == 52) { return true; } // Mausoleum check else if (p.hasPower(EmperorPower.POWER_ID)) { EmperorPower empInstance = (EmperorPower)p.getPower(EmperorPower.POWER_ID); if (!empInstance.flag) { return true; } else { if (p.hasPower(SummonPower.POWER_ID)) { int temp = (p.getPower(SummonPower.POWER_ID).amount); if (temp >= this.tributes) { return true; } } } } // Check for # of summons >= tributes else { if (p.hasPower(SummonPower.POWER_ID)) { int temp = (p.getPower(SummonPower.POWER_ID).amount); if (temp >= this.tributes) { return true; } } } // Player doesn't have something required at this point this.cantUseMessage = this.tribString; return false; } @Override public void onTribute(DuelistCard tributingCard) { // TODO Auto-generated method stub } @Override public void onResummon(int summons) { // TODO Auto-generated method stub } @Override public void summonThis(int summons, DuelistCard c, int var) { } @Override public void summonThis(int summons, DuelistCard c, int var, AbstractMonster m) { } @Override public String getID() { return ID; } @Override public void optionSelected(AbstractPlayer arg0, AbstractMonster arg1, int arg2) { // TODO Auto-generated method stub } }
[ "nyoxidetwitter@gmail.com" ]
nyoxidetwitter@gmail.com
45218521224dfb642288e898606ce287de763344
34d9d1dbd41b2781f5d1839367942728ee199c2c
/VectorGraphics/src/org/freehep/swing/graphics/YSkewSelectionPanel.java
9eddfaf852b340ede20c648033720fdc18c329ea
[]
no_license
Intrinsarc/intrinsarc-evolve
4808c0698776252ac07bfb5ed2afddbc087d5e21
4492433668893500ebc78045b6be24f8b3725feb
refs/heads/master
2020-05-23T08:14:14.532184
2015-09-08T23:07:35
2015-09-08T23:07:35
70,294,516
1
1
null
null
null
null
UTF-8
Java
false
false
7,664
java
// Charles A. Loomis, Jr., and University of California, Santa Cruz, // Copyright (c) 2000 package org.freehep.swing.graphics; import java.awt.*; import java.awt.geom.*; import java.util.*; import org.freehep.swing.images.*; /** * A panel which selects a parallogram-shaped region in which two sides are * parallel to the x-axis and the other two are skewed with respect to the * y-axis. * * @author Charles Loomis * @version $Id: YSkewSelectionPanel.java,v 1.1 2009-03-04 22:46:55 andrew Exp $ */ public class YSkewSelectionPanel extends AbstractRegionSelectionPanel { /** * The initial starting width of the skewed rectangle. */ final private static int STARTING_WIDTH = 25; /** * Creates a YSkewSelectionPanel. */ public YSkewSelectionPanel() { super(); } /** * Get the number of control points 6---the four corners and the centerpoints * of the two sides parallel to the x-axis. * * @return 6 the number of control points */ public int getNumberOfControlPoints() { return 6; } public Cursor getControlPointCursor(int index) { int k; switch (index) { case 0 : case 3 : k = 4; break; case 1 : case 2 : k = 5; break; case 4 : case 5 : return FreeHepImage.getCursor("0_MoveCursor", 16, 16); default : return FreeHepImage.getCursor("YSkewCursor"); } return compassCursor("Resize", xCtrlPts[index] - xCtrlPts[k], yCtrlPts[index] - yCtrlPts[k], 4, false); } /** * Initialize the control points based on the starting point (x,y). * * @param x * x-coordinate of the starting point * @param y * y-coordinate of the starting point */ public void initializeControlPoints(int x, int y) { // Set the fifth control point to be the active one and // initialize all of the coordinates. activeCtrlPt = 5; Arrays.fill(yCtrlPts, y); xCtrlPts[0] = x - STARTING_WIDTH; xCtrlPts[1] = x - STARTING_WIDTH; xCtrlPts[2] = x + STARTING_WIDTH; xCtrlPts[3] = x + STARTING_WIDTH; xCtrlPts[4] = x; xCtrlPts[5] = x; } /** * Move the active control point to the point (x,y). * * @param x * x-coordinate of the new point * @param y * y-coordinate of the new point */ public void updateActiveControlPoint(int x, int y) { // Bring the location within bounds. x = forceXCoordinateWithinBounds(x); y = forceYCoordinateWithinBounds(y); // Change what is done depending on which control point is // active. int width; switch (activeCtrlPt) { case 0 : width = x - xCtrlPts[4]; xCtrlPts[0] = xCtrlPts[4] + width; xCtrlPts[1] = xCtrlPts[5] + width; xCtrlPts[2] = xCtrlPts[5] - width; xCtrlPts[3] = xCtrlPts[4] - width; break; case 1 : width = x - xCtrlPts[5]; xCtrlPts[0] = xCtrlPts[4] + width; xCtrlPts[1] = xCtrlPts[5] + width; xCtrlPts[2] = xCtrlPts[5] - width; xCtrlPts[3] = xCtrlPts[4] - width; break; case 2 : width = x - xCtrlPts[5]; xCtrlPts[0] = xCtrlPts[4] - width; xCtrlPts[1] = xCtrlPts[5] - width; xCtrlPts[2] = xCtrlPts[5] + width; xCtrlPts[3] = xCtrlPts[4] + width; break; case 3 : width = x - xCtrlPts[4]; xCtrlPts[0] = xCtrlPts[4] - width; xCtrlPts[1] = xCtrlPts[5] - width; xCtrlPts[2] = xCtrlPts[5] + width; xCtrlPts[3] = xCtrlPts[4] + width; break; case 4 : // Determine the width. width = xCtrlPts[4] - xCtrlPts[0]; // Update the active control point. xCtrlPts[activeCtrlPt] = x; yCtrlPts[activeCtrlPt] = y; // Update the control points on either side. xCtrlPts[0] = x - width; yCtrlPts[0] = y; xCtrlPts[3] = x + width; yCtrlPts[3] = y; break; case 5 : // Determine the width. width = xCtrlPts[4] - xCtrlPts[0]; // Update the active control point. xCtrlPts[activeCtrlPt] = x; yCtrlPts[activeCtrlPt] = y; // Update the control points on either side. xCtrlPts[1] = x - width; yCtrlPts[1] = y; xCtrlPts[2] = x + width; yCtrlPts[2] = y; break; default : break; } repaintPanel(); } public void paintComponent(Graphics g) { // Allow parent to draw any custom painting. super.paintComponent(g); // If the selection region is visible, paint it. if (visible) { // Make a 2D graphics context. Graphics2D g2d = (Graphics2D) g; // Draw a rectangle on top the the image. g2d.setStroke(thickStroke); g.setColor(Color.black); g.drawPolygon(xCtrlPts, yCtrlPts, 4); if (visibleGuides) { g.drawLine(xCtrlPts[4], yCtrlPts[4], xCtrlPts[5], yCtrlPts[5]); } g2d.setStroke(thinStroke); g.setColor(Color.white); g.drawPolygon(xCtrlPts, yCtrlPts, 4); if (visibleGuides) { g.drawLine(xCtrlPts[4], yCtrlPts[4], xCtrlPts[5], yCtrlPts[5]); } // Draw the active control point. if (activeCtrlPt >= 0) { g.setColor(Color.black); g.fillRect(xCtrlPts[activeCtrlPt] - ctrlPtSize - 1, yCtrlPts[activeCtrlPt] - ctrlPtSize - 1, 2 * ctrlPtSize + 3, 2 * ctrlPtSize + 3); g.setColor(Color.white); g.fillRect(xCtrlPts[activeCtrlPt] - ctrlPtSize, yCtrlPts[activeCtrlPt] - ctrlPtSize, 2 * ctrlPtSize + 1, 2 * ctrlPtSize + 1); } } } /** * Make the affine transform which corresponds to this skewed selection. * * @return AffineTransform which describes the selected region */ public AffineTransform makeAffineTransform() { // Find first the upper, left-hand point. This is the one // with the smallest y-value and then the smallest x-value. int first = 0; int xSavedValue = xCtrlPts[first]; int ySavedValue = yCtrlPts[first]; for (int i = 1; i < 4; i++) { int xValue = xCtrlPts[i]; int yValue = yCtrlPts[i]; if (yValue < ySavedValue) { xSavedValue = xValue; ySavedValue = yValue; first = i; } else if (yValue == ySavedValue) { if (xValue < xSavedValue) { xSavedValue = xValue; ySavedValue = yValue; first = i; } } } // Calculate which is the opposite corner. int third = (first + 2) % 4; // Now use the cross-product to determine which of the // remaining points is the one which keep the path going // clockwise. int second = (first + 1) % 4; int dx0 = xCtrlPts[third] - xCtrlPts[first]; int dy0 = yCtrlPts[third] - yCtrlPts[first]; int dx1 = xCtrlPts[second] - xCtrlPts[first]; int dy1 = yCtrlPts[second] - yCtrlPts[first]; if (dx0 * dy1 - dy0 * dx1 > 0) second = (first + 3) % 4; // Now call the utility function of the parent. return makeTransform((double) xCtrlPts[first], (double) yCtrlPts[first], (double) xCtrlPts[second], (double) yCtrlPts[second], (double) xCtrlPts[third], (double) yCtrlPts[third]); } /** * Check that the selection region is valid; regions with zero area are * invalid. * * @return flag indicating whether this region is valid */ public boolean isValidSelection() { return (visible) && (yCtrlPts[4] != yCtrlPts[5]) && (xCtrlPts[0] != xCtrlPts[3]); } }
[ "devnull@localhost" ]
devnull@localhost
35b4ef58974322a9803e2c54fd36af4570d1772f
4da9097315831c8639a8491e881ec97fdf74c603
/src/StockIT-v2-release_source_from_JADX/sources/com/google/android/gms/internal/ads/zzaan.java
cf82da19b223c0b08bd188eb3c94ab52228f4efc
[ "Apache-2.0" ]
permissive
atul-vyshnav/2021_IBM_Code_Challenge_StockIT
5c3c11af285cf6f032b7c207e457f4c9a5b0c7e1
25c26a4cc59a3f3e575f617b59acc202ee6ee48a
refs/heads/main
2023-08-11T06:17:05.659651
2021-10-01T08:48:06
2021-10-01T08:48:06
410,595,708
1
1
null
null
null
null
UTF-8
Java
false
false
208
java
package com.google.android.gms.internal.ads; import java.util.List; /* compiled from: com.google.android.gms:play-services-ads@@19.4.0 */ public interface zzaan { List<String> zzf(List<String> list); }
[ "57108396+atul-vyshnav@users.noreply.github.com" ]
57108396+atul-vyshnav@users.noreply.github.com
5b46fcb19d202a0f342c2de5a0d24d2549b60c5f
e78909704a47ac3bdf62eeddbb0d5dda765c3e51
/src/MnogomernyMassivTable33.java
ce11293021cdc071f7e990443c14218d8b9bac9b
[]
no_license
erfaenda/Nerd
9b6c875072e5bd82ab18ccaa076de31feda9e8cc
22b3b77c0f2e17aead10a38da5c60749982c492d
refs/heads/master
2021-01-19T11:34:32.605391
2017-04-06T10:17:23
2017-04-06T10:17:23
82,209,460
0
0
null
null
null
null
UTF-8
Java
false
false
1,740
java
/** * Created by alex on 21.02.17. */ public class MnogomernyMassivTable33 { public static void main(String[] args) { int massiv1[][] = {{46,3,12,78},{11,2,333,1}}; //создан двумерный массив, инициализирован двумерный массив int massiv2[][] = {{12,33},{1},{15,22,62,11,2}}; //создан трехмерный массив, с разной длинной строк System.out.println("Это первый массив:");//сообщение о выводе массива 1 massiv(massiv1); //использовали метод massiv описанный ниже System.out.println("Это второй массив:"); massiv(massiv2); } public static void massiv(int m[][]) { //создаем метод с параметрами, числовой ммногомерный массив for (int i = 0; i < m.length; i++) { //цикл перебирает с первого элемента строки до последнего for (int y = 0; y < m[i].length; y++) { //цикл переберает с первого до последнего елемента столбца в строке 0 потом в строке 1 System.out.print(m[i][y] + "\t"); // выводит первый елемент строки и столбца, табуляция, повторяет пока не кончаться элементы в троке } System.out.println();// элементы в строке закончились цикл выше закончился, теперь заканчиваеться первый цикл for отступ } } }
[ "regalko7@gmail.com" ]
regalko7@gmail.com
e849395c0a432beb55b20e26594f8b6984948646
508b117a95cde9e30506231f3d006087811c94f4
/src/smarttrashcan/HailMall.java
d72523b041fb329cbb99fb8c1fb108688647dd6f
[]
no_license
aalsomali/SmartTrashCan
08dc8c41f744dd7bf32ae691007d0f8337e8f293
285be4beb41ed06a74c9f62cc1d39b6b1e091f74
refs/heads/master
2023-03-15T01:52:04.441561
2021-03-27T17:58:16
2021-03-27T17:58:16
352,076,142
0
0
null
null
null
null
UTF-8
Java
false
false
10,689
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package smarttrashcan; /** * * @author milo */ public class HailMall extends javax.swing.JFrame { /** * Creates new form HailMall */ int per; public HailMall() { initComponents(); per = Integer.parseInt(number.getText()); System.out.println(per); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { locButton = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); signout = new javax.swing.JLabel(); profile = new javax.swing.JLabel(); about = new javax.swing.JLabel(); contactUs = new javax.swing.JLabel(); mapIcon = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); locButton1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); number = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); bg = new javax.swing.JLabel(); locButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/go to location.jpg"))); // NOI18N setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setPreferredSize(new java.awt.Dimension(390, 844)); jPanel1.setLayout(null); signout.setText("Sign Out"); signout.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { signoutMouseClicked(evt); } }); jPanel1.add(signout); signout.setBounds(160, 10, 49, 30); profile.setText("Profile"); profile.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { profileMouseClicked(evt); } }); jPanel1.add(profile); profile.setBounds(220, 10, 41, 30); about.setText("About"); about.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { aboutMouseClicked(evt); } }); jPanel1.add(about); about.setBounds(270, 10, 41, 30); contactUs.setText("Contact Us"); contactUs.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { contactUsMouseClicked(evt); } }); jPanel1.add(contactUs); contactUs.setBounds(320, 10, 70, 30); mapIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Mask Group 2.jpg"))); // NOI18N jPanel1.add(mapIcon); mapIcon.setBounds(30, 120, 50, 50); jPanel2.setBackground(new java.awt.Color(240, 254, 222)); jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); jPanel2.setLayout(null); jLabel4.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N jLabel4.setText("Hail Mall"); jPanel2.add(jLabel4); jLabel4.setBounds(20, 30, 100, 30); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N jLabel5.setText("2.1 km"); jPanel2.add(jLabel5); jLabel5.setBounds(321, 40, 50, 20); jPanel1.add(jPanel2); jPanel2.setBounds(0, 210, 390, 0); jPanel3.setMaximumSize(new java.awt.Dimension(390, 310)); jPanel3.setPreferredSize(new java.awt.Dimension(390, 310)); jPanel3.setLayout(null); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Map.jpg"))); // NOI18N jPanel3.add(jLabel6); jLabel6.setBounds(0, 0, 390, 310); jPanel1.add(jPanel3); jPanel3.setBounds(0, 340, 390, 310); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setText("Fill Level:"); jPanel1.add(jLabel2); jLabel2.setBounds(10, 660, 70, 30); locButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/go to location.jpg"))); // NOI18N locButton1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { locButton1MouseClicked(evt); } }); jPanel1.add(locButton1); locButton1.setBounds(100, 710, 180, 70); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/back-arrow.jpg"))); // NOI18N jPanel1.add(jLabel1); jLabel1.setBounds(20, 10, 80, 40); number.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N number.setText("100"); jPanel1.add(number); number.setBounds(90, 660, 40, 30); jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel3.setText("%"); jPanel1.add(jLabel3); jLabel3.setBounds(130, 670, 41, 16); bg.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Rectangle 1.jpg"))); // NOI18N jPanel1.add(bg); bg.setBounds(0, 0, 390, 844); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void signoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_signoutMouseClicked this.dispose(); new Login().setVisible(true); }//GEN-LAST:event_signoutMouseClicked private void profileMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_profileMouseClicked this.dispose(); new ThrowProf().setVisible(true); }//GEN-LAST:event_profileMouseClicked private void aboutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_aboutMouseClicked this.dispose(); About a = new About(); a.setVisible(true); }//GEN-LAST:event_aboutMouseClicked private void contactUsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_contactUsMouseClicked this.dispose(); new ContactUs().setVisible(true); }//GEN-LAST:event_contactUsMouseClicked private void locButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_locButton1MouseClicked if(per>=90){ this.dispose(); HailMallLoc hml = new HailMallLoc(); hml.setVisible(true); } else { new NotFullNotif().setVisible(true); } System.out.println(per); }//GEN-LAST:event_locButton1MouseClicked /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(HailMall.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(HailMall.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(HailMall.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(HailMall.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new HailMall().setVisible(true); } }); } public void setPercent(int percent){ per = percent; } public int getPercent(){ return per; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel about; private javax.swing.JLabel bg; private javax.swing.JLabel contactUs; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JLabel locButton; private javax.swing.JLabel locButton1; private javax.swing.JLabel mapIcon; private javax.swing.JLabel number; private javax.swing.JLabel profile; private javax.swing.JLabel signout; // End of variables declaration//GEN-END:variables }
[ "79758265+aalsomali@users.noreply.github.com" ]
79758265+aalsomali@users.noreply.github.com
4e1593fe01281c6c686d22600608df90a3a592a4
732e4074ee44d733445ca2655e49959858e61ff2
/gen/com/whu/readshare/R.java
ddd3ceb0f78e998b5dc7404a5d7a81699c8d7f0e
[]
no_license
LiaoLi327/ReadShare
f467bcc53dc5f332cb1ee58788fb1cf5fe61b80b
0c6889eeed63965845c98d24f4f60aca128aa1b8
refs/heads/master
2021-05-05T09:12:05.493422
2017-10-08T15:30:53
2017-10-08T15:30:53
105,780,840
0
0
null
null
null
null
UTF-8
Java
false
false
169,468
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.whu.readshare; public final class R { public static final class anim { public static final int abc_fade_in=0x7f040000; public static final int abc_fade_out=0x7f040001; public static final int abc_slide_in_bottom=0x7f040002; public static final int abc_slide_in_top=0x7f040003; public static final int abc_slide_out_bottom=0x7f040004; public static final int abc_slide_out_top=0x7f040005; public static final int push_up_in=0x7f040006; public static final int push_up_out=0x7f040007; public static final int slide_left_in=0x7f040008; public static final int slide_left_out=0x7f040009; public static final int slide_right_in=0x7f04000a; public static final int slide_right_out=0x7f04000b; } public static final class attr { /** Custom divider drawable to use for elements in the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarDivider=0x7f01000b; /** Custom item state list drawable background for action bar items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarItemBackground=0x7f01000c; /** Size of the Action Bar, including the contextual bar used to present Action Modes. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int actionBarSize=0x7f01000a; /** Reference to a theme that should be used to inflate widgets and layouts destined for the action bar. Most of the time this will be a reference to the current theme, but when the action bar has a significantly different contrast profile than the rest of the activity the difference can become important. If this is set to @null the current theme will be used. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarSplitStyle=0x7f010008; /** Reference to a style for the Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarStyle=0x7f010007; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarTabBarStyle=0x7f010004; /** Default style for tabs within an action bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarTabStyle=0x7f010003; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarTabTextStyle=0x7f010005; /** Reference to a theme that should be used to inflate widgets and layouts destined for the action bar. Most of the time this will be a reference to the current theme, but when the action bar has a significantly different contrast profile than the rest of the activity the difference can become important. If this is set to @null the current theme will be used. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarWidgetTheme=0x7f010009; /** Default action button style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionButtonStyle=0x7f010012; /** Default ActionBar dropdown style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionDropDownStyle=0x7f010043; /** An optional layout to be used as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionLayout=0x7f01004a; /** TextAppearance style that will be applied to text that appears within action menu items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionMenuTextAppearance=0x7f01000d; /** Color for text that appears within action menu items. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int actionMenuTextColor=0x7f01000e; /** Background drawable to use for action mode UI <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeBackground=0x7f010038; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCloseButtonStyle=0x7f010037; /** Drawable to use for the close action mode button <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCloseDrawable=0x7f01003a; /** Drawable to use for the Copy action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCopyDrawable=0x7f01003c; /** Drawable to use for the Cut action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCutDrawable=0x7f01003b; /** Drawable to use for the Find action button in WebView selection action modes <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeFindDrawable=0x7f010040; /** Drawable to use for the Paste action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModePasteDrawable=0x7f01003d; /** PopupWindow style to use for action modes when showing as a window overlay. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModePopupWindowStyle=0x7f010042; /** Drawable to use for the Select all action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeSelectAllDrawable=0x7f01003e; /** Drawable to use for the Share action button in WebView selection action modes <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeShareDrawable=0x7f01003f; /** Background drawable to use for action mode UI in the lower split bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeSplitBackground=0x7f010039; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeStyle=0x7f010036; /** Drawable to use for the Web Search action button in WebView selection action modes <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeWebSearchDrawable=0x7f010041; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionOverflowButtonStyle=0x7f010006; /** The name of an optional ActionProvider class to instantiate an action view and perform operations such as default action for that menu item. See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int actionProviderClass=0x7f01004c; /** The name of an optional View class to instantiate and use as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int actionViewClass=0x7f01004b; /** Default ActivityChooserView style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int activityChooserViewStyle=0x7f010068; /** Specifies a background drawable for the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int background=0x7f01002b; /** Specifies a background drawable for the bottom component of a split action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int backgroundSplit=0x7f01002d; /** Specifies a background drawable for a second stacked row of the action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int backgroundStacked=0x7f01002c; /** A style that may be applied to Buttons placed within a LinearLayout with the style buttonBarStyle to form a button bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int buttonBarButtonStyle=0x7f010014; /** A style that may be applied to horizontal LinearLayouts to form a button bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int buttonBarStyle=0x7f010013; /** Specifies a layout for custom navigation. Overrides navigationMode. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int customNavigationLayout=0x7f01002e; /** Whether this spinner should mark child views as enabled/disabled when the spinner itself is enabled/disabled. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int disableChildrenWhenDisabled=0x7f010050; /** Options affecting how the action bar is displayed. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr> <tr><td><code>showHome</code></td><td>0x2</td><td></td></tr> <tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr> <tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr> <tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr> <tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr> </table> */ public static final int displayOptions=0x7f010024; /** Specifies the drawable used for item dividers. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int divider=0x7f01002a; /** A drawable that may be used as a horizontal divider between visual elements. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int dividerHorizontal=0x7f010017; /** Size of padding on either end of a divider. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int dividerPadding=0x7f010052; /** A drawable that may be used as a vertical divider between visual elements. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int dividerVertical=0x7f010016; /** ListPopupWindow comaptibility <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int dropDownListViewStyle=0x7f01001d; /** The preferred item height for dropdown lists. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int dropdownListPreferredItemHeight=0x7f010044; /** The drawable to show in the button for expanding the activities overflow popup. <strong>Note:</strong> Clients would like to set this drawable as a clue about the action the chosen activity will perform. For example, if share activity is to be chosen the drawable should give a clue that sharing is to be performed. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int expandActivityOverflowButtonDrawable=0x7f010067; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int height=0x7f010022; /** Specifies a drawable to use for the 'home as up' indicator. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int homeAsUpIndicator=0x7f01000f; /** Specifies a layout to use for the "home" section of the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int homeLayout=0x7f01002f; /** Specifies the drawable used for the application icon. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int icon=0x7f010028; /** The default state of the SearchView. If true, it will be iconified when not in use and expanded when clicked. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int iconifiedByDefault=0x7f010056; /** Specifies a style resource to use for an indeterminate progress spinner. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int indeterminateProgressStyle=0x7f010031; /** The maximal number of items initially shown in the activity list. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int initialActivityCount=0x7f010066; /** Specifies whether the theme is light, otherwise it is dark. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int isLightTheme=0x7f010055; /** Specifies padding that should be applied to the left and right sides of system-provided items in the bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int itemPadding=0x7f010033; /** Drawable used as a background for selected list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int listChoiceBackgroundIndicator=0x7f010048; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int listPopupWindowStyle=0x7f01001e; /** The preferred list item height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemHeight=0x7f010018; /** A larger, more robust list item height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemHeightLarge=0x7f01001a; /** A smaller, sleeker list item height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemHeightSmall=0x7f010019; /** The preferred padding along the left edge of list items. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemPaddingLeft=0x7f01001b; /** The preferred padding along the right edge of list items. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemPaddingRight=0x7f01001c; /** Specifies the drawable used for the application logo. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int logo=0x7f010029; /** The type of navigation to use. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>normal</code></td><td>0</td><td> Normal static title text </td></tr> <tr><td><code>listMode</code></td><td>1</td><td> The action bar will use a selection list for navigation. </td></tr> <tr><td><code>tabMode</code></td><td>2</td><td> The action bar will use a series of horizontal tabs for navigation. </td></tr> </table> */ public static final int navigationMode=0x7f010023; /** Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int paddingEnd=0x7f010035; /** Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int paddingStart=0x7f010034; /** Default Panel Menu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int panelMenuListTheme=0x7f010047; /** Default Panel Menu width. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int panelMenuListWidth=0x7f010046; /** Default PopupMenu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int popupMenuStyle=0x7f010045; /** Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown". This layout must contain a TextView with the id {@code @android:id/text1} to be populated with the prompt text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int popupPromptView=0x7f01004f; /** Specifies the horizontal padding on either end for an embedded progress bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progressBarPadding=0x7f010032; /** Specifies a style resource to use for an embedded progress bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int progressBarStyle=0x7f010030; /** The prompt to display when the spinner's dialog is shown. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int prompt=0x7f01004d; /** An optional query hint string to be displayed in the empty query field. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int queryHint=0x7f010057; /** SearchView dropdown background <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchDropdownBackground=0x7f010058; /** The list item height for search results. @hide <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int searchResultListItemHeight=0x7f010061; /** SearchView AutoCompleteTextView style <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewAutoCompleteTextView=0x7f010065; /** SearchView close button icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewCloseIcon=0x7f010059; /** SearchView query refinement icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewEditQuery=0x7f01005d; /** SearchView query refinement icon background <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewEditQueryBackground=0x7f01005e; /** SearchView Go button icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewGoIcon=0x7f01005a; /** SearchView Search icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewSearchIcon=0x7f01005b; /** SearchView text field background for the left section <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewTextField=0x7f01005f; /** SearchView text field background for the right section <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewTextFieldRight=0x7f010060; /** SearchView Voice button icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewVoiceIcon=0x7f01005c; /** A style that may be applied to buttons or other selectable items that should react to pressed and focus states, but that do not have a clear visual border along the edges. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int selectableItemBackground=0x7f010015; /** How this item should display in the Action Bar, if present. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>never</code></td><td>0</td><td> Never show this item in an action bar, show it in the overflow menu instead. Mutually exclusive with "ifRoom" and "always". </td></tr> <tr><td><code>ifRoom</code></td><td>1</td><td> Show this item in an action bar if there is room for it as determined by the system. Favor this option over "always" where possible. Mutually exclusive with "never" and "always". </td></tr> <tr><td><code>always</code></td><td>2</td><td> Always show this item in an actionbar, even if it would override the system's limits of how much stuff to put there. This may make your action bar look bad on some screens. In most cases you should use "ifRoom" instead. Mutually exclusive with "ifRoom" and "never". </td></tr> <tr><td><code>withText</code></td><td>4</td><td> When this item is shown as an action in the action bar, show a text label with it even if it has an icon representation. </td></tr> <tr><td><code>collapseActionView</code></td><td>8</td><td> This item's action view collapses to a normal menu item. When expanded, the action view takes over a larger segment of its container. </td></tr> </table> */ public static final int showAsAction=0x7f010049; /** Setting for which dividers to show. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>none</code></td><td>0</td><td></td></tr> <tr><td><code>beginning</code></td><td>1</td><td></td></tr> <tr><td><code>middle</code></td><td>2</td><td></td></tr> <tr><td><code>end</code></td><td>4</td><td></td></tr> </table> */ public static final int showDividers=0x7f010051; /** Default Spinner style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int spinnerDropDownItemStyle=0x7f010054; /** Display mode for spinner options. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>dialog</code></td><td>0</td><td> Spinner options will be presented to the user as a dialog window. </td></tr> <tr><td><code>dropdown</code></td><td>1</td><td> Spinner options will be presented to the user as an inline dropdown anchored to the spinner widget itself. </td></tr> </table> */ public static final int spinnerMode=0x7f01004e; /** Default Spinner style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int spinnerStyle=0x7f010053; /** Specifies subtitle text used for navigationMode="normal" <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int subtitle=0x7f010025; /** Specifies a style to use for subtitle text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int subtitleTextStyle=0x7f010027; /** Present the text in ALL CAPS. This may use a small-caps form when available. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int textAllCaps=0x7f010069; /** Text color, typeface, size, and style for the text inside of a popup menu. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceLargePopupMenu=0x7f010010; /** The preferred TextAppearance for the primary text of list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceListItem=0x7f01001f; /** The preferred TextAppearance for the primary text of small list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceListItemSmall=0x7f010020; /** Text color, typeface, size, and style for system search result subtitle. Defaults to primary inverse text color. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceSearchResultSubtitle=0x7f010063; /** Text color, typeface, size, and style for system search result title. Defaults to primary inverse text color. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceSearchResultTitle=0x7f010062; /** Text color, typeface, size, and style for small text inside of a popup menu. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceSmallPopupMenu=0x7f010011; /** Text color for urls in search suggestions, used by things like global search <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int textColorSearchUrl=0x7f010064; /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int title=0x7f010021; /** Specifies a style to use for title text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int titleTextStyle=0x7f010026; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowActionBar=0x7f010000; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowActionBarOverlay=0x7f010001; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowSplitActionBar=0x7f010002; } public static final class bool { public static final int abc_action_bar_embed_tabs_pre_jb=0x7f060000; public static final int abc_action_bar_expanded_action_views_exclusive=0x7f060001; /** Whether action menu items should be displayed in ALLCAPS or not. Defaults to true. If this is not appropriate for specific locales it should be disabled in that locale's resources. */ public static final int abc_config_actionMenuItemAllCaps=0x7f060005; /** Whether action menu items should obey the "withText" showAsAction flag. This may be set to false for situations where space is extremely limited. Whether action menu items should obey the "withText" showAsAction. This may be set to false for situations where space is extremely limited. */ public static final int abc_config_allowActionMenuItemTextWithIcon=0x7f060004; public static final int abc_config_showMenuShortcutsWhenKeyboardPresent=0x7f060003; public static final int abc_split_action_bar_is_narrow=0x7f060002; } public static final class color { public static final int Orange=0x7f070004; public static final int White=0x7f070003; public static final int abc_search_url_text_holo=0x7f07000d; public static final int abc_search_url_text_normal=0x7f070000; public static final int abc_search_url_text_pressed=0x7f070002; public static final int abc_search_url_text_selected=0x7f070001; public static final int black=0x7f070009; public static final int dimgray=0x7f07000c; public static final int gray=0x7f07000b; public static final int green=0x7f07000a; public static final int radiobtn=0x7f070008; public static final int select=0x7f070005; public static final int textcolor=0x7f070007; public static final int unselect=0x7f070006; } public static final class dimen { /** Default height of an action bar. Default height of an action bar. Default height of an action bar. Default height of an action bar. Default height of an action bar. */ public static final int abc_action_bar_default_height=0x7f080002; /** Vertical padding around action bar icons. Vertical padding around action bar icons. Vertical padding around action bar icons. Vertical padding around action bar icons. Vertical padding around action bar icons. */ public static final int abc_action_bar_icon_vertical_padding=0x7f080003; /** Size of the indeterminate Progress Bar Size of the indeterminate Progress Bar */ public static final int abc_action_bar_progress_bar_size=0x7f08000a; /** Maximum height for a stacked tab bar as part of an action bar */ public static final int abc_action_bar_stacked_max_height=0x7f080009; /** Maximum width for a stacked action bar tab. This prevents action bar tabs from becoming too wide on a wide screen when only a few are present. */ public static final int abc_action_bar_stacked_tab_max_width=0x7f080001; /** Bottom margin for action bar subtitles Bottom margin for action bar subtitles Bottom margin for action bar subtitles Bottom margin for action bar subtitles Bottom margin for action bar subtitles */ public static final int abc_action_bar_subtitle_bottom_margin=0x7f080007; /** Text size for action bar subtitles Text size for action bar subtitles Text size for action bar subtitles Text size for action bar subtitles Text size for action bar subtitles */ public static final int abc_action_bar_subtitle_text_size=0x7f080005; /** Top margin for action bar subtitles Top margin for action bar subtitles Top margin for action bar subtitles Top margin for action bar subtitles Top margin for action bar subtitles */ public static final int abc_action_bar_subtitle_top_margin=0x7f080006; /** Text size for action bar titles Text size for action bar titles Text size for action bar titles Text size for action bar titles Text size for action bar titles */ public static final int abc_action_bar_title_text_size=0x7f080004; /** Minimum width for an action button in the menu area of an action bar Minimum width for an action button in the menu area of an action bar Minimum width for an action button in the menu area of an action bar */ public static final int abc_action_button_min_width=0x7f080008; /** The maximum width we would prefer dialogs to be. 0 if there is no maximum (let them grow as large as the screen). Actual values are specified for -large and -xlarge configurations. see comment in values/config.xml see comment in values/config.xml */ public static final int abc_config_prefDialogWidth=0x7f080000; /** Width of the icon in a dropdown list */ public static final int abc_dropdownitem_icon_width=0x7f080010; /** Text padding for dropdown items */ public static final int abc_dropdownitem_text_padding_left=0x7f08000e; public static final int abc_dropdownitem_text_padding_right=0x7f08000f; public static final int abc_panel_menu_list_width=0x7f08000b; /** Preferred width of the search view. */ public static final int abc_search_view_preferred_width=0x7f08000d; /** Minimum width of the search view text entry area. Minimum width of the search view text entry area. Minimum width of the search view text entry area. Minimum width of the search view text entry area. */ public static final int abc_search_view_text_min_width=0x7f08000c; /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f080011; public static final int activity_vertical_margin=0x7f080012; } public static final class drawable { public static final int abc_ab_bottom_solid_dark_holo=0x7f020000; public static final int abc_ab_bottom_solid_light_holo=0x7f020001; public static final int abc_ab_bottom_transparent_dark_holo=0x7f020002; public static final int abc_ab_bottom_transparent_light_holo=0x7f020003; public static final int abc_ab_share_pack_holo_dark=0x7f020004; public static final int abc_ab_share_pack_holo_light=0x7f020005; public static final int abc_ab_solid_dark_holo=0x7f020006; public static final int abc_ab_solid_light_holo=0x7f020007; public static final int abc_ab_stacked_solid_dark_holo=0x7f020008; public static final int abc_ab_stacked_solid_light_holo=0x7f020009; public static final int abc_ab_stacked_transparent_dark_holo=0x7f02000a; public static final int abc_ab_stacked_transparent_light_holo=0x7f02000b; public static final int abc_ab_transparent_dark_holo=0x7f02000c; public static final int abc_ab_transparent_light_holo=0x7f02000d; public static final int abc_cab_background_bottom_holo_dark=0x7f02000e; public static final int abc_cab_background_bottom_holo_light=0x7f02000f; public static final int abc_cab_background_top_holo_dark=0x7f020010; public static final int abc_cab_background_top_holo_light=0x7f020011; public static final int abc_ic_ab_back_holo_dark=0x7f020012; public static final int abc_ic_ab_back_holo_light=0x7f020013; public static final int abc_ic_cab_done_holo_dark=0x7f020014; public static final int abc_ic_cab_done_holo_light=0x7f020015; public static final int abc_ic_clear=0x7f020016; public static final int abc_ic_clear_disabled=0x7f020017; public static final int abc_ic_clear_holo_light=0x7f020018; public static final int abc_ic_clear_normal=0x7f020019; public static final int abc_ic_clear_search_api_disabled_holo_light=0x7f02001a; public static final int abc_ic_clear_search_api_holo_light=0x7f02001b; public static final int abc_ic_commit_search_api_holo_dark=0x7f02001c; public static final int abc_ic_commit_search_api_holo_light=0x7f02001d; public static final int abc_ic_go=0x7f02001e; public static final int abc_ic_go_search_api_holo_light=0x7f02001f; public static final int abc_ic_menu_moreoverflow_normal_holo_dark=0x7f020020; public static final int abc_ic_menu_moreoverflow_normal_holo_light=0x7f020021; public static final int abc_ic_menu_share_holo_dark=0x7f020022; public static final int abc_ic_menu_share_holo_light=0x7f020023; public static final int abc_ic_search=0x7f020024; public static final int abc_ic_search_api_holo_light=0x7f020025; public static final int abc_ic_voice_search=0x7f020026; public static final int abc_ic_voice_search_api_holo_light=0x7f020027; public static final int abc_item_background_holo_dark=0x7f020028; public static final int abc_item_background_holo_light=0x7f020029; public static final int abc_list_divider_holo_dark=0x7f02002a; public static final int abc_list_divider_holo_light=0x7f02002b; public static final int abc_list_divider_mtrl_alpha=0x7f02002c; public static final int abc_list_focused_holo=0x7f02002d; public static final int abc_list_longpressed_holo=0x7f02002e; public static final int abc_list_pressed_holo_dark=0x7f02002f; public static final int abc_list_pressed_holo_light=0x7f020030; public static final int abc_list_selector_background_transition_holo_dark=0x7f020031; public static final int abc_list_selector_background_transition_holo_light=0x7f020032; public static final int abc_list_selector_disabled_holo_dark=0x7f020033; public static final int abc_list_selector_disabled_holo_light=0x7f020034; public static final int abc_list_selector_holo_dark=0x7f020035; public static final int abc_list_selector_holo_light=0x7f020036; public static final int abc_menu_dropdown_panel_holo_dark=0x7f020037; public static final int abc_menu_dropdown_panel_holo_light=0x7f020038; public static final int abc_menu_hardkey_panel_holo_dark=0x7f020039; public static final int abc_menu_hardkey_panel_holo_light=0x7f02003a; public static final int abc_search_dropdown_dark=0x7f02003b; public static final int abc_search_dropdown_light=0x7f02003c; public static final int abc_spinner_ab_default_holo_dark=0x7f02003d; public static final int abc_spinner_ab_default_holo_light=0x7f02003e; public static final int abc_spinner_ab_disabled_holo_dark=0x7f02003f; public static final int abc_spinner_ab_disabled_holo_light=0x7f020040; public static final int abc_spinner_ab_focused_holo_dark=0x7f020041; public static final int abc_spinner_ab_focused_holo_light=0x7f020042; public static final int abc_spinner_ab_holo_dark=0x7f020043; public static final int abc_spinner_ab_holo_light=0x7f020044; public static final int abc_spinner_ab_pressed_holo_dark=0x7f020045; public static final int abc_spinner_ab_pressed_holo_light=0x7f020046; public static final int abc_tab_indicator_ab_holo=0x7f020047; public static final int abc_tab_selected_focused_holo=0x7f020048; public static final int abc_tab_selected_holo=0x7f020049; public static final int abc_tab_selected_pressed_holo=0x7f02004a; public static final int abc_tab_unselected_pressed_holo=0x7f02004b; public static final int abc_textfield_search_default_holo_dark=0x7f02004c; public static final int abc_textfield_search_default_holo_light=0x7f02004d; public static final int abc_textfield_search_right_default_holo_dark=0x7f02004e; public static final int abc_textfield_search_right_default_holo_light=0x7f02004f; public static final int abc_textfield_search_right_selected_holo_dark=0x7f020050; public static final int abc_textfield_search_right_selected_holo_light=0x7f020051; public static final int abc_textfield_search_selected_holo_dark=0x7f020052; public static final int abc_textfield_search_selected_holo_light=0x7f020053; public static final int abc_textfield_searchview_holo_dark=0x7f020054; public static final int abc_textfield_searchview_holo_light=0x7f020055; public static final int abc_textfield_searchview_right_holo_dark=0x7f020056; public static final int abc_textfield_searchview_right_holo_light=0x7f020057; public static final int background_img_login_light=0x7f020058; public static final int btn_login=0x7f020059; public static final int card_background=0x7f02005a; public static final int card_background_selector=0x7f02005b; public static final int card_state_pressed=0x7f02005c; public static final int divider_shadow=0x7f02005d; public static final int ic_admire_edit_desc=0x7f02005e; public static final int ic_bar_back_green=0x7f02005f; public static final int ic_group_comment_0=0x7f020060; public static final int ic_launcher=0x7f020061; public static final int ic_liked=0x7f020062; public static final int ic_menu_reply=0x7f020063; public static final int ic_send_disabled=0x7f020064; public static final int ic_send_focused=0x7f020065; public static final int ic_tab_bbs_active=0x7f020066; public static final int ic_tab_bbs_normal=0x7f020067; public static final int ic_tab_find_active=0x7f020068; public static final int ic_tab_find_normal=0x7f020069; public static final int ic_tab_self_active=0x7f02006a; public static final int ic_tab_self_normal=0x7f02006b; public static final int ic_user_info_gender=0x7f02006c; public static final int icon=0x7f02006d; public static final int live_back_icon=0x7f02006e; public static final int qiqiu=0x7f02006f; public static final int rd__divider_line=0x7f020070; public static final int rounded_edittext=0x7f020071; public static final int school_img=0x7f020072; public static final int select_bbs=0x7f020073; public static final int select_find=0x7f020074; public static final int select_self=0x7f020075; public static final int select_tab_textview=0x7f020076; public static final int selector_tab_background=0x7f020077; public static final int status_topic_bg_default=0x7f020078; } public static final class id { public static final int action_bar=0x7f05001c; public static final int action_bar_activity_content=0x7f050015; public static final int action_bar_container=0x7f05001b; public static final int action_bar_overlay_layout=0x7f05001f; public static final int action_bar_root=0x7f05001a; public static final int action_bar_subtitle=0x7f050023; public static final int action_bar_title=0x7f050022; public static final int action_context_bar=0x7f05001d; public static final int action_menu_divider=0x7f050016; public static final int action_menu_presenter=0x7f050017; public static final int action_mode_close_button=0x7f050024; public static final int action_settings=0x7f050058; public static final int activity_chooser_view_content=0x7f050025; public static final int ad_list=0x7f050055; public static final int always=0x7f05000b; public static final int bar_back=0x7f05003c; public static final int bar_text=0x7f05003d; public static final int bbs_listview=0x7f050053; public static final int beginning=0x7f050011; public static final int btn_login=0x7f050046; public static final int btn_register=0x7f05004f; public static final int checkbox=0x7f05002d; public static final int collapseActionView=0x7f05000d; public static final int container=0x7f050052; public static final int content=0x7f050041; public static final int content_pager=0x7f050048; public static final int content_send=0x7f05003e; public static final int default_activity_button=0x7f050028; public static final int dialog=0x7f05000e; public static final int disableHome=0x7f050008; public static final int dropdown=0x7f05000f; public static final int edit_content=0x7f050043; public static final int edit_img=0x7f050056; public static final int edit_query=0x7f050030; public static final int edit_title=0x7f050042; public static final int end=0x7f050013; public static final int expand_activities_button=0x7f050026; public static final int expanded_menu=0x7f05002c; public static final int home=0x7f050014; public static final int homeAsUp=0x7f050005; public static final int icon=0x7f05002a; public static final int ifRoom=0x7f05000a; public static final int image=0x7f050027; public static final int input_password=0x7f05004d; public static final int input_readfeel=0x7f05004a; public static final int input_username=0x7f05004c; public static final int listMode=0x7f050001; public static final int list_item=0x7f050029; public static final int middle=0x7f050012; public static final int never=0x7f050009; public static final int none=0x7f050010; public static final int normal=0x7f050000; public static final int password=0x7f050045; public static final int progress_circular=0x7f050018; public static final int progress_horizontal=0x7f050019; public static final int radio=0x7f05002f; public static final int readfeel_list=0x7f050049; public static final int readfeel_send=0x7f05004b; public static final int reinput_password=0x7f05004e; public static final int school_img=0x7f050044; public static final int search_badge=0x7f050032; public static final int search_bar=0x7f050031; public static final int search_button=0x7f050033; public static final int search_close_btn=0x7f050038; public static final int search_edit_frame=0x7f050034; public static final int search_go_btn=0x7f05003a; public static final int search_mag_icon=0x7f050035; public static final int search_plate=0x7f050036; public static final int search_src_text=0x7f050037; public static final int search_voice_btn=0x7f05003b; public static final int shortcut=0x7f05002e; public static final int showCustom=0x7f050007; public static final int showHome=0x7f050004; public static final int showTitle=0x7f050006; public static final int split_action_bar=0x7f05001e; public static final int submit_area=0x7f050039; public static final int tabMode=0x7f050002; public static final int tab_imageview=0x7f050050; public static final int tab_textview=0x7f050051; public static final int title=0x7f05002b; public static final int top_action_bar=0x7f050020; public static final int txt_content=0x7f050057; public static final int txt_register=0x7f050047; public static final int up=0x7f050021; public static final int useLogo=0x7f050003; public static final int user_img=0x7f05003f; public static final int username=0x7f050040; public static final int vb=0x7f050054; public static final int withText=0x7f05000c; } public static final class integer { /** The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. */ public static final int abc_max_action_buttons=0x7f090000; } public static final class layout { public static final int abc_action_bar_decor=0x7f030000; public static final int abc_action_bar_decor_include=0x7f030001; public static final int abc_action_bar_decor_overlay=0x7f030002; public static final int abc_action_bar_home=0x7f030003; public static final int abc_action_bar_tab=0x7f030004; public static final int abc_action_bar_tabbar=0x7f030005; public static final int abc_action_bar_title_item=0x7f030006; public static final int abc_action_bar_view_list_nav_layout=0x7f030007; public static final int abc_action_menu_item_layout=0x7f030008; public static final int abc_action_menu_layout=0x7f030009; public static final int abc_action_mode_bar=0x7f03000a; public static final int abc_action_mode_close_item=0x7f03000b; public static final int abc_activity_chooser_view=0x7f03000c; public static final int abc_activity_chooser_view_include=0x7f03000d; public static final int abc_activity_chooser_view_list_item=0x7f03000e; public static final int abc_expanded_menu_layout=0x7f03000f; public static final int abc_list_menu_item_checkbox=0x7f030010; public static final int abc_list_menu_item_icon=0x7f030011; public static final int abc_list_menu_item_layout=0x7f030012; public static final int abc_list_menu_item_radio=0x7f030013; public static final int abc_popup_menu_item_layout=0x7f030014; public static final int abc_search_dropdown_item_icons_2line=0x7f030015; public static final int abc_search_view=0x7f030016; public static final int activity_content_details=0x7f030017; public static final int activity_edit_content=0x7f030018; public static final int activity_login=0x7f030019; public static final int activity_main=0x7f03001a; public static final int activity_readfeel=0x7f03001b; public static final int activity_register=0x7f03001c; public static final int bbs_listview_item=0x7f03001d; public static final int bottom_menu_item=0x7f03001e; public static final int fragment_bbs=0x7f03001f; public static final int fragment_find=0x7f030020; public static final int fragment_slef=0x7f030021; public static final int support_simple_spinner_dropdown_item=0x7f030022; public static final int top_title=0x7f030023; } public static final class menu { public static final int main=0x7f0c0000; } public static final class string { /** Content description for the action bar "home" affordance. [CHAR LIMIT=NONE] */ public static final int abc_action_bar_home_description=0x7f0a0001; /** Content description for the action bar "up" affordance. [CHAR LIMIT=NONE] */ public static final int abc_action_bar_up_description=0x7f0a0002; /** Content description for the action menu overflow button. [CHAR LIMIT=NONE] */ public static final int abc_action_menu_overflow_description=0x7f0a0003; /** Label for the "Done" button on the far left of action mode toolbars. */ public static final int abc_action_mode_done=0x7f0a0000; /** Title for a button to expand the list of activities in ActivityChooserView [CHAR LIMIT=25] */ public static final int abc_activity_chooser_view_see_all=0x7f0a000a; /** ActivityChooserView - accessibility support Description of the shwoing of a popup window with activities to choose from. [CHAR LIMIT=NONE] */ public static final int abc_activitychooserview_choose_application=0x7f0a0009; /** SearchView accessibility description for clear button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_clear=0x7f0a0006; /** SearchView accessibility description for search text field [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_query=0x7f0a0005; /** SearchView accessibility description for search button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_search=0x7f0a0004; /** SearchView accessibility description for submit button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_submit=0x7f0a0007; /** SearchView accessibility description for voice button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_voice=0x7f0a0008; /** Description of the choose target button in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] */ public static final int abc_shareactionprovider_share_with=0x7f0a000c; /** Description of a share target (both in the list of such or the default share button) in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] */ public static final int abc_shareactionprovider_share_with_application=0x7f0a000b; public static final int action_settings=0x7f0a000e; public static final int app_name=0x7f0a000d; public static final int input_password=0x7f0a0014; public static final int input_username=0x7f0a0013; public static final int login=0x7f0a0011; public static final int password=0x7f0a0010; public static final int rb_bbs=0x7f0a0017; public static final int rb_find=0x7f0a0018; public static final int rb_my=0x7f0a0019; public static final int register=0x7f0a0016; public static final int reinput_password=0x7f0a0015; public static final int txt_register=0x7f0a0012; public static final int username=0x7f0a000f; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f0b0083; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f0b0084; /** Mimic text appearance in select_dialog_item.xml */ public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog=0x7f0b0063; public static final int TextAppearance_AppCompat_Base_SearchResult=0x7f0b006d; public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle=0x7f0b006f; /** Search View result styles */ public static final int TextAppearance_AppCompat_Base_SearchResult_Title=0x7f0b006e; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large=0x7f0b0069; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small=0x7f0b006a; public static final int TextAppearance_AppCompat_Light_Base_SearchResult=0x7f0b0070; public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle=0x7f0b0072; /** TextAppearance.Holo.Light.SearchResult.* are private so we extend from the default versions instead (which are exactly the same). */ public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title=0x7f0b0071; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large=0x7f0b006b; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small=0x7f0b006c; public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle=0x7f0b0035; public static final int TextAppearance_AppCompat_Light_SearchResult_Title=0x7f0b0034; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large=0x7f0b0030; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small=0x7f0b0031; public static final int TextAppearance_AppCompat_SearchResult_Subtitle=0x7f0b0033; public static final int TextAppearance_AppCompat_SearchResult_Title=0x7f0b0032; public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu=0x7f0b001a; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle=0x7f0b0006; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse=0x7f0b0008; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title=0x7f0b0005; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse=0x7f0b0007; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle=0x7f0b001e; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse=0x7f0b0020; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title=0x7f0b001d; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse=0x7f0b001f; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu=0x7f0b0054; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle=0x7f0b0056; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse=0x7f0b0058; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title=0x7f0b0055; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse=0x7f0b0057; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle=0x7f0b0051; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse=0x7f0b0053; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title=0x7f0b0050; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse=0x7f0b0052; public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem=0x7f0b0061; public static final int TextAppearance_AppCompat_Widget_DropDownItem=0x7f0b0021; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large=0x7f0b002e; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small=0x7f0b002f; public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item=0x7f0b0062; public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item=0x7f0b0028; /** Themes in the "Theme.AppCompat" family will contain an action bar by default. If Holo themes are available on the current platform version they will be used. A limited Holo-styled action bar will be provided on platform versions older than 3.0. (API 11) These theme declarations contain any version-independent specification. Items that need to vary based on platform version should be defined in the corresponding "Theme.Base" theme. Platform-independent theme providing an action bar in a dark-themed activity. */ public static final int Theme_AppCompat=0x7f0b0077; /** Menu/item attributes */ public static final int Theme_AppCompat_Base_CompactMenu=0x7f0b0081; public static final int Theme_AppCompat_Base_CompactMenu_Dialog=0x7f0b0082; /** Menu/item attributes */ public static final int Theme_AppCompat_CompactMenu=0x7f0b007a; public static final int Theme_AppCompat_CompactMenu_Dialog=0x7f0b007b; /** Platform-independent theme providing an action bar in a light-themed activity. */ public static final int Theme_AppCompat_Light=0x7f0b0078; /** Platform-independent theme providing an action bar in a dark-themed activity. */ public static final int Theme_AppCompat_Light_DarkActionBar=0x7f0b0079; /** Base platform-dependent theme */ public static final int Theme_Base=0x7f0b007c; /** Base platform-dependent theme providing an action bar in a dark-themed activity. Base platform-dependent theme providing an action bar in a dark-themed activity. */ public static final int Theme_Base_AppCompat=0x7f0b007e; /** Base platform-dependent theme providing an action bar in a light-themed activity. Base platform-dependent theme providing an action bar in a light-themed activity. */ public static final int Theme_Base_AppCompat_Light=0x7f0b007f; /** Base platform-dependent theme providing a dark action bar in a light-themed activity. Base platform-dependent theme providing a dark action bar in a light-themed activity. */ public static final int Theme_Base_AppCompat_Light_DarkActionBar=0x7f0b0080; /** Base platform-dependent theme providing a light-themed activity. */ public static final int Theme_Base_Light=0x7f0b007d; /** Styles in here can be extended for customisation in your application. Each utilises one of the Base styles. If Holo themes are available on the current platform version they will be used instead of the compat styles. */ public static final int Widget_AppCompat_ActionBar=0x7f0b0000; public static final int Widget_AppCompat_ActionBar_Solid=0x7f0b0002; public static final int Widget_AppCompat_ActionBar_TabBar=0x7f0b0011; public static final int Widget_AppCompat_ActionBar_TabText=0x7f0b0017; public static final int Widget_AppCompat_ActionBar_TabView=0x7f0b0014; public static final int Widget_AppCompat_ActionButton=0x7f0b000b; public static final int Widget_AppCompat_ActionButton_CloseMode=0x7f0b000d; public static final int Widget_AppCompat_ActionButton_Overflow=0x7f0b000f; public static final int Widget_AppCompat_ActionMode=0x7f0b001b; public static final int Widget_AppCompat_ActivityChooserView=0x7f0b0038; public static final int Widget_AppCompat_AutoCompleteTextView=0x7f0b0036; public static final int Widget_AppCompat_Base_ActionBar=0x7f0b003a; public static final int Widget_AppCompat_Base_ActionBar_Solid=0x7f0b003c; public static final int Widget_AppCompat_Base_ActionBar_TabBar=0x7f0b0045; public static final int Widget_AppCompat_Base_ActionBar_TabText=0x7f0b004b; public static final int Widget_AppCompat_Base_ActionBar_TabView=0x7f0b0048; /** Action Button Styles */ public static final int Widget_AppCompat_Base_ActionButton=0x7f0b003f; public static final int Widget_AppCompat_Base_ActionButton_CloseMode=0x7f0b0041; public static final int Widget_AppCompat_Base_ActionButton_Overflow=0x7f0b0043; public static final int Widget_AppCompat_Base_ActionMode=0x7f0b004e; public static final int Widget_AppCompat_Base_ActivityChooserView=0x7f0b0075; /** AutoCompleteTextView styles (for SearchView) */ public static final int Widget_AppCompat_Base_AutoCompleteTextView=0x7f0b0073; public static final int Widget_AppCompat_Base_DropDownItem_Spinner=0x7f0b005d; /** Popup Menu */ public static final int Widget_AppCompat_Base_ListPopupWindow=0x7f0b0065; /** Spinner Widgets */ public static final int Widget_AppCompat_Base_ListView_DropDown=0x7f0b005f; public static final int Widget_AppCompat_Base_ListView_Menu=0x7f0b0064; public static final int Widget_AppCompat_Base_PopupMenu=0x7f0b0067; public static final int Widget_AppCompat_Base_ProgressBar=0x7f0b005a; /** Progress Bar */ public static final int Widget_AppCompat_Base_ProgressBar_Horizontal=0x7f0b0059; /** Action Bar Spinner Widgets */ public static final int Widget_AppCompat_Base_Spinner=0x7f0b005b; public static final int Widget_AppCompat_DropDownItem_Spinner=0x7f0b0024; public static final int Widget_AppCompat_Light_ActionBar=0x7f0b0001; public static final int Widget_AppCompat_Light_ActionBar_Solid=0x7f0b0003; public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse=0x7f0b0004; public static final int Widget_AppCompat_Light_ActionBar_TabBar=0x7f0b0012; public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse=0x7f0b0013; public static final int Widget_AppCompat_Light_ActionBar_TabText=0x7f0b0018; public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse=0x7f0b0019; public static final int Widget_AppCompat_Light_ActionBar_TabView=0x7f0b0015; public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse=0x7f0b0016; public static final int Widget_AppCompat_Light_ActionButton=0x7f0b000c; public static final int Widget_AppCompat_Light_ActionButton_CloseMode=0x7f0b000e; public static final int Widget_AppCompat_Light_ActionButton_Overflow=0x7f0b0010; public static final int Widget_AppCompat_Light_ActionMode_Inverse=0x7f0b001c; public static final int Widget_AppCompat_Light_ActivityChooserView=0x7f0b0039; public static final int Widget_AppCompat_Light_AutoCompleteTextView=0x7f0b0037; public static final int Widget_AppCompat_Light_Base_ActionBar=0x7f0b003b; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid=0x7f0b003d; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse=0x7f0b003e; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar=0x7f0b0046; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse=0x7f0b0047; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText=0x7f0b004c; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse=0x7f0b004d; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView=0x7f0b0049; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse=0x7f0b004a; public static final int Widget_AppCompat_Light_Base_ActionButton=0x7f0b0040; public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode=0x7f0b0042; public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow=0x7f0b0044; public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse=0x7f0b004f; public static final int Widget_AppCompat_Light_Base_ActivityChooserView=0x7f0b0076; public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView=0x7f0b0074; public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner=0x7f0b005e; public static final int Widget_AppCompat_Light_Base_ListPopupWindow=0x7f0b0066; public static final int Widget_AppCompat_Light_Base_ListView_DropDown=0x7f0b0060; public static final int Widget_AppCompat_Light_Base_PopupMenu=0x7f0b0068; public static final int Widget_AppCompat_Light_Base_Spinner=0x7f0b005c; public static final int Widget_AppCompat_Light_DropDownItem_Spinner=0x7f0b0025; public static final int Widget_AppCompat_Light_ListPopupWindow=0x7f0b002a; public static final int Widget_AppCompat_Light_ListView_DropDown=0x7f0b0027; public static final int Widget_AppCompat_Light_PopupMenu=0x7f0b002c; public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar=0x7f0b0023; public static final int Widget_AppCompat_ListPopupWindow=0x7f0b0029; public static final int Widget_AppCompat_ListView_DropDown=0x7f0b0026; public static final int Widget_AppCompat_ListView_Menu=0x7f0b002d; public static final int Widget_AppCompat_PopupMenu=0x7f0b002b; public static final int Widget_AppCompat_ProgressBar=0x7f0b000a; public static final int Widget_AppCompat_ProgressBar_Horizontal=0x7f0b0009; public static final int Widget_AppCompat_Spinner_DropDown_ActionBar=0x7f0b0022; } public static final class styleable { /** ============================================ Attributes used to style the Action Bar. These should be set on your theme; the default actionBarStyle will propagate them to the correct elements as needed. Please Note: when overriding attributes for an ActionBar style you must specify each attribute twice: once with the "android:" namespace prefix and once without. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionBar_background com.whu.readshare:background}</code></td><td> Specifies a background drawable for the action bar.</td></tr> <tr><td><code>{@link #ActionBar_backgroundSplit com.whu.readshare:backgroundSplit}</code></td><td> Specifies a background drawable for the bottom component of a split action bar.</td></tr> <tr><td><code>{@link #ActionBar_backgroundStacked com.whu.readshare:backgroundStacked}</code></td><td> Specifies a background drawable for a second stacked row of the action bar.</td></tr> <tr><td><code>{@link #ActionBar_customNavigationLayout com.whu.readshare:customNavigationLayout}</code></td><td> Specifies a layout for custom navigation.</td></tr> <tr><td><code>{@link #ActionBar_displayOptions com.whu.readshare:displayOptions}</code></td><td> Options affecting how the action bar is displayed.</td></tr> <tr><td><code>{@link #ActionBar_divider com.whu.readshare:divider}</code></td><td> Specifies the drawable used for item dividers.</td></tr> <tr><td><code>{@link #ActionBar_height com.whu.readshare:height}</code></td><td> Specifies a fixed height.</td></tr> <tr><td><code>{@link #ActionBar_homeLayout com.whu.readshare:homeLayout}</code></td><td> Specifies a layout to use for the "home" section of the action bar.</td></tr> <tr><td><code>{@link #ActionBar_icon com.whu.readshare:icon}</code></td><td> Specifies the drawable used for the application icon.</td></tr> <tr><td><code>{@link #ActionBar_indeterminateProgressStyle com.whu.readshare:indeterminateProgressStyle}</code></td><td> Specifies a style resource to use for an indeterminate progress spinner.</td></tr> <tr><td><code>{@link #ActionBar_itemPadding com.whu.readshare:itemPadding}</code></td><td> Specifies padding that should be applied to the left and right sides of system-provided items in the bar.</td></tr> <tr><td><code>{@link #ActionBar_logo com.whu.readshare:logo}</code></td><td> Specifies the drawable used for the application logo.</td></tr> <tr><td><code>{@link #ActionBar_navigationMode com.whu.readshare:navigationMode}</code></td><td> The type of navigation to use.</td></tr> <tr><td><code>{@link #ActionBar_progressBarPadding com.whu.readshare:progressBarPadding}</code></td><td> Specifies the horizontal padding on either end for an embedded progress bar.</td></tr> <tr><td><code>{@link #ActionBar_progressBarStyle com.whu.readshare:progressBarStyle}</code></td><td> Specifies a style resource to use for an embedded progress bar.</td></tr> <tr><td><code>{@link #ActionBar_subtitle com.whu.readshare:subtitle}</code></td><td> Specifies subtitle text used for navigationMode="normal" </td></tr> <tr><td><code>{@link #ActionBar_subtitleTextStyle com.whu.readshare:subtitleTextStyle}</code></td><td> Specifies a style to use for subtitle text.</td></tr> <tr><td><code>{@link #ActionBar_title com.whu.readshare:title}</code></td><td> Specifies title text used for navigationMode="normal" </td></tr> <tr><td><code>{@link #ActionBar_titleTextStyle com.whu.readshare:titleTextStyle}</code></td><td> Specifies a style to use for title text.</td></tr> </table> @see #ActionBar_background @see #ActionBar_backgroundSplit @see #ActionBar_backgroundStacked @see #ActionBar_customNavigationLayout @see #ActionBar_displayOptions @see #ActionBar_divider @see #ActionBar_height @see #ActionBar_homeLayout @see #ActionBar_icon @see #ActionBar_indeterminateProgressStyle @see #ActionBar_itemPadding @see #ActionBar_logo @see #ActionBar_navigationMode @see #ActionBar_progressBarPadding @see #ActionBar_progressBarStyle @see #ActionBar_subtitle @see #ActionBar_subtitleTextStyle @see #ActionBar_title @see #ActionBar_titleTextStyle */ public static final int[] ActionBar = { 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033 }; /** <p> @attr description Specifies a background drawable for the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:background */ public static final int ActionBar_background = 10; /** <p> @attr description Specifies a background drawable for the bottom component of a split action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:backgroundSplit */ public static final int ActionBar_backgroundSplit = 12; /** <p> @attr description Specifies a background drawable for a second stacked row of the action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:backgroundStacked */ public static final int ActionBar_backgroundStacked = 11; /** <p> @attr description Specifies a layout for custom navigation. Overrides navigationMode. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:customNavigationLayout */ public static final int ActionBar_customNavigationLayout = 13; /** <p> @attr description Options affecting how the action bar is displayed. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr> <tr><td><code>showHome</code></td><td>0x2</td><td></td></tr> <tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr> <tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr> <tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr> <tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr> </table> <p>This is a private symbol. @attr name com.whu.readshare:displayOptions */ public static final int ActionBar_displayOptions = 3; /** <p> @attr description Specifies the drawable used for item dividers. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:divider */ public static final int ActionBar_divider = 9; /** <p> @attr description Specifies a fixed height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:height */ public static final int ActionBar_height = 1; /** <p> @attr description Specifies a layout to use for the "home" section of the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:homeLayout */ public static final int ActionBar_homeLayout = 14; /** <p> @attr description Specifies the drawable used for the application icon. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:icon */ public static final int ActionBar_icon = 7; /** <p> @attr description Specifies a style resource to use for an indeterminate progress spinner. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:indeterminateProgressStyle */ public static final int ActionBar_indeterminateProgressStyle = 16; /** <p> @attr description Specifies padding that should be applied to the left and right sides of system-provided items in the bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:itemPadding */ public static final int ActionBar_itemPadding = 18; /** <p> @attr description Specifies the drawable used for the application logo. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:logo */ public static final int ActionBar_logo = 8; /** <p> @attr description The type of navigation to use. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>normal</code></td><td>0</td><td> Normal static title text </td></tr> <tr><td><code>listMode</code></td><td>1</td><td> The action bar will use a selection list for navigation. </td></tr> <tr><td><code>tabMode</code></td><td>2</td><td> The action bar will use a series of horizontal tabs for navigation. </td></tr> </table> <p>This is a private symbol. @attr name com.whu.readshare:navigationMode */ public static final int ActionBar_navigationMode = 2; /** <p> @attr description Specifies the horizontal padding on either end for an embedded progress bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:progressBarPadding */ public static final int ActionBar_progressBarPadding = 17; /** <p> @attr description Specifies a style resource to use for an embedded progress bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:progressBarStyle */ public static final int ActionBar_progressBarStyle = 15; /** <p> @attr description Specifies subtitle text used for navigationMode="normal" <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:subtitle */ public static final int ActionBar_subtitle = 4; /** <p> @attr description Specifies a style to use for subtitle text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:subtitleTextStyle */ public static final int ActionBar_subtitleTextStyle = 6; /** <p> @attr description Specifies title text used for navigationMode="normal" <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:title */ public static final int ActionBar_title = 0; /** <p> @attr description Specifies a style to use for title text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:titleTextStyle */ public static final int ActionBar_titleTextStyle = 5; /** Valid LayoutParams for views placed in the action bar as custom views. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionBarLayout_android_layout_gravity android:layout_gravity}</code></td><td></td></tr> </table> @see #ActionBarLayout_android_layout_gravity */ public static final int[] ActionBarLayout = { 0x010100b3 }; /** <p>This symbol is the offset where the {@link android.R.attr#layout_gravity} attribute's value can be found in the {@link #ActionBarLayout} array. @attr name android:layout_gravity */ public static final int ActionBarLayout_android_layout_gravity = 0; /** These attributes are meant to be specified and customized by the app. The system will read and apply them as needed. These attributes control properties of the activity window, such as whether an action bar should be present and whether it should overlay content. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionBarWindow_windowActionBar com.whu.readshare:windowActionBar}</code></td><td></td></tr> <tr><td><code>{@link #ActionBarWindow_windowActionBarOverlay com.whu.readshare:windowActionBarOverlay}</code></td><td></td></tr> <tr><td><code>{@link #ActionBarWindow_windowSplitActionBar com.whu.readshare:windowSplitActionBar}</code></td><td></td></tr> </table> @see #ActionBarWindow_windowActionBar @see #ActionBarWindow_windowActionBarOverlay @see #ActionBarWindow_windowSplitActionBar */ public static final int[] ActionBarWindow = { 0x7f010000, 0x7f010001, 0x7f010002 }; /** <p>This symbol is the offset where the {@link com.whu.readshare.R.attr#windowActionBar} attribute's value can be found in the {@link #ActionBarWindow} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.whu.readshare:windowActionBar */ public static final int ActionBarWindow_windowActionBar = 0; /** <p>This symbol is the offset where the {@link com.whu.readshare.R.attr#windowActionBarOverlay} attribute's value can be found in the {@link #ActionBarWindow} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.whu.readshare:windowActionBarOverlay */ public static final int ActionBarWindow_windowActionBarOverlay = 1; /** <p>This symbol is the offset where the {@link com.whu.readshare.R.attr#windowSplitActionBar} attribute's value can be found in the {@link #ActionBarWindow} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.whu.readshare:windowSplitActionBar */ public static final int ActionBarWindow_windowSplitActionBar = 2; /** Attributes that can be used with a ActionMenuItemView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionMenuItemView_android_minWidth android:minWidth}</code></td><td></td></tr> </table> @see #ActionMenuItemView_android_minWidth */ public static final int[] ActionMenuItemView = { 0x0101013f }; /** <p>This symbol is the offset where the {@link android.R.attr#minWidth} attribute's value can be found in the {@link #ActionMenuItemView} array. @attr name android:minWidth */ public static final int ActionMenuItemView_android_minWidth = 0; /** Size of padding on either end of a divider. */ public static final int[] ActionMenuView = { }; /** Attributes that can be used with a ActionMode. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionMode_background com.whu.readshare:background}</code></td><td> Specifies a background for the action mode bar.</td></tr> <tr><td><code>{@link #ActionMode_backgroundSplit com.whu.readshare:backgroundSplit}</code></td><td> Specifies a background for the split action mode bar.</td></tr> <tr><td><code>{@link #ActionMode_height com.whu.readshare:height}</code></td><td> Specifies a fixed height for the action mode bar.</td></tr> <tr><td><code>{@link #ActionMode_subtitleTextStyle com.whu.readshare:subtitleTextStyle}</code></td><td> Specifies a style to use for subtitle text.</td></tr> <tr><td><code>{@link #ActionMode_titleTextStyle com.whu.readshare:titleTextStyle}</code></td><td> Specifies a style to use for title text.</td></tr> </table> @see #ActionMode_background @see #ActionMode_backgroundSplit @see #ActionMode_height @see #ActionMode_subtitleTextStyle @see #ActionMode_titleTextStyle */ public static final int[] ActionMode = { 0x7f010022, 0x7f010026, 0x7f010027, 0x7f01002b, 0x7f01002d }; /** <p> @attr description Specifies a background for the action mode bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:background */ public static final int ActionMode_background = 3; /** <p> @attr description Specifies a background for the split action mode bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:backgroundSplit */ public static final int ActionMode_backgroundSplit = 4; /** <p> @attr description Specifies a fixed height for the action mode bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:height */ public static final int ActionMode_height = 0; /** <p> @attr description Specifies a style to use for subtitle text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:subtitleTextStyle */ public static final int ActionMode_subtitleTextStyle = 2; /** <p> @attr description Specifies a style to use for title text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:titleTextStyle */ public static final int ActionMode_titleTextStyle = 1; /** Attrbitutes for a ActivityChooserView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActivityChooserView_expandActivityOverflowButtonDrawable com.whu.readshare:expandActivityOverflowButtonDrawable}</code></td><td> The drawable to show in the button for expanding the activities overflow popup.</td></tr> <tr><td><code>{@link #ActivityChooserView_initialActivityCount com.whu.readshare:initialActivityCount}</code></td><td> The maximal number of items initially shown in the activity list.</td></tr> </table> @see #ActivityChooserView_expandActivityOverflowButtonDrawable @see #ActivityChooserView_initialActivityCount */ public static final int[] ActivityChooserView = { 0x7f010066, 0x7f010067 }; /** <p> @attr description The drawable to show in the button for expanding the activities overflow popup. <strong>Note:</strong> Clients would like to set this drawable as a clue about the action the chosen activity will perform. For example, if share activity is to be chosen the drawable should give a clue that sharing is to be performed. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:expandActivityOverflowButtonDrawable */ public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1; /** <p> @attr description The maximal number of items initially shown in the activity list. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:initialActivityCount */ public static final int ActivityChooserView_initialActivityCount = 0; /** Attributes that can be used with a CompatTextView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #CompatTextView_textAllCaps com.whu.readshare:textAllCaps}</code></td><td> Present the text in ALL CAPS.</td></tr> </table> @see #CompatTextView_textAllCaps */ public static final int[] CompatTextView = { 0x7f010069 }; /** <p> @attr description Present the text in ALL CAPS. This may use a small-caps form when available. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This is a private symbol. @attr name com.whu.readshare:textAllCaps */ public static final int CompatTextView_textAllCaps = 0; /** Attributes that can be used with a LinearLayoutICS. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #LinearLayoutICS_divider com.whu.readshare:divider}</code></td><td> Drawable to use as a vertical divider between buttons.</td></tr> <tr><td><code>{@link #LinearLayoutICS_dividerPadding com.whu.readshare:dividerPadding}</code></td><td> Size of padding on either end of a divider.</td></tr> <tr><td><code>{@link #LinearLayoutICS_showDividers com.whu.readshare:showDividers}</code></td><td> Setting for which dividers to show.</td></tr> </table> @see #LinearLayoutICS_divider @see #LinearLayoutICS_dividerPadding @see #LinearLayoutICS_showDividers */ public static final int[] LinearLayoutICS = { 0x7f01002a, 0x7f010051, 0x7f010052 }; /** <p> @attr description Drawable to use as a vertical divider between buttons. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:divider */ public static final int LinearLayoutICS_divider = 0; /** <p> @attr description Size of padding on either end of a divider. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:dividerPadding */ public static final int LinearLayoutICS_dividerPadding = 2; /** <p> @attr description Setting for which dividers to show. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>none</code></td><td>0</td><td></td></tr> <tr><td><code>beginning</code></td><td>1</td><td></td></tr> <tr><td><code>middle</code></td><td>2</td><td></td></tr> <tr><td><code>end</code></td><td>4</td><td></td></tr> </table> <p>This is a private symbol. @attr name com.whu.readshare:showDividers */ public static final int LinearLayoutICS_showDividers = 1; /** Base attributes that are available to all groups. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #MenuGroup_android_checkableBehavior android:checkableBehavior}</code></td><td> Whether the items are capable of displaying a check mark.</td></tr> <tr><td><code>{@link #MenuGroup_android_enabled android:enabled}</code></td><td> Whether the items are enabled.</td></tr> <tr><td><code>{@link #MenuGroup_android_id android:id}</code></td><td> The ID of the group.</td></tr> <tr><td><code>{@link #MenuGroup_android_menuCategory android:menuCategory}</code></td><td> The category applied to all items within this group.</td></tr> <tr><td><code>{@link #MenuGroup_android_orderInCategory android:orderInCategory}</code></td><td> The order within the category applied to all items within this group.</td></tr> <tr><td><code>{@link #MenuGroup_android_visible android:visible}</code></td><td> Whether the items are shown/visible.</td></tr> </table> @see #MenuGroup_android_checkableBehavior @see #MenuGroup_android_enabled @see #MenuGroup_android_id @see #MenuGroup_android_menuCategory @see #MenuGroup_android_orderInCategory @see #MenuGroup_android_visible */ public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }; /** <p> @attr description Whether the items are capable of displaying a check mark. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#checkableBehavior}. @attr name android:checkableBehavior */ public static final int MenuGroup_android_checkableBehavior = 5; /** <p> @attr description Whether the items are enabled. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#enabled}. @attr name android:enabled */ public static final int MenuGroup_android_enabled = 0; /** <p> @attr description The ID of the group. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#id}. @attr name android:id */ public static final int MenuGroup_android_id = 1; /** <p> @attr description The category applied to all items within this group. (This will be or'ed with the orderInCategory attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#menuCategory}. @attr name android:menuCategory */ public static final int MenuGroup_android_menuCategory = 3; /** <p> @attr description The order within the category applied to all items within this group. (This will be or'ed with the category attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#orderInCategory}. @attr name android:orderInCategory */ public static final int MenuGroup_android_orderInCategory = 4; /** <p> @attr description Whether the items are shown/visible. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#visible}. @attr name android:visible */ public static final int MenuGroup_android_visible = 2; /** Base attributes that are available to all Item objects. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #MenuItem_actionLayout com.whu.readshare:actionLayout}</code></td><td> An optional layout to be used as an action view.</td></tr> <tr><td><code>{@link #MenuItem_actionProviderClass com.whu.readshare:actionProviderClass}</code></td><td> The name of an optional ActionProvider class to instantiate an action view and perform operations such as default action for that menu item.</td></tr> <tr><td><code>{@link #MenuItem_actionViewClass com.whu.readshare:actionViewClass}</code></td><td> The name of an optional View class to instantiate and use as an action view.</td></tr> <tr><td><code>{@link #MenuItem_android_alphabeticShortcut android:alphabeticShortcut}</code></td><td> The alphabetic shortcut key.</td></tr> <tr><td><code>{@link #MenuItem_android_checkable android:checkable}</code></td><td> Whether the item is capable of displaying a check mark.</td></tr> <tr><td><code>{@link #MenuItem_android_checked android:checked}</code></td><td> Whether the item is checked.</td></tr> <tr><td><code>{@link #MenuItem_android_enabled android:enabled}</code></td><td> Whether the item is enabled.</td></tr> <tr><td><code>{@link #MenuItem_android_icon android:icon}</code></td><td> The icon associated with this item.</td></tr> <tr><td><code>{@link #MenuItem_android_id android:id}</code></td><td> The ID of the item.</td></tr> <tr><td><code>{@link #MenuItem_android_menuCategory android:menuCategory}</code></td><td> The category applied to the item.</td></tr> <tr><td><code>{@link #MenuItem_android_numericShortcut android:numericShortcut}</code></td><td> The numeric shortcut key.</td></tr> <tr><td><code>{@link #MenuItem_android_onClick android:onClick}</code></td><td> Name of a method on the Context used to inflate the menu that will be called when the item is clicked.</td></tr> <tr><td><code>{@link #MenuItem_android_orderInCategory android:orderInCategory}</code></td><td> The order within the category applied to the item.</td></tr> <tr><td><code>{@link #MenuItem_android_title android:title}</code></td><td> The title associated with the item.</td></tr> <tr><td><code>{@link #MenuItem_android_titleCondensed android:titleCondensed}</code></td><td> The condensed title associated with the item.</td></tr> <tr><td><code>{@link #MenuItem_android_visible android:visible}</code></td><td> Whether the item is shown/visible.</td></tr> <tr><td><code>{@link #MenuItem_showAsAction com.whu.readshare:showAsAction}</code></td><td> How this item should display in the Action Bar, if present.</td></tr> </table> @see #MenuItem_actionLayout @see #MenuItem_actionProviderClass @see #MenuItem_actionViewClass @see #MenuItem_android_alphabeticShortcut @see #MenuItem_android_checkable @see #MenuItem_android_checked @see #MenuItem_android_enabled @see #MenuItem_android_icon @see #MenuItem_android_id @see #MenuItem_android_menuCategory @see #MenuItem_android_numericShortcut @see #MenuItem_android_onClick @see #MenuItem_android_orderInCategory @see #MenuItem_android_title @see #MenuItem_android_titleCondensed @see #MenuItem_android_visible @see #MenuItem_showAsAction */ public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c }; /** <p> @attr description An optional layout to be used as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:actionLayout */ public static final int MenuItem_actionLayout = 14; /** <p> @attr description The name of an optional ActionProvider class to instantiate an action view and perform operations such as default action for that menu item. See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:actionProviderClass */ public static final int MenuItem_actionProviderClass = 16; /** <p> @attr description The name of an optional View class to instantiate and use as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:actionViewClass */ public static final int MenuItem_actionViewClass = 15; /** <p> @attr description The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#alphabeticShortcut}. @attr name android:alphabeticShortcut */ public static final int MenuItem_android_alphabeticShortcut = 9; /** <p> @attr description Whether the item is capable of displaying a check mark. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#checkable}. @attr name android:checkable */ public static final int MenuItem_android_checkable = 11; /** <p> @attr description Whether the item is checked. Note that you must first have enabled checking with the checkable attribute or else the check mark will not appear. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#checked}. @attr name android:checked */ public static final int MenuItem_android_checked = 3; /** <p> @attr description Whether the item is enabled. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#enabled}. @attr name android:enabled */ public static final int MenuItem_android_enabled = 1; /** <p> @attr description The icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#icon}. @attr name android:icon */ public static final int MenuItem_android_icon = 0; /** <p> @attr description The ID of the item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#id}. @attr name android:id */ public static final int MenuItem_android_id = 2; /** <p> @attr description The category applied to the item. (This will be or'ed with the orderInCategory attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#menuCategory}. @attr name android:menuCategory */ public static final int MenuItem_android_menuCategory = 5; /** <p> @attr description The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key) keyboard. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#numericShortcut}. @attr name android:numericShortcut */ public static final int MenuItem_android_numericShortcut = 10; /** <p> @attr description Name of a method on the Context used to inflate the menu that will be called when the item is clicked. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#onClick}. @attr name android:onClick */ public static final int MenuItem_android_onClick = 12; /** <p> @attr description The order within the category applied to the item. (This will be or'ed with the category attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#orderInCategory}. @attr name android:orderInCategory */ public static final int MenuItem_android_orderInCategory = 6; /** <p> @attr description The title associated with the item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#title}. @attr name android:title */ public static final int MenuItem_android_title = 7; /** <p> @attr description The condensed title associated with the item. This is used in situations where the normal title may be too long to be displayed. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#titleCondensed}. @attr name android:titleCondensed */ public static final int MenuItem_android_titleCondensed = 8; /** <p> @attr description Whether the item is shown/visible. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#visible}. @attr name android:visible */ public static final int MenuItem_android_visible = 4; /** <p> @attr description How this item should display in the Action Bar, if present. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>never</code></td><td>0</td><td> Never show this item in an action bar, show it in the overflow menu instead. Mutually exclusive with "ifRoom" and "always". </td></tr> <tr><td><code>ifRoom</code></td><td>1</td><td> Show this item in an action bar if there is room for it as determined by the system. Favor this option over "always" where possible. Mutually exclusive with "never" and "always". </td></tr> <tr><td><code>always</code></td><td>2</td><td> Always show this item in an actionbar, even if it would override the system's limits of how much stuff to put there. This may make your action bar look bad on some screens. In most cases you should use "ifRoom" instead. Mutually exclusive with "ifRoom" and "never". </td></tr> <tr><td><code>withText</code></td><td>4</td><td> When this item is shown as an action in the action bar, show a text label with it even if it has an icon representation. </td></tr> <tr><td><code>collapseActionView</code></td><td>8</td><td> This item's action view collapses to a normal menu item. When expanded, the action view takes over a larger segment of its container. </td></tr> </table> <p>This is a private symbol. @attr name com.whu.readshare:showAsAction */ public static final int MenuItem_showAsAction = 13; /** Attributes that can be used with a MenuView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #MenuView_android_headerBackground android:headerBackground}</code></td><td> Default background for the menu header.</td></tr> <tr><td><code>{@link #MenuView_android_horizontalDivider android:horizontalDivider}</code></td><td> Default horizontal divider between rows of menu items.</td></tr> <tr><td><code>{@link #MenuView_android_itemBackground android:itemBackground}</code></td><td> Default background for each menu item.</td></tr> <tr><td><code>{@link #MenuView_android_itemIconDisabledAlpha android:itemIconDisabledAlpha}</code></td><td> Default disabled icon alpha for each menu item that shows an icon.</td></tr> <tr><td><code>{@link #MenuView_android_itemTextAppearance android:itemTextAppearance}</code></td><td> Default appearance of menu item text.</td></tr> <tr><td><code>{@link #MenuView_android_preserveIconSpacing android:preserveIconSpacing}</code></td><td> Whether space should be reserved in layout when an icon is missing.</td></tr> <tr><td><code>{@link #MenuView_android_verticalDivider android:verticalDivider}</code></td><td> Default vertical divider between menu items.</td></tr> <tr><td><code>{@link #MenuView_android_windowAnimationStyle android:windowAnimationStyle}</code></td><td> Default animations for the menu.</td></tr> </table> @see #MenuView_android_headerBackground @see #MenuView_android_horizontalDivider @see #MenuView_android_itemBackground @see #MenuView_android_itemIconDisabledAlpha @see #MenuView_android_itemTextAppearance @see #MenuView_android_preserveIconSpacing @see #MenuView_android_verticalDivider @see #MenuView_android_windowAnimationStyle */ public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x01010435 }; /** <p> @attr description Default background for the menu header. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#headerBackground}. @attr name android:headerBackground */ public static final int MenuView_android_headerBackground = 4; /** <p> @attr description Default horizontal divider between rows of menu items. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#horizontalDivider}. @attr name android:horizontalDivider */ public static final int MenuView_android_horizontalDivider = 2; /** <p> @attr description Default background for each menu item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#itemBackground}. @attr name android:itemBackground */ public static final int MenuView_android_itemBackground = 5; /** <p> @attr description Default disabled icon alpha for each menu item that shows an icon. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#itemIconDisabledAlpha}. @attr name android:itemIconDisabledAlpha */ public static final int MenuView_android_itemIconDisabledAlpha = 6; /** <p> @attr description Default appearance of menu item text. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#itemTextAppearance}. @attr name android:itemTextAppearance */ public static final int MenuView_android_itemTextAppearance = 1; /** <p> @attr description Whether space should be reserved in layout when an icon is missing. <p>This is a private symbol. @attr name android:preserveIconSpacing */ public static final int MenuView_android_preserveIconSpacing = 7; /** <p> @attr description Default vertical divider between menu items. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#verticalDivider}. @attr name android:verticalDivider */ public static final int MenuView_android_verticalDivider = 3; /** <p> @attr description Default animations for the menu. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#windowAnimationStyle}. @attr name android:windowAnimationStyle */ public static final int MenuView_android_windowAnimationStyle = 0; /** Attributes that can be used with a SearchView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #SearchView_android_imeOptions android:imeOptions}</code></td><td> The IME options to set on the query text field.</td></tr> <tr><td><code>{@link #SearchView_android_inputType android:inputType}</code></td><td> The input type to set on the query text field.</td></tr> <tr><td><code>{@link #SearchView_android_maxWidth android:maxWidth}</code></td><td> An optional maximum width of the SearchView.</td></tr> <tr><td><code>{@link #SearchView_iconifiedByDefault com.whu.readshare:iconifiedByDefault}</code></td><td> The default state of the SearchView.</td></tr> <tr><td><code>{@link #SearchView_queryHint com.whu.readshare:queryHint}</code></td><td> An optional query hint string to be displayed in the empty query field.</td></tr> </table> @see #SearchView_android_imeOptions @see #SearchView_android_inputType @see #SearchView_android_maxWidth @see #SearchView_iconifiedByDefault @see #SearchView_queryHint */ public static final int[] SearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f010056, 0x7f010057 }; /** <p> @attr description The IME options to set on the query text field. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#imeOptions}. @attr name android:imeOptions */ public static final int SearchView_android_imeOptions = 2; /** <p> @attr description The input type to set on the query text field. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#inputType}. @attr name android:inputType */ public static final int SearchView_android_inputType = 1; /** <p> @attr description An optional maximum width of the SearchView. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#maxWidth}. @attr name android:maxWidth */ public static final int SearchView_android_maxWidth = 0; /** <p> @attr description The default state of the SearchView. If true, it will be iconified when not in use and expanded when clicked. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:iconifiedByDefault */ public static final int SearchView_iconifiedByDefault = 3; /** <p> @attr description An optional query hint string to be displayed in the empty query field. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:queryHint */ public static final int SearchView_queryHint = 4; /** Attributes that can be used with a Spinner. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #Spinner_android_dropDownHorizontalOffset android:dropDownHorizontalOffset}</code></td><td> Horizontal offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_android_dropDownSelector android:dropDownSelector}</code></td><td> List selector to use for spinnerMode="dropdown" display.</td></tr> <tr><td><code>{@link #Spinner_android_dropDownVerticalOffset android:dropDownVerticalOffset}</code></td><td> Vertical offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_android_dropDownWidth android:dropDownWidth}</code></td><td> Width of the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_android_gravity android:gravity}</code></td><td> Gravity setting for positioning the currently selected item.</td></tr> <tr><td><code>{@link #Spinner_android_popupBackground android:popupBackground}</code></td><td> Background drawable to use for the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_disableChildrenWhenDisabled com.whu.readshare:disableChildrenWhenDisabled}</code></td><td> Whether this spinner should mark child views as enabled/disabled when the spinner itself is enabled/disabled.</td></tr> <tr><td><code>{@link #Spinner_popupPromptView com.whu.readshare:popupPromptView}</code></td><td> Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_prompt com.whu.readshare:prompt}</code></td><td> The prompt to display when the spinner's dialog is shown.</td></tr> <tr><td><code>{@link #Spinner_spinnerMode com.whu.readshare:spinnerMode}</code></td><td> Display mode for spinner options.</td></tr> </table> @see #Spinner_android_dropDownHorizontalOffset @see #Spinner_android_dropDownSelector @see #Spinner_android_dropDownVerticalOffset @see #Spinner_android_dropDownWidth @see #Spinner_android_gravity @see #Spinner_android_popupBackground @see #Spinner_disableChildrenWhenDisabled @see #Spinner_popupPromptView @see #Spinner_prompt @see #Spinner_spinnerMode */ public static final int[] Spinner = { 0x010100af, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050 }; /** <p> @attr description Horizontal offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownHorizontalOffset}. @attr name android:dropDownHorizontalOffset */ public static final int Spinner_android_dropDownHorizontalOffset = 4; /** <p> @attr description List selector to use for spinnerMode="dropdown" display. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownSelector}. @attr name android:dropDownSelector */ public static final int Spinner_android_dropDownSelector = 1; /** <p> @attr description Vertical offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownVerticalOffset}. @attr name android:dropDownVerticalOffset */ public static final int Spinner_android_dropDownVerticalOffset = 5; /** <p> @attr description Width of the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownWidth}. @attr name android:dropDownWidth */ public static final int Spinner_android_dropDownWidth = 3; /** <p> @attr description Gravity setting for positioning the currently selected item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#gravity}. @attr name android:gravity */ public static final int Spinner_android_gravity = 0; /** <p> @attr description Background drawable to use for the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#popupBackground}. @attr name android:popupBackground */ public static final int Spinner_android_popupBackground = 2; /** <p> @attr description Whether this spinner should mark child views as enabled/disabled when the spinner itself is enabled/disabled. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:disableChildrenWhenDisabled */ public static final int Spinner_disableChildrenWhenDisabled = 9; /** <p> @attr description Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown". This layout must contain a TextView with the id {@code @android:id/text1} to be populated with the prompt text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:popupPromptView */ public static final int Spinner_popupPromptView = 8; /** <p> @attr description The prompt to display when the spinner's dialog is shown. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:prompt */ public static final int Spinner_prompt = 6; /** <p> @attr description Display mode for spinner options. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>dialog</code></td><td>0</td><td> Spinner options will be presented to the user as a dialog window. </td></tr> <tr><td><code>dropdown</code></td><td>1</td><td> Spinner options will be presented to the user as an inline dropdown anchored to the spinner widget itself. </td></tr> </table> <p>This is a private symbol. @attr name com.whu.readshare:spinnerMode */ public static final int Spinner_spinnerMode = 7; /** These are the standard attributes that make up a complete theme. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #Theme_actionDropDownStyle com.whu.readshare:actionDropDownStyle}</code></td><td> Default ActionBar dropdown style.</td></tr> <tr><td><code>{@link #Theme_dropdownListPreferredItemHeight com.whu.readshare:dropdownListPreferredItemHeight}</code></td><td> The preferred item height for dropdown lists.</td></tr> <tr><td><code>{@link #Theme_listChoiceBackgroundIndicator com.whu.readshare:listChoiceBackgroundIndicator}</code></td><td> Drawable used as a background for selected list items.</td></tr> <tr><td><code>{@link #Theme_panelMenuListTheme com.whu.readshare:panelMenuListTheme}</code></td><td> Default Panel Menu style.</td></tr> <tr><td><code>{@link #Theme_panelMenuListWidth com.whu.readshare:panelMenuListWidth}</code></td><td> Default Panel Menu width.</td></tr> <tr><td><code>{@link #Theme_popupMenuStyle com.whu.readshare:popupMenuStyle}</code></td><td> Default PopupMenu style.</td></tr> </table> @see #Theme_actionDropDownStyle @see #Theme_dropdownListPreferredItemHeight @see #Theme_listChoiceBackgroundIndicator @see #Theme_panelMenuListTheme @see #Theme_panelMenuListWidth @see #Theme_popupMenuStyle */ public static final int[] Theme = { 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047, 0x7f010048 }; /** <p> @attr description Default ActionBar dropdown style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:actionDropDownStyle */ public static final int Theme_actionDropDownStyle = 0; /** <p> @attr description The preferred item height for dropdown lists. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:dropdownListPreferredItemHeight */ public static final int Theme_dropdownListPreferredItemHeight = 1; /** <p> @attr description Drawable used as a background for selected list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:listChoiceBackgroundIndicator */ public static final int Theme_listChoiceBackgroundIndicator = 5; /** <p> @attr description Default Panel Menu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:panelMenuListTheme */ public static final int Theme_panelMenuListTheme = 4; /** <p> @attr description Default Panel Menu width. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:panelMenuListWidth */ public static final int Theme_panelMenuListWidth = 3; /** <p> @attr description Default PopupMenu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.whu.readshare:popupMenuStyle */ public static final int Theme_popupMenuStyle = 2; /** Attributes that can be used with a View. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #View_android_focusable android:focusable}</code></td><td> Boolean that controls whether a view can take focus.</td></tr> <tr><td><code>{@link #View_paddingEnd com.whu.readshare:paddingEnd}</code></td><td> Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}.</td></tr> <tr><td><code>{@link #View_paddingStart com.whu.readshare:paddingStart}</code></td><td> Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}.</td></tr> </table> @see #View_android_focusable @see #View_paddingEnd @see #View_paddingStart */ public static final int[] View = { 0x010100da, 0x7f010034, 0x7f010035 }; /** <p> @attr description Boolean that controls whether a view can take focus. By default the user can not move focus to a view; by setting this attribute to true the view is allowed to take focus. This value does not impact the behavior of directly calling {@link android.view.View#requestFocus}, which will always request focus regardless of this view. It only impacts where focus navigation will try to move focus. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#focusable}. @attr name android:focusable */ public static final int View_android_focusable = 0; /** <p> @attr description Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:paddingEnd */ public static final int View_paddingEnd = 2; /** <p> @attr description Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.whu.readshare:paddingStart */ public static final int View_paddingStart = 1; }; }
[ "liliaowhu@foxmail.com" ]
liliaowhu@foxmail.com
f0c662875effee3347c3d0bcfc66852d200d8749
600cdbeb86d71847ce8d085af70a1aeb2e1f6898
/src/Explosives.java
15352fe94bb407304089fad59ece69afdb3912c3
[]
no_license
sherlocknoir/TestAvanceTd4
4278331fbb030ee10392445f322e3c3aafc3359e
2bcca7b71eda6be766aa2b239431d05d70554c0d
refs/heads/master
2021-01-25T08:32:32.361050
2014-11-03T23:06:52
2014-11-03T23:06:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,953
java
// Based on a B specification from Marie-Laure Potet. import java.util.HashMap; import java.util.Iterator; import java.util.Map; //@ nullable_by_default public class Explosives{ public int nb_inc = 0; public String [][] incomp = new String[50][2]; public int nb_assign = 0; public String [][] assign = new String[30][2]; /*@ public invariant // Prop 1 @ (0 <= nb_inc && nb_inc < 50); @*/ /** * le variable incomp est un tableau 2 dimentions [50][2], * donc le nombre de incompatibles au paires et il ne peut pas dépasser à 50 * il faut contraindre nb_inc entre 0 et 50 */ /*@ public invariant // Prop 2 @ (0 <= nb_assign && nb_assign < 30); @*/ /** * le variable assign est un tableau 2 dimentions [30][2], * donc le nombre de assign au paires et il ne peut pas dépasser à 30 * il faut contraindre nb_assign entre 0 et 30 */ /*@ public invariant // Prop 3 @ (\forall int i; 0 <= i && i < nb_inc; @ incomp[i][0].startsWith("Prod") && incomp[i][1].startsWith("Prod")); @*/ /** * Tous les elements au paires dans le tableau incomp, * il faut commencer par "Prod" * Comme ca on peut assurer ce qu'on compare les choses de meme type. */ /*@ public invariant // Prop 4 @ (\forall int i; 0 <= i && i < nb_assign; @ assign[i][0].startsWith("Bat") && assign[i][1].startsWith("Prod")); @*/ /** * pour les elements au paires dans le tableau assign, * il faut verifier que tous sont bien typées comme dessus: * le premier varible dans assign[] est un batiment, alors il faut commencer par "Bat" * Deuxeme varible dans assign[] est un produit, alors il faut commencer par "Prod" */ /*@ public invariant // Prop 5 @ (\forall int i; 0 <= i && i < nb_inc; !(incomp[i][0]).equals(incomp[i][1])); @*/ /** * Il faut verifier que chaque paire d'éléments inserees sont différents dans le tableau incomp. * CTD on ne peut pas avoir un produit qui est incompatible avec soi-même. */ /*@ public invariant // Prop 6 @ (\forall int i; 0 <= i && i < nb_inc; @ (\exists int j; 0 <= j && j < nb_inc; @ (incomp[i][0]).equals(incomp[j][1]) @ && (incomp[j][0]).equals(incomp[i][1]))); @*/ /** * Pour chaque i contraint entre 0 et nb_inc, * il existe un j qui satisfait (incomp[i][0]).equals(incomp[j][1]) &&(incomp[j][0]).equals(incomp[i][1]))) * CTD, pour chaque couple de variables dans le tableau incomp, * les deux instances de ce couple, ils ont d'ordre. * s'il existe un couple (A , B), il faut verifier qu'il exite le couple à l'inverse(B, A) */ /*@ public invariant // Prop 7 @ (\forall int i; 0 <= i && i < nb_assign; @ (\forall int j; 0 <= j && j < nb_assign; @ (i != j && (assign[i][0]).equals(assign [j][0])) ==> @ (\forall int k; 0 <= k && k < nb_inc; @ (!(assign[i][1]).equals(incomp[k][0])) @ || (!(assign[j][1]).equals(incomp[k][1]))))); @*/ /** * A ==> B est equal avec !A||B, * si A implies B est vrai, CTD, si A est vrai, alors B est obligatoirement vrai; * sinon A est faux, on ne vérifie pas B. * donc pour ce cas là, soit les produits ne sont pas dans le meme batiment, * soit si ils déposent dans le meme endroit, ils doivent etre compatible * * Cette invariant est pour assurer qu'il n'y pas des produits incompatibles qui sont déposés dans le meme batiment. */ /*@requires prod1 != null; @requires prod2 != null; @requires nb_inc < 48; @requires !prod1.equals(prod2); @requires prod1.startsWith("Prod") && prod2.startsWith("Prod"); @*/ public void add_incomp(String prod1, String prod2){ incomp[nb_inc][0] = prod1; incomp[nb_inc][1] = prod2; incomp[nb_inc+1][1] = prod1; incomp[nb_inc+1][0] = prod2; nb_inc = nb_inc+2; } /*@requires bat != null; @requires prod != null; @requires nb_assign < 29; @requires bat.startsWith("Bat") && prod.startsWith("Prod"); @requires @ (\forall int i; 0 <= i && i < nb_assign; @ (assign[i][0].equals(bat)) ==> @ !(\exists int j; 0 <= j && j < nb_inc; @ (assign[i][1].equals(incomp[j][0]) && incomp[j][1].equals(prod)))); @*/ public void add_assign(String bat, String prod){ assign[nb_assign][0] = bat; assign[nb_assign][1] = prod; nb_assign = nb_assign+1; } // 1ere moyenne //@requires prod != null; //@requires prod.startsWith("Prod"); /*@requires //specifier en JML @(\exists int i; 0<=i && i<nb_assign; @ (\forall int j; 0<=j && j<nb_assign; @ (assign[i][0].equals(assign[j][0]) ==> @ (compatible(assign[j][1], prod))))); @*/ public /*@ pure @*/ String findBat1(String prod){ boolean trueFlag = false; for(int i = 0; i < nb_assign; i++){ for(int k = 0; k < nb_assign; k++){ if(!assign[i][0].equals(assign[k][0])) continue; if(!compatible(assign[k][1], prod)){ trueFlag = false; break; } else trueFlag = true; } if(trueFlag == true) return assign[i][0]; } return null; } // 2eme moyenne /*@ requires prod != null && prod.startsWith("Prod"); @ ensures (\forall int i; 0<=i && i<nb_assign; @ (assign[i][0].equals(\result) ==> @ (compatible(assign[i][1], prod)))); @ ensures (\result.startsWith("Bat")); @*/ public /*@ pure @*/ String findBat2(String prod) { /* code -2 means not compatable. -1 means compatible but product isnt already in the building. >=0 is the index of the building where the product is already found. */ //un map qui contient notre list de batiment availible. HashMap batList = new HashMap(); for (int i = 0; i < nb_assign; i++) { String bat = assign[i][0]; String product = assign[i][1]; // System.out.println("loop index : "+i+" batname: "+bat+" prod inside: "+product); if (batList.containsKey(bat)) { //our map already contains the building we only // change the marker of a building if it becomes incompatible or to mark it as // already containing the product. if (!compatible(prod, product)) { //mark the building as incompatible batList.put(bat, Integer.valueOf(-2)); } else if (((Integer)batList.get(bat)).intValue() ==-1 && prod.equals(product)) { //mark the building already containing the prod. batList.put(bat, Integer.valueOf(i)); } } else { //building doesnt exist added and set intial building marker code. System.out.println("bulding doesnt exsit adding it to the map"); if (compatible(prod, product)) { if (prod.equals(product)) { //add the batiment to the array with index of building containing // the prod already batList.put(bat, Integer.valueOf(i)); System.out.println(" added at index " + i); } else { //add the name of the building with a marker that it is compatible for // the product. batList.put(bat, Integer.valueOf(-1)); System.out.println("compatible but isnt the same"); } } else { //add building with marker that the building is not compatable System.out.println("not comp new building gets a -2"); batList.put(bat, Integer.valueOf(-2)); } } } String bestBuildingMatch= null; //compatible and has the product String secondBuildingMatch= null; //compatible but doesnt have the product System.out.println("new map size "+batList.size()); //find the best matching building for (Iterator it = batList.entrySet().iterator(); it.hasNext();) { Map.Entry pairs = (Map.Entry) it.next(); System.out.println(pairs.getKey() + " = " + (Integer)pairs.getValue()); int comp = ((Integer) pairs.getValue()).intValue(); String name = pairs.getKey().toString(); if(comp >=0){ bestBuildingMatch = name; } else if(comp == -1){ secondBuildingMatch = name; } } //return the best matching building System.out.println("batlist? "+batList.values()); if(bestBuildingMatch !=null){ return bestBuildingMatch; } else if (secondBuildingMatch !=null){ return secondBuildingMatch; } else{ //no compatible building found so we create a new one int count = 0; while(true) { //loop until we find a name that doesnt exsist. String name = "Bat_" + count; if (! batList.containsKey(name)) { return name; } else { count++; } } } } //@requires !prod1.equals(prod2); //@requires prod1 != null; //@requires prod2 != null; /*@ ensures \result == true <==> @ (\forall int i; 0<=i && i<nb_inc; !(incomp[i][0].equals(prod1) && incomp[i][1].equals(prod2))); @*/ public /*@ pure @*/ boolean compatible(String prod1, String prod2){ for( int i = 0; i < nb_inc; i++){ if(incomp[i][0].equals(prod1) && incomp[i][1].equals(prod2)){ return false; } } return true; } public void skip(){ } }
[ "wangheda.li@gmail.com" ]
wangheda.li@gmail.com
d532c01b8c7da4d3a34aab6505a2379203f727d6
bcd723cd252e8da75eab76c85af2f4b6e38c0ed7
/Dfs.java
8814b2d3d87e348c517a9ab5739971610794c495
[]
no_license
weichaoxi/SlidingBrickPuzzle
54fb597dab170916507c117f06fda0cbbdce1f14
e4493caa399431e1cbbbb08be529a5f6f2575cf0
refs/heads/master
2020-07-06T08:44:10.572210
2019-08-18T04:55:00
2019-08-18T04:55:00
202,959,613
0
0
null
null
null
null
UTF-8
Java
false
false
4,097
java
import java.util.*; public class Dfs { //vns stands for visited not solved //it stores states discovered while searching that do not represent solved states //this info is used to avoid searching states that are already verified to not be solved //and thus avoid getting stuck in loops private static ArrayList<int[][]> vns; public static void dfs(GameState g) { long startTime = System.currentTimeMillis(); vns = new ArrayList<>(); Stack<Node> stack = new Stack<>(); //stack to store states that can be reached int nodesExplored = 1; Node start = new Node(g, 0, null, null); start.gameState.normalize(); if(start.gameState.isSolved()) { System.out.println("#" + nodesExplored + " " + "0" + " " + start.depth); } else { vns.add(start.gameState.state); for(Move m : Move.getAllMoves(start.gameState)) { GameState childState = Move.applyMoveCloning(start.gameState, m); Node child = new Node(childState, start.depth + 1, start, m); //add nodes that represent the states reached after moves stack.push(child); } //at this point, the queue only contains the states accessible from //the initial state in the next move while(!stack.isEmpty()) { //check if the next state in queue is already known to be not solved Node next = stack.pop(); nodesExplored++; next.gameState.normalize(); if(next.gameState.isSolved()) { long endTime = System.currentTimeMillis(); double totalTime = (double)(endTime - startTime)/1000; Stack<String> messages = new Stack<>(); Node solution = next; //copy solution state for displaying System.out.println(); System.out.println("Depth First Search"); while(next.parent != null) { //this puts all the moves from beginning to end in reverse order messages.push("(" + next.moveToReach.piece + ", " + next.moveToReach.direction + ")"); next = next.parent; } while(!messages.isEmpty()) { //pop everything in stack to print list of moves to solve state System.out.println(messages.pop()); } solution.gameState.printState(); System.out.println(); System.out.println("#" + nodesExplored + " " + totalTime + " " + solution.depth); return; } boolean alreadyExists = false; for(int[][] notSolved : vns) { if(Arrays.deepEquals(next.gameState.state, notSolved)) alreadyExists = true; } if(!alreadyExists) { //add the new unsolved state to array so alg knows not to process it again vns.add(next.gameState.state); //System.out.println(); //System.out.println(); //for testing purposes //next.gameState.printState(); for(Move m : Move.getAllMoves(next.gameState)) { GameState child = Move.applyMoveCloning(next.gameState, m); child.normalize(); boolean exists = false; for(int[][] notSolved : vns) { if(Arrays.deepEquals(child.state, notSolved)) exists = true; } if(!exists) { Node c = new Node(child, next.depth + 1, next, m); //add nodes that represent the states reached after moves stack.push(c); } } } } } } }
[ "wx45@drexel.edu" ]
wx45@drexel.edu
1a6aef497111b356f2548b1cde7a204728c8e46e
813ad225d282310852ef1c2142985cf93e2bf9be
/MagicCameraNew/library/src/main/java/com/seu/magicfilter/filter/advanced/MagicHefeFilter.java
ca3f6c82e3bbfcdebc2bf0ebb451c60a25631ac5
[ "MIT" ]
permissive
Darobactin/GRP-Team11
618adeacf5b7bf487e20a829fd253185968a0c59
a9852b3a086818a0d688cb9ed7ad32abcf59f62b
refs/heads/master
2021-10-28T10:05:42.313058
2019-04-23T09:50:11
2019-04-23T09:50:11
157,871,121
1
0
null
null
null
null
UTF-8
Java
false
false
2,616
java
/* * Copyright (C) 2019 Baidu, Inc. All Rights Reserved. */ package com.seu.magicfilter.filter.advanced; import com.seu.magicfilter.filter.base.gpuimage.GPUImageFilter; import com.seu.magicfilter.utils.MagicParams; import com.seu.magicfilter.utils.OpenGlUtils; import android.opengl.GLES20; import duxiaoman.guofeng.myapplicationbeauty.R; public class MagicHefeFilter extends GPUImageFilter{ private int[] inputTextureHandles = {-1,-1,-1,-1}; private int[] inputTextureUniformLocations = {-1,-1,-1,-1}; private int mGLStrengthLocation; public MagicHefeFilter(){ super(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.hefe)); } protected void onDestroy() { super.onDestroy(); GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0); for(int i = 0; i < inputTextureHandles.length; i++) inputTextureHandles[i] = -1; } protected void onDrawArraysAfter(){ for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){ GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3)); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); } } //调用顺序3:提交给shader protected void onDrawArraysPre(){ for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){ GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) ); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]); GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3)); } } //调用顺序2:载入程序 protected void onInit(){ super.onInit(); for(int i=0; i < inputTextureUniformLocations.length; i++) // Set program handles inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture"+(2+i)); mGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId, "strength"); } //调用顺序1:载入图片,然后将图片绑定给纹理,获取纹理索引 protected void onInitialized(){ super.onInitialized(); setFloat(mGLStrengthLocation, 1.0f); runOnDraw(new Runnable(){ public void run(){ inputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, "filter/edgeburn.png"); inputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, "filter/hefemap.png"); inputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, "filter/hefemetal.png"); inputTextureHandles[3] = OpenGlUtils.loadTexture(MagicParams.context, "filter/hefesoftlight.png"); } }); } }
[ "zy22082@nottingham.edu.cn" ]
zy22082@nottingham.edu.cn
8eaab55e94f2f6aaca6057009587dc12c3e85b41
ff7a33ae80089f95e283fe02e4adf09cb56cfac0
/src/main/java/com/hm/hbase/CellDemo.java
024df6f52f4d5f15a7fb132b35514a25124c69b0
[]
no_license
yingxincui/hbase
20fc2da4a66aa9661dcf20b2f29d07ef4087e535
43ce23410ffe4f851bff8e999035a632d1d0fe09
refs/heads/master
2023-02-17T18:53:04.522588
2021-01-18T06:19:19
2021-01-18T06:19:19
330,568,563
0
0
null
null
null
null
UTF-8
Java
false
false
725
java
package com.hm.hbase; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; import org.junit.After; import org.junit.Before; public class CellDemo { private Admin admin; @Before public void getAdmin() { admin = HbaseUtil.getAdmin(); } @After public void close() { HbaseUtil.closeAdmin(admin); } public void getCell(){ Table table= com.hm.hbasecurd.HbaseUtil.getTable("ns1:emp"); Put newput = new Put("rk000001".getBytes()); newput.addColumn("base".getBytes(), "message".getBytes(), "hello michael".getBytes()); } }
[ "yingxincui@sina.com" ]
yingxincui@sina.com
ea8df59008f4e65247f87106207098f5b4be7ef9
95b69a21586d6d83231a534d90279743608c05ca
/src/main/java/com/anytrek/ts3/dto/TrkInfoDetailDto.java
8eed6649e1a931720529e3cfc000cc4c2aea8aa7
[]
no_license
johnlanliu/TS3Demo_Backend
3db2d68f1e1548fdf6400b94cffcf38a3e565f1b
bef92abeb5cc773f6a70575eff7d1ee65f704435
refs/heads/master
2022-10-28T07:35:03.643861
2019-08-09T09:35:23
2019-08-09T09:35:23
180,215,360
0
0
null
2022-10-05T03:22:35
2019-04-08T19:05:42
Java
UTF-8
Java
false
false
1,430
java
package com.anytrek.ts3.dto; import javax.persistence.Column; import com.anytrek.ts3.model.TrkInfo; import com.fasterxml.jackson.annotation.JsonView; /** * trkInfo扩展 增加一些关联表属性 * @author John * date 2018 M10 8 */ public class TrkInfoDetailDto extends TrkInfo{ /** 版本号 */ private static final long serialVersionUID = 4034635723711775295L; @Column(name = "model_name") @JsonView(View.Summary.class) private String modelName; @Column(name = "org_name") @JsonView(View.Summary.class) private String orgName; @Column(name = "batch_name") @JsonView(View.Summary.class) private String batchName; //固件版本名称 @Column(name = "file_name") @JsonView(View.Summary.class) private String fileName; public String getModelName() { return modelName; } public void setModelName(String modelName) { this.modelName = modelName; } public String getOrgName() { return orgName; } public void setOrgName(String orgName) { this.orgName = orgName; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getBatchName() { return batchName; } public void setBatchName(String batchName) { this.batchName = batchName; } }
[ "l07954585311" ]
l07954585311
8e73f09dc269a804d4ebb95d2b3918b107c51854
4cb6fed45cdec56994c475da9daa7f581374c7d9
/blade-cache/src/main/java/blade/cache/impl/FIFOCache.java
20399c474be28a15461a9d69c65e2b3f3a6d6e60
[ "Apache-2.0" ]
permissive
JeffLi1993/blade
94228635ea57c304ded2c757c8eeb81eb14a28da
d3c9d809b66b1433dc569479343fe49fba5898c2
refs/heads/master
2021-01-25T11:27:43.058162
2015-10-28T07:17:49
2015-10-28T07:17:49
45,096,751
1
2
null
2015-10-28T07:47:50
2015-10-28T07:47:50
null
UTF-8
Java
false
false
979
java
package blade.cache.impl; import java.util.Iterator; import blade.cache.AbstractCache; import blade.cache.CacheObject; /** * FIFO实现 * * @author <a href="mailto:biezhi.me@gmail.com" target="_blank">biezhi</a> * @since 1.0 * @param <K> * @param <V> */ public class FIFOCache<K, V> extends AbstractCache<K, V> { public FIFOCache(int cacheSize) { super(cacheSize); } @Override protected int eliminateCache() { int count = 0; K firstKey = null; Iterator<CacheObject<K, V>> iterator = _mCache.values().iterator(); while (iterator.hasNext()) { CacheObject<K, V> cacheObject = iterator.next(); if (cacheObject.isExpired()) { iterator.remove(); count++; } else { if (firstKey == null) firstKey = cacheObject.getKey(); } } if (firstKey != null && isFull()) {// 删除过期对象还是满,继续删除链表第一个 _mCache.remove(firstKey); } return count; } }
[ "biezhi.me@gmail.com" ]
biezhi.me@gmail.com
c996acc10f5d6826d3d2d1f08349ab0ba5cf435f
84e5f8d0209360c882c279a361ea24415c900bb8
/src/ec/edu/epn/getmovie/controller/cuenta/Home.java
d16d45af0bc1c29c0b86134ccd228b833ec5bbc2
[]
no_license
SamLOving/GetMovie
c93a65d9960f1805fcae15f85159bd09797ace0f
5546ef81e07b8c7e889b52f477724509d346b411
refs/heads/master
2020-04-06T04:20:57.423891
2016-06-13T15:26:51
2016-06-13T15:26:51
59,629,998
1
0
null
null
null
null
UTF-8
Java
false
false
1,261
java
package ec.edu.epn.getmovie.controller.cuenta; 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; /** * Servlet implementation class HomeCuenta */ @WebServlet("/home") public class Home extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Home() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub getServletConfig().getServletContext().getRequestDispatcher("/vistas/home.jsp").forward(request, response);; } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "gloomyfairy@hotmail.es" ]
gloomyfairy@hotmail.es
4c5fdde929e7ae2da02607714dff68a83a235f20
4b8d4a27ec0943e704c1f13db8760b54003714d5
/后端/demo_ssm 2/src/main/java/com/system/service/impl/AirlineServiceImpl.java
64cccc8bb88eeff505c6ffb2dda4045d8f1a443c
[ "Apache-2.0" ]
permissive
YuMing1114/ssm-ptss
750fc43096e7351de20a404dedf5c1d8f47ff714
b7b2fc5ec47289d05fefbcd8d9fc5b98cacaea08
refs/heads/main
2023-04-10T14:34:34.859060
2021-04-21T07:04:11
2021-04-21T07:04:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,577
java
package com.system.service.impl; import com.system.domain.AirlineInfo; import com.system.mapper.AirlineInfoMapper; import com.system.service.AirlineService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; @Service public class AirlineServiceImpl implements AirlineService { @Autowired private AirlineInfoMapper airlineInfoMapper; @Override public String Cregister(AirlineInfo airlineInfo) { AirlineInfo isregister = airlineInfoMapper.selectByAirlineName(airlineInfo.getAirlineName()); if (isregister == null) { Date register_time = new Date(); String isvalid = "未审核"; airlineInfo.setRegisterdate(register_time); airlineInfo.setIsvalid(isvalid); airlineInfoMapper.insertSelective(airlineInfo); return "ok"; } else { return "fail"; } } @Override public List<AirlineInfo> getList() { return airlineInfoMapper.selectAll(); } @Override public String airlinelogin(String username,String password) { //先判断用户是否存在 AirlineInfo islogin = airlineInfoMapper.selectByAirlineName(username); //获取是否通过通过 if (islogin != null) { //获取是否审核通过 String isvaild = islogin.getIsvalid(); if (isvaild.equals("未审核")) { return "未审核"; } else { //获取密码 String getpassword = islogin.getAirlinePassword(); if (password.equals(getpassword)) { return "success"; } else { return "loginfail"; } } } else { return "noexit"; } } @Override public String vaildpass(AirlineInfo airlineInfo) { airlineInfoMapper.updateByPrimaryKeySelective(airlineInfo); return "success"; } @Override public String deleteOne(AirlineInfo airlineInfo) { int airlineid = airlineInfo.getAirlineId(); airlineInfoMapper.deleteByPrimaryKey(airlineid); return "success"; } @Override public List<AirlineInfo> searchListByName(String searchtext) { return airlineInfoMapper.selectListByName(searchtext); } @Override public List<AirlineInfo> getallAirName() { return airlineInfoMapper.selectAllairlineName(); } }
[ "52183346+Orikisiori@users.noreply.github.com" ]
52183346+Orikisiori@users.noreply.github.com
62bb25234bd89e78e0034dbe03113db42c0bedec
9ff9c9d4ea065ae3636ad0e743414de72af4286a
/src/main/java/com/ityouzi/common/utils/ip/IpUtils.java
34758157f097d81dad6ae7b20e65ac171437430d
[]
no_license
ityouzi/RuoYi-Vue-202006
a18963fdfedcc1acd9cf5bc4d930155ab9aa7e20
018c56ecb98743ea7e637237b7e14d8d83d08f41
refs/heads/master
2023-03-25T17:15:37.579379
2021-03-26T06:04:40
2021-03-26T06:04:40
286,924,599
0
0
null
null
null
null
UTF-8
Java
false
false
5,630
java
package com.ityouzi.common.utils.ip; import com.ityouzi.common.utils.StringUtils; import javax.servlet.http.HttpServletRequest; import java.net.InetAddress; import java.net.UnknownHostException; /** * @Auther: lizhen * @Date: 2020-06-14 14:55 * @Description: 获取IP方法 */ public class IpUtils { public static String getIpAddr(HttpServletRequest request){ if (request == null){ return "unknown"; } String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("X-Forwarded-For"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("X-Real-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } return "0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; } public static boolean internalIp(String ip) { byte[] addr = textToNumericFormatV4(ip); return internalIp(addr) || "127.0.0.1".equals(ip); } private static boolean internalIp(byte[] addr) { if (StringUtils.isNull(addr) || addr.length < 2) { return true; } final byte b0 = addr[0]; final byte b1 = addr[1]; // 10.x.x.x/8 final byte SECTION_1 = 0x0A; // 172.16.x.x/12 final byte SECTION_2 = (byte) 0xAC; final byte SECTION_3 = (byte) 0x10; final byte SECTION_4 = (byte) 0x1F; // 192.168.x.x/16 final byte SECTION_5 = (byte) 0xC0; final byte SECTION_6 = (byte) 0xA8; switch (b0) { case SECTION_1: return true; case SECTION_2: if (b1 >= SECTION_3 && b1 <= SECTION_4) { return true; } case SECTION_5: switch (b1) { case SECTION_6: return true; } default: return false; } } /** * 将IPv4地址转换成字节 * * @param text IPv4地址 * @return byte 字节 */ public static byte[] textToNumericFormatV4(String text) { if (text.length() == 0) { return null; } byte[] bytes = new byte[4]; String[] elements = text.split("\\.", -1); try { long l; int i; switch (elements.length) { case 1: l = Long.parseLong(elements[0]); if ((l < 0L) || (l > 4294967295L)) return null; bytes[0] = (byte) (int) (l >> 24 & 0xFF); bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); bytes[3] = (byte) (int) (l & 0xFF); break; case 2: l = Integer.parseInt(elements[0]); if ((l < 0L) || (l > 255L)) return null; bytes[0] = (byte) (int) (l & 0xFF); l = Integer.parseInt(elements[1]); if ((l < 0L) || (l > 16777215L)) return null; bytes[1] = (byte) (int) (l >> 16 & 0xFF); bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); bytes[3] = (byte) (int) (l & 0xFF); break; case 3: for (i = 0; i < 2; ++i) { l = Integer.parseInt(elements[i]); if ((l < 0L) || (l > 255L)) return null; bytes[i] = (byte) (int) (l & 0xFF); } l = Integer.parseInt(elements[2]); if ((l < 0L) || (l > 65535L)) return null; bytes[2] = (byte) (int) (l >> 8 & 0xFF); bytes[3] = (byte) (int) (l & 0xFF); break; case 4: for (i = 0; i < 4; ++i) { l = Integer.parseInt(elements[i]); if ((l < 0L) || (l > 255L)) return null; bytes[i] = (byte) (int) (l & 0xFF); } break; default: return null; } } catch (NumberFormatException e) { return null; } return bytes; } public static String getHostIp() { try { return InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { } return "127.0.0.1"; } public static String getHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { } return "未知"; } }
[ "2504480136@qq.com" ]
2504480136@qq.com
35567c31f7ce0af82cd25e46c6d7252cd575b7b0
16c4b5a509551c563859bd510b86bb3a1ed64849
/src/test/java/com/example/testcache/TestcacheApplicationTests.java
726ba53c0d4b9f589cb1fa22888741f0889686dd
[]
no_license
rkritchat/Spring_JPA_with_cache
41a6fd2220f22e87f8264ebed73eb832f7f07e89
4b4364a9186cc83c62ffc099fd1432e7971c43a0
refs/heads/master
2020-04-01T10:37:12.456683
2018-10-15T14:05:44
2018-10-15T14:05:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.example.testcache; 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 TestcacheApplicationTests { @Test public void contextLoads() { } }
[ "laphatrada@iMac-khxng-Laphatrada.local" ]
laphatrada@iMac-khxng-Laphatrada.local
95d069712f0e0b8c45481285a734289392473ceb
fda1ee633e8dbaae791da9a5e6c747c4d3cf50df
/faceye-hadoop-manager/src/template/project/src/test/java/com/faceye/test/component/mail/service/MailServiceTestCase.java
b009a0932c092824f6276cebb59124831d147375
[]
no_license
haipenge/faceye-hadoop
4670fbd55f1cd63bbeb0e962c3851cef3426b48a
1dff867c820eee16da408ec4d91a089f2a1b0e1b
refs/heads/master
2021-01-22T02:17:17.733570
2018-04-02T13:08:08
2018-04-02T13:08:08
92,345,654
1
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package com.faceye.test.component.mail.service; import java.util.HashMap; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.faceye.component.mail.service.MailService; import com.faceye.component.mail.service.wrap.Mail; import com.faceye.test.feature.service.BaseServiceTestCase; @RunWith(SpringJUnit4ClassRunner.class) public class MailServiceTestCase extends BaseServiceTestCase { private Log log=LogFactory.getLog(getClass()); @Autowired private MailService mailService=null; @Test public void testSendTextMail() throws Exception{ Mail mail=new Mail(); mail.setReceiver("haipenge@gmail.com"); mail.setSubject("test mail"); this.mailService.sendMail(mail); } @Test public void testSendHtmlMail() throws Exception{ Mail mail=new Mail(); mail.setReceiver("haipenge@gmail.com"); mail.setSubject("test mail"); Map body =new HashMap(); body.put("key-1", "test-key-1"); body.put("key-2", "test-key-2"); mail.setBody(body); this.mailService.sendMail(mail); } }
[ "haipenge@gmail.com" ]
haipenge@gmail.com
103085cc77c5f06f0d401d7b3fc0e808a304b0d0
0374096d7bc5bf8d609908d2a298e009d5a5b0a3
/layoutmanager/src/main/java/com/mcxtzhang/layoutmanager/flow/FlowLayoutManager.java
fbcaa298568cd052eaf4cc89bde4fcff58b01a37
[]
no_license
KyrieWangyz/ZLayoutManager-master
d8b337b9bd8b39226324bd1c2731c78b350adaa0
6e7efc05a0c3b9efa2e9b9ce8706ddfa3c21455d
refs/heads/master
2020-03-08T13:49:38.555635
2018-04-05T06:37:03
2018-04-05T06:37:03
128,168,138
2
0
null
null
null
null
UTF-8
Java
false
false
11,403
java
package com.mcxtzhang.layoutmanager.flow; import android.graphics.Rect; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; /** * 介绍:流式布局LayoutManager * 作者:zhangxutong * 邮箱:zhangxutong@imcoming.com * 时间: 2016/10/26. */ public class FlowLayoutManager extends RecyclerView.LayoutManager { private int mVerticalOffset;//竖直偏移量 每次换行时,要根据这个offset判断 private int mFirstVisiPos;//屏幕可见的第一个View的Position private int mLastVisiPos;//屏幕可见的最后一个View的Position private SparseArray<Rect> mItemRects;//key 是View的position,保存View的bounds 和 显示标志, /* private class FlowItem { public Rect bounds;//View的边界 public boolean isShow;//View 是否显示 public FlowItem(Rect bounds, boolean isShow) { this.bounds = bounds; this.isShow = isShow; } }*/ public FlowLayoutManager() { setAutoMeasureEnabled(true); mItemRects = new SparseArray<>(); } @Override public RecyclerView.LayoutParams generateDefaultLayoutParams() { return new RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); } @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { if (getItemCount() == 0) {//没有Item,界面空着吧 detachAndScrapAttachedViews(recycler); return; } if (getChildCount() == 0 && state.isPreLayout()) {//state.isPreLayout()是支持动画的 return; } //onLayoutChildren方法在RecyclerView 初始化时 会执行两遍 detachAndScrapAttachedViews(recycler); //初始化区域 mVerticalOffset = 0; mFirstVisiPos = 0; mLastVisiPos = getItemCount(); //初始化时调用 填充childView fill(recycler, state); } /** * 初始化时调用 填充childView * * @param recycler * @param state */ private void fill(RecyclerView.Recycler recycler, RecyclerView.State state) { fill(recycler, state, 0); } /** * 填充childView的核心方法,应该先填充,再移动。 * 在填充时,预先计算dy的在内,如果View越界,回收掉。 * 一般情况是返回dy,如果出现View数量不足,则返回修正后的dy. * * @param recycler * @param state * @param dy RecyclerView给我们的位移量,+,显示底端, -,显示头部 * @return 修正以后真正的dy(可能剩余空间不够移动那么多了 所以return <|dy|) */ private int fill(RecyclerView.Recycler recycler, RecyclerView.State state, int dy) { int topOffset = getPaddingTop(); //回收越界子View if (getChildCount() > 0) {//滑动时进来的 for (int i = getChildCount() - 1; i >= 0; i--) { View child = getChildAt(i); if (dy > 0) {//需要回收当前屏幕,上越界的View if (getDecoratedBottom(child) - dy < topOffset) { removeAndRecycleView(child, recycler); mFirstVisiPos++; continue; } } else if (dy < 0) {//回收当前屏幕,下越界的View if (getDecoratedTop(child) - dy > getHeight() - getPaddingBottom()) { removeAndRecycleView(child, recycler); mLastVisiPos--; continue; } } } //detachAndScrapAttachedViews(recycler); } int leftOffset = getPaddingLeft(); int lineMaxHeight = 0; //布局子View阶段 if (dy >= 0) { int minPos = mFirstVisiPos; mLastVisiPos = getItemCount() - 1; if (getChildCount() > 0) { View lastView = getChildAt(getChildCount() - 1); minPos = getPosition(lastView) + 1;//从最后一个View+1开始吧 topOffset = getDecoratedTop(lastView); leftOffset = getDecoratedRight(lastView); lineMaxHeight = Math.max(lineMaxHeight, getDecoratedMeasurementVertical(lastView)); } //顺序addChildView for (int i = minPos; i <= mLastVisiPos; i++) { //找recycler要一个childItemView,我们不管它是从scrap里取,还是从RecyclerViewPool里取,亦或是onCreateViewHolder里拿。 View child = recycler.getViewForPosition(i); addView(child); measureChildWithMargins(child, 0, 0); //计算宽度 包括margin if (leftOffset + getDecoratedMeasurementHorizontal(child) <= getHorizontalSpace()) {//当前行还排列的下 layoutDecoratedWithMargins(child, leftOffset, topOffset, leftOffset + getDecoratedMeasurementHorizontal(child), topOffset + getDecoratedMeasurementVertical(child)); //保存Rect供逆序layout用 Rect rect = new Rect(leftOffset, topOffset + mVerticalOffset, leftOffset + getDecoratedMeasurementHorizontal(child), topOffset + getDecoratedMeasurementVertical(child) + mVerticalOffset); mItemRects.put(i, rect); //改变 left lineHeight leftOffset += getDecoratedMeasurementHorizontal(child); lineMaxHeight = Math.max(lineMaxHeight, getDecoratedMeasurementVertical(child)); } else {//当前行排列不下 //改变top left lineHeight leftOffset = getPaddingLeft(); topOffset += lineMaxHeight; lineMaxHeight = 0; //新起一行的时候要判断一下边界 if (topOffset - dy > getHeight() - getPaddingBottom()) { //越界了 就回收 removeAndRecycleView(child, recycler); mLastVisiPos = i - 1; } else { layoutDecoratedWithMargins(child, leftOffset, topOffset, leftOffset + getDecoratedMeasurementHorizontal(child), topOffset + getDecoratedMeasurementVertical(child)); //保存Rect供逆序layout用 Rect rect = new Rect(leftOffset, topOffset + mVerticalOffset, leftOffset + getDecoratedMeasurementHorizontal(child), topOffset + getDecoratedMeasurementVertical(child) + mVerticalOffset); mItemRects.put(i, rect); //改变 left lineHeight leftOffset += getDecoratedMeasurementHorizontal(child); lineMaxHeight = Math.max(lineMaxHeight, getDecoratedMeasurementVertical(child)); } } } //添加完后,判断是否已经没有更多的ItemView,并且此时屏幕仍有空白,则需要修正dy View lastChild = getChildAt(getChildCount() - 1); if (getPosition(lastChild) == getItemCount() - 1) { int gap = getHeight() - getPaddingBottom() - getDecoratedBottom(lastChild); if (gap > 0) { dy -= gap; } } } else { /** * ## 利用Rect保存子View边界 正序排列时,保存每个子View的Rect,逆序时,直接拿出来layout。 */ int maxPos = getItemCount() - 1; mFirstVisiPos = 0; if (getChildCount() > 0) { View firstView = getChildAt(0); maxPos = getPosition(firstView) - 1; } for (int i = maxPos; i >= mFirstVisiPos; i--) { Rect rect = mItemRects.get(i); if (rect.bottom - mVerticalOffset - dy < getPaddingTop()) { mFirstVisiPos = i + 1; break; } else { View child = recycler.getViewForPosition(i); addView(child, 0);//将View添加至RecyclerView中,childIndex为1,但是View的位置还是由layout的位置决定 measureChildWithMargins(child, 0, 0); layoutDecoratedWithMargins(child, rect.left, rect.top - mVerticalOffset, rect.right, rect.bottom - mVerticalOffset); } } } Log.d("TAG", "count= [" + getChildCount() + "]" + ",[recycler.getScrapList().size():" + recycler.getScrapList().size() + ", dy:" + dy + ", mVerticalOffset" + mVerticalOffset + ", "); return dy; } @Override public boolean canScrollVertically() { return true; } @Override public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) { //位移0、没有子View 当然不移动 if (dy == 0 || getChildCount() == 0) { return 0; } int realOffset = dy;//实际滑动的距离, 可能会在边界处被修复 //边界修复代码 if (mVerticalOffset + realOffset < 0) {//上边界 realOffset = -mVerticalOffset; } else if (realOffset > 0) {//下边界 //利用最后一个子View比较修正 View lastChild = getChildAt(getChildCount() - 1); if (getPosition(lastChild) == getItemCount() - 1) { int gap = getHeight() - getPaddingBottom() - getDecoratedBottom(lastChild); if (gap > 0) { realOffset = -gap; } else if (gap == 0) { realOffset = 0; } else { realOffset = Math.min(realOffset, -gap); } } } realOffset = fill(recycler, state, realOffset);//先填充,再位移。 mVerticalOffset += realOffset;//累加实际滑动距离 offsetChildrenVertical(-realOffset);//滑动 return realOffset; } //模仿LLM Horizontal 源码 /** * 获取某个childView在水平方向所占的空间 * * @param view * @return */ public int getDecoratedMeasurementHorizontal(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return getDecoratedMeasuredWidth(view) + params.leftMargin + params.rightMargin; } /** * 获取某个childView在竖直方向所占的空间 * * @param view * @return */ public int getDecoratedMeasurementVertical(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return getDecoratedMeasuredHeight(view) + params.topMargin + params.bottomMargin; } public int getVerticalSpace() { return getHeight() - getPaddingTop() - getPaddingBottom(); } public int getHorizontalSpace() { return getWidth() - getPaddingLeft() - getPaddingRight(); } }
[ "1306952017@qq.com" ]
1306952017@qq.com
8170cae9a3de371bb4611b2e51080d55fdac9905
a4c3f146f4728ef811798522deaf02b7fc9b73d5
/src/com/dyned/mydyned/component/AppPickerDialog.java
fd738e1e5e399a5c56c8318a3fe12bd37ca825c1
[]
no_license
jakalesmana/mda_2nd
76c4161ebaff3178e4b4f71089a53f91049d20f4
042b705a6e124b9dc08d425a35bce4e4e30fac4d
refs/heads/master
2020-12-25T19:26:02.841454
2014-11-28T12:16:14
2014-11-28T12:16:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,875
java
package com.dyned.mydyned.component; import java.util.ArrayList; import java.util.List; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Handler; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.Toast; import com.dyned.mydyned.R; import com.dyned.mydyned.composite.AppAdapter; import com.dyned.mydyned.manager.AppManager; import com.dyned.mydyned.model.App; public class AppPickerDialog extends Dialog { private List<App> listApp; private Context ctx; private PackageManager pm; public AppPickerDialog(final Context context, boolean fromInstalled) { super(context); this.ctx = context; pm = ctx.getPackageManager(); requestWindowFeature((int) Window.FEATURE_NO_TITLE); setContentView(R.layout.dialog_app_picker); getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ListView lvApp = (ListView)findViewById(R.id.lvApp); if (fromInstalled) { listApp = getAppList(ctx); } else { listApp = AppManager.getInstance().getApps(); } lvApp.setAdapter(new AppAdapter(context, listApp)); lvApp.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { App app = listApp.get(pos); // if (app.getPackageName().equals("com.dyned.engine")) { //check if the app installed if(check(app.getPackageName())) { PackageManager pack = context.getPackageManager(); Intent in = pack.getLaunchIntentForPackage(app.getPackageName()); context.startActivity(in); } else { Intent marketIntent = new Intent(Intent.ACTION_VIEW); marketIntent.setData(Uri.parse(app.getMarketUrl())); context.startActivity(marketIntent); } // } else { // //already installed, just launch // PackageManager pack = context.getPackageManager(); // Intent i = pack.getLaunchIntentForPackage(app.getPackageName()); // context.startActivity(i); // } dismiss(); } }); if (listApp.size() == 0) { Toast.makeText(ctx, "No DynEd application installed.", Toast.LENGTH_SHORT).show(); Handler h = new Handler(); h.postDelayed(new Runnable() { public void run() { dismiss(); } }, 1); } } private List<App> getAppList(Context ctx){ List<App> apps = new ArrayList<App>(); // apps.add(new App("com.dyned.engine", "DynEd Pro", "ic_launch_dyned")); for(App app : AppManager.getInstance().getApps()) { // Log.d("PackageList", "package: " + app.packageName + ", name: " + pm.getApplicationLabel(app).toString()); if (isExist(app.getPackageName())) { // try { apps.add(getApp(app.getPackageName())); // apps.add(new App(app.packageName, pm.getApplicationLabel(app).toString(), pm.getApplicationIcon(app.packageName))); // } catch (NameNotFoundException e) { // apps.add(new App(app.packageName, pm.getApplicationLabel(app).toString(), "ic_ge", "")); // } } } // Collections.sort(apps, new Comparator<App>() { // public int compare(App app1, App app2) { // return app1.getAppName().compareToIgnoreCase(app2.getAppName()); // } // }); // apps.add(new App("qs.dn.ns", "General English 1", "ic_ge")); // apps.add(new App("qs.dn.ns2", "General English 2", "ic_ge")); // apps.add(new App("qs.dn.ns3", "General English 3", "ic_ge")); // apps.add(new App("qs.dn.ns4", "General English 4", "ic_ge")); // apps.add(new App("qs.dn.ns5", "General English 5", "ic_ge")); // apps.add(new App("qs.dn.ns6", "General English 6", "ic_ge")); return apps; } private boolean isExist(String pckg){ // List<App> apps = AppManager.getInstance().getApps(); // for (int i = 0; i < apps.size(); i++) { // if (apps.get(i).getPackageName().equals(pckg)) { // return true; // } // } for(ApplicationInfo app : pm.getInstalledApplications(0)) { if (app.packageName.equals(pckg)) { return true; } } return false; } private App getApp(String pckg){ List<App> apps = AppManager.getInstance().getApps(); for (int i = 0; i < apps.size(); i++) { if (apps.get(i).getPackageName().equals(pckg)) { return apps.get(i); } } return null; } public boolean check(String packageName) { try{ ctx.getPackageManager().getApplicationInfo(packageName, 0 ); return true; } catch( PackageManager.NameNotFoundException e ){ return false; } } @Override public void show() { setCanceledOnTouchOutside(false); super.show(); } }
[ "jakaputralesmana@gmail.com" ]
jakaputralesmana@gmail.com
3ddfb7c92c9c2ba02534a2a71d695a54a0c4c124
329d32c1e96e35b2a73ecfe12eccfb5a404e344f
/server/src/main/java/com/dreamers/controllers/WallController.java
38d669a3ba5bd4d9033bf243a73ef27cf1558d72
[]
no_license
DashaMosk/build-calculator
ca060b9512be45e98571583fbe8e5582d2b2ee16
7a26dc0544c5d0bafb01be587ebd1381098189f2
refs/heads/master
2021-01-19T20:12:16.976195
2017-10-20T20:15:27
2017-10-20T20:15:27
101,223,140
0
0
null
null
null
null
UTF-8
Java
false
false
916
java
package com.dreamers.controllers; import com.dreamers.entities.Wall; import com.dreamers.services.WallService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class WallController { @Autowired private WallService wallService; @GetMapping("/api/{roomId}/walls") public List<Wall> getWalls(@PathVariable Long roomId) { return wallService.getWallsForRoom(roomId); } @PostMapping("/api/wall") public Wall saveWall(@RequestBody Wall wall) { return wallService.save(wall); } @DeleteMapping("/api/wall") public void deleteWall(@RequestParam Long id) { wallService.delete(id); } @GetMapping("/api/wall") public Wall getWall(@RequestParam Long id) { return wallService.getWall(id); } }
[ "dreamers.dsl@gmail.com" ]
dreamers.dsl@gmail.com
af77609813639fd8c84e524534ad49886018677e
81719679e3d5945def9b7f3a6f638ee274f5d770
/aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/GetKeyPairResult.java
abe1aa3c5d5dc60081fb2d55cdfa5c253604d2c6
[ "Apache-2.0" ]
permissive
ZeevHayat1/aws-sdk-java
1e3351f2d3f44608fbd3ff987630b320b98dc55c
bd1a89e53384095bea869a4ea064ef0cf6ed7588
refs/heads/master
2022-04-10T14:18:43.276970
2020-03-07T12:15:44
2020-03-07T12:15:44
172,681,373
1
0
Apache-2.0
2019-02-26T09:36:47
2019-02-26T09:36:47
null
UTF-8
Java
false
false
3,899
java
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.lightsail.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPair" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetKeyPairResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * An array of key-value pairs containing information about the key pair. * </p> */ private KeyPair keyPair; /** * <p> * An array of key-value pairs containing information about the key pair. * </p> * * @param keyPair * An array of key-value pairs containing information about the key pair. */ public void setKeyPair(KeyPair keyPair) { this.keyPair = keyPair; } /** * <p> * An array of key-value pairs containing information about the key pair. * </p> * * @return An array of key-value pairs containing information about the key pair. */ public KeyPair getKeyPair() { return this.keyPair; } /** * <p> * An array of key-value pairs containing information about the key pair. * </p> * * @param keyPair * An array of key-value pairs containing information about the key pair. * @return Returns a reference to this object so that method calls can be chained together. */ public GetKeyPairResult withKeyPair(KeyPair keyPair) { setKeyPair(keyPair); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKeyPair() != null) sb.append("KeyPair: ").append(getKeyPair()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetKeyPairResult == false) return false; GetKeyPairResult other = (GetKeyPairResult) obj; if (other.getKeyPair() == null ^ this.getKeyPair() == null) return false; if (other.getKeyPair() != null && other.getKeyPair().equals(this.getKeyPair()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKeyPair() == null) ? 0 : getKeyPair().hashCode()); return hashCode; } @Override public GetKeyPairResult clone() { try { return (GetKeyPairResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
76d0acd4a2f52bb266a518fd9e512e69d5169584
d052f54f596ad83f7608eb47a6a23eca9c768d49
/src/com/luv2code/springdemo/CricketCoach.java
54031c9b2e247ba1c2a2183d448e9da7fa723cdf
[]
no_license
Sergiu1987/learning_spring_50
6e1547a4b4a621c8459f755b4093c96df6bfdcc1
aa0f09808fdbc5fa1aa573e7ff6e4fee319044f7
refs/heads/master
2020-06-18T04:49:22.842303
2019-07-12T08:15:36
2019-07-12T08:15:36
196,168,932
0
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package com.luv2code.springdemo; public class CricketCoach implements Coach { private String team; private String emailAddress; private FortuneService fortuneService; public CricketCoach() { System.out.println("CricketCOach: inside no-args constructor"); } public void setTeam(String team) { System.out.println("CricketCoach: inside setter method - setTeam"); this.team = team; } public String getTeam() { return team; } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { System.out.println("CricketCoach: inside setter method - setEmailAddress"); this.emailAddress = emailAddress; } public void setFortuneService(FortuneService fortuneService) { System.out.println("CricketCoach: inside setter method - setFortuneService"); this.fortuneService = fortuneService; } @Override public String getDailyWorkOut() { return "Practice fast bowling for 15 minutes"; } @Override public Boolean getYourDailyWorkOut() { return true; } @Override public String getDailyFortune() { return fortuneService.getFortune(); } }
[ "sergiu.siscovschi@gmail.com" ]
sergiu.siscovschi@gmail.com
94915a10c64add01058338e6a20ed25c3072b9cf
6b1ca8b441f9ba25358bcb93b94014f5cd47cacb
/src/main/java/com/example/sudoku/SudokuApplication.java
5e547c235b217e03e449c2dbdd50be89ef60ffc6
[]
no_license
jorgeviana/SudokuSolver
6d96cc1c12355fc37a778361f5ec763112066c52
3af705ab3ee7b9f515f0a7b935a6e6275a5073c6
refs/heads/master
2022-12-01T23:14:12.348513
2020-08-16T17:56:32
2020-08-16T17:56:32
285,048,830
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.example.sudoku; public class SudokuApplication { public static void main(String[] args) { System.out.println("Hello, Sudoku!"); } }
[ "secoviana@gmail.com" ]
secoviana@gmail.com
29c8522ce447b9bd76c1a2a1e5e9f185ab24e57b
ceebbb78e69f49e23d168b960b8c85dedf95c041
/src/main/java/com/example/echocloud/Config/DataSourceConfiguration.java
38423a2d354875bbd2e7e3c09b5162843e991ac1
[]
no_license
yinmaoning55/echocloud
d2c937aea8dabb5a6722c0744d4f37970e95219b
4a556b1a3a12fcddcbd5c9eae6097ec0182854a6
refs/heads/master
2023-08-08T07:19:09.115442
2019-05-12T02:01:55
2019-05-12T02:02:33
201,471,376
0
0
null
null
null
null
UTF-8
Java
false
false
1,308
java
package com.example.echocloud.Config; import com.alibaba.druid.pool.DruidDataSource; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import javax.sql.DataSource; @Configuration public class DataSourceConfiguration { @Value("${spring.datasource.username}") private String username; @Value("${spring.datasource.password}") private String password; @Value("${spring.datasource.url}") private String url; @Value("${spring.datasource.driver-class-name}") private String driverClassName; @Bean @Primary public DataSource dataSource() { DruidDataSource dataSource = new DruidDataSource(); dataSource.setUsername(username); dataSource.setPassword(password); dataSource.setUrl(url); dataSource.setDriverClassName(driverClassName); // dataSource.setMaxActive(); // dataSource.setMaxIdle(); // dataSource.setMinIdle(); // dataSource.setInitialSize(); // dataSource.setValidationQuery(); // dataSource.setTestWhileIdle(); dataSource.setDefaultAutoCommit(false); return dataSource; } }
[ "35050094+yinmaoning55@users.noreply.github.com" ]
35050094+yinmaoning55@users.noreply.github.com
aa406a241a049088ee37f0571689b1feca42bbdf
e1009a7a0326d780fd118029865cb8079da255dd
/src/main/java/xy/SpringBoot2NoSQL/controller/Cassandra/CassandraController.java
848d38903d34dd8c972185f0bebd17d2fa0123eb
[]
no_license
ithjz/SpringBoot2NoSQL
c72a6f8b2df961810a057b7c4b690b3022ee0fae
039be1d6deba06f0c87ef47d38a768fa2be3a383
refs/heads/master
2020-03-29T04:48:52.463480
2018-09-18T09:15:53
2018-09-18T09:15:53
149,549,814
2
0
null
2018-09-20T04:09:53
2018-09-20T04:09:52
null
UTF-8
Java
false
false
2,256
java
package xy.SpringBoot2NoSQL.controller.Cassandra; import java.util.List; import java.util.Optional; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import xy.SpringBoot2NoSQL.model.Cassandra.Customer; import xy.SpringBoot2NoSQL.repository.Cassandra.CustomerRepository; @RestController @RequestMapping("/cassandra") public class CassandraController { Logger logger = LogManager.getLogger(getClass()); @Autowired CustomerRepository customerRepository; @RequestMapping("/add") public String add(){ customerRepository.deleteAll(); Customer cust_1 = new Customer("Test1", "Test1", "Test1", 20); Customer cust_2 = new Customer("Test2", "Test2", "Test2", 25); Customer cust_3 = new Customer("Test3", "Test3", "Test3", 30); Customer cust_4 = new Customer("Test4", "Test4", "Test4", 35); Customer cust_5 = new Customer("Test5", "Test5", "Test5", 40); Customer cust_6 = new Customer("Test6", "Test6", "Test6", 45); customerRepository.save(cust_1); customerRepository.save(cust_2); customerRepository.save(cust_3); customerRepository.save(cust_4); customerRepository.save(cust_5); customerRepository.save(cust_6); return "ok"; } @RequestMapping("/all") public Iterable<Customer> getAll(){ return customerRepository.findAll(); } @RequestMapping("/getByID/{id}") public Optional<Customer> getByID(@PathVariable("id") String id){ return customerRepository.findById(id); } @RequestMapping("/getByName/{name}") public List<Customer> getByName(@PathVariable("name") String name){ return customerRepository.findByLastname(name); } @RequestMapping("/getByAge/{age}") public List<Customer> getByAge(@PathVariable("age") String age){ return customerRepository.findByAgeGreaterThan(Integer.valueOf(age)); } }
[ "475660@qq.com" ]
475660@qq.com
151ddb6779469a7180775aad32e6fd78ba41fb0f
f933d2dad43ca9e972a4a7542ef3bef1801fa695
/jeysan/src/com/jeysan/cpf/decision/dao/Flowbasicquery5ViewDao.java
69e48098d550c41d8950db8be014412d892f707d
[]
no_license
harlankuo/cdrkzyk
d757d237e30f56113ed1365fdf1d20a7a7ba6e68
48e6fc4ace4289ab94b6976c1e26b654b98224da
refs/heads/master
2021-05-29T11:24:10.926216
2013-05-17T09:47:25
2013-05-17T09:47:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package com.jeysan.cpf.decision.dao; import org.springframework.stereotype.Component; import com.jeysan.cpf.decision.entity.Flowbasicquery5View; import com.jeysan.modules.orm.hibernate.HibernateDao; /** * @author 黄静 * */ @Component public class Flowbasicquery5ViewDao extends HibernateDao<Flowbasicquery5View, Long> { }
[ "ajie719@gmail.com@5d9d9c31-dec5-1043-5490-979c6bc11509" ]
ajie719@gmail.com@5d9d9c31-dec5-1043-5490-979c6bc11509
6c228778d4663a960e77d9da06252c810eb40590
9610256a9ef23ee7e213c0014eadac8bfd4e11e0
/loaders/src/main/java/com/example/loaders/SearchSnippet.java
fbb055d40f33e20e745f32c704b0e4f471bf1169
[ "Apache-2.0" ]
permissive
toyluck/iosched
3d8dc12a90779a551f788ffdde4ebf682ba6a4da
0975229c732584d0885544047f2744ca1ea46ddc
refs/heads/master
2021-01-15T12:18:27.743799
2016-03-07T13:53:46
2016-03-07T13:53:46
47,667,214
2
0
Apache-2.0
2020-07-24T10:16:16
2015-12-09T03:52:16
Java
UTF-8
Java
false
false
2,587
java
/* * Copyright 2015 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. */ package com.example.loaders; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import android.util.AttributeSet; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * An extension to TextView which marks up search result snippets. * * It looks for search terms surrounded by curly brace tokens e.g. “blah {Android} blah” and marks * the search term up as bold. */ public class SearchSnippet extends TextView { String patternStr = "\u300a.+\u300b"; private static final Pattern PATTERN_SEARCH_TERM = Pattern.compile("([\\u4e00-\\u9fa5])", Pattern.DOTALL); public SearchSnippet(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void setText(CharSequence text, BufferType type) { if (!TextUtils.isEmpty(text)) { Matcher matcher = PATTERN_SEARCH_TERM.matcher(text); SpannableStringBuilder ssb = new SpannableStringBuilder(text); List<String> hits = new ArrayList<>(); while (matcher.find()) { hits.add(matcher.group(1)); } for (String hit : hits) { int start = ssb.toString().indexOf(hit); int end = start + hit.length(); // ssb.setSpan(new StyleSpan(Typeface.BOLD), start, end, 0); // delete the markup tokens // ssb.delete(end - 1, end); // ssb.delete(start, start + 1); ssb.setSpan(new ForegroundColorSpan(Color.RED),start,end, Spanned.SPAN_EXCLUSIVE_INCLUSIVE); } text = ssb; } super.setText(text, type); } }
[ "hyc@outlook.com" ]
hyc@outlook.com
faa1b4aa77ac9d8a282daff65e0562c51c32e987
3dda6f46920c970f01bac7e23a015f7de09f0ae1
/src/com/neuedu/test/chapter10/Test6.java
5f6669ec37b509b631864ee3a4f4146ce0fe1067
[]
no_license
feiyy/java10-se-2020
51a8f470b2e240021203dc2ba0a58b38a78ecd65
d21eddf2d074e7c17d07909a99082e4b0d1fd9db
refs/heads/master
2022-12-05T10:49:20.282853
2020-08-04T03:44:37
2020-08-04T03:44:37
283,656,200
0
0
null
null
null
null
GB18030
Java
false
false
645
java
package com.neuedu.test.chapter10; import java.util.HashSet; import java.util.Iterator; import java.util.Random; import java.util.TreeSet; public class Test6 { //35 选 7 //hashset存储位置由hash算法决定 //treeset内部是排序树 public static void main(String[] args) { Random r = new Random(); TreeSet set = new TreeSet(); while(set.size()<7) { //生成1-35 int num = r.nextInt(35)+1; set.add(num); } //打印7个数 Iterator iter = set.iterator(); while(iter.hasNext()) { Object o = iter.next(); System.out.println(o); //放数组里 } //数组冒泡排序 } }
[ "you@neusoft.com" ]
you@neusoft.com
7d58a3256e80d7202341709df117e5502485700c
e480db520d3ef0f943d761cb84325334f9a4ceeb
/java/RIL_graphic/src/com/ril/graphique/ecouteur/MonEcouteur.java
cdf5e676fcff3050fea94eb424feb168f674f170
[]
no_license
juliendossantos/course-RIL13
beaf03dc40d62b489ec0c3741502656592516fb1
ad970fc77702414cdcd401872c56bc7eb5eba4be
refs/heads/master
2021-01-20T05:49:54.855246
2015-04-14T20:20:34
2015-04-14T20:20:34
30,377,456
1
0
null
null
null
null
UTF-8
Java
false
false
909
java
package com.ril.graphique.ecouteur; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import com.ril.graphique.gui.MonPanel; public class MonEcouteur implements ActionListener { private MonPanel panel; public MonEcouteur(MonPanel panel) { this.panel = panel; } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == panel.getJbCal()) { System.out.println("Calcule"); try { int A = Integer.parseInt(panel.getJtfA().getText()); int B = Integer.parseInt(panel.getJtfB().getText()); int C = A*B; JOptionPane.showMessageDialog(panel, String.format("%d * %d = %d", A,B,C)); } catch(Exception excep) { System.err.println(excep.getMessage()); JOptionPane.showMessageDialog(panel, "vérifier le format"); } } else if(e.getSource() == panel.getJbQuitte()) { System.exit(0); } } }
[ "contact.jdossantos@gmail.com" ]
contact.jdossantos@gmail.com
b84a79ccda79415722ee89a7c9abd1951c7e4996
a9573b1ce3644ef7cf2ffe2edae30a76a921a002
/secondary_sort/src/secondary/SecondarySortDriver.java
2dea9a4067b8fc6120ef82fcbd3d732bd8659cd5
[]
no_license
imzwz/data-algorithm-in-hadoop
6248093211bab14e617f3509d71b7f39970deeaf
3efd2862319e9e1c92bb4be16272176df8d1caed
refs/heads/master
2021-01-21T08:46:23.998834
2017-09-03T03:41:59
2017-09-03T03:41:59
91,639,465
1
0
null
null
null
null
UTF-8
Java
false
false
2,175
java
package secondary; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.SymlinkBaseTest; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import java.util.logging.Logger; /** * Created by winn on 17/5/17. */ public class SecondarySortDriver extends Configured implements Tool { private static Logger theLogger = Logger.getLogger(String.valueOf(SecondarySortDriver.class)); @Override public int run(String[] args) throws Exception{ Configuration conf = getConf(); Job job = new Job(conf); job.setJarByClass(SecondarySortDriver.class); job.setJobName("SecondarySortDriver"); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setOutputKeyClass(DateTemperaturePair.class); job.setOutputValueClass(Text.class); job.setMapperClass(SecondarySortMapper.class); job.setReducerClass(SecondarySortReducer.class); job.setPartitionerClass(DateTemperaturePartitioner.class); job.setGroupingComparatorClass(DateTemperatureGroupingComparator.class); boolean status = job.waitForCompletion(true); theLogger.info("run(): status="+status); return status ? 0 : 1; } public static void main(String[] args)throws Exception{ if (args.length !=2){ theLogger.warning("SecondarySortDriver <input-dir> <output-dir>"); throw new IllegalArgumentException("SecondarySortDriver <input-dir> <output-dir>"); } int returnStatus = submitJob(args); theLogger.info("returnStatus="+returnStatus); System.exit(returnStatus); } public static int submitJob(String[] args)throws Exception{ int returnStatus = ToolRunner.run(new SecondarySortDriver(), args); return returnStatus; } }
[ "iamzwz3@gmail.com" ]
iamzwz3@gmail.com
446e4749931c263e157fe9ff56ac1174da740611
79e5614ead97b2c8db7767dd7499e2e8e58a1739
/medicalcenter/src/main/java/com/medicalcenter/Medicalcenter/controller/UserController.java
4ca899c38c5f4de3954c4f39e451ac18c9f3ab0f
[]
no_license
udreamarius97/medicalcenter
ccf839a6abdd4b35a2cb87caf0d8c5ad00d75c14
282cfdd10683d40b56140a59455bba34fcc0e98c
refs/heads/master
2023-03-09T09:47:06.360383
2021-10-04T13:42:36
2021-10-04T13:42:36
238,771,149
0
0
null
2023-03-01T01:45:06
2020-02-06T19:49:57
Java
UTF-8
Java
false
false
12,873
java
package com.medicalcenter.Medicalcenter.controller; import com.medicalcenter.Medicalcenter.model.*; import com.medicalcenter.Medicalcenter.payload.*; import com.medicalcenter.Medicalcenter.repository.AnomalityRepository; import com.medicalcenter.Medicalcenter.repository.MedicationRepository; import com.medicalcenter.Medicalcenter.repository.UserRepository; import com.medicalcenter.Medicalcenter.security.CurrentUser; import com.medicalcenter.Medicalcenter.security.UserPrincipal; import com.medicalcenter.Medicalcenter.service.MedicationService; import com.medicalcenter.Medicalcenter.service.PrescriptionService; import com.medicalcenter.Medicalcenter.service.UserService; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import javax.validation.Valid; import java.net.URI; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDate; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.logging.Logger; @RestController @RequestMapping("/api") public class UserController { @Autowired private UserService userService; @Autowired private AnomalityRepository anomalityRepository; @Autowired UserRepository userRepository; @Autowired PasswordEncoder passwordEncoder; @Autowired private MedicationService medicationService; @Autowired private PrescriptionService prescriptionService; @Autowired private MedicationRepository medicationRepository; @GetMapping("/user/me") public ResponseEntity<UserSummary> getCurrentUser(@CurrentUser UserPrincipal currentUser) { System.out.println("currentUser"); System.out.println(currentUser.getUsername()); UserSummary userSummary = new UserSummary(currentUser.getName(),currentUser.getUsername(), currentUser.getEmail(),currentUser.getAuthorities().stream().findFirst().toString() .substring(9,currentUser.getAuthorities().stream().findFirst().toString().length()-1), currentUser.getBirthdate(),currentUser.getGender(),currentUser.getAddress()); return ResponseEntity.ok(userSummary); } @PostMapping("/users/doctor/patients") @PreAuthorize("hasRole('DOCTOR')") public ResponseEntity<List<UserSummary2>> getAllUsers(){ System.out.println("ceva"); List<UserSummary2> u=new ArrayList<>(); for(User currentUser:userService.getAllUsers()){ UserSummary2 us=new UserSummary2(currentUser.getName(),currentUser.getUsername(), currentUser.getEmail(), currentUser.getRole(),currentUser.getBirthdate().toString().substring(0,10),currentUser.getGender(),currentUser.getAddress()); u.add(us); } return ResponseEntity.ok(u); } @GetMapping("/user/{username}") public ResponseEntity<UserSummary> getYserProfile(@PathVariable(value = "username") String username) { User currentUser=userService.findByUsernameOrEmail(username); UserSummary userSummary = new UserSummary(currentUser.getName(),currentUser.getUsername(), currentUser.getEmail(), currentUser.getBirthdate(),currentUser.getGender(),currentUser.getAddress()); return ResponseEntity.ok(userSummary); } @GetMapping("/user/users/prescriptions") @PreAuthorize("hasRole('PATIENT')") public ResponseEntity<List<PrescriptionResponse2>> getPrescriptedMeds(@CurrentUser UserPrincipal currentUser){ User u=userService.findByUsernameOrEmail(currentUser.getUsername()); List<PrescriptionResponse2> lp=new ArrayList<>(); for(Prescription pr:u.getPrescriptions()){ PrescriptionResponse2 p=new PrescriptionResponse2(); p.setPatientUsername(pr.getDoctor().getName()); p.setStartDate(pr.getStartDate()); p.setEndDate(pr.getEndDate()); for(PrescriptedMeds pmd:pr.getMedicationSet()){ MedsPresc m=new MedsPresc(pmd.getMed().getName(),pmd.getDailyIntervals()); p.add(m); } lp.add(p); } return ResponseEntity.ok(lp); } @PostMapping("/user/doctor") @PreAuthorize("hasRole('DOCTOR')") public ResponseEntity deleteByEmail(@RequestBody String email){ System.out.println(email); userService.deleteByEmail(email); return ResponseEntity.ok(new ApiResponse(false, "User deleted")); } @GetMapping("user/users/{email}") @PreAuthorize("hasRole('DOCTOR')") public ResponseEntity<User> getUserDetailsByDoctor(@PathVariable(value = "email") String email){ return ResponseEntity.ok(userService.findByUsernameOrEmail(email)); } @PostMapping("user/users/{email}") @PreAuthorize("hasRole('DOCTOR')") public ResponseEntity<?> addPatientToCeregiver(@RequestBody String emailPatient,@PathVariable(value = "email") String email){ User caregiver=userService.findByUsernameOrEmail(email); User patient=userService.findByUsernameOrEmail(emailPatient); caregiver.addPatient(patient); userService.save(caregiver); return ResponseEntity.ok(new ApiResponse(true, "Added patient to caregiver")); } @GetMapping("/users/patiens") @PreAuthorize("hasRole('CAREGIVER')") public ResponseEntity<List<UserSummary>> getAsigneePatiens(@CurrentUser UserPrincipal currentUser){ System.out.println("cava"); User u=userService.findByUsernameOrEmail(currentUser.getEmail()); List<UserSummary> s=new ArrayList<>(); System.out.println(u.getPatiens().size()+"cava"); for(User currentUser2:u.getPatiens()){ UserSummary us=new UserSummary(currentUser2.getName(),currentUser2.getUsername(), currentUser2.getEmail(), currentUser2.getBirthdate(),currentUser2.getGender(),currentUser2.getAddress()); s.add(us); } return ResponseEntity.ok(s); } @GetMapping("/user/messages") @PreAuthorize("hasRole('CAREGIVER')") public ResponseEntity<List<String>> getMessages(@CurrentUser UserPrincipal currentUser){ List<String> messages=new ArrayList<String>(); User u=userService.findById(currentUser.getId()); System.out.println(u.getPatiens().size()); List<Anomality> l=anomalityRepository.findAll(); for(Anomality a:l){ if(u.getPatiens().contains(a.getUser())){ messages.add("Pacientul cu numele "+a.getUser().getName()+ " a facut activitatea "+a.getActivity().replace('\t',' ') +"in perioada "+a.getStartDate()+" : "+a.getEndDate()); } } return ResponseEntity.ok(messages); } @PostMapping("/auth/medication") public ResponseEntity<List<GRPCMeds>> getMedsForPatient(@RequestBody String id){ System.out.println("ceva"); System.out.println(id); List<GRPCMeds> grpcMeds=new ArrayList<GRPCMeds>(); User u=userService.findById(Integer.parseInt(id)); for(Prescription p1:u.getPrescriptions()){ if(p1.getEndDate().toInstant().isAfter(Instant.now())){ for(PrescriptedMeds pm:p1.getMedicationSet()){ GRPCMeds gp=new GRPCMeds(pm.getMed().getName(),pm.getMed().getDosage(),pm.getDailyIntervals()); grpcMeds.add(gp); } } } return ResponseEntity.ok(grpcMeds); } @PostMapping("/signup/caregiver") public ResponseEntity<?> registerCaregiver(@Valid @RequestBody SignUpRequest signUpRequest) throws ParseException { Date date1=new SimpleDateFormat("dd/MM/yyyy").parse(signUpRequest.getBirthdate()); if(userRepository.existsByEmail(signUpRequest.getEmail())) { User user=userService.findByUsernameOrEmail(signUpRequest.getEmail()); user.setAddress(signUpRequest.getAddress()); user.setName(signUpRequest.getName()); user.setBirthdate(date1); user.setGender(signUpRequest.getGender()); user.setUsername(signUpRequest.getUsername()); userService.save(user); } else { if(userRepository.existsByEmail(signUpRequest.getEmail())) { User user=userService.findByUsernameOrEmail(signUpRequest.getEmail()); user.setAddress(signUpRequest.getAddress()); user.setName(signUpRequest.getName()); user.setBirthdate(date1); user.setGender(signUpRequest.getGender()); user.setEmail(signUpRequest.getEmail()); userService.save(user); } else { User user = new User(signUpRequest.getName(), signUpRequest.getUsername(), signUpRequest.getEmail(), date1, signUpRequest.getAddress(), signUpRequest.getGender()); user.setPassword(passwordEncoder.encode(signUpRequest.getPassword())); user.setRole("ROLE_CAREGIVER"); userService.save(user); } } return ResponseEntity.ok(new ApiResponse(true, "Caregiver registered successfully")); } @PostMapping("/signup/patient") public ResponseEntity<?> registerPatient(@Valid @RequestBody SignUpRequest signUpRequest) throws ParseException { Date date1=new SimpleDateFormat("dd/MM/yyyy").parse(signUpRequest.getBirthdate()); if(userRepository.existsByEmail(signUpRequest.getEmail())) { User user=userService.findByUsernameOrEmail(signUpRequest.getEmail()); user.setAddress(signUpRequest.getAddress()); user.setName(signUpRequest.getName()); user.setBirthdate(date1); user.setGender(signUpRequest.getGender()); user.setUsername(signUpRequest.getUsername()); userService.save(user); } else { if(userRepository.existsByEmail(signUpRequest.getEmail())) { User user=userService.findByUsernameOrEmail(signUpRequest.getEmail()); user.setAddress(signUpRequest.getAddress()); user.setName(signUpRequest.getName()); user.setBirthdate(date1); user.setGender(signUpRequest.getGender()); user.setEmail(signUpRequest.getEmail()); userService.save(user); } else { User user = new User(signUpRequest.getName(), signUpRequest.getUsername(), signUpRequest.getEmail(), date1, signUpRequest.getAddress(), signUpRequest.getGender()); user.setPassword(passwordEncoder.encode(signUpRequest.getPassword())); user.setRole("ROLE_PATIENT"); userService.save(user); } } return ResponseEntity.ok(new ApiResponse(true, "Caregiver registered successfully")); } @PostMapping("/users/userlist/adduser") @PreAuthorize("hasRole('DOCTOR')") public ResponseEntity<?> addUser(@Valid @RequestBody UserSummary2 usersummay) throws ParseException { System.out.println(usersummay.getBirthdate()); Date date=new SimpleDateFormat("yyyy-MM-dd").parse(usersummay.getBirthdate()); User user; if(!userRepository.existsByEmail(usersummay.getEmail())){ user=new User(); user.setPassword(passwordEncoder.encode(usersummay.getUsername())); user.setAddress(usersummay.getAddress()); user.setBirthdate(date); user.setGender(usersummay.getGender()); user.setName(usersummay.getName()); user.setUsername(usersummay.getUsername()); user.setEmail(usersummay.getEmail()); user.setRole(usersummay.getRole()); } else{ user=userService.findByUsernameOrEmail(usersummay.getEmail()); user.setAddress(usersummay.getAddress()); user.setBirthdate(date); user.setGender(usersummay.getGender()); user.setName(usersummay.getName()); user.setUsername(usersummay.getUsername()); user.setEmail(usersummay.getEmail()); user.setRole(usersummay.getRole()); } userService.save(user); return ResponseEntity.ok(new ApiResponse(true, "User added successfully")); } }
[ "marius.cristian2206@gmail.com" ]
marius.cristian2206@gmail.com
9b1758d3621920ac1886a5eb77b862f629358e4c
f1557a8fadebcb56be2af3b03b99f09764291c1f
/javaTest/src/main/java/com/interview/famousProblems/LongestIncreasingSeq.java
712934681a89b1c8a3a73412193d4622cd0ce27c
[]
no_license
paras1988/DaMedico
07655706ba8e3cfe91a0390d39e80b93fdbc0f4d
a438c27210aead6648ea0195790b83b7abe7ac91
refs/heads/master
2020-12-24T05:10:09.603658
2020-03-07T17:08:34
2020-03-07T17:08:34
38,919,052
0
0
null
null
null
null
UTF-8
Java
false
false
1,793
java
package com.interview.famousProblems; public class LongestIncreasingSeq { /* * LIS(arr)={if--> j<i && arr[j]<arr[i] * then 1+max(LIS(arr[j]) * else * 1 * * length of LIS for { 10, 22, 9, 33, 21, 50, 41, 60, 80 } is 6 and LIS is {10, 22, 33, 50, 60, 80}. * * */ static int maxFinal=0; public static void main(String[] args) { int arr[]={8,3,12,4,5,6,7, 23,3}; nonRecur(arr); LIS(arr,arr.length); System.out.println("Result is "+maxFinal); int maxRes=0; maxRes=memoizedLIS(arr); System.out.println("Result from memoized is "+ maxRes); } private static void nonRecur(int[] arr) { int[] DP=new int[arr.length]; int[] prev=new int[arr.length]; for(int i=1;i<arr.length;i++){ DP[i]=1; prev[i] = -1; for(int j=i-1;j>0;j--){ if(j<i && 1+DP[j]>DP[i] && arr[j]<arr[i]){ DP[i]=DP[j]+1; prev[i] = j; } } } int max=0; for(int i=0;i<DP.length;i++){ if(DP[i]>max){ max=DP[i]; } } System.out.println("LIS from Non Recursive " + max); } static int LIS(int[] arr, int n){ if(n==1) return 1; int res, max_ending_here = 1; for(int i=1;i<n;i++){ res=LIS(arr,i); if(arr[i-1] < arr[n-1] && res + 1 > max_ending_here) max_ending_here = res + 1; } if(max_ending_here>maxFinal) maxFinal=max_ending_here; return max_ending_here; } static int memoizedLIS(int[] arr){ int[] LIS=new int[arr.length]; for(int i=0;i<arr.length;i++){ LIS[i]=0; } for(int i=0;i<arr.length;i++){ for(int j=0;j<i;j++){ if(arr[i]>arr[j] && LIS[i]<LIS[j]+1){ LIS[i]=LIS[j]+1; } } if(LIS[i]==0){ LIS[i]=1; } } int max=0; for(int i=0;i<arr.length;i++){ if(LIS[i]>max){ max=LIS[i]; } } return max; } }
[ "paras.agarwal@datametica.com" ]
paras.agarwal@datametica.com
4c334b8eab370b1a5455c95765a5cd7775770f5d
3e422e30c66aa8d9a89757a9afa7b6a04fe9a3d7
/src/main/java/com/tupperware/auto/mysql/model/ConfigController.java
9b121f0b56269bfdfa07e91803018974e3607a28
[]
no_license
wzpabc/autogen
146787ec1b48be76590eb46720c2da367f222930
811e17d9e83de3f0b2382ef5d736b25a7145ce82
refs/heads/master
2020-03-30T06:29:47.063023
2018-12-27T14:52:37
2018-12-27T14:52:38
150,865,607
0
0
null
null
null
null
UTF-8
Java
false
false
7,840
java
package com.tupperware.auto.mysql.model; import com.baomidou.mybatisplus.activerecord.Model; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.enums.IdType; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonFormat; import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; /** * <p> * 实体类 * </p> * * @author patrick.wang * @since 2018-12-24 */ @TableName("config_controller") public class ConfigController extends Model<ConfigController> { private static final long serialVersionUID = 1L; /** * 属性: id * 备注: * 字段: id */ @JsonProperty private Integer id; /** * 属性: groupId * 备注: * 字段: group_id */ @TableField(value="group_id") @JsonProperty private String groupId; /** * 属性: tableSchema * 备注: * 字段: table_schema */ @TableField(value="table_schema") @JsonProperty private String tableSchema; /** * 属性: tableName * 备注: * 字段: table_name */ @TableField(value="table_name") @JsonProperty private String tableName; /** * 属性: tableType * 备注: * 字段: table_type */ @TableField(value="table_type") @JsonProperty private String tableType; /** * 属性: tableDesc * 备注: * 字段: table_desc */ @TableField(value="table_desc") @JsonProperty private String tableDesc; /** * 属性: apiValue * 备注: * 字段: api_value */ @TableField(value="api_value") @JsonProperty private String apiValue; /** * 属性: notes * 备注: * 字段: notes */ @JsonProperty private String notes; /** * 属性: flag * 备注: * 字段: flag */ @JsonProperty private String flag; /** * 属性: producers * 备注: * 字段: producers */ @JsonProperty private String producers; /** * 属性: required * 备注: * 字段: required */ @JsonProperty private String required; /** * 属性: isdisabled * 备注: * 字段: isdisabled */ @JsonProperty private Integer isdisabled; /** * 属性: construct * 备注: * 字段: construct */ @JsonProperty private String construct; /** * 属性: ignored * 备注: * 字段: ignored */ @JsonProperty private Integer ignored; /** * 属性: requestPath * 备注: * 字段: request_path */ @TableField(value="request_path") @JsonProperty private String requestPath; /** * 属性: requestMethod * 备注: * 字段: request_method */ @TableField(value="request_method") @JsonProperty private String requestMethod; /** * 属性: functionName * 备注: * 字段: function_name */ @TableField(value="function_name") @JsonProperty private String functionName; /** * 属性: query * 备注: * 字段: query */ @JsonProperty private String query; /** * 属性: isunique * 备注: * 字段: isunique */ @JsonProperty private Integer isunique; /** * 属性: auth * 备注: * 字段: auth */ @JsonProperty private Integer auth; /** * 属性: updateDate * 备注: * 字段: update_date */ @TableField(value="update_date") @JsonProperty @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") private java.util.Date updateDate; /** * 获取 */ @JsonIgnore public Integer getId() { return id; } /** * 设置 */ @JsonIgnore public void setId(Integer id) { this.id = id; } /** * 获取 */ @JsonIgnore public String getGroupId() { return groupId; } /** * 设置 */ @JsonIgnore public void setGroupId(String groupId) { this.groupId = groupId; } /** * 获取 */ @JsonIgnore public String getTableSchema() { return tableSchema; } /** * 设置 */ @JsonIgnore public void setTableSchema(String tableSchema) { this.tableSchema = tableSchema; } /** * 获取 */ @JsonIgnore public String getTableName() { return tableName; } /** * 设置 */ @JsonIgnore public void setTableName(String tableName) { this.tableName = tableName; } /** * 获取 */ @JsonIgnore public String getTableType() { return tableType; } /** * 设置 */ @JsonIgnore public void setTableType(String tableType) { this.tableType = tableType; } /** * 获取 */ @JsonIgnore public String getTableDesc() { return tableDesc; } /** * 设置 */ @JsonIgnore public void setTableDesc(String tableDesc) { this.tableDesc = tableDesc; } /** * 获取 */ @JsonIgnore public String getApiValue() { return apiValue; } /** * 设置 */ @JsonIgnore public void setApiValue(String apiValue) { this.apiValue = apiValue; } /** * 获取 */ @JsonIgnore public String getNotes() { return notes; } /** * 设置 */ @JsonIgnore public void setNotes(String notes) { this.notes = notes; } /** * 获取 */ @JsonIgnore public String getFlag() { return flag; } /** * 设置 */ @JsonIgnore public void setFlag(String flag) { this.flag = flag; } /** * 获取 */ @JsonIgnore public String getProducers() { return producers; } /** * 设置 */ @JsonIgnore public void setProducers(String producers) { this.producers = producers; } /** * 获取 */ @JsonIgnore public String getRequired() { return required; } /** * 设置 */ @JsonIgnore public void setRequired(String required) { this.required = required; } /** * 获取 */ @JsonIgnore public Integer getIsdisabled() { return isdisabled; } /** * 设置 */ @JsonIgnore public void setIsdisabled(Integer isdisabled) { this.isdisabled = isdisabled; } /** * 获取 */ @JsonIgnore public String getConstruct() { return construct; } /** * 设置 */ @JsonIgnore public void setConstruct(String construct) { this.construct = construct; } /** * 获取 */ @JsonIgnore public Integer getIgnored() { return ignored; } /** * 设置 */ @JsonIgnore public void setIgnored(Integer ignored) { this.ignored = ignored; } /** * 获取 */ @JsonIgnore public String getRequestPath() { return requestPath; } /** * 设置 */ @JsonIgnore public void setRequestPath(String requestPath) { this.requestPath = requestPath; } /** * 获取 */ @JsonIgnore public String getRequestMethod() { return requestMethod; } /** * 设置 */ @JsonIgnore public void setRequestMethod(String requestMethod) { this.requestMethod = requestMethod; } /** * 获取 */ @JsonIgnore public String getFunctionName() { return functionName; } /** * 设置 */ @JsonIgnore public void setFunctionName(String functionName) { this.functionName = functionName; } /** * 获取 */ @JsonIgnore public String getQuery() { return query; } /** * 设置 */ @JsonIgnore public void setQuery(String query) { this.query = query; } public Integer getIsunique() { return isunique; } public void setIsunique(Integer isunique) { this.isunique = isunique; } /** * 获取 */ @JsonIgnore public Integer getAuth() { return auth; } /** * 设置 */ @JsonIgnore public void setAuth(Integer auth) { this.auth = auth; } /** * 获取 */ @JsonIgnore public java.util.Date getUpdateDate() { return updateDate; } /** * 设置 */ @JsonIgnore public void setUpdateDate(java.util.Date updateDate) { this.updateDate = updateDate; } @Override protected Serializable pkVal() { // TODO Auto-generated method stub return null; } public ConfigController() { //getHeader(); } }
[ "wzpabc@outlook.com" ]
wzpabc@outlook.com