code
stringlengths
10
174k
nl
stringlengths
3
129k
public void test_ticket_1007_number6() throws Exception { new TestHelper("ticket-1007-number6","ticket-1007-number6.rq","ticket-1007-custom.trig","ticket-1007-number-integer.srx",false).runTest(); }
<code> SELECT ?o { ?s <http://www.bigdata.com/integer> ?o . <http://www.bigdata.com/c> <http://www.bigdata.com/p5> ?v . BIND (?v*2 AS ?o) } </code>
public static boolean isSupported(String charset){ return java.nio.charset.Charset.isSupported(charset); }
is given charset supported or not
public void runTest() throws Throwable { Document newNode; String newValue; newNode=(Document)load("staff",true); newValue=newNode.getNodeValue(); assertNull("initiallyNull",newValue); newNode.setNodeValue("This should have no effect"); newValue=newNode.getNodeValue(); assertNull("nullAfterAttemptedChange",newValue); }
Runs the test case.
public HttpsURL(final String userinfo,final String host,final String path,final String query,final String fragment) throws URIException { this(userinfo,host,-1,path,query,fragment); }
Construct a HTTPS URL from given components. Note: The <code>userinfo</code> format is normally <code>&lt;username&gt;:&lt;password&gt;</code> where username and password must both be URL escaped.
public boolean hasSkins(){ return System.getProperty("skin") != null || System.getProperty("dskin") != null; }
Subclasses of this implementation might override this to return builtin skins for a specific implementation
public void fsetstat(SFTPv3FileHandle handle,SFTPv3FileAttributes attr) throws IOException { checkHandleValidAndOpen(handle); int req_id=generateNextRequestID(); TypesWriter tw=new TypesWriter(); tw.writeString(handle.fileHandle,0,handle.fileHandle.length); tw.writeBytes(createAttrs(attr)); if (debug != null) { debug.println("Sending SSH_FXP_FSETSTAT..."); debug.flush(); } sendMessage(Packet.SSH_FXP_FSETSTAT,req_id,tw.getBytes()); expectStatusOKMessage(req_id); }
Modify the attributes of a file. Used for operations such as changing the ownership, permissions or access times, as well as for truncating a file.
public void onSuccess(int downloadId,String filePath){ }
Invoked when downloading successfully.
private static boolean isOperatingSystemWindows(){ return System.getProperty("os.name","").toLowerCase().startsWith("windows"); }
Detects whether the running platform is Windows* by looking at the operating system name system property
@Override protected void onFocusChanged(boolean focused,int direction,Rect previouslyFocusedRect){ super.onFocusChanged(focused,direction,previouslyFocusedRect); if (mIcon != null) { mIcon.setVisibility(focused ? View.VISIBLE : View.GONE); } }
Only show the icon view when focused, if there is one.
public String sqlObject_dropFunction(String vendorName,String catalogName,String schemaName,String functionType,String functionName,String functionReturnType,String functionSignature){ String translatedFunctionType=translateFunctionType(vendorName,vendorName,functionType,functionReturnType); return m_interfaces.get(getDBVendorID(vendorName)).sqlObject_dropFunction(catalogName,schemaName,translatedFunctionType,functionName,functionSignature); }
gets the database specific SQL command to drop functions
public C lowerEndpoint(){ return lowerBound.endpoint(); }
Returns the lower endpoint of this range.
@Override protected void register(ConfigurationCapabilityFactory configurationCapabilityFactory){ configurationCapabilityFactory.registerConfigurationCapability("oc4j9x",ContainerType.INSTALLED,ConfigurationType.STANDALONE,OrionStandaloneLocalConfigurationCapability.class); configurationCapabilityFactory.registerConfigurationCapability("oc4j10x",ContainerType.INSTALLED,ConfigurationType.STANDALONE,OrionStandaloneLocalConfigurationCapability.class); }
Register configuration capabilities.
boolean isHeld(long version){ SnapshotDeletionPolicy.SnapshotHolder holder=snapshots.get(version); return holder != null && holder.counter > 0; }
Returns <tt>true</tt> if the version has been snapshotted.
@Override public void write(byte[] buf,int offset,int length,boolean isEnd) throws IOException { if (!_isPost) { return; } if (_tempStream == null) { _tempStream=new MemoryStream(); } _tempStream.write(buf,offset,length,isEnd); }
Writes a buffer to the underlying stream.
private static ArrayList<String> readIndirectValues(final InputStream in) throws IOException { final ArrayList<String> fonts; final BufferedReader inpStream=new BufferedReader(new InputStreamReader(in)); fonts=new ArrayList<String>(0); while (true) { final String nextValue=inpStream.readLine(); if (nextValue == null) { break; } fonts.add(nextValue); } inpStream.close(); return fonts; }
read values from the classpath
public static DividerBuilder from(Drawable drawable){ DividerBuilder builder=new DividerBuilder(); builder.with(drawable); return builder; }
Returns a new builder with the drawable applied to all the sides of the divider.
public static <T>List<T> map(List<T> values,Map<T,T> map){ List<T> result=new ArrayList<>(values.size()); for ( T t : values) { result.add(map.get(t)); } return result; }
Maps all values to new values. Returns a new list.
public void rewindInputPosition(int position){ this.ptr=position; }
Rewind the input ptr to the marked position.
protected void deflate() throws IOException { int len=def.deflate(buf,0,buf.length); if (len > 0) { out.write(buf,0,len); } }
Writes next block of compressed data to the output stream.
private void appendPolygonPolygon(Polygon polygon,int level,boolean indentFirst,Writer writer) throws IOException { if (indentFirst) indent(level,writer); writer.write("<polygon points='"); appendSequencePoints(polygon.getExteriorRing().getCoordinateSequence(),level,false,writer); writer.write("' />\n"); }
Converts a <code>Polygon</code> to &lt;Polygon Text&gt; format, then appends it to the writer.
public PSPCommunicationException(String message,Reason reason){ super(message); setMessageKey(getMessageKey() + "." + reason.toString()); }
Constructs a new exception with the given detail message, and appends the specified reason to the message key.
@Deprecated public static String toString(final byte[] bytes,final String charsetName) throws UnsupportedEncodingException { return charsetName != null ? new String(bytes,charsetName) : new String(bytes,Charset.defaultCharset()); }
Converts a <code>byte[]</code> to a String using the specified character encoding.
DOMStringListImpl(Vector params){ fStrings=params; }
Construct an empty list of DOMStringListImpl
public static void notNull(Object obj){ if (obj == null) throw new IllegalArgumentException("Object must not be null"); }
Validates that the object is not null
@Override public boolean isOpaque(){ Color back=getBackground(); Component p=getParent(); if (p != null) { p=p.getParent(); } boolean colorMatch=(back != null) && (p != null) && back.equals(p.getBackground())&& p.isOpaque(); return !colorMatch && super.isOpaque(); }
Overridden for performance reasons. See the <a href="#override">Implementation Note</a> for more information.
public static @Nonnull <T>T valueOrDefault(@Nullable T value,@Nonnull T defaultValue){ return value == null ? defaultValue : value; }
Returns a value if that value is not null, or a specified default value otherwise.
public void registerScheme(ResourceSet resourceSet,@SuppressWarnings("hiding") ClassLoader classLoader){ URIConverter converter=resourceSet.getURIConverter(); if (registerScheme(converter,classLoader)) { ExecutionEnvironmentDescriptor descriptor=new ExecutionEnvironmentDescriptor(resourceSet,classLoader); register(resourceSet,descriptor); } }
Configure the resourceSet such that it understands the n4js scheme. Use the given classLoader to lookup the resources.
public NegativeArraySizeException(String s){ super(s); }
Constructs a <code>NegativeArraySizeException</code> with the specified detail message.
public ToggleCommentAction(ResourceBundle bundle,String prefix,ITextEditor editor){ super(bundle,prefix,editor); }
Creates and initializes the action for the given text editor. The action configures its visual representation from the given resource bundle.
public Boolean Dial(String number,boolean makeTheCall){ try { Intent intent=new Intent(makeTheCall ? Intent.ACTION_CALL : Intent.ACTION_VIEW,Uri.parse("tel:" + number)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); _context.startActivity(intent); return true; } catch ( Exception e) { return false; } }
Dial a phone number
private void part(Player player){ Group group=SingletonRepository.getGroupManager().getGroup(player.getName()); if (group == null) { player.sendPrivateText(NotificationType.ERROR,"You are not a member of a group."); return; } group.removeMember(player.getName()); }
leave the group
public boolean commit() throws LoginException { switch (status) { case UNINITIALIZED: default : throw new LoginException("The login module is not initialized"); case INITIALIZED: logoutInternal(); throw new LoginException("Authentication failed"); case AUTHENTICATED: if (commitInternal()) { return true; } else { logoutInternal(); throw new LoginException("Unable to retrieve certificates"); } case LOGGED_IN: return true; } }
Abstract method to commit the authentication process (phase 2). <p> This method is called if the LoginContext's overall authentication succeeded (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules succeeded). <p> If this LoginModule's own authentication attempt succeeded (checked by retrieving the private state saved by the <code>login</code> method), then this method associates a <code>X500Principal</code> for the subject distinguished name of the first certificate in the alias's credentials in the subject's principals,the alias's certificate path in the subject's public credentials, and a<code>X500PrivateCredential</code> whose certificate is the first certificate in the alias's certificate path and whose private key is the alias's private key in the subject's private credentials. If this LoginModule's own authentication attempted failed, then this method removes any state that was originally saved. <p>
protected HTTPErrorStage(GraphManager graphManager,Pipe<?> input,Pipe<ServerResponseSchema> output,HTTPSpecification<T,R,V,H> httpSpec){ super(graphManager,input,output,httpSpec); this.input=input; this.output=output; }
Send HTTP valid error messages
public int readLargeUleb128(){ return readUleb128(true); }
Reads a "large" uleb128. That is, one that may legitimately be greater than a signed int. The value is returned as if it were signed. i.e. a value of 0xFFFFFFFF would be returned as -1. It is up to the caller to handle the value appropriately.
private void createContext(String path){ String verifiedpath=null; verifiedpath=prependPath(path); try { m_group=new GroupMembership(verifiedpath,s_nodename,this,this); } catch ( Exception e2) { LOGGER.error("Exception while creating the context :" + path,e2); } }
Each Topic will be created as persistent znode in ZK
public boolean isFinal(){ return (accessFlags & AccessFlag.FINAL) != 0; }
Returns true if this is a final class or interface.
public void readDict(BufferedReader fin) throws IOException { dict.clear(); String line; if ((line=fin.readLine()) == null) { System.out.println("No dictionary size information"); return; } int dictSize=Integer.parseInt(line); if (dictSize <= 0) { System.out.println("Invalid dictionary size"); } System.out.println("Reading dictionary ..."); for (int i=0; i < dictSize; i++) { line=fin.readLine(); if (line == null) { System.out.println("Invalid dictionary line"); return; } StringTokenizer strTok=new StringTokenizer(line," \t\r\n"); int len=strTok.countTokens(); if (len < 2) { continue; } StringTokenizer cpTok=new StringTokenizer(strTok.nextToken(),":"); int cp=Integer.parseInt(cpTok.nextToken()); int cpCount=Integer.parseInt(cpTok.nextToken()); Element elem=new Element(); elem.count=cpCount; elem.chosen=1; while (strTok.hasMoreTokens()) { StringTokenizer lbTok=new StringTokenizer(strTok.nextToken(),":"); int label=Integer.parseInt(lbTok.nextToken()); int count=Integer.parseInt(lbTok.nextToken()); int fidx=Integer.parseInt(lbTok.nextToken()); CountFIdx cntFIdx=new CountFIdx(count,fidx); elem.lbCntFidxes.put(new Integer(label),cntFIdx); } dict.put(new Integer(cp),elem); } System.out.println("Reading dictionary (" + Integer.toString(dict.size()) + " entries) completed!"); line=fin.readLine(); }
Read dict.
private void addOnCurvePoint(PointRec rec,RenderState rs){ if (rs.firstOn == null) { rs.firstOn=rec; rs.gp.moveTo(rec.x,rec.y); } else if (rs.prevOff != null) { rs.gp.quadTo(rs.prevOff.x,rs.prevOff.y,rec.x,rec.y); rs.prevOff=null; } else { rs.gp.lineTo(rec.x,rec.y); } }
add a point on the curve
private int isInResults(ArrayList<Media> results,String id){ int i=0; for ( Media item : results) { if (item.videoId.equals(id)) return i; i++; } return -1; }
Test if there is an item that already exists
public void clearSelection(){ List<Integer> selection=getSelectedItems(); selectedItems.clear(); for ( Integer i : selection) { notifyItemChanged(i); } }
Clear the selection status for all items
public static boolean isSnakeCase(String name){ return Pattern.matches("[\\da-z_]+",name); }
checks if given name is a snake-cased name i.e if the name contains all small-caps and underscores only
public void testEncode() throws StunException { byte[] expectedReturn=msgFixture.bindingRequest; byte[] actualReturn=bindingRequest.encode(stunStack); assertTrue("A binding request was not properly encoded",Arrays.equals(expectedReturn,actualReturn)); expectedReturn=msgFixture.bindingResponse; actualReturn=bindingResponse.encode(stunStack); assertTrue("A binding response was not properly encoded",Arrays.equals(expectedReturn,actualReturn)); }
Decodes a bindingRequest and then a binding response and checks whether they match the corresponding objects.
protected Builder(OnCardClickListener listener,Card card){ mCard=card; mCard.mClickListener=listener; }
Instantiate the builder with data from a shallow clone.
private void writeObject(java.io.ObjectOutputStream out) throws NotSerializableException { throw new NotSerializableException("Not serializable."); }
Throws NotSerializableException, since InvalidPropertiesFormatException objects are not intended to be serializable.
public EuclideanDistance(){ super(); }
Constructs a new Euclidean distance function.
protected XAResource connect() throws Exception { synchronized (ActiveMQXAResourceWrapper.lock) { if (delegate != null) { return delegate; } } for ( XARecoveryConfig xaRecoveryConfig : xaRecoveryConfigs) { if (xaRecoveryConfig == null) { continue; } if (ActiveMQXARecoveryLogger.LOGGER.isDebugEnabled()) { ActiveMQXARecoveryLogger.LOGGER.debug("Trying to connect recovery on " + xaRecoveryConfig + " of "+ Arrays.toString(xaRecoveryConfigs)); } ClientSession cs=null; try { if (xaRecoveryConfig.getDiscoveryConfiguration() != null) { serverLocator=ActiveMQClient.createServerLocator(false,xaRecoveryConfig.getDiscoveryConfiguration()); } else { serverLocator=ActiveMQClient.createServerLocator(false,xaRecoveryConfig.getTransportConfig()); } serverLocator.disableFinalizeCheck(); serverLocator.setProtocolManagerFactory(xaRecoveryConfig.getClientProtocolManager()); csf=serverLocator.createSessionFactory(); if (xaRecoveryConfig.getUsername() == null) { cs=csf.createSession(true,false,false); } else { cs=csf.createSession(xaRecoveryConfig.getUsername(),xaRecoveryConfig.getPassword(),true,false,false,false,1); } } catch ( Throwable e) { ActiveMQXARecoveryLogger.LOGGER.xaRecoverAutoConnectionError(e,xaRecoveryConfig); if (ActiveMQXARecoveryLogger.LOGGER.isDebugEnabled()) { ActiveMQXARecoveryLogger.LOGGER.debug(e.getMessage(),e); } try { if (cs != null) cs.close(); if (serverLocator != null) serverLocator.close(); } catch ( Throwable ignored) { if (ActiveMQXARecoveryLogger.LOGGER.isTraceEnabled()) { ActiveMQXARecoveryLogger.LOGGER.trace(e.getMessage(),ignored); } } continue; } cs.addFailureListener(this); synchronized (ActiveMQXAResourceWrapper.lock) { delegate=cs; } return delegate; } ActiveMQXARecoveryLogger.LOGGER.recoveryConnectFailed(Arrays.toString(xaRecoveryConfigs)); throw new ActiveMQNotConnectedException(); }
Connect to the server if not already done so
public GrayPaintScale(double lowerBound,double upperBound,int alpha){ if (lowerBound >= upperBound) { throw new IllegalArgumentException("Requires lowerBound < upperBound."); } if (alpha < 0 || alpha > 255) { throw new IllegalArgumentException("Requires alpha in the range 0 to 255."); } this.lowerBound=lowerBound; this.upperBound=upperBound; this.alpha=alpha; }
Creates a new paint scale for values in the specified range.
@Override public int read(char[] chars,int startOffset,int length) throws IOException { for (int i=startOffset; i <= startOffset + length; i++) { int readInt=read(); if (readInt == -1) return i - startOffset; chars[i]=(char)readInt; } return length; }
Reads characters into a portion of an array.
private AsciiImgCache(final Dimension characterImageSize,final Map<Character,GrayscaleMatrix> imageCache,final char[] characters){ this.characterImageSize=characterImageSize; this.imageCache=imageCache; }
Instantiates a new ascii img cache.
public void applyAll(long index){ if (!log.isOpen()) return; long lastIndex=Math.min(index,log.lastIndex()); if (lastIndex > lastApplied) { for (long i=lastApplied + 1; i <= lastIndex; i++) { Entry entry=log.get(i); if (entry != null) { apply(entry).whenComplete(null); } setLastApplied(i); } } }
Applies all commits up to the given index. <p> Calls to this method are assumed not to expect a result. This allows some optimizations to be made internally since linearizable events don't have to be waited to complete the command.
public static Number acos(Number a){ return Math.acos(a.doubleValue()); }
Returns the arc cosine of the number.
public void addCompareCol(int sortCol){ sortCols.add(new ArrayElementComparator(sortCol,true)); }
Compare the passed in col in natural order
public AnnihilateMove(int col,int row,Player player){ super(col,row,player); }
Construct an AnnihilateMove move with given (col,row) and mark to be placed. REQUIRES: player.mark != ' ' AND 0 <= col < # of columns in board AND 0 <= row < # of rows in board.
public void testXformLoadSucceeded_HidesLoadingDialog(){ mController.init(); mFakeGlobalEventBus.post(new FetchXformSucceededEvent()); verify(mMockUi).showFormLoadingDialog(false); }
Tests that a successful xform fetch hides the loading dialog.
public TimePeriodValuesCollection(){ this((TimePeriodValues)null); }
Constructs an empty dataset.
@Override public String resultsetKey(){ if (!m_ResultsetsValid) { try { prepareData(); } catch ( Exception ex) { ex.printStackTrace(); return ex.getMessage(); } } String result=""; for (int j=0; j < getNumResultsets(); j++) { result+="(" + (j + 1) + ") "+ getResultsetName(j)+ '\n'; } return result + '\n'; }
Creates a key that maps resultset numbers to their descriptions.
public static int ENOTTY(){ return Errno.ENOTTY.intValue(); }
Not a typewriter
public static float r_distance(vec3 a,vec3 b){ float x=a.m[0] - b.m[0]; float y=a.m[1] - b.m[1]; float z=a.m[2] - b.m[2]; float result=(float)Math.sqrt(x * x + y * y + z * z); return result; }
\brief distance(vec3 a, vec3 b)
public mat4 loadRotate(vec3 v){ mat4_util_load_rotate(this.m,v.x(),v.y(),v.z()); return this; }
\fn loadRotate \brief Replaces the current matrix with a rotation matrix using v \param v vec3
@Override final public int hashCode(){ if (hash == 0) { hash=961 * s.hashCode() + 31 * p.hashCode() + o.hashCode(); } return hash; }
Note: implementation per Statement interface, which does not consider the context position.
private static void printElement(Element element){ printDocument(new Document(element)); }
Prints an arbitrary XML element to System.out.
public boolean isSetHeader(){ return this.header != null; }
Returns true if field header is set (has been assigned a value) and false otherwise
private int compareVersions(String fullVersion1,String fullVersion2){ Matcher v1Matcher=VERSION_PATTERN.matcher(fullVersion1); boolean isV1Match=v1Matcher.matches(); Matcher v2Matcher=VERSION_PATTERN.matcher(fullVersion2); boolean isV2Match=v2Matcher.matches(); if (isV1Match && !isV2Match) { return 1; } else if (!isV1Match && isV2Match) { return -1; } else if (!isV1Match && !isV2Match) { return 0; } String v1Major=v1Matcher.groupCount() >= 1 ? v1Matcher.group(1) : "0"; String v1Minor=v1Matcher.groupCount() >= 2 ? v1Matcher.group(2) : "0"; String v1Release=v1Matcher.groupCount() >= 3 ? v1Matcher.group(3) : "0"; String v2Major=v2Matcher.groupCount() >= 1 ? v2Matcher.group(1) : "0"; String v2Minor=v2Matcher.groupCount() >= 2 ? v2Matcher.group(2) : "0"; String v2Release=v2Matcher.groupCount() >= 3 ? v2Matcher.group(3) : "0"; int compareMajor=compareVersionParts(v1Major,v2Major); if (compareMajor == 1) { return 1; } else if (compareMajor == -1) { return -1; } else { int compareMinor=compareVersionParts(v1Minor,v2Minor); if (compareMinor == 1) { return 1; } else if (compareMinor == -1) { return -1; } else { int compareRelease=compareVersionParts(v1Release,v2Release); if (compareRelease == 1) { return 1; } else if (compareRelease == -1) { return -1; } else { return 0; } } } }
Compare two 3-part version numbers and indicate whether version1 is equal to version2, version1 is greater than version2, version1 is less than version2.
private String applyPostProcessors(final CacheKey cacheKey,final String content) throws IOException { final Collection<ResourcePostProcessor> processors=processorsFactory.getPostProcessors(); LOG.debug("appying post processors: {}",processors); if (processors.isEmpty()) { return content; } final Resource resource=Resource.create(cacheKey.getGroupName(),cacheKey.getType()); Reader reader=new StringReader(content.toString()); Writer writer=null; for ( final ResourcePostProcessor processor : processors) { final ResourcePreProcessor decoratedProcessor=decorateProcessor(processor,cacheKey.isMinimize()); writer=new StringWriter(); decoratedProcessor.process(resource,reader,writer); reader=new StringReader(writer.toString()); } return writer.toString(); }
Apply resourcePostProcessors.
public QueryExpression(String group){ super(group); }
Create a new QueryExpression.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:54:59.824 -0500",hash_original_method="8119C72F0478CFCCBAF29A53C28985A0",hash_generated_method="CAE9266E5A14EABAAFFFFF8B47C20EF4") public boolean hasToTag(){ return hasParameter(ParameterNames.TO_TAG); }
Boolean function
@Override public boolean containsValue(Object value){ if (value == null) { value=NULL_OBJECT; } for (int i=1; i < elementData.length; i=i + 2) { if (elementData[i] == value) { return true; } } return false; }
Returns whether this map contains the specified value.
protected void applyRequestedModifications(){ TextureView view=requestedModificationView.get(); if (view != null) { if (requestedRotation != null) { rotate(view,requestedRotation); requestedRotation=null; } if (requestedScaleType != null) { scale(view,requestedScaleType); requestedScaleType=null; } } requestedModificationView=new WeakReference<>(null); }
Applies any scale or rotation that was requested before the MatrixManager was ready to apply those modifications.
public Socks5BytestreamSession establishSession(String targetJID,String sessionID) throws XMPPException, IOException, InterruptedException { XMPPException discoveryException=null; if (!supportsSocks5(targetJID)) { throw new XMPPException(targetJID + " doesn't support SOCKS5 Bytestream"); } List<String> proxies=new ArrayList<String>(); try { proxies.addAll(determineProxies()); } catch ( XMPPException e) { discoveryException=e; } List<StreamHost> streamHosts=determineStreamHostInfos(proxies); if (streamHosts.isEmpty()) { throw discoveryException != null ? discoveryException : new XMPPException("no SOCKS5 proxies available"); } String digest=Socks5Utils.createDigest(sessionID,this.connection.getUser(),targetJID); if (this.proxyPrioritizationEnabled && this.lastWorkingProxy != null) { StreamHost selectedStreamHost=null; for ( StreamHost streamHost : streamHosts) { if (streamHost.getJID().equals(this.lastWorkingProxy)) { selectedStreamHost=streamHost; break; } } if (selectedStreamHost != null) { streamHosts.remove(selectedStreamHost); streamHosts.add(0,selectedStreamHost); } } Socks5Proxy socks5Proxy=Socks5Proxy.getSocks5Proxy(); try { socks5Proxy.addTransfer(digest); Bytestream initiation=createBytestreamInitiation(sessionID,targetJID,streamHosts); Packet response=SyncPacketSend.getReply(this.connection,initiation,getTargetResponseTimeout()); StreamHostUsed streamHostUsed=((Bytestream)response).getUsedHost(); StreamHost usedStreamHost=initiation.getStreamHost(streamHostUsed.getJID()); if (usedStreamHost == null) { throw new XMPPException("Remote user responded with unknown host"); } Socks5Client socks5Client=new Socks5ClientForInitiator(usedStreamHost,digest,this.connection,sessionID,targetJID); Socket socket=socks5Client.getSocket(getProxyConnectionTimeout()); this.lastWorkingProxy=usedStreamHost.getJID(); return new Socks5BytestreamSession(socket,usedStreamHost.getJID().equals(this.connection.getUser())); } catch ( TimeoutException e) { throw new IOException("Timeout while connecting to SOCKS5 proxy"); } finally { socks5Proxy.removeTransfer(digest); } }
Establishes a SOCKS5 Bytestream with the given user using the given session ID and returns the Socket to send/receive data to/from the user.
protected boolean isArrayContentDetail(){ return arrayContentDetail; }
<p>Gets whether to output array content detail.</p>
protected static void printClassType(TypeElement typeElt,AnnotatedTypeFactory atypeFactory){ assert typeElt != null; String simpleName=typeElt.getSimpleName().toString(); AnnotatedDeclaredType type=atypeFactory.fromElement(typeElt); System.out.println(simpleName + "\t" + type+ "\t"+ type.directSuperTypes()); for ( Element enclosedElt : typeElt.getEnclosedElements()) { if (enclosedElt instanceof TypeElement) { printClassType((TypeElement)enclosedElt,atypeFactory); } if (!enclosedElt.getKind().isField() && !(enclosedElt instanceof ExecutableElement)) continue; AnnotatedTypeMirror memberType=atypeFactory.fromElement(enclosedElt); System.out.println(simpleName + "." + enclosedElt+ "\t\t"+ memberType); } }
Prints the types of the class and all of its enclosing fields, methods, and inner classes
@Check public void checkN4MemberDeclaration(N4MemberDeclaration n4Member){ if (isNotChecked(n4Member)) { return; } if (holdsDoesNotEqualWithConstructor(n4Member) && holdsNameMayNotBeConfusedWith(n4Member,"future reserved word",FUTURE_RESERVED_WORDS) && holdsNameMayNotBeConfusedWith(n4Member,"boolean literal",BOOLEAN_LITERALS)&& (!(n4Member instanceof Variable) && holdsDoesNotStartWithUpperCaseLetter(n4Member) && holdsNoTypeNameOrNameEqualsType(n4Member)&& holdsDoesNotContainDiscouragedCharacter(n4Member)&& holdsNameMayNotBeConfusedWith(n4Member,"access modifier",ACCESS_MODIFIERS))) { } }
Constraints 4.1
protected void sendFetch(int fetchSize) throws SQLException, IOException { final XdrOutputStream xdrOut=getXdrOut(); xdrOut.writeInt(WireProtocolConstants.op_fetch); xdrOut.writeInt(getHandle()); xdrOut.writeBuffer(calculateBlr(getFieldDescriptor())); xdrOut.writeInt(0); xdrOut.writeInt(fetchSize); }
Sends the fetch request to the database.
public SkipCommand(Server server){ super(server,"skip","Skips the current turn, if possible. Usage: /skip"); }
Creates a new instance of SkipCommand
private void addCollapseData(GraphModel graph,Collection<CollapseData> collapseChanges,TreeModel treeModel,GraphNode parent){ SuccessorEdges successors=treeModel.getSuccessors(parent); if (!successors.hasSuccessors()) { return; } Map<GraphNode,GraphNode> hiddenNodeMap=buildHiddenNodeMap(); HiddenNodesGizmo gizmo=new HiddenNodesGizmo(hiddenNodeMap); Set<GraphNode> exposedNodes=getExposedNodeSet(graph,gizmo); Collection<GraphNode> result=Lists.newArrayList(); result.add(parent); addExposedAncestors(result,treeModel,exposedNodes,parent); CollapseData collapseData=collapse(parent,result,false); collapseChanges.add(collapseData); }
Collapse a single node based on its ancestors in the tree model. The given node becomes the master for the collapse group. All exposed children (and their exposed ancestors) become members of the collapse group, and the collapse group stops for (but includes) top-level master nodes in the ancestor set.
public void installUI(JComponent a){ for (int i=0; i < uis.size(); i++) { ((ComponentUI)(uis.elementAt(i))).installUI(a); } }
Invokes the <code>installUI</code> method on each UI handled by this object.
public Builder add(String fieldName,CharSequence[] values){ intent.putExtra(fieldName,values); return this; }
Add extra field data values to intent being built up
public List<Properties> findAllProperties(String uri) throws IOException { String fulluri=_path + uri; List<Properties> properties=new ArrayList<>(); Enumeration<URL> resources=getResources(fulluri); while (resources.hasMoreElements()) { URL url=resources.nextElement(); Properties props=loadProperties(url); properties.add(props); } return properties; }
Finds the corresponding resources and reads them in as a properties files <p/> Any URL that cannot be read in as a properties file will cause an exception to be thrown. <p/> Example classpath: <p/> META-INF/app.properties META-INF/app.properties META-INF/app.properties <p/> ResourceFinder finder = new ResourceFinder("META-INF/"); List<Properties> appProps = finder.findAllProperties("app.properties");
public void testGetVersion25() throws Exception { String xml=WEBAPP_25_HEADER + "</web-app>"; WebXml webXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes("UTF-8")),getEntityResolver()); assertEquals(WebXmlVersion.V2_5,webXml.getVersion()); }
Tests whether a servlet API version 2.5 descriptor is correctly detected.
public static int poisson(double lambda){ int k=0; double p=1.0; double L=Math.exp(-lambda); do { k++; p*=uniform(); } while (p >= L); return k - 1; }
Return an integer with a Poisson distribution with mean lambda.
protected AbstractSensorMatrix(final int receptiveFieldWidth,final int receptiveFieldHeight,final Filter defaultFilter){ if (receptiveFieldWidth < 0) { throw new IllegalArgumentException("receptiveFieldWidth must be >= 0"); } if (receptiveFieldWidth < 0) { throw new IllegalArgumentException("receptiveFieldHeight must be >= 0"); } this.receptiveFieldHeight=receptiveFieldHeight; this.receptiveFieldWidth=receptiveFieldWidth; this.defaultFilter=defaultFilter; }
Create a new abstract sensor matrix with the specified receptive field width and height and specified filter.
private <T extends Element>Collection<T> createCollection(ElementKey<?,?> key){ Class<?> elementType=key.getElementType(); if (Category.class.isAssignableFrom(elementType)) { return Sets.newLinkedHashSet(); } else { return Lists.newArrayList(); } }
Creates a collection based on the given key.
private int[] readTypeAnnotations(final MethodVisitor mv,final Context context,int u,boolean visible){ char[] c=context.buffer; int[] offsets=new int[readUnsignedShort(u)]; u+=2; for (int i=0; i < offsets.length; ++i) { offsets[i]=u; int target=readInt(u); switch (target >>> 24) { case 0x00: case 0x01: case 0x16: u+=2; break; case 0x13: case 0x14: case 0x15: u+=1; break; case 0x40: case 0x41: for (int j=readUnsignedShort(u + 1); j > 0; --j) { int start=readUnsignedShort(u + 3); int length=readUnsignedShort(u + 5); readLabel(start,context.labels); readLabel(start + length,context.labels); u+=6; } u+=3; break; case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: u+=4; break; default : u+=3; break; } int pathLength=readByte(u); if ((target >>> 24) == 0x42) { TypePath path=pathLength == 0 ? null : new TypePath(b,u); u+=1 + 2 * pathLength; u=readAnnotationValues(u + 2,c,true,mv.visitTryCatchAnnotation(target,path,readUTF8(u,c),visible)); } else { u=readAnnotationValues(u + 3 + 2 * pathLength,c,true,null); } } return offsets; }
Parses a type annotation table to find the labels, and to visit the try catch block annotations.
public void remove(final String collectionName,final String documentID){ remove(collectionName,documentID,null); }
Insert given data into the specified collection
public static synchronized void cleanup(ResultSet R){ Statement S=null; if (R != null) { try { S=R.getStatement(); } catch ( Throwable t) { surfaceThrowable("cleanup() called ResultSet.getStatement()",t); } cleanup(S,R); } }
Overload of cleanup( S, R ) when only R is visible to caller.
public void printTree(){ System.out.println("Root is: " + vertices.get(root)); System.out.print("Edges: "); for (int i=0; i < parent.length; i++) { if (parent[i] != -1) { System.out.print("(" + vertices.get(parent[i]) + ", "+ vertices.get(i)+ ") "); } } System.out.println(); }
Print the whole tree
public ZeroRegisterDecodedInstruction(InstructionCodec format,int opcode,int index,IndexType indexType,int target,long literal){ super(format,opcode,index,indexType,target,literal); }
Constructs an instance.
public static DetailPostFragment newInstance(String param1,String param2){ DetailPostFragment fragment=new DetailPostFragment(); Bundle args=new Bundle(); args.putString(ARG_PARAM1,param1); args.putString(ARG_PARAM2,param2); fragment.setArguments(args); return fragment; }
Use this factory method to create a new instance of this fragment using the provided parameters.
public static void main(String... a) throws Exception { TestBase.createCaller().init().test(); }
Run just this test.
public PrecisionModel(){ modelType=FLOATING; }
Creates a <code>PrecisionModel</code> with a default precision of FLOATING.
public void sendSerialMessage(SerialMessage m,SerialListener reply){ sendMessage(m,reply); }
Forward a preformatted message to the actual interface.
public static void datagramEcho(DatagramSocket s1,DatagramSocket s2,InetAddress ia2) throws Exception { byte[] ba="Hello world".getBytes(); DatagramPacket p1; SocketAddress dest2=null; if (ia2 != null) { dest2=new InetSocketAddress(ia2,s2.getLocalPort()); p1=new DatagramPacket(ba,ba.length,dest2); } else { p1=new DatagramPacket(ba,ba.length); } dprintln("dest2 = " + dest2); DatagramPacket r1=new DatagramPacket(new byte[256],256); DatagramPacket r2=new DatagramPacket(new byte[256],256); s1.send(p1); s2.receive(r1); s2.send(r1); s1.receive(r2); comparePackets(p1,r1); comparePackets(p1,r2); }
Send a packet from s1 to s2 (ia2/s2.localPort) and send same packet back from s2 to sender. Check s1 receives original packet
public final String yytext(){ return new String(zzBuffer,zzStartRead,zzMarkedPos - zzStartRead); }
Returns the text matched by the current regular expression.
public static String tokenize(String str){ str=str.replaceAll("``"," `` "); str=str.replaceAll("''"," '' "); str=str.replaceAll("\""," \" "); str=str.replaceAll("([?!\";#$&])"," $1 "); str=str.replaceAll("\\.\\.\\."," ... "); str=str.replaceAll("([^.])([.])([\\])}>\"']*)\\s*$","$1 $2$3 "); str=str.replaceAll("([\\[\\](){}<>])"," $1 "); str=str.replaceAll("--"," -- "); str=str.replaceAll("$"," "); str=str.replaceAll("^"," "); str=str.replaceAll("([^'])' ","$1 ' "); str=str.replaceAll("'([sSmMdD]) "," '$1 "); str=str.replaceAll("'ll "," 'll "); str=str.replaceAll("'re "," 're "); str=str.replaceAll("'ve "," 've "); str=str.replaceAll("n't "," n't "); str=str.replaceAll("'LL "," 'LL "); str=str.replaceAll("'RE "," 'RE "); str=str.replaceAll("'VE "," 'VE "); str=str.replaceAll("N'T "," N'T "); str=str.replaceAll(" ([Cc])annot "," $1an not "); str=str.replaceAll(" ([Dd])'ye "," $1' ye "); str=str.replaceAll(" ([Gg])imme "," $1im me "); str=str.replaceAll(" ([Gg])onna "," $1on na "); str=str.replaceAll(" ([Gg])otta "," $1ot ta "); str=str.replaceAll(" ([Ll])emme "," $1em me "); str=str.replaceAll(" ([Mm])ore'n "," $1ore 'n "); str=str.replaceAll(" '([Tt])is "," $1 is "); str=str.replaceAll(" '([Tt])was "," $1 was "); str=str.replaceAll(" ([Ww])anna "," $1an na "); str=str.replaceAll(" ([A-Z])\\. "," $1 . "); str=str.replaceAll(",([^0-9])",", $1"); str=str.replaceAll("'([^'])","' $1"); str=str.replaceAll("([^\\xBB])(\\xBB)","$1 $2"); str=str.replaceAll("(\\u201C)([^'])","$1 $2"); str=str.replaceAll("([^'])(\\u201D)","$1 $2"); str=str.replaceAll("\\,([^0-9])","\\, $1"); str=str.replaceAll("([^\\s]),([\\s])","$1 , $2"); str=str.replaceAll("([^\\s:/0-9])/([^\\s:/0-9])","$1 / $2"); str=str.replaceAll("([^\\s0-9]+)-"," $1 -"); str=str.replaceAll("-([^\\s0-9]+)","- $1"); str=str.replaceAll("([^\\s]):([\\s])","$1 : $2"); str=str.replaceAll("([^\\s]):([^0-9]+)","$1 : $2"); str=str.replaceAll("([^0-9]+):([^\\s])","$1 : $2"); str=str.replaceAll(" -([^\\s]+)"," - $1"); str=str.replaceAll("|",""); str=str.replaceAll("[\u2026\u201C\u201D]",""); str=str.replaceAll("([^\\p{L}0-9\\.\\,:\\-/])"," $1 "); str=str.replaceAll("[ \t]+"," "); str=str.replaceAll("^\\s+",""); str=str.replaceAll("\\. \\.\\."," ... "); str=str.trim(); return str; }
Tokenizes according to the Penn Treebank conventions.
private void saveDynamicActions(FacesContext context,StateContext stateContext,UIViewRoot viewRoot){ if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("FaceletFullStateManagementStrategy.saveDynamicActions"); } List<ComponentStruct> actions=stateContext.getDynamicActions(); HashMap<String,UIComponent> componentMap=stateContext.getDynamicComponents(); if (actions != null) { List<Object> savedActions=new ArrayList<>(actions.size()); for ( ComponentStruct action : actions) { UIComponent component=componentMap.get(action.clientId); if (component == null && context.isProjectStage(ProjectStage.Development)) { LOGGER.log(Level.WARNING,"Unable to save dynamic action with clientId ''{0}'' because the UIComponent cannot be found",action.clientId); } if (component != null) { savedActions.add(action.saveState(context)); } } viewRoot.getAttributes().put(DYNAMIC_ACTIONS,savedActions); } }
Save the dynamic actions.
public boolean isProcessing(){ Object oo=get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Process Now.
public LegendTitle(LegendItemSource source){ this(source,new FlowArrangement(),new ColumnArrangement()); }
Constructs a new (empty) legend for the specified source.
public void exportAsDrag(JComponent comp,InputEvent e,int action){ int srcActions=getSourceActions(comp); int dragAction=srcActions & action; if (!(e instanceof MouseEvent)) dragAction=NONE; if (dragAction != NONE && !GraphicsEnvironment.isHeadless()) { if (recognizer == null) recognizer=new TriggerableDragGestureRecognizer(new BasicDragGestureListener()); recognizer.trigger(comp,(MouseEvent)e,srcActions,dragAction); } else { exportDone(comp,null,NONE); } }
Initiates a drag operation from the given component.
public AuthTimeWithHash(String client,String server,int ctime,int cusec,String hash){ super(client,server,ctime,cusec); this.hash=hash; }
Constructs a new <code>AuthTimeWithHash</code>.
public AmenityReader(String file,CoordinateTransformation ct,Map<String,String> osmToMatsimTypeMap){ log.info("Creating amenity reader"); this.ct=ct; this.osmToMatsimTypeMap=osmToMatsimTypeMap; this.amenities=FacilitiesUtils.createActivityFacilities("OpenStreetMap amenities"); this.amenityAttributes=new ObjectAttributes(); }
Constructing an amenity reader to parse the OpenStreetMap amenities.