code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public void removeReference(Block block){
String procedureName=getProcedureName(block);
if (mProcedureReferences.containsKey(procedureName)) {
mProcedureReferences.get(procedureName).remove(block);
}
else {
throw new IllegalStateException("Tried to remove a procedure reference that was not in the list of references");
}
}
|
Removes a reference to a procedure.
|
public JSONArray put(int index,long value) throws JSONException {
this.put(index,new Long(value));
return this;
}
|
Put or replace a long value. If the index is greater than the length of the JSONArray, then null elements will be added as necessary to pad it out.
|
@Override public List<Integer> readSortIndex() throws IOException {
if (null == columnSortInfo) {
readColumnSortInfo();
}
return columnSortInfo.getSort_index();
}
|
method for reading the carbon dictionary sort index data from columns sortIndex file.
|
public void testCertificateFactory14() throws CertificateException {
if (!X509Support) {
fail(NotSupportMsg);
return;
}
CertificateFactory[] certFs=initCertFs();
assertNotNull("CertificateFactory objects were not created",certFs);
List<Certificate> list=null;
for (int i=0; i < certFs.length; i++) {
try {
certFs[i].generateCertPath(list);
fail("generateCertificate must thrown CertificateException when list is null");
}
catch ( NullPointerException e) {
}
}
}
|
Test for <code>generateCertPath(List certificates)</code> method Assertion: throw NullPointerException certificates is null
|
private static void checkArguments(final JFrame parent,final IDebugger debugger,final TraceLogger logger){
Preconditions.checkNotNull(parent,"IE01566: Parent argument can not be null");
Preconditions.checkNotNull(debugger,"IE01567: Debugger argument can not be null");
Preconditions.checkNotNull(logger,"IE01568: Logger argument can not be null");
}
|
Checks arguments for validity.
|
public Object clone(){
FloatArrayList clone=new FloatArrayList((float[])elements.clone());
clone.setSizeRaw(size);
return clone;
}
|
Returns a deep copy of the receiver.
|
public static List<File> sortInBatch(File file,Comparator<String> cmp,int maxtmpfiles) throws IOException {
List<File> files=new ArrayList<File>();
BufferedReader fbr=new BufferedReader(new FileReader(file));
long blocksize=estimateBestSizeOfBlocks(file,maxtmpfiles);
try {
List<String> tmplist=new ArrayList<String>();
String line="";
try {
while (line != null) {
long currentblocksize=0;
while ((currentblocksize < blocksize) && ((line=fbr.readLine()) != null)) {
tmplist.add(line);
currentblocksize+=line.length() * 2;
}
files.add(sortAndSave(tmplist,cmp));
tmplist.clear();
}
}
catch ( EOFException oef) {
if (tmplist.size() > 0) {
files.add(sortAndSave(tmplist,cmp));
tmplist.clear();
}
}
}
finally {
fbr.close();
}
return files;
}
|
This will simply load the file by blocks of x rows, then sort them in-memory, and write the result to temporary files that have to be merged later. You can specify a bound on the number of temporary files that will be created.
|
public static void main(final String[] args){
DOMTestCase.doMain(elementgetattributenodens02.class,args);
}
|
Runs this test from the command line.
|
private boolean isEnclosedInArray(final String rawData){
return rawData.matches("(?ims)^\\s*\\[.*\\]");
}
|
Check if the string is enclosed with [] (array).
|
public void append(byte[] buffer,int offset,int length){
if (_length + length >= _capacity) ensureCapacity(_length + length);
System.arraycopy(buffer,offset,_buffer,_length,length);
_length+=length;
}
|
Inserts a byte array
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:05.310 -0500",hash_original_method="4C2FCF871904470A4665E52D44D62875",hash_generated_method="D931D99D7A7E06878979263386640E8D") public void disableNetwork(int netId,int reason){
mAsyncChannel.sendMessage(CMD_DISABLE_NETWORK,netId,reason);
}
|
Disable a configured network asynchronously. This call is for abnormal network events, and the user may be notified of network change, if they recently attempted to connect to the specified network.
|
AlignmentPattern find() throws NotFoundException {
int startX=this.startX;
int height=this.height;
int maxJ=startX + width;
int middleI=startY + (height >> 1);
int[] stateCount=new int[3];
for (int iGen=0; iGen < height; iGen++) {
int i=middleI + ((iGen & 0x01) == 0 ? (iGen + 1) >> 1 : -((iGen + 1) >> 1));
stateCount[0]=0;
stateCount[1]=0;
stateCount[2]=0;
int j=startX;
while (j < maxJ && !image.get(j,i)) {
j++;
}
int currentState=0;
while (j < maxJ) {
if (image.get(j,i)) {
if (currentState == 1) {
stateCount[currentState]++;
}
else {
if (currentState == 2) {
if (foundPatternCross(stateCount)) {
AlignmentPattern confirmed=handlePossibleCenter(stateCount,i,j);
if (confirmed != null) {
return confirmed;
}
}
stateCount[0]=stateCount[2];
stateCount[1]=1;
stateCount[2]=0;
currentState=1;
}
else {
stateCount[++currentState]++;
}
}
}
else {
if (currentState == 1) {
currentState++;
}
stateCount[currentState]++;
}
j++;
}
if (foundPatternCross(stateCount)) {
AlignmentPattern confirmed=handlePossibleCenter(stateCount,i,maxJ);
if (confirmed != null) {
return confirmed;
}
}
}
if (!possibleCenters.isEmpty()) {
return possibleCenters.get(0);
}
throw NotFoundException.getNotFoundInstance();
}
|
<p>This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since it's pretty performance-critical and so is written to be fast foremost.</p>
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:41.906 -0500",hash_original_method="31528962776A4296CB5B735981815A21",hash_generated_method="186B8F2FBB52DC26F824F7EE78727CF3") public void startTest(Test test){
String testClass=test.getClass().getName();
String testName=((TestCase)test).getName();
mTestResult=new Bundle(mResultTemplate);
mTestResult.putString(REPORT_KEY_NAME_CLASS,testClass);
mTestResult.putString(REPORT_KEY_NAME_TEST,testName);
mTestResult.putInt(REPORT_KEY_NUM_CURRENT,++mTestNum);
if (testClass != null && !testClass.equals(mTestClass)) {
mTestResult.putString(Instrumentation.REPORT_KEY_STREAMRESULT,String.format("\n%s:",testClass));
mTestClass=testClass;
}
else {
mTestResult.putString(Instrumentation.REPORT_KEY_STREAMRESULT,"");
}
Method testMethod=null;
try {
testMethod=test.getClass().getMethod(testName);
if (testMethod.isAnnotationPresent(RepetitiveTest.class)) {
int numIterations=testMethod.getAnnotation(RepetitiveTest.class).numIterations();
mTestResult.putInt(REPORT_KEY_NUM_ITERATIONS,numIterations);
}
}
catch ( NoSuchMethodException e) {
}
try {
if (mTestNum == 1) Thread.sleep(mDelayMsec);
}
catch ( InterruptedException e) {
throw new IllegalStateException(e);
}
sendStatus(REPORT_VALUE_RESULT_START,mTestResult);
mTestResultCode=0;
mIsTimedTest=false;
mIncludeDetailedStats=false;
try {
if (testMethod != null && testMethod.isAnnotationPresent(TimedTest.class)) {
mIsTimedTest=true;
mIncludeDetailedStats=testMethod.getAnnotation(TimedTest.class).includeDetailedStats();
}
else if (test.getClass().isAnnotationPresent(TimedTest.class)) {
mIsTimedTest=true;
mIncludeDetailedStats=test.getClass().getAnnotation(TimedTest.class).includeDetailedStats();
}
}
catch ( SecurityException e) {
}
if (mIsTimedTest && mIncludeDetailedStats) {
mPerfCollector.beginSnapshot("");
}
else if (mIsTimedTest) {
mPerfCollector.startTiming("");
}
}
|
send a status for the start of a each test, so long tests can be seen as "running"
|
public String consumeTagName(){
int start=pos;
while (!isEmpty() && (matchesWord() || matchesAny(':','_','-'))) pos++;
return queue.substring(start,pos);
}
|
Consume an tag name off the queue (word or :, _, -)
|
public boolean checkPrefLevels(List lst){
for (int i=0; i < lst.size(); i++) {
String value=((String)lst.get(i));
if (value.trim().equals(Preference.BLANK_PREF_VALUE)) {
return false;
}
}
return true;
}
|
Checks that pref levels are selected
|
public void tagSoundStreamHead(int playbackFrequency,boolean playback16bit,boolean playbackStereo,int streamFormat,int streamFrequency,boolean stream16bit,boolean streamStereo,int averageSampleCount) throws IOException {
if (tags != null) {
tags.tagSoundStreamHead(playbackFrequency,playback16bit,playbackStereo,streamFormat,streamFrequency,stream16bit,streamStereo,averageSampleCount);
}
}
|
SWFTagTypes interface
|
public static Properties toProperties(JSONObject jo) throws JSONException {
Properties properties=new Properties();
if (jo != null) {
Iterator<String> keys=jo.keys();
while (keys.hasNext()) {
String name=keys.next();
properties.put(name,jo.getString(name));
}
}
return properties;
}
|
Converts the JSONObject into a property file object.
|
public static FloatFloatFunction createFloatFloatFunction(String functionName){
if (functionName.equalsIgnoreCase(SquaredError.class.getSimpleName())) {
return new SquaredError();
}
else if (functionName.equalsIgnoreCase(CrossEntropy.class.getSimpleName())) {
return new CrossEntropy();
}
else if (functionName.equalsIgnoreCase(CategoricalCrossEntropy.class.getSimpleName())) {
return new CategoricalCrossEntropy();
}
throw new IllegalArgumentException(String.format("No double double function with name '%s' exists.",functionName));
}
|
Create a double double function with specified name.
|
public DefaultHttpResponseFactory(ReasonPhraseCatalog catalog){
if (catalog == null) {
throw new IllegalArgumentException("Reason phrase catalog must not be null.");
}
this.reasonCatalog=catalog;
}
|
Creates a new response factory with the given catalog.
|
public static String normalizeFilename(final String file){
if (file.startsWith("//")) {
if (Cfg.DEBUG) {
Check.log(TAG + " normalizeFilename: " + file);
}
return file.substring(1);
}
else {
return file;
}
}
|
Normalize filename.
|
private void generateTerrain(ICubePrimer cube,double[][][] input,int cubeX,int cubeY,int cubeZ){
int xSteps=X_SECTION_SIZE - 1;
int ySteps=Y_SECTION_SIZE - 1;
int zSteps=Z_SECTION_SIZE - 1;
for (int noiseX=0; noiseX < X_SECTIONS - 1; noiseX++) {
for (int noiseZ=0; noiseZ < Z_SECTIONS - 1; noiseZ++) {
for (int noiseY=0; noiseY < Y_SECTIONS - 1; noiseY++) {
double x0y0z0=input[noiseX][noiseY][noiseZ];
double x0y0z1=input[noiseX][noiseY][noiseZ + 1];
double x1y0z0=input[noiseX + 1][noiseY][noiseZ];
double x1y0z1=input[noiseX + 1][noiseY][noiseZ + 1];
double x0y1z0=input[noiseX][noiseY + 1][noiseZ];
double x0y1z1=input[noiseX][noiseY + 1][noiseZ + 1];
double x1y1z0=input[noiseX + 1][noiseY + 1][noiseZ];
double x1y1z1=input[noiseX + 1][noiseY + 1][noiseZ + 1];
for (int x=0; x < xSteps; x++) {
int xRel=noiseX * xSteps + x;
double xd=(double)x / xSteps;
double xy0z0=lerp(xd,x0y0z0,x1y0z0);
double xy0z1=lerp(xd,x0y0z1,x1y0z1);
double xy1z0=lerp(xd,x0y1z0,x1y1z0);
double xy1z1=lerp(xd,x0y1z1,x1y1z1);
for (int z=0; z < zSteps; z++) {
int zRel=noiseZ * zSteps + z;
double zd=(double)z / zSteps;
double xy0z=lerp(zd,xy0z0,xy0z1);
double xy1z=lerp(zd,xy1z0,xy1z1);
for (int y=0; y < ySteps; y++) {
int yRel=noiseY * ySteps + y;
double yd=(double)y / ySteps;
double xyz=lerp(yd,xy0z,xy1z);
double xyz0=lerp(yd,xy0z0,xy1z0);
double xyz1=lerp(yd,xy0z1,xy1z1);
double x0y0z=lerp(zd,x0y0z0,x0y0z1);
double x0y1z=lerp(zd,x0y1z0,x0y1z1);
double x1y0z=lerp(zd,x1y0z0,x1y0z1);
double x1y1z=lerp(zd,x1y1z0,x1y1z1);
double x0yz=lerp(yd,x0y0z,x0y1z);
double x1yz=lerp(yd,x1y0z,x1y1z);
double xGrad=(x1yz - x0yz) / xSteps;
double yGrad=(xy1z - xy0z) / ySteps;
double zGrad=(xyz1 - xyz0) / zSteps;
IBlockState state=getBlockStateFor(localToBlock(cubeY,yRel),xyz,xGrad,yGrad,zGrad);
cube.setBlockState(xRel,yRel,zRel,state);
}
}
}
}
}
}
}
|
Generate terrain at the specified location
|
protected static void initializeMessages(String bundleName,Class<? extends NLS> clazz){
try {
load(clazz);
if (!bundles.containsKey(bundleName)) bundles.put(bundleName,clazz);
}
catch ( Throwable e) {
}
}
|
Initialize a given class with the message bundle Keys Should be called from a class that extends NLS in a static block at class load time.
|
private static int findFirstDupOrDrop(int[] reorder,int newArity){
final int BIT_LIMIT=63;
if (newArity < BIT_LIMIT) {
long mask=0;
for (int i=0; i < reorder.length; i++) {
int arg=reorder[i];
if (arg >= newArity) {
return reorder.length;
}
long bit=1L << arg;
if ((mask & bit) != 0) {
return i;
}
mask|=bit;
}
if (mask == (1L << newArity) - 1) {
assert (Long.numberOfTrailingZeros(Long.lowestOneBit(~mask)) == newArity);
return 0;
}
long zeroBit=Long.lowestOneBit(~mask);
int zeroPos=Long.numberOfTrailingZeros(zeroBit);
assert (zeroPos <= newArity);
if (zeroPos == newArity) {
return 0;
}
return ~zeroPos;
}
else {
BitSet mask=new BitSet(newArity);
for (int i=0; i < reorder.length; i++) {
int arg=reorder[i];
if (arg >= newArity) {
return reorder.length;
}
if (mask.get(arg)) {
return i;
}
mask.set(arg);
}
int zeroPos=mask.nextClearBit(0);
assert (zeroPos <= newArity);
if (zeroPos == newArity) {
return 0;
}
return ~zeroPos;
}
}
|
Return an indication of any duplicate or omission in reorder. If the reorder contains a duplicate entry, return the index of the second occurrence. Otherwise, return ~(n), for the first n in [0..newArity-1] that is not present in reorder. Otherwise, return zero. If an element not in [0..newArity-1] is encountered, return reorder.length.
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:59.587 -0500",hash_original_method="91D0630D593C0E5EFA5BB0A713D23C43",hash_generated_method="C03ECE1CEE103510DDBEBF92F73191AD") public CharSequence loadDescription(PackageManager pm){
if (descriptionRes != 0) {
CharSequence label=pm.getText(packageName,descriptionRes,this);
if (label != null) {
return label;
}
}
return null;
}
|
Retrieve the textual description of the application. This will call back on the given PackageManager to load the description from the application.
|
public boolean hasCcs(){
return hasRepeatingExtension(Cc.class);
}
|
Returns whether it has the list of CCed users.
|
@Override public Generator<IPoint> construct(String[] args){
return new CircleGenerator(Integer.valueOf(args[0]));
}
|
Provide reflective behavior to construct instance of generator given an array of string arguments.
|
public static byte[] decode(byte[] source,int off,int len) throws Base64DecoderException {
return decode(source,off,len,DECODABET);
}
|
Decodes Base64 content in byte array format and returns the decoded byte array.
|
public Builder addCollectionItemClause(String collectionFieldName,String itemName){
return addFieldClause(QuerySpecification.buildCollectionItemName(collectionFieldName),itemName);
}
|
Add a clause which matches a collection item.
|
@Override public void teardown(){
}
|
a noop
|
public static boolean isArrayByteBase64(byte[] arrayOctect){
arrayOctect=discardWhitespace(arrayOctect);
int length=arrayOctect.length;
if (length == 0) {
return true;
}
for (int i=0; i < length; i++) {
if (!isBase64(arrayOctect[i])) {
return false;
}
}
return true;
}
|
Tests a given byte array to see if it contains only valid characters within the Base64 alphabet.
|
public static void printInstructions(IR ir){
SSADictionary dictionary=ir.HIRInfo.dictionary;
System.out.println("********* START OF IR DUMP in SSA FOR " + ir.method);
for (Enumeration<BasicBlock> be=ir.forwardBlockEnumerator(); be.hasMoreElements(); ) {
BasicBlock bb=be.nextElement();
for (Enumeration<Instruction> e=dictionary.getAllInstructions(bb); e.hasMoreElements(); ) {
Instruction s=e.nextElement();
System.out.print(s.getBytecodeIndex() + "\t" + s);
if (dictionary.defsHeapVariable(s) && s.operator() != PHI) {
System.out.print(" (Implicit Defs: ");
HeapOperand<?>[] defs=dictionary.getHeapDefs(s);
if (defs != null) {
for ( HeapOperand<?> def : defs) System.out.print(def + " ");
}
System.out.print(" )");
}
if (dictionary.usesHeapVariable(s) && s.operator() != PHI) {
System.out.print(" (Implicit Uses: ");
HeapOperand<?>[] uses=dictionary.getHeapUses(s);
if (uses != null) {
for ( HeapOperand<?> use : uses) System.out.print(use + " ");
}
System.out.print(" )");
}
System.out.print('\n');
}
}
System.out.println("********* END OF IR DUMP in SSA FOR " + ir.method);
}
|
Print the instructions in SSA form.
|
@Override public AsciiForm withUppercasePropertyName(){
this.uppercasePropertyName=true;
return this;
}
|
Use uppercase for the property name
|
public OMRect(int px1,int py1,int px2,int py2){
super(RENDERTYPE_XY,LINETYPE_UNKNOWN,DECLUTTERTYPE_NONE);
x1=px1;
y1=py1;
x2=px2;
y2=py2;
}
|
Construct an XY rectangle. It doesn't matter which corners of the rectangle are used, as long as they are opposite from each other.
|
public String testDestination(Location destination,Track track){
return rsTestDestination(destination,track);
}
|
Used to check destination track to see if it will accept rolling stock
|
public boolean hasString(){
return true;
}
|
Tell if this object contains a java String object.
|
protected void tagHandlerClassicSupportMethods() throws Exception {
writer.writeLineComment("Methods From TagSupport");
writer.fwrite("public int doStartTag() throws JspException {\n");
writer.indent();
writeSuperTagCallBody("doStartTag",true);
writer.outdent();
writer.fwrite("}\n\n");
writer.fwrite("public int doEndTag() throws JspException {\n");
writer.indent();
writeSuperTagCallBody("doEndTag",true);
writer.outdent();
writer.fwrite("}\n\n");
}
|
Generate Tag Handler support methods
|
public void beginSignleAction(WebRequest theRequest){
theRequest.addParameter("button1","button1");
}
|
* PENDING() perhaps reactivate this if the EG wants event loop detection. <p/> <p/> // tests event recursion - infinite loop // ValueChangeEvent will fire back the same event it received.. <p/> public void testValueChangeRecursion() { // for keeping track of events processed limit.. // eventsProcessed = new HashMap(); <p/> UIInput userName = new UIInput(); <p/> // add valueChangeListener to the component <p/> ValueChangeRecursion valueChange = new ValueChangeRecursion(); userName.addValueChangeListener(valueChange); <p/> // add value change event (containing the component) to the queue <p/> userName.queueEvent(new ValueChangeEvent( userName, "foo", "bar")); <p/> PhaseId phaseId = PhaseId.PROCESS_VALIDATIONS; boolean exceptionthrown = false; try { processEvents(getFacesContext(), phaseId); } catch (Throwable e) { System.out.println(e.getMessage()); exceptionthrown = true; } <p/> assertTrue(exceptionthrown); } *
|
public T caseAnonymous_parameter_1_(Anonymous_parameter_1_ object){
return null;
}
|
Returns the result of interpreting the object as an instance of '<em>Anonymous parameter 1</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
|
public int read(byte[] buf,int off,int len) throws IOException {
ensureOpen();
if (eos) {
return -1;
}
int n=super.read(buf,off,len);
if (n == -1) {
if (readTrailer()) eos=true;
else return this.read(buf,off,len);
}
else {
crc.update(buf,off,n);
}
return n;
}
|
Reads uncompressed data into an array of bytes. If <code>len</code> is not zero, the method will block until some input can be decompressed; otherwise, no bytes are read and <code>0</code> is returned.
|
public RankingImageListProvider inWeeks(int weeks){
mTime=Integer.toString(weeks) + "w";
return this;
}
|
Sets time limit for a ranking list in weeks (the default value is All Time).
|
public boolean isTakeOverable(){
if (isTakeoverOverride != null) {
return isTakeoverOverride;
}
else {
boolean allowTakeover=Raptor.getInstance().getPreferences().getBoolean(PreferenceKeys.BOARD_TAKEOVER_INACTIVE_GAMES);
ChessBoardController controller=getController();
return !(!allowTakeover || controller == null) && controller instanceof InactiveController;
}
}
|
Returns true if this ChessBoardWindowItem can be taken over by a new ChessBoardWindowItem as needed.
|
public static void decode(BinaryVariable binary,RealVariable real){
int numberOfBits=binary.getNumberOfBits();
double lowerBound=real.getLowerBound();
double upperBound=real.getUpperBound();
long index=decode(binary);
double scale=index / (double)((1L << numberOfBits) - 1);
double value=lowerBound + (upperBound - lowerBound) * scale;
real.setValue(value);
}
|
Decodes the specified binary variable into its real value.
|
public void goToNextColor(){
mColorIndex=(mColorIndex + 1) % (mColors.length);
}
|
Proceed to the next available ring color. This will automatically wrap back to the beginning of colors.
|
public void removeAll(String key,List<?> objects){
if (key == null) {
throw new IllegalArgumentException("Key cannot be null");
}
if (values.containsKey(key)) {
SabresValue sabresValue=values.get(key);
if (!(sabresValue instanceof ListValue)) {
throw new IllegalArgumentException("removeAll operation is only permitted on list values");
}
ListValue listValue=(ListValue)sabresValue;
for ( Object o : objects) {
listValue.remove(o);
}
}
}
|
Removes all instances of the objects contained in a List from the array associated with a given key. To remove one value you can call SabresObject.removeAll(key, Arrays.asList(value)).
|
public void processServerResponse(int response,ResponseData rawData){
if (response != Policy.RETRY) {
setRetryCount(0);
}
else {
setRetryCount(mRetryCount + 1);
}
if (response == Policy.LICENSED) {
Map<String,String> extras=decodeExtras(rawData.extra);
mLastResponse=response;
setValidityTimestamp(extras.get("VT"));
setRetryUntil(extras.get("GT"));
setMaxRetries(extras.get("GR"));
}
else if (response == Policy.NOT_LICENSED) {
setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP);
setRetryUntil(DEFAULT_RETRY_UNTIL);
setMaxRetries(DEFAULT_MAX_RETRIES);
}
setLastResponse(response);
mPreferences.commit();
}
|
Process a new response from the license server. <p> This data will be used for computing future policy decisions. The following parameters are processed: <ul> <li>VT: the timestamp that the client should consider the response valid until <li>GT: the timestamp that the client should ignore retry errors until <li>GR: the number of retry errors that the client should ignore </ul>
|
public void test_simpleRemovalWithRawRecords(){
final MemStore store=new MemStore(DirectBufferPool.INSTANCE,5);
try {
final Random r=new Random();
final HTreeIndexMetadata metadata=new HTreeIndexMetadata(UUID.randomUUID());
metadata.setAddressBits(2);
metadata.setRawRecords(true);
metadata.setMaxRecLen(64);
final HTree htree=HTree.create(store,metadata);
assertEquals(64,htree.getMaxRecLen());
assertTrue(htree.rawRecords);
final byte[] key=new byte[]{1,2,3};
final byte[] val=new byte[htree.getMaxRecLen() + 1];
r.nextBytes(val);
final int ninserts=15;
for (int i=0; i < ninserts; i++) {
htree.insert(key,val);
}
assertEquals(ninserts,htree.getEntryCount());
TestCase3.assertEquals(val,htree.lookupFirst(key));
assertEquals(ninserts,htree.removeAll(key));
assertEquals(0,htree.getEntryCount());
TestCase3.assertEquals(null,htree.lookupFirst(key));
}
finally {
store.destroy();
}
}
|
Test removal with raw records.
|
public static final String md5(String s) throws UtilException {
char hexDigits[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
try {
byte[] btInput=s.getBytes();
MessageDigest mdInst=MessageDigest.getInstance("MD5");
mdInst.update(btInput);
byte[] md=mdInst.digest();
int j=md.length;
char str[]=new char[j * 2];
int k=0;
for (int i=0; i < j; i++) {
byte byte0=md[i];
str[k++]=hexDigits[byte0 >>> 4 & 0xf];
str[k++]=hexDigits[byte0 & 0xf];
}
return new String(str);
}
catch ( Exception e) {
throw new UtilException(ErrorCodeDef.SYSTEM_ERROR_10001);
}
}
|
Description: <br>
|
public String create() throws SaaSApplicationException {
if (serviceForCreation == null || selectedTechService == null) {
return OUTCOME_ERROR;
}
boolean isPublicService=serviceForCreation.isPublicService();
serviceForCreation=new ServiceDetails(cleanupParameter(serviceForCreation.getVoServiceDetails()));
selectedService=new ServiceDetails(getProvisioningService().createService(selectedTechService,serviceForCreation.getVoServiceDetails(),getImageUploader().getVOImageResource()));
selectedService.setPublicService(isPublicService);
boolean addedMsg=false;
List<VOCategory> categories=selectedCategoryToVOUnwrapper(this.categorySelection);
try {
marketplaceBean.publishService(selectedService,categories);
}
catch ( ObjectNotFoundException e) {
if (ClassEnum.MARKETPLACE == e.getDomainObjectClassEnum()) {
addMessage(null,FacesMessage.SEVERITY_ERROR,ERROR_SERVICE_SAVED_MARKETPLACE_DELETED,new String[]{selectedService.getServiceId(),marketplaceBean.getMarketplace().getName(),marketplaceBean.getMarketplace().getMarketplaceId()});
addedMsg=true;
}
else {
throw e;
}
}
catch ( PublishingToMarketplaceNotPermittedException e) {
addMessage(null,FacesMessage.SEVERITY_ERROR,ERROR_SERVICE_SAVED_PUBLISHING_NOT_PERMITTED,new String[]{selectedService.getServiceId(),marketplaceBean.getMarketplace().getName(),marketplaceBean.getMarketplace().getMarketplaceId()});
addedMsg=true;
}
if (!addedMsg) {
addMessage(null,FacesMessage.SEVERITY_INFO,INFO_SERVICE_CREATED,selectedService.getServiceId());
}
sessionBean.setSelectedServiceKeyForSupplier(Long.valueOf(selectedService.getKey()));
prepareParameters();
services=null;
menuBean.setCurrentPageLink(MenuBean.LINK_SERVICE_EDIT);
if (logger.isDebugLoggingEnabled()) {
}
return OUTCOME_SUCCESS;
}
|
Define a new service.
|
public static boolean exportMaskInVarray(DbClient dbClient,ExportMask exportMask,URI varrayURI){
if (exportMask.getStoragePorts() == null || exportMask.getStoragePorts().isEmpty()) {
return false;
}
List<URI> targetURIs=StringSetUtil.stringSetToUriList(exportMask.getStoragePorts());
List<StoragePort> ports=dbClient.queryObject(StoragePort.class,targetURIs);
for ( StoragePort port : ports) {
if (port.getTaggedVirtualArrays() == null || !port.getTaggedVirtualArrays().contains(varrayURI.toString())) {
return false;
}
}
return true;
}
|
Determine if the ExportMask is "in" a given Varray. This is determined by if all the target ports are tagged for for the Varray.
|
public NotificationChain basicSetSuperClassRef(ParameterizedTypeRef newSuperClassRef,NotificationChain msgs){
ParameterizedTypeRef oldSuperClassRef=superClassRef;
superClassRef=newSuperClassRef;
if (eNotificationRequired()) {
ENotificationImpl notification=new ENotificationImpl(this,Notification.SET,TypesPackage.TCLASS__SUPER_CLASS_REF,oldSuperClassRef,newSuperClassRef);
if (msgs == null) msgs=notification;
else msgs.add(notification);
}
return msgs;
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public void releaseConnection(){
LOG.trace("enter HttpConnection.releaseConnection()");
if (locked) {
LOG.debug("Connection is locked. Call to releaseConnection() ignored.");
}
else if (httpConnectionManager != null) {
LOG.debug("Releasing connection back to connection manager.");
httpConnectionManager.releaseConnection(this);
}
else {
LOG.warn("HttpConnectionManager is null. Connection cannot be released.");
}
}
|
Releases the connection. If the connection is locked or does not have a connection manager associated with it, this method has no effect. Note that it is completely safe to call this method multiple times.
|
public boolean multipliesWith(FloatMatrix a){
return columns == a.rows;
}
|
Checks whether two matrices can be multiplied (that is, number of columns of this must equal number of rows of a.
|
public NamedSmartTreeNode(String name){
super(name);
this.name=name;
}
|
Creates a new instance of NamedSmartTreeNode
|
private List<Relation> loadDynamicRelations(Universe root,List<Domain> domains,Map<Table,Domain> coverage,List<Relation> concretes){
Project project=root.getProject();
HashSet<ExpressionAST> dedup=new HashSet<>();
HashSet<String> naturals=new HashSet<>();
List<Relation> relations=new ArrayList<Relation>();
for ( Relation concrete : concretes) {
relations.add(concrete);
naturals.add(concrete.getOid());
if (concrete.getJoinExpression() != null) {
try {
ExpressionAST join=parseResilient(root,concrete,concretes);
dedup.add(join);
}
catch ( ScopeException e) {
}
}
}
for ( Domain domain : domains) {
try {
if (!domain.getOptions().getReinjected() && !domain.getOptions().getAlink()) {
Table table=root.getTable(domain);
HashMap<String,NaturalRelation> dedupLinks=new HashMap<>();
for ( ForeignKey fk : getForeignKeys(table)) {
Table targetTable=fk.getPrimaryTable();
Domain target=coverage.get(targetTable);
if (target != null) {
String link=genRelationLinkId(project,domain,target);
String id=link + ":" + fk.getName();
String digest=digest(id);
Relation relation=null;
NaturalRelation samesame=null;
if (!naturals.contains(digest)) {
String leftName=domain.getName();
String rightName=target.getName();
samesame=dedupLinks.get(link);
if (samesame != null) {
leftName+="[" + fk.getName() + "]";
rightName+="[" + fk.getName() + "]";
if (samesame.first) {
samesame.rel.setLeftName(samesame.rel.getLeftName() + "[" + samesame.fk.getName()+ "]");
samesame.rel.setRightName(samesame.rel.getRightName() + "[" + samesame.fk.getName()+ "]");
}
}
RelationPK relationPk=new RelationPK(project.getId(),digest);
relation=new Relation(relationPk,domain.getId(),Cardinality.MANY,target.getId(),Cardinality.ZERO_OR_ONE,leftName,rightName,new Expression("'" + fk.getName() + "'"),true);
AccessRightsUtils.getInstance().setAccessRights(root.getContext(),relation,project);
try {
ExpressionAST check=root.getParser().parse(relation);
if (!dedup.contains(check)) {
relations.add(relation);
}
}
catch ( ScopeException e) {
}
}
dedupLinks.put(link,new NaturalRelation(relation,fk,relation != null && samesame == null));
}
}
}
else {
domain.getOptions().getLinkSource();
}
}
catch ( ScopeException e) {
logger.info(e.getMessage(),e);
}
}
return relations;
}
|
dynamic relation loading: check all existing FK and automatically create relation if not already concrete
|
private void addAndMeasureChild(final View child,final int layoutMode){
LayoutParams params=child.getLayoutParams();
if (params == null) {
params=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
}
final int index=layoutMode == LAYOUT_MODE_ABOVE ? 0 : -1;
child.setDrawingCacheEnabled(true);
addViewInLayout(child,index,params,true);
final int itemWidth=(int)(getWidth() * ITEM_WIDTH);
child.measure(MeasureSpec.EXACTLY | itemWidth,MeasureSpec.UNSPECIFIED);
}
|
Adds a view as a child view and takes care of measuring it
|
public void cancel(int id){
String pkg=mContext.getPackageName();
try {
sService.cancelLiveLockScreen(pkg,id,UserHandle.myUserId());
}
catch ( RemoteException e) {
logServiceException(e);
}
}
|
Cancels a previously shown Live lock screen.
|
public boolean more() throws JSONException {
this.next();
if (this.end()) {
return false;
}
this.back();
return true;
}
|
Determine if the source string still contains characters that next() can consume.
|
public static Object decodeToObject(String encodedObject) throws java.io.IOException, java.lang.ClassNotFoundException {
byte[] objBytes=decode(encodedObject);
java.io.ByteArrayInputStream bais=null;
java.io.ObjectInputStream ois=null;
Object obj=null;
try {
bais=new java.io.ByteArrayInputStream(objBytes);
ois=new java.io.ObjectInputStream(bais);
obj=ois.readObject();
}
catch ( java.io.IOException e) {
throw e;
}
catch ( java.lang.ClassNotFoundException e) {
throw e;
}
finally {
try {
bais.close();
}
catch ( Exception e) {
}
try {
ois.close();
}
catch ( Exception e) {
}
}
return obj;
}
|
Attempts to decode Base64 data and deserialize a Java Object within. Returns <tt>null</tt> if there was an error.
|
public static void moveDown(JList list){
if (canMoveDown(list)) moveItems(list,1,MOVE_DOWN);
}
|
moves the selected item down by 1
|
@SuppressWarnings("unchecked") @Override public void eSet(int featureID,Object newValue){
switch (featureID) {
case DomPackage.TAG__TITLE:
setTitle((TagTitle)newValue);
return;
case DomPackage.TAG__VALUES:
getValues().clear();
getValues().addAll((Collection<? extends TagValue>)newValue);
return;
case DomPackage.TAG__TAG_DEFINITION:
setTagDefinition((ITagDefinition)newValue);
return;
}
super.eSet(featureID,newValue);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public void startDocument() throws org.xml.sax.SAXException {
}
|
Receive notification of the beginning of a document. <p>The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).</p>
|
public void writeSpeedCounts(String outputFolder){
String filename=outputFolder + (outputFolder.endsWith("/") ? "" : "/") + "speedClassCounts.csv";
LOG.info("Writing the speed class counts to " + filename);
BufferedWriter bw=IOUtils.getBufferedWriter(filename);
try {
bw.write("speedClass,count");
bw.newLine();
for (int i=0; i < this.speedObservations.length; i++) {
bw.write(String.format("%d,%d\n",i,this.speedObservations[i]));
}
}
catch ( IOException e) {
e.printStackTrace();
throw new RuntimeException("Cannot write to " + filename);
}
finally {
try {
bw.close();
}
catch ( IOException e) {
e.printStackTrace();
throw new RuntimeException("Cannot close " + filename);
}
}
LOG.info("Done writing the speed class counts.");
}
|
Writes the speed observation results: the number of records in each risk class. The output file with name <code>speedClassCounts.csv</code> will be created in the output folder.
|
private HashMapEntry<K,V>[] makeTable(int newCapacity){
@SuppressWarnings("unchecked") HashMapEntry<K,V>[] newTable=(HashMapEntry<K,V>[])new HashMapEntry[newCapacity];
table=newTable;
threshold=(newCapacity >> 1) + (newCapacity >> 2);
return newTable;
}
|
Allocate a table of the given capacity and set the threshold accordingly.
|
protected static String quoteArray(String[] s){
return StringUtils.quoteJavaStringArray(s);
}
|
Format a string array to the Java source code that represents this object.
|
@Override public String toString(){
return getDescriptor();
}
|
Returns a string representation of this type.
|
boolean add(String srcFilename,int srcLine,int dstLine,boolean isPreferLast){
if (_srcFilename != null && (!_srcFilename.equals(srcFilename) || srcFilename == null)) return false;
if (dstLine <= _dstLine) {
if (!isPreferLast) return true;
else if (_dstIncrement == 1 && _repeat == 1) {
_srcLine=srcLine;
return true;
}
else if (_repeat > 1) {
_repeat--;
return false;
}
else if (_dstIncrement > 1) {
_dstIncrement--;
return false;
}
else return true;
}
if (srcLine == _srcLine) {
_dstIncrement=dstLine - _dstLine + 1;
return true;
}
else if (dstLine - _dstLine == (srcLine - _srcLine) * _dstIncrement) {
_repeat=srcLine - _srcLine + 1;
return true;
}
else if (srcLine == _srcLine + 1 && _repeat == 1) {
_dstIncrement=dstLine - _dstLine;
return false;
}
return false;
}
|
Tries to add a new location.
|
public boolean hasMore(){
return this.first != null;
}
|
Returns whether more chrono storage blocks are available.
|
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
setMeasuredDimension((int)Math.min(MeasureSpec.getSize(widthMeasureSpec),halfWidth * 2),(int)Math.min(MeasureSpec.getSize(heightMeasureSpec),height));
}
|
set our view to be the minimum of the sizes that Android will allow and our desired sizes
|
public static void deleteViews(final Window parent,final IViewContainer viewContainer,final INaviView[] views){
if (CMessageBox.showYesNoQuestion(parent,String.format("Do you really want to delete the following views?\n\n%s",CNameListGenerators.getNameList(views))) == JOptionPane.YES_OPTION) {
for ( final INaviView view : views) {
try {
viewContainer.deleteView(view);
}
catch ( final CouldntDeleteException exception) {
CUtilityFunctions.logException(exception);
final String innerMessage="E00148: " + "Could not delete view";
final String innerDescription=CUtilityFunctions.createDescription(String.format("The view '%s' could not be deleted.",view.getName()),new String[]{"There was a problem with the database connection."},new String[]{"The view was not deleted and can still be used."});
NaviErrorDialog.show(parent,innerMessage,innerDescription,exception);
}
}
}
}
|
Deletes one or more views from a view container.
|
public void resumeAll() throws SchedulerException {
sched.resumeAll();
}
|
<p> Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>. </p>
|
public double ln(final int n){
check(n);
if (n <= tabulated) return Math.log(firstFactorials[n]);
return gammaFunction.logValue(n + 1);
}
|
Computes log of n factorial, <code>ln(n!)</code>
|
public static void chunkTaskSync(RegionWrapper region,final RunnableVal<int[]> task){
final int p1x=region.minX;
final int p1z=region.minZ;
final int p2x=region.maxX;
final int p2z=region.maxZ;
final int bcx=p1x >> 4;
final int bcz=p1z >> 4;
final int tcx=p2x >> 4;
final int tcz=p2z >> 4;
task.value=new int[7];
for (int x=bcx; x <= tcx; x++) {
for (int z=bcz; z <= tcz; z++) {
task.value[0]=x;
task.value[1]=z;
task.value[2]=task.value[0] << 4;
task.value[3]=task.value[1] << 4;
task.value[4]=task.value[2] + 15;
task.value[5]=task.value[3] + 15;
task.value[6]=0;
if (task.value[0] == bcx) {
task.value[2]=p1x;
task.value[6]=1;
}
if (task.value[0] == tcx) {
task.value[4]=p2x;
task.value[6]=1;
}
if (task.value[1] == bcz) {
task.value[3]=p1z;
task.value[6]=1;
}
if (task.value[1] == tcz) {
task.value[5]=p2z;
task.value[6]=1;
}
task.run();
}
}
}
|
The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunk
|
protected InfoModelPropertySourceImpl(){
super();
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public DrawerBuilder withCustomView(@NonNull View customView){
this.mCustomView=customView;
return this;
}
|
Pass a custom view if you need a completely custom drawer content
|
protected final void onError(final T_State state,final Error error,final String eventName){
final Object[] args={eventName,state};
final String message=error.getDescription(args);
getObserver().onError(this,error,message);
}
|
/ Invoked when the specified error has occurred while in the named event has been received in the given state.
|
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
|
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
|
public String reverseWords(String s){
if (s == null || s.length() == 0) return "";
String res="";
for (int i=0; i < s.length(); i++) {
char c=s.charAt(i);
if (c == ' ') continue;
else {
StringBuilder word=new StringBuilder();
while (i < s.length()) {
c=s.charAt(i);
if (c == ' ') break;
word.append(c);
i++;
}
res=res.length() == 0 ? word.toString() : word.toString() + " " + res;
i--;
}
}
return res;
}
|
If space, continue If not, get the word and insert to the front of result note that result may not contain spaces before or after
|
protected int sizeof(Object o) throws IllegalArgumentException {
return basicSizeof(o,this.sizer);
}
|
Return the size of an object as stored in GemFire... Typically this is the serialized size in bytes.. This implementation is slow.... Need to add Sizer interface and call it for customer objects.
|
public static String buildSelectorFromElementAndChildren(String elementName,Collection<String> childrenList,boolean hasChild){
StringBuilder selector=new StringBuilder();
boolean isFirstElement=true;
for ( String child : childrenList) {
if (!isFirstElement) {
selector.append(SPACE);
selector.append(COMMA);
selector.append(SPACE);
}
selector.append(elementName);
if (!hasChild) {
selector.append(NOT_PREFIX);
}
selector.append(HAS_PREFIX);
selector.append(child);
selector.append(CLOSE_PARENTHESE);
if (!hasChild) {
selector.append(CLOSE_PARENTHESE);
}
isFirstElement=false;
}
return selector.toString();
}
|
Build a JQuery selector to retrieve elements that have or not children of a given type. Multiple children can be set.
|
public JSDocContext(TemplateContextType type,IDocument document,Position completionPosition){
super(type,document,completionPosition);
}
|
Creates a javadoc template context.
|
public void addLocation(Where location){
getLocations().add(location);
}
|
Adds a new event location.
|
public final void test_chooseEngineClientAlias(){
X509ExtendedKeyManager km=new MyX509ExtendedKeyManager();
if (km.chooseEngineClientAlias(null,null,null) != null) {
fail("non null result");
}
}
|
javax.net.ssl.X509ExtendedKeyManager #chooseEngineClientAlias(java.lang.String[], java.security.Principal[], javax.net.ssl.SSLEngine)
|
@Override public Instances generateExamples() throws Exception {
Instances result;
int i;
result=new Instances(m_DatasetFormat,0);
m_Random=new Random(getSeed());
for (i=0; i < getNumExamplesAct(); i++) {
result.add(generateExample());
}
return result;
}
|
Generates all examples of the dataset. Re-initializes the random number generator with the given seed, before generating instances.
|
public static long parseHexLong(String s,boolean ignoreTrailingChars){
long value=0;
if (s == null) {
return value;
}
if (s.startsWith("0x")) {
s=s.substring(2);
}
if (ignoreTrailingChars && s.length() > 0) {
for (int i=0; i < s.length(); i++) {
char c=s.charAt(i);
if ("0123456789abcdefABCDEF".indexOf(c) < 0) {
s=s.substring(0,i);
break;
}
}
}
value=Long.parseLong(s,16);
return value;
}
|
Parse the string as a number and returns its value. The number is always parsed in base 16. The string can start as an option with "0x".
|
public double distance(final double x,final double y,final double z){
final double dx=(double)this.x - x;
final double dy=(double)this.y - y;
final double dz=(double)this.z - z;
return Math.sqrt(dx * dx + dy * dy + dz * dz);
}
|
Returns the distance FROM this Int3D TO the specified point
|
@Override public Operator cloneOperator(String name,boolean forParallelExcecution){
OperatorChain clone=(OperatorChain)super.cloneOperator(name,forParallelExcecution);
if (areSubprocessesExtendable()) {
while (clone.getNumberOfSubprocesses() < getNumberOfSubprocesses()) {
clone.addSubprocess(clone.getNumberOfSubprocesses());
}
}
for (int i=0; i < subprocesses.length; i++) {
clone.subprocesses[i].cloneExecutionUnitFrom(this.subprocesses[i],forParallelExcecution);
}
return clone;
}
|
Performs a deep clone of this operator chain. Use this method only if you are sure what you are doing.
|
public IntIterator rows(Predicate filter){
return FilterIteratorFactory.rows(this,filter);
}
|
Get a filtered iterator over the row numbers of this table, returning only the rows whose tuples match the given filter predicate.
|
public void initOutBuffer(Object obj){
collector().initOutBuffer(getRuleName(),obj);
}
|
This method initialises a data buffer associated with the supplied object.
|
public void back() throws JSONException {
if (this.usePrevious || this.index <= 0) {
throw new JSONException("Stepping back two steps is not supported");
}
this.index-=1;
this.character-=1;
this.usePrevious=true;
this.eof=false;
}
|
Back up one character. This provides a sort of lookahead capability, so that you can test for a digit or letter before attempting to parse the next number or identifier.
|
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
request.getSession().setAttribute("school","cdut");
response.sendRedirect("servlet/SchoolServlet");
return;
}
|
The doGet method of the servlet. <br> This method is called when a form has its tag value method equals to get.
|
private void handleSingleOutputJobs(ArrayList<Lop> execNodes,ArrayList<ArrayList<Lop>> jobNodes,ArrayList<Lop> finishedNodes) throws LopsException {
ArrayList<Lop> nodesWithUnfinishedOutputs=new ArrayList<Lop>();
int[] jobIndices={JobType.MMCJ.getId()};
Lop.Type[] lopTypes={Lop.Type.MMCJ};
for (int jobi=0; jobi < jobIndices.length; jobi++) {
int jindex=jobIndices[jobi];
if (!jobNodes.get(jindex).isEmpty()) {
ArrayList<Lop> vec=jobNodes.get(jindex);
for (int i=0; i < vec.size(); i++) {
Lop node=vec.get(i);
if (node.getExecLocation() == ExecLocation.MapOrReduce || node.getExecLocation() == ExecLocation.Map) {
Lop MRparent=getParentNode(node,execNodes,ExecLocation.MapAndReduce);
if (MRparent != null && MRparent.getType() == lopTypes[jobi]) {
int numParents=node.getOutputs().size();
if (numParents > 1) {
for (int j=0; j < numParents; j++) {
if (!finishedNodes.contains(node.getOutputs().get(j))) nodesWithUnfinishedOutputs.add(node);
}
}
}
}
}
for ( Lop node : vec) {
if (node.getExecLocation() == ExecLocation.MapOrReduce || node.getExecLocation() == ExecLocation.Map) {
if (nodesWithUnfinishedOutputs.contains(node)) finishedNodes.remove(node);
if (hasParentNode(node,nodesWithUnfinishedOutputs)) finishedNodes.remove(node);
}
}
}
}
}
|
As some jobs only write one output, all operations in the mapper need to be redone and cannot be marked as finished.
|
protected SSLContextImpl(DefaultSSLContextImpl dummy) throws GeneralSecurityException, IOException {
synchronized (DefaultSSLContextImpl.class) {
if (DEFAULT_SSL_CONTEXT_IMPL == null) {
clientSessionContext=new ClientSessionContext();
serverSessionContext=new ServerSessionContext();
DEFAULT_SSL_CONTEXT_IMPL=(DefaultSSLContextImpl)this;
}
else {
clientSessionContext=DEFAULT_SSL_CONTEXT_IMPL.engineGetClientSessionContext();
serverSessionContext=DEFAULT_SSL_CONTEXT_IMPL.engineGetServerSessionContext();
}
sslParameters=new SSLParametersImpl(DEFAULT_SSL_CONTEXT_IMPL.getKeyManagers(),DEFAULT_SSL_CONTEXT_IMPL.getTrustManagers(),null,clientSessionContext,serverSessionContext);
}
}
|
Constuctor for the DefaultSSLContextImpl.
|
public boolean schedule(E e){
return super.schedule(e);
}
|
!!! Do not remove this code !!! Otherwise it will be impossible to override schedule method
|
public boolean deleteAll(){
return dbHelper.getWritableDatabase().delete(tableName,"1",null) > 0;
}
|
Deletes all entries from database
|
public boolean isRunning(){
return started;
}
|
Returns a boolean indicating whether the server is running.
|
public void onPackageRemovedAllUsers(String packageName,int uid){
}
|
Called when a package is really removed (and not replaced) for all users on the device.
|
public static Statement createStatement(){
return createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY,null);
}
|
Create Read Only Statement
|
private IgniteConfiguration gridConfiguration(boolean dfltGridName,boolean dfltIgfsName) throws Exception {
IgniteConfiguration cfg=super.getConfiguration(dfltGridName ? null : GRID_NAME);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
TcpDiscoverySpi discoSpi=new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
TcpCommunicationSpi commSpi=new TcpCommunicationSpi();
commSpi.setSharedMemoryPort(-1);
cfg.setCommunicationSpi(commSpi);
CacheConfiguration metaCacheCfg=defaultCacheConfiguration();
metaCacheCfg.setName("replicated");
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration dataCacheCfg=defaultCacheConfiguration();
dataCacheCfg.setName("partitioned");
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
cfg.setCacheConfiguration(metaCacheCfg,dataCacheCfg);
FileSystemConfiguration igfsCfg=new FileSystemConfiguration();
igfsCfg.setDataCacheName("partitioned");
igfsCfg.setMetaCacheName("replicated");
igfsCfg.setName(dfltIgfsName ? null : IGFS_NAME);
igfsCfg.setPrefetchBlocks(1);
igfsCfg.setDefaultMode(PRIMARY);
IgfsIpcEndpointConfiguration endpointCfg=new IgfsIpcEndpointConfiguration();
endpointCfg.setType(IgfsIpcEndpointType.TCP);
endpointCfg.setPort(DFLT_IPC_PORT);
igfsCfg.setIpcEndpointConfiguration(endpointCfg);
igfsCfg.setManagementPort(-1);
igfsCfg.setBlockSize(512 * 1024);
cfg.setFileSystemConfiguration(igfsCfg);
return cfg;
}
|
Create Grid configuration.
|
private void replaceAllNullsWithEmptyString(List<String> list){
for (int i=0; i < list.size(); i++) {
if (list.get(i) == null) {
list.set(i,"");
}
}
}
|
Replaces all null values in the specified list with empty strings.
|
public ProducesRequestCondition(String[] produces,String[] headers){
this(produces,headers,null);
}
|
Creates a new instance with "produces" and "header" expressions. "Header" expressions where the header name is not 'Accept' or have no header value defined are ignored. If 0 expressions are provided in total, this condition will match to any request.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.