code
stringlengths
10
174k
nl
stringlengths
3
129k
void back(){ if (index > 0) index--; }
Puts back last read character.
private void initializeLiveAttributes(){ target=createLiveAnimatedString(null,SVG_TARGET_ATTRIBUTE); }
Initializes the live attribute values of this element.
public void applyToTaskView(View v,int duration,Interpolator interp,boolean allowLayers,boolean allowShadows,ValueAnimator.AnimatorUpdateListener updateCallback){ if (duration > 0) { ViewPropertyAnimator anim=v.animate(); boolean requiresLayers=false; if (hasTranslationYChangedFrom(v.getTranslationY())) { anim.translationY(translationY); } if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) { anim.translationZ(translationZ); } if (hasScaleChangedFrom(v.getScaleX())) { anim.scaleX(scale).scaleY(scale); requiresLayers=true; } if (hasAlphaChangedFrom(v.getAlpha())) { anim.alpha(alpha); requiresLayers=true; } if (requiresLayers && allowLayers) { anim.withLayer(); } if (updateCallback != null) { anim.setUpdateListener(updateCallback); } else { anim.setUpdateListener(null); } anim.setStartDelay(startDelay).setDuration(duration).setInterpolator(interp).start(); } else { if (hasTranslationYChangedFrom(v.getTranslationY())) { v.setTranslationY(translationY); } if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) { v.setTranslationZ(translationZ); } if (hasScaleChangedFrom(v.getScaleX())) { v.setScaleX(scale); v.setScaleY(scale); } if (hasAlphaChangedFrom(v.getAlpha())) { v.setAlpha(alpha); } } }
Applies this transform to a view.
@Override public Iterator iterator(){ return new StructBagIterator(fieldValuesIterator()); }
Return an iterator over the elements in this collection. Duplicates will show up the number of times it has occurrances.
public Tradestrategy findTradestrategyByUniqueKeys(final ZonedDateTime open,final String strategy,final Integer idContract,final String portfolioName) throws PersistentModelException { return m_tradestrategyHome.findTradestrategyByUniqueKeys(open,strategy,idContract,portfolioName); }
Method findTradestrategyByUniqueKeys.
public void print(String value) throws IOException { print(value,true); }
Print the string as the next value on the line. The value will be escaped or encapsulated as needed.
public void startScroll(int startX,int startY,int dx,int dy,int duration){ mScrollerX.mMode=mScrollerY.mMode=SCROLL_MODE; mScrollerX.startScroll(startX,dx,duration); mScrollerY.startScroll(startY,dy,duration); }
Start scrolling by providing a starting point and the distance to travel.
public void testSortsElementsWithDifferentValue() throws Exception { XppDom dom1=XppFactory.buildDom("<dom>value1</dom>"); XppDom dom2=XppFactory.buildDom("<dom>value2</dom>"); assertEquals(-1,comparator.compare(dom1,dom2)); assertEquals("/dom::text()",xpath.get()); assertEquals(1,comparator.compare(dom2,dom1)); assertEquals("/dom::text()",xpath.get()); }
Tests comparison of different values.
public void initGUI(){ removeAll(); try { URL url=PropUtils.getResourceOrFileOrURL(this,forwardIconURL); forwardIcon=new ImageIcon(url); url=PropUtils.getResourceOrFileOrURL(this,forwardStepIconURL); forwardStepIcon=new ImageIcon(url); url=PropUtils.getResourceOrFileOrURL(this,backwardIconURL); backwardIcon=new ImageIcon(url); url=PropUtils.getResourceOrFileOrURL(this,backwardStepIconURL); backwardStepIcon=new ImageIcon(url); url=PropUtils.getResourceOrFileOrURL(this,pauseIconURL); pauseIcon=new ImageIcon(url); } catch ( MalformedURLException murle) { Debug.error("TimerToggleButton: initGUI() bad icon."); } catch ( NullPointerException npe) { Debug.error("TimerToggleButton: initGUI() bad icon."); npe.printStackTrace(); } JToolBar jtb=new JToolBar(); jtb.setFloatable(false); backwardButton=new JButton(backwardIcon); backwardButton.setToolTipText("Run Timer Backwards"); backwardButton.setActionCommand(TimerStatus.TIMER_BACKWARD); backwardButton.addActionListener(this); jtb.add(backwardButton); JButton button=new JButton(backwardStepIcon); button.setToolTipText("Step Timer Backward"); button.setActionCommand(TimerStatus.TIMER_STEP_BACKWARD); button.addActionListener(this); jtb.add(button); button=new JButton(forwardStepIcon); button.setToolTipText("Step Timer Forward"); button.setActionCommand(TimerStatus.TIMER_STEP_FORWARD); button.addActionListener(this); jtb.add(button); forwardButton=new JButton(forwardIcon); forwardButton.setToolTipText("Run Timer Forward"); forwardButton.setActionCommand(TimerStatus.TIMER_FORWARD); forwardButton.addActionListener(this); jtb.add(forwardButton); add(jtb); }
Set the ImageIcons to whatever is set on the URL variables. Sets the running icon to be the pressed icon, and makes the stopped and inactive icons.
private void calculateCalibration(long difference,float currentMeasure,byte currentIndex){ if (difference >= MedtronicConstants.TIME_15_MIN_IN_MS && difference < MedtronicConstants.TIME_20_MIN_IN_MS) { if (isSensorMeasureInRange(currentIndex,expectedSensorSortNumberForCalibration)) { isCalibrating=false; calibrationStatus=MedtronicConstants.CALIBRATED; calibrationIsigValue=currentMeasure; SharedPreferences.Editor editor=settings.edit(); calibrationFactor=lastGlucometerValue / calibrationIsigValue; editor.remove("expectedSensorSortNumberForCalibration0"); editor.remove("expectedSensorSortNumberForCalibration1"); editor.putFloat("calibrationFactor",(float)calibrationFactor); editor.putInt("calibrationStatus",calibrationStatus); editor.commit(); } else { if (calibrationStatus != MedtronicConstants.WITHOUT_ANY_CALIBRATION && currentIndex != expectedSensorSortNumber) { calibrationStatus=MedtronicConstants.LAST_CALIBRATION_FAILED_USING_PREVIOUS; isCalibrating=false; } else { calibrationStatus=MedtronicConstants.WITHOUT_ANY_CALIBRATION; } SharedPreferences.Editor editor=settings.edit(); editor.remove("expectedSensorSortNumberForCalibration0"); editor.remove("expectedSensorSortNumberForCalibration1"); editor.commit(); } } else if (difference >= MedtronicConstants.TIME_20_MIN_IN_MS) { if (isSensorMeasureInRange(currentIndex,expectedSensorSortNumberForCalibration)) { calibrationStatus=MedtronicConstants.CALIBRATED_IN_15MIN; calibrationIsigValue=currentMeasure; SharedPreferences.Editor editor=settings.edit(); calibrationFactor=lastGlucometerValue / calibrationIsigValue; editor.remove("expectedSensorSortNumberForCalibration0"); editor.remove("expectedSensorSortNumberForCalibration1"); editor.putFloat("calibrationFactor",(float)calibrationFactor); editor.putInt("calibrationStatus",calibrationStatus); editor.commit(); } else { if (calibrationStatus != MedtronicConstants.WITHOUT_ANY_CALIBRATION) calibrationStatus=MedtronicConstants.LAST_CALIBRATION_FAILED_USING_PREVIOUS; else { calibrationStatus=MedtronicConstants.WITHOUT_ANY_CALIBRATION; } SharedPreferences.Editor editor=settings.edit(); editor.remove("expectedSensorSortNumberForCalibration0"); editor.remove("expectedSensorSortNumberForCalibration1"); editor.commit(); } isCalibrating=false; } else { if (isCalibrating) { if (difference < MedtronicConstants.TIME_5_MIN_IN_MS) { calibrationStatus=MedtronicConstants.CALIBRATING; } else if (difference >= MedtronicConstants.TIME_5_MIN_IN_MS && difference <= MedtronicConstants.TIME_15_MIN_IN_MS) calibrationStatus=MedtronicConstants.CALIBRATING2; else calibrationStatus=MedtronicConstants.CALIBRATING; } else { if (calibrationStatus != MedtronicConstants.WITHOUT_ANY_CALIBRATION) calibrationStatus=MedtronicConstants.LAST_CALIBRATION_FAILED_USING_PREVIOUS; else { calibrationStatus=MedtronicConstants.WITHOUT_ANY_CALIBRATION; } SharedPreferences.Editor editor=settings.edit(); editor.remove("expectedSensorSortNumberForCalibration0"); editor.remove("expectedSensorSortNumberForCalibration1"); editor.putInt("calibrationStatus",calibrationStatus); editor.commit(); } } }
This method checks if a calibration is valid.
@Inline @Entrypoint public static void floatArrayWrite(float[] ref,int index,float value){ if (NEEDS_FLOAT_GC_WRITE_BARRIER) { ObjectReference array=ObjectReference.fromObject(ref); Offset offset=Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT); Selected.Mutator.get().floatWrite(array,array.toAddress().plus(offset),value,offset.toWord(),Word.zero(),ARRAY_ELEMENT); } else if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); }
Barrier for writes of floats into arrays (i.e. fastore).
public static boolean isXMLDocument(Object o){ return o instanceof Document; }
tests if object is a XML Document Object
public static synchronized void injectPools(ExecutorService globalThreadPool,ScheduledExecutorService scheduledThreadPool){ if (globalThreadPool == null || scheduledThreadPool == null) throw new IllegalArgumentException("thread pools must not be null"); clearThreadPools(); ActiveMQClient.globalThreadPool=globalThreadPool; ActiveMQClient.globalScheduledThreadPool=scheduledThreadPool; injectedPools=true; }
Warning: This method has to be called before any clients or servers is started on the JVM otherwise previous ServerLocator would be broken after this call.
protected void reportWarning(String msg,long lineNo,long columnNo){ if (errListener != null) { errListener.warning(msg,lineNo,columnNo); } }
Reports a warning with associated line- and column number to the registered ParseErrorListener, if any.
public static String loadTextFileFromAssets(Context context,String fileName) throws IOException { InputStream inputStream=context.getAssets().open(fileName); try { OutputStream outputStream=new ByteArrayOutputStream(); try { byte[] buffer=new byte[DEFAULT_BUFFER_SIZE]; for (int n; (n=inputStream.read(buffer)) >= 0; ) { outputStream.write(buffer,0,n); } return outputStream.toString(); } finally { outputStream.close(); } } finally { inputStream.close(); } }
Returns the text of a file as a String object
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { try { ois.defaultReadObject(); remove(m_visualLabel); m_visualLabel=new JLabel(m_icon); loadIcons(m_iconPath,m_animatedIconPath); add(m_visualLabel,BorderLayout.CENTER); Dimension d=m_visualLabel.getPreferredSize(); Dimension d2=new Dimension((int)d.getWidth() + 10,(int)d.getHeight() + 10); setMinimumSize(d2); setPreferredSize(d2); setMaximumSize(d2); } catch ( Exception ex) { ex.printStackTrace(); } }
Overides default read object in order to reload icons. This is necessary because for some strange reason animated gifs stop being animated after being serialized/deserialized.
public void cacheEntryAdded(CacheEntryEvent arg0){ super.cacheEntryAdded(arg0); StringBuffer buffer=new StringBuffer(); buffer.append("Cache entry added ["); buffer.append(arg0.getEntry().getKey()); buffer.append("]. Added ["); buffer.append(getEntryAddedCount()); buffer.append("] Removed ["); buffer.append(getEntryRemovedCount()); buffer.append("]"); log.debug(buffer.toString()); }
Public methods
public CtClass[] mayThrow(){ return super.mayThrow(); }
Returns the list of exceptions that the expression may throw. This list includes both the exceptions that the try-catch statements including the expression can catch and the exceptions that the throws declaration allows the method to throw.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:31:36.469 -0500",hash_original_method="19A6345BB30DA1B94EF425A139EBF7B6",hash_generated_method="3F38B0E9396A1A008A1A74F14E81449E") public boolean isColumnCollapsed(int columnIndex){ return mCollapsedColumns.get(columnIndex); }
<p>Returns the collapsed state of the specified column.</p>
@Override public Object dataAccessObjectProcess(ProceedingJoinPoint pjp) throws AuthorityException, ServiceException, Throwable { return pjp.proceed(); }
no enable for scan DAO package
public int nextNode(){ if (m_foundLast) return DTM.NULL; int next; if (null != m_exprObj) { m_lastFetched=next=m_exprObj.nextNode(); } else m_lastFetched=next=DTM.NULL; if (DTM.NULL != next) { m_pos++; return next; } else { m_foundLast=true; return DTM.NULL; } }
Returns the next node in the set and advances the position of the iterator in the set. After a NodeIterator is created, the first call to nextNode() returns the first node in the set.
private void updateUiForConfigDataMap(final DataMap config){ boolean uiUpdated=false; for ( String configKey : config.keySet()) { if (!config.containsKey(configKey)) { continue; } if (updateUiForKey(configKey,config)) { uiUpdated=true; } } if (uiUpdated) { invalidate(); sendMessage("WEARABLE_SETTINGS_CHANGE",config.toByteArray()); } }
Update the interface on changes on the settings
public void stop(){ if (mLocaleChangedReceiver != null) { mCtx.unregisterReceiver(mLocaleChangedReceiver); mLocaleChangedReceiver=null; } mUpdateExecutor.shutdownNow(); }
Stops Locale manager
@Deprecated public ScriptSortBuilder lang(String lang){ this.lang=lang; return this; }
The language of the script.
public void reset(){ super.reset(); H0=0x67452301; H1=0xefcdab89; H2=0x98badcfe; H3=0x10325476; H4=0x76543210; H5=0xFEDCBA98; H6=0x89ABCDEF; H7=0x01234567; xOff=0; for (int i=0; i != X.length; i++) { X[i]=0; } }
reset the chaining variables to the IV values.
@Override public boolean equals(Object obj){ if (this == obj) { return true; } if (obj instanceof AbstractChronology) { return compareTo((AbstractChronology)obj) == 0; } return false; }
Checks if this chronology is equal to another chronology. <p> The comparison is based on the entire state of the object.
@Override protected final Object clone(){ return this; }
There is only intended to be a single instance of the NULL object, so the clone method returns itself.
private Object readResolve(){ dataset=new XYSeriesCollection(); dataset.addSeries(new XYSeries("Data",false,true)); projector.postOpenInit(); addListeners(); return this; }
Standard method call made to objects after they are deserialized. See: http://java.sun.com/developer/JDCTechTips/2002/tt0205.html#tip2 http://xstream.codehaus.org/faq.html
@Override public void updateSelectionTo(Collection<GraphNode> selection){ for ( GraphNode node : getEditor().getViewGraph().getNodes()) { NodeWrapper<NodeDisplayProperty> nodeWrapper=nodeTreeView.getNodeWrapper(node); if (null != nodeWrapper) { nodeTreeView.getTreeViewer().update(nodeWrapper,new String[]{COL_SELECTED}); } } updateSelectedExtend(selection); }
Set the nodes in the given set as the only ones selected. Which means that the previously selected are first unselected, then nodes in the <code>selection</code> argument are added.
public void testBogusArguments() throws Exception { IllegalArgumentException expected=expectThrows(IllegalArgumentException.class,null); assertTrue(expected.getMessage().contains("Unknown parameters")); }
Test that bogus arguments result in exception
public static char toDimensionSymbol(int dimensionValue){ switch (dimensionValue) { case FALSE: return SYM_FALSE; case TRUE: return SYM_TRUE; case DONTCARE: return SYM_DONTCARE; case P: return SYM_P; case L: return SYM_L; case A: return SYM_A; } throw new IllegalArgumentException("Unknown dimension value: " + dimensionValue); }
Converts the dimension value to a dimension symbol, for example, <code>TRUE =&gt; 'T'</code> .
private K highestKey(){ ConcurrentSkipListMap.Node<K,V> n=hiNode(); if (n != null) { K last=n.key; if (inBounds(last)) return last; } throw new NoSuchElementException(); }
Returns highest absolute key (ignoring directonality).
public ScatterPlotSetter(final Integer index){ this.index=index; }
Construct a setter object.
private boolean saveSelection(){ if (!m_readWrite) return true; log.info(""); MAttributeSet as=m_masi.getMAttributeSet(); if (as == null) return true; m_changed=false; String mandatory=""; if ((!m_productWindow || !m_productASI) && as.isLot()) { log.fine("Lot=" + fieldLotString.getText()); String text=fieldLotString.getText(); m_masi.setLot(text); if (as.isLotMandatory() && (text == null || text.length() == 0)) mandatory+=" - " + Msg.translate(Env.getCtx(),"Lot"); m_changed=true; } if ((!m_productWindow || !m_productASI) && as.isSerNo()) { log.fine("SerNo=" + fieldSerNo.getText()); String text=fieldSerNo.getText(); m_masi.setSerNo(text); if (as.isSerNoMandatory() && (text == null || text.length() == 0)) mandatory+=" - " + Msg.translate(Env.getCtx(),"SerNo"); m_changed=true; } if ((!m_productWindow || !m_productASI) && as.isGuaranteeDate()) { log.fine("GuaranteeDate=" + fieldGuaranteeDate.getValue()); Timestamp ts=(Timestamp)fieldGuaranteeDate.getValue(); m_masi.setGuaranteeDate(ts); if (as.isGuaranteeDateMandatory() && ts == null) mandatory+=" - " + Msg.translate(Env.getCtx(),"GuaranteeDate"); m_changed=true; } if (m_changed || m_masi.getM_AttributeSetInstance_ID() == 0) { m_masi.save(); m_M_AttributeSetInstance_ID=m_masi.getM_AttributeSetInstance_ID(); m_M_AttributeSetInstanceName=m_masi.getDescription(); } if (m_M_AttributeSetInstance_ID > 0 && m_readWrite) { MAttribute[] attributes=as.getMAttributes(!m_productASI); for (int i=0; i < attributes.length; i++) { if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attributes[i].getAttributeValueType())) { CComboBox editor=(CComboBox)m_editors.get(i); MAttributeValue value=(MAttributeValue)editor.getSelectedItem(); log.fine(attributes[i].getName() + "=" + value); if (attributes[i].isMandatory() && value == null) mandatory+=" - " + attributes[i].getName(); attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID,value); } else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attributes[i].getAttributeValueType())) { VNumber editor=(VNumber)m_editors.get(i); BigDecimal value=(BigDecimal)editor.getValue(); log.fine(attributes[i].getName() + "=" + value); if (attributes[i].isMandatory() && value == null) mandatory+=" - " + attributes[i].getName(); if (value != null && value.scale() == 0) value=value.setScale(1,BigDecimal.ROUND_HALF_UP); attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID,value); } else { VString editor=(VString)m_editors.get(i); String value=editor.getText(); log.fine(attributes[i].getName() + "=" + value); if (attributes[i].isMandatory() && (value == null || value.length() == 0)) mandatory+=" - " + attributes[i].getName(); attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID,value); } } m_changed=true; } if (m_changed) { m_masi.setDescription(); m_masi.save(); } m_M_AttributeSetInstance_ID=m_masi.getM_AttributeSetInstance_ID(); m_M_AttributeSetInstanceName=m_masi.getDescription(); if (mandatory.length() > 0) { ADialog.error(m_WindowNo,this,"FillMandatory",mandatory); return false; } return true; }
Save Selection
public static ArrayList<Instruction> cleanupRuntimeInstructions(ArrayList<Instruction> insts,String[] outputs){ for (int i=0; i < insts.size(); i++) { Instruction linst=insts.get(i); if (linst instanceof VariableCPInstruction && ((VariableCPInstruction)linst).isRemoveVariable()) { VariableCPInstruction varinst=(VariableCPInstruction)linst; for ( String var : outputs) if (varinst.isRemoveVariable(var)) { insts.remove(i); i--; break; } } } return insts; }
Cleanup runtime instructions, removing rmvar instructions for any of the given output variable names.
private void init(){ setFocusPainted(false); setFocusable(false); JComboBox box=new JComboBox(); Object preventHide=box.getClientProperty("doNotCancelPopup"); putClientProperty("doNotCancelPopup",preventHide); }
Initialize the column control button's gui
@Override public void beginOfStream() throws AdeException, AdeFlowException { if (s_marshaller == null) { JAXBContext jaxbContext; try { jaxbContext=JAXBContext.newInstance(ADEEXT_JAXB_CONTEXT); } catch ( JAXBException e) { throw new AdeInternalException("failed to create JAXBContext object for package " + Arrays.toString(ADEEXT_JAXB_CONTEXT),e); } try { s_marshaller=jaxbContext.createMarshaller(); } catch ( JAXBException e) { throw new AdeInternalException("failed to create JAXB Marshaller object",e); } try { s_marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,m_formatXMLOutput); s_marshaller.setProperty(Marshaller.JAXB_FRAGMENT,Boolean.TRUE); s_marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,XML_INTERVAL_V2_XSD); } catch ( PropertyException e) { throw new AdeInternalException("failed to set formatted output for JAXB Marshaller object",e); } SchemaFactory sf=SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI); File xmlParent=Ade.getAde().getConfigProperties().getXsltDir().getAbsoluteFile(); xmlParent=xmlParent.getParentFile(); File intervalSchema=new File(xmlParent,XML_INTERVAL_V2_XSD); Schema schema; try { URL analyzedIntervalSchema=intervalSchema.toURI().toURL(); schema=sf.newSchema(analyzedIntervalSchema); } catch ( SAXException e) { throw new AdeInternalException("failed to create XML Schemal for event log analysis results",e); } catch ( MalformedURLException e) { throw new AdeInternalException("failed to create URL from Schema path: " + intervalSchema.getAbsolutePath(),e); } s_marshaller.setSchema(schema); } m_xmlMetaData=new XMLMetaDataRetriever(); }
Begin of Stream
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){ ActionErrors errors=new ActionErrors(); if (!new CustomDate(this.fechaFormato,this.fechaA,this.fechaM,this.fechaD,this.fechaS).validate() || !new CustomDate(this.fechaIniFormato,this.fechaIniA,this.fechaIniM,this.fechaIniD,this.fechaIniS).validate() || !new CustomDate(this.fechaFinFormato,this.fechaFinA,this.fechaFinM,this.fechaFinD,this.fechaFinS).validate()) { errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionError(Constants.ERROR_DATE,Messages.getString(DescripcionConstants.DESCRIPCION_BUSQUEDA_AUT_FECHA,request.getLocale()))); } if (StringUtils.isNotBlank(numero) && !NumberUtils.isNumber(numero)) { errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionError(Constants.ERROR_INVALID,Messages.getString(ArchivoDetails.DESCRIPCION_BUSQUEDA_DATO_NUMERICO,request.getLocale()))); } if (listasDescriptoras.length == 0) { errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionError(Constants.ERROR_REQUIRED,Messages.getString(ArchivoDetails.DESCRIPCION_BUSQUEDA_LISTAS_DESCRIPTORAS,request.getLocale()))); } return errors; }
Valida el formulario
@Override public boolean canHandleJitter(){ return true; }
Returns true.
public OperationNotSupportException(Throwable arg0){ super(arg0); }
Creates a new instance of OperationNotSupportException.
private static void initialize(GemFireCacheImpl cache){ try { AttributesFactory factory=new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setEntryTimeToLive(new ExpirationAttributes(ADMIN_REGION_EXPIRY_INTERVAL,ExpirationAction.DESTROY)); cache.getLogger().fine("ClientHealthMonitoringRegion, setting TTL for entry...."); factory.addCacheListener(prepareCacheListener()); factory.setStatisticsEnabled(true); RegionAttributes regionAttrs=factory.create(); InternalRegionArguments internalArgs=new InternalRegionArguments(); internalArgs.setIsUsedForMetaRegion(true); internalArgs.setIsUsedForPartitionedRegionAdmin(false); currentInstance=cache.createVMRegion(ADMIN_REGION_NAME,regionAttrs,internalArgs); } catch ( Exception ex) { cache.getLoggerI18n().error(LocalizedStrings.ClientHealthMonitoringRegion_ERROR_WHILE_CREATING_AN_ADMIN_REGION,ex); } }
This method creates the client health monitoring region.
public String namespace(){ return theNamespace; }
Returns the namespace name of this element type.
private List<StoragePool> processStorageThickPoolResponse(StorageSystem system,List<Pool> thickPoolListFromResponse,AccessProfile accessProfile,Set<String> supportedProtocols,List<StoragePool> poolsToMatchWithVpool) throws IOException { _logger.debug("Entering {}",Thread.currentThread().getStackTrace()[1].getMethodName()); List<StoragePool> newPools=new ArrayList<StoragePool>(); List<StoragePool> updatePools=new ArrayList<StoragePool>(); List<StoragePool> allPools=new ArrayList<StoragePool>(); if (null != thickPoolListFromResponse && !thickPoolListFromResponse.isEmpty()) { _logger.debug("thickPoolListFromResponse.size() :{}",thickPoolListFromResponse.size()); for ( Pool poolFromResponse : thickPoolListFromResponse) { _logger.debug("Pool Id:{}",poolFromResponse.getPoolID()); if (!(0 == Integer.valueOf(poolFromResponse.getType()) || -1 == Integer.valueOf(poolFromResponse.getType()) || 1 == Integer.valueOf(poolFromResponse.getType()))) { continue; } boolean isNew=false; boolean isModified=false; String nativeGuid=NativeGUIDGenerator.generateNativeGuid(system,poolFromResponse.getObjectID(),NativeGUIDGenerator.POOL); _logger.debug("nativeGuid :{}",nativeGuid); StoragePool pool=checkPoolExistsInDB(nativeGuid); if (null == pool) { isNew=true; pool=new StoragePool(); pool.setNativeGuid(nativeGuid); pool.setStorageDevice(system.getId()); pool.setId(URIUtil.createId(StoragePool.class)); pool.setNativeId(poolFromResponse.getPoolID()); pool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY.toString()); pool.setMaximumThickVolumeSize(104857600L); pool.setPoolServiceType(PoolServiceType.block.toString()); pool.setRegistrationStatus(DiscoveredDataObject.RegistrationStatus.REGISTERED.toString()); StringSet raidLevels=new StringSet(); String raidLevel=parseRaidLevel(poolFromResponse.getRaidType()); if (StringUtils.isNotEmpty(raidLevel)) { raidLevels.add(raidLevel); } pool.addSupportedRaidLevels(raidLevels); pool.setSupportedResourceTypes(StoragePool.SupportedResourceTypes.THICK_ONLY.toString()); _logger.info("poolType {} {}",poolFromResponse.getType(),poolFromResponse.getObjectID()); } StringSet protocols=new StringSet(supportedProtocols); if (!isNew && ImplicitPoolMatcher.checkPoolPropertiesChanged(pool.getProtocols(),protocols)) { isModified=true; } pool.setProtocols(protocols); pool.setPoolName(poolFromResponse.getDisplayName()); pool.setFreeCapacity(poolFromResponse.getFreeCapacity()); StringSet copyTypes=new StringSet(); copyTypes.add(StoragePool.CopyTypes.UNSYNC_ASSOC.name()); copyTypes.add(StoragePool.CopyTypes.UNSYNC_UNASSOC.name()); copyTypes.add(StoragePool.CopyTypes.SYNC.name()); copyTypes.add(StoragePool.CopyTypes.ASYNC.name()); pool.setSupportedCopyTypes(copyTypes); pool.setTotalCapacity(poolFromResponse.getFreeCapacity() + poolFromResponse.getUsedCapacity()); if (StringUtils.isNotBlank(poolFromResponse.getDisplayName())) { pool.setLabel(poolFromResponse.getDisplayName().length() == 1 ? " " + poolFromResponse.getDisplayName() : poolFromResponse.getDisplayName()); } if (!isNew && !isModified && (ImplicitPoolMatcher.checkPoolPropertiesChanged(pool.getCompatibilityStatus(),CompatibilityStatus.COMPATIBLE.name()) || ImplicitPoolMatcher.checkPoolPropertiesChanged(pool.getDiscoveryStatus(),DiscoveryStatus.VISIBLE.name()))) { isModified=true; } pool.setCompatibilityStatus(CompatibilityStatus.COMPATIBLE.name()); pool.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name()); if (isNew) { newPools.add(pool); poolsToMatchWithVpool.add(pool); } else { updatePools.add(pool); if (isModified) { poolsToMatchWithVpool.add(pool); } } } StoragePoolAssociationHelper.setStoragePoolVarrays(system.getId(),newPools,_dbClient); _logger.debug("newPools size:{}",newPools.size()); _logger.debug("updatePools size:{}",updatePools.size()); _dbClient.createObject(newPools); _dbClient.persistObject(updatePools); allPools.addAll(newPools); allPools.addAll(updatePools); } _logger.debug("Exiting {}",Thread.currentThread().getStackTrace()[1].getMethodName()); return allPools; }
Process the ThickPool response received from server.
public void translate(Properties ctx){ if (m_originalString == null) return; String inText=Msg.parseTranslation(ctx,m_originalString); String[] lines=Pattern.compile("$",Pattern.MULTILINE).split(inText); m_string_paper=new AttributedString[lines.length]; for (int i=0; i < lines.length; i++) { String line=Util.removeCRLF(lines[i]); m_string_paper[i]=new AttributedString(line); if (line.length() > 0) { m_string_paper[i].addAttribute(TextAttribute.FONT,m_font); m_string_paper[i].addAttribute(TextAttribute.FOREGROUND,m_paint); } } m_string_view=m_string_paper; }
Translate Context if required If content is translated, the element needs to stay in the bounds of the originally calculated size and need to align the field.
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:30.328 -0500",hash_original_method="C0D74F5DDFD9A01C19E54F3379BA7652",hash_generated_method="618EE3A321C4FFDE67749913AA58ADE8") final public boolean isAdded(){ return mActivity != null && mAdded; }
Return true if the fragment is currently added to its activity.
public void onReferencesBuild(RefElement refElement){ }
Called after the references to the specified element have been collected.
public Matrix4f(){ mMat=new float[16]; loadIdentity(); }
Creates a new identity 4x4 matrix
public static void responseCodeReceived(Context context,RestoreTransactions request,ResponseCode responseCode){ if (sPurchaseObserver != null) { sPurchaseObserver.onRestoreTransactionsResponse(request,responseCode); } }
This is called when we receive a response code from Android Market for a RestoreTransactions request.
public Partition(double ratio[],int size,PartitionBuilder builder){ init(ratio,size,builder); }
Creates a new partition of a given size consisting of <tt>ratio.length</tt> sets. The set <i>i</i> will be of size of <i>size x ratio[i]</i>, i.e. the sum of all <i>ratio[i]</i> must be 1. Initially all partitions are selected.
@Override public void run(){ amIActive=true; if (args.length < 2) { showFeedback("Plugin parameters have not been set properly."); return; } String inputHeader=args[0]; String outputHeader=args[1]; if ((inputHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { int row, col; double z; int progress, oldProgress=-1; double[] data; WhiteboxRaster inputFile=new WhiteboxRaster(inputHeader,"r"); int rows=inputFile.getNumberRows(); int cols=inputFile.getNumberColumns(); double noData=inputFile.getNoDataValue(); WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFile.setPreferredPalette(inputFile.getPreferredPalette()); for (row=0; row < rows; row++) { data=inputFile.getRowValues(row); for (col=0; col < cols; col++) { z=data[col]; if (z != noData) { outputFile.setValue(row,col,Math.log(z)); } } progress=(int)(100f * row / (rows - 1)); if (progress != oldProgress) { oldProgress=progress; updateProgress((int)progress); if (cancelOp) { cancelOperation(); return; } } } outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFile.addMetadataEntry("Created on " + new Date()); inputFile.close(); outputFile.close(); returnData(outputHeader); } 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 { updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
public void java_lang_Class_setSigners(SootMethod method,ReferenceVariable thisVar,ReferenceVariable returnVar,ReferenceVariable params[]){ ReferenceVariable tempFld=helper.tempField("<java.lang.Class signers>"); helper.assign(tempFld,params[0]); }
Sets the signers of a class. This should be called after defining a class. Parameters: c - the Class object signers - the signers for the class native void setSigners(java.lang.Object[]);
public UserTunnel(UserContext userContext,GuacamoleTunnel tunnel){ super(tunnel); this.userContext=userContext; }
Creates a new UserTunnel which wraps the given tunnel, associating it with the given UserContext. The UserContext MUST be from the AuthenticationProvider that created this tunnel, and MUST be associated with the user for whom this tunnel was created.
protected JTree createTree(){ JTree tree=new JTree(model); tree.setName("TreePopup.tree"); tree.setFont(getFont()); tree.setForeground(getForeground()); tree.setBackground(getBackground()); tree.setBorder(null); tree.setFocusable(true); tree.addMouseListener(handler); tree.addKeyListener(handler); tree.setCellRenderer(new Renderer()); return tree; }
Creates the JList used in the popup to display the items in the combo box model. This method is called when the UI class is created.
@Override public int aggregateData(AbstractScannedResult scannedResult){ while (scannedResult.hasNext()) { wrapper.setDictionaryKey(scannedResult.getDictionaryKeyArray()); wrapper.setNoDictionaryKeys(scannedResult.getNoDictionaryKeyArray()); wrapper.setComplexTypesKeys(scannedResult.getComplexTypeKeyArray()); MeasureAggregator[] measureAggregators=aggData.get(wrapper); if (null == measureAggregators) { measureAggregators=getNewAggregator(); ByteArrayWrapper byteArrayWrapper=wrapper; wrapper=new ByteArrayWrapper(); aggData.put(byteArrayWrapper,measureAggregators); } dataAggregator.aggregateData(scannedResult,measureAggregators); } return 0; }
Below method will be used to aggregate the scanned result
public void testCrashCorruptsIndexing() throws Exception { path=createTempDir("testCrashCorruptsIndexing"); indexAndCrashOnCreateOutputSegments2(); searchForFleas(2); indexAfterRestart(); searchForFleas(3); }
LUCENE-3627: This test fails.
public ServiceHost startService(Service service){ Operation post=Operation.createPost(UriUtils.buildUri(this,service.getClass())); return startService(post,service); }
Start a service using the default start operation.
public String dropEngine(Engine engine){ StringBuilder builder=new StringBuilder(); for ( String attribute : Setup.getDropEngineMessageFormat()) { builder.append(getEngineAttribute(engine,attribute,!PICKUP)); } return builder.toString(); }
Returns the drop string for a loco. Useful for frames like the train conductor and yardmaster.
@Override public boolean rowInserted() throws SQLException { try { debugCodeCall("rowInserted"); return false; } catch ( Exception e) { throw logAndConvert(e); } }
Detects if the row was inserted.
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:22.109 -0500",hash_original_method="3044E621F64D9746C61861BC2D15D7B8",hash_generated_method="55D3BEE5320ADD2D9AB948841488DEF3") private void sendMessage(byte[] msg,boolean retry) throws IOException { Socket sock=this.sipStack.ioHandler.sendBytes(this.messageProcessor.getIpAddress(),this.peerAddress,this.peerPort,this.peerProtocol,msg,retry,this); if (sock != mySock && sock != null) { try { if (mySock != null) mySock.close(); } catch ( IOException ex) { } mySock=sock; this.myClientInputStream=mySock.getInputStream(); this.myClientOutputStream=mySock.getOutputStream(); Thread thread=new Thread(this); thread.setDaemon(true); thread.setName("TCPMessageChannelThread"); thread.start(); } }
Send message to whoever is connected to us. Uses the topmost via address to send to.
public int indexOf(final StrMatcher matcher){ return indexOf(matcher,0); }
Searches the string builder using the matcher to find the first match. <p> Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to find the character 'a' followed by a number.
public static void checkArgument(boolean expression,Object errorMessage){ if (!expression) { throw new IllegalArgumentException(String.valueOf(errorMessage)); } }
Ensures the truth of an expression involving one or more parameters to the calling method.
public int score(){ return score; }
Return the score for this node.
public void tryToDequeueAllOneToOneChatMessagesAndOneToOneFileTransfers(){ mImOperationHandler.post(new OneToOneChatDequeueTask(mCtx,mCore,mMessagingLog,mRcsSettings,mChatService,mFileTransferService,mContactManager,mHistoryLog)); }
Try to dequeue all one-to-one chat messages and one-one file transfers
public DisposableLazy(){ super(); }
Constructs an empty lazy object with no provider. Stored variable has to be set manually.
public boolean selectSingleNode(D nodeData){ if ((selectedNodes.size() == 1) && (selectedNodes.get(0).equals(nodeData))) { return false; } clearSelections(); insertAndSelectNode(nodeData,0,true); return true; }
Clears the the current selection and selects a single node.
@Deprecated public MutuallyExclusiveSetLock(boolean fair){ this(fair,null); }
Constructs a new <code>MutuallyExclusiveSetLock</code>.
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.
private void start(){ mStarted=true; mEnableSessionInvalidationsTimer.resume(); Intent intent=new Intent(mContext,InvalidationClientService.class); mContext.startService(intent); }
Starts the invalidation client without updating the registered invalidation types.
public static SimpleSimulationProperties serializableInstance(){ return new SimpleSimulationProperties(); }
Generates a simple exemplar of this class to test serialization.
public Annotation(boolean isPersistent){ this(null,isPersistent,null,0,null,null); }
Creates a new annotation with the given persistence state.
public void addState(int[] specs,Animation animation){ Tuple tuple=new Tuple(specs,animation); animation.setAnimationListener(mAnimationListener); mTuples.add(tuple); }
Associates the given Animation with the provided drawable state specs so that it will be run when the View's drawable state matches the specs.
public void decodeAttributeBody(byte[] attributeValue,char offset,char length){ hmacSha1Content=new byte[length]; System.arraycopy(attributeValue,offset,hmacSha1Content,0,length); }
Sets this attribute's fields according to the message and attributeValue arrays.
public ShapeWriter(PointTransformation pointTransformer,PointShapeFactory pointFactory){ if (pointTransformer != null) this.pointTransformer=pointTransformer; if (pointFactory != null) this.pointFactory=pointFactory; }
Creates a new ShapeWriter with a specified point transformation and point shape factory.
private int handleDataMessage(String lastRxMsg){ int result=0; switch (service) { case OBD_SVC_NONE: break; case OBD_SVC_CAN_MONITOR: result=canProt.handleTelegram(lastRxMsg.toCharArray()); break; default : result=super.handleTelegram(lastRxMsg.toCharArray()); } return result; }
forward data message for further handling
public final Intersection[] intersect(Line line){ if (line == null) { String message=Logging.getMessage("nullValue.LineIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } double a=line.getDirection().getLengthSquared3(); double b=2 * line.selfDot(); double c=line.getOrigin().getLengthSquared3() - this.radius * this.radius; double discriminant=Sphere.discriminant(a,b,c); if (discriminant < 0) return null; double discriminantRoot=Math.sqrt(discriminant); if (discriminant == 0) { Vec4 p=line.getPointAt((-b - discriminantRoot) / (2 * a)); return new Intersection[]{new Intersection(p,true)}; } else { Vec4 near=line.getPointAt((-b - discriminantRoot) / (2 * a)); Vec4 far=line.getPointAt((-b + discriminantRoot) / (2 * a)); return new Intersection[]{new Intersection(near,false),new Intersection(far,false)}; } }
Obtains the intersections of this sphere with a line. The returned array may be either null or of zero length if no intersections are discovered. It does not contain null elements and will have a size of 2 at most. Tangential intersections are marked as such. <code>line</code> is considered to have infinite length in both directions.
public void addMessageToConsole(String message,int lineNumber,String sourceID,int msgLevel){ if (mWebChromeClient == null) { return; } Message msg=obtainMessage(ADD_MESSAGE_TO_CONSOLE); msg.getData().putString("message",message); msg.getData().putString("sourceID",sourceID); msg.getData().putInt("lineNumber",lineNumber); msg.getData().putInt("msgLevel",msgLevel); sendMessage(msg); }
Called by WebViewCore when we have a message to be added to the JavaScript error console. Sends a message to the Java side with the details.
public org.smpte_ra.schemas.st2067_2_2016.CompositionTimecodeType buildCompositionTimeCode(BigInteger compositionEditRate){ org.smpte_ra.schemas.st2067_2_2016.CompositionTimecodeType compositionTimecodeType=new CompositionTimecodeType(); compositionTimecodeType.setTimecodeDropFrame(false); compositionTimecodeType.setTimecodeRate(compositionEditRate); compositionTimecodeType.setTimecodeStartAddress(IMFUtils.generateTimecodeStartAddress()); return compositionTimecodeType; }
A method to construct a CompositionTimecodeType conforming to the 2016 schema
public static String saveImageResultsToHtml(String prefix,ImageSearchHits hits,String queryImage,IndexReader reader) throws IOException { long l=System.currentTimeMillis() / 1000; String fileName="results-" + prefix + "-"+ l+ ".html"; BufferedWriter bw=new BufferedWriter(new FileWriter(fileName)); bw.write("<html>\n" + "<head><title>Search Results</title></head>\n" + "<body bgcolor=\"#FFFFFF\">\n"); bw.write("<h3>query</h3>\n"); bw.write("<a href=\"file://" + queryImage + "\"><img src=\"file://"+ queryImage+ "\"></a><p>\n"); bw.write("<h3>results</h3>\n"); for (int i=0; i < hits.length(); i++) { bw.write(hits.score(i) + " - <a href=\"file://" + reader.document(hits.documentID(i)).getValues(DocumentBuilder.FIELD_NAME_IDENTIFIER)[0]+ "\"><img src=\"file://"+ reader.document(hits.documentID(i)).getValues(DocumentBuilder.FIELD_NAME_IDENTIFIER)[0]+ "\"></a><p>\n"); } bw.write("</body>\n" + "</html>"); bw.close(); return fileName; }
Puts results into a HTML file.
public IElementType advance() throws java.io.IOException { int zzInput; int zzAction; int zzCurrentPosL; int zzMarkedPosL; int zzEndReadL=zzEndRead; CharSequence zzBufferL=zzBuffer; char[] zzBufferArrayL=zzBufferArray; char[] zzCMapL=ZZ_CMAP; int[] zzTransL=ZZ_TRANS; int[] zzRowMapL=ZZ_ROWMAP; int[] zzAttrL=ZZ_ATTRIBUTE; while (true) { zzMarkedPosL=zzMarkedPos; zzAction=-1; zzCurrentPosL=zzCurrentPos=zzStartRead=zzMarkedPosL; zzState=ZZ_LEXSTATE[zzLexicalState]; zzForAction: { while (true) { if (zzCurrentPosL < zzEndReadL) zzInput=(zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++)); else if (zzAtEOF) { zzInput=YYEOF; break zzForAction; } else { zzCurrentPos=zzCurrentPosL; zzMarkedPos=zzMarkedPosL; boolean eof=zzRefill(); zzCurrentPosL=zzCurrentPos; zzMarkedPosL=zzMarkedPos; zzBufferL=zzBuffer; zzEndReadL=zzEndRead; if (eof) { zzInput=YYEOF; break zzForAction; } else { zzInput=(zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++)); } } int zzNext=zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]]; if (zzNext == -1) break zzForAction; zzState=zzNext; int zzAttributes=zzAttrL[zzState]; if ((zzAttributes & 1) == 1) { zzAction=zzState; zzMarkedPosL=zzCurrentPosL; if ((zzAttributes & 8) == 8) break zzForAction; } } } zzMarkedPos=zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { case 2: { return JavaTokenType.WHITE_SPACE; } case 7: break; case 3: { return SPITokenType.IDENTIFIER; } case 8: break; case 6: { return JavaTokenType.DOT; } case 9: break; case 5: { return SPITokenType.DOLLAR; } case 10: break; case 4: { return JavaTokenType.END_OF_LINE_COMMENT; } case 11: break; case 1: { return JavaTokenType.BAD_CHARACTER; } case 12: break; default : if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF=true; zzDoEOF(); return null; } else { zzScanError(ZZ_NO_MATCH); } } } }
Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs.
public RequestBuilder form(Object... args){ return with(formParams,args); }
Adds form parameters.
private static MyPresenceManager createInstance(Context context,MXSession session){ MyPresenceManager instance=new MyPresenceManager(context,session); instances.put(session,instance); return instance; }
Create an instance without any check.
public Builder(){ }
Instantiates a new builder.
@Override public void run(){ amIActive=true; String inputFile; String outputFile; boolean flag; int row, col, rN, cN, r, c, count; double xCoord, yCoord; int progress; int i, a; boolean patternMatch; double value, z, zN; int[] neighbours=new int[8]; int FID=0; int[] rowVals=new int[2]; int[] colVals=new int[2]; int traceDirection=0; int previousTraceDirection=0; double currentHalfRow=0, currentHalfCol=0; double[] inputValueData=new double[4]; long numPoints; int minLineLength=2; int[] dX={1,1,1,0,-1,-1,-1,0}; int[] dY={-1,0,1,1,1,0,-1,-1}; int[][] elements={{6,7,0,4,3,2},{7,0,1,3,5},{0,1,2,4,5,6},{1,2,3,5,7},{2,3,4,6,7,0},{3,4,5,7,1},{4,5,6,0,1,2},{5,6,7,1,3},{0,1,2,3,4,5,6,7},{0,1,2,3,4,5,6,7}}; double[][] vals={{0,0,0,1,1,1},{0,0,0,1,1},{0,0,0,1,1,1},{0,0,0,1,1},{0,0,0,1,1,1},{0,0,0,1,1},{0,0,0,1,1,1},{0,0,0,1,1},{1,1,1,1,1,1,1,1},{0,0,0,0,0,0,0,0}}; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } inputFile=args[0]; outputFile=args[1]; minLineLength=Integer.parseInt(args[2]); if (minLineLength < 2) { minLineLength=2; } if ((inputFile == null) || (outputFile == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { WhiteboxRaster input=new WhiteboxRaster(inputFile,"r"); int rows=input.getNumberRows(); int cols=input.getNumberColumns(); double rowsD=(double)rows; double colsD=(double)cols; double noData=input.getNoDataValue(); double gridResX=input.getCellSizeX(); double gridResY=input.getCellSizeY(); double east=input.getEast() - gridResX / 2.0; double west=input.getWest() + gridResX / 2.0; double EWRange=east - west; double north=input.getNorth() - gridResY / 2.0; double south=input.getSouth() + gridResY / 2.0; double NSRange=north - south; String tempHeader1=inputFile.replace(".dep","_temp1.dep"); WhiteboxRaster temp1=new WhiteboxRaster(tempHeader1,"rw",inputFile,WhiteboxRaster.DataType.INTEGER,0); temp1.isTemporaryFile=true; for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=input.getValue(row,col); if (z > 0 && z != noData) { for (i=0; i < 8; i++) { z=input.getValue(row + dY[i],col + dX[i]); if (z == 1) { neighbours[i]=1; } else { neighbours[i]=0; } } value=1; for (a=8; a < elements.length; a++) { patternMatch=true; for (i=0; i < elements[a].length; i++) { if (neighbours[elements[a][i]] != vals[a][i]) { patternMatch=false; break; } } if (patternMatch) { value=0; } } temp1.setValue(row,col,value); } } if (cancelOp) { cancelOperation(); return; } progress=(int)(100.0 * row / (rows - 1)); updateProgress("Loop 1 of 4:",progress); } for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=temp1.getValue(row,col); if (z == 1) { for (i=0; i < 8; i++) { z=temp1.getValue(row + dY[i],col + dX[i]); if (z == 1) { neighbours[i]=1; } else { neighbours[i]=0; } } value=1; for (a=0; a < 8; a++) { patternMatch=true; for (i=0; i < elements[a].length; i++) { if (neighbours[elements[a][i]] != vals[a][i]) { patternMatch=false; break; } } if (patternMatch) { value=0; } } temp1.setValue(row,col,value); } } if (cancelOp) { cancelOperation(); return; } progress=(int)(100.0 * row / (rows - 1)); updateProgress("Loop 2 of 4:",progress); } for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=temp1.getValue(row,col); if (z > 0 && z != noData) { count=0; for (i=0; i < 8; i++) { rN=row + dY[i]; cN=col + dX[i]; zN=temp1.getValue(rN,cN); if (zN > 0 && zN != noData) { count++; } } temp1.setValue(row,col,count); } else { temp1.setValue(row,col,0); } } if (cancelOp) { cancelOperation(); return; } progress=(int)(100.0 * row / (rows - 1)); updateProgress("Loop 3 of 4:",progress); } ShapeFile output=new ShapeFile(outputFile,ShapeType.POLYLINE); DBFField fields[]=new DBFField[2]; fields[0]=new DBFField(); fields[0].setName("FID"); fields[0].setDataType(DBFField.DBFDataType.NUMERIC); fields[0].setFieldLength(10); fields[0].setDecimalCount(0); fields[1]=new DBFField(); fields[1].setName("VALUE"); fields[1].setDataType(DBFField.DBFDataType.NUMERIC); fields[1].setFieldLength(10); fields[1].setDecimalCount(2); String DBFName=output.getDatabaseFile(); DBFWriter writer=new DBFWriter(new File(DBFName)); writer.setFields(fields); int[] parts={0}; boolean pointAdded=false; for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=temp1.getValue(row,col); if (z == 1) { PointsList points=new PointsList(); value=1; r=row; c=col; flag=true; previousTraceDirection=-1; traceDirection=0; do { xCoord=west + (c / colsD) * EWRange; yCoord=north - (r / rowsD) * NSRange; pointAdded=false; if (traceDirection != previousTraceDirection) { points.addPoint(xCoord,yCoord); previousTraceDirection=traceDirection; pointAdded=true; } temp1.setValue(r,c,0); traceDirection=-1; value=-1; for (i=0; i < 8; i++) { rN=r + dY[i]; cN=c + dX[i]; zN=temp1.getValue(rN,cN); if (zN > 0 && zN != noData) { traceDirection=i; value=zN; break; } } if (value == 2) { r+=dY[traceDirection]; c+=dX[traceDirection]; } else if (value >= 0) { r+=dY[traceDirection]; c+=dX[traceDirection]; if (!pointAdded) { xCoord=west + (c / colsD) * EWRange; yCoord=north - (r / rowsD) * NSRange; points.addPoint(xCoord,yCoord); } if (value == 1) { temp1.setValue(r,c,0); } else { temp1.setValue(r,c,value - 1); } flag=false; } else { flag=false; } } while (flag); if (points.size() >= minLineLength) { PolyLine poly=new PolyLine(parts,points.getPointsArray()); output.addRecord(poly); Object[] rowData=new Object[2]; rowData[0]=new Double(FID); rowData[1]=new Double(z); writer.addRecord(rowData); } } } if (cancelOp) { cancelOperation(); return; } progress=(int)(100.0 * row / (rows - 1)); updateProgress("Loop 4 of 4:",progress); } temp1.close(); input.close(); output.write(); returnData(outputFile); } 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 { updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
public boolean isErrors(){ return errors; }
method to check if any errors were generated during DITA generation
public CustomSwitchPreference(Context context,AttributeSet attrs){ super(context,attrs); }
Construct a new SwitchPreference with the given style options.
public KerningTable(Kern[] entries){ this.entries=entries; }
Creates a KerningTable from an array of Kern entries.
public static byte[] formatMessageForSigning(String message){ try { ByteArrayOutputStream bos=new ByteArrayOutputStream(); bos.write(BITCOIN_SIGNED_MESSAGE_HEADER_BYTES.length); bos.write(BITCOIN_SIGNED_MESSAGE_HEADER_BYTES); byte[] messageBytes=message.getBytes(Charsets.UTF_8); VarInt size=new VarInt(messageBytes.length); bos.write(size.encode()); bos.write(messageBytes); return bos.toByteArray(); } catch ( IOException e) { throw new RuntimeException(e); } }
<p>Given a textual message, returns a byte buffer formatted as follows:</p> <tt><p>[24] "Bitcoin Signed Message:\n" [message.length as a varint] message</p></tt>
public Scenario(MapEnvironment env,Map agentMap,String agentLoc){ this.agentMap=agentMap; this.env=env; this.initAgentLoc=agentLoc; }
Creates a scenario.
public IpInterfaceRestRep create(URI hostId,IpInterfaceCreateParam input){ return client.post(IpInterfaceRestRep.class,input,PathConstants.IPINTERFACE_BY_HOST_URL,hostId); }
Creates an IP interface for the given host. <p> API Call: <tt>POST /compute/hosts/{hostId}/ip-interfaces</tt>
public Writer write(Writer writer) throws JSONException { return this.write(writer,0,0); }
Write the contents of the JSONObject as JSON text to a writer. For compactness, no whitespace is added. <p> Warning: This method assumes that the data structure is acyclical.
private boolean createTable(MTable mTable,DatabaseMetaData md){ String tableName=mTable.getTableName(); log.info(tableName); String catalog=m_dbSource.getCatalog(); String schema=m_dbSource.getSchema(); String table=tableName.toUpperCase(); MColumn[] columns=mTable.getColumns(false); StringBuffer sb=new StringBuffer("CREATE TABLE "); sb.append(tableName).append(" ("); try { boolean first=true; ResultSet sourceColumns=md.getColumns(catalog,schema,table,null); while (sourceColumns.next()) { sb.append(first ? "" : ", "); first=false; MColumn column=null; String columnName=sourceColumns.getString("COLUMN_NAME"); for (int i=0; i < columns.length; i++) { String cn=columns[i].getColumnName(); if (cn.equalsIgnoreCase(columnName)) { columnName=cn; column=columns[i]; break; } } sb.append(columnName).append(" "); int sqlType=sourceColumns.getInt("DATA_TYPE"); String typeName=sourceColumns.getString("TYPE_NAME"); int size=sourceColumns.getInt("COLUMN_SIZE"); int decDigits=sourceColumns.getInt("DECIMAL_DIGITS"); if (sourceColumns.wasNull()) decDigits=-1; if (typeName.equals("NUMBER")) { int dt=column.getAD_Reference_ID(); if (DisplayType.isID(dt)) sb.append("INTEGER"); else { int scale=DisplayType.getDefaultPrecision(dt); sb.append("DECIMAL(").append(18 + scale).append(",").append(scale).append(")"); } } else if (typeName.equals("DATE") || typeName.equals("BLOB") || typeName.equals("CLOB")) sb.append(typeName); else if (typeName.equals("CHAR") || typeName.startsWith("VARCHAR")) sb.append(typeName).append("(").append(size).append(")"); else if (typeName.startsWith("NCHAR") || typeName.startsWith("NVAR")) sb.append(typeName).append("(").append(size / 2).append(")"); else if (typeName.startsWith("TIMESTAMP")) sb.append("DATE"); else log.severe("Do not support data type " + typeName); String def=sourceColumns.getString("COLUMN_DEF"); if (def != null) { def.replaceAll("''","\\'"); sb.append(" DEFAULT ").append(def); } if (sourceColumns.getInt("NULLABLE") == DatabaseMetaData.columnNoNulls) sb.append(" NOT NULL"); else sb.append(" NULL"); } sourceColumns.close(); ResultSet sourcePK=md.getPrimaryKeys(catalog,schema,table); first=true; boolean hasPK=false; while (sourcePK.next()) { hasPK=true; if (first) sb.append(", CONSTRAINT ").append(sourcePK.getString("PK_NAME")).append(" PRIMARY KEY ("); else sb.append(","); first=false; String columnName=sourcePK.getString("COLUMN_NAME"); sb.append(checkColumnName(columnName)); } if (hasPK) sb.append(")"); sourcePK.close(); sb.append(")"); } catch ( Exception ex) { log.log(Level.SEVERE,"createTable",ex); return false; } if (!executeCommands(new String[]{sb.toString()},m_conn,false,true)) return true; createTableIndexes(mTable,md); return createTableData(mTable); }
Create Table
public ImAdapterFactory(){ if (modelPackage == null) { modelPackage=ImPackage.eINSTANCE; } }
Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc -->
public static int indexOf(Coordinate coordinate,Coordinate[] coordinates){ for (int i=0; i < coordinates.length; i++) { if (coordinate.equals(coordinates[i])) { return i; } } return -1; }
Returns the index of <code>coordinate</code> in <code>coordinates</code>. The first position is 0; the second, 1; etc.
public void addTestSuite(Class<? extends Test> testClass,Validator[] validators){ addTestSuite(testClass,validators,null); }
Add a given test suite.
public void testHttpsConnection_Not_Found_Response() throws Throwable { setUpStoreProperties(); SSLContext ctx=getContext(); ServerSocket ss=ctx.getServerSocketFactory().createServerSocket(0); TestHostnameVerifier hnv=new TestHostnameVerifier(); HttpsURLConnection.setDefaultHostnameVerifier(hnv); URL url=new URL("https://localhost:" + ss.getLocalPort()); HttpsURLConnection connection=(HttpsURLConnection)url.openConnection(); connection.setSSLSocketFactory(ctx.getSocketFactory()); try { doInteraction(connection,ss,NOT_FOUND_CODE); fail("Expected exception was not thrown."); } catch ( FileNotFoundException e) { if (DO_LOG) { System.out.println("Expected exception was thrown: " + e.getMessage()); e.printStackTrace(); } } connection.connect(); }
Tests the behaviour of HTTPS connection in case of unavailability of requested resource.
private void synthesise(String utterance){ String systemSpeechVar=system.getSettings().systemSpeech; SpeechData outputSpeech; if (ttsCache.containsKey(utterance)) { outputSpeech=ttsCache.get(utterance); outputSpeech.rewind(); } else { AudioFormat format=new AudioFormat(16000,16,1,true,false); outputSpeech=new SpeechData(format); new Thread(null).start(); } currentSynthesis.add(outputSpeech); new Thread(null).start(); }
Synthesises the provided utterance (first looking at the cache of existing synthesised speech, and starting the generation if no one is already present).
public HostCandidate(TransportAddress transportAddress,Component parentComponent){ super(transportAddress,parentComponent,CandidateType.HOST_CANDIDATE,CandidateExtendedType.HOST_CANDIDATE,null); this.socket=null; setBase(this); }
Creates a HostCandidate for the specified transport address.
public void applyQueryTimeout(Statement stmt){ if (hasQueryTimeout()) { try { stmt.setQueryTimeout(getQueryTimeoutInSeconds()); } catch ( SQLException e) { throw new JDBCException("failed to setQueryTimeout to :" + getQueryTimeoutInSeconds(),e,e.getSQLState()); } } }
Apply the current query timeout, if any, to the current <code>Statement</code>.
public static SRegResponse createFetchResponse(){ return new SRegResponse(); }
Constructs a SReg Response with an empty parameter list.
public static UPSCoord fromLatLon(Angle latitude,Angle longitude){ if (latitude == null || longitude == null) { throw new IllegalArgumentException("Latitude Or Longitude Is Null"); } final UPSCoordConverter converter=new UPSCoordConverter(); long err=converter.convertGeodeticToUPS(latitude.radians,longitude.radians); if (err != UPSCoordConverter.UPS_NO_ERROR) { throw new IllegalArgumentException("UPS Conversion Error"); } return new UPSCoord(latitude,longitude,converter.getHemisphere(),converter.getEasting(),converter.getNorthing()); }
Create a set of UPS coordinates from a pair of latitude and longitude for the given <code>Globe</code>.