method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
Preconditions.checkNotNull(win, "win was null"); this.wins.add(win); }
Preconditions.checkNotNull(win, STR); this.wins.add(win); }
/** * Adds a win to this player's wins. This should always be used to add a winning card. * * @param win BaseCard that won a point for this player */
Adds a win to this player's wins. This should always be used to add a winning card
addWin
{ "repo_name": "RoyalDev/TheHumanity", "path": "src/main/java/org/royaldev/thehumanity/player/TheHumanityPlayer.java", "license": "gpl-3.0", "size": 3883 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,893,304
@Override public Container[] findChildren() { synchronized (children) { Container results[] = new Container[children.size()]; return children.values().toArray(results); } }
Container[] function() { synchronized (children) { Container results[] = new Container[children.size()]; return children.values().toArray(results); } }
/** * Return the set of children Containers associated with this Container. * If this Container has no children, a zero-length array is returned. */
Return the set of children Containers associated with this Container. If this Container has no children, a zero-length array is returned
findChildren
{ "repo_name": "zzsoszz/codegen3", "path": "opensource_embedtomcat/org/apache/catalina/core/ContainerBase.java", "license": "apache-2.0", "size": 44262 }
[ "org.apache.catalina.Container" ]
import org.apache.catalina.Container;
import org.apache.catalina.*;
[ "org.apache.catalina" ]
org.apache.catalina;
915,480
private int findPrimeInRow(byte[] zeroMask, int row, IntFixedList sequence) { final int start = row * cols; final int end = start + cols; for (int i = start; i < end; i++) { if (zeroMask[i] == PRIME) { sequence.add(i); return i - start; } } // Should not reach here. throw new AssertionError("Every starred zero will also have a primed zero in the row"); }
int function(byte[] zeroMask, int row, IntFixedList sequence) { final int start = row * cols; final int end = start + cols; for (int i = start; i < end; i++) { if (zeroMask[i] == PRIME) { sequence.add(i); return i - start; } } throw new AssertionError(STR); }
/** * Find the primed zero (0') in the row and add it to the sequence. * * @param zeroMask the zero mask * @param row the row * @param sequence the sequence * @return the column */
Find the primed zero (0') in the row and add it to the sequence
findPrimeInRow
{ "repo_name": "aherbert/GDSC-Core", "path": "src/main/java/uk/ac/sussex/gdsc/core/match/KuhnMunkresAssignment.java", "license": "gpl-3.0", "size": 19002 }
[ "uk.ac.sussex.gdsc.core.utils.IntFixedList" ]
import uk.ac.sussex.gdsc.core.utils.IntFixedList;
import uk.ac.sussex.gdsc.core.utils.*;
[ "uk.ac.sussex" ]
uk.ac.sussex;
2,468,332
public static void linkToActiveTIM(String filePath) { try { // Create the link AddCodeElementAction act = AddCodeElementAction.getInstance(); act.createLink(new File(filePath)); } catch (IllegalArgumentException e) { EclipsePlatformUtils.showErrorMessage("Error", "No item is selected to link!"); } catch (NullPointerException e) { EclipsePlatformUtils.showErrorMessage("Error", "Could not find an active TIM editor!"); } catch (ClassCastException e) { EclipsePlatformUtils.showErrorMessage("Error", "Could not find an active TIM editor or no node is highlighted!"); } catch (IllegalStateException e) { EclipsePlatformUtils.showErrorMessage("Error", "You can't link a source file to a TIM in a different project!"); } }
static void function(String filePath) { try { AddCodeElementAction act = AddCodeElementAction.getInstance(); act.createLink(new File(filePath)); } catch (IllegalArgumentException e) { EclipsePlatformUtils.showErrorMessage("Error", STR); } catch (NullPointerException e) { EclipsePlatformUtils.showErrorMessage("Error", STR); } catch (ClassCastException e) { EclipsePlatformUtils.showErrorMessage("Error", STR); } catch (IllegalStateException e) { EclipsePlatformUtils.showErrorMessage("Error", STR); } }
/******************************************************* * Links the CompilationUnit whose absolute file path is given to the * currently active element in the currently active TIM. It will handle all the * exceptions (if any) and report errors as error dialogs. * * @param filePath * The absolute file path of the CompilationUnit to link to the * TIM. *******************************************************/
Links the CompilationUnit whose absolute file path is given to the currently active element in the currently active TIM. It will handle all the exceptions (if any) and report errors as error dialogs
linkToActiveTIM
{ "repo_name": "SoftwareEngineeringToolDemos/FSE-2014-Archie-Smart-IDE", "path": "src/archie/timstorage/LinkToTim.java", "license": "lgpl-3.0", "size": 1933 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,156,380
public File save(DataSet dataset, File saveDirectory) throws IOException, XMLStreamException { String filename = createFileName(dataset); logger.debug("save to " + filename + " in " + saveDirectory.toString()); saveDirectory.mkdirs(); File outFile = new File(saveDirectory, filename); createFile(dataset, saveDirectory, outFile); logger.debug("Done with save to " + saveDirectory.toString()); return outFile; }
File function(DataSet dataset, File saveDirectory) throws IOException, XMLStreamException { String filename = createFileName(dataset); logger.debug(STR + filename + STR + saveDirectory.toString()); saveDirectory.mkdirs(); File outFile = new File(saveDirectory, filename); createFile(dataset, saveDirectory, outFile); logger.debug(STR + saveDirectory.toString()); return outFile; }
/** * Saves the given dataset to an xml file in the given directory. The file * is returned. */
Saves the given dataset to an xml file in the given directory. The file is returned
save
{ "repo_name": "crotwell/fissuresUtil", "path": "src/main/java/edu/sc/seis/fissuresUtil/xml/DataSetToXMLStAX.java", "license": "gpl-2.0", "size": 8287 }
[ "java.io.File", "java.io.IOException", "javax.xml.stream.XMLStreamException" ]
import java.io.File; import java.io.IOException; import javax.xml.stream.XMLStreamException;
import java.io.*; import javax.xml.stream.*;
[ "java.io", "javax.xml" ]
java.io; javax.xml;
1,987,522
Assert.fail( "Test 'StaffService_getAccountsTest.testSuccessPath()}' not implemented." ); }
Assert.fail( STR ); }
/** * Test succes path for service method <code>getAccounts</code> * * Tests expected behaviour of service method. */
Test succes path for service method <code>getAccounts</code> Tests expected behaviour of service method
testSuccessPath
{ "repo_name": "phoenixctms/ctsms", "path": "core/src/test/java/org/phoenixctms/ctsms/service/staff/test/StaffService_getAccountsTest.java", "license": "lgpl-2.1", "size": 1264 }
[ "org.testng.Assert" ]
import org.testng.Assert;
import org.testng.*;
[ "org.testng" ]
org.testng;
2,552,540
Specification createSpecification(Specification specification, String identifier) throws GreenPepperServerException;
Specification createSpecification(Specification specification, String identifier) throws GreenPepperServerException;
/** * Creates the Specification * <p/> * * @param specification a {@link com.greenpepper.server.domain.Specification} object. * @param identifier a {@link java.lang.String} object. * @return the new Specification * @throws com.greenpepper.server.GreenPepperServerException if any. */
Creates the Specification
createSpecification
{ "repo_name": "strator-dev/greenpepper", "path": "greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/RpcClientService.java", "license": "apache-2.0", "size": 23525 }
[ "com.greenpepper.server.GreenPepperServerException", "com.greenpepper.server.domain.Specification" ]
import com.greenpepper.server.GreenPepperServerException; import com.greenpepper.server.domain.Specification;
import com.greenpepper.server.*; import com.greenpepper.server.domain.*;
[ "com.greenpepper.server" ]
com.greenpepper.server;
215,763
public void setKsPackages(Set<KickstartPackage> p) { this.ksPackages = p; }
void function(Set<KickstartPackage> p) { this.ksPackages = p; }
/** * Setter for ksPackages * @param p The KickstartPackage set to set. */
Setter for ksPackages
setKsPackages
{ "repo_name": "renner/spacewalk", "path": "java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java", "license": "gpl-2.0", "size": 48300 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,804,503
private ClassLoader getDataSourceClassLoader(ConditionContext context) { Class<?> dataSourceClass = new DataSourceBuilder(context.getClassLoader()) .findType(); return (dataSourceClass == null ? null : dataSourceClass.getClassLoader()); } } static class EmbeddedDatabaseCondition extends SpringBootCondition { private final SpringBootCondition pooledCondition = new PooledDataSourceCondition();
ClassLoader function(ConditionContext context) { Class<?> dataSourceClass = new DataSourceBuilder(context.getClassLoader()) .findType(); return (dataSourceClass == null ? null : dataSourceClass.getClassLoader()); } } static class EmbeddedDatabaseCondition extends SpringBootCondition { private final SpringBootCondition pooledCondition = new PooledDataSourceCondition();
/** * Returns the class loader for the {@link DataSource} class. Used to ensure that * the driver class can actually be loaded by the data source. * @param context the condition context * @return the class loader */
Returns the class loader for the <code>DataSource</code> class. Used to ensure that the driver class can actually be loaded by the data source
getDataSourceClassLoader
{ "repo_name": "herau/spring-boot", "path": "spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java", "license": "apache-2.0", "size": 8132 }
[ "org.springframework.boot.autoconfigure.condition.SpringBootCondition", "org.springframework.context.annotation.ConditionContext" ]
import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.context.annotation.ConditionContext;
import org.springframework.boot.autoconfigure.condition.*; import org.springframework.context.annotation.*;
[ "org.springframework.boot", "org.springframework.context" ]
org.springframework.boot; org.springframework.context;
1,069,024
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt);
Point2D function(Point2D srcPt, Point2D dstPt);
/** * Returns the location of the corresponding destination point given a * point in the source image. If <CODE>dstPt</CODE> is specified, it * is used to hold the return value. * @param srcPt the <code>Point2D</code> that represents the point in * the source image * @param dstPt The <CODE>Point2D</CODE> in which to store the result * * @return The <CODE>Point2D</CODE> in the destination image that * corresponds to the specified point in the source image. */
Returns the location of the corresponding destination point given a point in the source image. If <code>dstPt</code> is specified, it is used to hold the return value
getPoint2D
{ "repo_name": "wangsongpeng/jdk-src", "path": "src/main/java/java/awt/image/BufferedImageOp.java", "license": "apache-2.0", "size": 4631 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,031,677
protected void updateState(SessionState state, HttpServletRequest req, HttpServletResponse res) { } protected static final String ALERT_ATTR = "sakai.alert";
void function(SessionState state, HttpServletRequest req, HttpServletResponse res) { } protected static final String ALERT_ATTR = STR;
/** * Update for this request processing the session state. If overridden in a sub-class, make sure to call super. * * @param state * The session state. * @param req * The current request. * @param res * The current response. */
Update for this request processing the session state. If overridden in a sub-class, make sure to call super
updateState
{ "repo_name": "OpenCollabZA/sakai", "path": "velocity/tool/src/java/org/sakaiproject/cheftool/ToolServlet.java", "license": "apache-2.0", "size": 22169 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.sakaiproject.event.api.SessionState" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.sakaiproject.event.api.SessionState;
import javax.servlet.http.*; import org.sakaiproject.event.api.*;
[ "javax.servlet", "org.sakaiproject.event" ]
javax.servlet; org.sakaiproject.event;
1,050,373
public static <E> boolean exists(List<? extends E> list, Predicate1<E> predicate) { for (E e : list) { if (predicate.apply(e)) { return true; } } return false; }
static <E> boolean function(List<? extends E> list, Predicate1<E> predicate) { for (E e : list) { if (predicate.apply(e)) { return true; } } return false; }
/** Returns whether there is an element in {@code list} for which * {@code predicate} is true. */
Returns whether there is an element in list for which
exists
{ "repo_name": "devth/calcite", "path": "linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java", "license": "apache-2.0", "size": 17714 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
203,001
private ContentHostingService contentHostingService; public void setContentHostingService(ContentHostingService service) { contentHostingService = service; }
ContentHostingService contentHostingService; public void function(ContentHostingService service) { contentHostingService = service; }
/** * Dependency: contentHostingService. * * @param service * The NotificationService. */
Dependency: contentHostingService
setContentHostingService
{ "repo_name": "harfalm/Sakai-10.1", "path": "announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/BaseAnnouncementService.java", "license": "apache-2.0", "size": 63688 }
[ "org.sakaiproject.content.api.ContentHostingService" ]
import org.sakaiproject.content.api.ContentHostingService;
import org.sakaiproject.content.api.*;
[ "org.sakaiproject.content" ]
org.sakaiproject.content;
2,664,761
@SuppressWarnings("unchecked") void initExisting() throws IOException { LOG.info("Initializing Existing Jobs..."); List<FileStatus> timestampedDirList = findTimestampedDirectories(); // Sort first just so insertion is in a consistent order Collections.sort(timestampedDirList); for (FileStatus fs : timestampedDirList) { // TODO Could verify the correct format for these directories. addDirectoryToSerialNumberIndex(fs.getPath()); } for (int i= timestampedDirList.size() - 1; i >= 0 && !jobListCache.isFull(); i--) { FileStatus fs = timestampedDirList.get(i); addDirectoryToJobListCache(fs.getPath()); } }
@SuppressWarnings(STR) void initExisting() throws IOException { LOG.info(STR); List<FileStatus> timestampedDirList = findTimestampedDirectories(); Collections.sort(timestampedDirList); for (FileStatus fs : timestampedDirList) { addDirectoryToSerialNumberIndex(fs.getPath()); } for (int i= timestampedDirList.size() - 1; i >= 0 && !jobListCache.isFull(); i--) { FileStatus fs = timestampedDirList.get(i); addDirectoryToJobListCache(fs.getPath()); } }
/** * Populates index data structures. Should only be called at initialization * times. */
Populates index data structures. Should only be called at initialization times
initExisting
{ "repo_name": "an3m0na/hadoop", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java", "license": "apache-2.0", "size": 38386 }
[ "java.io.IOException", "java.util.Collections", "java.util.List", "org.apache.hadoop.fs.FileStatus" ]
import java.io.IOException; import java.util.Collections; import java.util.List; import org.apache.hadoop.fs.FileStatus;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,373,756
public Set<VarType<?>> getTypeVariables();
Set<VarType<?>> function();
/** * Returns the type variables local to the type. */
Returns the type variables local to the type
getTypeVariables
{ "repo_name": "baratine/baratine", "path": "framework/src/main/java/com/caucho/v5/config/reflect/BaseTypeAnnotated.java", "license": "gpl-2.0", "size": 1701 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,597,220
void openExtendedPlayerInventory(AbstractPlayerEntity player, IInventory inventory, int containerWidth, Consumer<IInventory> onClosed, ItemContainer.ISlotCallback slotCallback);
void openExtendedPlayerInventory(AbstractPlayerEntity player, IInventory inventory, int containerWidth, Consumer<IInventory> onClosed, ItemContainer.ISlotCallback slotCallback);
/** * Opens the player inventory with an additional inventory on the top. * @param player The player opening the container. * @param inventory The extra inventory. * @param containerWidth The amount of slots horizontally before wrapping to next line. * @param onClosed The action to take when the container is closed. */
Opens the player inventory with an additional inventory on the top
openExtendedPlayerInventory
{ "repo_name": "RockBottomGame/API", "path": "src/main/java/de/ellpeck/rockbottom/api/IApiHandler.java", "license": "lgpl-3.0", "size": 12621 }
[ "de.ellpeck.rockbottom.api.entity.player.AbstractPlayerEntity", "de.ellpeck.rockbottom.api.gui.container.ItemContainer", "de.ellpeck.rockbottom.api.inventory.IInventory", "java.util.function.Consumer" ]
import de.ellpeck.rockbottom.api.entity.player.AbstractPlayerEntity; import de.ellpeck.rockbottom.api.gui.container.ItemContainer; import de.ellpeck.rockbottom.api.inventory.IInventory; import java.util.function.Consumer;
import de.ellpeck.rockbottom.api.entity.player.*; import de.ellpeck.rockbottom.api.gui.container.*; import de.ellpeck.rockbottom.api.inventory.*; import java.util.function.*;
[ "de.ellpeck.rockbottom", "java.util" ]
de.ellpeck.rockbottom; java.util;
2,743,963
void addAllSupportedHostFeature(Guid hostId, Set<String> features);
void addAllSupportedHostFeature(Guid hostId, Set<String> features);
/** * Add all the given features to the supported_host_features table. */
Add all the given features to the supported_host_features table
addAllSupportedHostFeature
{ "repo_name": "OpenUniversity/ovirt-engine", "path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/SupportedHostFeatureDao.java", "license": "apache-2.0", "size": 775 }
[ "java.util.Set", "org.ovirt.engine.core.compat.Guid" ]
import java.util.Set; import org.ovirt.engine.core.compat.Guid;
import java.util.*; import org.ovirt.engine.core.compat.*;
[ "java.util", "org.ovirt.engine" ]
java.util; org.ovirt.engine;
1,510,503
public void setAdditionalInfos(List<String> additionalInfos) { this.additionalInfos = additionalInfos; }
void function(List<String> additionalInfos) { this.additionalInfos = additionalInfos; }
/** * Sets the list of additionalInfos two structure elements must * both have or not have in order to have a non zero similarity * * @param additionalInfos the additionalInfos to set */
Sets the list of additionalInfos two structure elements must both have or not have in order to have a non zero similarity
setAdditionalInfos
{ "repo_name": "SAG-KeLP/kelp-additional-kernels", "path": "src/main/java/it/uniroma2/sag/kelp/data/representation/structure/similarity/SameAdditionalInfoStructureElementSimilarity.java", "license": "apache-2.0", "size": 3338 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,121,356
public void write(JobProcessing job_processing, byte[] pes_packet, int pes_packetoffset, int pes_payloadlength, boolean pes_hasHeader) { boolean pes_isAligned = false; int pes_extensionlength = 0; int offset = pes_packetoffset; int _es_streamtype = CommonParsing.AC3_AUDIO; pack++; if (pes_hasHeader) { if (CommonParsing.validateStartcode(pes_packet, offset) < 0) { Common.setMessage(Resource.getString("demux.error.audio.startcode") + " " + pack + " (" + Integer.toHexString(PID) + "/" + Integer.toHexString(pes_ID) + "/" + Integer.toHexString(newID) + "/" + es_streamtype + ")"); return; } pes_ID = CommonParsing.getPES_IdField(pes_packet, offset); pes_payloadlength = CommonParsing.getPES_LengthField(pes_packet, offset); pes_isAligned = (pes_streamtype == CommonParsing.PES_AV_TYPE || pes_streamtype == CommonParsing.MPEG2PS_TYPE) && (4 & pes_packet[6 + offset]) != 0; if (pes_ID == CommonParsing.PADDING_STREAM_CODE) return; if (pes_streamtype == CommonParsing.MPEG1PS_TYPE) { skiploop: while(true) { switch (0xC0 & pes_packet[6 + offset]) { case 0x40: offset += 2; continue skiploop; case 0x80: offset += 3; continue skiploop; case 0xC0: offset++; continue skiploop; case 0: break; } switch (0x30 & pes_packet[6 + offset]) { case 0x20: //PTS pes_extensionlength = 5; break skiploop; case 0x30: //PTS+DTS pes_extensionlength = 10; break skiploop; case 0x10: //DTS offset += 5; break skiploop; case 0: offset++; break skiploop; } } } else { pes_extensionlength = CommonParsing.getPES_ExtensionLengthField(pes_packet, offset); if (pes_ID == CommonParsing.PRIVATE_STREAM_1_CODE && pes_extensionlength == 0x24 && (0xFF & pes_packet[9 + pes_extensionlength + offset])>>>4 == 1) _es_streamtype = CommonParsing.TELETEXT; // workaround uk freesat teletext else if (pes_ID == CommonParsing.PRIVATE_STREAM_1_CODE && pes_extensionlength == 0x24 && (0xFF & pes_packet[9 + pes_extensionlength + offset]) == 0x99) _es_streamtype = CommonParsing.TELETEXT; if ((0x80 & pes_packet[7 + offset]) == 0) { offset += pes_extensionlength; pes_extensionlength = 0; } offset += 3; } es_streamtype = pes_ID == CommonParsing.PRIVATE_STREAM_1_CODE ? _es_streamtype : CommonParsing.MPEG_AUDIO; subid = ((es_streamtype == CommonParsing.AC3_AUDIO || es_streamtype == CommonParsing.DTS_AUDIO || es_streamtype == CommonParsing.TELETEXT) && ((pes_streamtype == CommonParsing.PES_AV_TYPE && (pes_isAligned || es_streamtype == CommonParsing.TELETEXT)) || pes_streamtype == CommonParsing.MPEG2PS_TYPE)) ? (0xFF & pes_packet[9 + (0xFF & pes_packet[8 + pes_packetoffset]) + pes_packetoffset]) : 0; // workaround uk freesat teletext if (isTTX()) subid &= 0x1F; switch (subid>>>4) { case 8: if (pes_streamtype == CommonParsing.PES_AV_TYPE || pes_streamtype == CommonParsing.MPEG1PS_TYPE) { subid = 0; break; } case 1: case 2: case 3: case 9: case 0xA: break; case 0: if (pes_isAligned && subid == 0x09) break; default: if (pes_streamtype != CommonParsing.MPEG2PS_TYPE) subid = 0; } switch (subid>>>4) { case 0xA: //LPCM from MPG-PS es_streamtype = CommonParsing.LPCM_AUDIO; break; case 2: //SubPic 0-31 from MPG-PS case 3: //SubPic 32-63 from MPG-PS es_streamtype = CommonParsing.SUBPICTURE; break; case 8: //AC3-DTS from MPG-PS case 1: //TTX case 0: //AC3-DTS from PES/VDR break; case 9: //VBI from TS,MPG2 if (pes_isAligned) { if (pes_streamtype == CommonParsing.MPEG1PS_TYPE || pes_streamtype == CommonParsing.PES_AV_TYPE) subid = 0; if (DecodeVBI) VBI.parsePES(pes_packet, pes_packetoffset); return; } break; default: return; } pes_payloadlength -= (offset - pes_packetoffset + pes_extensionlength); offset += 6; } if (!WriteNonVideo) return; if (out == null) return; try { // recreate PTS if (RebuildPTS && es_streamtype == CommonParsing.TELETEXT) { if (job_processing.getBorrowedPts() != lastPTS) { lastPTS = job_processing.getBorrowedPts(); pts_log.writeLong(lastPTS); pts_log.writeLong(target_position); if (Debug) System.out.println(" stolen ttx PTS: " + lastPTS + " /ao " + AddOffset + " /tp " + target_position); } } //recreate subpicture else if (RebuildPictPTS && es_streamtype == CommonParsing.SUBPICTURE) { if (job_processing.getBorrowedPts() != lastPTS) { lastPTS = job_processing.getBorrowedPts(); pts = lastPTS; //to rewrite into sp file pts_log.writeLong(lastPTS); pts_log.writeLong(target_position); if (Debug) System.out.println(" stolen subpic PTS: " + lastPTS + " /ao " + AddOffset + " /tp " + target_position); } } else if (pes_extensionlength > 0 && pes_payloadlength >= 0) { //--> �ndern pts = CommonParsing.getPTSfromBytes(pes_packet, offset); //returns 32bit pts -= job_processing.getNextFileStartPts(); pts &= 0xFFFFFFFFL; //trim to 32bit if ( (pts & 0xFF000000L) == 0xFF000000L ) ptsover = true; // bit 33 was set if (ptsover && pts < 0xF0000000L) pts |= 0x100000000L; //<-- pts += ptsoffset; pts += AddOffset; if (lastPTS != pts) { if ((es_streamtype == CommonParsing.MPEG_AUDIO || es_streamtype == CommonParsing.AC3_AUDIO || es_streamtype == CommonParsing.DTS_AUDIO || es_streamtype == CommonParsing.LPCM_AUDIO) && lastPTS != -1 && Math.abs(lastPTS - pts) > 100000) Common.setMessage("!> ID 0x" + Integer.toHexString(pes_ID).toUpperCase() + " (sub 0x" + Integer.toHexString(subid).toUpperCase() + ") packet# " + pack + ", big PTS difference: this " + pts + ", prev. " + lastPTS); pts_log.writeLong(pts); pts_log.writeLong(target_position); } if (Debug) System.out.println(" pda PTS: " + pts + "/ " + AddOffset + "/ " + target_position); lastPTS = pts; } //if (newID == 0xC0 && job_processing.getBorrowedPts() != lastPTS) if (!RebuildPTStoggle && newID == 0xC0 && job_processing.getBorrowedPts() != lastPTS) job_processing.setBorrowedPts(lastPTS); else if (RebuildPTStoggle && newID == 0x80 && job_processing.getBorrowedPts() != lastPTS) job_processing.setBorrowedPts(lastPTS); switch(subid>>>4) { case 0xA: //LPCM, keep info fields 6 bytes offset += 1; //7 pes_payloadlength -= 1; //7 break; case 8: //AC3-DTS offset += 4; pes_payloadlength -= 4; break; case 1: //TTX offset += 1; pes_payloadlength -= 1; break; case 2: //subpic 0.31 case 3: //subpic 32.63 offset += 1; pes_payloadlength -= 1; } if (subid == 0x09) { offset += 4; pes_payloadlength -= 4; } if (pes_payloadlength <= 0) return; if (pes_extensionlength > 0) { switch(es_streamtype) { case CommonParsing.SUBPICTURE: CommonParsing.setValue(subpicture_header, 2, 8, CommonParsing.BYTEREORDERING, pts); target_position += writePacket(subpicture_header); if (CommonParsing.nextBits(pes_packet, (offset + pes_extensionlength) * 8, 16) == 0xF) { out.write(0xFF & (pes_payloadlength + 3)>>>8); out.write(0xFF & (pes_payloadlength + 3)); out.write(0); //padding target_position += 3; } break; case CommonParsing.LPCM_AUDIO: CommonParsing.setValue(lpcm_header, 3, 5, CommonParsing.BYTEREORDERING, pts); lpcm_header[8] = (byte)(0xFF & pes_payloadlength>>>8); lpcm_header[9] = (byte)(0xFF & pes_payloadlength); target_position += writePacket(lpcm_header); } } else if (es_streamtype == CommonParsing.SUBPICTURE && pes_isAligned && CommonParsing.nextBits(pes_packet, (offset + pes_extensionlength) * 8, 16) == 0xF) // else if (es_streamtype == CommonParsing.SUBPICTURE && CommonParsing.nextBits(pes_packet, (offset + pes_extensionlength) * 8, 16) == 0xF) { CommonParsing.setValue(subpicture_header, 2, 8, CommonParsing.BYTEREORDERING, 0); target_position += writePacket(subpicture_header); out.write(0xFF & (pes_payloadlength + 3)>>>8); out.write(0xFF & (pes_payloadlength + 3)); out.write(0); //padding! target_position += 3; } if (subid == 0x09) for (int i = 0; i < pes_payloadlength; i += 3) target_position += writePacket(pes_packet, offset + pes_extensionlength + i, 2); else target_position += writePacket(pes_packet, offset + pes_extensionlength, pes_payloadlength); } catch (IOException e) { Common.setExceptionMessage(e); } }
void function(JobProcessing job_processing, byte[] pes_packet, int pes_packetoffset, int pes_payloadlength, boolean pes_hasHeader) { boolean pes_isAligned = false; int pes_extensionlength = 0; int offset = pes_packetoffset; int _es_streamtype = CommonParsing.AC3_AUDIO; pack++; if (pes_hasHeader) { if (CommonParsing.validateStartcode(pes_packet, offset) < 0) { Common.setMessage(Resource.getString(STR) + " " + pack + STR + Integer.toHexString(PID) + "/" + Integer.toHexString(pes_ID) + "/" + Integer.toHexString(newID) + "/" + es_streamtype + ")"); return; } pes_ID = CommonParsing.getPES_IdField(pes_packet, offset); pes_payloadlength = CommonParsing.getPES_LengthField(pes_packet, offset); pes_isAligned = (pes_streamtype == CommonParsing.PES_AV_TYPE pes_streamtype == CommonParsing.MPEG2PS_TYPE) && (4 & pes_packet[6 + offset]) != 0; if (pes_ID == CommonParsing.PADDING_STREAM_CODE) return; if (pes_streamtype == CommonParsing.MPEG1PS_TYPE) { skiploop: while(true) { switch (0xC0 & pes_packet[6 + offset]) { case 0x40: offset += 2; continue skiploop; case 0x80: offset += 3; continue skiploop; case 0xC0: offset++; continue skiploop; case 0: break; } switch (0x30 & pes_packet[6 + offset]) { case 0x20: pes_extensionlength = 5; break skiploop; case 0x30: pes_extensionlength = 10; break skiploop; case 0x10: offset += 5; break skiploop; case 0: offset++; break skiploop; } } } else { pes_extensionlength = CommonParsing.getPES_ExtensionLengthField(pes_packet, offset); if (pes_ID == CommonParsing.PRIVATE_STREAM_1_CODE && pes_extensionlength == 0x24 && (0xFF & pes_packet[9 + pes_extensionlength + offset])>>>4 == 1) _es_streamtype = CommonParsing.TELETEXT; else if (pes_ID == CommonParsing.PRIVATE_STREAM_1_CODE && pes_extensionlength == 0x24 && (0xFF & pes_packet[9 + pes_extensionlength + offset]) == 0x99) _es_streamtype = CommonParsing.TELETEXT; if ((0x80 & pes_packet[7 + offset]) == 0) { offset += pes_extensionlength; pes_extensionlength = 0; } offset += 3; } es_streamtype = pes_ID == CommonParsing.PRIVATE_STREAM_1_CODE ? _es_streamtype : CommonParsing.MPEG_AUDIO; subid = ((es_streamtype == CommonParsing.AC3_AUDIO es_streamtype == CommonParsing.DTS_AUDIO es_streamtype == CommonParsing.TELETEXT) && ((pes_streamtype == CommonParsing.PES_AV_TYPE && (pes_isAligned es_streamtype == CommonParsing.TELETEXT)) pes_streamtype == CommonParsing.MPEG2PS_TYPE)) ? (0xFF & pes_packet[9 + (0xFF & pes_packet[8 + pes_packetoffset]) + pes_packetoffset]) : 0; if (isTTX()) subid &= 0x1F; switch (subid>>>4) { case 8: if (pes_streamtype == CommonParsing.PES_AV_TYPE pes_streamtype == CommonParsing.MPEG1PS_TYPE) { subid = 0; break; } case 1: case 2: case 3: case 9: case 0xA: break; case 0: if (pes_isAligned && subid == 0x09) break; default: if (pes_streamtype != CommonParsing.MPEG2PS_TYPE) subid = 0; } switch (subid>>>4) { case 0xA: es_streamtype = CommonParsing.LPCM_AUDIO; break; case 2: case 3: es_streamtype = CommonParsing.SUBPICTURE; break; case 8: case 1: case 0: break; case 9: if (pes_isAligned) { if (pes_streamtype == CommonParsing.MPEG1PS_TYPE pes_streamtype == CommonParsing.PES_AV_TYPE) subid = 0; if (DecodeVBI) VBI.parsePES(pes_packet, pes_packetoffset); return; } break; default: return; } pes_payloadlength -= (offset - pes_packetoffset + pes_extensionlength); offset += 6; } if (!WriteNonVideo) return; if (out == null) return; try { if (RebuildPTS && es_streamtype == CommonParsing.TELETEXT) { if (job_processing.getBorrowedPts() != lastPTS) { lastPTS = job_processing.getBorrowedPts(); pts_log.writeLong(lastPTS); pts_log.writeLong(target_position); if (Debug) System.out.println(STR + lastPTS + STR + AddOffset + STR + target_position); } } else if (RebuildPictPTS && es_streamtype == CommonParsing.SUBPICTURE) { if (job_processing.getBorrowedPts() != lastPTS) { lastPTS = job_processing.getBorrowedPts(); pts = lastPTS; pts_log.writeLong(lastPTS); pts_log.writeLong(target_position); if (Debug) System.out.println(STR + lastPTS + STR + AddOffset + STR + target_position); } } else if (pes_extensionlength > 0 && pes_payloadlength >= 0) { pts = CommonParsing.getPTSfromBytes(pes_packet, offset); pts -= job_processing.getNextFileStartPts(); pts &= 0xFFFFFFFFL; if ( (pts & 0xFF000000L) == 0xFF000000L ) ptsover = true; if (ptsover && pts < 0xF0000000L) pts = 0x100000000L; pts += ptsoffset; pts += AddOffset; if (lastPTS != pts) { if ((es_streamtype == CommonParsing.MPEG_AUDIO es_streamtype == CommonParsing.AC3_AUDIO es_streamtype == CommonParsing.DTS_AUDIO es_streamtype == CommonParsing.LPCM_AUDIO) && lastPTS != -1 && Math.abs(lastPTS - pts) > 100000) Common.setMessage(STR + Integer.toHexString(pes_ID).toUpperCase() + STR + Integer.toHexString(subid).toUpperCase() + STR + pack + STR + pts + STR + lastPTS); pts_log.writeLong(pts); pts_log.writeLong(target_position); } if (Debug) System.out.println(STR + pts + STR + AddOffset + STR + target_position); lastPTS = pts; } if (!RebuildPTStoggle && newID == 0xC0 && job_processing.getBorrowedPts() != lastPTS) job_processing.setBorrowedPts(lastPTS); else if (RebuildPTStoggle && newID == 0x80 && job_processing.getBorrowedPts() != lastPTS) job_processing.setBorrowedPts(lastPTS); switch(subid>>>4) { case 0xA: offset += 1; pes_payloadlength -= 1; break; case 8: offset += 4; pes_payloadlength -= 4; break; case 1: offset += 1; pes_payloadlength -= 1; break; case 2: case 3: offset += 1; pes_payloadlength -= 1; } if (subid == 0x09) { offset += 4; pes_payloadlength -= 4; } if (pes_payloadlength <= 0) return; if (pes_extensionlength > 0) { switch(es_streamtype) { case CommonParsing.SUBPICTURE: CommonParsing.setValue(subpicture_header, 2, 8, CommonParsing.BYTEREORDERING, pts); target_position += writePacket(subpicture_header); if (CommonParsing.nextBits(pes_packet, (offset + pes_extensionlength) * 8, 16) == 0xF) { out.write(0xFF & (pes_payloadlength + 3)>>>8); out.write(0xFF & (pes_payloadlength + 3)); out.write(0); target_position += 3; } break; case CommonParsing.LPCM_AUDIO: CommonParsing.setValue(lpcm_header, 3, 5, CommonParsing.BYTEREORDERING, pts); lpcm_header[8] = (byte)(0xFF & pes_payloadlength>>>8); lpcm_header[9] = (byte)(0xFF & pes_payloadlength); target_position += writePacket(lpcm_header); } } else if (es_streamtype == CommonParsing.SUBPICTURE && pes_isAligned && CommonParsing.nextBits(pes_packet, (offset + pes_extensionlength) * 8, 16) == 0xF) { CommonParsing.setValue(subpicture_header, 2, 8, CommonParsing.BYTEREORDERING, 0); target_position += writePacket(subpicture_header); out.write(0xFF & (pes_payloadlength + 3)>>>8); out.write(0xFF & (pes_payloadlength + 3)); out.write(0); target_position += 3; } if (subid == 0x09) for (int i = 0; i < pes_payloadlength; i += 3) target_position += writePacket(pes_packet, offset + pes_extensionlength + i, 2); else target_position += writePacket(pes_packet, offset + pes_extensionlength, pes_payloadlength); } catch (IOException e) { Common.setExceptionMessage(e); } }
/** * process nonvideo data = 1 pespacket from demux */
process nonvideo data = 1 pespacket from demux
write
{ "repo_name": "vladimir-zahradnik/Project-X", "path": "src/sk/vzahradn/dvb/projectx/parser/StreamDemultiplexer.java", "license": "gpl-2.0", "size": 38394 }
[ "java.io.IOException", "sk.vzahradn.dvb.projectx.common.Common", "sk.vzahradn.dvb.projectx.common.JobProcessing", "sk.vzahradn.dvb.projectx.common.Resource" ]
import java.io.IOException; import sk.vzahradn.dvb.projectx.common.Common; import sk.vzahradn.dvb.projectx.common.JobProcessing; import sk.vzahradn.dvb.projectx.common.Resource;
import java.io.*; import sk.vzahradn.dvb.projectx.common.*;
[ "java.io", "sk.vzahradn.dvb" ]
java.io; sk.vzahradn.dvb;
197,230
public synchronized void clear(Object key) { Stack stack = (Stack)(_pools.remove(key)); destroyStack(key,stack); }
synchronized void function(Object key) { Stack stack = (Stack)(_pools.remove(key)); destroyStack(key,stack); }
/** * Clears the specified pool, removing all pooled instances corresponding to the given <code>key</code>. * * @param key the key to clear */
Clears the specified pool, removing all pooled instances corresponding to the given <code>key</code>
clear
{ "repo_name": "ZJU-Shaonian-Biancheng-Tuan/bbossgroups-3.5", "path": "bboss-persistent/src-jdk6/com/frameworkset/commons/pool/impl/StackKeyedObjectPool.java", "license": "apache-2.0", "size": 18090 }
[ "java.util.Stack" ]
import java.util.Stack;
import java.util.*;
[ "java.util" ]
java.util;
2,197,644
EList<IfcFaceBound> getBounds();
EList<IfcFaceBound> getBounds();
/** * Returns the value of the '<em><b>Bounds</b></em>' reference list. * The list contents are of type {@link cn.dlb.bim.models.ifc2x3tc1.IfcFaceBound}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Bounds</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Bounds</em>' reference list. * @see cn.dlb.bim.models.ifc2x3tc1.Ifc2x3tc1Package#getIfcFace_Bounds() * @model * @generated */
Returns the value of the 'Bounds' reference list. The list contents are of type <code>cn.dlb.bim.models.ifc2x3tc1.IfcFaceBound</code>. If the meaning of the 'Bounds' reference list isn't clear, there really should be more of a description here...
getBounds
{ "repo_name": "shenan4321/BIMplatform", "path": "generated/cn/dlb/bim/models/ifc2x3tc1/IfcFace.java", "license": "agpl-3.0", "size": 1827 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,939,982
public EpollServerChannelConfig setTcpFastopen(int pendingFastOpenRequestsThreshold) { checkPositiveOrZero(this.pendingFastOpenRequestsThreshold, "pendingFastOpenRequestsThreshold"); this.pendingFastOpenRequestsThreshold = pendingFastOpenRequestsThreshold; return this; }
EpollServerChannelConfig function(int pendingFastOpenRequestsThreshold) { checkPositiveOrZero(this.pendingFastOpenRequestsThreshold, STR); this.pendingFastOpenRequestsThreshold = pendingFastOpenRequestsThreshold; return this; }
/** * Enables tcpFastOpen on the server channel. If the underlying os doesn't support TCP_FASTOPEN setting this has no * effect. This has to be set before doing listen on the socket otherwise this takes no effect. * * @param pendingFastOpenRequestsThreshold number of requests to be pending for fastopen at a given point in time * for security. * * @see <a href="https://tools.ietf.org/html/rfc7413#appendix-A.2">RFC 7413 Passive Open</a> */
Enables tcpFastOpen on the server channel. If the underlying os doesn't support TCP_FASTOPEN setting this has no effect. This has to be set before doing listen on the socket otherwise this takes no effect
setTcpFastopen
{ "repo_name": "netty/netty", "path": "transport-classes-epoll/src/main/java/io/netty/channel/epoll/EpollServerChannelConfig.java", "license": "apache-2.0", "size": 7731 }
[ "io.netty.util.internal.ObjectUtil" ]
import io.netty.util.internal.ObjectUtil;
import io.netty.util.internal.*;
[ "io.netty.util" ]
io.netty.util;
2,794,356
public ResourceBundle getNumberFormatData(Locale locale) { return getBundle(type.getTextResourcesPackage() + ".FormatData", locale); }
ResourceBundle function(Locale locale) { return getBundle(type.getTextResourcesPackage() + STR, locale); }
/** * Gets a number format data resource bundle, using privileges * to allow accessing a sun.* package. */
Gets a number format data resource bundle, using privileges to allow accessing a sun.* package
getNumberFormatData
{ "repo_name": "JetBrains/jdk8u_jdk", "path": "src/share/classes/sun/util/resources/LocaleData.java", "license": "gpl-2.0", "size": 12224 }
[ "java.util.Locale", "java.util.ResourceBundle" ]
import java.util.Locale; import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
1,972,872
public Boolean insertDrugBatch(TrnDrugsSupplied b,int drugSrNo,int drugQty,int qty) { Boolean status = false; try { tx = session.beginTransaction(); MstDrugsNew drug = (MstDrugsNew) session.get(MstDrugsNew.class,drugSrNo); drug.setdQty(drugQty + qty); session.update(drug); session.save(b); status = true; tx.commit(); //session.getTransaction().commit(); } catch(HibernateException e) { status = false; if (tx!=null) { tx.rollback(); e.printStackTrace(); } } return status; }
Boolean function(TrnDrugsSupplied b,int drugSrNo,int drugQty,int qty) { Boolean status = false; try { tx = session.beginTransaction(); MstDrugsNew drug = (MstDrugsNew) session.get(MstDrugsNew.class,drugSrNo); drug.setdQty(drugQty + qty); session.update(drug); session.save(b); status = true; tx.commit(); } catch(HibernateException e) { status = false; if (tx!=null) { tx.rollback(); e.printStackTrace(); } } return status; }
/** * Inserts a new batch of a particular drug * @author Vishwa * @param b * @param drugSrNo * @param drugQty * @param qty * @return */
Inserts a new batch of a particular drug
insertDrugBatch
{ "repo_name": "SLIIT-FacultyOfComputing/Digital-Pulz-for-Hospitals", "path": "HIS_Latest_Project_29-07-2016/Backend/NewWorkspace_2016/HIS_API/src/main/java/lib/driver/pharmacy/driver_class/DrugDBDriver.java", "license": "apache-2.0", "size": 36328 }
[ "org.hibernate.HibernateException" ]
import org.hibernate.HibernateException;
import org.hibernate.*;
[ "org.hibernate" ]
org.hibernate;
1,113,414
public void setEventsRestClient(EventsRestClient eventsRestClient) { mEventsRestClient = eventsRestClient; }
void function(EventsRestClient eventsRestClient) { mEventsRestClient = eventsRestClient; }
/** * Update the events Rest client. * * @param eventsRestClient the events client */
Update the events Rest client
setEventsRestClient
{ "repo_name": "matrix-org/matrix-android-sdk", "path": "matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java", "license": "apache-2.0", "size": 79460 }
[ "org.matrix.androidsdk.rest.client.EventsRestClient" ]
import org.matrix.androidsdk.rest.client.EventsRestClient;
import org.matrix.androidsdk.rest.client.*;
[ "org.matrix.androidsdk" ]
org.matrix.androidsdk;
753,551
private void loadLexerRules(String lexersFilename) { LexiconUnmarshaller unmarshaller = new LexiconUnmarshaller(); Corpus corpus = unmarshaller.unmarshal(lexersFilename); ArrayList<LexerRule> ruleList = new ArrayList<LexerRule>(); List<W> lexers = corpus.getBody().getW(); for (W w : lexers) { LexerRule lr = new LexerRule(w.getMsd(), w.getContent()); // System.out.println(w.getMsd() + ": " + w.getContent()); ruleList.add(lr); } // convert the list of rules to an array and save it rules = ruleList.toArray(rules); }
void function(String lexersFilename) { LexiconUnmarshaller unmarshaller = new LexiconUnmarshaller(); Corpus corpus = unmarshaller.unmarshal(lexersFilename); ArrayList<LexerRule> ruleList = new ArrayList<LexerRule>(); List<W> lexers = corpus.getBody().getW(); for (W w : lexers) { LexerRule lr = new LexerRule(w.getMsd(), w.getContent()); ruleList.add(lr); } rules = ruleList.toArray(rules); }
/** * Load lexer specification file. This text file contains lexical rules to * tokenize a text * * @param lexersFilename * specification file */
Load lexer specification file. This text file contains lexical rules to tokenize a text
loadLexerRules
{ "repo_name": "heartsmile/VietSemtimentDemo2", "path": "VietSentiment/src/main/java/vn/hus/nlp/tokenizer/Tokenizer.java", "license": "gpl-2.0", "size": 17449 }
[ "java.util.ArrayList", "java.util.List", "vn.hus.nlp.lexicon.LexiconUnmarshaller", "vn.hus.nlp.lexicon.jaxb.Corpus", "vn.hus.nlp.tokenizer.tokens.LexerRule" ]
import java.util.ArrayList; import java.util.List; import vn.hus.nlp.lexicon.LexiconUnmarshaller; import vn.hus.nlp.lexicon.jaxb.Corpus; import vn.hus.nlp.tokenizer.tokens.LexerRule;
import java.util.*; import vn.hus.nlp.lexicon.*; import vn.hus.nlp.lexicon.jaxb.*; import vn.hus.nlp.tokenizer.tokens.*;
[ "java.util", "vn.hus.nlp" ]
java.util; vn.hus.nlp;
1,299,488
protected void computeLayout(int w, int h) { mLayout.prepareLayout(); if (shouldRecalculateScrollWhenComputingLayout) { computeViewPort(mLayout); } Map<Object, FreeFlowItem> oldFrames = frames; frames = new LinkedHashMap<Object, FreeFlowItem>(); copyFrames(mLayout.getItemProxies(viewPortX, viewPortY), frames); // Create a copy of the incoming values because the source // layout may change the map inside its own class dispatchLayoutComputed(); animateChanges(getViewChanges(oldFrames, frames)); }
void function(int w, int h) { mLayout.prepareLayout(); if (shouldRecalculateScrollWhenComputingLayout) { computeViewPort(mLayout); } Map<Object, FreeFlowItem> oldFrames = frames; frames = new LinkedHashMap<Object, FreeFlowItem>(); copyFrames(mLayout.getItemProxies(viewPortX, viewPortY), frames); dispatchLayoutComputed(); animateChanges(getViewChanges(oldFrames, frames)); }
/** * The heart of the system. Calls the layout to get the frames needed, * decides which view should be kept in focus if view transitions are going * to happen and then kicks off animation changes if things have changed * * @param w * Width of the viewport. Since right now we don't support * margins and padding, this is width of the container. * @param h * Height of the viewport. Since right now we don't support * margins and padding, this is height of the container. */
The heart of the system. Calls the layout to get the frames needed, decides which view should be kept in focus if view transitions are going to happen and then kicks off animation changes if things have changed
computeLayout
{ "repo_name": "predator11/FreeFlow-2-", "path": "FreeFlow/src/com/comcast/freeflow/core/FreeFlowContainer.java", "license": "apache-2.0", "size": 52657 }
[ "java.util.LinkedHashMap", "java.util.Map" ]
import java.util.LinkedHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,630,103
public boolean isPreciousMetal() { return false; } /** * Get the {@link Currency} instance that corresponds to * this currency code. * * <p> * This method is an alias of {@link Currency}{@code .}{@link * Currency#getInstance(String) getInstance}{@code (this.name())}. * The only difference is that this method returns {@code null}
boolean function() { return false; } /** * Get the {@link Currency} instance that corresponds to * this currency code. * * <p> * This method is an alias of {@link Currency}{@code .}{ * Currency#getInstance(String) getInstance}{@code (this.name())}. * The only difference is that this method returns {@code null}
/** * Check if this currency code represents a precious metal. * * <p> * {@code CurrencyCode} instances listed below return {@code true}. * </p> * * <ul> * <li>{@link #XAG} Silver * <li>{@link #XAU} Gold * <li>{@link #XPD} Palladium * <li>{@link #XPT} Platinum * </ul> * * @return * True if this currency code represents a precious metal. */
Check if this currency code represents a precious metal. CurrencyCode instances listed below return true. <code>#XAG</code> Silver <code>#XAU</code> Gold <code>#XPD</code> Palladium <code>#XPT</code> Platinum
isPreciousMetal
{ "repo_name": "TakahikoKawasaki/nv-i18n", "path": "src/main/java/com/neovisionaries/i18n/CurrencyCode.java", "license": "apache-2.0", "size": 79951 }
[ "java.util.Currency" ]
import java.util.Currency;
import java.util.*;
[ "java.util" ]
java.util;
226,170
@Description( "The Compute Engine zone " + "(https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker " + "processing should occur, e.g. \"us-west1-a\". Mutually exclusive with workerRegion. " + "If neither workerRegion nor workerZone is specified, the Dataflow service will choose " + "a zone in region based on available capacity.") String getWorkerZone();
@Description( STR + STRprocessing should occur, e.g. \STR. Mutually exclusive with workerRegion. STRIf neither workerRegion nor workerZone is specified, the Dataflow service will choose STRa zone in region based on available capacity.") String getWorkerZone();
/** * The Compute Engine zone (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in * which worker processing should occur, e.g. "us-west1-a". Mutually exclusive with {@link * #getWorkerRegion()}. If neither workerRegion nor workerZone is specified, the Dataflow service * will choose a zone in region based on available capacity. */
The Compute Engine zone (HREF) in which worker processing should occur, e.g. "us-west1-a". Mutually exclusive with <code>#getWorkerRegion()</code>. If neither workerRegion nor workerZone is specified, the Dataflow service will choose a zone in region based on available capacity
getWorkerZone
{ "repo_name": "RyanSkraba/beam", "path": "sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/options/GcpOptions.java", "license": "apache-2.0", "size": 20182 }
[ "org.apache.beam.sdk.options.Description" ]
import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.options.*;
[ "org.apache.beam" ]
org.apache.beam;
2,788,590
public static void invokeAndWait(final Runnable runnable) { if(runnable != null) { try { SwingUtilities.invokeAndWait(runnable); } catch(final InvocationTargetException | InterruptedException e) { // Do nothing. } } }
static void function(final Runnable runnable) { if(runnable != null) { try { SwingUtilities.invokeAndWait(runnable); } catch(final InvocationTargetException InterruptedException e) { } } }
/** * Invokes {@code runnable} in the Event Dispatch Thread and waits for its execution to complete. * <p> * This method is similar to the one provided by {@code SwingUtilities}. But it differs in that you don't have to catch its checked {@code Exception}s. It simply ignores them. * <p> * If {@code runnable} is {@code null}, nothing will happen. * * @param runnable the {@code Runnable} to invoke and execute in the Event Dispatch Thread */
Invokes runnable in the Event Dispatch Thread and waits for its execution to complete. This method is similar to the one provided by SwingUtilities. But it differs in that you don't have to catch its checked Exceptions. It simply ignores them. If runnable is null, nothing will happen
invokeAndWait
{ "repo_name": "macroing/OpenRC", "path": "src/main/java/org/macroing/gdt/openrc/swing/SwingUtilities2.java", "license": "lgpl-3.0", "size": 5268 }
[ "java.lang.reflect.InvocationTargetException", "javax.swing.SwingUtilities" ]
import java.lang.reflect.InvocationTargetException; import javax.swing.SwingUtilities;
import java.lang.reflect.*; import javax.swing.*;
[ "java.lang", "javax.swing" ]
java.lang; javax.swing;
2,238,467
public List<SubResource> httpListeners() { return this.httpListeners; }
List<SubResource> function() { return this.httpListeners; }
/** * Get a collection of references to application gateway http listeners. * * @return the httpListeners value */
Get a collection of references to application gateway http listeners
httpListeners
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/WebApplicationFirewallPolicyInner.java", "license": "mit", "size": 7002 }
[ "com.microsoft.azure.SubResource", "java.util.List" ]
import com.microsoft.azure.SubResource; import java.util.List;
import com.microsoft.azure.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
1,493,812
protected Comparator<?> getInitialBeanSortComparator() { if (initialBeanSortComparator == NO_COMPARATOR) { DeprPmTableCfg tableCfg = AnnotationUtil.findAnnotation(this, DeprPmTableCfg.class); initialBeanSortComparator = (tableCfg != null && tableCfg.initialBeanSortComparator() != Comparator.class) ? (Comparator<?>) ClassUtil.newInstance(tableCfg.initialBeanSortComparator()) : null; } return initialBeanSortComparator; }
Comparator<?> function() { if (initialBeanSortComparator == NO_COMPARATOR) { DeprPmTableCfg tableCfg = AnnotationUtil.findAnnotation(this, DeprPmTableCfg.class); initialBeanSortComparator = (tableCfg != null && tableCfg.initialBeanSortComparator() != Comparator.class) ? (Comparator<?>) ClassUtil.newInstance(tableCfg.initialBeanSortComparator()) : null; } return initialBeanSortComparator; }
/** * Defines a bean comparator that provides the initial table sort order. * <p> * The default implementation provides the comparator defined in {@link DeprPmTableCfg#initialBeanSortComparator()}. * * @return The bean sort comparator. May be <code>null</code>. */
Defines a bean comparator that provides the initial table sort order. The default implementation provides the comparator defined in <code>DeprPmTableCfg#initialBeanSortComparator()</code>
getInitialBeanSortComparator
{ "repo_name": "pm4j/org.pm4j", "path": "pm4j-deprecated/src/main/java/org/pm4j/deprecated/core/pm/impl/DeprPmTableImpl.java", "license": "bsd-2-clause", "size": 27288 }
[ "java.util.Comparator", "org.pm4j.common.util.reflection.ClassUtil", "org.pm4j.core.pm.impl.AnnotationUtil", "org.pm4j.deprecated.core.pm.annotation.DeprPmTableCfg" ]
import java.util.Comparator; import org.pm4j.common.util.reflection.ClassUtil; import org.pm4j.core.pm.impl.AnnotationUtil; import org.pm4j.deprecated.core.pm.annotation.DeprPmTableCfg;
import java.util.*; import org.pm4j.common.util.reflection.*; import org.pm4j.core.pm.impl.*; import org.pm4j.deprecated.core.pm.annotation.*;
[ "java.util", "org.pm4j.common", "org.pm4j.core", "org.pm4j.deprecated" ]
java.util; org.pm4j.common; org.pm4j.core; org.pm4j.deprecated;
2,744,674
protected int nextInContent() throws IOException, XMLException { switch (current) { case -1: return LexicalUnits.EOF; case '&': return readReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case '[': context = CDATA_SECTION_CONTEXT; return readIdentifier("CDATA[", LexicalUnits.CDATA_START, -1); default: throw createXMLException("invalid.character"); } case '/': nextChar(); context = END_TAG_CONTEXT; return readName(LexicalUnits.END_TAG); default: depth++; context = START_TAG_CONTEXT; return readName(LexicalUnits.START_TAG); } default: loop: for (;;) { switch (current) { default: nextChar(); break; case -1: case '&': case '<': break loop; } } return LexicalUnits.CHARACTER_DATA; } }
int function() throws IOException, XMLException { switch (current) { case -1: return LexicalUnits.EOF; case '&': return readReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case '[': context = CDATA_SECTION_CONTEXT; return readIdentifier(STR, LexicalUnits.CDATA_START, -1); default: throw createXMLException(STR); } case '/': nextChar(); context = END_TAG_CONTEXT; return readName(LexicalUnits.END_TAG); default: depth++; context = START_TAG_CONTEXT; return readName(LexicalUnits.START_TAG); } default: loop: for (;;) { switch (current) { default: nextChar(); break; case -1: case '&': case '<': break loop; } } return LexicalUnits.CHARACTER_DATA; } }
/** * Returns the next lexical unit in the context of an element content. */
Returns the next lexical unit in the context of an element content
nextInContent
{ "repo_name": "apache/batik", "path": "batik-xml/src/main/java/org/apache/batik/xml/XMLScanner.java", "license": "apache-2.0", "size": 60774 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
562,662
private List<AlluxioURI> startupCheckConsistency(final ExecutorService service) throws InterruptedException, IOException { final long completionMarker = -1; final BlockingQueue<Long> dirsToCheck = new LinkedBlockingQueue<>(); final class StartupConsistencyChecker implements Callable<List<AlluxioURI>> { private final Long mFileId; private StartupConsistencyChecker(Long fileId) { mFileId = fileId; }
List<AlluxioURI> function(final ExecutorService service) throws InterruptedException, IOException { final long completionMarker = -1; final BlockingQueue<Long> dirsToCheck = new LinkedBlockingQueue<>(); final class StartupConsistencyChecker implements Callable<List<AlluxioURI>> { private final Long mFileId; private StartupConsistencyChecker(Long fileId) { mFileId = fileId; }
/** * Checks the consistency of the root in a multi-threaded and incremental fashion. This method * will only READ lock the directories and files actively being checked and release them after the * check on the file / directory is complete. * * @return a list of paths in Alluxio which are not consistent with the under storage * @throws InterruptedException if the thread is interrupted during execution */
Checks the consistency of the root in a multi-threaded and incremental fashion. This method will only READ lock the directories and files actively being checked and release them after the check on the file / directory is complete
startupCheckConsistency
{ "repo_name": "Reidddddd/mo-alluxio", "path": "core/server/master/src/main/java/alluxio/master/file/DefaultFileSystemMaster.java", "license": "apache-2.0", "size": 129113 }
[ "java.io.IOException", "java.util.List", "java.util.concurrent.BlockingQueue", "java.util.concurrent.Callable", "java.util.concurrent.ExecutorService", "java.util.concurrent.LinkedBlockingQueue" ]
import java.io.IOException; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue;
import java.io.*; import java.util.*; import java.util.concurrent.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,538,863
public final Index createIndex(Session session, HsqlName name, int[] columns, boolean[] descending, boolean[] nullsLast, boolean unique, boolean constraint, boolean forward) { Index newIndex = createAndAddIndexStructure(name, columns, descending, nullsLast, unique, constraint, forward); return newIndex; }
final Index function(Session session, HsqlName name, int[] columns, boolean[] descending, boolean[] nullsLast, boolean unique, boolean constraint, boolean forward) { Index newIndex = createAndAddIndexStructure(name, columns, descending, nullsLast, unique, constraint, forward); return newIndex; }
/** * Create new memory-resident index. For MEMORY and TEXT tables. */
Create new memory-resident index. For MEMORY and TEXT tables
createIndex
{ "repo_name": "ggorsontanguy/pocHSQLDB", "path": "hsqldb-2.2.9/hsqldb/src/org/hsqldb/TableBase.java", "license": "gpl-3.0", "size": 17056 }
[ "org.hsqldb.HsqlNameManager", "org.hsqldb.index.Index" ]
import org.hsqldb.HsqlNameManager; import org.hsqldb.index.Index;
import org.hsqldb.*; import org.hsqldb.index.*;
[ "org.hsqldb", "org.hsqldb.index" ]
org.hsqldb; org.hsqldb.index;
1,292,902
@Generated(hash = 128553479) public void delete() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.delete(this); }
@Generated(hash = 128553479) void function() { if (myDao == null) { throw new DaoException(STR); } myDao.delete(this); }
/** * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}. * Entity must attached to an entity context. */
Convenient call for <code>org.greenrobot.greendao.AbstractDao#delete(Object)</code>. Entity must attached to an entity context
delete
{ "repo_name": "diaus/TimeTracker", "path": "app/src/main/java/com/andrew/timetracker/database/Timeline.java", "license": "gpl-3.0", "size": 4161 }
[ "org.greenrobot.greendao.DaoException", "org.greenrobot.greendao.annotation.Generated" ]
import org.greenrobot.greendao.DaoException; import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.*; import org.greenrobot.greendao.annotation.*;
[ "org.greenrobot.greendao" ]
org.greenrobot.greendao;
2,867,121
public List<Application> listApplications( String exactName ) throws ManagementWsException { if( exactName != null ) this.logger.finer( "List/finding the application named " + exactName + "." ); else this.logger.finer( "Listing all the applications." ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); if( exactName != null ) path = path.queryParam( "name", exactName ); List<Application> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Application>> () {}); if( result != null ) this.logger.finer( result.size() + " applications were found on the DM." ); else this.logger.finer( "No application was found on the DM." ); return result != null ? result : new ArrayList<Application> (); }
List<Application> function( String exactName ) throws ManagementWsException { if( exactName != null ) this.logger.finer( STR + exactName + "." ); else this.logger.finer( STR ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); if( exactName != null ) path = path.queryParam( "name", exactName ); List<Application> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Application>> () {}); if( result != null ) this.logger.finer( result.size() + STR ); else this.logger.finer( STR ); return result != null ? result : new ArrayList<Application> (); }
/** * Lists applications. * @param exactName if not null, the result list will contain at most one application (with this name) * @return a non-null list of applications * @throws ManagementWsException if a problem occurred with the applications management */
Lists applications
listApplications
{ "repo_name": "gibello/roboconf", "path": "miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java", "license": "apache-2.0", "size": 13690 }
[ "com.sun.jersey.api.client.GenericType", "com.sun.jersey.api.client.WebResource", "java.util.ArrayList", "java.util.List", "javax.ws.rs.core.MediaType", "net.roboconf.core.model.beans.Application", "net.roboconf.dm.rest.client.exceptions.ManagementWsException", "net.roboconf.dm.rest.commons.UrlConstants" ]
import com.sun.jersey.api.client.GenericType; import com.sun.jersey.api.client.WebResource; import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.MediaType; import net.roboconf.core.model.beans.Application; import net.roboconf.dm.rest.client.exceptions.ManagementWsException; import net.roboconf.dm.rest.commons.UrlConstants;
import com.sun.jersey.api.client.*; import java.util.*; import javax.ws.rs.core.*; import net.roboconf.core.model.beans.*; import net.roboconf.dm.rest.client.exceptions.*; import net.roboconf.dm.rest.commons.*;
[ "com.sun.jersey", "java.util", "javax.ws", "net.roboconf.core", "net.roboconf.dm" ]
com.sun.jersey; java.util; javax.ws; net.roboconf.core; net.roboconf.dm;
1,433,068
public void beforeFirst() throws SQLException { synchronized (checkClosed().getConnectionMutex()) { if (this.onInsertRow) { this.onInsertRow = false; } if (this.doingUpdates) { this.doingUpdates = false; } if (this.rowData.size() == 0) { return; } if (this.thisRow != null) { this.thisRow.closeOpenStreams(); } this.rowData.beforeFirst(); this.thisRow = null; setRowPositionValidity(); } } // --------------------------------------------------------------------- // Traversal/Positioning // ---------------------------------------------------------------------
void function() throws SQLException { synchronized (checkClosed().getConnectionMutex()) { if (this.onInsertRow) { this.onInsertRow = false; } if (this.doingUpdates) { this.doingUpdates = false; } if (this.rowData.size() == 0) { return; } if (this.thisRow != null) { this.thisRow.closeOpenStreams(); } this.rowData.beforeFirst(); this.thisRow = null; setRowPositionValidity(); } }
/** * JDBC 2.0 * * <p> * Moves to the front of the result set, just before the first row. Has no effect if the result set contains no rows. * </p> * * @exception SQLException * if a database-access error occurs, or result set type is * TYPE_FORWARD_ONLY */
JDBC 2.0 Moves to the front of the result set, just before the first row. Has no effect if the result set contains no rows.
beforeFirst
{ "repo_name": "martingh15/TPJava", "path": "TPJavaNotebook/mysql-connector-java-5.1.39/src/com/mysql/jdbc/ResultSetImpl.java", "license": "mpl-2.0", "size": 288777 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
695,145
private void setColumns(String xID, String yID, SeriesData s) throws GraphException, JSONException { JSONArray xValues = new JSONArray(); JSONArray yValues = new JSONArray(); xValues.put(xID); yValues.put(yID); int barIndex = 0; boolean addBarLabels = mData.getType().equals(GraphUtil.TYPE_BAR) && mBarLabels.length() == 1; JSONArray rValues = new JSONArray(); double maxRadius = parseDouble(s.getConfiguration("max-radius", "0"), "max-radius"); for (XYPointData p : s.getPoints()) { String description = "data (" + p.getX() + ", " + p.getY() + ")"; if (mData.getType().equals(GraphUtil.TYPE_BAR)) { // In CommCare, bar graphs are specified with x as a set of text labels // and y as a set of values. In C3, bar graphs are still basically // of XY graphs, with numeric x and y values. Deal with this by // assigning an arbitrary, evenly-spaced x value to each bar and then // using the user's x values as custom labels. xValues.put(barIndex + 1); mBarCount = Math.max(mBarCount, barIndex + 1); if (addBarLabels) { mBarLabels.put(p.getX()); } } else { if (mData.getType().equals(GraphUtil.TYPE_TIME)) { String time = parseTime(p.getX(), description); // c3 needs YYYY-MM-DD HH:MM:SS format xValues.put(time); } else { double val = parseDouble(p.getX(), description); xValues.put(val); } } yValues.put(parseDouble(p.getY(), description)); // Bubble charts also get a radius if (mData.getType().equals(GraphUtil.TYPE_BUBBLE)) { BubblePointData b = (BubblePointData)p; double r = parseDouble(b.getRadius(), description + " with radius " + b.getRadius()); rValues.put(r); maxRadius = Math.max(maxRadius, r); } barIndex++; } mColumns.put(xValues); mColumns.put(yValues); if (mData.getType().equals(GraphUtil.TYPE_BUBBLE)) { mRadii.put(yID, rValues); mMaxRadii.put(yID, maxRadius); } }
void function(String xID, String yID, SeriesData s) throws GraphException, JSONException { JSONArray xValues = new JSONArray(); JSONArray yValues = new JSONArray(); xValues.put(xID); yValues.put(yID); int barIndex = 0; boolean addBarLabels = mData.getType().equals(GraphUtil.TYPE_BAR) && mBarLabels.length() == 1; JSONArray rValues = new JSONArray(); double maxRadius = parseDouble(s.getConfiguration(STR, "0"), STR); for (XYPointData p : s.getPoints()) { String description = STR + p.getX() + STR + p.getY() + ")"; if (mData.getType().equals(GraphUtil.TYPE_BAR)) { xValues.put(barIndex + 1); mBarCount = Math.max(mBarCount, barIndex + 1); if (addBarLabels) { mBarLabels.put(p.getX()); } } else { if (mData.getType().equals(GraphUtil.TYPE_TIME)) { String time = parseTime(p.getX(), description); xValues.put(time); } else { double val = parseDouble(p.getX(), description); xValues.put(val); } } yValues.put(parseDouble(p.getY(), description)); if (mData.getType().equals(GraphUtil.TYPE_BUBBLE)) { BubblePointData b = (BubblePointData)p; double r = parseDouble(b.getRadius(), description + STR + b.getRadius()); rValues.put(r); maxRadius = Math.max(maxRadius, r); } barIndex++; } mColumns.put(xValues); mColumns.put(yValues); if (mData.getType().equals(GraphUtil.TYPE_BUBBLE)) { mRadii.put(yID, rValues); mMaxRadii.put(yID, maxRadius); } }
/** * Set up data: x, y, and radius values * * @param xID ID of the x-values array * @param yID ID of the y-values array * @param s The SeriesData providing the data */
Set up data: x, y, and radius values
setColumns
{ "repo_name": "dimagi/commcare", "path": "src/main/java/org/commcare/core/graph/c3/DataConfiguration.java", "license": "apache-2.0", "size": 19504 }
[ "org.commcare.core.graph.model.BubblePointData", "org.commcare.core.graph.model.SeriesData", "org.commcare.core.graph.model.XYPointData", "org.commcare.core.graph.util.GraphException", "org.commcare.core.graph.util.GraphUtil", "org.json.JSONArray", "org.json.JSONException" ]
import org.commcare.core.graph.model.BubblePointData; import org.commcare.core.graph.model.SeriesData; import org.commcare.core.graph.model.XYPointData; import org.commcare.core.graph.util.GraphException; import org.commcare.core.graph.util.GraphUtil; import org.json.JSONArray; import org.json.JSONException;
import org.commcare.core.graph.model.*; import org.commcare.core.graph.util.*; import org.json.*;
[ "org.commcare.core", "org.json" ]
org.commcare.core; org.json;
1,995,537
private Class getClassFromString(String repositoryIDString, String codebaseURL) { RepositoryIdInterface repositoryID = repIdStrs.getFromString(repositoryIDString); for (int i = 0; i < 3; i++) { try { switch (i) { case 0: // First try to load the class locally return repositoryID.getClassFromType(); case 1: // Try to load the class using the provided // codebase URL (falls out below) break; case 2: // Try to load the class using a URL from the // remote CodeBase codebaseURL = getCodeBase().implementation(repositoryIDString); break; } // Don't bother if the codebaseURL is null if (codebaseURL == null) continue; return repositoryID.getClassFromType(codebaseURL); } catch(ClassNotFoundException cnfe) { // Will ultimately return null if all three // attempts fail, but don't do anything here. } catch (MalformedURLException mue) { throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE, mue, repositoryIDString, codebaseURL ) ; } } // If we get here, we have failed to load the class dprint("getClassFromString failed with rep id " + repositoryIDString + " and codebase " + codebaseURL); return null; }
Class function(String repositoryIDString, String codebaseURL) { RepositoryIdInterface repositoryID = repIdStrs.getFromString(repositoryIDString); for (int i = 0; i < 3; i++) { try { switch (i) { case 0: return repositoryID.getClassFromType(); case 1: break; case 2: codebaseURL = getCodeBase().implementation(repositoryIDString); break; } if (codebaseURL == null) continue; return repositoryID.getClassFromType(codebaseURL); } catch(ClassNotFoundException cnfe) { } catch (MalformedURLException mue) { throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE, mue, repositoryIDString, codebaseURL ) ; } } dprint(STR + repositoryIDString + STR + codebaseURL); return null; }
/** * Attempts to find the class described by the given * repository ID string. At most, three attempts are made: * Try to find it locally, through the provided URL, and * finally, via a URL from the remote CodeBase. */
Attempts to find the class described by the given repository ID string. At most, three attempts are made: Try to find it locally, through the provided URL, and finally, via a URL from the remote CodeBase
getClassFromString
{ "repo_name": "JetBrains/jdk8u_corba", "path": "src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java", "license": "gpl-2.0", "size": 82746 }
[ "com.sun.corba.se.impl.orbutil.RepositoryIdInterface", "java.net.MalformedURLException", "org.omg.CORBA" ]
import com.sun.corba.se.impl.orbutil.RepositoryIdInterface; import java.net.MalformedURLException; import org.omg.CORBA;
import com.sun.corba.se.impl.orbutil.*; import java.net.*; import org.omg.*;
[ "com.sun.corba", "java.net", "org.omg" ]
com.sun.corba; java.net; org.omg;
1,015,161
private static void validateIpFamilyPolicy(Set<String> errors, GenericKafkaListener listener) { if (KafkaListenerType.INTERNAL == listener.getType() && listener.getConfiguration().getIpFamilyPolicy() != null) { errors.add("listener " + listener.getName() + " cannot configure ipFamilyPolicy because it is not internal listener"); } }
static void function(Set<String> errors, GenericKafkaListener listener) { if (KafkaListenerType.INTERNAL == listener.getType() && listener.getConfiguration().getIpFamilyPolicy() != null) { errors.add(STR + listener.getName() + STR); } }
/** * Validates that ipFamilyPolicy is used only with external listeners * * @param errors List where any found errors will be added * @param listener Listener which needs to be validated */
Validates that ipFamilyPolicy is used only with external listeners
validateIpFamilyPolicy
{ "repo_name": "ppatierno/kaas", "path": "cluster-operator/src/main/java/io/strimzi/operator/cluster/model/ListenersValidator.java", "license": "apache-2.0", "size": 29986 }
[ "io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener", "io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType", "java.util.Set" ]
import io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener; import io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType; import java.util.Set;
import io.strimzi.api.kafka.model.listener.arraylistener.*; import java.util.*;
[ "io.strimzi.api", "java.util" ]
io.strimzi.api; java.util;
820,987
@Override public synchronized void reportForeignHostFailed(int hostId) { long initiatorSiteId = CoreUtils.getHSIdFromHostAndSite(hostId, AGREEMENT_SITE_ID); m_agreementSite.reportFault(initiatorSiteId); if (!m_shuttingDown) { logger.warn(String.format("Host %d failed", hostId)); } }
synchronized void function(int hostId) { long initiatorSiteId = CoreUtils.getHSIdFromHostAndSite(hostId, AGREEMENT_SITE_ID); m_agreementSite.reportFault(initiatorSiteId); if (!m_shuttingDown) { logger.warn(String.format(STR, hostId)); } }
/** * Synchronization protects m_knownFailedHosts and ensures that every failed host is only reported * once */
Synchronization protects m_knownFailedHosts and ensures that every failed host is only reported once
reportForeignHostFailed
{ "repo_name": "wolffcm/voltdb", "path": "src/frontend/org/voltcore/messaging/HostMessenger.java", "license": "agpl-3.0", "size": 40921 }
[ "org.voltcore.utils.CoreUtils" ]
import org.voltcore.utils.CoreUtils;
import org.voltcore.utils.*;
[ "org.voltcore.utils" ]
org.voltcore.utils;
2,494,104
private String calCommentRating(String comment){ int pos = 0; int neg = 0; int neu = 0; Set<String> words = new HashSet<String>(); String delims = "[ \t\n.,?!\"]+"; String[] tokens = comment.split(delims); for (int i = 0; i < tokens.length; i++){ if (!words.contains(tokens[i])) words.add(tokens[i]); } Iterator it = words.iterator(); while (it.hasNext()){ String word = ((String) it.next()).toLowerCase(); if (keyWordList.getPositveKeyWord().contains(word)){ pos++; } else if (keyWordList.getNegativeKeyWord().contains(word)){ neg++; } else if (keyWordList.getNeutralKeyWord().contains(word)){ neu++; } } if (pos+neg == 0) return "Neutral"; if (pos > neg) return "Positive"; if (neg > pos) return "Negative"; return "Neutral"; }
String function(String comment){ int pos = 0; int neg = 0; int neu = 0; Set<String> words = new HashSet<String>(); String delims = STR]+STRNeutralSTRPositiveSTRNegativeSTRNeutral"; }
/** * Cal comment rating. * * @param comment the comment * @return the string */
Cal comment rating
calCommentRating
{ "repo_name": "CS3343G20/moviereviewsystem", "path": "MovieReview/src/MovieReview/Database.java", "license": "apache-2.0", "size": 7144 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
528,282
static void acceptTermsOfService(boolean allowCrashUpload) { UmaSessionStats.changeMetricsReportingConsent(allowCrashUpload); SharedPreferencesManager.getInstance().writeBoolean( ChromePreferenceKeys.FIRST_RUN_CACHED_TOS_ACCEPTED, true); setEulaAccepted(); }
static void acceptTermsOfService(boolean allowCrashUpload) { UmaSessionStats.changeMetricsReportingConsent(allowCrashUpload); SharedPreferencesManager.getInstance().writeBoolean( ChromePreferenceKeys.FIRST_RUN_CACHED_TOS_ACCEPTED, true); setEulaAccepted(); }
/** * Sets the EULA/Terms of Services state as "ACCEPTED". * @param allowCrashUpload True if the user allows to upload crash dumps and collect stats. */
Sets the EULA/Terms of Services state as "ACCEPTED"
acceptTermsOfService
{ "repo_name": "scheib/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java", "license": "bsd-3-clause", "size": 6545 }
[ "org.chromium.chrome.browser.metrics.UmaSessionStats", "org.chromium.chrome.browser.preferences.ChromePreferenceKeys", "org.chromium.chrome.browser.preferences.SharedPreferencesManager" ]
import org.chromium.chrome.browser.metrics.UmaSessionStats; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
import org.chromium.chrome.browser.metrics.*; import org.chromium.chrome.browser.preferences.*;
[ "org.chromium.chrome" ]
org.chromium.chrome;
346,102
public int getType() throws SQLException { return ResultSet.TYPE_SCROLL_INSENSITIVE; }
int function() throws SQLException { return ResultSet.TYPE_SCROLL_INSENSITIVE; }
/** * Retrieves the type of this <code>ResultSet</code> object. * The type is determined by the <code>Statement</code> object * that created the result set. * * @return <code>ResultSet.TYPE_FORWARD_ONLY</code>, * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, * or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> * @exception SQLException if a database access error occurs * @since 1.2 */
Retrieves the type of this <code>ResultSet</code> object. The type is determined by the <code>Statement</code> object that created the result set
getType
{ "repo_name": "OpenBD/openbd-core", "path": "src/com/naryx/tagfusion/cfm/engine/cfQueryResultData.java", "license": "gpl-3.0", "size": 154192 }
[ "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
720,226
renderInFrame = true; bindEntityTexture(entity); random.setSeed(187L); ItemStack itemstack = entity.getEntityItem(); if (itemstack.getItem() != null) { GL11.glPushMatrix(); float f2 = 0F; float f3 = 0F; byte b0 = getMiniBlockCount(itemstack); GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f4; float f5; float f6; int i; //field_147909_c = renderBlocks if (ForgeHooksClient.renderEntityItem(entity, itemstack, f2, f3, random, renderManager.renderEngine, field_147909_c, b0)) { ; } else if (itemstack.getItemSpriteNumber() == 0 && itemstack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) { Block block = Block.getBlockFromItem(itemstack.getItem()); GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); if (renderInFrame) { GL11.glScalef(1.25F, 1.25F, 1.25F); GL11.glTranslatef(0.0F, 0.05F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } float f7 = 0.25F; int j = block.getRenderType(); if (j == 1 || j == 19 || j == 12 || j == 2) { f7 = 0.5F; } GL11.glScalef(f7, f7, f7); for (i = 0; i < b0; ++i) { GL11.glPushMatrix(); if (i > 0) { f5 = (random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; f4 = (random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; f6 = (random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; GL11.glTranslatef(f5, f4, f6); } f5 = 1.0F; itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5); GL11.glPopMatrix(); } } else { float f8; if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) { if (renderInFrame) { GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); GL11.glTranslatef(0.0F, -0.05F, 0.0F); } else { GL11.glScalef(0.5F, 0.5F, 0.5F); } for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) { random.setSeed(187L); IIcon icon = itemstack.getItem().getIcon(itemstack, k); f8 = 1.0F; if (renderWithColor) { i = itemstack.getItem().getColorFromItemStack(itemstack, k); f5 = (i >> 16 & 255) / 255.0F; f4 = (i >> 8 & 255) / 255.0F; f6 = (i & 255) / 255.0F; GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F); this.renderDroppedItem(entity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k); } else { this.renderDroppedItem(entity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k); } } } else { if (renderInFrame) { GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); GL11.glTranslatef(0.0F, -0.05F, 0.0F); } else { GL11.glScalef(0.5F, 0.5F, 0.5F); } IIcon icon1 = itemstack.getIconIndex(); if (renderWithColor) { int l = itemstack.getItem().getColorFromItemStack(itemstack, 0); f8 = (l >> 16 & 255) / 255.0F; float f9 = (l >> 8 & 255) / 255.0F; f5 = (l & 255) / 255.0F; f4 = 1.0F; this.renderDroppedItem(entity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4); } else { this.renderDroppedItem(entity, icon1, b0, par9, 1.0F, 1.0F, 1.0F); } } } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
renderInFrame = true; bindEntityTexture(entity); random.setSeed(187L); ItemStack itemstack = entity.getEntityItem(); if (itemstack.getItem() != null) { GL11.glPushMatrix(); float f2 = 0F; float f3 = 0F; byte b0 = getMiniBlockCount(itemstack); GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f4; float f5; float f6; int i; if (ForgeHooksClient.renderEntityItem(entity, itemstack, f2, f3, random, renderManager.renderEngine, field_147909_c, b0)) { ; } else if (itemstack.getItemSpriteNumber() == 0 && itemstack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) { Block block = Block.getBlockFromItem(itemstack.getItem()); GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); if (renderInFrame) { GL11.glScalef(1.25F, 1.25F, 1.25F); GL11.glTranslatef(0.0F, 0.05F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } float f7 = 0.25F; int j = block.getRenderType(); if (j == 1 j == 19 j == 12 j == 2) { f7 = 0.5F; } GL11.glScalef(f7, f7, f7); for (i = 0; i < b0; ++i) { GL11.glPushMatrix(); if (i > 0) { f5 = (random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; f4 = (random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; f6 = (random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; GL11.glTranslatef(f5, f4, f6); } f5 = 1.0F; itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5); GL11.glPopMatrix(); } } else { float f8; if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) { if (renderInFrame) { GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); GL11.glTranslatef(0.0F, -0.05F, 0.0F); } else { GL11.glScalef(0.5F, 0.5F, 0.5F); } for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) { random.setSeed(187L); IIcon icon = itemstack.getItem().getIcon(itemstack, k); f8 = 1.0F; if (renderWithColor) { i = itemstack.getItem().getColorFromItemStack(itemstack, k); f5 = (i >> 16 & 255) / 255.0F; f4 = (i >> 8 & 255) / 255.0F; f6 = (i & 255) / 255.0F; GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F); this.renderDroppedItem(entity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k); } else { this.renderDroppedItem(entity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k); } } } else { if (renderInFrame) { GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); GL11.glTranslatef(0.0F, -0.05F, 0.0F); } else { GL11.glScalef(0.5F, 0.5F, 0.5F); } IIcon icon1 = itemstack.getIconIndex(); if (renderWithColor) { int l = itemstack.getItem().getColorFromItemStack(itemstack, 0); f8 = (l >> 16 & 255) / 255.0F; float f9 = (l >> 8 & 255) / 255.0F; f5 = (l & 255) / 255.0F; f4 = 1.0F; this.renderDroppedItem(entity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4); } else { this.renderDroppedItem(entity, icon1, b0, par9, 1.0F, 1.0F, 1.0F); } } } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
/** * Renders the item */
Renders the item
doRenderItem
{ "repo_name": "svgorbunov/Mariculture", "path": "src/main/java/mariculture/core/render/RenderFakeItem.java", "license": "mit", "size": 21598 }
[ "net.minecraft.block.Block", "net.minecraft.client.renderer.RenderBlocks", "net.minecraft.item.ItemBlock", "net.minecraft.item.ItemStack", "net.minecraft.util.IIcon", "net.minecraftforge.client.ForgeHooksClient" ]
import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.ForgeHooksClient;
import net.minecraft.block.*; import net.minecraft.client.renderer.*; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraftforge.client.*;
[ "net.minecraft.block", "net.minecraft.client", "net.minecraft.item", "net.minecraft.util", "net.minecraftforge.client" ]
net.minecraft.block; net.minecraft.client; net.minecraft.item; net.minecraft.util; net.minecraftforge.client;
2,708,851
private void walk(TreeNode<T> element, List<TreeNode<T>> list) { list.add(element); for (TreeNode<T> data : element.getChildren()) { walk(data, list); } }
void function(TreeNode<T> element, List<TreeNode<T>> list) { list.add(element); for (TreeNode<T> data : element.getChildren()) { walk(data, list); } }
/** * Walks the Tree in pre-order style. This is a recursive method, and is * called from the toList() method with the root element as the first * argument. It appends to the second argument, which is passed by reference * as it recurses down the tree. * @param element the starting element. * @param list the output of the walk. */
Walks the Tree in pre-order style. This is a recursive method, and is called from the toList() method with the root element as the first argument. It appends to the second argument, which is passed by reference * as it recurses down the tree
walk
{ "repo_name": "dhmay/msInspect", "path": "src/org/fhcrc/cpl/toolbox/datastructure/Tree.java", "license": "apache-2.0", "size": 3027 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,243,564
@Test public void testUnorderedWaitTimeoutHandling() throws Exception { testTimeoutExceptionHandling(AsyncDataStream.OutputMode.UNORDERED); }
void function() throws Exception { testTimeoutExceptionHandling(AsyncDataStream.OutputMode.UNORDERED); }
/** * FLINK-6435 * * <p>Tests that timeout exceptions are properly handled in ordered output mode. The proper handling means that * a StreamElementQueueEntry is completed in case of a timeout exception. */
FLINK-6435 Tests that timeout exceptions are properly handled in ordered output mode. The proper handling means that a StreamElementQueueEntry is completed in case of a timeout exception
testUnorderedWaitTimeoutHandling
{ "repo_name": "shaoxuan-wang/flink", "path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorTest.java", "license": "apache-2.0", "size": 38289 }
[ "org.apache.flink.streaming.api.datastream.AsyncDataStream" ]
import org.apache.flink.streaming.api.datastream.AsyncDataStream;
import org.apache.flink.streaming.api.datastream.*;
[ "org.apache.flink" ]
org.apache.flink;
2,529,738
@TruffleBoundary public final InternalByteArray getInternalByteArrayUncached(TruffleString.Encoding expectedEncoding) { return TruffleString.GetInternalByteArrayNode.getUncached().execute(this, expectedEncoding); }
final InternalByteArray function(TruffleString.Encoding expectedEncoding) { return TruffleString.GetInternalByteArrayNode.getUncached().execute(this, expectedEncoding); }
/** * Shorthand for calling the uncached version of {@link TruffleString.GetInternalByteArrayNode}. * * @since 22.1 */
Shorthand for calling the uncached version of <code>TruffleString.GetInternalByteArrayNode</code>
getInternalByteArrayUncached
{ "repo_name": "smarr/Truffle", "path": "truffle/src/com.oracle.truffle.api.strings/src/com/oracle/truffle/api/strings/AbstractTruffleString.java", "license": "gpl-2.0", "size": 49225 }
[ "com.oracle.truffle.api.strings.TruffleString" ]
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.api.strings.*;
[ "com.oracle.truffle" ]
com.oracle.truffle;
874,431
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(background); } else { view.setBackgroundDrawable(background); } }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(background); } else { view.setBackgroundDrawable(background); } }
/** * Allows to set the background for the given view. * * @param view that has to be updated. * @param background that has to be set. */
Allows to set the background for the given view
setBackground
{ "repo_name": "SimoneCasagranda/android-wear-tutorial", "path": "common/src/main/java/com/alchemiasoft/common/util/ViewUtil.java", "license": "apache-2.0", "size": 1394 }
[ "android.os.Build" ]
import android.os.Build;
import android.os.*;
[ "android.os" ]
android.os;
1,236,964
if (in == null) { return -1; } mDb.beginTransaction(); long ret = -1; try { if (!exists(in.getKey())) { if (lastModified != null && (in.getLastModified() == null || lastModified > in.getLastModified())) { in.setLastModified(lastModified); } else if (in.getLastModified() == null) { in.setLastModified(0L); } ret = mDb.insert(getTableName(), null, in.getParams(mGson)); if (ret != -1) { insertCallback(in); } } else { ret = update(in, lastModified); } mDb.setTransactionSuccessful(); } finally { mDb.endTransaction(); } return ret; } /** * Adds a List of items to the database via {@link #add(TbaDatabaseModel, Long)}
if (in == null) { return -1; } mDb.beginTransaction(); long ret = -1; try { if (!exists(in.getKey())) { if (lastModified != null && (in.getLastModified() == null lastModified > in.getLastModified())) { in.setLastModified(lastModified); } else if (in.getLastModified() == null) { in.setLastModified(0L); } ret = mDb.insert(getTableName(), null, in.getParams(mGson)); if (ret != -1) { insertCallback(in); } } else { ret = update(in, lastModified); } mDb.setTransactionSuccessful(); } finally { mDb.endTransaction(); } return ret; } /** * Adds a List of items to the database via {@link #add(TbaDatabaseModel, Long)}
/** * Adds a model to the database, if it doesn't already exist * If the model is already entered, update the existing row via * {@link #update(TbaDatabaseModel, Long)} * If the insert was successful, call {@link #insertCallback(TbaDatabaseModel)} * @param in Model to be added * @param lastModified the timestamp that came from the Last-Modified header * @return The value from * {@link SQLiteDatabase#insert(String, String, android.content.ContentValues)} if a new * row is inserted (row ID or -1 on error), or the value from * {@link SQLiteDatabase#update(String, android.content.ContentValues, String, String[])} if an * existing row * was updated (number of affected rows) */
Adds a model to the database, if it doesn't already exist If the model is already entered, update the existing row via <code>#update(TbaDatabaseModel, Long)</code> If the insert was successful, call <code>#insertCallback(TbaDatabaseModel)</code>
add
{ "repo_name": "phil-lopreiato/the-blue-alliance-android", "path": "android/src/main/java/com/thebluealliance/androidclient/database/ModelTable.java", "license": "mit", "size": 12398 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
892,742
public int ask(String question, List<Integer> ranges) { int key = Integer.valueOf(this.ask(question)); boolean exist = false; for (int value : ranges) { if (value == key) { exist = true; break; } } if (exist) { return key; } else { throw new MenuOutException("Out of menu range"); } }
int function(String question, List<Integer> ranges) { int key = Integer.valueOf(this.ask(question)); boolean exist = false; for (int value : ranges) { if (value == key) { exist = true; break; } } if (exist) { return key; } else { throw new MenuOutException(STR); } }
/** * Method ask() for qustion. * @param question question. * @param ranges List ranges. * @return int key. */
Method ask() for qustion
ask
{ "repo_name": "evgenymatveev/Task", "path": "chapter_002/src/main/java/ru/ematveev/start/StubInput.java", "license": "apache-2.0", "size": 1237 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,506,917
private SplittingPair doSplit(LogicalExpression subExpression, List<Variable> argumentOrder) { // The h expression final Variable rootArg = originalLambda.getArgument(); // Create variables for the objects we will pull out final List<Variable> newVars = new LinkedList<Variable>(); // The variable x, such that h = \lambda x f(g(x)) newVars.add(rootArg); // The rest of the arguments to the function g newVars.addAll(argumentOrder); // Create g, such that h = \lambda x f(g(x)) final LogicalExpression g = SplittingServices.makeExpression(newVars, subExpression); // Create f, such that h = \lambda x f(g(x)) newVars.remove(rootArg); final Variable compositionArgument = new Variable(LogicLanguageServices .getTypeRepository().generalizeType(g.getType().getRange())); final LogicalExpression embeddedApplication = SplittingServices .makeAssignment(newVars, compositionArgument); final LogicalExpression newBody = ReplaceExpression.of( originalLambda.getBody(), subExpression, embeddedApplication); final Lambda f = new Lambda(compositionArgument, newBody); // Verify that f has no free arguments. Can happen if rootArg appears in // another part of the expression. if (GetAllFreeVariables.of(f).size() == 0) { // Create the splitting pair and return it return createSplittingPair(f, g); } else { return null; } }
SplittingPair function(LogicalExpression subExpression, List<Variable> argumentOrder) { final Variable rootArg = originalLambda.getArgument(); final List<Variable> newVars = new LinkedList<Variable>(); newVars.add(rootArg); newVars.addAll(argumentOrder); final LogicalExpression g = SplittingServices.makeExpression(newVars, subExpression); newVars.remove(rootArg); final Variable compositionArgument = new Variable(LogicLanguageServices .getTypeRepository().generalizeType(g.getType().getRange())); final LogicalExpression embeddedApplication = SplittingServices .makeAssignment(newVars, compositionArgument); final LogicalExpression newBody = ReplaceExpression.of( originalLambda.getBody(), subExpression, embeddedApplication); final Lambda f = new Lambda(compositionArgument, newBody); if (GetAllFreeVariables.of(f).size() == 0) { return createSplittingPair(f, g); } else { return null; } }
/** * Extract the entire subExpression * * @param subExpression * @param argumentOrder * The free variables in subExpression except the first variables * in originalLambda, which is assumed to be in subExpression as * well. * @return */
Extract the entire subExpression
doSplit
{ "repo_name": "PriyankaKhante/nlp_spf", "path": "genlex.ccg.unification/src/edu/uw/cs/lil/tiny/genlex/ccg/unification/split/MakeCompositionSplits.java", "license": "gpl-2.0", "size": 18976 }
[ "edu.uw.cs.lil.tiny.genlex.ccg.unification.split.SplittingServices", "edu.uw.cs.lil.tiny.mr.lambda.Lambda", "edu.uw.cs.lil.tiny.mr.lambda.LogicLanguageServices", "edu.uw.cs.lil.tiny.mr.lambda.LogicalExpression", "edu.uw.cs.lil.tiny.mr.lambda.Variable", "edu.uw.cs.lil.tiny.mr.lambda.visitor.GetAllFreeVariables", "edu.uw.cs.lil.tiny.mr.lambda.visitor.ReplaceExpression", "java.util.LinkedList", "java.util.List" ]
import edu.uw.cs.lil.tiny.genlex.ccg.unification.split.SplittingServices; import edu.uw.cs.lil.tiny.mr.lambda.Lambda; import edu.uw.cs.lil.tiny.mr.lambda.LogicLanguageServices; import edu.uw.cs.lil.tiny.mr.lambda.LogicalExpression; import edu.uw.cs.lil.tiny.mr.lambda.Variable; import edu.uw.cs.lil.tiny.mr.lambda.visitor.GetAllFreeVariables; import edu.uw.cs.lil.tiny.mr.lambda.visitor.ReplaceExpression; import java.util.LinkedList; import java.util.List;
import edu.uw.cs.lil.tiny.genlex.ccg.unification.split.*; import edu.uw.cs.lil.tiny.mr.lambda.*; import edu.uw.cs.lil.tiny.mr.lambda.visitor.*; import java.util.*;
[ "edu.uw.cs", "java.util" ]
edu.uw.cs; java.util;
1,603,940
public void internalError(final Exception cause) { logError("Internal Server Error on " + request().getUri(), cause); sendStatusOnly(HttpResponseStatus.INTERNAL_SERVER_ERROR); }
void function(final Exception cause) { logError(STR + request().getUri(), cause); sendStatusOnly(HttpResponseStatus.INTERNAL_SERVER_ERROR); }
/** * Sends <code>500/Internal Server Error</code> to the client. * @param cause The unexpected exception that caused this error. */
Sends <code>500/Internal Server Error</code> to the client
internalError
{ "repo_name": "geoffreyanderson/opentsdb", "path": "src/tsd/AbstractHttpQuery.java", "license": "gpl-3.0", "size": 17287 }
[ "org.jboss.netty.handler.codec.http.HttpResponseStatus" ]
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.*;
[ "org.jboss.netty" ]
org.jboss.netty;
109,951
private void routeAroundSelfForClosestDistance(Connection conn, PointList newLine) { Point ptOrig = newLine.getPoint(newLine.size() - 2); Point ptTerm = newLine.getLastPoint(); if (NORMALIZE_ON_HORIZONTAL_CENTER == normalizeBehavior || NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { // special algo when the sequence edge goes from right to left: int tolerance = MapModeUtil.getMapMode(conn).DPtoLP(3); int extra = MapModeUtil.getMapMode(conn).DPtoLP(16); if (ptOrig.x + extra >= ptTerm.x) { newLine.setSize(newLine.size() - 1); Rectangle src = conn.getSourceAnchor().getOwner() == null ? null : getOwnerBounds(conn.getSourceAnchor()).getCopy(); if (src == null) { src = new Rectangle(ptOrig.getCopy().translate( new Dimension(-extra, -extra / 2)), ptOrig); } else { if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { // then the source shape to route around is the // sub-process IFigure fig = conn.getSourceAnchor().getOwner(); while (fig != null) { // [SDR] if (fig instanceof AbstractComponentShape) {// [/SDR] break; } else { fig = fig.getParent(); } } if (fig == null) { fig = conn.getSourceAnchor().getOwner(); } src = fig.getBounds().getCopy(); fig.translateToAbsolute(src); } else { conn.getSourceAnchor().getOwner().translateToAbsolute( src); } conn.translateToRelative(src); } Rectangle target = conn.getTargetAnchor().getOwner() == null ? null : getOwnerBounds(conn.getTargetAnchor()).getCopy(); if (target == null) { target = new Rectangle(ptTerm.getCopy().translate( new Dimension(extra, -extra / 2)), ptTerm); } else { conn.getTargetAnchor().getOwner().translateToAbsolute( target); conn.translateToRelative(target); } // compute how much away we should be: 1/2 of the biggest height int heightOwnerSrc = src.height; int heightOwnerTarget = target.height; int topRightSrcY = src.y; int bottomRightSrcY = src.y + src.height; int topLeftTargetY = target.y; int bottomLeftTargetY = target.y + target.height; // now compute where we draw the line: above or below the 2 // shapes. int aboveY = -1; int farRightX = -1; // see if we should go in between the 2 shapes: if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG != normalizeBehavior && topRightSrcY > bottomLeftTargetY + extra) { // src is below the target go in between: aboveY = (topRightSrcY + bottomLeftTargetY) / 2; farRightX = ptOrig.x + extra; } else if (topLeftTargetY > bottomRightSrcY + extra) { // target is below the src go in between: aboveY = (topLeftTargetY + bottomRightSrcY) / 2; farRightX = ptOrig.x + extra; } else { int extraY = // extra; Math.max(extra, Math.min(heightOwnerSrc / 2, heightOwnerTarget / 2)); // min y if we go above int aboveYone = Math.min(topRightSrcY, topLeftTargetY); // max y if we go below int belowYone = Math .max(bottomLeftTargetY, bottomRightSrcY); if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG != normalizeBehavior) { // in that case, always go below as we are already at // the bottom-side of a sub-process aboveY = belowYone + extraY; } else { // see which one is shortest: int aboveDelta = Math.max(ptOrig.y - aboveYone, ptTerm.y - aboveYone); int belowDelta = Math.max(belowYone - ptOrig.y, belowYone - ptTerm.y); if (aboveDelta - belowDelta > tolerance) { // consider that one of them really is a shorter // path: aboveY = belowYone + extraY; } else if (belowDelta - aboveDelta > tolerance) { // consider that one of them really is a shorter // path: aboveY = aboveYone - extraY; } else { // they are pretty similar really. // we choose one according to the position of // the anchors within their shapes int midYSrc = src.getCenter().y; if (ptOrig.y + tolerance > midYSrc) {// +tolerance // as we // favor // going // above aboveY = belowYone + extraY; } else { aboveY = aboveYone - extraY; } } } farRightX = Math.max(ptOrig.x + extra, ptTerm.x + extra + target.width); } int farLeft = ptTerm.x - extra; if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { // make sure we are far enough on the left to avoid the // sub-process on which the src shape is anchored on. Point srcLeft = src.getLeft(); conn.getSourceAnchor().getOwner().translateToRelative( srcLeft); farLeft = Math.min(farLeft, srcLeft.x + extra); } Point origPlus = new Point(farRightX, ptOrig.y); Point origAbove = new Point(origPlus.x, aboveY); Point termMinus = new Point(farLeft, ptTerm.y); Point termAbove = new Point(termMinus.x, aboveY); if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG != normalizeBehavior) { newLine.addPoint(origPlus); newLine.addPoint(origAbove); } else { newLine.setSize(1);// keep the original origine point // make sure we are still going down: Point orig = newLine.getFirstPoint(); if (orig.y + extra > termAbove.y) { // oops looks like we are going up. let's fix everyone: ptOrig.y = orig.y + extra; termAbove.y = ptOrig.y; } else { ptOrig.y = termAbove.y; } newLine.addPoint(ptOrig); } newLine.addPoint(termAbove); newLine.addPoint(termMinus); newLine.addPoint(ptTerm); } else if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { // this is a shape on the sub-process border. // let's make sure that we don't need to route around the // sub-process // if the target of the connection is higher than the ptOrig. Point orig = newLine.getFirstPoint(); if (ptOrig.y < orig.y) { ptOrig.y = orig.y + extra; } if (ptOrig.y > ptTerm.y && conn.getSourceAnchor().getOwner() != null) { // let's route around: IFigure fig = conn.getSourceAnchor().getOwner(); while (fig != null) { // [SDR] if (fig instanceof AbstractComponentShape) {// [/SDR] break; } else { fig = fig.getParent(); } } if (fig == null) { return;// never mind } Rectangle src = fig.getBounds().getCopy(); fig.translateToAbsolute(src); conn.translateToRelative(src); // int extra = MapModeUtil.getMapMode(conn).DPtoLP(16); Point termMinus = new Point(ptTerm.x - extra, ptTerm.y); Point termBelow = new Point(termMinus.x, ptOrig.y); newLine.setSize(newLine.size() - 2); newLine.addPoint(ptOrig); newLine.addPoint(termBelow); newLine.addPoint(termMinus); newLine.addPoint(ptTerm); } } } }
void function(Connection conn, PointList newLine) { Point ptOrig = newLine.getPoint(newLine.size() - 2); Point ptTerm = newLine.getLastPoint(); if (NORMALIZE_ON_HORIZONTAL_CENTER == normalizeBehavior NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { int tolerance = MapModeUtil.getMapMode(conn).DPtoLP(3); int extra = MapModeUtil.getMapMode(conn).DPtoLP(16); if (ptOrig.x + extra >= ptTerm.x) { newLine.setSize(newLine.size() - 1); Rectangle src = conn.getSourceAnchor().getOwner() == null ? null : getOwnerBounds(conn.getSourceAnchor()).getCopy(); if (src == null) { src = new Rectangle(ptOrig.getCopy().translate( new Dimension(-extra, -extra / 2)), ptOrig); } else { if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { IFigure fig = conn.getSourceAnchor().getOwner(); while (fig != null) { if (fig instanceof AbstractComponentShape) { break; } else { fig = fig.getParent(); } } if (fig == null) { fig = conn.getSourceAnchor().getOwner(); } src = fig.getBounds().getCopy(); fig.translateToAbsolute(src); } else { conn.getSourceAnchor().getOwner().translateToAbsolute( src); } conn.translateToRelative(src); } Rectangle target = conn.getTargetAnchor().getOwner() == null ? null : getOwnerBounds(conn.getTargetAnchor()).getCopy(); if (target == null) { target = new Rectangle(ptTerm.getCopy().translate( new Dimension(extra, -extra / 2)), ptTerm); } else { conn.getTargetAnchor().getOwner().translateToAbsolute( target); conn.translateToRelative(target); } int heightOwnerSrc = src.height; int heightOwnerTarget = target.height; int topRightSrcY = src.y; int bottomRightSrcY = src.y + src.height; int topLeftTargetY = target.y; int bottomLeftTargetY = target.y + target.height; int aboveY = -1; int farRightX = -1; if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG != normalizeBehavior && topRightSrcY > bottomLeftTargetY + extra) { aboveY = (topRightSrcY + bottomLeftTargetY) / 2; farRightX = ptOrig.x + extra; } else if (topLeftTargetY > bottomRightSrcY + extra) { aboveY = (topLeftTargetY + bottomRightSrcY) / 2; farRightX = ptOrig.x + extra; } else { int extraY = Math.max(extra, Math.min(heightOwnerSrc / 2, heightOwnerTarget / 2)); int aboveYone = Math.min(topRightSrcY, topLeftTargetY); int belowYone = Math .max(bottomLeftTargetY, bottomRightSrcY); if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG != normalizeBehavior) { aboveY = belowYone + extraY; } else { int aboveDelta = Math.max(ptOrig.y - aboveYone, ptTerm.y - aboveYone); int belowDelta = Math.max(belowYone - ptOrig.y, belowYone - ptTerm.y); if (aboveDelta - belowDelta > tolerance) { aboveY = belowYone + extraY; } else if (belowDelta - aboveDelta > tolerance) { aboveY = aboveYone - extraY; } else { int midYSrc = src.getCenter().y; if (ptOrig.y + tolerance > midYSrc) { aboveY = belowYone + extraY; } else { aboveY = aboveYone - extraY; } } } farRightX = Math.max(ptOrig.x + extra, ptTerm.x + extra + target.width); } int farLeft = ptTerm.x - extra; if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { Point srcLeft = src.getLeft(); conn.getSourceAnchor().getOwner().translateToRelative( srcLeft); farLeft = Math.min(farLeft, srcLeft.x + extra); } Point origPlus = new Point(farRightX, ptOrig.y); Point origAbove = new Point(origPlus.x, aboveY); Point termMinus = new Point(farLeft, ptTerm.y); Point termAbove = new Point(termMinus.x, aboveY); if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG != normalizeBehavior) { newLine.addPoint(origPlus); newLine.addPoint(origAbove); } else { newLine.setSize(1); Point orig = newLine.getFirstPoint(); if (orig.y + extra > termAbove.y) { ptOrig.y = orig.y + extra; termAbove.y = ptOrig.y; } else { ptOrig.y = termAbove.y; } newLine.addPoint(ptOrig); } newLine.addPoint(termAbove); newLine.addPoint(termMinus); newLine.addPoint(ptTerm); } else if (NORMALIZE_ON_HORIZONTAL_EXCEPT_FIRST_SEG == normalizeBehavior) { Point orig = newLine.getFirstPoint(); if (ptOrig.y < orig.y) { ptOrig.y = orig.y + extra; } if (ptOrig.y > ptTerm.y && conn.getSourceAnchor().getOwner() != null) { IFigure fig = conn.getSourceAnchor().getOwner(); while (fig != null) { if (fig instanceof AbstractComponentShape) { break; } else { fig = fig.getParent(); } } if (fig == null) { return; } Rectangle src = fig.getBounds().getCopy(); fig.translateToAbsolute(src); conn.translateToRelative(src); Point termMinus = new Point(ptTerm.x - extra, ptTerm.y); Point termBelow = new Point(termMinus.x, ptOrig.y); newLine.setSize(newLine.size() - 2); newLine.addPoint(ptOrig); newLine.addPoint(termBelow); newLine.addPoint(termMinus); newLine.addPoint(ptTerm); } } } }
/** * Called for closest distance. Applies a custom algorithm for sequence edge * to make sure that if the connection goes from right to left it goes * around the source and target shapes. * * @param conn * @param newLine */
Called for closest distance. Applies a custom algorithm for sequence edge to make sure that if the connection goes from right to left it goes around the source and target shapes
routeAroundSelfForClosestDistance
{ "repo_name": "StephaneSeyvoz/mindEd", "path": "org.ow2.mindEd.adl.editor.graphic.ui/customsrc/org/ow2/mindEd/adl/editor/graphic/ui/custom/layouts/RectilinearRouterEx.java", "license": "lgpl-3.0", "size": 32826 }
[ "org.eclipse.draw2d.Connection", "org.eclipse.draw2d.IFigure", "org.eclipse.draw2d.geometry.Dimension", "org.eclipse.draw2d.geometry.Point", "org.eclipse.draw2d.geometry.PointList", "org.eclipse.draw2d.geometry.Rectangle", "org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil", "org.ow2.mindEd.adl.editor.graphic.ui.custom.figures.AbstractComponentShape" ]
import org.eclipse.draw2d.Connection; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil; import org.ow2.mindEd.adl.editor.graphic.ui.custom.figures.AbstractComponentShape;
import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*; import org.eclipse.gmf.runtime.draw2d.ui.mapmode.*; import org.ow2.*;
[ "org.eclipse.draw2d", "org.eclipse.gmf", "org.ow2" ]
org.eclipse.draw2d; org.eclipse.gmf; org.ow2;
1,179,007
public static File createUniqueDirectory(File parent) { String uniqueName = UUID.randomUUID().toString(); File directory = new File(parent, uniqueName); directory.mkdirs(); return directory; }
static File function(File parent) { String uniqueName = UUID.randomUUID().toString(); File directory = new File(parent, uniqueName); directory.mkdirs(); return directory; }
/** * Create a directory with a unique name inside a given parnet directory. * * @param parent Parent directory * @return Newly created directory */
Create a directory with a unique name inside a given parnet directory
createUniqueDirectory
{ "repo_name": "zippy1978/shift", "path": "src/main/java/org/shiftedit/util/FileUtils.java", "license": "lgpl-3.0", "size": 4808 }
[ "java.io.File", "java.util.UUID" ]
import java.io.File; import java.util.UUID;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
279,830
HandlerRegistration addAppendRowClickHandler( final ClickHandler handler );
HandlerRegistration addAppendRowClickHandler( final ClickHandler handler );
/** * Adds a handler for when the User, interacting with the View, requests a row to be appended. * @param handler * @return */
Adds a handler for when the User, interacting with the View, requests a row to be appended
addAppendRowClickHandler
{ "repo_name": "Salaboy/uberfire", "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/demo/WiresGridsDemoView.java", "license": "apache-2.0", "size": 3754 }
[ "com.google.gwt.event.dom.client.ClickHandler", "com.google.gwt.event.shared.HandlerRegistration" ]
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.dom.client.*; import com.google.gwt.event.shared.*;
[ "com.google.gwt" ]
com.google.gwt;
2,823,386
void serveFile(StaplerRequest request, URL res) throws ServletException, IOException;
void serveFile(StaplerRequest request, URL res) throws ServletException, IOException;
/** * Serves a static resource. * * <p> * This method sets content type, HTTP status code, sends the complete data * and closes the response. This method also handles cache-control HTTP headers * like "If-Modified-Since" and others. */
Serves a static resource. This method sets content type, HTTP status code, sends the complete data and closes the response. This method also handles cache-control HTTP headers like "If-Modified-Since" and others
serveFile
{ "repo_name": "eclipse/hudson.stapler", "path": "stapler-core/src/main/java/org/kohsuke/stapler/StaplerResponse.java", "license": "apache-2.0", "size": 7729 }
[ "java.io.IOException", "javax.servlet.ServletException" ]
import java.io.IOException; import javax.servlet.ServletException;
import java.io.*; import javax.servlet.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
527,895
public void insertAttributeValue(String attributeName, String value, int index) { if (m_simpleAttributes.containsKey(attributeName)) { m_simpleAttributes.get(attributeName).add(index, value); } else { setAttributeValue(attributeName, value); } fireChange(ChangeType.add); }
void function(String attributeName, String value, int index) { if (m_simpleAttributes.containsKey(attributeName)) { m_simpleAttributes.get(attributeName).add(index, value); } else { setAttributeValue(attributeName, value); } fireChange(ChangeType.add); }
/** * Inserts a new attribute value at the given index.<p> * * @param attributeName the attribute name * @param value the attribute value * @param index the value index */
Inserts a new attribute value at the given index
insertAttributeValue
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/acacia/shared/CmsEntity.java", "license": "lgpl-2.1", "size": 27138 }
[ "org.opencms.acacia.shared.CmsEntityChangeEvent" ]
import org.opencms.acacia.shared.CmsEntityChangeEvent;
import org.opencms.acacia.shared.*;
[ "org.opencms.acacia" ]
org.opencms.acacia;
1,286,515
public void setRenderer(WaferMapRenderer renderer) { if (this.renderer != null) { this.renderer.removeChangeListener(this); } this.renderer = renderer; if (renderer != null) { renderer.setPlot(this); } fireChangeEvent(); }
void function(WaferMapRenderer renderer) { if (this.renderer != null) { this.renderer.removeChangeListener(this); } this.renderer = renderer; if (renderer != null) { renderer.setPlot(this); } fireChangeEvent(); }
/** * Sets the item renderer, and notifies all listeners of a change to the * plot. If the renderer is set to {@code null}, no chart will be * drawn. * * @param renderer the new renderer ({@code null} permitted). */
Sets the item renderer, and notifies all listeners of a change to the plot. If the renderer is set to null, no chart will be drawn
setRenderer
{ "repo_name": "jfree/jfreechart", "path": "src/main/java/org/jfree/chart/plot/WaferMapPlot.java", "license": "lgpl-2.1", "size": 14432 }
[ "org.jfree.chart.renderer.WaferMapRenderer" ]
import org.jfree.chart.renderer.WaferMapRenderer;
import org.jfree.chart.renderer.*;
[ "org.jfree.chart" ]
org.jfree.chart;
530,316
@Override public void sendDownlink(DownlinkRequest request) throws DownlinkException { if (!isRunning) throw new ClientNotRunningException(); else { try { String accessToken = authenticator.getAccessToken(); super.encode(request); URL url = new URL(this.buildDownlinkUrl(request)); logger.debug("url is: {}", url.toString()); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type","application/json"); con.setRequestProperty("Authorization", "Bearer "+accessToken); con.setRequestProperty("Accept", "application/json"); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); String downlinkAsJson = super.objectMapper.writeValueAsString(request); logger.debug("downlink json: {}",downlinkAsJson); wr.writeBytes(downlinkAsJson); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); if (!(responseCode == 202)) throw new DownlinkException("response from ttn server: " + responseCode); logger.debug(responseCode); con.disconnect(); }catch (TokenResponseException e) { throw new DownlinkException(); } catch (IOException e ) { throw new DownlinkException(e.getMessage()); } } }
void function(DownlinkRequest request) throws DownlinkException { if (!isRunning) throw new ClientNotRunningException(); else { try { String accessToken = authenticator.getAccessToken(); super.encode(request); URL url = new URL(this.buildDownlinkUrl(request)); logger.debug(STR, url.toString()); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.setRequestProperty(STR,STR); con.setRequestProperty(STR, STR+accessToken); con.setRequestProperty(STR, STR); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); String downlinkAsJson = super.objectMapper.writeValueAsString(request); logger.debug(STR,downlinkAsJson); wr.writeBytes(downlinkAsJson); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); if (!(responseCode == 202)) throw new DownlinkException(STR + responseCode); logger.debug(responseCode); con.disconnect(); }catch (TokenResponseException e) { throw new DownlinkException(); } catch (IOException e ) { throw new DownlinkException(e.getMessage()); } } }
/** * sends downlink message to device through proximus * @param request The DownlinkRequest, either ProximusDownlinkRequest or TTNDownlinkRequest * @throws DownlinkException */
sends downlink message to device through proximus
sendDownlink
{ "repo_name": "YangSkyL/lora_weather_station", "path": "demo/weather_station/common/src/msf4j/src/main/java/be/i8c/wso2/msf4j/lora/services/proximus/LoRaProximusHTTPService.java", "license": "apache-2.0", "size": 6822 }
[ "be.i8c.wso2.msf4j.lora.models.common.DownlinkRequest", "be.i8c.wso2.msf4j.lora.services.common.exceptions.ClientNotRunningException", "be.i8c.wso2.msf4j.lora.services.common.exceptions.DownlinkException", "com.google.api.client.auth.oauth2.TokenResponseException", "java.io.DataOutputStream", "java.io.IOException", "java.net.HttpURLConnection" ]
import be.i8c.wso2.msf4j.lora.models.common.DownlinkRequest; import be.i8c.wso2.msf4j.lora.services.common.exceptions.ClientNotRunningException; import be.i8c.wso2.msf4j.lora.services.common.exceptions.DownlinkException; import com.google.api.client.auth.oauth2.TokenResponseException; import java.io.DataOutputStream; import java.io.IOException; import java.net.HttpURLConnection;
import be.i8c.wso2.msf4j.lora.models.common.*; import be.i8c.wso2.msf4j.lora.services.common.exceptions.*; import com.google.api.client.auth.oauth2.*; import java.io.*; import java.net.*;
[ "be.i8c.wso2", "com.google.api", "java.io", "java.net" ]
be.i8c.wso2; com.google.api; java.io; java.net;
711,761
@SuppressWarnings("WeakerAccess") @UiThread public boolean popToTag(@NonNull String tag, @Nullable ControllerChangeHandler changeHandler) { ThreadUtils.ensureMainThread(); for (RouterTransaction transaction : backstack) { if (tag.equals(transaction.tag())) { popToTransaction(transaction, changeHandler); return true; } } return false; }
@SuppressWarnings(STR) boolean function(@NonNull String tag, @Nullable ControllerChangeHandler changeHandler) { ThreadUtils.ensureMainThread(); for (RouterTransaction transaction : backstack) { if (tag.equals(transaction.tag())) { popToTransaction(transaction, changeHandler); return true; } } return false; }
/** * Pops all {@link Controller}s until the {@link Controller} with the passed tag is at the top * * @param tag The tag being popped to * @param changeHandler The {@link ControllerChangeHandler} to handle this transaction * @return Whether or not the {@link Controller} with the passed tag is now at the top */
Pops all <code>Controller</code>s until the <code>Controller</code> with the passed tag is at the top
popToTag
{ "repo_name": "bluelinelabs/Conductor", "path": "conductor/src/main/java/com/bluelinelabs/conductor/Router.java", "license": "apache-2.0", "size": 43569 }
[ "androidx.annotation.NonNull", "androidx.annotation.Nullable", "com.bluelinelabs.conductor.internal.ThreadUtils" ]
import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.bluelinelabs.conductor.internal.ThreadUtils;
import androidx.annotation.*; import com.bluelinelabs.conductor.internal.*;
[ "androidx.annotation", "com.bluelinelabs.conductor" ]
androidx.annotation; com.bluelinelabs.conductor;
611,276
static boolean isCoordinateAxis(final String name) { return CharSequences.startsWith(name, LATITUDE, true) || CharSequences.startsWith(name, LONGITUDE, true); }
static boolean isCoordinateAxis(final String name) { return CharSequences.startsWith(name, LATITUDE, true) CharSequences.startsWith(name, LONGITUDE, true); }
/** * Returns {@code true} if a variable of the given name is a coordinate axis. */
Returns true if a variable of the given name is a coordinate axis
isCoordinateAxis
{ "repo_name": "apache/sis", "path": "profiles/sis-japan-profile/src/main/java/org/apache/sis/internal/earth/netcdf/GCOM_W.java", "license": "apache-2.0", "size": 13205 }
[ "org.apache.sis.util.CharSequences" ]
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.*;
[ "org.apache.sis" ]
org.apache.sis;
2,195,031
@SuppressWarnings("unchecked") public static void resolveRawParameterValues(Map<String, Object> parameters) { for (Map.Entry<String, Object> entry : parameters.entrySet()) { if (entry.getValue() != null) { // if the value is a list then we need to iterate Object value = entry.getValue(); if (value instanceof List) { List list = (List) value; for (int i = 0; i < list.size(); i++) { Object obj = list.get(i); if (obj != null) { String str = obj.toString(); if (str.startsWith(RAW_TOKEN_START) && str.endsWith(RAW_TOKEN_END)) { str = str.substring(4, str.length() - 1); // update the string in the list list.set(i, str); } } } } else { String str = entry.getValue().toString(); if (str.startsWith(RAW_TOKEN_START) && str.endsWith(RAW_TOKEN_END)) { str = str.substring(4, str.length() - 1); entry.setValue(str); } } } } }
@SuppressWarnings(STR) static void function(Map<String, Object> parameters) { for (Map.Entry<String, Object> entry : parameters.entrySet()) { if (entry.getValue() != null) { Object value = entry.getValue(); if (value instanceof List) { List list = (List) value; for (int i = 0; i < list.size(); i++) { Object obj = list.get(i); if (obj != null) { String str = obj.toString(); if (str.startsWith(RAW_TOKEN_START) && str.endsWith(RAW_TOKEN_END)) { str = str.substring(4, str.length() - 1); list.set(i, str); } } } } else { String str = entry.getValue().toString(); if (str.startsWith(RAW_TOKEN_START) && str.endsWith(RAW_TOKEN_END)) { str = str.substring(4, str.length() - 1); entry.setValue(str); } } } } }
/** * Traverses the given parameters, and resolve any parameter values which uses the RAW token * syntax: <tt>key=RAW(value)</tt>. This method will then remove the RAW tokens, and replace * the content of the value, with just the value. * * @param parameters the uri parameters * @see #parseQuery(String) * @see #RAW_TOKEN_START * @see #RAW_TOKEN_END */
Traverses the given parameters, and resolve any parameter values which uses the RAW token syntax: key=RAW(value). This method will then remove the RAW tokens, and replace the content of the value, with just the value
resolveRawParameterValues
{ "repo_name": "onders86/camel", "path": "camel-core/src/main/java/org/apache/camel/util/URISupport.java", "license": "apache-2.0", "size": 26689 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
944,893
protected static String copyResourceTo(String inDir, String name, String outDir) throws Exception { String result; String resource; InputStream is; BufferedInputStream bis; String outFull; File out; FileOutputStream fos; BufferedOutputStream bos; result = null; is = null; bis = null; fos = null; bos = null; try { resource = inDir; if (!resource.endsWith("/")) resource += "/"; resource += name; outFull = outDir + File.separator + name; LOGGER.info("Copying resource '" + resource + "' to '" + outFull + "'"); is = Binaries.class.getClassLoader().getResourceAsStream(resource); bis = new BufferedInputStream(is); out = new File(outFull); fos = new FileOutputStream(out); bos = new BufferedOutputStream(fos); IOUtils.copy(bis, bos); result = out.getAbsolutePath(); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Copying failed!", e); throw e; } finally { IOUtils.closeQuietly(bis, null); IOUtils.closeQuietly(is, null); IOUtils.closeQuietly(bos, null); IOUtils.closeQuietly(fos, null); } return result; }
static String function(String inDir, String name, String outDir) throws Exception { String result; String resource; InputStream is; BufferedInputStream bis; String outFull; File out; FileOutputStream fos; BufferedOutputStream bos; result = null; is = null; bis = null; fos = null; bos = null; try { resource = inDir; if (!resource.endsWith("/")) resource += "/"; resource += name; outFull = outDir + File.separator + name; LOGGER.info(STR + resource + STR + outFull + "'"); is = Binaries.class.getClassLoader().getResourceAsStream(resource); bis = new BufferedInputStream(is); out = new File(outFull); fos = new FileOutputStream(out); bos = new BufferedOutputStream(fos); IOUtils.copy(bis, bos); result = out.getAbsolutePath(); } catch (Exception e) { LOGGER.log(Level.SEVERE, STR, e); throw e; } finally { IOUtils.closeQuietly(bis, null); IOUtils.closeQuietly(is, null); IOUtils.closeQuietly(bos, null); IOUtils.closeQuietly(fos, null); } return result; }
/** * Copies the specified resource to the output directory. * * @param inDir the resource directory to use * @param name the name of the resource * @param outDir the output directory * @return the full path */
Copies the specified resource to the output directory
copyResourceTo
{ "repo_name": "fracpete/rsync4j", "path": "rsync4j-core/src/main/java/com/github/fracpete/rsync4j/core/Binaries.java", "license": "gpl-3.0", "size": 11297 }
[ "java.io.BufferedInputStream", "java.io.BufferedOutputStream", "java.io.File", "java.io.FileOutputStream", "java.io.InputStream", "java.util.logging.Level", "org.apache.commons.io.IOUtils" ]
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.util.logging.Level; import org.apache.commons.io.IOUtils;
import java.io.*; import java.util.logging.*; import org.apache.commons.io.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
263,930
@DELETE @Path("/{path:.*}") @Produces("application/json") @ApiOperation(value = "Delete a resource", httpMethod = "DELETE", notes = "Delete a resource") @ApiResponses(value = { @ApiResponse(code = 204, message = "Resource deleted successfully"), @ApiResponse(code = 401, message = "Invalid credentials provided"), @ApiResponse(code = 404, message = "Specified resource not found"), @ApiResponse(code = 500, message = "Internal server error occurred")}) public Response deleteResource(@PathParam("path") List<PathSegment> path, @HeaderParam("X-JWT-Assertion") String JWTToken) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); RestAPIAuthContext authContext = RestAPISecurityUtils.getAuthContext(carbonContext, JWTToken); if (!authContext.isAuthorized()) { return Response.status(Response.Status.UNAUTHORIZED).build(); } String resourcePath = getResourcePath(path); Registry registry = getUserRegistry(authContext.getUserName(), authContext.getTenantId()); try { if (!registry.resourceExists(resourcePath)) { return Response.status(Response.Status.NOT_FOUND).entity( RestAPIConstants.RESOURCE_NOT_FOUND + resourcePath).build(); } // if resource exists delete the resource registry.delete(resourcePath); return Response.status(Response.Status.NO_CONTENT).build(); } catch (RegistryException e) { log.error("Failed to delete resource " + path, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } }
@Path(STR) @Produces(STR) @ApiOperation(value = STR, httpMethod = STR, notes = STR) @ApiResponses(value = { @ApiResponse(code = 204, message = STR), @ApiResponse(code = 401, message = STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 500, message = STR)}) Response function(@PathParam("path") List<PathSegment> path, @HeaderParam(STR) String JWTToken) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); RestAPIAuthContext authContext = RestAPISecurityUtils.getAuthContext(carbonContext, JWTToken); if (!authContext.isAuthorized()) { return Response.status(Response.Status.UNAUTHORIZED).build(); } String resourcePath = getResourcePath(path); Registry registry = getUserRegistry(authContext.getUserName(), authContext.getTenantId()); try { if (!registry.resourceExists(resourcePath)) { return Response.status(Response.Status.NOT_FOUND).entity( RestAPIConstants.RESOURCE_NOT_FOUND + resourcePath).build(); } registry.delete(resourcePath); return Response.status(Response.Status.NO_CONTENT).build(); } catch (RegistryException e) { log.error(STR + path, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } }
/** * This method delete the requested resource. * * @param path - path segment of the resource path * @return Response - HTTP 204 No Content. */
This method delete the requested resource
deleteResource
{ "repo_name": "sameerak/carbon-registry", "path": "components/registry/org.wso2.carbon.registry.rest.api/src/main/java/org/wso2/carbon/registry/rest/api/Artifact.java", "license": "apache-2.0", "size": 11242 }
[ "com.wordnik.swagger.annotations.ApiOperation", "com.wordnik.swagger.annotations.ApiResponse", "com.wordnik.swagger.annotations.ApiResponses", "java.util.List", "javax.ws.rs.HeaderParam", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.PathSegment", "javax.ws.rs.core.Response", "org.wso2.carbon.context.PrivilegedCarbonContext", "org.wso2.carbon.registry.core.Registry", "org.wso2.carbon.registry.core.exceptions.RegistryException", "org.wso2.carbon.registry.rest.api.security.RestAPIAuthContext", "org.wso2.carbon.registry.rest.api.security.RestAPISecurityUtils" ]
import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import java.util.List; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.PathSegment; import javax.ws.rs.core.Response; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.rest.api.security.RestAPIAuthContext; import org.wso2.carbon.registry.rest.api.security.RestAPISecurityUtils;
import com.wordnik.swagger.annotations.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.wso2.carbon.context.*; import org.wso2.carbon.registry.core.*; import org.wso2.carbon.registry.core.exceptions.*; import org.wso2.carbon.registry.rest.api.security.*;
[ "com.wordnik.swagger", "java.util", "javax.ws", "org.wso2.carbon" ]
com.wordnik.swagger; java.util; javax.ws; org.wso2.carbon;
1,670,128
@Test public void shouldAnswerWithTrue() { assertTrue( true ); }
void function() { assertTrue( true ); }
/** * Rigorous Test :-) */
Rigorous Test :-)
shouldAnswerWithTrue
{ "repo_name": "zhonghuasheng/JAVA", "path": "rabbitmq/src/test/java/com/zhonghuasheng/rabbitmq/AppTest.java", "license": "gpl-3.0", "size": 318 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,238,227
List<T> getPermutation( BigInteger permutationIndex );
List<T> getPermutation( BigInteger permutationIndex );
/** * Calculate the given permutation. * If the class is accessed as an iterator after fetching a specific permutation, * then the iteration should start immediately after the requested permutation. * @param permutationIndex The zero-indexed permutation to generate. * @return The requested permutation, as a List of elements from the input set. */
Calculate the given permutation. If the class is accessed as an iterator after fetching a specific permutation, then the iteration should start immediately after the requested permutation
getPermutation
{ "repo_name": "JonnyANYC/permutations", "path": "src/com/angelajonhome/algorithms/permutations/PermutationGenerator.java", "license": "apache-2.0", "size": 626 }
[ "java.math.BigInteger", "java.util.List" ]
import java.math.BigInteger; import java.util.List;
import java.math.*; import java.util.*;
[ "java.math", "java.util" ]
java.math; java.util;
1,397,874
List<Crif> sensitivities = Arrays.asList(JS_IR_47, JS_IR_48); SimmpleConfig config = SimmpleConfig.Builder() .calculationCurrency("USD") .holdingPeriod(HoldingPeriod.TEN_DAY) .imRole(ImRole.SECURED) .simmCalculationType(SimmCalculationType.TOTAL) .build(); BigDecimal amount = Simmple.calculateWorstOf(sensitivities, config).getImTree().getMargin(); Assert.assertEquals(new BigDecimal("100000000"), amount.setScale(0, RoundingMode.HALF_UP)); }
List<Crif> sensitivities = Arrays.asList(JS_IR_47, JS_IR_48); SimmpleConfig config = SimmpleConfig.Builder() .calculationCurrency("USD") .holdingPeriod(HoldingPeriod.TEN_DAY) .imRole(ImRole.SECURED) .simmCalculationType(SimmCalculationType.TOTAL) .build(); BigDecimal amount = Simmple.calculateWorstOf(sensitivities, config).getImTree().getMargin(); Assert.assertEquals(new BigDecimal(STR), amount.setScale(0, RoundingMode.HALF_UP)); }
/** * Required Passes: None * Element Tested: IR Risk Weight with each sensitivity having a unique applicable regulation * Risk Measure: Delta * Group: Rates & Fx */
Required Passes: None Element Tested: IR Risk Weight with each sensitivity having a unique applicable regulation Risk Measure: Delta Group: Rates & Fx
testJ1
{ "repo_name": "AcadiaSoft/simm-lib", "path": "simm-ple/src/test/java/com/acadiasoft/im/simmple/SimmOptionalTenDayTest.java", "license": "mit", "size": 9084 }
[ "com.acadiasoft.im.simm.config.HoldingPeriod", "com.acadiasoft.im.simm.config.SimmCalculationType", "com.acadiasoft.im.simmple.config.ImRole", "com.acadiasoft.im.simmple.config.SimmpleConfig", "com.acadiasoft.im.simmple.engine.Simmple", "com.acadiasoft.im.simmple.model.Crif", "java.math.BigDecimal", "java.math.RoundingMode", "java.util.Arrays", "java.util.List", "org.junit.Assert" ]
import com.acadiasoft.im.simm.config.HoldingPeriod; import com.acadiasoft.im.simm.config.SimmCalculationType; import com.acadiasoft.im.simmple.config.ImRole; import com.acadiasoft.im.simmple.config.SimmpleConfig; import com.acadiasoft.im.simmple.engine.Simmple; import com.acadiasoft.im.simmple.model.Crif; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Arrays; import java.util.List; import org.junit.Assert;
import com.acadiasoft.im.simm.config.*; import com.acadiasoft.im.simmple.config.*; import com.acadiasoft.im.simmple.engine.*; import com.acadiasoft.im.simmple.model.*; import java.math.*; import java.util.*; import org.junit.*;
[ "com.acadiasoft.im", "java.math", "java.util", "org.junit" ]
com.acadiasoft.im; java.math; java.util; org.junit;
874,072
public List<DataflowContraint<V>> getDependent() { return dependent; }
List<DataflowContraint<V>> function() { return dependent; }
/** * Returns list of dependent constraints that have to * be re-evaluated when this constraint has been changed. */
Returns list of dependent constraints that have to be re-evaluated when this constraint has been changed
getDependent
{ "repo_name": "rla/while", "path": "src/com/infdot/analysis/solver/DataflowContraint.java", "license": "mit", "size": 1778 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,383,335
public interface WorkspaceManagedIdentitySqlControlSettingsClient { @ServiceMethod(returns = ReturnType.SINGLE) ManagedIdentitySqlControlSettingsModelInner get(String resourceGroupName, String workspaceName);
interface WorkspaceManagedIdentitySqlControlSettingsClient { @ServiceMethod(returns = ReturnType.SINGLE) ManagedIdentitySqlControlSettingsModelInner function(String resourceGroupName, String workspaceName);
/** * Get Managed Identity Sql Control Settings. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return managed Identity Sql Control Settings. */
Get Managed Identity Sql Control Settings
get
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/fluent/WorkspaceManagedIdentitySqlControlSettingsClient.java", "license": "mit", "size": 6754 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.synapse.fluent.models.ManagedIdentitySqlControlSettingsModelInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.synapse.fluent.models.ManagedIdentitySqlControlSettingsModelInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.synapse.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
477,795
protected ActionForward cancelled(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return null; } // ----------------------------------------------------- Protected Methods
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return null; }
/** * Method which is dispatched to when the request is a cancel button submit. * Subclasses of <code>DispatchAction</code> should override this method if * they wish to provide default behavior different than returning null. * * @param mapping * The ActionMapping used to select this instance * @param form * The optional ActionForm bean for this request (if any) * @param request * The non-HTTP request we are processing * @param response * The non-HTTP response we are creating * @return The forward to which control should be transferred, or * <code>null</code> if the response has been completed. * @throws Exception * if the application business logic throws an exception. * @since Struts 1.2.0 */
Method which is dispatched to when the request is a cancel button submit. Subclasses of <code>DispatchAction</code> should override this method if they wish to provide default behavior different than returning null
cancelled
{ "repo_name": "jreadstone/zsyproject", "path": "src/org/g4studio/core/mvc/xstruts/actions/DispatchAction.java", "license": "gpl-2.0", "size": 10477 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.g4studio.core.mvc.xstruts.action.ActionForm", "org.g4studio.core.mvc.xstruts.action.ActionForward", "org.g4studio.core.mvc.xstruts.action.ActionMapping" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.g4studio.core.mvc.xstruts.action.ActionForm; import org.g4studio.core.mvc.xstruts.action.ActionForward; import org.g4studio.core.mvc.xstruts.action.ActionMapping;
import javax.servlet.http.*; import org.g4studio.core.mvc.xstruts.action.*;
[ "javax.servlet", "org.g4studio.core" ]
javax.servlet; org.g4studio.core;
1,735,168
public Cluster getCluster() { return cluster; }
Cluster function() { return cluster; }
/** * Get the cluster that was used to obtain this projected database. * @return the Cluster or null if none is associated. */
Get the cluster that was used to obtain this projected database
getCluster
{ "repo_name": "YinYanfei/CadalWorkspace", "path": "ca/pfv/spmf/algorithms/sequentialpatterns/fournier2008/PseudoSequenceDatabase.java", "license": "gpl-3.0", "size": 3445 }
[ "ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008.kmeans_for_fournier08.Cluster" ]
import ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008.kmeans_for_fournier08.Cluster;
import ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008.kmeans_for_fournier08.*;
[ "ca.pfv.spmf" ]
ca.pfv.spmf;
205,122
public static <I> Predicate<I> asPredicate(FailablePredicate<I,?> pPredicate) { return (pInput) -> { try { return pPredicate.test(pInput); } catch (Throwable t) { throw Exceptions.show(t); } }; }
static <I> Predicate<I> function(FailablePredicate<I,?> pPredicate) { return (pInput) -> { try { return pPredicate.test(pInput); } catch (Throwable t) { throw Exceptions.show(t); } }; }
/** * Converts the given {@link FailablePredicate} into a standard {@link Predicate}. * @param <I> The predicates input type (both, the parameter predicate, and the * result) * @param pPredicate The failable predicate to convert. * @return A proxy predicate, which is implemented by invoking {@code pPredicate}. */
Converts the given <code>FailablePredicate</code> into a standard <code>Predicate</code>
asPredicate
{ "repo_name": "jochenw/afw", "path": "afw-core/src/main/java/com/github/jochenw/afw/core/util/Functions.java", "license": "apache-2.0", "size": 38438 }
[ "java.util.function.Predicate" ]
import java.util.function.Predicate;
import java.util.function.*;
[ "java.util" ]
java.util;
186,920
EntityResolver getEntityResolver();
EntityResolver getEntityResolver();
/** * DOCUMENT ME! * * @return the EntityResolver used to find resolve URIs such as for DTDs, or * XML Schema documents */
DOCUMENT ME
getEntityResolver
{ "repo_name": "raedle/univis", "path": "lib/dom4j-1.6.1/src/org/dom4j/Document.java", "license": "lgpl-2.1", "size": 6161 }
[ "org.xml.sax.EntityResolver" ]
import org.xml.sax.EntityResolver;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,549,116
@VisibleForTesting boolean isIntact() { for (int i = 1; i < size; i++) { if (!heapForIndex(i).verifyIndex(i)) { return false; } } return true; } @WeakOuter private class Heap { final Ordering<E> ordering; @MonotonicNonNullDecl @Weak Heap otherHeap; Heap(Ordering<E> ordering) { this.ordering = ordering; }
boolean isIntact() { for (int i = 1; i < size; i++) { if (!heapForIndex(i).verifyIndex(i)) { return false; } } return true; } private class Heap { final Ordering<E> ordering; @MonotonicNonNullDecl @Weak Heap otherHeap; Heap(Ordering<E> ordering) { this.ordering = ordering; }
/** * Returns {@code true} if the MinMax heap structure holds. This is only used in testing. * * <p>TODO(kevinb): move to the test class? */
Returns true if the MinMax heap structure holds. This is only used in testing. TODO(kevinb): move to the test class
isIntact
{ "repo_name": "Xaerxess/guava", "path": "guava/src/com/google/common/collect/MinMaxPriorityQueue.java", "license": "apache-2.0", "size": 33450 }
[ "com.google.j2objc.annotations.Weak", "org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl" ]
import com.google.j2objc.annotations.Weak; import org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl;
import com.google.j2objc.annotations.*; import org.checkerframework.checker.nullness.compatqual.*;
[ "com.google.j2objc", "org.checkerframework.checker" ]
com.google.j2objc; org.checkerframework.checker;
948,022
public static void overScrollBy(final PullToRefreshBase<?> view, final int deltaX, final int scrollX, final int deltaY, final int scrollY, final boolean isTouchEvent) { OverscrollHelper.overScrollBy(view, deltaX, scrollX, deltaY, scrollY, 0, isTouchEvent); } /** * This version of the call is used for Views that need to specify a Scroll Range but scroll back to it's edge correctly. * * @param view PullToRefreshView that is calling this. * @param deltaX change in X in pixels, passed through from {@linkplain View#overScrollBy} call * @param scrollX current X scroll value in pixels before applying deltaY,passed through from {@linkplain View#overScrollBy} call * @param deltaY change in Y in pixels, passed through from from overScrollBy call * @param scrollY current Y scroll value in pixels before applying deltaY,passed through from {@linkplain View#overScrollBy} call * @param scrollRange scroll Range of the View, specifically needed for {@linkplain ScrollView}
static void function(final PullToRefreshBase<?> view, final int deltaX, final int scrollX, final int deltaY, final int scrollY, final boolean isTouchEvent) { OverscrollHelper.overScrollBy(view, deltaX, scrollX, deltaY, scrollY, 0, isTouchEvent); } /** * This version of the call is used for Views that need to specify a Scroll Range but scroll back to it's edge correctly. * * @param view PullToRefreshView that is calling this. * @param deltaX change in X in pixels, passed through from {@linkplain View#overScrollBy} call * @param scrollX current X scroll value in pixels before applying deltaY,passed through from {@linkplain View#overScrollBy} call * @param deltaY change in Y in pixels, passed through from from overScrollBy call * @param scrollY current Y scroll value in pixels before applying deltaY,passed through from {@linkplain View#overScrollBy} call * @param scrollRange scroll Range of the View, specifically needed for {@linkplain ScrollView}
/** * This should only be used on AdapterView's such as ListView as it just * calls through to overScrollBy() with the scrollRange = 0. * AdapterView's do not have a scroll range (i.e. getScrollY() doesn't work). * * @param view PullToRefreshView that is calling this * @param deltaX change in X in pixels, passed through from from {@linkplain View#overScrollBy} call * @param scrollX current X scroll value in pixels before applying deltaY,passed through from {@linkplain View#overScrollBy} call * @param deltaY change in Y in pixels, passed through from from {@linkplain View#overScrollBy} call * @param scrollY current Y scroll value in pixels before applying deltaY,passed through from {@linkplain View#overScrollBy} call * @param isTouchEvent - true if this scroll operation is the result of a touch event, passed through from from {@linkplain View#overScrollBy} call */
This should only be used on AdapterView's such as ListView as it just calls through to overScrollBy() with the scrollRange = 0. AdapterView's do not have a scroll range (i.e. getScrollY() doesn't work)
overScrollBy
{ "repo_name": "OneWorld0neDream/QingQiQiu", "path": "MagicArenaPullToRefresh/src/main/java/com/framework/magicarena/pulltorefresh/OverscrollHelper.java", "license": "apache-2.0", "size": 9619 }
[ "android.view.View", "android.widget.ScrollView" ]
import android.view.View; import android.widget.ScrollView;
import android.view.*; import android.widget.*;
[ "android.view", "android.widget" ]
android.view; android.widget;
471,970
public boolean addAll(Collection c) { createCollection(); return imageCollection.addAll(c); }
boolean function(Collection c) { createCollection(); return imageCollection.addAll(c); }
/** * Creates the <code>Collection</code> rendering if none yet exists, and * adds all of the elements in the specified <code>Collection</code> * to this <code>Collection</code>. */
Creates the <code>Collection</code> rendering if none yet exists, and adds all of the elements in the specified <code>Collection</code> to this <code>Collection</code>
addAll
{ "repo_name": "MarinnaCole/LightZone", "path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/CollectionOp.java", "license": "bsd-3-clause", "size": 60710 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,816,393
public static AccessControlProtos.UsersAndPermissions toUserTablePermissions( ListMultimap<String, TablePermission> perm) { AccessControlProtos.UsersAndPermissions.Builder builder = AccessControlProtos.UsersAndPermissions.newBuilder(); for (Map.Entry<String, Collection<TablePermission>> entry : perm.asMap().entrySet()) { AccessControlProtos.UsersAndPermissions.UserPermissions.Builder userPermBuilder = AccessControlProtos.UsersAndPermissions.UserPermissions.newBuilder(); userPermBuilder.setUser(ByteString.copyFromUtf8(entry.getKey())); for (TablePermission tablePerm: entry.getValue()) { userPermBuilder.addPermissions(toPermission(tablePerm)); } builder.addUserPermissions(userPermBuilder.build()); } return builder.build(); }
static AccessControlProtos.UsersAndPermissions function( ListMultimap<String, TablePermission> perm) { AccessControlProtos.UsersAndPermissions.Builder builder = AccessControlProtos.UsersAndPermissions.newBuilder(); for (Map.Entry<String, Collection<TablePermission>> entry : perm.asMap().entrySet()) { AccessControlProtos.UsersAndPermissions.UserPermissions.Builder userPermBuilder = AccessControlProtos.UsersAndPermissions.UserPermissions.newBuilder(); userPermBuilder.setUser(ByteString.copyFromUtf8(entry.getKey())); for (TablePermission tablePerm: entry.getValue()) { userPermBuilder.addPermissions(toPermission(tablePerm)); } builder.addUserPermissions(userPermBuilder.build()); } return builder.build(); }
/** * Convert a ListMultimap<String, TablePermission> where key is username * to a protobuf UserPermission * * @param perm the list of user and table permissions * @return the protobuf UserTablePermissions */
Convert a ListMultimap where key is username to a protobuf UserPermission
toUserTablePermissions
{ "repo_name": "drewpope/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java", "license": "apache-2.0", "size": 114457 }
[ "com.google.common.collect.ListMultimap", "com.google.protobuf.ByteString", "java.util.Collection", "java.util.Map", "org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos", "org.apache.hadoop.hbase.security.access.TablePermission" ]
import com.google.common.collect.ListMultimap; import com.google.protobuf.ByteString; import java.util.Collection; import java.util.Map; import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos; import org.apache.hadoop.hbase.security.access.TablePermission;
import com.google.common.collect.*; import com.google.protobuf.*; import java.util.*; import org.apache.hadoop.hbase.protobuf.generated.*; import org.apache.hadoop.hbase.security.access.*;
[ "com.google.common", "com.google.protobuf", "java.util", "org.apache.hadoop" ]
com.google.common; com.google.protobuf; java.util; org.apache.hadoop;
106,045
public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser) { this.incrementWindowID(); this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, par1TileEntityDispenser instanceof TileEntityDropper ? 10 : 3, par1TileEntityDispenser.getInvName(), par1TileEntityDispenser.getSizeInventory(), par1TileEntityDispenser.isInvNameLocalized())); this.openContainer = new ContainerDispenser(this.inventory, par1TileEntityDispenser); this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); }
void function(TileEntityDispenser par1TileEntityDispenser) { this.incrementWindowID(); this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, par1TileEntityDispenser instanceof TileEntityDropper ? 10 : 3, par1TileEntityDispenser.getInvName(), par1TileEntityDispenser.getSizeInventory(), par1TileEntityDispenser.isInvNameLocalized())); this.openContainer = new ContainerDispenser(this.inventory, par1TileEntityDispenser); this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); }
/** * Displays the dipsenser GUI for the passed in dispenser entity. Args: TileEntityDispenser */
Displays the dipsenser GUI for the passed in dispenser entity. Args: TileEntityDispenser
displayGUIDispenser
{ "repo_name": "HATB0T/RuneCraftery", "path": "forge/mcp/src/minecraft/net/minecraft/entity/player/EntityPlayerMP.java", "license": "lgpl-3.0", "size": 42595 }
[ "net.minecraft.inventory.ContainerDispenser", "net.minecraft.network.packet.Packet100OpenWindow", "net.minecraft.tileentity.TileEntityDispenser", "net.minecraft.tileentity.TileEntityDropper" ]
import net.minecraft.inventory.ContainerDispenser; import net.minecraft.network.packet.Packet100OpenWindow; import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.inventory.*; import net.minecraft.network.packet.*; import net.minecraft.tileentity.*;
[ "net.minecraft.inventory", "net.minecraft.network", "net.minecraft.tileentity" ]
net.minecraft.inventory; net.minecraft.network; net.minecraft.tileentity;
2,190,654
Stream<VscConverterStation> getVscConverterStationStream();
Stream<VscConverterStation> getVscConverterStationStream();
/** * Get all VSC converter stations connected to this voltage level. * @return all VSC converter stations connected to this voltage level */
Get all VSC converter stations connected to this voltage level
getVscConverterStationStream
{ "repo_name": "itesla/ipst-core", "path": "iidm/iidm-api/src/main/java/eu/itesla_project/iidm/network/VoltageLevel.java", "license": "mpl-2.0", "size": 24958 }
[ "java.util.stream.Stream" ]
import java.util.stream.Stream;
import java.util.stream.*;
[ "java.util" ]
java.util;
1,016,059
public static Resource PomBase() { return ResourceFactory.createResource("http://www.pombase.org/spombe/result/"); }
static Resource function() { return ResourceFactory.createResource("http: }
/** * Returns the link-out URI for objects of "PomBase". */
Returns the link-out URI for objects of "PomBase"
PomBase
{ "repo_name": "BioInterchange/BioInterchange", "path": "supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GOXRef.java", "license": "mit", "size": 41277 }
[ "com.hp.hpl.jena.rdf.model.Resource", "com.hp.hpl.jena.rdf.model.ResourceFactory" ]
import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.*;
[ "com.hp.hpl" ]
com.hp.hpl;
2,193,434
public void writeTo(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); dos.writeInt(N); dos.writeInt(q); dos.writeInt(d); dos.writeInt(d1); dos.writeInt(d2); dos.writeInt(d3); dos.writeInt(B); dos.writeDouble(beta); dos.writeDouble(normBound); dos.writeInt(signFailTolerance); dos.writeInt(bitsF); dos.writeUTF(hashAlg.getAlgorithmName()); }
void function(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); dos.writeInt(N); dos.writeInt(q); dos.writeInt(d); dos.writeInt(d1); dos.writeInt(d2); dos.writeInt(d3); dos.writeInt(B); dos.writeDouble(beta); dos.writeDouble(normBound); dos.writeInt(signFailTolerance); dos.writeInt(bitsF); dos.writeUTF(hashAlg.getAlgorithmName()); }
/** * Writes the parameter set to an output stream * * @param os an output stream * @throws IOException */
Writes the parameter set to an output stream
writeTo
{ "repo_name": "xdv/ripple-lib-java", "path": "ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/ntru/NTRUSigningParameters.java", "license": "isc", "size": 8452 }
[ "java.io.DataOutputStream", "java.io.IOException", "java.io.OutputStream" ]
import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,540,534
public void updateLocation(Location location) { sendMessage(UPDATE_LOCATION, 0, location); }
void function(Location location) { sendMessage(UPDATE_LOCATION, 0, location); }
/** * This is called to inform us when another location provider returns a location. * Someday we might use this for network location injection to aid the GPS */
This is called to inform us when another location provider returns a location. Someday we might use this for network location injection to aid the GPS
updateLocation
{ "repo_name": "mateor/pdroid", "path": "android-4.0.3_r1/trunk/frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java", "license": "gpl-3.0", "size": 64310 }
[ "android.location.Location" ]
import android.location.Location;
import android.location.*;
[ "android.location" ]
android.location;
2,640,655
@SuppressWarnings("unused") @Test(expected = IllegalArgumentException.class) public void testParamWithNoName () { new Parameter(null, new ArrayList<String>(), false, "does not matter", 0, null); }
@SuppressWarnings(STR) @Test(expected = IllegalArgumentException.class) void function () { new Parameter(null, new ArrayList<String>(), false, STR, 0, null); }
/** * Test that a parameter cannot be created with no name. */
Test that a parameter cannot be created with no name
testParamWithNoName
{ "repo_name": "AlexRNL/Commons", "path": "src/test/java/com/alexrnl/commons/arguments/ParameterTest.java", "license": "bsd-3-clause", "size": 5472 }
[ "java.util.ArrayList", "org.junit.Test" ]
import java.util.ArrayList; import org.junit.Test;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,428,293
public List<Element> getMarkupHeadElements() { List<Element> markupHeadElements = null; if (markupHeaders != null) { markupHeadElements = markupHeaders.get("javax.portlet.markup.head.element"); } return markupHeadElements == null ? Collections.EMPTY_LIST : markupHeadElements; }
List<Element> function() { List<Element> markupHeadElements = null; if (markupHeaders != null) { markupHeadElements = markupHeaders.get(STR); } return markupHeadElements == null ? Collections.EMPTY_LIST : markupHeadElements; }
/** * Returns the list of DOM Elements that are set by the portlet using addProperty method of * PortletResponse with the property name as "javax.portlet.markup.head.element". If there is no * DOM elements, it returns an empty list. * @return the list of the DOM Elements that set by the portlet */
Returns the list of DOM Elements that are set by the portlet using addProperty method of PortletResponse with the property name as "javax.portlet.markup.head.element". If there is no DOM elements, it returns an empty list
getMarkupHeadElements
{ "repo_name": "NicolasEYSSERIC/Silverpeas-Core", "path": "web-core/src/main/java/com/sun/portal/portletcontainer/invoker/ResponseProperties.java", "license": "agpl-3.0", "size": 3979 }
[ "java.util.Collections", "java.util.List", "org.w3c.dom.Element" ]
import java.util.Collections; import java.util.List; import org.w3c.dom.Element;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
853,965
public void requestClusterDelete(String clusterId, Account account, ClusterOperationRequest request) throws IOException, IllegalAccessException, MissingEntityException, MissingFieldsException { Lock lock = lockService.getClusterLock(account.getTenantId(), clusterId); lock.lock(); try { Cluster cluster = getCluster(clusterId, account); JobId deleteJobId = idService.getNewJobId(clusterId); ClusterJob deleteJob = new ClusterJob(deleteJobId, ClusterAction.CLUSTER_DELETE); deleteJob.setJobStatus(ClusterJob.Status.RUNNING); cluster.setLatestJobId(deleteJobId.getId()); cluster.setStatus(Cluster.Status.PENDING); prepareClusterForOperation(cluster, request); LOG.debug("Writing cluster {} to store with delete job {}", clusterId, deleteJobId); clusterStoreService.getView(account).writeCluster(cluster); clusterStore.writeClusterJob(deleteJob); serverStats.getClusterStats().incrementStat(ClusterAction.CLUSTER_DELETE); clusterQueues.add(account.getTenantId(), new Element(clusterId, ClusterAction.CLUSTER_DELETE.name())); } finally { lock.unlock(); } }
void function(String clusterId, Account account, ClusterOperationRequest request) throws IOException, IllegalAccessException, MissingEntityException, MissingFieldsException { Lock lock = lockService.getClusterLock(account.getTenantId(), clusterId); lock.lock(); try { Cluster cluster = getCluster(clusterId, account); JobId deleteJobId = idService.getNewJobId(clusterId); ClusterJob deleteJob = new ClusterJob(deleteJobId, ClusterAction.CLUSTER_DELETE); deleteJob.setJobStatus(ClusterJob.Status.RUNNING); cluster.setLatestJobId(deleteJobId.getId()); cluster.setStatus(Cluster.Status.PENDING); prepareClusterForOperation(cluster, request); LOG.debug(STR, clusterId, deleteJobId); clusterStoreService.getView(account).writeCluster(cluster); clusterStore.writeClusterJob(deleteJob); serverStats.getClusterStats().incrementStat(ClusterAction.CLUSTER_DELETE); clusterQueues.add(account.getTenantId(), new Element(clusterId, ClusterAction.CLUSTER_DELETE.name())); } finally { lock.unlock(); } }
/** * Request deletion of a given cluster that the user has permission to delete. * * @param clusterId Id of the cluster to delete. * @param account Account of the user making the request. * @param request Request to delete the cluster, containing optional provider fields. * @throws IOException if there was some error writing to stores. * @throws MissingEntityException if some entity required to complete, such as the provider type * used to create the cluster, could not be found. * @throws IllegalAccessException if the operation is not allowed for the given account. * @throws MissingFieldsException if there are required fields missing from the request. */
Request deletion of a given cluster that the user has permission to delete
requestClusterDelete
{ "repo_name": "caskdata/coopr", "path": "coopr-server/src/main/java/co/cask/coopr/cluster/ClusterService.java", "license": "apache-2.0", "size": 39562 }
[ "co.cask.coopr.account.Account", "co.cask.coopr.common.queue.Element", "co.cask.coopr.http.request.ClusterOperationRequest", "co.cask.coopr.scheduler.ClusterAction", "co.cask.coopr.scheduler.task.ClusterJob", "co.cask.coopr.scheduler.task.JobId", "co.cask.coopr.scheduler.task.MissingEntityException", "java.io.IOException", "java.util.concurrent.locks.Lock" ]
import co.cask.coopr.account.Account; import co.cask.coopr.common.queue.Element; import co.cask.coopr.http.request.ClusterOperationRequest; import co.cask.coopr.scheduler.ClusterAction; import co.cask.coopr.scheduler.task.ClusterJob; import co.cask.coopr.scheduler.task.JobId; import co.cask.coopr.scheduler.task.MissingEntityException; import java.io.IOException; import java.util.concurrent.locks.Lock;
import co.cask.coopr.account.*; import co.cask.coopr.common.queue.*; import co.cask.coopr.http.request.*; import co.cask.coopr.scheduler.*; import co.cask.coopr.scheduler.task.*; import java.io.*; import java.util.concurrent.locks.*;
[ "co.cask.coopr", "java.io", "java.util" ]
co.cask.coopr; java.io; java.util;
284,949
CauseOfBlockage getCauseOfBlockage();
CauseOfBlockage getCauseOfBlockage();
/** * If the execution of this task should be blocked for temporary reasons, * this method returns a non-null object explaining why. * * <p> * Otherwise this method returns null, indicating that the build can proceed right away. * * <p> * This can be used to define mutual exclusion that goes beyond * {@link #getResourceList()}. */
If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why. Otherwise this method returns null, indicating that the build can proceed right away. This can be used to define mutual exclusion that goes beyond <code>#getResourceList()</code>
getCauseOfBlockage
{ "repo_name": "alvarolobato/jenkins", "path": "core/src/main/java/hudson/model/Queue.java", "license": "mit", "size": 108236 }
[ "hudson.model.queue.CauseOfBlockage" ]
import hudson.model.queue.CauseOfBlockage;
import hudson.model.queue.*;
[ "hudson.model.queue" ]
hudson.model.queue;
1,476,292
public static String[] getActiveProfiles(Environment env) { String[] profiles = env.getActiveProfiles(); if (profiles.length == 0) { return env.getDefaultProfiles(); } return profiles; }
static String[] function(Environment env) { String[] profiles = env.getActiveProfiles(); if (profiles.length == 0) { return env.getDefaultProfiles(); } return profiles; }
/** * Get the profiles that are applied else get default profiles. * * @param env spring environment * @return profiles */
Get the profiles that are applied else get default profiles
getActiveProfiles
{ "repo_name": "RADAR-CNS/ManagementPortal", "path": "src/main/java/org/radarcns/management/config/DefaultProfileUtil.java", "license": "apache-2.0", "size": 1747 }
[ "org.springframework.core.env.Environment" ]
import org.springframework.core.env.Environment;
import org.springframework.core.env.*;
[ "org.springframework.core" ]
org.springframework.core;
186,907
@Test public void getWindingList() { List<Vector2> points = new ArrayList<Vector2>(); points.add(new Vector2(-1.0, -1.0)); points.add(new Vector2(1.0, -1.0)); points.add(new Vector2(1.0, 1.0)); points.add(new Vector2(-1.0, 1.0)); TestCase.assertTrue(Geometry.getWinding(points) > 0); Collections.reverse(points); TestCase.assertTrue(Geometry.getWinding(points) < 0); }
void function() { List<Vector2> points = new ArrayList<Vector2>(); points.add(new Vector2(-1.0, -1.0)); points.add(new Vector2(1.0, -1.0)); points.add(new Vector2(1.0, 1.0)); points.add(new Vector2(-1.0, 1.0)); TestCase.assertTrue(Geometry.getWinding(points) > 0); Collections.reverse(points); TestCase.assertTrue(Geometry.getWinding(points) < 0); }
/** * Tests the getWinding method passing a list. */
Tests the getWinding method passing a list
getWindingList
{ "repo_name": "satishbabusee/dyn4j", "path": "junit/org/dyn4j/geometry/GeometryTest.java", "license": "bsd-3-clause", "size": 54121 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "junit.framework.TestCase", "org.dyn4j.geometry.Geometry", "org.dyn4j.geometry.Vector2" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import junit.framework.TestCase; import org.dyn4j.geometry.Geometry; import org.dyn4j.geometry.Vector2;
import java.util.*; import junit.framework.*; import org.dyn4j.geometry.*;
[ "java.util", "junit.framework", "org.dyn4j.geometry" ]
java.util; junit.framework; org.dyn4j.geometry;
2,796,637
public static Graph createDefaultGraph() { return helper.createDefaultGraph(); }
static Graph function() { return helper.createDefaultGraph(); }
/** * Creates a new Graph. By default this will deliver a plain in-memory graph, * but other implementations may deliver graphs with concurrency support and * other features. * @return a default graph * @see #createDefaultModel() */
Creates a new Graph. By default this will deliver a plain in-memory graph, but other implementations may deliver graphs with concurrency support and other features
createDefaultGraph
{ "repo_name": "TopQuadrant/shacl", "path": "src/main/java/org/topbraid/jenax/util/JenaUtil.java", "license": "apache-2.0", "size": 38680 }
[ "org.apache.jena.graph.Graph" ]
import org.apache.jena.graph.Graph;
import org.apache.jena.graph.*;
[ "org.apache.jena" ]
org.apache.jena;
2,494,848
public static TreeDriver getTreeDriver(ComponentOperator operator) { return (TreeDriver) getDriver(TREE_DRIVER_ID, operator.getClass()); }
static TreeDriver function(ComponentOperator operator) { return (TreeDriver) getDriver(TREE_DRIVER_ID, operator.getClass()); }
/** * Returns {@code TREE_DRIVER_ID} driver. * * @param operator Operator to find driver for. * @return a driver * @see #setTreeDriver */
Returns TREE_DRIVER_ID driver
getTreeDriver
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverManager.java", "license": "gpl-2.0", "size": 24726 }
[ "org.netbeans.jemmy.operators.ComponentOperator" ]
import org.netbeans.jemmy.operators.ComponentOperator;
import org.netbeans.jemmy.operators.*;
[ "org.netbeans.jemmy" ]
org.netbeans.jemmy;
413,341
@SuppressWarnings("unchecked") public void findStartTime() throws CalendarException { CalendarManagerBean cmb = ControllerUtil.getCalendarManagerBean(); AonCalendar aonCalendar = cmb.getCalendar( this.resource.getCalendar() ); ComponentList cl = aonCalendar.getVEvents(EventCategory.WORK); if ( cl.size() > 0 ) { Iterator it = cl.iterator(); while (it.hasNext()) { VEvent vevent = (VEvent) it.next(); Date start = CalendarUtil.getDate( (DateTime)vevent.getStartDate().getDate() ); Calendar calendar = Calendar.getInstance(); calendar.setTime(start); if ( calendar.get(Calendar.HOUR_OF_DAY) < this.hour ) { setHour( calendar.get(Calendar.HOUR_OF_DAY) ); setMinute( calendar.get(Calendar.MINUTE) ); } } } else { String msg = Utils.getMessage( "aon_planner_workingtime_not_found", new String[] { this.resource.getOwner() } ); throw new CalendarException( msg ); } }
@SuppressWarnings(STR) void function() throws CalendarException { CalendarManagerBean cmb = ControllerUtil.getCalendarManagerBean(); AonCalendar aonCalendar = cmb.getCalendar( this.resource.getCalendar() ); ComponentList cl = aonCalendar.getVEvents(EventCategory.WORK); if ( cl.size() > 0 ) { Iterator it = cl.iterator(); while (it.hasNext()) { VEvent vevent = (VEvent) it.next(); Date start = CalendarUtil.getDate( (DateTime)vevent.getStartDate().getDate() ); Calendar calendar = Calendar.getInstance(); calendar.setTime(start); if ( calendar.get(Calendar.HOUR_OF_DAY) < this.hour ) { setHour( calendar.get(Calendar.HOUR_OF_DAY) ); setMinute( calendar.get(Calendar.MINUTE) ); } } } else { String msg = Utils.getMessage( STR, new String[] { this.resource.getOwner() } ); throw new CalendarException( msg ); } }
/** * Finds current resource working start time. * * @throws CalendarException */
Finds current resource working start time
findStartTime
{ "repo_name": "Esleelkartea/aon-employee", "path": "aonemployee_v2.3.0_src/paquetes descomprimidos/aon.ui.planner-2.1.5-sources/com/code/aon/ui/planner/IncidencesController.java", "license": "gpl-2.0", "size": 21884 }
[ "com.code.aon.calendar.AonCalendar", "com.code.aon.calendar.CalendarException", "com.code.aon.calendar.CalendarUtil", "com.code.aon.calendar.enumeration.EventCategory", "java.util.Calendar", "java.util.Date", "java.util.Iterator", "net.fortuna.ical4j.model.ComponentList", "net.fortuna.ical4j.model.DateTime", "net.fortuna.ical4j.model.component.VEvent" ]
import com.code.aon.calendar.AonCalendar; import com.code.aon.calendar.CalendarException; import com.code.aon.calendar.CalendarUtil; import com.code.aon.calendar.enumeration.EventCategory; import java.util.Calendar; import java.util.Date; import java.util.Iterator; import net.fortuna.ical4j.model.ComponentList; import net.fortuna.ical4j.model.DateTime; import net.fortuna.ical4j.model.component.VEvent;
import com.code.aon.calendar.*; import com.code.aon.calendar.enumeration.*; import java.util.*; import net.fortuna.ical4j.model.*; import net.fortuna.ical4j.model.component.*;
[ "com.code.aon", "java.util", "net.fortuna.ical4j" ]
com.code.aon; java.util; net.fortuna.ical4j;
1,249,488
public void setSyncAnchor(SyncAnchor anchor) { config.setSyncAnchor(anchor); }
void function(SyncAnchor anchor) { config.setSyncAnchor(anchor); }
/** * Set the value of the Last Anchor for this source */
Set the value of the Last Anchor for this source
setSyncAnchor
{ "repo_name": "zhangdakun/funasyn", "path": "externals/java-sdk/sync/src/main/java/com/funambol/sync/client/BaseSyncSource.java", "license": "agpl-3.0", "size": 27040 }
[ "com.funambol.sync.SyncAnchor" ]
import com.funambol.sync.SyncAnchor;
import com.funambol.sync.*;
[ "com.funambol.sync" ]
com.funambol.sync;
1,704,827
public static void greaterZero(String name, Integer value) throws NullPointerException, IllegalArgumentException { if (Objects.requireNonNull(value, name) <= 0) { throw new IllegalArgumentException(name + " may not less or equal 0!"); } }
static void function(String name, Integer value) throws NullPointerException, IllegalArgumentException { if (Objects.requireNonNull(value, name) <= 0) { throw new IllegalArgumentException(name + STR); } }
/** * Throws a {@code NullPointerExceptions} if value is null or a {@code IllegalArgumentException} if value is <= 0. * * @param name the name of the value * @param value the value to check * * @throws NullPointerException if value is null * @throws IllegalArgumentException if value is <= 0 */
Throws a NullPointerExceptions if value is null or a IllegalArgumentException if value is <= 0
greaterZero
{ "repo_name": "autermann/SOS", "path": "core/api/src/main/java/org/n52/sos/cache/CacheValidation.java", "license": "gpl-2.0", "size": 4836 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
400,584
public int toCharMarshalCost() { return Marshal.COST_TO_CHAR; }
int function() { return Marshal.COST_TO_CHAR; }
/** * Cost to convert to a character */
Cost to convert to a character
toCharMarshalCost
{ "repo_name": "dwango/quercus", "path": "src/main/java/com/caucho/quercus/env/Value.java", "license": "gpl-2.0", "size": 58000 }
[ "com.caucho.quercus.marshal.Marshal" ]
import com.caucho.quercus.marshal.Marshal;
import com.caucho.quercus.marshal.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
2,441,487
public ServiceFuture<ImageInner> updateAsync(String resourceGroupName, String imageName, ImageUpdate parameters, final ServiceCallback<ImageInner> serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, imageName, parameters), serviceCallback); }
ServiceFuture<ImageInner> function(String resourceGroupName, String imageName, ImageUpdate parameters, final ServiceCallback<ImageInner> serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, imageName, parameters), serviceCallback); }
/** * Update an image. * * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param parameters Parameters supplied to the Update Image operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Update an image
updateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/compute/mgmt-v2019_03_01/src/main/java/com/microsoft/azure/management/compute/v2019_03_01/implementation/ImagesInner.java", "license": "mit", "size": 66881 }
[ "com.microsoft.azure.management.compute.v2019_03_01.ImageUpdate", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.azure.management.compute.v2019_03_01.ImageUpdate; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.azure.management.compute.v2019_03_01.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,530,380
@Test public void noMinifiedResourceAvailable() { MinCountingResourceStreamLocator locator = new MinCountingResourceStreamLocator(); Application.get().getResourceSettings().setResourceStreamLocator(locator); Application.get().getResourceSettings().setUseMinifiedResources(true); ResourceReference reference = new JavaScriptResourceReference( MinifiedAwareResourceReferenceTest.class, "a.js"); assertEquals("a.js", reference.getName()); String fileContent = renderResource(reference); assertEquals("//a", fileContent); assertEquals(1, locator.minLocated); } private class MinCountingResourceStreamLocator extends ResourceStreamLocator { public int minLocated = 0;
void function() { MinCountingResourceStreamLocator locator = new MinCountingResourceStreamLocator(); Application.get().getResourceSettings().setResourceStreamLocator(locator); Application.get().getResourceSettings().setUseMinifiedResources(true); ResourceReference reference = new JavaScriptResourceReference( MinifiedAwareResourceReferenceTest.class, "a.js"); assertEquals("a.js", reference.getName()); String fileContent = renderResource(reference); assertEquals(" assertEquals(1, locator.minLocated); } private class MinCountingResourceStreamLocator extends ResourceStreamLocator { public int minLocated = 0;
/** * Tests fallback to normal resource when pre-minified is not available */
Tests fallback to normal resource when pre-minified is not available
noMinifiedResourceAvailable
{ "repo_name": "mafulafunk/wicket", "path": "wicket-core/src/test/java/org/apache/wicket/request/resource/MinifiedAwareResourceReferenceTest.java", "license": "apache-2.0", "size": 3194 }
[ "org.apache.wicket.Application", "org.apache.wicket.core.util.resource.locator.ResourceStreamLocator" ]
import org.apache.wicket.Application; import org.apache.wicket.core.util.resource.locator.ResourceStreamLocator;
import org.apache.wicket.*; import org.apache.wicket.core.util.resource.locator.*;
[ "org.apache.wicket" ]
org.apache.wicket;
174,432
private void parseMagicBranch(ReceiveCommand cmd) throws PermissionBackendException { logger.atFine().log("Found magic branch %s", cmd.getRefName()); MagicBranchInput magicBranch = new MagicBranchInput(user, cmd, labelTypes, notesMigration); String ref; magicBranch.cmdLineParser = optionParserFactory.create(magicBranch); try { ref = magicBranch.parse(repo, receivePack.getAdvertisedRefs().keySet(), pushOptions); } catch (CmdLineException e) { if (!magicBranch.cmdLineParser.wasHelpRequestedByOption()) { logger.atFine().log("Invalid branch syntax"); reject(cmd, e.getMessage()); return; } ref = null; // never happens } if (magicBranch.topic != null && magicBranch.topic.length() > ChangeUtil.TOPIC_MAX_LENGTH) { reject( cmd, String.format("topic length exceeds the limit (%d)", ChangeUtil.TOPIC_MAX_LENGTH)); } if (magicBranch.cmdLineParser.wasHelpRequestedByOption()) { StringWriter w = new StringWriter(); w.write("\nHelp for refs/for/branch:\n\n"); magicBranch.cmdLineParser.printUsage(w, null); addMessage(w.toString()); reject(cmd, "see help"); return; } if (projectState.isAllUsers() && RefNames.REFS_USERS_SELF.equals(ref)) { logger.atFine().log("Handling %s", RefNames.REFS_USERS_SELF); ref = RefNames.refsUsers(user.getAccountId()); } if (!receivePack.getAdvertisedRefs().containsKey(ref) && !ref.equals(readHEAD(repo)) && !ref.equals(RefNames.REFS_CONFIG)) { logger.atFine().log("Ref %s not found", ref); if (ref.startsWith(Constants.R_HEADS)) { String n = ref.substring(Constants.R_HEADS.length()); reject(cmd, "branch " + n + " not found"); } else { reject(cmd, ref + " not found"); } return; } magicBranch.dest = new Branch.NameKey(project.getNameKey(), ref); magicBranch.perm = permissions.ref(ref); Optional<AuthException> err = checkRefPermission(magicBranch.perm, RefPermission.CREATE_CHANGE); if (err.isPresent()) { rejectProhibited(cmd, err.get()); return; } // TODO(davido): Remove legacy support for drafts magic branch option // after repo-tool supports private and work-in-progress changes. if (magicBranch.draft && !receiveConfig.allowDrafts) { errors.put(CODE_REVIEW_ERROR, ref); reject(cmd, "draft workflow is disabled"); return; } if (magicBranch.isPrivate && magicBranch.removePrivate) { reject(cmd, "the options 'private' and 'remove-private' are mutually exclusive"); return; } boolean privateByDefault = projectCache.get(project.getNameKey()).is(BooleanProjectConfig.PRIVATE_BY_DEFAULT); setChangeAsPrivate = magicBranch.draft || magicBranch.isPrivate || (privateByDefault && !magicBranch.removePrivate); if (receiveConfig.disablePrivateChanges && setChangeAsPrivate) { reject(cmd, "private changes are disabled"); return; } if (magicBranch.workInProgress && magicBranch.ready) { reject(cmd, "the options 'wip' and 'ready' are mutually exclusive"); return; } if (magicBranch.publishComments && magicBranch.noPublishComments) { reject( cmd, "the options 'publish-comments' and 'no-publish-comments' are mutually exclusive"); return; } if (magicBranch.submit) { err = checkRefPermission(magicBranch.perm, RefPermission.UPDATE_BY_SUBMIT); if (err.isPresent()) { rejectProhibited(cmd, err.get()); return; } } RevWalk walk = receivePack.getRevWalk(); RevCommit tip; try { tip = walk.parseCommit(magicBranch.cmd.getNewId()); logger.atFine().log("Tip of push: %s", tip.name()); } catch (IOException ex) { magicBranch.cmd.setResult(REJECTED_MISSING_OBJECT); logger.atSevere().withCause(ex).log("Invalid pack upload; one or more objects weren't sent"); return; } String destBranch = magicBranch.dest.get(); try { if (magicBranch.merged) { if (magicBranch.base != null) { reject(cmd, "cannot use merged with base"); return; } RevCommit branchTip = readBranchTip(cmd, magicBranch.dest); if (branchTip == null) { return; // readBranchTip already rejected cmd. } if (!walk.isMergedInto(tip, branchTip)) { reject(cmd, "not merged into branch"); return; } } // If tip is a merge commit, or the root commit or // if %base or %merged was specified, ignore newChangeForAllNotInTarget. if (tip.getParentCount() > 1 || magicBranch.base != null || magicBranch.merged || tip.getParentCount() == 0) { logger.atFine().log("Forcing newChangeForAllNotInTarget = false"); newChangeForAllNotInTarget = false; } if (magicBranch.base != null) { logger.atFine().log("Handling %%base: %s", magicBranch.base); magicBranch.baseCommit = Lists.newArrayListWithCapacity(magicBranch.base.size()); for (ObjectId id : magicBranch.base) { try { magicBranch.baseCommit.add(walk.parseCommit(id)); } catch (IncorrectObjectTypeException notCommit) { reject(cmd, "base must be a commit"); return; } catch (MissingObjectException e) { reject(cmd, "base not found"); return; } catch (IOException e) { logger.atWarning().withCause(e).log( "Project %s cannot read %s", project.getName(), id.name()); reject(cmd, INTERNAL_SERVER_ERROR); return; } } } else if (newChangeForAllNotInTarget) { RevCommit branchTip = readBranchTip(cmd, magicBranch.dest); if (branchTip == null) { return; // readBranchTip already rejected cmd. } magicBranch.baseCommit = Collections.singletonList(branchTip); logger.atFine().log("Set baseCommit = %s", magicBranch.baseCommit.get(0).name()); } } catch (IOException ex) { logger.atWarning().withCause(ex).log( "Error walking to %s in project %s", destBranch, project.getName()); reject(cmd, INTERNAL_SERVER_ERROR); return; } if (magicBranch.deprecatedTopicSeen) { messages.add( new ValidationMessage( "WARNING: deprecated topic syntax. Use %topic=TOPIC instead", false)); logger.atInfo().log("deprecated topic push seen for project %s", project.getName()); } if (validateConnected(magicBranch.cmd, magicBranch.dest, tip)) { this.magicBranch = magicBranch; } }
void function(ReceiveCommand cmd) throws PermissionBackendException { logger.atFine().log(STR, cmd.getRefName()); MagicBranchInput magicBranch = new MagicBranchInput(user, cmd, labelTypes, notesMigration); String ref; magicBranch.cmdLineParser = optionParserFactory.create(magicBranch); try { ref = magicBranch.parse(repo, receivePack.getAdvertisedRefs().keySet(), pushOptions); } catch (CmdLineException e) { if (!magicBranch.cmdLineParser.wasHelpRequestedByOption()) { logger.atFine().log(STR); reject(cmd, e.getMessage()); return; } ref = null; } if (magicBranch.topic != null && magicBranch.topic.length() > ChangeUtil.TOPIC_MAX_LENGTH) { reject( cmd, String.format(STR, ChangeUtil.TOPIC_MAX_LENGTH)); } if (magicBranch.cmdLineParser.wasHelpRequestedByOption()) { StringWriter w = new StringWriter(); w.write(STR); magicBranch.cmdLineParser.printUsage(w, null); addMessage(w.toString()); reject(cmd, STR); return; } if (projectState.isAllUsers() && RefNames.REFS_USERS_SELF.equals(ref)) { logger.atFine().log(STR, RefNames.REFS_USERS_SELF); ref = RefNames.refsUsers(user.getAccountId()); } if (!receivePack.getAdvertisedRefs().containsKey(ref) && !ref.equals(readHEAD(repo)) && !ref.equals(RefNames.REFS_CONFIG)) { logger.atFine().log(STR, ref); if (ref.startsWith(Constants.R_HEADS)) { String n = ref.substring(Constants.R_HEADS.length()); reject(cmd, STR + n + STR); } else { reject(cmd, ref + STR); } return; } magicBranch.dest = new Branch.NameKey(project.getNameKey(), ref); magicBranch.perm = permissions.ref(ref); Optional<AuthException> err = checkRefPermission(magicBranch.perm, RefPermission.CREATE_CHANGE); if (err.isPresent()) { rejectProhibited(cmd, err.get()); return; } if (magicBranch.draft && !receiveConfig.allowDrafts) { errors.put(CODE_REVIEW_ERROR, ref); reject(cmd, STR); return; } if (magicBranch.isPrivate && magicBranch.removePrivate) { reject(cmd, STR); return; } boolean privateByDefault = projectCache.get(project.getNameKey()).is(BooleanProjectConfig.PRIVATE_BY_DEFAULT); setChangeAsPrivate = magicBranch.draft magicBranch.isPrivate (privateByDefault && !magicBranch.removePrivate); if (receiveConfig.disablePrivateChanges && setChangeAsPrivate) { reject(cmd, STR); return; } if (magicBranch.workInProgress && magicBranch.ready) { reject(cmd, STR); return; } if (magicBranch.publishComments && magicBranch.noPublishComments) { reject( cmd, STR); return; } if (magicBranch.submit) { err = checkRefPermission(magicBranch.perm, RefPermission.UPDATE_BY_SUBMIT); if (err.isPresent()) { rejectProhibited(cmd, err.get()); return; } } RevWalk walk = receivePack.getRevWalk(); RevCommit tip; try { tip = walk.parseCommit(magicBranch.cmd.getNewId()); logger.atFine().log(STR, tip.name()); } catch (IOException ex) { magicBranch.cmd.setResult(REJECTED_MISSING_OBJECT); logger.atSevere().withCause(ex).log(STR); return; } String destBranch = magicBranch.dest.get(); try { if (magicBranch.merged) { if (magicBranch.base != null) { reject(cmd, STR); return; } RevCommit branchTip = readBranchTip(cmd, magicBranch.dest); if (branchTip == null) { return; } if (!walk.isMergedInto(tip, branchTip)) { reject(cmd, STR); return; } } if (tip.getParentCount() > 1 magicBranch.base != null magicBranch.merged tip.getParentCount() == 0) { logger.atFine().log(STR); newChangeForAllNotInTarget = false; } if (magicBranch.base != null) { logger.atFine().log(STR, magicBranch.base); magicBranch.baseCommit = Lists.newArrayListWithCapacity(magicBranch.base.size()); for (ObjectId id : magicBranch.base) { try { magicBranch.baseCommit.add(walk.parseCommit(id)); } catch (IncorrectObjectTypeException notCommit) { reject(cmd, STR); return; } catch (MissingObjectException e) { reject(cmd, STR); return; } catch (IOException e) { logger.atWarning().withCause(e).log( STR, project.getName(), id.name()); reject(cmd, INTERNAL_SERVER_ERROR); return; } } } else if (newChangeForAllNotInTarget) { RevCommit branchTip = readBranchTip(cmd, magicBranch.dest); if (branchTip == null) { return; } magicBranch.baseCommit = Collections.singletonList(branchTip); logger.atFine().log(STR, magicBranch.baseCommit.get(0).name()); } } catch (IOException ex) { logger.atWarning().withCause(ex).log( STR, destBranch, project.getName()); reject(cmd, INTERNAL_SERVER_ERROR); return; } if (magicBranch.deprecatedTopicSeen) { messages.add( new ValidationMessage( STR, false)); logger.atInfo().log(STR, project.getName()); } if (validateConnected(magicBranch.cmd, magicBranch.dest, tip)) { this.magicBranch = magicBranch; } }
/** * Parse the magic branch data (refs/for/BRANCH/OPTIONALTOPIC%OPTIONS) into the magicBranch * member. * * <p>Assumes we are handling a magic branch here. */
Parse the magic branch data (refs/for/BRANCH/OPTIONALTOPIC%OPTIONS) into the magicBranch member. Assumes we are handling a magic branch here
parseMagicBranch
{ "repo_name": "WANdisco/gerrit", "path": "java/com/google/gerrit/server/git/receive/ReceiveCommits.java", "license": "apache-2.0", "size": 127680 }
[ "com.google.common.collect.Lists", "com.google.gerrit.extensions.restapi.AuthException", "com.google.gerrit.reviewdb.client.BooleanProjectConfig", "com.google.gerrit.reviewdb.client.Branch", "com.google.gerrit.reviewdb.client.RefNames", "com.google.gerrit.server.ChangeUtil", "com.google.gerrit.server.git.validators.ValidationMessage", "com.google.gerrit.server.permissions.PermissionBackendException", "com.google.gerrit.server.permissions.RefPermission", "java.io.IOException", "java.io.StringWriter", "java.util.Collections", "java.util.Optional", "org.eclipse.jgit.errors.IncorrectObjectTypeException", "org.eclipse.jgit.errors.MissingObjectException", "org.eclipse.jgit.lib.Constants", "org.eclipse.jgit.lib.ObjectId", "org.eclipse.jgit.revwalk.RevCommit", "org.eclipse.jgit.revwalk.RevWalk", "org.eclipse.jgit.transport.ReceiveCommand", "org.kohsuke.args4j.CmdLineException" ]
import com.google.common.collect.Lists; import com.google.gerrit.extensions.restapi.AuthException; import com.google.gerrit.reviewdb.client.BooleanProjectConfig; import com.google.gerrit.reviewdb.client.Branch; import com.google.gerrit.reviewdb.client.RefNames; import com.google.gerrit.server.ChangeUtil; import com.google.gerrit.server.git.validators.ValidationMessage; import com.google.gerrit.server.permissions.PermissionBackendException; import com.google.gerrit.server.permissions.RefPermission; import java.io.IOException; import java.io.StringWriter; import java.util.Collections; import java.util.Optional; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.transport.ReceiveCommand; import org.kohsuke.args4j.CmdLineException;
import com.google.common.collect.*; import com.google.gerrit.extensions.restapi.*; import com.google.gerrit.reviewdb.client.*; import com.google.gerrit.server.*; import com.google.gerrit.server.git.validators.*; import com.google.gerrit.server.permissions.*; import java.io.*; import java.util.*; import org.eclipse.jgit.errors.*; import org.eclipse.jgit.lib.*; import org.eclipse.jgit.revwalk.*; import org.eclipse.jgit.transport.*; import org.kohsuke.args4j.*;
[ "com.google.common", "com.google.gerrit", "java.io", "java.util", "org.eclipse.jgit", "org.kohsuke.args4j" ]
com.google.common; com.google.gerrit; java.io; java.util; org.eclipse.jgit; org.kohsuke.args4j;
1,840,429
public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) { }
void function(World worldIn, BlockPos pos, IBlockState state, Random random) { }
/** * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) */
Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.)
randomTick
{ "repo_name": "TorchPowered/Thallium", "path": "src/main/java/net/minecraft/block/BlockRedstoneTorch.java", "license": "mit", "size": 6379 }
[ "java.util.Random", "net.minecraft.block.state.IBlockState", "net.minecraft.util.BlockPos", "net.minecraft.world.World" ]
import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.world.World;
import java.util.*; import net.minecraft.block.state.*; import net.minecraft.util.*; import net.minecraft.world.*;
[ "java.util", "net.minecraft.block", "net.minecraft.util", "net.minecraft.world" ]
java.util; net.minecraft.block; net.minecraft.util; net.minecraft.world;
635,433