code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static float[] insertAt(float[] dest,float[] src,int offset){
float[] temp=new float[dest.length + src.length - 1];
System.arraycopy(dest,0,temp,0,offset);
System.arraycopy(src,0,temp,offset,src.length);
System.arraycopy(dest,offset + 1,temp,src.length + offset,dest.length - offset - 1);
return temp;
}
| Inserts one array into another by replacing specified offset. |
public void removeFailListener(){
this.failedListener=null;
}
| Unregister fail listener, initialised by Builder#failListener |
private static boolean fieldsForOtherResourceSpecified(TypedParams<IncludedFieldsParams> includedFields,IncludedFieldsParams typeIncludedFields){
return includedFields != null && !includedFields.getParams().isEmpty() && noResourceIncludedFieldsSpecified(typeIncludedFields);
}
| Checks if fields for other resource has been specified but not for the processed one |
IBinding resolveReference(MemberRef ref){
return null;
}
| Resolves the given reference and returns the binding for it. <p> The implementation of <code>MemberRef.resolveBinding</code> forwards to this method. How the name resolves is often a function of the context in which the name node is embedded as well as the name itself. </p> <p> The default implementation of this method returns <code>null</code>. Subclasses may reimplement. </p> |
@Scheduled(fixedRate=FIXED_RATE) public void logStatistics(){
if (beansAvailable) {
if (log.isInfoEnabled()) {
logOperatingSystemStatistics();
logRuntimeStatistics();
logMemoryStatistics();
logThreadStatistics();
log.info("\n");
}
}
if (log.isInfoEnabled()) {
logDroppedData();
logBufferStatistics();
logStorageStatistics();
}
}
| Log all the statistics. |
@HLEFunction(nid=0x93440B11,version=150) public int sceWlanDevIsPowerOn(){
return Wlan.getSwitchState();
}
| Determine if the wlan device is currently powered on |
public FrameBlock readTransformMetaDataFromFile(String spec,String metapath) throws IOException {
return readTransformMetaDataFromFile(spec,metapath,TfUtils.TXMTD_SEP);
}
| Reads transform meta data from an HDFS file path and converts it into an in-memory FrameBlock object. The column names in the meta data file 'column.names' is processed with default separator ','. |
public final String toString(String codeset){
StringBuffer retVal=new StringBuffer();
for (int i=0; i < prolog.size(); i++) {
ConcreteElement e=(ConcreteElement)prolog.elementAt(i);
retVal.append(e.toString(getCodeset()) + "\n");
}
if (content != null) retVal.append(content.toString(getCodeset()) + "\n");
return versionDecl + retVal.toString();
}
| Override toString so it prints something useful |
public boolean isCompound(){
return splits.size() != 1;
}
| Checks if this instance is a compounding word. |
public boolean hasAnnotation(Annotation annotation){
return annotationAccessor.typeHas(annotation);
}
| Determines whether T has a particular annotation. |
public static Builder create(){
return new Builder(false);
}
| Constructs an asynchronous query task. |
public MP4Reader(FileInputStream fis) throws IOException {
if (null == fis) {
log.warn("Reader was passed a null file");
log.debug("{}",ToStringBuilder.reflectionToString(this));
}
this.fis=new MP4DataStream(fis);
channel=fis.getChannel();
decodeHeader();
analyzeFrames();
firstTags.add(createFileMeta());
createPreStreamingTags(0,false);
}
| Creates MP4 reader from file input stream, sets up metadata generation flag. |
public static strictfp double plusPIO2_strict(final double angRad){
if (angRad > -Math.PI / 4) {
return angRad + PIO2_LO + PIO2_HI;
}
else {
return angRad + PIO2_HI + PIO2_LO;
}
}
| Strict version. |
private synchronized boolean isSelectedTrackRecording(){
return trackDataHub != null && trackDataHub.isSelectedTrackRecording();
}
| Returns true if the selected track is recording. Needs to be synchronized because trackDataHub can be accessed by multiple threads. |
public Drawable loadIcon(ApplicationSuggestion suggestion){
try {
InputStream is=mContext.getContentResolver().openInputStream(suggestion.getThumbailUri());
return Drawable.createFromStream(is,null);
}
catch ( FileNotFoundException e) {
return null;
}
}
| Loads the icon for the given suggestion. |
public boolean isHead(){
if (parent == null) return true;
else return false;
}
| Returns true if this node is the head of its DominatorTree. |
public static String ofMethod(CtClass returnType,CtClass[] paramTypes){
StringBuffer desc=new StringBuffer();
desc.append('(');
if (paramTypes != null) {
int n=paramTypes.length;
for (int i=0; i < n; ++i) toDescriptor(desc,paramTypes[i]);
}
desc.append(')');
if (returnType != null) toDescriptor(desc,returnType);
return desc.toString();
}
| Returns the descriptor representing a method that receives the given parameter types and returns the given type. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case UmplePackage.GEN_EXPR___NAME_1:
return getName_1();
case UmplePackage.GEN_EXPR___ANONYMOUS_GEN_EXPR_11:
return getAnonymous_genExpr_1_1();
case UmplePackage.GEN_EXPR___EQUALITY_OP_1:
return getEqualityOp_1();
case UmplePackage.GEN_EXPR___NAME_2:
return getName_2();
case UmplePackage.GEN_EXPR___ANONYMOUS_GEN_EXPR_21:
return getAnonymous_genExpr_2_1();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public Main(){
}
| Creates a new instance of Main |
public static void serializeFile(String path,Object o){
try {
JAXBContext context=JAXBContext.newInstance(o.getClass());
Marshaller m=context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
FileOutputStream stream=new FileOutputStream(path);
m.marshal(o,stream);
}
catch ( JAXBException e) {
e.printStackTrace();
}
catch ( FileNotFoundException e) {
e.printStackTrace();
}
}
| Serializes an object and saves it to a file, located at given path. |
public static MinProjectionExpression min(Expression expression){
return new MinProjectionExpression(expression,false);
}
| Minimum aggregation function. |
@Override public void onUIReset(PtrFrameLayout frame){
mScale=1f;
mDrawable.stop();
}
| When the content view has reached top and refresh has been completed, view will be reset. |
public boolean forgetInstruction(BytecodeInstruction ins){
if (!instructionMap.containsKey(ins.getClassName())) return false;
if (!instructionMap.get(ins.getClassName()).containsKey(ins.getMethodName())) return false;
return instructionMap.get(ins.getClassName()).get(ins.getMethodName()).remove(ins);
}
| <p> forgetInstruction </p> |
public static Observable<WatchEvent<?>> watchRecursive(final Path path) throws IOException {
final boolean recursive=true;
return new ObservableFactory(path,recursive).create();
}
| Creates an observable that watches the given directory and all its subdirectories. Directories that are created after subscription are watched, too. |
public Matrix3 invertMatrix(Matrix3 matrix){
if (matrix == null) {
throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Matrix3","invertMatrix","missingMatrix"));
}
throw new UnsupportedOperationException("Matrix3.invertMatrix is not implemented");
}
| Inverts the specified matrix and stores the result in this matrix. <p/> This throws an exception if the matrix is singular. <p/> The result of this method is undefined if this matrix is passed in as the matrix to invert. |
public static void sync(Context context){
ContentResolver cr=cr();
String[] proj={_ID,Syncs.TYPE_ID,Syncs.OBJECT_ID,millis(Syncs.ACTION_ON)};
String sel=Syncs.STATUS_ID + " = ?";
String[] args={String.valueOf(ACTIVE.id)};
String order=Syncs.ACTION_ON + " DESC";
EasyCursor c=new EasyCursor(cr.query(Syncs.CONTENT_URI,proj,sel,args,order));
int count=c.getCount();
if (count > 0) {
int users=0;
int reviews=0;
Review review=null;
Set<CharSequence> lines=new LinkedHashSet<>();
long when=0L;
Bitmap icon=null;
Set<String> syncIds=new HashSet<>(count);
while (c.moveToNext()) {
Uri photo=null;
switch (Sync.Type.get(c.getInt(Syncs.TYPE_ID))) {
case USER:
photo=user(context,cr,c.getLong(Syncs.OBJECT_ID),lines,icon);
if (photo != null) {
users++;
syncIds.add(String.valueOf(c.getLong(_ID)));
}
break;
case REVIEW:
Pair<Uri,Review> pair=review(context,cr,c.getLong(Syncs.OBJECT_ID),lines,icon);
photo=pair.first;
if (pair.second != null) {
reviews++;
syncIds.add(String.valueOf(c.getLong(_ID)));
if (review == null) {
review=pair.second;
}
}
break;
}
if (when == 0) {
when=c.getLong(Syncs.ACTION_ON);
}
if (photo != null && photo != EMPTY) {
icon=photo(context,photo);
}
}
int size=lines.size();
if (size > 0) {
CharSequence bigText=null;
CharSequence summary=null;
Intent activity;
if (users > 0 && reviews == 0) {
activity=new Intent(context,FriendsActivity.class);
}
else if (users == 0 && (reviews == 1 || size == 1)) {
bigText=ReviewAdapter.comments(review.comments);
summary=context.getString(R.string.n_stars,review.rating);
activity=new Intent(context,RestaurantActivity.class).putExtra(EXTRA_ID,review.restaurantId);
if (review.type == GOOGLE) {
activity.putExtra(EXTRA_TAB,TAB_PUBLIC);
}
}
else {
activity=new Intent(context,NotificationsActivity.class);
}
notify(context,lines,bigText,summary,when,icon,users + reviews,activity);
Prefs.putStringSet(context,APP,NEW_SYNC_IDS,syncIds);
event("notification","notify","sync",size);
}
else {
Managers.notification(context).cancel(TAG_SYNC,0);
context.startService(new Intent(context,SyncsReadService.class));
}
}
c.close();
}
| Post a notification for any unread server changes. |
public static LogisticRegressionRunner serializableInstance(){
List<Node> variables=new LinkedList<>();
ContinuousVariable var1=new ContinuousVariable("X");
ContinuousVariable var2=new ContinuousVariable("Y");
variables.add(var1);
variables.add(var2);
DataSet dataSet=new ColtDataSet(3,variables);
double[] col1data=new double[]{0.0,1.0,2.0};
double[] col2data=new double[]{2.3,4.3,2.5};
for (int i=0; i < 3; i++) {
dataSet.setDouble(i,0,col1data[i]);
dataSet.setDouble(i,1,col2data[i]);
}
DataWrapper dataWrapper=new DataWrapper(dataSet);
return new LogisticRegressionRunner(dataWrapper,new Parameters());
}
| Generates a simple exemplar of this class to test serialization. |
public ESHistory(String documentId,Collection<HistoryEvent> events){
this.documentId=documentId;
this.events=events;
}
| New instance with the specified content. |
public boolean executeDelayedExpensiveWrite(Runnable task){
Future<?> f=executeDiskStoreTask(task,this.delayedWritePool);
lastDelayedWrite=f;
return f != null;
}
| Execute a task asynchronously, or in the calling thread if the bound is reached. This pool is used for write operations which can be delayed, but we have a limit on how many write operations we delay so that we don't run out of disk space. Used for deletes, unpreblow, RAF close, etc. |
private void resetMnemonics(){
if (mnemonicToIndexMap != null) {
mnemonicToIndexMap.clear();
mnemonicInputMap.clear();
}
}
| Resets the mnemonics bindings to an empty state. |
public void textureMode(int mode){
g.textureMode(mode);
}
| Set texture mode to either to use coordinates based on the IMAGE (more intuitive for new users) or NORMALIZED (better for advanced chaps) |
@Override public GetETLDriverInfo execute(String[] params){
try {
CommandLine commandLine=getCommandLine(params,PARAMS_STRUCTURE);
String minBId=commandLine.getOptionValue("min-batch-id");
LOGGER.debug("minimum-batch-id is " + minBId);
String maxBId=commandLine.getOptionValue("max-batch-id");
LOGGER.debug("maximum-batch-id is " + maxBId);
List<GetETLDriverInfo> getETLDriverInfoList=getETLInfoDAO.getETLInfo(Long.parseLong(minBId),Long.parseLong(maxBId));
LOGGER.info("list of File is " + getETLDriverInfoList.get(0).getFileList());
return getETLDriverInfoList.get(0);
}
catch ( Exception e) {
LOGGER.error("Error occurred",e);
throw new MetadataException(e);
}
}
| This method runs GetETLInfo proc and retrieves information regarding files available for batches mentioned. |
public FunctionblockFactoryImpl(){
super();
}
| Creates an instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc --> |
public void writePopulation(String outputfolder){
outputfolder=outputfolder + (outputfolder.endsWith("/") ? "" : "/");
if (sc.getPopulation().getPersons().size() == 0 || sc.getPopulation().getPersonAttributes() == null) {
throw new RuntimeException("Either no persons or person attributes to write.");
}
else {
LOG.info("Writing population to file... (" + sc.getPopulation().getPersons().size() + ")");
PopulationWriter pw=new PopulationWriter(sc.getPopulation(),sc.getNetwork());
pw.writeV5(outputfolder + "Population.xml");
LOG.info("Writing person attributes to file...");
ObjectAttributesXmlWriter oaw=new ObjectAttributesXmlWriter(sc.getPopulation().getPersonAttributes());
oaw.putAttributeConverter(IncomeImpl.class,new SAIncomeConverter());
oaw.setPrettyPrint(true);
oaw.writeFile(outputfolder + "PersonAttributes.xml");
}
}
| Writes the population and their attributes to file. |
public void restart(final String serviceName) throws LocalRepositoryException {
final String prefix="restart(): serviceName=" + serviceName + " ";
_log.debug(prefix);
final String[] cmd={_SYSTOOL_CMD,_SYSTOOL_RESTART,serviceName};
final Exec.Result result=Exec.sudo(_SYSTOOL_TIMEOUT,cmd);
checkFailure(result,prefix);
}
| Restart a service |
public void receiveResultqueryStorageProcessors(com.emc.storageos.vasa.VasaServiceStub.QueryStorageProcessorsResponse result){
}
| auto generated Axis2 call back method for queryStorageProcessors method override this method for handling normal response from queryStorageProcessors operation |
public final void testNextBytesbyteArray02(){
byte[] myBytes;
byte[] myBytes1;
byte[] myBytes2;
for (int i=1; i < LENGTH; i+=INCR) {
myBytes=new byte[i];
for (int j=1; j < i; j++) {
myBytes[j]=(byte)(j & 0xFF);
}
sr.setSeed(myBytes);
sr2.setSeed(myBytes);
for (int k=1; k < LENGTH; k+=INCR) {
myBytes1=new byte[k];
myBytes2=new byte[k];
sr.nextBytes(myBytes1);
sr2.nextBytes(myBytes2);
for (int l=0; l < k; l++) {
assertFalse("unexpected: myBytes1[l] != myBytes2[l] :: l==" + l + " k="+ k+ " i="+ i+ " myBytes1[l]="+ myBytes1[l]+ " myBytes2[l]="+ myBytes2[l],myBytes1[l] != myBytes2[l]);
}
}
}
for (int n=1; n < LENGTH; n+=INCR) {
int n1=10;
int n2=20;
int n3=100;
byte[][] bytes1=new byte[10][n1];
byte[][] bytes2=new byte[5][n2];
for (int k=0; k < bytes1.length; k++) {
sr.nextBytes(bytes1[k]);
}
for (int k=0; k < bytes2.length; k++) {
sr2.nextBytes(bytes2[k]);
}
for (int k=0; k < n3; k++) {
int i1=k / n1;
int i2=k % n1;
int i3=k / n2;
int i4=k % n2;
assertTrue("non-equality: i1=" + i1 + " i2="+ i2+ " i3="+ i3+ " i4="+ i4,bytes1[i1][i2] == bytes2[i3][i4]);
}
}
}
| test against the "void nextBytes(byte[])" method; it checks out that different SecureRandom objects being supplied with the same seed return the same sequencies of bytes as results of their "nextBytes(byte[])" methods |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:29:27.931 -0500",hash_original_method="92BE44E9F6280B7AE0D2A8904499350A",hash_generated_method="5A68C897F2049F6754C8DA6E4CBD57CE") public ViewPropertyAnimator translationXBy(float value){
animatePropertyBy(TRANSLATION_X,value);
return this;
}
| This method will cause the View's <code>translationX</code> property to be animated by the specified value. Animations already running on the property will be canceled. |
private void loadServerDetailsActivity(){
Preference.putString(context,Constants.PreferenceFlag.IP,null);
Intent intent=new Intent(AlreadyRegisteredActivity.this,ServerDetails.class);
intent.putExtra(getResources().getString(R.string.intent_extra_regid),regId);
intent.putExtra(getResources().getString(R.string.intent_extra_from_activity),AlreadyRegisteredActivity.class.getSimpleName());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
| Load server details activity. |
public static NamedGraph createNamedGraph(Model model,Resource graphNameNode,RDFList elements){
NamedGraph result=model.createResource(SP.NamedGraph).as(NamedGraph.class);
result.addProperty(SP.graphNameNode,graphNameNode);
result.addProperty(SP.elements,elements);
return result;
}
| Creates a new NamedGraph element as a blank node in a given Model. |
public SQLWarning(String reason,String SQLState,int vendorCode,Throwable cause){
super(reason,SQLState,vendorCode,cause);
}
| Creates an SQLWarning object. The Reason string is set to reason, the SQLState string is set to given SQLState and the Error Code is set to vendorCode, cause is set to the given cause |
@POST @Path("downloads") @ApiOperation(value="Starts downloading artifacts",response=DownloadToken.class) @ApiResponses(value={@ApiResponse(code=202,message="OK"),@ApiResponse(code=400,message="Illegal version format or artifact name"),@ApiResponse(code=409,message="Downloading already in progress"),@ApiResponse(code=500,message="Server error")}) public Response startDownload(@QueryParam(value="artifact") @ApiParam(value="Artifact name",allowableValues=CDECArtifact.NAME) String artifactName,@QueryParam(value="version") @ApiParam(value="Version number") String versionNumber){
try {
DownloadToken downloadToken=new DownloadToken();
downloadToken.setId(DOWNLOAD_TOKEN);
Artifact artifact=createArtifactOrNull(artifactName);
Version version=createVersionOrNull(versionNumber);
facade.startDownload(artifact,version);
return Response.status(Response.Status.ACCEPTED).entity(downloadToken).build();
}
catch ( ArtifactNotFoundException|IllegalVersionException e) {
return handleException(e,Response.Status.BAD_REQUEST);
}
catch ( DownloadAlreadyStartedException e) {
return handleException(e,Response.Status.CONFLICT);
}
catch ( Exception e) {
return handleException(e);
}
}
| Starts downloading artifacts. |
public void release(){
PathLockFactory.this.release(path,permits);
}
| Release file permit. |
protected BuddyPanel(final BuddyListModel model){
super(model);
setCellRenderer(new BuddyLabel());
setOpaque(false);
this.setFocusable(false);
this.addMouseListener(new BuddyPanelMouseListener());
}
| Create a new BuddyList. |
Component createComponent(Component owner){
if (GraphicsEnvironment.isHeadless()) {
return null;
}
return new HeavyWeightWindow(getParentWindow(owner));
}
| Creates the Component to use as the parent of the <code>Popup</code>. The default implementation creates a <code>Window</code>, subclasses should override. |
protected UnknownResolverVariableException(String i18n,Object... arguments){
super(i18n,arguments);
}
| Creates a parsing exception with message associated to the i18n and the arguments. |
public boolean isEndNode(final Node node){
return getDelegator().getCurrentStorage().isEndNode(node);
}
| Test if the given Node is an end node of a Way. Isolated nodes not part of a way are not considered an end node. |
public boolean hasDefClearPathToMethodExit(Definition duVertex){
if (!graph.containsVertex(duVertex)) throw new IllegalArgumentException("vertex not in graph");
if (duVertex.isLocalDU()) return false;
return hasDefClearPathToMethodExit(duVertex,duVertex,new HashSet<BytecodeInstruction>());
}
| <p> hasDefClearPathToMethodExit </p> |
private Collection<FollowElement> resetAndGetFollowElements(ObservableXtextTokenStream tokens,boolean strict){
CustomInternalN4JSParser parser=createParser();
parser.setStrict(strict);
tokens.reset();
return doGetFollowElements(parser,tokens);
}
| Create a fresh parser instance and process the tokens for a second pass. |
private static void printInfo(IgniteFileSystem fs,IgfsPath path) throws IgniteException {
System.out.println();
System.out.println("Information for " + path + ": "+ fs.info(path));
}
| Prints information for file or directory. |
protected List<BindingSet> makeHashValue(int currentMaxListSize){
return new ArrayList<BindingSet>(currentMaxListSize / 2 + 1);
}
| Utility methods to make it easier to inserted custom store dependent list |
public static double cdf(double val,double loc,double scale){
val=(val - loc) / scale;
return 1. / (1. + Math.exp(-val));
}
| Cumulative density function. |
public void taskStateChanged(@TASK_STATE int taskState,Serializable tag){
switch (taskState) {
case TASK_STATE_PREPARE:
{
iView.layoutLoadingVisibility(isContentEmpty());
iView.layoutContentVisibility(!isContentEmpty());
iView.layoutEmptyVisibility(false);
iView.layoutLoadFailedVisibility(false);
}
break;
case TASK_STATE_SUCCESS:
{
iView.layoutLoadingVisibility(false);
if (isContentEmpty()) {
iView.layoutEmptyVisibility(true);
}
else {
iView.layoutContentVisibility(true);
}
}
break;
case TASK_STATE_FAILED:
{
if (isContentEmpty()) {
iView.layoutEmptyVisibility(false);
iView.layoutLoadingVisibility(false);
iView.layoutLoadFailedVisibility(true);
if (tag != null) {
iView.setTextLoadFailed(tag.toString());
}
}
}
break;
case TASK_STATE_FINISH:
break;
}
}
| According to the task execution state to update the page display state. |
public GutterIconInfo addLineTrackingIcon(int line,Icon icon) throws BadLocationException {
int offs=textArea.getLineStartOffset(line);
return addOffsetTrackingIcon(offs,icon);
}
| Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. This is useful for marking things such as source code errors. |
public SpatialSparseVertex createVertex(Point point){
if (point != null) point.setSRID(SRID);
return new SpatialSparseVertex(point);
}
| Creates a new vertex located at <tt>point</tt>. The spatial reference id is the to the one of the factory's coordinate reference system. |
private String indentString(){
StringBuffer sb=new StringBuffer();
for (int i=0; i < indent; ++i) {
sb.append(" ");
}
return sb.toString();
}
| Indent child nodes to help visually identify the structure of the AST. |
public boolean isProcessing(){
return isProcessing;
}
| Returns whether XBL processing is currently enabled. |
public static String computeCodebase(String name,String jarFile,String port,String srcRoot,String mdAlgorithm) throws IOException {
return computeCodebase(name,jarFile,Integer.parseInt(port),srcRoot,mdAlgorithm);
}
| Convenience method that ultimately calls the primary 5-argument version of this method. This method allows one to input a <code>String</code> value for the port to use when constructing the codebase; which can be useful when invoking this method from a Jini configuration file. |
private void purgeRelayLogs(boolean wait){
if (relayLogRetention > 1) {
logger.info("Checking for old relay log files...");
File logDir=new File(binlogDir);
File[] filesToPurge=FileCommands.filesOverRetentionAndInactive(logDir,binlogFilePattern,relayLogRetention,this.binlogPosition.getFileName());
if (this.relayLogQueue != null) {
for ( File fileToPurge : filesToPurge) {
if (logger.isInfoEnabled()) {
logger.debug("Removing relay log file from relay log queue: " + fileToPurge.getAbsolutePath());
}
if (!relayLogQueue.remove(fileToPurge)) {
logger.info("Unable to remove relay log file from relay log queue, probably old: " + fileToPurge);
}
}
}
FileCommands.deleteFiles(filesToPurge,wait);
}
}
| Purge old relay logs that have aged out past the number of retained files. |
public static Inet4Address fromInteger(int address){
return getInet4Address(Ints.toByteArray(address));
}
| Returns an Inet4Address having the integer value specified by the argument. |
public boolean isOverwriteUser1(){
Object oo=get_Value(COLUMNNAME_OverwriteUser1);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Overwrite User1. |
private static boolean valEquals(Object o1,Object o2){
return (o1 == null ? o2 == null : o1.equals(o2));
}
| Test two values for equality. Differs from o1.equals(o2) only in that it copes with with <tt>null</tt> o1 properly. |
public boolean hasAttribute(String name){
return DTM.NULL != dtm.getAttributeNode(node,null,name);
}
| Method hasAttribute |
public void init(){
Environment.init(this);
Debug.init(this,new String[]{"debug.basic","debug.cspec","debug.layer","debug.mapbean","debug.plugin"});
String propValue=getParameter(PropertiesProperty);
PropertyHandler propHandler=null;
try {
if (propValue != null) {
PropertyHandler.Builder builder=new PropertyHandler.Builder().setPropertiesFile(propValue);
propHandler=new PropertyHandler(builder);
if (Debug.debugging("app")) {
Debug.output("OpenMapApplet: Using properties from " + propValue);
}
}
}
catch ( MalformedURLException murle) {
Debug.error("OpenMap: property file specified: " + propValue + " doesn't exist, searching for default openmap.properties file...");
}
catch ( IOException ioe) {
Debug.error("OpenMap: There is a problem using the property file specified: " + propValue + ", searching for default openmap.properties file...");
}
if (propHandler == null) {
propHandler=new PropertyHandler();
}
MapPanel mapPanel=new BasicMapPanel(propHandler);
mapPanel.getMapHandler().add(this);
Debug.message("app","OpenMapApplet.init()");
}
| Called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the <code>start</code> method is called. <p> The implementation of this method provided by the <code>Applet</code> class does nothing. |
@Override public void process(ResponseBuilder rb) throws IOException {
SolrQueryRequest req=rb.req;
SolrQueryResponse rsp=rb.rsp;
SolrParams params=req.getParams();
if (!params.getBool(COMPONENT_NAME,true)) {
return;
}
SolrIndexSearcher searcher=req.getSearcher();
if (rb.getQueryCommand().getOffset() < 0) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"'start' parameter cannot be negative");
}
long timeAllowed=(long)params.getInt(CommonParams.TIME_ALLOWED,-1);
if (null != rb.getCursorMark() && 0 < timeAllowed) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Can not search using both " + CursorMarkParams.CURSOR_MARK_PARAM + " and "+ CommonParams.TIME_ALLOWED);
}
String ids=params.get(ShardParams.IDS);
if (ids != null) {
SchemaField idField=searcher.getSchema().getUniqueKeyField();
List<String> idArr=StrUtils.splitSmart(ids,",",true);
int[] luceneIds=new int[idArr.size()];
int docs=0;
for (int i=0; i < idArr.size(); i++) {
int id=req.getSearcher().getFirstMatch(new Term(idField.getName(),idField.getType().toInternal(idArr.get(i))));
if (id >= 0) luceneIds[docs++]=id;
}
DocListAndSet res=new DocListAndSet();
res.docList=new DocSlice(0,docs,luceneIds,null,docs,0);
if (rb.isNeedDocSet()) {
List<Query> queries=new ArrayList<>();
queries.add(rb.getQuery());
List<Query> filters=rb.getFilters();
if (filters != null) queries.addAll(filters);
res.docSet=searcher.getDocSet(queries);
}
rb.setResults(res);
ResultContext ctx=new ResultContext();
ctx.docs=rb.getResults().docList;
ctx.query=null;
rsp.add("response",ctx);
return;
}
SolrIndexSearcher.QueryCommand cmd=rb.getQueryCommand();
cmd.setTimeAllowed(timeAllowed);
SolrIndexSearcher.QueryResult result=new SolrIndexSearcher.QueryResult();
GroupingSpecification groupingSpec=rb.getGroupingSpec();
if (groupingSpec != null) {
try {
boolean needScores=(cmd.getFlags() & SolrIndexSearcher.GET_SCORES) != 0;
if (params.getBool(GroupParams.GROUP_DISTRIBUTED_FIRST,false)) {
CommandHandler.Builder topsGroupsActionBuilder=new CommandHandler.Builder().setQueryCommand(cmd).setNeedDocSet(false).setIncludeHitCount(true).setSearcher(searcher);
for ( String field : groupingSpec.getFields()) {
topsGroupsActionBuilder.addCommandField(new SearchGroupsFieldCommand.Builder().setField(searcher.getSchema().getField(field)).setGroupSort(groupingSpec.getGroupSort()).setTopNGroups(cmd.getOffset() + cmd.getLen()).setIncludeGroupCount(groupingSpec.isIncludeGroupCount()).build());
}
CommandHandler commandHandler=topsGroupsActionBuilder.build();
commandHandler.execute();
SearchGroupsResultTransformer serializer=new SearchGroupsResultTransformer(searcher);
rsp.add("firstPhase",commandHandler.processResult(result,serializer));
rsp.add("totalHitCount",commandHandler.getTotalHitCount());
rb.setResult(result);
return;
}
else if (params.getBool(GroupParams.GROUP_DISTRIBUTED_SECOND,false)) {
CommandHandler.Builder secondPhaseBuilder=new CommandHandler.Builder().setQueryCommand(cmd).setTruncateGroups(groupingSpec.isTruncateGroups() && groupingSpec.getFields().length > 0).setSearcher(searcher);
for ( String field : groupingSpec.getFields()) {
String[] topGroupsParam=params.getParams(GroupParams.GROUP_DISTRIBUTED_TOPGROUPS_PREFIX + field);
if (topGroupsParam == null) {
topGroupsParam=new String[0];
}
List<SearchGroup<BytesRef>> topGroups=new ArrayList<>(topGroupsParam.length);
for ( String topGroup : topGroupsParam) {
SearchGroup<BytesRef> searchGroup=new SearchGroup<>();
if (!topGroup.equals(TopGroupsShardRequestFactory.GROUP_NULL_VALUE)) {
searchGroup.groupValue=new BytesRef(searcher.getSchema().getField(field).getType().readableToIndexed(topGroup));
}
topGroups.add(searchGroup);
}
secondPhaseBuilder.addCommandField(new TopGroupsFieldCommand.Builder().setField(searcher.getSchema().getField(field)).setGroupSort(groupingSpec.getGroupSort()).setSortWithinGroup(groupingSpec.getSortWithinGroup()).setFirstPhaseGroups(topGroups).setMaxDocPerGroup(groupingSpec.getGroupOffset() + groupingSpec.getGroupLimit()).setNeedScores(needScores).setNeedMaxScore(needScores).build());
}
for ( String query : groupingSpec.getQueries()) {
secondPhaseBuilder.addCommandField(new QueryCommand.Builder().setDocsToCollect(groupingSpec.getOffset() + groupingSpec.getLimit()).setSort(groupingSpec.getGroupSort()).setQuery(query,rb.req).setDocSet(searcher).build());
}
CommandHandler commandHandler=secondPhaseBuilder.build();
commandHandler.execute();
TopGroupsResultTransformer serializer=new TopGroupsResultTransformer(rb);
rsp.add("secondPhase",commandHandler.processResult(result,serializer));
rb.setResult(result);
return;
}
int maxDocsPercentageToCache=params.getInt(GroupParams.GROUP_CACHE_PERCENTAGE,0);
boolean cacheSecondPassSearch=maxDocsPercentageToCache >= 1 && maxDocsPercentageToCache <= 100;
Grouping.TotalCount defaultTotalCount=groupingSpec.isIncludeGroupCount() ? Grouping.TotalCount.grouped : Grouping.TotalCount.ungrouped;
int limitDefault=cmd.getLen();
Grouping grouping=new Grouping(searcher,result,cmd,cacheSecondPassSearch,maxDocsPercentageToCache,groupingSpec.isMain());
grouping.setSort(groupingSpec.getGroupSort()).setGroupSort(groupingSpec.getSortWithinGroup()).setDefaultFormat(groupingSpec.getResponseFormat()).setLimitDefault(limitDefault).setDefaultTotalCount(defaultTotalCount).setDocsPerGroupDefault(groupingSpec.getGroupLimit()).setGroupOffsetDefault(groupingSpec.getGroupOffset()).setGetGroupedDocSet(groupingSpec.isTruncateGroups());
if (groupingSpec.getFields() != null) {
for ( String field : groupingSpec.getFields()) {
grouping.addFieldCommand(field,rb.req);
}
}
if (groupingSpec.getFunctions() != null) {
for ( String groupByStr : groupingSpec.getFunctions()) {
grouping.addFunctionCommand(groupByStr,rb.req);
}
}
if (groupingSpec.getQueries() != null) {
for ( String groupByStr : groupingSpec.getQueries()) {
grouping.addQueryCommand(groupByStr,rb.req);
}
}
if (rb.doHighlights || rb.isDebug() || params.getBool(MoreLikeThisParams.MLT,false)) {
cmd.setFlags(SolrIndexSearcher.GET_DOCLIST);
}
grouping.execute();
if (grouping.isSignalCacheWarning()) {
rsp.add("cacheWarning",String.format(Locale.ROOT,"Cache limit of %d percent relative to maxdoc has exceeded. Please increase cache size or disable caching.",maxDocsPercentageToCache));
}
rb.setResult(result);
if (grouping.mainResult != null) {
ResultContext ctx=new ResultContext();
ctx.docs=grouping.mainResult;
ctx.query=null;
rsp.add("response",ctx);
rsp.getToLog().add("hits",grouping.mainResult.matches());
}
else if (!grouping.getCommands().isEmpty()) {
rsp.add("grouped",result.groupedResults);
rsp.getToLog().add("hits",grouping.getCommands().get(0).getMatches());
}
return;
}
catch ( SyntaxError e) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,e);
}
}
searcher.search(result,cmd);
rb.setResult(result);
ResultContext ctx=new ResultContext();
ctx.docs=rb.getResults().docList;
ctx.query=rb.getQuery();
rsp.add("response",ctx);
rsp.getToLog().add("hits",rb.getResults().docList.matches());
if (!rb.req.getParams().getBool(ShardParams.IS_SHARD,false)) {
if (null != rb.getNextCursorMark()) {
rb.rsp.add(CursorMarkParams.CURSOR_MARK_NEXT,rb.getNextCursorMark().getSerializedTotem());
}
}
if (rb.mergeFieldHandler != null) {
rb.mergeFieldHandler.handleMergeFields(rb,searcher);
}
else {
doFieldSortValues(rb,searcher);
}
doPrefetch(rb);
}
| Actually run the query |
public void addUser(IUser user){
if (!this.users.contains(user) && user != null) this.users.add(user);
}
| CACHES a user to the guild. |
public Element create(String prefix,Document doc){
return new SVGOMForeignObjectElement(prefix,(AbstractDocument)doc);
}
| Creates an instance of the associated element type. |
public T casePostfixExpression(PostfixExpression object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Postfix Expression</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
@Deprecated public int readPrimitiveArray(Object o) throws IOException {
return (int)readLArray(o);
}
| This routine provides efficient reading of arrays of any primitive type. It is an error to invoke this method with an object that is not an array of some primitive type. Note that there is no corresponding capability to writePrimitiveArray in BufferedDataOutputStream to read in an array of Strings. |
@Override public boolean hasValuesDescription(){
return restrictionClass != null && restrictionClass != Object.class;
}
| This class sometimes provides a list of value descriptions. |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
private void handleError(@NotNull Throwable e,GitOutputConsole console){
String errorMessage=(e.getMessage() != null && !e.getMessage().isEmpty()) ? e.getMessage() : constant.initFailed();
console.printError(errorMessage);
notificationManager.notify(constant.initFailed(),FAIL,FLOAT_MODE);
}
| Handler some action whether some exception happened. |
private void validateComplete(ParameterFile pf){
Assert.assertEquals(3,pf.size());
Assert.assertEquals("entry1",pf.get(0).getName());
Assert.assertEquals(0.0,pf.get(0).getLowerBound(),Settings.EPS);
Assert.assertEquals(1.0,pf.get(0).getUpperBound(),Settings.EPS);
Assert.assertEquals("entry2",pf.get(1).getName());
Assert.assertEquals(100,pf.get(1).getLowerBound(),Settings.EPS);
Assert.assertEquals(10000,pf.get(1).getUpperBound(),Settings.EPS);
Assert.assertEquals("entry3",pf.get(2).getName());
Assert.assertEquals(0.0,pf.get(2).getLowerBound(),Settings.EPS);
Assert.assertEquals(1.0,pf.get(2).getUpperBound(),Settings.EPS);
}
| Performs the necessary assertions to validate a successful load of the COMPLETE input. |
public IMqttDeliveryToken publish(String topic,MqttMessage message,String invocationContext,String activityToken){
final Bundle resultBundle=new Bundle();
resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION,MqttServiceConstants.SEND_ACTION);
resultBundle.putString(MqttServiceConstants.CALLBACK_ACTIVITY_TOKEN,activityToken);
resultBundle.putString(MqttServiceConstants.CALLBACK_INVOCATION_CONTEXT,invocationContext);
IMqttDeliveryToken sendToken=null;
if ((myClient != null) && (myClient.isConnected())) {
IMqttActionListener listener=new MqttConnectionListener(resultBundle);
try {
sendToken=myClient.publish(topic,message,invocationContext,listener);
storeSendDetails(topic,message,sendToken,invocationContext,activityToken);
}
catch ( Exception e) {
handleException(resultBundle,e);
}
}
else if ((myClient != null) && (this.bufferOpts != null) && (this.bufferOpts.isBufferEnabled())) {
IMqttActionListener listener=new MqttConnectionListener(resultBundle);
try {
sendToken=myClient.publish(topic,message,invocationContext,listener);
storeSendDetails(topic,message,sendToken,invocationContext,activityToken);
}
catch ( Exception e) {
handleException(resultBundle,e);
}
}
else {
Log.i(TAG,"Client is not connected, so not sending message");
resultBundle.putString(MqttServiceConstants.CALLBACK_ERROR_MESSAGE,NOT_CONNECTED);
service.traceError(MqttServiceConstants.SEND_ACTION,NOT_CONNECTED);
service.callbackToActivity(clientHandle,Status.ERROR,resultBundle);
}
return sendToken;
}
| Publish a message on a topic |
public void parseAtom(ExtensionProfile extProfile,Reader reader) throws IOException, ParseException {
SourceHandler handler=new SourceHandler(extProfile);
new XmlParser().parse(reader,handler,Namespaces.atom,"source");
}
| Parses XML in the Atom format. |
public void processServerResponse(int response,ResponseData rawData){
if (response != Policy.RETRY) {
setRetryCount(0);
}
else {
setRetryCount(mRetryCount + 1);
}
if (response == Policy.LICENSED) {
Map<String,String> extras=decodeExtras(rawData.extra);
mLastResponse=response;
setValidityTimestamp(extras.get("VT"));
setRetryUntil(extras.get("GT"));
setMaxRetries(extras.get("GR"));
}
else if (response == Policy.NOT_LICENSED) {
setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP);
setRetryUntil(DEFAULT_RETRY_UNTIL);
setMaxRetries(DEFAULT_MAX_RETRIES);
}
setLastResponse(response);
mPreferences.commit();
}
| Process a new response from the license server. <p> This data will be used for computing future policy decisions. The following parameters are processed: <ul> <li>VT: the timestamp that the client should consider the response valid until <li>GT: the timestamp that the client should ignore retry errors until <li>GR: the number of retry errors that the client should ignore </ul> |
public static String locationJSON(String provider,Location location,boolean cached){
final JSONObject json=new JSONObject();
if (location != null) {
try {
json.put("provider",provider);
json.put("latitude",location.getLatitude());
json.put("longitude",location.getLongitude());
json.put("altitude",location.getAltitude());
json.put("accuracy",location.getAccuracy());
json.put("bearing",location.getBearing());
json.put("speed",location.getSpeed());
json.put("timestamp",location.getTime());
json.put("cached",cached);
}
catch ( JSONException exc) {
logJSONException(exc);
}
}
return json.toString();
}
| Converts location data into a JSON form that can be consumed within a JavaScript application |
public synchronized void dispose() throws IllegalStateException {
CompilerAsserts.neverPartOfCompilation();
if (!disposed) {
instrumenter.disposeBinding(this);
disposed=true;
}
}
| Cancels the subscription permanently. |
public NamespaceId(final String name){
this(parse(name));
}
| Creates a namespace id. |
public DefaultIoFilterChain(AbstractIoSession session){
if (session == null) {
throw new IllegalArgumentException("session");
}
this.session=session;
head=new EntryImpl(null,null,"head",new HeadFilter());
tail=new EntryImpl(head,null,"tail",new TailFilter());
head.nextEntry=tail;
}
| Create a new default chain, associated with a session. It will only contain a HeadFilter and a TailFilter. |
protected String processPostRequest(HttpServletRequest request){
if (request == null) {
return Helper.ERROR_UNKNOWN_JSON;
}
try {
JsonObject jsonObject=Helper.getJsonObjectFromRequestBody(request);
Integer id=JsonUtils.getIntegerFieldFromJsonObject(jsonObject,"id");
String name=JsonUtils.getStringFieldFromJsonObject(jsonObject,"name");
if (id != null) {
NotificationGroupsDao notificationGroupsDao=new NotificationGroupsDao();
NotificationGroup notificationGroup=notificationGroupsDao.getNotificationGroup(id);
name=notificationGroup.getName();
}
NotificationGroupsDao notificationGroupsDao=new NotificationGroupsDao();
NotificationGroup notificationGroup=notificationGroupsDao.getNotificationGroupByName(name);
if (notificationGroup == null) return Helper.ERROR_NOTFOUND_JSON;
com.pearson.statsagg.webui.NotificationGroups notificationGroups=new com.pearson.statsagg.webui.NotificationGroups();
String result=notificationGroups.removeNotificationGroup(name);
return Helper.createSimpleJsonResponse(result);
}
catch ( Exception e) {
logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
return Helper.ERROR_UNKNOWN_JSON;
}
}
| Returns a string with a success message if the notification group is deleted successfully, or an error message if the request fails to delete the notification group. |
public void removeCycles() throws WikiApiException {
DefaultEdge edge=null;
while ((edge=findCycle()) != null) {
Category sourceCat=wiki.getCategory(categoryGraph.getGraph().getEdgeSource(edge));
Category targetCat=wiki.getCategory(categoryGraph.getGraph().getEdgeTarget(edge));
logger.info("Removing cycle: " + sourceCat.getTitle() + " - "+ targetCat.getTitle());
categoryGraph.getGraph().removeEdge(edge);
}
}
| Removes cycles from the graph that was used to construct the cycle handler. |
public void takeHints(Collection<Hint> c,int maxElements) throws InterruptedException {
int count=0;
try {
while (count == 0) {
hintLock.lock();
while (hintQueue.isEmpty()) {
hintsAvailable.await();
}
while (count < maxElements && !hintQueue.isEmpty()) {
HintKey hintKey=hintQueue.pollFirst();
if (hintKey != null) {
List<Versioned<byte[]>> values=hints.remove(hintKey);
if (values == null) {
continue;
}
c.add(new Hint(hintKey,values));
count+=1;
}
}
}
}
finally {
hintLock.unlock();
}
}
| Drain up to the given number of hints to the provided collection. This method will block until at least one hint is available |
public Component(boolean enableCache){
this(null,enableCache);
}
| Construct a component without a name. |
private void ensureCapacity(final int capacity){
a=CharArrays.ensureCapacity(a,capacity,size);
}
| Ensures that this array list can contain the given number of entries without resizing. |
void addBridges(DiagnosticPosition pos,ClassSymbol origin,ListBuffer<JCTree> bridges){
Type st=types.supertype(origin.type);
while (st.hasTag(CLASS)) {
addBridges(pos,st.tsym,origin,bridges);
st=types.supertype(st);
}
for (List<Type> l=types.interfaces(origin.type); l.nonEmpty(); l=l.tail) addBridges(pos,l.head.tsym,origin,bridges);
}
| Add all necessary bridges to some class appending them to list buffer. |
public TransactionConfiguration txConfig(){
return kernalCtx.config().getTransactionConfiguration();
}
| Gets transactions configuration. |
public void updateDataset(CandleDataset source,int seriesIndex,boolean newBar){
if (source == null) {
throw new IllegalArgumentException("Null source (CandleDataset).");
}
for (int i=0; i < this.getSeriesCount(); i++) {
VwapSeries series=this.getSeries(i);
series.updateSeries(source.getSeries(seriesIndex),source.getSeries(seriesIndex).getItemCount() - 1,newBar);
}
}
| Method updateDataset. |
private void createMainPanel(){
log.config(": " + m_product);
this.getChildren().clear();
m_selectionList.clear();
m_productList.clear();
m_qtyList.clear();
m_buttonGroups.clear();
this.appendChild(new Separator());
this.appendChild(grpSelectionPanel);
this.appendChild(new Separator());
this.appendChild(grpSelectProd);
this.appendChild(new Separator());
this.appendChild(confirmPanel);
this.appendChild(new Separator());
this.setBorder("normal");
Caption title=new Caption(Msg.getMsg(Env.getCtx(),"SelectProduct"));
grpSelectProd.getChildren().clear();
grpSelectProd.appendChild(title);
if (m_product != null && m_product.get_ID() > 0) {
title.setLabel(m_product.getName());
if (m_product.getDescription() != null && m_product.getDescription().length() > 0) ;
m_bomLine=0;
addBOMLines(m_product,m_qty);
}
}
| Create Main Panel. Called when changing Product |
public static void main(String... a) throws Exception {
TestBase.createCaller().init().test();
}
| Run just this test. |
public static boolean addSmiles(Context context,Spannable spannable){
boolean hasChanges=false;
for ( Entry<Pattern,Object> entry : emoticons.entrySet()) {
Matcher matcher=entry.getKey().matcher(spannable);
while (matcher.find()) {
boolean set=true;
for ( ImageSpan span : spannable.getSpans(matcher.start(),matcher.end(),ImageSpan.class)) if (spannable.getSpanStart(span) >= matcher.start() && spannable.getSpanEnd(span) <= matcher.end()) spannable.removeSpan(span);
else {
set=false;
break;
}
if (set) {
hasChanges=true;
Object value=entry.getValue();
if (value instanceof String && !((String)value).startsWith("http")) {
File file=new File((String)value);
if (!file.exists() || file.isDirectory()) {
return false;
}
spannable.setSpan(new ImageSpan(context,Uri.fromFile(file)),matcher.start(),matcher.end(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
else {
spannable.setSpan(new ImageSpan(context,(Integer)value),matcher.start(),matcher.end(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
}
return hasChanges;
}
| replace existing spannable with smiles |
public int countCurrentDockerSlaves(final DockerSlaveTemplate template) throws Exception {
int count=0;
List<Container> containers=getClient().listContainersCmd().exec();
for ( Container container : containers) {
final Map<String,String> labels=container.getLabels();
if (labels.containsKey(DOCKER_CLOUD_LABEL) && labels.get(DOCKER_CLOUD_LABEL).equals(getDisplayName())) {
if (template == null) {
count++;
}
else if (labels.containsKey(DOCKER_TEMPLATE_LABEL) && labels.get(DOCKER_TEMPLATE_LABEL).equals(template.getId())) {
count++;
}
}
}
return count;
}
| Counts the number of instances in Docker currently running that are using the specified template. |
public EchoReplyMessage(EchoReplyMessage other){
if (other.isSetHeader()) {
this.header=new AsyncMessageHeader(other.header);
}
}
| Performs a deep copy on <i>other</i>. |
public void blend(int sx,int sy,int sw,int sh,int dx,int dy,int dw,int dh,int mode){
blend(this,sx,sy,sw,sh,dx,dy,dw,dh,mode);
}
| Blends one area of this image to another area. |
public IntHashMap(int initialCapacity){
this(initialCapacity,0.75f);
}
| <p>Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is <code>0.75</code>.</p> |
public static long[] hash(int[] key,long seed){
HashState hashState=new HashState(seed,seed);
final int ints=key.length;
final int nblocks=ints >> 2;
for (int i=0; i < nblocks; i++) {
long k1=getLong(key,4 * i,2);
long k2=getLong(key,(4 * i) + 2,2);
hashState.blockMix128(k1,k2);
}
int tail=nblocks * 4;
int rem=ints - tail;
long k1;
long k2;
if (rem > 2) {
k1=getLong(key,tail,2);
k2=getLong(key,tail + 2,rem - 2);
}
else {
k1=(rem == 0) ? 0 : getLong(key,tail,rem);
k2=0;
}
return hashState.finalMix128(k1,k2,ints * Integer.BYTES);
}
| Returns a long array of size 2, which is a 128-bit hash of the input. |
private void startChristmas(Player admin){
if (System.getProperty("stendhal.santa") != null) {
admin.sendPrivateText("Santa is already active.");
return;
}
System.setProperty("stendhal.santa","true");
StendhalQuestSystem.get().loadQuest(new MeetSanta());
}
| Starts Christmas. |
public static void resetTimeComparisonEpsilonMicros(){
timeComparisonEpsilon=initializeTimeEpsilon();
}
| Resets comparison value from default or global property |
private static int first(ByteBuffer in,int inPos){
return (in.get(inPos) << 8) | (in.get(inPos + 1) & 255);
}
| Return the integer with the first two bytes 0, then the bytes at the index, then at index+1. |
@ApiMethod(httpMethod="POST") public final Recommendation insertRecommendation(final Recommendation recommendation,final User user) throws ServiceException {
EndpointUtil.throwIfNotAdmin(user);
ofy().save().entity(recommendation).now();
return recommendation;
}
| Inserts the entity into App Engine datastore. It uses HTTP POST method. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.