code
stringlengths
10
174k
nl
stringlengths
3
129k
private void tryAllAddresses(String dstName,int dstPort,InetAddress localAddress,int localPort,boolean streaming) throws IOException { InetAddress[] dstAddresses=InetAddress.getAllByName(dstName); InetAddress dstAddress; for (int i=0; i < dstAddresses.length - 1; i++) { dstAddress=dstAddresses[i]; try { checkDestination(dstAddress,dstPort); startupSocket(dstAddress,dstPort,localAddress,localPort,streaming); return; } catch ( IOException ex) { } } dstAddress=dstAddresses[dstAddresses.length - 1]; checkDestination(dstAddress,dstPort); startupSocket(dstAddress,dstPort,localAddress,localPort,streaming); }
Tries to connect a socket to all IP addresses of the given hostname.
public SVGAttributedFigure(){ }
Creates a new instance.
public static TreebankNode selectMatchingLeaf(JCas jCas,Annotation annotation){ TreebankNode leaf=null; for ( TreebankNode node : JCasUtil.selectCovered(jCas,TreebankNode.class,annotation)) { if (node.getLeaf() && node.getBegin() == annotation.getBegin() && node.getEnd() == annotation.getEnd()) { if (leaf == null) { leaf=node; } else { throw new IllegalArgumentException(String.format("expected one leaf matching annotation %s, found %s",annotation,Arrays.asList(leaf,node))); } } } return leaf; }
Selects a single TreebankNode leaf that has the same span as the given annotation.
protected void startVideoCall(){ if (!EMClient.getInstance().isConnected()) Toast.makeText(getActivity(),R.string.not_connect_to_server,Toast.LENGTH_SHORT).show(); else { startActivity(new Intent(getActivity(),VideoCallActivity.class).putExtra("username",toChatUsername).putExtra("isComingCall",false)); inputMenu.hideExtendMenuContainer(); } }
make a video call
protected JavadocTokenizer(ScannerFactory fac,CharBuffer buffer){ super(fac,buffer); }
Create a scanner from the input buffer. buffer must implement array() and compact(), and remaining() must be less than limit().
public void findAndInit(Object someObj){ if (someObj instanceof MouseDelegator) md=(MouseDelegator)someObj; if (someObj instanceof MapBean) { ((MapBean)someObj).addProjectionListener(this); setProjection(((MapBean)someObj).getProjection().makeClone()); } if (someObj instanceof LayerHandler) { LayerHandler lh=(LayerHandler)someObj; lh.addLayerListener(this); setLayers(lh.getLayers()); } }
Called when an object should be evaluated by the DefaultDnDCatcher to see if it is needed.
private void populateDefaultsForNewOrder(Order order){ order.setOrderType(DbUtil.getMiscOrderType()); order.setCareSetting(orderService.getCareSettingByName("Outpatient")); order.setConcept(getFreeTextOrderConcept()); order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE); }
Populates data for a NEW order that was created with the Buendia API. This should not be used for revisions, because it may overwrite data set by another source.
public E argMax(){ double maxCount=Double.NEGATIVE_INFINITY; E maxKey=null; for ( final Map.Entry<E,Double> entry : entries.entrySet()) { if (entry.getValue() > maxCount || maxKey == null) { maxKey=entry.getKey(); maxCount=entry.getValue(); } } return maxKey; }
Finds the key with maximum count. This is a linear operation, and ties are broken arbitrarily.
void activateConnectionDialog(){ if (JOptionPane.showOptionDialog(tableAggregate,connectionPanel,ConnectTitle,JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE,null,ConnectOptionNames,ConnectOptionNames[0]) == 0) { connect(); frame.setVisible(true); } else if (!frame.isVisible()) { System.exit(0); } }
Brigs up a JDialog using JOptionPane containing the connectionPanel. If the user clicks on the 'Connect' button the connection is reset.
public static boolean testIdentifierType(PsiElement element,IElementType type){ if (element.getNode().getElementType() != BuckTypes.IDENTIFIER) { return false; } return element.getParent() != null && element.getParent().getNode().getElementType() == type; }
Test the specific type of the given identifier element. For it could be a BUCK_RULE_NAME or PROPERTY_LVALUE.
@Override public boolean isAgentType(){ return type.isAgentType(); }
Method isSpeciesType()
public static Test suite(){ return (new TestSuite(TagIvarITCase.class)); }
Return the tests included in this test suite.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:39.130 -0500",hash_original_method="FD10061FB9DFD564FAB6BA17DFE98F77",hash_generated_method="7DBF5BD38DA526086B79259046E6CD8E") public boolean isDebuggerActive(){ return getTaintBoolean(); }
Returns true if either a Java debugger or native debugger is active.
@Override protected boolean isSwitchFor(EPackage ePackage){ return ePackage == modelPackage; }
Checks whether this is a switch for the given package. <!-- begin-user-doc --> <!-- end-user-doc -->
@Override protected EClass eStaticClass(){ return UmplePackage.eINSTANCE.getMethodDeclarator_(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private void loadFiles(String inputPath){ this.root=inputPath; try { log.info("Loading GTFS files from " + root); loadStops(); loadCalendar(); loadCalendarDates(); loadShapes(); loadRoutes(); loadTrips(); loadStopTimes(); loadFrequencies(); log.info("All files loaded"); } catch ( IOException e) { e.printStackTrace(); } }
Calls all methods to load the gtfs files
public Pair<Set<String>,Set<String>> diff(Set<String> segmentsReceived){ Set<String> segmentsAdded; Set<String> segmentsRemoved; synchronized (logSegments) { Set<String> segmentsCached=logSegments.keySet(); segmentsAdded=Sets.difference(segmentsReceived,segmentsCached).immutableCopy(); segmentsRemoved=Sets.difference(segmentsCached,segmentsReceived).immutableCopy(); } return Pair.of(segmentsAdded,segmentsRemoved); }
Diff with new received segment list <code>segmentReceived</code>.
public void removeProgressListener(ChartProgressListener listener){ this.progressListeners.remove(ChartProgressListener.class,listener); }
Deregisters an object for notification of changes to the chart.
public boolean contains(List<Integer> hashes){ Iterator<Integer> ni=hashes.iterator(); for (int i=0; i < hashFunctions; ++i) { if (!testBit((int)((ni.next() & 0xFFFFFFFFL) % (filter.length * 8)))) { return false; } } return true; }
check if the filter contains data with precomputed hashes.
public Conversions(){ }
Creates a new instance of Conversions
public int bootloaderImageSize(){ return bootloaderSize; }
Returns the total size of the Bootloader firmware. In case the firmware was given as a HEX, this method returns the size of the BIN content of the file.
public final boolean sendMessageDelayed(Message msg,long delayMillis){ return mExec.sendMessageDelayed(msg,delayMillis); }
Enqueue a message into the message queue after all pending messages before (current time + delayMillis). You will receive it in callback, in the thread attached to this handler.
public boolean visit(FieldDeclaration node){ return true; }
Visits the given type-specific AST node. <p> The default implementation does nothing and return true. Subclasses may reimplement. </p>
public static RefactoringStatus checkMethodInType(ITypeBinding type,String methodName,ITypeBinding[] parameters){ RefactoringStatus result=new RefactoringStatus(); IMethodBinding method=org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInType(type,methodName,parameters); if (method != null) { if (method.isConstructor()) { result.addWarning(Messages.format(RefactoringCoreMessages.Checks_methodName_constructor,new Object[]{BasicElementLabels.getJavaElementName(type.getName())})); } else { result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_exists,new Object[]{BasicElementLabels.getJavaElementName(methodName),BasicElementLabels.getJavaElementName(type.getName())}),JavaStatusContext.create(method)); } } return result; }
Checks if the new method is already used in the given type.
public void addScript(Script script){ (scripts != null ? scripts : (scripts=new ArrayList<Script>())).add(script); }
add script. <br>The script list is built as InterfaceCompiler.InterfaceAnalyzer traverses the DOM, collecting items needed to generate the public signature of the class to be generated.
private void checkEvents(THLParallelReadQueue prq,int expectedEvents,int expectedCtrlEvents) throws InterruptedException { checkEvents(prq,expectedEvents,expectedCtrlEvents,0); }
Convenience method with zero start seqno.
private static void runTests(int pid) throws Throwable { final String sep=File.separator; String classpath=System.getProperty("test.class.path","") + File.pathSeparator + System.getProperty("test.jdk",".")+ sep+ "lib"+ sep+ "tools.jar"; String testSrc=System.getProperty("test.src","") + sep; String[] args={"-classpath",classpath,"-Djava.security.manager",String.format("-Djava.security.policy=%sjava.policy.deny",testSrc),"PermissionTest$TestMain",Integer.toString(pid),"true"}; OutputAnalyzer output=ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); args=new String[]{"-classpath",classpath,"-Djava.security.manager",String.format("-Djava.security.policy=%sjava.policy.allow",testSrc),"PermissionTest$TestMain",Integer.toString(pid),"false"}; output=ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Runs the actual test the nested class TestMain. The test is run in a separate process because we need to add to the classpath.
private static void updatePriceOption(PricedParameter ppWithNewValue,PricedOption existingPO){ for ( PricedOption newPo : ppWithNewValue.getPricedOptionList()) { if (newPo.getParameterOptionKey() == existingPO.getParameterOptionKey()) { existingPO.setPricePerSubscription(newPo.getPricePerSubscription()); existingPO.setPricePerUser(newPo.getPricePerUser()); existingPO.setRoleSpecificUserPrices(newPo.getRoleSpecificUserPrices()); break; } } }
The existing priced options are updated with the new prices
public boolean isValueTypeEnumeration(){ return valueType == ParameterValueType.ENUMERATION; }
Checks if the parameter data type is <code>ENUMERATION</code>.
public String deleteEmptyBinsTipText(){ return "Whether to delete empty bins after discretization."; }
Returns the tip text for this property
public void load(Reader aReader) throws IOException { String line=null; BufferedReader br=new BufferedReader(aReader); while ((line=br.readLine()) != null) { String[] words=line.trim().split("\\s|\\|"); if (words.length > 0 && words[0].trim().length() > 0) { data.add(words[0].toLowerCase()); } } }
Load the stopwords from the given reader. If the set already contains data, new stopwords are added.
private void buildChosenAnimation(int childIndex){ List<Animator> fadeOutTextTopAnimatorList=new ArrayList<>(); List<Animator> closeToBottomImageAnimatorList=new ArrayList<>(); for (int i=0; i < childIndex; i++) { View view=mMenuWrapper.getChildAt(i); resetVerticalAnimation(view,true); closeToBottomImageAnimatorList.add(AnimatorUtils.rotationCloseVertical(view)); fadeOutTextTopAnimatorList.add(AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(i),mContext.getResources().getDimension(R.dimen.text_right_translation))); } AnimatorSet closeToBottom=new AnimatorSet(); closeToBottom.playSequentially(closeToBottomImageAnimatorList); AnimatorSet fadeOutTop=new AnimatorSet(); fadeOutTop.playSequentially(fadeOutTextTopAnimatorList); List<Animator> fadeOutTextBottomAnimatorList=new ArrayList<>(); List<Animator> closeToTopAnimatorObjects=new ArrayList<>(); for (int i=getItemCount() - 1; i > childIndex; i--) { View view=mMenuWrapper.getChildAt(i); resetVerticalAnimation(view,false); closeToTopAnimatorObjects.add(AnimatorUtils.rotationCloseVertical(view)); fadeOutTextBottomAnimatorList.add(AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(i),mContext.getResources().getDimension(R.dimen.text_right_translation))); } AnimatorSet closeToTop=new AnimatorSet(); closeToTop.playSequentially(closeToTopAnimatorObjects); AnimatorSet fadeOutBottom=new AnimatorSet(); fadeOutBottom.playSequentially(fadeOutTextBottomAnimatorList); resetSideAnimation(mMenuWrapper.getChildAt(childIndex)); ObjectAnimator closeToRight=AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(childIndex)); closeToRight.addListener(mChosenItemFinishAnimatorListener); AnimatorSet fadeOutChosenText=AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(childIndex),mContext.getResources().getDimension(R.dimen.text_right_translation)); AnimatorSet imageFullAnimatorSet=new AnimatorSet(); imageFullAnimatorSet.play(closeToBottom).with(closeToTop); AnimatorSet textFullAnimatorSet=new AnimatorSet(); textFullAnimatorSet.play(fadeOutTop).with(fadeOutBottom); if (closeToBottomImageAnimatorList.size() >= closeToTopAnimatorObjects.size()) { imageFullAnimatorSet.play(closeToBottom).before(closeToRight); textFullAnimatorSet.play(fadeOutTop).before(fadeOutChosenText); } else { imageFullAnimatorSet.play(closeToTop).before(closeToRight); textFullAnimatorSet.play(fadeOutBottom).before(fadeOutChosenText); } AnimatorSet fullAnimatorSet=new AnimatorSet(); fullAnimatorSet.playTogether(imageFullAnimatorSet,textFullAnimatorSet); fullAnimatorSet.setDuration(mAnimationDurationMilis); fullAnimatorSet.setInterpolator(new HesitateInterpolator()); fullAnimatorSet.start(); }
Builds and runs chosen item and menu closing animation
@Override public Void visitType(TypeElement e,Void p){ scan(e.getTypeParameters(),p); checkCamelCase(e,true); super.visitType(e,p); return null; }
Check the name of a type and its enclosed elements and type parameters.
public static void show(Context context,int titleResId,int urlResId){ if (context == null) return; Intent intent=new Intent(Intent.ACTION_VIEW); intent.setClassName(context,EmbedContentViewActivity.class.getName()); if (context instanceof Activity) { intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); } else { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } intent.putExtra(TITLE_INTENT_EXTRA,titleResId); intent.putExtra(URL_INTENT_EXTRA,urlResId); context.startActivity(intent); }
Starts an EmbedContentViewActivity that shows title and URL for the given resource IDs.
public void writeStartDocument(String encoding,String version) throws XMLStreamException { writeStartDocument(encoding,version,null); }
Write the XML Declaration. Note that the encoding parameter does not set the actual encoding of the underlying output. That must be set when the instance of the XMLStreamWriter is created
public void success(byte[] message){ sendPluginResult(new PluginResult(PluginResult.Status.OK,message)); }
Helper for success callbacks that just returns the Status.OK by default
private boolean add(BasedNumberElement e){ assert e != null; if (isTop()) return false; set.add(e); if (set.size() > bound) { set=FULL_SET; return false; } else { return true; } }
Add an element to this KSet. If it exceeds the bound, set this set to TOP.
public void logPurchase(BigDecimal purchaseAmount,Currency currency){ logPurchase(purchaseAmount,currency,null); }
Logs a purchase event with Facebook, in the specified amount and with the specified currency.
private void sendBlob(String index,byte[] blob){ sendInstruction(new GuacamoleInstruction("blob",index,DatatypeConverter.printBase64Binary(blob))); }
Injects a "blob" instruction into the outbound Guacamole protocol stream, as if sent by the connected client. "blob" instructions are used to send chunks of data along a stream.
public FloatIterator(float[] primitiveArray){ super(primitiveArray); }
Construct new FloatIterator for given primitive array.
public JCheckBoxMenuItem(String text,Icon icon){ this(text,icon,false); }
Creates an initially unselected check box menu item with the specified text and icon.
public boolean hits(Span s){ return start < s.getEnd() && s.getStart() < end; }
returns true if this Span is in the range of the Span s.
public boolean hasNotifications(String tag){ return CENTER.hasEntries(tag); }
Whether the notifications with tag exists.
public static <K,V>boolean isEmpty(Map<K,V> map){ return (map == null || map.size() == 0); }
Judge whether a map is null or size is 0
@Bean public SessionRegistry sessionRegistry(){ return new SessionRegistryImpl(); }
Use by Spring Security, to get events from Hazelcast.
public static Criteria WHERE(){ return new Example().createCriteria(); }
Simple query with example <br>
public static Vec4 fromDoubleArray(double[] array,int offset,int length){ if (array == null) { throw new IllegalArgumentException("Array Is Null"); } if (offset < 0) { throw new IllegalArgumentException("Offset Is Invalid"); } if (length < 1) { throw new IllegalArgumentException("Length Is Invalid"); } if (array.length < offset + length) { throw new IllegalArgumentException("Array Invalid Length"); } if (length == 1) return new Vec4(array[offset],0d); if (length == 2) return new Vec4(array[offset],array[offset + 1]); if (length == 3) return new Vec4(array[offset],array[offset + 1],array[offset + 2]); return new Vec4(array[offset],array[offset + 1],array[offset + 2],array[offset + 3]); }
Constructs a new Vec4 with coordinate values read from the specified double array. The specified offset must be 0 or greater, the specified length must be 1 or greater, and the array must have capacity equal to or greater than <code>offset + length</code>. Coordinates are assigned as follows:<p><code>x = array[offset]</code><br/> <code>y = array[offset + 1]</code> if <code>length > 1</code>, otherwise <code>y=0</code><br/><code>z = array[offset + 2]</code> if <code>length > 2</code>, otherwise <code>z=0</code><br/><code>w = array[offset + 3]</code> if <code>length > 3</code>, otherwise <code>w=1</code></p>
public DefaultLmlSyntax(){ registerTags(); registerAttributes(); }
Constructs a new instance of default syntax, with default tag and attributes registered.
@Override public void drawScreen(int par1,int par2,float par3){ drawBackground(0); drawCenteredString(fontRendererObj,"Zoom Manager",width / 2,40,0xffffff); drawString(fontRendererObj,"Zoom Level: " + WurstClient.INSTANCE.options.zoom.level + " x normal",width / 2 - 75,height / 4 + 44,0xcccccc); super.drawScreen(par1,par2,par3); }
Draws the screen and all the components in it.
public NetworkRestRep update(URI id,NetworkUpdate input){ return client.put(NetworkRestRep.class,input,getIdUrl(),id); }
Updates the given network by ID. <p> API Call: <tt>PUT /vdc/networks/{id}</tt>
public Chain branch(int opcode){ Chain result=null; if (opcode == goto_) { result=pendingJumps; pendingJumps=null; } if (opcode != dontgoto && isAlive()) { result=new Chain(emitJump(opcode),result,state.dup()); fixedPc=fatcode; if (opcode == goto_) alive=false; } return result; }
Emit a branch with given opcode; return its chain. branch differs from jump in that jsr is treated as no-op.
@Override public boolean supportsCorrelatedSubqueries(){ debugCodeCall("supportsCorrelatedSubqueries"); return true; }
Returns whether correlated subqueries are supported.
public static RoutingService.Builder buildRoutingService(RoutingService routingService){ return new RoutingServiceProvider(routingService); }
Build routing service builder of a routing service <code>routingService</code>.
@SuppressWarnings("unchecked") private Collection<GraphEdgeMatcherDescriptor> loadEdgeMatchers(ObjectXmlPersist persist,IFile file) throws IOException { return (Collection<GraphEdgeMatcherDescriptor>)persist.load(file.getLocationURI()); }
Isolate unchecked conversion.
public void testEncode(){ byte[] expectedReturn=msgFixture.connectionId; connectionIdAttribute.setConnectionIdValue(MsgFixture.CONNECTION_ID); byte[] actualReturn=connectionIdAttribute.encode(); assertTrue("ConnectionIdAttribute.encode() did not " + "properly encode a sample attribute",Arrays.equals(expectedReturn,actualReturn)); }
Test whether attributes are properly encoded.
private static void printVolumeFeed(VolumeFeed volumeFeed) throws IOException, ServiceException { String title=volumeFeed.getTitle().getPlainText(); System.out.println(title); List<VolumeEntry> volumeEntries=volumeFeed.getEntries(); if (volumeEntries.size() == 0) { System.out.println("This feed contains no entries."); return; } System.out.println("Results " + volumeFeed.getStartIndex() + " - "+ (volumeFeed.getStartIndex() + volumeEntries.size() - 1)+ " of "+ volumeFeed.getTotalResults()); System.out.println(); int count=1; for ( VolumeEntry entry : volumeEntries) { System.out.println("(Volume #" + String.valueOf(count) + ")"); printVolumeEntry(entry); count++; } System.out.println(); }
Print a volume feed of entries as a numbered list
public List<JCVariableDecl> Params(List<Type> argtypes,Symbol owner){ ListBuffer<JCVariableDecl> params=new ListBuffer<JCVariableDecl>(); MethodSymbol mth=(owner.kind == MTH) ? ((MethodSymbol)owner) : null; if (mth != null && mth.params != null && argtypes.length() == mth.params.length()) { for ( VarSymbol param : ((MethodSymbol)owner).params) params.append(VarDef(param,null)); } else { int i=0; for (List<Type> l=argtypes; l.nonEmpty(); l=l.tail) params.append(Param(paramName(i++),l.head,owner)); } return params.toList(); }
Create a a list of value parameter trees x0, ..., xn from a list of their types and an their owner.
public static AllocationMethod newInstance(){ final AllocationMethod returnInstance=new AllocationMethod(); returnInstance.setDefaultCode(); return returnInstance; }
Method newInstance.
public void accept(final MethodVisitor mv){ AbstractInsnNode insn=first; while (insn != null) { insn.accept(mv); insn=insn.next; } }
Makes the given visitor visit all of the instructions in this list.
private HttpUrl.Builder withIncluded(HttpUrl.Builder endpoint){ return endpoint.addQueryParameter(Oddworks.QUERY_PARAM_INCLUDE,"true"); }
adds query parameter includ=true to endpoint string.
public Comms(EventHandler parent,int port) throws IOException { this.parent=parent; this.isServer=true; this.port=port; parent.debug("Creating server"); networkThread=new SocketThread(); new Thread(networkThread).start(); waitForThreadInit(2000); if (networkThread.thrownIOException != null) { throw networkThread.thrownIOException; } }
Initialize this as server. This starts the network thread, which does the initialization of the socket and starts listening. This also waits until the network thread is done initializing and throws an error. TODO: This could block if the socket initialization takes long (does that happen?)
public void visitLookupSwitchInsn(Label dflt,int[] keys,Label[] labels){ if (mv != null) { mv.visitLookupSwitchInsn(dflt,keys,labels); } }
Visits a LOOKUPSWITCH instruction.
@Inline @Override public final void addressWrite(ObjectReference ref,Address target,Word offset,Word location,int mode){ Magic.setAddressAtOffset(ref.toObject(),offset.toOffset(),target,location.toInt()); }
Perform the actual write of the write barrier, writing the value as a raw Address.
public CopyOnWriteMap(int initialCapacity){ internalMap=new HashMap<K,V>(initialCapacity); }
Creates a new instance of CopyOnWriteMap with the specified initial size
private static boolean shouldParkAfterFailedAcquire(Node pred,Node node){ int ws=pred.waitStatus; if (ws == Node.SIGNAL) return true; if (ws > 0) { do { node.prev=pred=pred.prev; } while (pred.waitStatus > 0); pred.next=node; } else { compareAndSetWaitStatus(pred,ws,Node.SIGNAL); } return false; }
Checks and updates status for a node that failed to acquire. Returns true if thread should block. This is the main signal control in all acquire loops. Requires that pred == node.prev.
protected static String colAlias(String str){ if (str == null) return null; String[] arr=str.split(" [aA][sS] "); if (arr.length == 2) return arr[1].trim(); else return null; }
get alias portion of 'request.getRequestURI() AS myAlias. this is used to put a more descriptive name in jamon.
@Override protected void onDestroy(){ super.onDestroy(); if (mPreview != null) { mPreview.release(); } }
Releases the resources associated with the camera source, the associated detectors, and the rest of the processing pipeline.
public static String formatTextBox(String text,int width){ requireNonNull(text); return formatTextBox(text,width,WORDS,Collections.emptySet()); }
Creates and returns a String formatted so it will fit in a box with the given width.
public TransportServiceEvent(Object source,TYPE type){ super(source); this.type=type; }
Create a new TransportServiceEvent.
public static Boolean toBoolean(long l){ return l != 0 ? Boolean.TRUE : Boolean.FALSE; }
cast a long value to a Boolean Object(reference type)
public LinkedList<Patch> patch_make(LinkedList<Diff> diffs){ if (diffs == null) { throw new IllegalArgumentException("Null inputs. (patch_make)"); } String text1=diff_text1(diffs); return patch_make(text1,diffs); }
Compute a list of patches to turn text1 into text2. text1 will be derived from the provided diffs.
void helpDelete(Node<K,V> b,Node<K,V> f){ if (f == next && this == b.next) { if (f == null || f.value != f) casNext(f,new Node<K,V>(f)); else b.casNext(this,f.next); } }
Helps out a deletion by appending marker or unlinking from predecessor. This is called during traversals when value field seen to be null.
public final AnimatedTexture toAnimatedTexture(AnimationChannel defaultChannel){ return new AnimatedTexture(getImage(),defaultChannel); }
Converts the texture to animated texture.
private Object toDate(final Class type,final String value){ if (type.equals(java.sql.Date.class)) { try { return java.sql.Date.valueOf(value); } catch ( IllegalArgumentException e) { throw new ConversionException("String must be in JDBC format [yyyy-MM-dd] to create a java.sql.Date"); } } if (type.equals(java.sql.Time.class)) { try { return java.sql.Time.valueOf(value); } catch ( IllegalArgumentException e) { throw new ConversionException("String must be in JDBC format [HH:mm:ss] to create a java.sql.Time"); } } if (type.equals(java.sql.Timestamp.class)) { try { return java.sql.Timestamp.valueOf(value); } catch ( IllegalArgumentException e) { throw new ConversionException("String must be in JDBC format [yyyy-MM-dd HH:mm:ss.fffffffff] " + "to create a java.sql.Timestamp"); } } String msg=this.toString(this.getClass()) + " does not support default String to '" + this.toString(type)+ "' conversion."; throw new ConversionException(msg); }
Default String to Date conversion. <p> This method handles conversion from a String to the following types: <ul> <li><code>java.sql.Date</code></li> <li><code>java.sql.Time</code></li> <li><code>java.sql.Timestamp</code></li> </ul> <p> <strong>N.B.</strong> No default String conversion mechanism is provided for <code>java.util.Date</code> and <code>java.util.Calendar</code> type.
protected byte[] hexStringToByteArray(String hexString){ int len=hexString.length(); byte[] data=new byte[len / 2]; for (int i=0; i < len; i+=2) { data[i / 2]=(byte)((Character.digit(hexString.charAt(i),16) << 4) + Character.digit(hexString.charAt(i + 1),16)); } return data; }
Converts hex values from strings to byte arra
public synchronized boolean hasChanged(){ return changed; }
Tests if this object has changed.
public void doRun(Integer prNumber){ if (not(isBuildable()).apply(job)) { LOGGER.debug("Job {} is disabled, but trigger run!",isNull(job) ? "<no job>" : job.getFullName()); return; } if (!isSupportedTriggerMode(getTriggerMode())) { LOGGER.warn("Trigger mode {} is not supported yet ({})",getTriggerMode(),job.getFullName()); return; } GitHubPRRepository localRepository=job.getAction(GitHubPRRepository.class); if (isNull(localRepository)) { LOGGER.warn("Can't get repository info, maybe project {} misconfigured?",job.getFullName()); return; } List<GitHubPRCause> causes; try (LoggingTaskListenerWrapper listener=new LoggingTaskListenerWrapper(getPollingLogAction().getPollingLogFile(),UTF_8)){ long startTime=System.currentTimeMillis(); listener.debug("Running GitHub Pull Request trigger check for {} on {}",getDateTimeInstance().format(new Date(startTime)),localRepository.getFullName()); causes=readyToBuildCauses(localRepository,listener,prNumber); localRepository.saveQuietly(); long duration=System.currentTimeMillis() - startTime; listener.info(FINISH_MSG + " for {} at {}. Duration: {}ms",localRepository.getFullName(),getDateTimeInstance().format(new Date()),duration); } catch ( Exception e) { LOGGER.error("Can't process check ({})",e.getMessage(),e); return; } from(causes).filter(new JobRunnerForCause(job,this)).toSet(); }
Runs check
public static void printSystemInfo(){ err("Java version: " + System.getProperty("java.version")); err("Runtime name: " + System.getProperty("java.runtime.name")); err("Vendor: " + System.getProperty("java.vendor")); err("VM version: " + System.getProperty("java.vm.version")); err("VM vendor: " + System.getProperty("java.vm.vendor")); err("VM name: " + System.getProperty("java.vm.name")); err("VM info: " + System.getProperty("java.vm.info")); err("OS name: " + System.getProperty("os.name")); err("OS arch: " + System.getProperty("os.arch")); err("OS version: " + System.getProperty("os.version")); err("Encoding: " + System.getProperty("file.encoding")); err("Unicode versions: " + UnicodeProperties.UNICODE_VERSIONS); err("JFlex version: " + Main.version); }
Print system information (e.g. in case of unexpected exceptions)
public DeleteCursorWrapper(Cursor cursor){ super(cursor); }
Creates a cursor wrapper.
public EOMGEvent(){ this.source=null; this.cursor=null; this.message=null; this.mouseEvent=null; this.status=EOMG_COMPLETE; }
Deactivation event.
public void init(boolean forEncryption,CipherParameters params) throws IllegalArgumentException { this.forEncryption=forEncryption; reset(); if (params instanceof ParametersWithRandom) { ParametersWithRandom p=(ParametersWithRandom)params; padding.init(p.getRandom()); cipher.init(forEncryption,p.getParameters()); } else { padding.init(null); cipher.init(forEncryption,params); } }
initialise the cipher.
public byte[] wrap(byte[] outgoing,int start,int len) throws SaslException { if (len == 0) { return EMPTY_BYTE_ARRAY; } incrementSeqNum(); byte[] mac=getHMAC(myKi,sequenceNum,outgoing,start,len); if (logger.isLoggable(Level.FINEST)) { traceOutput(DP_CLASS_NAME,"wrap","DIGEST30:Outgoing: ",outgoing,start,len); traceOutput(DP_CLASS_NAME,"wrap","seqNum: ",sequenceNum); traceOutput(DP_CLASS_NAME,"wrap","MAC: ",mac); } int bs=encCipher.getBlockSize(); byte[] padding; if (bs > 1) { int pad=bs - ((len + 10) % bs); padding=new byte[pad]; for (int i=0; i < pad; i++) { padding[i]=(byte)pad; } } else { padding=EMPTY_BYTE_ARRAY; } byte[] toBeEncrypted=new byte[len + padding.length + 10]; System.arraycopy(outgoing,start,toBeEncrypted,0,len); System.arraycopy(padding,0,toBeEncrypted,len,padding.length); System.arraycopy(mac,0,toBeEncrypted,len + padding.length,10); if (logger.isLoggable(Level.FINEST)) { traceOutput(DP_CLASS_NAME,"wrap","DIGEST31:{msg, pad, KicMAC}: ",toBeEncrypted); } byte[] cipherBlock; try { cipherBlock=encCipher.update(toBeEncrypted); if (cipherBlock == null) { throw new IllegalBlockSizeException("" + toBeEncrypted.length); } } catch ( IllegalBlockSizeException e) { throw new SaslException("DIGEST-MD5: Invalid block size for cipher",e); } byte[] wrapped=new byte[cipherBlock.length + 2 + 4]; System.arraycopy(cipherBlock,0,wrapped,0,cipherBlock.length); System.arraycopy(messageType,0,wrapped,cipherBlock.length,2); System.arraycopy(sequenceNum,0,wrapped,cipherBlock.length + 2,4); if (logger.isLoggable(Level.FINEST)) { traceOutput(DP_CLASS_NAME,"wrap","DIGEST32:Wrapped: ",wrapped); } return wrapped; }
Encrypt out-going message.
public boolean equals(Object anObject){ return m_str.equals(anObject); }
Compares this string to the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>String</code> object that represents the same sequence of characters as this object.
public WebApplicationException build(){ Response response=null; switch (status) { case BAD_REQUEST: response=Response.status(Status.BAD_REQUEST).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; case UNAUTHORIZED: response=Response.status(Status.UNAUTHORIZED).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; case FORBIDDEN: response=Response.status(Status.FORBIDDEN).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; case NOT_FOUND: response=Response.status(Status.NOT_FOUND).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; case CONFLICT: response=Response.status(Status.CONFLICT).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; case INTERNAL_SERVER_ERROR: response=Response.status(Status.INTERNAL_SERVER_ERROR).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; case SERVICE_UNAVAILABLE: response=Response.status(Status.SERVICE_UNAVAILABLE).entity(body).type(MediaType.APPLICATION_JSON_TYPE).build(); break; default : break; } return new WebApplicationException(response); }
Build the corresponding exception with the JSON body
public boolean isSaved(){ File allowed=FileUtilities.getFile(Constants.ALLOW_FILE); return existsInFile(allowed); }
Checks if the certificate has been added to the local trusted store
private static void init(String language){ try { InputStream is=Translate.class.getClassLoader().getResourceAsStream("data/languages/" + language + ".txt"); if (is == null) { logger.warn("data/language/" + language + ".txt does not exist on classpath)"); return; } BufferedReader reader=new BufferedReader(new UnicodeSupportingInputStreamReader(is,"UTF-8")); Map<String,String> map=new HashMap<String,String>(); try { String line=reader.readLine(); while (line != null) { String[] tokens=line.split("=",2); if (tokens.length != 2) { System.err.println(line + "///" + Arrays.toString(tokens)); } else { map.put(tokens[0],tokens[1]); } line=reader.readLine(); } } finally { reader.close(); } texts.put(language,map); } catch ( IOException e) { logger.error(e,e); } }
loads a lauguage file
public void endVisit(MethodRefParameter node){ }
End of visit the given type-specific AST node. <p> The default implementation does nothing. Subclasses may reimplement. </p>
@Subscribe @AllowConcurrentEvents public void sessionCompleted(final SessionFinishedEvent event){ LOGGER.info("Received test session finished event. Session ID: '" + event.getSessionId() + "'."); completedSessionIds.add(event.getSessionId()); countDown(); }
Percepts a test session completed event, registers the session ID of the completed session.
private QueryTask(final Type type,final int taskId,final Object tag,final Object cookie,final AsyncDbQueryCallback callback){ mType=type; mTaskId=taskId; mCookie=cookie; mCallback=callback; mCancelled=false; mTag=tag; }
Construct a Query Task
public static byte[] hexStringToBytes(String hex){ int l=(hex.length() + 1) / 2; byte[] r=new byte[l]; int i=0; int j=0; if (hex.length() % 2 == 1) { r[0]=hexDigitToByte(hex.charAt(0)); i=j=1; } while (i < l) r[i++]=(byte)((hexDigitToByte(hex.charAt(j++)) << 4) | hexDigitToByte(hex.charAt(j++))); return r; }
Convert a string of hexadecimal digits to a byte array.
@Override public String toString(){ return new StringBuilder().append(getKey()).append('=').append(getValue()).toString(); }
Gets a debugging String view of the pair.
public ReadOnlyLDAPGroupRestriction(HierarchicalConfiguration configuration){ groupDNs=new ArrayList<String>(); if (configuration != null) { memberAttribute=configuration.getString("[@memberAttribute]"); if (configuration.getKeys("group").hasNext()) { Collections.addAll(groupDNs,configuration.getStringArray("group")); } } }
Initialises an instance from the contents of a <code>&lt;restriction&gt;<code> configuration XML element.
public void initShadowTreeEventNS(String namespaceURIArg,String typeArg,boolean canBubbleArg,boolean cancelableArg,XBLShadowTreeElement xblShadowTreeArg){ initEventNS(namespaceURIArg,typeArg,canBubbleArg,cancelableArg); xblShadowTree=xblShadowTreeArg; }
Initializes this event object with a namespaced event type.
public KLHandlerGeneric(String device){ try { setDeviceName(device); } catch ( Exception ex) { log.fatal(ex); } commTimer=new Timer(commTimeoutTime,commTimeoutHandler); commTimer.setInitialDelay(commTimeoutTime); commTimer.stop(); }
construct with connecting to device
private void updateRange(double x,double y){ mMinX=Math.min(mMinX,x); mMaxX=Math.max(mMaxX,x); mMinY=Math.min(mMinY,y); mMaxY=Math.max(mMaxY,y); }
Updates the range on both axes.
public String startPasswordRecovery(){ getPasswordRecoveryService().startPasswordRecovery(model.getUserId(),model.getMarketpalceId()); if (isMarketplaceSet(getRequest())) { return OUTCOME_MARKETPLACE_CONFIRMSTARTPWDRECOVERY; } addMessage(null,FacesMessage.SEVERITY_INFO,INFO_RECOVERPASSWORD_START); return OUTCOME_SUCCESS; }
Start password recovery procedure
public static InformeBean obtenerInforme(int id,String entidad,OptionsBean listaPerfiles) throws RPAdminDAOException, Exception { InformeBean informeBean=AdapterVOSigem.adapterSIGEMInformeBean(ISicresRPAdminInformeManager.obtenerInforme(id,entidad,AdapterVOSicres.adapterISicresOptionsBean(listaPerfiles))); return informeBean; }
Recupera un informe
private void returnData(Object ret){ if (myHost != null) { myHost.returnData(ret); } }
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
public static Number unaryPlus(Number left){ return NumberMath.unaryPlus(left); }
Returns the number, effectively being a noop for numbers. Operator overloaded form of the '+' operator when it preceeds a single operand, i.e. <code>+10</code>
private void loadSesssionManagementMethodTypes(ExtensionHook extensionHook){ this.sessionManagementMethodTypes=new ArrayList<>(); this.sessionManagementMethodTypes.add(new CookieBasedSessionManagementMethodType()); this.sessionManagementMethodTypes.add(new HttpAuthSessionManagementMethodType()); for ( SessionManagementMethodType t : sessionManagementMethodTypes) { t.hook(extensionHook); } if (log.isInfoEnabled()) { log.info("Loaded session management method types: " + sessionManagementMethodTypes); } }
Loads session management method types and hooks them up.