code
stringlengths
10
174k
nl
stringlengths
3
129k
public SimpleDate(java.sql.Time time){ this(time,TIME); }
Creates a new date model wrapping the specified time object and having TIME type.
public String[] convertTypeNamesToSigs(char[][] typeNames){ if (typeNames == null) return CharOperation.NO_STRINGS; int n=typeNames.length; if (n == 0) return CharOperation.NO_STRINGS; String[] typeSigs=new String[n]; for (int i=0; i < n; ++i) { char[] typeSig=Signature.createCharArrayTypeSignature(typeNames[i],false); StringBuffer simpleTypeSig=null; int start=0; int dot=-1; int length=typeSig.length; for (int j=0; j < length; j++) { switch (typeSig[j]) { case Signature.C_UNRESOLVED: if (simpleTypeSig != null) simpleTypeSig.append(typeSig,start,j - start); start=j; break; case Signature.C_DOT: dot=j; break; case Signature.C_GENERIC_START: int matchingEnd=findMatchingGenericEnd(typeSig,j + 1); if (matchingEnd > 0 && matchingEnd + 1 < length && typeSig[matchingEnd + 1] == Signature.C_DOT) { if (simpleTypeSig == null) simpleTypeSig=new StringBuffer().append(typeSig,0,start); simpleTypeSig.append(Signature.C_UNRESOLVED); start=j=matchingEnd + 2; break; } case Signature.C_NAME_END: if (dot > start) { if (simpleTypeSig == null) simpleTypeSig=new StringBuffer().append(typeSig,0,start); simpleTypeSig.append(Signature.C_UNRESOLVED); simpleTypeSig.append(typeSig,dot + 1,j - dot - 1); start=j; } break; } } if (simpleTypeSig == null) { typeSigs[i]=new String(typeSig); } else { simpleTypeSig.append(typeSig,start,length - start); typeSigs[i]=simpleTypeSig.toString(); } } return typeSigs; }
NOT API, public only for access by Unit tests. Converts these type names to unqualified signatures. This needs to be done in order to be consistent with the way the source range is retrieved.
public static long parseLongBase10(final CharSequence str){ return parseLongBase10(str,0,str.length()); }
Parse a long integer from a character sequence.
public void testIsValidUtf8_3Bytes() throws UnsupportedEncodingException { IsValidUtf8TestUtil.testBytes(3,IsValidUtf8TestUtil.EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT); }
Tests that round tripping of all three byte permutations work.
final public void halted(){ if (halt) { throw new RuntimeException(firstCause.get()); } }
Return unless processing has been halted.
@Override public void onMessageReceived(String from,Bundle data){ JSONObject jsonObject=new JSONObject(); final Set<String> keys=data.keySet(); for ( String key : keys) { try { jsonObject.put(key,data.getString(key)); } catch ( JSONException e) { e.printStackTrace(); } } Log.d(TAG,"Sending JSON:" + jsonObject.toString()); sendNotification(jsonObject); }
Called when message is received.
public PaddedBufferedBlockCipher(BlockCipher cipher){ this(cipher,new PKCS7Padding()); }
Create a buffered block cipher PKCS7 padding
@Override public String basePath(){ return "/wm/firewall"; }
Set the base path for the Firewall
public h2 addElement(String element){ addElementToRegistry(element); return (this); }
Adds an Element to the element.
public static RobotParser createEager(final RobotProjectHolder projectHolder){ RobotParserConfig cfg=new RobotParserConfig(); cfg.setEagerImport(true); return create(projectHolder,cfg); }
Creates parser which eagerly parses given file with all dependent resources (resource files, variables)
private void state2() throws IOException { int[] selectionIds=readList(new File(filePrefix + "sel")); int[] archivedIds=readList(new File(filePrefix + "arc")); int[] variationIds=new int[lambda]; if (selectionIds.length != mu) { throw new IOException("invalid selection length"); } updatePopulation(archivedIds); clearFile(new File(filePrefix + "sel")); clearFile(new File(filePrefix + "arc")); List<Solution> offspring=new ArrayList<Solution>(); for (int i=0; i < mu; i+=variation.getArity()) { Solution[] parents=new Solution[variation.getArity()]; for (int j=0; j < variation.getArity(); j++) { parents[j]=solutions.get(selectionIds[i + j]); } offspring.addAll(Arrays.asList(variation.evolve(parents))); } if (offspring.size() != lambda) { throw new IOException("invalid variation length"); } evaluateAll(offspring); for (int i=0; i < lambda; i++) { variationIds[i]=addToPopulation(offspring.get(i)); } writePopulation(new File(filePrefix + "var"),variationIds); }
The commands to execute when in state 2.
public void checkAllExcludingMetaData(){ getRoot().clear(Port.CLEAR_METADATA | Port.CLEAR_SIMPLE_ERRORS); if (isEnabled()) { checkOperator(); propagateDirtyness(); } updateExecutionOrder(); }
As check all, but does not check the meta data for performance reasons.
public Script in(String name,Object value){ return in(name,value,null); }
Register an input (parameter ($) or variable).
public void testImbalancedMultivariateMIforRandomVariablesFromFile() throws Exception { ArrayFileReader afr=new ArrayFileReader("demos/data/4randomCols-1.txt"); double[][] data=afr.getDouble2DMatrix(); int[] kNNs={1,2,3,4,5,6,10,15}; double[] expectedFromMILCA={0.02473475,0.00404451,-0.00454679,-0.00737512,-0.00464896,-0.00610772,-0.00881741,-0.01306668}; System.out.println("Kraskov comparison 4 - multivariate random data 2 (1 var to 3 vars)"); checkMIForGivenData(MatrixUtils.selectColumns(data,new int[]{0}),MatrixUtils.selectColumns(data,new int[]{1,2,3}),kNNs,expectedFromMILCA); }
Test the computed multivariate MI against that calculated by Kraskov's own MILCA tool on the same data. To run Kraskov's tool (http://www.klab.caltech.edu/~kraskov/MILCA/) for this data, run: ./MIxnyn <dataFile> 1 3 3000 <kNearestNeighbours> 0
public static WriterThread create(Database database,int writeDelay){ try { WriterThread writer=new WriterThread(database,writeDelay); writer.thread=new Thread(writer,"H2 Log Writer " + database.getShortName()); Driver.setThreadContextClassLoader(writer.thread); writer.thread.setDaemon(true); return writer; } catch ( AccessControlException e) { return null; } }
Create and start a new writer thread for the given database. If the thread can't be created, this method returns null.
public Object methodException(Class claz,String method,Exception e) throws Exception { if (exceptionSwitch && method.equals("throwException")) { return "handler"; } throw e; }
Handles exceptions thrown during in-template method access
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:29:21.453 -0500",hash_original_method="8ECFF7D6DBED10855DA2C653047584D7",hash_generated_method="026A77FBF5B5886FDF2CB0009853C72D") public boolean commitCorrection(CorrectionInfo correctionInfo){ return false; }
Default implementation does nothing and returns false.
public void cancel(){ canceled=true; if (engine != null) engine.cancel(); }
Cancels the request, if possible. Requests that are already complete cannot be canceled.
public void body(String namespace,String name,String text) throws Exception { }
<p>No body processing is required.</p>
public AccumuloQueryRuleset(final RdfCloudTripleStoreConfiguration conf) throws IOException, QueryRulesetException { super(conf); ryaContext=RyaTripleContext.getInstance(conf); for ( final CopyRule rule : rules) { final StatementPattern sp=rule.getStatement(); final Map.Entry<TABLE_LAYOUT,ByteRange> entry=getRange(sp); final TABLE_LAYOUT layout=entry.getKey(); final ByteRange byteRange=entry.getValue(); final Range range=new Range(new Text(byteRange.getStart()),new Text(byteRange.getEnd())); if (!tableRanges.containsKey(layout)) { tableRanges.put(layout,new LinkedList<Range>()); } tableRanges.get(layout).add(range); } }
Constructs the ruleset and the associated Ranges, given a Configuration that contains a SPARQL query.
public void multiply(Complex multiplier){ float inphase=multiplyInphase(inphase(),quadrature(),multiplier.inphase(),multiplier.quadrature()); float quadrature=multiplyQuadrature(inphase(),quadrature(),multiplier.inphase(),multiplier.quadrature()); mLeft=inphase; mRight=quadrature; }
Multiplies this sample by the multiplier sample
@Override public void onTokenRefresh(){ SettingsMy.setTokenSentToServer(false); Intent intent=new Intent(this,MyRegistrationIntentService.class); startService(intent); }
Called if InstanceID token is updated. This may occur if the security of the previous token had been compromised. This call is initiated by the InstanceID provider.
BoxLayout(Container target,int axis,PrintStream dbg){ this(target,axis); this.dbg=dbg; }
Constructs a BoxLayout that produces debugging messages.
public HadoopIgfsInputStream(HadoopIgfsStreamDelegate delegate,long limit,int bufSize,Log log,IgfsLogger clientLog,long logStreamId){ assert limit >= 0; this.delegate=delegate; this.limit=limit; this.log=log; this.clientLog=clientLog; this.logStreamId=logStreamId; bufHalfSize=Math.max(bufSize,MIN_BUF_SIZE); lastTs=System.nanoTime(); delegate.hadoop().addEventListener(delegate,this); }
Creates input stream.
public void checkAndHandleFirstVisibleCellChange(){ if (mCurrentFirstVisibleItem != mPreviousFirstVisibleItem) { if (mCellIsMobile && mMobileItemId != INVALID_ID) { updateNeighborViewsForID(mMobileItemId); handleCellSwitch(); } } }
Determines if the listview scrolled up enough to reveal a new cell at the top of the list. If so, then the appropriate parameters are updated.
private Util(){ }
Creates new Util
public String doubleMetaphone(String value){ return doubleMetaphone(value,false); }
Encode a value with Double Metaphone
static Object[] toArray(Iterable<?> iterable){ return castOrCopyToCollection(iterable).toArray(); }
Copies an iterable's elements into an array.
@Override protected EClass eStaticClass(){ return EipPackage.Literals.ADAPTER; }
<!-- begin-user-doc --> <!-- end-user-doc -->
static private void loadPropertiesJar(URL resource,String path){ JarURLConnection jarConn; JarFile jar=null; try { jarConn=(JarURLConnection)resource.openConnection(); jar=jarConn.getJarFile(); Enumeration<JarEntry> e=jar.entries(); while (e.hasMoreElements()) { JarEntry entry=e.nextElement(); if (entry.getName().startsWith(path + "/" + PROPERTIES_PREFIX) && entry.getName().endsWith(PROPERTIES_SUFFIX)) { Properties props=new Properties(); props.load(jar.getInputStream(entry)); definitions.add(loadDefinition(props)); } } } catch ( IOException e) { log.log(Level.SEVERE,"loadPropertiesJar(): Error loading definition {0}",resource); log.log(Level.SEVERE,"loadPropertiesJar(): Error loading definition...",e); } finally { try { if (jar != null) { jar.close(); } } catch ( IOException e) { } } }
Private method that load the properties file from a JAR file. The JAR is iterated searching for the definition files and the definitions are loaded.
public static String encodeBytes(byte[] source,int off,int len){ String encoded=null; try { encoded=encodeBytes(source,off,len,NO_OPTIONS); } catch ( java.io.IOException ex) { assert false : ex.getMessage(); } assert encoded != null; return encoded; }
Encodes a byte array into Base64 notation. Does not GZip-compress data. <p>As of v 2.3, if there is an error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it.</p>
private boolean pathMatch(URL realmUrl,URL returnToUrl){ String realmPath=realmUrl.getPath(); String returnToPath=returnToUrl.getPath(); if (!realmPath.endsWith("/")) realmPath+="/"; if (!returnToPath.endsWith("/")) returnToPath+="/"; return returnToPath.startsWith(realmPath); }
Does the URL's path equal to or a sub-directory of the realm's path.
public static void assertEquals(final Object[] a,final Object[] b){ if (equals(a,b)) { return; } final String msg="Expected: " + Arrays.toString(a) + " Actual:"+ Arrays.toString(b); Assert.fail(msg); }
Check if two arrays are equal - if not then print a message displaying them.
public CheckedInputStream(InputStream in,Checksum cksum){ super(in); this.cksum=cksum; }
Creates an input stream using the specified Checksum.
protected void flushChangeRecords() throws IOException { if (!initialStyles) { writeInitialStyles(); initialStyles=true; } writeChangeRecord(); outstandingChanges=false; }
Description of the Method
@Override public boolean add(final T entry){ final Element<T> element=new Element<T>(entry); element.next=null; if (head == null) { if (VM.VerifyAssertions) VM._assert(tail == null); head=element; element.prev=null; } else { tail.next=element; element.prev=tail; } tail=element; count++; return true; }
Insert at the tail of the list
public static final String createMsg(ListResourceBundle fResourceBundle,String msgKey,Object args[]){ String fmsg=null; boolean throwex=false; String msg=null; if (msgKey != null) msg=fResourceBundle.getString(msgKey); if (msg == null) { msg=fResourceBundle.getString(BAD_CODE); throwex=true; } if (args != null) { try { int n=args.length; for (int i=0; i < n; i++) { if (null == args[i]) args[i]=""; } fmsg=java.text.MessageFormat.format(msg,args); } catch ( Exception e) { fmsg=fResourceBundle.getString(FORMAT_FAILED); fmsg+=" " + msg; } } else fmsg=msg; if (throwex) { throw new RuntimeException(fmsg); } return fmsg; }
Creates a message from the specified key and replacement arguments, localized to the given locale.
public boolean handleKeyEventIfNecessary(KeyEvent event){ if (!isAccessibilityEnabled()) { mAccessibilityScriptInjected=false; toggleFallbackAccessibilityInjector(false); return false; } if (mAccessibilityScriptInjected) { if (event.getAction() == KeyEvent.ACTION_UP) { mWebViewClassic.sendBatchableInputMessage(EventHub.KEY_UP,0,0,event); } else if (event.getAction() == KeyEvent.ACTION_DOWN) { mWebViewClassic.sendBatchableInputMessage(EventHub.KEY_DOWN,0,0,event); } else { return false; } return true; } if (mAccessibilityInjectorFallback != null) { return mAccessibilityInjectorFallback.onKeyEvent(event); } return false; }
Attempts to handle key events when accessibility is turned on.
protected boolean[] canHandleZeroTraining(boolean nominalPredictor,boolean numericPredictor,boolean stringPredictor,boolean datePredictor,boolean relationalPredictor,boolean multiInstance,int classType){ print("handle zero training instances"); printAttributeSummary(nominalPredictor,numericPredictor,stringPredictor,datePredictor,relationalPredictor,multiInstance,classType); print("..."); ArrayList<String> accepts=new ArrayList<String>(); accepts.add("train"); accepts.add("value"); int numTrain=0, numClasses=2, missingLevel=0; boolean predictorMissing=false, classMissing=false; return runBasicTest(nominalPredictor,numericPredictor,stringPredictor,datePredictor,relationalPredictor,multiInstance,classType,missingLevel,predictorMissing,classMissing,numTrain,numClasses,accepts); }
Checks whether the scheme can handle zero training instances.
@HLEFunction(nid=0xA62C6F57,version=150,checkInsideInterrupt=true) public int sceNetAdhocTerm(){ isInitialized=false; return 0; }
Terminate the adhoc library
public String toString(){ return getClass().getName() + "[hgap=" + hgap+ ",vgap="+ vgap+ "]"; }
Returns a string representation of the state of this card layout.
public void stop(BundleContext context) throws Exception { super.stop(context); plugin=null; }
This method is called when the plug-in is stopped
private <LP extends ViewGroup.LayoutParams>Chopstick isInLayout(Class<LP> layoutParamsType,boolean useExistingLayoutParams,int width,int height){ LP lp=useExistingLayoutParams ? useExistingLayoutParams(layoutParamsType) : useNewLayoutParams(layoutParamsType,width,height); if (RelativeLayout.LayoutParams.class.equals(layoutParamsType)) { return new RelativeLayoutStick((RelativeLayout.LayoutParams)lp,mView); } else if (LinearLayout.LayoutParams.class.equals(layoutParamsType)) { return new LinearLayoutStick((LinearLayout.LayoutParams)lp,mView); } throw new UnsupportedOperationException("This Layout is not currently supported. A PR is welcome!"); }
Choose the right builder stick according to layout params type
private static void restoreAttributes(RestorableSupport restorableSupport,RestorableSupport.StateObject context,AnnotationAttributes dest){ Map<String,String> legacySupport=new HashMap<String,String>(); legacySupport.put("render.Annotation.RepeatNone",AVKey.REPEAT_NONE); legacySupport.put("render.Annotation.RepeatX",AVKey.REPEAT_X); legacySupport.put("render.Annotation.RepeatY",AVKey.REPEAT_Y); legacySupport.put("render.Annotation.RepeatXY",AVKey.REPEAT_XY); legacySupport.put("render.Annotation.SizeFixed",AVKey.SIZE_FIXED); legacySupport.put("render.Annotation.SizeFitText",AVKey.SIZE_FIT_TEXT); legacySupport.put("Render.FrameFactory.ShapeRectangle",AVKey.SHAPE_RECTANGLE); legacySupport.put("Render.FrameFactory.ShapeEllipse",AVKey.SHAPE_ELLIPSE); legacySupport.put("Render.FrameFactory.ShapeNone",AVKey.SHAPE_NONE); legacySupport.put("Render.FrameFactory.LeaderTriangle",AVKey.SHAPE_TRIANGLE); legacySupport.put("Render.FrameFactory.LeaderNone",AVKey.SHAPE_NONE); if (restorableSupport == null || dest == null) throw new IllegalArgumentException(); String frameShapeState=restorableSupport.getStateValueAsString(context,"frameShape"); if (frameShapeState != null) { String updatedValue=legacySupport.get(frameShapeState); if (updatedValue != null) frameShapeState=updatedValue; dest.setFrameShape(frameShapeState); } Boolean highlightedState=restorableSupport.getStateValueAsBoolean(context,"highlighted"); if (highlightedState != null) dest.setHighlighted(highlightedState); Double highlightScaleState=restorableSupport.getStateValueAsDouble(context,"highlightScale"); if (highlightScaleState != null) dest.setHighlightScale(highlightScaleState); RestorableSupport.StateObject sizeStateObj=restorableSupport.getStateObject(context,"size"); if (sizeStateObj != null) { Double widthState=restorableSupport.getStateValueAsDouble(sizeStateObj,"width"); Double heightState=restorableSupport.getStateValueAsDouble(sizeStateObj,"height"); if (widthState != null && heightState != null) dest.setSize(new Dimension(widthState.intValue(),heightState.intValue())); } Double scaleState=restorableSupport.getStateValueAsDouble(context,"scale"); if (scaleState != null) dest.setScale(scaleState); Double opacityState=restorableSupport.getStateValueAsDouble(context,"opacity"); if (opacityState != null) dest.setOpacity(opacityState); String leaderState=restorableSupport.getStateValueAsString(context,"leader"); if (leaderState != null) { String updatedValue=legacySupport.get(leaderState); if (updatedValue != null) leaderState=updatedValue; dest.setLeader(leaderState); } Integer leaderGapWidthState=restorableSupport.getStateValueAsInteger(context,"leaderGapWidth"); if (leaderGapWidthState != null) dest.setLeaderGapWidth(leaderGapWidthState); Integer cornerRadiusState=restorableSupport.getStateValueAsInteger(context,"cornerRadius"); if (cornerRadiusState != null) dest.setCornerRadius(cornerRadiusState); String adjustWidthToTextState=restorableSupport.getStateValueAsString(context,"adjustWidthToText"); if (adjustWidthToTextState != null) { String updatedValue=legacySupport.get(adjustWidthToTextState); if (updatedValue != null) adjustWidthToTextState=updatedValue; dest.setAdjustWidthToText(adjustWidthToTextState); } RestorableSupport.StateObject drawOffsetStateObj=restorableSupport.getStateObject(context,"drawOffset"); if (drawOffsetStateObj != null) { Double xState=restorableSupport.getStateValueAsDouble(drawOffsetStateObj,"x"); Double yState=restorableSupport.getStateValueAsDouble(drawOffsetStateObj,"y"); if (xState != null && yState != null) dest.setDrawOffset(new Point(xState.intValue(),yState.intValue())); } RestorableSupport.StateObject insetsStateObj=restorableSupport.getStateObject(context,"insets"); if (insetsStateObj != null) { Integer topState=restorableSupport.getStateValueAsInteger(insetsStateObj,"top"); Integer leftState=restorableSupport.getStateValueAsInteger(insetsStateObj,"left"); Integer bottomState=restorableSupport.getStateValueAsInteger(insetsStateObj,"bottom"); Integer rightState=restorableSupport.getStateValueAsInteger(insetsStateObj,"right"); if (topState != null && leftState != null && bottomState != null && rightState != null) dest.setInsets(new Insets(topState,leftState,bottomState,rightState)); } Double borderWidthState=restorableSupport.getStateValueAsDouble(context,"borderWidth"); if (borderWidthState != null) dest.setBorderWidth(borderWidthState); Integer borderStippleFactorState=restorableSupport.getStateValueAsInteger(context,"borderStippleFactor"); if (borderStippleFactorState != null) dest.setBorderStippleFactor(borderStippleFactorState); Integer borderStipplePatternState=restorableSupport.getStateValueAsInteger(context,"borderStipplePattern"); if (borderStipplePatternState != null) dest.setBorderStipplePattern(borderStipplePatternState.shortValue()); Integer antiAliasHintState=restorableSupport.getStateValueAsInteger(context,"antiAliasHint"); if (antiAliasHintState != null) dest.setAntiAliasHint(antiAliasHintState); Boolean visibleState=restorableSupport.getStateValueAsBoolean(context,"visible"); if (visibleState != null) dest.setVisible(visibleState); RestorableSupport.StateObject fontStateObj=restorableSupport.getStateObject(context,"font"); if (fontStateObj != null) { String nameState=restorableSupport.getStateValueAsString(fontStateObj,"name"); Integer styleState=restorableSupport.getStateValueAsInteger(fontStateObj,"style"); Integer sizeState=restorableSupport.getStateValueAsInteger(fontStateObj,"size"); if (nameState != null && styleState != null && sizeState != null) dest.setFont(new Font(nameState,styleState,sizeState)); } String textAlignState=restorableSupport.getStateValueAsString(context,"textAlign"); if (textAlignState != null) { Integer textAlignInt=WWUtil.makeInteger(textAlignState); if (textAlignInt != null) { dest.setTextAlign(textAlignInt == 0 ? AVKey.LEFT : (textAlignInt == 1 ? AVKey.CENTER : AVKey.RIGHT)); } else { dest.setTextAlign(textAlignState); } } String textColorState=restorableSupport.getStateValueAsString(context,"textColor"); if (textColorState != null) { Color color=RestorableSupport.decodeColor(textColorState); if (color != null) dest.setTextColor(color); } String backgroundColorState=restorableSupport.getStateValueAsString(context,"backgroundColor"); if (backgroundColorState != null) { Color color=RestorableSupport.decodeColor(backgroundColorState); if (color != null) dest.setBackgroundColor(color); } String borderColorState=restorableSupport.getStateValueAsString(context,"borderColor"); if (borderColorState != null) { Color color=RestorableSupport.decodeColor(borderColorState); if (color != null) dest.setBorderColor(color); } String imagePathState=restorableSupport.getStateValueAsString(context,"imagePath"); if (imagePathState != null) dest.setImageSource(imagePathState); Double imageScaleState=restorableSupport.getStateValueAsDouble(context,"imageScale"); if (imageScaleState != null) dest.setImageScale(imageScaleState); RestorableSupport.StateObject imageOffsetStateObj=restorableSupport.getStateObject(context,"imageOffset"); if (imageOffsetStateObj != null) { Double xState=restorableSupport.getStateValueAsDouble(imageOffsetStateObj,"x"); Double yState=restorableSupport.getStateValueAsDouble(imageOffsetStateObj,"y"); if (xState != null && yState != null) dest.setImageOffset(new Point(xState.intValue(),yState.intValue())); } Double imageOpacityState=restorableSupport.getStateValueAsDouble(context,"imageOpacity"); if (imageOpacityState != null) dest.setImageOpacity(imageOpacityState); String imageRepeatState=restorableSupport.getStateValueAsString(context,"imageRepeat"); if (imageRepeatState != null) { String updatedValue=legacySupport.get(imageRepeatState); if (updatedValue != null) imageRepeatState=updatedValue; dest.setImageRepeat(imageRepeatState); } Double distanceMinScaleState=restorableSupport.getStateValueAsDouble(context,"distanceMinScale"); if (distanceMinScaleState != null) dest.setDistanceMinScale(distanceMinScaleState); Double distanceMaxScaleState=restorableSupport.getStateValueAsDouble(context,"distanceMaxScale"); if (distanceMaxScaleState != null) dest.setDistanceMaxScale(distanceMaxScaleState); Double distanceMinOpacityState=restorableSupport.getStateValueAsDouble(context,"distanceMinOpacity"); if (distanceMinOpacityState != null) dest.setDistanceMinOpacity(distanceMinOpacityState); String effectState=restorableSupport.getStateValueAsString(context,"effect"); if (effectState != null) dest.setEffect(effectState); }
Restores the any attributes appearing in the specified <code>restorableSupport</code>. If <code>context</code> is not null, this will search for attributes beneath it. Otherwise, this will search for attributes beneath the document root.
public static void cleanupEpisodes(@NonNull Context context,int stateFilter){ Intent intent=new Intent(context,BackgroundOperations.class); intent.setAction(ACTION_CLEANUP_EPISODES); intent.putExtra(EXTRA_EPISODE_STATE,stateFilter); context.startService(intent); }
deletes episodes whose state == stateFilter
public LogicalOrExpressionItemProvider(AdapterFactory adapterFactory){ super(adapterFactory); }
This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
public final void deOp(String channel,String nick){ this.setMode(channel,"-o " + nick); }
Removes operator privilidges from a user on a channel. Successful use of this method may require the bot to have operator status itself.
@DSSource({DSSourceKind.IO}) @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:54.177 -0400",hash_original_method="FC7B978EE0A26C67A4BDA439F3CC27AC",hash_generated_method="4C11E730871E3160CA9C54C34573C65F") public static byte[] toByteArray(URI uri) throws IOException { return IOUtils.toByteArray(uri.toURL()); }
Get the contents of a <code>URI</code> as a <code>byte[]</code>.
public Response onCommand(SMTPSession session,Request request){ return doRSET(session,request.getArgument()); }
handles RSET command
private ObjectName cloneObjectName(ObjectName name){ if (name != null) { return ObjectName.getInstance(name); } return name; }
Clone object name.
private Promise<OwnIdentity> fetchOwnIdentity(){ return Promise.success(new OwnIdentity(ownKeys.getKeyGroupId(),ownKeys.getIdentityKey())); }
Fetching Own Identity key and group id
public JSONArray optJSONArray(int index){ Object o=this.opt(index); return o instanceof JSONArray ? (JSONArray)o : null; }
Get the optional JSONArray associated with an index.
public GenericFeed retrieveNextPage(Link next) throws AppsForYourDomainException, MalformedURLException, IOException, ServiceException { return service.getFeed(new URL(next.getHref()),GenericFeed.class); }
Retrieves a single page of entries given an atom:link.
@Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup,int i){ View view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_item,viewGroup,false); ViewHolder viewHolder=new ViewHolder(view); return viewHolder; }
Create View holder
public BinaryProperty(String url,T type){ setUrl(url,type); }
Creates a binary property.
public IntIterator columnRows(int col,boolean reverse){ return new ColumnRowIterator(rows(reverse),col); }
Return an iterator over column row indices.
public static <O>Map<String,Attribute<O,Comparable>> generateAttributesForPojo(Class<O> pojoClass){ Map<String,Attribute<O,Comparable>> generatedAttributes=new LinkedHashMap<String,Attribute<O,Comparable>>(); for ( Field field : pojoClass.getDeclaredFields()) { if (Comparable.class.isAssignableFrom(field.getType())) { @SuppressWarnings({"unchecked"}) Class<Comparable> fieldType=(Class<Comparable>)field.getType(); generatedAttributes.put(field.getName(),ReflectiveAttribute.forField(pojoClass,fieldType,field.getName())); } } return generatedAttributes; }
Generates attributes dynamically for the fields declared in the given POJO class. <p/> Implementation is currently limited to generating attributes for Comparable fields (String, Integer etc.).
public void addBannedUsername(final String username){ addBannedUsername(username,null); }
Ban the username permanently
private List obtenerListaEntidades(){ try { ServicioEntidades oServicio=LocalizadorServicios.getServicioEntidades(); List oLista=oServicio.obtenerEntidades(); return getEntidades(oLista); } catch ( Exception e) { return new ArrayList(); } }
Obtiene la lista de entidades del sistema SIGEM
private String commandGet(String[] parameters){ if (parameters.length == 1) { String name=parameters[0].trim(); AddressbookEntry entry=get(name); if (entry == null) { return "No entry for '" + name + "'."; } return "'" + name + "' has categories "+ categoriesToString(entry.getCategories())+ "."; } else { return "Get: Invalid number of parameters."; } }
Display the categories for this name, if it exists.
public final void propertyChange(final PropertyChangeEvent e){ if (LOG.isDebugEnabled()) { LOG.debug("enter: propertyChange(" + e + ")"); } if (!FOCUSED_WINDOW_PROPERTY.equals(e.getPropertyName())) { throw new IllegalArgumentException("unknown property name: " + e.getPropertyName()); } synchronized (myLock) { final Window window=(Window)e.getNewValue(); if (window == null || ApplicationManager.getApplication().isDisposed()) { return; } if (!myWindow2Info.containsKey(window)) { myWindow2Info.put(window,new WindowInfo(window,true)); } myFocusedWindow=window; final Project project=CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myFocusedWindow)); for (Iterator i=myFocusedWindows.iterator(); i.hasNext(); ) { final Window w=(Window)i.next(); final DataContext dataContext=DataManager.getInstance().getDataContext(w); if (project == CommonDataKeys.PROJECT.getData(dataContext)) { i.remove(); } } myFocusedWindows.add(myFocusedWindow); final IdeFrameImpl frame; if (window instanceof IdeFrameImpl) { frame=(IdeFrameImpl)window; } else { frame=(IdeFrameImpl)SwingUtilities.getAncestorOfClass(IdeFrameImpl.class,window); } if (frame != null) { JOptionPane.setRootFrame(frame); } } if (LOG.isDebugEnabled()) { LOG.debug("exit: propertyChange()"); } }
This method should get notifications abount changes of focused window. Only <code>focusedWindow</code> property is acceptable.
public EnumValueType clone(){ EnumValueType result=new EnumValueType(); result.Value=Value; result.DisplayName=DisplayName; result.Description=Description; return result; }
Deep clone
protected void sendFree(int option) throws IOException, SQLException { final XdrOutputStream xdrOut=getXdrOut(); xdrOut.writeInt(WireProtocolConstants.op_free_statement); xdrOut.writeInt(getHandle()); xdrOut.writeInt(option); }
Sends the free statement to the database
public @Test final void testCreation(){ Role role=new Role(TEST_ROLE,TEST_DESCR); assertThat(role.getName()).isEqualTo(TEST_ROLE); Assert.assertEquals(TEST_DESCR,role.getDescription()); Role role2=new Role(TEST_ROLE2); Assert.assertEquals(TEST_ROLE2,role2.getName()); }
Simple POJOS test to test setters only.
public Point screenToChartCoord(int x,int y){ if (currentTransform != null) { Transform inverse=currentTransform.getInverse(); float[] pt=inverse.transformPoint(new float[]{x,y,0}); x=(int)pt[0]; y=(int)pt[1]; } return new Point(x - getAbsoluteX(),y - getAbsoluteY()); }
Converts screen coordinates to chart coordinates.
public synchronized void updateServerBucketProfile(BucketProfile p){ this.localProfile=p; }
Only for local profile.
private void updateUnmanagedBackendVolumesInParent(){ if (!getUnmanagedBackendVolumes().isEmpty()) { StringSet bvols=new StringSet(); for ( UnManagedVolume backendVol : unmanagedBackendVolumes) { bvols.add(backendVol.getNativeGuid()); StringSet parentVol=new StringSet(); parentVol.add(_unmanagedVirtualVolume.getNativeGuid()); backendVol.putVolumeInfo(SupportedVolumeInformation.VPLEX_PARENT_VOLUME.name(),parentVol); if (isDistributed()) { VPlexStorageVolumeInfo storageVolume=getBackendVolumeWwnToInfoMap().get(backendVol.getWwn()); if (null != storageVolume) { String clusterId=getClusterLocationForStorageVolume(storageVolume); if (null != clusterId && !clusterId.isEmpty()) { _logger.info("setting VPLEX_BACKEND_CLUSTER_ID: " + clusterId); StringSet clusterIds=new StringSet(); clusterIds.add(clusterId); backendVol.putVolumeInfo(SupportedVolumeInformation.VPLEX_BACKEND_CLUSTER_ID.name(),clusterIds); } } } _dbClient.updateObject(backendVol); } if (bvols != null && !bvols.isEmpty()) { _logger.info("setting VPLEX_BACKEND_VOLUMES: " + unmanagedBackendVolumes); _unmanagedVirtualVolume.putVolumeInfo(SupportedVolumeInformation.VPLEX_BACKEND_VOLUMES.name(),bvols); _unmanagedVirtualVolume.setLabel(getFriendlyLabel()); } } }
Sets the VPLEX_BACKEND_VOLUMES information on the virtual UnManagedVolume as well as the VPLEX_PARENT_VOLUME and VPLEX_BACKEND_CLUSTER_ID on each associated UnManagedVolume.
private Base64(){ }
Defeats instantiation.
public DataSource<Void> prefetchToBitmapCache(ImageRequest imageRequest,Object callerContext){ if (!mIsPrefetchEnabledSupplier.get()) { return DataSources.immediateFailedDataSource(PREFETCH_EXCEPTION); } try { Producer<Void> producerSequence=mProducerSequenceFactory.getDecodedImagePrefetchProducerSequence(imageRequest); return submitPrefetchRequest(producerSequence,imageRequest,ImageRequest.RequestLevel.FULL_FETCH,callerContext); } catch ( Exception exception) { return DataSources.immediateFailedDataSource(exception); } }
Submits a request for prefetching to the bitmap cache.
public void addLabelOffset(int hash,int offset,int cid){ int bucketIndex=indexFor(hash,this.capacity); addEntry(offset,cid,hash,bucketIndex); }
This method does not check if the same value is already in the map because we pass in an char-array offset, so so we now that we're in resize-mode here.
public SigningFailsInServerProxy(){ requestFileName="getstate.query"; responseFile="getstate.answer"; }
Constructs the test case.
public static WindowActionEvent createWindowClosedEvent(){ return new WindowActionEvent(null,WindowAction.CLOSED); }
Creates a Window Closed Event.
public Point center(){ return rect.center; }
Get the center of the ellipse
public void run(){ try { accept(); } catch ( CancelException e) { } finally { try { if (this.serverSock != null) { this.serverSock.close(); } } catch ( IOException ignore) { } if (this.stats != null) { this.stats.close(); } } }
The work loop of this acceptor
public Cache(int pref_size,int size){ cache_size=size; prefix_size=pref_size; hashes=new long[cache_size]; hashes_idx=new long[cache_size]; encodings=new byte[cache_size][]; cache=new Object[cache_size]; }
Creates the Cache object.
@Interruptible public static void init(){ nextLockIndex=1; locks=new Lock[LOCK_SPINE_SIZE][]; for (int i=0; i < INITIAL_CHUNKS; i++) { chunksAllocated++; locks[i]=new Lock[LOCK_CHUNK_SIZE]; } if (VM.VerifyAssertions) { VM._assert(((MAX_LOCKS - 1) <= TL_LOCK_ID_MASK.rshl(TL_LOCK_ID_SHIFT).toInt()) || TL_LOCK_ID_MASK.EQ(Word.fromIntSignExtend(-1))); } }
Sets up the data structures for holding heavy-weight locks.
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); if (getUIClassID().equals(uiClassID)) { updateUI(); } }
See JComponent.readObject() for information about serialization in Swing.
protected String doIt() throws Exception { MWFActivity activity=new MWFActivity(getCtx(),p_AD_WF_Activity_ID,get_TrxName()); log.info("doIt - " + activity); MUser user=MUser.get(getCtx(),getAD_User_ID()); if (p_IsAbort) { String msg=user.getName() + ": Abort"; activity.setTextMsg(msg); activity.setAD_User_ID(getAD_User_ID()); activity.setProcessed(true); activity.setWFState(StateEngine.STATE_Aborted); return msg; } String msg=null; if (p_AD_User_ID != 0 && activity.getAD_User_ID() != p_AD_User_ID) { MUser from=MUser.get(getCtx(),activity.getAD_User_ID()); MUser to=MUser.get(getCtx(),p_AD_User_ID); msg=user.getName() + ": " + from.getName()+ " -> "+ to.getName(); activity.setTextMsg(msg); activity.setAD_User_ID(p_AD_User_ID); } if (p_AD_WF_Responsible_ID != 0 && activity.getAD_WF_Responsible_ID() != p_AD_WF_Responsible_ID) { MWFResponsible from=MWFResponsible.get(getCtx(),activity.getAD_WF_Responsible_ID()); MWFResponsible to=MWFResponsible.get(getCtx(),p_AD_WF_Responsible_ID); String msg1=user.getName() + ": " + from.getName()+ " -> "+ to.getName(); activity.setTextMsg(msg1); activity.setAD_WF_Responsible_ID(p_AD_WF_Responsible_ID); if (msg == null) msg=msg1; else msg+=" - " + msg1; } activity.saveEx(); return msg; }
Perform process.
protected void forward(QueuedInputEvent q){ onDeliverToNext(q); }
Forwards the event to the next stage.
public static TermsQueryBuilder termsQuery(String name,float... values){ return new TermsQueryBuilder(name,values); }
A filer for a field based on several terms matching on any of them.
public T next() throws IOException { if (firstRead) { int firstChar=reader.read(); if (firstChar == -1) { return null; } else { reader.unread(firstChar); firstRead=false; } } if (streamParser.hasNext()) { try { return GSON.fromJson(streamParser.next(),messageClass); } catch ( JsonIOException e) { throw new IOException(e); } catch ( JsonParseException ignore) { } } return null; }
Returns message parsed from JSON stream.
private void handleUnknownException(StreamOp op,final Throwable cause){ AsyncLogWriter oldWriter=null; boolean statusChanged=false; synchronized (this) { if (StreamStatus.INITIALIZED == status) { oldWriter=setStreamStatus(StreamStatus.FAILED,StreamStatus.INITIALIZED,null,null,cause); statusChanged=true; } } if (statusChanged) { Abortables.asyncAbort(oldWriter,false); logger.error("Failed to write data into stream {} : ",name,cause); scheduleTryAcquireOnce(0L); } op.fail(cause); }
Handle unknown exception when executing <i>op</i>.
public void sortInstances(int columnIndex,boolean ascending){ if ((columnIndex > 0) && (columnIndex < getColumnCount())) { addUndoPoint(); m_Data.stableSort(columnIndex - 1); if (!ascending) { Instances reversedData=new Instances(m_Data,m_Data.numInstances()); int i=m_Data.numInstances(); while (i > 0) { i--; int equalCount=1; while ((i > 0) && (m_Data.instance(i).value(columnIndex - 1) == m_Data.instance(i - 1).value(columnIndex - 1))) { equalCount++; i--; } int j=0; while (j < equalCount) { reversedData.add(m_Data.instance(i + j)); j++; } } m_Data=reversedData; } notifyListener(new TableModelEvent(this)); } }
sorts the instances via the given attribute
public static String toStringInSortedLines(Collection<?> c){ if (c.isEmpty()) return ""; return join(Globals.lineSep,sort(toStringLines(c))) + Globals.lineSep; }
Prints out the elements of the collection in lines, in lexicographic order of String.valueOf called on each element.
public boolean unlockIt(){ log.info("unlockIt - " + toString()); setProcessing(false); return true; }
Unlock Document.
public static String sqlEscape(String str){ final int len=str.length(); StringBuilder sql=new StringBuilder(len * 2); for (int i=0; i < len; i++) { char c=str.charAt(i); switch (c) { case '\u0000': sql.append('\\').append('0'); break; case '\n': sql.append('\\').append('n'); break; case '\t': sql.append('\\').append('t'); break; case '\r': sql.append('\\').append('r'); break; case '\u001a': sql.append('\\').append('Z'); break; case '\'': sql.append('\\').append('\''); break; case '\"': sql.append('\\').append('"'); break; case '\b': sql.append('\\').append('b'); break; case '\\': sql.append('\\').append('\\'); break; default : sql.append(c); break; } } return sql.toString(); }
Replaces all problematic characters from a String with their escaped versions to make it SQL conform.
protected void handleModelChangedEvent(Model model,Object object,int index){ if (model == treeModel) { if (object instanceof TreeModel.TreeChangedEvent) { if (((TreeModel.TreeChangedEvent)object).isNodeChanged()) { updateNodeAndChildren(((TreeModel.TreeChangedEvent)object).getNode()); } else { updateAllNodes(); } } } else if (model == frequencyModel) { updateAllNodes(); } else if (model instanceof SiteModel) { updateAllNodes(); } else { throw new RuntimeException("Unknown componentChangedEvent"); } super.handleModelChangedEvent(model,object,index); }
Handles model changed events from the submodels.
@Override public void eUnset(int featureID){ switch (featureID) { case N4JSPackage.IDENTIFIER_REF__STRICT_MODE: setStrictMode(STRICT_MODE_EDEFAULT); return; case N4JSPackage.IDENTIFIER_REF__ID: setId((IdentifiableElement)null); return; case N4JSPackage.IDENTIFIER_REF__ID_AS_TEXT: setIdAsText(ID_AS_TEXT_EDEFAULT); return; } super.eUnset(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public boolean isPermissionGranted(@NonNull String permissionsName){ return ActivityCompat.checkSelfPermission(context,permissionsName) == PackageManager.PERMISSION_GRANTED; }
return true if permission is granted, false otherwise.
public static FontData[] textFont(final TextSymbolizer symbolizer){ final Font font=font(symbolizer); if (font == null) return null; final FontData[] tempFD=new FontData[1]; final Expression fontFamilyExpression=font.getFamily().get(0); final Expression sizeExpression=font.getSize(); if (sizeExpression == null || fontFamilyExpression == null) return null; final Double size=sizeExpression.evaluate(null,Double.class); try { final String fontFamily=fontFamilyExpression.evaluate(null,String.class); tempFD[0]=new FontData(fontFamily,size.intValue(),1); } catch ( final NullPointerException ignore) { return null; } if (tempFD[0] != null) return tempFD; return null; }
Grabs the font from the first TextSymbolizer. <p> If you are using something fun like symbols you will need to do your own thing. </p>
@Inline public static void shortBulkCopy(short[] src,Offset srcOffset,short[] dst,Offset dstOffset,int bytes){ if (VM.VerifyAssertions) VM._assert(SHORT_BULK_COPY_SUPPORTED); if (!Selected.Mutator.get().shortBulkCopy(ObjectReference.fromObject(src),srcOffset,ObjectReference.fromObject(dst),dstOffset,bytes)) { Memory.aligned16Copy(Magic.objectAsAddress(dst).plus(dstOffset),Magic.objectAsAddress(src).plus(srcOffset),bytes); } }
Barrier for a bulk copy of shorts (i.e. in an array copy).
public static GrantorInfo peekGrantor(DLockService service,InternalDistributedSystem sys){ return basicOp(-1,service,-1,sys,null,PEEK_OP); }
Asks the elder who the grantor is for the specified service.
public boolean hasTriggered(){ return mHasTriggered; }
Returns whether the trigger has fired at least once.
public final AC align(String side,int... indexes){ UnitValue al=ConstraintParser.parseAlignKeywords(side,true); if (al == null) al=ConstraintParser.parseAlignKeywords(side,false); for (int i=indexes.length - 1; i >= 0; i--) { int ix=indexes[i]; makeSize(ix); cList.get(ix).setAlign(al); } return this; }
Specifies the indicated rows'/columns' columns default alignment <b>for its components</b>. It does not affect the positioning or size of the columns/row itself. For columns it is the horizonal alignment (e.g. "left") and for rows it is the vertical alignment (e.g. "top"). <p> For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:28.172 -0500",hash_original_method="4ACF3BC65F0835BDAED23C3218607CC6",hash_generated_method="AB47D7FD2D522A6C4B52051AE9DD7CB1") public static String dumpAsString(Object obj){ return dumpAsString(obj,false); }
dump out a DER object as a formatted string, in non-verbose mode.
public ExceptionsAttribute(ConstPool cp){ super(cp,tag); byte[] data=new byte[2]; data[0]=data[1]=0; this.info=data; }
Constructs a new exceptions attribute.
public final boolean isExact(){ return isEquivalent() && (this.rule & SearchPattern.R_FULL_MATCH) != 0; }
Returns whether element matches exactly searched pattern or not. Note that exact matches are also erasure and equivalent ones.
public void error(SourceLocator srcLctr,String msg,Object[] args) throws TransformerException { error(srcLctr,null,null,msg,args); }
Tell the user of an error, and probably throw an exception.
public void addAll(double[] values){ super.addAll(values,0); }
Adds several new observations with the specified values.
protected ParenExpressionImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->