code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public static ChatMessage createChatMessage(String msgId,String apiMimeType,String content,ContactId contact,String displayName,long timestamp,long timestampSent){
if (MimeType.TEXT_MESSAGE.equals(apiMimeType)) {
return new ChatMessage(msgId,contact,content,MimeType.TEXT_MESSAGE,timestamp,timestampSent,displayName);
}
else if (MimeType.GEOLOC_MESSAGE.equals(apiMimeType)) {
return new ChatMessage(msgId,contact,content,MimeType.GEOLOC_MESSAGE,timestamp,timestampSent,displayName);
}
throw new IllegalArgumentException("Unable to create message, Invalid mimetype " + apiMimeType);
}
| Create a chat message either text or geolocation. |
@Override public void eUnset(int featureID){
switch (featureID) {
case ExpressionsPackage.LOGICAL_OR_EXPRESSION__LEFT_OPERAND:
setLeftOperand((Expression)null);
return;
case ExpressionsPackage.LOGICAL_OR_EXPRESSION__RIGHT_OPERAND:
setRightOperand((Expression)null);
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private boolean inBounds(final int x,final int y){
return x >= 0 && x < m_bufferedImage.getWidth(null) && y >= 0 && y < m_bufferedImage.getHeight(null);
}
| java.lang.boolean inBounds(java.lang.int, java.lang.int) Checks if the given x/y coordinate point is inbounds or not |
private void trace(){
glUseProgram(computeProgram);
if (mouseDown) {
currRotationAboutY=rotationAboutY + (mouseX - mouseDownX) * 0.01f;
}
else {
currRotationAboutY=rotationAboutY;
}
cameraPosition.set((float)sin(-currRotationAboutY) * 3.0f,2.0f,(float)cos(-currRotationAboutY) * 3.0f);
viewMatrix.setLookAt(cameraPosition,cameraLookAt,cameraUp);
if (resetFramebuffer) {
projMatrix.setPerspective((float)Math.toRadians(60.0f),(float)width / height,1f,2f);
resizeFramebufferTexture();
resetFramebuffer=false;
}
projMatrix.invertPerspectiveView(viewMatrix,invViewProjMatrix);
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER,0,atomicBuffer);
intBuffer.put(0,(int)System.nanoTime());
glBufferSubData(GL_ATOMIC_COUNTER_BUFFER,0,intBuffer);
float blendFactor=frameNumber / (frameNumber + 1.0f);
glUniform1f(blendFactorUniform,blendFactor);
glUniform1i(bounceCountUniform,bounceCount);
glUniform3f(eyeUniform,cameraPosition.x,cameraPosition.y,cameraPosition.z);
invViewProjMatrix.transformProject(tmpVector.set(-1,-1,0)).sub(cameraPosition);
glUniform3f(ray00Uniform,tmpVector.x,tmpVector.y,tmpVector.z);
invViewProjMatrix.transformProject(tmpVector.set(-1,1,0)).sub(cameraPosition);
glUniform3f(ray01Uniform,tmpVector.x,tmpVector.y,tmpVector.z);
invViewProjMatrix.transformProject(tmpVector.set(1,-1,0)).sub(cameraPosition);
glUniform3f(ray10Uniform,tmpVector.x,tmpVector.y,tmpVector.z);
invViewProjMatrix.transformProject(tmpVector.set(1,1,0)).sub(cameraPosition);
glUniform3f(ray11Uniform,tmpVector.x,tmpVector.y,tmpVector.z);
glBindImageTexture(framebufferImageBinding,tex,0,false,0,GL_READ_WRITE,GL_RGBA32F);
int worksizeX=mathRoundPoT(width);
int worksizeY=mathRoundPoT(height);
glDispatchCompute(worksizeX / workGroupSizeX,worksizeY / workGroupSizeY,1);
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
glBindImageTexture(framebufferImageBinding,0,0,false,0,GL_READ_WRITE,GL_RGBA32F);
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER,0,0);
glUseProgram(0);
frameNumber++;
}
| Compute one frame by tracing the scene using our compute shader and presenting that image on the screen. |
public DirtyFlagMap(final int initialCapacity,final float loadFactor){
map=new HashMap<K,V>(initialCapacity,loadFactor);
}
| <p> Create a DirtyFlagMap that 'wraps' a <code>HashMap</code> that has the given initial capacity and load factor. </p> |
LWComponentPeer<?,?> findPeerAt(final int x,final int y){
final Rectangle r=getBounds();
final Region sh=getRegion();
final boolean found=isVisible() && sh.contains(x - r.x,y - r.y);
return found ? this : null;
}
| Finds a top-most visible component for the given point. The location is specified relative to the peer's parent. |
public void onCreate(Bundle savedInstanceState){
mSlidingMenu=(SlidingMenu)LayoutInflater.from(mActivity).inflate(R.layout.slidingmenumain,null);
}
| Sets mSlidingMenu as a newly inflated SlidingMenu. Should be called within the activitiy's onCreate() |
@Override public void eSet(int featureID,Object newValue){
switch (featureID) {
case UmplePackage.ANONYMOUS_CONSTANT_DECLARATION_1__LIST_1:
setList_1((Boolean)newValue);
return;
case UmplePackage.ANONYMOUS_CONSTANT_DECLARATION_1__NAME_1:
setName_1((String)newValue);
return;
case UmplePackage.ANONYMOUS_CONSTANT_DECLARATION_1__TYPE_1:
setType_1((String)newValue);
return;
}
super.eSet(featureID,newValue);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
final public static float[] earthCircle(float phi1,float lambda0,float c,int n,float[] ret_val){
return earthCircle(phi1,lambda0,c,0.0f,MoreMath.TWO_PI,n,ret_val);
}
| Calculate earth circle in the sphere. <p> Returns n float lat,lon pairs at arc distance c from point at phi1,lambda0. <p> |
public boolean isExplicit(){
return kind.isExplicit();
}
| Returns true if the call is due to an explicit invoke statement. |
private void enableProgressBarView(boolean aIsProgressBarDisplayed){
if (null != mProgressBarView) {
mProgressBarView.setVisibility(aIsProgressBarDisplayed ? View.VISIBLE : View.GONE);
}
}
| Helper method to enable/disable the progress bar view used when a remote server action is on progress. |
public void putString(String s){
ensureCapacity((s.length() * 2) + 1);
System.arraycopy(s.getBytes(),0,this.byteBuffer,this.position,s.length());
this.position+=s.length();
this.byteBuffer[this.position++]=0;
}
| Put a string in the buffer. |
public int read() throws IOException {
return checkInputFile().read();
}
| Read from the file. |
public AndroidAuthenticator(Context context,Account account,String authTokenType,boolean notifyAuthFailure){
this(AccountManager.get(context),account,authTokenType,notifyAuthFailure);
}
| Creates a new authenticator. |
public ConsoleDocument(){
}
| Creates an empty console document. |
private void readFrameRemainder(ParsableByteArray source){
int bytesToRead=Math.min(source.bytesLeft(),frameSize - frameBytesRead);
output.sampleData(source,bytesToRead);
frameBytesRead+=bytesToRead;
if (frameBytesRead < frameSize) {
return;
}
output.sampleMetadata(timeUs,C.SAMPLE_FLAG_SYNC,frameSize,0,null);
timeUs+=frameDurationUs;
frameBytesRead=0;
state=STATE_FINDING_HEADER;
}
| Attempts to read the remainder of the frame. <p> If a frame is read in full then true is returned. The frame will have been output, and the position of the source will have been advanced to the byte that immediately follows the end of the frame. <p> If a frame is not read in full then the position of the source will have been advanced to the limit, and the method should be called again with the next source to continue the read. |
public Lucene50CompoundReader(Directory directory,SegmentInfo si,IOContext context) throws IOException {
this.directory=directory;
this.segmentName=si.name;
String dataFileName=IndexFileNames.segmentFileName(segmentName,"",Lucene50CompoundFormat.DATA_EXTENSION);
String entriesFileName=IndexFileNames.segmentFileName(segmentName,"",Lucene50CompoundFormat.ENTRIES_EXTENSION);
this.entries=readEntries(si.getId(),directory,entriesFileName);
boolean success=false;
long expectedLength=CodecUtil.indexHeaderLength(Lucene50CompoundFormat.DATA_CODEC,"");
for ( Map.Entry<String,FileEntry> ent : entries.entrySet()) {
expectedLength+=ent.getValue().length;
}
expectedLength+=CodecUtil.footerLength();
handle=directory.openInput(dataFileName,context);
try {
CodecUtil.checkIndexHeader(handle,Lucene50CompoundFormat.DATA_CODEC,version,version,si.getId(),"");
CodecUtil.retrieveChecksum(handle);
if (handle.length() != expectedLength) {
throw new CorruptIndexException("length should be " + expectedLength + " bytes, but is "+ handle.length()+ " instead",handle);
}
success=true;
}
finally {
if (!success) {
IOUtils.closeWhileHandlingException(handle);
}
}
}
| Create a new CompoundFileDirectory. |
public void writeExif(Bitmap bmap,OutputStream exifOutStream) throws IOException {
if (bmap == null || exifOutStream == null) {
throw new IllegalArgumentException(NULL_ARGUMENT_STRING);
}
OutputStream s=getExifWriterStream(exifOutStream);
bmap.compress(Bitmap.CompressFormat.JPEG,90,s);
s.flush();
}
| Writes the tags from this ExifInterface object into a jpeg compressed bitmap, removing prior exif tags. |
@Override public String toString(){
return String.format("Thread (TID: %d)",getThreadId());
}
| Returns a string representation of the thread. |
public String toString(){
StringBuffer buffer=new StringBuffer();
buffer.append("FlushFdrPage[");
buffer.append("fixedValue = ").append(fixedValue);
buffer.append(", className = ").append(className);
buffer.append(", treeId = ").append(treeId);
buffer.append(", pageName = ").append(pageName);
buffer.append(", fatherId = ").append(fatherId);
buffer.append(", fatherClassName = ").append(fatherClassName);
buffer.append("]");
return buffer.toString();
}
| toString methode: creates a String representation of the object |
private void ensureCapacity(int newNumStates){
int oldLength=epsilon.length;
if (newNumStates < oldLength) return;
int newStatesLength=Math.max(oldLength * 2,newNumStates);
boolean[] newFinal=new boolean[newStatesLength];
boolean[] newIsPush=new boolean[newStatesLength];
Action[] newAction=new Action[newStatesLength];
StateSet[][] newTable=new StateSet[newStatesLength][numInput];
StateSet[] newEpsilon=new StateSet[newStatesLength];
System.arraycopy(isFinal,0,newFinal,0,numStates);
System.arraycopy(action,0,newAction,0,numStates);
System.arraycopy(epsilon,0,newEpsilon,0,numStates);
System.arraycopy(table,0,newTable,0,numStates);
isFinal=newFinal;
action=newAction;
epsilon=newEpsilon;
table=newTable;
}
| Make sure the NFA can contain at least newNumStates states. |
protected List<TestDiagnostic> readDiagnostics(TestConfiguration config,CompilationResult compilationResult){
List<TestDiagnostic> expectedDiagnostics;
if (config.getDiagnosticFiles() == null || config.getDiagnosticFiles().isEmpty()) {
expectedDiagnostics=JavaDiagnosticReader.readExpectedDiagnosticsJfo(compilationResult.getJavaFileObjects(),true);
}
else {
expectedDiagnostics=JavaDiagnosticReader.readDiagnosticFiles(config.getDiagnosticFiles(),true);
}
return expectedDiagnostics;
}
| Added in case a subclass wishes to filter out errors or add new expected errors. This method is called immediately before results are checked. |
public static String readFile(String fileName){
try {
URL resource=TestUtil.class.getClassLoader().getResource(fileName);
if (resource == null) {
throw new FileNotFoundException(format("Could not find the file on classpath: %s",fileName));
}
return Resources.toString(resource,Charsets.UTF_8);
}
catch ( IOException e) {
throw new IllegalArgumentException(format("Error reading file \"%s\"",fileName),e);
}
}
| Read a file on the classpath into a string. |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset=0;
int length=to.length();
char[] circle=new char[length];
for (i=0; i < length; i+=1) {
c=next();
if (c == 0) {
return false;
}
circle[i]=c;
}
for (; ; ) {
j=offset;
b=true;
for (i=0; i < length; i+=1) {
if (circle[j] != to.charAt(i)) {
b=false;
break;
}
j+=1;
if (j >= length) {
j-=length;
}
}
if (b) {
return true;
}
c=next();
if (c == 0) {
return false;
}
circle[offset]=c;
offset+=1;
if (offset >= length) {
offset-=length;
}
}
}
| Skip characters until past the requested string. If it is not found, we are left at the end of the source with a result of false. |
public void add(Permission permission){
if (!(permission instanceof ExecOptionPermission)) throw new IllegalArgumentException("invalid permission: " + permission);
if (isReadOnly()) throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
ExecOptionPermission p=(ExecOptionPermission)permission;
permissions.put(p.getName(),permission);
if (!all_allowed) {
if (p.getName().equals("*")) all_allowed=true;
}
}
| Adds a permission to the collection. The key for the hash is permission.name. |
public boolean isReusable(){
if ((socket != null) && (socket instanceof RMISocketInfo)) return ((RMISocketInfo)socket).isReusable();
else return true;
}
| Determine if this connection can be used for multiple operations. If the socket implements RMISocketInfo, then we can query it about this; otherwise, assume that it does provide a full-duplex persistent connection like java.net.Socket. |
public ColumnList addCounter(byte[] family,byte[] qualifier,long incr){
counters().add(new Counter(family,qualifier,incr));
return this;
}
| Add an HBase counter column. |
private final void _writeSegment(int end) throws IOException, JsonGenerationException {
final int[] escCodes=CharTypes.getOutputEscapes();
final int escLen=escCodes.length;
int ptr=0;
output_loop: while (ptr < end) {
int start=ptr;
while (true) {
char c=_outputBuffer[ptr];
if (c < escLen && escCodes[c] != 0) {
break;
}
if (++ptr >= end) {
break;
}
}
int flushLen=(ptr - start);
if (flushLen > 0) {
_writer.write(_outputBuffer,start,flushLen);
if (ptr >= end) {
break output_loop;
}
}
{
int escCode=escCodes[_outputBuffer[ptr]];
++ptr;
int needLen=(escCode < 0) ? 6 : 2;
if (needLen > _outputTail) {
_writeSingleEscape(escCode);
}
else {
ptr-=needLen;
_appendSingleEscape(escCode,_outputBuffer,ptr);
}
}
}
}
| Method called to output textual context which has been copied to the output buffer prior to call. If any escaping is needed, it will also be handled by the method. <p> Note: when called, textual content to write is within output buffer, right after buffered content (if any). That's why only length of that text is passed, as buffer and offset are implied. |
private void fillPicks(){
String sql="SELECT M_PriceList_Version.M_PriceList_Version_ID," + " M_PriceList_Version.Name || ' (' || c.Iso_Code || ')' AS ValueName " + "FROM M_PriceList_Version, M_PriceList pl, C_Currency c "+ "WHERE M_PriceList_Version.M_PriceList_ID=pl.M_PriceList_ID"+ " AND pl.C_Currency_ID=c.C_Currency_ID"+ " AND M_PriceList_Version.IsActive='Y' AND pl.IsActive='Y'";
sql=MRole.getDefault().addAccessSQL(sql,"M_PriceList_Version",true,false) + " ORDER BY M_PriceList_Version.Name";
try {
pickPriceList.addItem(new KeyNamePair(0,""));
PreparedStatement pstmt=DB.prepareStatement(sql,null);
ResultSet rs=pstmt.executeQuery();
while (rs.next()) {
KeyNamePair kn=new KeyNamePair(rs.getInt(1),rs.getString(2));
pickPriceList.addItem(kn);
}
rs.close();
pstmt.close();
sql="SELECT M_Warehouse_ID, Value || ' - ' || Name AS ValueName " + "FROM M_Warehouse " + "WHERE IsActive='Y'";
sql=MRole.getDefault().addAccessSQL(sql,"M_Warehouse",MRole.SQL_NOTQUALIFIED,MRole.SQL_RO) + " ORDER BY Value";
pickWarehouse.addItem(new KeyNamePair(0,""));
pstmt=DB.prepareStatement(sql,null);
rs=pstmt.executeQuery();
while (rs.next()) {
KeyNamePair kn=new KeyNamePair(rs.getInt("M_Warehouse_ID"),rs.getString("ValueName"));
pickWarehouse.addItem(kn);
}
rs.close();
pstmt.close();
}
catch ( SQLException e) {
log.log(Level.SEVERE,sql,e);
}
}
| Fill Picks with values |
public HttpException(){
super();
}
| Creates a new HttpException with a <tt>null</tt> detail message. |
static public boolean hasPhoto(Tweet tweet){
return getPhotoEntity(tweet) != null;
}
| Returns true if there is a media entity with the type of "photo" |
public ScopeContext(String scopeName,Map<String,Object> scope){
this.scopeName=scopeName;
this.scope=scope;
}
| <p class="changed_added_2_0">Construct this structure with the supplied arguments.</p> |
public boolean isOK(){
return fSeverity == OK;
}
| Returns whether the status's severity is <code>OK</code> or not. |
void waitBeforeNextPoll(int pollingInterval) throws InterruptedException {
synchronized (this) {
wait(pollingInterval);
}
if (!pollOutstanding) {
return;
}
log.debug("--- extra wait");
for (int i=0; i < 20; i++) {
synchronized (this) {
wait(pollingInterval / 4);
}
log.debug("-------------extra wait");
if (!pollOutstanding) {
return;
}
}
}
| Wait before sending next poll. <P> Waits specified time, and then checks to see if response has been returned. If not, it waits again (twice) by 1/2 the interval, then finally polls anyway. |
public boolean equivalent(Label other){
if (other == null) {
return false;
}
boolean result=true;
result&=value.equals(other.getValue());
result&=scope.equals(other.getScope());
return result;
}
| A method to determine the equivalence of any two Labels. |
private static Map<String,Integer> optionArgDefs(){
Map<String,Integer> optionArgDefs=new HashMap<>();
optionArgDefs.put("annotationsSplit",0);
optionArgDefs.put("sourceTokens",1);
optionArgDefs.put("targetTokens",1);
optionArgDefs.put("alignment",1);
optionArgDefs.put("annotations",1);
return optionArgDefs;
}
| Command-line option specification. |
public static ClassInfo[] findOrCreateClass(Class<?>[] l){
final ClassInfo[] a=new ClassInfo[l.length];
for (int i=0; i < a.length; ++i) {
a[i]=findOrCreateClass(l[i]);
}
return a;
}
| Find or create a list of class representations |
private boolean existsXmlConversion(Class<?> clazz){
return exists(xml.getConversionMethods(clazz));
}
| Verifies the presence of the xml conversion method in the input class, if found it's returned. |
public static void putObject_test4() throws Exception {
println("Test: putObject(String bucketName, String objectName, String contentType, long size, InputStream body)");
String fileName=createFile(3 * MB);
InputStream is=Files.newInputStream(Paths.get(fileName));
client.putObject(bucketName,fileName,is,1024 * 1024,customContenType);
is.close();
Files.delete(Paths.get(fileName));
ObjectStat objectStat=client.statObject(bucketName,fileName);
if (!customContenType.equals(objectStat.contentType())) {
println("FAILED");
}
client.removeObject(bucketName,fileName);
}
| Test: putObject(String bucketName, String objectName, String contentType, long size, InputStream body). |
public WorldWindowGLCanvas(WorldWindow shareWith,java.awt.GraphicsDevice device){
super(Configuration.getRequiredGLCapabilities(),new BasicGLCapabilitiesChooser(),device);
if (shareWith != null) this.setSharedContext(shareWith.getContext());
try {
this.wwd=((WorldWindowGLDrawable)WorldWind.createConfigurationComponent(AVKey.WORLD_WINDOW_CLASS_NAME));
this.wwd.initDrawable(this);
this.wwd.addPropertyChangeListener(this);
if (shareWith != null) this.wwd.initGpuResourceCache(shareWith.getGpuResourceCache());
else this.wwd.initGpuResourceCache(WorldWindowImpl.createGpuResourceCache());
this.createView();
this.createDefaultInputHandler();
WorldWind.addPropertyChangeListener(WorldWind.SHUTDOWN_EVENT,this);
this.wwd.endInitialization();
}
catch ( Exception e) {
String message=Logging.getMessage("Awt.WorldWindowGLSurface.UnabletoCreateWindow");
Logging.logger().severe(message);
throw new WWRuntimeException(message,e);
}
}
| Constructs a new <code>WorldWindowGLCanvas</code> on a specified graphics device and shares graphics resources with another <code>WorldWindow</code>. |
long triggerTime(long delay){
return now() + ((delay < (Long.MAX_VALUE >> 1)) ? delay : overflowFree(delay));
}
| Returns the trigger time of a delayed action. |
public final void flush(){
if (offset > 0 && offset >= minLenToWrite()) {
ChunkRaw c=new ChunkRaw(offset,getChunkId(),false);
c.data=buf;
c.writeChunk(outputStream);
totalBytesWriten+=c.len + 12;
chunksWriten++;
offset=0;
availLen=maxChunkLen;
postReset();
}
}
| Writes a chhunk if there is more than minLenToWrite. This is normally called internally, but can be called explicitly to force flush. |
@Override public boolean equals(Object obj){
if (obj == this) {
return true;
}
if (!(obj instanceof StandardXYSeriesLabelGenerator)) {
return false;
}
StandardXYSeriesLabelGenerator that=(StandardXYSeriesLabelGenerator)obj;
if (!this.formatPattern.equals(that.formatPattern)) {
return false;
}
return true;
}
| Tests this object for equality with an arbitrary object. |
public SecurityObjectAuthority(SecurityObject securityObject){
sObj=securityObject;
}
| Create a new SecurityObjectAuthority. |
private static void usage(){
System.out.println("TAnk Standalone Agent Startup Usage:");
System.out.println("java -cp standaloneagent-startup-pkg-1.0-all.jar com/intuit/tank/agent/StandaloneAgentStartup <options>");
System.out.println("-controller=<controller_base_url>: The url of the controller to get test info from.");
System.out.println("-host=<agent ip or host>: optional. only need if agent cannot determine correct ip. The ip or dns name of this agent.");
System.out.println("-capacity=<integer>: optional. The number of users this agent can simulate. Default 4000.");
}
| Display usage error text |
public static void startSettingsApp(Fragment fragment){
startSettingsApp((Context)fragment.getActivity());
}
| Helper API to start the Settings app directly into the details page for the app. This allows the user to quickly change the permissions granted/denied for the app. <p> |
public void runMATSimPSSIterations(int numberOfIterations){
File resultsDirectory=new File(resultDirectory);
if (resultsDirectory.list().length > 0) {
throw new Error("The result directory is not empty.");
}
if (!new File(outputPSSPath + "\\hubPriceInfo.txt").exists()) {
throw new Error("The initial price file is not in " + outputPSSPath);
}
GeneralLib.copyFile(outputPSSPath + "\\hubPriceInfo.txt",resultDirectory + "initialHubPriceInfo.txt");
for (iterationNumber=0; iterationNumber < numberOfIterations; iterationNumber++) {
runMATSimIterations();
saveMATSimResults();
preparePSSInput();
runPSS();
savePSSResults();
prepareMATSimInput();
}
}
| number of iterations, in which both MATSim and PSS (Power System Simulation) is run. The number of iterations within matsim is specified in the config file. |
public void start(){
init();
m_Start=getCurrentTime();
m_Stop=m_Start;
m_Running=true;
}
| saves the current system time (or CPU time) in msec as start time |
public PricedProductRole copy(PriceModel pm){
return copy(pm,null,null);
}
| Creates a copy of the current object. |
public void handleEvent(Event evt){
Node node=(Node)evt.getTarget();
BridgeUpdateHandler h=getBridgeUpdateHandler(node);
if (h != null) {
try {
h.handleDOMNodeRemovedEvent((MutationEvent)evt);
}
catch ( Exception e) {
userAgent.displayError(e);
}
}
}
| Handles 'DOMNodeRemoved' event type. |
@Override public void characters(char[] ch,int start,int length){
if (this.currentText != null) {
this.currentText.append(String.copyValueOf(ch,start,length));
}
}
| Receives some (or all) of the text in the current element. |
public RDFXMLWriter(Writer writer){
this.writer=writer;
namespaceTable=new LinkedHashMap<String,String>();
writingStarted=false;
headerWritten=false;
lastWrittenSubject=null;
}
| Creates a new RDFXMLWriter that will write to the supplied Writer. |
@Override public boolean isEmpty(){
return 0 == size();
}
| Returns true if the deque has no elements. |
private BitMatrix sampleGrid(BitMatrix image,ResultPoint topLeft,ResultPoint bottomLeft,ResultPoint bottomRight,ResultPoint topRight) throws NotFoundException {
int dimension;
if (compact) {
dimension=4 * nbLayers + 11;
}
else {
if (nbLayers <= 4) {
dimension=4 * nbLayers + 15;
}
else {
dimension=4 * nbLayers + 2 * ((nbLayers - 4) / 8 + 1) + 15;
}
}
GridSampler sampler=GridSampler.getInstance();
return sampler.sampleGrid(image,dimension,dimension,0.5f,0.5f,dimension - 0.5f,0.5f,dimension - 0.5f,dimension - 0.5f,0.5f,dimension - 0.5f,topLeft.getX(),topLeft.getY(),topRight.getX(),topRight.getY(),bottomRight.getX(),bottomRight.getY(),bottomLeft.getX(),bottomLeft.getY());
}
| Samples an Aztec matrix from an image |
private void put(final Item i){
if (index + typeCount > threshold) {
int ll=items.length;
int nl=ll * 2 + 1;
Item[] newItems=new Item[nl];
for (int l=ll - 1; l >= 0; --l) {
Item j=items[l];
while (j != null) {
int index=j.hashCode % newItems.length;
Item k=j.next;
j.next=newItems[index];
newItems[index]=j;
j=k;
}
}
items=newItems;
threshold=(int)(nl * 0.75);
}
int index=i.hashCode % items.length;
i.next=items[index];
items[index]=i;
}
| Puts the given item in the constant pool's hash table. The hash table <i>must</i> not already contains this item. |
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException {
String prefix;
String namespace;
String methName;
String fullName=m_arg0.execute(xctxt).str();
int indexOfNSSep=fullName.indexOf(':');
if (indexOfNSSep < 0) {
prefix="";
namespace=Constants.S_XSLNAMESPACEURL;
methName=fullName;
}
else {
prefix=fullName.substring(0,indexOfNSSep);
namespace=xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
if (null == namespace) return XBoolean.S_FALSE;
methName=fullName.substring(indexOfNSSep + 1);
}
if (namespace.equals(Constants.S_XSLNAMESPACEURL) || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)) {
try {
TransformerImpl transformer=(TransformerImpl)xctxt.getOwnerObject();
return transformer.getStylesheet().getAvailableElements().containsKey(new QName(namespace,methName)) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
catch ( Exception e) {
return XBoolean.S_FALSE;
}
}
else {
ExtensionsProvider extProvider=(ExtensionsProvider)xctxt.getOwnerObject();
return extProvider.elementAvailable(namespace,methName) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
}
| Execute the function. The function must return a valid object. |
public boolean allowTrailingEdges(){
return patternElement.allowTrailingEdges();
}
| Return whether or not the most recently matched instruction allows trailing edges. |
public static CompoundTag putItemHelper(Item item){
return putItemHelper(item,null);
}
| A Named Binary Tag library for BukkitPE Project |
public final boolean contains(String key){
for (int i=0; i < m_firstFree; i++) {
if (m_map[i].equals(key)) return true;
}
return false;
}
| Tell if the table contains the given string. |
public void installUI(JComponent c){
super.installUI(c);
c.setOpaque(false);
}
| Install UI |
public Collection<GridQueryTypeDescriptor> types(@Nullable String space){
Collection<GridQueryTypeDescriptor> spaceTypes=new ArrayList<>(Math.min(10,types.size()));
for ( Map.Entry<TypeId,TypeDescriptor> e : types.entrySet()) {
TypeDescriptor desc=e.getValue();
if (desc.registered() && F.eq(e.getKey().space,space)) spaceTypes.add(desc);
}
return spaceTypes;
}
| Gets types for space. |
public final synchronized void queueAnalyzeRequest(SearchRequest sr){
killOldEngine(sr.engine);
stopSearch();
ArrayList<Move> moves=movesToSearch(sr);
if (moves.size() == 0) return;
searchRequest=sr;
handleQueue();
}
| Start analyzing a position. |
public void fireGenerateEvent(int eventType){
}
| Fire off startDocument, endDocument events. |
public static void enable(){
}
| Enables the JIT compiler. Does nothing on Android. |
public Debug_ createDebug_(){
Debug_Impl debug_=new Debug_Impl();
return debug_;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@Override protected boolean shouldContinue(){
return receivedJDPpackets < 3;
}
| After receiving three Jdp packets the test should end. |
public void test_getPublicExponent(){
assertEquals("invalid public exponent",Util.rsaCrtParam.getPublicExponent(),key.getPublicExponent());
}
| java.security.interfaces.RSAPrivateCrtKey #getPublicExponent() |
private Throwable prepareFault(HashMap fault) throws IOException {
Object detail=fault.get("detail");
String message=(String)fault.get("message");
if (detail instanceof Throwable) {
_replyFault=(Throwable)detail;
if (message != null && _detailMessageField != null) {
try {
_detailMessageField.set(_replyFault,message);
}
catch ( Throwable e) {
}
}
return _replyFault;
}
else {
String code=(String)fault.get("code");
_replyFault=new HessianServiceException(message,code,detail);
return _replyFault;
}
}
| Prepares the fault. |
public void free(){
logger.fine("Free ICE agent");
shutdown=true;
if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt();
connCheckServer.stop();
IceProcessingState state=getState();
if (!IceProcessingState.FAILED.equals(state) && !IceProcessingState.TERMINATED.equals(state)) {
terminate(IceProcessingState.TERMINATED);
}
boolean interrupted=false;
logger.fine("remove streams");
for ( IceMediaStream stream : getStreams()) {
try {
removeStream(stream);
logger.fine("remove stream " + stream.getName());
}
catch ( Throwable t) {
logger.fine("remove stream " + stream.getName() + " failed: "+ t);
if (t instanceof InterruptedException) interrupted=true;
else if (t instanceof ThreadDeath) throw (ThreadDeath)t;
}
}
if (interrupted) Thread.currentThread().interrupt();
getStunStack().shutDown();
logger.fine("ICE agent freed");
}
| Prepares this <tt>Agent</tt> for garbage collection by ending all related processes and freeing its <tt>IceMediaStream</tt>s, <tt>Component</tt>s and <tt>Candidate</tt>s. This method will also place the agent in the terminated state in case it wasn't already there. |
public boolean containsIgnoredSections(){
return containsIgnoredSections;
}
| Returns true if ignored sections where found the pon file |
public NullOutputLogTarget(){
open();
}
| Creation of a new null log target. |
@SuppressWarnings("deprecation") protected void preShow(){
if (mRootView == null) throw new IllegalStateException("setContentView was not called with a view to display.");
onShow();
if (mBackground == null) mWindow.setBackgroundDrawable(new BitmapDrawable());
else mWindow.setBackgroundDrawable(mBackground);
mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setTouchable(true);
mWindow.setFocusable(true);
mWindow.setOutsideTouchable(true);
mWindow.setContentView(mRootView);
}
| On pre show |
private void updateOffsets(){
float minSizeX=imageWidth * minRelativeOffset;
float minSizeY=imageHeight * minRelativeOffset;
offsetWidth=(imageWidth - canvasWidth - minSizeX) > 0 ? imageWidth - canvasWidth : 0;
offsetHeight=(imageHeight - canvasHeight - minSizeY) > 0 ? imageHeight - canvasHeight : 0;
}
| Offset is the difference between image and canvas including the min relative size. Determines the base path animation length. |
public boolean isParentOf(Node node1,Node node2){
for ( Edge edge1 : getEdges(node1)) {
Edge edge=(edge1);
Node sub=Edges.traverseDirected(node1,edge);
if (sub == node2) {
return true;
}
}
return false;
}
| Determines whether one node is a parent of another. |
public Rule findById(Integer id){
try {
EntityManager entityManager=EntityManagerHelper.getEntityManager();
entityManager.getTransaction().begin();
Rule instance=entityManager.find(Rule.class,id);
entityManager.getTransaction().commit();
return instance;
}
catch ( Exception re) {
EntityManagerHelper.rollback();
throw re;
}
finally {
EntityManagerHelper.close();
}
}
| Method findById. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-03-25 14:54:53.600 -0400",hash_original_method="3EB1A4F1628CAC368761882425F0BB03",hash_generated_method="3EB1A4F1628CAC368761882425F0BB03") boolean isValid(){
return (null != mMimeType && !mMimeType.equals("") && null != mData && mData.length > 0);
}
| Determines whether this instance is valid or not. |
public static Builder newBuilder(@Nullable Context context){
return new Builder(context);
}
| Create a new builder. |
@AfterClass public static void afterClassBaseTest() throws SQLException {
if (testSingleHost) {
if (!sharedConnection.isClosed()) {
if (!tempViewList.isEmpty()) {
Statement stmt=sharedConnection.createStatement();
String viewName;
while ((viewName=tempViewList.poll()) != null) {
try {
stmt.execute("DROP VIEW IF EXISTS " + viewName);
}
catch ( SQLException e) {
}
}
}
if (!tempTableList.isEmpty()) {
Statement stmt=sharedConnection.createStatement();
String tableName;
while ((tableName=tempTableList.poll()) != null) {
try {
stmt.execute("DROP TABLE IF EXISTS " + tableName);
}
catch ( SQLException e) {
}
}
}
if (!tempProcedureList.isEmpty()) {
Statement stmt=sharedConnection.createStatement();
String procedureName;
while ((procedureName=tempProcedureList.poll()) != null) {
try {
stmt.execute("DROP procedure IF EXISTS " + procedureName);
}
catch ( SQLException e) {
}
}
}
if (!tempFunctionList.isEmpty()) {
Statement stmt=sharedConnection.createStatement();
String functionName;
while ((functionName=tempFunctionList.poll()) != null) {
try {
stmt.execute("DROP FUNCTION IF EXISTS " + functionName);
}
catch ( SQLException e) {
}
}
}
}
try {
sharedConnection.close();
}
catch ( SQLException e) {
e.printStackTrace();
}
}
}
| Destroy the test tables. |
public boolean isSorted(){
return (mSortColumn > -1);
}
| returns whether the table was sorted |
public CacheProfile(FilterProfile localProfile){
this.filterProfile=localProfile;
}
| used for routing computation |
Type(Response.Status status){
this.status=status;
}
| Defines a new error type associated with the given HTTP status. |
public INode copy(){
return new SmallPuzzle(s);
}
| return copy of node. |
@Override protected final void addArgument(Object argument){
if (this.arguments == null) {
throw new IllegalStateException("Could not add argument to evaluated element");
}
this.arguments.add(argument);
}
| Adds the argument to the list of arguments that is used to calculate the value of this element. |
public DImportKeyPairPvk(JFrame parent){
super(parent,Dialog.ModalityType.DOCUMENT_MODAL);
initComponents();
}
| Creates a new DImportKeyPairPvk dialog. |
private IgniteBiTuple<Integer,Integer> fieldPositionAndLength(int footerPos,int footerEnd,int rawPos,int fieldIdLen,int fieldOffsetLen){
int fieldOffset=BinaryUtils.fieldOffsetRelative(reader,footerPos + fieldIdLen,fieldOffsetLen);
int fieldPos=start + fieldOffset;
int fieldLen;
if (footerPos + fieldIdLen + fieldOffsetLen == footerEnd) fieldLen=rawPos - fieldPos;
else {
int nextFieldOffset=BinaryUtils.fieldOffsetRelative(reader,footerPos + fieldIdLen + fieldOffsetLen+ fieldIdLen,fieldOffsetLen);
fieldLen=nextFieldOffset - fieldOffset;
}
return F.t(fieldPos,fieldLen);
}
| Get field position and length. |
public Graph search(Node target){
long start=System.currentTimeMillis();
this.numIndependenceTests=0;
this.allTriples=new HashSet<>();
this.ambiguousTriples=new HashSet<>();
this.colliderTriples=new HashSet<>();
this.noncolliderTriples=new HashSet<>();
if (target == null) {
throw new IllegalArgumentException("Null target name not permitted");
}
this.target=target;
logger.log("info","Target = " + target);
this.maxRemainingAtDepth=new int[20];
this.maxVariableAtDepth=new Node[20];
Arrays.fill(maxRemainingAtDepth,-1);
Arrays.fill(maxVariableAtDepth,null);
logger.log("info","target = " + getTarget());
Graph graph=new EdgeListGraph();
this.a=new HashSet<>();
logger.log("info","BEGINNING step 1 (prune target).");
graph.addNode(getTarget());
constructFan(getTarget(),graph);
logger.log("graph","After step 1 (prune target)" + graph);
logger.log("graph","After step 1 (prune target)" + graph);
logger.log("info","BEGINNING step 2 (prune PC).");
for ( Node v : graph.getAdjacentNodes(getTarget())) {
constructFan(v,graph);
W: for ( Node w : graph.getAdjacentNodes(v)) {
if (a.contains(w)) {
continue;
}
List _a=new LinkedList<>(a);
_a.retainAll(graph.getAdjacentNodes(w));
if (_a.size() > 1) continue;
List<Node> adjT=graph.getAdjacentNodes(getTarget());
DepthChoiceGenerator cg=new DepthChoiceGenerator(adjT.size(),depth);
int[] choice;
while ((choice=cg.next()) != null) {
List<Node> s=GraphUtils.asList(choice,adjT);
if (!s.contains(v)) continue;
if (independent(getTarget(),w,s)) {
graph.removeEdge(v,w);
continue W;
}
}
}
}
logger.log("graph","After step 2 (prune PC)" + graph);
logger.log("info","BEGINNING step 3 (prune PCPC).");
for ( Node v : graph.getAdjacentNodes(getTarget())) {
for ( Node w : graph.getAdjacentNodes(v)) {
if (getA().contains(w)) {
continue;
}
constructFan(w,graph);
}
}
logger.log("graph","After step 3 (prune PCPC)" + graph);
logger.log("info","BEGINNING step 4 (PC Orient).");
SearchGraphUtils.pcOrientbk(knowledge,graph,graph.getNodes());
List<Node> _visited=new LinkedList<>(getA());
orientUnshieldedTriples(knowledge,graph,getTest(),getDepth(),_visited);
MeekRules meekRules=new MeekRules();
meekRules.setAggressivelyPreventCycles(this.aggressivelyPreventCycles);
meekRules.setKnowledge(knowledge);
meekRules.orientImplied(graph);
logger.log("graph","After step 4 (PC Orient)" + graph);
logger.log("info","BEGINNING step 5 (Trim graph to {T} U PC U " + "{Parents(Children(T))}).");
MbUtils.trimToMbNodes(graph,getTarget(),false);
logger.log("graph","After step 5 (Trim graph to {T} U PC U {Parents(Children(T))})" + graph);
logger.log("info","BEGINNING step 6 (Remove edges among P and P of C).");
MbUtils.trimEdgesAmongParents(graph,getTarget());
MbUtils.trimEdgesAmongParentsOfChildren(graph,getTarget());
logger.log("graph","After step 6 (Remove edges among P and P of C)" + graph);
finishUp(start,graph);
this.logger.log("graph","\nReturning this graph: " + graph);
this.graph=graph;
return graph;
}
| Searches for the MB Pattern for the given target. |
public static SliceMetaData readSliceMetadata(File rsFiles,int restructFolderNumber) throws CarbonUtilException {
SliceMetaData readObject=null;
InputStream stream=null;
ObjectInputStream objectInputStream=null;
File file=null;
try {
file=new File(rsFiles + File.separator + getSliceMetaDataFileName(restructFolderNumber));
stream=new FileInputStream(rsFiles + File.separator + getSliceMetaDataFileName(restructFolderNumber));
objectInputStream=new ObjectInputStream(stream);
readObject=(SliceMetaData)objectInputStream.readObject();
}
catch ( ClassNotFoundException e) {
throw new CarbonUtilException("Problem while reading the slicemeta data file " + file.getAbsolutePath(),e);
}
catch ( IOException e) {
throw new CarbonUtilException("Problem while reading the slicemeta data file ",e);
}
finally {
closeStreams(objectInputStream,stream);
}
return readObject;
}
| This method will be used to read the slice metadata |
private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
}
| Writes the AffineTrassform object to the output steam. |
public static void warn(String tag,String text){
try {
Log.w(tag,getFormattedLogLine() + text);
}
catch ( OutOfMemoryError error) {
error.printStackTrace();
}
catch ( Exception exception) {
exception.printStackTrace();
}
}
| Log warn extendido |
public boolean parse(){
BStack=new BracketStack();
BStack.newClass();
BStack.registerInCurrentClass(AND);
BStack.newClass();
BStack.registerInCurrentClass(OR);
BStack.newClass();
BStack.registerInCurrentClass(PROOF);
BStack.newClass();
BStack.registerInCurrentClass(LBR);
BStack.newClass();
BStack.registerInCurrentClass(ASSUME);
try {
ParseTree=CompilationUnit();
}
catch ( ParseException e) {
PErrors.push(new ParseError(msgStackToString(e)));
}
catch ( TokenMgrError tme) {
String msg=tme.getMessage();
int bl=jj_input_stream.getBeginLine() + 1;
int el=jj_input_stream.getEndLine() + 1;
if ((msg.indexOf("EOF") != -1) && (bl != el)) {
PErrors.push(new ParseError("Lexical {error: EOF reached, " + "possibly open comment starting around line " + (bl - 1)));
}
else PErrors.push(new ParseError(msg));
}
if (PErrors.empty()) Assert.check(heirsIndex == 0,EC.SANY_PARSER_CHECK_1);
else {
tla2sany.st.ParseError list[]=PErrors.errors();
for (int i=0; i < list.length; i++) {
ToolIO.out.println(list[i].reportedError());
}
}
return PErrors.empty();
}
| This is a stack of the kinds and offsets of the tokens that start a bulleted list within which the parser is currently grabbing tokens. |
void addOrReplaceDecls(XMLNSDecl newDecl){
int n=m_prefixTable.size();
for (int i=n - 1; i >= 0; i--) {
XMLNSDecl decl=(XMLNSDecl)m_prefixTable.get(i);
if (decl.getPrefix().equals(newDecl.getPrefix())) {
return;
}
}
m_prefixTable.add(newDecl);
}
| Add or replace this namespace declaration in list of namespaces in scope for this element. |
protected ChangeDescriptor(){
}
| Creates a new change descriptor. |
PortTcp port(){
return _port;
}
| Returns the port which generated the connection. |
public static final String portDisplayTextFunction(Interface iface){
String string;
if (iface.hasSpecifiedName()) {
string=String.format("%s %s",iface.getName(),iface.getPort().getDisplayText());
}
else {
string=iface.getPort().getDisplayText();
}
return string;
}
| Pluggable toString for a Port and MAC address. |
public void visitFieldInsn(int opcode,String owner,String name,String desc){
if (mv != null) {
mv.visitFieldInsn(opcode,owner,name,desc);
}
}
| Visits a field instruction. A field instruction is an instruction that loads or stores the value of a field of an object. |
public boolean visit(final int depth,final Value predecessor){
if (this.depth.compareAndSet(-1,depth)) {
this.predecessor.set(predecessor);
return true;
}
return false;
}
| Note: This marks the vertex at the current traversal depth. |
@Override public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
cardboardAudioEngine=new GvrAudioEngine(this,GvrAudioEngine.RenderingMode.BINAURAL_HIGH_QUALITY);
setMain(new SpatialAudioMain(cardboardAudioEngine),"gvr.xml");
}
| Called when the activity is first created. |
public DataFilterCriteria.Builder<Select<T>> openBracketOr(){
return new DataFilterCriteria.Builder<>(this,DataFilterClause.DataFilterConjunction.OR);
}
| Starts a new Criteria builder with OR conjunction |
protected void putChar(char ch,boolean scan){
sbuf=ArrayUtils.ensureCapacity(sbuf,sp);
sbuf[sp++]=ch;
if (scan) scanChar();
}
| Append a character to sbuf. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.