code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public boolean match(NullLiteral node,Object other){
if (!(other instanceof NullLiteral)) {
return false;
}
return true;
}
| Returns whether the given node and the other object match. <p> The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed. </p> |
public OFNetmaskGetVendorDataRequest(byte tableIndex,int netMask){
super(BSN_GET_IP_MASK_ENTRY_REQUEST,tableIndex,netMask);
}
| Construct a get network mask vendor data for a specific table entry |
public final boolean inside(double[] en){
return inside(en[0],en[1]);
}
| Is the given Easting-Northing pair inside this grid square? |
public static void removeBreakpoint(final BreakpointManager manager,final INaviModule module,final UnrelocatedAddress unrelocatedAddress){
Preconditions.checkNotNull(manager,"IE01710: Breakpoint manager argument can not be null");
Preconditions.checkNotNull(module,"IE01711: Module argument can not be null");
Preconditions.checkNotNull(unrelocatedAddress,"IE01712: Address argument can not be null");
final BreakpointAddress address=new BreakpointAddress(module,unrelocatedAddress);
if (manager.hasBreakpoint(BreakpointType.REGULAR,address)) {
removeBreakpoints(Sets.newHashSet(address),manager);
}
}
| Removes a breakpoint from the given address. |
public void changeValue(int index,Object value){
if (indexValueMap.containsKey(index)) {
indexValueMap.put(index,value);
nameValueMap.put(columnNameList.get(index),value);
}
}
| change value by index in this result set |
public HttpURL(final String userinfo,final String host,final int port,final String path,final String query) throws URIException {
this(userinfo,host,port,path,query,null);
}
| Construct a HTTP URL from given components. Note: The <code>userinfo</code> format is normally <code><username>:<password></code> where username and password must both be URL escaped. |
public static BlobEntry isBlobEntryForStoring(String repositoryLocation,String mimeType){
RepositoryLocation location;
try {
location=new RepositoryLocation(repositoryLocation);
Entry entry=location.locateEntry();
if (entry instanceof BlobEntry) {
BlobEntry blobEntry=(BlobEntry)entry;
if (mimeType.equals(blobEntry.getMimeType())) {
return blobEntry;
}
else {
SwingTools.showSimpleErrorMessage("entry_must_be_blob",blobEntry.getName());
return null;
}
}
else if (entry == null) {
return createBlobEntry(repositoryLocation);
}
else {
SwingTools.showSimpleErrorMessage("entry_must_be_blob",entry.getName());
}
}
catch ( RepositoryException e) {
SwingTools.showSimpleErrorMessage("cannot_access_repository",e);
}
catch ( MalformedRepositoryLocationException e) {
SwingTools.showSimpleErrorMessage("cannot_access_repository",e);
}
return null;
}
| This method will check if the given location is either empty or is an BlobEntry of the given mimeType. If neither is the case, null will be returned. Otherwise the BlobEntry denoting this location will be returned. |
protected void parseSession(HtmlPage page){
String value=page.getWebResponse().getResponseHeaderValue("Set-Cookie");
if (value == null) {
return;
}
int equals=value.indexOf("JSESSIONID=");
if (equals < 0) {
return;
}
value=value.substring(equals + "JSESSIONID=".length());
int semi=value.indexOf(";");
if (semi >= 0) {
value=value.substring(0,semi);
}
sessionId=value;
}
| <p>Parse and save any session identifier from the specified page.</p> |
public AsyncResult SetMonitoringModeAsync(RequestHeader RequestHeader,UnsignedInteger SubscriptionId,MonitoringMode MonitoringMode,UnsignedInteger... MonitoredItemIds){
SetMonitoringModeRequest req=new SetMonitoringModeRequest(RequestHeader,SubscriptionId,MonitoringMode,MonitoredItemIds);
return channel.serviceRequestAsync(req);
}
| Asynchronous SetMonitoringMode service request. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case StextPackage.REGULAR_EVENT_SPEC__EVENT:
return getEvent();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private static void installJavaStuff(Document document){
LangDocumentPartitionerSetup.getInstance().setup(document);
}
| Installs a java partitioner with <code>document</code>. |
public void broadcastSerialData(byte[] data,OneSheeldDevice exceptionArray[]){
if (data == null) throw new NullPointerException("The passed data array is null, have you checked its validity?");
Log.i("Manager: Broadcasting serial data to all connected devices.");
ArrayList<OneSheeldDevice> tempConnectedDevices;
synchronized (connectedDevicesLock) {
tempConnectedDevices=new ArrayList<>(connectedDevices.values());
}
for ( OneSheeldDevice device : tempConnectedDevices) {
boolean foundInExceptArray=false;
if (exceptionArray != null) for ( OneSheeldDevice exceptDevice : exceptionArray) if (device.getAddress().equals(exceptDevice.getAddress())) {
foundInExceptArray=true;
break;
}
if (!foundInExceptArray) device.sendSerialData(data);
}
}
| Broadcast raw serial data to all connected devices on their 0,1 pins except the ones provided. |
public LognormalDistr(Random seed,double shape,double scale){
this(shape,scale);
numGen.reseedRandomGenerator(seed.nextLong());
}
| Instantiates a new Log-normal pseudo random number generator. |
public AnimationBuilder dp(){
nextValueWillBeDp=true;
return this;
}
| Dp animation builder. |
public double measureBestVal(){
return m_bestResult;
}
| Returns the measure for the best model |
public void removeEfferent(final Synapse synapse){
if (fanOut != null) {
fanOut.remove(synapse.getTarget());
}
}
| Remove this neuron from target neuron via a weight. |
public void addQuat(Quaternion input,Quaternion output){
output.setX(getX() + input.getX());
output.setY(getY() + input.getY());
output.setZ(getZ() + input.getZ());
output.setW(getW() + input.getW());
}
| Add this quaternion and another quaternion together and store the result in the output quaternion |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:52.597 -0500",hash_original_method="D85F37EBA7BADE4247645DA206EE836F",hash_generated_method="1B57BE8B9CF258F29A6F28387123668B") public static final boolean isLocationProviderEnabled(ContentResolver cr,String provider){
String allowedProviders=Settings.Secure.getString(cr,LOCATION_PROVIDERS_ALLOWED);
return TextUtils.delimitedStringContains(allowedProviders,',',provider);
}
| Helper method for determining if a location provider is enabled. |
private static void writeSpaces(Writer out,int amt) throws IOException {
while (amt > 0) {
out.write(' ');
amt--;
}
}
| Writes the given number of spaces to the given writer. |
private static int directionalRegexp(boolean forward,RegExp regexp,String text,int column){
MatchResult result=forward ? RegExpUtils.findMatchAfterIndex(regexp,text,column) : RegExpUtils.findMatchBeforeIndex(regexp,text,column);
int fallback=forward ? text.length() : -1;
return result == null ? fallback : result.getIndex();
}
| Depending on the supplied direction, it will call either findMatchAfterIndex or findMatchBeforeIndex. Once the result is obtained it will return either the match index or the appropriate bound column (text.length() or -1). |
public static PropertyContainer find(Object src,Path path){
PropertyContainer result;
PropertyDescriptor desc;
Object newSrc;
PathElement part;
Method method;
Object methodResult;
part=path.get(0);
try {
desc=new PropertyDescriptor(part.getName(),src.getClass());
}
catch ( Exception e) {
desc=null;
e.printStackTrace();
}
if (desc == null) return null;
if (path.size() == 1) {
result=new PropertyContainer(desc,src);
}
else {
try {
method=desc.getReadMethod();
methodResult=method.invoke(src,(Object[])null);
if (part.hasIndex()) newSrc=Array.get(methodResult,part.getIndex());
else newSrc=methodResult;
result=find(newSrc,path.subpath(1));
}
catch ( Exception e) {
result=null;
e.printStackTrace();
}
}
return result;
}
| returns the property and object associated with the given path, null if a problem occurred. |
public T caseSimpleProjectDependency(SimpleProjectDependency object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Simple Project Dependency</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
public boolean isSetHostname(){
return this.hostname != null;
}
| Returns true if field hostname is set (has been assigned a value) and false otherwise |
public static void main(String[] args){
if (args.length != 1) {
System.out.println("Usage: java huglife.HugLife [worldname]");
return;
}
HugLife h=readWorld(args[0]);
if (SIMULATE_BY_CYCLE) {
h.simulate(MAX_CYCLES);
}
else {
h.simulate(MAX_TICS,TICS_BETWEEN_DRAW);
}
}
| Runs world name specified by ARGS[0]. |
public boolean hasMileage(){
return hasExtension(Mileage.class);
}
| Returns whether it has the mileage. |
public void startDocument() throws SAXException {
}
| Receive notification of the beginning of the document. <p>By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).</p> |
public double asDouble(){
return asNumber().doubleValue();
}
| Get the property casted to a Double |
@Override public void writeCharacters(String text) throws XMLStreamException {
log.log(Level.FINE,"writeCharacters({0})",text);
writeCharsInternal(text,skipSpaces);
}
| Write text to the output. |
public void loadingFinished(){
if (loading) {
((CardLayout)(getLayout())).last(LoadingContentPane.this);
loading=false;
}
}
| Tells the LoadingContentPane that the content has finished loading, switches to the actual content pane. |
public HttpStack(int httpPort) throws IOException {
new HttpServer(httpPort);
}
| Instantiates a new http stack on the requested port. It creates an http listener thread on the port. |
public DiskBasedCache(File rootDirectory,int maxCacheSizeInBytes){
mRootDirectory=rootDirectory;
mMaxCacheSizeInBytes=maxCacheSizeInBytes;
}
| Constructs an instance of the DiskBasedCache at the specified directory. |
public synchronized void enqueueTask(T t) throws InterruptedException {
while (_data.size() + 1 > MAX_SIZE) {
LOG.warn("MAX_SIZE of task queue reached.");
wait();
}
_data.addLast(t);
notify();
}
| Synchronized insert of a new task to the end of the FIFO queue. |
public int size(){
return closed.size();
}
| Determine number of states in the closed set. |
Date toDate(Calendar calendar){
return calendar.getTime();
}
| Convert a Calendar to a java.util.Date |
public static int max(int a,int b){
return a > b ? a : b;
}
| Get the larger of both values. |
public void clearActivations(){
for ( Neuron n : this.getNeuronList()) {
n.clear();
}
}
| Set all activations to 0. |
public ViewExpiredException(Throwable cause,String viewId){
super(cause);
this.viewId=viewId;
}
| <p>Construct a new exception with the specified root cause. The detail message will be set to <code>(cause == null ? null : cause.toString()</code> |
public String toString(){
StringBuffer sb=new StringBuffer("MYear[");
sb.append(get_ID()).append("-").append(getFiscalYear()).append("]");
return sb.toString();
}
| String Representation |
public boolean isStateActive(State state){
switch (state) {
case main_region_StateA:
return stateVector[0] == State.main_region_StateA;
case main_region_StateB:
return stateVector[0] == State.main_region_StateB;
case second_region_SateA:
return stateVector[1] == State.second_region_SateA;
case second_region_StateB:
return stateVector[1] == State.second_region_StateB;
default :
return false;
}
}
| Returns true if the given state is currently active otherwise false. |
public void acceptChanges(Connection con) throws SyncProviderException {
setConnection(con);
acceptChanges();
}
| Propagates all row update, insert, and delete changes to the data source backing this <code>CachedRowSetImpl</code> object using the given <code>Connection</code> object. <P> The reference implementation <code>RIOptimisticProvider</code> modifies its synchronization to a write back function given the updated connection The reference implementation modifies its synchronization behaviour via the <code>SyncProvider</code> to ensure the synchronization occurs according to the updated JDBC <code>Connection</code> properties. |
public void paintArrowButtonBorder(SynthContext context,Graphics g,int x,int y,int w,int h){
}
| Paints the border of an arrow button. Arrow buttons are created by some components, such as <code>JScrollBar</code>. |
private void cleanState(){
username=null;
if (password != null) {
Arrays.fill(password,' ');
password=null;
}
try {
if (ctx != null) {
ctx.close();
}
}
catch ( NamingException e) {
}
ctx=null;
if (clearPass) {
sharedState.remove(USERNAME_KEY);
sharedState.remove(PASSWORD_KEY);
}
}
| Clean out state because of a failed authentication attempt |
public static <K,V>MutableMap<V,K> reverseMapping(Map<K,V> map){
MutableMap<V,K> reverseMap=UnifiedMap.newMap(map.size());
MapIterate.forEachKeyValue(map,null);
return reverseMap;
}
| Return a new map swapping key-value for value-key. If the original map contains entries with the same value, the result mapping is undefined, in that the last entry applied wins (the order of application is undefined). |
private void fciOrientbk(IKnowledge bk,Graph graph,List<Node> variables){
logger.log("info","Starting BK Orientation.");
for (Iterator<KnowledgeEdge> it=bk.forbiddenEdgesIterator(); it.hasNext(); ) {
KnowledgeEdge edge=it.next();
Node from=SearchGraphUtils.translate(edge.getFrom(),variables);
Node to=SearchGraphUtils.translate(edge.getTo(),variables);
if (from == null || to == null) {
continue;
}
if (graph.getEdge(from,to) == null) {
continue;
}
graph.setEndpoint(to,from,Endpoint.CIRCLE);
graph.setEndpoint(from,to,Endpoint.TAIL);
changeFlag=true;
logger.log("knowledgeOrientation",SearchLogUtils.edgeOrientedMsg("Knowledge",graph.getEdge(from,to)));
}
for (Iterator<KnowledgeEdge> it=bk.requiredEdgesIterator(); it.hasNext(); ) {
KnowledgeEdge edge=it.next();
Node from=SearchGraphUtils.translate(edge.getFrom(),variables);
Node to=SearchGraphUtils.translate(edge.getTo(),variables);
if (from == null || to == null) {
continue;
}
if (graph.getEdge(from,to) == null) {
continue;
}
graph.setEndpoint(to,from,Endpoint.TAIL);
graph.setEndpoint(from,to,Endpoint.ARROW);
changeFlag=true;
logger.log("knowledgeOrientation",SearchLogUtils.edgeOrientedMsg("Knowledge",graph.getEdge(from,to)));
}
logger.log("info","Finishing BK Orientation.");
}
| Orients according to background knowledge |
public void visitInnerClassType(String name){
}
| Visits an inner class. |
public final String yytext(){
return new String(zzBuffer,zzStartRead,zzMarkedPos - zzStartRead);
}
| Returns the text matched by the current regular expression. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:27.382 -0500",hash_original_method="98F6B6C49553AC4D3032798198FC694A",hash_generated_method="E0D85ABA1500C693E45FDA4B5393020F") public Entry(String tag,long millis,ParcelFileDescriptor data,int flags){
if (tag == null) throw new NullPointerException("tag == null");
if (((flags & IS_EMPTY) != 0) != (data == null)) {
throw new IllegalArgumentException("Bad flags: " + flags);
}
mTag=tag;
mTimeMillis=millis;
mData=null;
mFileDescriptor=data;
mFlags=flags;
}
| Create a new Entry with streaming data contents. Takes ownership of the ParcelFileDescriptor. |
public Expression simple(Factory f,SourceCode cfml) throws TemplateException {
StringBuffer sb=new StringBuffer();
Position line=cfml.getPosition();
while (cfml.isValidIndex()) {
if (cfml.isCurrent(' ') || cfml.isCurrent('>') || cfml.isCurrent("/>")) break;
else if (cfml.isCurrent('"') || cfml.isCurrent('#') || cfml.isCurrent('\'')) {
throw new TemplateException(cfml,"simple attribute value can't contain [" + cfml.getCurrent() + "]");
}
else sb.append(cfml.getCurrent());
cfml.next();
}
cfml.removeSpace();
return f.createLitString(sb.toString(),line,cfml.getPosition());
}
| Liest ein |
public IssuerNotMatchException(){
}
| Constructs a new exception with <code>null</code> as its detail message. The cause is not initialized. |
public void testStandard() throws Exception {
Input keys[]=new Input[]{new Input("the ghost of christmas past",50)};
Directory tempDir=getDirectory();
Analyzer standard=new MockAnalyzer(random(),MockTokenizer.WHITESPACE,true,MockTokenFilter.ENGLISH_STOPSET);
AnalyzingSuggester suggester=new AnalyzingSuggester(tempDir,"suggest",standard,standard,AnalyzingSuggester.EXACT_FIRST | AnalyzingSuggester.PRESERVE_SEP,256,-1,false);
suggester.build(new InputArrayIterator(keys));
List<LookupResult> results=suggester.lookup(TestUtil.stringToCharSequence("the ghost of chris",random()),false,1);
assertEquals(1,results.size());
assertEquals("the ghost of christmas past",results.get(0).key.toString());
assertEquals(50,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("ghost of chris",random()),false,1);
assertEquals(1,results.size());
assertEquals("the ghost of christmas past",results.get(0).key.toString());
assertEquals(50,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("ghost chris",random()),false,1);
assertEquals(1,results.size());
assertEquals("the ghost of christmas past",results.get(0).key.toString());
assertEquals(50,results.get(0).value,0.01F);
IOUtils.close(standard,tempDir);
}
| basic "standardanalyzer" test with stopword removal |
public WordAlternative(Double confidence,String word){
this.confidence=confidence;
this.word=word;
}
| Instantiates a new word alternative. |
public FailOverStrategy(int maxRetryTimes){
this.maxRetryTimes=maxRetryTimes;
}
| Creates a new instance of FailOverStrategy. |
public boolean isIndexSelected(int index){
return isSelected(index);
}
| Determines if the specified item in this scrolling list is selected. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:04.274 -0500",hash_original_method="AA202573A133FD4C93192532FFFE560D",hash_generated_method="474639955C5D8CF949FD2CA6772DB7D6") private synchronized boolean sendMessage(Message msg){
if (mHandler != null) {
mHandler.sendMessage(msg);
return true;
}
else {
return false;
}
}
| Send a message to the private queue or handler. |
synchronized static void computePRF(byte[] out,byte[] secret,byte[] str_byts,byte[] seed) throws GeneralSecurityException {
if (sha_mac == null) {
init();
}
SecretKeySpec keyMd5;
SecretKeySpec keySha1;
if ((secret == null) || (secret.length == 0)) {
secret=new byte[8];
keyMd5=new SecretKeySpec(secret,"HmacMD5");
keySha1=new SecretKeySpec(secret,"HmacSHA1");
}
else {
int length=secret.length >> 1;
int offset=secret.length & 1;
keyMd5=new SecretKeySpec(secret,0,length + offset,"HmacMD5");
keySha1=new SecretKeySpec(secret,length,length + offset,"HmacSHA1");
}
if (logger != null) {
logger.println("secret[" + secret.length + "]: ");
logger.printAsHex(16,""," ",secret);
logger.println("label[" + str_byts.length + "]: ");
logger.printAsHex(16,""," ",str_byts);
logger.println("seed[" + seed.length + "]: ");
logger.printAsHex(16,""," ",seed);
logger.println("MD5 key:");
logger.printAsHex(16,""," ",keyMd5.getEncoded());
logger.println("SHA1 key:");
logger.printAsHex(16,""," ",keySha1.getEncoded());
}
md5_mac.init(keyMd5);
sha_mac.init(keySha1);
int pos=0;
md5_mac.update(str_byts);
byte[] hash=md5_mac.doFinal(seed);
while (pos < out.length) {
md5_mac.update(hash);
md5_mac.update(str_byts);
md5_mac.update(seed);
if (pos + md5_mac_length < out.length) {
md5_mac.doFinal(out,pos);
pos+=md5_mac_length;
}
else {
System.arraycopy(md5_mac.doFinal(),0,out,pos,out.length - pos);
break;
}
hash=md5_mac.doFinal(hash);
}
if (logger != null) {
logger.println("P_MD5:");
logger.printAsHex(md5_mac_length,""," ",out);
}
pos=0;
sha_mac.update(str_byts);
hash=sha_mac.doFinal(seed);
byte[] sha1hash;
while (pos < out.length) {
sha_mac.update(hash);
sha_mac.update(str_byts);
sha1hash=sha_mac.doFinal(seed);
for (int i=0; (i < sha_mac_length) & (pos < out.length); i++) {
out[pos++]^=sha1hash[i];
}
hash=sha_mac.doFinal(hash);
}
if (logger != null) {
logger.println("PRF:");
logger.printAsHex(sha_mac_length,""," ",out);
}
}
| Computes the value of TLS pseudo random function. |
public Map<String,String> attributes(){
return attributes;
}
| Returns internal codec attributes map. |
public void test_syntax_update_bad_08() throws MalformedQueryException {
final String query="CREATE GRAPH <:g> ;; LOAD <:remote> into GRAPH <:g>";
negativeTest(query);
}
| Too many separators (in UPDATE request) |
public static synchronized void ensureRapidMinerHomeSet(final Level logLevel){
LOGGER.setLevel(logLevel);
if (getRapidMinerHome() == null) {
logInfo("Property " + PROPERTY_RAPIDMINER_HOME + " is not set. Guessing.");
if (!searchInClassPath()) {
try {
logInfo("Property " + PROPERTY_RAPIDMINER_HOME + " not found via search in Classpath. Searching in build directory.");
searchInBuildDir();
}
catch ( Throwable e) {
logSevere("Failed to locate 'rapidminer.home'! Cause: " + e.getLocalizedMessage());
}
}
}
else {
logInfo(PROPERTY_RAPIDMINER_HOME + " is '" + getRapidMinerHome()+ "'.");
}
}
| Ensures that the environment variable 'rapidminer.home' is set by searching for RapidMiner Jars in classpath and build dir. |
@Override public double[] distributionForInstance(Instance instance) throws Exception {
DecisionTableHashKey thekey;
double[] tempDist;
double[] normDist;
m_disTransform.input(instance);
m_disTransform.batchFinished();
instance=m_disTransform.output();
m_delTransform.input(instance);
m_delTransform.batchFinished();
instance=m_delTransform.output();
thekey=new DecisionTableHashKey(instance,instance.numAttributes(),false);
if ((tempDist=m_entries.get(thekey)) == null) {
if (m_useIBk) {
tempDist=m_ibk.distributionForInstance(instance);
}
else {
if (!m_classIsNominal) {
tempDist=new double[1];
tempDist[0]=m_majority;
}
else {
tempDist=m_classPriors.clone();
}
}
}
else {
if (!m_classIsNominal) {
normDist=new double[1];
normDist[0]=(tempDist[0] / tempDist[1]);
tempDist=normDist;
}
else {
normDist=new double[tempDist.length];
System.arraycopy(tempDist,0,normDist,0,tempDist.length);
Utils.normalize(normDist);
tempDist=normDist;
}
}
return tempDist;
}
| Calculates the class membership probabilities for the given test instance. |
public NdefMessage(NdefRecord record,NdefRecord... records){
if (record == null) throw new NullPointerException("record cannot be null");
for ( NdefRecord r : records) {
if (r == null) {
throw new NullPointerException("record cannot be null");
}
}
mRecords=new NdefRecord[1 + records.length];
mRecords[0]=record;
System.arraycopy(records,0,mRecords,1,records.length);
}
| Construct an NDEF Message from one or more NDEF Records. |
public int compareTo(UploadCountHolder other){
if (other.getCompleted() == _completed) return _attempted - other.getAttempted();
return _completed - other.getCompleted();
}
| This one is larger if it has had more completed downloads. If the two have completed the same, it's larger if it had more attempted downloads |
public void callChildVisitors(XSLTVisitor visitor,boolean callAttrs){
super.callChildVisitors(visitor,callAttrs);
}
| Call the children visitors. |
private void closeEntityManager(){
EntityManager entityManager=getEntityManager();
if (entityManager != null && entityManager.isOpen()) {
entityManager.close();
entityManagerThreadLocal.set(null);
}
}
| Closes an entity manager if it is open. |
public String toString(){
return this.getClass().getSimpleName() + " seqno=" + seqno;
}
| Returns the class name and the seqno for which we waiting. |
@Override protected boolean readHeader() throws IOException, ArticleReaderException {
this.enteringTime=startTime;
return super.readHeader();
}
| Reads the header of an article. |
public String TO_NUMBER(BigDecimal number,int displayType){
if (number == null) return "NULL";
BigDecimal result=number;
int scale=DisplayType.getDefaultPrecision(displayType);
if (scale > number.scale()) {
try {
result=number.setScale(scale,BigDecimal.ROUND_HALF_UP);
}
catch ( Exception e) {
}
}
return result.toString();
}
| Return number as string for INSERT statements with correct precision |
public void goBack(){
if (this.inAppWebView.canGoBack()) {
this.inAppWebView.goBack();
}
}
| Checks to see if it is possible to go back one page in history, then does so. |
public static int copy(InputStream input,OutputStream output) throws IOException {
long count=copyLarge(input,output);
if (count > Integer.MAX_VALUE) {
return -1;
}
return (int)count;
}
| Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. <p> Large streams (over 2GB) will return a bytes copied value of <code>-1</code> after the copy has completed since the correct number of bytes cannot be returned as an int. For large streams use the <code>copyLarge(InputStream, OutputStream)</code> method. |
public void receive(boolean bit){
mBits=Long.rotateLeft(mBits,1);
mBits&=mMask;
if (bit) {
mBits+=1;
}
for ( ISyncProcessor processor : mSyncProcessors) {
processor.checkSync(mBits);
}
}
| Processes one bit before checking sync processors for a match. |
public ObjectFactory(){
}
| Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: oasis.names.tc.saml._2_0.assertion |
public Projection create(Properties props) throws ProjectionException {
try {
Point2D center=(Point2D)props.get(ProjectionFactory.CENTER);
float scale=PropUtils.floatFromProperties(props,ProjectionFactory.SCALE,10000000);
int height=PropUtils.intFromProperties(props,ProjectionFactory.HEIGHT,100);
int width=PropUtils.intFromProperties(props,ProjectionFactory.WIDTH,100);
Cartesian proj=new Cartesian(center,scale,width,height);
proj.setLimits(topLimit,bottomLimit,leftLimit,rightLimit,limitAnchorPoint);
return proj;
}
catch ( Exception e) {
if (Debug.debugging("proj")) {
Debug.output("CartesianLoader: problem creating Cartesian projection " + e.getMessage());
}
}
throw new ProjectionException("CartesianLoader: problem creating Cartesian projection");
}
| Create the projection with the given parameters. |
public Builder batchSize(final long batchSize){
this.batchSize=batchSize;
return this;
}
| Number of mutations to perform before a commit is executed. |
public static void abort(@Nullable AsyncAbortable abortable,boolean swallowIOException) throws IOException {
if (null == abortable) {
return;
}
try {
FutureUtils.result(abortable.asyncAbort());
}
catch ( IOException ioe) {
if (swallowIOException) {
logger.warn("IOException thrown while aborting Abortable {} : ",abortable,ioe);
}
else {
throw ioe;
}
}
}
| Abort async <i>abortable</i> |
protected static void do_action_table(PrintStream out,parse_action_table act_tab,boolean compact_reduces) throws internal_error {
parse_action_row row;
parse_action act;
int red;
long start_time=System.currentTimeMillis();
out.println();
out.println(" /** parse action table */");
out.println(" protected static final short[][] _action_table = {");
for (int i=0; i < act_tab.num_states(); i++) {
row=act_tab.under_state[i];
if (compact_reduces) row.compute_default();
else row.default_reduce=-1;
out.print(" /*" + i + "*/{");
for (int j=0; j < row.size(); j++) {
act=row.under_term[j];
if (act.kind() != parse_action.ERROR) {
if (act.kind() == parse_action.SHIFT) {
out.print(j + "," + (((shift_action)act).shift_to().index() + 1)+ ",");
}
else if (act.kind() == parse_action.REDUCE) {
red=((reduce_action)act).reduce_with().index();
if (red != row.default_reduce) out.print(j + "," + (-(red + 1))+ ",");
}
else throw new internal_error("Unrecognized action code " + act.kind() + " found in parse table");
}
}
if (row.default_reduce != -1) out.println("-1," + (-(row.default_reduce + 1)) + "},");
else out.println("-1,0},");
}
out.println(" };");
out.println();
out.println(" /** access to parse action table */");
out.println(" public short[][] action_table() {return _action_table;}");
action_table_time=System.currentTimeMillis() - start_time;
}
| Emit the action table. |
private void updateHistoryButtons(){
historyForwardButton.setEnabled(history.hasNext());
historyBackButton.setEnabled(history.hasPrevious());
}
| Enable/disable the history buttons based on whether there is something to go to in the history. |
public static void wtf(String msg){
if (null == msg || null == sXLogConfig) {
return;
}
if (allowConsoleLogPrint(LogLevel.WTF)) {
Log.wtf(getDefaultTag(),msg);
}
if (allowFileLogPrint(LogLevel.WTF)) {
FileLogHelper.getInstance().logToFile(msg,null,getDefaultTag(),LogLevel.E);
}
}
| Log.wtf What the FUCK |
public void add(Production production){
productions.add(production);
}
| Adds a production to this rule. |
@SuppressWarnings({"WeakerAccess"}) public static double gammaCdf(double a,double x){
double gln;
if ((x <= 0.0) || (a <= 0.0)) {
return Double.NaN;
}
else if (a > LARGE_A) {
return gnorm(a,x);
}
else {
gln=lngamma(a);
if (x < (a + 1.0)) {
return gser(a,x,gln);
}
else {
return (1.0 - gcf(a,x,gln));
}
}
}
| compute complementary gamma cdf by its continued fraction expansion |
public StempelStemmer(Trie stemmer){
this.stemmer=stemmer;
}
| Create a Stemmer using pre-loaded stemmer table |
public PositionBasedCompletionProposal(String replacementString,Position replacementPosition,int cursorPosition,Image image,String displayString,IContextInformation contextInformation,String additionalProposalInfo,char[] triggers){
Assert.isNotNull(replacementString);
Assert.isTrue(replacementPosition != null);
fReplacementString=replacementString;
fReplacementPosition=replacementPosition;
fCursorPosition=cursorPosition;
fImage=image;
fDisplayString=displayString;
fContextInformation=contextInformation;
fAdditionalProposalInfo=additionalProposalInfo;
fTriggerCharacters=triggers;
}
| Creates a new completion proposal. All fields are initialized based on the provided information. |
private IonStruct makeIonRepresentation(ValueFactory factory){
IonStruct ionRep=factory.newEmptyStruct();
ionRep.addTypeAnnotation(ION_SYMBOL_TABLE);
SymbolTable[] importedTables=getImportedTablesNoCopy();
if (importedTables.length > 1) {
IonList importsList=factory.newEmptyList();
for (int i=1; i < importedTables.length; i++) {
SymbolTable importedTable=importedTables[i];
IonStruct importStruct=factory.newEmptyStruct();
importStruct.add(NAME,factory.newString(importedTable.getName()));
importStruct.add(VERSION,factory.newInt(importedTable.getVersion()));
importStruct.add(MAX_ID,factory.newInt(importedTable.getMaxId()));
importsList.add(importStruct);
}
ionRep.add(IMPORTS,importsList);
}
if (mySymbolsCount > 0) {
int sid=myFirstLocalSid;
for (int offset=0; offset < mySymbolsCount; offset++, sid++) {
String symbolName=mySymbolNames[offset];
recordLocalSymbolInIonRep(ionRep,symbolName,sid);
}
}
return ionRep;
}
| NOT SYNCHRONIZED! Call only from a synch'd method. |
private boolean isReferenceResult(Clustering<?> t){
if ("bylabel-clustering".equals(t.getShortName())) {
return true;
}
if ("bymodel-clustering".equals(t.getShortName())) {
return true;
}
if ("allinone-clustering".equals(t.getShortName())) {
return true;
}
if ("allinnoise-clustering".equals(t.getShortName())) {
return true;
}
return false;
}
| Test if a clustering result is a valid reference result. |
public ListNode detectCycle(ListNode head){
if (head == null) return null;
ListNode slow=head;
ListNode fast=head;
boolean hasCycle=false;
while (fast.next != null && fast.next.next != null) {
fast=fast.next.next;
slow=slow.next;
if (fast == slow) {
hasCycle=true;
break;
}
}
if (!hasCycle) return null;
slow=head;
while (slow != fast) {
fast=fast.next;
slow=slow.next;
}
return slow;
}
| Reset slow to head after cycle is detected Then move until slow and fast meets Each one step every time |
public void sendSessionBegins(){
sendSessionState(SessionState.Start);
}
| Call sendSessionBegins when the plugin is loaded. |
public char nextClean() throws JSONException {
int nextCleanInt=nextCleanInternal();
return nextCleanInt == -1 ? '\0' : (char)nextCleanInt;
}
| Returns the next character that is not whitespace and does not belong to a comment. If the input is exhausted before such a character can be found, the null character '\0' is returned. The return value of this method is ambiguous for JSON strings that contain the character '\0'. |
@Override public Object terminate(){
return new Object[]{Integer.valueOf(count),super.terminate()};
}
| Returns a two element array of the total number of values & the computed sum of the values. |
protected void atCastToRtype(CastExpr expr) throws CompileError {
expr.getOprand().accept(this);
if (exprType == VOID || isRefType(exprType) || arrayDim > 0) compileUnwrapValue(returnType,bytecode);
else if (returnType instanceof CtPrimitiveType) {
CtPrimitiveType pt=(CtPrimitiveType)returnType;
int destType=MemberResolver.descToType(pt.getDescriptor());
atNumCastExpr(exprType,destType);
exprType=destType;
arrayDim=0;
className=null;
}
else throw new CompileError("invalid cast");
}
| Inserts a cast operator to the return type. If the return type is void, this does nothing. |
public boolean verify(byte[] hash,byte[] signature){
return verify(hash,signature,pub);
}
| verify a signature created with the private counterpart of this key |
public void updateTotalValue(){
total=0;
for (int i=0; i < dataset.getItemCount(); i++) {
total+=dataset.getValue(i).doubleValue();
}
}
| Updates the total value across all data items. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:31:10.470 -0500",hash_original_method="75B70D9FB26EF7CE7043E09D494022A0",hash_generated_method="68FAF3CB941E8F3EE47F333D991B23E1") public Element create(){
mRS.validate();
Element[] ein=new Element[mCount];
String[] sin=new String[mCount];
int[] asin=new int[mCount];
java.lang.System.arraycopy(mElements,0,ein,0,mCount);
java.lang.System.arraycopy(mElementNames,0,sin,0,mCount);
java.lang.System.arraycopy(mArraySizes,0,asin,0,mCount);
int[] ids=new int[ein.length];
for (int ct=0; ct < ein.length; ct++) {
ids[ct]=ein[ct].getID();
}
int id=mRS.nElementCreate2(ids,sin,asin);
return new Element(id,mRS,ein,sin,asin);
}
| Create the element from this builder. |
default Filterable<T> retainAll(final Stream<? extends T> stream){
final Set<T> set=stream.collect(Collectors.toSet());
return filter(null);
}
| Retain only the supplied elements in the returned Filterable |
public StrBuilder insert(final int index,String str){
validateIndex(index);
if (str == null) {
str=nullText;
}
if (str != null) {
final int strLen=str.length();
if (strLen > 0) {
final int newSize=size + strLen;
ensureCapacity(newSize);
System.arraycopy(buffer,index,buffer,index + strLen,size - index);
size=newSize;
str.getChars(0,strLen,buffer,index);
}
}
return this;
}
| Inserts the string into this builder. Inserting null will use the stored null text value. |
protected AbstractDebugger(){
synchronizer=new DebuggerSynchronizer(this);
memorySynchronizer=new MemorySynchronizer(this);
}
| Creates a new abstract debugger object. |
public Pair(){
this(null,null);
}
| Creates a new instance of <code>Pair</code> with both sides of the pair set to null. |
public String searchpopup() throws Exception {
executeQuery();
return POPUP_VIEW;
}
| Execute a fulltextSearch from the request parameters |
void update(Context context){
SharedPreferences settings=context.getSharedPreferences(context.getPackageName(),0);
Resources res=context.getResources();
DisplayMetrics dm=res.getDisplayMetrics();
debugModeEnabled=settings.getBoolean(DVConstants.Values.App.Key_DebugModeEnabled,false);
isLandscape=res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
animationPxMovementPerSecond=res.getDimensionPixelSize(R.dimen.animation_movement_in_dps_per_second);
filteringCurrentViewsAnimDuration=res.getInteger(R.integer.filter_animate_current_views_duration);
filteringNewViewsAnimDuration=res.getInteger(R.integer.filter_animate_new_views_duration);
taskStackScrollDuration=res.getInteger(R.integer.animate_deck_scroll_duration);
TypedValue widthPaddingPctValue=new TypedValue();
res.getValue(R.dimen.deck_width_padding_percentage,widthPaddingPctValue,true);
taskStackWidthPaddingPct=widthPaddingPctValue.getFloat();
TypedValue stackOverscrollPctValue=new TypedValue();
res.getValue(R.dimen.deck_overscroll_percentage,stackOverscrollPctValue,true);
taskStackOverscrollPct=stackOverscrollPctValue.getFloat();
taskStackMaxDim=res.getInteger(R.integer.max_deck_view_dim);
taskStackTopPaddingPx=res.getDimensionPixelSize(R.dimen.deck_top_padding);
transitionEnterFromAppDelay=res.getInteger(R.integer.enter_from_app_transition_duration);
transitionEnterFromHomeDelay=res.getInteger(R.integer.enter_from_home_transition_duration);
taskViewEnterFromAppDuration=res.getInteger(R.integer.task_enter_from_app_duration);
taskViewEnterFromHomeDuration=res.getInteger(R.integer.task_enter_from_home_duration);
taskViewEnterFromHomeStaggerDelay=res.getInteger(R.integer.task_enter_from_home_stagger_delay);
taskViewExitToAppDuration=res.getInteger(R.integer.task_exit_to_app_duration);
taskViewExitToHomeDuration=res.getInteger(R.integer.task_exit_to_home_duration);
taskViewRemoveAnimDuration=res.getInteger(R.integer.animate_task_view_remove_duration);
taskViewRemoveAnimTranslationXPx=res.getDimensionPixelSize(R.dimen.task_view_remove_anim_translation_x);
taskViewRoundedCornerRadiusPx=res.getDimensionPixelSize(R.dimen.task_view_rounded_corners_radius);
taskViewHighlightPx=res.getDimensionPixelSize(R.dimen.task_view_highlight);
taskViewTranslationZMinPx=res.getDimensionPixelSize(R.dimen.task_view_z_min);
taskViewTranslationZMaxPx=res.getDimensionPixelSize(R.dimen.task_view_z_max);
taskViewAffiliateGroupEnterOffsetPx=res.getDimensionPixelSize(R.dimen.task_view_affiliate_group_enter_offset);
TypedValue thumbnailAlphaValue=new TypedValue();
res.getValue(R.dimen.task_view_thumbnail_alpha,thumbnailAlphaValue,true);
taskViewThumbnailAlpha=thumbnailAlphaValue.getFloat();
taskBarViewDefaultBackgroundColor=res.getColor(R.color.task_bar_default_background_color);
taskBarViewLightTextColor=res.getColor(R.color.task_bar_light_text_color);
taskBarViewDarkTextColor=res.getColor(R.color.task_bar_dark_text_color);
taskBarViewHighlightColor=res.getColor(R.color.task_bar_highlight_color);
TypedValue affMinAlphaPctValue=new TypedValue();
res.getValue(R.dimen.task_affiliation_color_min_alpha_percentage,affMinAlphaPctValue,true);
taskBarViewAffiliationColorMinAlpha=affMinAlphaPctValue.getFloat();
taskBarHeight=res.getDimensionPixelSize(R.dimen.deck_child_header_bar_height);
taskBarDismissDozeDelaySeconds=res.getInteger(R.integer.task_bar_dismiss_delay_seconds);
navBarScrimEnterDuration=res.getInteger(R.integer.nav_bar_scrim_enter_duration);
useHardwareLayers=res.getBoolean(R.bool.config_use_hardware_layers);
altTabKeyDelay=res.getInteger(R.integer.deck_alt_tab_key_delay);
fakeShadows=res.getBoolean(R.bool.config_fake_shadows);
svelteLevel=res.getInteger(R.integer.deck_svelte_level);
}
| Updates the state, given the specified context |
private static void fullCardinalityCorrectionTest(final ISchemaVersion schemaVersion) throws IOException {
final Writer output=openOutput(schemaVersion,"cardinality_correction",TestType.ADD);
final HLL hll=newHLL(HLLType.FULL);
initLineAdd(output,hll,schemaVersion);
for (int i=0; i < ((1 << LOG2M) - 1); i++) {
final long rawValue=constructHLLValue(LOG2M,i,1);
cumulativeAddLine(output,hll,rawValue,schemaVersion);
}
for (int i=0; i < (1 << LOG2M); i++) {
final long rawValue=constructHLLValue(LOG2M,i,7);
cumulativeAddLine(output,hll,rawValue,schemaVersion);
}
for (int i=0; i < (1 << LOG2M); i++) {
final long rawValue=constructHLLValue(LOG2M,i,30);
cumulativeAddLine(output,hll,rawValue,schemaVersion);
}
output.flush();
output.close();
}
| Cumulatively adds random values to a FULL HLL through the small range correction, uncorrected range, and large range correction of the HLL's cardinality estimator. Format: cumulative add Tests: - FULL cardinality computation |
public boolean isEmpty(){
return begin == end;
}
| This method is used to determine if this expression is an empty path. An empty path can be represented by a single period, '.'. It identifies the current path. |
private void init(int initCapacity){
table=new Object[2 * initCapacity];
}
| Initializes object to be an empty map with the specified initial capacity, which is assumed to be a power of two between MINIMUM_CAPACITY and MAXIMUM_CAPACITY inclusive. |
public boolean isLocked(){
return m_locked;
}
| Indicates if this schema is locked. Locked schemas can not be edited. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.