code
stringlengths
10
174k
nl
stringlengths
3
129k
public static XMLObjectReader newInstance(InputStream in,String encoding) throws XMLStreamException { XMLObjectReader reader=new XMLObjectReader(); reader.setInput(in,encoding); return reader; }
Returns a XML object reader (potentially recycled) having the specified input stream/encoding as input.
public boolean isForeignKeysSupported(){ return foreignKeysSupported; }
Determines whether indices are supported.
public Builder(RenderScript rs,Element e){ e.checkValid(); mRS=rs; mElement=e; }
Create a new builder object.
public void prologueStackHeights(NormalMethod method,BytecodeStream bcodes,int[] stackHeights){ if (VM.TraceOnStackReplacement) { VM.sysWriteln("computing stack heights of method " + method.toString()); } bytecodes=bcodes; visitedpc=new byte[bytecodes.length()]; ignoreGotos=true; int localsize=method.getLocalWords(); retaddr=new int[localsize]; for (int i=0; i < localsize; i++) { retaddr[i]=-1; } addr=-1; int stacksize=method.getOperandWords(); TypeStack simstacks=new TypeStack(stacksize,VoidTypeCode); { int startpc=0; scanBlocks(method,bytecodes,false,-1,null,null,startpc,simstacks,stackHeights); } visitedpc=null; }
Compute stack heights of bytecode stream (used for osr prologue)
public void sendSAXComment(org.xml.sax.ext.LexicalHandler ch,int start,int length) throws org.xml.sax.SAXException { String comment=getString(start,length); ch.comment(comment.toCharArray(),0,length); }
Sends the specified range of characters as sax Comment. <p> Note that, unlike sendSAXcharacters, this has to be done as a single call to LexicalHandler#comment.
public AbstractIndexTask(final String termText,final int termNdx,final int numTerms,final boolean prefixMatch,final double queryTermWeight,final FullTextIndex<V> searchEngine){ if (termText == null) throw new IllegalArgumentException(); if (searchEngine == null) throw new IllegalArgumentException(); this.queryTerm=termText; this.queryTermNdx=termNdx; this.numQueryTerms=numTerms; this.queryTermWeight=queryTermWeight; final IKeyBuilder keyBuilder=searchEngine.getIndex().getIndexMetadata().getKeyBuilder(); { keyBuilder.reset(); keyBuilder.appendText(termText,true,false); final byte[] tmp=keyBuilder.getKey(); if (prefixMatch) { fromKey=new byte[tmp.length - 3]; System.arraycopy(tmp,0,fromKey,0,fromKey.length); } else { fromKey=tmp; } } { toKey=SuccessorUtil.successor(fromKey.clone()); } }
Setup a task that will perform a range scan for entries matching the search term.
public List<Pair<Level,String>> load() throws IOException { final Logger logger=GPLogger.getLogger(GanttCSVOpen.class); final List<Pair<Level,String>> errors=Lists.newArrayList(); for ( RecordGroup group : myRecordGroups) { group.setErrorOutput(errors); } int idxCurrentGroup=0; int idxNextGroup; int skipHeadLines=0; do { idxNextGroup=idxCurrentGroup; CSVFormat format=CSVFormat.DEFAULT.withIgnoreEmptyLines(false).withIgnoreSurroundingSpaces(true); if (myCsvOptions != null) { format=format.withDelimiter(myCsvOptions.sSeparatedChar.charAt(0)).withQuote(myCsvOptions.sSeparatedTextChar.charAt(0)); } RecordGroup currentGroup=myRecordGroups.get(idxCurrentGroup); if (currentGroup.getHeader() != null) { format=format.withHeader(currentGroup.getHeader().toArray(new String[0])); idxNextGroup++; } try (Reader reader=myInputSupplier.get()){ CSVParser parser=new CSVParser(reader,format); skipHeadLines=doLoad(parser,idxCurrentGroup,skipHeadLines); } idxCurrentGroup=idxNextGroup; } while (skipHeadLines > 0); for ( RecordGroup group : myRecordGroups) { group.postProcess(); } return errors; }
Create tasks from file.
public void convertToFileIfRequired(){ try { if (small != null && small.length > getMaxLengthInplaceLob()) { int len=getBufferSize(Long.MAX_VALUE); int tabId=tableId; if (type == Value.BLOB) { createFromStream(DataUtils.newBytes(len),0,getInputStream(),Long.MAX_VALUE); } else { createFromReader(new char[len],0,getReader(),Long.MAX_VALUE); } Value v2=link(tabId); if (SysProperties.CHECK && v2 != this) { DbException.throwInternalError(); } } } catch ( IOException e) { throw DbException.convertIOException(e,null); } }
Store the lob data to a file if the size of the buffer is larger than the maximum size for an in-place lob.
public Object runSafely(Catbert.FastStack stack) throws Exception { MediaFile mf=getMediaFile(stack); return new Long(mf == null ? 0 : mf.getRecordTime()); }
Returns the starting time for the content in ths specified MediaFile. This corresponds to when the file's recording started or the timestamp on the file itself. See java.lang.System.currentTimeMillis() for information on the time units.
public JCExpression makeNullCheck(JCExpression arg){ Name name=TreeInfo.name(arg); if (name == names._this || name == names._super) return arg; JCTree.Tag optag=NULLCHK; JCUnary tree=make.at(arg.pos).Unary(optag,arg); tree.operator=syms.nullcheck; tree.type=arg.type; return tree; }
Make an attributed null check tree.
protected boolean handle(){ log.debug("Waiting for state change"); waitSensorChange(now,sensor); now=sensor.getKnownState(); log.debug("Found new state: " + now); setTurnout(now); return true; }
Watch "sensor", and when it changes adjust "turnout" to match.
@Override public void eSet(int featureID,Object newValue){ switch (featureID) { case N4JSPackage.FUNCTION_OR_FIELD_ACCESSOR__BODY: setBody((Block)newValue); return; case N4JSPackage.FUNCTION_OR_FIELD_ACCESSOR__LOK: set_lok((LocalArgumentsVariable)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public Offer(final RPObject object){ super(object); setRPClass("offer"); hide(); getSlot(OFFER_ITEM_SLOT_NAME).clear(); final RPObject itemObject=object.getSlot(OFFER_ITEM_SLOT_NAME).getFirst(); final Item entity=new ItemTransformer().transform(itemObject); if (entity == null) { int quantity=1; if (itemObject.has("quantity")) { quantity=itemObject.getInt("quantity"); } logger.warn("Cannot restore " + quantity + " "+ itemObject.get("name")+ " to offer "+ " because this item was removed from items.xml"); return; } getSlot(OFFER_ITEM_SLOT_NAME).addPreservingId(entity); }
Creates an Offer from a RPObject
static void stopRefreshTimer(){ try { if (refreshTimer != null && mbeanServer != null) { mbeanServer.unregisterMBean(refreshTimerObjectName); refreshTimer.stop(); } } catch ( JMException e) { logStackTrace(Level.WARN,e); } catch ( JMRuntimeException e) { logStackTrace(Level.WARN,e); } catch ( Exception e) { logStackTrace(Level.DEBUG,e,"Failed to stop refresh timer for MBeanUtil"); } }
Initializes the timer for sending refresh notifications.
public RenderPass(RajawaliScene scene,Camera camera,int clearColor){ mPassType=PassType.RENDER; mScene=scene; mCamera=camera; mClearColor=clearColor; mOldClearColor=0x00000000; mEnabled=true; mClear=true; mNeedsSwap=true; }
Instantiates a new RenderPass object.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:29.511 -0500",hash_original_method="3040682D1BCFEA9BA338FA9FE200A62D",hash_generated_method="CAAB92B2FE1C02DD4BCA219B7AFDAD2B") public void onRingingBack(SipSession session){ }
Called when a RINGING response is received for the INVITE request sent
public TaskResourceRep hostVcenterUnassign(URI hostId,URI eventId){ return hostClusterChange(hostId,NullColumnValueGetter.getNullURI(),NullColumnValueGetter.getNullURI(),true,eventId); }
Unassign host from a vCenter NOTE: In order to maintain backwards compatibility, do not change the signature of this method.
private void openFile(final File file,final int page){ try { final boolean fileCanBeOpened=OpenFile.openUpFile(file.getCanonicalPath(),commonValues,searchFrame,currentGUI,decode_pdf,properties,thumbnails); commonValues.setCurrentPage(page); if (fileCanBeOpened) { OpenFile.processPage(commonValues,decode_pdf,currentGUI,thumbnails); } } catch ( final Exception e) { System.err.println("Exception " + e + " processing file"); e.printStackTrace(); Values.setProcessing(false); } }
General code to open file at specified page - do not call directly
public Vertex top(Network network){ if (this.contextStack.isEmpty()) { return null; } return network.findById(this.contextStack.get(this.contextStack.size() - 1)); }
Return the top of the context stack.
public static GenericValue create(Delegator delegator,ModelEntity modelEntity,Map<String,? extends Object> fields){ GenericValue newValue=new GenericValue(); newValue.init(delegator,modelEntity,fields); return newValue; }
Creates new GenericValue from existing Map
public AuthSSLInitializationError(String message){ super(message); }
Creates a new AuthSSLInitializationError with the specified message.
public boolean containsEntry(int position,VariableReference var){ if (!trace.containsKey(position)) { trace.put(position,new HashMap<Integer,T>()); return false; } if (!trace.get(position).containsKey(var.getStPosition())) return false; return true; }
Get the current entry at the given position
protected ConditionExpression andConditions(ConditionExpression conds,ConditionExpression cond){ if (conds == null) return cond; else { List<ConditionExpression> operands=new ArrayList<>(2); operands.add(conds); operands.add(cond); return new LogicalFunctionCondition("and",operands,cond.getSQLtype(),null,typesTranslator.typeForSQLType(cond.getSQLtype())); } }
Combine AND of conditions (or <code>null</code>) with another one.
public boolean isNullOrEmpty(String section,String key){ String value=getKeyValueEL(section,key); return (value == null || value.length() == 0); }
Gets the NullOrEmpty attribute of the IniFile object
public static SymbolTable makeLocalSymtab(IonSystem system,String... localSymbols){ return newLocalSymtab(system,system.getSystemSymbolTable(),Arrays.asList(localSymbols)); }
Creates a local symtab with local symbols but no imports.
public boolean isSynchronised() throws IOException { String serverVersion=preCalcMatchClient.getServerVersion(); int finalDashIndex=interproscanVersion.lastIndexOf("-"); String interproDataVersion=interproscanVersion.substring(finalDashIndex); if (!serverVersion.endsWith(interproDataVersion)) { displayLookupSynchronisationError(interproscanVersion,serverVersion); return false; } return true; }
If the client and the server are based on the same version of interproscan return true, otherwise return false
public String clusterResultsToString(){ return m_clusteringResults.toString(); }
return the results of clustering.
public static RxANRequest.PatchRequestBuilder patch(String url){ return new RxANRequest.PatchRequestBuilder(url); }
Method to make PATCH request
@Override public String toString(){ return name; }
Returns a string containing a concise, human-readable description of this object. In this case, the enum constant's name is returned.
protected double defaultNoiseVariance(){ return 1.0; }
returns the default variance of the noise rate
public IgniteTxRollbackCheckedException(Throwable cause){ super(cause); }
Creates new exception with given nested exception.
public void reAlloc(){ final long newAllocationSize=allocationSizeInBytes * 2L; if (newAllocationSize > MAX_ALLOCATION_SIZE) { throw new OversizedAllocationException("Requested amount of memory is more than max allowed allocation size"); } final int curSize=(int)newAllocationSize; final ArrowBuf newBuf=allocator.buffer(curSize); newBuf.setZero(0,newBuf.capacity()); newBuf.setBytes(0,data,0,data.capacity()); data.release(); data=newBuf; allocationSizeInBytes=curSize; }
Allocate new buffer with double capacity, and copy data into the new buffer. Replace vector's buffer with new buffer, and release old one
public boolean undo(INode state){ SmallPuzzle tp=(SmallPuzzle)state; tp.s[0]*=2; tp.s[1]*=2; return true; }
Undo a move.
public GradlePluginsRuntimeException(String message,Throwable cause){ super(message,cause); }
Creates a new instance.
@Override public DataHeaderViewHolder newViewHolder(ViewGroup viewGroup){ View dataHeaderView=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.offer_header,viewGroup,false); return new DataHeaderViewHolder(dataHeaderView); }
creates a new ViewHolder using the provided xml layout
public void restart(String gatewayId) throws PageException { executeThread(gatewayId,GatewayThread.RESTART); }
restart the gateway
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
private int readAnnotationValue(int v,final char[] buf,final String name,final AnnotationVisitor av){ int i; if (av == null) { switch (b[v] & 0xFF) { case 'e': return v + 5; case '@': return readAnnotationValues(v + 3,buf,true,null); case '[': return readAnnotationValues(v + 1,buf,false,null); default : return v + 3; } } switch (b[v++] & 0xFF) { case 'I': case 'J': case 'F': case 'D': av.visit(name,readConst(readUnsignedShort(v),buf)); v+=2; break; case 'B': av.visit(name,new Byte((byte)readInt(items[readUnsignedShort(v)]))); v+=2; break; case 'Z': av.visit(name,readInt(items[readUnsignedShort(v)]) == 0 ? Boolean.FALSE : Boolean.TRUE); v+=2; break; case 'S': av.visit(name,new Short((short)readInt(items[readUnsignedShort(v)]))); v+=2; break; case 'C': av.visit(name,new Character((char)readInt(items[readUnsignedShort(v)]))); v+=2; break; case 's': av.visit(name,readUTF8(v,buf)); v+=2; break; case 'e': av.visitEnum(name,readUTF8(v,buf),readUTF8(v + 2,buf)); v+=4; break; case 'c': av.visit(name,Type.getType(readUTF8(v,buf))); v+=2; break; case '@': v=readAnnotationValues(v + 2,buf,true,av.visitAnnotation(name,readUTF8(v,buf))); break; case '[': int size=readUnsignedShort(v); v+=2; if (size == 0) { return readAnnotationValues(v - 2,buf,false,av.visitArray(name)); } switch (this.b[v++] & 0xFF) { case 'B': byte[] bv=new byte[size]; for (i=0; i < size; i++) { bv[i]=(byte)readInt(items[readUnsignedShort(v)]); v+=3; } av.visit(name,bv); --v; break; case 'Z': boolean[] zv=new boolean[size]; for (i=0; i < size; i++) { zv[i]=readInt(items[readUnsignedShort(v)]) != 0; v+=3; } av.visit(name,zv); --v; break; case 'S': short[] sv=new short[size]; for (i=0; i < size; i++) { sv[i]=(short)readInt(items[readUnsignedShort(v)]); v+=3; } av.visit(name,sv); --v; break; case 'C': char[] cv=new char[size]; for (i=0; i < size; i++) { cv[i]=(char)readInt(items[readUnsignedShort(v)]); v+=3; } av.visit(name,cv); --v; break; case 'I': int[] iv=new int[size]; for (i=0; i < size; i++) { iv[i]=readInt(items[readUnsignedShort(v)]); v+=3; } av.visit(name,iv); --v; break; case 'J': long[] lv=new long[size]; for (i=0; i < size; i++) { lv[i]=readLong(items[readUnsignedShort(v)]); v+=3; } av.visit(name,lv); --v; break; case 'F': float[] fv=new float[size]; for (i=0; i < size; i++) { fv[i]=Float.intBitsToFloat(readInt(items[readUnsignedShort(v)])); v+=3; } av.visit(name,fv); --v; break; case 'D': double[] dv=new double[size]; for (i=0; i < size; i++) { dv[i]=Double.longBitsToDouble(readLong(items[readUnsignedShort(v)])); v+=3; } av.visit(name,dv); --v; break; default : v=readAnnotationValues(v - 3,buf,false,av.visitArray(name)); } } return v; }
Reads a value of an annotation and makes the given visitor visit it.
public boolean isProcessed(){ Object oo=get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Processed.
public SubscriptionAlreadyExistsException(String message,ApplicationExceptionBean bean){ super(message,bean); }
Constructs a new exception with the specified detail message and bean for JAX-WS exception serialization.
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public BandPassBuilder stopFrequency2(int stopFrequency){ mStopFrequency2=stopFrequency; return this; }
Specifies the beginning frequency of the second stop band
public NotificationChain basicSetArgs(ExpressionList newArgs,NotificationChain msgs){ ExpressionList oldArgs=args; args=newArgs; if (eNotificationRequired()) { ENotificationImpl notification=new ENotificationImpl(this,Notification.SET,GamlPackage.ACCESS__ARGS,oldArgs,newArgs); if (msgs == null) msgs=notification; else msgs.add(notification); } return msgs; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public ObjectNotFoundException(List<LocalizedText> messages){ super(messages); }
Constructs a new exception with the specified localized text messages. The cause is not initialized.
public ReadOnlyFileSystemException(){ }
Constructs an instance of this class.
public void writeToNBT(final NBTTagCompound nbt){ final NBTTagList modulesNbt=new NBTTagList(); for ( final Module module : modules) { final NBTTagCompound moduleNbt=new NBTTagCompound(); if (module != null) { module.writeToNBT(moduleNbt); } modulesNbt.appendTag(moduleNbt); } nbt.setTag(TAG_MODULES,modulesNbt); lock.ifPresent(null); lock.ifPresent(null); }
Write the state of all modules and pipes to the specified NBT tag.
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public static float function2(float x){ return x * x * x* x* x - 2 * x * x* x + x; }
Fifth-order polynomial.
public static Number add(Number a,Number b){ if (isFloatingPoint(a) || isFloatingPoint(b)) { return a.doubleValue() + b.doubleValue(); } else { return a.longValue() + b.longValue(); } }
Returns the value of adding the two numbers
public void testUnivariateTEforCoupledVariablesFromFile() throws Exception { ArrayFileReader afr=new ArrayFileReader("demos/data/2coupledRandomCols-1.txt"); double[][] data=afr.getDouble2DMatrix(); double[] col0=MatrixUtils.selectColumn(data,0); double[] col1=MatrixUtils.selectColumn(data,1); col0=MatrixUtils.normaliseIntoNewArray(col0); col1=MatrixUtils.normaliseIntoNewArray(col1); int kNNs=4; double expectedFromTRENTOOL0to1=0.3058006; double expectedFromTRENTOOL1to0=-0.0029744; System.out.println("Kraskov TE comparison 1 to TRENTOOL - univariate coupled data 1"); TransferEntropyCalculatorKraskov teCalc=new TransferEntropyCalculatorKraskov(); teCalc.setProperty(ConditionalMutualInfoCalculatorMultiVariateKraskov.PROP_K,Integer.toString(kNNs)); teCalc.setProperty(ConditionalMutualInfoCalculatorMultiVariateKraskov.PROP_NORMALISE,"false"); teCalc.setProperty(ConditionalMutualInfoCalculatorMultiVariateKraskov.PROP_ADD_NOISE,"0"); teCalc.initialise(1); teCalc.setObservations(col0,col1); double result=teCalc.computeAverageLocalOfObservations(); System.out.printf("From 2coupledRandomCols 0->1 expecting %.6f, got %.6f\n",expectedFromTRENTOOL0to1,result); assertEquals(expectedFromTRENTOOL0to1,result,0.000001); teCalc.initialise(1); teCalc.setObservations(col1,col0); result=teCalc.computeAverageLocalOfObservations(); assertEquals(expectedFromTRENTOOL1to0,result,0.000001); System.out.printf("From 2coupledRandomCols 1->0 expecting %.6f, got %.6f\n",expectedFromTRENTOOL1to0,result); assertEquals(99,teCalc.getNumObservations()); }
Test the computed univariate TE against that calculated by Wibral et al.'s TRENTOOL on the same data. To run TRENTOOL (http://www.trentool.de/) for this data, run its TEvalues.m matlab script on the multivariate source and dest data sets as: TEvalues(source, dest, 1, 1, 1, kraskovK, 0) with these values ensuring source-dest lag 1, history k=1, embedding lag 1, no dynamic correlation exclusion
public String app_source_path(String app_class){ String filename=app_class.replace(".","/"); filename=filename.replaceFirst("[$][0-9]+",""); if (filename.indexOf("$") > 0) { filename=filename.substring(0,filename.indexOf("$")); } return "../jsrc/" + filename + ".java.html"; }
Returns the relative path from the android directory to the source html created by java2html
public Pair<BigDecimal,BigDecimal> findQuantity(final Collection<Warehouse> warehouses,final String productSkuCode){ final List<Object> warehouseIdList=new ArrayList<Object>(warehouses.size()); for ( Warehouse wh : warehouses) { warehouseIdList.add(wh.getWarehouseId()); } final List rez=getGenericDao().findQueryObjectsByNamedQuery("SKU.QTY.ON.WAREHOUSES.IN.WAREHOUSEID.BY.SKUCODE",productSkuCode,warehouseIdList); BigDecimal quantity=BigDecimal.ZERO.setScale(Constants.DEFAULT_SCALE); BigDecimal reserved=BigDecimal.ZERO.setScale(Constants.DEFAULT_SCALE); if (!rez.isEmpty()) { final Object obj[]=(Object[])rez.get(0); if (obj.length > 0 && obj[0] != null) { quantity=((BigDecimal)obj[0]).setScale(Constants.DEFAULT_SCALE); } if (obj.length > 1 && obj[1] != null) { reserved=((BigDecimal)obj[1]).setScale(Constants.DEFAULT_SCALE); } } return new Pair<BigDecimal,BigDecimal>(quantity,reserved); }
Get the sku's Quantity - Reserved quantity pair.
private void checkMatrix(){ for ( Node variable : variables) { if (variable == null) { throw new NullPointerException(); } } if (sampleSize < 1) { throw new IllegalArgumentException("Sample size must be at least 1."); } for (int i=0; i < matrix.rows(); i++) { for (int j=0; j < matrix.columns(); j++) { if (Double.isNaN(matrix.get(i,j))) { throw new IllegalArgumentException("Please remove or impute missing values."); } } } }
Checks the sample size, variable, and matrix information.
public DummyDataSource(){ }
Create new instance.
private int hash(String name){ assert name.intern() == name; return name.hashCode() & (hashTableMask); }
The hash function must be based on the name only, so that searches for {name,type} entries can be found in the same bucket.
@Override public boolean isConsciousProcessingRequired(){ return true; }
Wait until conscious is done to avoid database contention/deadlocks.
public boolean useForType(JavaType t){ switch (_appliesFor) { case NON_CONCRETE_AND_ARRAYS: while (t.isArrayType()) { t=t.getContentType(); } case OBJECT_AND_NON_CONCRETE: return (t.getRawClass() == Object.class) || !t.isConcrete(); case NON_FINAL: while (t.isArrayType()) { t=t.getContentType(); } return !t.isFinal(); default : return (t.getRawClass() == Object.class); } }
Method called to check if the default type handler should be used for given type. Note: "natural types" (String, Boolean, Integer, Double) will never use typing; that is both due to them being concrete and final, and since actual serializers and deserializers will also ignore any attempts to enforce typing.
public void testFailure(Failure failure) throws Exception { String printedOutput=this.endCapture(); String printedOutputNoTrailingWS=printedOutput.replaceFirst("\\s+$",""); System.out.println("Running " + mostRecentTestName + ": "); System.out.println("===================================="); if (printedOutputNoTrailingWS.length() > 0) { System.out.println(printedOutputNoTrailingWS); } System.out.println(JUnitUtilities.failureToString(failure)); mostRecentTestPassed=false; }
Sets score to 0 and appends reason for failure and dumps a stack trace. TODO: Clean up this stack trace so it is not hideous. Other possible things we might want to consider including: http://junit.sourceforge.net/javadoc/org/junit/runner/notification/Failure.html.
public ChunkedInputStream(InputStream in,HttpClient hc,MessageHeader responses) throws IOException { this.in=in; this.responses=responses; this.hc=hc; state=STATE_AWAITING_CHUNK_HEADER; }
Creates a <code>ChunkedInputStream</code> and saves its arguments, for later use.
@Override public void run(){ amIActive=true; String inputFilesString=null; String arcFile=null; String whiteboxHeaderFile=null; int i=0; int row, col, rows, cols; String[] imageFiles; int numImages=0; int progress=0; double xllcenter=0; double yllcenter=0; double xllcorner=0; double yllcorner=0; double cellsize=0; double north=0; double east=0; double west=0; double south=0; double arcNoData=-9999; double whiteboxNoData=-32768d; double z=0; String delimiter=" "; String str1=null; FileWriter fw=null; BufferedWriter bw=null; PrintWriter out=null; DataInputStream in=null; BufferedReader br=null; try { if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } inputFilesString=args[0]; if ((inputFilesString == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } imageFiles=inputFilesString.split(";"); numImages=imageFiles.length; for (i=0; i < numImages; i++) { progress=(int)(100f * i / (numImages - 1)); updateProgress("Loop " + (i + 1) + " of "+ numImages+ ":",progress); arcFile=imageFiles[i]; if (!((new File(arcFile)).exists())) { showFeedback("ArcGIS raster file does not exist."); return; } if (arcFile.lastIndexOf(".") >= 0) { String extension=arcFile.substring(arcFile.lastIndexOf(".")); whiteboxHeaderFile=arcFile.replace(extension,".dep"); } else { whiteboxHeaderFile=arcFile + ".dep"; } (new File(whiteboxHeaderFile)).delete(); (new File(whiteboxHeaderFile.replace(".dep",".tas"))).delete(); FileInputStream fstream=new FileInputStream(arcFile); rows=0; cols=0; in=new DataInputStream(fstream); br=new BufferedReader(new InputStreamReader(in)); if (arcFile != null) { String line; String[] str; while ((line=br.readLine()) != null) { str=line.split(delimiter); if (str.length <= 1) { delimiter="\t"; str=line.split(delimiter); if (str.length <= 1) { delimiter=" "; str=line.split(delimiter); if (str.length <= 1) { delimiter=","; str=line.split(delimiter); } } } if (str[0].toLowerCase().contains("ncols")) { cols=Integer.parseInt(str[str.length - 1]); } else if (str[0].toLowerCase().contains("nrows")) { rows=Integer.parseInt(str[str.length - 1]); } else if (str[0].toLowerCase().contains("xllcenter")) { xllcenter=Double.parseDouble(str[str.length - 1]); } else if (str[0].toLowerCase().contains("yllcenter")) { yllcenter=Double.parseDouble(str[str.length - 1]); } else if (str[0].toLowerCase().contains("xllcorner")) { xllcorner=Double.parseDouble(str[str.length - 1]); } else if (str[0].toLowerCase().contains("yllcorner")) { yllcorner=Double.parseDouble(str[str.length - 1]); } else if (str[0].toLowerCase().contains("cellsize")) { cellsize=Double.parseDouble(str[str.length - 1]); if (xllcorner != 0) { east=xllcorner + cols * cellsize; west=xllcorner; south=yllcorner; north=yllcorner + rows * cellsize; } else { east=xllcenter - (0.5 * cellsize) + cols * cellsize; west=xllcenter - (0.5 * cellsize); south=yllcenter - (0.5 * cellsize); north=yllcenter - (0.5 * cellsize) + rows * cellsize; } } else if (str[0].toLowerCase().contains("nodata")) { arcNoData=Double.parseDouble(str[str.length - 1]); } else { break; } } fw=new FileWriter(whiteboxHeaderFile,false); bw=new BufferedWriter(fw); out=new PrintWriter(bw,true); str1="Min:\t" + Double.toString(Integer.MAX_VALUE); out.println(str1); str1="Max:\t" + Double.toString(Integer.MIN_VALUE); out.println(str1); str1="North:\t" + Double.toString(north); out.println(str1); str1="South:\t" + Double.toString(south); out.println(str1); str1="East:\t" + Double.toString(east); out.println(str1); str1="West:\t" + Double.toString(west); out.println(str1); str1="Cols:\t" + Integer.toString(cols); out.println(str1); str1="Rows:\t" + Integer.toString(rows); out.println(str1); str1="Data Type:\t" + "float"; out.println(str1); str1="Z Units:\t" + "not specified"; out.println(str1); str1="XY Units:\t" + "not specified"; out.println(str1); str1="Projection:\t" + "not specified"; out.println(str1); str1="Data Scale:\tcontinuous"; out.println(str1); str1="Preferred Palette:\t" + "spectrum.pal"; out.println(str1); str1="NoData:\t-32768"; out.println(str1); if (java.nio.ByteOrder.nativeOrder() == java.nio.ByteOrder.LITTLE_ENDIAN) { str1="Byte Order:\t" + "LITTLE_ENDIAN"; } else { str1="Byte Order:\t" + "BIG_ENDIAN"; } out.println(str1); WhiteboxRaster wbr=new WhiteboxRaster(whiteboxHeaderFile,"rw"); delimiter=" "; row=0; col=0; while ((line=br.readLine()) != null) { str=line.split(delimiter); if (str.length <= 1) { delimiter="\t"; str=line.split(delimiter); if (str.length <= 1) { delimiter=" "; str=line.split(delimiter); if (str.length <= 1) { delimiter=","; str=line.split(delimiter); } } } if (str[0].toLowerCase().contains("ncols")) { } else if (str[0].toLowerCase().contains("nrows")) { } else if (str[0].toLowerCase().contains("xllcenter")) { } else if (str[0].toLowerCase().contains("yllcenter")) { } else if (str[0].toLowerCase().contains("xllcorner")) { } else if (str[0].toLowerCase().contains("yllcorner")) { } else if (str[0].toLowerCase().contains("cellsize")) { } else if (str[0].toLowerCase().contains("nodata")) { } else { for (i=0; i < str.length; i++) { z=Double.parseDouble(str[i]); if (z != arcNoData) { wbr.setValue(row,col,z); } else { wbr.setValue(row,col,whiteboxNoData); } col++; if (col == cols) { col=0; row++; } } } } in.close(); br.close(); wbr.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); wbr.addMetadataEntry("Created on " + new Date()); wbr.close(); returnData(whiteboxHeaderFile); } } } catch ( OutOfMemoryError oe) { myHost.showFeedback("An out-of-memory error has occurred during operation."); } catch ( Exception e) { myHost.showFeedback("An error has occurred during operation. See log file for details."); myHost.logException("Error in " + getDescriptiveName(),e); } finally { if (out != null || bw != null) { out.flush(); out.close(); } updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
public IntArray(int capacity){ data=new int[capacity]; }
Create an int array with specified initial capacity.
@Override public void installBorderSettings(){ UIManager.put("DockView.singleDockableBorder",null); UIManager.put("DockView.tabbedDockableBorder",null); UIManager.put("DockView.maximizedDockableBorder",null); }
installs the borders
private String match(MBankStatementLine bsl){ if (m_matchers == null || bsl == null || bsl.getC_Payment_ID() != 0) return "--"; log.fine("match - " + bsl); BankStatementMatchInfo info=null; for (int i=0; i < m_matchers.length; i++) { if (m_matchers[i].isMatcherValid()) { info=m_matchers[i].getMatcher().findMatch(bsl); if (info != null && info.isMatched()) { if (info.getC_Payment_ID() > 0) bsl.setC_Payment_ID(info.getC_Payment_ID()); if (info.getC_Invoice_ID() > 0) bsl.setC_Invoice_ID(info.getC_Invoice_ID()); if (info.getC_BPartner_ID() > 0) bsl.setC_BPartner_ID(info.getC_BPartner_ID()); bsl.saveEx(); return "OK"; } } } return "--"; }
Perform Match
public Value convert(Value v){ try { return v.convertTo(type); } catch ( DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target=(table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1,v.getSQL() + " (" + target+ ")"); } throw e; } }
Convert a value to this column's type.
private void fillBuf() throws IOException { int result=in.read(buf,0,buf.length); if (result == -1) { throw new EOFException(); } pos=0; end=result; }
Reads new input data into the buffer. Call only with pos == end or end == -1, depending on the desired outcome if the function throws.
public static void main(String[] args) throws Exception { if (args.length != 4) { System.out.println(); System.out.println("Usage: " + SerialUIDChanger.class.getName() + " <oldUID> <newUID> <oldFilename> <newFilename>"); System.out.println(" <oldFilename> and <newFilename> have to be different"); System.out.println(); } else { if (args[2].equals(args[3])) throw new Exception("Filenames have to be different!"); changeUID(Long.parseLong(args[0]),Long.parseLong(args[1]),args[2],args[3]); } }
exchanges an old UID for a new one. a file that doesn't end with ".koml" is considered being binary. takes four arguments: oldUID newUID oldFilename newFilename
public void sendEmptyDataChunk() throws NetworkException { msrpMgr.sendEmptyChunk(); }
Send an empty data chunk
public boolean commitCorrection(CorrectionInfo correctionInfo){ return false; }
Default implementation does nothing and returns false.
public void testSimpleWatchActionMulti() throws Exception { WatchManager<String> em=new WatchManager<String>(); StringWatchAction action=new StringWatchAction(3); Watch<String> w=em.watch(new StringWatchPredicate("hello"),3,action); for (int i=0; i < 3; i++) { assertNull("Action not taken before match: " + i,action.getString(i)); em.process("hello",i); assertEquals("Should have string after match: " + i,"hello",action.getString(i)); } assertTrue("Should be done",w.isDone()); }
Prove that an action associated with a watch is executed on the task ID for which the watch has just matched.
public boolean hasInitialResponse(){ return true; }
This mechanism has an initial response.
protected boolean matches(Node object){ if (object instanceof Element) { Element element=(Element)object; return name.equals(element.getName()); } return false; }
DOCUMENT ME!
public boolean showJavaScriptSites(){ return mContentSettingsType == ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT; }
Returns whether this category is the JavaScript category.
public boolean isSortingCategories(){ return sortingCategories; }
Get whether this model is currently sorting categories.
public PacProxyException(){ super(); }
Creates a new PacProxyException.
public void allZero(){ this.coeff_domlength=0; this.coeff_date=0; this.coeff_wordsintitle=0; this.coeff_wordsintext=0; this.coeff_phrasesintext=0; this.coeff_llocal=0; this.coeff_lother=0; this.coeff_urllength=0; this.coeff_urlcomps=0; this.coeff_hitcount=0; this.coeff_posintext=0; this.coeff_posofphrase=0; this.coeff_posinphrase=0; this.coeff_authority=0; this.coeff_worddistance=0; this.coeff_appurl=0; this.coeff_app_dc_title=0; this.coeff_app_dc_creator=0; this.coeff_app_dc_subject=0; this.coeff_app_dc_description=0; this.coeff_appemph=0; this.coeff_catindexof=0; this.coeff_cathasimage=0; this.coeff_cathasaudio=0; this.coeff_cathasvideo=0; this.coeff_cathasapp=0; this.coeff_termfrequency=0; this.coeff_urlcompintoplist=0; this.coeff_descrcompintoplist=0; this.coeff_prefer=0; this.coeff_language=0; this.coeff_citation=0; }
set all ranking attributes to zero This is usually used when a specific value is set to maximum
public final boolean isTopLevel(){ return outerClass == null || isStatic() || isInterface(); }
Tell if the class is "top-level", which is either a package member, or a static member of another top-level class.
@Override protected EClass eStaticClass(){ return N4JSPackage.Literals.SCRIPT_ELEMENT; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public Type1Font(String baseName,PDFObject src,PDFFontDescriptor descriptor) throws IOException { super(baseName,src,descriptor); if (descriptor != null && descriptor.getFontFile() != null) { int start=descriptor.getFontFile().getDictRef("Length1").getIntValue(); int len=descriptor.getFontFile().getDictRef("Length2").getIntValue(); byte font[]=descriptor.getFontFile().getStream(); parseFont(font,start,len); } }
create a new Type1Font based on a font data stream and an encoding.
public static double sortingAUC(ArrayList<Tuple2D> data){ double P=sumTruth(data); double N=data.size() - P; double n=data.size(); double lastpred=data.get(0).pred - 1.; double lastx=0, lasty=0; double x, y; double tp=0, fp=0; double auc=0; for ( Tuple2D tuple : data) { if (tuple.pred != lastpred) { x=fp / N; y=tp / P; auc=auc + 0.5 * (lasty + y) * (x - lastx); lastx=x; lasty=y; lastpred=tuple.pred; } if (tuple.truth > 0) tp++; else fp++; } return auc; }
requires input to be sorted by class1, though it doesn't check
public LinearLocation toLowest(Geometry linearGeom){ LineString lineComp=(LineString)linearGeom.getGeometryN(componentIndex); int nseg=lineComp.getNumPoints() - 1; if (segmentIndex < nseg) return this; return new LinearLocation(componentIndex,nseg,1.0,false); }
Converts a linear location to the lowest equivalent location index. The lowest index has the lowest possible component and segment indices. <p> Specifically: <ul> <li>if the location point is an endpoint, a location value is returned as (nseg-1, 1.0) <li>if the location point is ambiguous (i.e. an endpoint and a startpoint), the lowest endpoint location is returned </ul> If the location index is already the lowest possible value, the original location is returned.
public void extractAudioWaveform(ExtractAudioWaveformProgressListener listener) throws IOException { int frameDuration=0; int sampleCount=0; final String projectPath=mMANativeHelper.getProjectPath(); if (mAudioWaveformFilename == null) { String mAudioWaveFileName=null; mAudioWaveFileName=String.format(projectPath + "/" + "audioWaveformFile-"+ getId()+ ".dat"); if (mMANativeHelper.getAudioCodecType(mAudioType) == MediaProperties.ACODEC_AMRNB) { frameDuration=(MediaProperties.SAMPLES_PER_FRAME_AMRNB * 1000) / MediaProperties.DEFAULT_SAMPLING_FREQUENCY; sampleCount=MediaProperties.SAMPLES_PER_FRAME_AMRNB; } else if (mMANativeHelper.getAudioCodecType(mAudioType) == MediaProperties.ACODEC_AMRWB) { frameDuration=(MediaProperties.SAMPLES_PER_FRAME_AMRWB * 1000) / MediaProperties.DEFAULT_SAMPLING_FREQUENCY; sampleCount=MediaProperties.SAMPLES_PER_FRAME_AMRWB; } else if (mMANativeHelper.getAudioCodecType(mAudioType) == MediaProperties.ACODEC_AAC_LC) { frameDuration=(MediaProperties.SAMPLES_PER_FRAME_AAC * 1000) / MediaProperties.DEFAULT_SAMPLING_FREQUENCY; sampleCount=MediaProperties.SAMPLES_PER_FRAME_AAC; } mMANativeHelper.generateAudioGraph(getId(),mFilename,mAudioWaveFileName,frameDuration,MediaProperties.DEFAULT_CHANNEL_COUNT,sampleCount,listener,true); mAudioWaveformFilename=mAudioWaveFileName; } mWaveformData=new SoftReference<WaveformData>(new WaveformData(mAudioWaveformFilename)); }
This API allows to generate a file containing the sample volume levels of the Audio track of this media item. This function may take significant time and is blocking. The file can be retrieved using getAudioWaveformFilename().
public void actionPerformed(ActionEvent e){ log.fine("VPayment.actionPerformed - " + e.getActionCommand()); if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { if (checkMandatory()) { saveChanges(); dispose(); } } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) dispose(); else if (e.getSource() == paymentCombo) { ValueNamePair pp=(ValueNamePair)paymentCombo.getSelectedItem(); if (pp != null) { String s=pp.getValue().toLowerCase(); if (X_C_Order.PAYMENTRULE_DirectDebit.equalsIgnoreCase(s)) s=X_C_Order.PAYMENTRULE_DirectDeposit.toLowerCase(); s+="Panel"; centerLayout.show(centerPanel,s); int C_Invoice_ID=Env.getContextAsInt(Env.getCtx(),m_WindowNo,"C_Invoice_ID"); MInvoice invoice_tmp=new MInvoice(Env.getCtx(),C_Invoice_ID,null); if (!invoice_tmp.isSOTrx()) { bAmountField.setValue(m_Amount.negate()); } else { bAmountField.setValue(m_Amount); } invoice_tmp=null; } } else if (e.getSource() == sCurrencyCombo) { KeyNamePair pp=(KeyNamePair)sCurrencyCombo.getSelectedItem(); BigDecimal amt=MConversionRate.convert(Env.getCtx(),m_Amount,m_C_Currency_ID,pp.getKey(),m_AD_Client_ID,m_AD_Org_ID); sAmountField.setValue(amt); } else if (e.getSource() == bCurrencyCombo) { KeyNamePair pp=(KeyNamePair)bCurrencyCombo.getSelectedItem(); BigDecimal amt=MConversionRate.convert(Env.getCtx(),m_Amount,m_C_Currency_ID,pp.getKey(),m_AD_Client_ID,m_AD_Org_ID); bAmountField.setValue(amt); } else if (e.getSource() == kOnline || e.getSource() == sOnline) processOnline(); }
Action Listener
protected int read(byte[] buffer) throws IOException { return mTiffStream.read(buffer); }
Equivalent to read(buffer, 0, buffer.length).
public URL find(String classname){ if (this.classname.equals(classname)) { String cname=classname.replace('.','/') + ".class"; try { return new URL("file:/ByteArrayClassPath/" + cname); } catch ( MalformedURLException e) { } } return null; }
Obtains the URL.
@Override public Object clone() throws CloneNotSupportedException { return super.clone(); }
Returns a clone of the entity.
public void selectInList(String listName,int offset){ TestUtils.selectInList(listName,offset); }
This method just invokes the test utils method, it is here for convenience
public MarketService updateUrl(String url){ this.updateUrl=url; return this; }
Set the destination url of the default update button.
public void invert(final int ulx,final int uly,final int lrx,final int lry){ filter(ulx,uly,lrx,lry,FilterMode.FILTER_INVERT,-1); }
invert filter for a square part of the image
public void addModel(ModelInstance instance){ instances.add(instance); }
Render only
boolean isHandshakeComplete(){ return handshakeComplete; }
Check if handshake is completed.
public StackBlurFilter(){ this(3,3); }
<p>Creates a new blur filter with a default radius of 3 and 3 iterations.</p>
public static CC parseComponentConstraint(String s){ CC cc=new CC(); if (s.length() == 0) return cc; String[] parts=toTrimmedTokens(s,','); for ( String part : parts) { try { if (part.length() == 0) continue; int ix=-1; char c=part.charAt(0); if (c == 'n') { if (part.equals("north")) { cc.setDockSide(0); continue; } if (part.equals("newline")) { cc.setNewline(true); continue; } if (part.startsWith("newline ")) { String gapSz=part.substring(7).trim(); cc.setNewlineGapSize(parseBoundSize(gapSz,true,true)); continue; } } if (c == 'f' && (part.equals("flowy") || part.equals("flowx"))) { cc.setFlowX(part.charAt(4) == 'x' ? Boolean.TRUE : Boolean.FALSE); continue; } if (c == 's') { ix=startsWithLenient(part,"skip",4,true); if (ix > -1) { String num=part.substring(ix).trim(); cc.setSkip(num.length() != 0 ? Integer.parseInt(num) : 1); continue; } ix=startsWithLenient(part,"split",5,true); if (ix > -1) { String split=part.substring(ix).trim(); cc.setSplit(split.length() > 0 ? Integer.parseInt(split) : LayoutUtil.INF); continue; } if (part.equals("south")) { cc.setDockSide(2); continue; } ix=startsWithLenient(part,new String[]{"spany","sy"},new int[]{5,2},true); if (ix > -1) { cc.setSpanY(parseSpan(part.substring(ix).trim())); continue; } ix=startsWithLenient(part,new String[]{"spanx","sx"},new int[]{5,2},true); if (ix > -1) { cc.setSpanX(parseSpan(part.substring(ix).trim())); continue; } ix=startsWithLenient(part,"span",4,true); if (ix > -1) { String[] spans=toTrimmedTokens(part.substring(ix).trim(),' '); cc.setSpanX(spans[0].length() > 0 ? Integer.parseInt(spans[0]) : LayoutUtil.INF); cc.setSpanY(spans.length > 1 ? Integer.parseInt(spans[1]) : 1); continue; } ix=startsWithLenient(part,"shrinkx",7,true); if (ix > -1) { cc.getHorizontal().setShrink(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,"shrinky",7,true); if (ix > -1) { cc.getVertical().setShrink(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,"shrink",6,false); if (ix > -1) { String[] shrinks=toTrimmedTokens(part.substring(ix).trim(),' '); cc.getHorizontal().setShrink(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); if (shrinks.length > 1) cc.getVertical().setShrink(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,new String[]{"shrinkprio","shp"},new int[]{10,3},true); if (ix > -1) { String sp=part.substring(ix).trim(); if (sp.startsWith("x") || sp.startsWith("y")) { (sp.startsWith("x") ? cc.getHorizontal() : cc.getVertical()).setShrinkPriority(Integer.parseInt(sp.substring(2))); } else { String[] shrinks=toTrimmedTokens(sp,' '); cc.getHorizontal().setShrinkPriority(Integer.parseInt(shrinks[0])); if (shrinks.length > 1) cc.getVertical().setShrinkPriority(Integer.parseInt(shrinks[1])); } continue; } ix=startsWithLenient(part,new String[]{"sizegroupx","sizegroupy","sgx","sgy"},new int[]{9,9,2,2},true); if (ix > -1) { String sg=part.substring(ix).trim(); char lc=part.charAt(ix - 1); if (lc != 'y') cc.getHorizontal().setSizeGroup(sg); if (lc != 'x') cc.getVertical().setSizeGroup(sg); continue; } } if (c == 'g') { ix=startsWithLenient(part,"growx",5,true); if (ix > -1) { cc.getHorizontal().setGrow(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,"growy",5,true); if (ix > -1) { cc.getVertical().setGrow(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,"grow",4,false); if (ix > -1) { String[] grows=toTrimmedTokens(part.substring(ix).trim(),' '); cc.getHorizontal().setGrow(parseFloat(grows[0],ResizeConstraint.WEIGHT_100)); cc.getVertical().setGrow(parseFloat(grows.length > 1 ? grows[1] : "",ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,new String[]{"growprio","gp"},new int[]{8,2},true); if (ix > -1) { String gp=part.substring(ix).trim(); char c0=gp.length() > 0 ? gp.charAt(0) : ' '; if (c0 == 'x' || c0 == 'y') { (c0 == 'x' ? cc.getHorizontal() : cc.getVertical()).setGrowPriority(Integer.parseInt(gp.substring(2))); } else { String[] grows=toTrimmedTokens(gp,' '); cc.getHorizontal().setGrowPriority(Integer.parseInt(grows[0])); if (grows.length > 1) cc.getVertical().setGrowPriority(Integer.parseInt(grows[1])); } continue; } if (part.startsWith("gap")) { BoundSize[] gaps=parseGaps(part); if (gaps[0] != null) cc.getVertical().setGapBefore(gaps[0]); if (gaps[1] != null) cc.getHorizontal().setGapBefore(gaps[1]); if (gaps[2] != null) cc.getVertical().setGapAfter(gaps[2]); if (gaps[3] != null) cc.getHorizontal().setGapAfter(gaps[3]); continue; } } if (c == 'a') { ix=startsWithLenient(part,new String[]{"aligny","ay"},new int[]{6,2},true); if (ix > -1) { cc.getVertical().setAlign(parseUnitValueOrAlign(part.substring(ix).trim(),false,null)); continue; } ix=startsWithLenient(part,new String[]{"alignx","ax"},new int[]{6,2},true); if (ix > -1) { cc.getHorizontal().setAlign(parseUnitValueOrAlign(part.substring(ix).trim(),true,null)); continue; } ix=startsWithLenient(part,"align",2,true); if (ix > -1) { String[] gaps=toTrimmedTokens(part.substring(ix).trim(),' '); cc.getHorizontal().setAlign(parseUnitValueOrAlign(gaps[0],true,null)); if (gaps.length > 1) cc.getVertical().setAlign(parseUnitValueOrAlign(gaps[1],false,null)); continue; } } if ((c == 'x' || c == 'y') && part.length() > 2) { char c2=part.charAt(1); if (c2 == ' ' || (c2 == '2' && part.charAt(2) == ' ')) { if (cc.getPos() == null) { cc.setPos(new UnitValue[4]); } else if (cc.isBoundsInGrid() == false) { throw new IllegalArgumentException("Cannot combine 'position' with 'x/y/x2/y2' keywords."); } int edge=(c == 'x' ? 0 : 1) + (c2 == '2' ? 2 : 0); UnitValue[] pos=cc.getPos(); pos[edge]=parseUnitValue(part.substring(2).trim(),null,c == 'x'); cc.setPos(pos); cc.setBoundsInGrid(true); continue; } } if (c == 'c') { ix=startsWithLenient(part,"cell",4,true); if (ix > -1) { String[] grs=toTrimmedTokens(part.substring(ix).trim(),' '); if (grs.length < 2) throw new IllegalArgumentException("At least two integers must follow " + part); cc.setCellX(Integer.parseInt(grs[0])); cc.setCellY(Integer.parseInt(grs[1])); if (grs.length > 2) cc.setSpanX(Integer.parseInt(grs[2])); if (grs.length > 3) cc.setSpanY(Integer.parseInt(grs[3])); continue; } } if (c == 'p') { ix=startsWithLenient(part,"pos",3,true); if (ix > -1) { if (cc.getPos() != null && cc.isBoundsInGrid()) throw new IllegalArgumentException("Can not combine 'pos' with 'x/y/x2/y2' keywords."); String[] pos=toTrimmedTokens(part.substring(ix).trim(),' '); UnitValue[] bounds=new UnitValue[4]; for (int j=0; j < pos.length; j++) bounds[j]=parseUnitValue(pos[j],null,j % 2 == 0); if (bounds[0] == null && bounds[2] == null || bounds[1] == null && bounds[3] == null) throw new IllegalArgumentException("Both x and x2 or y and y2 can not be null!"); cc.setPos(bounds); cc.setBoundsInGrid(false); continue; } ix=startsWithLenient(part,"pad",3,true); if (ix > -1) { UnitValue[] p=parseInsets(part.substring(ix).trim(),false); cc.setPadding(new UnitValue[]{p[0],p.length > 1 ? p[1] : null,p.length > 2 ? p[2] : null,p.length > 3 ? p[3] : null}); continue; } ix=startsWithLenient(part,"pushx",5,true); if (ix > -1) { cc.setPushX(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,"pushy",5,true); if (ix > -1) { cc.setPushY(parseFloat(part.substring(ix).trim(),ResizeConstraint.WEIGHT_100)); continue; } ix=startsWithLenient(part,"push",4,false); if (ix > -1) { String[] pushs=toTrimmedTokens(part.substring(ix).trim(),' '); cc.setPushX(parseFloat(pushs[0],ResizeConstraint.WEIGHT_100)); cc.setPushY(parseFloat(pushs.length > 1 ? pushs[1] : "",ResizeConstraint.WEIGHT_100)); continue; } } if (c == 't') { ix=startsWithLenient(part,"tag",3,true); if (ix > -1) { cc.setTag(part.substring(ix).trim()); continue; } } if (c == 'w' || c == 'h') { if (part.equals("wrap")) { cc.setWrap(true); continue; } if (part.startsWith("wrap ")) { String gapSz=part.substring(5).trim(); cc.setWrapGapSize(parseBoundSize(gapSz,true,true)); continue; } boolean isHor=c == 'w'; if (isHor && (part.startsWith("w ") || part.startsWith("width "))) { String uvStr=part.substring(part.charAt(1) == ' ' ? 2 : 6).trim(); cc.getHorizontal().setSize(parseBoundSize(uvStr,false,true)); continue; } if (!isHor && (part.startsWith("h ") || part.startsWith("height "))) { String uvStr=part.substring(part.charAt(1) == ' ' ? 2 : 7).trim(); cc.getVertical().setSize(parseBoundSize(uvStr,false,false)); continue; } if (part.startsWith("wmin ") || part.startsWith("wmax ") || part.startsWith("hmin ")|| part.startsWith("hmax ")) { String uvStr=part.substring(5).trim(); if (uvStr.length() > 0) { UnitValue uv=parseUnitValue(uvStr,null,isHor); boolean isMin=part.charAt(3) == 'n'; DimConstraint dc=isHor ? cc.getHorizontal() : cc.getVertical(); dc.setSize(new BoundSize(isMin ? uv : dc.getSize().getMin(),dc.getSize().getPreferred(),isMin ? (dc.getSize().getMax()) : uv,uvStr)); continue; } } if (part.equals("west")) { cc.setDockSide(1); continue; } if (part.startsWith("hidemode ")) { cc.setHideMode(Integer.parseInt(part.substring(9))); continue; } } if (c == 'i' && part.startsWith("id ")) { cc.setId(part.substring(3).trim()); int dIx=cc.getId().indexOf('.'); if (dIx == 0 || dIx == cc.getId().length() - 1) throw new IllegalArgumentException("Dot must not be first or last!"); continue; } if (c == 'e') { if (part.equals("east")) { cc.setDockSide(3); continue; } if (part.equals("external")) { cc.setExternal(true); continue; } ix=startsWithLenient(part,new String[]{"endgroupx","endgroupy","egx","egy"},new int[]{-1,-1,-1,-1},true); if (ix > -1) { String sg=part.substring(ix).trim(); char lc=part.charAt(ix - 1); DimConstraint dc=(lc == 'x' ? cc.getHorizontal() : cc.getVertical()); dc.setEndGroup(sg); continue; } } if (c == 'd') { if (part.equals("dock north")) { cc.setDockSide(0); continue; } if (part.equals("dock west")) { cc.setDockSide(1); continue; } if (part.equals("dock south")) { cc.setDockSide(2); continue; } if (part.equals("dock east")) { cc.setDockSide(3); continue; } if (part.equals("dock center")) { cc.getHorizontal().setGrow(100f); cc.getVertical().setGrow(100f); cc.setPushX(100f); cc.setPushY(100f); continue; } } UnitValue horAlign=parseAlignKeywords(part,true); if (horAlign != null) { cc.getHorizontal().setAlign(horAlign); continue; } UnitValue verAlign=parseAlignKeywords(part,false); if (verAlign != null) { cc.getVertical().setAlign(verAlign); continue; } throw new IllegalArgumentException("Unknown keyword."); } catch ( Exception ex) { throw new IllegalArgumentException("Illegal Constraint: '" + part + "'\n"+ ex.getMessage()); } } return cc; }
Parses one component constraint and returns the parsed value.
@Override public void removeConnection(Connection connection){ super.removeConnection(connection); if (this.getConnections().isEmpty()) { this.setValue(this.getSocketHint().createInitialValue().orElse(null)); } }
Reset the socket to its default value when it's no longer connected to anything. This prevents removed connections from continuing to have an effect on steps because they still hold references to the values they were connected to.
@Override protected void after(){ ActiveMQTestBase.deleteDirectory(new File(folderName)); }
Override to tear down your specific external resource.
private int runClientSide(String args[],String serviceUrlStr) throws Exception { List<String> opts=buildCommandLine(args); opts.add("-serviceUrl"); opts.add(serviceUrlStr); int exitCode=0; String[] optsArray=opts.toArray(new String[0]); ProcessBuilder pb=new ProcessBuilder(optsArray); Process p=ProcessTools.startProcess("AuthorizationTest$ClientSide",pb); try { exitCode=p.waitFor(); if (exitCode != 0) { System.out.println("Subprocess unexpected exit value of [" + exitCode + "]. Expected 0.\n"); } } catch ( InterruptedException e) { System.out.println("Parent process interrupted with exception : \n " + e + " :"); p.destroyForcibly(); throw new RuntimeException("Parent process interrupted with exception : \n " + e + " :"); } finally { if (p.isAlive()) { p.destroyForcibly(); } return exitCode; } }
Runs AuthorizationTest$ClientSide with the passed options and redirects subprocess standard I/O to the current (parent) process. This provides a trace of what happens in the subprocess while it is runnning (and before it terminates).
public static boolean pickDirectory(Activity activity,File startPath,int requestCode){ PackageManager packageMgr=activity.getPackageManager(); for ( String[] intent : PICK_DIRECTORY_INTENTS) { String intentAction=intent[0]; String uriPrefix=intent[1]; Intent startIntent=new Intent(intentAction).putExtra("org.openintents.extra.TITLE",activity.getString(R.string.save_as)).setData(Uri.parse(uriPrefix + startPath.getPath())); try { if (startIntent.resolveActivity(packageMgr) != null) { activity.startActivityForResult(startIntent,requestCode); return true; } } catch ( ActivityNotFoundException e) { showNoFilePickerError(activity,e); } } return false; }
Tries to open a known file browsers to pick a directory.
public Object opt(String key){ return key == null ? null : this.map.get(key); }
Get an optional value associated with a key.
public void close(){ }
Close the result list and delete the temporary file.
protected SVGOMFlowRegionExcludeElement(){ }
Creates a new BatikRegularPolygonElement object.
public String query(SolrQueryRequest req) throws Exception { return query(req.getParams().get(CommonParams.QT),req); }
Processes a "query" using a user constructed SolrQueryRequest